@sequenzy/mcp 0.0.67 → 0.0.69
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 +11 -11
- package/dist/server.js +9 -9
- package/package.json +1 -1
- package/server.json +2 -2
package/dist/server.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
var s5=Object.create;var{getPrototypeOf:e5,defineProperty:EQ,getOwnPropertyNames:QH}=Object;var YH=Object.prototype.hasOwnProperty;function XH(Q){return this[Q]}var WH,GH,eY=(Q,Y,X)=>{var W=Q!=null&&typeof Q==="object";if(W){var G=Y?WH??=new WeakMap:GH??=new WeakMap,$=G.get(Q);if($)return $}X=Q!=null?s5(e5(Q)):{};let z=Y||!Q||!Q.__esModule?EQ(X,"default",{value:Q,enumerable:!0}):X;for(let J of QH(Q))if(!YH.call(z,J))EQ(z,J,{get:XH.bind(Q,J),enumerable:!0});if(W)G.set(Q,z);return z};var j=(Q,Y)=>()=>(Y||Q((Y={exports:{}}).exports,Y),Y.exports);var $H=(Q)=>Q;function zH(Q,Y){this[Q]=$H.bind(null,Y)}var QX=(Q,Y)=>{for(var X in Y)EQ(Q,X,{get:Y[X],enumerable:!0,configurable:!0,set:zH.bind(Y,X)})};var E6=j((tG)=>{Object.defineProperty(tG,"__esModule",{value:!0});tG.regexpCode=tG.getEsmExportName=tG.getProperty=tG.safeStringify=tG.stringify=tG.strConcat=tG.addCodeArg=tG.str=tG._=tG.nil=tG._Code=tG.Name=tG.IDENTIFIER=tG._CodeOrName=void 0;class _4{}tG._CodeOrName=_4;tG.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class h1 extends _4{constructor(Q){super();if(!tG.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}}}tG.Name=h1;class x0 extends _4{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((Y,X)=>`${Y}${X}`,"")}get names(){var Q;return(Q=this._names)!==null&&Q!==void 0?Q:this._names=this._items.reduce((Y,X)=>{if(X instanceof h1)Y[X.str]=(Y[X.str]||0)+1;return Y},{})}}tG._Code=x0;tG.nil=new x0("");function dG(Q,...Y){let X=[Q[0]],W=0;while(W<Y.length)g9(X,Y[W]),X.push(Q[++W]);return new x0(X)}tG._=dG;var _9=new x0("+");function oG(Q,...Y){let X=[I6(Q[0])],W=0;while(W<Y.length)X.push(_9),g9(X,Y[W]),X.push(_9,I6(Q[++W]));return SA(X),new x0(X)}tG.str=oG;function g9(Q,Y){if(Y instanceof x0)Q.push(...Y._items);else if(Y instanceof h1)Q.push(Y);else Q.push(kA(Y))}tG.addCodeArg=g9;function SA(Q){let Y=1;while(Y<Q.length-1){if(Q[Y]===_9){let X=RA(Q[Y-1],Q[Y+1]);if(X!==void 0){Q.splice(Y-1,3,X);continue}Q[Y++]="+"}Y++}}function RA(Q,Y){if(Y==='""')return Q;if(Q==='""')return Y;if(typeof Q=="string"){if(Y instanceof h1||Q[Q.length-1]!=='"')return;if(typeof Y!="string")return`${Q.slice(0,-1)}${Y}"`;if(Y[0]==='"')return Q.slice(0,-1)+Y.slice(1);return}if(typeof Y=="string"&&Y[0]==='"'&&!(Q instanceof h1))return`"${Q}${Y.slice(1)}`;return}function CA(Q,Y){return Y.emptyStr()?Q:Q.emptyStr()?Y:oG`${Q}${Y}`}tG.strConcat=CA;function kA(Q){return typeof Q=="number"||typeof Q=="boolean"||Q===null?Q:I6(Array.isArray(Q)?Q.join(","):Q)}function vA(Q){return new x0(I6(Q))}tG.stringify=vA;function I6(Q){return JSON.stringify(Q).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}tG.safeStringify=I6;function xA(Q){return typeof Q=="string"&&tG.IDENTIFIER.test(Q)?new x0(`.${Q}`):dG`[${Q}]`}tG.getProperty=xA;function _A(Q){if(typeof Q=="string"&&tG.IDENTIFIER.test(Q))return new x0(`${Q}`);throw Error(`CodeGen: invalid export name: ${Q}, use explicit $id name mapping`)}tG.getEsmExportName=_A;function gA(Q){return new x0(Q.toString())}tG.regexpCode=gA});var f9=j((Q$)=>{Object.defineProperty(Q$,"__esModule",{value:!0});Q$.ValueScope=Q$.ValueScopeName=Q$.Scope=Q$.varKinds=Q$.UsedValueState=void 0;var V0=E6();class sG extends Error{constructor(Q){super(`CodeGen: "code" for ${Q} not defined`);this.value=Q.value}}var y4;(function(Q){Q[Q.Started=0]="Started",Q[Q.Completed=1]="Completed"})(y4||(Q$.UsedValueState=y4={}));Q$.varKinds={const:new V0.Name("const"),let:new V0.Name("let"),var:new V0.Name("var")};class u9{constructor({prefixes:Q,parent:Y}={}){this._names={},this._prefixes=Q,this._parent=Y}toName(Q){return Q instanceof V0.Name?Q:this.name(Q)}name(Q){return new V0.Name(this._newName(Q))}_newName(Q){let Y=this._names[Q]||this._nameGroup(Q);return`${Q}${Y.index++}`}_nameGroup(Q){var Y,X;if(((X=(Y=this._parent)===null||Y===void 0?void 0:Y._prefixes)===null||X===void 0?void 0:X.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}}}Q$.Scope=u9;class h9 extends V0.Name{constructor(Q,Y){super(Y);this.prefix=Q}setValue(Q,{property:Y,itemIndex:X}){this.value=Q,this.scopePath=V0._`.${new V0.Name(Y)}[${X}]`}}Q$.ValueScopeName=h9;var oA=V0._`\n`;class eG extends u9{constructor(Q){super(Q);this._values={},this._scope=Q.scope,this.opts={...Q,_n:Q.lines?oA:V0.nil}}get(){return this._scope}name(Q){return new h9(Q,this._newName(Q))}value(Q,Y){var X;if(Y.ref===void 0)throw Error("CodeGen: ref must be passed in value");let W=this.toName(Q),{prefix:G}=W,$=(X=Y.key)!==null&&X!==void 0?X:Y.ref,z=this._values[G];if(z){let U=z.get($);if(U)return U}else z=this._values[G]=new Map;z.set($,W);let J=this._scope[G]||(this._scope[G]=[]),H=J.length;return J[H]=Y.ref,W.setValue(Y,{property:G,itemIndex:H}),W}getValue(Q,Y){let X=this._values[Q];if(!X)return;return X.get(Y)}scopeRefs(Q,Y=this._values){return this._reduceValues(Y,(X)=>{if(X.scopePath===void 0)throw Error(`CodeGen: name "${X}" has no value`);return V0._`${Q}${X.scopePath}`})}scopeCode(Q=this._values,Y,X){return this._reduceValues(Q,(W)=>{if(W.value===void 0)throw Error(`CodeGen: name "${W}" has no value`);return W.value.code},Y,X)}_reduceValues(Q,Y,X={},W){let G=V0.nil;for(let $ in Q){let z=Q[$];if(!z)continue;let J=X[$]=X[$]||new Map;z.forEach((H)=>{if(J.has(H))return;J.set(H,y4.Started);let U=Y(H);if(U){let A=this.opts.es5?Q$.varKinds.var:Q$.varKinds.const;G=V0._`${G}${A} ${H} = ${U};${this.opts._n}`}else if(U=W===null||W===void 0?void 0:W(H))G=V0._`${G}${U}${this.opts._n}`;else throw new sG(H);J.set(H,y4.Completed)})}return G}}Q$.ValueScope=eG});var g=j((N0)=>{Object.defineProperty(N0,"__esModule",{value:!0});N0.or=N0.and=N0.not=N0.CodeGen=N0.operators=N0.varKinds=N0.ValueScopeName=N0.ValueScope=N0.Scope=N0.Name=N0.regexpCode=N0.stringify=N0.getProperty=N0.nil=N0.strConcat=N0.str=N0._=void 0;var f=E6(),_0=f9(),B1=E6();Object.defineProperty(N0,"_",{enumerable:!0,get:function(){return B1._}});Object.defineProperty(N0,"str",{enumerable:!0,get:function(){return B1.str}});Object.defineProperty(N0,"strConcat",{enumerable:!0,get:function(){return B1.strConcat}});Object.defineProperty(N0,"nil",{enumerable:!0,get:function(){return B1.nil}});Object.defineProperty(N0,"getProperty",{enumerable:!0,get:function(){return B1.getProperty}});Object.defineProperty(N0,"stringify",{enumerable:!0,get:function(){return B1.stringify}});Object.defineProperty(N0,"regexpCode",{enumerable:!0,get:function(){return B1.regexpCode}});Object.defineProperty(N0,"Name",{enumerable:!0,get:function(){return B1.Name}});var c4=f9();Object.defineProperty(N0,"Scope",{enumerable:!0,get:function(){return c4.Scope}});Object.defineProperty(N0,"ValueScope",{enumerable:!0,get:function(){return c4.ValueScope}});Object.defineProperty(N0,"ValueScopeName",{enumerable:!0,get:function(){return c4.ValueScopeName}});Object.defineProperty(N0,"varKinds",{enumerable:!0,get:function(){return c4.varKinds}});N0.operators={GT:new f._Code(">"),GTE:new f._Code(">="),LT:new f._Code("<"),LTE:new f._Code("<="),EQ:new f._Code("==="),NEQ:new f._Code("!=="),NOT:new f._Code("!"),OR:new f._Code("||"),AND:new f._Code("&&"),ADD:new f._Code("+")};class K1{optimizeNodes(){return this}optimizeNames(Q,Y){return this}}class X$ extends K1{constructor(Q,Y,X){super();this.varKind=Q,this.name=Y,this.rhs=X}render({es5:Q,_n:Y}){let X=Q?_0.varKinds.var:this.varKind,W=this.rhs===void 0?"":` = ${this.rhs}`;return`${X} ${this.name}${W};`+Y}optimizeNames(Q,Y){if(!Q[this.name.str])return;if(this.rhs)this.rhs=l1(this.rhs,Q,Y);return this}get names(){return this.rhs instanceof f._CodeOrName?this.rhs.names:{}}}class c9 extends K1{constructor(Q,Y,X){super();this.lhs=Q,this.rhs=Y,this.sideEffects=X}render({_n:Q}){return`${this.lhs} = ${this.rhs};`+Q}optimizeNames(Q,Y){if(this.lhs instanceof f.Name&&!Q[this.lhs.str]&&!this.sideEffects)return;return this.rhs=l1(this.rhs,Q,Y),this}get names(){let Q=this.lhs instanceof f.Name?{}:{...this.lhs.names};return m4(Q,this.rhs)}}class W$ extends c9{constructor(Q,Y,X,W){super(Q,X,W);this.op=Y}render({_n:Q}){return`${this.lhs} ${this.op}= ${this.rhs};`+Q}}class G$ extends K1{constructor(Q){super();this.label=Q,this.names={}}render({_n:Q}){return`${this.label}:`+Q}}class $$ extends K1{constructor(Q){super();this.label=Q,this.names={}}render({_n:Q}){return`break${this.label?` ${this.label}`:""};`+Q}}class z$ extends K1{constructor(Q){super();this.error=Q}render({_n:Q}){return`throw ${this.error};`+Q}get names(){return this.error.names}}class J$ extends K1{constructor(Q){super();this.code=Q}render({_n:Q}){return`${this.code};`+Q}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(Q,Y){return this.code=l1(this.code,Q,Y),this}get names(){return this.code instanceof f._CodeOrName?this.code.names:{}}}class p4 extends K1{constructor(Q=[]){super();this.nodes=Q}render(Q){return this.nodes.reduce((Y,X)=>Y+X.render(Q),"")}optimizeNodes(){let{nodes:Q}=this,Y=Q.length;while(Y--){let X=Q[Y].optimizeNodes();if(Array.isArray(X))Q.splice(Y,1,...X);else if(X)Q[Y]=X;else Q.splice(Y,1)}return Q.length>0?this:void 0}optimizeNames(Q,Y){let{nodes:X}=this,W=X.length;while(W--){let G=X[W];if(G.optimizeNames(Q,Y))continue;eA(Q,G.names),X.splice(W,1)}return X.length>0?this:void 0}get names(){return this.nodes.reduce((Q,Y)=>j1(Q,Y.names),{})}}class D1 extends p4{render(Q){return"{"+Q._n+super.render(Q)+"}"+Q._n}}class H$ extends p4{}class T6 extends D1{}T6.kind="else";class s0 extends D1{constructor(Q,Y){super(Y);this.condition=Q}render(Q){let Y=`if(${this.condition})`+super.render(Q);if(this.else)Y+="else "+this.else.render(Q);return Y}optimizeNodes(){super.optimizeNodes();let Q=this.condition;if(Q===!0)return this.nodes;let Y=this.else;if(Y){let X=Y.optimizeNodes();Y=this.else=Array.isArray(X)?new T6(X):X}if(Y){if(Q===!1)return Y instanceof s0?Y:Y.nodes;if(this.nodes.length)return this;return new s0(D$(Q),Y instanceof s0?[Y]:Y.nodes)}if(Q===!1||!this.nodes.length)return;return this}optimizeNames(Q,Y){var X;if(this.else=(X=this.else)===null||X===void 0?void 0:X.optimizeNames(Q,Y),!(super.optimizeNames(Q,Y)||this.else))return;return this.condition=l1(this.condition,Q,Y),this}get names(){let Q=super.names;if(m4(Q,this.condition),this.else)j1(Q,this.else.names);return Q}}s0.kind="if";class f1 extends D1{}f1.kind="for";class U$ extends f1{constructor(Q){super();this.iteration=Q}render(Q){return`for(${this.iteration})`+super.render(Q)}optimizeNames(Q,Y){if(!super.optimizeNames(Q,Y))return;return this.iteration=l1(this.iteration,Q,Y),this}get names(){return j1(super.names,this.iteration.names)}}class A$ extends f1{constructor(Q,Y,X,W){super();this.varKind=Q,this.name=Y,this.from=X,this.to=W}render(Q){let Y=Q.es5?_0.varKinds.var:this.varKind,{name:X,from:W,to:G}=this;return`for(${Y} ${X}=${W}; ${X}<${G}; ${X}++)`+super.render(Q)}get names(){let Q=m4(super.names,this.from);return m4(Q,this.to)}}class l9 extends f1{constructor(Q,Y,X,W){super();this.loop=Q,this.varKind=Y,this.name=X,this.iterable=W}render(Q){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(Q)}optimizeNames(Q,Y){if(!super.optimizeNames(Q,Y))return;return this.iterable=l1(this.iterable,Q,Y),this}get names(){return j1(super.names,this.iterable.names)}}class u4 extends D1{constructor(Q,Y,X){super();this.name=Q,this.args=Y,this.async=X}render(Q){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(Q)}}u4.kind="func";class h4 extends p4{render(Q){return"return "+super.render(Q)}}h4.kind="return";class B$ extends D1{render(Q){let Y="try"+super.render(Q);if(this.catch)Y+=this.catch.render(Q);if(this.finally)Y+=this.finally.render(Q);return Y}optimizeNodes(){var Q,Y;return super.optimizeNodes(),(Q=this.catch)===null||Q===void 0||Q.optimizeNodes(),(Y=this.finally)===null||Y===void 0||Y.optimizeNodes(),this}optimizeNames(Q,Y){var X,W;return super.optimizeNames(Q,Y),(X=this.catch)===null||X===void 0||X.optimizeNames(Q,Y),(W=this.finally)===null||W===void 0||W.optimizeNames(Q,Y),this}get names(){let Q=super.names;if(this.catch)j1(Q,this.catch.names);if(this.finally)j1(Q,this.finally.names);return Q}}class f4 extends D1{constructor(Q){super();this.error=Q}render(Q){return`catch(${this.error})`+super.render(Q)}}f4.kind="catch";class l4 extends D1{render(Q){return"finally"+super.render(Q)}}l4.kind="finally";class K${constructor(Q,Y={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...Y,_n:Y.lines?`
|
|
2
|
-
`:""},this._extScope=Q,this._scope=new _0.Scope({parent:Q}),this._nodes=[new H$]}toString(){return this._root.render(this.opts)}name(Q){return this._scope.name(Q)}scopeName(Q){return this._extScope.name(Q)}scopeValue(Q,Y){let X=this._extScope.value(Q,Y);return(this._values[X.prefix]||(this._values[X.prefix]=new Set)).add(X),X}getScopeValue(Q,Y){return this._extScope.getValue(Q,Y)}scopeRefs(Q){return this._extScope.scopeRefs(Q,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(Q,Y,X,W){let G=this._scope.toName(Y);if(X!==void 0&&W)this._constants[G.str]=X;return this._leafNode(new X$(Q,G,X)),G}const(Q,Y,X){return this._def(_0.varKinds.const,Q,Y,X)}let(Q,Y,X){return this._def(_0.varKinds.let,Q,Y,X)}var(Q,Y,X){return this._def(_0.varKinds.var,Q,Y,X)}assign(Q,Y,X){return this._leafNode(new c9(Q,Y,X))}add(Q,Y){return this._leafNode(new W$(Q,N0.operators.ADD,Y))}code(Q){if(typeof Q=="function")Q();else if(Q!==f.nil)this._leafNode(new J$(Q));return this}object(...Q){let Y=["{"];for(let[X,W]of Q){if(Y.length>1)Y.push(",");if(Y.push(X),X!==W||this.opts.es5)Y.push(":"),(0,f.addCodeArg)(Y,W)}return Y.push("}"),new f._Code(Y)}if(Q,Y,X){if(this._blockNode(new s0(Q)),Y&&X)this.code(Y).else().code(X).endIf();else if(Y)this.code(Y).endIf();else if(X)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(Q){return this._elseNode(new s0(Q))}else(){return this._elseNode(new T6)}endIf(){return this._endBlockNode(s0,T6)}_for(Q,Y){if(this._blockNode(Q),Y)this.code(Y).endFor();return this}for(Q,Y){return this._for(new U$(Q),Y)}forRange(Q,Y,X,W,G=this.opts.es5?_0.varKinds.var:_0.varKinds.let){let $=this._scope.toName(Q);return this._for(new A$(G,$,Y,X),()=>W($))}forOf(Q,Y,X,W=_0.varKinds.const){let G=this._scope.toName(Q);if(this.opts.es5){let $=Y instanceof f.Name?Y:this.var("_arr",Y);return this.forRange("_i",0,f._`${$}.length`,(z)=>{this.var(G,f._`${$}[${z}]`),X(G)})}return this._for(new l9("of",W,G,Y),()=>X(G))}forIn(Q,Y,X,W=this.opts.es5?_0.varKinds.var:_0.varKinds.const){if(this.opts.ownProperties)return this.forOf(Q,f._`Object.keys(${Y})`,X);let G=this._scope.toName(Q);return this._for(new l9("in",W,G,Y),()=>X(G))}endFor(){return this._endBlockNode(f1)}label(Q){return this._leafNode(new G$(Q))}break(Q){return this._leafNode(new $$(Q))}return(Q){let Y=new h4;if(this._blockNode(Y),this.code(Q),Y.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(h4)}try(Q,Y,X){if(!Y&&!X)throw Error('CodeGen: "try" without "catch" and "finally"');let W=new B$;if(this._blockNode(W),this.code(Q),Y){let G=this.name("e");this._currNode=W.catch=new f4(G),Y(G)}if(X)this._currNode=W.finally=new l4,this.code(X);return this._endBlockNode(f4,l4)}throw(Q){return this._leafNode(new z$(Q))}block(Q,Y){if(this._blockStarts.push(this._nodes.length),Q)this.code(Q).endBlock(Y);return this}endBlock(Q){let Y=this._blockStarts.pop();if(Y===void 0)throw Error("CodeGen: not in self-balancing block");let X=this._nodes.length-Y;if(X<0||Q!==void 0&&X!==Q)throw Error(`CodeGen: wrong number of nodes: ${X} vs ${Q} expected`);return this._nodes.length=Y,this}func(Q,Y=f.nil,X,W){if(this._blockNode(new u4(Q,Y,X)),W)this.code(W).endFunc();return this}endFunc(){return this._endBlockNode(u4)}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,Y){let X=this._currNode;if(X instanceof Q||Y&&X instanceof Y)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${Y?`${Q.kind}/${Y.kind}`:Q.kind}"`)}_elseNode(Q){let Y=this._currNode;if(!(Y instanceof s0))throw Error('CodeGen: "else" without "if"');return this._currNode=Y.else=Q,this}get _root(){return this._nodes[0]}get _currNode(){let Q=this._nodes;return Q[Q.length-1]}set _currNode(Q){let Y=this._nodes;Y[Y.length-1]=Q}}N0.CodeGen=K$;function j1(Q,Y){for(let X in Y)Q[X]=(Q[X]||0)+(Y[X]||0);return Q}function m4(Q,Y){return Y instanceof f._CodeOrName?j1(Q,Y.names):Q}function l1(Q,Y,X){if(Q instanceof f.Name)return W(Q);if(!G(Q))return Q;return new f._Code(Q._items.reduce(($,z)=>{if(z instanceof f.Name)z=W(z);if(z instanceof f._Code)$.push(...z._items);else $.push(z);return $},[]));function W($){let z=X[$.str];if(z===void 0||Y[$.str]!==1)return $;return delete Y[$.str],z}function G($){return $ instanceof f._Code&&$._items.some((z)=>z instanceof f.Name&&Y[z.str]===1&&X[z.str]!==void 0)}}function eA(Q,Y){for(let X in Y)Q[X]=(Q[X]||0)-(Y[X]||0)}function D$(Q){return typeof Q=="boolean"||typeof Q=="number"||Q===null?!Q:f._`!${m9(Q)}`}N0.not=D$;var QB=L$(N0.operators.AND);function YB(...Q){return Q.reduce(QB)}N0.and=YB;var XB=L$(N0.operators.OR);function WB(...Q){return Q.reduce(XB)}N0.or=WB;function L$(Q){return(Y,X)=>Y===f.nil?X:X===f.nil?Y:f._`${m9(Y)} ${Q} ${m9(X)}`}function m9(Q){return Q instanceof f.Name?Q:f._`(${Q})`}});var c=j((j$)=>{Object.defineProperty(j$,"__esModule",{value:!0});j$.checkStrictMode=j$.getErrorPath=j$.Type=j$.useFunc=j$.setEvaluated=j$.evaluatedPropsToName=j$.mergeEvaluated=j$.eachItem=j$.unescapeJsonPointer=j$.escapeJsonPointer=j$.escapeFragment=j$.unescapeFragment=j$.schemaRefOrVal=j$.schemaHasRulesButRef=j$.schemaHasRules=j$.checkUnknownRules=j$.alwaysValidSchema=j$.toHash=void 0;var n=g(),JB=E6();function HB(Q){let Y={};for(let X of Q)Y[X]=!0;return Y}j$.toHash=HB;function UB(Q,Y){if(typeof Y=="boolean")return Y;if(Object.keys(Y).length===0)return!0;return M$(Q,Y),!V$(Y,Q.self.RULES.all)}j$.alwaysValidSchema=UB;function M$(Q,Y=Q.schema){let{opts:X,self:W}=Q;if(!X.strictSchema)return;if(typeof Y==="boolean")return;let G=W.RULES.keywords;for(let $ in Y)if(!G[$])w$(Q,`unknown keyword: "${$}"`)}j$.checkUnknownRules=M$;function V$(Q,Y){if(typeof Q=="boolean")return!Q;for(let X in Q)if(Y[X])return!0;return!1}j$.schemaHasRules=V$;function AB(Q,Y){if(typeof Q=="boolean")return!Q;for(let X in Q)if(X!=="$ref"&&Y.all[X])return!0;return!1}j$.schemaHasRulesButRef=AB;function BB({topSchemaRef:Q,schemaPath:Y},X,W,G){if(!G){if(typeof X=="number"||typeof X=="boolean")return X;if(typeof X=="string")return n._`${X}`}return n._`${Q}${Y}${(0,n.getProperty)(W)}`}j$.schemaRefOrVal=BB;function KB(Q){return N$(decodeURIComponent(Q))}j$.unescapeFragment=KB;function DB(Q){return encodeURIComponent(i9(Q))}j$.escapeFragment=DB;function i9(Q){if(typeof Q=="number")return`${Q}`;return Q.replace(/~/g,"~0").replace(/\//g,"~1")}j$.escapeJsonPointer=i9;function N$(Q){return Q.replace(/~1/g,"/").replace(/~0/g,"~")}j$.unescapeJsonPointer=N$;function LB(Q,Y){if(Array.isArray(Q))for(let X of Q)Y(X);else Y(Q)}j$.eachItem=LB;function q$({mergeNames:Q,mergeToName:Y,mergeValues:X,resultToName:W}){return(G,$,z,J)=>{let H=z===void 0?$:z instanceof n.Name?($ instanceof n.Name?Q(G,$,z):Y(G,$,z),z):$ instanceof n.Name?(Y(G,z,$),$):X($,z);return J===n.Name&&!(H instanceof n.Name)?W(G,H):H}}j$.mergeEvaluated={props:q$({mergeNames:(Q,Y,X)=>Q.if(n._`${X} !== true && ${Y} !== undefined`,()=>{Q.if(n._`${Y} === true`,()=>Q.assign(X,!0),()=>Q.assign(X,n._`${X} || {}`).code(n._`Object.assign(${X}, ${Y})`))}),mergeToName:(Q,Y,X)=>Q.if(n._`${X} !== true`,()=>{if(Y===!0)Q.assign(X,!0);else Q.assign(X,n._`${X} || {}`),n9(Q,X,Y)}),mergeValues:(Q,Y)=>Q===!0?!0:{...Q,...Y},resultToName:Z$}),items:q$({mergeNames:(Q,Y,X)=>Q.if(n._`${X} !== true && ${Y} !== undefined`,()=>Q.assign(X,n._`${Y} === true ? true : ${X} > ${Y} ? ${X} : ${Y}`)),mergeToName:(Q,Y,X)=>Q.if(n._`${X} !== true`,()=>Q.assign(X,Y===!0?!0:n._`${X} > ${Y} ? ${X} : ${Y}`)),mergeValues:(Q,Y)=>Q===!0?!0:Math.max(Q,Y),resultToName:(Q,Y)=>Q.var("items",Y)})};function Z$(Q,Y){if(Y===!0)return Q.var("props",!0);let X=Q.var("props",n._`{}`);if(Y!==void 0)n9(Q,X,Y);return X}j$.evaluatedPropsToName=Z$;function n9(Q,Y,X){Object.keys(X).forEach((W)=>Q.assign(n._`${Y}${(0,n.getProperty)(W)}`,!0))}j$.setEvaluated=n9;var O$={};function FB(Q,Y){return Q.scopeValue("func",{ref:Y,code:O$[Y.code]||(O$[Y.code]=new JB._Code(Y.code))})}j$.useFunc=FB;var p9;(function(Q){Q[Q.Num=0]="Num",Q[Q.Str=1]="Str"})(p9||(j$.Type=p9={}));function qB(Q,Y,X){if(Q instanceof n.Name){let W=Y===p9.Num;return X?W?n._`"[" + ${Q} + "]"`:n._`"['" + ${Q} + "']"`:W?n._`"/" + ${Q}`:n._`"/" + ${Q}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return X?(0,n.getProperty)(Q).toString():"/"+i9(Q)}j$.getErrorPath=qB;function w$(Q,Y,X=Q.opts.strictSchema){if(!X)return;if(Y=`strict mode: ${Y}`,X===!0)throw Error(Y);Q.self.logger.warn(Y)}j$.checkStrictMode=w$});var e0=j((b$)=>{Object.defineProperty(b$,"__esModule",{value:!0});var L0=g(),xB={data:new L0.Name("data"),valCxt:new L0.Name("valCxt"),instancePath:new L0.Name("instancePath"),parentData:new L0.Name("parentData"),parentDataProperty:new L0.Name("parentDataProperty"),rootData:new L0.Name("rootData"),dynamicAnchors:new L0.Name("dynamicAnchors"),vErrors:new L0.Name("vErrors"),errors:new L0.Name("errors"),this:new L0.Name("this"),self:new L0.Name("self"),scope:new L0.Name("scope"),json:new L0.Name("json"),jsonPos:new L0.Name("jsonPos"),jsonLen:new L0.Name("jsonLen"),jsonPart:new L0.Name("jsonPart")};b$.default=xB});var S6=j((S$)=>{Object.defineProperty(S$,"__esModule",{value:!0});S$.extendErrors=S$.resetErrorsCount=S$.reportExtraError=S$.reportError=S$.keyword$DataError=S$.keywordError=void 0;var l=g(),n4=c(),q0=e0();S$.keywordError={message:({keyword:Q})=>l.str`must pass "${Q}" keyword validation`};S$.keyword$DataError={message:({keyword:Q,schemaType:Y})=>Y?l.str`"${Q}" keyword must be ${Y} ($data)`:l.str`"${Q}" keyword is invalid ($data)`};function gB(Q,Y=S$.keywordError,X,W){let{it:G}=Q,{gen:$,compositeRule:z,allErrors:J}=G,H=T$(Q,Y,X);if(W!==null&&W!==void 0?W:z||J)I$($,H);else E$(G,l._`[${H}]`)}S$.reportError=gB;function yB(Q,Y=S$.keywordError,X){let{it:W}=Q,{gen:G,compositeRule:$,allErrors:z}=W,J=T$(Q,Y,X);if(I$(G,J),!($||z))E$(W,q0.default.vErrors)}S$.reportExtraError=yB;function uB(Q,Y){Q.assign(q0.default.errors,Y),Q.if(l._`${q0.default.vErrors} !== null`,()=>Q.if(Y,()=>Q.assign(l._`${q0.default.vErrors}.length`,Y),()=>Q.assign(q0.default.vErrors,null)))}S$.resetErrorsCount=uB;function hB({gen:Q,keyword:Y,schemaValue:X,data:W,errsCount:G,it:$}){if(G===void 0)throw Error("ajv implementation error");let z=Q.name("err");Q.forRange("i",G,q0.default.errors,(J)=>{if(Q.const(z,l._`${q0.default.vErrors}[${J}]`),Q.if(l._`${z}.instancePath === undefined`,()=>Q.assign(l._`${z}.instancePath`,(0,l.strConcat)(q0.default.instancePath,$.errorPath))),Q.assign(l._`${z}.schemaPath`,l.str`${$.errSchemaPath}/${Y}`),$.opts.verbose)Q.assign(l._`${z}.schema`,X),Q.assign(l._`${z}.data`,W)})}S$.extendErrors=hB;function I$(Q,Y){let X=Q.const("err",Y);Q.if(l._`${q0.default.vErrors} === null`,()=>Q.assign(q0.default.vErrors,l._`[${X}]`),l._`${q0.default.vErrors}.push(${X})`),Q.code(l._`${q0.default.errors}++`)}function E$(Q,Y){let{gen:X,validateName:W,schemaEnv:G}=Q;if(G.$async)X.throw(l._`new ${Q.ValidationError}(${Y})`);else X.assign(l._`${W}.errors`,Y),X.return(!1)}var P1={keyword:new l.Name("keyword"),schemaPath:new l.Name("schemaPath"),params:new l.Name("params"),propertyName:new l.Name("propertyName"),message:new l.Name("message"),schema:new l.Name("schema"),parentSchema:new l.Name("parentSchema")};function T$(Q,Y,X){let{createErrors:W}=Q.it;if(W===!1)return l._`{}`;return fB(Q,Y,X)}function fB(Q,Y,X={}){let{gen:W,it:G}=Q,$=[lB(G,X),mB(Q,X)];return cB(Q,Y,$),W.object(...$)}function lB({errorPath:Q},{instancePath:Y}){let X=Y?l.str`${Q}${(0,n4.getErrorPath)(Y,n4.Type.Str)}`:Q;return[q0.default.instancePath,(0,l.strConcat)(q0.default.instancePath,X)]}function mB({keyword:Q,it:{errSchemaPath:Y}},{schemaPath:X,parentSchema:W}){let G=W?Y:l.str`${Y}/${Q}`;if(X)G=l.str`${G}${(0,n4.getErrorPath)(X,n4.Type.Str)}`;return[P1.schemaPath,G]}function cB(Q,{params:Y,message:X},W){let{keyword:G,data:$,schemaValue:z,it:J}=Q,{opts:H,propertyName:U,topSchemaRef:A,schemaPath:B}=J;if(W.push([P1.keyword,G],[P1.params,typeof Y=="function"?Y(Q):Y||l._`{}`]),H.messages)W.push([P1.message,typeof X=="function"?X(Q):X]);if(H.verbose)W.push([P1.schema,z],[P1.parentSchema,l._`${A}${B}`],[q0.default.data,$]);if(U)W.push([P1.propertyName,U])}});var x$=j((k$)=>{Object.defineProperty(k$,"__esModule",{value:!0});k$.boolOrEmptySchema=k$.topBoolOrEmptySchema=void 0;var dB=S6(),oB=g(),tB=e0(),aB={message:"boolean schema is false"};function sB(Q){let{gen:Y,schema:X,validateName:W}=Q;if(X===!1)C$(Q,!1);else if(typeof X=="object"&&X.$async===!0)Y.return(tB.default.data);else Y.assign(oB._`${W}.errors`,null),Y.return(!0)}k$.topBoolOrEmptySchema=sB;function eB(Q,Y){let{gen:X,schema:W}=Q;if(W===!1)X.var(Y,!1),C$(Q);else X.var(Y,!0)}k$.boolOrEmptySchema=eB;function C$(Q,Y){let{gen:X,data:W}=Q,G={gen:X,keyword:"false schema",data:W,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:Q};(0,dB.reportError)(G,aB,void 0,Y)}});var d9=j((_$)=>{Object.defineProperty(_$,"__esModule",{value:!0});_$.getRules=_$.isJSONType=void 0;var YK=["string","number","integer","boolean","null","object","array"],XK=new Set(YK);function WK(Q){return typeof Q=="string"&&XK.has(Q)}_$.isJSONType=WK;function GK(){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:{}}}_$.getRules=GK});var o9=j((h$)=>{Object.defineProperty(h$,"__esModule",{value:!0});h$.shouldUseRule=h$.shouldUseGroup=h$.schemaHasRulesForType=void 0;function zK({schema:Q,self:Y},X){let W=Y.RULES.types[X];return W&&W!==!0&&y$(Q,W)}h$.schemaHasRulesForType=zK;function y$(Q,Y){return Y.rules.some((X)=>u$(Q,X))}h$.shouldUseGroup=y$;function u$(Q,Y){var X;return Q[Y.keyword]!==void 0||((X=Y.definition.implements)===null||X===void 0?void 0:X.some((W)=>Q[W]!==void 0))}h$.shouldUseRule=u$});var R6=j((p$)=>{Object.defineProperty(p$,"__esModule",{value:!0});p$.reportTypeError=p$.checkDataTypes=p$.checkDataType=p$.coerceAndCheckDataType=p$.getJSONTypes=p$.getSchemaTypes=p$.DataType=void 0;var UK=d9(),AK=o9(),BK=S6(),x=g(),l$=c(),m1;(function(Q){Q[Q.Correct=0]="Correct",Q[Q.Wrong=1]="Wrong"})(m1||(p$.DataType=m1={}));function KK(Q){let Y=m$(Q.type);if(Y.includes("null")){if(Q.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!Y.length&&Q.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');if(Q.nullable===!0)Y.push("null")}return Y}p$.getSchemaTypes=KK;function m$(Q){let Y=Array.isArray(Q)?Q:Q?[Q]:[];if(Y.every(UK.isJSONType))return Y;throw Error("type must be JSONType or JSONType[]: "+Y.join(","))}p$.getJSONTypes=m$;function DK(Q,Y){let{gen:X,data:W,opts:G}=Q,$=LK(Y,G.coerceTypes),z=Y.length>0&&!($.length===0&&Y.length===1&&(0,AK.schemaHasRulesForType)(Q,Y[0]));if(z){let J=a9(Y,W,G.strictNumbers,m1.Wrong);X.if(J,()=>{if($.length)FK(Q,Y,$);else s9(Q)})}return z}p$.coerceAndCheckDataType=DK;var c$=new Set(["string","number","integer","boolean","null"]);function LK(Q,Y){return Y?Q.filter((X)=>c$.has(X)||Y==="array"&&X==="array"):[]}function FK(Q,Y,X){let{gen:W,data:G,opts:$}=Q,z=W.let("dataType",x._`typeof ${G}`),J=W.let("coerced",x._`undefined`);if($.coerceTypes==="array")W.if(x._`${z} == 'object' && Array.isArray(${G}) && ${G}.length == 1`,()=>W.assign(G,x._`${G}[0]`).assign(z,x._`typeof ${G}`).if(a9(Y,G,$.strictNumbers),()=>W.assign(J,G)));W.if(x._`${J} !== undefined`);for(let U of X)if(c$.has(U)||U==="array"&&$.coerceTypes==="array")H(U);W.else(),s9(Q),W.endIf(),W.if(x._`${J} !== undefined`,()=>{W.assign(G,J),qK(Q,J)});function H(U){switch(U){case"string":W.elseIf(x._`${z} == "number" || ${z} == "boolean"`).assign(J,x._`"" + ${G}`).elseIf(x._`${G} === null`).assign(J,x._`""`);return;case"number":W.elseIf(x._`${z} == "boolean" || ${G} === null
|
|
1
|
+
var s5=Object.create;var{getPrototypeOf:e5,defineProperty:EQ,getOwnPropertyNames:QH}=Object;var YH=Object.prototype.hasOwnProperty;function XH(Q){return this[Q]}var WH,GH,QX=(Q,Y,X)=>{var W=Q!=null&&typeof Q==="object";if(W){var G=Y?WH??=new WeakMap:GH??=new WeakMap,$=G.get(Q);if($)return $}X=Q!=null?s5(e5(Q)):{};let z=Y||!Q||!Q.__esModule?EQ(X,"default",{value:Q,enumerable:!0}):X;for(let J of QH(Q))if(!YH.call(z,J))EQ(z,J,{get:XH.bind(Q,J),enumerable:!0});if(W)G.set(Q,z);return z};var j=(Q,Y)=>()=>(Y||Q((Y={exports:{}}).exports,Y),Y.exports);var $H=(Q)=>Q;function zH(Q,Y){this[Q]=$H.bind(null,Y)}var YX=(Q,Y)=>{for(var X in Y)EQ(Q,X,{get:Y[X],enumerable:!0,configurable:!0,set:zH.bind(Y,X)})};var T6=j((aG)=>{Object.defineProperty(aG,"__esModule",{value:!0});aG.regexpCode=aG.getEsmExportName=aG.getProperty=aG.safeStringify=aG.stringify=aG.strConcat=aG.addCodeArg=aG.str=aG._=aG.nil=aG._Code=aG.Name=aG.IDENTIFIER=aG._CodeOrName=void 0;class g4{}aG._CodeOrName=g4;aG.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class h1 extends g4{constructor(Q){super();if(!aG.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}}}aG.Name=h1;class x0 extends g4{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((Y,X)=>`${Y}${X}`,"")}get names(){var Q;return(Q=this._names)!==null&&Q!==void 0?Q:this._names=this._items.reduce((Y,X)=>{if(X instanceof h1)Y[X.str]=(Y[X.str]||0)+1;return Y},{})}}aG._Code=x0;aG.nil=new x0("");function oG(Q,...Y){let X=[Q[0]],W=0;while(W<Y.length)g9(X,Y[W]),X.push(Q[++W]);return new x0(X)}aG._=oG;var _9=new x0("+");function tG(Q,...Y){let X=[E6(Q[0])],W=0;while(W<Y.length)X.push(_9),g9(X,Y[W]),X.push(_9,E6(Q[++W]));return SA(X),new x0(X)}aG.str=tG;function g9(Q,Y){if(Y instanceof x0)Q.push(...Y._items);else if(Y instanceof h1)Q.push(Y);else Q.push(kA(Y))}aG.addCodeArg=g9;function SA(Q){let Y=1;while(Y<Q.length-1){if(Q[Y]===_9){let X=RA(Q[Y-1],Q[Y+1]);if(X!==void 0){Q.splice(Y-1,3,X);continue}Q[Y++]="+"}Y++}}function RA(Q,Y){if(Y==='""')return Q;if(Q==='""')return Y;if(typeof Q=="string"){if(Y instanceof h1||Q[Q.length-1]!=='"')return;if(typeof Y!="string")return`${Q.slice(0,-1)}${Y}"`;if(Y[0]==='"')return Q.slice(0,-1)+Y.slice(1);return}if(typeof Y=="string"&&Y[0]==='"'&&!(Q instanceof h1))return`"${Q}${Y.slice(1)}`;return}function CA(Q,Y){return Y.emptyStr()?Q:Q.emptyStr()?Y:tG`${Q}${Y}`}aG.strConcat=CA;function kA(Q){return typeof Q=="number"||typeof Q=="boolean"||Q===null?Q:E6(Array.isArray(Q)?Q.join(","):Q)}function vA(Q){return new x0(E6(Q))}aG.stringify=vA;function E6(Q){return JSON.stringify(Q).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}aG.safeStringify=E6;function xA(Q){return typeof Q=="string"&&aG.IDENTIFIER.test(Q)?new x0(`.${Q}`):oG`[${Q}]`}aG.getProperty=xA;function _A(Q){if(typeof Q=="string"&&aG.IDENTIFIER.test(Q))return new x0(`${Q}`);throw Error(`CodeGen: invalid export name: ${Q}, use explicit $id name mapping`)}aG.getEsmExportName=_A;function gA(Q){return new x0(Q.toString())}aG.regexpCode=gA});var f9=j((Y$)=>{Object.defineProperty(Y$,"__esModule",{value:!0});Y$.ValueScope=Y$.ValueScopeName=Y$.Scope=Y$.varKinds=Y$.UsedValueState=void 0;var V0=T6();class eG extends Error{constructor(Q){super(`CodeGen: "code" for ${Q} not defined`);this.value=Q.value}}var u4;(function(Q){Q[Q.Started=0]="Started",Q[Q.Completed=1]="Completed"})(u4||(Y$.UsedValueState=u4={}));Y$.varKinds={const:new V0.Name("const"),let:new V0.Name("let"),var:new V0.Name("var")};class u9{constructor({prefixes:Q,parent:Y}={}){this._names={},this._prefixes=Q,this._parent=Y}toName(Q){return Q instanceof V0.Name?Q:this.name(Q)}name(Q){return new V0.Name(this._newName(Q))}_newName(Q){let Y=this._names[Q]||this._nameGroup(Q);return`${Q}${Y.index++}`}_nameGroup(Q){var Y,X;if(((X=(Y=this._parent)===null||Y===void 0?void 0:Y._prefixes)===null||X===void 0?void 0:X.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}}}Y$.Scope=u9;class h9 extends V0.Name{constructor(Q,Y){super(Y);this.prefix=Q}setValue(Q,{property:Y,itemIndex:X}){this.value=Q,this.scopePath=V0._`.${new V0.Name(Y)}[${X}]`}}Y$.ValueScopeName=h9;var oA=V0._`\n`;class Q$ extends u9{constructor(Q){super(Q);this._values={},this._scope=Q.scope,this.opts={...Q,_n:Q.lines?oA:V0.nil}}get(){return this._scope}name(Q){return new h9(Q,this._newName(Q))}value(Q,Y){var X;if(Y.ref===void 0)throw Error("CodeGen: ref must be passed in value");let W=this.toName(Q),{prefix:G}=W,$=(X=Y.key)!==null&&X!==void 0?X:Y.ref,z=this._values[G];if(z){let U=z.get($);if(U)return U}else z=this._values[G]=new Map;z.set($,W);let J=this._scope[G]||(this._scope[G]=[]),H=J.length;return J[H]=Y.ref,W.setValue(Y,{property:G,itemIndex:H}),W}getValue(Q,Y){let X=this._values[Q];if(!X)return;return X.get(Y)}scopeRefs(Q,Y=this._values){return this._reduceValues(Y,(X)=>{if(X.scopePath===void 0)throw Error(`CodeGen: name "${X}" has no value`);return V0._`${Q}${X.scopePath}`})}scopeCode(Q=this._values,Y,X){return this._reduceValues(Q,(W)=>{if(W.value===void 0)throw Error(`CodeGen: name "${W}" has no value`);return W.value.code},Y,X)}_reduceValues(Q,Y,X={},W){let G=V0.nil;for(let $ in Q){let z=Q[$];if(!z)continue;let J=X[$]=X[$]||new Map;z.forEach((H)=>{if(J.has(H))return;J.set(H,u4.Started);let U=Y(H);if(U){let A=this.opts.es5?Y$.varKinds.var:Y$.varKinds.const;G=V0._`${G}${A} ${H} = ${U};${this.opts._n}`}else if(U=W===null||W===void 0?void 0:W(H))G=V0._`${G}${U}${this.opts._n}`;else throw new eG(H);J.set(H,u4.Completed)})}return G}}Y$.ValueScope=Q$});var g=j((N0)=>{Object.defineProperty(N0,"__esModule",{value:!0});N0.or=N0.and=N0.not=N0.CodeGen=N0.operators=N0.varKinds=N0.ValueScopeName=N0.ValueScope=N0.Scope=N0.Name=N0.regexpCode=N0.stringify=N0.getProperty=N0.nil=N0.strConcat=N0.str=N0._=void 0;var f=T6(),_0=f9(),B1=T6();Object.defineProperty(N0,"_",{enumerable:!0,get:function(){return B1._}});Object.defineProperty(N0,"str",{enumerable:!0,get:function(){return B1.str}});Object.defineProperty(N0,"strConcat",{enumerable:!0,get:function(){return B1.strConcat}});Object.defineProperty(N0,"nil",{enumerable:!0,get:function(){return B1.nil}});Object.defineProperty(N0,"getProperty",{enumerable:!0,get:function(){return B1.getProperty}});Object.defineProperty(N0,"stringify",{enumerable:!0,get:function(){return B1.stringify}});Object.defineProperty(N0,"regexpCode",{enumerable:!0,get:function(){return B1.regexpCode}});Object.defineProperty(N0,"Name",{enumerable:!0,get:function(){return B1.Name}});var p4=f9();Object.defineProperty(N0,"Scope",{enumerable:!0,get:function(){return p4.Scope}});Object.defineProperty(N0,"ValueScope",{enumerable:!0,get:function(){return p4.ValueScope}});Object.defineProperty(N0,"ValueScopeName",{enumerable:!0,get:function(){return p4.ValueScopeName}});Object.defineProperty(N0,"varKinds",{enumerable:!0,get:function(){return p4.varKinds}});N0.operators={GT:new f._Code(">"),GTE:new f._Code(">="),LT:new f._Code("<"),LTE:new f._Code("<="),EQ:new f._Code("==="),NEQ:new f._Code("!=="),NOT:new f._Code("!"),OR:new f._Code("||"),AND:new f._Code("&&"),ADD:new f._Code("+")};class K1{optimizeNodes(){return this}optimizeNames(Q,Y){return this}}class W$ extends K1{constructor(Q,Y,X){super();this.varKind=Q,this.name=Y,this.rhs=X}render({es5:Q,_n:Y}){let X=Q?_0.varKinds.var:this.varKind,W=this.rhs===void 0?"":` = ${this.rhs}`;return`${X} ${this.name}${W};`+Y}optimizeNames(Q,Y){if(!Q[this.name.str])return;if(this.rhs)this.rhs=l1(this.rhs,Q,Y);return this}get names(){return this.rhs instanceof f._CodeOrName?this.rhs.names:{}}}class c9 extends K1{constructor(Q,Y,X){super();this.lhs=Q,this.rhs=Y,this.sideEffects=X}render({_n:Q}){return`${this.lhs} = ${this.rhs};`+Q}optimizeNames(Q,Y){if(this.lhs instanceof f.Name&&!Q[this.lhs.str]&&!this.sideEffects)return;return this.rhs=l1(this.rhs,Q,Y),this}get names(){let Q=this.lhs instanceof f.Name?{}:{...this.lhs.names};return c4(Q,this.rhs)}}class G$ extends c9{constructor(Q,Y,X,W){super(Q,X,W);this.op=Y}render({_n:Q}){return`${this.lhs} ${this.op}= ${this.rhs};`+Q}}class $$ extends K1{constructor(Q){super();this.label=Q,this.names={}}render({_n:Q}){return`${this.label}:`+Q}}class z$ extends K1{constructor(Q){super();this.label=Q,this.names={}}render({_n:Q}){return`break${this.label?` ${this.label}`:""};`+Q}}class J$ extends K1{constructor(Q){super();this.error=Q}render({_n:Q}){return`throw ${this.error};`+Q}get names(){return this.error.names}}class H$ extends K1{constructor(Q){super();this.code=Q}render({_n:Q}){return`${this.code};`+Q}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(Q,Y){return this.code=l1(this.code,Q,Y),this}get names(){return this.code instanceof f._CodeOrName?this.code.names:{}}}class i4 extends K1{constructor(Q=[]){super();this.nodes=Q}render(Q){return this.nodes.reduce((Y,X)=>Y+X.render(Q),"")}optimizeNodes(){let{nodes:Q}=this,Y=Q.length;while(Y--){let X=Q[Y].optimizeNodes();if(Array.isArray(X))Q.splice(Y,1,...X);else if(X)Q[Y]=X;else Q.splice(Y,1)}return Q.length>0?this:void 0}optimizeNames(Q,Y){let{nodes:X}=this,W=X.length;while(W--){let G=X[W];if(G.optimizeNames(Q,Y))continue;eA(Q,G.names),X.splice(W,1)}return X.length>0?this:void 0}get names(){return this.nodes.reduce((Q,Y)=>j1(Q,Y.names),{})}}class D1 extends i4{render(Q){return"{"+Q._n+super.render(Q)+"}"+Q._n}}class U$ extends i4{}class S6 extends D1{}S6.kind="else";class s0 extends D1{constructor(Q,Y){super(Y);this.condition=Q}render(Q){let Y=`if(${this.condition})`+super.render(Q);if(this.else)Y+="else "+this.else.render(Q);return Y}optimizeNodes(){super.optimizeNodes();let Q=this.condition;if(Q===!0)return this.nodes;let Y=this.else;if(Y){let X=Y.optimizeNodes();Y=this.else=Array.isArray(X)?new S6(X):X}if(Y){if(Q===!1)return Y instanceof s0?Y:Y.nodes;if(this.nodes.length)return this;return new s0(L$(Q),Y instanceof s0?[Y]:Y.nodes)}if(Q===!1||!this.nodes.length)return;return this}optimizeNames(Q,Y){var X;if(this.else=(X=this.else)===null||X===void 0?void 0:X.optimizeNames(Q,Y),!(super.optimizeNames(Q,Y)||this.else))return;return this.condition=l1(this.condition,Q,Y),this}get names(){let Q=super.names;if(c4(Q,this.condition),this.else)j1(Q,this.else.names);return Q}}s0.kind="if";class f1 extends D1{}f1.kind="for";class A$ extends f1{constructor(Q){super();this.iteration=Q}render(Q){return`for(${this.iteration})`+super.render(Q)}optimizeNames(Q,Y){if(!super.optimizeNames(Q,Y))return;return this.iteration=l1(this.iteration,Q,Y),this}get names(){return j1(super.names,this.iteration.names)}}class B$ extends f1{constructor(Q,Y,X,W){super();this.varKind=Q,this.name=Y,this.from=X,this.to=W}render(Q){let Y=Q.es5?_0.varKinds.var:this.varKind,{name:X,from:W,to:G}=this;return`for(${Y} ${X}=${W}; ${X}<${G}; ${X}++)`+super.render(Q)}get names(){let Q=c4(super.names,this.from);return c4(Q,this.to)}}class l9 extends f1{constructor(Q,Y,X,W){super();this.loop=Q,this.varKind=Y,this.name=X,this.iterable=W}render(Q){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(Q)}optimizeNames(Q,Y){if(!super.optimizeNames(Q,Y))return;return this.iterable=l1(this.iterable,Q,Y),this}get names(){return j1(super.names,this.iterable.names)}}class h4 extends D1{constructor(Q,Y,X){super();this.name=Q,this.args=Y,this.async=X}render(Q){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(Q)}}h4.kind="func";class f4 extends i4{render(Q){return"return "+super.render(Q)}}f4.kind="return";class K$ extends D1{render(Q){let Y="try"+super.render(Q);if(this.catch)Y+=this.catch.render(Q);if(this.finally)Y+=this.finally.render(Q);return Y}optimizeNodes(){var Q,Y;return super.optimizeNodes(),(Q=this.catch)===null||Q===void 0||Q.optimizeNodes(),(Y=this.finally)===null||Y===void 0||Y.optimizeNodes(),this}optimizeNames(Q,Y){var X,W;return super.optimizeNames(Q,Y),(X=this.catch)===null||X===void 0||X.optimizeNames(Q,Y),(W=this.finally)===null||W===void 0||W.optimizeNames(Q,Y),this}get names(){let Q=super.names;if(this.catch)j1(Q,this.catch.names);if(this.finally)j1(Q,this.finally.names);return Q}}class l4 extends D1{constructor(Q){super();this.error=Q}render(Q){return`catch(${this.error})`+super.render(Q)}}l4.kind="catch";class m4 extends D1{render(Q){return"finally"+super.render(Q)}}m4.kind="finally";class D${constructor(Q,Y={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...Y,_n:Y.lines?`
|
|
2
|
+
`:""},this._extScope=Q,this._scope=new _0.Scope({parent:Q}),this._nodes=[new U$]}toString(){return this._root.render(this.opts)}name(Q){return this._scope.name(Q)}scopeName(Q){return this._extScope.name(Q)}scopeValue(Q,Y){let X=this._extScope.value(Q,Y);return(this._values[X.prefix]||(this._values[X.prefix]=new Set)).add(X),X}getScopeValue(Q,Y){return this._extScope.getValue(Q,Y)}scopeRefs(Q){return this._extScope.scopeRefs(Q,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(Q,Y,X,W){let G=this._scope.toName(Y);if(X!==void 0&&W)this._constants[G.str]=X;return this._leafNode(new W$(Q,G,X)),G}const(Q,Y,X){return this._def(_0.varKinds.const,Q,Y,X)}let(Q,Y,X){return this._def(_0.varKinds.let,Q,Y,X)}var(Q,Y,X){return this._def(_0.varKinds.var,Q,Y,X)}assign(Q,Y,X){return this._leafNode(new c9(Q,Y,X))}add(Q,Y){return this._leafNode(new G$(Q,N0.operators.ADD,Y))}code(Q){if(typeof Q=="function")Q();else if(Q!==f.nil)this._leafNode(new H$(Q));return this}object(...Q){let Y=["{"];for(let[X,W]of Q){if(Y.length>1)Y.push(",");if(Y.push(X),X!==W||this.opts.es5)Y.push(":"),(0,f.addCodeArg)(Y,W)}return Y.push("}"),new f._Code(Y)}if(Q,Y,X){if(this._blockNode(new s0(Q)),Y&&X)this.code(Y).else().code(X).endIf();else if(Y)this.code(Y).endIf();else if(X)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(Q){return this._elseNode(new s0(Q))}else(){return this._elseNode(new S6)}endIf(){return this._endBlockNode(s0,S6)}_for(Q,Y){if(this._blockNode(Q),Y)this.code(Y).endFor();return this}for(Q,Y){return this._for(new A$(Q),Y)}forRange(Q,Y,X,W,G=this.opts.es5?_0.varKinds.var:_0.varKinds.let){let $=this._scope.toName(Q);return this._for(new B$(G,$,Y,X),()=>W($))}forOf(Q,Y,X,W=_0.varKinds.const){let G=this._scope.toName(Q);if(this.opts.es5){let $=Y instanceof f.Name?Y:this.var("_arr",Y);return this.forRange("_i",0,f._`${$}.length`,(z)=>{this.var(G,f._`${$}[${z}]`),X(G)})}return this._for(new l9("of",W,G,Y),()=>X(G))}forIn(Q,Y,X,W=this.opts.es5?_0.varKinds.var:_0.varKinds.const){if(this.opts.ownProperties)return this.forOf(Q,f._`Object.keys(${Y})`,X);let G=this._scope.toName(Q);return this._for(new l9("in",W,G,Y),()=>X(G))}endFor(){return this._endBlockNode(f1)}label(Q){return this._leafNode(new $$(Q))}break(Q){return this._leafNode(new z$(Q))}return(Q){let Y=new f4;if(this._blockNode(Y),this.code(Q),Y.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(f4)}try(Q,Y,X){if(!Y&&!X)throw Error('CodeGen: "try" without "catch" and "finally"');let W=new K$;if(this._blockNode(W),this.code(Q),Y){let G=this.name("e");this._currNode=W.catch=new l4(G),Y(G)}if(X)this._currNode=W.finally=new m4,this.code(X);return this._endBlockNode(l4,m4)}throw(Q){return this._leafNode(new J$(Q))}block(Q,Y){if(this._blockStarts.push(this._nodes.length),Q)this.code(Q).endBlock(Y);return this}endBlock(Q){let Y=this._blockStarts.pop();if(Y===void 0)throw Error("CodeGen: not in self-balancing block");let X=this._nodes.length-Y;if(X<0||Q!==void 0&&X!==Q)throw Error(`CodeGen: wrong number of nodes: ${X} vs ${Q} expected`);return this._nodes.length=Y,this}func(Q,Y=f.nil,X,W){if(this._blockNode(new h4(Q,Y,X)),W)this.code(W).endFunc();return this}endFunc(){return this._endBlockNode(h4)}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,Y){let X=this._currNode;if(X instanceof Q||Y&&X instanceof Y)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${Y?`${Q.kind}/${Y.kind}`:Q.kind}"`)}_elseNode(Q){let Y=this._currNode;if(!(Y instanceof s0))throw Error('CodeGen: "else" without "if"');return this._currNode=Y.else=Q,this}get _root(){return this._nodes[0]}get _currNode(){let Q=this._nodes;return Q[Q.length-1]}set _currNode(Q){let Y=this._nodes;Y[Y.length-1]=Q}}N0.CodeGen=D$;function j1(Q,Y){for(let X in Y)Q[X]=(Q[X]||0)+(Y[X]||0);return Q}function c4(Q,Y){return Y instanceof f._CodeOrName?j1(Q,Y.names):Q}function l1(Q,Y,X){if(Q instanceof f.Name)return W(Q);if(!G(Q))return Q;return new f._Code(Q._items.reduce(($,z)=>{if(z instanceof f.Name)z=W(z);if(z instanceof f._Code)$.push(...z._items);else $.push(z);return $},[]));function W($){let z=X[$.str];if(z===void 0||Y[$.str]!==1)return $;return delete Y[$.str],z}function G($){return $ instanceof f._Code&&$._items.some((z)=>z instanceof f.Name&&Y[z.str]===1&&X[z.str]!==void 0)}}function eA(Q,Y){for(let X in Y)Q[X]=(Q[X]||0)-(Y[X]||0)}function L$(Q){return typeof Q=="boolean"||typeof Q=="number"||Q===null?!Q:f._`!${m9(Q)}`}N0.not=L$;var QB=F$(N0.operators.AND);function YB(...Q){return Q.reduce(QB)}N0.and=YB;var XB=F$(N0.operators.OR);function WB(...Q){return Q.reduce(XB)}N0.or=WB;function F$(Q){return(Y,X)=>Y===f.nil?X:X===f.nil?Y:f._`${m9(Y)} ${Q} ${m9(X)}`}function m9(Q){return Q instanceof f.Name?Q:f._`(${Q})`}});var c=j((P$)=>{Object.defineProperty(P$,"__esModule",{value:!0});P$.checkStrictMode=P$.getErrorPath=P$.Type=P$.useFunc=P$.setEvaluated=P$.evaluatedPropsToName=P$.mergeEvaluated=P$.eachItem=P$.unescapeJsonPointer=P$.escapeJsonPointer=P$.escapeFragment=P$.unescapeFragment=P$.schemaRefOrVal=P$.schemaHasRulesButRef=P$.schemaHasRules=P$.checkUnknownRules=P$.alwaysValidSchema=P$.toHash=void 0;var n=g(),JB=T6();function HB(Q){let Y={};for(let X of Q)Y[X]=!0;return Y}P$.toHash=HB;function UB(Q,Y){if(typeof Y=="boolean")return Y;if(Object.keys(Y).length===0)return!0;return V$(Q,Y),!N$(Y,Q.self.RULES.all)}P$.alwaysValidSchema=UB;function V$(Q,Y=Q.schema){let{opts:X,self:W}=Q;if(!X.strictSchema)return;if(typeof Y==="boolean")return;let G=W.RULES.keywords;for(let $ in Y)if(!G[$])j$(Q,`unknown keyword: "${$}"`)}P$.checkUnknownRules=V$;function N$(Q,Y){if(typeof Q=="boolean")return!Q;for(let X in Q)if(Y[X])return!0;return!1}P$.schemaHasRules=N$;function AB(Q,Y){if(typeof Q=="boolean")return!Q;for(let X in Q)if(X!=="$ref"&&Y.all[X])return!0;return!1}P$.schemaHasRulesButRef=AB;function BB({topSchemaRef:Q,schemaPath:Y},X,W,G){if(!G){if(typeof X=="number"||typeof X=="boolean")return X;if(typeof X=="string")return n._`${X}`}return n._`${Q}${Y}${(0,n.getProperty)(W)}`}P$.schemaRefOrVal=BB;function KB(Q){return Z$(decodeURIComponent(Q))}P$.unescapeFragment=KB;function DB(Q){return encodeURIComponent(i9(Q))}P$.escapeFragment=DB;function i9(Q){if(typeof Q=="number")return`${Q}`;return Q.replace(/~/g,"~0").replace(/\//g,"~1")}P$.escapeJsonPointer=i9;function Z$(Q){return Q.replace(/~1/g,"/").replace(/~0/g,"~")}P$.unescapeJsonPointer=Z$;function LB(Q,Y){if(Array.isArray(Q))for(let X of Q)Y(X);else Y(Q)}P$.eachItem=LB;function O$({mergeNames:Q,mergeToName:Y,mergeValues:X,resultToName:W}){return(G,$,z,J)=>{let H=z===void 0?$:z instanceof n.Name?($ instanceof n.Name?Q(G,$,z):Y(G,$,z),z):$ instanceof n.Name?(Y(G,z,$),$):X($,z);return J===n.Name&&!(H instanceof n.Name)?W(G,H):H}}P$.mergeEvaluated={props:O$({mergeNames:(Q,Y,X)=>Q.if(n._`${X} !== true && ${Y} !== undefined`,()=>{Q.if(n._`${Y} === true`,()=>Q.assign(X,!0),()=>Q.assign(X,n._`${X} || {}`).code(n._`Object.assign(${X}, ${Y})`))}),mergeToName:(Q,Y,X)=>Q.if(n._`${X} !== true`,()=>{if(Y===!0)Q.assign(X,!0);else Q.assign(X,n._`${X} || {}`),n9(Q,X,Y)}),mergeValues:(Q,Y)=>Q===!0?!0:{...Q,...Y},resultToName:w$}),items:O$({mergeNames:(Q,Y,X)=>Q.if(n._`${X} !== true && ${Y} !== undefined`,()=>Q.assign(X,n._`${Y} === true ? true : ${X} > ${Y} ? ${X} : ${Y}`)),mergeToName:(Q,Y,X)=>Q.if(n._`${X} !== true`,()=>Q.assign(X,Y===!0?!0:n._`${X} > ${Y} ? ${X} : ${Y}`)),mergeValues:(Q,Y)=>Q===!0?!0:Math.max(Q,Y),resultToName:(Q,Y)=>Q.var("items",Y)})};function w$(Q,Y){if(Y===!0)return Q.var("props",!0);let X=Q.var("props",n._`{}`);if(Y!==void 0)n9(Q,X,Y);return X}P$.evaluatedPropsToName=w$;function n9(Q,Y,X){Object.keys(X).forEach((W)=>Q.assign(n._`${Y}${(0,n.getProperty)(W)}`,!0))}P$.setEvaluated=n9;var M$={};function FB(Q,Y){return Q.scopeValue("func",{ref:Y,code:M$[Y.code]||(M$[Y.code]=new JB._Code(Y.code))})}P$.useFunc=FB;var p9;(function(Q){Q[Q.Num=0]="Num",Q[Q.Str=1]="Str"})(p9||(P$.Type=p9={}));function qB(Q,Y,X){if(Q instanceof n.Name){let W=Y===p9.Num;return X?W?n._`"[" + ${Q} + "]"`:n._`"['" + ${Q} + "']"`:W?n._`"/" + ${Q}`:n._`"/" + ${Q}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return X?(0,n.getProperty)(Q).toString():"/"+i9(Q)}P$.getErrorPath=qB;function j$(Q,Y,X=Q.opts.strictSchema){if(!X)return;if(Y=`strict mode: ${Y}`,X===!0)throw Error(Y);Q.self.logger.warn(Y)}P$.checkStrictMode=j$});var e0=j((I$)=>{Object.defineProperty(I$,"__esModule",{value:!0});var L0=g(),xB={data:new L0.Name("data"),valCxt:new L0.Name("valCxt"),instancePath:new L0.Name("instancePath"),parentData:new L0.Name("parentData"),parentDataProperty:new L0.Name("parentDataProperty"),rootData:new L0.Name("rootData"),dynamicAnchors:new L0.Name("dynamicAnchors"),vErrors:new L0.Name("vErrors"),errors:new L0.Name("errors"),this:new L0.Name("this"),self:new L0.Name("self"),scope:new L0.Name("scope"),json:new L0.Name("json"),jsonPos:new L0.Name("jsonPos"),jsonLen:new L0.Name("jsonLen"),jsonPart:new L0.Name("jsonPart")};I$.default=xB});var R6=j((R$)=>{Object.defineProperty(R$,"__esModule",{value:!0});R$.extendErrors=R$.resetErrorsCount=R$.reportExtraError=R$.reportError=R$.keyword$DataError=R$.keywordError=void 0;var l=g(),r4=c(),q0=e0();R$.keywordError={message:({keyword:Q})=>l.str`must pass "${Q}" keyword validation`};R$.keyword$DataError={message:({keyword:Q,schemaType:Y})=>Y?l.str`"${Q}" keyword must be ${Y} ($data)`:l.str`"${Q}" keyword is invalid ($data)`};function gB(Q,Y=R$.keywordError,X,W){let{it:G}=Q,{gen:$,compositeRule:z,allErrors:J}=G,H=S$(Q,Y,X);if(W!==null&&W!==void 0?W:z||J)E$($,H);else T$(G,l._`[${H}]`)}R$.reportError=gB;function yB(Q,Y=R$.keywordError,X){let{it:W}=Q,{gen:G,compositeRule:$,allErrors:z}=W,J=S$(Q,Y,X);if(E$(G,J),!($||z))T$(W,q0.default.vErrors)}R$.reportExtraError=yB;function uB(Q,Y){Q.assign(q0.default.errors,Y),Q.if(l._`${q0.default.vErrors} !== null`,()=>Q.if(Y,()=>Q.assign(l._`${q0.default.vErrors}.length`,Y),()=>Q.assign(q0.default.vErrors,null)))}R$.resetErrorsCount=uB;function hB({gen:Q,keyword:Y,schemaValue:X,data:W,errsCount:G,it:$}){if(G===void 0)throw Error("ajv implementation error");let z=Q.name("err");Q.forRange("i",G,q0.default.errors,(J)=>{if(Q.const(z,l._`${q0.default.vErrors}[${J}]`),Q.if(l._`${z}.instancePath === undefined`,()=>Q.assign(l._`${z}.instancePath`,(0,l.strConcat)(q0.default.instancePath,$.errorPath))),Q.assign(l._`${z}.schemaPath`,l.str`${$.errSchemaPath}/${Y}`),$.opts.verbose)Q.assign(l._`${z}.schema`,X),Q.assign(l._`${z}.data`,W)})}R$.extendErrors=hB;function E$(Q,Y){let X=Q.const("err",Y);Q.if(l._`${q0.default.vErrors} === null`,()=>Q.assign(q0.default.vErrors,l._`[${X}]`),l._`${q0.default.vErrors}.push(${X})`),Q.code(l._`${q0.default.errors}++`)}function T$(Q,Y){let{gen:X,validateName:W,schemaEnv:G}=Q;if(G.$async)X.throw(l._`new ${Q.ValidationError}(${Y})`);else X.assign(l._`${W}.errors`,Y),X.return(!1)}var P1={keyword:new l.Name("keyword"),schemaPath:new l.Name("schemaPath"),params:new l.Name("params"),propertyName:new l.Name("propertyName"),message:new l.Name("message"),schema:new l.Name("schema"),parentSchema:new l.Name("parentSchema")};function S$(Q,Y,X){let{createErrors:W}=Q.it;if(W===!1)return l._`{}`;return fB(Q,Y,X)}function fB(Q,Y,X={}){let{gen:W,it:G}=Q,$=[lB(G,X),mB(Q,X)];return cB(Q,Y,$),W.object(...$)}function lB({errorPath:Q},{instancePath:Y}){let X=Y?l.str`${Q}${(0,r4.getErrorPath)(Y,r4.Type.Str)}`:Q;return[q0.default.instancePath,(0,l.strConcat)(q0.default.instancePath,X)]}function mB({keyword:Q,it:{errSchemaPath:Y}},{schemaPath:X,parentSchema:W}){let G=W?Y:l.str`${Y}/${Q}`;if(X)G=l.str`${G}${(0,r4.getErrorPath)(X,r4.Type.Str)}`;return[P1.schemaPath,G]}function cB(Q,{params:Y,message:X},W){let{keyword:G,data:$,schemaValue:z,it:J}=Q,{opts:H,propertyName:U,topSchemaRef:A,schemaPath:B}=J;if(W.push([P1.keyword,G],[P1.params,typeof Y=="function"?Y(Q):Y||l._`{}`]),H.messages)W.push([P1.message,typeof X=="function"?X(Q):X]);if(H.verbose)W.push([P1.schema,z],[P1.parentSchema,l._`${A}${B}`],[q0.default.data,$]);if(U)W.push([P1.propertyName,U])}});var _$=j((v$)=>{Object.defineProperty(v$,"__esModule",{value:!0});v$.boolOrEmptySchema=v$.topBoolOrEmptySchema=void 0;var dB=R6(),oB=g(),tB=e0(),aB={message:"boolean schema is false"};function sB(Q){let{gen:Y,schema:X,validateName:W}=Q;if(X===!1)k$(Q,!1);else if(typeof X=="object"&&X.$async===!0)Y.return(tB.default.data);else Y.assign(oB._`${W}.errors`,null),Y.return(!0)}v$.topBoolOrEmptySchema=sB;function eB(Q,Y){let{gen:X,schema:W}=Q;if(W===!1)X.var(Y,!1),k$(Q);else X.var(Y,!0)}v$.boolOrEmptySchema=eB;function k$(Q,Y){let{gen:X,data:W}=Q,G={gen:X,keyword:"false schema",data:W,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:Q};(0,dB.reportError)(G,aB,void 0,Y)}});var d9=j((g$)=>{Object.defineProperty(g$,"__esModule",{value:!0});g$.getRules=g$.isJSONType=void 0;var YK=["string","number","integer","boolean","null","object","array"],XK=new Set(YK);function WK(Q){return typeof Q=="string"&&XK.has(Q)}g$.isJSONType=WK;function GK(){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:{}}}g$.getRules=GK});var o9=j((f$)=>{Object.defineProperty(f$,"__esModule",{value:!0});f$.shouldUseRule=f$.shouldUseGroup=f$.schemaHasRulesForType=void 0;function zK({schema:Q,self:Y},X){let W=Y.RULES.types[X];return W&&W!==!0&&u$(Q,W)}f$.schemaHasRulesForType=zK;function u$(Q,Y){return Y.rules.some((X)=>h$(Q,X))}f$.shouldUseGroup=u$;function h$(Q,Y){var X;return Q[Y.keyword]!==void 0||((X=Y.definition.implements)===null||X===void 0?void 0:X.some((W)=>Q[W]!==void 0))}f$.shouldUseRule=h$});var C6=j((i$)=>{Object.defineProperty(i$,"__esModule",{value:!0});i$.reportTypeError=i$.checkDataTypes=i$.checkDataType=i$.coerceAndCheckDataType=i$.getJSONTypes=i$.getSchemaTypes=i$.DataType=void 0;var UK=d9(),AK=o9(),BK=R6(),x=g(),m$=c(),m1;(function(Q){Q[Q.Correct=0]="Correct",Q[Q.Wrong=1]="Wrong"})(m1||(i$.DataType=m1={}));function KK(Q){let Y=c$(Q.type);if(Y.includes("null")){if(Q.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!Y.length&&Q.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');if(Q.nullable===!0)Y.push("null")}return Y}i$.getSchemaTypes=KK;function c$(Q){let Y=Array.isArray(Q)?Q:Q?[Q]:[];if(Y.every(UK.isJSONType))return Y;throw Error("type must be JSONType or JSONType[]: "+Y.join(","))}i$.getJSONTypes=c$;function DK(Q,Y){let{gen:X,data:W,opts:G}=Q,$=LK(Y,G.coerceTypes),z=Y.length>0&&!($.length===0&&Y.length===1&&(0,AK.schemaHasRulesForType)(Q,Y[0]));if(z){let J=a9(Y,W,G.strictNumbers,m1.Wrong);X.if(J,()=>{if($.length)FK(Q,Y,$);else s9(Q)})}return z}i$.coerceAndCheckDataType=DK;var p$=new Set(["string","number","integer","boolean","null"]);function LK(Q,Y){return Y?Q.filter((X)=>p$.has(X)||Y==="array"&&X==="array"):[]}function FK(Q,Y,X){let{gen:W,data:G,opts:$}=Q,z=W.let("dataType",x._`typeof ${G}`),J=W.let("coerced",x._`undefined`);if($.coerceTypes==="array")W.if(x._`${z} == 'object' && Array.isArray(${G}) && ${G}.length == 1`,()=>W.assign(G,x._`${G}[0]`).assign(z,x._`typeof ${G}`).if(a9(Y,G,$.strictNumbers),()=>W.assign(J,G)));W.if(x._`${J} !== undefined`);for(let U of X)if(p$.has(U)||U==="array"&&$.coerceTypes==="array")H(U);W.else(),s9(Q),W.endIf(),W.if(x._`${J} !== undefined`,()=>{W.assign(G,J),qK(Q,J)});function H(U){switch(U){case"string":W.elseIf(x._`${z} == "number" || ${z} == "boolean"`).assign(J,x._`"" + ${G}`).elseIf(x._`${G} === null`).assign(J,x._`""`);return;case"number":W.elseIf(x._`${z} == "boolean" || ${G} === null
|
|
3
3
|
|| (${z} == "string" && ${G} && ${G} == +${G})`).assign(J,x._`+${G}`);return;case"integer":W.elseIf(x._`${z} === "boolean" || ${G} === null
|
|
4
4
|
|| (${z} === "string" && ${G} && ${G} == +${G} && !(${G} % 1))`).assign(J,x._`+${G}`);return;case"boolean":W.elseIf(x._`${G} === "false" || ${G} === 0 || ${G} === null`).assign(J,!1).elseIf(x._`${G} === "true" || ${G} === 1`).assign(J,!0);return;case"null":W.elseIf(x._`${G} === "" || ${G} === 0 || ${G} === false`),W.assign(J,null);return;case"array":W.elseIf(x._`${z} === "string" || ${z} === "number"
|
|
5
|
-
|| ${z} === "boolean" || ${G} === null`).assign(J,x._`[${G}]`)}}}function qK({gen:Q,parentData:Y,parentDataProperty:X},W){Q.if(x._`${Y} !== undefined`,()=>Q.assign(x._`${Y}[${X}]`,W))}function t9(Q,Y,X,W=m1.Correct){let G=W===m1.Correct?x.operators.EQ:x.operators.NEQ,$;switch(Q){case"null":return x._`${Y} ${G} null`;case"array":$=x._`Array.isArray(${Y})`;break;case"object":$=x._`${Y} && typeof ${Y} == "object" && !Array.isArray(${Y})`;break;case"integer":$=z(x._`!(${Y} % 1) && !isNaN(${Y})`);break;case"number":$=z();break;default:return x._`typeof ${Y} ${G} ${Q}`}return W===m1.Correct?$:(0,x.not)($);function z(J=x.nil){return(0,x.and)(x._`typeof ${Y} == "number"`,J,X?x._`isFinite(${Y})`:x.nil)}}p$.checkDataType=t9;function a9(Q,Y,X,W){if(Q.length===1)return t9(Q[0],Y,X,W);let G,$=(0,l$.toHash)(Q);if($.array&&$.object){let z=x._`typeof ${Y} != "object"`;G=$.null?z:x._`!${Y} || ${z}`,delete $.null,delete $.array,delete $.object}else G=x.nil;if($.number)delete $.integer;for(let z in $)G=(0,x.and)(G,t9(z,Y,X,W));return G}p$.checkDataTypes=a9;var OK={message:({schema:Q})=>`must be ${Q}`,params:({schema:Q,schemaValue:Y})=>typeof Q=="string"?x._`{type: ${Q}}`:x._`{type: ${Y}}`};function s9(Q){let Y=MK(Q);(0,BK.reportError)(Y,OK)}p$.reportTypeError=s9;function MK(Q){let{gen:Y,data:X,schema:W}=Q,G=(0,l$.schemaRefOrVal)(Q,W,"type");return{gen:Y,keyword:"type",data:X,schema:W.type,schemaCode:G,schemaValue:G,parentSchema:W,params:{},it:Q}}});var o$=j((r$)=>{Object.defineProperty(r$,"__esModule",{value:!0});r$.assignDefaults=void 0;var c1=g(),bK=c();function IK(Q,Y){let{properties:X,items:W}=Q.schema;if(Y==="object"&&X)for(let G in X)n$(Q,G,X[G].default);else if(Y==="array"&&Array.isArray(W))W.forEach((G,$)=>n$(Q,$,G.default))}r$.assignDefaults=IK;function n$(Q,Y,X){let{gen:W,compositeRule:G,data:$,opts:z}=Q;if(X===void 0)return;let J=c1._`${$}${(0,c1.getProperty)(Y)}`;if(G){(0,bK.checkStrictMode)(Q,`default is ignored for: ${J}`);return}let H=c1._`${J} === undefined`;if(z.useDefaults==="empty")H=c1._`${H} || ${J} === null || ${J} === ""`;W.if(H,c1._`${J} = ${(0,c1.stringify)(X)}`)}});var S0=j((s$)=>{Object.defineProperty(s$,"__esModule",{value:!0});s$.validateUnion=s$.validateArray=s$.usePattern=s$.callValidateCode=s$.schemaProperties=s$.allSchemaProperties=s$.noPropertyInData=s$.propertyInData=s$.isOwnProperty=s$.hasPropFunc=s$.reportMissingProp=s$.checkMissingProp=s$.checkReportMissingProp=void 0;var a=g(),e9=c(),L1=e0(),EK=c();function TK(Q,Y){let{gen:X,data:W,it:G}=Q;X.if(YY(X,W,Y,G.opts.ownProperties),()=>{Q.setParams({missingProperty:a._`${Y}`},!0),Q.error()})}s$.checkReportMissingProp=TK;function SK({gen:Q,data:Y,it:{opts:X}},W,G){return(0,a.or)(...W.map(($)=>(0,a.and)(YY(Q,Y,$,X.ownProperties),a._`${G} = ${$}`)))}s$.checkMissingProp=SK;function RK(Q,Y){Q.setParams({missingProperty:Y},!0),Q.error()}s$.reportMissingProp=RK;function t$(Q){return Q.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:a._`Object.prototype.hasOwnProperty`})}s$.hasPropFunc=t$;function QY(Q,Y,X){return a._`${t$(Q)}.call(${Y}, ${X})`}s$.isOwnProperty=QY;function CK(Q,Y,X,W){let G=a._`${Y}${(0,a.getProperty)(X)} !== undefined`;return W?a._`${G} && ${QY(Q,Y,X)}`:G}s$.propertyInData=CK;function YY(Q,Y,X,W){let G=a._`${Y}${(0,a.getProperty)(X)} === undefined`;return W?(0,a.or)(G,(0,a.not)(QY(Q,Y,X))):G}s$.noPropertyInData=YY;function a$(Q){return Q?Object.keys(Q).filter((Y)=>Y!=="__proto__"):[]}s$.allSchemaProperties=a$;function kK(Q,Y){return a$(Y).filter((X)=>!(0,e9.alwaysValidSchema)(Q,Y[X]))}s$.schemaProperties=kK;function vK({schemaCode:Q,data:Y,it:{gen:X,topSchemaRef:W,schemaPath:G,errorPath:$},it:z},J,H,U){let A=U?a._`${Q}, ${Y}, ${W}${G}`:Y,B=[[L1.default.instancePath,(0,a.strConcat)(L1.default.instancePath,$)],[L1.default.parentData,z.parentData],[L1.default.parentDataProperty,z.parentDataProperty],[L1.default.rootData,L1.default.rootData]];if(z.opts.dynamicRef)B.push([L1.default.dynamicAnchors,L1.default.dynamicAnchors]);let K=a._`${A}, ${X.object(...B)}`;return H!==a.nil?a._`${J}.call(${H}, ${K})`:a._`${J}(${K})`}s$.callValidateCode=vK;var xK=a._`new RegExp`;function _K({gen:Q,it:{opts:Y}},X){let W=Y.unicodeRegExp?"u":"",{regExp:G}=Y.code,$=G(X,W);return Q.scopeValue("pattern",{key:$.toString(),ref:$,code:a._`${G.code==="new RegExp"?xK:(0,EK.useFunc)(Q,G)}(${X}, ${W})`})}s$.usePattern=_K;function gK(Q){let{gen:Y,data:X,keyword:W,it:G}=Q,$=Y.name("valid");if(G.allErrors){let J=Y.let("valid",!0);return z(()=>Y.assign(J,!1)),J}return Y.var($,!0),z(()=>Y.break()),$;function z(J){let H=Y.const("len",a._`${X}.length`);Y.forRange("i",0,H,(U)=>{Q.subschema({keyword:W,dataProp:U,dataPropType:e9.Type.Num},$),Y.if((0,a.not)($),J)})}}s$.validateArray=gK;function yK(Q){let{gen:Y,schema:X,keyword:W,it:G}=Q;if(!Array.isArray(X))throw Error("ajv implementation error");if(X.some((H)=>(0,e9.alwaysValidSchema)(G,H))&&!G.opts.unevaluated)return;let z=Y.let("valid",!1),J=Y.name("_valid");Y.block(()=>X.forEach((H,U)=>{let A=Q.subschema({keyword:W,schemaProp:U,compositeRule:!0},J);if(Y.assign(z,a._`${z} || ${J}`),!Q.mergeValidEvaluated(A,J))Y.if((0,a.not)(z))})),Q.result(z,()=>Q.reset(),()=>Q.error(!0))}s$.validateUnion=yK});var Gz=j((Xz)=>{Object.defineProperty(Xz,"__esModule",{value:!0});Xz.validateKeywordUsage=Xz.validSchemaType=Xz.funcKeywordCode=Xz.macroKeywordCode=void 0;var O0=g(),b1=e0(),tK=S0(),aK=S6();function sK(Q,Y){let{gen:X,keyword:W,schema:G,parentSchema:$,it:z}=Q,J=Y.macro.call(z.self,G,$,z),H=Yz(X,W,J);if(z.opts.validateSchema!==!1)z.self.validateSchema(J,!0);let U=X.name("valid");Q.subschema({schema:J,schemaPath:O0.nil,errSchemaPath:`${z.errSchemaPath}/${W}`,topSchemaRef:H,compositeRule:!0},U),Q.pass(U,()=>Q.error(!0))}Xz.macroKeywordCode=sK;function eK(Q,Y){var X;let{gen:W,keyword:G,schema:$,parentSchema:z,$data:J,it:H}=Q;YD(H,Y);let U=!J&&Y.compile?Y.compile.call(H.self,$,z,H):Y.validate,A=Yz(W,G,U),B=W.let("valid");Q.block$data(B,K),Q.ok((X=Y.valid)!==null&&X!==void 0?X:B);function K(){if(Y.errors===!1){if(M(),Y.modifying)Qz(Q);Z(()=>Q.error())}else{let V=Y.async?D():O();if(Y.modifying)Qz(Q);Z(()=>QD(Q,V))}}function D(){let V=W.let("ruleErrs",null);return W.try(()=>M(O0._`await `),(R)=>W.assign(B,!1).if(O0._`${R} instanceof ${H.ValidationError}`,()=>W.assign(V,O0._`${R}.errors`),()=>W.throw(R))),V}function O(){let V=O0._`${A}.errors`;return W.assign(V,null),M(O0.nil),V}function M(V=Y.async?O0._`await `:O0.nil){let R=H.opts.passContext?b1.default.this:b1.default.self,T=!(("compile"in Y)&&!J||Y.schema===!1);W.assign(B,O0._`${V}${(0,tK.callValidateCode)(Q,A,R,T)}`,Y.modifying)}function Z(V){var R;W.if((0,O0.not)((R=Y.valid)!==null&&R!==void 0?R:B),V)}}Xz.funcKeywordCode=eK;function Qz(Q){let{gen:Y,data:X,it:W}=Q;Y.if(W.parentData,()=>Y.assign(X,O0._`${W.parentData}[${W.parentDataProperty}]`))}function QD(Q,Y){let{gen:X}=Q;X.if(O0._`Array.isArray(${Y})`,()=>{X.assign(b1.default.vErrors,O0._`${b1.default.vErrors} === null ? ${Y} : ${b1.default.vErrors}.concat(${Y})`).assign(b1.default.errors,O0._`${b1.default.vErrors}.length`),(0,aK.extendErrors)(Q)},()=>Q.error())}function YD({schemaEnv:Q},Y){if(Y.async&&!Q.$async)throw Error("async keyword in sync schema")}function Yz(Q,Y,X){if(X===void 0)throw Error(`keyword "${Y}" failed to compile`);return Q.scopeValue("keyword",typeof X=="function"?{ref:X}:{ref:X,code:(0,O0.stringify)(X)})}function XD(Q,Y,X=!1){return!Y.length||Y.some((W)=>W==="array"?Array.isArray(Q):W==="object"?Q&&typeof Q=="object"&&!Array.isArray(Q):typeof Q==W||X&&typeof Q>"u")}Xz.validSchemaType=XD;function WD({schema:Q,opts:Y,self:X,errSchemaPath:W},G,$){if(Array.isArray(G.keyword)?!G.keyword.includes($):G.keyword!==$)throw Error("ajv implementation error");let z=G.dependencies;if(z===null||z===void 0?void 0:z.some((J)=>!Object.prototype.hasOwnProperty.call(Q,J)))throw Error(`parent schema must have dependencies of ${$}: ${z.join(",")}`);if(G.validateSchema){if(!G.validateSchema(Q[$])){let H=`keyword "${$}" value is invalid at path "${W}": `+X.errorsText(G.validateSchema.errors);if(Y.validateSchema==="log")X.logger.error(H);else throw Error(H)}}}Xz.validateKeywordUsage=WD});var Hz=j((zz)=>{Object.defineProperty(zz,"__esModule",{value:!0});zz.extendSubschemaMode=zz.extendSubschemaData=zz.getSubschema=void 0;var c0=g(),$z=c();function JD(Q,{keyword:Y,schemaProp:X,schema:W,schemaPath:G,errSchemaPath:$,topSchemaRef:z}){if(Y!==void 0&&W!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(Y!==void 0){let J=Q.schema[Y];return X===void 0?{schema:J,schemaPath:c0._`${Q.schemaPath}${(0,c0.getProperty)(Y)}`,errSchemaPath:`${Q.errSchemaPath}/${Y}`}:{schema:J[X],schemaPath:c0._`${Q.schemaPath}${(0,c0.getProperty)(Y)}${(0,c0.getProperty)(X)}`,errSchemaPath:`${Q.errSchemaPath}/${Y}/${(0,$z.escapeFragment)(X)}`}}if(W!==void 0){if(G===void 0||$===void 0||z===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:W,schemaPath:G,topSchemaRef:z,errSchemaPath:$}}throw Error('either "keyword" or "schema" must be passed')}zz.getSubschema=JD;function HD(Q,Y,{dataProp:X,dataPropType:W,data:G,dataTypes:$,propertyName:z}){if(G!==void 0&&X!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:J}=Y;if(X!==void 0){let{errorPath:U,dataPathArr:A,opts:B}=Y,K=J.let("data",c0._`${Y.data}${(0,c0.getProperty)(X)}`,!0);H(K),Q.errorPath=c0.str`${U}${(0,$z.getErrorPath)(X,W,B.jsPropertySyntax)}`,Q.parentDataProperty=c0._`${X}`,Q.dataPathArr=[...A,Q.parentDataProperty]}if(G!==void 0){let U=G instanceof c0.Name?G:J.let("data",G,!0);if(H(U),z!==void 0)Q.propertyName=z}if($)Q.dataTypes=$;function H(U){Q.data=U,Q.dataLevel=Y.dataLevel+1,Q.dataTypes=[],Y.definedProperties=new Set,Q.parentData=Y.data,Q.dataNames=[...Y.dataNames,U]}}zz.extendSubschemaData=HD;function UD(Q,{jtdDiscriminator:Y,jtdMetadata:X,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=Y,Q.jtdMetadata=X}zz.extendSubschemaMode=UD});var XY=j((XI,Uz)=>{Uz.exports=function Q(Y,X){if(Y===X)return!0;if(Y&&X&&typeof Y=="object"&&typeof X=="object"){if(Y.constructor!==X.constructor)return!1;var W,G,$;if(Array.isArray(Y)){if(W=Y.length,W!=X.length)return!1;for(G=W;G--!==0;)if(!Q(Y[G],X[G]))return!1;return!0}if(Y.constructor===RegExp)return Y.source===X.source&&Y.flags===X.flags;if(Y.valueOf!==Object.prototype.valueOf)return Y.valueOf()===X.valueOf();if(Y.toString!==Object.prototype.toString)return Y.toString()===X.toString();if($=Object.keys(Y),W=$.length,W!==Object.keys(X).length)return!1;for(G=W;G--!==0;)if(!Object.prototype.hasOwnProperty.call(X,$[G]))return!1;for(G=W;G--!==0;){var z=$[G];if(!Q(Y[z],X[z]))return!1}return!0}return Y!==Y&&X!==X}});var Bz=j((WI,Az)=>{var F1=Az.exports=function(Q,Y,X){if(typeof Y=="function")X=Y,Y={};X=Y.cb||X;var W=typeof X=="function"?X:X.pre||function(){},G=X.post||function(){};r4(Y,W,G,Q,"",Q)};F1.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};F1.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};F1.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};F1.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 r4(Q,Y,X,W,G,$,z,J,H,U){if(W&&typeof W=="object"&&!Array.isArray(W)){Y(W,G,$,z,J,H,U);for(var A in W){var B=W[A];if(Array.isArray(B)){if(A in F1.arrayKeywords)for(var K=0;K<B.length;K++)r4(Q,Y,X,B[K],G+"/"+A+"/"+K,$,G,A,W,K)}else if(A in F1.propsKeywords){if(B&&typeof B=="object")for(var D in B)r4(Q,Y,X,B[D],G+"/"+A+"/"+KD(D),$,G,A,W,D)}else if(A in F1.keywords||Q.allKeys&&!(A in F1.skipKeywords))r4(Q,Y,X,B,G+"/"+A,$,G,A,W)}X(W,G,$,z,J,H,U)}}function KD(Q){return Q.replace(/~/g,"~0").replace(/\//g,"~1")}});var C6=j((Fz)=>{Object.defineProperty(Fz,"__esModule",{value:!0});Fz.getSchemaRefs=Fz.resolveUrl=Fz.normalizeId=Fz._getFullPath=Fz.getFullPath=Fz.inlineRef=void 0;var DD=c(),LD=XY(),FD=Bz(),qD=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function OD(Q,Y=!0){if(typeof Q=="boolean")return!0;if(Y===!0)return!WY(Q);if(!Y)return!1;return Kz(Q)<=Y}Fz.inlineRef=OD;var MD=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function WY(Q){for(let Y in Q){if(MD.has(Y))return!0;let X=Q[Y];if(Array.isArray(X)&&X.some(WY))return!0;if(typeof X=="object"&&WY(X))return!0}return!1}function Kz(Q){let Y=0;for(let X in Q){if(X==="$ref")return 1/0;if(Y++,qD.has(X))continue;if(typeof Q[X]=="object")(0,DD.eachItem)(Q[X],(W)=>Y+=Kz(W));if(Y===1/0)return 1/0}return Y}function Dz(Q,Y="",X){if(X!==!1)Y=p1(Y);let W=Q.parse(Y);return Lz(Q,W)}Fz.getFullPath=Dz;function Lz(Q,Y){return Q.serialize(Y).split("#")[0]+"#"}Fz._getFullPath=Lz;var VD=/#\/?$/;function p1(Q){return Q?Q.replace(VD,""):""}Fz.normalizeId=p1;function ND(Q,Y,X){return X=p1(X),Q.resolve(Y,X)}Fz.resolveUrl=ND;var ZD=/^[a-z_][-a-z0-9._]*$/i;function wD(Q,Y){if(typeof Q=="boolean")return{};let{schemaId:X,uriResolver:W}=this.opts,G=p1(Q[X]||Y),$={"":G},z=Dz(W,G,!1),J={},H=new Set;return FD(Q,{allKeys:!0},(B,K,D,O)=>{if(O===void 0)return;let M=z+K,Z=$[O];if(typeof B[X]=="string")Z=V.call(this,B[X]);R.call(this,B.$anchor),R.call(this,B.$dynamicAnchor),$[K]=Z;function V(T){let y=this.opts.uriResolver.resolve;if(T=p1(Z?y(Z,T):T),H.has(T))throw A(T);H.add(T);let S=this.refs[T];if(typeof S=="string")S=this.refs[S];if(typeof S=="object")U(B,S.schema,T);else if(T!==p1(M))if(T[0]==="#")U(B,J[T],T),J[T]=B;else this.refs[T]=M;return T}function R(T){if(typeof T=="string"){if(!ZD.test(T))throw Error(`invalid anchor "${T}"`);V.call(this,`#${T}`)}}}),J;function U(B,K,D){if(K!==void 0&&!LD(B,K))throw A(D)}function A(B){return Error(`reference "${B}" resolves to more than one schema`)}}Fz.getSchemaRefs=wD});var x6=j((Cz)=>{Object.defineProperty(Cz,"__esModule",{value:!0});Cz.getData=Cz.KeywordCxt=Cz.validateFunctionCode=void 0;var Zz=x$(),Oz=R6(),$Y=o9(),d4=R6(),TD=o$(),v6=Gz(),GY=Hz(),I=g(),C=e0(),SD=C6(),Q1=c(),k6=S6();function RD(Q){if(Pz(Q)){if(bz(Q),jz(Q)){vD(Q);return}}wz(Q,()=>(0,Zz.topBoolOrEmptySchema)(Q))}Cz.validateFunctionCode=RD;function wz({gen:Q,validateName:Y,schema:X,schemaEnv:W,opts:G},$){if(G.code.es5)Q.func(Y,I._`${C.default.data}, ${C.default.valCxt}`,W.$async,()=>{Q.code(I._`"use strict"; ${Mz(X,G)}`),kD(Q,G),Q.code($)});else Q.func(Y,I._`${C.default.data}, ${CD(G)}`,W.$async,()=>Q.code(Mz(X,G)).code($))}function CD(Q){return I._`{${C.default.instancePath}="", ${C.default.parentData}, ${C.default.parentDataProperty}, ${C.default.rootData}=${C.default.data}${Q.dynamicRef?I._`, ${C.default.dynamicAnchors}={}`:I.nil}}={}`}function kD(Q,Y){Q.if(C.default.valCxt,()=>{if(Q.var(C.default.instancePath,I._`${C.default.valCxt}.${C.default.instancePath}`),Q.var(C.default.parentData,I._`${C.default.valCxt}.${C.default.parentData}`),Q.var(C.default.parentDataProperty,I._`${C.default.valCxt}.${C.default.parentDataProperty}`),Q.var(C.default.rootData,I._`${C.default.valCxt}.${C.default.rootData}`),Y.dynamicRef)Q.var(C.default.dynamicAnchors,I._`${C.default.valCxt}.${C.default.dynamicAnchors}`)},()=>{if(Q.var(C.default.instancePath,I._`""`),Q.var(C.default.parentData,I._`undefined`),Q.var(C.default.parentDataProperty,I._`undefined`),Q.var(C.default.rootData,C.default.data),Y.dynamicRef)Q.var(C.default.dynamicAnchors,I._`{}`)})}function vD(Q){let{schema:Y,opts:X,gen:W}=Q;wz(Q,()=>{if(X.$comment&&Y.$comment)Ez(Q);if(uD(Q),W.let(C.default.vErrors,null),W.let(C.default.errors,0),X.unevaluated)xD(Q);Iz(Q),lD(Q)});return}function xD(Q){let{gen:Y,validateName:X}=Q;Q.evaluated=Y.const("evaluated",I._`${X}.evaluated`),Y.if(I._`${Q.evaluated}.dynamicProps`,()=>Y.assign(I._`${Q.evaluated}.props`,I._`undefined`)),Y.if(I._`${Q.evaluated}.dynamicItems`,()=>Y.assign(I._`${Q.evaluated}.items`,I._`undefined`))}function Mz(Q,Y){let X=typeof Q=="object"&&Q[Y.schemaId];return X&&(Y.code.source||Y.code.process)?I._`/*# sourceURL=${X} */`:I.nil}function _D(Q,Y){if(Pz(Q)){if(bz(Q),jz(Q)){gD(Q,Y);return}}(0,Zz.boolOrEmptySchema)(Q,Y)}function jz({schema:Q,self:Y}){if(typeof Q=="boolean")return!Q;for(let X in Q)if(Y.RULES.all[X])return!0;return!1}function Pz(Q){return typeof Q.schema!="boolean"}function gD(Q,Y){let{schema:X,gen:W,opts:G}=Q;if(G.$comment&&X.$comment)Ez(Q);hD(Q),fD(Q);let $=W.const("_errs",C.default.errors);Iz(Q,$),W.var(Y,I._`${$} === ${C.default.errors}`)}function bz(Q){(0,Q1.checkUnknownRules)(Q),yD(Q)}function Iz(Q,Y){if(Q.opts.jtd)return Vz(Q,[],!1,Y);let X=(0,Oz.getSchemaTypes)(Q.schema),W=(0,Oz.coerceAndCheckDataType)(Q,X);Vz(Q,X,!W,Y)}function yD(Q){let{schema:Y,errSchemaPath:X,opts:W,self:G}=Q;if(Y.$ref&&W.ignoreKeywordsWithRef&&(0,Q1.schemaHasRulesButRef)(Y,G.RULES))G.logger.warn(`$ref: keywords ignored in schema at path "${X}"`)}function uD(Q){let{schema:Y,opts:X}=Q;if(Y.default!==void 0&&X.useDefaults&&X.strictSchema)(0,Q1.checkStrictMode)(Q,"default is ignored in the schema root")}function hD(Q){let Y=Q.schema[Q.opts.schemaId];if(Y)Q.baseId=(0,SD.resolveUrl)(Q.opts.uriResolver,Q.baseId,Y)}function fD(Q){if(Q.schema.$async&&!Q.schemaEnv.$async)throw Error("async schema in sync schema")}function Ez({gen:Q,schemaEnv:Y,schema:X,errSchemaPath:W,opts:G}){let $=X.$comment;if(G.$comment===!0)Q.code(I._`${C.default.self}.logger.log(${$})`);else if(typeof G.$comment=="function"){let z=I.str`${W}/$comment`,J=Q.scopeValue("root",{ref:Y.root});Q.code(I._`${C.default.self}.opts.$comment(${$}, ${z}, ${J}.schema)`)}}function lD(Q){let{gen:Y,schemaEnv:X,validateName:W,ValidationError:G,opts:$}=Q;if(X.$async)Y.if(I._`${C.default.errors} === 0`,()=>Y.return(C.default.data),()=>Y.throw(I._`new ${G}(${C.default.vErrors})`));else{if(Y.assign(I._`${W}.errors`,C.default.vErrors),$.unevaluated)mD(Q);Y.return(I._`${C.default.errors} === 0`)}}function mD({gen:Q,evaluated:Y,props:X,items:W}){if(X instanceof I.Name)Q.assign(I._`${Y}.props`,X);if(W instanceof I.Name)Q.assign(I._`${Y}.items`,W)}function Vz(Q,Y,X,W){let{gen:G,schema:$,data:z,allErrors:J,opts:H,self:U}=Q,{RULES:A}=U;if($.$ref&&(H.ignoreKeywordsWithRef||!(0,Q1.schemaHasRulesButRef)($,A))){G.block(()=>Sz(Q,"$ref",A.all.$ref.definition));return}if(!H.jtd)cD(Q,Y);G.block(()=>{for(let K of A.rules)B(K);B(A.post)});function B(K){if(!(0,$Y.shouldUseGroup)($,K))return;if(K.type){if(G.if((0,d4.checkDataType)(K.type,z,H.strictNumbers)),Nz(Q,K),Y.length===1&&Y[0]===K.type&&X)G.else(),(0,d4.reportTypeError)(Q);G.endIf()}else Nz(Q,K);if(!J)G.if(I._`${C.default.errors} === ${W||0}`)}}function Nz(Q,Y){let{gen:X,schema:W,opts:{useDefaults:G}}=Q;if(G)(0,TD.assignDefaults)(Q,Y.type);X.block(()=>{for(let $ of Y.rules)if((0,$Y.shouldUseRule)(W,$))Sz(Q,$.keyword,$.definition,Y.type)})}function cD(Q,Y){if(Q.schemaEnv.meta||!Q.opts.strictTypes)return;if(pD(Q,Y),!Q.opts.allowUnionTypes)iD(Q,Y);nD(Q,Q.dataTypes)}function pD(Q,Y){if(!Y.length)return;if(!Q.dataTypes.length){Q.dataTypes=Y;return}Y.forEach((X)=>{if(!Tz(Q.dataTypes,X))zY(Q,`type "${X}" not allowed by context "${Q.dataTypes.join(",")}"`)}),dD(Q,Y)}function iD(Q,Y){if(Y.length>1&&!(Y.length===2&&Y.includes("null")))zY(Q,"use allowUnionTypes to allow union type keyword")}function nD(Q,Y){let X=Q.self.RULES.all;for(let W in X){let G=X[W];if(typeof G=="object"&&(0,$Y.shouldUseRule)(Q.schema,G)){let{type:$}=G.definition;if($.length&&!$.some((z)=>rD(Y,z)))zY(Q,`missing type "${$.join(",")}" for keyword "${W}"`)}}}function rD(Q,Y){return Q.includes(Y)||Y==="number"&&Q.includes("integer")}function Tz(Q,Y){return Q.includes(Y)||Y==="integer"&&Q.includes("number")}function dD(Q,Y){let X=[];for(let W of Q.dataTypes)if(Tz(Y,W))X.push(W);else if(Y.includes("integer")&&W==="number")X.push("integer");Q.dataTypes=X}function zY(Q,Y){let X=Q.schemaEnv.baseId+Q.errSchemaPath;Y+=` at "${X}" (strictTypes)`,(0,Q1.checkStrictMode)(Q,Y,Q.opts.strictTypes)}class JY{constructor(Q,Y,X){if((0,v6.validateKeywordUsage)(Q,Y,X),this.gen=Q.gen,this.allErrors=Q.allErrors,this.keyword=X,this.data=Q.data,this.schema=Q.schema[X],this.$data=Y.$data&&Q.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Q1.schemaRefOrVal)(Q,this.schema,X,this.$data),this.schemaType=Y.schemaType,this.parentSchema=Q.schema,this.params={},this.it=Q,this.def=Y,this.$data)this.schemaCode=Q.gen.const("vSchema",Rz(this.$data,Q));else if(this.schemaCode=this.schemaValue,!(0,v6.validSchemaType)(this.schema,Y.schemaType,Y.allowUndefined))throw Error(`${X} value must be ${JSON.stringify(Y.schemaType)}`);if("code"in Y?Y.trackErrors:Y.errors!==!1)this.errsCount=Q.gen.const("_errs",C.default.errors)}result(Q,Y,X){this.failResult((0,I.not)(Q),Y,X)}failResult(Q,Y,X){if(this.gen.if(Q),X)X();else this.error();if(Y){if(this.gen.else(),Y(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(Q,Y){this.failResult((0,I.not)(Q),void 0,Y)}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:Y}=this;this.fail(I._`${Y} !== undefined && (${(0,I.or)(this.invalid$data(),Q)})`)}error(Q,Y,X){if(Y){this.setParams(Y),this._error(Q,X),this.setParams({});return}this._error(Q,X)}_error(Q,Y){(Q?k6.reportExtraError:k6.reportError)(this,this.def.error,Y)}$dataError(){(0,k6.reportError)(this,this.def.$dataError||k6.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,k6.resetErrorsCount)(this.gen,this.errsCount)}ok(Q){if(!this.allErrors)this.gen.if(Q)}setParams(Q,Y){if(Y)Object.assign(this.params,Q);else this.params=Q}block$data(Q,Y,X=I.nil){this.gen.block(()=>{this.check$data(Q,X),Y()})}check$data(Q=I.nil,Y=I.nil){if(!this.$data)return;let{gen:X,schemaCode:W,schemaType:G,def:$}=this;if(X.if((0,I.or)(I._`${W} === undefined`,Y)),Q!==I.nil)X.assign(Q,!0);if(G.length||$.validateSchema){if(X.elseIf(this.invalid$data()),this.$dataError(),Q!==I.nil)X.assign(Q,!1)}X.else()}invalid$data(){let{gen:Q,schemaCode:Y,schemaType:X,def:W,it:G}=this;return(0,I.or)($(),z());function $(){if(X.length){if(!(Y instanceof I.Name))throw Error("ajv implementation error");let J=Array.isArray(X)?X:[X];return I._`${(0,d4.checkDataTypes)(J,Y,G.opts.strictNumbers,d4.DataType.Wrong)}`}return I.nil}function z(){if(W.validateSchema){let J=Q.scopeValue("validate$data",{ref:W.validateSchema});return I._`!${J}(${Y})`}return I.nil}}subschema(Q,Y){let X=(0,GY.getSubschema)(this.it,Q);(0,GY.extendSubschemaData)(X,this.it,Q),(0,GY.extendSubschemaMode)(X,Q);let W={...this.it,...X,items:void 0,props:void 0};return _D(W,Y),W}mergeEvaluated(Q,Y){let{it:X,gen:W}=this;if(!X.opts.unevaluated)return;if(X.props!==!0&&Q.props!==void 0)X.props=Q1.mergeEvaluated.props(W,Q.props,X.props,Y);if(X.items!==!0&&Q.items!==void 0)X.items=Q1.mergeEvaluated.items(W,Q.items,X.items,Y)}mergeValidEvaluated(Q,Y){let{it:X,gen:W}=this;if(X.opts.unevaluated&&(X.props!==!0||X.items!==!0))return W.if(Y,()=>this.mergeEvaluated(Q,I.Name)),!0}}Cz.KeywordCxt=JY;function Sz(Q,Y,X,W){let G=new JY(Q,X,Y);if("code"in X)X.code(G,W);else if(G.$data&&X.validate)(0,v6.funcKeywordCode)(G,X);else if("macro"in X)(0,v6.macroKeywordCode)(G,X);else if(X.compile||X.validate)(0,v6.funcKeywordCode)(G,X)}var oD=/^\/(?:[^~]|~0|~1)*$/,tD=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Rz(Q,{dataLevel:Y,dataNames:X,dataPathArr:W}){let G,$;if(Q==="")return C.default.rootData;if(Q[0]==="/"){if(!oD.test(Q))throw Error(`Invalid JSON-pointer: ${Q}`);G=Q,$=C.default.rootData}else{let U=tD.exec(Q);if(!U)throw Error(`Invalid JSON-pointer: ${Q}`);let A=+U[1];if(G=U[2],G==="#"){if(A>=Y)throw Error(H("property/index",A));return W[Y-A]}if(A>Y)throw Error(H("data",A));if($=X[Y-A],!G)return $}let z=$,J=G.split("/");for(let U of J)if(U)$=I._`${$}${(0,I.getProperty)((0,Q1.unescapeJsonPointer)(U))}`,z=I._`${z} && ${$}`;return z;function H(U,A){return`Cannot access ${U} ${A} levels up, current level is ${Y}`}}Cz.getData=Rz});var o4=j((xz)=>{Object.defineProperty(xz,"__esModule",{value:!0});class vz extends Error{constructor(Q){super("validation failed");this.errors=Q,this.ajv=this.validation=!0}}xz.default=vz});var _6=j((gz)=>{Object.defineProperty(gz,"__esModule",{value:!0});var HY=C6();class _z extends Error{constructor(Q,Y,X,W){super(W||`can't resolve reference ${X} from id ${Y}`);this.missingRef=(0,HY.resolveUrl)(Q,Y,X),this.missingSchema=(0,HY.normalizeId)((0,HY.getFullPath)(Q,this.missingRef))}}gz.default=_z});var a4=j((hz)=>{Object.defineProperty(hz,"__esModule",{value:!0});hz.resolveSchema=hz.getCompilingSchema=hz.resolveRef=hz.compileSchema=hz.SchemaEnv=void 0;var g0=g(),YL=o4(),I1=e0(),y0=C6(),yz=c(),XL=x6();class g6{constructor(Q){var Y;this.refs={},this.dynamicAnchors={};let X;if(typeof Q.schema=="object")X=Q.schema;this.schema=Q.schema,this.schemaId=Q.schemaId,this.root=Q.root||this,this.baseId=(Y=Q.baseId)!==null&&Y!==void 0?Y:(0,y0.normalizeId)(X===null||X===void 0?void 0:X[Q.schemaId||"$id"]),this.schemaPath=Q.schemaPath,this.localRefs=Q.localRefs,this.meta=Q.meta,this.$async=X===null||X===void 0?void 0:X.$async,this.refs={}}}hz.SchemaEnv=g6;function AY(Q){let Y=uz.call(this,Q);if(Y)return Y;let X=(0,y0.getFullPath)(this.opts.uriResolver,Q.root.baseId),{es5:W,lines:G}=this.opts.code,{ownProperties:$}=this.opts,z=new g0.CodeGen(this.scope,{es5:W,lines:G,ownProperties:$}),J;if(Q.$async)J=z.scopeValue("Error",{ref:YL.default,code:g0._`require("ajv/dist/runtime/validation_error").default`});let H=z.scopeName("validate");Q.validateName=H;let U={gen:z,allErrors:this.opts.allErrors,data:I1.default.data,parentData:I1.default.parentData,parentDataProperty:I1.default.parentDataProperty,dataNames:[I1.default.data],dataPathArr:[g0.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:z.scopeValue("schema",this.opts.code.source===!0?{ref:Q.schema,code:(0,g0.stringify)(Q.schema)}:{ref:Q.schema}),validateName:H,ValidationError:J,schema:Q.schema,schemaEnv:Q,rootId:X,baseId:Q.baseId||X,schemaPath:g0.nil,errSchemaPath:Q.schemaPath||(this.opts.jtd?"":"#"),errorPath:g0._`""`,opts:this.opts,self:this},A;try{this._compilations.add(Q),(0,XL.validateFunctionCode)(U),z.optimize(this.opts.code.optimize);let B=z.toString();if(A=`${z.scopeRefs(I1.default.scope)}return ${B}`,this.opts.code.process)A=this.opts.code.process(A,Q);let D=Function(`${I1.default.self}`,`${I1.default.scope}`,A)(this,this.scope.get());if(this.scope.value(H,{ref:D}),D.errors=null,D.schema=Q.schema,D.schemaEnv=Q,Q.$async)D.$async=!0;if(this.opts.code.source===!0)D.source={validateName:H,validateCode:B,scopeValues:z._values};if(this.opts.unevaluated){let{props:O,items:M}=U;if(D.evaluated={props:O instanceof g0.Name?void 0:O,items:M instanceof g0.Name?void 0:M,dynamicProps:O instanceof g0.Name,dynamicItems:M instanceof g0.Name},D.source)D.source.evaluated=(0,g0.stringify)(D.evaluated)}return Q.validate=D,Q}catch(B){if(delete Q.validate,delete Q.validateName,A)this.logger.error("Error compiling schema, function code:",A);throw B}finally{this._compilations.delete(Q)}}hz.compileSchema=AY;function WL(Q,Y,X){var W;X=(0,y0.resolveUrl)(this.opts.uriResolver,Y,X);let G=Q.refs[X];if(G)return G;let $=zL.call(this,Q,X);if($===void 0){let z=(W=Q.localRefs)===null||W===void 0?void 0:W[X],{schemaId:J}=this.opts;if(z)$=new g6({schema:z,schemaId:J,root:Q,baseId:Y})}if($===void 0)return;return Q.refs[X]=GL.call(this,$)}hz.resolveRef=WL;function GL(Q){if((0,y0.inlineRef)(Q.schema,this.opts.inlineRefs))return Q.schema;return Q.validate?Q:AY.call(this,Q)}function uz(Q){for(let Y of this._compilations)if($L(Y,Q))return Y}hz.getCompilingSchema=uz;function $L(Q,Y){return Q.schema===Y.schema&&Q.root===Y.root&&Q.baseId===Y.baseId}function zL(Q,Y){let X;while(typeof(X=this.refs[Y])=="string")Y=X;return X||this.schemas[Y]||t4.call(this,Q,Y)}function t4(Q,Y){let X=this.opts.uriResolver.parse(Y),W=(0,y0._getFullPath)(this.opts.uriResolver,X),G=(0,y0.getFullPath)(this.opts.uriResolver,Q.baseId,void 0);if(Object.keys(Q.schema).length>0&&W===G)return UY.call(this,X,Q);let $=(0,y0.normalizeId)(W),z=this.refs[$]||this.schemas[$];if(typeof z=="string"){let J=t4.call(this,Q,z);if(typeof(J===null||J===void 0?void 0:J.schema)!=="object")return;return UY.call(this,X,J)}if(typeof(z===null||z===void 0?void 0:z.schema)!=="object")return;if(!z.validate)AY.call(this,z);if($===(0,y0.normalizeId)(Y)){let{schema:J}=z,{schemaId:H}=this.opts,U=J[H];if(U)G=(0,y0.resolveUrl)(this.opts.uriResolver,G,U);return new g6({schema:J,schemaId:H,root:Q,baseId:G})}return UY.call(this,X,z)}hz.resolveSchema=t4;var JL=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function UY(Q,{baseId:Y,schema:X,root:W}){var G;if(((G=Q.fragment)===null||G===void 0?void 0:G[0])!=="/")return;for(let J of Q.fragment.slice(1).split("/")){if(typeof X==="boolean")return;let H=X[(0,yz.unescapeFragment)(J)];if(H===void 0)return;X=H;let U=typeof X==="object"&&X[this.opts.schemaId];if(!JL.has(J)&&U)Y=(0,y0.resolveUrl)(this.opts.uriResolver,Y,U)}let $;if(typeof X!="boolean"&&X.$ref&&!(0,yz.schemaHasRulesButRef)(X,this.RULES)){let J=(0,y0.resolveUrl)(this.opts.uriResolver,Y,X.$ref);$=t4.call(this,W,J)}let{schemaId:z}=this.opts;if($=$||new g6({schema:X,schemaId:z,root:W,baseId:Y}),$.schema!==$.root.schema)return $;return}});var lz=j((UI,KL)=>{KL.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 KY=j((AI,iz)=>{var DL=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),cz=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 BY(Q){let Y="",X=0,W=0;for(W=0;W<Q.length;W++){if(X=Q[W].charCodeAt(0),X===48)continue;if(!(X>=48&&X<=57||X>=65&&X<=70||X>=97&&X<=102))return"";Y+=Q[W];break}for(W+=1;W<Q.length;W++){if(X=Q[W].charCodeAt(0),!(X>=48&&X<=57||X>=65&&X<=70||X>=97&&X<=102))return"";Y+=Q[W]}return Y}var LL=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function mz(Q){return Q.length=0,!0}function FL(Q,Y,X){if(Q.length){let W=BY(Q);if(W!=="")Y.push(W);else return X.error=!0,!1;Q.length=0}return!0}function qL(Q){let Y=0,X={error:!1,address:"",zone:""},W=[],G=[],$=!1,z=!1,J=FL;for(let H=0;H<Q.length;H++){let U=Q[H];if(U==="["||U==="]")continue;if(U===":"){if($===!0)z=!0;if(!J(G,W,X))break;if(++Y>7){X.error=!0;break}if(H>0&&Q[H-1]===":")$=!0;W.push(":");continue}else if(U==="%"){if(!J(G,W,X))break;J=mz}else{G.push(U);continue}}if(G.length)if(J===mz)X.zone=G.join("");else if(z)W.push(G.join(""));else W.push(BY(G));return X.address=W.join(""),X}function pz(Q){if(OL(Q,":")<2)return{host:Q,isIPV6:!1};let Y=qL(Q);if(!Y.error){let{address:X,address:W}=Y;if(Y.zone)X+="%"+Y.zone,W+="%25"+Y.zone;return{host:X,isIPV6:!0,escapedHost:W}}else return{host:Q,isIPV6:!1}}function OL(Q,Y){let X=0;for(let W=0;W<Q.length;W++)if(Q[W]===Y)X++;return X}function ML(Q){let Y=Q,X=[],W=-1,G=0;while(G=Y.length){if(G===1)if(Y===".")break;else if(Y==="/"){X.push("/");break}else{X.push(Y);break}else if(G===2){if(Y[0]==="."){if(Y[1]===".")break;else if(Y[1]==="/"){Y=Y.slice(2);continue}}else if(Y[0]==="/"){if(Y[1]==="."||Y[1]==="/"){X.push("/");break}}}else if(G===3){if(Y==="/.."){if(X.length!==0)X.pop();X.push("/");break}}if(Y[0]==="."){if(Y[1]==="."){if(Y[2]==="/"){Y=Y.slice(3);continue}}else if(Y[1]==="/"){Y=Y.slice(2);continue}}else if(Y[0]==="/"){if(Y[1]==="."){if(Y[2]==="/"){Y=Y.slice(2);continue}else if(Y[2]==="."){if(Y[3]==="/"){if(Y=Y.slice(3),X.length!==0)X.pop();continue}}}}if((W=Y.indexOf("/",1))===-1){X.push(Y);break}else X.push(Y.slice(0,W)),Y=Y.slice(W)}return X.join("")}function VL(Q,Y){let X=Y!==!0?escape:unescape;if(Q.scheme!==void 0)Q.scheme=X(Q.scheme);if(Q.userinfo!==void 0)Q.userinfo=X(Q.userinfo);if(Q.host!==void 0)Q.host=X(Q.host);if(Q.path!==void 0)Q.path=X(Q.path);if(Q.query!==void 0)Q.query=X(Q.query);if(Q.fragment!==void 0)Q.fragment=X(Q.fragment);return Q}function NL(Q){let Y=[];if(Q.userinfo!==void 0)Y.push(Q.userinfo),Y.push("@");if(Q.host!==void 0){let X=unescape(Q.host);if(!cz(X)){let W=pz(X);if(W.isIPV6===!0)X=`[${W.escapedHost}]`;else X=Q.host}Y.push(X)}if(typeof Q.port==="number"||typeof Q.port==="string")Y.push(":"),Y.push(String(Q.port));return Y.length?Y.join(""):void 0}iz.exports={nonSimpleDomain:LL,recomposeAuthority:NL,normalizeComponentEncoding:VL,removeDotSegments:ML,isIPv4:cz,isUUID:DL,normalizeIPv6:pz,stringArrayToHexStripped:BY}});var tz=j((BI,oz)=>{var{isUUID:ZL}=KY(),wL=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,jL=["http","https","ws","wss","urn","urn:uuid"];function PL(Q){return jL.indexOf(Q)!==-1}function DY(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 nz(Q){if(!Q.host)Q.error=Q.error||"HTTP URIs must have a host.";return Q}function rz(Q){let Y=String(Q.scheme).toLowerCase()==="https";if(Q.port===(Y?443:80)||Q.port==="")Q.port=void 0;if(!Q.path)Q.path="/";return Q}function bL(Q){return Q.secure=DY(Q),Q.resourceName=(Q.path||"/")+(Q.query?"?"+Q.query:""),Q.path=void 0,Q.query=void 0,Q}function IL(Q){if(Q.port===(DY(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[Y,X]=Q.resourceName.split("?");Q.path=Y&&Y!=="/"?Y:void 0,Q.query=X,Q.resourceName=void 0}return Q.fragment=void 0,Q}function EL(Q,Y){if(!Q.path)return Q.error="URN can not be parsed",Q;let X=Q.path.match(wL);if(X){let W=Y.scheme||Q.scheme||"urn";Q.nid=X[1].toLowerCase(),Q.nss=X[2];let G=`${W}:${Y.nid||Q.nid}`,$=LY(G);if(Q.path=void 0,$)Q=$.parse(Q,Y)}else Q.error=Q.error||"URN can not be parsed.";return Q}function TL(Q,Y){if(Q.nid===void 0)throw Error("URN without nid cannot be serialized");let X=Y.scheme||Q.scheme||"urn",W=Q.nid.toLowerCase(),G=`${X}:${Y.nid||W}`,$=LY(G);if($)Q=$.serialize(Q,Y);let z=Q,J=Q.nss;return z.path=`${W||Y.nid}:${J}`,Y.skipEscape=!0,z}function SL(Q,Y){let X=Q;if(X.uuid=X.nss,X.nss=void 0,!Y.tolerant&&(!X.uuid||!ZL(X.uuid)))X.error=X.error||"UUID is not valid.";return X}function RL(Q){let Y=Q;return Y.nss=(Q.uuid||"").toLowerCase(),Y}var dz={scheme:"http",domainHost:!0,parse:nz,serialize:rz},CL={scheme:"https",domainHost:dz.domainHost,parse:nz,serialize:rz},s4={scheme:"ws",domainHost:!0,parse:bL,serialize:IL},kL={scheme:"wss",domainHost:s4.domainHost,parse:s4.parse,serialize:s4.serialize},vL={scheme:"urn",parse:EL,serialize:TL,skipNormalize:!0},xL={scheme:"urn:uuid",parse:SL,serialize:RL,skipNormalize:!0},e4={http:dz,https:CL,ws:s4,wss:kL,urn:vL,"urn:uuid":xL};Object.setPrototypeOf(e4,null);function LY(Q){return Q&&(e4[Q]||e4[Q.toLowerCase()])||void 0}oz.exports={wsIsSecure:DY,SCHEMES:e4,isValidSchemeName:PL,getSchemeHandler:LY}});var ez=j((KI,YQ)=>{var{normalizeIPv6:_L,removeDotSegments:y6,recomposeAuthority:gL,normalizeComponentEncoding:QQ,isIPv4:yL,nonSimpleDomain:uL}=KY(),{SCHEMES:hL,getSchemeHandler:az}=tz();function fL(Q,Y){if(typeof Q==="string")Q=p0(Y1(Q,Y),Y);else if(typeof Q==="object")Q=Y1(p0(Q,Y),Y);return Q}function lL(Q,Y,X){let W=X?Object.assign({scheme:"null"},X):{scheme:"null"},G=sz(Y1(Q,W),Y1(Y,W),W,!0);return W.skipEscape=!0,p0(G,W)}function sz(Q,Y,X,W){let G={};if(!W)Q=Y1(p0(Q,X),X),Y=Y1(p0(Y,X),X);if(X=X||{},!X.tolerant&&Y.scheme)G.scheme=Y.scheme,G.userinfo=Y.userinfo,G.host=Y.host,G.port=Y.port,G.path=y6(Y.path||""),G.query=Y.query;else{if(Y.userinfo!==void 0||Y.host!==void 0||Y.port!==void 0)G.userinfo=Y.userinfo,G.host=Y.host,G.port=Y.port,G.path=y6(Y.path||""),G.query=Y.query;else{if(!Y.path)if(G.path=Q.path,Y.query!==void 0)G.query=Y.query;else G.query=Q.query;else{if(Y.path[0]==="/")G.path=y6(Y.path);else{if((Q.userinfo!==void 0||Q.host!==void 0||Q.port!==void 0)&&!Q.path)G.path="/"+Y.path;else if(!Q.path)G.path=Y.path;else G.path=Q.path.slice(0,Q.path.lastIndexOf("/")+1)+Y.path;G.path=y6(G.path)}G.query=Y.query}G.userinfo=Q.userinfo,G.host=Q.host,G.port=Q.port}G.scheme=Q.scheme}return G.fragment=Y.fragment,G}function mL(Q,Y,X){if(typeof Q==="string")Q=unescape(Q),Q=p0(QQ(Y1(Q,X),!0),{...X,skipEscape:!0});else if(typeof Q==="object")Q=p0(QQ(Q,!0),{...X,skipEscape:!0});if(typeof Y==="string")Y=unescape(Y),Y=p0(QQ(Y1(Y,X),!0),{...X,skipEscape:!0});else if(typeof Y==="object")Y=p0(QQ(Y,!0),{...X,skipEscape:!0});return Q.toLowerCase()===Y.toLowerCase()}function p0(Q,Y){let X={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({},Y),G=[],$=az(W.scheme||X.scheme);if($&&$.serialize)$.serialize(X,W);if(X.path!==void 0)if(!W.skipEscape){if(X.path=escape(X.path),X.scheme!==void 0)X.path=X.path.split("%3A").join(":")}else X.path=unescape(X.path);if(W.reference!=="suffix"&&X.scheme)G.push(X.scheme,":");let z=gL(X);if(z!==void 0){if(W.reference!=="suffix")G.push("//");if(G.push(z),X.path&&X.path[0]!=="/")G.push("/")}if(X.path!==void 0){let J=X.path;if(!W.absolutePath&&(!$||!$.absolutePath))J=y6(J);if(z===void 0&&J[0]==="/"&&J[1]==="/")J="/%2F"+J.slice(2);G.push(J)}if(X.query!==void 0)G.push("?",X.query);if(X.fragment!==void 0)G.push("#",X.fragment);return G.join("")}var cL=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function Y1(Q,Y){let X=Object.assign({},Y),W={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},G=!1;if(X.reference==="suffix")if(X.scheme)Q=X.scheme+":"+Q;else Q="//"+Q;let $=Q.match(cL);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(yL(W.host)===!1){let H=_L(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(X.reference&&X.reference!=="suffix"&&X.reference!==W.reference)W.error=W.error||"URI is not a "+X.reference+" reference.";let z=az(X.scheme||W.scheme);if(!X.unicodeSupport&&(!z||!z.unicodeSupport)){if(W.host&&(X.domainHost||z&&z.domainHost)&&G===!1&&uL(W.host))try{W.host=URL.domainToASCII(W.host.toLowerCase())}catch(J){W.error=W.error||"Host's domain name can not be converted to ASCII: "+J}}if(!z||z&&!z.skipNormalize){if(Q.indexOf("%")!==-1){if(W.scheme!==void 0)W.scheme=unescape(W.scheme);if(W.host!==void 0)W.host=unescape(W.host)}if(W.path)W.path=escape(unescape(W.path));if(W.fragment)W.fragment=encodeURI(decodeURIComponent(W.fragment))}if(z&&z.parse)z.parse(W,X)}else W.error=W.error||"URI can not be parsed.";return W}var FY={SCHEMES:hL,normalize:fL,resolve:lL,resolveComponent:sz,equal:mL,serialize:p0,parse:Y1};YQ.exports=FY;YQ.exports.default=FY;YQ.exports.fastUri=FY});var XJ=j((YJ)=>{Object.defineProperty(YJ,"__esModule",{value:!0});var QJ=ez();QJ.code='require("ajv/dist/runtime/uri").default';YJ.default=QJ});var AJ=j((X1)=>{Object.defineProperty(X1,"__esModule",{value:!0});X1.CodeGen=X1.Name=X1.nil=X1.stringify=X1.str=X1._=X1.KeywordCxt=void 0;var iL=x6();Object.defineProperty(X1,"KeywordCxt",{enumerable:!0,get:function(){return iL.KeywordCxt}});var i1=g();Object.defineProperty(X1,"_",{enumerable:!0,get:function(){return i1._}});Object.defineProperty(X1,"str",{enumerable:!0,get:function(){return i1.str}});Object.defineProperty(X1,"stringify",{enumerable:!0,get:function(){return i1.stringify}});Object.defineProperty(X1,"nil",{enumerable:!0,get:function(){return i1.nil}});Object.defineProperty(X1,"Name",{enumerable:!0,get:function(){return i1.Name}});Object.defineProperty(X1,"CodeGen",{enumerable:!0,get:function(){return i1.CodeGen}});var nL=o4(),JJ=_6(),rL=d9(),u6=a4(),dL=g(),h6=C6(),XQ=R6(),OY=c(),WJ=lz(),oL=XJ(),HJ=(Q,Y)=>new RegExp(Q,Y);HJ.code="new RegExp";var tL=["removeAdditional","useDefaults","coerceTypes"],aL=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),sL={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."},eL={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},GJ=200;function QF(Q){var Y,X,W,G,$,z,J,H,U,A,B,K,D,O,M,Z,V,R,T,y,S,m0,r0,PQ,bQ;let e1=Q.strict,IQ=(Y=Q.code)===null||Y===void 0?void 0:Y.optimize,aY=IQ===!0||IQ===void 0?1:IQ||0,sY=(W=(X=Q.code)===null||X===void 0?void 0:X.regExp)!==null&&W!==void 0?W:HJ,a5=(G=Q.uriResolver)!==null&&G!==void 0?G:oL.default;return{strictSchema:(z=($=Q.strictSchema)!==null&&$!==void 0?$:e1)!==null&&z!==void 0?z:!0,strictNumbers:(H=(J=Q.strictNumbers)!==null&&J!==void 0?J:e1)!==null&&H!==void 0?H:!0,strictTypes:(A=(U=Q.strictTypes)!==null&&U!==void 0?U:e1)!==null&&A!==void 0?A:"log",strictTuples:(K=(B=Q.strictTuples)!==null&&B!==void 0?B:e1)!==null&&K!==void 0?K:"log",strictRequired:(O=(D=Q.strictRequired)!==null&&D!==void 0?D:e1)!==null&&O!==void 0?O:!1,code:Q.code?{...Q.code,optimize:aY,regExp:sY}:{optimize:aY,regExp:sY},loopRequired:(M=Q.loopRequired)!==null&&M!==void 0?M:GJ,loopEnum:(Z=Q.loopEnum)!==null&&Z!==void 0?Z:GJ,meta:(V=Q.meta)!==null&&V!==void 0?V:!0,messages:(R=Q.messages)!==null&&R!==void 0?R:!0,inlineRefs:(T=Q.inlineRefs)!==null&&T!==void 0?T:!0,schemaId:(y=Q.schemaId)!==null&&y!==void 0?y:"$id",addUsedSchema:(S=Q.addUsedSchema)!==null&&S!==void 0?S:!0,validateSchema:(m0=Q.validateSchema)!==null&&m0!==void 0?m0:!0,validateFormats:(r0=Q.validateFormats)!==null&&r0!==void 0?r0:!0,unicodeRegExp:(PQ=Q.unicodeRegExp)!==null&&PQ!==void 0?PQ:!0,int32range:(bQ=Q.int32range)!==null&&bQ!==void 0?bQ:!0,uriResolver:a5}}class WQ{constructor(Q={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,Q=this.opts={...Q,...QF(Q)};let{es5:Y,lines:X}=this.opts.code;this.scope=new dL.ValueScope({scope:{},prefixes:aL,es5:Y,lines:X}),this.logger=zF(Q.logger);let W=Q.validateFormats;if(Q.validateFormats=!1,this.RULES=(0,rL.getRules)(),$J.call(this,sL,Q,"NOT SUPPORTED"),$J.call(this,eL,Q,"DEPRECATED","warn"),this._metaOpts=GF.call(this),Q.formats)XF.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),Q.keywords)WF.call(this,Q.keywords);if(typeof Q.meta=="object")this.addMetaSchema(Q.meta);YF.call(this),Q.validateFormats=W}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:Q,meta:Y,schemaId:X}=this.opts,W=WJ;if(X==="id")W={...WJ},W.id=W.$id,delete W.$id;if(Y&&Q)this.addMetaSchema(W,W[X],!1)}defaultMeta(){let{meta:Q,schemaId:Y}=this.opts;return this.opts.defaultMeta=typeof Q=="object"?Q[Y]||Q:void 0}validate(Q,Y){let X;if(typeof Q=="string"){if(X=this.getSchema(Q),!X)throw Error(`no schema with key or ref "${Q}"`)}else X=this.compile(Q);let W=X(Y);if(!("$async"in X))this.errors=X.errors;return W}compile(Q,Y){let X=this._addSchema(Q,Y);return X.validate||this._compileSchemaEnv(X)}compileAsync(Q,Y){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:X}=this.opts;return W.call(this,Q,Y);async function W(U,A){await G.call(this,U.$schema);let B=this._addSchema(U,A);return B.validate||$.call(this,B)}async function G(U){if(U&&!this.getSchema(U))await W.call(this,{$ref:U},!0)}async function $(U){try{return this._compileSchemaEnv(U)}catch(A){if(!(A instanceof JJ.default))throw A;return z.call(this,A),await J.call(this,A.missingSchema),$.call(this,U)}}function z({missingSchema:U,missingRef:A}){if(this.refs[U])throw Error(`AnySchema ${U} is loaded but ${A} cannot be resolved`)}async function J(U){let A=await H.call(this,U);if(!this.refs[U])await G.call(this,A.$schema);if(!this.refs[U])this.addSchema(A,U,Y)}async function H(U){let A=this._loading[U];if(A)return A;try{return await(this._loading[U]=X(U))}finally{delete this._loading[U]}}}addSchema(Q,Y,X,W=this.opts.validateSchema){if(Array.isArray(Q)){for(let $ of Q)this.addSchema($,void 0,X,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 Y=(0,h6.normalizeId)(Y||G),this._checkUnique(Y),this.schemas[Y]=this._addSchema(Q,X,Y,W,!0),this}addMetaSchema(Q,Y,X=this.opts.validateSchema){return this.addSchema(Q,Y,!0,X),this}validateSchema(Q,Y){if(typeof Q=="boolean")return!0;let X;if(X=Q.$schema,X!==void 0&&typeof X!="string")throw Error("$schema must be a string");if(X=X||this.opts.defaultMeta||this.defaultMeta(),!X)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let W=this.validate(X,Q);if(!W&&Y){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 Y;while(typeof(Y=zJ.call(this,Q))=="string")Q=Y;if(Y===void 0){let{schemaId:X}=this.opts,W=new u6.SchemaEnv({schema:{},schemaId:X});if(Y=u6.resolveSchema.call(this,W,Q),!Y)return;this.refs[Q]=Y}return Y.validate||this._compileSchemaEnv(Y)}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 Y=zJ.call(this,Q);if(typeof Y=="object")this._cache.delete(Y.schema);return delete this.schemas[Q],delete this.refs[Q],this}case"object":{let Y=Q;this._cache.delete(Y);let X=Q[this.opts.schemaId];if(X)X=(0,h6.normalizeId)(X),delete this.schemas[X],delete this.refs[X];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(Q){for(let Y of Q)this.addKeyword(Y);return this}addKeyword(Q,Y){let X;if(typeof Q=="string"){if(X=Q,typeof Y=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),Y.keyword=X}else if(typeof Q=="object"&&Y===void 0){if(Y=Q,X=Y.keyword,Array.isArray(X)&&!X.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(HF.call(this,X,Y),!Y)return(0,OY.eachItem)(X,(G)=>qY.call(this,G)),this;AF.call(this,Y);let W={...Y,type:(0,XQ.getJSONTypes)(Y.type),schemaType:(0,XQ.getJSONTypes)(Y.schemaType)};return(0,OY.eachItem)(X,W.type.length===0?(G)=>qY.call(this,G,W):(G)=>W.type.forEach(($)=>qY.call(this,G,W,$))),this}getKeyword(Q){let Y=this.RULES.all[Q];return typeof Y=="object"?Y.definition:!!Y}removeKeyword(Q){let{RULES:Y}=this;delete Y.keywords[Q],delete Y.all[Q];for(let X of Y.rules){let W=X.rules.findIndex((G)=>G.keyword===Q);if(W>=0)X.rules.splice(W,1)}return this}addFormat(Q,Y){if(typeof Y=="string")Y=new RegExp(Y);return this.formats[Q]=Y,this}errorsText(Q=this.errors,{separator:Y=", ",dataVar:X="data"}={}){if(!Q||Q.length===0)return"No errors";return Q.map((W)=>`${X}${W.instancePath} ${W.message}`).reduce((W,G)=>W+Y+G)}$dataMetaSchema(Q,Y){let X=this.RULES.all;Q=JSON.parse(JSON.stringify(Q));for(let W of Y){let G=W.split("/").slice(1),$=Q;for(let z of G)$=$[z];for(let z in X){let J=X[z];if(typeof J!="object")continue;let{$data:H}=J.definition,U=$[z];if(H&&U)$[z]=UJ(U)}}return Q}_removeAllSchemas(Q,Y){for(let X in Q){let W=Q[X];if(!Y||Y.test(X)){if(typeof W=="string")delete Q[X];else if(W&&!W.meta)this._cache.delete(W.schema),delete Q[X]}}}_addSchema(Q,Y,X,W=this.opts.validateSchema,G=this.opts.addUsedSchema){let $,{schemaId:z}=this.opts;if(typeof Q=="object")$=Q[z];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 J=this._cache.get(Q);if(J!==void 0)return J;X=(0,h6.normalizeId)($||X);let H=h6.getSchemaRefs.call(this,Q,X);if(J=new u6.SchemaEnv({schema:Q,schemaId:z,meta:Y,baseId:X,localRefs:H}),this._cache.set(J.schema,J),G&&!X.startsWith("#")){if(X)this._checkUnique(X);this.refs[X]=J}if(W)this.validateSchema(Q,!0);return J}_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 u6.compileSchema.call(this,Q);if(!Q.validate)throw Error("ajv implementation error");return Q.validate}_compileMetaSchema(Q){let Y=this.opts;this.opts=this._metaOpts;try{u6.compileSchema.call(this,Q)}finally{this.opts=Y}}}WQ.ValidationError=nL.default;WQ.MissingRefError=JJ.default;X1.default=WQ;function $J(Q,Y,X,W="error"){for(let G in Q){let $=G;if($ in Y)this.logger[W](`${X}: option ${G}. ${Q[$]}`)}}function zJ(Q){return Q=(0,h6.normalizeId)(Q),this.schemas[Q]||this.refs[Q]}function YF(){let Q=this.opts.schemas;if(!Q)return;if(Array.isArray(Q))this.addSchema(Q);else for(let Y in Q)this.addSchema(Q[Y],Y)}function XF(){for(let Q in this.opts.formats){let Y=this.opts.formats[Q];if(Y)this.addFormat(Q,Y)}}function WF(Q){if(Array.isArray(Q)){this.addVocabulary(Q);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let Y in Q){let X=Q[Y];if(!X.keyword)X.keyword=Y;this.addKeyword(X)}}function GF(){let Q={...this.opts};for(let Y of tL)delete Q[Y];return Q}var $F={log(){},warn(){},error(){}};function zF(Q){if(Q===!1)return $F;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 JF=/^[a-z_$][a-z0-9_$:-]*$/i;function HF(Q,Y){let{RULES:X}=this;if((0,OY.eachItem)(Q,(W)=>{if(X.keywords[W])throw Error(`Keyword ${W} is already defined`);if(!JF.test(W))throw Error(`Keyword ${W} has invalid name`)}),!Y)return;if(Y.$data&&!(("code"in Y)||("validate"in Y)))throw Error('$data keyword must have "code" or "validate" function')}function qY(Q,Y,X){var W;let G=Y===null||Y===void 0?void 0:Y.post;if(X&&G)throw Error('keyword with "post" flag cannot have "type"');let{RULES:$}=this,z=G?$.post:$.rules.find(({type:H})=>H===X);if(!z)z={type:X,rules:[]},$.rules.push(z);if($.keywords[Q]=!0,!Y)return;let J={keyword:Q,definition:{...Y,type:(0,XQ.getJSONTypes)(Y.type),schemaType:(0,XQ.getJSONTypes)(Y.schemaType)}};if(Y.before)UF.call(this,z,J,Y.before);else z.rules.push(J);$.all[Q]=J,(W=Y.implements)===null||W===void 0||W.forEach((H)=>this.addKeyword(H))}function UF(Q,Y,X){let W=Q.rules.findIndex((G)=>G.keyword===X);if(W>=0)Q.rules.splice(W,0,Y);else Q.rules.push(Y),this.logger.warn(`rule ${X} is not defined`)}function AF(Q){let{metaSchema:Y}=Q;if(Y===void 0)return;if(Q.$data&&this.opts.$data)Y=UJ(Y);Q.validateSchema=this.compile(Y,!0)}var BF={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function UJ(Q){return{anyOf:[Q,BF]}}});var KJ=j((BJ)=>{Object.defineProperty(BJ,"__esModule",{value:!0});var LF={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};BJ.default=LF});var MJ=j((qJ)=>{Object.defineProperty(qJ,"__esModule",{value:!0});qJ.callRef=qJ.getValidate=void 0;var qF=_6(),DJ=S0(),Z0=g(),n1=e0(),LJ=a4(),GQ=c(),OF={keyword:"$ref",schemaType:"string",code(Q){let{gen:Y,schema:X,it:W}=Q,{baseId:G,schemaEnv:$,validateName:z,opts:J,self:H}=W,{root:U}=$;if((X==="#"||X==="#/")&&G===U.baseId)return B();let A=LJ.resolveRef.call(H,U,G,X);if(A===void 0)throw new qF.default(W.opts.uriResolver,G,X);if(A instanceof LJ.SchemaEnv)return K(A);return D(A);function B(){if($===U)return $Q(Q,z,$,$.$async);let O=Y.scopeValue("root",{ref:U});return $Q(Q,Z0._`${O}.validate`,U,U.$async)}function K(O){let M=FJ(Q,O);$Q(Q,M,O,O.$async)}function D(O){let M=Y.scopeValue("schema",J.code.source===!0?{ref:O,code:(0,Z0.stringify)(O)}:{ref:O}),Z=Y.name("valid"),V=Q.subschema({schema:O,dataTypes:[],schemaPath:Z0.nil,topSchemaRef:M,errSchemaPath:X},Z);Q.mergeEvaluated(V),Q.ok(Z)}}};function FJ(Q,Y){let{gen:X}=Q;return Y.validate?X.scopeValue("validate",{ref:Y.validate}):Z0._`${X.scopeValue("wrapper",{ref:Y})}.validate`}qJ.getValidate=FJ;function $Q(Q,Y,X,W){let{gen:G,it:$}=Q,{allErrors:z,schemaEnv:J,opts:H}=$,U=H.passContext?n1.default.this:Z0.nil;if(W)A();else B();function A(){if(!J.$async)throw Error("async schema referenced by sync schema");let O=G.let("valid");G.try(()=>{if(G.code(Z0._`await ${(0,DJ.callValidateCode)(Q,Y,U)}`),D(Y),!z)G.assign(O,!0)},(M)=>{if(G.if(Z0._`!(${M} instanceof ${$.ValidationError})`,()=>G.throw(M)),K(M),!z)G.assign(O,!1)}),Q.ok(O)}function B(){Q.result((0,DJ.callValidateCode)(Q,Y,U),()=>D(Y),()=>K(Y))}function K(O){let M=Z0._`${O}.errors`;G.assign(n1.default.vErrors,Z0._`${n1.default.vErrors} === null ? ${M} : ${n1.default.vErrors}.concat(${M})`),G.assign(n1.default.errors,Z0._`${n1.default.vErrors}.length`)}function D(O){var M;if(!$.opts.unevaluated)return;let Z=(M=X===null||X===void 0?void 0:X.validate)===null||M===void 0?void 0:M.evaluated;if($.props!==!0)if(Z&&!Z.dynamicProps){if(Z.props!==void 0)$.props=GQ.mergeEvaluated.props(G,Z.props,$.props)}else{let V=G.var("props",Z0._`${O}.evaluated.props`);$.props=GQ.mergeEvaluated.props(G,V,$.props,Z0.Name)}if($.items!==!0)if(Z&&!Z.dynamicItems){if(Z.items!==void 0)$.items=GQ.mergeEvaluated.items(G,Z.items,$.items)}else{let V=G.var("items",Z0._`${O}.evaluated.items`);$.items=GQ.mergeEvaluated.items(G,V,$.items,Z0.Name)}}}qJ.callRef=$Q;qJ.default=OF});var NJ=j((VJ)=>{Object.defineProperty(VJ,"__esModule",{value:!0});var NF=KJ(),ZF=MJ(),wF=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",NF.default,ZF.default];VJ.default=wF});var wJ=j((ZJ)=>{Object.defineProperty(ZJ,"__esModule",{value:!0});var zQ=g(),q1=zQ.operators,JQ={maximum:{okStr:"<=",ok:q1.LTE,fail:q1.GT},minimum:{okStr:">=",ok:q1.GTE,fail:q1.LT},exclusiveMaximum:{okStr:"<",ok:q1.LT,fail:q1.GTE},exclusiveMinimum:{okStr:">",ok:q1.GT,fail:q1.LTE}},PF={message:({keyword:Q,schemaCode:Y})=>zQ.str`must be ${JQ[Q].okStr} ${Y}`,params:({keyword:Q,schemaCode:Y})=>zQ._`{comparison: ${JQ[Q].okStr}, limit: ${Y}}`},bF={keyword:Object.keys(JQ),type:"number",schemaType:"number",$data:!0,error:PF,code(Q){let{keyword:Y,data:X,schemaCode:W}=Q;Q.fail$data(zQ._`${X} ${JQ[Y].fail} ${W} || isNaN(${X})`)}};ZJ.default=bF});var PJ=j((jJ)=>{Object.defineProperty(jJ,"__esModule",{value:!0});var f6=g(),EF={message:({schemaCode:Q})=>f6.str`must be multiple of ${Q}`,params:({schemaCode:Q})=>f6._`{multipleOf: ${Q}}`},TF={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:EF,code(Q){let{gen:Y,data:X,schemaCode:W,it:G}=Q,$=G.opts.multipleOfPrecision,z=Y.let("res"),J=$?f6._`Math.abs(Math.round(${z}) - ${z}) > 1e-${$}`:f6._`${z} !== parseInt(${z})`;Q.fail$data(f6._`(${W} === 0 || (${z} = ${X}/${W}, ${J}))`)}};jJ.default=TF});var EJ=j((IJ)=>{Object.defineProperty(IJ,"__esModule",{value:!0});function bJ(Q){let Y=Q.length,X=0,W=0,G;while(W<Y)if(X++,G=Q.charCodeAt(W++),G>=55296&&G<=56319&&W<Y){if(G=Q.charCodeAt(W),(G&64512)===56320)W++}return X}IJ.default=bJ;bJ.code='require("ajv/dist/runtime/ucs2length").default'});var SJ=j((TJ)=>{Object.defineProperty(TJ,"__esModule",{value:!0});var E1=g(),CF=c(),kF=EJ(),vF={message({keyword:Q,schemaCode:Y}){let X=Q==="maxLength"?"more":"fewer";return E1.str`must NOT have ${X} than ${Y} characters`},params:({schemaCode:Q})=>E1._`{limit: ${Q}}`},xF={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:vF,code(Q){let{keyword:Y,data:X,schemaCode:W,it:G}=Q,$=Y==="maxLength"?E1.operators.GT:E1.operators.LT,z=G.opts.unicode===!1?E1._`${X}.length`:E1._`${(0,CF.useFunc)(Q.gen,kF.default)}(${X})`;Q.fail$data(E1._`${z} ${$} ${W}`)}};TJ.default=xF});var CJ=j((RJ)=>{Object.defineProperty(RJ,"__esModule",{value:!0});var gF=S0(),HQ=g(),yF={message:({schemaCode:Q})=>HQ.str`must match pattern "${Q}"`,params:({schemaCode:Q})=>HQ._`{pattern: ${Q}}`},uF={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:yF,code(Q){let{data:Y,$data:X,schema:W,schemaCode:G,it:$}=Q,z=$.opts.unicodeRegExp?"u":"",J=X?HQ._`(new RegExp(${G}, ${z}))`:(0,gF.usePattern)(Q,W);Q.fail$data(HQ._`!${J}.test(${Y})`)}};RJ.default=uF});var vJ=j((kJ)=>{Object.defineProperty(kJ,"__esModule",{value:!0});var l6=g(),fF={message({keyword:Q,schemaCode:Y}){let X=Q==="maxProperties"?"more":"fewer";return l6.str`must NOT have ${X} than ${Y} properties`},params:({schemaCode:Q})=>l6._`{limit: ${Q}}`},lF={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:fF,code(Q){let{keyword:Y,data:X,schemaCode:W}=Q,G=Y==="maxProperties"?l6.operators.GT:l6.operators.LT;Q.fail$data(l6._`Object.keys(${X}).length ${G} ${W}`)}};kJ.default=lF});var _J=j((xJ)=>{Object.defineProperty(xJ,"__esModule",{value:!0});var m6=S0(),c6=g(),cF=c(),pF={message:({params:{missingProperty:Q}})=>c6.str`must have required property '${Q}'`,params:({params:{missingProperty:Q}})=>c6._`{missingProperty: ${Q}}`},iF={keyword:"required",type:"object",schemaType:"array",$data:!0,error:pF,code(Q){let{gen:Y,schema:X,schemaCode:W,data:G,$data:$,it:z}=Q,{opts:J}=z;if(!$&&X.length===0)return;let H=X.length>=J.loopRequired;if(z.allErrors)U();else A();if(J.strictRequired){let D=Q.parentSchema.properties,{definedProperties:O}=Q.it;for(let M of X)if((D===null||D===void 0?void 0:D[M])===void 0&&!O.has(M)){let Z=z.schemaEnv.baseId+z.errSchemaPath,V=`required property "${M}" is not defined at "${Z}" (strictRequired)`;(0,cF.checkStrictMode)(z,V,z.opts.strictRequired)}}function U(){if(H||$)Q.block$data(c6.nil,B);else for(let D of X)(0,m6.checkReportMissingProp)(Q,D)}function A(){let D=Y.let("missing");if(H||$){let O=Y.let("valid",!0);Q.block$data(O,()=>K(D,O)),Q.ok(O)}else Y.if((0,m6.checkMissingProp)(Q,X,D)),(0,m6.reportMissingProp)(Q,D),Y.else()}function B(){Y.forOf("prop",W,(D)=>{Q.setParams({missingProperty:D}),Y.if((0,m6.noPropertyInData)(Y,G,D,J.ownProperties),()=>Q.error())})}function K(D,O){Q.setParams({missingProperty:D}),Y.forOf(D,W,()=>{Y.assign(O,(0,m6.propertyInData)(Y,G,D,J.ownProperties)),Y.if((0,c6.not)(O),()=>{Q.error(),Y.break()})},c6.nil)}}};xJ.default=iF});var yJ=j((gJ)=>{Object.defineProperty(gJ,"__esModule",{value:!0});var p6=g(),rF={message({keyword:Q,schemaCode:Y}){let X=Q==="maxItems"?"more":"fewer";return p6.str`must NOT have ${X} than ${Y} items`},params:({schemaCode:Q})=>p6._`{limit: ${Q}}`},dF={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:rF,code(Q){let{keyword:Y,data:X,schemaCode:W}=Q,G=Y==="maxItems"?p6.operators.GT:p6.operators.LT;Q.fail$data(p6._`${X}.length ${G} ${W}`)}};gJ.default=dF});var UQ=j((hJ)=>{Object.defineProperty(hJ,"__esModule",{value:!0});var uJ=XY();uJ.code='require("ajv/dist/runtime/equal").default';hJ.default=uJ});var lJ=j((fJ)=>{Object.defineProperty(fJ,"__esModule",{value:!0});var MY=R6(),D0=g(),aF=c(),sF=UQ(),eF={message:({params:{i:Q,j:Y}})=>D0.str`must NOT have duplicate items (items ## ${Y} and ${Q} are identical)`,params:({params:{i:Q,j:Y}})=>D0._`{i: ${Q}, j: ${Y}}`},Qq={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:eF,code(Q){let{gen:Y,data:X,$data:W,schema:G,parentSchema:$,schemaCode:z,it:J}=Q;if(!W&&!G)return;let H=Y.let("valid"),U=$.items?(0,MY.getSchemaTypes)($.items):[];Q.block$data(H,A,D0._`${z} === false`),Q.ok(H);function A(){let O=Y.let("i",D0._`${X}.length`),M=Y.let("j");Q.setParams({i:O,j:M}),Y.assign(H,!0),Y.if(D0._`${O} > 1`,()=>(B()?K:D)(O,M))}function B(){return U.length>0&&!U.some((O)=>O==="object"||O==="array")}function K(O,M){let Z=Y.name("item"),V=(0,MY.checkDataTypes)(U,Z,J.opts.strictNumbers,MY.DataType.Wrong),R=Y.const("indices",D0._`{}`);Y.for(D0._`;${O}--;`,()=>{if(Y.let(Z,D0._`${X}[${O}]`),Y.if(V,D0._`continue`),U.length>1)Y.if(D0._`typeof ${Z} == "string"`,D0._`${Z} += "_"`);Y.if(D0._`typeof ${R}[${Z}] == "number"`,()=>{Y.assign(M,D0._`${R}[${Z}]`),Q.error(),Y.assign(H,!1).break()}).code(D0._`${R}[${Z}] = ${O}`)})}function D(O,M){let Z=(0,aF.useFunc)(Y,sF.default),V=Y.name("outer");Y.label(V).for(D0._`;${O}--;`,()=>Y.for(D0._`${M} = ${O}; ${M}--;`,()=>Y.if(D0._`${Z}(${X}[${O}], ${X}[${M}])`,()=>{Q.error(),Y.assign(H,!1).break(V)})))}}};fJ.default=Qq});var cJ=j((mJ)=>{Object.defineProperty(mJ,"__esModule",{value:!0});var VY=g(),Xq=c(),Wq=UQ(),Gq={message:"must be equal to constant",params:({schemaCode:Q})=>VY._`{allowedValue: ${Q}}`},$q={keyword:"const",$data:!0,error:Gq,code(Q){let{gen:Y,data:X,$data:W,schemaCode:G,schema:$}=Q;if(W||$&&typeof $=="object")Q.fail$data(VY._`!${(0,Xq.useFunc)(Y,Wq.default)}(${X}, ${G})`);else Q.fail(VY._`${$} !== ${X}`)}};mJ.default=$q});var iJ=j((pJ)=>{Object.defineProperty(pJ,"__esModule",{value:!0});var i6=g(),Jq=c(),Hq=UQ(),Uq={message:"must be equal to one of the allowed values",params:({schemaCode:Q})=>i6._`{allowedValues: ${Q}}`},Aq={keyword:"enum",schemaType:"array",$data:!0,error:Uq,code(Q){let{gen:Y,data:X,$data:W,schema:G,schemaCode:$,it:z}=Q;if(!W&&G.length===0)throw Error("enum must have non-empty array");let J=G.length>=z.opts.loopEnum,H,U=()=>H!==null&&H!==void 0?H:H=(0,Jq.useFunc)(Y,Hq.default),A;if(J||W)A=Y.let("valid"),Q.block$data(A,B);else{if(!Array.isArray(G))throw Error("ajv implementation error");let D=Y.const("vSchema",$);A=(0,i6.or)(...G.map((O,M)=>K(D,M)))}Q.pass(A);function B(){Y.assign(A,!1),Y.forOf("v",$,(D)=>Y.if(i6._`${U()}(${X}, ${D})`,()=>Y.assign(A,!0).break()))}function K(D,O){let M=G[O];return typeof M==="object"&&M!==null?i6._`${U()}(${X}, ${D}[${O}])`:i6._`${X} === ${M}`}}};pJ.default=Aq});var rJ=j((nJ)=>{Object.defineProperty(nJ,"__esModule",{value:!0});var Kq=wJ(),Dq=PJ(),Lq=SJ(),Fq=CJ(),qq=vJ(),Oq=_J(),Mq=yJ(),Vq=lJ(),Nq=cJ(),Zq=iJ(),wq=[Kq.default,Dq.default,Lq.default,Fq.default,qq.default,Oq.default,Mq.default,Vq.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Nq.default,Zq.default];nJ.default=wq});var ZY=j((oJ)=>{Object.defineProperty(oJ,"__esModule",{value:!0});oJ.validateAdditionalItems=void 0;var T1=g(),NY=c(),Pq={message:({params:{len:Q}})=>T1.str`must NOT have more than ${Q} items`,params:({params:{len:Q}})=>T1._`{limit: ${Q}}`},bq={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Pq,code(Q){let{parentSchema:Y,it:X}=Q,{items:W}=Y;if(!Array.isArray(W)){(0,NY.checkStrictMode)(X,'"additionalItems" is ignored when "items" is not an array of schemas');return}dJ(Q,W)}};function dJ(Q,Y){let{gen:X,schema:W,data:G,keyword:$,it:z}=Q;z.items=!0;let J=X.const("len",T1._`${G}.length`);if(W===!1)Q.setParams({len:Y.length}),Q.pass(T1._`${J} <= ${Y.length}`);else if(typeof W=="object"&&!(0,NY.alwaysValidSchema)(z,W)){let U=X.var("valid",T1._`${J} <= ${Y.length}`);X.if((0,T1.not)(U),()=>H(U)),Q.ok(U)}function H(U){X.forRange("i",Y.length,J,(A)=>{if(Q.subschema({keyword:$,dataProp:A,dataPropType:NY.Type.Num},U),!z.allErrors)X.if((0,T1.not)(U),()=>X.break())})}}oJ.validateAdditionalItems=dJ;oJ.default=bq});var wY=j((eJ)=>{Object.defineProperty(eJ,"__esModule",{value:!0});eJ.validateTuple=void 0;var aJ=g(),AQ=c(),Eq=S0(),Tq={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(Q){let{schema:Y,it:X}=Q;if(Array.isArray(Y))return sJ(Q,"additionalItems",Y);if(X.items=!0,(0,AQ.alwaysValidSchema)(X,Y))return;Q.ok((0,Eq.validateArray)(Q))}};function sJ(Q,Y,X=Q.schema){let{gen:W,parentSchema:G,data:$,keyword:z,it:J}=Q;if(A(G),J.opts.unevaluated&&X.length&&J.items!==!0)J.items=AQ.mergeEvaluated.items(W,X.length,J.items);let H=W.name("valid"),U=W.const("len",aJ._`${$}.length`);X.forEach((B,K)=>{if((0,AQ.alwaysValidSchema)(J,B))return;W.if(aJ._`${U} > ${K}`,()=>Q.subschema({keyword:z,schemaProp:K,dataProp:K},H)),Q.ok(H)});function A(B){let{opts:K,errSchemaPath:D}=J,O=X.length,M=O===B.minItems&&(O===B.maxItems||B[Y]===!1);if(K.strictTuples&&!M){let Z=`"${z}" is ${O}-tuple, but minItems or maxItems/${Y} are not specified or different at path "${D}"`;(0,AQ.checkStrictMode)(J,Z,K.strictTuples)}}}eJ.validateTuple=sJ;eJ.default=Tq});var X7=j((Y7)=>{Object.defineProperty(Y7,"__esModule",{value:!0});var Rq=wY(),Cq={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(Q)=>(0,Rq.validateTuple)(Q,"items")};Y7.default=Cq});var $7=j((G7)=>{Object.defineProperty(G7,"__esModule",{value:!0});var W7=g(),vq=c(),xq=S0(),_q=ZY(),gq={message:({params:{len:Q}})=>W7.str`must NOT have more than ${Q} items`,params:({params:{len:Q}})=>W7._`{limit: ${Q}}`},yq={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:gq,code(Q){let{schema:Y,parentSchema:X,it:W}=Q,{prefixItems:G}=X;if(W.items=!0,(0,vq.alwaysValidSchema)(W,Y))return;if(G)(0,_q.validateAdditionalItems)(Q,G);else Q.ok((0,xq.validateArray)(Q))}};G7.default=yq});var J7=j((z7)=>{Object.defineProperty(z7,"__esModule",{value:!0});var R0=g(),BQ=c(),hq={message:({params:{min:Q,max:Y}})=>Y===void 0?R0.str`must contain at least ${Q} valid item(s)`:R0.str`must contain at least ${Q} and no more than ${Y} valid item(s)`,params:({params:{min:Q,max:Y}})=>Y===void 0?R0._`{minContains: ${Q}}`:R0._`{minContains: ${Q}, maxContains: ${Y}}`},fq={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:hq,code(Q){let{gen:Y,schema:X,parentSchema:W,data:G,it:$}=Q,z,J,{minContains:H,maxContains:U}=W;if($.opts.next)z=H===void 0?1:H,J=U;else z=1;let A=Y.const("len",R0._`${G}.length`);if(Q.setParams({min:z,max:J}),J===void 0&&z===0){(0,BQ.checkStrictMode)($,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(J!==void 0&&z>J){(0,BQ.checkStrictMode)($,'"minContains" > "maxContains" is always invalid'),Q.fail();return}if((0,BQ.alwaysValidSchema)($,X)){let M=R0._`${A} >= ${z}`;if(J!==void 0)M=R0._`${M} && ${A} <= ${J}`;Q.pass(M);return}$.items=!0;let B=Y.name("valid");if(J===void 0&&z===1)D(B,()=>Y.if(B,()=>Y.break()));else if(z===0){if(Y.let(B,!0),J!==void 0)Y.if(R0._`${G}.length > 0`,K)}else Y.let(B,!1),K();Q.result(B,()=>Q.reset());function K(){let M=Y.name("_valid"),Z=Y.let("count",0);D(M,()=>Y.if(M,()=>O(Z)))}function D(M,Z){Y.forRange("i",0,A,(V)=>{Q.subschema({keyword:"contains",dataProp:V,dataPropType:BQ.Type.Num,compositeRule:!0},M),Z()})}function O(M){if(Y.code(R0._`${M}++`),J===void 0)Y.if(R0._`${M} >= ${z}`,()=>Y.assign(B,!0).break());else if(Y.if(R0._`${M} > ${J}`,()=>Y.assign(B,!1).break()),z===1)Y.assign(B,!0);else Y.if(R0._`${M} >= ${z}`,()=>Y.assign(B,!0))}}};z7.default=fq});var D7=j((A7)=>{Object.defineProperty(A7,"__esModule",{value:!0});A7.validateSchemaDeps=A7.validatePropertyDeps=A7.error=void 0;var jY=g(),mq=c(),n6=S0();A7.error={message:({params:{property:Q,depsCount:Y,deps:X}})=>{let W=Y===1?"property":"properties";return jY.str`must have ${W} ${X} when property ${Q} is present`},params:({params:{property:Q,depsCount:Y,deps:X,missingProperty:W}})=>jY._`{property: ${Q},
|
|
5
|
+
|| ${z} === "boolean" || ${G} === null`).assign(J,x._`[${G}]`)}}}function qK({gen:Q,parentData:Y,parentDataProperty:X},W){Q.if(x._`${Y} !== undefined`,()=>Q.assign(x._`${Y}[${X}]`,W))}function t9(Q,Y,X,W=m1.Correct){let G=W===m1.Correct?x.operators.EQ:x.operators.NEQ,$;switch(Q){case"null":return x._`${Y} ${G} null`;case"array":$=x._`Array.isArray(${Y})`;break;case"object":$=x._`${Y} && typeof ${Y} == "object" && !Array.isArray(${Y})`;break;case"integer":$=z(x._`!(${Y} % 1) && !isNaN(${Y})`);break;case"number":$=z();break;default:return x._`typeof ${Y} ${G} ${Q}`}return W===m1.Correct?$:(0,x.not)($);function z(J=x.nil){return(0,x.and)(x._`typeof ${Y} == "number"`,J,X?x._`isFinite(${Y})`:x.nil)}}i$.checkDataType=t9;function a9(Q,Y,X,W){if(Q.length===1)return t9(Q[0],Y,X,W);let G,$=(0,m$.toHash)(Q);if($.array&&$.object){let z=x._`typeof ${Y} != "object"`;G=$.null?z:x._`!${Y} || ${z}`,delete $.null,delete $.array,delete $.object}else G=x.nil;if($.number)delete $.integer;for(let z in $)G=(0,x.and)(G,t9(z,Y,X,W));return G}i$.checkDataTypes=a9;var OK={message:({schema:Q})=>`must be ${Q}`,params:({schema:Q,schemaValue:Y})=>typeof Q=="string"?x._`{type: ${Q}}`:x._`{type: ${Y}}`};function s9(Q){let Y=MK(Q);(0,BK.reportError)(Y,OK)}i$.reportTypeError=s9;function MK(Q){let{gen:Y,data:X,schema:W}=Q,G=(0,m$.schemaRefOrVal)(Q,W,"type");return{gen:Y,keyword:"type",data:X,schema:W.type,schemaCode:G,schemaValue:G,parentSchema:W,params:{},it:Q}}});var t$=j((d$)=>{Object.defineProperty(d$,"__esModule",{value:!0});d$.assignDefaults=void 0;var c1=g(),bK=c();function IK(Q,Y){let{properties:X,items:W}=Q.schema;if(Y==="object"&&X)for(let G in X)r$(Q,G,X[G].default);else if(Y==="array"&&Array.isArray(W))W.forEach((G,$)=>r$(Q,$,G.default))}d$.assignDefaults=IK;function r$(Q,Y,X){let{gen:W,compositeRule:G,data:$,opts:z}=Q;if(X===void 0)return;let J=c1._`${$}${(0,c1.getProperty)(Y)}`;if(G){(0,bK.checkStrictMode)(Q,`default is ignored for: ${J}`);return}let H=c1._`${J} === undefined`;if(z.useDefaults==="empty")H=c1._`${H} || ${J} === null || ${J} === ""`;W.if(H,c1._`${J} = ${(0,c1.stringify)(X)}`)}});var S0=j((e$)=>{Object.defineProperty(e$,"__esModule",{value:!0});e$.validateUnion=e$.validateArray=e$.usePattern=e$.callValidateCode=e$.schemaProperties=e$.allSchemaProperties=e$.noPropertyInData=e$.propertyInData=e$.isOwnProperty=e$.hasPropFunc=e$.reportMissingProp=e$.checkMissingProp=e$.checkReportMissingProp=void 0;var a=g(),e9=c(),L1=e0(),EK=c();function TK(Q,Y){let{gen:X,data:W,it:G}=Q;X.if(YY(X,W,Y,G.opts.ownProperties),()=>{Q.setParams({missingProperty:a._`${Y}`},!0),Q.error()})}e$.checkReportMissingProp=TK;function SK({gen:Q,data:Y,it:{opts:X}},W,G){return(0,a.or)(...W.map(($)=>(0,a.and)(YY(Q,Y,$,X.ownProperties),a._`${G} = ${$}`)))}e$.checkMissingProp=SK;function RK(Q,Y){Q.setParams({missingProperty:Y},!0),Q.error()}e$.reportMissingProp=RK;function a$(Q){return Q.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:a._`Object.prototype.hasOwnProperty`})}e$.hasPropFunc=a$;function QY(Q,Y,X){return a._`${a$(Q)}.call(${Y}, ${X})`}e$.isOwnProperty=QY;function CK(Q,Y,X,W){let G=a._`${Y}${(0,a.getProperty)(X)} !== undefined`;return W?a._`${G} && ${QY(Q,Y,X)}`:G}e$.propertyInData=CK;function YY(Q,Y,X,W){let G=a._`${Y}${(0,a.getProperty)(X)} === undefined`;return W?(0,a.or)(G,(0,a.not)(QY(Q,Y,X))):G}e$.noPropertyInData=YY;function s$(Q){return Q?Object.keys(Q).filter((Y)=>Y!=="__proto__"):[]}e$.allSchemaProperties=s$;function kK(Q,Y){return s$(Y).filter((X)=>!(0,e9.alwaysValidSchema)(Q,Y[X]))}e$.schemaProperties=kK;function vK({schemaCode:Q,data:Y,it:{gen:X,topSchemaRef:W,schemaPath:G,errorPath:$},it:z},J,H,U){let A=U?a._`${Q}, ${Y}, ${W}${G}`:Y,B=[[L1.default.instancePath,(0,a.strConcat)(L1.default.instancePath,$)],[L1.default.parentData,z.parentData],[L1.default.parentDataProperty,z.parentDataProperty],[L1.default.rootData,L1.default.rootData]];if(z.opts.dynamicRef)B.push([L1.default.dynamicAnchors,L1.default.dynamicAnchors]);let K=a._`${A}, ${X.object(...B)}`;return H!==a.nil?a._`${J}.call(${H}, ${K})`:a._`${J}(${K})`}e$.callValidateCode=vK;var xK=a._`new RegExp`;function _K({gen:Q,it:{opts:Y}},X){let W=Y.unicodeRegExp?"u":"",{regExp:G}=Y.code,$=G(X,W);return Q.scopeValue("pattern",{key:$.toString(),ref:$,code:a._`${G.code==="new RegExp"?xK:(0,EK.useFunc)(Q,G)}(${X}, ${W})`})}e$.usePattern=_K;function gK(Q){let{gen:Y,data:X,keyword:W,it:G}=Q,$=Y.name("valid");if(G.allErrors){let J=Y.let("valid",!0);return z(()=>Y.assign(J,!1)),J}return Y.var($,!0),z(()=>Y.break()),$;function z(J){let H=Y.const("len",a._`${X}.length`);Y.forRange("i",0,H,(U)=>{Q.subschema({keyword:W,dataProp:U,dataPropType:e9.Type.Num},$),Y.if((0,a.not)($),J)})}}e$.validateArray=gK;function yK(Q){let{gen:Y,schema:X,keyword:W,it:G}=Q;if(!Array.isArray(X))throw Error("ajv implementation error");if(X.some((H)=>(0,e9.alwaysValidSchema)(G,H))&&!G.opts.unevaluated)return;let z=Y.let("valid",!1),J=Y.name("_valid");Y.block(()=>X.forEach((H,U)=>{let A=Q.subschema({keyword:W,schemaProp:U,compositeRule:!0},J);if(Y.assign(z,a._`${z} || ${J}`),!Q.mergeValidEvaluated(A,J))Y.if((0,a.not)(z))})),Q.result(z,()=>Q.reset(),()=>Q.error(!0))}e$.validateUnion=yK});var $z=j((Wz)=>{Object.defineProperty(Wz,"__esModule",{value:!0});Wz.validateKeywordUsage=Wz.validSchemaType=Wz.funcKeywordCode=Wz.macroKeywordCode=void 0;var O0=g(),b1=e0(),tK=S0(),aK=R6();function sK(Q,Y){let{gen:X,keyword:W,schema:G,parentSchema:$,it:z}=Q,J=Y.macro.call(z.self,G,$,z),H=Xz(X,W,J);if(z.opts.validateSchema!==!1)z.self.validateSchema(J,!0);let U=X.name("valid");Q.subschema({schema:J,schemaPath:O0.nil,errSchemaPath:`${z.errSchemaPath}/${W}`,topSchemaRef:H,compositeRule:!0},U),Q.pass(U,()=>Q.error(!0))}Wz.macroKeywordCode=sK;function eK(Q,Y){var X;let{gen:W,keyword:G,schema:$,parentSchema:z,$data:J,it:H}=Q;YD(H,Y);let U=!J&&Y.compile?Y.compile.call(H.self,$,z,H):Y.validate,A=Xz(W,G,U),B=W.let("valid");Q.block$data(B,K),Q.ok((X=Y.valid)!==null&&X!==void 0?X:B);function K(){if(Y.errors===!1){if(M(),Y.modifying)Yz(Q);Z(()=>Q.error())}else{let V=Y.async?D():O();if(Y.modifying)Yz(Q);Z(()=>QD(Q,V))}}function D(){let V=W.let("ruleErrs",null);return W.try(()=>M(O0._`await `),(R)=>W.assign(B,!1).if(O0._`${R} instanceof ${H.ValidationError}`,()=>W.assign(V,O0._`${R}.errors`),()=>W.throw(R))),V}function O(){let V=O0._`${A}.errors`;return W.assign(V,null),M(O0.nil),V}function M(V=Y.async?O0._`await `:O0.nil){let R=H.opts.passContext?b1.default.this:b1.default.self,T=!(("compile"in Y)&&!J||Y.schema===!1);W.assign(B,O0._`${V}${(0,tK.callValidateCode)(Q,A,R,T)}`,Y.modifying)}function Z(V){var R;W.if((0,O0.not)((R=Y.valid)!==null&&R!==void 0?R:B),V)}}Wz.funcKeywordCode=eK;function Yz(Q){let{gen:Y,data:X,it:W}=Q;Y.if(W.parentData,()=>Y.assign(X,O0._`${W.parentData}[${W.parentDataProperty}]`))}function QD(Q,Y){let{gen:X}=Q;X.if(O0._`Array.isArray(${Y})`,()=>{X.assign(b1.default.vErrors,O0._`${b1.default.vErrors} === null ? ${Y} : ${b1.default.vErrors}.concat(${Y})`).assign(b1.default.errors,O0._`${b1.default.vErrors}.length`),(0,aK.extendErrors)(Q)},()=>Q.error())}function YD({schemaEnv:Q},Y){if(Y.async&&!Q.$async)throw Error("async keyword in sync schema")}function Xz(Q,Y,X){if(X===void 0)throw Error(`keyword "${Y}" failed to compile`);return Q.scopeValue("keyword",typeof X=="function"?{ref:X}:{ref:X,code:(0,O0.stringify)(X)})}function XD(Q,Y,X=!1){return!Y.length||Y.some((W)=>W==="array"?Array.isArray(Q):W==="object"?Q&&typeof Q=="object"&&!Array.isArray(Q):typeof Q==W||X&&typeof Q>"u")}Wz.validSchemaType=XD;function WD({schema:Q,opts:Y,self:X,errSchemaPath:W},G,$){if(Array.isArray(G.keyword)?!G.keyword.includes($):G.keyword!==$)throw Error("ajv implementation error");let z=G.dependencies;if(z===null||z===void 0?void 0:z.some((J)=>!Object.prototype.hasOwnProperty.call(Q,J)))throw Error(`parent schema must have dependencies of ${$}: ${z.join(",")}`);if(G.validateSchema){if(!G.validateSchema(Q[$])){let H=`keyword "${$}" value is invalid at path "${W}": `+X.errorsText(G.validateSchema.errors);if(Y.validateSchema==="log")X.logger.error(H);else throw Error(H)}}}Wz.validateKeywordUsage=WD});var Uz=j((Jz)=>{Object.defineProperty(Jz,"__esModule",{value:!0});Jz.extendSubschemaMode=Jz.extendSubschemaData=Jz.getSubschema=void 0;var c0=g(),zz=c();function JD(Q,{keyword:Y,schemaProp:X,schema:W,schemaPath:G,errSchemaPath:$,topSchemaRef:z}){if(Y!==void 0&&W!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(Y!==void 0){let J=Q.schema[Y];return X===void 0?{schema:J,schemaPath:c0._`${Q.schemaPath}${(0,c0.getProperty)(Y)}`,errSchemaPath:`${Q.errSchemaPath}/${Y}`}:{schema:J[X],schemaPath:c0._`${Q.schemaPath}${(0,c0.getProperty)(Y)}${(0,c0.getProperty)(X)}`,errSchemaPath:`${Q.errSchemaPath}/${Y}/${(0,zz.escapeFragment)(X)}`}}if(W!==void 0){if(G===void 0||$===void 0||z===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:W,schemaPath:G,topSchemaRef:z,errSchemaPath:$}}throw Error('either "keyword" or "schema" must be passed')}Jz.getSubschema=JD;function HD(Q,Y,{dataProp:X,dataPropType:W,data:G,dataTypes:$,propertyName:z}){if(G!==void 0&&X!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:J}=Y;if(X!==void 0){let{errorPath:U,dataPathArr:A,opts:B}=Y,K=J.let("data",c0._`${Y.data}${(0,c0.getProperty)(X)}`,!0);H(K),Q.errorPath=c0.str`${U}${(0,zz.getErrorPath)(X,W,B.jsPropertySyntax)}`,Q.parentDataProperty=c0._`${X}`,Q.dataPathArr=[...A,Q.parentDataProperty]}if(G!==void 0){let U=G instanceof c0.Name?G:J.let("data",G,!0);if(H(U),z!==void 0)Q.propertyName=z}if($)Q.dataTypes=$;function H(U){Q.data=U,Q.dataLevel=Y.dataLevel+1,Q.dataTypes=[],Y.definedProperties=new Set,Q.parentData=Y.data,Q.dataNames=[...Y.dataNames,U]}}Jz.extendSubschemaData=HD;function UD(Q,{jtdDiscriminator:Y,jtdMetadata:X,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=Y,Q.jtdMetadata=X}Jz.extendSubschemaMode=UD});var XY=j((XI,Az)=>{Az.exports=function Q(Y,X){if(Y===X)return!0;if(Y&&X&&typeof Y=="object"&&typeof X=="object"){if(Y.constructor!==X.constructor)return!1;var W,G,$;if(Array.isArray(Y)){if(W=Y.length,W!=X.length)return!1;for(G=W;G--!==0;)if(!Q(Y[G],X[G]))return!1;return!0}if(Y.constructor===RegExp)return Y.source===X.source&&Y.flags===X.flags;if(Y.valueOf!==Object.prototype.valueOf)return Y.valueOf()===X.valueOf();if(Y.toString!==Object.prototype.toString)return Y.toString()===X.toString();if($=Object.keys(Y),W=$.length,W!==Object.keys(X).length)return!1;for(G=W;G--!==0;)if(!Object.prototype.hasOwnProperty.call(X,$[G]))return!1;for(G=W;G--!==0;){var z=$[G];if(!Q(Y[z],X[z]))return!1}return!0}return Y!==Y&&X!==X}});var Kz=j((WI,Bz)=>{var F1=Bz.exports=function(Q,Y,X){if(typeof Y=="function")X=Y,Y={};X=Y.cb||X;var W=typeof X=="function"?X:X.pre||function(){},G=X.post||function(){};d4(Y,W,G,Q,"",Q)};F1.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};F1.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};F1.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};F1.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 d4(Q,Y,X,W,G,$,z,J,H,U){if(W&&typeof W=="object"&&!Array.isArray(W)){Y(W,G,$,z,J,H,U);for(var A in W){var B=W[A];if(Array.isArray(B)){if(A in F1.arrayKeywords)for(var K=0;K<B.length;K++)d4(Q,Y,X,B[K],G+"/"+A+"/"+K,$,G,A,W,K)}else if(A in F1.propsKeywords){if(B&&typeof B=="object")for(var D in B)d4(Q,Y,X,B[D],G+"/"+A+"/"+KD(D),$,G,A,W,D)}else if(A in F1.keywords||Q.allKeys&&!(A in F1.skipKeywords))d4(Q,Y,X,B,G+"/"+A,$,G,A,W)}X(W,G,$,z,J,H,U)}}function KD(Q){return Q.replace(/~/g,"~0").replace(/\//g,"~1")}});var k6=j((qz)=>{Object.defineProperty(qz,"__esModule",{value:!0});qz.getSchemaRefs=qz.resolveUrl=qz.normalizeId=qz._getFullPath=qz.getFullPath=qz.inlineRef=void 0;var DD=c(),LD=XY(),FD=Kz(),qD=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function OD(Q,Y=!0){if(typeof Q=="boolean")return!0;if(Y===!0)return!WY(Q);if(!Y)return!1;return Dz(Q)<=Y}qz.inlineRef=OD;var MD=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function WY(Q){for(let Y in Q){if(MD.has(Y))return!0;let X=Q[Y];if(Array.isArray(X)&&X.some(WY))return!0;if(typeof X=="object"&&WY(X))return!0}return!1}function Dz(Q){let Y=0;for(let X in Q){if(X==="$ref")return 1/0;if(Y++,qD.has(X))continue;if(typeof Q[X]=="object")(0,DD.eachItem)(Q[X],(W)=>Y+=Dz(W));if(Y===1/0)return 1/0}return Y}function Lz(Q,Y="",X){if(X!==!1)Y=p1(Y);let W=Q.parse(Y);return Fz(Q,W)}qz.getFullPath=Lz;function Fz(Q,Y){return Q.serialize(Y).split("#")[0]+"#"}qz._getFullPath=Fz;var VD=/#\/?$/;function p1(Q){return Q?Q.replace(VD,""):""}qz.normalizeId=p1;function ND(Q,Y,X){return X=p1(X),Q.resolve(Y,X)}qz.resolveUrl=ND;var ZD=/^[a-z_][-a-z0-9._]*$/i;function wD(Q,Y){if(typeof Q=="boolean")return{};let{schemaId:X,uriResolver:W}=this.opts,G=p1(Q[X]||Y),$={"":G},z=Lz(W,G,!1),J={},H=new Set;return FD(Q,{allKeys:!0},(B,K,D,O)=>{if(O===void 0)return;let M=z+K,Z=$[O];if(typeof B[X]=="string")Z=V.call(this,B[X]);R.call(this,B.$anchor),R.call(this,B.$dynamicAnchor),$[K]=Z;function V(T){let y=this.opts.uriResolver.resolve;if(T=p1(Z?y(Z,T):T),H.has(T))throw A(T);H.add(T);let S=this.refs[T];if(typeof S=="string")S=this.refs[S];if(typeof S=="object")U(B,S.schema,T);else if(T!==p1(M))if(T[0]==="#")U(B,J[T],T),J[T]=B;else this.refs[T]=M;return T}function R(T){if(typeof T=="string"){if(!ZD.test(T))throw Error(`invalid anchor "${T}"`);V.call(this,`#${T}`)}}}),J;function U(B,K,D){if(K!==void 0&&!LD(B,K))throw A(D)}function A(B){return Error(`reference "${B}" resolves to more than one schema`)}}qz.getSchemaRefs=wD});var _6=j((kz)=>{Object.defineProperty(kz,"__esModule",{value:!0});kz.getData=kz.KeywordCxt=kz.validateFunctionCode=void 0;var wz=_$(),Mz=C6(),$Y=o9(),o4=C6(),TD=t$(),x6=$z(),GY=Uz(),I=g(),C=e0(),SD=k6(),Q1=c(),v6=R6();function RD(Q){if(bz(Q)){if(Iz(Q),Pz(Q)){vD(Q);return}}jz(Q,()=>(0,wz.topBoolOrEmptySchema)(Q))}kz.validateFunctionCode=RD;function jz({gen:Q,validateName:Y,schema:X,schemaEnv:W,opts:G},$){if(G.code.es5)Q.func(Y,I._`${C.default.data}, ${C.default.valCxt}`,W.$async,()=>{Q.code(I._`"use strict"; ${Vz(X,G)}`),kD(Q,G),Q.code($)});else Q.func(Y,I._`${C.default.data}, ${CD(G)}`,W.$async,()=>Q.code(Vz(X,G)).code($))}function CD(Q){return I._`{${C.default.instancePath}="", ${C.default.parentData}, ${C.default.parentDataProperty}, ${C.default.rootData}=${C.default.data}${Q.dynamicRef?I._`, ${C.default.dynamicAnchors}={}`:I.nil}}={}`}function kD(Q,Y){Q.if(C.default.valCxt,()=>{if(Q.var(C.default.instancePath,I._`${C.default.valCxt}.${C.default.instancePath}`),Q.var(C.default.parentData,I._`${C.default.valCxt}.${C.default.parentData}`),Q.var(C.default.parentDataProperty,I._`${C.default.valCxt}.${C.default.parentDataProperty}`),Q.var(C.default.rootData,I._`${C.default.valCxt}.${C.default.rootData}`),Y.dynamicRef)Q.var(C.default.dynamicAnchors,I._`${C.default.valCxt}.${C.default.dynamicAnchors}`)},()=>{if(Q.var(C.default.instancePath,I._`""`),Q.var(C.default.parentData,I._`undefined`),Q.var(C.default.parentDataProperty,I._`undefined`),Q.var(C.default.rootData,C.default.data),Y.dynamicRef)Q.var(C.default.dynamicAnchors,I._`{}`)})}function vD(Q){let{schema:Y,opts:X,gen:W}=Q;jz(Q,()=>{if(X.$comment&&Y.$comment)Tz(Q);if(uD(Q),W.let(C.default.vErrors,null),W.let(C.default.errors,0),X.unevaluated)xD(Q);Ez(Q),lD(Q)});return}function xD(Q){let{gen:Y,validateName:X}=Q;Q.evaluated=Y.const("evaluated",I._`${X}.evaluated`),Y.if(I._`${Q.evaluated}.dynamicProps`,()=>Y.assign(I._`${Q.evaluated}.props`,I._`undefined`)),Y.if(I._`${Q.evaluated}.dynamicItems`,()=>Y.assign(I._`${Q.evaluated}.items`,I._`undefined`))}function Vz(Q,Y){let X=typeof Q=="object"&&Q[Y.schemaId];return X&&(Y.code.source||Y.code.process)?I._`/*# sourceURL=${X} */`:I.nil}function _D(Q,Y){if(bz(Q)){if(Iz(Q),Pz(Q)){gD(Q,Y);return}}(0,wz.boolOrEmptySchema)(Q,Y)}function Pz({schema:Q,self:Y}){if(typeof Q=="boolean")return!Q;for(let X in Q)if(Y.RULES.all[X])return!0;return!1}function bz(Q){return typeof Q.schema!="boolean"}function gD(Q,Y){let{schema:X,gen:W,opts:G}=Q;if(G.$comment&&X.$comment)Tz(Q);hD(Q),fD(Q);let $=W.const("_errs",C.default.errors);Ez(Q,$),W.var(Y,I._`${$} === ${C.default.errors}`)}function Iz(Q){(0,Q1.checkUnknownRules)(Q),yD(Q)}function Ez(Q,Y){if(Q.opts.jtd)return Nz(Q,[],!1,Y);let X=(0,Mz.getSchemaTypes)(Q.schema),W=(0,Mz.coerceAndCheckDataType)(Q,X);Nz(Q,X,!W,Y)}function yD(Q){let{schema:Y,errSchemaPath:X,opts:W,self:G}=Q;if(Y.$ref&&W.ignoreKeywordsWithRef&&(0,Q1.schemaHasRulesButRef)(Y,G.RULES))G.logger.warn(`$ref: keywords ignored in schema at path "${X}"`)}function uD(Q){let{schema:Y,opts:X}=Q;if(Y.default!==void 0&&X.useDefaults&&X.strictSchema)(0,Q1.checkStrictMode)(Q,"default is ignored in the schema root")}function hD(Q){let Y=Q.schema[Q.opts.schemaId];if(Y)Q.baseId=(0,SD.resolveUrl)(Q.opts.uriResolver,Q.baseId,Y)}function fD(Q){if(Q.schema.$async&&!Q.schemaEnv.$async)throw Error("async schema in sync schema")}function Tz({gen:Q,schemaEnv:Y,schema:X,errSchemaPath:W,opts:G}){let $=X.$comment;if(G.$comment===!0)Q.code(I._`${C.default.self}.logger.log(${$})`);else if(typeof G.$comment=="function"){let z=I.str`${W}/$comment`,J=Q.scopeValue("root",{ref:Y.root});Q.code(I._`${C.default.self}.opts.$comment(${$}, ${z}, ${J}.schema)`)}}function lD(Q){let{gen:Y,schemaEnv:X,validateName:W,ValidationError:G,opts:$}=Q;if(X.$async)Y.if(I._`${C.default.errors} === 0`,()=>Y.return(C.default.data),()=>Y.throw(I._`new ${G}(${C.default.vErrors})`));else{if(Y.assign(I._`${W}.errors`,C.default.vErrors),$.unevaluated)mD(Q);Y.return(I._`${C.default.errors} === 0`)}}function mD({gen:Q,evaluated:Y,props:X,items:W}){if(X instanceof I.Name)Q.assign(I._`${Y}.props`,X);if(W instanceof I.Name)Q.assign(I._`${Y}.items`,W)}function Nz(Q,Y,X,W){let{gen:G,schema:$,data:z,allErrors:J,opts:H,self:U}=Q,{RULES:A}=U;if($.$ref&&(H.ignoreKeywordsWithRef||!(0,Q1.schemaHasRulesButRef)($,A))){G.block(()=>Rz(Q,"$ref",A.all.$ref.definition));return}if(!H.jtd)cD(Q,Y);G.block(()=>{for(let K of A.rules)B(K);B(A.post)});function B(K){if(!(0,$Y.shouldUseGroup)($,K))return;if(K.type){if(G.if((0,o4.checkDataType)(K.type,z,H.strictNumbers)),Zz(Q,K),Y.length===1&&Y[0]===K.type&&X)G.else(),(0,o4.reportTypeError)(Q);G.endIf()}else Zz(Q,K);if(!J)G.if(I._`${C.default.errors} === ${W||0}`)}}function Zz(Q,Y){let{gen:X,schema:W,opts:{useDefaults:G}}=Q;if(G)(0,TD.assignDefaults)(Q,Y.type);X.block(()=>{for(let $ of Y.rules)if((0,$Y.shouldUseRule)(W,$))Rz(Q,$.keyword,$.definition,Y.type)})}function cD(Q,Y){if(Q.schemaEnv.meta||!Q.opts.strictTypes)return;if(pD(Q,Y),!Q.opts.allowUnionTypes)iD(Q,Y);nD(Q,Q.dataTypes)}function pD(Q,Y){if(!Y.length)return;if(!Q.dataTypes.length){Q.dataTypes=Y;return}Y.forEach((X)=>{if(!Sz(Q.dataTypes,X))zY(Q,`type "${X}" not allowed by context "${Q.dataTypes.join(",")}"`)}),dD(Q,Y)}function iD(Q,Y){if(Y.length>1&&!(Y.length===2&&Y.includes("null")))zY(Q,"use allowUnionTypes to allow union type keyword")}function nD(Q,Y){let X=Q.self.RULES.all;for(let W in X){let G=X[W];if(typeof G=="object"&&(0,$Y.shouldUseRule)(Q.schema,G)){let{type:$}=G.definition;if($.length&&!$.some((z)=>rD(Y,z)))zY(Q,`missing type "${$.join(",")}" for keyword "${W}"`)}}}function rD(Q,Y){return Q.includes(Y)||Y==="number"&&Q.includes("integer")}function Sz(Q,Y){return Q.includes(Y)||Y==="integer"&&Q.includes("number")}function dD(Q,Y){let X=[];for(let W of Q.dataTypes)if(Sz(Y,W))X.push(W);else if(Y.includes("integer")&&W==="number")X.push("integer");Q.dataTypes=X}function zY(Q,Y){let X=Q.schemaEnv.baseId+Q.errSchemaPath;Y+=` at "${X}" (strictTypes)`,(0,Q1.checkStrictMode)(Q,Y,Q.opts.strictTypes)}class JY{constructor(Q,Y,X){if((0,x6.validateKeywordUsage)(Q,Y,X),this.gen=Q.gen,this.allErrors=Q.allErrors,this.keyword=X,this.data=Q.data,this.schema=Q.schema[X],this.$data=Y.$data&&Q.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Q1.schemaRefOrVal)(Q,this.schema,X,this.$data),this.schemaType=Y.schemaType,this.parentSchema=Q.schema,this.params={},this.it=Q,this.def=Y,this.$data)this.schemaCode=Q.gen.const("vSchema",Cz(this.$data,Q));else if(this.schemaCode=this.schemaValue,!(0,x6.validSchemaType)(this.schema,Y.schemaType,Y.allowUndefined))throw Error(`${X} value must be ${JSON.stringify(Y.schemaType)}`);if("code"in Y?Y.trackErrors:Y.errors!==!1)this.errsCount=Q.gen.const("_errs",C.default.errors)}result(Q,Y,X){this.failResult((0,I.not)(Q),Y,X)}failResult(Q,Y,X){if(this.gen.if(Q),X)X();else this.error();if(Y){if(this.gen.else(),Y(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(Q,Y){this.failResult((0,I.not)(Q),void 0,Y)}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:Y}=this;this.fail(I._`${Y} !== undefined && (${(0,I.or)(this.invalid$data(),Q)})`)}error(Q,Y,X){if(Y){this.setParams(Y),this._error(Q,X),this.setParams({});return}this._error(Q,X)}_error(Q,Y){(Q?v6.reportExtraError:v6.reportError)(this,this.def.error,Y)}$dataError(){(0,v6.reportError)(this,this.def.$dataError||v6.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,v6.resetErrorsCount)(this.gen,this.errsCount)}ok(Q){if(!this.allErrors)this.gen.if(Q)}setParams(Q,Y){if(Y)Object.assign(this.params,Q);else this.params=Q}block$data(Q,Y,X=I.nil){this.gen.block(()=>{this.check$data(Q,X),Y()})}check$data(Q=I.nil,Y=I.nil){if(!this.$data)return;let{gen:X,schemaCode:W,schemaType:G,def:$}=this;if(X.if((0,I.or)(I._`${W} === undefined`,Y)),Q!==I.nil)X.assign(Q,!0);if(G.length||$.validateSchema){if(X.elseIf(this.invalid$data()),this.$dataError(),Q!==I.nil)X.assign(Q,!1)}X.else()}invalid$data(){let{gen:Q,schemaCode:Y,schemaType:X,def:W,it:G}=this;return(0,I.or)($(),z());function $(){if(X.length){if(!(Y instanceof I.Name))throw Error("ajv implementation error");let J=Array.isArray(X)?X:[X];return I._`${(0,o4.checkDataTypes)(J,Y,G.opts.strictNumbers,o4.DataType.Wrong)}`}return I.nil}function z(){if(W.validateSchema){let J=Q.scopeValue("validate$data",{ref:W.validateSchema});return I._`!${J}(${Y})`}return I.nil}}subschema(Q,Y){let X=(0,GY.getSubschema)(this.it,Q);(0,GY.extendSubschemaData)(X,this.it,Q),(0,GY.extendSubschemaMode)(X,Q);let W={...this.it,...X,items:void 0,props:void 0};return _D(W,Y),W}mergeEvaluated(Q,Y){let{it:X,gen:W}=this;if(!X.opts.unevaluated)return;if(X.props!==!0&&Q.props!==void 0)X.props=Q1.mergeEvaluated.props(W,Q.props,X.props,Y);if(X.items!==!0&&Q.items!==void 0)X.items=Q1.mergeEvaluated.items(W,Q.items,X.items,Y)}mergeValidEvaluated(Q,Y){let{it:X,gen:W}=this;if(X.opts.unevaluated&&(X.props!==!0||X.items!==!0))return W.if(Y,()=>this.mergeEvaluated(Q,I.Name)),!0}}kz.KeywordCxt=JY;function Rz(Q,Y,X,W){let G=new JY(Q,X,Y);if("code"in X)X.code(G,W);else if(G.$data&&X.validate)(0,x6.funcKeywordCode)(G,X);else if("macro"in X)(0,x6.macroKeywordCode)(G,X);else if(X.compile||X.validate)(0,x6.funcKeywordCode)(G,X)}var oD=/^\/(?:[^~]|~0|~1)*$/,tD=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Cz(Q,{dataLevel:Y,dataNames:X,dataPathArr:W}){let G,$;if(Q==="")return C.default.rootData;if(Q[0]==="/"){if(!oD.test(Q))throw Error(`Invalid JSON-pointer: ${Q}`);G=Q,$=C.default.rootData}else{let U=tD.exec(Q);if(!U)throw Error(`Invalid JSON-pointer: ${Q}`);let A=+U[1];if(G=U[2],G==="#"){if(A>=Y)throw Error(H("property/index",A));return W[Y-A]}if(A>Y)throw Error(H("data",A));if($=X[Y-A],!G)return $}let z=$,J=G.split("/");for(let U of J)if(U)$=I._`${$}${(0,I.getProperty)((0,Q1.unescapeJsonPointer)(U))}`,z=I._`${z} && ${$}`;return z;function H(U,A){return`Cannot access ${U} ${A} levels up, current level is ${Y}`}}kz.getData=Cz});var t4=j((_z)=>{Object.defineProperty(_z,"__esModule",{value:!0});class xz extends Error{constructor(Q){super("validation failed");this.errors=Q,this.ajv=this.validation=!0}}_z.default=xz});var g6=j((yz)=>{Object.defineProperty(yz,"__esModule",{value:!0});var HY=k6();class gz extends Error{constructor(Q,Y,X,W){super(W||`can't resolve reference ${X} from id ${Y}`);this.missingRef=(0,HY.resolveUrl)(Q,Y,X),this.missingSchema=(0,HY.normalizeId)((0,HY.getFullPath)(Q,this.missingRef))}}yz.default=gz});var s4=j((fz)=>{Object.defineProperty(fz,"__esModule",{value:!0});fz.resolveSchema=fz.getCompilingSchema=fz.resolveRef=fz.compileSchema=fz.SchemaEnv=void 0;var g0=g(),YL=t4(),I1=e0(),y0=k6(),uz=c(),XL=_6();class y6{constructor(Q){var Y;this.refs={},this.dynamicAnchors={};let X;if(typeof Q.schema=="object")X=Q.schema;this.schema=Q.schema,this.schemaId=Q.schemaId,this.root=Q.root||this,this.baseId=(Y=Q.baseId)!==null&&Y!==void 0?Y:(0,y0.normalizeId)(X===null||X===void 0?void 0:X[Q.schemaId||"$id"]),this.schemaPath=Q.schemaPath,this.localRefs=Q.localRefs,this.meta=Q.meta,this.$async=X===null||X===void 0?void 0:X.$async,this.refs={}}}fz.SchemaEnv=y6;function AY(Q){let Y=hz.call(this,Q);if(Y)return Y;let X=(0,y0.getFullPath)(this.opts.uriResolver,Q.root.baseId),{es5:W,lines:G}=this.opts.code,{ownProperties:$}=this.opts,z=new g0.CodeGen(this.scope,{es5:W,lines:G,ownProperties:$}),J;if(Q.$async)J=z.scopeValue("Error",{ref:YL.default,code:g0._`require("ajv/dist/runtime/validation_error").default`});let H=z.scopeName("validate");Q.validateName=H;let U={gen:z,allErrors:this.opts.allErrors,data:I1.default.data,parentData:I1.default.parentData,parentDataProperty:I1.default.parentDataProperty,dataNames:[I1.default.data],dataPathArr:[g0.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:z.scopeValue("schema",this.opts.code.source===!0?{ref:Q.schema,code:(0,g0.stringify)(Q.schema)}:{ref:Q.schema}),validateName:H,ValidationError:J,schema:Q.schema,schemaEnv:Q,rootId:X,baseId:Q.baseId||X,schemaPath:g0.nil,errSchemaPath:Q.schemaPath||(this.opts.jtd?"":"#"),errorPath:g0._`""`,opts:this.opts,self:this},A;try{this._compilations.add(Q),(0,XL.validateFunctionCode)(U),z.optimize(this.opts.code.optimize);let B=z.toString();if(A=`${z.scopeRefs(I1.default.scope)}return ${B}`,this.opts.code.process)A=this.opts.code.process(A,Q);let D=Function(`${I1.default.self}`,`${I1.default.scope}`,A)(this,this.scope.get());if(this.scope.value(H,{ref:D}),D.errors=null,D.schema=Q.schema,D.schemaEnv=Q,Q.$async)D.$async=!0;if(this.opts.code.source===!0)D.source={validateName:H,validateCode:B,scopeValues:z._values};if(this.opts.unevaluated){let{props:O,items:M}=U;if(D.evaluated={props:O instanceof g0.Name?void 0:O,items:M instanceof g0.Name?void 0:M,dynamicProps:O instanceof g0.Name,dynamicItems:M instanceof g0.Name},D.source)D.source.evaluated=(0,g0.stringify)(D.evaluated)}return Q.validate=D,Q}catch(B){if(delete Q.validate,delete Q.validateName,A)this.logger.error("Error compiling schema, function code:",A);throw B}finally{this._compilations.delete(Q)}}fz.compileSchema=AY;function WL(Q,Y,X){var W;X=(0,y0.resolveUrl)(this.opts.uriResolver,Y,X);let G=Q.refs[X];if(G)return G;let $=zL.call(this,Q,X);if($===void 0){let z=(W=Q.localRefs)===null||W===void 0?void 0:W[X],{schemaId:J}=this.opts;if(z)$=new y6({schema:z,schemaId:J,root:Q,baseId:Y})}if($===void 0)return;return Q.refs[X]=GL.call(this,$)}fz.resolveRef=WL;function GL(Q){if((0,y0.inlineRef)(Q.schema,this.opts.inlineRefs))return Q.schema;return Q.validate?Q:AY.call(this,Q)}function hz(Q){for(let Y of this._compilations)if($L(Y,Q))return Y}fz.getCompilingSchema=hz;function $L(Q,Y){return Q.schema===Y.schema&&Q.root===Y.root&&Q.baseId===Y.baseId}function zL(Q,Y){let X;while(typeof(X=this.refs[Y])=="string")Y=X;return X||this.schemas[Y]||a4.call(this,Q,Y)}function a4(Q,Y){let X=this.opts.uriResolver.parse(Y),W=(0,y0._getFullPath)(this.opts.uriResolver,X),G=(0,y0.getFullPath)(this.opts.uriResolver,Q.baseId,void 0);if(Object.keys(Q.schema).length>0&&W===G)return UY.call(this,X,Q);let $=(0,y0.normalizeId)(W),z=this.refs[$]||this.schemas[$];if(typeof z=="string"){let J=a4.call(this,Q,z);if(typeof(J===null||J===void 0?void 0:J.schema)!=="object")return;return UY.call(this,X,J)}if(typeof(z===null||z===void 0?void 0:z.schema)!=="object")return;if(!z.validate)AY.call(this,z);if($===(0,y0.normalizeId)(Y)){let{schema:J}=z,{schemaId:H}=this.opts,U=J[H];if(U)G=(0,y0.resolveUrl)(this.opts.uriResolver,G,U);return new y6({schema:J,schemaId:H,root:Q,baseId:G})}return UY.call(this,X,z)}fz.resolveSchema=a4;var JL=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function UY(Q,{baseId:Y,schema:X,root:W}){var G;if(((G=Q.fragment)===null||G===void 0?void 0:G[0])!=="/")return;for(let J of Q.fragment.slice(1).split("/")){if(typeof X==="boolean")return;let H=X[(0,uz.unescapeFragment)(J)];if(H===void 0)return;X=H;let U=typeof X==="object"&&X[this.opts.schemaId];if(!JL.has(J)&&U)Y=(0,y0.resolveUrl)(this.opts.uriResolver,Y,U)}let $;if(typeof X!="boolean"&&X.$ref&&!(0,uz.schemaHasRulesButRef)(X,this.RULES)){let J=(0,y0.resolveUrl)(this.opts.uriResolver,Y,X.$ref);$=a4.call(this,W,J)}let{schemaId:z}=this.opts;if($=$||new y6({schema:X,schemaId:z,root:W,baseId:Y}),$.schema!==$.root.schema)return $;return}});var mz=j((UI,KL)=>{KL.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 KY=j((AI,nz)=>{var DL=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),pz=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 BY(Q){let Y="",X=0,W=0;for(W=0;W<Q.length;W++){if(X=Q[W].charCodeAt(0),X===48)continue;if(!(X>=48&&X<=57||X>=65&&X<=70||X>=97&&X<=102))return"";Y+=Q[W];break}for(W+=1;W<Q.length;W++){if(X=Q[W].charCodeAt(0),!(X>=48&&X<=57||X>=65&&X<=70||X>=97&&X<=102))return"";Y+=Q[W]}return Y}var LL=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function cz(Q){return Q.length=0,!0}function FL(Q,Y,X){if(Q.length){let W=BY(Q);if(W!=="")Y.push(W);else return X.error=!0,!1;Q.length=0}return!0}function qL(Q){let Y=0,X={error:!1,address:"",zone:""},W=[],G=[],$=!1,z=!1,J=FL;for(let H=0;H<Q.length;H++){let U=Q[H];if(U==="["||U==="]")continue;if(U===":"){if($===!0)z=!0;if(!J(G,W,X))break;if(++Y>7){X.error=!0;break}if(H>0&&Q[H-1]===":")$=!0;W.push(":");continue}else if(U==="%"){if(!J(G,W,X))break;J=cz}else{G.push(U);continue}}if(G.length)if(J===cz)X.zone=G.join("");else if(z)W.push(G.join(""));else W.push(BY(G));return X.address=W.join(""),X}function iz(Q){if(OL(Q,":")<2)return{host:Q,isIPV6:!1};let Y=qL(Q);if(!Y.error){let{address:X,address:W}=Y;if(Y.zone)X+="%"+Y.zone,W+="%25"+Y.zone;return{host:X,isIPV6:!0,escapedHost:W}}else return{host:Q,isIPV6:!1}}function OL(Q,Y){let X=0;for(let W=0;W<Q.length;W++)if(Q[W]===Y)X++;return X}function ML(Q){let Y=Q,X=[],W=-1,G=0;while(G=Y.length){if(G===1)if(Y===".")break;else if(Y==="/"){X.push("/");break}else{X.push(Y);break}else if(G===2){if(Y[0]==="."){if(Y[1]===".")break;else if(Y[1]==="/"){Y=Y.slice(2);continue}}else if(Y[0]==="/"){if(Y[1]==="."||Y[1]==="/"){X.push("/");break}}}else if(G===3){if(Y==="/.."){if(X.length!==0)X.pop();X.push("/");break}}if(Y[0]==="."){if(Y[1]==="."){if(Y[2]==="/"){Y=Y.slice(3);continue}}else if(Y[1]==="/"){Y=Y.slice(2);continue}}else if(Y[0]==="/"){if(Y[1]==="."){if(Y[2]==="/"){Y=Y.slice(2);continue}else if(Y[2]==="."){if(Y[3]==="/"){if(Y=Y.slice(3),X.length!==0)X.pop();continue}}}}if((W=Y.indexOf("/",1))===-1){X.push(Y);break}else X.push(Y.slice(0,W)),Y=Y.slice(W)}return X.join("")}function VL(Q,Y){let X=Y!==!0?escape:unescape;if(Q.scheme!==void 0)Q.scheme=X(Q.scheme);if(Q.userinfo!==void 0)Q.userinfo=X(Q.userinfo);if(Q.host!==void 0)Q.host=X(Q.host);if(Q.path!==void 0)Q.path=X(Q.path);if(Q.query!==void 0)Q.query=X(Q.query);if(Q.fragment!==void 0)Q.fragment=X(Q.fragment);return Q}function NL(Q){let Y=[];if(Q.userinfo!==void 0)Y.push(Q.userinfo),Y.push("@");if(Q.host!==void 0){let X=unescape(Q.host);if(!pz(X)){let W=iz(X);if(W.isIPV6===!0)X=`[${W.escapedHost}]`;else X=Q.host}Y.push(X)}if(typeof Q.port==="number"||typeof Q.port==="string")Y.push(":"),Y.push(String(Q.port));return Y.length?Y.join(""):void 0}nz.exports={nonSimpleDomain:LL,recomposeAuthority:NL,normalizeComponentEncoding:VL,removeDotSegments:ML,isIPv4:pz,isUUID:DL,normalizeIPv6:iz,stringArrayToHexStripped:BY}});var az=j((BI,tz)=>{var{isUUID:ZL}=KY(),wL=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,jL=["http","https","ws","wss","urn","urn:uuid"];function PL(Q){return jL.indexOf(Q)!==-1}function DY(Q){if(Q.secure===!0)return!0;else if(Q.secure===!1)return!1;else if(Q.scheme)return Q.scheme.length===3&&(Q.scheme[0]==="w"||Q.scheme[0]==="W")&&(Q.scheme[1]==="s"||Q.scheme[1]==="S")&&(Q.scheme[2]==="s"||Q.scheme[2]==="S");else return!1}function rz(Q){if(!Q.host)Q.error=Q.error||"HTTP URIs must have a host.";return Q}function dz(Q){let Y=String(Q.scheme).toLowerCase()==="https";if(Q.port===(Y?443:80)||Q.port==="")Q.port=void 0;if(!Q.path)Q.path="/";return Q}function bL(Q){return Q.secure=DY(Q),Q.resourceName=(Q.path||"/")+(Q.query?"?"+Q.query:""),Q.path=void 0,Q.query=void 0,Q}function IL(Q){if(Q.port===(DY(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[Y,X]=Q.resourceName.split("?");Q.path=Y&&Y!=="/"?Y:void 0,Q.query=X,Q.resourceName=void 0}return Q.fragment=void 0,Q}function EL(Q,Y){if(!Q.path)return Q.error="URN can not be parsed",Q;let X=Q.path.match(wL);if(X){let W=Y.scheme||Q.scheme||"urn";Q.nid=X[1].toLowerCase(),Q.nss=X[2];let G=`${W}:${Y.nid||Q.nid}`,$=LY(G);if(Q.path=void 0,$)Q=$.parse(Q,Y)}else Q.error=Q.error||"URN can not be parsed.";return Q}function TL(Q,Y){if(Q.nid===void 0)throw Error("URN without nid cannot be serialized");let X=Y.scheme||Q.scheme||"urn",W=Q.nid.toLowerCase(),G=`${X}:${Y.nid||W}`,$=LY(G);if($)Q=$.serialize(Q,Y);let z=Q,J=Q.nss;return z.path=`${W||Y.nid}:${J}`,Y.skipEscape=!0,z}function SL(Q,Y){let X=Q;if(X.uuid=X.nss,X.nss=void 0,!Y.tolerant&&(!X.uuid||!ZL(X.uuid)))X.error=X.error||"UUID is not valid.";return X}function RL(Q){let Y=Q;return Y.nss=(Q.uuid||"").toLowerCase(),Y}var oz={scheme:"http",domainHost:!0,parse:rz,serialize:dz},CL={scheme:"https",domainHost:oz.domainHost,parse:rz,serialize:dz},e4={scheme:"ws",domainHost:!0,parse:bL,serialize:IL},kL={scheme:"wss",domainHost:e4.domainHost,parse:e4.parse,serialize:e4.serialize},vL={scheme:"urn",parse:EL,serialize:TL,skipNormalize:!0},xL={scheme:"urn:uuid",parse:SL,serialize:RL,skipNormalize:!0},QQ={http:oz,https:CL,ws:e4,wss:kL,urn:vL,"urn:uuid":xL};Object.setPrototypeOf(QQ,null);function LY(Q){return Q&&(QQ[Q]||QQ[Q.toLowerCase()])||void 0}tz.exports={wsIsSecure:DY,SCHEMES:QQ,isValidSchemeName:PL,getSchemeHandler:LY}});var QJ=j((KI,XQ)=>{var{normalizeIPv6:_L,removeDotSegments:u6,recomposeAuthority:gL,normalizeComponentEncoding:YQ,isIPv4:yL,nonSimpleDomain:uL}=KY(),{SCHEMES:hL,getSchemeHandler:sz}=az();function fL(Q,Y){if(typeof Q==="string")Q=p0(Y1(Q,Y),Y);else if(typeof Q==="object")Q=Y1(p0(Q,Y),Y);return Q}function lL(Q,Y,X){let W=X?Object.assign({scheme:"null"},X):{scheme:"null"},G=ez(Y1(Q,W),Y1(Y,W),W,!0);return W.skipEscape=!0,p0(G,W)}function ez(Q,Y,X,W){let G={};if(!W)Q=Y1(p0(Q,X),X),Y=Y1(p0(Y,X),X);if(X=X||{},!X.tolerant&&Y.scheme)G.scheme=Y.scheme,G.userinfo=Y.userinfo,G.host=Y.host,G.port=Y.port,G.path=u6(Y.path||""),G.query=Y.query;else{if(Y.userinfo!==void 0||Y.host!==void 0||Y.port!==void 0)G.userinfo=Y.userinfo,G.host=Y.host,G.port=Y.port,G.path=u6(Y.path||""),G.query=Y.query;else{if(!Y.path)if(G.path=Q.path,Y.query!==void 0)G.query=Y.query;else G.query=Q.query;else{if(Y.path[0]==="/")G.path=u6(Y.path);else{if((Q.userinfo!==void 0||Q.host!==void 0||Q.port!==void 0)&&!Q.path)G.path="/"+Y.path;else if(!Q.path)G.path=Y.path;else G.path=Q.path.slice(0,Q.path.lastIndexOf("/")+1)+Y.path;G.path=u6(G.path)}G.query=Y.query}G.userinfo=Q.userinfo,G.host=Q.host,G.port=Q.port}G.scheme=Q.scheme}return G.fragment=Y.fragment,G}function mL(Q,Y,X){if(typeof Q==="string")Q=unescape(Q),Q=p0(YQ(Y1(Q,X),!0),{...X,skipEscape:!0});else if(typeof Q==="object")Q=p0(YQ(Q,!0),{...X,skipEscape:!0});if(typeof Y==="string")Y=unescape(Y),Y=p0(YQ(Y1(Y,X),!0),{...X,skipEscape:!0});else if(typeof Y==="object")Y=p0(YQ(Y,!0),{...X,skipEscape:!0});return Q.toLowerCase()===Y.toLowerCase()}function p0(Q,Y){let X={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({},Y),G=[],$=sz(W.scheme||X.scheme);if($&&$.serialize)$.serialize(X,W);if(X.path!==void 0)if(!W.skipEscape){if(X.path=escape(X.path),X.scheme!==void 0)X.path=X.path.split("%3A").join(":")}else X.path=unescape(X.path);if(W.reference!=="suffix"&&X.scheme)G.push(X.scheme,":");let z=gL(X);if(z!==void 0){if(W.reference!=="suffix")G.push("//");if(G.push(z),X.path&&X.path[0]!=="/")G.push("/")}if(X.path!==void 0){let J=X.path;if(!W.absolutePath&&(!$||!$.absolutePath))J=u6(J);if(z===void 0&&J[0]==="/"&&J[1]==="/")J="/%2F"+J.slice(2);G.push(J)}if(X.query!==void 0)G.push("?",X.query);if(X.fragment!==void 0)G.push("#",X.fragment);return G.join("")}var cL=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function Y1(Q,Y){let X=Object.assign({},Y),W={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},G=!1;if(X.reference==="suffix")if(X.scheme)Q=X.scheme+":"+Q;else Q="//"+Q;let $=Q.match(cL);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(yL(W.host)===!1){let H=_L(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(X.reference&&X.reference!=="suffix"&&X.reference!==W.reference)W.error=W.error||"URI is not a "+X.reference+" reference.";let z=sz(X.scheme||W.scheme);if(!X.unicodeSupport&&(!z||!z.unicodeSupport)){if(W.host&&(X.domainHost||z&&z.domainHost)&&G===!1&&uL(W.host))try{W.host=URL.domainToASCII(W.host.toLowerCase())}catch(J){W.error=W.error||"Host's domain name can not be converted to ASCII: "+J}}if(!z||z&&!z.skipNormalize){if(Q.indexOf("%")!==-1){if(W.scheme!==void 0)W.scheme=unescape(W.scheme);if(W.host!==void 0)W.host=unescape(W.host)}if(W.path)W.path=escape(unescape(W.path));if(W.fragment)W.fragment=encodeURI(decodeURIComponent(W.fragment))}if(z&&z.parse)z.parse(W,X)}else W.error=W.error||"URI can not be parsed.";return W}var FY={SCHEMES:hL,normalize:fL,resolve:lL,resolveComponent:ez,equal:mL,serialize:p0,parse:Y1};XQ.exports=FY;XQ.exports.default=FY;XQ.exports.fastUri=FY});var WJ=j((XJ)=>{Object.defineProperty(XJ,"__esModule",{value:!0});var YJ=QJ();YJ.code='require("ajv/dist/runtime/uri").default';XJ.default=YJ});var BJ=j((X1)=>{Object.defineProperty(X1,"__esModule",{value:!0});X1.CodeGen=X1.Name=X1.nil=X1.stringify=X1.str=X1._=X1.KeywordCxt=void 0;var iL=_6();Object.defineProperty(X1,"KeywordCxt",{enumerable:!0,get:function(){return iL.KeywordCxt}});var i1=g();Object.defineProperty(X1,"_",{enumerable:!0,get:function(){return i1._}});Object.defineProperty(X1,"str",{enumerable:!0,get:function(){return i1.str}});Object.defineProperty(X1,"stringify",{enumerable:!0,get:function(){return i1.stringify}});Object.defineProperty(X1,"nil",{enumerable:!0,get:function(){return i1.nil}});Object.defineProperty(X1,"Name",{enumerable:!0,get:function(){return i1.Name}});Object.defineProperty(X1,"CodeGen",{enumerable:!0,get:function(){return i1.CodeGen}});var nL=t4(),HJ=g6(),rL=d9(),h6=s4(),dL=g(),f6=k6(),WQ=C6(),OY=c(),GJ=mz(),oL=WJ(),UJ=(Q,Y)=>new RegExp(Q,Y);UJ.code="new RegExp";var tL=["removeAdditional","useDefaults","coerceTypes"],aL=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),sL={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."},eL={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},$J=200;function QF(Q){var Y,X,W,G,$,z,J,H,U,A,B,K,D,O,M,Z,V,R,T,y,S,m0,r0,PQ,bQ;let Q6=Q.strict,IQ=(Y=Q.code)===null||Y===void 0?void 0:Y.optimize,sY=IQ===!0||IQ===void 0?1:IQ||0,eY=(W=(X=Q.code)===null||X===void 0?void 0:X.regExp)!==null&&W!==void 0?W:UJ,a5=(G=Q.uriResolver)!==null&&G!==void 0?G:oL.default;return{strictSchema:(z=($=Q.strictSchema)!==null&&$!==void 0?$:Q6)!==null&&z!==void 0?z:!0,strictNumbers:(H=(J=Q.strictNumbers)!==null&&J!==void 0?J:Q6)!==null&&H!==void 0?H:!0,strictTypes:(A=(U=Q.strictTypes)!==null&&U!==void 0?U:Q6)!==null&&A!==void 0?A:"log",strictTuples:(K=(B=Q.strictTuples)!==null&&B!==void 0?B:Q6)!==null&&K!==void 0?K:"log",strictRequired:(O=(D=Q.strictRequired)!==null&&D!==void 0?D:Q6)!==null&&O!==void 0?O:!1,code:Q.code?{...Q.code,optimize:sY,regExp:eY}:{optimize:sY,regExp:eY},loopRequired:(M=Q.loopRequired)!==null&&M!==void 0?M:$J,loopEnum:(Z=Q.loopEnum)!==null&&Z!==void 0?Z:$J,meta:(V=Q.meta)!==null&&V!==void 0?V:!0,messages:(R=Q.messages)!==null&&R!==void 0?R:!0,inlineRefs:(T=Q.inlineRefs)!==null&&T!==void 0?T:!0,schemaId:(y=Q.schemaId)!==null&&y!==void 0?y:"$id",addUsedSchema:(S=Q.addUsedSchema)!==null&&S!==void 0?S:!0,validateSchema:(m0=Q.validateSchema)!==null&&m0!==void 0?m0:!0,validateFormats:(r0=Q.validateFormats)!==null&&r0!==void 0?r0:!0,unicodeRegExp:(PQ=Q.unicodeRegExp)!==null&&PQ!==void 0?PQ:!0,int32range:(bQ=Q.int32range)!==null&&bQ!==void 0?bQ:!0,uriResolver:a5}}class GQ{constructor(Q={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,Q=this.opts={...Q,...QF(Q)};let{es5:Y,lines:X}=this.opts.code;this.scope=new dL.ValueScope({scope:{},prefixes:aL,es5:Y,lines:X}),this.logger=zF(Q.logger);let W=Q.validateFormats;if(Q.validateFormats=!1,this.RULES=(0,rL.getRules)(),zJ.call(this,sL,Q,"NOT SUPPORTED"),zJ.call(this,eL,Q,"DEPRECATED","warn"),this._metaOpts=GF.call(this),Q.formats)XF.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),Q.keywords)WF.call(this,Q.keywords);if(typeof Q.meta=="object")this.addMetaSchema(Q.meta);YF.call(this),Q.validateFormats=W}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:Q,meta:Y,schemaId:X}=this.opts,W=GJ;if(X==="id")W={...GJ},W.id=W.$id,delete W.$id;if(Y&&Q)this.addMetaSchema(W,W[X],!1)}defaultMeta(){let{meta:Q,schemaId:Y}=this.opts;return this.opts.defaultMeta=typeof Q=="object"?Q[Y]||Q:void 0}validate(Q,Y){let X;if(typeof Q=="string"){if(X=this.getSchema(Q),!X)throw Error(`no schema with key or ref "${Q}"`)}else X=this.compile(Q);let W=X(Y);if(!("$async"in X))this.errors=X.errors;return W}compile(Q,Y){let X=this._addSchema(Q,Y);return X.validate||this._compileSchemaEnv(X)}compileAsync(Q,Y){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:X}=this.opts;return W.call(this,Q,Y);async function W(U,A){await G.call(this,U.$schema);let B=this._addSchema(U,A);return B.validate||$.call(this,B)}async function G(U){if(U&&!this.getSchema(U))await W.call(this,{$ref:U},!0)}async function $(U){try{return this._compileSchemaEnv(U)}catch(A){if(!(A instanceof HJ.default))throw A;return z.call(this,A),await J.call(this,A.missingSchema),$.call(this,U)}}function z({missingSchema:U,missingRef:A}){if(this.refs[U])throw Error(`AnySchema ${U} is loaded but ${A} cannot be resolved`)}async function J(U){let A=await H.call(this,U);if(!this.refs[U])await G.call(this,A.$schema);if(!this.refs[U])this.addSchema(A,U,Y)}async function H(U){let A=this._loading[U];if(A)return A;try{return await(this._loading[U]=X(U))}finally{delete this._loading[U]}}}addSchema(Q,Y,X,W=this.opts.validateSchema){if(Array.isArray(Q)){for(let $ of Q)this.addSchema($,void 0,X,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 Y=(0,f6.normalizeId)(Y||G),this._checkUnique(Y),this.schemas[Y]=this._addSchema(Q,X,Y,W,!0),this}addMetaSchema(Q,Y,X=this.opts.validateSchema){return this.addSchema(Q,Y,!0,X),this}validateSchema(Q,Y){if(typeof Q=="boolean")return!0;let X;if(X=Q.$schema,X!==void 0&&typeof X!="string")throw Error("$schema must be a string");if(X=X||this.opts.defaultMeta||this.defaultMeta(),!X)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let W=this.validate(X,Q);if(!W&&Y){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 Y;while(typeof(Y=JJ.call(this,Q))=="string")Q=Y;if(Y===void 0){let{schemaId:X}=this.opts,W=new h6.SchemaEnv({schema:{},schemaId:X});if(Y=h6.resolveSchema.call(this,W,Q),!Y)return;this.refs[Q]=Y}return Y.validate||this._compileSchemaEnv(Y)}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 Y=JJ.call(this,Q);if(typeof Y=="object")this._cache.delete(Y.schema);return delete this.schemas[Q],delete this.refs[Q],this}case"object":{let Y=Q;this._cache.delete(Y);let X=Q[this.opts.schemaId];if(X)X=(0,f6.normalizeId)(X),delete this.schemas[X],delete this.refs[X];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(Q){for(let Y of Q)this.addKeyword(Y);return this}addKeyword(Q,Y){let X;if(typeof Q=="string"){if(X=Q,typeof Y=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),Y.keyword=X}else if(typeof Q=="object"&&Y===void 0){if(Y=Q,X=Y.keyword,Array.isArray(X)&&!X.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(HF.call(this,X,Y),!Y)return(0,OY.eachItem)(X,(G)=>qY.call(this,G)),this;AF.call(this,Y);let W={...Y,type:(0,WQ.getJSONTypes)(Y.type),schemaType:(0,WQ.getJSONTypes)(Y.schemaType)};return(0,OY.eachItem)(X,W.type.length===0?(G)=>qY.call(this,G,W):(G)=>W.type.forEach(($)=>qY.call(this,G,W,$))),this}getKeyword(Q){let Y=this.RULES.all[Q];return typeof Y=="object"?Y.definition:!!Y}removeKeyword(Q){let{RULES:Y}=this;delete Y.keywords[Q],delete Y.all[Q];for(let X of Y.rules){let W=X.rules.findIndex((G)=>G.keyword===Q);if(W>=0)X.rules.splice(W,1)}return this}addFormat(Q,Y){if(typeof Y=="string")Y=new RegExp(Y);return this.formats[Q]=Y,this}errorsText(Q=this.errors,{separator:Y=", ",dataVar:X="data"}={}){if(!Q||Q.length===0)return"No errors";return Q.map((W)=>`${X}${W.instancePath} ${W.message}`).reduce((W,G)=>W+Y+G)}$dataMetaSchema(Q,Y){let X=this.RULES.all;Q=JSON.parse(JSON.stringify(Q));for(let W of Y){let G=W.split("/").slice(1),$=Q;for(let z of G)$=$[z];for(let z in X){let J=X[z];if(typeof J!="object")continue;let{$data:H}=J.definition,U=$[z];if(H&&U)$[z]=AJ(U)}}return Q}_removeAllSchemas(Q,Y){for(let X in Q){let W=Q[X];if(!Y||Y.test(X)){if(typeof W=="string")delete Q[X];else if(W&&!W.meta)this._cache.delete(W.schema),delete Q[X]}}}_addSchema(Q,Y,X,W=this.opts.validateSchema,G=this.opts.addUsedSchema){let $,{schemaId:z}=this.opts;if(typeof Q=="object")$=Q[z];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 J=this._cache.get(Q);if(J!==void 0)return J;X=(0,f6.normalizeId)($||X);let H=f6.getSchemaRefs.call(this,Q,X);if(J=new h6.SchemaEnv({schema:Q,schemaId:z,meta:Y,baseId:X,localRefs:H}),this._cache.set(J.schema,J),G&&!X.startsWith("#")){if(X)this._checkUnique(X);this.refs[X]=J}if(W)this.validateSchema(Q,!0);return J}_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 h6.compileSchema.call(this,Q);if(!Q.validate)throw Error("ajv implementation error");return Q.validate}_compileMetaSchema(Q){let Y=this.opts;this.opts=this._metaOpts;try{h6.compileSchema.call(this,Q)}finally{this.opts=Y}}}GQ.ValidationError=nL.default;GQ.MissingRefError=HJ.default;X1.default=GQ;function zJ(Q,Y,X,W="error"){for(let G in Q){let $=G;if($ in Y)this.logger[W](`${X}: option ${G}. ${Q[$]}`)}}function JJ(Q){return Q=(0,f6.normalizeId)(Q),this.schemas[Q]||this.refs[Q]}function YF(){let Q=this.opts.schemas;if(!Q)return;if(Array.isArray(Q))this.addSchema(Q);else for(let Y in Q)this.addSchema(Q[Y],Y)}function XF(){for(let Q in this.opts.formats){let Y=this.opts.formats[Q];if(Y)this.addFormat(Q,Y)}}function WF(Q){if(Array.isArray(Q)){this.addVocabulary(Q);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let Y in Q){let X=Q[Y];if(!X.keyword)X.keyword=Y;this.addKeyword(X)}}function GF(){let Q={...this.opts};for(let Y of tL)delete Q[Y];return Q}var $F={log(){},warn(){},error(){}};function zF(Q){if(Q===!1)return $F;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 JF=/^[a-z_$][a-z0-9_$:-]*$/i;function HF(Q,Y){let{RULES:X}=this;if((0,OY.eachItem)(Q,(W)=>{if(X.keywords[W])throw Error(`Keyword ${W} is already defined`);if(!JF.test(W))throw Error(`Keyword ${W} has invalid name`)}),!Y)return;if(Y.$data&&!(("code"in Y)||("validate"in Y)))throw Error('$data keyword must have "code" or "validate" function')}function qY(Q,Y,X){var W;let G=Y===null||Y===void 0?void 0:Y.post;if(X&&G)throw Error('keyword with "post" flag cannot have "type"');let{RULES:$}=this,z=G?$.post:$.rules.find(({type:H})=>H===X);if(!z)z={type:X,rules:[]},$.rules.push(z);if($.keywords[Q]=!0,!Y)return;let J={keyword:Q,definition:{...Y,type:(0,WQ.getJSONTypes)(Y.type),schemaType:(0,WQ.getJSONTypes)(Y.schemaType)}};if(Y.before)UF.call(this,z,J,Y.before);else z.rules.push(J);$.all[Q]=J,(W=Y.implements)===null||W===void 0||W.forEach((H)=>this.addKeyword(H))}function UF(Q,Y,X){let W=Q.rules.findIndex((G)=>G.keyword===X);if(W>=0)Q.rules.splice(W,0,Y);else Q.rules.push(Y),this.logger.warn(`rule ${X} is not defined`)}function AF(Q){let{metaSchema:Y}=Q;if(Y===void 0)return;if(Q.$data&&this.opts.$data)Y=AJ(Y);Q.validateSchema=this.compile(Y,!0)}var BF={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function AJ(Q){return{anyOf:[Q,BF]}}});var DJ=j((KJ)=>{Object.defineProperty(KJ,"__esModule",{value:!0});var LF={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};KJ.default=LF});var VJ=j((OJ)=>{Object.defineProperty(OJ,"__esModule",{value:!0});OJ.callRef=OJ.getValidate=void 0;var qF=g6(),LJ=S0(),Z0=g(),n1=e0(),FJ=s4(),$Q=c(),OF={keyword:"$ref",schemaType:"string",code(Q){let{gen:Y,schema:X,it:W}=Q,{baseId:G,schemaEnv:$,validateName:z,opts:J,self:H}=W,{root:U}=$;if((X==="#"||X==="#/")&&G===U.baseId)return B();let A=FJ.resolveRef.call(H,U,G,X);if(A===void 0)throw new qF.default(W.opts.uriResolver,G,X);if(A instanceof FJ.SchemaEnv)return K(A);return D(A);function B(){if($===U)return zQ(Q,z,$,$.$async);let O=Y.scopeValue("root",{ref:U});return zQ(Q,Z0._`${O}.validate`,U,U.$async)}function K(O){let M=qJ(Q,O);zQ(Q,M,O,O.$async)}function D(O){let M=Y.scopeValue("schema",J.code.source===!0?{ref:O,code:(0,Z0.stringify)(O)}:{ref:O}),Z=Y.name("valid"),V=Q.subschema({schema:O,dataTypes:[],schemaPath:Z0.nil,topSchemaRef:M,errSchemaPath:X},Z);Q.mergeEvaluated(V),Q.ok(Z)}}};function qJ(Q,Y){let{gen:X}=Q;return Y.validate?X.scopeValue("validate",{ref:Y.validate}):Z0._`${X.scopeValue("wrapper",{ref:Y})}.validate`}OJ.getValidate=qJ;function zQ(Q,Y,X,W){let{gen:G,it:$}=Q,{allErrors:z,schemaEnv:J,opts:H}=$,U=H.passContext?n1.default.this:Z0.nil;if(W)A();else B();function A(){if(!J.$async)throw Error("async schema referenced by sync schema");let O=G.let("valid");G.try(()=>{if(G.code(Z0._`await ${(0,LJ.callValidateCode)(Q,Y,U)}`),D(Y),!z)G.assign(O,!0)},(M)=>{if(G.if(Z0._`!(${M} instanceof ${$.ValidationError})`,()=>G.throw(M)),K(M),!z)G.assign(O,!1)}),Q.ok(O)}function B(){Q.result((0,LJ.callValidateCode)(Q,Y,U),()=>D(Y),()=>K(Y))}function K(O){let M=Z0._`${O}.errors`;G.assign(n1.default.vErrors,Z0._`${n1.default.vErrors} === null ? ${M} : ${n1.default.vErrors}.concat(${M})`),G.assign(n1.default.errors,Z0._`${n1.default.vErrors}.length`)}function D(O){var M;if(!$.opts.unevaluated)return;let Z=(M=X===null||X===void 0?void 0:X.validate)===null||M===void 0?void 0:M.evaluated;if($.props!==!0)if(Z&&!Z.dynamicProps){if(Z.props!==void 0)$.props=$Q.mergeEvaluated.props(G,Z.props,$.props)}else{let V=G.var("props",Z0._`${O}.evaluated.props`);$.props=$Q.mergeEvaluated.props(G,V,$.props,Z0.Name)}if($.items!==!0)if(Z&&!Z.dynamicItems){if(Z.items!==void 0)$.items=$Q.mergeEvaluated.items(G,Z.items,$.items)}else{let V=G.var("items",Z0._`${O}.evaluated.items`);$.items=$Q.mergeEvaluated.items(G,V,$.items,Z0.Name)}}}OJ.callRef=zQ;OJ.default=OF});var ZJ=j((NJ)=>{Object.defineProperty(NJ,"__esModule",{value:!0});var NF=DJ(),ZF=VJ(),wF=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",NF.default,ZF.default];NJ.default=wF});var jJ=j((wJ)=>{Object.defineProperty(wJ,"__esModule",{value:!0});var JQ=g(),q1=JQ.operators,HQ={maximum:{okStr:"<=",ok:q1.LTE,fail:q1.GT},minimum:{okStr:">=",ok:q1.GTE,fail:q1.LT},exclusiveMaximum:{okStr:"<",ok:q1.LT,fail:q1.GTE},exclusiveMinimum:{okStr:">",ok:q1.GT,fail:q1.LTE}},PF={message:({keyword:Q,schemaCode:Y})=>JQ.str`must be ${HQ[Q].okStr} ${Y}`,params:({keyword:Q,schemaCode:Y})=>JQ._`{comparison: ${HQ[Q].okStr}, limit: ${Y}}`},bF={keyword:Object.keys(HQ),type:"number",schemaType:"number",$data:!0,error:PF,code(Q){let{keyword:Y,data:X,schemaCode:W}=Q;Q.fail$data(JQ._`${X} ${HQ[Y].fail} ${W} || isNaN(${X})`)}};wJ.default=bF});var bJ=j((PJ)=>{Object.defineProperty(PJ,"__esModule",{value:!0});var l6=g(),EF={message:({schemaCode:Q})=>l6.str`must be multiple of ${Q}`,params:({schemaCode:Q})=>l6._`{multipleOf: ${Q}}`},TF={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:EF,code(Q){let{gen:Y,data:X,schemaCode:W,it:G}=Q,$=G.opts.multipleOfPrecision,z=Y.let("res"),J=$?l6._`Math.abs(Math.round(${z}) - ${z}) > 1e-${$}`:l6._`${z} !== parseInt(${z})`;Q.fail$data(l6._`(${W} === 0 || (${z} = ${X}/${W}, ${J}))`)}};PJ.default=TF});var TJ=j((EJ)=>{Object.defineProperty(EJ,"__esModule",{value:!0});function IJ(Q){let Y=Q.length,X=0,W=0,G;while(W<Y)if(X++,G=Q.charCodeAt(W++),G>=55296&&G<=56319&&W<Y){if(G=Q.charCodeAt(W),(G&64512)===56320)W++}return X}EJ.default=IJ;IJ.code='require("ajv/dist/runtime/ucs2length").default'});var RJ=j((SJ)=>{Object.defineProperty(SJ,"__esModule",{value:!0});var E1=g(),CF=c(),kF=TJ(),vF={message({keyword:Q,schemaCode:Y}){let X=Q==="maxLength"?"more":"fewer";return E1.str`must NOT have ${X} than ${Y} characters`},params:({schemaCode:Q})=>E1._`{limit: ${Q}}`},xF={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:vF,code(Q){let{keyword:Y,data:X,schemaCode:W,it:G}=Q,$=Y==="maxLength"?E1.operators.GT:E1.operators.LT,z=G.opts.unicode===!1?E1._`${X}.length`:E1._`${(0,CF.useFunc)(Q.gen,kF.default)}(${X})`;Q.fail$data(E1._`${z} ${$} ${W}`)}};SJ.default=xF});var kJ=j((CJ)=>{Object.defineProperty(CJ,"__esModule",{value:!0});var gF=S0(),UQ=g(),yF={message:({schemaCode:Q})=>UQ.str`must match pattern "${Q}"`,params:({schemaCode:Q})=>UQ._`{pattern: ${Q}}`},uF={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:yF,code(Q){let{data:Y,$data:X,schema:W,schemaCode:G,it:$}=Q,z=$.opts.unicodeRegExp?"u":"",J=X?UQ._`(new RegExp(${G}, ${z}))`:(0,gF.usePattern)(Q,W);Q.fail$data(UQ._`!${J}.test(${Y})`)}};CJ.default=uF});var xJ=j((vJ)=>{Object.defineProperty(vJ,"__esModule",{value:!0});var m6=g(),fF={message({keyword:Q,schemaCode:Y}){let X=Q==="maxProperties"?"more":"fewer";return m6.str`must NOT have ${X} than ${Y} properties`},params:({schemaCode:Q})=>m6._`{limit: ${Q}}`},lF={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:fF,code(Q){let{keyword:Y,data:X,schemaCode:W}=Q,G=Y==="maxProperties"?m6.operators.GT:m6.operators.LT;Q.fail$data(m6._`Object.keys(${X}).length ${G} ${W}`)}};vJ.default=lF});var gJ=j((_J)=>{Object.defineProperty(_J,"__esModule",{value:!0});var c6=S0(),p6=g(),cF=c(),pF={message:({params:{missingProperty:Q}})=>p6.str`must have required property '${Q}'`,params:({params:{missingProperty:Q}})=>p6._`{missingProperty: ${Q}}`},iF={keyword:"required",type:"object",schemaType:"array",$data:!0,error:pF,code(Q){let{gen:Y,schema:X,schemaCode:W,data:G,$data:$,it:z}=Q,{opts:J}=z;if(!$&&X.length===0)return;let H=X.length>=J.loopRequired;if(z.allErrors)U();else A();if(J.strictRequired){let D=Q.parentSchema.properties,{definedProperties:O}=Q.it;for(let M of X)if((D===null||D===void 0?void 0:D[M])===void 0&&!O.has(M)){let Z=z.schemaEnv.baseId+z.errSchemaPath,V=`required property "${M}" is not defined at "${Z}" (strictRequired)`;(0,cF.checkStrictMode)(z,V,z.opts.strictRequired)}}function U(){if(H||$)Q.block$data(p6.nil,B);else for(let D of X)(0,c6.checkReportMissingProp)(Q,D)}function A(){let D=Y.let("missing");if(H||$){let O=Y.let("valid",!0);Q.block$data(O,()=>K(D,O)),Q.ok(O)}else Y.if((0,c6.checkMissingProp)(Q,X,D)),(0,c6.reportMissingProp)(Q,D),Y.else()}function B(){Y.forOf("prop",W,(D)=>{Q.setParams({missingProperty:D}),Y.if((0,c6.noPropertyInData)(Y,G,D,J.ownProperties),()=>Q.error())})}function K(D,O){Q.setParams({missingProperty:D}),Y.forOf(D,W,()=>{Y.assign(O,(0,c6.propertyInData)(Y,G,D,J.ownProperties)),Y.if((0,p6.not)(O),()=>{Q.error(),Y.break()})},p6.nil)}}};_J.default=iF});var uJ=j((yJ)=>{Object.defineProperty(yJ,"__esModule",{value:!0});var i6=g(),rF={message({keyword:Q,schemaCode:Y}){let X=Q==="maxItems"?"more":"fewer";return i6.str`must NOT have ${X} than ${Y} items`},params:({schemaCode:Q})=>i6._`{limit: ${Q}}`},dF={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:rF,code(Q){let{keyword:Y,data:X,schemaCode:W}=Q,G=Y==="maxItems"?i6.operators.GT:i6.operators.LT;Q.fail$data(i6._`${X}.length ${G} ${W}`)}};yJ.default=dF});var AQ=j((fJ)=>{Object.defineProperty(fJ,"__esModule",{value:!0});var hJ=XY();hJ.code='require("ajv/dist/runtime/equal").default';fJ.default=hJ});var mJ=j((lJ)=>{Object.defineProperty(lJ,"__esModule",{value:!0});var MY=C6(),D0=g(),aF=c(),sF=AQ(),eF={message:({params:{i:Q,j:Y}})=>D0.str`must NOT have duplicate items (items ## ${Y} and ${Q} are identical)`,params:({params:{i:Q,j:Y}})=>D0._`{i: ${Q}, j: ${Y}}`},Qq={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:eF,code(Q){let{gen:Y,data:X,$data:W,schema:G,parentSchema:$,schemaCode:z,it:J}=Q;if(!W&&!G)return;let H=Y.let("valid"),U=$.items?(0,MY.getSchemaTypes)($.items):[];Q.block$data(H,A,D0._`${z} === false`),Q.ok(H);function A(){let O=Y.let("i",D0._`${X}.length`),M=Y.let("j");Q.setParams({i:O,j:M}),Y.assign(H,!0),Y.if(D0._`${O} > 1`,()=>(B()?K:D)(O,M))}function B(){return U.length>0&&!U.some((O)=>O==="object"||O==="array")}function K(O,M){let Z=Y.name("item"),V=(0,MY.checkDataTypes)(U,Z,J.opts.strictNumbers,MY.DataType.Wrong),R=Y.const("indices",D0._`{}`);Y.for(D0._`;${O}--;`,()=>{if(Y.let(Z,D0._`${X}[${O}]`),Y.if(V,D0._`continue`),U.length>1)Y.if(D0._`typeof ${Z} == "string"`,D0._`${Z} += "_"`);Y.if(D0._`typeof ${R}[${Z}] == "number"`,()=>{Y.assign(M,D0._`${R}[${Z}]`),Q.error(),Y.assign(H,!1).break()}).code(D0._`${R}[${Z}] = ${O}`)})}function D(O,M){let Z=(0,aF.useFunc)(Y,sF.default),V=Y.name("outer");Y.label(V).for(D0._`;${O}--;`,()=>Y.for(D0._`${M} = ${O}; ${M}--;`,()=>Y.if(D0._`${Z}(${X}[${O}], ${X}[${M}])`,()=>{Q.error(),Y.assign(H,!1).break(V)})))}}};lJ.default=Qq});var pJ=j((cJ)=>{Object.defineProperty(cJ,"__esModule",{value:!0});var VY=g(),Xq=c(),Wq=AQ(),Gq={message:"must be equal to constant",params:({schemaCode:Q})=>VY._`{allowedValue: ${Q}}`},$q={keyword:"const",$data:!0,error:Gq,code(Q){let{gen:Y,data:X,$data:W,schemaCode:G,schema:$}=Q;if(W||$&&typeof $=="object")Q.fail$data(VY._`!${(0,Xq.useFunc)(Y,Wq.default)}(${X}, ${G})`);else Q.fail(VY._`${$} !== ${X}`)}};cJ.default=$q});var nJ=j((iJ)=>{Object.defineProperty(iJ,"__esModule",{value:!0});var n6=g(),Jq=c(),Hq=AQ(),Uq={message:"must be equal to one of the allowed values",params:({schemaCode:Q})=>n6._`{allowedValues: ${Q}}`},Aq={keyword:"enum",schemaType:"array",$data:!0,error:Uq,code(Q){let{gen:Y,data:X,$data:W,schema:G,schemaCode:$,it:z}=Q;if(!W&&G.length===0)throw Error("enum must have non-empty array");let J=G.length>=z.opts.loopEnum,H,U=()=>H!==null&&H!==void 0?H:H=(0,Jq.useFunc)(Y,Hq.default),A;if(J||W)A=Y.let("valid"),Q.block$data(A,B);else{if(!Array.isArray(G))throw Error("ajv implementation error");let D=Y.const("vSchema",$);A=(0,n6.or)(...G.map((O,M)=>K(D,M)))}Q.pass(A);function B(){Y.assign(A,!1),Y.forOf("v",$,(D)=>Y.if(n6._`${U()}(${X}, ${D})`,()=>Y.assign(A,!0).break()))}function K(D,O){let M=G[O];return typeof M==="object"&&M!==null?n6._`${U()}(${X}, ${D}[${O}])`:n6._`${X} === ${M}`}}};iJ.default=Aq});var dJ=j((rJ)=>{Object.defineProperty(rJ,"__esModule",{value:!0});var Kq=jJ(),Dq=bJ(),Lq=RJ(),Fq=kJ(),qq=xJ(),Oq=gJ(),Mq=uJ(),Vq=mJ(),Nq=pJ(),Zq=nJ(),wq=[Kq.default,Dq.default,Lq.default,Fq.default,qq.default,Oq.default,Mq.default,Vq.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Nq.default,Zq.default];rJ.default=wq});var ZY=j((tJ)=>{Object.defineProperty(tJ,"__esModule",{value:!0});tJ.validateAdditionalItems=void 0;var T1=g(),NY=c(),Pq={message:({params:{len:Q}})=>T1.str`must NOT have more than ${Q} items`,params:({params:{len:Q}})=>T1._`{limit: ${Q}}`},bq={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Pq,code(Q){let{parentSchema:Y,it:X}=Q,{items:W}=Y;if(!Array.isArray(W)){(0,NY.checkStrictMode)(X,'"additionalItems" is ignored when "items" is not an array of schemas');return}oJ(Q,W)}};function oJ(Q,Y){let{gen:X,schema:W,data:G,keyword:$,it:z}=Q;z.items=!0;let J=X.const("len",T1._`${G}.length`);if(W===!1)Q.setParams({len:Y.length}),Q.pass(T1._`${J} <= ${Y.length}`);else if(typeof W=="object"&&!(0,NY.alwaysValidSchema)(z,W)){let U=X.var("valid",T1._`${J} <= ${Y.length}`);X.if((0,T1.not)(U),()=>H(U)),Q.ok(U)}function H(U){X.forRange("i",Y.length,J,(A)=>{if(Q.subschema({keyword:$,dataProp:A,dataPropType:NY.Type.Num},U),!z.allErrors)X.if((0,T1.not)(U),()=>X.break())})}}tJ.validateAdditionalItems=oJ;tJ.default=bq});var wY=j((Q7)=>{Object.defineProperty(Q7,"__esModule",{value:!0});Q7.validateTuple=void 0;var sJ=g(),BQ=c(),Eq=S0(),Tq={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(Q){let{schema:Y,it:X}=Q;if(Array.isArray(Y))return eJ(Q,"additionalItems",Y);if(X.items=!0,(0,BQ.alwaysValidSchema)(X,Y))return;Q.ok((0,Eq.validateArray)(Q))}};function eJ(Q,Y,X=Q.schema){let{gen:W,parentSchema:G,data:$,keyword:z,it:J}=Q;if(A(G),J.opts.unevaluated&&X.length&&J.items!==!0)J.items=BQ.mergeEvaluated.items(W,X.length,J.items);let H=W.name("valid"),U=W.const("len",sJ._`${$}.length`);X.forEach((B,K)=>{if((0,BQ.alwaysValidSchema)(J,B))return;W.if(sJ._`${U} > ${K}`,()=>Q.subschema({keyword:z,schemaProp:K,dataProp:K},H)),Q.ok(H)});function A(B){let{opts:K,errSchemaPath:D}=J,O=X.length,M=O===B.minItems&&(O===B.maxItems||B[Y]===!1);if(K.strictTuples&&!M){let Z=`"${z}" is ${O}-tuple, but minItems or maxItems/${Y} are not specified or different at path "${D}"`;(0,BQ.checkStrictMode)(J,Z,K.strictTuples)}}}Q7.validateTuple=eJ;Q7.default=Tq});var W7=j((X7)=>{Object.defineProperty(X7,"__esModule",{value:!0});var Rq=wY(),Cq={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(Q)=>(0,Rq.validateTuple)(Q,"items")};X7.default=Cq});var z7=j(($7)=>{Object.defineProperty($7,"__esModule",{value:!0});var G7=g(),vq=c(),xq=S0(),_q=ZY(),gq={message:({params:{len:Q}})=>G7.str`must NOT have more than ${Q} items`,params:({params:{len:Q}})=>G7._`{limit: ${Q}}`},yq={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:gq,code(Q){let{schema:Y,parentSchema:X,it:W}=Q,{prefixItems:G}=X;if(W.items=!0,(0,vq.alwaysValidSchema)(W,Y))return;if(G)(0,_q.validateAdditionalItems)(Q,G);else Q.ok((0,xq.validateArray)(Q))}};$7.default=yq});var H7=j((J7)=>{Object.defineProperty(J7,"__esModule",{value:!0});var R0=g(),KQ=c(),hq={message:({params:{min:Q,max:Y}})=>Y===void 0?R0.str`must contain at least ${Q} valid item(s)`:R0.str`must contain at least ${Q} and no more than ${Y} valid item(s)`,params:({params:{min:Q,max:Y}})=>Y===void 0?R0._`{minContains: ${Q}}`:R0._`{minContains: ${Q}, maxContains: ${Y}}`},fq={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:hq,code(Q){let{gen:Y,schema:X,parentSchema:W,data:G,it:$}=Q,z,J,{minContains:H,maxContains:U}=W;if($.opts.next)z=H===void 0?1:H,J=U;else z=1;let A=Y.const("len",R0._`${G}.length`);if(Q.setParams({min:z,max:J}),J===void 0&&z===0){(0,KQ.checkStrictMode)($,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(J!==void 0&&z>J){(0,KQ.checkStrictMode)($,'"minContains" > "maxContains" is always invalid'),Q.fail();return}if((0,KQ.alwaysValidSchema)($,X)){let M=R0._`${A} >= ${z}`;if(J!==void 0)M=R0._`${M} && ${A} <= ${J}`;Q.pass(M);return}$.items=!0;let B=Y.name("valid");if(J===void 0&&z===1)D(B,()=>Y.if(B,()=>Y.break()));else if(z===0){if(Y.let(B,!0),J!==void 0)Y.if(R0._`${G}.length > 0`,K)}else Y.let(B,!1),K();Q.result(B,()=>Q.reset());function K(){let M=Y.name("_valid"),Z=Y.let("count",0);D(M,()=>Y.if(M,()=>O(Z)))}function D(M,Z){Y.forRange("i",0,A,(V)=>{Q.subschema({keyword:"contains",dataProp:V,dataPropType:KQ.Type.Num,compositeRule:!0},M),Z()})}function O(M){if(Y.code(R0._`${M}++`),J===void 0)Y.if(R0._`${M} >= ${z}`,()=>Y.assign(B,!0).break());else if(Y.if(R0._`${M} > ${J}`,()=>Y.assign(B,!1).break()),z===1)Y.assign(B,!0);else Y.if(R0._`${M} >= ${z}`,()=>Y.assign(B,!0))}}};J7.default=fq});var L7=j((B7)=>{Object.defineProperty(B7,"__esModule",{value:!0});B7.validateSchemaDeps=B7.validatePropertyDeps=B7.error=void 0;var jY=g(),mq=c(),r6=S0();B7.error={message:({params:{property:Q,depsCount:Y,deps:X}})=>{let W=Y===1?"property":"properties";return jY.str`must have ${W} ${X} when property ${Q} is present`},params:({params:{property:Q,depsCount:Y,deps:X,missingProperty:W}})=>jY._`{property: ${Q},
|
|
6
6
|
missingProperty: ${W},
|
|
7
7
|
depsCount: ${Y},
|
|
8
|
-
deps: ${X}}`};var cq={keyword:"dependencies",type:"object",schemaType:"object",error:A7.error,code(Q){let[Y,X]=pq(Q);H7(Q,Y),U7(Q,X)}};function pq({schema:Q}){let Y={},X={};for(let W in Q){if(W==="__proto__")continue;let G=Array.isArray(Q[W])?Y:X;G[W]=Q[W]}return[Y,X]}function H7(Q,Y=Q.schema){let{gen:X,data:W,it:G}=Q;if(Object.keys(Y).length===0)return;let $=X.let("missing");for(let z in Y){let J=Y[z];if(J.length===0)continue;let H=(0,n6.propertyInData)(X,W,z,G.opts.ownProperties);if(Q.setParams({property:z,depsCount:J.length,deps:J.join(", ")}),G.allErrors)X.if(H,()=>{for(let U of J)(0,n6.checkReportMissingProp)(Q,U)});else X.if(jY._`${H} && (${(0,n6.checkMissingProp)(Q,J,$)})`),(0,n6.reportMissingProp)(Q,$),X.else()}}A7.validatePropertyDeps=H7;function U7(Q,Y=Q.schema){let{gen:X,data:W,keyword:G,it:$}=Q,z=X.name("valid");for(let J in Y){if((0,mq.alwaysValidSchema)($,Y[J]))continue;X.if((0,n6.propertyInData)(X,W,J,$.opts.ownProperties),()=>{let H=Q.subschema({keyword:G,schemaProp:J},z);Q.mergeValidEvaluated(H,z)},()=>X.var(z,!0)),Q.ok(z)}}A7.validateSchemaDeps=U7;A7.default=cq});var q7=j((F7)=>{Object.defineProperty(F7,"__esModule",{value:!0});var L7=g(),rq=c(),dq={message:"property name must be valid",params:({params:Q})=>L7._`{propertyName: ${Q.propertyName}}`},oq={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:dq,code(Q){let{gen:Y,schema:X,data:W,it:G}=Q;if((0,rq.alwaysValidSchema)(G,X))return;let $=Y.name("valid");Y.forIn("key",W,(z)=>{Q.setParams({propertyName:z}),Q.subschema({keyword:"propertyNames",data:z,dataTypes:["string"],propertyName:z,compositeRule:!0},$),Y.if((0,L7.not)($),()=>{if(Q.error(!0),!G.allErrors)Y.break()})}),Q.ok($)}};F7.default=oq});var PY=j((O7)=>{Object.defineProperty(O7,"__esModule",{value:!0});var KQ=S0(),u0=g(),aq=e0(),DQ=c(),sq={message:"must NOT have additional properties",params:({params:Q})=>u0._`{additionalProperty: ${Q.additionalProperty}}`},eq={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:sq,code(Q){let{gen:Y,schema:X,parentSchema:W,data:G,errsCount:$,it:z}=Q;if(!$)throw Error("ajv implementation error");let{allErrors:J,opts:H}=z;if(z.props=!0,H.removeAdditional!=="all"&&(0,DQ.alwaysValidSchema)(z,X))return;let U=(0,KQ.allSchemaProperties)(W.properties),A=(0,KQ.allSchemaProperties)(W.patternProperties);B(),Q.ok(u0._`${$} === ${aq.default.errors}`);function B(){Y.forIn("key",G,(Z)=>{if(!U.length&&!A.length)O(Z);else Y.if(K(Z),()=>O(Z))})}function K(Z){let V;if(U.length>8){let R=(0,DQ.schemaRefOrVal)(z,W.properties,"properties");V=(0,KQ.isOwnProperty)(Y,R,Z)}else if(U.length)V=(0,u0.or)(...U.map((R)=>u0._`${Z} === ${R}`));else V=u0.nil;if(A.length)V=(0,u0.or)(V,...A.map((R)=>u0._`${(0,KQ.usePattern)(Q,R)}.test(${Z})`));return(0,u0.not)(V)}function D(Z){Y.code(u0._`delete ${G}[${Z}]`)}function O(Z){if(H.removeAdditional==="all"||H.removeAdditional&&X===!1){D(Z);return}if(X===!1){if(Q.setParams({additionalProperty:Z}),Q.error(),!J)Y.break();return}if(typeof X=="object"&&!(0,DQ.alwaysValidSchema)(z,X)){let V=Y.name("valid");if(H.removeAdditional==="failing")M(Z,V,!1),Y.if((0,u0.not)(V),()=>{Q.reset(),D(Z)});else if(M(Z,V),!J)Y.if((0,u0.not)(V),()=>Y.break())}}function M(Z,V,R){let T={keyword:"additionalProperties",dataProp:Z,dataPropType:DQ.Type.Str};if(R===!1)Object.assign(T,{compositeRule:!0,createErrors:!1,allErrors:!1});Q.subschema(T,V)}}};O7.default=eq});var Z7=j((N7)=>{Object.defineProperty(N7,"__esModule",{value:!0});var YO=x6(),M7=S0(),bY=c(),V7=PY(),XO={keyword:"properties",type:"object",schemaType:"object",code(Q){let{gen:Y,schema:X,parentSchema:W,data:G,it:$}=Q;if($.opts.removeAdditional==="all"&&W.additionalProperties===void 0)V7.default.code(new YO.KeywordCxt($,V7.default,"additionalProperties"));let z=(0,M7.allSchemaProperties)(X);for(let B of z)$.definedProperties.add(B);if($.opts.unevaluated&&z.length&&$.props!==!0)$.props=bY.mergeEvaluated.props(Y,(0,bY.toHash)(z),$.props);let J=z.filter((B)=>!(0,bY.alwaysValidSchema)($,X[B]));if(J.length===0)return;let H=Y.name("valid");for(let B of J){if(U(B))A(B);else{if(Y.if((0,M7.propertyInData)(Y,G,B,$.opts.ownProperties)),A(B),!$.allErrors)Y.else().var(H,!0);Y.endIf()}Q.it.definedProperties.add(B),Q.ok(H)}function U(B){return $.opts.useDefaults&&!$.compositeRule&&X[B].default!==void 0}function A(B){Q.subschema({keyword:"properties",schemaProp:B,dataProp:B},H)}}};N7.default=XO});var I7=j((b7)=>{Object.defineProperty(b7,"__esModule",{value:!0});var w7=S0(),LQ=g(),j7=c(),P7=c(),GO={keyword:"patternProperties",type:"object",schemaType:"object",code(Q){let{gen:Y,schema:X,data:W,parentSchema:G,it:$}=Q,{opts:z}=$,J=(0,w7.allSchemaProperties)(X),H=J.filter((M)=>(0,j7.alwaysValidSchema)($,X[M]));if(J.length===0||H.length===J.length&&(!$.opts.unevaluated||$.props===!0))return;let U=z.strictSchema&&!z.allowMatchingProperties&&G.properties,A=Y.name("valid");if($.props!==!0&&!($.props instanceof LQ.Name))$.props=(0,P7.evaluatedPropsToName)(Y,$.props);let{props:B}=$;K();function K(){for(let M of J){if(U)D(M);if($.allErrors)O(M);else Y.var(A,!0),O(M),Y.if(A)}}function D(M){for(let Z in U)if(new RegExp(M).test(Z))(0,j7.checkStrictMode)($,`property ${Z} matches pattern ${M} (use allowMatchingProperties)`)}function O(M){Y.forIn("key",W,(Z)=>{Y.if(LQ._`${(0,w7.usePattern)(Q,M)}.test(${Z})`,()=>{let V=H.includes(M);if(!V)Q.subschema({keyword:"patternProperties",schemaProp:M,dataProp:Z,dataPropType:P7.Type.Str},A);if($.opts.unevaluated&&B!==!0)Y.assign(LQ._`${B}[${Z}]`,!0);else if(!V&&!$.allErrors)Y.if((0,LQ.not)(A),()=>Y.break())})})}}};b7.default=GO});var T7=j((E7)=>{Object.defineProperty(E7,"__esModule",{value:!0});var zO=c(),JO={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(Q){let{gen:Y,schema:X,it:W}=Q;if((0,zO.alwaysValidSchema)(W,X)){Q.fail();return}let G=Y.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"}};E7.default=JO});var R7=j((S7)=>{Object.defineProperty(S7,"__esModule",{value:!0});var UO=S0(),AO={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:UO.validateUnion,error:{message:"must match a schema in anyOf"}};S7.default=AO});var k7=j((C7)=>{Object.defineProperty(C7,"__esModule",{value:!0});var FQ=g(),KO=c(),DO={message:"must match exactly one schema in oneOf",params:({params:Q})=>FQ._`{passingSchemas: ${Q.passing}}`},LO={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:DO,code(Q){let{gen:Y,schema:X,parentSchema:W,it:G}=Q;if(!Array.isArray(X))throw Error("ajv implementation error");if(G.opts.discriminator&&W.discriminator)return;let $=X,z=Y.let("valid",!1),J=Y.let("passing",null),H=Y.name("_valid");Q.setParams({passing:J}),Y.block(U),Q.result(z,()=>Q.reset(),()=>Q.error(!0));function U(){$.forEach((A,B)=>{let K;if((0,KO.alwaysValidSchema)(G,A))Y.var(H,!0);else K=Q.subschema({keyword:"oneOf",schemaProp:B,compositeRule:!0},H);if(B>0)Y.if(FQ._`${H} && ${z}`).assign(z,!1).assign(J,FQ._`[${J}, ${B}]`).else();Y.if(H,()=>{if(Y.assign(z,!0),Y.assign(J,B),K)Q.mergeEvaluated(K,FQ.Name)})})}}};C7.default=LO});var x7=j((v7)=>{Object.defineProperty(v7,"__esModule",{value:!0});var qO=c(),OO={keyword:"allOf",schemaType:"array",code(Q){let{gen:Y,schema:X,it:W}=Q;if(!Array.isArray(X))throw Error("ajv implementation error");let G=Y.name("valid");X.forEach(($,z)=>{if((0,qO.alwaysValidSchema)(W,$))return;let J=Q.subschema({keyword:"allOf",schemaProp:z},G);Q.ok(G),Q.mergeEvaluated(J)})}};v7.default=OO});var u7=j((y7)=>{Object.defineProperty(y7,"__esModule",{value:!0});var qQ=g(),g7=c(),VO={message:({params:Q})=>qQ.str`must match "${Q.ifClause}" schema`,params:({params:Q})=>qQ._`{failingKeyword: ${Q.ifClause}}`},NO={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:VO,code(Q){let{gen:Y,parentSchema:X,it:W}=Q;if(X.then===void 0&&X.else===void 0)(0,g7.checkStrictMode)(W,'"if" without "then" and "else" is ignored');let G=_7(W,"then"),$=_7(W,"else");if(!G&&!$)return;let z=Y.let("valid",!0),J=Y.name("_valid");if(H(),Q.reset(),G&&$){let A=Y.let("ifClause");Q.setParams({ifClause:A}),Y.if(J,U("then",A),U("else",A))}else if(G)Y.if(J,U("then"));else Y.if((0,qQ.not)(J),U("else"));Q.pass(z,()=>Q.error(!0));function H(){let A=Q.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},J);Q.mergeEvaluated(A)}function U(A,B){return()=>{let K=Q.subschema({keyword:A},J);if(Y.assign(z,J),Q.mergeValidEvaluated(K,z),B)Y.assign(B,qQ._`${A}`);else Q.setParams({ifClause:A})}}}};function _7(Q,Y){let X=Q.schema[Y];return X!==void 0&&!(0,g7.alwaysValidSchema)(Q,X)}y7.default=NO});var f7=j((h7)=>{Object.defineProperty(h7,"__esModule",{value:!0});var wO=c(),jO={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:Q,parentSchema:Y,it:X}){if(Y.if===void 0)(0,wO.checkStrictMode)(X,`"${Q}" without "if" is ignored`)}};h7.default=jO});var m7=j((l7)=>{Object.defineProperty(l7,"__esModule",{value:!0});var bO=ZY(),IO=X7(),EO=wY(),TO=$7(),SO=J7(),RO=D7(),CO=q7(),kO=PY(),vO=Z7(),xO=I7(),_O=T7(),gO=R7(),yO=k7(),uO=x7(),hO=u7(),fO=f7();function lO(Q=!1){let Y=[_O.default,gO.default,yO.default,uO.default,hO.default,fO.default,CO.default,kO.default,RO.default,vO.default,xO.default];if(Q)Y.push(IO.default,TO.default);else Y.push(bO.default,EO.default);return Y.push(SO.default),Y}l7.default=lO});var p7=j((c7)=>{Object.defineProperty(c7,"__esModule",{value:!0});var W0=g(),cO={message:({schemaCode:Q})=>W0.str`must match format "${Q}"`,params:({schemaCode:Q})=>W0._`{format: ${Q}}`},pO={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:cO,code(Q,Y){let{gen:X,data:W,$data:G,schema:$,schemaCode:z,it:J}=Q,{opts:H,errSchemaPath:U,schemaEnv:A,self:B}=J;if(!H.validateFormats)return;if(G)K();else D();function K(){let O=X.scopeValue("formats",{ref:B.formats,code:H.code.formats}),M=X.const("fDef",W0._`${O}[${z}]`),Z=X.let("fType"),V=X.let("format");X.if(W0._`typeof ${M} == "object" && !(${M} instanceof RegExp)`,()=>X.assign(Z,W0._`${M}.type || "string"`).assign(V,W0._`${M}.validate`),()=>X.assign(Z,W0._`"string"`).assign(V,M)),Q.fail$data((0,W0.or)(R(),T()));function R(){if(H.strictSchema===!1)return W0.nil;return W0._`${z} && !${V}`}function T(){let y=A.$async?W0._`(${M}.async ? await ${V}(${W}) : ${V}(${W}))`:W0._`${V}(${W})`,S=W0._`(typeof ${V} == "function" ? ${y} : ${V}.test(${W}))`;return W0._`${V} && ${V} !== true && ${Z} === ${Y} && !${S}`}}function D(){let O=B.formats[$];if(!O){R();return}if(O===!0)return;let[M,Z,V]=T(O);if(M===Y)Q.pass(y());function R(){if(H.strictSchema===!1){B.logger.warn(S());return}throw Error(S());function S(){return`unknown format "${$}" ignored in schema at path "${U}"`}}function T(S){let m0=S instanceof RegExp?(0,W0.regexpCode)(S):H.code.formats?W0._`${H.code.formats}${(0,W0.getProperty)($)}`:void 0,r0=X.scopeValue("formats",{key:$,ref:S,code:m0});if(typeof S=="object"&&!(S instanceof RegExp))return[S.type||"string",S.validate,W0._`${r0}.validate`];return["string",S,r0]}function y(){if(typeof O=="object"&&!(O instanceof RegExp)&&O.async){if(!A.$async)throw Error("async format in sync schema");return W0._`await ${V}(${W})`}return typeof Z=="function"?W0._`${V}(${W})`:W0._`${V}.test(${W})`}}}};c7.default=pO});var n7=j((i7)=>{Object.defineProperty(i7,"__esModule",{value:!0});var nO=p7(),rO=[nO.default];i7.default=rO});var o7=j((r7)=>{Object.defineProperty(r7,"__esModule",{value:!0});r7.contentVocabulary=r7.metadataVocabulary=void 0;r7.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];r7.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var s7=j((a7)=>{Object.defineProperty(a7,"__esModule",{value:!0});var tO=NJ(),aO=rJ(),sO=m7(),eO=n7(),t7=o7(),QM=[tO.default,aO.default,(0,sO.default)(),eO.default,t7.metadataVocabulary,t7.contentVocabulary];a7.default=QM});var X5=j((Q5)=>{Object.defineProperty(Q5,"__esModule",{value:!0});Q5.DiscrError=void 0;var e7;(function(Q){Q.Tag="tag",Q.Mapping="mapping"})(e7||(Q5.DiscrError=e7={}))});var $5=j((G5)=>{Object.defineProperty(G5,"__esModule",{value:!0});var r1=g(),IY=X5(),W5=a4(),XM=_6(),WM=c(),GM={message:({params:{discrError:Q,tagName:Y}})=>Q===IY.DiscrError.Tag?`tag "${Y}" must be string`:`value of tag "${Y}" must be in oneOf`,params:({params:{discrError:Q,tag:Y,tagName:X}})=>r1._`{error: ${Q}, tag: ${X}, tagValue: ${Y}}`},$M={keyword:"discriminator",type:"object",schemaType:"object",error:GM,code(Q){let{gen:Y,data:X,schema:W,parentSchema:G,it:$}=Q,{oneOf:z}=G;if(!$.opts.discriminator)throw Error("discriminator: requires discriminator option");let J=W.propertyName;if(typeof J!="string")throw Error("discriminator: requires propertyName");if(W.mapping)throw Error("discriminator: mapping is not supported");if(!z)throw Error("discriminator: requires oneOf keyword");let H=Y.let("valid",!1),U=Y.const("tag",r1._`${X}${(0,r1.getProperty)(J)}`);Y.if(r1._`typeof ${U} == "string"`,()=>A(),()=>Q.error(!1,{discrError:IY.DiscrError.Tag,tag:U,tagName:J})),Q.ok(H);function A(){let D=K();Y.if(!1);for(let O in D)Y.elseIf(r1._`${U} === ${O}`),Y.assign(H,B(D[O]));Y.else(),Q.error(!1,{discrError:IY.DiscrError.Mapping,tag:U,tagName:J}),Y.endIf()}function B(D){let O=Y.name("valid"),M=Q.subschema({keyword:"oneOf",schemaProp:D},O);return Q.mergeEvaluated(M,r1.Name),O}function K(){var D;let O={},M=V(G),Z=!0;for(let y=0;y<z.length;y++){let S=z[y];if((S===null||S===void 0?void 0:S.$ref)&&!(0,WM.schemaHasRulesButRef)(S,$.self.RULES)){let r0=S.$ref;if(S=W5.resolveRef.call($.self,$.schemaEnv.root,$.baseId,r0),S instanceof W5.SchemaEnv)S=S.schema;if(S===void 0)throw new XM.default($.opts.uriResolver,$.baseId,r0)}let m0=(D=S===null||S===void 0?void 0:S.properties)===null||D===void 0?void 0:D[J];if(typeof m0!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${J}"`);Z=Z&&(M||V(S)),R(m0,y)}if(!Z)throw Error(`discriminator: "${J}" must be required`);return O;function V({required:y}){return Array.isArray(y)&&y.includes(J)}function R(y,S){if(y.const)T(y.const,S);else if(y.enum)for(let m0 of y.enum)T(m0,S);else throw Error(`discriminator: "properties/${J}" must have "const" or "enum"`)}function T(y,S){if(typeof y!="string"||y in O)throw Error(`discriminator: "${J}" values must be unique strings`);O[y]=S}}}};G5.default=$M});var z5=j((zE,JM)=>{JM.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 TY=j((w0,EY)=>{Object.defineProperty(w0,"__esModule",{value:!0});w0.MissingRefError=w0.ValidationError=w0.CodeGen=w0.Name=w0.nil=w0.stringify=w0.str=w0._=w0.KeywordCxt=w0.Ajv=void 0;var HM=AJ(),UM=s7(),AM=$5(),J5=z5(),BM=["/properties"],OQ="http://json-schema.org/draft-07/schema";class r6 extends HM.default{_addVocabularies(){if(super._addVocabularies(),UM.default.forEach((Q)=>this.addVocabulary(Q)),this.opts.discriminator)this.addKeyword(AM.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let Q=this.opts.$data?this.$dataMetaSchema(J5,BM):J5;this.addMetaSchema(Q,OQ,!1),this.refs["http://json-schema.org/schema"]=OQ}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(OQ)?OQ:void 0)}}w0.Ajv=r6;EY.exports=w0=r6;EY.exports.Ajv=r6;Object.defineProperty(w0,"__esModule",{value:!0});w0.default=r6;var KM=x6();Object.defineProperty(w0,"KeywordCxt",{enumerable:!0,get:function(){return KM.KeywordCxt}});var d1=g();Object.defineProperty(w0,"_",{enumerable:!0,get:function(){return d1._}});Object.defineProperty(w0,"str",{enumerable:!0,get:function(){return d1.str}});Object.defineProperty(w0,"stringify",{enumerable:!0,get:function(){return d1.stringify}});Object.defineProperty(w0,"nil",{enumerable:!0,get:function(){return d1.nil}});Object.defineProperty(w0,"Name",{enumerable:!0,get:function(){return d1.Name}});Object.defineProperty(w0,"CodeGen",{enumerable:!0,get:function(){return d1.CodeGen}});var DM=o4();Object.defineProperty(w0,"ValidationError",{enumerable:!0,get:function(){return DM.default}});var LM=_6();Object.defineProperty(w0,"MissingRefError",{enumerable:!0,get:function(){return LM.default}})});var O5=j((F5)=>{Object.defineProperty(F5,"__esModule",{value:!0});F5.formatNames=F5.fastFormats=F5.fullFormats=void 0;function i0(Q,Y){return{validate:Q,compare:Y}}F5.fullFormats={date:i0(B5,kY),time:i0(RY(!0),vY),"date-time":i0(H5(!0),D5),"iso-time":i0(RY(),K5),"iso-date-time":i0(H5(),L5),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:wM,"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:SM,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:jM,int32:{type:"number",validate:IM},int64:{type:"number",validate:EM},float:{type:"number",validate:A5},double:{type:"number",validate:A5},password:!0,binary:!0};F5.fastFormats={...F5.fullFormats,date:i0(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,kY),time:i0(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,vY),"date-time":i0(/^\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,D5),"iso-time":i0(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,K5),"iso-date-time":i0(/^\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,L5),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};F5.formatNames=Object.keys(F5.fullFormats);function OM(Q){return Q%4===0&&(Q%100!==0||Q%400===0)}var MM=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,VM=[0,31,28,31,30,31,30,31,31,30,31,30,31];function B5(Q){let Y=MM.exec(Q);if(!Y)return!1;let X=+Y[1],W=+Y[2],G=+Y[3];return W>=1&&W<=12&&G>=1&&G<=(W===2&&OM(X)?29:VM[W])}function kY(Q,Y){if(!(Q&&Y))return;if(Q>Y)return 1;if(Q<Y)return-1;return 0}var SY=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function RY(Q){return function(X){let W=SY.exec(X);if(!W)return!1;let G=+W[1],$=+W[2],z=+W[3],J=W[4],H=W[5]==="-"?-1:1,U=+(W[6]||0),A=+(W[7]||0);if(U>23||A>59||Q&&!J)return!1;if(G<=23&&$<=59&&z<60)return!0;let B=$-A*H,K=G-U*H-(B<0?1:0);return(K===23||K===-1)&&(B===59||B===-1)&&z<61}}function vY(Q,Y){if(!(Q&&Y))return;let X=new Date("2020-01-01T"+Q).valueOf(),W=new Date("2020-01-01T"+Y).valueOf();if(!(X&&W))return;return X-W}function K5(Q,Y){if(!(Q&&Y))return;let X=SY.exec(Q),W=SY.exec(Y);if(!(X&&W))return;if(Q=X[1]+X[2]+X[3],Y=W[1]+W[2]+W[3],Q>Y)return 1;if(Q<Y)return-1;return 0}var CY=/t|\s/i;function H5(Q){let Y=RY(Q);return function(W){let G=W.split(CY);return G.length===2&&B5(G[0])&&Y(G[1])}}function D5(Q,Y){if(!(Q&&Y))return;let X=new Date(Q).valueOf(),W=new Date(Y).valueOf();if(!(X&&W))return;return X-W}function L5(Q,Y){if(!(Q&&Y))return;let[X,W]=Q.split(CY),[G,$]=Y.split(CY),z=kY(X,G);if(z===void 0)return;return z||vY(W,$)}var NM=/\/|:/,ZM=/^(?:[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 wM(Q){return NM.test(Q)&&ZM.test(Q)}var U5=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function jM(Q){return U5.lastIndex=0,U5.test(Q)}var PM=-2147483648,bM=2147483647;function IM(Q){return Number.isInteger(Q)&&Q<=bM&&Q>=PM}function EM(Q){return Number.isInteger(Q)}function A5(){return!0}var TM=/[^\\]\\Z/;function SM(Q){if(TM.test(Q))return!1;try{return new RegExp(Q),!0}catch(Y){return!1}}});var V5=j((M5)=>{Object.defineProperty(M5,"__esModule",{value:!0});M5.formatLimitDefinition=void 0;var CM=TY(),h0=g(),O1=h0.operators,MQ={formatMaximum:{okStr:"<=",ok:O1.LTE,fail:O1.GT},formatMinimum:{okStr:">=",ok:O1.GTE,fail:O1.LT},formatExclusiveMaximum:{okStr:"<",ok:O1.LT,fail:O1.GTE},formatExclusiveMinimum:{okStr:">",ok:O1.GT,fail:O1.LTE}},kM={message:({keyword:Q,schemaCode:Y})=>h0.str`should be ${MQ[Q].okStr} ${Y}`,params:({keyword:Q,schemaCode:Y})=>h0._`{comparison: ${MQ[Q].okStr}, limit: ${Y}}`};M5.formatLimitDefinition={keyword:Object.keys(MQ),type:"string",schemaType:"string",$data:!0,error:kM,code(Q){let{gen:Y,data:X,schemaCode:W,keyword:G,it:$}=Q,{opts:z,self:J}=$;if(!z.validateFormats)return;let H=new CM.KeywordCxt($,J.RULES.all.format.definition,"format");if(H.$data)U();else A();function U(){let K=Y.scopeValue("formats",{ref:J.formats,code:z.code.formats}),D=Y.const("fmt",h0._`${K}[${H.schemaCode}]`);Q.fail$data((0,h0.or)(h0._`typeof ${D} != "object"`,h0._`${D} instanceof RegExp`,h0._`typeof ${D}.compare != "function"`,B(D)))}function A(){let K=H.schema,D=J.formats[K];if(!D||D===!0)return;if(typeof D!="object"||D instanceof RegExp||typeof D.compare!="function")throw Error(`"${G}": format "${K}" does not define "compare" function`);let O=Y.scopeValue("formats",{key:K,ref:D,code:z.code.formats?h0._`${z.code.formats}${(0,h0.getProperty)(K)}`:void 0});Q.fail$data(B(O))}function B(K){return h0._`${K}.compare(${X}, ${W}) ${MQ[G].fail} 0`}},dependencies:["format"]};var vM=(Q)=>{return Q.addKeyword(M5.formatLimitDefinition),Q};M5.default=vM});var j5=j((d6,w5)=>{Object.defineProperty(d6,"__esModule",{value:!0});var o1=O5(),_M=V5(),gY=g(),N5=new gY.Name("fullFormats"),gM=new gY.Name("fastFormats"),yY=(Q,Y={keywords:!0})=>{if(Array.isArray(Y))return Z5(Q,Y,o1.fullFormats,N5),Q;let[X,W]=Y.mode==="fast"?[o1.fastFormats,gM]:[o1.fullFormats,N5],G=Y.formats||o1.formatNames;if(Z5(Q,G,X,W),Y.keywords)(0,_M.default)(Q);return Q};yY.get=(Q,Y="full")=>{let W=(Y==="fast"?o1.fastFormats:o1.fullFormats)[Q];if(!W)throw Error(`Unknown format "${Q}"`);return W};function Z5(Q,Y,X,W){var G,$;(G=($=Q.opts.code).formats)!==null&&G!==void 0||($.formats=gY._`require("ajv-formats/dist/formats").${W}`);for(let z of Y)Q.addFormat(z,X[z])}w5.exports=d6=yY;Object.defineProperty(d6,"__esModule",{value:!0});d6.default=yY});import{AsyncLocalStorage as UH}from"node:async_hooks";class V1 extends Error{statusCode;rawDetails;code;context;constructor(Q,Y,X,W,G){super(Q);this.statusCode=Y;this.rawDetails=X;this.code=W;this.context=G;this.name="McpApiError"}}function JH(Q){if(Q instanceof V1)return{message:Q.message,statusCode:Q.statusCode,code:Q.code,rawDetails:Q.rawDetails,context:Q.context};if(Q instanceof Error)return{message:Q.message};return{message:String(Q)}}function HH(Q){let Y=JH(Q),X=Y.message.trim()||"Unknown error",W=X.toLowerCase(),G=Y.rawDetails?.trim()||X;if(Y.context?.title||Y.context?.description||Y.context?.howToFix||Y.context?.docsUrl)return{title:Y.context.title??(Y.statusCode===409?"Request conflict":"API request failed"),description:Y.context.description??X,howToFix:Y.context.howToFix??"Review the details below, adjust the tool input, and retry.",docsUrl:Y.context.docsUrl??"https://docs.sequenzy.com/concepts/mcp",details:G};if(Y.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(Y.statusCode===401||Y.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(Y.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(Y.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(Y.statusCode===409||W.includes("already exists"))return{title:"Resource already exists",description:"Sequenzy rejected this MCP request because it would create a duplicate resource.",howToFix:"List the existing resources first, reuse the matching resource when appropriate, or retry with a unique name or domain.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G};if(Y.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(Y.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(Y.statusCode&&Y.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 R1(Q){let Y=HH(Q);return[`Sequenzy MCP error: ${Y.title}`,`Description: ${Y.description}`,`How to fix: ${Y.howToFix}`,`Docs: ${Y.docsUrl}`,`Details: ${Y.details}`].join(`
|
|
9
|
-
`)}var AH="https://api.sequenzy.com",Q6=new UH,YX=!1;function cV(){YX=!0}function XX(){return YX}var WX=null;function N1(){let Q=Q6.getStore();if(Q)return Q.selectedCompanyId??null;return WX}function TQ(Q){let Y=Q6.getStore();if(Y){Y.selectedCompanyId=Q;return}WX=Q}function GX(Q,Y){return Q6.run(Q,Y)}function BH(){return Q6.getStore()?.apiUrl??process.env.SEQUENZY_API_URL??AH}function $X(){return Q6.getStore()?.apiKey??process.env.SEQUENZY_API_KEY}function pV(){if($X())return;console.error(R1(new V1("SEQUENZY_API_KEY environment variable is required",401,void 0,"MCP_AUTH_REQUIRED"))),process.exit(1)}function j0(Q,Y){let X=Q[Y];return typeof X==="string"&&X.trim()!==""?X.trim():void 0}function KH(Q){if(Q===void 0)return;if(typeof Q==="string")return Q.trim()||void 0;return JSON.stringify(Q)}function DH(Q){if(!Q.trim())return{message:"Request failed"};try{let Y=JSON.parse(Q);if(typeof Y==="string")return{message:Y};let X=typeof Y.error==="object"&&Y.error!==null?Y.error:void 0,W=j0(Y,"code")??(X?j0(X,"code"):void 0),G=(typeof Y.error==="string"?Y.error:void 0)??(X?j0(X,"message"):void 0)??j0(Y,"message")??j0(Y,"error")??Q,$=j0(Y,"howToFix")??j0(Y,"resolution"),z={...j0(Y,"title")?{title:j0(Y,"title")}:{},...j0(Y,"description")?{description:j0(Y,"description")}:{},...$?{howToFix:$}:{},...j0(Y,"docsUrl")?{docsUrl:j0(Y,"docsUrl")}:{}},J=KH(Y.details);if(Object.keys(z).length>0||J)return{message:G,...W?{code:W}:{},...J?{details:J}:{},...Object.keys(z).length>0?{context:z}:{}};if(typeof Y.error==="string")return{message:Y.error,...W?{code:W}:{}};if(X)return{message:G,...W?{code:W}:{}};return{message:G,...W?{code:W}:{}}}catch{return{message:Q}}}async function L(Q,Y,X,W){let G=$X();if(!G)throw new V1("SEQUENZY_API_KEY environment variable is required",401,void 0,"MCP_AUTH_REQUIRED");let $={"Content-Type":"application/json",Authorization:`Bearer ${G}`},z=W??N1();if(z)$["x-company-id"]=z;let J;try{J=await fetch(`${BH()}${Y}`,{method:Q,headers:$,body:X?JSON.stringify(X):void 0})}catch(H){throw new V1(H instanceof Error?H.message:"Failed to reach Sequenzy API",0,void 0,"NETWORK_ERROR")}if(!J.ok){let H=await J.text(),U=DH(H);throw new V1(U.message,J.status,U.details??H,U.code,U.context)}return J.json()}var nV=Object.freeze({status:"aborted"});function q(Q,Y,X){function W(J,H){var U;Object.defineProperty(J,"_zod",{value:J._zod??{},enumerable:!1}),(U=J._zod).traits??(U.traits=new Set),J._zod.traits.add(Q),Y(J,H);for(let A in z.prototype)if(!(A in J))Object.defineProperty(J,A,{value:z.prototype[A].bind(J)});J._zod.constr=z,J._zod.def=H}let G=X?.Parent??Object;class $ extends G{}Object.defineProperty($,"name",{value:Q});function z(J){var H;let U=X?.Parent?new $:this;W(U,J),(H=U._zod).deferred??(H.deferred=[]);for(let A of U._zod.deferred)A();return U}return Object.defineProperty(z,"init",{value:W}),Object.defineProperty(z,Symbol.hasInstance,{value:(J)=>{if(X?.Parent&&J instanceof X.Parent)return!0;return J?._zod?.traits?.has(Q)}}),Object.defineProperty(z,"name",{value:Q}),z}var rV=Symbol("zod_brand");class d0 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Y6 extends Error{constructor(Q){super(`Encountered unidirectional transform during encode: ${Q}`);this.name="ZodEncodeError"}}var e6={};function I0(Q){if(Q)Object.assign(e6,Q);return e6}var m={};QX(m,{unwrapMessage:()=>X6,uint8ArrayToHex:()=>uH,uint8ArrayToBase64url:()=>gH,uint8ArrayToBase64:()=>KX,stringifyPrimitive:()=>W4,shallowClone:()=>JX,safeExtend:()=>RH,required:()=>vH,randomString:()=>jH,propertyKeyTypes:()=>vQ,promiseAllObject:()=>wH,primitiveTypes:()=>HX,prefixIssues:()=>t0,pick:()=>EH,partial:()=>kH,optionalKeys:()=>xQ,omit:()=>TH,objectClone:()=>VH,numKeys:()=>PH,nullish:()=>W6,normalizeParams:()=>E,mergeDefs:()=>$1,merge:()=>CH,jsonStringifyReplacer:()=>C1,joinValues:()=>Q4,issue:()=>v1,isPlainObject:()=>z1,isObject:()=>Z1,hexToUint8Array:()=>yH,getSizableOrigin:()=>AX,getParsedType:()=>bH,getLengthableOrigin:()=>$6,getEnumValues:()=>RQ,getElementAtPath:()=>ZH,floatSafeRemainder:()=>CQ,finalizeIssue:()=>v0,extend:()=>SH,escapeRegex:()=>o0,esc:()=>Y4,defineLazy:()=>i,createTransparentProxy:()=>IH,cloneDef:()=>NH,clone:()=>k0,cleanRegex:()=>G6,cleanEnum:()=>xH,captureStackTrace:()=>X4,cached:()=>k1,base64urlToUint8Array:()=>_H,base64ToUint8Array:()=>BX,assignProp:()=>G1,assertNotEqual:()=>FH,assertNever:()=>OH,assertIs:()=>qH,assertEqual:()=>LH,assert:()=>MH,allowsEval:()=>kQ,aborted:()=>J1,NUMBER_FORMAT_RANGES:()=>_Q,Class:()=>DX,BIGINT_FORMAT_RANGES:()=>UX});function LH(Q){return Q}function FH(Q){return Q}function qH(Q){}function OH(Q){throw Error()}function MH(Q){}function RQ(Q){let Y=Object.values(Q).filter((W)=>typeof W==="number");return Object.entries(Q).filter(([W,G])=>Y.indexOf(+W)===-1).map(([W,G])=>G)}function Q4(Q,Y="|"){return Q.map((X)=>W4(X)).join(Y)}function C1(Q,Y){if(typeof Y==="bigint")return Y.toString();return Y}function k1(Q){return{get value(){{let X=Q();return Object.defineProperty(this,"value",{value:X}),X}throw Error("cached value already set")}}}function W6(Q){return Q===null||Q===void 0}function G6(Q){let Y=Q.startsWith("^")?1:0,X=Q.endsWith("$")?Q.length-1:Q.length;return Q.slice(Y,X)}function CQ(Q,Y){let X=(Q.toString().split(".")[1]||"").length,W=Y.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 $=X>G?X:G,z=Number.parseInt(Q.toFixed($).replace(".","")),J=Number.parseInt(Y.toFixed($).replace(".",""));return z%J/10**$}var zX=Symbol("evaluating");function i(Q,Y,X){let W=void 0;Object.defineProperty(Q,Y,{get(){if(W===zX)return;if(W===void 0)W=zX,W=X();return W},set(G){Object.defineProperty(Q,Y,{value:G})},configurable:!0})}function VH(Q){return Object.create(Object.getPrototypeOf(Q),Object.getOwnPropertyDescriptors(Q))}function G1(Q,Y,X){Object.defineProperty(Q,Y,{value:X,writable:!0,enumerable:!0,configurable:!0})}function $1(...Q){let Y={};for(let X of Q){let W=Object.getOwnPropertyDescriptors(X);Object.assign(Y,W)}return Object.defineProperties({},Y)}function NH(Q){return $1(Q._zod.def)}function ZH(Q,Y){if(!Y)return Q;return Y.reduce((X,W)=>X?.[W],Q)}function wH(Q){let Y=Object.keys(Q),X=Y.map((W)=>Q[W]);return Promise.all(X).then((W)=>{let G={};for(let $=0;$<Y.length;$++)G[Y[$]]=W[$];return G})}function jH(Q=10){let X="";for(let W=0;W<Q;W++)X+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return X}function Y4(Q){return JSON.stringify(Q)}var X4="captureStackTrace"in Error?Error.captureStackTrace:(...Q)=>{};function Z1(Q){return typeof Q==="object"&&Q!==null&&!Array.isArray(Q)}var kQ=k1(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(Q){return!1}});function z1(Q){if(Z1(Q)===!1)return!1;let Y=Q.constructor;if(Y===void 0)return!0;let X=Y.prototype;if(Z1(X)===!1)return!1;if(Object.prototype.hasOwnProperty.call(X,"isPrototypeOf")===!1)return!1;return!0}function JX(Q){if(z1(Q))return{...Q};if(Array.isArray(Q))return[...Q];return Q}function PH(Q){let Y=0;for(let X in Q)if(Object.prototype.hasOwnProperty.call(Q,X))Y++;return Y}var bH=(Q)=>{let Y=typeof Q;switch(Y){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: ${Y}`)}},vQ=new Set(["string","number","symbol"]),HX=new Set(["string","number","bigint","boolean","symbol","undefined"]);function o0(Q){return Q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function k0(Q,Y,X){let W=new Q._zod.constr(Y??Q._zod.def);if(!Y||X?.parent)W._zod.parent=Q;return W}function E(Q){let Y=Q;if(!Y)return{};if(typeof Y==="string")return{error:()=>Y};if(Y?.message!==void 0){if(Y?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");Y.error=Y.message}if(delete Y.message,typeof Y.error==="string")return{...Y,error:()=>Y.error};return Y}function IH(Q){let Y;return new Proxy({},{get(X,W,G){return Y??(Y=Q()),Reflect.get(Y,W,G)},set(X,W,G,$){return Y??(Y=Q()),Reflect.set(Y,W,G,$)},has(X,W){return Y??(Y=Q()),Reflect.has(Y,W)},deleteProperty(X,W){return Y??(Y=Q()),Reflect.deleteProperty(Y,W)},ownKeys(X){return Y??(Y=Q()),Reflect.ownKeys(Y)},getOwnPropertyDescriptor(X,W){return Y??(Y=Q()),Reflect.getOwnPropertyDescriptor(Y,W)},defineProperty(X,W,G){return Y??(Y=Q()),Reflect.defineProperty(Y,W,G)}})}function W4(Q){if(typeof Q==="bigint")return Q.toString()+"n";if(typeof Q==="string")return`"${Q}"`;return`${Q}`}function xQ(Q){return Object.keys(Q).filter((Y)=>{return Q[Y]._zod.optin==="optional"&&Q[Y]._zod.optout==="optional"})}var _Q={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 EH(Q,Y){let X=Q._zod.def,W=$1(Q._zod.def,{get shape(){let G={};for(let $ in Y){if(!($ in X.shape))throw Error(`Unrecognized key: "${$}"`);if(!Y[$])continue;G[$]=X.shape[$]}return G1(this,"shape",G),G},checks:[]});return k0(Q,W)}function TH(Q,Y){let X=Q._zod.def,W=$1(Q._zod.def,{get shape(){let G={...Q._zod.def.shape};for(let $ in Y){if(!($ in X.shape))throw Error(`Unrecognized key: "${$}"`);if(!Y[$])continue;delete G[$]}return G1(this,"shape",G),G},checks:[]});return k0(Q,W)}function SH(Q,Y){if(!z1(Y))throw Error("Invalid input to extend: expected a plain object");let X=Q._zod.def.checks;if(X&&X.length>0)throw Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");let G=$1(Q._zod.def,{get shape(){let $={...Q._zod.def.shape,...Y};return G1(this,"shape",$),$},checks:[]});return k0(Q,G)}function RH(Q,Y){if(!z1(Y))throw Error("Invalid input to safeExtend: expected a plain object");let X={...Q._zod.def,get shape(){let W={...Q._zod.def.shape,...Y};return G1(this,"shape",W),W},checks:Q._zod.def.checks};return k0(Q,X)}function CH(Q,Y){let X=$1(Q._zod.def,{get shape(){let W={...Q._zod.def.shape,...Y._zod.def.shape};return G1(this,"shape",W),W},get catchall(){return Y._zod.def.catchall},checks:[]});return k0(Q,X)}function kH(Q,Y,X){let W=$1(Y._zod.def,{get shape(){let G=Y._zod.def.shape,$={...G};if(X)for(let z in X){if(!(z in G))throw Error(`Unrecognized key: "${z}"`);if(!X[z])continue;$[z]=Q?new Q({type:"optional",innerType:G[z]}):G[z]}else for(let z in G)$[z]=Q?new Q({type:"optional",innerType:G[z]}):G[z];return G1(this,"shape",$),$},checks:[]});return k0(Y,W)}function vH(Q,Y,X){let W=$1(Y._zod.def,{get shape(){let G=Y._zod.def.shape,$={...G};if(X)for(let z in X){if(!(z in $))throw Error(`Unrecognized key: "${z}"`);if(!X[z])continue;$[z]=new Q({type:"nonoptional",innerType:G[z]})}else for(let z in G)$[z]=new Q({type:"nonoptional",innerType:G[z]});return G1(this,"shape",$),$},checks:[]});return k0(Y,W)}function J1(Q,Y=0){if(Q.aborted===!0)return!0;for(let X=Y;X<Q.issues.length;X++)if(Q.issues[X]?.continue!==!0)return!0;return!1}function t0(Q,Y){return Y.map((X)=>{var W;return(W=X).path??(W.path=[]),X.path.unshift(Q),X})}function X6(Q){return typeof Q==="string"?Q:Q?.message}function v0(Q,Y,X){let W={...Q,path:Q.path??[]};if(!Q.message){let G=X6(Q.inst?._zod.def?.error?.(Q))??X6(Y?.error?.(Q))??X6(X.customError?.(Q))??X6(X.localeError?.(Q))??"Invalid input";W.message=G}if(delete W.inst,delete W.continue,!Y?.reportInput)delete W.input;return W}function AX(Q){if(Q instanceof Set)return"set";if(Q instanceof Map)return"map";if(Q instanceof File)return"file";return"unknown"}function $6(Q){if(Array.isArray(Q))return"array";if(typeof Q==="string")return"string";return"unknown"}function v1(...Q){let[Y,X,W]=Q;if(typeof Y==="string")return{message:Y,code:"custom",input:X,inst:W};return{...Y}}function xH(Q){return Object.entries(Q).filter(([Y,X])=>{return Number.isNaN(Number.parseInt(Y,10))}).map((Y)=>Y[1])}function BX(Q){let Y=atob(Q),X=new Uint8Array(Y.length);for(let W=0;W<Y.length;W++)X[W]=Y.charCodeAt(W);return X}function KX(Q){let Y="";for(let X=0;X<Q.length;X++)Y+=String.fromCharCode(Q[X]);return btoa(Y)}function _H(Q){let Y=Q.replace(/-/g,"+").replace(/_/g,"/"),X="=".repeat((4-Y.length%4)%4);return BX(Y+X)}function gH(Q){return KX(Q).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function yH(Q){let Y=Q.replace(/^0x/,"");if(Y.length%2!==0)throw Error("Invalid hex string length");let X=new Uint8Array(Y.length/2);for(let W=0;W<Y.length;W+=2)X[W/2]=Number.parseInt(Y.slice(W,W+2),16);return X}function uH(Q){return Array.from(Q).map((Y)=>Y.toString(16).padStart(2,"0")).join("")}class DX{constructor(...Q){}}var LX=(Q,Y)=>{Q.name="$ZodError",Object.defineProperty(Q,"_zod",{value:Q._zod,enumerable:!1}),Object.defineProperty(Q,"issues",{value:Y,enumerable:!1}),Q.message=JSON.stringify(Y,C1,2),Object.defineProperty(Q,"toString",{value:()=>Q.message,enumerable:!1})},G4=q("$ZodError",LX),gQ=q("$ZodError",LX,{Parent:Error});function FX(Q,Y=(X)=>X.message){let X={},W=[];for(let G of Q.issues)if(G.path.length>0)X[G.path[0]]=X[G.path[0]]||[],X[G.path[0]].push(Y(G));else W.push(Y(G));return{formErrors:W,fieldErrors:X}}function qX(Q,Y=(X)=>X.message){let X={_errors:[]},W=(G)=>{for(let $ of G.issues)if($.code==="invalid_union"&&$.errors.length)$.errors.map((z)=>W({issues:z}));else if($.code==="invalid_key")W({issues:$.issues});else if($.code==="invalid_element")W({issues:$.issues});else if($.path.length===0)X._errors.push(Y($));else{let z=X,J=0;while(J<$.path.length){let H=$.path[J];if(J!==$.path.length-1)z[H]=z[H]||{_errors:[]};else z[H]=z[H]||{_errors:[]},z[H]._errors.push(Y($));z=z[H],J++}}};return W(Q),X}var $4=(Q)=>(Y,X,W,G)=>{let $=W?Object.assign(W,{async:!1}):{async:!1},z=Y._zod.run({value:X,issues:[]},$);if(z instanceof Promise)throw new d0;if(z.issues.length){let J=new(G?.Err??Q)(z.issues.map((H)=>v0(H,$,I0())));throw X4(J,G?.callee),J}return z.value};var z4=(Q)=>async(Y,X,W,G)=>{let $=W?Object.assign(W,{async:!0}):{async:!0},z=Y._zod.run({value:X,issues:[]},$);if(z instanceof Promise)z=await z;if(z.issues.length){let J=new(G?.Err??Q)(z.issues.map((H)=>v0(H,$,I0())));throw X4(J,G?.callee),J}return z.value};var z6=(Q)=>(Y,X,W)=>{let G=W?{...W,async:!1}:{async:!1},$=Y._zod.run({value:X,issues:[]},G);if($ instanceof Promise)throw new d0;return $.issues.length?{success:!1,error:new(Q??G4)($.issues.map((z)=>v0(z,G,I0())))}:{success:!0,data:$.value}},J6=z6(gQ),H6=(Q)=>async(Y,X,W)=>{let G=W?Object.assign(W,{async:!0}):{async:!0},$=Y._zod.run({value:X,issues:[]},G);if($ instanceof Promise)$=await $;return $.issues.length?{success:!1,error:new Q($.issues.map((z)=>v0(z,G,I0())))}:{success:!0,data:$.value}},J4=H6(gQ),OX=(Q)=>(Y,X,W)=>{let G=W?Object.assign(W,{direction:"backward"}):{direction:"backward"};return $4(Q)(Y,X,G)};var MX=(Q)=>(Y,X,W)=>{return $4(Q)(Y,X,W)};var VX=(Q)=>async(Y,X,W)=>{let G=W?Object.assign(W,{direction:"backward"}):{direction:"backward"};return z4(Q)(Y,X,G)};var NX=(Q)=>async(Y,X,W)=>{return z4(Q)(Y,X,W)};var ZX=(Q)=>(Y,X,W)=>{let G=W?Object.assign(W,{direction:"backward"}):{direction:"backward"};return z6(Q)(Y,X,G)};var wX=(Q)=>(Y,X,W)=>{return z6(Q)(Y,X,W)};var jX=(Q)=>async(Y,X,W)=>{let G=W?Object.assign(W,{direction:"backward"}):{direction:"backward"};return H6(Q)(Y,X,G)};var PX=(Q)=>async(Y,X,W)=>{return H6(Q)(Y,X,W)};var bX=/^[cC][^\s-]{8,}$/,IX=/^[0-9a-z]+$/,EX=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,TX=/^[0-9a-vA-V]{20}$/,SX=/^[A-Za-z0-9]{27}$/,RX=/^[a-zA-Z0-9_-]{21}$/,CX=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var kX=/^([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})$/,yQ=(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 vX=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function xX(){return new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}var _X=/^(?:(?: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])$/,gX=/^(([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}|:))$/,yX=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,uX=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,hX=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,uQ=/^[A-Za-z0-9_-]*$/,fX=/^(?=.{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 lX=/^\+(?:[0-9]){6,14}[0-9]$/,mX="(?:(?:\\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])))",cX=new RegExp(`^${mX}$`);function pX(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 iX(Q){return new RegExp(`^${pX(Q)}$`)}function nX(Q){let Y=pX({precision:Q.precision}),X=["Z"];if(Q.local)X.push("");if(Q.offset)X.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let W=`${Y}(?:${X.join("|")})`;return new RegExp(`^${mX}T(?:${W})$`)}var rX=(Q)=>{let Y=Q?`[\\s\\S]{${Q?.minimum??0},${Q?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${Y}$`)};var dX=/^-?\d+$/,oX=/^-?\d+(?:\.\d+)?/,tX=/^(?:true|false)$/i,aX=/^null$/i;var sX=/^[^A-Z]*$/,eX=/^[^a-z]*$/;var H0=q("$ZodCheck",(Q,Y)=>{var X;Q._zod??(Q._zod={}),Q._zod.def=Y,(X=Q._zod).onattach??(X.onattach=[])}),Q8={number:"number",bigint:"bigint",object:"date"},hQ=q("$ZodCheckLessThan",(Q,Y)=>{H0.init(Q,Y);let X=Q8[typeof Y.value];Q._zod.onattach.push((W)=>{let G=W._zod.bag,$=(Y.inclusive?G.maximum:G.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(Y.value<$)if(Y.inclusive)G.maximum=Y.value;else G.exclusiveMaximum=Y.value}),Q._zod.check=(W)=>{if(Y.inclusive?W.value<=Y.value:W.value<Y.value)return;W.issues.push({origin:X,code:"too_big",maximum:Y.value,input:W.value,inclusive:Y.inclusive,inst:Q,continue:!Y.abort})}}),fQ=q("$ZodCheckGreaterThan",(Q,Y)=>{H0.init(Q,Y);let X=Q8[typeof Y.value];Q._zod.onattach.push((W)=>{let G=W._zod.bag,$=(Y.inclusive?G.minimum:G.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(Y.value>$)if(Y.inclusive)G.minimum=Y.value;else G.exclusiveMinimum=Y.value}),Q._zod.check=(W)=>{if(Y.inclusive?W.value>=Y.value:W.value>Y.value)return;W.issues.push({origin:X,code:"too_small",minimum:Y.value,input:W.value,inclusive:Y.inclusive,inst:Q,continue:!Y.abort})}}),Y8=q("$ZodCheckMultipleOf",(Q,Y)=>{H0.init(Q,Y),Q._zod.onattach.push((X)=>{var W;(W=X._zod.bag).multipleOf??(W.multipleOf=Y.value)}),Q._zod.check=(X)=>{if(typeof X.value!==typeof Y.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof X.value==="bigint"?X.value%Y.value===BigInt(0):CQ(X.value,Y.value)===0)return;X.issues.push({origin:typeof X.value,code:"not_multiple_of",divisor:Y.value,input:X.value,inst:Q,continue:!Y.abort})}}),X8=q("$ZodCheckNumberFormat",(Q,Y)=>{H0.init(Q,Y),Y.format=Y.format||"float64";let X=Y.format?.includes("int"),W=X?"int":"number",[G,$]=_Q[Y.format];Q._zod.onattach.push((z)=>{let J=z._zod.bag;if(J.format=Y.format,J.minimum=G,J.maximum=$,X)J.pattern=dX}),Q._zod.check=(z)=>{let J=z.value;if(X){if(!Number.isInteger(J)){z.issues.push({expected:W,format:Y.format,code:"invalid_type",continue:!1,input:J,inst:Q});return}if(!Number.isSafeInteger(J)){if(J>0)z.issues.push({input:J,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:Q,origin:W,continue:!Y.abort});else z.issues.push({input:J,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:Q,origin:W,continue:!Y.abort});return}}if(J<G)z.issues.push({origin:"number",input:J,code:"too_small",minimum:G,inclusive:!0,inst:Q,continue:!Y.abort});if(J>$)z.issues.push({origin:"number",input:J,code:"too_big",maximum:$,inst:Q})}});var W8=q("$ZodCheckMaxLength",(Q,Y)=>{var X;H0.init(Q,Y),(X=Q._zod.def).when??(X.when=(W)=>{let G=W.value;return!W6(G)&&G.length!==void 0}),Q._zod.onattach.push((W)=>{let G=W._zod.bag.maximum??Number.POSITIVE_INFINITY;if(Y.maximum<G)W._zod.bag.maximum=Y.maximum}),Q._zod.check=(W)=>{let G=W.value;if(G.length<=Y.maximum)return;let z=$6(G);W.issues.push({origin:z,code:"too_big",maximum:Y.maximum,inclusive:!0,input:G,inst:Q,continue:!Y.abort})}}),G8=q("$ZodCheckMinLength",(Q,Y)=>{var X;H0.init(Q,Y),(X=Q._zod.def).when??(X.when=(W)=>{let G=W.value;return!W6(G)&&G.length!==void 0}),Q._zod.onattach.push((W)=>{let G=W._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(Y.minimum>G)W._zod.bag.minimum=Y.minimum}),Q._zod.check=(W)=>{let G=W.value;if(G.length>=Y.minimum)return;let z=$6(G);W.issues.push({origin:z,code:"too_small",minimum:Y.minimum,inclusive:!0,input:G,inst:Q,continue:!Y.abort})}}),$8=q("$ZodCheckLengthEquals",(Q,Y)=>{var X;H0.init(Q,Y),(X=Q._zod.def).when??(X.when=(W)=>{let G=W.value;return!W6(G)&&G.length!==void 0}),Q._zod.onattach.push((W)=>{let G=W._zod.bag;G.minimum=Y.length,G.maximum=Y.length,G.length=Y.length}),Q._zod.check=(W)=>{let G=W.value,$=G.length;if($===Y.length)return;let z=$6(G),J=$>Y.length;W.issues.push({origin:z,...J?{code:"too_big",maximum:Y.length}:{code:"too_small",minimum:Y.length},inclusive:!0,exact:!0,input:W.value,inst:Q,continue:!Y.abort})}}),U6=q("$ZodCheckStringFormat",(Q,Y)=>{var X,W;if(H0.init(Q,Y),Q._zod.onattach.push((G)=>{let $=G._zod.bag;if($.format=Y.format,Y.pattern)$.patterns??($.patterns=new Set),$.patterns.add(Y.pattern)}),Y.pattern)(X=Q._zod).check??(X.check=(G)=>{if(Y.pattern.lastIndex=0,Y.pattern.test(G.value))return;G.issues.push({origin:"string",code:"invalid_format",format:Y.format,input:G.value,...Y.pattern?{pattern:Y.pattern.toString()}:{},inst:Q,continue:!Y.abort})});else(W=Q._zod).check??(W.check=()=>{})}),z8=q("$ZodCheckRegex",(Q,Y)=>{U6.init(Q,Y),Q._zod.check=(X)=>{if(Y.pattern.lastIndex=0,Y.pattern.test(X.value))return;X.issues.push({origin:"string",code:"invalid_format",format:"regex",input:X.value,pattern:Y.pattern.toString(),inst:Q,continue:!Y.abort})}}),J8=q("$ZodCheckLowerCase",(Q,Y)=>{Y.pattern??(Y.pattern=sX),U6.init(Q,Y)}),H8=q("$ZodCheckUpperCase",(Q,Y)=>{Y.pattern??(Y.pattern=eX),U6.init(Q,Y)}),U8=q("$ZodCheckIncludes",(Q,Y)=>{H0.init(Q,Y);let X=o0(Y.includes),W=new RegExp(typeof Y.position==="number"?`^.{${Y.position}}${X}`:X);Y.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(Y.includes,Y.position))return;G.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:Y.includes,input:G.value,inst:Q,continue:!Y.abort})}}),A8=q("$ZodCheckStartsWith",(Q,Y)=>{H0.init(Q,Y);let X=new RegExp(`^${o0(Y.prefix)}.*`);Y.pattern??(Y.pattern=X),Q._zod.onattach.push((W)=>{let G=W._zod.bag;G.patterns??(G.patterns=new Set),G.patterns.add(X)}),Q._zod.check=(W)=>{if(W.value.startsWith(Y.prefix))return;W.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:Y.prefix,input:W.value,inst:Q,continue:!Y.abort})}}),B8=q("$ZodCheckEndsWith",(Q,Y)=>{H0.init(Q,Y);let X=new RegExp(`.*${o0(Y.suffix)}$`);Y.pattern??(Y.pattern=X),Q._zod.onattach.push((W)=>{let G=W._zod.bag;G.patterns??(G.patterns=new Set),G.patterns.add(X)}),Q._zod.check=(W)=>{if(W.value.endsWith(Y.suffix))return;W.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:Y.suffix,input:W.value,inst:Q,continue:!Y.abort})}});var K8=q("$ZodCheckOverwrite",(Q,Y)=>{H0.init(Q,Y),Q._zod.check=(X)=>{X.value=Y.tx(X.value)}});class lQ{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 X=Q.split(`
|
|
8
|
+
deps: ${X}}`};var cq={keyword:"dependencies",type:"object",schemaType:"object",error:B7.error,code(Q){let[Y,X]=pq(Q);U7(Q,Y),A7(Q,X)}};function pq({schema:Q}){let Y={},X={};for(let W in Q){if(W==="__proto__")continue;let G=Array.isArray(Q[W])?Y:X;G[W]=Q[W]}return[Y,X]}function U7(Q,Y=Q.schema){let{gen:X,data:W,it:G}=Q;if(Object.keys(Y).length===0)return;let $=X.let("missing");for(let z in Y){let J=Y[z];if(J.length===0)continue;let H=(0,r6.propertyInData)(X,W,z,G.opts.ownProperties);if(Q.setParams({property:z,depsCount:J.length,deps:J.join(", ")}),G.allErrors)X.if(H,()=>{for(let U of J)(0,r6.checkReportMissingProp)(Q,U)});else X.if(jY._`${H} && (${(0,r6.checkMissingProp)(Q,J,$)})`),(0,r6.reportMissingProp)(Q,$),X.else()}}B7.validatePropertyDeps=U7;function A7(Q,Y=Q.schema){let{gen:X,data:W,keyword:G,it:$}=Q,z=X.name("valid");for(let J in Y){if((0,mq.alwaysValidSchema)($,Y[J]))continue;X.if((0,r6.propertyInData)(X,W,J,$.opts.ownProperties),()=>{let H=Q.subschema({keyword:G,schemaProp:J},z);Q.mergeValidEvaluated(H,z)},()=>X.var(z,!0)),Q.ok(z)}}B7.validateSchemaDeps=A7;B7.default=cq});var O7=j((q7)=>{Object.defineProperty(q7,"__esModule",{value:!0});var F7=g(),rq=c(),dq={message:"property name must be valid",params:({params:Q})=>F7._`{propertyName: ${Q.propertyName}}`},oq={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:dq,code(Q){let{gen:Y,schema:X,data:W,it:G}=Q;if((0,rq.alwaysValidSchema)(G,X))return;let $=Y.name("valid");Y.forIn("key",W,(z)=>{Q.setParams({propertyName:z}),Q.subschema({keyword:"propertyNames",data:z,dataTypes:["string"],propertyName:z,compositeRule:!0},$),Y.if((0,F7.not)($),()=>{if(Q.error(!0),!G.allErrors)Y.break()})}),Q.ok($)}};q7.default=oq});var PY=j((M7)=>{Object.defineProperty(M7,"__esModule",{value:!0});var DQ=S0(),u0=g(),aq=e0(),LQ=c(),sq={message:"must NOT have additional properties",params:({params:Q})=>u0._`{additionalProperty: ${Q.additionalProperty}}`},eq={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:sq,code(Q){let{gen:Y,schema:X,parentSchema:W,data:G,errsCount:$,it:z}=Q;if(!$)throw Error("ajv implementation error");let{allErrors:J,opts:H}=z;if(z.props=!0,H.removeAdditional!=="all"&&(0,LQ.alwaysValidSchema)(z,X))return;let U=(0,DQ.allSchemaProperties)(W.properties),A=(0,DQ.allSchemaProperties)(W.patternProperties);B(),Q.ok(u0._`${$} === ${aq.default.errors}`);function B(){Y.forIn("key",G,(Z)=>{if(!U.length&&!A.length)O(Z);else Y.if(K(Z),()=>O(Z))})}function K(Z){let V;if(U.length>8){let R=(0,LQ.schemaRefOrVal)(z,W.properties,"properties");V=(0,DQ.isOwnProperty)(Y,R,Z)}else if(U.length)V=(0,u0.or)(...U.map((R)=>u0._`${Z} === ${R}`));else V=u0.nil;if(A.length)V=(0,u0.or)(V,...A.map((R)=>u0._`${(0,DQ.usePattern)(Q,R)}.test(${Z})`));return(0,u0.not)(V)}function D(Z){Y.code(u0._`delete ${G}[${Z}]`)}function O(Z){if(H.removeAdditional==="all"||H.removeAdditional&&X===!1){D(Z);return}if(X===!1){if(Q.setParams({additionalProperty:Z}),Q.error(),!J)Y.break();return}if(typeof X=="object"&&!(0,LQ.alwaysValidSchema)(z,X)){let V=Y.name("valid");if(H.removeAdditional==="failing")M(Z,V,!1),Y.if((0,u0.not)(V),()=>{Q.reset(),D(Z)});else if(M(Z,V),!J)Y.if((0,u0.not)(V),()=>Y.break())}}function M(Z,V,R){let T={keyword:"additionalProperties",dataProp:Z,dataPropType:LQ.Type.Str};if(R===!1)Object.assign(T,{compositeRule:!0,createErrors:!1,allErrors:!1});Q.subschema(T,V)}}};M7.default=eq});var w7=j((Z7)=>{Object.defineProperty(Z7,"__esModule",{value:!0});var YO=_6(),V7=S0(),bY=c(),N7=PY(),XO={keyword:"properties",type:"object",schemaType:"object",code(Q){let{gen:Y,schema:X,parentSchema:W,data:G,it:$}=Q;if($.opts.removeAdditional==="all"&&W.additionalProperties===void 0)N7.default.code(new YO.KeywordCxt($,N7.default,"additionalProperties"));let z=(0,V7.allSchemaProperties)(X);for(let B of z)$.definedProperties.add(B);if($.opts.unevaluated&&z.length&&$.props!==!0)$.props=bY.mergeEvaluated.props(Y,(0,bY.toHash)(z),$.props);let J=z.filter((B)=>!(0,bY.alwaysValidSchema)($,X[B]));if(J.length===0)return;let H=Y.name("valid");for(let B of J){if(U(B))A(B);else{if(Y.if((0,V7.propertyInData)(Y,G,B,$.opts.ownProperties)),A(B),!$.allErrors)Y.else().var(H,!0);Y.endIf()}Q.it.definedProperties.add(B),Q.ok(H)}function U(B){return $.opts.useDefaults&&!$.compositeRule&&X[B].default!==void 0}function A(B){Q.subschema({keyword:"properties",schemaProp:B,dataProp:B},H)}}};Z7.default=XO});var E7=j((I7)=>{Object.defineProperty(I7,"__esModule",{value:!0});var j7=S0(),FQ=g(),P7=c(),b7=c(),GO={keyword:"patternProperties",type:"object",schemaType:"object",code(Q){let{gen:Y,schema:X,data:W,parentSchema:G,it:$}=Q,{opts:z}=$,J=(0,j7.allSchemaProperties)(X),H=J.filter((M)=>(0,P7.alwaysValidSchema)($,X[M]));if(J.length===0||H.length===J.length&&(!$.opts.unevaluated||$.props===!0))return;let U=z.strictSchema&&!z.allowMatchingProperties&&G.properties,A=Y.name("valid");if($.props!==!0&&!($.props instanceof FQ.Name))$.props=(0,b7.evaluatedPropsToName)(Y,$.props);let{props:B}=$;K();function K(){for(let M of J){if(U)D(M);if($.allErrors)O(M);else Y.var(A,!0),O(M),Y.if(A)}}function D(M){for(let Z in U)if(new RegExp(M).test(Z))(0,P7.checkStrictMode)($,`property ${Z} matches pattern ${M} (use allowMatchingProperties)`)}function O(M){Y.forIn("key",W,(Z)=>{Y.if(FQ._`${(0,j7.usePattern)(Q,M)}.test(${Z})`,()=>{let V=H.includes(M);if(!V)Q.subschema({keyword:"patternProperties",schemaProp:M,dataProp:Z,dataPropType:b7.Type.Str},A);if($.opts.unevaluated&&B!==!0)Y.assign(FQ._`${B}[${Z}]`,!0);else if(!V&&!$.allErrors)Y.if((0,FQ.not)(A),()=>Y.break())})})}}};I7.default=GO});var S7=j((T7)=>{Object.defineProperty(T7,"__esModule",{value:!0});var zO=c(),JO={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(Q){let{gen:Y,schema:X,it:W}=Q;if((0,zO.alwaysValidSchema)(W,X)){Q.fail();return}let G=Y.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"}};T7.default=JO});var C7=j((R7)=>{Object.defineProperty(R7,"__esModule",{value:!0});var UO=S0(),AO={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:UO.validateUnion,error:{message:"must match a schema in anyOf"}};R7.default=AO});var v7=j((k7)=>{Object.defineProperty(k7,"__esModule",{value:!0});var qQ=g(),KO=c(),DO={message:"must match exactly one schema in oneOf",params:({params:Q})=>qQ._`{passingSchemas: ${Q.passing}}`},LO={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:DO,code(Q){let{gen:Y,schema:X,parentSchema:W,it:G}=Q;if(!Array.isArray(X))throw Error("ajv implementation error");if(G.opts.discriminator&&W.discriminator)return;let $=X,z=Y.let("valid",!1),J=Y.let("passing",null),H=Y.name("_valid");Q.setParams({passing:J}),Y.block(U),Q.result(z,()=>Q.reset(),()=>Q.error(!0));function U(){$.forEach((A,B)=>{let K;if((0,KO.alwaysValidSchema)(G,A))Y.var(H,!0);else K=Q.subschema({keyword:"oneOf",schemaProp:B,compositeRule:!0},H);if(B>0)Y.if(qQ._`${H} && ${z}`).assign(z,!1).assign(J,qQ._`[${J}, ${B}]`).else();Y.if(H,()=>{if(Y.assign(z,!0),Y.assign(J,B),K)Q.mergeEvaluated(K,qQ.Name)})})}}};k7.default=LO});var _7=j((x7)=>{Object.defineProperty(x7,"__esModule",{value:!0});var qO=c(),OO={keyword:"allOf",schemaType:"array",code(Q){let{gen:Y,schema:X,it:W}=Q;if(!Array.isArray(X))throw Error("ajv implementation error");let G=Y.name("valid");X.forEach(($,z)=>{if((0,qO.alwaysValidSchema)(W,$))return;let J=Q.subschema({keyword:"allOf",schemaProp:z},G);Q.ok(G),Q.mergeEvaluated(J)})}};x7.default=OO});var h7=j((u7)=>{Object.defineProperty(u7,"__esModule",{value:!0});var OQ=g(),y7=c(),VO={message:({params:Q})=>OQ.str`must match "${Q.ifClause}" schema`,params:({params:Q})=>OQ._`{failingKeyword: ${Q.ifClause}}`},NO={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:VO,code(Q){let{gen:Y,parentSchema:X,it:W}=Q;if(X.then===void 0&&X.else===void 0)(0,y7.checkStrictMode)(W,'"if" without "then" and "else" is ignored');let G=g7(W,"then"),$=g7(W,"else");if(!G&&!$)return;let z=Y.let("valid",!0),J=Y.name("_valid");if(H(),Q.reset(),G&&$){let A=Y.let("ifClause");Q.setParams({ifClause:A}),Y.if(J,U("then",A),U("else",A))}else if(G)Y.if(J,U("then"));else Y.if((0,OQ.not)(J),U("else"));Q.pass(z,()=>Q.error(!0));function H(){let A=Q.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},J);Q.mergeEvaluated(A)}function U(A,B){return()=>{let K=Q.subschema({keyword:A},J);if(Y.assign(z,J),Q.mergeValidEvaluated(K,z),B)Y.assign(B,OQ._`${A}`);else Q.setParams({ifClause:A})}}}};function g7(Q,Y){let X=Q.schema[Y];return X!==void 0&&!(0,y7.alwaysValidSchema)(Q,X)}u7.default=NO});var l7=j((f7)=>{Object.defineProperty(f7,"__esModule",{value:!0});var wO=c(),jO={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:Q,parentSchema:Y,it:X}){if(Y.if===void 0)(0,wO.checkStrictMode)(X,`"${Q}" without "if" is ignored`)}};f7.default=jO});var c7=j((m7)=>{Object.defineProperty(m7,"__esModule",{value:!0});var bO=ZY(),IO=W7(),EO=wY(),TO=z7(),SO=H7(),RO=L7(),CO=O7(),kO=PY(),vO=w7(),xO=E7(),_O=S7(),gO=C7(),yO=v7(),uO=_7(),hO=h7(),fO=l7();function lO(Q=!1){let Y=[_O.default,gO.default,yO.default,uO.default,hO.default,fO.default,CO.default,kO.default,RO.default,vO.default,xO.default];if(Q)Y.push(IO.default,TO.default);else Y.push(bO.default,EO.default);return Y.push(SO.default),Y}m7.default=lO});var i7=j((p7)=>{Object.defineProperty(p7,"__esModule",{value:!0});var W0=g(),cO={message:({schemaCode:Q})=>W0.str`must match format "${Q}"`,params:({schemaCode:Q})=>W0._`{format: ${Q}}`},pO={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:cO,code(Q,Y){let{gen:X,data:W,$data:G,schema:$,schemaCode:z,it:J}=Q,{opts:H,errSchemaPath:U,schemaEnv:A,self:B}=J;if(!H.validateFormats)return;if(G)K();else D();function K(){let O=X.scopeValue("formats",{ref:B.formats,code:H.code.formats}),M=X.const("fDef",W0._`${O}[${z}]`),Z=X.let("fType"),V=X.let("format");X.if(W0._`typeof ${M} == "object" && !(${M} instanceof RegExp)`,()=>X.assign(Z,W0._`${M}.type || "string"`).assign(V,W0._`${M}.validate`),()=>X.assign(Z,W0._`"string"`).assign(V,M)),Q.fail$data((0,W0.or)(R(),T()));function R(){if(H.strictSchema===!1)return W0.nil;return W0._`${z} && !${V}`}function T(){let y=A.$async?W0._`(${M}.async ? await ${V}(${W}) : ${V}(${W}))`:W0._`${V}(${W})`,S=W0._`(typeof ${V} == "function" ? ${y} : ${V}.test(${W}))`;return W0._`${V} && ${V} !== true && ${Z} === ${Y} && !${S}`}}function D(){let O=B.formats[$];if(!O){R();return}if(O===!0)return;let[M,Z,V]=T(O);if(M===Y)Q.pass(y());function R(){if(H.strictSchema===!1){B.logger.warn(S());return}throw Error(S());function S(){return`unknown format "${$}" ignored in schema at path "${U}"`}}function T(S){let m0=S instanceof RegExp?(0,W0.regexpCode)(S):H.code.formats?W0._`${H.code.formats}${(0,W0.getProperty)($)}`:void 0,r0=X.scopeValue("formats",{key:$,ref:S,code:m0});if(typeof S=="object"&&!(S instanceof RegExp))return[S.type||"string",S.validate,W0._`${r0}.validate`];return["string",S,r0]}function y(){if(typeof O=="object"&&!(O instanceof RegExp)&&O.async){if(!A.$async)throw Error("async format in sync schema");return W0._`await ${V}(${W})`}return typeof Z=="function"?W0._`${V}(${W})`:W0._`${V}.test(${W})`}}}};p7.default=pO});var r7=j((n7)=>{Object.defineProperty(n7,"__esModule",{value:!0});var nO=i7(),rO=[nO.default];n7.default=rO});var t7=j((d7)=>{Object.defineProperty(d7,"__esModule",{value:!0});d7.contentVocabulary=d7.metadataVocabulary=void 0;d7.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];d7.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var e7=j((s7)=>{Object.defineProperty(s7,"__esModule",{value:!0});var tO=ZJ(),aO=dJ(),sO=c7(),eO=r7(),a7=t7(),QM=[tO.default,aO.default,(0,sO.default)(),eO.default,a7.metadataVocabulary,a7.contentVocabulary];s7.default=QM});var W5=j((Y5)=>{Object.defineProperty(Y5,"__esModule",{value:!0});Y5.DiscrError=void 0;var Q5;(function(Q){Q.Tag="tag",Q.Mapping="mapping"})(Q5||(Y5.DiscrError=Q5={}))});var z5=j(($5)=>{Object.defineProperty($5,"__esModule",{value:!0});var r1=g(),IY=W5(),G5=s4(),XM=g6(),WM=c(),GM={message:({params:{discrError:Q,tagName:Y}})=>Q===IY.DiscrError.Tag?`tag "${Y}" must be string`:`value of tag "${Y}" must be in oneOf`,params:({params:{discrError:Q,tag:Y,tagName:X}})=>r1._`{error: ${Q}, tag: ${X}, tagValue: ${Y}}`},$M={keyword:"discriminator",type:"object",schemaType:"object",error:GM,code(Q){let{gen:Y,data:X,schema:W,parentSchema:G,it:$}=Q,{oneOf:z}=G;if(!$.opts.discriminator)throw Error("discriminator: requires discriminator option");let J=W.propertyName;if(typeof J!="string")throw Error("discriminator: requires propertyName");if(W.mapping)throw Error("discriminator: mapping is not supported");if(!z)throw Error("discriminator: requires oneOf keyword");let H=Y.let("valid",!1),U=Y.const("tag",r1._`${X}${(0,r1.getProperty)(J)}`);Y.if(r1._`typeof ${U} == "string"`,()=>A(),()=>Q.error(!1,{discrError:IY.DiscrError.Tag,tag:U,tagName:J})),Q.ok(H);function A(){let D=K();Y.if(!1);for(let O in D)Y.elseIf(r1._`${U} === ${O}`),Y.assign(H,B(D[O]));Y.else(),Q.error(!1,{discrError:IY.DiscrError.Mapping,tag:U,tagName:J}),Y.endIf()}function B(D){let O=Y.name("valid"),M=Q.subschema({keyword:"oneOf",schemaProp:D},O);return Q.mergeEvaluated(M,r1.Name),O}function K(){var D;let O={},M=V(G),Z=!0;for(let y=0;y<z.length;y++){let S=z[y];if((S===null||S===void 0?void 0:S.$ref)&&!(0,WM.schemaHasRulesButRef)(S,$.self.RULES)){let r0=S.$ref;if(S=G5.resolveRef.call($.self,$.schemaEnv.root,$.baseId,r0),S instanceof G5.SchemaEnv)S=S.schema;if(S===void 0)throw new XM.default($.opts.uriResolver,$.baseId,r0)}let m0=(D=S===null||S===void 0?void 0:S.properties)===null||D===void 0?void 0:D[J];if(typeof m0!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${J}"`);Z=Z&&(M||V(S)),R(m0,y)}if(!Z)throw Error(`discriminator: "${J}" must be required`);return O;function V({required:y}){return Array.isArray(y)&&y.includes(J)}function R(y,S){if(y.const)T(y.const,S);else if(y.enum)for(let m0 of y.enum)T(m0,S);else throw Error(`discriminator: "properties/${J}" must have "const" or "enum"`)}function T(y,S){if(typeof y!="string"||y in O)throw Error(`discriminator: "${J}" values must be unique strings`);O[y]=S}}}};$5.default=$M});var J5=j((zE,JM)=>{JM.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 TY=j((w0,EY)=>{Object.defineProperty(w0,"__esModule",{value:!0});w0.MissingRefError=w0.ValidationError=w0.CodeGen=w0.Name=w0.nil=w0.stringify=w0.str=w0._=w0.KeywordCxt=w0.Ajv=void 0;var HM=BJ(),UM=e7(),AM=z5(),H5=J5(),BM=["/properties"],MQ="http://json-schema.org/draft-07/schema";class d6 extends HM.default{_addVocabularies(){if(super._addVocabularies(),UM.default.forEach((Q)=>this.addVocabulary(Q)),this.opts.discriminator)this.addKeyword(AM.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let Q=this.opts.$data?this.$dataMetaSchema(H5,BM):H5;this.addMetaSchema(Q,MQ,!1),this.refs["http://json-schema.org/schema"]=MQ}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(MQ)?MQ:void 0)}}w0.Ajv=d6;EY.exports=w0=d6;EY.exports.Ajv=d6;Object.defineProperty(w0,"__esModule",{value:!0});w0.default=d6;var KM=_6();Object.defineProperty(w0,"KeywordCxt",{enumerable:!0,get:function(){return KM.KeywordCxt}});var d1=g();Object.defineProperty(w0,"_",{enumerable:!0,get:function(){return d1._}});Object.defineProperty(w0,"str",{enumerable:!0,get:function(){return d1.str}});Object.defineProperty(w0,"stringify",{enumerable:!0,get:function(){return d1.stringify}});Object.defineProperty(w0,"nil",{enumerable:!0,get:function(){return d1.nil}});Object.defineProperty(w0,"Name",{enumerable:!0,get:function(){return d1.Name}});Object.defineProperty(w0,"CodeGen",{enumerable:!0,get:function(){return d1.CodeGen}});var DM=t4();Object.defineProperty(w0,"ValidationError",{enumerable:!0,get:function(){return DM.default}});var LM=g6();Object.defineProperty(w0,"MissingRefError",{enumerable:!0,get:function(){return LM.default}})});var M5=j((q5)=>{Object.defineProperty(q5,"__esModule",{value:!0});q5.formatNames=q5.fastFormats=q5.fullFormats=void 0;function i0(Q,Y){return{validate:Q,compare:Y}}q5.fullFormats={date:i0(K5,kY),time:i0(RY(!0),vY),"date-time":i0(U5(!0),L5),"iso-time":i0(RY(),D5),"iso-date-time":i0(U5(),F5),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:wM,"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:SM,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:jM,int32:{type:"number",validate:IM},int64:{type:"number",validate:EM},float:{type:"number",validate:B5},double:{type:"number",validate:B5},password:!0,binary:!0};q5.fastFormats={...q5.fullFormats,date:i0(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,kY),time:i0(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,vY),"date-time":i0(/^\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,L5),"iso-time":i0(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,D5),"iso-date-time":i0(/^\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,F5),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};q5.formatNames=Object.keys(q5.fullFormats);function OM(Q){return Q%4===0&&(Q%100!==0||Q%400===0)}var MM=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,VM=[0,31,28,31,30,31,30,31,31,30,31,30,31];function K5(Q){let Y=MM.exec(Q);if(!Y)return!1;let X=+Y[1],W=+Y[2],G=+Y[3];return W>=1&&W<=12&&G>=1&&G<=(W===2&&OM(X)?29:VM[W])}function kY(Q,Y){if(!(Q&&Y))return;if(Q>Y)return 1;if(Q<Y)return-1;return 0}var SY=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function RY(Q){return function(X){let W=SY.exec(X);if(!W)return!1;let G=+W[1],$=+W[2],z=+W[3],J=W[4],H=W[5]==="-"?-1:1,U=+(W[6]||0),A=+(W[7]||0);if(U>23||A>59||Q&&!J)return!1;if(G<=23&&$<=59&&z<60)return!0;let B=$-A*H,K=G-U*H-(B<0?1:0);return(K===23||K===-1)&&(B===59||B===-1)&&z<61}}function vY(Q,Y){if(!(Q&&Y))return;let X=new Date("2020-01-01T"+Q).valueOf(),W=new Date("2020-01-01T"+Y).valueOf();if(!(X&&W))return;return X-W}function D5(Q,Y){if(!(Q&&Y))return;let X=SY.exec(Q),W=SY.exec(Y);if(!(X&&W))return;if(Q=X[1]+X[2]+X[3],Y=W[1]+W[2]+W[3],Q>Y)return 1;if(Q<Y)return-1;return 0}var CY=/t|\s/i;function U5(Q){let Y=RY(Q);return function(W){let G=W.split(CY);return G.length===2&&K5(G[0])&&Y(G[1])}}function L5(Q,Y){if(!(Q&&Y))return;let X=new Date(Q).valueOf(),W=new Date(Y).valueOf();if(!(X&&W))return;return X-W}function F5(Q,Y){if(!(Q&&Y))return;let[X,W]=Q.split(CY),[G,$]=Y.split(CY),z=kY(X,G);if(z===void 0)return;return z||vY(W,$)}var NM=/\/|:/,ZM=/^(?:[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 wM(Q){return NM.test(Q)&&ZM.test(Q)}var A5=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function jM(Q){return A5.lastIndex=0,A5.test(Q)}var PM=-2147483648,bM=2147483647;function IM(Q){return Number.isInteger(Q)&&Q<=bM&&Q>=PM}function EM(Q){return Number.isInteger(Q)}function B5(){return!0}var TM=/[^\\]\\Z/;function SM(Q){if(TM.test(Q))return!1;try{return new RegExp(Q),!0}catch(Y){return!1}}});var N5=j((V5)=>{Object.defineProperty(V5,"__esModule",{value:!0});V5.formatLimitDefinition=void 0;var CM=TY(),h0=g(),O1=h0.operators,VQ={formatMaximum:{okStr:"<=",ok:O1.LTE,fail:O1.GT},formatMinimum:{okStr:">=",ok:O1.GTE,fail:O1.LT},formatExclusiveMaximum:{okStr:"<",ok:O1.LT,fail:O1.GTE},formatExclusiveMinimum:{okStr:">",ok:O1.GT,fail:O1.LTE}},kM={message:({keyword:Q,schemaCode:Y})=>h0.str`should be ${VQ[Q].okStr} ${Y}`,params:({keyword:Q,schemaCode:Y})=>h0._`{comparison: ${VQ[Q].okStr}, limit: ${Y}}`};V5.formatLimitDefinition={keyword:Object.keys(VQ),type:"string",schemaType:"string",$data:!0,error:kM,code(Q){let{gen:Y,data:X,schemaCode:W,keyword:G,it:$}=Q,{opts:z,self:J}=$;if(!z.validateFormats)return;let H=new CM.KeywordCxt($,J.RULES.all.format.definition,"format");if(H.$data)U();else A();function U(){let K=Y.scopeValue("formats",{ref:J.formats,code:z.code.formats}),D=Y.const("fmt",h0._`${K}[${H.schemaCode}]`);Q.fail$data((0,h0.or)(h0._`typeof ${D} != "object"`,h0._`${D} instanceof RegExp`,h0._`typeof ${D}.compare != "function"`,B(D)))}function A(){let K=H.schema,D=J.formats[K];if(!D||D===!0)return;if(typeof D!="object"||D instanceof RegExp||typeof D.compare!="function")throw Error(`"${G}": format "${K}" does not define "compare" function`);let O=Y.scopeValue("formats",{key:K,ref:D,code:z.code.formats?h0._`${z.code.formats}${(0,h0.getProperty)(K)}`:void 0});Q.fail$data(B(O))}function B(K){return h0._`${K}.compare(${X}, ${W}) ${VQ[G].fail} 0`}},dependencies:["format"]};var vM=(Q)=>{return Q.addKeyword(V5.formatLimitDefinition),Q};V5.default=vM});var P5=j((o6,j5)=>{Object.defineProperty(o6,"__esModule",{value:!0});var o1=M5(),_M=N5(),gY=g(),Z5=new gY.Name("fullFormats"),gM=new gY.Name("fastFormats"),yY=(Q,Y={keywords:!0})=>{if(Array.isArray(Y))return w5(Q,Y,o1.fullFormats,Z5),Q;let[X,W]=Y.mode==="fast"?[o1.fastFormats,gM]:[o1.fullFormats,Z5],G=Y.formats||o1.formatNames;if(w5(Q,G,X,W),Y.keywords)(0,_M.default)(Q);return Q};yY.get=(Q,Y="full")=>{let W=(Y==="fast"?o1.fastFormats:o1.fullFormats)[Q];if(!W)throw Error(`Unknown format "${Q}"`);return W};function w5(Q,Y,X,W){var G,$;(G=($=Q.opts.code).formats)!==null&&G!==void 0||($.formats=gY._`require("ajv-formats/dist/formats").${W}`);for(let z of Y)Q.addFormat(z,X[z])}j5.exports=o6=yY;Object.defineProperty(o6,"__esModule",{value:!0});o6.default=yY});import{AsyncLocalStorage as UH}from"node:async_hooks";class V1 extends Error{statusCode;rawDetails;code;context;constructor(Q,Y,X,W,G){super(Q);this.statusCode=Y;this.rawDetails=X;this.code=W;this.context=G;this.name="McpApiError"}}function JH(Q){if(Q instanceof V1)return{message:Q.message,statusCode:Q.statusCode,code:Q.code,rawDetails:Q.rawDetails,context:Q.context};if(Q instanceof Error)return{message:Q.message};return{message:String(Q)}}function HH(Q){let Y=JH(Q),X=Y.message.trim()||"Unknown error",W=X.toLowerCase(),G=Y.rawDetails?.trim()||X;if(Y.context?.title||Y.context?.description||Y.context?.howToFix||Y.context?.docsUrl)return{title:Y.context.title??(Y.statusCode===409?"Request conflict":"API request failed"),description:Y.context.description??X,howToFix:Y.context.howToFix??"Review the details below, adjust the tool input, and retry.",docsUrl:Y.context.docsUrl??"https://docs.sequenzy.com/concepts/mcp",details:G};if(Y.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(Y.statusCode===401||Y.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(Y.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(Y.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(Y.statusCode===409||W.includes("already exists"))return{title:"Resource already exists",description:"Sequenzy rejected this MCP request because it would create a duplicate resource.",howToFix:"List the existing resources first, reuse the matching resource when appropriate, or retry with a unique name or domain.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G};if(Y.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(Y.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(Y.statusCode&&Y.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 R1(Q){let Y=HH(Q);return[`Sequenzy MCP error: ${Y.title}`,`Description: ${Y.description}`,`How to fix: ${Y.howToFix}`,`Docs: ${Y.docsUrl}`,`Details: ${Y.details}`].join(`
|
|
9
|
+
`)}var AH="https://api.sequenzy.com",Y6=new UH,XX=!1;function cV(){XX=!0}function WX(){return XX}var GX=null;function N1(){let Q=Y6.getStore();if(Q)return Q.selectedCompanyId??null;return GX}function TQ(Q){let Y=Y6.getStore();if(Y){Y.selectedCompanyId=Q;return}GX=Q}function $X(Q,Y){return Y6.run(Q,Y)}function BH(){return Y6.getStore()?.apiUrl??process.env.SEQUENZY_API_URL??AH}function zX(){return Y6.getStore()?.apiKey??process.env.SEQUENZY_API_KEY}function pV(){if(zX())return;console.error(R1(new V1("SEQUENZY_API_KEY environment variable is required",401,void 0,"MCP_AUTH_REQUIRED"))),process.exit(1)}function j0(Q,Y){let X=Q[Y];return typeof X==="string"&&X.trim()!==""?X.trim():void 0}function KH(Q){if(Q===void 0)return;if(typeof Q==="string")return Q.trim()||void 0;return JSON.stringify(Q)}function DH(Q){if(!Q.trim())return{message:"Request failed"};try{let Y=JSON.parse(Q);if(typeof Y==="string")return{message:Y};let X=typeof Y.error==="object"&&Y.error!==null?Y.error:void 0,W=j0(Y,"code")??(X?j0(X,"code"):void 0),G=(typeof Y.error==="string"?Y.error:void 0)??(X?j0(X,"message"):void 0)??j0(Y,"message")??j0(Y,"error")??Q,$=j0(Y,"howToFix")??j0(Y,"resolution"),z={...j0(Y,"title")?{title:j0(Y,"title")}:{},...j0(Y,"description")?{description:j0(Y,"description")}:{},...$?{howToFix:$}:{},...j0(Y,"docsUrl")?{docsUrl:j0(Y,"docsUrl")}:{}},J=KH(Y.details);if(Object.keys(z).length>0||J)return{message:G,...W?{code:W}:{},...J?{details:J}:{},...Object.keys(z).length>0?{context:z}:{}};if(typeof Y.error==="string")return{message:Y.error,...W?{code:W}:{}};if(X)return{message:G,...W?{code:W}:{}};return{message:G,...W?{code:W}:{}}}catch{return{message:Q}}}async function L(Q,Y,X,W){let G=zX();if(!G)throw new V1("SEQUENZY_API_KEY environment variable is required",401,void 0,"MCP_AUTH_REQUIRED");let $={"Content-Type":"application/json",Authorization:`Bearer ${G}`},z=W??N1();if(z)$["x-company-id"]=z;let J;try{J=await fetch(`${BH()}${Y}`,{method:Q,headers:$,body:X?JSON.stringify(X):void 0})}catch(H){throw new V1(H instanceof Error?H.message:"Failed to reach Sequenzy API",0,void 0,"NETWORK_ERROR")}if(!J.ok){let H=await J.text(),U=DH(H);throw new V1(U.message,J.status,U.details??H,U.code,U.context)}return J.json()}var nV=Object.freeze({status:"aborted"});function q(Q,Y,X){function W(J,H){var U;Object.defineProperty(J,"_zod",{value:J._zod??{},enumerable:!1}),(U=J._zod).traits??(U.traits=new Set),J._zod.traits.add(Q),Y(J,H);for(let A in z.prototype)if(!(A in J))Object.defineProperty(J,A,{value:z.prototype[A].bind(J)});J._zod.constr=z,J._zod.def=H}let G=X?.Parent??Object;class $ extends G{}Object.defineProperty($,"name",{value:Q});function z(J){var H;let U=X?.Parent?new $:this;W(U,J),(H=U._zod).deferred??(H.deferred=[]);for(let A of U._zod.deferred)A();return U}return Object.defineProperty(z,"init",{value:W}),Object.defineProperty(z,Symbol.hasInstance,{value:(J)=>{if(X?.Parent&&J instanceof X.Parent)return!0;return J?._zod?.traits?.has(Q)}}),Object.defineProperty(z,"name",{value:Q}),z}var rV=Symbol("zod_brand");class d0 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class X6 extends Error{constructor(Q){super(`Encountered unidirectional transform during encode: ${Q}`);this.name="ZodEncodeError"}}var Q4={};function I0(Q){if(Q)Object.assign(Q4,Q);return Q4}var m={};YX(m,{unwrapMessage:()=>W6,uint8ArrayToHex:()=>uH,uint8ArrayToBase64url:()=>gH,uint8ArrayToBase64:()=>DX,stringifyPrimitive:()=>G4,shallowClone:()=>HX,safeExtend:()=>RH,required:()=>vH,randomString:()=>jH,propertyKeyTypes:()=>vQ,promiseAllObject:()=>wH,primitiveTypes:()=>UX,prefixIssues:()=>t0,pick:()=>EH,partial:()=>kH,optionalKeys:()=>xQ,omit:()=>TH,objectClone:()=>VH,numKeys:()=>PH,nullish:()=>G6,normalizeParams:()=>E,mergeDefs:()=>$1,merge:()=>CH,jsonStringifyReplacer:()=>C1,joinValues:()=>Y4,issue:()=>v1,isPlainObject:()=>z1,isObject:()=>Z1,hexToUint8Array:()=>yH,getSizableOrigin:()=>BX,getParsedType:()=>bH,getLengthableOrigin:()=>z6,getEnumValues:()=>RQ,getElementAtPath:()=>ZH,floatSafeRemainder:()=>CQ,finalizeIssue:()=>v0,extend:()=>SH,escapeRegex:()=>o0,esc:()=>X4,defineLazy:()=>i,createTransparentProxy:()=>IH,cloneDef:()=>NH,clone:()=>k0,cleanRegex:()=>$6,cleanEnum:()=>xH,captureStackTrace:()=>W4,cached:()=>k1,base64urlToUint8Array:()=>_H,base64ToUint8Array:()=>KX,assignProp:()=>G1,assertNotEqual:()=>FH,assertNever:()=>OH,assertIs:()=>qH,assertEqual:()=>LH,assert:()=>MH,allowsEval:()=>kQ,aborted:()=>J1,NUMBER_FORMAT_RANGES:()=>_Q,Class:()=>LX,BIGINT_FORMAT_RANGES:()=>AX});function LH(Q){return Q}function FH(Q){return Q}function qH(Q){}function OH(Q){throw Error()}function MH(Q){}function RQ(Q){let Y=Object.values(Q).filter((W)=>typeof W==="number");return Object.entries(Q).filter(([W,G])=>Y.indexOf(+W)===-1).map(([W,G])=>G)}function Y4(Q,Y="|"){return Q.map((X)=>G4(X)).join(Y)}function C1(Q,Y){if(typeof Y==="bigint")return Y.toString();return Y}function k1(Q){return{get value(){{let X=Q();return Object.defineProperty(this,"value",{value:X}),X}throw Error("cached value already set")}}}function G6(Q){return Q===null||Q===void 0}function $6(Q){let Y=Q.startsWith("^")?1:0,X=Q.endsWith("$")?Q.length-1:Q.length;return Q.slice(Y,X)}function CQ(Q,Y){let X=(Q.toString().split(".")[1]||"").length,W=Y.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 $=X>G?X:G,z=Number.parseInt(Q.toFixed($).replace(".","")),J=Number.parseInt(Y.toFixed($).replace(".",""));return z%J/10**$}var JX=Symbol("evaluating");function i(Q,Y,X){let W=void 0;Object.defineProperty(Q,Y,{get(){if(W===JX)return;if(W===void 0)W=JX,W=X();return W},set(G){Object.defineProperty(Q,Y,{value:G})},configurable:!0})}function VH(Q){return Object.create(Object.getPrototypeOf(Q),Object.getOwnPropertyDescriptors(Q))}function G1(Q,Y,X){Object.defineProperty(Q,Y,{value:X,writable:!0,enumerable:!0,configurable:!0})}function $1(...Q){let Y={};for(let X of Q){let W=Object.getOwnPropertyDescriptors(X);Object.assign(Y,W)}return Object.defineProperties({},Y)}function NH(Q){return $1(Q._zod.def)}function ZH(Q,Y){if(!Y)return Q;return Y.reduce((X,W)=>X?.[W],Q)}function wH(Q){let Y=Object.keys(Q),X=Y.map((W)=>Q[W]);return Promise.all(X).then((W)=>{let G={};for(let $=0;$<Y.length;$++)G[Y[$]]=W[$];return G})}function jH(Q=10){let X="";for(let W=0;W<Q;W++)X+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return X}function X4(Q){return JSON.stringify(Q)}var W4="captureStackTrace"in Error?Error.captureStackTrace:(...Q)=>{};function Z1(Q){return typeof Q==="object"&&Q!==null&&!Array.isArray(Q)}var kQ=k1(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(Q){return!1}});function z1(Q){if(Z1(Q)===!1)return!1;let Y=Q.constructor;if(Y===void 0)return!0;let X=Y.prototype;if(Z1(X)===!1)return!1;if(Object.prototype.hasOwnProperty.call(X,"isPrototypeOf")===!1)return!1;return!0}function HX(Q){if(z1(Q))return{...Q};if(Array.isArray(Q))return[...Q];return Q}function PH(Q){let Y=0;for(let X in Q)if(Object.prototype.hasOwnProperty.call(Q,X))Y++;return Y}var bH=(Q)=>{let Y=typeof Q;switch(Y){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: ${Y}`)}},vQ=new Set(["string","number","symbol"]),UX=new Set(["string","number","bigint","boolean","symbol","undefined"]);function o0(Q){return Q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function k0(Q,Y,X){let W=new Q._zod.constr(Y??Q._zod.def);if(!Y||X?.parent)W._zod.parent=Q;return W}function E(Q){let Y=Q;if(!Y)return{};if(typeof Y==="string")return{error:()=>Y};if(Y?.message!==void 0){if(Y?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");Y.error=Y.message}if(delete Y.message,typeof Y.error==="string")return{...Y,error:()=>Y.error};return Y}function IH(Q){let Y;return new Proxy({},{get(X,W,G){return Y??(Y=Q()),Reflect.get(Y,W,G)},set(X,W,G,$){return Y??(Y=Q()),Reflect.set(Y,W,G,$)},has(X,W){return Y??(Y=Q()),Reflect.has(Y,W)},deleteProperty(X,W){return Y??(Y=Q()),Reflect.deleteProperty(Y,W)},ownKeys(X){return Y??(Y=Q()),Reflect.ownKeys(Y)},getOwnPropertyDescriptor(X,W){return Y??(Y=Q()),Reflect.getOwnPropertyDescriptor(Y,W)},defineProperty(X,W,G){return Y??(Y=Q()),Reflect.defineProperty(Y,W,G)}})}function G4(Q){if(typeof Q==="bigint")return Q.toString()+"n";if(typeof Q==="string")return`"${Q}"`;return`${Q}`}function xQ(Q){return Object.keys(Q).filter((Y)=>{return Q[Y]._zod.optin==="optional"&&Q[Y]._zod.optout==="optional"})}var _Q={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]},AX={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function EH(Q,Y){let X=Q._zod.def,W=$1(Q._zod.def,{get shape(){let G={};for(let $ in Y){if(!($ in X.shape))throw Error(`Unrecognized key: "${$}"`);if(!Y[$])continue;G[$]=X.shape[$]}return G1(this,"shape",G),G},checks:[]});return k0(Q,W)}function TH(Q,Y){let X=Q._zod.def,W=$1(Q._zod.def,{get shape(){let G={...Q._zod.def.shape};for(let $ in Y){if(!($ in X.shape))throw Error(`Unrecognized key: "${$}"`);if(!Y[$])continue;delete G[$]}return G1(this,"shape",G),G},checks:[]});return k0(Q,W)}function SH(Q,Y){if(!z1(Y))throw Error("Invalid input to extend: expected a plain object");let X=Q._zod.def.checks;if(X&&X.length>0)throw Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");let G=$1(Q._zod.def,{get shape(){let $={...Q._zod.def.shape,...Y};return G1(this,"shape",$),$},checks:[]});return k0(Q,G)}function RH(Q,Y){if(!z1(Y))throw Error("Invalid input to safeExtend: expected a plain object");let X={...Q._zod.def,get shape(){let W={...Q._zod.def.shape,...Y};return G1(this,"shape",W),W},checks:Q._zod.def.checks};return k0(Q,X)}function CH(Q,Y){let X=$1(Q._zod.def,{get shape(){let W={...Q._zod.def.shape,...Y._zod.def.shape};return G1(this,"shape",W),W},get catchall(){return Y._zod.def.catchall},checks:[]});return k0(Q,X)}function kH(Q,Y,X){let W=$1(Y._zod.def,{get shape(){let G=Y._zod.def.shape,$={...G};if(X)for(let z in X){if(!(z in G))throw Error(`Unrecognized key: "${z}"`);if(!X[z])continue;$[z]=Q?new Q({type:"optional",innerType:G[z]}):G[z]}else for(let z in G)$[z]=Q?new Q({type:"optional",innerType:G[z]}):G[z];return G1(this,"shape",$),$},checks:[]});return k0(Y,W)}function vH(Q,Y,X){let W=$1(Y._zod.def,{get shape(){let G=Y._zod.def.shape,$={...G};if(X)for(let z in X){if(!(z in $))throw Error(`Unrecognized key: "${z}"`);if(!X[z])continue;$[z]=new Q({type:"nonoptional",innerType:G[z]})}else for(let z in G)$[z]=new Q({type:"nonoptional",innerType:G[z]});return G1(this,"shape",$),$},checks:[]});return k0(Y,W)}function J1(Q,Y=0){if(Q.aborted===!0)return!0;for(let X=Y;X<Q.issues.length;X++)if(Q.issues[X]?.continue!==!0)return!0;return!1}function t0(Q,Y){return Y.map((X)=>{var W;return(W=X).path??(W.path=[]),X.path.unshift(Q),X})}function W6(Q){return typeof Q==="string"?Q:Q?.message}function v0(Q,Y,X){let W={...Q,path:Q.path??[]};if(!Q.message){let G=W6(Q.inst?._zod.def?.error?.(Q))??W6(Y?.error?.(Q))??W6(X.customError?.(Q))??W6(X.localeError?.(Q))??"Invalid input";W.message=G}if(delete W.inst,delete W.continue,!Y?.reportInput)delete W.input;return W}function BX(Q){if(Q instanceof Set)return"set";if(Q instanceof Map)return"map";if(Q instanceof File)return"file";return"unknown"}function z6(Q){if(Array.isArray(Q))return"array";if(typeof Q==="string")return"string";return"unknown"}function v1(...Q){let[Y,X,W]=Q;if(typeof Y==="string")return{message:Y,code:"custom",input:X,inst:W};return{...Y}}function xH(Q){return Object.entries(Q).filter(([Y,X])=>{return Number.isNaN(Number.parseInt(Y,10))}).map((Y)=>Y[1])}function KX(Q){let Y=atob(Q),X=new Uint8Array(Y.length);for(let W=0;W<Y.length;W++)X[W]=Y.charCodeAt(W);return X}function DX(Q){let Y="";for(let X=0;X<Q.length;X++)Y+=String.fromCharCode(Q[X]);return btoa(Y)}function _H(Q){let Y=Q.replace(/-/g,"+").replace(/_/g,"/"),X="=".repeat((4-Y.length%4)%4);return KX(Y+X)}function gH(Q){return DX(Q).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function yH(Q){let Y=Q.replace(/^0x/,"");if(Y.length%2!==0)throw Error("Invalid hex string length");let X=new Uint8Array(Y.length/2);for(let W=0;W<Y.length;W+=2)X[W/2]=Number.parseInt(Y.slice(W,W+2),16);return X}function uH(Q){return Array.from(Q).map((Y)=>Y.toString(16).padStart(2,"0")).join("")}class LX{constructor(...Q){}}var FX=(Q,Y)=>{Q.name="$ZodError",Object.defineProperty(Q,"_zod",{value:Q._zod,enumerable:!1}),Object.defineProperty(Q,"issues",{value:Y,enumerable:!1}),Q.message=JSON.stringify(Y,C1,2),Object.defineProperty(Q,"toString",{value:()=>Q.message,enumerable:!1})},$4=q("$ZodError",FX),gQ=q("$ZodError",FX,{Parent:Error});function qX(Q,Y=(X)=>X.message){let X={},W=[];for(let G of Q.issues)if(G.path.length>0)X[G.path[0]]=X[G.path[0]]||[],X[G.path[0]].push(Y(G));else W.push(Y(G));return{formErrors:W,fieldErrors:X}}function OX(Q,Y=(X)=>X.message){let X={_errors:[]},W=(G)=>{for(let $ of G.issues)if($.code==="invalid_union"&&$.errors.length)$.errors.map((z)=>W({issues:z}));else if($.code==="invalid_key")W({issues:$.issues});else if($.code==="invalid_element")W({issues:$.issues});else if($.path.length===0)X._errors.push(Y($));else{let z=X,J=0;while(J<$.path.length){let H=$.path[J];if(J!==$.path.length-1)z[H]=z[H]||{_errors:[]};else z[H]=z[H]||{_errors:[]},z[H]._errors.push(Y($));z=z[H],J++}}};return W(Q),X}var z4=(Q)=>(Y,X,W,G)=>{let $=W?Object.assign(W,{async:!1}):{async:!1},z=Y._zod.run({value:X,issues:[]},$);if(z instanceof Promise)throw new d0;if(z.issues.length){let J=new(G?.Err??Q)(z.issues.map((H)=>v0(H,$,I0())));throw W4(J,G?.callee),J}return z.value};var J4=(Q)=>async(Y,X,W,G)=>{let $=W?Object.assign(W,{async:!0}):{async:!0},z=Y._zod.run({value:X,issues:[]},$);if(z instanceof Promise)z=await z;if(z.issues.length){let J=new(G?.Err??Q)(z.issues.map((H)=>v0(H,$,I0())));throw W4(J,G?.callee),J}return z.value};var J6=(Q)=>(Y,X,W)=>{let G=W?{...W,async:!1}:{async:!1},$=Y._zod.run({value:X,issues:[]},G);if($ instanceof Promise)throw new d0;return $.issues.length?{success:!1,error:new(Q??$4)($.issues.map((z)=>v0(z,G,I0())))}:{success:!0,data:$.value}},H6=J6(gQ),U6=(Q)=>async(Y,X,W)=>{let G=W?Object.assign(W,{async:!0}):{async:!0},$=Y._zod.run({value:X,issues:[]},G);if($ instanceof Promise)$=await $;return $.issues.length?{success:!1,error:new Q($.issues.map((z)=>v0(z,G,I0())))}:{success:!0,data:$.value}},H4=U6(gQ),MX=(Q)=>(Y,X,W)=>{let G=W?Object.assign(W,{direction:"backward"}):{direction:"backward"};return z4(Q)(Y,X,G)};var VX=(Q)=>(Y,X,W)=>{return z4(Q)(Y,X,W)};var NX=(Q)=>async(Y,X,W)=>{let G=W?Object.assign(W,{direction:"backward"}):{direction:"backward"};return J4(Q)(Y,X,G)};var ZX=(Q)=>async(Y,X,W)=>{return J4(Q)(Y,X,W)};var wX=(Q)=>(Y,X,W)=>{let G=W?Object.assign(W,{direction:"backward"}):{direction:"backward"};return J6(Q)(Y,X,G)};var jX=(Q)=>(Y,X,W)=>{return J6(Q)(Y,X,W)};var PX=(Q)=>async(Y,X,W)=>{let G=W?Object.assign(W,{direction:"backward"}):{direction:"backward"};return U6(Q)(Y,X,G)};var bX=(Q)=>async(Y,X,W)=>{return U6(Q)(Y,X,W)};var IX=/^[cC][^\s-]{8,}$/,EX=/^[0-9a-z]+$/,TX=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,SX=/^[0-9a-vA-V]{20}$/,RX=/^[A-Za-z0-9]{27}$/,CX=/^[a-zA-Z0-9_-]{21}$/,kX=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var vX=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,yQ=(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 xX=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function _X(){return new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}var gX=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,yX=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,uX=/^((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])$/,hX=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,fX=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,uQ=/^[A-Za-z0-9_-]*$/,lX=/^(?=.{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 mX=/^\+(?:[0-9]){6,14}[0-9]$/,cX="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",pX=new RegExp(`^${cX}$`);function iX(Q){return typeof Q.precision==="number"?Q.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":Q.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${Q.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function nX(Q){return new RegExp(`^${iX(Q)}$`)}function rX(Q){let Y=iX({precision:Q.precision}),X=["Z"];if(Q.local)X.push("");if(Q.offset)X.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let W=`${Y}(?:${X.join("|")})`;return new RegExp(`^${cX}T(?:${W})$`)}var dX=(Q)=>{let Y=Q?`[\\s\\S]{${Q?.minimum??0},${Q?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${Y}$`)};var oX=/^-?\d+$/,tX=/^-?\d+(?:\.\d+)?/,aX=/^(?:true|false)$/i,sX=/^null$/i;var eX=/^[^A-Z]*$/,Q8=/^[^a-z]*$/;var H0=q("$ZodCheck",(Q,Y)=>{var X;Q._zod??(Q._zod={}),Q._zod.def=Y,(X=Q._zod).onattach??(X.onattach=[])}),Y8={number:"number",bigint:"bigint",object:"date"},hQ=q("$ZodCheckLessThan",(Q,Y)=>{H0.init(Q,Y);let X=Y8[typeof Y.value];Q._zod.onattach.push((W)=>{let G=W._zod.bag,$=(Y.inclusive?G.maximum:G.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(Y.value<$)if(Y.inclusive)G.maximum=Y.value;else G.exclusiveMaximum=Y.value}),Q._zod.check=(W)=>{if(Y.inclusive?W.value<=Y.value:W.value<Y.value)return;W.issues.push({origin:X,code:"too_big",maximum:Y.value,input:W.value,inclusive:Y.inclusive,inst:Q,continue:!Y.abort})}}),fQ=q("$ZodCheckGreaterThan",(Q,Y)=>{H0.init(Q,Y);let X=Y8[typeof Y.value];Q._zod.onattach.push((W)=>{let G=W._zod.bag,$=(Y.inclusive?G.minimum:G.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(Y.value>$)if(Y.inclusive)G.minimum=Y.value;else G.exclusiveMinimum=Y.value}),Q._zod.check=(W)=>{if(Y.inclusive?W.value>=Y.value:W.value>Y.value)return;W.issues.push({origin:X,code:"too_small",minimum:Y.value,input:W.value,inclusive:Y.inclusive,inst:Q,continue:!Y.abort})}}),X8=q("$ZodCheckMultipleOf",(Q,Y)=>{H0.init(Q,Y),Q._zod.onattach.push((X)=>{var W;(W=X._zod.bag).multipleOf??(W.multipleOf=Y.value)}),Q._zod.check=(X)=>{if(typeof X.value!==typeof Y.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof X.value==="bigint"?X.value%Y.value===BigInt(0):CQ(X.value,Y.value)===0)return;X.issues.push({origin:typeof X.value,code:"not_multiple_of",divisor:Y.value,input:X.value,inst:Q,continue:!Y.abort})}}),W8=q("$ZodCheckNumberFormat",(Q,Y)=>{H0.init(Q,Y),Y.format=Y.format||"float64";let X=Y.format?.includes("int"),W=X?"int":"number",[G,$]=_Q[Y.format];Q._zod.onattach.push((z)=>{let J=z._zod.bag;if(J.format=Y.format,J.minimum=G,J.maximum=$,X)J.pattern=oX}),Q._zod.check=(z)=>{let J=z.value;if(X){if(!Number.isInteger(J)){z.issues.push({expected:W,format:Y.format,code:"invalid_type",continue:!1,input:J,inst:Q});return}if(!Number.isSafeInteger(J)){if(J>0)z.issues.push({input:J,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:Q,origin:W,continue:!Y.abort});else z.issues.push({input:J,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:Q,origin:W,continue:!Y.abort});return}}if(J<G)z.issues.push({origin:"number",input:J,code:"too_small",minimum:G,inclusive:!0,inst:Q,continue:!Y.abort});if(J>$)z.issues.push({origin:"number",input:J,code:"too_big",maximum:$,inst:Q})}});var G8=q("$ZodCheckMaxLength",(Q,Y)=>{var X;H0.init(Q,Y),(X=Q._zod.def).when??(X.when=(W)=>{let G=W.value;return!G6(G)&&G.length!==void 0}),Q._zod.onattach.push((W)=>{let G=W._zod.bag.maximum??Number.POSITIVE_INFINITY;if(Y.maximum<G)W._zod.bag.maximum=Y.maximum}),Q._zod.check=(W)=>{let G=W.value;if(G.length<=Y.maximum)return;let z=z6(G);W.issues.push({origin:z,code:"too_big",maximum:Y.maximum,inclusive:!0,input:G,inst:Q,continue:!Y.abort})}}),$8=q("$ZodCheckMinLength",(Q,Y)=>{var X;H0.init(Q,Y),(X=Q._zod.def).when??(X.when=(W)=>{let G=W.value;return!G6(G)&&G.length!==void 0}),Q._zod.onattach.push((W)=>{let G=W._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(Y.minimum>G)W._zod.bag.minimum=Y.minimum}),Q._zod.check=(W)=>{let G=W.value;if(G.length>=Y.minimum)return;let z=z6(G);W.issues.push({origin:z,code:"too_small",minimum:Y.minimum,inclusive:!0,input:G,inst:Q,continue:!Y.abort})}}),z8=q("$ZodCheckLengthEquals",(Q,Y)=>{var X;H0.init(Q,Y),(X=Q._zod.def).when??(X.when=(W)=>{let G=W.value;return!G6(G)&&G.length!==void 0}),Q._zod.onattach.push((W)=>{let G=W._zod.bag;G.minimum=Y.length,G.maximum=Y.length,G.length=Y.length}),Q._zod.check=(W)=>{let G=W.value,$=G.length;if($===Y.length)return;let z=z6(G),J=$>Y.length;W.issues.push({origin:z,...J?{code:"too_big",maximum:Y.length}:{code:"too_small",minimum:Y.length},inclusive:!0,exact:!0,input:W.value,inst:Q,continue:!Y.abort})}}),A6=q("$ZodCheckStringFormat",(Q,Y)=>{var X,W;if(H0.init(Q,Y),Q._zod.onattach.push((G)=>{let $=G._zod.bag;if($.format=Y.format,Y.pattern)$.patterns??($.patterns=new Set),$.patterns.add(Y.pattern)}),Y.pattern)(X=Q._zod).check??(X.check=(G)=>{if(Y.pattern.lastIndex=0,Y.pattern.test(G.value))return;G.issues.push({origin:"string",code:"invalid_format",format:Y.format,input:G.value,...Y.pattern?{pattern:Y.pattern.toString()}:{},inst:Q,continue:!Y.abort})});else(W=Q._zod).check??(W.check=()=>{})}),J8=q("$ZodCheckRegex",(Q,Y)=>{A6.init(Q,Y),Q._zod.check=(X)=>{if(Y.pattern.lastIndex=0,Y.pattern.test(X.value))return;X.issues.push({origin:"string",code:"invalid_format",format:"regex",input:X.value,pattern:Y.pattern.toString(),inst:Q,continue:!Y.abort})}}),H8=q("$ZodCheckLowerCase",(Q,Y)=>{Y.pattern??(Y.pattern=eX),A6.init(Q,Y)}),U8=q("$ZodCheckUpperCase",(Q,Y)=>{Y.pattern??(Y.pattern=Q8),A6.init(Q,Y)}),A8=q("$ZodCheckIncludes",(Q,Y)=>{H0.init(Q,Y);let X=o0(Y.includes),W=new RegExp(typeof Y.position==="number"?`^.{${Y.position}}${X}`:X);Y.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(Y.includes,Y.position))return;G.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:Y.includes,input:G.value,inst:Q,continue:!Y.abort})}}),B8=q("$ZodCheckStartsWith",(Q,Y)=>{H0.init(Q,Y);let X=new RegExp(`^${o0(Y.prefix)}.*`);Y.pattern??(Y.pattern=X),Q._zod.onattach.push((W)=>{let G=W._zod.bag;G.patterns??(G.patterns=new Set),G.patterns.add(X)}),Q._zod.check=(W)=>{if(W.value.startsWith(Y.prefix))return;W.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:Y.prefix,input:W.value,inst:Q,continue:!Y.abort})}}),K8=q("$ZodCheckEndsWith",(Q,Y)=>{H0.init(Q,Y);let X=new RegExp(`.*${o0(Y.suffix)}$`);Y.pattern??(Y.pattern=X),Q._zod.onattach.push((W)=>{let G=W._zod.bag;G.patterns??(G.patterns=new Set),G.patterns.add(X)}),Q._zod.check=(W)=>{if(W.value.endsWith(Y.suffix))return;W.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:Y.suffix,input:W.value,inst:Q,continue:!Y.abort})}});var D8=q("$ZodCheckOverwrite",(Q,Y)=>{H0.init(Q,Y),Q._zod.check=(X)=>{X.value=Y.tx(X.value)}});class lQ{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 X=Q.split(`
|
|
10
10
|
`).filter(($)=>$),W=Math.min(...X.map(($)=>$.length-$.trimStart().length)),G=X.map(($)=>$.slice(W)).map(($)=>" ".repeat(this.indent*2)+$);for(let $ of G)this.content.push($)}compile(){let Q=Function,Y=this?.args,W=[...(this?.content??[""]).map((G)=>` ${G}`)];return new Q(...Y,W.join(`
|
|
11
|
-
`))}}var
|
|
11
|
+
`))}}var F8={major:4,minor:1,patch:12};var o=q("$ZodType",(Q,Y)=>{var X;Q??(Q={}),Q._zod.def=Y,Q._zod.bag=Q._zod.bag||{},Q._zod.version=F8;let W=[...Q._zod.def.checks??[]];if(Q._zod.traits.has("$ZodCheck"))W.unshift(Q);for(let G of W)for(let $ of G._zod.onattach)$(Q);if(W.length===0)(X=Q._zod).deferred??(X.deferred=[]),Q._zod.deferred?.push(()=>{Q._zod.run=Q._zod.parse});else{let G=(z,J,H)=>{let U=J1(z),A;for(let B of J){if(B._zod.def.when){if(!B._zod.def.when(z))continue}else if(U)continue;let K=z.issues.length,D=B._zod.check(z);if(D instanceof Promise&&H?.async===!1)throw new d0;if(A||D instanceof Promise)A=(A??Promise.resolve()).then(async()=>{if(await D,z.issues.length===K)return;if(!U)U=J1(z,K)});else{if(z.issues.length===K)continue;if(!U)U=J1(z,K)}}if(A)return A.then(()=>{return z});return z},$=(z,J,H)=>{if(J1(z))return z.aborted=!0,z;let U=G(J,W,H);if(U instanceof Promise){if(H.async===!1)throw new d0;return U.then((A)=>Q._zod.parse(A,H))}return Q._zod.parse(U,H)};Q._zod.run=(z,J)=>{if(J.skipChecks)return Q._zod.parse(z,J);if(J.direction==="backward"){let U=Q._zod.parse({value:z.value,issues:[]},{...J,skipChecks:!0});if(U instanceof Promise)return U.then((A)=>{return $(A,z,J)});return $(U,z,J)}let H=Q._zod.parse(z,J);if(H instanceof Promise){if(J.async===!1)throw new d0;return H.then((U)=>G(U,W,J))}return G(H,W,J)}}Q["~standard"]={validate:(G)=>{try{let $=H6(Q,G);return $.success?{value:$.data}:{issues:$.error?.issues}}catch($){return H4(Q,G).then((z)=>z.success?{value:z.data}:{issues:z.error?.issues})}},vendor:"zod",version:1}}),K4=q("$ZodString",(Q,Y)=>{o.init(Q,Y),Q._zod.pattern=[...Q?._zod.bag?.patterns??[]].pop()??dX(Q._zod.bag),Q._zod.parse=(X,W)=>{if(Y.coerce)try{X.value=String(X.value)}catch(G){}if(typeof X.value==="string")return X;return X.issues.push({expected:"string",code:"invalid_type",input:X.value,inst:Q}),X}}),t=q("$ZodStringFormat",(Q,Y)=>{A6.init(Q,Y),K4.init(Q,Y)}),P8=q("$ZodGUID",(Q,Y)=>{Y.pattern??(Y.pattern=vX),t.init(Q,Y)}),b8=q("$ZodUUID",(Q,Y)=>{if(Y.version){let W={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[Y.version];if(W===void 0)throw Error(`Invalid UUID version: "${Y.version}"`);Y.pattern??(Y.pattern=yQ(W))}else Y.pattern??(Y.pattern=yQ());t.init(Q,Y)}),I8=q("$ZodEmail",(Q,Y)=>{Y.pattern??(Y.pattern=xX),t.init(Q,Y)}),E8=q("$ZodURL",(Q,Y)=>{t.init(Q,Y),Q._zod.check=(X)=>{try{let W=X.value.trim(),G=new URL(W);if(Y.hostname){if(Y.hostname.lastIndex=0,!Y.hostname.test(G.hostname))X.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:lX.source,input:X.value,inst:Q,continue:!Y.abort})}if(Y.protocol){if(Y.protocol.lastIndex=0,!Y.protocol.test(G.protocol.endsWith(":")?G.protocol.slice(0,-1):G.protocol))X.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:Y.protocol.source,input:X.value,inst:Q,continue:!Y.abort})}if(Y.normalize)X.value=G.href;else X.value=W;return}catch(W){X.issues.push({code:"invalid_format",format:"url",input:X.value,inst:Q,continue:!Y.abort})}}}),T8=q("$ZodEmoji",(Q,Y)=>{Y.pattern??(Y.pattern=_X()),t.init(Q,Y)}),S8=q("$ZodNanoID",(Q,Y)=>{Y.pattern??(Y.pattern=CX),t.init(Q,Y)}),R8=q("$ZodCUID",(Q,Y)=>{Y.pattern??(Y.pattern=IX),t.init(Q,Y)}),C8=q("$ZodCUID2",(Q,Y)=>{Y.pattern??(Y.pattern=EX),t.init(Q,Y)}),k8=q("$ZodULID",(Q,Y)=>{Y.pattern??(Y.pattern=TX),t.init(Q,Y)}),v8=q("$ZodXID",(Q,Y)=>{Y.pattern??(Y.pattern=SX),t.init(Q,Y)}),x8=q("$ZodKSUID",(Q,Y)=>{Y.pattern??(Y.pattern=RX),t.init(Q,Y)}),_8=q("$ZodISODateTime",(Q,Y)=>{Y.pattern??(Y.pattern=rX(Y)),t.init(Q,Y)}),g8=q("$ZodISODate",(Q,Y)=>{Y.pattern??(Y.pattern=pX),t.init(Q,Y)}),y8=q("$ZodISOTime",(Q,Y)=>{Y.pattern??(Y.pattern=nX(Y)),t.init(Q,Y)}),u8=q("$ZodISODuration",(Q,Y)=>{Y.pattern??(Y.pattern=kX),t.init(Q,Y)}),h8=q("$ZodIPv4",(Q,Y)=>{Y.pattern??(Y.pattern=gX),t.init(Q,Y),Q._zod.onattach.push((X)=>{let W=X._zod.bag;W.format="ipv4"})}),f8=q("$ZodIPv6",(Q,Y)=>{Y.pattern??(Y.pattern=yX),t.init(Q,Y),Q._zod.onattach.push((X)=>{let W=X._zod.bag;W.format="ipv6"}),Q._zod.check=(X)=>{try{new URL(`http://[${X.value}]`)}catch{X.issues.push({code:"invalid_format",format:"ipv6",input:X.value,inst:Q,continue:!Y.abort})}}}),l8=q("$ZodCIDRv4",(Q,Y)=>{Y.pattern??(Y.pattern=uX),t.init(Q,Y)}),m8=q("$ZodCIDRv6",(Q,Y)=>{Y.pattern??(Y.pattern=hX),t.init(Q,Y),Q._zod.check=(X)=>{let W=X.value.split("/");try{if(W.length!==2)throw Error();let[G,$]=W;if(!$)throw Error();let z=Number($);if(`${z}`!==$)throw Error();if(z<0||z>128)throw Error();new URL(`http://[${G}]`)}catch{X.issues.push({code:"invalid_format",format:"cidrv6",input:X.value,inst:Q,continue:!Y.abort})}}});function c8(Q){if(Q==="")return!0;if(Q.length%4!==0)return!1;try{return atob(Q),!0}catch{return!1}}var p8=q("$ZodBase64",(Q,Y)=>{Y.pattern??(Y.pattern=fX),t.init(Q,Y),Q._zod.onattach.push((X)=>{X._zod.bag.contentEncoding="base64"}),Q._zod.check=(X)=>{if(c8(X.value))return;X.issues.push({code:"invalid_format",format:"base64",input:X.value,inst:Q,continue:!Y.abort})}});function mH(Q){if(!uQ.test(Q))return!1;let Y=Q.replace(/[-_]/g,(W)=>W==="-"?"+":"/"),X=Y.padEnd(Math.ceil(Y.length/4)*4,"=");return c8(X)}var i8=q("$ZodBase64URL",(Q,Y)=>{Y.pattern??(Y.pattern=uQ),t.init(Q,Y),Q._zod.onattach.push((X)=>{X._zod.bag.contentEncoding="base64url"}),Q._zod.check=(X)=>{if(mH(X.value))return;X.issues.push({code:"invalid_format",format:"base64url",input:X.value,inst:Q,continue:!Y.abort})}}),n8=q("$ZodE164",(Q,Y)=>{Y.pattern??(Y.pattern=mX),t.init(Q,Y)});function cH(Q,Y=null){try{let X=Q.split(".");if(X.length!==3)return!1;let[W]=X;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(Y&&(!("alg"in G)||G.alg!==Y))return!1;return!0}catch{return!1}}var r8=q("$ZodJWT",(Q,Y)=>{t.init(Q,Y),Q._zod.check=(X)=>{if(cH(X.value,Y.alg))return;X.issues.push({code:"invalid_format",format:"jwt",input:X.value,inst:Q,continue:!Y.abort})}});var cQ=q("$ZodNumber",(Q,Y)=>{o.init(Q,Y),Q._zod.pattern=Q._zod.bag.pattern??tX,Q._zod.parse=(X,W)=>{if(Y.coerce)try{X.value=Number(X.value)}catch(z){}let G=X.value;if(typeof G==="number"&&!Number.isNaN(G)&&Number.isFinite(G))return X;let $=typeof G==="number"?Number.isNaN(G)?"NaN":!Number.isFinite(G)?"Infinity":void 0:void 0;return X.issues.push({expected:"number",code:"invalid_type",input:G,inst:Q,...$?{received:$}:{}}),X}}),d8=q("$ZodNumber",(Q,Y)=>{W8.init(Q,Y),cQ.init(Q,Y)}),o8=q("$ZodBoolean",(Q,Y)=>{o.init(Q,Y),Q._zod.pattern=aX,Q._zod.parse=(X,W)=>{if(Y.coerce)try{X.value=Boolean(X.value)}catch($){}let G=X.value;if(typeof G==="boolean")return X;return X.issues.push({expected:"boolean",code:"invalid_type",input:G,inst:Q}),X}});var t8=q("$ZodNull",(Q,Y)=>{o.init(Q,Y),Q._zod.pattern=sX,Q._zod.values=new Set([null]),Q._zod.parse=(X,W)=>{let G=X.value;if(G===null)return X;return X.issues.push({expected:"null",code:"invalid_type",input:G,inst:Q}),X}});var a8=q("$ZodUnknown",(Q,Y)=>{o.init(Q,Y),Q._zod.parse=(X)=>X}),s8=q("$ZodNever",(Q,Y)=>{o.init(Q,Y),Q._zod.parse=(X,W)=>{return X.issues.push({expected:"never",code:"invalid_type",input:X.value,inst:Q}),X}});function q8(Q,Y,X){if(Q.issues.length)Y.issues.push(...t0(X,Q.issues));Y.value[X]=Q.value}var e8=q("$ZodArray",(Q,Y)=>{o.init(Q,Y),Q._zod.parse=(X,W)=>{let G=X.value;if(!Array.isArray(G))return X.issues.push({expected:"array",code:"invalid_type",input:G,inst:Q}),X;X.value=Array(G.length);let $=[];for(let z=0;z<G.length;z++){let J=G[z],H=Y.element._zod.run({value:J,issues:[]},W);if(H instanceof Promise)$.push(H.then((U)=>q8(U,X,z)));else q8(H,X,z)}if($.length)return Promise.all($).then(()=>X);return X}});function B4(Q,Y,X,W){if(Q.issues.length)Y.issues.push(...t0(X,Q.issues));if(Q.value===void 0){if(X in W)Y.value[X]=void 0}else Y.value[X]=Q.value}function QW(Q){let Y=Object.keys(Q.shape);for(let W of Y)if(!Q.shape?.[W]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${W}": expected a Zod schema`);let X=xQ(Q.shape);return{...Q,keys:Y,keySet:new Set(Y),numKeys:Y.length,optionalKeys:new Set(X)}}function YW(Q,Y,X,W,G,$){let z=[],J=G.keySet,H=G.catchall._zod,U=H.def.type;for(let A of Object.keys(Y)){if(J.has(A))continue;if(U==="never"){z.push(A);continue}let B=H.run({value:Y[A],issues:[]},W);if(B instanceof Promise)Q.push(B.then((K)=>B4(K,X,A,Y)));else B4(B,X,A,Y)}if(z.length)X.issues.push({code:"unrecognized_keys",keys:z,input:Y,inst:$});if(!Q.length)return X;return Promise.all(Q).then(()=>{return X})}var pH=q("$ZodObject",(Q,Y)=>{if(o.init(Q,Y),!Object.getOwnPropertyDescriptor(Y,"shape")?.get){let J=Y.shape;Object.defineProperty(Y,"shape",{get:()=>{let H={...J};return Object.defineProperty(Y,"shape",{value:H}),H}})}let W=k1(()=>QW(Y));i(Q._zod,"propValues",()=>{let J=Y.shape,H={};for(let U in J){let A=J[U]._zod;if(A.values){H[U]??(H[U]=new Set);for(let B of A.values)H[U].add(B)}}return H});let G=Z1,$=Y.catchall,z;Q._zod.parse=(J,H)=>{z??(z=W.value);let U=J.value;if(!G(U))return J.issues.push({expected:"object",code:"invalid_type",input:U,inst:Q}),J;J.value={};let A=[],B=z.shape;for(let K of z.keys){let O=B[K]._zod.run({value:U[K],issues:[]},H);if(O instanceof Promise)A.push(O.then((M)=>B4(M,J,K,U)));else B4(O,J,K,U)}if(!$)return A.length?Promise.all(A).then(()=>J):J;return YW(A,U,J,H,W.value,Q)}}),XW=q("$ZodObjectJIT",(Q,Y)=>{pH.init(Q,Y);let X=Q._zod.parse,W=k1(()=>QW(Y)),G=(K)=>{let D=new lQ(["shape","payload","ctx"]),O=W.value,M=(T)=>{let y=X4(T);return`shape[${y}]._zod.run({ value: input[${y}], issues: [] }, ctx)`};D.write("const input = payload.value;");let Z=Object.create(null),V=0;for(let T of O.keys)Z[T]=`key_${V++}`;D.write("const newResult = {};");for(let T of O.keys){let y=Z[T],S=X4(T);D.write(`const ${y} = ${M(T)};`),D.write(`
|
|
12
12
|
if (${y}.issues.length) {
|
|
13
13
|
payload.issues = payload.issues.concat(${y}.issues.map(iss => ({
|
|
14
14
|
...iss,
|
|
@@ -25,7 +25,7 @@ var s5=Object.create;var{getPrototypeOf:e5,defineProperty:EQ,getOwnPropertyNames
|
|
|
25
25
|
newResult[${S}] = ${y}.value;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
`)}D.write("payload.value = newResult;"),D.write("return payload;");let R=D.compile();return(T,y)=>R(K,T,y)},$,z=Z1,J=!e6.jitless,U=J&&kQ.value,A=Y.catchall,B;Q._zod.parse=(K,D)=>{B??(B=W.value);let O=K.value;if(!z(O))return K.issues.push({expected:"object",code:"invalid_type",input:O,inst:Q}),K;if(J&&U&&D?.async===!1&&D.jitless!==!0){if(!$)$=G(Y.shape);if(K=$(K,D),!A)return K;return QW([],O,K,D,B,Q)}return X(K,D)}});function q8(Q,Y,X,W){for(let $ of Q)if($.issues.length===0)return Y.value=$.value,Y;let G=Q.filter(($)=>!J1($));if(G.length===1)return Y.value=G[0].value,G[0];return Y.issues.push({code:"invalid_union",input:Y.value,inst:X,errors:Q.map(($)=>$.issues.map((z)=>v0(z,W,I0())))}),Y}var pQ=q("$ZodUnion",(Q,Y)=>{o.init(Q,Y),i(Q._zod,"optin",()=>Y.options.some((G)=>G._zod.optin==="optional")?"optional":void 0),i(Q._zod,"optout",()=>Y.options.some((G)=>G._zod.optout==="optional")?"optional":void 0),i(Q._zod,"values",()=>{if(Y.options.every((G)=>G._zod.values))return new Set(Y.options.flatMap((G)=>Array.from(G._zod.values)));return}),i(Q._zod,"pattern",()=>{if(Y.options.every((G)=>G._zod.pattern)){let G=Y.options.map(($)=>$._zod.pattern);return new RegExp(`^(${G.map(($)=>G6($.source)).join("|")})$`)}return});let X=Y.options.length===1,W=Y.options[0]._zod.run;Q._zod.parse=(G,$)=>{if(X)return W(G,$);let z=!1,J=[];for(let H of Y.options){let U=H._zod.run({value:G.value,issues:[]},$);if(U instanceof Promise)J.push(U),z=!0;else{if(U.issues.length===0)return U;J.push(U)}}if(!z)return q8(J,G,Q,$);return Promise.all(J).then((H)=>{return q8(H,G,Q,$)})}}),XW=q("$ZodDiscriminatedUnion",(Q,Y)=>{pQ.init(Q,Y);let X=Q._zod.parse;i(Q._zod,"propValues",()=>{let G={};for(let $ of Y.options){let z=$._zod.propValues;if(!z||Object.keys(z).length===0)throw Error(`Invalid discriminated union option at index "${Y.options.indexOf($)}"`);for(let[J,H]of Object.entries(z)){if(!G[J])G[J]=new Set;for(let U of H)G[J].add(U)}}return G});let W=k1(()=>{let G=Y.options,$=new Map;for(let z of G){let J=z._zod.propValues?.[Y.discriminator];if(!J||J.size===0)throw Error(`Invalid discriminated union option at index "${Y.options.indexOf(z)}"`);for(let H of J){if($.has(H))throw Error(`Duplicate discriminator value "${String(H)}"`);$.set(H,z)}}return $});Q._zod.parse=(G,$)=>{let z=G.value;if(!Z1(z))return G.issues.push({code:"invalid_type",expected:"object",input:z,inst:Q}),G;let J=W.value.get(z?.[Y.discriminator]);if(J)return J._zod.run(G,$);if(Y.unionFallback)return X(G,$);return G.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:Y.discriminator,input:z,path:[Y.discriminator],inst:Q}),G}}),WW=q("$ZodIntersection",(Q,Y)=>{o.init(Q,Y),Q._zod.parse=(X,W)=>{let G=X.value,$=Y.left._zod.run({value:G,issues:[]},W),z=Y.right._zod.run({value:G,issues:[]},W);if($ instanceof Promise||z instanceof Promise)return Promise.all([$,z]).then(([H,U])=>{return O8(X,H,U)});return O8(X,$,z)}});function mQ(Q,Y){if(Q===Y)return{valid:!0,data:Q};if(Q instanceof Date&&Y instanceof Date&&+Q===+Y)return{valid:!0,data:Q};if(z1(Q)&&z1(Y)){let X=Object.keys(Y),W=Object.keys(Q).filter(($)=>X.indexOf($)!==-1),G={...Q,...Y};for(let $ of W){let z=mQ(Q[$],Y[$]);if(!z.valid)return{valid:!1,mergeErrorPath:[$,...z.mergeErrorPath]};G[$]=z.data}return{valid:!0,data:G}}if(Array.isArray(Q)&&Array.isArray(Y)){if(Q.length!==Y.length)return{valid:!1,mergeErrorPath:[]};let X=[];for(let W=0;W<Q.length;W++){let G=Q[W],$=Y[W],z=mQ(G,$);if(!z.valid)return{valid:!1,mergeErrorPath:[W,...z.mergeErrorPath]};X.push(z.data)}return{valid:!0,data:X}}return{valid:!1,mergeErrorPath:[]}}function O8(Q,Y,X){if(Y.issues.length)Q.issues.push(...Y.issues);if(X.issues.length)Q.issues.push(...X.issues);if(J1(Q))return Q;let W=mQ(Y.value,X.value);if(!W.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(W.mergeErrorPath)}`);return Q.value=W.data,Q}var GW=q("$ZodRecord",(Q,Y)=>{o.init(Q,Y),Q._zod.parse=(X,W)=>{let G=X.value;if(!z1(G))return X.issues.push({expected:"record",code:"invalid_type",input:G,inst:Q}),X;let $=[];if(Y.keyType._zod.values){let z=Y.keyType._zod.values;X.value={};for(let H of z)if(typeof H==="string"||typeof H==="number"||typeof H==="symbol"){let U=Y.valueType._zod.run({value:G[H],issues:[]},W);if(U instanceof Promise)$.push(U.then((A)=>{if(A.issues.length)X.issues.push(...t0(H,A.issues));X.value[H]=A.value}));else{if(U.issues.length)X.issues.push(...t0(H,U.issues));X.value[H]=U.value}}let J;for(let H in G)if(!z.has(H))J=J??[],J.push(H);if(J&&J.length>0)X.issues.push({code:"unrecognized_keys",input:G,inst:Q,keys:J})}else{X.value={};for(let z of Reflect.ownKeys(G)){if(z==="__proto__")continue;let J=Y.keyType._zod.run({value:z,issues:[]},W);if(J instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(J.issues.length){X.issues.push({code:"invalid_key",origin:"record",issues:J.issues.map((U)=>v0(U,W,I0())),input:z,path:[z],inst:Q}),X.value[J.value]=J.value;continue}let H=Y.valueType._zod.run({value:G[z],issues:[]},W);if(H instanceof Promise)$.push(H.then((U)=>{if(U.issues.length)X.issues.push(...t0(z,U.issues));X.value[J.value]=U.value}));else{if(H.issues.length)X.issues.push(...t0(z,H.issues));X.value[J.value]=H.value}}}if($.length)return Promise.all($).then(()=>X);return X}});var $W=q("$ZodEnum",(Q,Y)=>{o.init(Q,Y);let X=RQ(Y.entries),W=new Set(X);Q._zod.values=W,Q._zod.pattern=new RegExp(`^(${X.filter((G)=>vQ.has(typeof G)).map((G)=>typeof G==="string"?o0(G):G.toString()).join("|")})$`),Q._zod.parse=(G,$)=>{let z=G.value;if(W.has(z))return G;return G.issues.push({code:"invalid_value",values:X,input:z,inst:Q}),G}}),zW=q("$ZodLiteral",(Q,Y)=>{if(o.init(Q,Y),Y.values.length===0)throw Error("Cannot create literal schema with no valid values");Q._zod.values=new Set(Y.values),Q._zod.pattern=new RegExp(`^(${Y.values.map((X)=>typeof X==="string"?o0(X):X?o0(X.toString()):String(X)).join("|")})$`),Q._zod.parse=(X,W)=>{let G=X.value;if(Q._zod.values.has(G))return X;return X.issues.push({code:"invalid_value",values:Y.values,input:G,inst:Q}),X}});var JW=q("$ZodTransform",(Q,Y)=>{o.init(Q,Y),Q._zod.parse=(X,W)=>{if(W.direction==="backward")throw new Y6(Q.constructor.name);let G=Y.transform(X.value,X);if(W.async)return(G instanceof Promise?G:Promise.resolve(G)).then((z)=>{return X.value=z,X});if(G instanceof Promise)throw new d0;return X.value=G,X}});function M8(Q,Y){if(Q.issues.length&&Y===void 0)return{issues:[],value:void 0};return Q}var HW=q("$ZodOptional",(Q,Y)=>{o.init(Q,Y),Q._zod.optin="optional",Q._zod.optout="optional",i(Q._zod,"values",()=>{return Y.innerType._zod.values?new Set([...Y.innerType._zod.values,void 0]):void 0}),i(Q._zod,"pattern",()=>{let X=Y.innerType._zod.pattern;return X?new RegExp(`^(${G6(X.source)})?$`):void 0}),Q._zod.parse=(X,W)=>{if(Y.innerType._zod.optin==="optional"){let G=Y.innerType._zod.run(X,W);if(G instanceof Promise)return G.then(($)=>M8($,X.value));return M8(G,X.value)}if(X.value===void 0)return X;return Y.innerType._zod.run(X,W)}}),UW=q("$ZodNullable",(Q,Y)=>{o.init(Q,Y),i(Q._zod,"optin",()=>Y.innerType._zod.optin),i(Q._zod,"optout",()=>Y.innerType._zod.optout),i(Q._zod,"pattern",()=>{let X=Y.innerType._zod.pattern;return X?new RegExp(`^(${G6(X.source)}|null)$`):void 0}),i(Q._zod,"values",()=>{return Y.innerType._zod.values?new Set([...Y.innerType._zod.values,null]):void 0}),Q._zod.parse=(X,W)=>{if(X.value===null)return X;return Y.innerType._zod.run(X,W)}}),AW=q("$ZodDefault",(Q,Y)=>{o.init(Q,Y),Q._zod.optin="optional",i(Q._zod,"values",()=>Y.innerType._zod.values),Q._zod.parse=(X,W)=>{if(W.direction==="backward")return Y.innerType._zod.run(X,W);if(X.value===void 0)return X.value=Y.defaultValue,X;let G=Y.innerType._zod.run(X,W);if(G instanceof Promise)return G.then(($)=>V8($,Y));return V8(G,Y)}});function V8(Q,Y){if(Q.value===void 0)Q.value=Y.defaultValue;return Q}var BW=q("$ZodPrefault",(Q,Y)=>{o.init(Q,Y),Q._zod.optin="optional",i(Q._zod,"values",()=>Y.innerType._zod.values),Q._zod.parse=(X,W)=>{if(W.direction==="backward")return Y.innerType._zod.run(X,W);if(X.value===void 0)X.value=Y.defaultValue;return Y.innerType._zod.run(X,W)}}),KW=q("$ZodNonOptional",(Q,Y)=>{o.init(Q,Y),i(Q._zod,"values",()=>{let X=Y.innerType._zod.values;return X?new Set([...X].filter((W)=>W!==void 0)):void 0}),Q._zod.parse=(X,W)=>{let G=Y.innerType._zod.run(X,W);if(G instanceof Promise)return G.then(($)=>N8($,Q));return N8(G,Q)}});function N8(Q,Y){if(!Q.issues.length&&Q.value===void 0)Q.issues.push({code:"invalid_type",expected:"nonoptional",input:Q.value,inst:Y});return Q}var DW=q("$ZodCatch",(Q,Y)=>{o.init(Q,Y),i(Q._zod,"optin",()=>Y.innerType._zod.optin),i(Q._zod,"optout",()=>Y.innerType._zod.optout),i(Q._zod,"values",()=>Y.innerType._zod.values),Q._zod.parse=(X,W)=>{if(W.direction==="backward")return Y.innerType._zod.run(X,W);let G=Y.innerType._zod.run(X,W);if(G instanceof Promise)return G.then(($)=>{if(X.value=$.value,$.issues.length)X.value=Y.catchValue({...X,error:{issues:$.issues.map((z)=>v0(z,W,I0()))},input:X.value}),X.issues=[];return X});if(X.value=G.value,G.issues.length)X.value=Y.catchValue({...X,error:{issues:G.issues.map(($)=>v0($,W,I0()))},input:X.value}),X.issues=[];return X}});var LW=q("$ZodPipe",(Q,Y)=>{o.init(Q,Y),i(Q._zod,"values",()=>Y.in._zod.values),i(Q._zod,"optin",()=>Y.in._zod.optin),i(Q._zod,"optout",()=>Y.out._zod.optout),i(Q._zod,"propValues",()=>Y.in._zod.propValues),Q._zod.parse=(X,W)=>{if(W.direction==="backward"){let $=Y.out._zod.run(X,W);if($ instanceof Promise)return $.then((z)=>U4(z,Y.in,W));return U4($,Y.in,W)}let G=Y.in._zod.run(X,W);if(G instanceof Promise)return G.then(($)=>U4($,Y.out,W));return U4(G,Y.out,W)}});function U4(Q,Y,X){if(Q.issues.length)return Q.aborted=!0,Q;return Y._zod.run({value:Q.value,issues:Q.issues},X)}var FW=q("$ZodReadonly",(Q,Y)=>{o.init(Q,Y),i(Q._zod,"propValues",()=>Y.innerType._zod.propValues),i(Q._zod,"values",()=>Y.innerType._zod.values),i(Q._zod,"optin",()=>Y.innerType._zod.optin),i(Q._zod,"optout",()=>Y.innerType._zod.optout),Q._zod.parse=(X,W)=>{if(W.direction==="backward")return Y.innerType._zod.run(X,W);let G=Y.innerType._zod.run(X,W);if(G instanceof Promise)return G.then(Z8);return Z8(G)}});function Z8(Q){return Q.value=Object.freeze(Q.value),Q}var qW=q("$ZodCustom",(Q,Y)=>{H0.init(Q,Y),o.init(Q,Y),Q._zod.parse=(X,W)=>{return X},Q._zod.check=(X)=>{let W=X.value,G=Y.fn(W);if(G instanceof Promise)return G.then(($)=>w8($,X,W,Q));w8(G,X,W,Q);return}});function w8(Q,Y,X,W){if(!Q){let G={code:"custom",input:X,inst:W,path:[...W._zod.def.path??[]],continue:!W._zod.def.abort};if(W._zod.def.params)G.params=W._zod.def.params;Y.issues.push(v1(G))}}var iH=(Q)=>{let Y=typeof Q;switch(Y){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 Y},nH=()=>{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 Y(W){return Q[W]??null}let X={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 ${iH(W.input)}`;case"invalid_value":if(W.values.length===1)return`Invalid input: expected ${W4(W.values[0])}`;return`Invalid option: expected one of ${Q4(W.values,"|")}`;case"too_big":{let G=W.inclusive?"<=":"<",$=Y(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?">=":">",$=Y(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 ${X[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":""}: ${Q4(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 iQ(){return{localeError:nH()}}var JN=Symbol("ZodOutput"),HN=Symbol("ZodInput");class OW{constructor(){this._map=new WeakMap,this._idmap=new Map}add(Q,...Y){let X=Y[0];if(this._map.set(Q,X),X&&typeof X==="object"&&"id"in X){if(this._idmap.has(X.id))throw Error(`ID ${X.id} already exists in the registry`);this._idmap.set(X.id,Q)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(Q){let Y=this._map.get(Q);if(Y&&typeof Y==="object"&&"id"in Y)this._idmap.delete(Y.id);return this._map.delete(Q),this}get(Q){let Y=Q._zod.parent;if(Y){let X={...this.get(Y)??{}};delete X.id;let W={...X,...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 rH(){return new OW}var A6=rH();function MW(Q,Y){return new Q({type:"string",...E(Y)})}function VW(Q,Y){return new Q({type:"string",format:"email",check:"string_format",abort:!1,...E(Y)})}function nQ(Q,Y){return new Q({type:"string",format:"guid",check:"string_format",abort:!1,...E(Y)})}function NW(Q,Y){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,...E(Y)})}function ZW(Q,Y){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...E(Y)})}function wW(Q,Y){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...E(Y)})}function jW(Q,Y){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...E(Y)})}function PW(Q,Y){return new Q({type:"string",format:"url",check:"string_format",abort:!1,...E(Y)})}function bW(Q,Y){return new Q({type:"string",format:"emoji",check:"string_format",abort:!1,...E(Y)})}function IW(Q,Y){return new Q({type:"string",format:"nanoid",check:"string_format",abort:!1,...E(Y)})}function EW(Q,Y){return new Q({type:"string",format:"cuid",check:"string_format",abort:!1,...E(Y)})}function TW(Q,Y){return new Q({type:"string",format:"cuid2",check:"string_format",abort:!1,...E(Y)})}function SW(Q,Y){return new Q({type:"string",format:"ulid",check:"string_format",abort:!1,...E(Y)})}function RW(Q,Y){return new Q({type:"string",format:"xid",check:"string_format",abort:!1,...E(Y)})}function CW(Q,Y){return new Q({type:"string",format:"ksuid",check:"string_format",abort:!1,...E(Y)})}function kW(Q,Y){return new Q({type:"string",format:"ipv4",check:"string_format",abort:!1,...E(Y)})}function vW(Q,Y){return new Q({type:"string",format:"ipv6",check:"string_format",abort:!1,...E(Y)})}function xW(Q,Y){return new Q({type:"string",format:"cidrv4",check:"string_format",abort:!1,...E(Y)})}function _W(Q,Y){return new Q({type:"string",format:"cidrv6",check:"string_format",abort:!1,...E(Y)})}function gW(Q,Y){return new Q({type:"string",format:"base64",check:"string_format",abort:!1,...E(Y)})}function yW(Q,Y){return new Q({type:"string",format:"base64url",check:"string_format",abort:!1,...E(Y)})}function uW(Q,Y){return new Q({type:"string",format:"e164",check:"string_format",abort:!1,...E(Y)})}function hW(Q,Y){return new Q({type:"string",format:"jwt",check:"string_format",abort:!1,...E(Y)})}function fW(Q,Y){return new Q({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...E(Y)})}function lW(Q,Y){return new Q({type:"string",format:"date",check:"string_format",...E(Y)})}function mW(Q,Y){return new Q({type:"string",format:"time",check:"string_format",precision:null,...E(Y)})}function cW(Q,Y){return new Q({type:"string",format:"duration",check:"string_format",...E(Y)})}function pW(Q,Y){return new Q({type:"number",checks:[],...E(Y)})}function iW(Q,Y){return new Q({type:"number",check:"number_format",abort:!1,format:"safeint",...E(Y)})}function nW(Q,Y){return new Q({type:"boolean",...E(Y)})}function rW(Q,Y){return new Q({type:"null",...E(Y)})}function dW(Q){return new Q({type:"unknown"})}function oW(Q,Y){return new Q({type:"never",...E(Y)})}function K4(Q,Y){return new hQ({check:"less_than",...E(Y),value:Q,inclusive:!1})}function B6(Q,Y){return new hQ({check:"less_than",...E(Y),value:Q,inclusive:!0})}function D4(Q,Y){return new fQ({check:"greater_than",...E(Y),value:Q,inclusive:!1})}function K6(Q,Y){return new fQ({check:"greater_than",...E(Y),value:Q,inclusive:!0})}function L4(Q,Y){return new Y8({check:"multiple_of",...E(Y),value:Q})}function F4(Q,Y){return new W8({check:"max_length",...E(Y),maximum:Q})}function x1(Q,Y){return new G8({check:"min_length",...E(Y),minimum:Q})}function q4(Q,Y){return new $8({check:"length_equals",...E(Y),length:Q})}function rQ(Q,Y){return new z8({check:"string_format",format:"regex",...E(Y),pattern:Q})}function dQ(Q){return new J8({check:"string_format",format:"lowercase",...E(Q)})}function oQ(Q){return new H8({check:"string_format",format:"uppercase",...E(Q)})}function tQ(Q,Y){return new U8({check:"string_format",format:"includes",...E(Y),includes:Q})}function aQ(Q,Y){return new A8({check:"string_format",format:"starts_with",...E(Y),prefix:Q})}function sQ(Q,Y){return new B8({check:"string_format",format:"ends_with",...E(Y),suffix:Q})}function w1(Q){return new K8({check:"overwrite",tx:Q})}function eQ(Q){return w1((Y)=>Y.normalize(Q))}function Q9(){return w1((Q)=>Q.trim())}function Y9(){return w1((Q)=>Q.toLowerCase())}function X9(){return w1((Q)=>Q.toUpperCase())}function tW(Q,Y,X){return new Q({type:"array",element:Y,...E(X)})}function aW(Q,Y,X){let W=E(X);return W.abort??(W.abort=!0),new Q({type:"custom",check:"custom",fn:Y,...W})}function sW(Q,Y,X){return new Q({type:"custom",check:"custom",fn:Y,...E(X)})}function eW(Q){let Y=dH((X)=>{return X.addIssue=(W)=>{if(typeof W==="string")X.issues.push(v1(W,X.value,Y._zod.def));else{let G=W;if(G.fatal)G.continue=!1;G.code??(G.code="custom"),G.input??(G.input=X.value),G.inst??(G.inst=Y),G.continue??(G.continue=!Y._zod.def.abort),X.issues.push(v1(G))}},Q(X.value,X)});return Y}function dH(Q,Y){let X=new H0({check:"custom",...E(Y)});return X._zod.check=Q,X}function _1(Q){return!!Q._zod}function H1(Q,Y){if(_1(Q))return J6(Q,Y);return Q.safeParse(Y)}function O4(Q){if(!Q)return;let Y;if(_1(Q))Y=Q._zod?.def?.shape;else Y=Q.shape;if(!Y)return;if(typeof Y==="function")try{return Y()}catch{return}return Y}function QG(Q){if(_1(Q)){let $=Q._zod?.def;if($){if($.value!==void 0)return $.value;if(Array.isArray($.values)&&$.values.length>0)return $.values[0]}}let X=Q._def;if(X){if(X.value!==void 0)return X.value;if(Array.isArray(X.values)&&X.values.length>0)return X.values[0]}let W=Q.value;if(W!==void 0)return W;return}var L6={};QX(L6,{time:()=>$9,duration:()=>z9,datetime:()=>W9,date:()=>G9,ZodISOTime:()=>WG,ZodISODuration:()=>GG,ZodISODateTime:()=>YG,ZodISODate:()=>XG});var YG=q("ZodISODateTime",(Q,Y)=>{x8.init(Q,Y),s.init(Q,Y)});function W9(Q){return fW(YG,Q)}var XG=q("ZodISODate",(Q,Y)=>{_8.init(Q,Y),s.init(Q,Y)});function G9(Q){return lW(XG,Q)}var WG=q("ZodISOTime",(Q,Y)=>{g8.init(Q,Y),s.init(Q,Y)});function $9(Q){return mW(WG,Q)}var GG=q("ZodISODuration",(Q,Y)=>{y8.init(Q,Y),s.init(Q,Y)});function z9(Q){return cW(GG,Q)}var $G=(Q,Y)=>{G4.init(Q,Y),Q.name="ZodError",Object.defineProperties(Q,{format:{value:(X)=>qX(Q,X)},flatten:{value:(X)=>FX(Q,X)},addIssue:{value:(X)=>{Q.issues.push(X),Q.message=JSON.stringify(Q.issues,C1,2)}},addIssues:{value:(X)=>{Q.issues.push(...X),Q.message=JSON.stringify(Q.issues,C1,2)}},isEmpty:{get(){return Q.issues.length===0}}})},rN=q("ZodError",$G),P0=q("ZodError",$G,{Parent:Error});var zG=$4(P0),JG=z4(P0),HG=z6(P0),UG=H6(P0),AG=OX(P0),BG=MX(P0),KG=VX(P0),DG=NX(P0),LG=ZX(P0),FG=wX(P0),qG=jX(P0),OG=PX(P0);var X0=q("ZodType",(Q,Y)=>{return o.init(Q,Y),Q.def=Y,Q.type=Y.type,Object.defineProperty(Q,"_def",{value:Y}),Q.check=(...X)=>{return Q.clone(m.mergeDefs(Y,{checks:[...Y.checks??[],...X.map((W)=>typeof W==="function"?{_zod:{check:W,def:{check:"custom"},onattach:[]}}:W)]}))},Q.clone=(X,W)=>k0(Q,X,W),Q.brand=()=>Q,Q.register=(X,W)=>{return X.add(Q,W),Q},Q.parse=(X,W)=>zG(Q,X,W,{callee:Q.parse}),Q.safeParse=(X,W)=>HG(Q,X,W),Q.parseAsync=async(X,W)=>JG(Q,X,W,{callee:Q.parseAsync}),Q.safeParseAsync=async(X,W)=>UG(Q,X,W),Q.spa=Q.safeParseAsync,Q.encode=(X,W)=>AG(Q,X,W),Q.decode=(X,W)=>BG(Q,X,W),Q.encodeAsync=async(X,W)=>KG(Q,X,W),Q.decodeAsync=async(X,W)=>DG(Q,X,W),Q.safeEncode=(X,W)=>LG(Q,X,W),Q.safeDecode=(X,W)=>FG(Q,X,W),Q.safeEncodeAsync=async(X,W)=>qG(Q,X,W),Q.safeDecodeAsync=async(X,W)=>OG(Q,X,W),Q.refine=(X,W)=>Q.check(p3(X,W)),Q.superRefine=(X)=>Q.check(i3(X)),Q.overwrite=(X)=>Q.check(w1(X)),Q.optional=()=>Y0(Q),Q.nullable=()=>NG(Q),Q.nullish=()=>Y0(NG(Q)),Q.nonoptional=(X)=>u3(Q,X),Q.array=()=>u(Q),Q.or=(X)=>d([Q,X]),Q.and=(X)=>V4(Q,X),Q.transform=(X)=>H9(Q,bG(X)),Q.default=(X)=>_3(Q,X),Q.prefault=(X)=>y3(Q,X),Q.catch=(X)=>f3(Q,X),Q.pipe=(X)=>H9(Q,X),Q.readonly=()=>c3(Q),Q.describe=(X)=>{let W=Q.clone();return A6.add(W,{description:X}),W},Object.defineProperty(Q,"description",{get(){return A6.get(Q)?.description},configurable:!0}),Q.meta=(...X)=>{if(X.length===0)return A6.get(Q);let W=Q.clone();return A6.add(W,X[0]),W},Q.isOptional=()=>Q.safeParse(void 0).success,Q.isNullable=()=>Q.safeParse(null).success,Q}),ZG=q("_ZodString",(Q,Y)=>{B4.init(Q,Y),X0.init(Q,Y);let X=Q._zod.bag;Q.format=X.format??null,Q.minLength=X.minimum??null,Q.maxLength=X.maximum??null,Q.regex=(...W)=>Q.check(rQ(...W)),Q.includes=(...W)=>Q.check(tQ(...W)),Q.startsWith=(...W)=>Q.check(aQ(...W)),Q.endsWith=(...W)=>Q.check(sQ(...W)),Q.min=(...W)=>Q.check(x1(...W)),Q.max=(...W)=>Q.check(F4(...W)),Q.length=(...W)=>Q.check(q4(...W)),Q.nonempty=(...W)=>Q.check(x1(1,...W)),Q.lowercase=(W)=>Q.check(dQ(W)),Q.uppercase=(W)=>Q.check(oQ(W)),Q.trim=()=>Q.check(Q9()),Q.normalize=(...W)=>Q.check(eQ(...W)),Q.toLowerCase=()=>Q.check(Y9()),Q.toUpperCase=()=>Q.check(X9())}),W3=q("ZodString",(Q,Y)=>{B4.init(Q,Y),ZG.init(Q,Y),Q.email=(X)=>Q.check(VW(G3,X)),Q.url=(X)=>Q.check(PW($3,X)),Q.jwt=(X)=>Q.check(hW(N3,X)),Q.emoji=(X)=>Q.check(bW(z3,X)),Q.guid=(X)=>Q.check(nQ(MG,X)),Q.uuid=(X)=>Q.check(NW(M4,X)),Q.uuidv4=(X)=>Q.check(ZW(M4,X)),Q.uuidv6=(X)=>Q.check(wW(M4,X)),Q.uuidv7=(X)=>Q.check(jW(M4,X)),Q.nanoid=(X)=>Q.check(IW(J3,X)),Q.guid=(X)=>Q.check(nQ(MG,X)),Q.cuid=(X)=>Q.check(EW(H3,X)),Q.cuid2=(X)=>Q.check(TW(U3,X)),Q.ulid=(X)=>Q.check(SW(A3,X)),Q.base64=(X)=>Q.check(gW(O3,X)),Q.base64url=(X)=>Q.check(yW(M3,X)),Q.xid=(X)=>Q.check(RW(B3,X)),Q.ksuid=(X)=>Q.check(CW(K3,X)),Q.ipv4=(X)=>Q.check(kW(D3,X)),Q.ipv6=(X)=>Q.check(vW(L3,X)),Q.cidrv4=(X)=>Q.check(xW(F3,X)),Q.cidrv6=(X)=>Q.check(_W(q3,X)),Q.e164=(X)=>Q.check(uW(V3,X)),Q.datetime=(X)=>Q.check(W9(X)),Q.date=(X)=>Q.check(G9(X)),Q.time=(X)=>Q.check($9(X)),Q.duration=(X)=>Q.check(z9(X))});function F(Q){return MW(W3,Q)}var s=q("ZodStringFormat",(Q,Y)=>{t.init(Q,Y),ZG.init(Q,Y)}),G3=q("ZodEmail",(Q,Y)=>{b8.init(Q,Y),s.init(Q,Y)});var MG=q("ZodGUID",(Q,Y)=>{j8.init(Q,Y),s.init(Q,Y)});var M4=q("ZodUUID",(Q,Y)=>{P8.init(Q,Y),s.init(Q,Y)});var $3=q("ZodURL",(Q,Y)=>{I8.init(Q,Y),s.init(Q,Y)});var z3=q("ZodEmoji",(Q,Y)=>{E8.init(Q,Y),s.init(Q,Y)});var J3=q("ZodNanoID",(Q,Y)=>{T8.init(Q,Y),s.init(Q,Y)});var H3=q("ZodCUID",(Q,Y)=>{S8.init(Q,Y),s.init(Q,Y)});var U3=q("ZodCUID2",(Q,Y)=>{R8.init(Q,Y),s.init(Q,Y)});var A3=q("ZodULID",(Q,Y)=>{C8.init(Q,Y),s.init(Q,Y)});var B3=q("ZodXID",(Q,Y)=>{k8.init(Q,Y),s.init(Q,Y)});var K3=q("ZodKSUID",(Q,Y)=>{v8.init(Q,Y),s.init(Q,Y)});var D3=q("ZodIPv4",(Q,Y)=>{u8.init(Q,Y),s.init(Q,Y)});var L3=q("ZodIPv6",(Q,Y)=>{h8.init(Q,Y),s.init(Q,Y)});var F3=q("ZodCIDRv4",(Q,Y)=>{f8.init(Q,Y),s.init(Q,Y)});var q3=q("ZodCIDRv6",(Q,Y)=>{l8.init(Q,Y),s.init(Q,Y)});var O3=q("ZodBase64",(Q,Y)=>{c8.init(Q,Y),s.init(Q,Y)});var M3=q("ZodBase64URL",(Q,Y)=>{p8.init(Q,Y),s.init(Q,Y)});var V3=q("ZodE164",(Q,Y)=>{i8.init(Q,Y),s.init(Q,Y)});var N3=q("ZodJWT",(Q,Y)=>{n8.init(Q,Y),s.init(Q,Y)});var wG=q("ZodNumber",(Q,Y)=>{cQ.init(Q,Y),X0.init(Q,Y),Q.gt=(W,G)=>Q.check(D4(W,G)),Q.gte=(W,G)=>Q.check(K6(W,G)),Q.min=(W,G)=>Q.check(K6(W,G)),Q.lt=(W,G)=>Q.check(K4(W,G)),Q.lte=(W,G)=>Q.check(B6(W,G)),Q.max=(W,G)=>Q.check(B6(W,G)),Q.int=(W)=>Q.check(VG(W)),Q.safe=(W)=>Q.check(VG(W)),Q.positive=(W)=>Q.check(D4(0,W)),Q.nonnegative=(W)=>Q.check(K6(0,W)),Q.negative=(W)=>Q.check(K4(0,W)),Q.nonpositive=(W)=>Q.check(B6(0,W)),Q.multipleOf=(W,G)=>Q.check(L4(W,G)),Q.step=(W,G)=>Q.check(L4(W,G)),Q.finite=()=>Q;let X=Q._zod.bag;Q.minValue=Math.max(X.minimum??Number.NEGATIVE_INFINITY,X.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,Q.maxValue=Math.min(X.maximum??Number.POSITIVE_INFINITY,X.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,Q.isInt=(X.format??"").includes("int")||Number.isSafeInteger(X.multipleOf??0.5),Q.isFinite=!0,Q.format=X.format??null});function p(Q){return pW(wG,Q)}var Z3=q("ZodNumberFormat",(Q,Y)=>{r8.init(Q,Y),wG.init(Q,Y)});function VG(Q){return iW(Z3,Q)}var w3=q("ZodBoolean",(Q,Y)=>{d8.init(Q,Y),X0.init(Q,Y)});function z0(Q){return nW(w3,Q)}var j3=q("ZodNull",(Q,Y)=>{o8.init(Q,Y),X0.init(Q,Y)});function U9(Q){return rW(j3,Q)}var P3=q("ZodUnknown",(Q,Y)=>{t8.init(Q,Y),X0.init(Q,Y)});function e(){return dW(P3)}var b3=q("ZodNever",(Q,Y)=>{a8.init(Q,Y),X0.init(Q,Y)});function I3(Q){return oW(b3,Q)}var E3=q("ZodArray",(Q,Y)=>{s8.init(Q,Y),X0.init(Q,Y),Q.element=Y.element,Q.min=(X,W)=>Q.check(x1(X,W)),Q.nonempty=(X)=>Q.check(x1(1,X)),Q.max=(X,W)=>Q.check(F4(X,W)),Q.length=(X,W)=>Q.check(q4(X,W)),Q.unwrap=()=>Q.element});function u(Q,Y){return tW(E3,Q,Y)}var jG=q("ZodObject",(Q,Y)=>{YW.init(Q,Y),X0.init(Q,Y),m.defineLazy(Q,"shape",()=>{return Y.shape}),Q.keyof=()=>M0(Object.keys(Q._zod.def.shape)),Q.catchall=(X)=>Q.clone({...Q._zod.def,catchall:X}),Q.passthrough=()=>Q.clone({...Q._zod.def,catchall:e()}),Q.loose=()=>Q.clone({...Q._zod.def,catchall:e()}),Q.strict=()=>Q.clone({...Q._zod.def,catchall:I3()}),Q.strip=()=>Q.clone({...Q._zod.def,catchall:void 0}),Q.extend=(X)=>{return m.extend(Q,X)},Q.safeExtend=(X)=>{return m.safeExtend(Q,X)},Q.merge=(X)=>m.merge(Q,X),Q.pick=(X)=>m.pick(Q,X),Q.omit=(X)=>m.omit(Q,X),Q.partial=(...X)=>m.partial(IG,Q,X[0]),Q.required=(...X)=>m.required(EG,Q,X[0])});function P(Q,Y){let X={type:"object",shape:Q??{},...m.normalizeParams(Y)};return new jG(X)}function F0(Q,Y){return new jG({type:"object",shape:Q,catchall:e(),...m.normalizeParams(Y)})}var PG=q("ZodUnion",(Q,Y)=>{pQ.init(Q,Y),X0.init(Q,Y),Q.options=Y.options});function d(Q,Y){return new PG({type:"union",options:Q,...m.normalizeParams(Y)})}var T3=q("ZodDiscriminatedUnion",(Q,Y)=>{PG.init(Q,Y),XW.init(Q,Y)});function A9(Q,Y,X){return new T3({type:"union",options:Y,discriminator:Q,...m.normalizeParams(X)})}var S3=q("ZodIntersection",(Q,Y)=>{WW.init(Q,Y),X0.init(Q,Y)});function V4(Q,Y){return new S3({type:"intersection",left:Q,right:Y})}var R3=q("ZodRecord",(Q,Y)=>{GW.init(Q,Y),X0.init(Q,Y),Q.keyType=Y.keyType,Q.valueType=Y.valueType});function Q0(Q,Y,X){return new R3({type:"record",keyType:Q,valueType:Y,...m.normalizeParams(X)})}var J9=q("ZodEnum",(Q,Y)=>{$W.init(Q,Y),X0.init(Q,Y),Q.enum=Y.entries,Q.options=Object.values(Y.entries);let X=new Set(Object.keys(Y.entries));Q.extract=(W,G)=>{let $={};for(let z of W)if(X.has(z))$[z]=Y.entries[z];else throw Error(`Key ${z} not found in enum`);return new J9({...Y,checks:[],...m.normalizeParams(G),entries:$})},Q.exclude=(W,G)=>{let $={...Y.entries};for(let z of W)if(X.has(z))delete $[z];else throw Error(`Key ${z} not found in enum`);return new J9({...Y,checks:[],...m.normalizeParams(G),entries:$})}});function M0(Q,Y){let X=Array.isArray(Q)?Object.fromEntries(Q.map((W)=>[W,W])):Q;return new J9({type:"enum",entries:X,...m.normalizeParams(Y)})}var C3=q("ZodLiteral",(Q,Y)=>{zW.init(Q,Y),X0.init(Q,Y),Q.values=new Set(Y.values),Object.defineProperty(Q,"value",{get(){if(Y.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return Y.values[0]}})});function b(Q,Y){return new C3({type:"literal",values:Array.isArray(Q)?Q:[Q],...m.normalizeParams(Y)})}var k3=q("ZodTransform",(Q,Y)=>{JW.init(Q,Y),X0.init(Q,Y),Q._zod.parse=(X,W)=>{if(W.direction==="backward")throw new Y6(Q.constructor.name);X.addIssue=($)=>{if(typeof $==="string")X.issues.push(m.issue($,X.value,Y));else{let z=$;if(z.fatal)z.continue=!1;z.code??(z.code="custom"),z.input??(z.input=X.value),z.inst??(z.inst=Q),X.issues.push(m.issue(z))}};let G=Y.transform(X.value,X);if(G instanceof Promise)return G.then(($)=>{return X.value=$,X});return X.value=G,X}});function bG(Q){return new k3({type:"transform",transform:Q})}var IG=q("ZodOptional",(Q,Y)=>{HW.init(Q,Y),X0.init(Q,Y),Q.unwrap=()=>Q._zod.def.innerType});function Y0(Q){return new IG({type:"optional",innerType:Q})}var v3=q("ZodNullable",(Q,Y)=>{UW.init(Q,Y),X0.init(Q,Y),Q.unwrap=()=>Q._zod.def.innerType});function NG(Q){return new v3({type:"nullable",innerType:Q})}var x3=q("ZodDefault",(Q,Y)=>{AW.init(Q,Y),X0.init(Q,Y),Q.unwrap=()=>Q._zod.def.innerType,Q.removeDefault=Q.unwrap});function _3(Q,Y){return new x3({type:"default",innerType:Q,get defaultValue(){return typeof Y==="function"?Y():m.shallowClone(Y)}})}var g3=q("ZodPrefault",(Q,Y)=>{BW.init(Q,Y),X0.init(Q,Y),Q.unwrap=()=>Q._zod.def.innerType});function y3(Q,Y){return new g3({type:"prefault",innerType:Q,get defaultValue(){return typeof Y==="function"?Y():m.shallowClone(Y)}})}var EG=q("ZodNonOptional",(Q,Y)=>{KW.init(Q,Y),X0.init(Q,Y),Q.unwrap=()=>Q._zod.def.innerType});function u3(Q,Y){return new EG({type:"nonoptional",innerType:Q,...m.normalizeParams(Y)})}var h3=q("ZodCatch",(Q,Y)=>{DW.init(Q,Y),X0.init(Q,Y),Q.unwrap=()=>Q._zod.def.innerType,Q.removeCatch=Q.unwrap});function f3(Q,Y){return new h3({type:"catch",innerType:Q,catchValue:typeof Y==="function"?Y:()=>Y})}var l3=q("ZodPipe",(Q,Y)=>{LW.init(Q,Y),X0.init(Q,Y),Q.in=Y.in,Q.out=Y.out});function H9(Q,Y){return new l3({type:"pipe",in:Q,out:Y})}var m3=q("ZodReadonly",(Q,Y)=>{FW.init(Q,Y),X0.init(Q,Y),Q.unwrap=()=>Q._zod.def.innerType});function c3(Q){return new m3({type:"readonly",innerType:Q})}var TG=q("ZodCustom",(Q,Y)=>{qW.init(Q,Y),X0.init(Q,Y)});function SG(Q,Y){return aW(TG,Q??(()=>!0),Y)}function p3(Q,Y={}){return sW(TG,Q,Y)}function i3(Q){return eW(Q)}function B9(Q,Y){return H9(bG(Q),Y)}I0(iQ());var K9="2025-11-25";var RG=[K9,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],U1="io.modelcontextprotocol/related-task",Z4="2.0",U0=SG((Q)=>Q!==null&&(typeof Q==="object"||typeof Q==="function")),CG=d([F(),p().int()]),kG=F(),mZ=F0({ttl:d([p(),U9()]).optional(),pollInterval:p().optional()}),n3=P({ttl:p().optional()}),r3=P({taskId:F()}),D9=F0({progressToken:CG.optional(),[U1]:r3.optional()}),b0=P({_meta:D9.optional()}),F6=b0.extend({task:n3.optional()}),vG=(Q)=>F6.safeParse(Q).success,A0=P({method:F(),params:b0.loose().optional()}),E0=P({_meta:D9.optional()}),T0=P({method:F(),params:E0.loose().optional()}),B0=F0({_meta:D9.optional()}),w4=d([F(),p().int()]),xG=P({jsonrpc:b(Z4),id:w4,...A0.shape}).strict(),L9=(Q)=>xG.safeParse(Q).success,_G=P({jsonrpc:b(Z4),...T0.shape}).strict(),gG=(Q)=>_G.safeParse(Q).success,F9=P({jsonrpc:b(Z4),id:w4,result:B0}).strict(),q6=(Q)=>F9.safeParse(Q).success;var h;(function(Q){Q[Q.ConnectionClosed=-32000]="ConnectionClosed",Q[Q.RequestTimeout=-32001]="RequestTimeout",Q[Q.ParseError=-32700]="ParseError",Q[Q.InvalidRequest=-32600]="InvalidRequest",Q[Q.MethodNotFound=-32601]="MethodNotFound",Q[Q.InvalidParams=-32602]="InvalidParams",Q[Q.InternalError=-32603]="InternalError",Q[Q.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(h||(h={}));var q9=P({jsonrpc:b(Z4),id:w4.optional(),error:P({code:p().int(),message:F(),data:e().optional()})}).strict();var yG=(Q)=>q9.safeParse(Q).success;var cZ=d([xG,_G,F9,q9]),pZ=d([F9,q9]),j4=B0.strict(),d3=E0.extend({requestId:w4.optional(),reason:F().optional()}),P4=T0.extend({method:b("notifications/cancelled"),params:d3}),o3=P({src:F(),mimeType:F().optional(),sizes:u(F()).optional(),theme:M0(["light","dark"]).optional()}),O6=P({icons:u(o3).optional()}),g1=P({name:F(),title:F().optional()}),uG=g1.extend({...g1.shape,...O6.shape,version:F(),websiteUrl:F().optional(),description:F().optional()}),t3=V4(P({applyDefaults:z0().optional()}),Q0(F(),e())),a3=B9((Q)=>{if(Q&&typeof Q==="object"&&!Array.isArray(Q)){if(Object.keys(Q).length===0)return{form:{}}}return Q},V4(P({form:t3.optional(),url:U0.optional()}),Q0(F(),e()).optional())),s3=F0({list:U0.optional(),cancel:U0.optional(),requests:F0({sampling:F0({createMessage:U0.optional()}).optional(),elicitation:F0({create:U0.optional()}).optional()}).optional()}),e3=F0({list:U0.optional(),cancel:U0.optional(),requests:F0({tools:F0({call:U0.optional()}).optional()}).optional()}),QU=P({experimental:Q0(F(),U0).optional(),sampling:P({context:U0.optional(),tools:U0.optional()}).optional(),elicitation:a3.optional(),roots:P({listChanged:z0().optional()}).optional(),tasks:s3.optional()}),YU=b0.extend({protocolVersion:F(),capabilities:QU,clientInfo:uG}),O9=A0.extend({method:b("initialize"),params:YU});var XU=P({experimental:Q0(F(),U0).optional(),logging:U0.optional(),completions:U0.optional(),prompts:P({listChanged:z0().optional()}).optional(),resources:P({subscribe:z0().optional(),listChanged:z0().optional()}).optional(),tools:P({listChanged:z0().optional()}).optional(),tasks:e3.optional()}),WU=B0.extend({protocolVersion:F(),capabilities:XU,serverInfo:uG,instructions:F().optional()}),M9=T0.extend({method:b("notifications/initialized"),params:E0.optional()});var b4=A0.extend({method:b("ping"),params:b0.optional()}),GU=P({progress:p(),total:Y0(p()),message:Y0(F())}),$U=P({...E0.shape,...GU.shape,progressToken:CG}),I4=T0.extend({method:b("notifications/progress"),params:$U}),zU=b0.extend({cursor:kG.optional()}),M6=A0.extend({params:zU.optional()}),V6=B0.extend({nextCursor:kG.optional()}),JU=M0(["working","input_required","completed","failed","cancelled"]),N6=P({taskId:F(),status:JU,ttl:d([p(),U9()]),createdAt:F(),lastUpdatedAt:F(),pollInterval:Y0(p()),statusMessage:Y0(F())}),y1=B0.extend({task:N6}),HU=E0.merge(N6),Z6=T0.extend({method:b("notifications/tasks/status"),params:HU}),E4=A0.extend({method:b("tasks/get"),params:b0.extend({taskId:F()})}),T4=B0.merge(N6),S4=A0.extend({method:b("tasks/result"),params:b0.extend({taskId:F()})}),iZ=B0.loose(),R4=M6.extend({method:b("tasks/list")}),C4=V6.extend({tasks:u(N6)}),k4=A0.extend({method:b("tasks/cancel"),params:b0.extend({taskId:F()})}),hG=B0.merge(N6),fG=P({uri:F(),mimeType:Y0(F()),_meta:Q0(F(),e()).optional()}),lG=fG.extend({text:F()}),V9=F().refine((Q)=>{try{return atob(Q),!0}catch{return!1}},{message:"Invalid Base64 string"}),mG=fG.extend({blob:V9}),w6=M0(["user","assistant"]),u1=P({audience:u(w6).optional(),priority:p().min(0).max(1).optional(),lastModified:L6.datetime({offset:!0}).optional()}),cG=P({...g1.shape,...O6.shape,uri:F(),description:Y0(F()),mimeType:Y0(F()),annotations:u1.optional(),_meta:Y0(F0({}))}),UU=P({...g1.shape,...O6.shape,uriTemplate:F(),description:Y0(F()),mimeType:Y0(F()),annotations:u1.optional(),_meta:Y0(F0({}))}),N9=M6.extend({method:b("resources/list")}),AU=V6.extend({resources:u(cG)}),BU=M6.extend({method:b("resources/templates/list")}),KU=V6.extend({resourceTemplates:u(UU)}),Z9=b0.extend({uri:F()}),DU=Z9,w9=A0.extend({method:b("resources/read"),params:DU}),LU=B0.extend({contents:u(d([lG,mG]))}),FU=T0.extend({method:b("notifications/resources/list_changed"),params:E0.optional()}),qU=Z9,OU=A0.extend({method:b("resources/subscribe"),params:qU}),MU=Z9,VU=A0.extend({method:b("resources/unsubscribe"),params:MU}),NU=E0.extend({uri:F()}),ZU=T0.extend({method:b("notifications/resources/updated"),params:NU}),wU=P({name:F(),description:Y0(F()),required:Y0(z0())}),jU=P({...g1.shape,...O6.shape,description:Y0(F()),arguments:Y0(u(wU)),_meta:Y0(F0({}))}),PU=M6.extend({method:b("prompts/list")}),bU=V6.extend({prompts:u(jU)}),IU=b0.extend({name:F(),arguments:Q0(F(),F()).optional()}),EU=A0.extend({method:b("prompts/get"),params:IU}),j9=P({type:b("text"),text:F(),annotations:u1.optional(),_meta:Q0(F(),e()).optional()}),P9=P({type:b("image"),data:V9,mimeType:F(),annotations:u1.optional(),_meta:Q0(F(),e()).optional()}),b9=P({type:b("audio"),data:V9,mimeType:F(),annotations:u1.optional(),_meta:Q0(F(),e()).optional()}),TU=P({type:b("tool_use"),name:F(),id:F(),input:Q0(F(),e()),_meta:Q0(F(),e()).optional()}),SU=P({type:b("resource"),resource:d([lG,mG]),annotations:u1.optional(),_meta:Q0(F(),e()).optional()}),RU=cG.extend({type:b("resource_link")}),I9=d([j9,P9,b9,RU,SU]),CU=P({role:w6,content:I9}),kU=B0.extend({description:F().optional(),messages:u(CU)}),vU=T0.extend({method:b("notifications/prompts/list_changed"),params:E0.optional()}),xU=P({title:F().optional(),readOnlyHint:z0().optional(),destructiveHint:z0().optional(),idempotentHint:z0().optional(),openWorldHint:z0().optional()}),_U=P({taskSupport:M0(["required","optional","forbidden"]).optional()}),pG=P({...g1.shape,...O6.shape,description:F().optional(),inputSchema:P({type:b("object"),properties:Q0(F(),U0).optional(),required:u(F()).optional()}).catchall(e()),outputSchema:P({type:b("object"),properties:Q0(F(),U0).optional(),required:u(F()).optional()}).catchall(e()).optional(),annotations:xU.optional(),execution:_U.optional(),_meta:Q0(F(),e()).optional()}),E9=M6.extend({method:b("tools/list")}),gU=V6.extend({tools:u(pG)}),v4=B0.extend({content:u(I9).default([]),structuredContent:Q0(F(),e()).optional(),isError:z0().optional()}),nZ=v4.or(B0.extend({toolResult:e()})),yU=F6.extend({name:F(),arguments:Q0(F(),e()).optional()}),j6=A0.extend({method:b("tools/call"),params:yU}),uU=T0.extend({method:b("notifications/tools/list_changed"),params:E0.optional()}),rZ=P({autoRefresh:z0().default(!0),debounceMs:p().int().nonnegative().default(300)}),P6=M0(["debug","info","notice","warning","error","critical","alert","emergency"]),hU=b0.extend({level:P6}),T9=A0.extend({method:b("logging/setLevel"),params:hU}),fU=E0.extend({level:P6,logger:F().optional(),data:e()}),lU=T0.extend({method:b("notifications/message"),params:fU}),mU=P({name:F().optional()}),cU=P({hints:u(mU).optional(),costPriority:p().min(0).max(1).optional(),speedPriority:p().min(0).max(1).optional(),intelligencePriority:p().min(0).max(1).optional()}),pU=P({mode:M0(["auto","required","none"]).optional()}),iU=P({type:b("tool_result"),toolUseId:F().describe("The unique identifier for the corresponding tool call."),content:u(I9).default([]),structuredContent:P({}).loose().optional(),isError:z0().optional(),_meta:Q0(F(),e()).optional()}),nU=A9("type",[j9,P9,b9]),N4=A9("type",[j9,P9,b9,TU,iU]),rU=P({role:w6,content:d([N4,u(N4)]),_meta:Q0(F(),e()).optional()}),dU=F6.extend({messages:u(rU),modelPreferences:cU.optional(),systemPrompt:F().optional(),includeContext:M0(["none","thisServer","allServers"]).optional(),temperature:p().optional(),maxTokens:p().int(),stopSequences:u(F()).optional(),metadata:U0.optional(),tools:u(pG).optional(),toolChoice:pU.optional()}),oU=A0.extend({method:b("sampling/createMessage"),params:dU}),S9=B0.extend({model:F(),stopReason:Y0(M0(["endTurn","stopSequence","maxTokens"]).or(F())),role:w6,content:nU}),R9=B0.extend({model:F(),stopReason:Y0(M0(["endTurn","stopSequence","maxTokens","toolUse"]).or(F())),role:w6,content:d([N4,u(N4)])}),tU=P({type:b("boolean"),title:F().optional(),description:F().optional(),default:z0().optional()}),aU=P({type:b("string"),title:F().optional(),description:F().optional(),minLength:p().optional(),maxLength:p().optional(),format:M0(["email","uri","date","date-time"]).optional(),default:F().optional()}),sU=P({type:M0(["number","integer"]),title:F().optional(),description:F().optional(),minimum:p().optional(),maximum:p().optional(),default:p().optional()}),eU=P({type:b("string"),title:F().optional(),description:F().optional(),enum:u(F()),default:F().optional()}),QA=P({type:b("string"),title:F().optional(),description:F().optional(),oneOf:u(P({const:F(),title:F()})),default:F().optional()}),YA=P({type:b("string"),title:F().optional(),description:F().optional(),enum:u(F()),enumNames:u(F()).optional(),default:F().optional()}),XA=d([eU,QA]),WA=P({type:b("array"),title:F().optional(),description:F().optional(),minItems:p().optional(),maxItems:p().optional(),items:P({type:b("string"),enum:u(F())}),default:u(F()).optional()}),GA=P({type:b("array"),title:F().optional(),description:F().optional(),minItems:p().optional(),maxItems:p().optional(),items:P({anyOf:u(P({const:F(),title:F()}))}),default:u(F()).optional()}),$A=d([WA,GA]),zA=d([YA,XA,$A]),JA=d([zA,tU,aU,sU]),HA=F6.extend({mode:b("form").optional(),message:F(),requestedSchema:P({type:b("object"),properties:Q0(F(),JA),required:u(F()).optional()})}),UA=F6.extend({mode:b("url"),message:F(),elicitationId:F(),url:F().url()}),AA=d([HA,UA]),BA=A0.extend({method:b("elicitation/create"),params:AA}),KA=E0.extend({elicitationId:F()}),DA=T0.extend({method:b("notifications/elicitation/complete"),params:KA}),x4=B0.extend({action:M0(["accept","decline","cancel"]),content:B9((Q)=>Q===null?void 0:Q,Q0(F(),d([F(),p(),z0(),u(F())])).optional())}),LA=P({type:b("ref/resource"),uri:F()});var FA=P({type:b("ref/prompt"),name:F()}),qA=b0.extend({ref:d([FA,LA]),argument:P({name:F(),value:F()}),context:P({arguments:Q0(F(),F()).optional()}).optional()}),OA=A0.extend({method:b("completion/complete"),params:qA});var MA=B0.extend({completion:F0({values:u(F()).max(100),total:Y0(p().int()),hasMore:Y0(z0())})}),VA=P({uri:F().startsWith("file://"),name:F().optional(),_meta:Q0(F(),e()).optional()}),NA=A0.extend({method:b("roots/list"),params:b0.optional()}),C9=B0.extend({roots:u(VA)}),ZA=T0.extend({method:b("notifications/roots/list_changed"),params:E0.optional()}),dZ=d([b4,O9,OA,T9,EU,PU,N9,BU,w9,OU,VU,j6,E9,E4,S4,R4,k4]),oZ=d([P4,I4,M9,ZA,Z6]),tZ=d([j4,S9,R9,x4,C9,T4,C4,y1]),aZ=d([b4,oU,BA,NA,E4,S4,R4,k4]),sZ=d([P4,I4,lU,ZU,FU,uU,vU,Z6,DA]),eZ=d([j4,WU,MA,kU,bU,AU,KU,LU,v4,gU,T4,C4,y1]);class _ extends Error{constructor(Q,Y,X){super(`MCP error ${Q}: ${Y}`);this.code=Q,this.data=X,this.name="McpError"}static fromError(Q,Y,X){if(Q===h.UrlElicitationRequired&&X){let W=X;if(W.elicitations)return new iG(W.elicitations,Y)}return new _(Q,Y,X)}}class iG extends _{constructor(Q,Y=`URL elicitation${Q.length>1?"s":""} required`){super(h.UrlElicitationRequired,Y,{elicitations:Q})}get elicitations(){return this.data?.elicitations??[]}}function A1(Q){return Q==="completed"||Q==="failed"||Q==="cancelled"}var wA=Symbol("Let zodToJsonSchema decide on which parser to use");var kw=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function k9(Q){let X=O4(Q)?.method;if(!X)throw Error("Schema is missing a method literal");let W=QG(X);if(typeof W!=="string")throw Error("Schema method literal must be a string");return W}function v9(Q,Y){let X=H1(Q,Y);if(!X.success)throw X.error;return X.data}var TA=60000;class x9{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(P4,(Y)=>{this._oncancel(Y)}),this.setNotificationHandler(I4,(Y)=>{this._onprogress(Y)}),this.setRequestHandler(b4,(Y)=>({})),this._taskStore=Q?.taskStore,this._taskMessageQueue=Q?.taskMessageQueue,this._taskStore)this.setRequestHandler(E4,async(Y,X)=>{let W=await this._taskStore.getTask(Y.params.taskId,X.sessionId);if(!W)throw new _(h.InvalidParams,"Failed to retrieve task: Task not found");return{...W}}),this.setRequestHandler(S4,async(Y,X)=>{let W=async()=>{let G=Y.params.taskId;if(this._taskMessageQueue){let z;while(z=await this._taskMessageQueue.dequeue(G,X.sessionId)){if(z.type==="response"||z.type==="error"){let J=z.message,H=J.id,U=this._requestResolvers.get(H);if(U)if(this._requestResolvers.delete(H),z.type==="response")U(J);else{let A=J,B=new _(A.error.code,A.error.message,A.error.data);U(B)}else{let A=z.type==="response"?"Response":"Error";this._onerror(Error(`${A} handler missing for request ${H}`))}continue}await this._transport?.send(z.message,{relatedRequestId:X.requestId})}}let $=await this._taskStore.getTask(G,X.sessionId);if(!$)throw new _(h.InvalidParams,`Task not found: ${G}`);if(!A1($.status))return await this._waitForTaskUpdate(G,X.signal),await W();if(A1($.status)){let z=await this._taskStore.getTaskResult(G,X.sessionId);return this._clearTaskQueue(G),{...z,_meta:{...z._meta,[U1]:{taskId:G}}}}return await W()};return await W()}),this.setRequestHandler(R4,async(Y,X)=>{try{let{tasks:W,nextCursor:G}=await this._taskStore.listTasks(Y.params?.cursor,X.sessionId);return{tasks:W,nextCursor:G,_meta:{}}}catch(W){throw new _(h.InvalidParams,`Failed to list tasks: ${W instanceof Error?W.message:String(W)}`)}}),this.setRequestHandler(k4,async(Y,X)=>{try{let W=await this._taskStore.getTask(Y.params.taskId,X.sessionId);if(!W)throw new _(h.InvalidParams,`Task not found: ${Y.params.taskId}`);if(A1(W.status))throw new _(h.InvalidParams,`Cannot cancel task in terminal status: ${W.status}`);await this._taskStore.updateTaskStatus(Y.params.taskId,"cancelled","Client cancelled task execution.",X.sessionId),this._clearTaskQueue(Y.params.taskId);let G=await this._taskStore.getTask(Y.params.taskId,X.sessionId);if(!G)throw new _(h.InvalidParams,`Task not found after cancellation: ${Y.params.taskId}`);return{_meta:{},...G}}catch(W){if(W instanceof _)throw W;throw new _(h.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,Y,X,W,G=!1){this._timeoutInfo.set(Q,{timeoutId:setTimeout(W,Y),startTime:Date.now(),timeout:Y,maxTotalTimeout:X,resetTimeoutOnProgress:G,onTimeout:W})}_resetTimeout(Q){let Y=this._timeoutInfo.get(Q);if(!Y)return!1;let X=Date.now()-Y.startTime;if(Y.maxTotalTimeout&&X>=Y.maxTotalTimeout)throw this._timeoutInfo.delete(Q),_.fromError(h.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:Y.maxTotalTimeout,totalElapsed:X});return clearTimeout(Y.timeoutId),Y.timeoutId=setTimeout(Y.onTimeout,Y.timeout),!0}_cleanupTimeout(Q){let Y=this._timeoutInfo.get(Q);if(Y)clearTimeout(Y.timeoutId),this._timeoutInfo.delete(Q)}async connect(Q){this._transport=Q;let Y=this.transport?.onclose;this._transport.onclose=()=>{Y?.(),this._onclose()};let X=this.transport?.onerror;this._transport.onerror=(G)=>{X?.(G),this._onerror(G)};let W=this._transport?.onmessage;this._transport.onmessage=(G,$)=>{if(W?.(G,$),q6(G)||yG(G))this._onresponse(G);else if(L9(G))this._onrequest(G,$);else if(gG(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 Y=_.fromError(h.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let X of Q.values())X(Y)}_onerror(Q){this.onerror?.(Q)}_onnotification(Q){let Y=this._notificationHandlers.get(Q.method)??this.fallbackNotificationHandler;if(Y===void 0)return;Promise.resolve().then(()=>Y(Q)).catch((X)=>this._onerror(Error(`Uncaught error in notification handler: ${X}`)))}_onrequest(Q,Y){let X=this._requestHandlers.get(Q.method)??this.fallbackRequestHandler,W=this._transport,G=Q.params?._meta?.[U1]?.taskId;if(X===void 0){let U={jsonrpc:"2.0",id:Q.id,error:{code:h.MethodNotFound,message:"Method not found"}};if(G&&this._taskMessageQueue)this._enqueueTaskMessage(G,{type:"error",message:U,timestamp:Date.now()},W?.sessionId).catch((A)=>this._onerror(Error(`Failed to enqueue error response: ${A}`)));else W?.send(U).catch((A)=>this._onerror(Error(`Failed to send an error response: ${A}`)));return}let $=new AbortController;this._requestHandlerAbortControllers.set(Q.id,$);let z=vG(Q.params)?Q.params.task:void 0,J=this._taskStore?this.requestTaskStore(Q,W?.sessionId):void 0,H={signal:$.signal,sessionId:W?.sessionId,_meta:Q.params?._meta,sendNotification:async(U)=>{let A={relatedRequestId:Q.id};if(G)A.relatedTask={taskId:G};await this.notification(U,A)},sendRequest:async(U,A,B)=>{let K={...B,relatedRequestId:Q.id};if(G&&!K.relatedTask)K.relatedTask={taskId:G};let D=K.relatedTask?.taskId??G;if(D&&J)await J.updateTaskStatus(D,"input_required");return await this.request(U,A,K)},authInfo:Y?.authInfo,requestId:Q.id,requestInfo:Y?.requestInfo,taskId:G,taskStore:J,taskRequestedTtl:z?.ttl,closeSSEStream:Y?.closeSSEStream,closeStandaloneSSEStream:Y?.closeStandaloneSSEStream};Promise.resolve().then(()=>{if(z)this.assertTaskHandlerCapability(Q.method)}).then(()=>X(Q,H)).then(async(U)=>{if($.signal.aborted)return;let A={result:U,jsonrpc:"2.0",id:Q.id};if(G&&this._taskMessageQueue)await this._enqueueTaskMessage(G,{type:"response",message:A,timestamp:Date.now()},W?.sessionId);else await W?.send(A)},async(U)=>{if($.signal.aborted)return;let A={jsonrpc:"2.0",id:Q.id,error:{code:Number.isSafeInteger(U.code)?U.code:h.InternalError,message:U.message??"Internal error",...U.data!==void 0&&{data:U.data}}};if(G&&this._taskMessageQueue)await this._enqueueTaskMessage(G,{type:"error",message:A,timestamp:Date.now()},W?.sessionId);else await W?.send(A)}).catch((U)=>this._onerror(Error(`Failed to send response: ${U}`))).finally(()=>{this._requestHandlerAbortControllers.delete(Q.id)})}_onprogress(Q){let{progressToken:Y,...X}=Q.params,W=Number(Y),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),z=this._timeoutInfo.get(W);if(z&&$&&z.resetTimeoutOnProgress)try{this._resetTimeout(W)}catch(J){this._responseHandlers.delete(W),this._progressHandlers.delete(W),this._cleanupTimeout(W),$(J);return}G(X)}_onresponse(Q){let Y=Number(Q.id),X=this._requestResolvers.get(Y);if(X){if(this._requestResolvers.delete(Y),q6(Q))X(Q);else{let $=new _(Q.error.code,Q.error.message,Q.error.data);X($)}return}let W=this._responseHandlers.get(Y);if(W===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(Q)}`));return}this._responseHandlers.delete(Y),this._cleanupTimeout(Y);let G=!1;if(q6(Q)&&Q.result&&typeof Q.result==="object"){let $=Q.result;if($.task&&typeof $.task==="object"){let z=$.task;if(typeof z.taskId==="string")G=!0,this._taskProgressTokens.set(z.taskId,Y)}}if(!G)this._progressHandlers.delete(Y);if(q6(Q))W(Q);else{let $=_.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,Y,X){let{task:W}=X??{};if(!W){try{yield{type:"result",result:await this.request(Q,Y,X)}}catch($){yield{type:"error",error:$ instanceof _?$:new _(h.InternalError,String($))}}return}let G;try{let $=await this.request(Q,y1,X);if($.task)G=$.task.taskId,yield{type:"taskCreated",task:$.task};else throw new _(h.InternalError,"Task creation did not return a task");while(!0){let z=await this.getTask({taskId:G},X);if(yield{type:"taskStatus",task:z},A1(z.status)){if(z.status==="completed")yield{type:"result",result:await this.getTaskResult({taskId:G},Y,X)};else if(z.status==="failed")yield{type:"error",error:new _(h.InternalError,`Task ${G} failed`)};else if(z.status==="cancelled")yield{type:"error",error:new _(h.InternalError,`Task ${G} was cancelled`)};return}if(z.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:G},Y,X)};return}let J=z.pollInterval??this._options?.defaultTaskPollInterval??1000;await new Promise((H)=>setTimeout(H,J)),X?.signal?.throwIfAborted()}}catch($){yield{type:"error",error:$ instanceof _?$:new _(h.InternalError,String($))}}}request(Q,Y,X){let{relatedRequestId:W,resumptionToken:G,onresumptiontoken:$,task:z,relatedTask:J}=X??{};return new Promise((H,U)=>{let A=(V)=>{U(V)};if(!this._transport){A(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod(Q.method),z)this.assertTaskCapability(Q.method)}catch(V){A(V);return}X?.signal?.throwIfAborted();let B=this._requestMessageId++,K={...Q,jsonrpc:"2.0",id:B};if(X?.onprogress)this._progressHandlers.set(B,X.onprogress),K.params={...Q.params,_meta:{...Q.params?._meta||{},progressToken:B}};if(z)K.params={...K.params,task:z};if(J)K.params={...K.params,_meta:{...K.params?._meta||{},[U1]:J}};let D=(V)=>{this._responseHandlers.delete(B),this._progressHandlers.delete(B),this._cleanupTimeout(B),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:B,reason:String(V)}},{relatedRequestId:W,resumptionToken:G,onresumptiontoken:$}).catch((T)=>this._onerror(Error(`Failed to send cancellation: ${T}`)));let R=V instanceof _?V:new _(h.RequestTimeout,String(V));U(R)};this._responseHandlers.set(B,(V)=>{if(X?.signal?.aborted)return;if(V instanceof Error)return U(V);try{let R=H1(Y,V.result);if(!R.success)U(R.error);else H(R.data)}catch(R){U(R)}}),X?.signal?.addEventListener("abort",()=>{D(X?.signal?.reason)});let O=X?.timeout??TA,M=()=>D(_.fromError(h.RequestTimeout,"Request timed out",{timeout:O}));this._setupTimeout(B,O,X?.maxTotalTimeout,M,X?.resetTimeoutOnProgress??!1);let Z=J?.taskId;if(Z){let V=(R)=>{let T=this._responseHandlers.get(B);if(T)T(R);else this._onerror(Error(`Response handler missing for side-channeled request ${B}`))};this._requestResolvers.set(B,V),this._enqueueTaskMessage(Z,{type:"request",message:K,timestamp:Date.now()}).catch((R)=>{this._cleanupTimeout(B),U(R)})}else this._transport.send(K,{relatedRequestId:W,resumptionToken:G,onresumptiontoken:$}).catch((V)=>{this._cleanupTimeout(B),U(V)})})}async getTask(Q,Y){return this.request({method:"tasks/get",params:Q},T4,Y)}async getTaskResult(Q,Y,X){return this.request({method:"tasks/result",params:Q},Y,X)}async listTasks(Q,Y){return this.request({method:"tasks/list",params:Q},C4,Y)}async cancelTask(Q,Y){return this.request({method:"tasks/cancel",params:Q},hG,Y)}async notification(Q,Y){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(Q.method);let X=Y?.relatedTask?.taskId;if(X){let z={...Q,jsonrpc:"2.0",params:{...Q.params,_meta:{...Q.params?._meta||{},[U1]:Y.relatedTask}}};await this._enqueueTaskMessage(X,{type:"notification",message:z,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(Q.method)&&!Q.params&&!Y?.relatedRequestId&&!Y?.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 z={...Q,jsonrpc:"2.0"};if(Y?.relatedTask)z={...z,params:{...z.params,_meta:{...z.params?._meta||{},[U1]:Y.relatedTask}}};this._transport?.send(z,Y).catch((J)=>this._onerror(J))});return}let $={...Q,jsonrpc:"2.0"};if(Y?.relatedTask)$={...$,params:{...$.params,_meta:{...$.params?._meta||{},[U1]:Y.relatedTask}}};await this._transport.send($,Y)}setRequestHandler(Q,Y){let X=k9(Q);this.assertRequestHandlerCapability(X),this._requestHandlers.set(X,(W,G)=>{let $=v9(Q,W);return Promise.resolve(Y($,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,Y){let X=k9(Q);this._notificationHandlers.set(X,(W)=>{let G=v9(Q,W);return Promise.resolve(Y(G))})}removeNotificationHandler(Q){this._notificationHandlers.delete(Q)}_cleanupTaskProgressHandler(Q){let Y=this._taskProgressTokens.get(Q);if(Y!==void 0)this._progressHandlers.delete(Y),this._taskProgressTokens.delete(Q)}async _enqueueTaskMessage(Q,Y,X){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,Y,X,W)}async _clearTaskQueue(Q,Y){if(this._taskMessageQueue){let X=await this._taskMessageQueue.dequeueAll(Q,Y);for(let W of X)if(W.type==="request"&&L9(W.message)){let G=W.message.id,$=this._requestResolvers.get(G);if($)$(new _(h.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,Y){let X=this._options?.defaultTaskPollInterval??1000;try{let W=await this._taskStore?.getTask(Q);if(W?.pollInterval)X=W.pollInterval}catch{}return new Promise((W,G)=>{if(Y.aborted){G(new _(h.InvalidRequest,"Request cancelled"));return}let $=setTimeout(W,X);Y.addEventListener("abort",()=>{clearTimeout($),G(new _(h.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(Q,Y){let X=this._taskStore;if(!X)throw Error("No task store configured");return{createTask:async(W)=>{if(!Q)throw Error("No request provided");return await X.createTask(W,Q.id,{method:Q.method,params:Q.params},Y)},getTask:async(W)=>{let G=await X.getTask(W,Y);if(!G)throw new _(h.InvalidParams,"Failed to retrieve task: Task not found");return G},storeTaskResult:async(W,G,$)=>{await X.storeTaskResult(W,G,$,Y);let z=await X.getTask(W,Y);if(z){let J=Z6.parse({method:"notifications/tasks/status",params:z});if(await this.notification(J),A1(z.status))this._cleanupTaskProgressHandler(W)}},getTaskResult:(W)=>{return X.getTaskResult(W,Y)},updateTaskStatus:async(W,G,$)=>{let z=await X.getTask(W,Y);if(!z)throw new _(h.InvalidParams,`Task "${W}" not found - it may have been cleaned up`);if(A1(z.status))throw new _(h.InvalidParams,`Cannot update task "${W}" from terminal status "${z.status}" to "${G}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await X.updateTaskStatus(W,G,$,Y);let J=await X.getTask(W,Y);if(J){let H=Z6.parse({method:"notifications/tasks/status",params:J});if(await this.notification(H),A1(J.status))this._cleanupTaskProgressHandler(W)}},listTasks:(W)=>{return X.listTasks(W,Y)}}}}function nG(Q){return Q!==null&&typeof Q==="object"&&!Array.isArray(Q)}function rG(Q,Y){let X={...Q};for(let W in Y){let G=W,$=Y[G];if($===void 0)continue;let z=X[G];if(nG(z)&&nG($))X[G]={...z,...$};else X[G]=$}return X}var P5=eY(TY(),1),b5=eY(j5(),1);function yM(){let Q=new P5.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return b5.default(Q),Q}class uY{constructor(Q){this._ajv=Q??yM()}getValidator(Q){let Y="$id"in Q&&typeof Q.$id==="string"?this._ajv.getSchema(Q.$id)??this._ajv.compile(Q):this._ajv.compile(Q);return(X)=>{if(Y(X))return{valid:!0,data:X,errorMessage:void 0};else return{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(Y.errors)}}}}class hY{constructor(Q){this._server=Q}requestStream(Q,Y,X){return this._server.requestStream(Q,Y,X)}async getTask(Q,Y){return this._server.getTask({taskId:Q},Y)}async getTaskResult(Q,Y,X){return this._server.getTaskResult({taskId:Q},Y,X)}async listTasks(Q,Y){return this._server.listTasks(Q?{cursor:Q}:void 0,Y)}async cancelTask(Q,Y){return this._server.cancelTask({taskId:Q},Y)}}function I5(Q,Y,X){if(!Q)throw Error(`${X} does not support task creation (required for ${Y})`);switch(Y){case"tools/call":if(!Q.tools?.call)throw Error(`${X} does not support task creation for tools/call (required for ${Y})`);break;default:break}}function E5(Q,Y,X){if(!Q)throw Error(`${X} does not support task creation (required for ${Y})`);switch(Y){case"sampling/createMessage":if(!Q.sampling?.createMessage)throw Error(`${X} does not support task creation for sampling/createMessage (required for ${Y})`);break;case"elicitation/create":if(!Q.elicitation?.create)throw Error(`${X} does not support task creation for elicitation/create (required for ${Y})`);break;default:break}}class fY extends x9{constructor(Q,Y){super(Y);if(this._serverInfo=Q,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(P6.options.map((X,W)=>[X,W])),this.isMessageIgnored=(X,W)=>{let G=this._loggingLevels.get(W);return G?this.LOG_LEVEL_SEVERITY.get(X)<this.LOG_LEVEL_SEVERITY.get(G):!1},this._capabilities=Y?.capabilities??{},this._instructions=Y?.instructions,this._jsonSchemaValidator=Y?.jsonSchemaValidator??new uY,this.setRequestHandler(O9,(X)=>this._oninitialize(X)),this.setNotificationHandler(M9,()=>this.oninitialized?.()),this._capabilities.logging)this.setRequestHandler(T9,async(X,W)=>{let G=W.sessionId||W.requestInfo?.headers["mcp-session-id"]||void 0,{level:$}=X.params,z=P6.safeParse($);if(z.success)this._loggingLevels.set(G,z.data);return{}})}get experimental(){if(!this._experimental)this._experimental={tasks:new hY(this)};return this._experimental}registerCapabilities(Q){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=rG(this._capabilities,Q)}setRequestHandler(Q,Y){let W=O4(Q)?.method;if(!W)throw Error("Schema is missing a method literal");let G;if(_1(W)){let z=W;G=z._zod?.def?.value??z.value}else{let z=W;G=z._def?.value??z.value}if(typeof G!=="string")throw Error("Schema method literal must be a string");if(G==="tools/call"){let z=async(J,H)=>{let U=H1(j6,J);if(!U.success){let D=U.error instanceof Error?U.error.message:String(U.error);throw new _(h.InvalidParams,`Invalid tools/call request: ${D}`)}let{params:A}=U.data,B=await Promise.resolve(Y(J,H));if(A.task){let D=H1(y1,B);if(!D.success){let O=D.error instanceof Error?D.error.message:String(D.error);throw new _(h.InvalidParams,`Invalid task creation result: ${O}`)}return D.data}let K=H1(v4,B);if(!K.success){let D=K.error instanceof Error?K.error.message:String(K.error);throw new _(h.InvalidParams,`Invalid tools/call result: ${D}`)}return K.data};return super.setRequestHandler(Q,z)}return super.setRequestHandler(Q,Y)}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){E5(this._clientCapabilities?.tasks?.requests,Q,"Client")}assertTaskHandlerCapability(Q){if(!this._capabilities)return;I5(this._capabilities.tasks?.requests,Q,"Server")}async _oninitialize(Q){let Y=Q.params.protocolVersion;return this._clientCapabilities=Q.params.capabilities,this._clientVersion=Q.params.clientInfo,{protocolVersion:RG.includes(Y)?Y:K9,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"},j4)}async createMessage(Q,Y){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 X=Q.messages[Q.messages.length-1],W=Array.isArray(X.content)?X.content:[X.content],G=W.some((H)=>H.type==="tool_result"),$=Q.messages.length>1?Q.messages[Q.messages.length-2]:void 0,z=$?Array.isArray($.content)?$.content:[$.content]:[],J=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(!J)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(J){let H=new Set(z.filter((A)=>A.type==="tool_use").map((A)=>A.id)),U=new Set(W.filter((A)=>A.type==="tool_result").map((A)=>A.toolUseId));if(H.size!==U.size||![...H].every((A)=>U.has(A)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}if(Q.tools)return this.request({method:"sampling/createMessage",params:Q},R9,Y);return this.request({method:"sampling/createMessage",params:Q},S9,Y)}async elicitInput(Q,Y){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},x4,Y)}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},x4,Y);if(G.action==="accept"&&G.content&&W.requestedSchema)try{let z=this._jsonSchemaValidator.getValidator(W.requestedSchema)(G.content);if(!z.valid)throw new _(h.InvalidParams,`Elicitation response content does not match requested schema: ${z.errorMessage}`)}catch($){if($ instanceof _)throw $;throw new _(h.InternalError,`Error validating elicitation response: ${$ instanceof Error?$.message:String($)}`)}return G}}}createElicitationCompletionNotifier(Q,Y){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}},Y)}async listRoots(Q,Y){return this.request({method:"roots/list",params:Q},C9,Y)}async sendLoggingMessage(Q,Y){if(this._capabilities.logging){if(!this.isMessageIgnored(Q.level,Y))return this.notification({method:"notifications/message",params:Q})}}async sendResourceUpdated(Q){return this.notification({method:"notifications/resources/updated",params:Q})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}var T5={name:"@sequenzy/mcp",version:"0.0.67",mcpName:"io.github.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":"./dist/server.js","./runtime":"./dist/runtime.js","./server.json":"./server.json"},scripts:{dev:"bun --watch src/index.ts",build:"bun build src/index.ts src/server.ts src/runtime.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/mcp.git"},homepage:"https://sequenzy.com",bugs:{url:"https://github.com/Sequenzy/mcp/issues"}};var lY=["product-info","domain","tracking","localization","integrations","products","events","tags","labels","goals","sync-rules","api-keys","widgets","team","danger"],S5={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}",landingPages:"/dashboard/company/{companyId}/landing-pages",landingPage:"/dashboard/company/{companyId}/landing-pages/{landingPageId}",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 hM(Q){let X=(Q??process.env.SEQUENZY_APP_URL??"https://sequenzy.com").trim().replace(/\/+$/,"");return X.length>0?X:"https://sequenzy.com"}function f0(Q){let Y=Q?.trim();return Y?Y:void 0}function n0(Q){return encodeURIComponent(Q)}function G0(Q,Y){return`${Q}${Y}`}function $0(Q,Y=""){return`/dashboard/company/${n0(Q)}${Y}`}function R5(Q,Y,X){return G0(Q,`${$0(Y,"/settings")}?tab=${encodeURIComponent(X)}`)}function fM(Q,Y){let X=lY.map((W)=>[W,Y?R5(Q,Y,W):""]);return Object.fromEntries(X)}function M1(Q={},Y){let X=hM(Y),W=f0(Q.companyId),G={},$=fM(X,W);if(!W)return{appUrl:X,routeTemplates:S5,settingsTabValues:lY,urls:G,settingsUrls:$};G.dashboard=G0(X,$0(W)),G.campaigns=G0(X,$0(W,"/campaign")),G.landingPages=G0(X,$0(W,"/landing-pages")),G.sequences=G0(X,$0(W,"/sequences")),G.settings=G0(X,$0(W,"/settings")),G.emails=G0(X,$0(W,"/emails")),G.subscribers=G0(X,$0(W,"/subscribers")),G.sentEmails=G0(X,$0(W,"/sent-emails")),G.segments=G0(X,$0(W,"/segments")),G.metrics=G0(X,$0(W,"/metrics")),G.transactional=G0(X,$0(W,"/transactional"));let z=f0(Q.campaignId);if(z)G.campaign=G0(X,$0(W,`/campaign/${n0(z)}`)),G.campaignPreview=`${G.campaign}?step=review`;let J=f0(Q.landingPageId);if(J)G.landingPage=G0(X,$0(W,`/landing-pages/${n0(J)}`));let H=f0(Q.sequenceId);if(H)G.sequence=G0(X,$0(W,`/sequences/${n0(H)}`));let U=f0(Q.emailId)??f0(Q.templateId);if(U)G.email=G0(X,$0(W,`/emails/${n0(U)}`)),G.template=G.email;let A=f0(Q.transactionalId);if(A)G.transactionalEmail=G0(X,$0(W,`/transactional/${n0(A)}`));let B=f0(Q.emailSendId);if(B)G.emailSend=G0(X,$0(W,`/sent-emails/${n0(B)}`));let K=f0(Q.domainId);if(K)G.domain=G0(X,$0(W,`/settings/domain/${n0(K)}`)),G.domainVerify=`${G.domain}/verify`;let D=f0(Q.status);if(D)G.campaignList=G0(X,$0(W,`/campaign/list/${n0(D)}`)),G.sequenceList=G0(X,$0(W,`/sequences/list/${n0(D)}`));let O=f0(Q.settingsTab);if(O)G.settingsTab=R5(X,W,O);return{appUrl:X,routeTemplates:S5,settingsTabValues:lY,urls:G,settingsUrls:$}}var C5=[{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 Y;switch(Q){case"sequenzy://dashboard":Y=await L("GET","/api/v1/metrics?period=7d");break;case"sequenzy://company":{let X=await L("GET","/api/v1/account"),W=N1()??X.currentCompanyId;if(!W)throw Error("No company available. Create or select a company first.");Y=await L("GET",`/api/v1/companies/${W}`);break}case"sequenzy://campaigns/recent":Y=await L("GET","/api/v1/campaigns?limit=10");break;case"sequenzy://subscribers/recent":Y=await L("GET","/api/v1/subscribers?sort=createdAt&limit=20");break;case"sequenzy://subscribers/engaged":Y=await L("GET","/api/v1/subscribers?sort=engagement&limit=20");break;case"sequenzy://sequences":Y=await L("GET","/api/v1/sequences");break;case"sequenzy://templates":Y=await L("GET","/api/v1/templates");break;case"sequenzy://segments":Y=await L("GET","/api/v1/segments");break;case"sequenzy://tags":Y=await L("GET","/api/v1/tags");break;case"sequenzy://health":Y=await L("GET","/api/v1/health/deliverability");break;case"sequenzy://app-routes":Y=M1();break;default:throw Error(`Unknown resource: ${Q}`)}return{contents:[{uri:Q,mimeType:"application/json",text:JSON.stringify(Y,null,2)}]}}catch(Y){return{contents:[{uri:Q,mimeType:"text/plain",text:R1(Y)}]}}}import{readFileSync as lM,statSync as mM}from"node:fs";import{basename as cM}from"node:path";var o6="Sequenzy email blocks. Use `styles` for per-block background, background opacity, text color, padding, border radius, border width, and border color. Top-level style aliases such as `backgroundColor`, `backgroundOpacity`, `borderColor`, `borderWidth`, and `borderRadius` are also accepted and saved under `styles`. Use this for editor-compatible content, including conditional and repeat blocks. Repeat blocks use { type: 'repeat', source: 'items', itemAlias: 'item', children: [...] }.",t1="Replacement Sequenzy email blocks. Use `styles` for per-block background, background opacity, text color, padding, border radius, border width, and border color. Top-level style aliases such as `backgroundColor`, `backgroundOpacity`, `borderColor`, `borderWidth`, and `borderRadius` are also accepted and saved under `styles`.",p5="Sequenzy email blocks. Provide blocks or html for email steps. Use `styles` for per-block background, background opacity, text color, padding, border radius, border width, and border color. Top-level style aliases such as `backgroundColor`, `backgroundOpacity`, `borderColor`, `borderWidth`, and `borderRadius` are also accepted and saved under `styles`. Blocks can include repeat blocks over array variables such as items.",VQ="Complete Sequenzy landing page content JSON. Use this when replacing the page structure. The content must be the editor-compatible landing page schema with version, template, seo, theme, and blocks. Landing pages must include exactly one footer block and at most one form block.",pM="Optional template key for default content, such as from-scratch, waitlist, lead-magnet, launch, demo-request, webinar, newsletter, product-hunt, pricing-offer, agency-lead-gen, or feature-announcement.",v5=500,x5=500,a1={type:"boolean",description:"If true, include machine-classified bot/scanner opens and clicks. Defaults to false, so metrics and activity are human-only."},_5={type:"object",description:"Optional send window for every email step in the sequence. When set, email actions that become due outside the window wait until the next allowed local time. Omit days to allow every day.",properties:{enabled:{type:"boolean",description:"Set false to disable the sending window when creating a sequence. For updates, prefer clearSendingWindow."},timezone:{type:"string",description:"IANA timezone for the window, e.g. Europe/Kiev or America/New_York."},startTime:{type:"string",description:"Earliest local send time in 24-hour HH:mm format, e.g. 08:00."},endTime:{type:"string",description:"Latest local send cutoff in 24-hour HH:mm format, e.g. 20:00. Must be later than startTime."},days:{type:"array",description:"Allowed local days. Use full names or short names such as monday, tuesday, mon, tue. Omit for every day.",items:{type:"string"}}},additionalProperties:!1},wQ=["gray","red","orange","amber","yellow","lime","green","emerald","teal","cyan","sky","blue","indigo","violet","purple","fuchsia","pink","rose"],jQ=["email.sent","email.delivered","email.delivery_delayed","email.bounced","email.complained","email.opened","email.clicked","email.unsubscribed","subscriber.invalid","subscriber.updated","subscriber.unsubscribed","sequence.finished","sequence.failed"],iM=new Set(["get_account","get_app_urls","get_company","list_websites","check_website","get_integration_guide","get_subscriber","search_subscribers","list_products","list_tags","list_lists","list_segments","get_segment_count","list_audience_syncs","list_ad_accounts","list_templates","get_template","list_ab_tests","get_ab_test","get_ab_test_stats","list_campaigns","get_campaign","get_email_send","list_landing_pages","get_landing_page","list_sequences","get_sequence","list_transactional_emails","get_transactional_email","get_stats","get_campaign_stats","get_sequence_stats","get_subscriber_activity","list_team_members","list_conversations","get_conversation","list_webhooks","list_webhook_deliveries","generate_email","generate_sequence","generate_subject_lines"]),nM=new Set(["select_company","create_company","create_api_key","add_website","add_subscriber","update_subscriber","remove_subscriber","upsert_products","delete_product","attach_product_file","remove_product_file","sync_products","create_tag","update_tag","delete_tag","create_list","update_list","delete_list","add_subscribers_to_list","remove_subscribers_from_list","create_segment","update_segment","delete_segment","create_audience_sync","update_audience_sync","delete_audience_sync","sync_audience_now","create_template","update_template","delete_template","restart_ab_test","update_ab_test_variant","create_ab_test","add_ab_test_variant","delete_ab_test_variant","delete_ab_test","create_campaign","update_campaign","schedule_campaign","send_test_email","cancel_campaign","pause_campaign","resume_campaign","delete_campaign","duplicate_campaign","create_landing_page","update_landing_page","delete_landing_page","publish_landing_page","unpublish_landing_page","connect_landing_page_domain","update_landing_page_domain_settings","create_sequence","update_sequence","enable_sequence","disable_sequence","enroll_subscribers_in_sequence","cancel_sequence_enrollments","delete_sequence","create_transactional_email","update_transactional_email","send_email","invite_team_member","cancel_team_invitation","reply_to_conversation","update_conversation_status","mark_conversation_read","create_webhook","update_webhook","delete_webhook","test_webhook","replay_webhook_delivery"]),rM=new Set(["send_test_email","schedule_campaign","resume_campaign","publish_landing_page","connect_landing_page_domain","update_landing_page_domain_settings","enable_sequence","send_email","invite_team_member","reply_to_conversation","create_webhook","update_webhook","test_webhook","replay_webhook_delivery"]),dM=new Set(["remove_subscriber","delete_product","remove_product_file","delete_tag","delete_list","remove_subscribers_from_list","delete_segment","delete_audience_sync","delete_template","restart_ab_test","delete_ab_test_variant","delete_ab_test","cancel_campaign","delete_campaign","delete_landing_page","unpublish_landing_page","disable_sequence","cancel_sequence_enrollments","delete_sequence","cancel_team_invitation","delete_webhook"]);function oM(Q){let Y=iM.has(Q),X=nM.has(Q);if(Y===X)throw Error(`MCP tool "${Q}" must be classified as exactly one of read-only or mutating.`);return{readOnlyHint:Y,destructiveHint:Y?!1:dM.has(Q),openWorldHint:rM.has(Q)}}function tM(Q){return{...Q,annotations:{...Q.annotations,...oM(Q.name)}}}var iY={status:["is","is_not"],tag:["contains","not_contains","is_empty","is_not_empty"],email:["contains","not_contains"],emailProvider:["is","is_not","is_empty","is_not_empty"],added:["less_than","more_than"],firstName:["contains","not_contains","is_empty","is_not_empty"],lastName:["contains","not_contains","is_empty","is_not_empty"],list:["is","is_not","is_empty","is_not_empty"],emailSent:["is","is_not","at_least","less_than_count"],emailDelivered:["is","is_not","at_least","less_than_count"],emailOpened:["is","is_not","at_least","less_than_count"],emailClicked:["is","is_not","at_least","less_than_count"],emailBounced:["is","is_temporary_bounce","is_permanent_bounce","is_not","at_least","less_than_count"],emailComplained:["is","is_not","at_least","less_than_count"],attribute:["is","is_not","is_empty","is_not_empty","gte","lte","gt","lt","contains","not_contains"],event:["is","is_not","at_least","less_than_count"],segment:["is","is_not"],stripeProduct:["is","is_not","at_least","less_than_count"],stripeCurrentProduct:["is","is_not","gte","lte","gt","lt"],stripeTrialProduct:["is","is_not","gte","lte","gt","lt"],commerceProduct:["is","is_not","at_least","less_than_count"]},aM=Object.entries(iY).map(([Q,Y])=>`${Q}: ${Y.join(", ")}`).join("; "),g5={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","emailDelivered","emailOpened","emailClicked","emailBounced","emailComplained","attribute","event","segment","stripeProduct","stripeCurrentProduct","stripeTrialProduct","commerceProduct"],description:"Filter field. Use `event` for custom subscriber events, `segment` for saved segment membership, `stripeProduct`/`stripeCurrentProduct`/`stripeTrialProduct` for Stripe product-based segments, and `commerceProduct` for products purchased through commerce orders - the value is `provider:productId` (provider one of `shopify`, `woocommerce`, `api`; product ids are provider-scoped), optionally with an order-count threshold (`provider:productId:count`) for at_least/less_than_count; a bare product id matches the id on any provider. Engagement fields (`emailSent`, `emailDelivered`, `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","is_temporary_bounce","is_permanent_bounce","at_least","less_than_count","gte","lte","gt","lt"],description:`Filter operator. Allowed operators by field: ${aM}.`},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/current/trialing, `prod_123:3` for payment thresholds, `prod_123:is_canceled` for products set to cancel, `prod_123:cancels_at:2026-05-26`, `prod_123:end_at:2026-05-26`, or `prod_123:start_at:7 days ago` for product-scoped dates. 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},y5={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 nY(Q){if(!Array.isArray(Q))return Q;return Q.map((Y)=>{if(typeof Y!=="object"||Y===null)return Y;let X=Y;if(typeof X.id==="string"&&X.id.trim()!=="")return X;return{...X,id:crypto.randomUUID()}})}function rY(Q){if(typeof Q!=="object"||Q===null)return Q;let Y=Q;if(Y.kind==="filter"||"field"in Y||"operator"in Y||"value"in Y){let X=nY([Y]);return Array.isArray(X)?X[0]:Y}if(Y.kind!=="group")return Q;return{...Y,id:typeof Y.id==="string"&&Y.id.trim()!==""?Y.id:crypto.randomUUID(),children:Array.isArray(Y.children)?Y.children.map(rY):[]}}function sM(Q){let Y=Q.indexOf(":");return Y!==-1&&Q.substring(0,Y).trim().length>0}function eM(Q){let Y=Q.indexOf(":");return Y!==-1&&Q.substring(Y+1).trim().length>0}function u5(Q){if(Q==="all")return!0;let Y=Q.match(/^(\d+)d$/);if(!Y?.[1])return!1;let X=Number.parseInt(Y[1],10);return Number.isInteger(X)&&X>0}function QV(Q,Y){let X=Y.split(":");if(Q==="at_least"||Q==="less_than_count"){if(X.length<3)return'Event count filters must use "eventName:count:timeRange", like "saas.purchase:2:30d".';let $=X.slice(0,-2).join(":").trim(),z=X.at(-2),J=X.at(-1),H=z===void 0?Number.NaN:Number.parseInt(z,10);return $&&Number.isInteger(H)&&H>0&&J!==void 0&&u5(J)?null:'Event count filters must use "eventName:count:timeRange", like "saas.purchase:2:30d".'}if(X.length<2)return'Event filters must use "eventName:timeRange", like "saas.purchase:30d".';let W=X.slice(0,-1).join(":").trim(),G=X.at(-1);return W&&G!==void 0&&u5(G)?null:'Event filters must use "eventName:timeRange", like "saas.purchase:30d".'}function YV(Q){let Y=Q.indexOf(":");if(Y===-1)return{productId:Q,subfilter:null,rawValue:null};let X=Q.substring(0,Y),W=Q.substring(Y+1),G=W.indexOf(":");if(G===-1)return{productId:X,subfilter:W,rawValue:null};return{productId:X,subfilter:W.substring(0,G),rawValue:W.substring(G+1)}}function XV(Q){return Q.trim().toLowerCase().replace(/[-\s]+/g,"_")}function WV(Q){return["is_canceled","is_cancelled","canceled","cancelled","will_cancel","cancel_at_period_end","is_not_canceled","is_not_cancelled","not_canceled","not_cancelled","will_not_cancel"].includes(Q)}function GV(Q,Y){if(Y==="cancels_at"||Y==="cancel_at"||Y==="cancellation_at")return!0;if(Q==="stripeCurrentProduct")return["end_at","ends_at","period_end","period_ends_at","current_period_end"].includes(Y);return["start_at","started_at","trial_start","trial_started_at","end_at","ends_at","trial_end","trial_ends_at"].includes(Y)}function $V(Q){return["is","is_not","gte","lte","gt","lt"].includes(Q)}function zV(Q,Y,X){if(Q==="stripeProduct"){if(Y!=="at_least"&&Y!=="less_than_count")return null;let J=X.indexOf(":");if(J===-1)return null;let H=X.substring(0,J).trim(),U=Number.parseInt(X.substring(J+1).trim(),10);return H&&Number.isInteger(U)&&U>=1?null:'Stripe Product threshold filters must use "productId:count" with a count of at least 1.'}if(Q!=="stripeCurrentProduct"&&Q!=="stripeTrialProduct")return null;let{productId:W,subfilter:G,rawValue:$}=YV(X);if(!W.trim())return"Stripe product filters must include a product ID.";if(!G)return Y==="is"||Y==="is_not"?null:'Stripe current/trial date filters must use "productId:dateField:value".';let z=XV(G);if(WV(z))return Y==="is"||Y==="is_not"?null:"Stripe cancellation flag filters only support is and is_not operators.";if(!GV(Q,z))return`Unsupported Stripe product subfilter "${G}".`;if(!$V(Y))return"Stripe date filters only support is, is_not, gte, lte, gt, and lt operators.";return $?.trim()?null:'Stripe date filters must include a value like "productId:end_at:2026-05-26".'}var JV=new Set(["shopify","woocommerce","api"]);function HV(Q,Y){let X=Y.trim(),W=X.indexOf(":");if(W!==-1&&JV.has(X.substring(0,W).trim()))X=X.substring(W+1).trim();if(!X)return'Purchased Product filters must include a product ID, like "shopify:42".';if(Q!=="at_least"&&Q!=="less_than_count")return null;let G=X.lastIndexOf(":");if(G===-1)return null;let $=X.substring(0,G).trim(),z=Number.parseInt(X.substring(G+1).trim(),10);return $&&Number.isInteger(z)&&z>=1?null:'Purchased Product threshold filters must use "provider:productId:count" with a count of at least 1.'}function oY(Q){if(typeof Q!=="object"||Q===null)return"Segment filters must be objects.";let Y=Q,X=Y.field,W=Y.operator,G=Y.value;if(typeof X!=="string"||!(X in iY))return`Unsupported segment filter field "${String(X)}".`;if(typeof W!=="string")return`Segment filter "${X}" must include an operator.`;let $=iY[X];if(!$.includes(W))return`Operator "${W}" is not supported for ${X} filters. Use one of: ${$.join(", ")}.`;if(W!=="is_empty"&&W!=="is_not_empty"&&(typeof G!=="string"||G.trim().length===0))return`Segment filter "${X}" must include a value.`;if(X==="attribute"&&typeof G==="string"){if(!sM(G))return'Attribute filters must use "attributeName:value" or "attributeName:" for empty checks.';if(W!=="is_empty"&&W!=="is_not_empty"&&!eM(G))return'Attribute filters must include a value after "attributeName:".'}if(X==="event"&&typeof G==="string"){let z=QV(W,G);if(z)return z}if((X==="stripeProduct"||X==="stripeCurrentProduct"||X==="stripeTrialProduct")&&typeof G==="string"){let z=zV(X,W,G);if(z)return z}if(X==="commerceProduct"&&typeof G==="string"){let z=HV(W,G);if(z)return z}if(X==="tag"&&(W==="contains"||W==="not_contains")){if(!(typeof G==="string"&&G.split(",").map((J)=>J.trim()).some(Boolean)))return"Tag filters must include at least one tag name."}return null}function tY(Q){if(typeof Q!=="object"||Q===null)return[];let Y=Q;if(Y.kind==="filter"||"field"in Y||"operator"in Y||"value"in Y){let X=oY(Y);return X?[X]:[]}if(Array.isArray(Y.children))return Y.children.flatMap(tY);return[]}function S1(Q,Y,X){if(Y.html!==void 0&&Y.blocks!==void 0)throw Error(`Provide either \`html\` or \`blocks\` when calling \`${Q}\`, not both.`);if(Y.blocks!==void 0&&!Array.isArray(Y.blocks))throw Error(`\`blocks\` must be an array when calling \`${Q}\`.`);if(X?.requireContent&&Y.html===void 0&&Y.blocks===void 0)throw Error(`Provide either \`html\` or \`blocks\` when calling \`${Q}\`.`)}function ZQ(Q,Y){if(Y.labels===void 0)return;if(!Array.isArray(Y.labels))throw Error(`\`labels\` must be an array when calling \`${Q}\`.`);if(Y.labels.some((X)=>typeof X!=="string"||X.trim().length===0))throw Error(`\`labels\` must contain only non-empty strings when calling \`${Q}\`.`)}function UV(Q){let Y=Q.filters!==void 0,X=Q.root!==void 0;if(Y&&X)throw Error("Provide either `filters` or `root` when calling `create_segment`, not both.");if(!Y&&!X)throw Error("Provide either `filters` or `root` when calling `create_segment`.");if(Y){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(X&&(typeof Q.root!=="object"||Q.root===null))throw Error("`root` must be an object when calling `create_segment`.");let W=Y?Q.filters.flatMap((G)=>{let $=oY(G);return $?[$]:[]}):tY(Q.root);if(W.length>0)throw Error(W[0]??"Invalid segment filter in `create_segment`.")}function AV(Q){let Y=Q.filters!==void 0,X=Q.root!==void 0;if(Y&&X)throw Error("Provide either `filters` or `root` when calling `update_segment`, not both.");if(Q.name===void 0&&Q.filterJoinOperator===void 0&&!Y&&!X)throw Error("Provide at least one of `name`, `filters`, `root`, or `filterJoinOperator` when calling `update_segment`.");if(Y){if(!Array.isArray(Q.filters))throw Error("`filters` must be an array when calling `update_segment`.");if(Q.filters.length===0)throw Error("`filters` must include at least one filter when calling `update_segment`.")}if(X&&(typeof Q.root!=="object"||Q.root===null))throw Error("`root` must be an object when calling `update_segment`.");let W=Y?Q.filters.flatMap((G)=>{let $=oY(G);return $?[$]:[]}):X?tY(Q.root):[];if(W.length>0)throw Error(W[0]??"Invalid segment filter in `update_segment`.")}function BV(Q){if(Q.clearEnrollmentFieldPath===!0&&Q.enrollmentFieldPath!==void 0)throw Error("Provide either `enrollmentFieldPath` or `clearEnrollmentFieldPath` when calling `update_sequence`, not both.");if(Q.clearSendingWindow===!0&&Q.sendingWindow!==void 0)throw Error("Provide either `sendingWindow` or `clearSendingWindow` when calling `update_sequence`, not both.");let Y={...Q};if(delete Y.clearEnrollmentFieldPath,delete Y.clearSendingWindow,Q.clearEnrollmentFieldPath===!0)Y.enrollmentFieldPath=null;if(Q.clearSendingWindow===!0)Y.sendingWindow=null;return Y}function KV(Q){let Y=w(Q,"subscriberId"),X=Q.fieldValues,W=X===void 0?void 0:Array.isArray(X)?X:void 0;if(X!==void 0&&W===void 0)throw Error("`fieldValues` must be an array when calling `cancel_sequence_enrollments`.");let G=W?.map((J)=>typeof J==="string"?J.trim():"").filter((J)=>J.length>0)??[];if(W?.some((J)=>typeof J!=="string")||W!==void 0&&G.length===0)throw Error("`fieldValues` must contain at least one non-empty string when calling `cancel_sequence_enrollments`.");if(Y!==void 0===G.length>0)throw Error("Provide exactly one target when calling `cancel_sequence_enrollments`: `subscriberId` or `fieldValues`.");let $=w(Q,"fieldPath"),z=w(Q,"reason");return{...Y!==void 0&&{subscriberId:Y},...$!==void 0&&{fieldPath:$},...G.length>0&&{fieldValues:G},...typeof Q.dryRun==="boolean"&&{dryRun:Q.dryRun},...z!==void 0&&{reason:z}}}function DV(Q){S1("create_campaign",Q),ZQ("create_campaign",Q);let Y=w(Q,"prompt")!==void 0,X=Q.html!==void 0,W=Q.blocks!==void 0,G=Q.templateId!==void 0;if(Q.prompt!==void 0&&!Y)throw Error("`prompt` cannot be empty when calling `create_campaign`.");if(Y&&(X||W||G))throw Error("Provide either `prompt`, `html`, `blocks`, or `templateId` when calling `create_campaign`, not multiple content sources.");if(!Y&&(Q.style!==void 0||Q.tone!==void 0))throw Error("`style` and `tone` can only be used with `prompt` when calling `create_campaign`.");if(!Y&&w(Q,"subject")===void 0)throw Error("`subject` is required unless `prompt` is provided when calling `create_campaign`.")}function LV(Q){if(w(Q,"scheduledAt")===void 0)throw Error("`scheduledAt` is required when calling `schedule_campaign`.");if(Q.targetLists!==void 0&&!J0(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 mY(Q,Y,X){let W=new Set(["companyId","landingPageId","name","slug","content"]),G=Object.keys(Y).filter(($)=>!W.has($));if(G.length>0)throw Error(`\`${Q}\` accepts only \`name\`, \`slug\`, and \`content\` update fields. Unsupported field${G.length===1?"":"s"}: ${G.map(($)=>`\`${$}\``).join(", ")}.`);if(X.requireUpdate&&Y.name===void 0&&Y.slug===void 0&&Y.content===void 0)throw Error(`Provide at least one of \`name\`, \`slug\`, or \`content\` when calling \`${Q}\`.`);return{...Y.name!==void 0&&{name:Y.name},...Y.slug!==void 0&&{slug:Y.slug},...Y.content!==void 0&&{content:Y.content}}}function FV(Q){let Y=new Set(["companyId","domain","verify"]),X=Object.keys(Q).filter((W)=>!Y.has(W));if(X.length>0)throw Error(`\`update_landing_page_domain_settings\` accepts only \`domain\` and \`verify\`. Unsupported field${X.length===1?"":"s"}: ${X.map((W)=>`\`${W}\``).join(", ")}.`);if(Q.domain===void 0&&Q.verify!==!0)throw Error("Provide `domain` or `verify: true` when calling `update_landing_page_domain_settings`.");return{...Q.domain!==void 0&&{domain:Q.domain},...typeof Q.verify==="boolean"&&{verify:Q.verify}}}function qV(Q){S1("create_transactional_email",Q);let Y=w(Q,"prompt")!==void 0,X=Q.html!==void 0,W=Q.blocks!==void 0;if(Q.prompt!==void 0&&!Y)throw Error("`prompt` cannot be empty when calling `create_transactional_email`.");if(Y&&(X||W))throw Error("Provide either `prompt`, `html`, or `blocks` when calling `create_transactional_email`, not multiple content sources.");if(!Y&&(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(!Y&&!X&&!W)throw Error("Provide either `prompt`, `html`, or `blocks` when calling `create_transactional_email`.");if(!Y&&w(Q,"subject")===void 0)throw Error("`subject` is required unless `prompt` is provided when calling `create_transactional_email`.")}var h5={type:"object",description:"A step to create inside a branch path. Use type:'delay' for a standalone delay, type:'email' for an email, or type:'create_discount' for a discount action.",properties:{type:{type:"string",enum:["email","delay","create_discount","discount","webhook"],description:"Branch path step type. Omit for email steps; use delay for standalone waits."},nodeType:{type:"string",enum:["logic_delay","action_email","action_create_discount","action_add_tag","action_remove_tag","action_add_to_list","action_remove_from_list","action_update_attributes","logic_wait_for_event","action_webhook"],description:"Advanced branch path node type. Prefer type unless creating a non-email action."},config:{type:"object",description:"Config for advanced nodeType steps such as tag/list/webhook/wait-for-event actions.",additionalProperties:!0},subject:{type:"string",description:"Email subject. Required for email steps."},previewText:{type:"string",description:"Email preview text."},blocks:{type:"array",description:p5,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 OV(Q){if(!Q||typeof Q!=="object")return null;let Y=Q;if(Y.success!==!1)return null;if(typeof Y.error==="string")return Error(Y.error);if(Y.error&&typeof Y.error==="object"&&typeof Y.error.message==="string")return Error(Y.error.message);if(typeof Y.message==="string")return Error(Y.message);return Error("The tool returned an unsuccessful response.")}function J0(Q){return typeof Q==="object"&&Q!==null&&!Array.isArray(Q)}function f5(Q){return Q.trim().toLowerCase().replace(/\s+/g,"-")}function MV(Q){let Y=new URLSearchParams;if(typeof Q.query==="string"&&Q.query.trim()!=="")Y.set("query",Q.query.trim());if(Array.isArray(Q.tags)&&Q.tags.length>0)Y.set("tags",Q.tags.filter((X)=>typeof X==="string"&&X.trim()!=="").join(","));if(typeof Q.list==="string"&&Q.list.trim()!=="")Y.set("list",Q.list.trim());if(typeof Q.listId==="string"&&Q.listId.trim()!=="")Y.set("listId",Q.listId.trim());if(typeof Q.listName==="string"&&Q.listName.trim()!=="")Y.set("listName",Q.listName.trim());if(typeof Q.segmentId==="string"&&Q.segmentId.trim()!=="")Y.set("segmentId",Q.segmentId);if(typeof Q.status==="string"&&Q.status.trim()!=="")Y.set("status",Q.status.trim());return Y.set("page",String(Q.page)),Y.set("limit",String(Q.pageSize)),Y}async function VV(Q,Y){let X=typeof Q.limit==="number"&&Number.isFinite(Q.limit)?Math.max(1,Math.trunc(Q.limit)):void 0,W=Math.min(100,Math.max(1,X??100)),G=[],$=1,z=0,J=0,H=0;while(!0){let A=MV({query:Q.query,tags:Q.tags,list:Q.list,listId:Q.listId,listName:Q.listName,segmentId:Q.segmentId,status:Q.status,page:$,pageSize:W}),B=await L("GET",`/api/v1/subscribers?${A.toString()}`,void 0,Y);z=B.pagination?.total??B.subscribers.length,J=B.pagination?.totalPages??1,H+=1,G.push(...B.subscribers??[]);let K=X!==void 0&&G.length>=X,D=B.pagination?$>=B.pagination.totalPages:(B.subscribers??[]).length<W;if(K||D)break;$+=1}let U=X!==void 0?G.slice(0,X):G;return{success:!0,subscribers:U,pagination:{page:1,limit:W,total:z,totalPages:J,fetchedPages:H},returned:U.length,truncated:X!==void 0&&z>0&&U.length<z}}function NV(Q){let Y=typeof Q.email==="string"&&Q.email.trim()!==""?Q.email.trim():void 0,X=typeof Q.externalId==="string"&&Q.externalId.trim()!==""?Q.externalId.trim():void 0;return{...Y?{email:Y}:{},...X?{externalId:X}:{}}}function t6(Q,Y){let X=NV(Y);if(!X.email&&!X.externalId)throw Error(`Provide either \`email\` or \`externalId\` when calling \`${Q}\`.`);return X}function dY(Q,Y){let X=new URLSearchParams;if(Y?.includeMachineEngagement)X.set("includeMachineEngagement","true");let W=X.toString(),G=W?`?${W}`:"";if(Q.email)return`/api/v1/subscribers/${encodeURIComponent(Q.email)}${G}`;return X.set("externalId",String(Q.externalId)),`/api/v1/subscribers/external?${X.toString()}`}async function cY(Q,Y,X){return L("GET",dY(Q,X),void 0,Y)}function w(Q,Y){let X=Q[Y];if(typeof X!=="string")return;let W=X.trim();return W.length>0?W:void 0}function k(Q,Y,X){let W=w(Y,X);if(W===void 0)throw Error(`\`${X}\` is required when calling \`${Q}\`.`);return W}function W1(Q,Y,X,W){let G=w(Y,X);if(G===void 0)return;if(!W.includes(G))throw Error(`\`${X}\` must be one of ${W.join(", ")} when calling \`${Q}\`.`);return G}function pY(Q,Y,X,W){let G=k(Q,Y,X);if(!W.includes(G))throw Error(`\`${X}\` must be one of ${W.join(", ")} when calling \`${Q}\`.`);return G}function a6(Q,Y,X,W,G){let $=Y[X];if($===void 0)return;if(typeof $!=="number"||!Number.isInteger($)||$<W||$>G)throw Error(`\`${X}\` must be an integer between ${W} and ${G} when calling \`${Q}\`.`);return $}function l5(Q,Y){if(Y.events===void 0)return;if(!Array.isArray(Y.events))throw Error(`\`events\` must be an array when calling \`${Q}\`.`);let X=Y.events.map((W,G)=>{if(typeof W!=="string"||!jQ.includes(W))throw Error(`\`events\` item ${G+1} must be one of ${jQ.join(", ")} when calling \`${Q}\`.`);return W});if(X.length===0)throw Error(`\`events\` must include at least one event type when calling \`${Q}\`.`);return X}function m5(Q,Y){if(!Array.isArray(Y.emails))throw Error(`\`emails\` must be an array when calling \`${Q}\`.`);let X=[];if(Y.emails.forEach((W,G)=>{if(typeof W!=="string")throw Error(`\`emails\` item ${G+1} must be a string when calling \`${Q}\`.`);let $=W.trim();if($.length>0)X.push($)}),X.length===0)throw Error(`\`emails\` must include at least one email address when calling \`${Q}\`.`);if(X.length>v5)throw Error(`\`emails\` must include no more than ${v5} email addresses when calling \`${Q}\`. Split larger batches into multiple calls.`);return X}function c5(Q,Y,X,W){let G=Y[X];if(G===void 0)return;if(!Array.isArray(G))throw Error(`\`${X}\` must be an array when calling \`${Q}\`.`);let $=[];if(G.forEach((z,J)=>{if(typeof z!=="string")throw Error(`\`${X}\` item ${J+1} must be a string when calling \`${Q}\`.`);let H=z.trim();if(H.length>0)$.push(H)}),$.length===0)throw Error(`\`${X}\` must include at least one ${W} when calling \`${Q}\`.`);return $}function ZV(Q){let X=c5("enroll_subscribers_in_sequence",Q,"emails","email address"),W=c5("enroll_subscribers_in_sequence",Q,"subscriberIds","subscriber ID"),G=(X?.length??0)+(W?.length??0);if(G===0)throw Error("Provide `emails` or `subscriberIds` when calling `enroll_subscribers_in_sequence`.");if(G>x5)throw Error(`\`emails\` and \`subscriberIds\` must include no more than ${x5} total targets when calling \`enroll_subscribers_in_sequence\`. Split larger batches into multiple calls.`);let $=w(Q,"targetNodeId");return{...X!==void 0&&{emails:X},...W!==void 0&&{subscriberIds:W},...$!==void 0&&{targetNodeId:$}}}var wV={pdf:"application/pdf",epub:"application/epub+zip",zip:"application/zip",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",mp3:"audio/mpeg",wav:"audio/wav",mp4:"video/mp4",txt:"text/plain",csv:"text/csv"};function jV(Q){let Y=Q.split(".").pop()?.toLowerCase()??"";return wV[Y]??null}var PV=104857600;async function bV(Q,Y){if(!XX())throw Error("`filePath` is only supported when the MCP server runs locally on your machine. Host the file somewhere public and pass `url` instead.");let X=jV(Q);if(!X)throw Error("Unsupported file type. Use PDF, ePub, ZIP, image, audio, video, or text files.");let W=mM(Q).size;if(W>PV)throw Error(`File is too large (${Math.round(W/1048576)}MB). Delivery files must be 100MB or smaller.`);let G=lM(Q),$=await L("POST","/api/v1/products/delivery/upload-url",{filename:cM(Q),contentType:X,fileSizeBytes:W},Y),z=await fetch($.uploadUrl,{method:"PUT",headers:{"Content-Type":X},body:G});if(!z.ok)throw Error(`File upload failed (${z.status})`);return{url:$.publicUrl,fileName:$.fileName,fileSizeBytes:W,mimeType:X}}async function i5(Q){let Y=w(Q,"companyId");if(Y)return Y;let X=N1();if(X)return X;try{return(await L("GET","/api/v1/account")).currentCompanyId??void 0}catch{return}}function s1(Q,Y){if(!J0(Q)||!Y)return Q;return{...Q,url:Y}}function n5(Q,Y){if(!J0(Q))return Q;return{...Q,...Y.campaign!==void 0&&{url:Y.campaign},...Y.campaignPreview!==void 0&&{previewUrl:Y.campaignPreview}}}function s6(Q,Y,X){if(!Array.isArray(Q)||!Y)return Q;return Q.map((W)=>{if(!J0(W))return W;let G=w(W,"id");if(!G)return W;let $=M1({companyId:Y,...X==="campaign"&&{campaignId:G},...X==="landingPage"&&{landingPageId:G},...X==="sequence"&&{sequenceId:G},...X==="template"&&{emailId:G},...X==="transactional"&&{transactionalId:G}});if(X==="campaign")return n5(W,$.urls);let z=X==="sequence"?$.urls.sequence:X==="landingPage"?$.urls.landingPage:X==="template"?$.urls.email:$.urls.transactionalEmail;return s1(W,z)})}function IV(Q){if(!Array.isArray(Q))return Q;return Q.map((Y)=>{if(!J0(Y))return Y;let X=w(Y,"id");if(!X)return Y;let W=M1({companyId:X});return{...Y,url:W.urls.dashboard,settingsUrl:W.urls.settings}})}var r5=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","cancel_campaign","pause_campaign","resume_campaign","duplicate_campaign","list_landing_pages","get_landing_page","create_landing_page","update_landing_page","publish_landing_page","unpublish_landing_page","delete_landing_page","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 EV(Q,Y,X){if(!J0(X)||!r5.has(Q))return X;let W=J0(X.company)?X.company:void 0,$=w(X,"selectedCompanyId")??w(X,"currentCompanyId")??w(X,"companyId")??(W?w(W,"id"):void 0)??(W?w(W,"companyId"):void 0)??await i5(Y);if(!$)return X;let z=J0(X.campaign)?X.campaign:void 0,J=J0(X.sequence)?X.sequence:void 0,H=J0(X.landingPage)?X.landingPage:void 0,U=J0(X.template)?X.template:void 0,A=J0(X.transactional)&&!Array.isArray(X.transactional)?X.transactional:void 0,B={companyId:$,campaignId:w(Y,"campaignId")??w(X,"campaignId")??(z?w(z,"id"):void 0),landingPageId:w(Y,"landingPageId")??w(X,"landingPageId")??(H?w(H,"id"):void 0),sequenceId:w(Y,"sequenceId")??w(X,"sequenceId")??(J?w(J,"id"):void 0),emailId:w(X,"templateId")??(U?w(U,"id"):void 0)??(A?w(A,"emailId"):void 0)??w(Y,"templateId"),transactionalId:w(Y,"transactionalId")??(A?w(A,"id"):void 0)??w(Y,"idOrSlug"),emailSendId:w(Y,"emailSendId")??w(X,"emailSendId")??(J0(X.emailSend)?w(X.emailSend,"id"):void 0),status:w(Y,"status")},K=M1(B),D=W?M1({companyId:$}):void 0;return{...X,...Array.isArray(X.companies)&&{companies:IV(X.companies)},...Array.isArray(X.campaigns)&&{campaigns:s6(X.campaigns,$,"campaign")},...Array.isArray(X.landingPages)&&{landingPages:s6(X.landingPages,$,"landingPage")},...Array.isArray(X.sequences)&&{sequences:s6(X.sequences,$,"sequence")},...Array.isArray(X.templates)&&{templates:s6(X.templates,$,"template")},...Array.isArray(X.transactional)&&{transactional:s6(X.transactional,$,"transactional")},...W&&D!==void 0&&{company:{...W,url:D.urls.dashboard,settingsUrl:D.urls.settings}},...z&&K.urls.campaign!==void 0&&{campaign:n5(z,K.urls)},...J&&K.urls.sequence!==void 0&&{sequence:s1(J,K.urls.sequence)},...H&&K.urls.landingPage!==void 0&&{landingPage:s1(H,K.urls.landingPage)},...U&&K.urls.email!==void 0&&{template:s1(U,K.urls.email)},...A&&K.urls.transactionalEmail!==void 0&&{transactional:s1(A,K.urls.transactionalEmail)},...J0(X.emailSend)&&K.urls.emailSend!==void 0&&{emailSend:s1(X.emailSend,K.urls.emailSend)},appUrls:K.urls}}var TV={type:"boolean",description:"Whether the Sequenzy operation succeeded."},SV={type:"string",description:"Human-readable status, confirmation, or next-step message."},RV={type:"string",description:"Additional context about the result."};function l0(Q){return{type:"object",description:Q,additionalProperties:!0}}function CV(Q){return{type:"array",description:Q,items:l0("One item in the returned collection.")}}function v(Q){return{type:"string",description:Q}}function C0(Q){return{type:"number",description:Q}}function NQ(Q){return{type:"boolean",description:Q}}function N(Q){return l0(`The ${Q} record returned by Sequenzy.`)}function r(Q){return CV(`List of ${Q} records returned by Sequenzy.`)}var kV={appUrls:l0("Dashboard URLs for relevant Sequenzy resources."),url:v("Primary dashboard URL for this result."),settingsUrl:v("Company settings URL when available.")},vV={success:TV,message:SV,note:RV,items:{type:"array",description:"Fallback array wrapper used only when a tool returns a bare array.",items:l0("One returned item.")},value:l0("Fallback object wrapper used only when a tool returns a non-object value.")},xV={get_account:{account:N("account"),companies:r("company"),currentCompanyId:v("Company ID selected by the authenticated API key, when available."),selectedCompanyId:v("Company ID selected locally for subsequent MCP calls, when available.")},select_company:{companyId:v("Selected company ID."),companyName:v("Selected company name.")},get_app_urls:{dashboard:v("Company dashboard URL."),settings:v("Company settings URL."),campaign:v("Campaign editor URL."),landingPage:v("Landing page editor URL."),sequence:v("Sequence editor URL."),email:v("Email editor URL."),transactionalEmail:v("Transactional email URL."),emailSend:v("Sent email detail URL."),domain:v("Sending domain settings URL."),urls:l0("All generated URLs keyed by resource type.")},create_company:{company:N("company"),autoSelected:NQ("Whether the new company was selected for subsequent MCP calls.")},get_company:{company:N("company")},create_api_key:{apiKey:v("Newly created API key. This secret is returned only once."),key:v("Newly created API key if the API response uses the short key field.")},list_websites:{websites:r("sender website")},add_website:{website:N("sender website")},check_website:{website:N("sender website"),ready:NQ("Whether the sender website is ready."),status:v("Current processing or verification status.")},get_integration_guide:{guide:N("integration guide"),code:v("Generated integration code or example."),steps:{type:"array",description:"Setup steps for the requested integration.",items:l0("One setup step.")}},add_subscriber:{subscriber:N("subscriber")},update_subscriber:{subscriber:N("subscriber")},remove_subscriber:{subscriber:N("subscriber"),hardDeleted:NQ("Whether the subscriber was permanently deleted.")},get_subscriber:{subscriber:N("subscriber")},search_subscribers:{subscribers:r("subscriber"),pagination:l0("Pagination metadata."),returned:C0("Number of subscribers returned."),truncated:NQ("Whether the result was truncated by the requested limit.")},list_products:{products:r("product")},upsert_products:{products:r("product"),created:C0("Number of products created."),updated:C0("Number of products updated.")},delete_product:{productId:v("Deleted product ID.")},attach_product_file:{product:N("product"),delivery:N("digital delivery file")},remove_product_file:{product:N("product")},sync_products:{job:N("product sync job"),jobId:v("Queued product sync job ID.")},list_tags:{tags:r("tag")},create_tag:{tag:N("tag")},update_tag:{tag:N("tag")},delete_tag:{tagId:v("Deleted tag ID.")},list_lists:{lists:r("list")},create_list:{list:N("list")},update_list:{list:N("list")},delete_list:{listId:v("Deleted list ID.")},add_subscribers_to_list:{list:N("list"),added:C0("Number of subscribers added to the list."),skipped:C0("Number of subscribers skipped.")},remove_subscribers_from_list:{list:N("list"),removed:C0("Number of subscribers removed from the list."),skipped:C0("Number of subscribers skipped.")},list_segments:{segments:r("segment")},create_segment:{segment:N("segment")},update_segment:{segment:N("segment")},delete_segment:{segmentId:v("Deleted segment ID.")},get_segment_count:{count:C0("Number of subscribers matching the segment."),segmentId:v("Segment ID that was counted.")},list_audience_syncs:{audienceSyncs:r("audience sync")},list_ad_accounts:{adAccounts:r("ad account")},create_audience_sync:{audienceSync:N("audience sync")},update_audience_sync:{audienceSync:N("audience sync")},delete_audience_sync:{audienceSyncId:v("Deleted audience sync ID.")},sync_audience_now:{audienceSync:N("audience sync"),job:N("audience sync job"),jobId:v("Queued audience sync job ID.")},list_templates:{templates:r("email template")},get_template:{template:N("email template")},create_template:{template:N("email template")},update_template:{template:N("email template")},delete_template:{templateId:v("Deleted template ID.")},list_ab_tests:{abTests:r("A/B test")},get_ab_test:{abTest:N("A/B test")},get_ab_test_stats:{abTest:N("A/B test"),stats:N("A/B test statistics")},restart_ab_test:{abTest:N("A/B test")},update_ab_test_variant:{abTest:N("A/B test"),variant:N("A/B test variant")},create_ab_test:{abTest:N("A/B test")},add_ab_test_variant:{abTest:N("A/B test"),variant:N("A/B test variant")},delete_ab_test_variant:{abTest:N("A/B test"),variantId:v("Deleted A/B test variant ID.")},delete_ab_test:{abTestId:v("Deleted A/B test ID.")},list_campaigns:{campaigns:r("campaign")},get_campaign:{campaign:N("campaign")},get_email_send:{emailSend:N("email send")},create_campaign:{campaign:N("campaign")},update_campaign:{campaign:N("campaign")},schedule_campaign:{campaign:N("campaign"),scheduledAt:v("Scheduled send timestamp.")},send_test_email:{emailSend:N("test email send"),recipient:v("Test email recipient.")},cancel_campaign:{campaign:N("campaign")},pause_campaign:{campaign:N("campaign")},resume_campaign:{campaign:N("campaign")},delete_campaign:{campaignId:v("Deleted campaign ID.")},duplicate_campaign:{campaign:N("duplicated campaign")},list_landing_pages:{landingPages:r("landing page")},get_landing_page:{landingPage:N("landing page")},create_landing_page:{landingPage:N("landing page")},update_landing_page:{landingPage:N("landing page")},delete_landing_page:{landingPageId:v("Deleted landing page ID.")},publish_landing_page:{landingPage:N("landing page")},unpublish_landing_page:{landingPage:N("landing page")},connect_landing_page_domain:{landingPage:N("landing page"),domain:v("Connected landing page domain.")},update_landing_page_domain_settings:{landingPage:N("landing page"),domain:v("Landing page domain.")},list_sequences:{sequences:r("sequence")},get_sequence:{sequence:N("sequence")},create_sequence:{sequence:N("sequence")},update_sequence:{sequence:N("sequence")},enable_sequence:{sequence:N("sequence")},disable_sequence:{sequence:N("sequence")},enroll_subscribers_in_sequence:{sequence:N("sequence"),enrollments:r("sequence enrollment"),enrolled:C0("Number of subscribers enrolled."),skipped:C0("Number of subscribers skipped.")},cancel_sequence_enrollments:{sequence:N("sequence"),cancelled:C0("Number of enrollments cancelled."),skipped:C0("Number of enrollments skipped.")},delete_sequence:{sequenceId:v("Deleted sequence ID.")},list_transactional_emails:{transactional:r("transactional email")},get_transactional_email:{transactional:N("transactional email")},create_transactional_email:{transactional:N("transactional email")},update_transactional_email:{transactional:N("transactional email")},send_email:{emailSend:N("transactional email send"),transactional:N("transactional email")},get_stats:{stats:N("account or company statistics")},get_campaign_stats:{campaign:N("campaign"),stats:N("campaign statistics")},get_sequence_stats:{sequence:N("sequence"),stats:N("sequence statistics")},get_subscriber_activity:{activity:r("subscriber activity event"),subscribers:r("subscriber"),pagination:l0("Pagination metadata.")},list_team_members:{members:r("team member"),invitations:r("team invitation")},invite_team_member:{invitation:N("team invitation")},cancel_team_invitation:{invitationId:v("Cancelled invitation ID.")},list_conversations:{conversations:r("inbox conversation"),pagination:l0("Pagination metadata.")},get_conversation:{conversation:N("inbox conversation"),messages:r("conversation message")},reply_to_conversation:{conversation:N("inbox conversation"),message:N("conversation message")},update_conversation_status:{conversation:N("inbox conversation")},mark_conversation_read:{conversation:N("inbox conversation")},list_webhooks:{webhooks:r("outbound webhook")},create_webhook:{webhook:N("outbound webhook")},update_webhook:{webhook:N("outbound webhook")},delete_webhook:{webhookId:v("Deleted outbound webhook ID.")},test_webhook:{webhook:N("outbound webhook"),delivery:N("test webhook delivery")},list_webhook_deliveries:{deliveries:r("webhook delivery")},replay_webhook_delivery:{delivery:N("webhook delivery"),job:N("webhook replay job")},generate_email:{email:N("generated email"),html:v("Generated HTML email body."),blocks:{type:"array",description:"Generated Sequenzy email blocks.",items:l0("One generated email block.")},subject:v("Generated subject line."),previewText:v("Generated inbox preview text.")},generate_sequence:{sequence:N("generated sequence"),steps:r("generated sequence step")},generate_subject_lines:{subjectLines:{type:"array",description:"Generated subject line variants.",items:v("One generated subject line.")},variants:r("generated subject line variant")}};function _V(Q){let Y=xV[Q];if(Y===void 0)throw Error(`MCP tool "${Q}" must define outputSchema properties.`);return{type:"object",description:`Structured content returned by the \`${Q}\` MCP tool.`,properties:{...vV,...Y,...r5.has(Q)?kV:{}},additionalProperties:!0}}function gV(Q){return{...Q,outputSchema:_V(Q.name)}}function yV(Q){if(J0(Q))return Q;if(Array.isArray(Q))return{items:Q};return{value:Q}}var uV=[{name:"get_account",description:`Get current account information including available companies. IMPORTANT: If you have access to multiple companies, you MUST either:
|
|
28
|
+
`)}D.write("payload.value = newResult;"),D.write("return payload;");let R=D.compile();return(T,y)=>R(K,T,y)},$,z=Z1,J=!Q4.jitless,U=J&&kQ.value,A=Y.catchall,B;Q._zod.parse=(K,D)=>{B??(B=W.value);let O=K.value;if(!z(O))return K.issues.push({expected:"object",code:"invalid_type",input:O,inst:Q}),K;if(J&&U&&D?.async===!1&&D.jitless!==!0){if(!$)$=G(Y.shape);if(K=$(K,D),!A)return K;return YW([],O,K,D,B,Q)}return X(K,D)}});function O8(Q,Y,X,W){for(let $ of Q)if($.issues.length===0)return Y.value=$.value,Y;let G=Q.filter(($)=>!J1($));if(G.length===1)return Y.value=G[0].value,G[0];return Y.issues.push({code:"invalid_union",input:Y.value,inst:X,errors:Q.map(($)=>$.issues.map((z)=>v0(z,W,I0())))}),Y}var pQ=q("$ZodUnion",(Q,Y)=>{o.init(Q,Y),i(Q._zod,"optin",()=>Y.options.some((G)=>G._zod.optin==="optional")?"optional":void 0),i(Q._zod,"optout",()=>Y.options.some((G)=>G._zod.optout==="optional")?"optional":void 0),i(Q._zod,"values",()=>{if(Y.options.every((G)=>G._zod.values))return new Set(Y.options.flatMap((G)=>Array.from(G._zod.values)));return}),i(Q._zod,"pattern",()=>{if(Y.options.every((G)=>G._zod.pattern)){let G=Y.options.map(($)=>$._zod.pattern);return new RegExp(`^(${G.map(($)=>$6($.source)).join("|")})$`)}return});let X=Y.options.length===1,W=Y.options[0]._zod.run;Q._zod.parse=(G,$)=>{if(X)return W(G,$);let z=!1,J=[];for(let H of Y.options){let U=H._zod.run({value:G.value,issues:[]},$);if(U instanceof Promise)J.push(U),z=!0;else{if(U.issues.length===0)return U;J.push(U)}}if(!z)return O8(J,G,Q,$);return Promise.all(J).then((H)=>{return O8(H,G,Q,$)})}}),WW=q("$ZodDiscriminatedUnion",(Q,Y)=>{pQ.init(Q,Y);let X=Q._zod.parse;i(Q._zod,"propValues",()=>{let G={};for(let $ of Y.options){let z=$._zod.propValues;if(!z||Object.keys(z).length===0)throw Error(`Invalid discriminated union option at index "${Y.options.indexOf($)}"`);for(let[J,H]of Object.entries(z)){if(!G[J])G[J]=new Set;for(let U of H)G[J].add(U)}}return G});let W=k1(()=>{let G=Y.options,$=new Map;for(let z of G){let J=z._zod.propValues?.[Y.discriminator];if(!J||J.size===0)throw Error(`Invalid discriminated union option at index "${Y.options.indexOf(z)}"`);for(let H of J){if($.has(H))throw Error(`Duplicate discriminator value "${String(H)}"`);$.set(H,z)}}return $});Q._zod.parse=(G,$)=>{let z=G.value;if(!Z1(z))return G.issues.push({code:"invalid_type",expected:"object",input:z,inst:Q}),G;let J=W.value.get(z?.[Y.discriminator]);if(J)return J._zod.run(G,$);if(Y.unionFallback)return X(G,$);return G.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:Y.discriminator,input:z,path:[Y.discriminator],inst:Q}),G}}),GW=q("$ZodIntersection",(Q,Y)=>{o.init(Q,Y),Q._zod.parse=(X,W)=>{let G=X.value,$=Y.left._zod.run({value:G,issues:[]},W),z=Y.right._zod.run({value:G,issues:[]},W);if($ instanceof Promise||z instanceof Promise)return Promise.all([$,z]).then(([H,U])=>{return M8(X,H,U)});return M8(X,$,z)}});function mQ(Q,Y){if(Q===Y)return{valid:!0,data:Q};if(Q instanceof Date&&Y instanceof Date&&+Q===+Y)return{valid:!0,data:Q};if(z1(Q)&&z1(Y)){let X=Object.keys(Y),W=Object.keys(Q).filter(($)=>X.indexOf($)!==-1),G={...Q,...Y};for(let $ of W){let z=mQ(Q[$],Y[$]);if(!z.valid)return{valid:!1,mergeErrorPath:[$,...z.mergeErrorPath]};G[$]=z.data}return{valid:!0,data:G}}if(Array.isArray(Q)&&Array.isArray(Y)){if(Q.length!==Y.length)return{valid:!1,mergeErrorPath:[]};let X=[];for(let W=0;W<Q.length;W++){let G=Q[W],$=Y[W],z=mQ(G,$);if(!z.valid)return{valid:!1,mergeErrorPath:[W,...z.mergeErrorPath]};X.push(z.data)}return{valid:!0,data:X}}return{valid:!1,mergeErrorPath:[]}}function M8(Q,Y,X){if(Y.issues.length)Q.issues.push(...Y.issues);if(X.issues.length)Q.issues.push(...X.issues);if(J1(Q))return Q;let W=mQ(Y.value,X.value);if(!W.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(W.mergeErrorPath)}`);return Q.value=W.data,Q}var $W=q("$ZodRecord",(Q,Y)=>{o.init(Q,Y),Q._zod.parse=(X,W)=>{let G=X.value;if(!z1(G))return X.issues.push({expected:"record",code:"invalid_type",input:G,inst:Q}),X;let $=[];if(Y.keyType._zod.values){let z=Y.keyType._zod.values;X.value={};for(let H of z)if(typeof H==="string"||typeof H==="number"||typeof H==="symbol"){let U=Y.valueType._zod.run({value:G[H],issues:[]},W);if(U instanceof Promise)$.push(U.then((A)=>{if(A.issues.length)X.issues.push(...t0(H,A.issues));X.value[H]=A.value}));else{if(U.issues.length)X.issues.push(...t0(H,U.issues));X.value[H]=U.value}}let J;for(let H in G)if(!z.has(H))J=J??[],J.push(H);if(J&&J.length>0)X.issues.push({code:"unrecognized_keys",input:G,inst:Q,keys:J})}else{X.value={};for(let z of Reflect.ownKeys(G)){if(z==="__proto__")continue;let J=Y.keyType._zod.run({value:z,issues:[]},W);if(J instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(J.issues.length){X.issues.push({code:"invalid_key",origin:"record",issues:J.issues.map((U)=>v0(U,W,I0())),input:z,path:[z],inst:Q}),X.value[J.value]=J.value;continue}let H=Y.valueType._zod.run({value:G[z],issues:[]},W);if(H instanceof Promise)$.push(H.then((U)=>{if(U.issues.length)X.issues.push(...t0(z,U.issues));X.value[J.value]=U.value}));else{if(H.issues.length)X.issues.push(...t0(z,H.issues));X.value[J.value]=H.value}}}if($.length)return Promise.all($).then(()=>X);return X}});var zW=q("$ZodEnum",(Q,Y)=>{o.init(Q,Y);let X=RQ(Y.entries),W=new Set(X);Q._zod.values=W,Q._zod.pattern=new RegExp(`^(${X.filter((G)=>vQ.has(typeof G)).map((G)=>typeof G==="string"?o0(G):G.toString()).join("|")})$`),Q._zod.parse=(G,$)=>{let z=G.value;if(W.has(z))return G;return G.issues.push({code:"invalid_value",values:X,input:z,inst:Q}),G}}),JW=q("$ZodLiteral",(Q,Y)=>{if(o.init(Q,Y),Y.values.length===0)throw Error("Cannot create literal schema with no valid values");Q._zod.values=new Set(Y.values),Q._zod.pattern=new RegExp(`^(${Y.values.map((X)=>typeof X==="string"?o0(X):X?o0(X.toString()):String(X)).join("|")})$`),Q._zod.parse=(X,W)=>{let G=X.value;if(Q._zod.values.has(G))return X;return X.issues.push({code:"invalid_value",values:Y.values,input:G,inst:Q}),X}});var HW=q("$ZodTransform",(Q,Y)=>{o.init(Q,Y),Q._zod.parse=(X,W)=>{if(W.direction==="backward")throw new X6(Q.constructor.name);let G=Y.transform(X.value,X);if(W.async)return(G instanceof Promise?G:Promise.resolve(G)).then((z)=>{return X.value=z,X});if(G instanceof Promise)throw new d0;return X.value=G,X}});function V8(Q,Y){if(Q.issues.length&&Y===void 0)return{issues:[],value:void 0};return Q}var UW=q("$ZodOptional",(Q,Y)=>{o.init(Q,Y),Q._zod.optin="optional",Q._zod.optout="optional",i(Q._zod,"values",()=>{return Y.innerType._zod.values?new Set([...Y.innerType._zod.values,void 0]):void 0}),i(Q._zod,"pattern",()=>{let X=Y.innerType._zod.pattern;return X?new RegExp(`^(${$6(X.source)})?$`):void 0}),Q._zod.parse=(X,W)=>{if(Y.innerType._zod.optin==="optional"){let G=Y.innerType._zod.run(X,W);if(G instanceof Promise)return G.then(($)=>V8($,X.value));return V8(G,X.value)}if(X.value===void 0)return X;return Y.innerType._zod.run(X,W)}}),AW=q("$ZodNullable",(Q,Y)=>{o.init(Q,Y),i(Q._zod,"optin",()=>Y.innerType._zod.optin),i(Q._zod,"optout",()=>Y.innerType._zod.optout),i(Q._zod,"pattern",()=>{let X=Y.innerType._zod.pattern;return X?new RegExp(`^(${$6(X.source)}|null)$`):void 0}),i(Q._zod,"values",()=>{return Y.innerType._zod.values?new Set([...Y.innerType._zod.values,null]):void 0}),Q._zod.parse=(X,W)=>{if(X.value===null)return X;return Y.innerType._zod.run(X,W)}}),BW=q("$ZodDefault",(Q,Y)=>{o.init(Q,Y),Q._zod.optin="optional",i(Q._zod,"values",()=>Y.innerType._zod.values),Q._zod.parse=(X,W)=>{if(W.direction==="backward")return Y.innerType._zod.run(X,W);if(X.value===void 0)return X.value=Y.defaultValue,X;let G=Y.innerType._zod.run(X,W);if(G instanceof Promise)return G.then(($)=>N8($,Y));return N8(G,Y)}});function N8(Q,Y){if(Q.value===void 0)Q.value=Y.defaultValue;return Q}var KW=q("$ZodPrefault",(Q,Y)=>{o.init(Q,Y),Q._zod.optin="optional",i(Q._zod,"values",()=>Y.innerType._zod.values),Q._zod.parse=(X,W)=>{if(W.direction==="backward")return Y.innerType._zod.run(X,W);if(X.value===void 0)X.value=Y.defaultValue;return Y.innerType._zod.run(X,W)}}),DW=q("$ZodNonOptional",(Q,Y)=>{o.init(Q,Y),i(Q._zod,"values",()=>{let X=Y.innerType._zod.values;return X?new Set([...X].filter((W)=>W!==void 0)):void 0}),Q._zod.parse=(X,W)=>{let G=Y.innerType._zod.run(X,W);if(G instanceof Promise)return G.then(($)=>Z8($,Q));return Z8(G,Q)}});function Z8(Q,Y){if(!Q.issues.length&&Q.value===void 0)Q.issues.push({code:"invalid_type",expected:"nonoptional",input:Q.value,inst:Y});return Q}var LW=q("$ZodCatch",(Q,Y)=>{o.init(Q,Y),i(Q._zod,"optin",()=>Y.innerType._zod.optin),i(Q._zod,"optout",()=>Y.innerType._zod.optout),i(Q._zod,"values",()=>Y.innerType._zod.values),Q._zod.parse=(X,W)=>{if(W.direction==="backward")return Y.innerType._zod.run(X,W);let G=Y.innerType._zod.run(X,W);if(G instanceof Promise)return G.then(($)=>{if(X.value=$.value,$.issues.length)X.value=Y.catchValue({...X,error:{issues:$.issues.map((z)=>v0(z,W,I0()))},input:X.value}),X.issues=[];return X});if(X.value=G.value,G.issues.length)X.value=Y.catchValue({...X,error:{issues:G.issues.map(($)=>v0($,W,I0()))},input:X.value}),X.issues=[];return X}});var FW=q("$ZodPipe",(Q,Y)=>{o.init(Q,Y),i(Q._zod,"values",()=>Y.in._zod.values),i(Q._zod,"optin",()=>Y.in._zod.optin),i(Q._zod,"optout",()=>Y.out._zod.optout),i(Q._zod,"propValues",()=>Y.in._zod.propValues),Q._zod.parse=(X,W)=>{if(W.direction==="backward"){let $=Y.out._zod.run(X,W);if($ instanceof Promise)return $.then((z)=>A4(z,Y.in,W));return A4($,Y.in,W)}let G=Y.in._zod.run(X,W);if(G instanceof Promise)return G.then(($)=>A4($,Y.out,W));return A4(G,Y.out,W)}});function A4(Q,Y,X){if(Q.issues.length)return Q.aborted=!0,Q;return Y._zod.run({value:Q.value,issues:Q.issues},X)}var qW=q("$ZodReadonly",(Q,Y)=>{o.init(Q,Y),i(Q._zod,"propValues",()=>Y.innerType._zod.propValues),i(Q._zod,"values",()=>Y.innerType._zod.values),i(Q._zod,"optin",()=>Y.innerType._zod.optin),i(Q._zod,"optout",()=>Y.innerType._zod.optout),Q._zod.parse=(X,W)=>{if(W.direction==="backward")return Y.innerType._zod.run(X,W);let G=Y.innerType._zod.run(X,W);if(G instanceof Promise)return G.then(w8);return w8(G)}});function w8(Q){return Q.value=Object.freeze(Q.value),Q}var OW=q("$ZodCustom",(Q,Y)=>{H0.init(Q,Y),o.init(Q,Y),Q._zod.parse=(X,W)=>{return X},Q._zod.check=(X)=>{let W=X.value,G=Y.fn(W);if(G instanceof Promise)return G.then(($)=>j8($,X,W,Q));j8(G,X,W,Q);return}});function j8(Q,Y,X,W){if(!Q){let G={code:"custom",input:X,inst:W,path:[...W._zod.def.path??[]],continue:!W._zod.def.abort};if(W._zod.def.params)G.params=W._zod.def.params;Y.issues.push(v1(G))}}var iH=(Q)=>{let Y=typeof Q;switch(Y){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 Y},nH=()=>{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 Y(W){return Q[W]??null}let X={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 ${iH(W.input)}`;case"invalid_value":if(W.values.length===1)return`Invalid input: expected ${G4(W.values[0])}`;return`Invalid option: expected one of ${Y4(W.values,"|")}`;case"too_big":{let G=W.inclusive?"<=":"<",$=Y(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?">=":">",$=Y(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 ${X[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":""}: ${Y4(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 iQ(){return{localeError:nH()}}var JN=Symbol("ZodOutput"),HN=Symbol("ZodInput");class MW{constructor(){this._map=new WeakMap,this._idmap=new Map}add(Q,...Y){let X=Y[0];if(this._map.set(Q,X),X&&typeof X==="object"&&"id"in X){if(this._idmap.has(X.id))throw Error(`ID ${X.id} already exists in the registry`);this._idmap.set(X.id,Q)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(Q){let Y=this._map.get(Q);if(Y&&typeof Y==="object"&&"id"in Y)this._idmap.delete(Y.id);return this._map.delete(Q),this}get(Q){let Y=Q._zod.parent;if(Y){let X={...this.get(Y)??{}};delete X.id;let W={...X,...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 rH(){return new MW}var B6=rH();function VW(Q,Y){return new Q({type:"string",...E(Y)})}function NW(Q,Y){return new Q({type:"string",format:"email",check:"string_format",abort:!1,...E(Y)})}function nQ(Q,Y){return new Q({type:"string",format:"guid",check:"string_format",abort:!1,...E(Y)})}function ZW(Q,Y){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,...E(Y)})}function wW(Q,Y){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...E(Y)})}function jW(Q,Y){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...E(Y)})}function PW(Q,Y){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...E(Y)})}function bW(Q,Y){return new Q({type:"string",format:"url",check:"string_format",abort:!1,...E(Y)})}function IW(Q,Y){return new Q({type:"string",format:"emoji",check:"string_format",abort:!1,...E(Y)})}function EW(Q,Y){return new Q({type:"string",format:"nanoid",check:"string_format",abort:!1,...E(Y)})}function TW(Q,Y){return new Q({type:"string",format:"cuid",check:"string_format",abort:!1,...E(Y)})}function SW(Q,Y){return new Q({type:"string",format:"cuid2",check:"string_format",abort:!1,...E(Y)})}function RW(Q,Y){return new Q({type:"string",format:"ulid",check:"string_format",abort:!1,...E(Y)})}function CW(Q,Y){return new Q({type:"string",format:"xid",check:"string_format",abort:!1,...E(Y)})}function kW(Q,Y){return new Q({type:"string",format:"ksuid",check:"string_format",abort:!1,...E(Y)})}function vW(Q,Y){return new Q({type:"string",format:"ipv4",check:"string_format",abort:!1,...E(Y)})}function xW(Q,Y){return new Q({type:"string",format:"ipv6",check:"string_format",abort:!1,...E(Y)})}function _W(Q,Y){return new Q({type:"string",format:"cidrv4",check:"string_format",abort:!1,...E(Y)})}function gW(Q,Y){return new Q({type:"string",format:"cidrv6",check:"string_format",abort:!1,...E(Y)})}function yW(Q,Y){return new Q({type:"string",format:"base64",check:"string_format",abort:!1,...E(Y)})}function uW(Q,Y){return new Q({type:"string",format:"base64url",check:"string_format",abort:!1,...E(Y)})}function hW(Q,Y){return new Q({type:"string",format:"e164",check:"string_format",abort:!1,...E(Y)})}function fW(Q,Y){return new Q({type:"string",format:"jwt",check:"string_format",abort:!1,...E(Y)})}function lW(Q,Y){return new Q({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...E(Y)})}function mW(Q,Y){return new Q({type:"string",format:"date",check:"string_format",...E(Y)})}function cW(Q,Y){return new Q({type:"string",format:"time",check:"string_format",precision:null,...E(Y)})}function pW(Q,Y){return new Q({type:"string",format:"duration",check:"string_format",...E(Y)})}function iW(Q,Y){return new Q({type:"number",checks:[],...E(Y)})}function nW(Q,Y){return new Q({type:"number",check:"number_format",abort:!1,format:"safeint",...E(Y)})}function rW(Q,Y){return new Q({type:"boolean",...E(Y)})}function dW(Q,Y){return new Q({type:"null",...E(Y)})}function oW(Q){return new Q({type:"unknown"})}function tW(Q,Y){return new Q({type:"never",...E(Y)})}function D4(Q,Y){return new hQ({check:"less_than",...E(Y),value:Q,inclusive:!1})}function K6(Q,Y){return new hQ({check:"less_than",...E(Y),value:Q,inclusive:!0})}function L4(Q,Y){return new fQ({check:"greater_than",...E(Y),value:Q,inclusive:!1})}function D6(Q,Y){return new fQ({check:"greater_than",...E(Y),value:Q,inclusive:!0})}function F4(Q,Y){return new X8({check:"multiple_of",...E(Y),value:Q})}function q4(Q,Y){return new G8({check:"max_length",...E(Y),maximum:Q})}function x1(Q,Y){return new $8({check:"min_length",...E(Y),minimum:Q})}function O4(Q,Y){return new z8({check:"length_equals",...E(Y),length:Q})}function rQ(Q,Y){return new J8({check:"string_format",format:"regex",...E(Y),pattern:Q})}function dQ(Q){return new H8({check:"string_format",format:"lowercase",...E(Q)})}function oQ(Q){return new U8({check:"string_format",format:"uppercase",...E(Q)})}function tQ(Q,Y){return new A8({check:"string_format",format:"includes",...E(Y),includes:Q})}function aQ(Q,Y){return new B8({check:"string_format",format:"starts_with",...E(Y),prefix:Q})}function sQ(Q,Y){return new K8({check:"string_format",format:"ends_with",...E(Y),suffix:Q})}function w1(Q){return new D8({check:"overwrite",tx:Q})}function eQ(Q){return w1((Y)=>Y.normalize(Q))}function Q9(){return w1((Q)=>Q.trim())}function Y9(){return w1((Q)=>Q.toLowerCase())}function X9(){return w1((Q)=>Q.toUpperCase())}function aW(Q,Y,X){return new Q({type:"array",element:Y,...E(X)})}function sW(Q,Y,X){let W=E(X);return W.abort??(W.abort=!0),new Q({type:"custom",check:"custom",fn:Y,...W})}function eW(Q,Y,X){return new Q({type:"custom",check:"custom",fn:Y,...E(X)})}function QG(Q){let Y=dH((X)=>{return X.addIssue=(W)=>{if(typeof W==="string")X.issues.push(v1(W,X.value,Y._zod.def));else{let G=W;if(G.fatal)G.continue=!1;G.code??(G.code="custom"),G.input??(G.input=X.value),G.inst??(G.inst=Y),G.continue??(G.continue=!Y._zod.def.abort),X.issues.push(v1(G))}},Q(X.value,X)});return Y}function dH(Q,Y){let X=new H0({check:"custom",...E(Y)});return X._zod.check=Q,X}function _1(Q){return!!Q._zod}function H1(Q,Y){if(_1(Q))return H6(Q,Y);return Q.safeParse(Y)}function M4(Q){if(!Q)return;let Y;if(_1(Q))Y=Q._zod?.def?.shape;else Y=Q.shape;if(!Y)return;if(typeof Y==="function")try{return Y()}catch{return}return Y}function YG(Q){if(_1(Q)){let $=Q._zod?.def;if($){if($.value!==void 0)return $.value;if(Array.isArray($.values)&&$.values.length>0)return $.values[0]}}let X=Q._def;if(X){if(X.value!==void 0)return X.value;if(Array.isArray(X.values)&&X.values.length>0)return X.values[0]}let W=Q.value;if(W!==void 0)return W;return}var F6={};YX(F6,{time:()=>$9,duration:()=>z9,datetime:()=>W9,date:()=>G9,ZodISOTime:()=>GG,ZodISODuration:()=>$G,ZodISODateTime:()=>XG,ZodISODate:()=>WG});var XG=q("ZodISODateTime",(Q,Y)=>{_8.init(Q,Y),s.init(Q,Y)});function W9(Q){return lW(XG,Q)}var WG=q("ZodISODate",(Q,Y)=>{g8.init(Q,Y),s.init(Q,Y)});function G9(Q){return mW(WG,Q)}var GG=q("ZodISOTime",(Q,Y)=>{y8.init(Q,Y),s.init(Q,Y)});function $9(Q){return cW(GG,Q)}var $G=q("ZodISODuration",(Q,Y)=>{u8.init(Q,Y),s.init(Q,Y)});function z9(Q){return pW($G,Q)}var zG=(Q,Y)=>{$4.init(Q,Y),Q.name="ZodError",Object.defineProperties(Q,{format:{value:(X)=>OX(Q,X)},flatten:{value:(X)=>qX(Q,X)},addIssue:{value:(X)=>{Q.issues.push(X),Q.message=JSON.stringify(Q.issues,C1,2)}},addIssues:{value:(X)=>{Q.issues.push(...X),Q.message=JSON.stringify(Q.issues,C1,2)}},isEmpty:{get(){return Q.issues.length===0}}})},rN=q("ZodError",zG),P0=q("ZodError",zG,{Parent:Error});var JG=z4(P0),HG=J4(P0),UG=J6(P0),AG=U6(P0),BG=MX(P0),KG=VX(P0),DG=NX(P0),LG=ZX(P0),FG=wX(P0),qG=jX(P0),OG=PX(P0),MG=bX(P0);var X0=q("ZodType",(Q,Y)=>{return o.init(Q,Y),Q.def=Y,Q.type=Y.type,Object.defineProperty(Q,"_def",{value:Y}),Q.check=(...X)=>{return Q.clone(m.mergeDefs(Y,{checks:[...Y.checks??[],...X.map((W)=>typeof W==="function"?{_zod:{check:W,def:{check:"custom"},onattach:[]}}:W)]}))},Q.clone=(X,W)=>k0(Q,X,W),Q.brand=()=>Q,Q.register=(X,W)=>{return X.add(Q,W),Q},Q.parse=(X,W)=>JG(Q,X,W,{callee:Q.parse}),Q.safeParse=(X,W)=>UG(Q,X,W),Q.parseAsync=async(X,W)=>HG(Q,X,W,{callee:Q.parseAsync}),Q.safeParseAsync=async(X,W)=>AG(Q,X,W),Q.spa=Q.safeParseAsync,Q.encode=(X,W)=>BG(Q,X,W),Q.decode=(X,W)=>KG(Q,X,W),Q.encodeAsync=async(X,W)=>DG(Q,X,W),Q.decodeAsync=async(X,W)=>LG(Q,X,W),Q.safeEncode=(X,W)=>FG(Q,X,W),Q.safeDecode=(X,W)=>qG(Q,X,W),Q.safeEncodeAsync=async(X,W)=>OG(Q,X,W),Q.safeDecodeAsync=async(X,W)=>MG(Q,X,W),Q.refine=(X,W)=>Q.check(p3(X,W)),Q.superRefine=(X)=>Q.check(i3(X)),Q.overwrite=(X)=>Q.check(w1(X)),Q.optional=()=>Y0(Q),Q.nullable=()=>ZG(Q),Q.nullish=()=>Y0(ZG(Q)),Q.nonoptional=(X)=>u3(Q,X),Q.array=()=>u(Q),Q.or=(X)=>d([Q,X]),Q.and=(X)=>N4(Q,X),Q.transform=(X)=>H9(Q,IG(X)),Q.default=(X)=>_3(Q,X),Q.prefault=(X)=>y3(Q,X),Q.catch=(X)=>f3(Q,X),Q.pipe=(X)=>H9(Q,X),Q.readonly=()=>c3(Q),Q.describe=(X)=>{let W=Q.clone();return B6.add(W,{description:X}),W},Object.defineProperty(Q,"description",{get(){return B6.get(Q)?.description},configurable:!0}),Q.meta=(...X)=>{if(X.length===0)return B6.get(Q);let W=Q.clone();return B6.add(W,X[0]),W},Q.isOptional=()=>Q.safeParse(void 0).success,Q.isNullable=()=>Q.safeParse(null).success,Q}),wG=q("_ZodString",(Q,Y)=>{K4.init(Q,Y),X0.init(Q,Y);let X=Q._zod.bag;Q.format=X.format??null,Q.minLength=X.minimum??null,Q.maxLength=X.maximum??null,Q.regex=(...W)=>Q.check(rQ(...W)),Q.includes=(...W)=>Q.check(tQ(...W)),Q.startsWith=(...W)=>Q.check(aQ(...W)),Q.endsWith=(...W)=>Q.check(sQ(...W)),Q.min=(...W)=>Q.check(x1(...W)),Q.max=(...W)=>Q.check(q4(...W)),Q.length=(...W)=>Q.check(O4(...W)),Q.nonempty=(...W)=>Q.check(x1(1,...W)),Q.lowercase=(W)=>Q.check(dQ(W)),Q.uppercase=(W)=>Q.check(oQ(W)),Q.trim=()=>Q.check(Q9()),Q.normalize=(...W)=>Q.check(eQ(...W)),Q.toLowerCase=()=>Q.check(Y9()),Q.toUpperCase=()=>Q.check(X9())}),W3=q("ZodString",(Q,Y)=>{K4.init(Q,Y),wG.init(Q,Y),Q.email=(X)=>Q.check(NW(G3,X)),Q.url=(X)=>Q.check(bW($3,X)),Q.jwt=(X)=>Q.check(fW(N3,X)),Q.emoji=(X)=>Q.check(IW(z3,X)),Q.guid=(X)=>Q.check(nQ(VG,X)),Q.uuid=(X)=>Q.check(ZW(V4,X)),Q.uuidv4=(X)=>Q.check(wW(V4,X)),Q.uuidv6=(X)=>Q.check(jW(V4,X)),Q.uuidv7=(X)=>Q.check(PW(V4,X)),Q.nanoid=(X)=>Q.check(EW(J3,X)),Q.guid=(X)=>Q.check(nQ(VG,X)),Q.cuid=(X)=>Q.check(TW(H3,X)),Q.cuid2=(X)=>Q.check(SW(U3,X)),Q.ulid=(X)=>Q.check(RW(A3,X)),Q.base64=(X)=>Q.check(yW(O3,X)),Q.base64url=(X)=>Q.check(uW(M3,X)),Q.xid=(X)=>Q.check(CW(B3,X)),Q.ksuid=(X)=>Q.check(kW(K3,X)),Q.ipv4=(X)=>Q.check(vW(D3,X)),Q.ipv6=(X)=>Q.check(xW(L3,X)),Q.cidrv4=(X)=>Q.check(_W(F3,X)),Q.cidrv6=(X)=>Q.check(gW(q3,X)),Q.e164=(X)=>Q.check(hW(V3,X)),Q.datetime=(X)=>Q.check(W9(X)),Q.date=(X)=>Q.check(G9(X)),Q.time=(X)=>Q.check($9(X)),Q.duration=(X)=>Q.check(z9(X))});function F(Q){return VW(W3,Q)}var s=q("ZodStringFormat",(Q,Y)=>{t.init(Q,Y),wG.init(Q,Y)}),G3=q("ZodEmail",(Q,Y)=>{I8.init(Q,Y),s.init(Q,Y)});var VG=q("ZodGUID",(Q,Y)=>{P8.init(Q,Y),s.init(Q,Y)});var V4=q("ZodUUID",(Q,Y)=>{b8.init(Q,Y),s.init(Q,Y)});var $3=q("ZodURL",(Q,Y)=>{E8.init(Q,Y),s.init(Q,Y)});var z3=q("ZodEmoji",(Q,Y)=>{T8.init(Q,Y),s.init(Q,Y)});var J3=q("ZodNanoID",(Q,Y)=>{S8.init(Q,Y),s.init(Q,Y)});var H3=q("ZodCUID",(Q,Y)=>{R8.init(Q,Y),s.init(Q,Y)});var U3=q("ZodCUID2",(Q,Y)=>{C8.init(Q,Y),s.init(Q,Y)});var A3=q("ZodULID",(Q,Y)=>{k8.init(Q,Y),s.init(Q,Y)});var B3=q("ZodXID",(Q,Y)=>{v8.init(Q,Y),s.init(Q,Y)});var K3=q("ZodKSUID",(Q,Y)=>{x8.init(Q,Y),s.init(Q,Y)});var D3=q("ZodIPv4",(Q,Y)=>{h8.init(Q,Y),s.init(Q,Y)});var L3=q("ZodIPv6",(Q,Y)=>{f8.init(Q,Y),s.init(Q,Y)});var F3=q("ZodCIDRv4",(Q,Y)=>{l8.init(Q,Y),s.init(Q,Y)});var q3=q("ZodCIDRv6",(Q,Y)=>{m8.init(Q,Y),s.init(Q,Y)});var O3=q("ZodBase64",(Q,Y)=>{p8.init(Q,Y),s.init(Q,Y)});var M3=q("ZodBase64URL",(Q,Y)=>{i8.init(Q,Y),s.init(Q,Y)});var V3=q("ZodE164",(Q,Y)=>{n8.init(Q,Y),s.init(Q,Y)});var N3=q("ZodJWT",(Q,Y)=>{r8.init(Q,Y),s.init(Q,Y)});var jG=q("ZodNumber",(Q,Y)=>{cQ.init(Q,Y),X0.init(Q,Y),Q.gt=(W,G)=>Q.check(L4(W,G)),Q.gte=(W,G)=>Q.check(D6(W,G)),Q.min=(W,G)=>Q.check(D6(W,G)),Q.lt=(W,G)=>Q.check(D4(W,G)),Q.lte=(W,G)=>Q.check(K6(W,G)),Q.max=(W,G)=>Q.check(K6(W,G)),Q.int=(W)=>Q.check(NG(W)),Q.safe=(W)=>Q.check(NG(W)),Q.positive=(W)=>Q.check(L4(0,W)),Q.nonnegative=(W)=>Q.check(D6(0,W)),Q.negative=(W)=>Q.check(D4(0,W)),Q.nonpositive=(W)=>Q.check(K6(0,W)),Q.multipleOf=(W,G)=>Q.check(F4(W,G)),Q.step=(W,G)=>Q.check(F4(W,G)),Q.finite=()=>Q;let X=Q._zod.bag;Q.minValue=Math.max(X.minimum??Number.NEGATIVE_INFINITY,X.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,Q.maxValue=Math.min(X.maximum??Number.POSITIVE_INFINITY,X.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,Q.isInt=(X.format??"").includes("int")||Number.isSafeInteger(X.multipleOf??0.5),Q.isFinite=!0,Q.format=X.format??null});function p(Q){return iW(jG,Q)}var Z3=q("ZodNumberFormat",(Q,Y)=>{d8.init(Q,Y),jG.init(Q,Y)});function NG(Q){return nW(Z3,Q)}var w3=q("ZodBoolean",(Q,Y)=>{o8.init(Q,Y),X0.init(Q,Y)});function z0(Q){return rW(w3,Q)}var j3=q("ZodNull",(Q,Y)=>{t8.init(Q,Y),X0.init(Q,Y)});function U9(Q){return dW(j3,Q)}var P3=q("ZodUnknown",(Q,Y)=>{a8.init(Q,Y),X0.init(Q,Y)});function e(){return oW(P3)}var b3=q("ZodNever",(Q,Y)=>{s8.init(Q,Y),X0.init(Q,Y)});function I3(Q){return tW(b3,Q)}var E3=q("ZodArray",(Q,Y)=>{e8.init(Q,Y),X0.init(Q,Y),Q.element=Y.element,Q.min=(X,W)=>Q.check(x1(X,W)),Q.nonempty=(X)=>Q.check(x1(1,X)),Q.max=(X,W)=>Q.check(q4(X,W)),Q.length=(X,W)=>Q.check(O4(X,W)),Q.unwrap=()=>Q.element});function u(Q,Y){return aW(E3,Q,Y)}var PG=q("ZodObject",(Q,Y)=>{XW.init(Q,Y),X0.init(Q,Y),m.defineLazy(Q,"shape",()=>{return Y.shape}),Q.keyof=()=>M0(Object.keys(Q._zod.def.shape)),Q.catchall=(X)=>Q.clone({...Q._zod.def,catchall:X}),Q.passthrough=()=>Q.clone({...Q._zod.def,catchall:e()}),Q.loose=()=>Q.clone({...Q._zod.def,catchall:e()}),Q.strict=()=>Q.clone({...Q._zod.def,catchall:I3()}),Q.strip=()=>Q.clone({...Q._zod.def,catchall:void 0}),Q.extend=(X)=>{return m.extend(Q,X)},Q.safeExtend=(X)=>{return m.safeExtend(Q,X)},Q.merge=(X)=>m.merge(Q,X),Q.pick=(X)=>m.pick(Q,X),Q.omit=(X)=>m.omit(Q,X),Q.partial=(...X)=>m.partial(EG,Q,X[0]),Q.required=(...X)=>m.required(TG,Q,X[0])});function P(Q,Y){let X={type:"object",shape:Q??{},...m.normalizeParams(Y)};return new PG(X)}function F0(Q,Y){return new PG({type:"object",shape:Q,catchall:e(),...m.normalizeParams(Y)})}var bG=q("ZodUnion",(Q,Y)=>{pQ.init(Q,Y),X0.init(Q,Y),Q.options=Y.options});function d(Q,Y){return new bG({type:"union",options:Q,...m.normalizeParams(Y)})}var T3=q("ZodDiscriminatedUnion",(Q,Y)=>{bG.init(Q,Y),WW.init(Q,Y)});function A9(Q,Y,X){return new T3({type:"union",options:Y,discriminator:Q,...m.normalizeParams(X)})}var S3=q("ZodIntersection",(Q,Y)=>{GW.init(Q,Y),X0.init(Q,Y)});function N4(Q,Y){return new S3({type:"intersection",left:Q,right:Y})}var R3=q("ZodRecord",(Q,Y)=>{$W.init(Q,Y),X0.init(Q,Y),Q.keyType=Y.keyType,Q.valueType=Y.valueType});function Q0(Q,Y,X){return new R3({type:"record",keyType:Q,valueType:Y,...m.normalizeParams(X)})}var J9=q("ZodEnum",(Q,Y)=>{zW.init(Q,Y),X0.init(Q,Y),Q.enum=Y.entries,Q.options=Object.values(Y.entries);let X=new Set(Object.keys(Y.entries));Q.extract=(W,G)=>{let $={};for(let z of W)if(X.has(z))$[z]=Y.entries[z];else throw Error(`Key ${z} not found in enum`);return new J9({...Y,checks:[],...m.normalizeParams(G),entries:$})},Q.exclude=(W,G)=>{let $={...Y.entries};for(let z of W)if(X.has(z))delete $[z];else throw Error(`Key ${z} not found in enum`);return new J9({...Y,checks:[],...m.normalizeParams(G),entries:$})}});function M0(Q,Y){let X=Array.isArray(Q)?Object.fromEntries(Q.map((W)=>[W,W])):Q;return new J9({type:"enum",entries:X,...m.normalizeParams(Y)})}var C3=q("ZodLiteral",(Q,Y)=>{JW.init(Q,Y),X0.init(Q,Y),Q.values=new Set(Y.values),Object.defineProperty(Q,"value",{get(){if(Y.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return Y.values[0]}})});function b(Q,Y){return new C3({type:"literal",values:Array.isArray(Q)?Q:[Q],...m.normalizeParams(Y)})}var k3=q("ZodTransform",(Q,Y)=>{HW.init(Q,Y),X0.init(Q,Y),Q._zod.parse=(X,W)=>{if(W.direction==="backward")throw new X6(Q.constructor.name);X.addIssue=($)=>{if(typeof $==="string")X.issues.push(m.issue($,X.value,Y));else{let z=$;if(z.fatal)z.continue=!1;z.code??(z.code="custom"),z.input??(z.input=X.value),z.inst??(z.inst=Q),X.issues.push(m.issue(z))}};let G=Y.transform(X.value,X);if(G instanceof Promise)return G.then(($)=>{return X.value=$,X});return X.value=G,X}});function IG(Q){return new k3({type:"transform",transform:Q})}var EG=q("ZodOptional",(Q,Y)=>{UW.init(Q,Y),X0.init(Q,Y),Q.unwrap=()=>Q._zod.def.innerType});function Y0(Q){return new EG({type:"optional",innerType:Q})}var v3=q("ZodNullable",(Q,Y)=>{AW.init(Q,Y),X0.init(Q,Y),Q.unwrap=()=>Q._zod.def.innerType});function ZG(Q){return new v3({type:"nullable",innerType:Q})}var x3=q("ZodDefault",(Q,Y)=>{BW.init(Q,Y),X0.init(Q,Y),Q.unwrap=()=>Q._zod.def.innerType,Q.removeDefault=Q.unwrap});function _3(Q,Y){return new x3({type:"default",innerType:Q,get defaultValue(){return typeof Y==="function"?Y():m.shallowClone(Y)}})}var g3=q("ZodPrefault",(Q,Y)=>{KW.init(Q,Y),X0.init(Q,Y),Q.unwrap=()=>Q._zod.def.innerType});function y3(Q,Y){return new g3({type:"prefault",innerType:Q,get defaultValue(){return typeof Y==="function"?Y():m.shallowClone(Y)}})}var TG=q("ZodNonOptional",(Q,Y)=>{DW.init(Q,Y),X0.init(Q,Y),Q.unwrap=()=>Q._zod.def.innerType});function u3(Q,Y){return new TG({type:"nonoptional",innerType:Q,...m.normalizeParams(Y)})}var h3=q("ZodCatch",(Q,Y)=>{LW.init(Q,Y),X0.init(Q,Y),Q.unwrap=()=>Q._zod.def.innerType,Q.removeCatch=Q.unwrap});function f3(Q,Y){return new h3({type:"catch",innerType:Q,catchValue:typeof Y==="function"?Y:()=>Y})}var l3=q("ZodPipe",(Q,Y)=>{FW.init(Q,Y),X0.init(Q,Y),Q.in=Y.in,Q.out=Y.out});function H9(Q,Y){return new l3({type:"pipe",in:Q,out:Y})}var m3=q("ZodReadonly",(Q,Y)=>{qW.init(Q,Y),X0.init(Q,Y),Q.unwrap=()=>Q._zod.def.innerType});function c3(Q){return new m3({type:"readonly",innerType:Q})}var SG=q("ZodCustom",(Q,Y)=>{OW.init(Q,Y),X0.init(Q,Y)});function RG(Q,Y){return sW(SG,Q??(()=>!0),Y)}function p3(Q,Y={}){return eW(SG,Q,Y)}function i3(Q){return QG(Q)}function B9(Q,Y){return H9(IG(Q),Y)}I0(iQ());var K9="2025-11-25";var CG=[K9,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],U1="io.modelcontextprotocol/related-task",w4="2.0",U0=RG((Q)=>Q!==null&&(typeof Q==="object"||typeof Q==="function")),kG=d([F(),p().int()]),vG=F(),mZ=F0({ttl:d([p(),U9()]).optional(),pollInterval:p().optional()}),n3=P({ttl:p().optional()}),r3=P({taskId:F()}),D9=F0({progressToken:kG.optional(),[U1]:r3.optional()}),b0=P({_meta:D9.optional()}),q6=b0.extend({task:n3.optional()}),xG=(Q)=>q6.safeParse(Q).success,A0=P({method:F(),params:b0.loose().optional()}),E0=P({_meta:D9.optional()}),T0=P({method:F(),params:E0.loose().optional()}),B0=F0({_meta:D9.optional()}),j4=d([F(),p().int()]),_G=P({jsonrpc:b(w4),id:j4,...A0.shape}).strict(),L9=(Q)=>_G.safeParse(Q).success,gG=P({jsonrpc:b(w4),...T0.shape}).strict(),yG=(Q)=>gG.safeParse(Q).success,F9=P({jsonrpc:b(w4),id:j4,result:B0}).strict(),O6=(Q)=>F9.safeParse(Q).success;var h;(function(Q){Q[Q.ConnectionClosed=-32000]="ConnectionClosed",Q[Q.RequestTimeout=-32001]="RequestTimeout",Q[Q.ParseError=-32700]="ParseError",Q[Q.InvalidRequest=-32600]="InvalidRequest",Q[Q.MethodNotFound=-32601]="MethodNotFound",Q[Q.InvalidParams=-32602]="InvalidParams",Q[Q.InternalError=-32603]="InternalError",Q[Q.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(h||(h={}));var q9=P({jsonrpc:b(w4),id:j4.optional(),error:P({code:p().int(),message:F(),data:e().optional()})}).strict();var uG=(Q)=>q9.safeParse(Q).success;var cZ=d([_G,gG,F9,q9]),pZ=d([F9,q9]),P4=B0.strict(),d3=E0.extend({requestId:j4.optional(),reason:F().optional()}),b4=T0.extend({method:b("notifications/cancelled"),params:d3}),o3=P({src:F(),mimeType:F().optional(),sizes:u(F()).optional(),theme:M0(["light","dark"]).optional()}),M6=P({icons:u(o3).optional()}),g1=P({name:F(),title:F().optional()}),hG=g1.extend({...g1.shape,...M6.shape,version:F(),websiteUrl:F().optional(),description:F().optional()}),t3=N4(P({applyDefaults:z0().optional()}),Q0(F(),e())),a3=B9((Q)=>{if(Q&&typeof Q==="object"&&!Array.isArray(Q)){if(Object.keys(Q).length===0)return{form:{}}}return Q},N4(P({form:t3.optional(),url:U0.optional()}),Q0(F(),e()).optional())),s3=F0({list:U0.optional(),cancel:U0.optional(),requests:F0({sampling:F0({createMessage:U0.optional()}).optional(),elicitation:F0({create:U0.optional()}).optional()}).optional()}),e3=F0({list:U0.optional(),cancel:U0.optional(),requests:F0({tools:F0({call:U0.optional()}).optional()}).optional()}),QU=P({experimental:Q0(F(),U0).optional(),sampling:P({context:U0.optional(),tools:U0.optional()}).optional(),elicitation:a3.optional(),roots:P({listChanged:z0().optional()}).optional(),tasks:s3.optional()}),YU=b0.extend({protocolVersion:F(),capabilities:QU,clientInfo:hG}),O9=A0.extend({method:b("initialize"),params:YU});var XU=P({experimental:Q0(F(),U0).optional(),logging:U0.optional(),completions:U0.optional(),prompts:P({listChanged:z0().optional()}).optional(),resources:P({subscribe:z0().optional(),listChanged:z0().optional()}).optional(),tools:P({listChanged:z0().optional()}).optional(),tasks:e3.optional()}),WU=B0.extend({protocolVersion:F(),capabilities:XU,serverInfo:hG,instructions:F().optional()}),M9=T0.extend({method:b("notifications/initialized"),params:E0.optional()});var I4=A0.extend({method:b("ping"),params:b0.optional()}),GU=P({progress:p(),total:Y0(p()),message:Y0(F())}),$U=P({...E0.shape,...GU.shape,progressToken:kG}),E4=T0.extend({method:b("notifications/progress"),params:$U}),zU=b0.extend({cursor:vG.optional()}),V6=A0.extend({params:zU.optional()}),N6=B0.extend({nextCursor:vG.optional()}),JU=M0(["working","input_required","completed","failed","cancelled"]),Z6=P({taskId:F(),status:JU,ttl:d([p(),U9()]),createdAt:F(),lastUpdatedAt:F(),pollInterval:Y0(p()),statusMessage:Y0(F())}),y1=B0.extend({task:Z6}),HU=E0.merge(Z6),w6=T0.extend({method:b("notifications/tasks/status"),params:HU}),T4=A0.extend({method:b("tasks/get"),params:b0.extend({taskId:F()})}),S4=B0.merge(Z6),R4=A0.extend({method:b("tasks/result"),params:b0.extend({taskId:F()})}),iZ=B0.loose(),C4=V6.extend({method:b("tasks/list")}),k4=N6.extend({tasks:u(Z6)}),v4=A0.extend({method:b("tasks/cancel"),params:b0.extend({taskId:F()})}),fG=B0.merge(Z6),lG=P({uri:F(),mimeType:Y0(F()),_meta:Q0(F(),e()).optional()}),mG=lG.extend({text:F()}),V9=F().refine((Q)=>{try{return atob(Q),!0}catch{return!1}},{message:"Invalid Base64 string"}),cG=lG.extend({blob:V9}),j6=M0(["user","assistant"]),u1=P({audience:u(j6).optional(),priority:p().min(0).max(1).optional(),lastModified:F6.datetime({offset:!0}).optional()}),pG=P({...g1.shape,...M6.shape,uri:F(),description:Y0(F()),mimeType:Y0(F()),annotations:u1.optional(),_meta:Y0(F0({}))}),UU=P({...g1.shape,...M6.shape,uriTemplate:F(),description:Y0(F()),mimeType:Y0(F()),annotations:u1.optional(),_meta:Y0(F0({}))}),N9=V6.extend({method:b("resources/list")}),AU=N6.extend({resources:u(pG)}),BU=V6.extend({method:b("resources/templates/list")}),KU=N6.extend({resourceTemplates:u(UU)}),Z9=b0.extend({uri:F()}),DU=Z9,w9=A0.extend({method:b("resources/read"),params:DU}),LU=B0.extend({contents:u(d([mG,cG]))}),FU=T0.extend({method:b("notifications/resources/list_changed"),params:E0.optional()}),qU=Z9,OU=A0.extend({method:b("resources/subscribe"),params:qU}),MU=Z9,VU=A0.extend({method:b("resources/unsubscribe"),params:MU}),NU=E0.extend({uri:F()}),ZU=T0.extend({method:b("notifications/resources/updated"),params:NU}),wU=P({name:F(),description:Y0(F()),required:Y0(z0())}),jU=P({...g1.shape,...M6.shape,description:Y0(F()),arguments:Y0(u(wU)),_meta:Y0(F0({}))}),PU=V6.extend({method:b("prompts/list")}),bU=N6.extend({prompts:u(jU)}),IU=b0.extend({name:F(),arguments:Q0(F(),F()).optional()}),EU=A0.extend({method:b("prompts/get"),params:IU}),j9=P({type:b("text"),text:F(),annotations:u1.optional(),_meta:Q0(F(),e()).optional()}),P9=P({type:b("image"),data:V9,mimeType:F(),annotations:u1.optional(),_meta:Q0(F(),e()).optional()}),b9=P({type:b("audio"),data:V9,mimeType:F(),annotations:u1.optional(),_meta:Q0(F(),e()).optional()}),TU=P({type:b("tool_use"),name:F(),id:F(),input:Q0(F(),e()),_meta:Q0(F(),e()).optional()}),SU=P({type:b("resource"),resource:d([mG,cG]),annotations:u1.optional(),_meta:Q0(F(),e()).optional()}),RU=pG.extend({type:b("resource_link")}),I9=d([j9,P9,b9,RU,SU]),CU=P({role:j6,content:I9}),kU=B0.extend({description:F().optional(),messages:u(CU)}),vU=T0.extend({method:b("notifications/prompts/list_changed"),params:E0.optional()}),xU=P({title:F().optional(),readOnlyHint:z0().optional(),destructiveHint:z0().optional(),idempotentHint:z0().optional(),openWorldHint:z0().optional()}),_U=P({taskSupport:M0(["required","optional","forbidden"]).optional()}),iG=P({...g1.shape,...M6.shape,description:F().optional(),inputSchema:P({type:b("object"),properties:Q0(F(),U0).optional(),required:u(F()).optional()}).catchall(e()),outputSchema:P({type:b("object"),properties:Q0(F(),U0).optional(),required:u(F()).optional()}).catchall(e()).optional(),annotations:xU.optional(),execution:_U.optional(),_meta:Q0(F(),e()).optional()}),E9=V6.extend({method:b("tools/list")}),gU=N6.extend({tools:u(iG)}),x4=B0.extend({content:u(I9).default([]),structuredContent:Q0(F(),e()).optional(),isError:z0().optional()}),nZ=x4.or(B0.extend({toolResult:e()})),yU=q6.extend({name:F(),arguments:Q0(F(),e()).optional()}),P6=A0.extend({method:b("tools/call"),params:yU}),uU=T0.extend({method:b("notifications/tools/list_changed"),params:E0.optional()}),rZ=P({autoRefresh:z0().default(!0),debounceMs:p().int().nonnegative().default(300)}),b6=M0(["debug","info","notice","warning","error","critical","alert","emergency"]),hU=b0.extend({level:b6}),T9=A0.extend({method:b("logging/setLevel"),params:hU}),fU=E0.extend({level:b6,logger:F().optional(),data:e()}),lU=T0.extend({method:b("notifications/message"),params:fU}),mU=P({name:F().optional()}),cU=P({hints:u(mU).optional(),costPriority:p().min(0).max(1).optional(),speedPriority:p().min(0).max(1).optional(),intelligencePriority:p().min(0).max(1).optional()}),pU=P({mode:M0(["auto","required","none"]).optional()}),iU=P({type:b("tool_result"),toolUseId:F().describe("The unique identifier for the corresponding tool call."),content:u(I9).default([]),structuredContent:P({}).loose().optional(),isError:z0().optional(),_meta:Q0(F(),e()).optional()}),nU=A9("type",[j9,P9,b9]),Z4=A9("type",[j9,P9,b9,TU,iU]),rU=P({role:j6,content:d([Z4,u(Z4)]),_meta:Q0(F(),e()).optional()}),dU=q6.extend({messages:u(rU),modelPreferences:cU.optional(),systemPrompt:F().optional(),includeContext:M0(["none","thisServer","allServers"]).optional(),temperature:p().optional(),maxTokens:p().int(),stopSequences:u(F()).optional(),metadata:U0.optional(),tools:u(iG).optional(),toolChoice:pU.optional()}),oU=A0.extend({method:b("sampling/createMessage"),params:dU}),S9=B0.extend({model:F(),stopReason:Y0(M0(["endTurn","stopSequence","maxTokens"]).or(F())),role:j6,content:nU}),R9=B0.extend({model:F(),stopReason:Y0(M0(["endTurn","stopSequence","maxTokens","toolUse"]).or(F())),role:j6,content:d([Z4,u(Z4)])}),tU=P({type:b("boolean"),title:F().optional(),description:F().optional(),default:z0().optional()}),aU=P({type:b("string"),title:F().optional(),description:F().optional(),minLength:p().optional(),maxLength:p().optional(),format:M0(["email","uri","date","date-time"]).optional(),default:F().optional()}),sU=P({type:M0(["number","integer"]),title:F().optional(),description:F().optional(),minimum:p().optional(),maximum:p().optional(),default:p().optional()}),eU=P({type:b("string"),title:F().optional(),description:F().optional(),enum:u(F()),default:F().optional()}),QA=P({type:b("string"),title:F().optional(),description:F().optional(),oneOf:u(P({const:F(),title:F()})),default:F().optional()}),YA=P({type:b("string"),title:F().optional(),description:F().optional(),enum:u(F()),enumNames:u(F()).optional(),default:F().optional()}),XA=d([eU,QA]),WA=P({type:b("array"),title:F().optional(),description:F().optional(),minItems:p().optional(),maxItems:p().optional(),items:P({type:b("string"),enum:u(F())}),default:u(F()).optional()}),GA=P({type:b("array"),title:F().optional(),description:F().optional(),minItems:p().optional(),maxItems:p().optional(),items:P({anyOf:u(P({const:F(),title:F()}))}),default:u(F()).optional()}),$A=d([WA,GA]),zA=d([YA,XA,$A]),JA=d([zA,tU,aU,sU]),HA=q6.extend({mode:b("form").optional(),message:F(),requestedSchema:P({type:b("object"),properties:Q0(F(),JA),required:u(F()).optional()})}),UA=q6.extend({mode:b("url"),message:F(),elicitationId:F(),url:F().url()}),AA=d([HA,UA]),BA=A0.extend({method:b("elicitation/create"),params:AA}),KA=E0.extend({elicitationId:F()}),DA=T0.extend({method:b("notifications/elicitation/complete"),params:KA}),_4=B0.extend({action:M0(["accept","decline","cancel"]),content:B9((Q)=>Q===null?void 0:Q,Q0(F(),d([F(),p(),z0(),u(F())])).optional())}),LA=P({type:b("ref/resource"),uri:F()});var FA=P({type:b("ref/prompt"),name:F()}),qA=b0.extend({ref:d([FA,LA]),argument:P({name:F(),value:F()}),context:P({arguments:Q0(F(),F()).optional()}).optional()}),OA=A0.extend({method:b("completion/complete"),params:qA});var MA=B0.extend({completion:F0({values:u(F()).max(100),total:Y0(p().int()),hasMore:Y0(z0())})}),VA=P({uri:F().startsWith("file://"),name:F().optional(),_meta:Q0(F(),e()).optional()}),NA=A0.extend({method:b("roots/list"),params:b0.optional()}),C9=B0.extend({roots:u(VA)}),ZA=T0.extend({method:b("notifications/roots/list_changed"),params:E0.optional()}),dZ=d([I4,O9,OA,T9,EU,PU,N9,BU,w9,OU,VU,P6,E9,T4,R4,C4,v4]),oZ=d([b4,E4,M9,ZA,w6]),tZ=d([P4,S9,R9,_4,C9,S4,k4,y1]),aZ=d([I4,oU,BA,NA,T4,R4,C4,v4]),sZ=d([b4,E4,lU,ZU,FU,uU,vU,w6,DA]),eZ=d([P4,WU,MA,kU,bU,AU,KU,LU,x4,gU,S4,k4,y1]);class _ extends Error{constructor(Q,Y,X){super(`MCP error ${Q}: ${Y}`);this.code=Q,this.data=X,this.name="McpError"}static fromError(Q,Y,X){if(Q===h.UrlElicitationRequired&&X){let W=X;if(W.elicitations)return new nG(W.elicitations,Y)}return new _(Q,Y,X)}}class nG extends _{constructor(Q,Y=`URL elicitation${Q.length>1?"s":""} required`){super(h.UrlElicitationRequired,Y,{elicitations:Q})}get elicitations(){return this.data?.elicitations??[]}}function A1(Q){return Q==="completed"||Q==="failed"||Q==="cancelled"}var wA=Symbol("Let zodToJsonSchema decide on which parser to use");var kw=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function k9(Q){let X=M4(Q)?.method;if(!X)throw Error("Schema is missing a method literal");let W=YG(X);if(typeof W!=="string")throw Error("Schema method literal must be a string");return W}function v9(Q,Y){let X=H1(Q,Y);if(!X.success)throw X.error;return X.data}var TA=60000;class x9{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(b4,(Y)=>{this._oncancel(Y)}),this.setNotificationHandler(E4,(Y)=>{this._onprogress(Y)}),this.setRequestHandler(I4,(Y)=>({})),this._taskStore=Q?.taskStore,this._taskMessageQueue=Q?.taskMessageQueue,this._taskStore)this.setRequestHandler(T4,async(Y,X)=>{let W=await this._taskStore.getTask(Y.params.taskId,X.sessionId);if(!W)throw new _(h.InvalidParams,"Failed to retrieve task: Task not found");return{...W}}),this.setRequestHandler(R4,async(Y,X)=>{let W=async()=>{let G=Y.params.taskId;if(this._taskMessageQueue){let z;while(z=await this._taskMessageQueue.dequeue(G,X.sessionId)){if(z.type==="response"||z.type==="error"){let J=z.message,H=J.id,U=this._requestResolvers.get(H);if(U)if(this._requestResolvers.delete(H),z.type==="response")U(J);else{let A=J,B=new _(A.error.code,A.error.message,A.error.data);U(B)}else{let A=z.type==="response"?"Response":"Error";this._onerror(Error(`${A} handler missing for request ${H}`))}continue}await this._transport?.send(z.message,{relatedRequestId:X.requestId})}}let $=await this._taskStore.getTask(G,X.sessionId);if(!$)throw new _(h.InvalidParams,`Task not found: ${G}`);if(!A1($.status))return await this._waitForTaskUpdate(G,X.signal),await W();if(A1($.status)){let z=await this._taskStore.getTaskResult(G,X.sessionId);return this._clearTaskQueue(G),{...z,_meta:{...z._meta,[U1]:{taskId:G}}}}return await W()};return await W()}),this.setRequestHandler(C4,async(Y,X)=>{try{let{tasks:W,nextCursor:G}=await this._taskStore.listTasks(Y.params?.cursor,X.sessionId);return{tasks:W,nextCursor:G,_meta:{}}}catch(W){throw new _(h.InvalidParams,`Failed to list tasks: ${W instanceof Error?W.message:String(W)}`)}}),this.setRequestHandler(v4,async(Y,X)=>{try{let W=await this._taskStore.getTask(Y.params.taskId,X.sessionId);if(!W)throw new _(h.InvalidParams,`Task not found: ${Y.params.taskId}`);if(A1(W.status))throw new _(h.InvalidParams,`Cannot cancel task in terminal status: ${W.status}`);await this._taskStore.updateTaskStatus(Y.params.taskId,"cancelled","Client cancelled task execution.",X.sessionId),this._clearTaskQueue(Y.params.taskId);let G=await this._taskStore.getTask(Y.params.taskId,X.sessionId);if(!G)throw new _(h.InvalidParams,`Task not found after cancellation: ${Y.params.taskId}`);return{_meta:{},...G}}catch(W){if(W instanceof _)throw W;throw new _(h.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,Y,X,W,G=!1){this._timeoutInfo.set(Q,{timeoutId:setTimeout(W,Y),startTime:Date.now(),timeout:Y,maxTotalTimeout:X,resetTimeoutOnProgress:G,onTimeout:W})}_resetTimeout(Q){let Y=this._timeoutInfo.get(Q);if(!Y)return!1;let X=Date.now()-Y.startTime;if(Y.maxTotalTimeout&&X>=Y.maxTotalTimeout)throw this._timeoutInfo.delete(Q),_.fromError(h.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:Y.maxTotalTimeout,totalElapsed:X});return clearTimeout(Y.timeoutId),Y.timeoutId=setTimeout(Y.onTimeout,Y.timeout),!0}_cleanupTimeout(Q){let Y=this._timeoutInfo.get(Q);if(Y)clearTimeout(Y.timeoutId),this._timeoutInfo.delete(Q)}async connect(Q){this._transport=Q;let Y=this.transport?.onclose;this._transport.onclose=()=>{Y?.(),this._onclose()};let X=this.transport?.onerror;this._transport.onerror=(G)=>{X?.(G),this._onerror(G)};let W=this._transport?.onmessage;this._transport.onmessage=(G,$)=>{if(W?.(G,$),O6(G)||uG(G))this._onresponse(G);else if(L9(G))this._onrequest(G,$);else if(yG(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 Y=_.fromError(h.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let X of Q.values())X(Y)}_onerror(Q){this.onerror?.(Q)}_onnotification(Q){let Y=this._notificationHandlers.get(Q.method)??this.fallbackNotificationHandler;if(Y===void 0)return;Promise.resolve().then(()=>Y(Q)).catch((X)=>this._onerror(Error(`Uncaught error in notification handler: ${X}`)))}_onrequest(Q,Y){let X=this._requestHandlers.get(Q.method)??this.fallbackRequestHandler,W=this._transport,G=Q.params?._meta?.[U1]?.taskId;if(X===void 0){let U={jsonrpc:"2.0",id:Q.id,error:{code:h.MethodNotFound,message:"Method not found"}};if(G&&this._taskMessageQueue)this._enqueueTaskMessage(G,{type:"error",message:U,timestamp:Date.now()},W?.sessionId).catch((A)=>this._onerror(Error(`Failed to enqueue error response: ${A}`)));else W?.send(U).catch((A)=>this._onerror(Error(`Failed to send an error response: ${A}`)));return}let $=new AbortController;this._requestHandlerAbortControllers.set(Q.id,$);let z=xG(Q.params)?Q.params.task:void 0,J=this._taskStore?this.requestTaskStore(Q,W?.sessionId):void 0,H={signal:$.signal,sessionId:W?.sessionId,_meta:Q.params?._meta,sendNotification:async(U)=>{let A={relatedRequestId:Q.id};if(G)A.relatedTask={taskId:G};await this.notification(U,A)},sendRequest:async(U,A,B)=>{let K={...B,relatedRequestId:Q.id};if(G&&!K.relatedTask)K.relatedTask={taskId:G};let D=K.relatedTask?.taskId??G;if(D&&J)await J.updateTaskStatus(D,"input_required");return await this.request(U,A,K)},authInfo:Y?.authInfo,requestId:Q.id,requestInfo:Y?.requestInfo,taskId:G,taskStore:J,taskRequestedTtl:z?.ttl,closeSSEStream:Y?.closeSSEStream,closeStandaloneSSEStream:Y?.closeStandaloneSSEStream};Promise.resolve().then(()=>{if(z)this.assertTaskHandlerCapability(Q.method)}).then(()=>X(Q,H)).then(async(U)=>{if($.signal.aborted)return;let A={result:U,jsonrpc:"2.0",id:Q.id};if(G&&this._taskMessageQueue)await this._enqueueTaskMessage(G,{type:"response",message:A,timestamp:Date.now()},W?.sessionId);else await W?.send(A)},async(U)=>{if($.signal.aborted)return;let A={jsonrpc:"2.0",id:Q.id,error:{code:Number.isSafeInteger(U.code)?U.code:h.InternalError,message:U.message??"Internal error",...U.data!==void 0&&{data:U.data}}};if(G&&this._taskMessageQueue)await this._enqueueTaskMessage(G,{type:"error",message:A,timestamp:Date.now()},W?.sessionId);else await W?.send(A)}).catch((U)=>this._onerror(Error(`Failed to send response: ${U}`))).finally(()=>{this._requestHandlerAbortControllers.delete(Q.id)})}_onprogress(Q){let{progressToken:Y,...X}=Q.params,W=Number(Y),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),z=this._timeoutInfo.get(W);if(z&&$&&z.resetTimeoutOnProgress)try{this._resetTimeout(W)}catch(J){this._responseHandlers.delete(W),this._progressHandlers.delete(W),this._cleanupTimeout(W),$(J);return}G(X)}_onresponse(Q){let Y=Number(Q.id),X=this._requestResolvers.get(Y);if(X){if(this._requestResolvers.delete(Y),O6(Q))X(Q);else{let $=new _(Q.error.code,Q.error.message,Q.error.data);X($)}return}let W=this._responseHandlers.get(Y);if(W===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(Q)}`));return}this._responseHandlers.delete(Y),this._cleanupTimeout(Y);let G=!1;if(O6(Q)&&Q.result&&typeof Q.result==="object"){let $=Q.result;if($.task&&typeof $.task==="object"){let z=$.task;if(typeof z.taskId==="string")G=!0,this._taskProgressTokens.set(z.taskId,Y)}}if(!G)this._progressHandlers.delete(Y);if(O6(Q))W(Q);else{let $=_.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,Y,X){let{task:W}=X??{};if(!W){try{yield{type:"result",result:await this.request(Q,Y,X)}}catch($){yield{type:"error",error:$ instanceof _?$:new _(h.InternalError,String($))}}return}let G;try{let $=await this.request(Q,y1,X);if($.task)G=$.task.taskId,yield{type:"taskCreated",task:$.task};else throw new _(h.InternalError,"Task creation did not return a task");while(!0){let z=await this.getTask({taskId:G},X);if(yield{type:"taskStatus",task:z},A1(z.status)){if(z.status==="completed")yield{type:"result",result:await this.getTaskResult({taskId:G},Y,X)};else if(z.status==="failed")yield{type:"error",error:new _(h.InternalError,`Task ${G} failed`)};else if(z.status==="cancelled")yield{type:"error",error:new _(h.InternalError,`Task ${G} was cancelled`)};return}if(z.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:G},Y,X)};return}let J=z.pollInterval??this._options?.defaultTaskPollInterval??1000;await new Promise((H)=>setTimeout(H,J)),X?.signal?.throwIfAborted()}}catch($){yield{type:"error",error:$ instanceof _?$:new _(h.InternalError,String($))}}}request(Q,Y,X){let{relatedRequestId:W,resumptionToken:G,onresumptiontoken:$,task:z,relatedTask:J}=X??{};return new Promise((H,U)=>{let A=(V)=>{U(V)};if(!this._transport){A(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod(Q.method),z)this.assertTaskCapability(Q.method)}catch(V){A(V);return}X?.signal?.throwIfAborted();let B=this._requestMessageId++,K={...Q,jsonrpc:"2.0",id:B};if(X?.onprogress)this._progressHandlers.set(B,X.onprogress),K.params={...Q.params,_meta:{...Q.params?._meta||{},progressToken:B}};if(z)K.params={...K.params,task:z};if(J)K.params={...K.params,_meta:{...K.params?._meta||{},[U1]:J}};let D=(V)=>{this._responseHandlers.delete(B),this._progressHandlers.delete(B),this._cleanupTimeout(B),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:B,reason:String(V)}},{relatedRequestId:W,resumptionToken:G,onresumptiontoken:$}).catch((T)=>this._onerror(Error(`Failed to send cancellation: ${T}`)));let R=V instanceof _?V:new _(h.RequestTimeout,String(V));U(R)};this._responseHandlers.set(B,(V)=>{if(X?.signal?.aborted)return;if(V instanceof Error)return U(V);try{let R=H1(Y,V.result);if(!R.success)U(R.error);else H(R.data)}catch(R){U(R)}}),X?.signal?.addEventListener("abort",()=>{D(X?.signal?.reason)});let O=X?.timeout??TA,M=()=>D(_.fromError(h.RequestTimeout,"Request timed out",{timeout:O}));this._setupTimeout(B,O,X?.maxTotalTimeout,M,X?.resetTimeoutOnProgress??!1);let Z=J?.taskId;if(Z){let V=(R)=>{let T=this._responseHandlers.get(B);if(T)T(R);else this._onerror(Error(`Response handler missing for side-channeled request ${B}`))};this._requestResolvers.set(B,V),this._enqueueTaskMessage(Z,{type:"request",message:K,timestamp:Date.now()}).catch((R)=>{this._cleanupTimeout(B),U(R)})}else this._transport.send(K,{relatedRequestId:W,resumptionToken:G,onresumptiontoken:$}).catch((V)=>{this._cleanupTimeout(B),U(V)})})}async getTask(Q,Y){return this.request({method:"tasks/get",params:Q},S4,Y)}async getTaskResult(Q,Y,X){return this.request({method:"tasks/result",params:Q},Y,X)}async listTasks(Q,Y){return this.request({method:"tasks/list",params:Q},k4,Y)}async cancelTask(Q,Y){return this.request({method:"tasks/cancel",params:Q},fG,Y)}async notification(Q,Y){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(Q.method);let X=Y?.relatedTask?.taskId;if(X){let z={...Q,jsonrpc:"2.0",params:{...Q.params,_meta:{...Q.params?._meta||{},[U1]:Y.relatedTask}}};await this._enqueueTaskMessage(X,{type:"notification",message:z,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(Q.method)&&!Q.params&&!Y?.relatedRequestId&&!Y?.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 z={...Q,jsonrpc:"2.0"};if(Y?.relatedTask)z={...z,params:{...z.params,_meta:{...z.params?._meta||{},[U1]:Y.relatedTask}}};this._transport?.send(z,Y).catch((J)=>this._onerror(J))});return}let $={...Q,jsonrpc:"2.0"};if(Y?.relatedTask)$={...$,params:{...$.params,_meta:{...$.params?._meta||{},[U1]:Y.relatedTask}}};await this._transport.send($,Y)}setRequestHandler(Q,Y){let X=k9(Q);this.assertRequestHandlerCapability(X),this._requestHandlers.set(X,(W,G)=>{let $=v9(Q,W);return Promise.resolve(Y($,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,Y){let X=k9(Q);this._notificationHandlers.set(X,(W)=>{let G=v9(Q,W);return Promise.resolve(Y(G))})}removeNotificationHandler(Q){this._notificationHandlers.delete(Q)}_cleanupTaskProgressHandler(Q){let Y=this._taskProgressTokens.get(Q);if(Y!==void 0)this._progressHandlers.delete(Y),this._taskProgressTokens.delete(Q)}async _enqueueTaskMessage(Q,Y,X){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,Y,X,W)}async _clearTaskQueue(Q,Y){if(this._taskMessageQueue){let X=await this._taskMessageQueue.dequeueAll(Q,Y);for(let W of X)if(W.type==="request"&&L9(W.message)){let G=W.message.id,$=this._requestResolvers.get(G);if($)$(new _(h.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,Y){let X=this._options?.defaultTaskPollInterval??1000;try{let W=await this._taskStore?.getTask(Q);if(W?.pollInterval)X=W.pollInterval}catch{}return new Promise((W,G)=>{if(Y.aborted){G(new _(h.InvalidRequest,"Request cancelled"));return}let $=setTimeout(W,X);Y.addEventListener("abort",()=>{clearTimeout($),G(new _(h.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(Q,Y){let X=this._taskStore;if(!X)throw Error("No task store configured");return{createTask:async(W)=>{if(!Q)throw Error("No request provided");return await X.createTask(W,Q.id,{method:Q.method,params:Q.params},Y)},getTask:async(W)=>{let G=await X.getTask(W,Y);if(!G)throw new _(h.InvalidParams,"Failed to retrieve task: Task not found");return G},storeTaskResult:async(W,G,$)=>{await X.storeTaskResult(W,G,$,Y);let z=await X.getTask(W,Y);if(z){let J=w6.parse({method:"notifications/tasks/status",params:z});if(await this.notification(J),A1(z.status))this._cleanupTaskProgressHandler(W)}},getTaskResult:(W)=>{return X.getTaskResult(W,Y)},updateTaskStatus:async(W,G,$)=>{let z=await X.getTask(W,Y);if(!z)throw new _(h.InvalidParams,`Task "${W}" not found - it may have been cleaned up`);if(A1(z.status))throw new _(h.InvalidParams,`Cannot update task "${W}" from terminal status "${z.status}" to "${G}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await X.updateTaskStatus(W,G,$,Y);let J=await X.getTask(W,Y);if(J){let H=w6.parse({method:"notifications/tasks/status",params:J});if(await this.notification(H),A1(J.status))this._cleanupTaskProgressHandler(W)}},listTasks:(W)=>{return X.listTasks(W,Y)}}}}function rG(Q){return Q!==null&&typeof Q==="object"&&!Array.isArray(Q)}function dG(Q,Y){let X={...Q};for(let W in Y){let G=W,$=Y[G];if($===void 0)continue;let z=X[G];if(rG(z)&&rG($))X[G]={...z,...$};else X[G]=$}return X}var b5=QX(TY(),1),I5=QX(P5(),1);function yM(){let Q=new b5.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return I5.default(Q),Q}class uY{constructor(Q){this._ajv=Q??yM()}getValidator(Q){let Y="$id"in Q&&typeof Q.$id==="string"?this._ajv.getSchema(Q.$id)??this._ajv.compile(Q):this._ajv.compile(Q);return(X)=>{if(Y(X))return{valid:!0,data:X,errorMessage:void 0};else return{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(Y.errors)}}}}class hY{constructor(Q){this._server=Q}requestStream(Q,Y,X){return this._server.requestStream(Q,Y,X)}async getTask(Q,Y){return this._server.getTask({taskId:Q},Y)}async getTaskResult(Q,Y,X){return this._server.getTaskResult({taskId:Q},Y,X)}async listTasks(Q,Y){return this._server.listTasks(Q?{cursor:Q}:void 0,Y)}async cancelTask(Q,Y){return this._server.cancelTask({taskId:Q},Y)}}function E5(Q,Y,X){if(!Q)throw Error(`${X} does not support task creation (required for ${Y})`);switch(Y){case"tools/call":if(!Q.tools?.call)throw Error(`${X} does not support task creation for tools/call (required for ${Y})`);break;default:break}}function T5(Q,Y,X){if(!Q)throw Error(`${X} does not support task creation (required for ${Y})`);switch(Y){case"sampling/createMessage":if(!Q.sampling?.createMessage)throw Error(`${X} does not support task creation for sampling/createMessage (required for ${Y})`);break;case"elicitation/create":if(!Q.elicitation?.create)throw Error(`${X} does not support task creation for elicitation/create (required for ${Y})`);break;default:break}}class fY extends x9{constructor(Q,Y){super(Y);if(this._serverInfo=Q,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(b6.options.map((X,W)=>[X,W])),this.isMessageIgnored=(X,W)=>{let G=this._loggingLevels.get(W);return G?this.LOG_LEVEL_SEVERITY.get(X)<this.LOG_LEVEL_SEVERITY.get(G):!1},this._capabilities=Y?.capabilities??{},this._instructions=Y?.instructions,this._jsonSchemaValidator=Y?.jsonSchemaValidator??new uY,this.setRequestHandler(O9,(X)=>this._oninitialize(X)),this.setNotificationHandler(M9,()=>this.oninitialized?.()),this._capabilities.logging)this.setRequestHandler(T9,async(X,W)=>{let G=W.sessionId||W.requestInfo?.headers["mcp-session-id"]||void 0,{level:$}=X.params,z=b6.safeParse($);if(z.success)this._loggingLevels.set(G,z.data);return{}})}get experimental(){if(!this._experimental)this._experimental={tasks:new hY(this)};return this._experimental}registerCapabilities(Q){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=dG(this._capabilities,Q)}setRequestHandler(Q,Y){let W=M4(Q)?.method;if(!W)throw Error("Schema is missing a method literal");let G;if(_1(W)){let z=W;G=z._zod?.def?.value??z.value}else{let z=W;G=z._def?.value??z.value}if(typeof G!=="string")throw Error("Schema method literal must be a string");if(G==="tools/call"){let z=async(J,H)=>{let U=H1(P6,J);if(!U.success){let D=U.error instanceof Error?U.error.message:String(U.error);throw new _(h.InvalidParams,`Invalid tools/call request: ${D}`)}let{params:A}=U.data,B=await Promise.resolve(Y(J,H));if(A.task){let D=H1(y1,B);if(!D.success){let O=D.error instanceof Error?D.error.message:String(D.error);throw new _(h.InvalidParams,`Invalid task creation result: ${O}`)}return D.data}let K=H1(x4,B);if(!K.success){let D=K.error instanceof Error?K.error.message:String(K.error);throw new _(h.InvalidParams,`Invalid tools/call result: ${D}`)}return K.data};return super.setRequestHandler(Q,z)}return super.setRequestHandler(Q,Y)}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){T5(this._clientCapabilities?.tasks?.requests,Q,"Client")}assertTaskHandlerCapability(Q){if(!this._capabilities)return;E5(this._capabilities.tasks?.requests,Q,"Server")}async _oninitialize(Q){let Y=Q.params.protocolVersion;return this._clientCapabilities=Q.params.capabilities,this._clientVersion=Q.params.clientInfo,{protocolVersion:CG.includes(Y)?Y:K9,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"},P4)}async createMessage(Q,Y){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 X=Q.messages[Q.messages.length-1],W=Array.isArray(X.content)?X.content:[X.content],G=W.some((H)=>H.type==="tool_result"),$=Q.messages.length>1?Q.messages[Q.messages.length-2]:void 0,z=$?Array.isArray($.content)?$.content:[$.content]:[],J=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(!J)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(J){let H=new Set(z.filter((A)=>A.type==="tool_use").map((A)=>A.id)),U=new Set(W.filter((A)=>A.type==="tool_result").map((A)=>A.toolUseId));if(H.size!==U.size||![...H].every((A)=>U.has(A)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}if(Q.tools)return this.request({method:"sampling/createMessage",params:Q},R9,Y);return this.request({method:"sampling/createMessage",params:Q},S9,Y)}async elicitInput(Q,Y){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},_4,Y)}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},_4,Y);if(G.action==="accept"&&G.content&&W.requestedSchema)try{let z=this._jsonSchemaValidator.getValidator(W.requestedSchema)(G.content);if(!z.valid)throw new _(h.InvalidParams,`Elicitation response content does not match requested schema: ${z.errorMessage}`)}catch($){if($ instanceof _)throw $;throw new _(h.InternalError,`Error validating elicitation response: ${$ instanceof Error?$.message:String($)}`)}return G}}}createElicitationCompletionNotifier(Q,Y){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}},Y)}async listRoots(Q,Y){return this.request({method:"roots/list",params:Q},C9,Y)}async sendLoggingMessage(Q,Y){if(this._capabilities.logging){if(!this.isMessageIgnored(Q.level,Y))return this.notification({method:"notifications/message",params:Q})}}async sendResourceUpdated(Q){return this.notification({method:"notifications/resources/updated",params:Q})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}var S5={name:"@sequenzy/mcp",version:"0.0.69",mcpName:"io.github.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":"./dist/server.js","./runtime":"./dist/runtime.js","./server.json":"./server.json"},scripts:{dev:"bun --watch src/index.ts",build:"bun build src/index.ts src/server.ts src/runtime.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/mcp.git"},homepage:"https://sequenzy.com",bugs:{url:"https://github.com/Sequenzy/mcp/issues"}};var lY=["product-info","domain","tracking","localization","integrations","products","events","tags","labels","goals","sync-rules","api-keys","widgets","team","danger"],R5={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}",landingPages:"/dashboard/company/{companyId}/landing-pages",landingPage:"/dashboard/company/{companyId}/landing-pages/{landingPageId}",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 hM(Q){let X=(Q??process.env.SEQUENZY_APP_URL??"https://sequenzy.com").trim().replace(/\/+$/,"");return X.length>0?X:"https://sequenzy.com"}function f0(Q){let Y=Q?.trim();return Y?Y:void 0}function n0(Q){return encodeURIComponent(Q)}function G0(Q,Y){return`${Q}${Y}`}function $0(Q,Y=""){return`/dashboard/company/${n0(Q)}${Y}`}function C5(Q,Y,X){return G0(Q,`${$0(Y,"/settings")}?tab=${encodeURIComponent(X)}`)}function fM(Q,Y){let X=lY.map((W)=>[W,Y?C5(Q,Y,W):""]);return Object.fromEntries(X)}function M1(Q={},Y){let X=hM(Y),W=f0(Q.companyId),G={},$=fM(X,W);if(!W)return{appUrl:X,routeTemplates:R5,settingsTabValues:lY,urls:G,settingsUrls:$};G.dashboard=G0(X,$0(W)),G.campaigns=G0(X,$0(W,"/campaign")),G.landingPages=G0(X,$0(W,"/landing-pages")),G.sequences=G0(X,$0(W,"/sequences")),G.settings=G0(X,$0(W,"/settings")),G.emails=G0(X,$0(W,"/emails")),G.subscribers=G0(X,$0(W,"/subscribers")),G.sentEmails=G0(X,$0(W,"/sent-emails")),G.segments=G0(X,$0(W,"/segments")),G.metrics=G0(X,$0(W,"/metrics")),G.transactional=G0(X,$0(W,"/transactional"));let z=f0(Q.campaignId);if(z)G.campaign=G0(X,$0(W,`/campaign/${n0(z)}`)),G.campaignPreview=`${G.campaign}?step=review`;let J=f0(Q.landingPageId);if(J)G.landingPage=G0(X,$0(W,`/landing-pages/${n0(J)}`));let H=f0(Q.sequenceId);if(H)G.sequence=G0(X,$0(W,`/sequences/${n0(H)}`));let U=f0(Q.emailId)??f0(Q.templateId);if(U)G.email=G0(X,$0(W,`/emails/${n0(U)}`)),G.template=G.email;let A=f0(Q.transactionalId);if(A)G.transactionalEmail=G0(X,$0(W,`/transactional/${n0(A)}`));let B=f0(Q.emailSendId);if(B)G.emailSend=G0(X,$0(W,`/sent-emails/${n0(B)}`));let K=f0(Q.domainId);if(K)G.domain=G0(X,$0(W,`/settings/domain/${n0(K)}`)),G.domainVerify=`${G.domain}/verify`;let D=f0(Q.status);if(D)G.campaignList=G0(X,$0(W,`/campaign/list/${n0(D)}`)),G.sequenceList=G0(X,$0(W,`/sequences/list/${n0(D)}`));let O=f0(Q.settingsTab);if(O)G.settingsTab=C5(X,W,O);return{appUrl:X,routeTemplates:R5,settingsTabValues:lY,urls:G,settingsUrls:$}}var k5=[{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 v5(Q){try{let Y;switch(Q){case"sequenzy://dashboard":Y=await L("GET","/api/v1/metrics?period=7d");break;case"sequenzy://company":{let X=await L("GET","/api/v1/account"),W=N1()??X.currentCompanyId;if(!W)throw Error("No company available. Create or select a company first.");Y=await L("GET",`/api/v1/companies/${W}`);break}case"sequenzy://campaigns/recent":Y=await L("GET","/api/v1/campaigns?limit=10");break;case"sequenzy://subscribers/recent":Y=await L("GET","/api/v1/subscribers?sort=createdAt&limit=20");break;case"sequenzy://subscribers/engaged":Y=await L("GET","/api/v1/subscribers?sort=engagement&limit=20");break;case"sequenzy://sequences":Y=await L("GET","/api/v1/sequences");break;case"sequenzy://templates":Y=await L("GET","/api/v1/templates");break;case"sequenzy://segments":Y=await L("GET","/api/v1/segments");break;case"sequenzy://tags":Y=await L("GET","/api/v1/tags");break;case"sequenzy://health":Y=await L("GET","/api/v1/health/deliverability");break;case"sequenzy://app-routes":Y=M1();break;default:throw Error(`Unknown resource: ${Q}`)}return{contents:[{uri:Q,mimeType:"application/json",text:JSON.stringify(Y,null,2)}]}}catch(Y){return{contents:[{uri:Q,mimeType:"text/plain",text:R1(Y)}]}}}import{readFileSync as lM,statSync as mM}from"node:fs";import{basename as cM}from"node:path";var t6="Sequenzy email blocks. Use `styles` for per-block background, background opacity, text color, padding, border radius, border width, and border color. Top-level style aliases such as `backgroundColor`, `backgroundOpacity`, `borderColor`, `borderWidth`, and `borderRadius` are also accepted and saved under `styles`. Use this for editor-compatible content, including conditional and repeat blocks. Repeat blocks use { type: 'repeat', source: 'items', itemAlias: 'item', children: [...] }.",t1="Replacement Sequenzy email blocks. Use `styles` for per-block background, background opacity, text color, padding, border radius, border width, and border color. Top-level style aliases such as `backgroundColor`, `backgroundOpacity`, `borderColor`, `borderWidth`, and `borderRadius` are also accepted and saved under `styles`.",p5="Sequenzy email blocks. Provide blocks or html for email steps. Use `styles` for per-block background, background opacity, text color, padding, border radius, border width, and border color. Top-level style aliases such as `backgroundColor`, `backgroundOpacity`, `borderColor`, `borderWidth`, and `borderRadius` are also accepted and saved under `styles`. Blocks can include repeat blocks over array variables such as items.",NQ="Complete Sequenzy landing page content JSON. Use this when replacing the page structure. The content must be the editor-compatible landing page schema with version, template, seo, theme, and blocks. Landing pages must include exactly one footer block and at most one form block.",pM="Optional template key for default content, such as from-scratch, waitlist, lead-magnet, launch, demo-request, webinar, newsletter, product-hunt, pricing-offer, agency-lead-gen, or feature-announcement.",x5=500,_5=500,a1={type:"boolean",description:"If true, include machine-classified bot/scanner opens and clicks. Defaults to false, so metrics and activity are human-only."},g5={type:"object",description:"Optional send window for every email step in the sequence. When set, email actions that become due outside the window wait until the next allowed local time. Omit days to allow every day.",properties:{enabled:{type:"boolean",description:"Set false to disable the sending window when creating a sequence. For updates, prefer clearSendingWindow."},timezone:{type:"string",description:"IANA timezone for the window, e.g. Europe/Kiev or America/New_York."},startTime:{type:"string",description:"Earliest local send time in 24-hour HH:mm format, e.g. 08:00."},endTime:{type:"string",description:"Latest local send cutoff in 24-hour HH:mm format, e.g. 20:00. Must be later than startTime."},days:{type:"array",description:"Allowed local days. Use full names or short names such as monday, tuesday, mon, tue. Omit for every day.",items:{type:"string"}}},additionalProperties:!1},wQ=["gray","red","orange","amber","yellow","lime","green","emerald","teal","cyan","sky","blue","indigo","violet","purple","fuchsia","pink","rose"],jQ=["email.sent","email.delivered","email.delivery_delayed","email.bounced","email.complained","email.opened","email.clicked","email.unsubscribed","subscriber.invalid","subscriber.updated","subscriber.unsubscribed","sequence.finished","sequence.failed"],iM=new Set(["get_account","get_app_urls","get_company","list_websites","check_website","get_integration_guide","get_subscriber","search_subscribers","list_products","list_tags","list_lists","list_segments","get_segment_count","list_audience_syncs","list_ad_accounts","list_templates","get_template","list_ab_tests","get_ab_test","get_ab_test_stats","list_campaigns","get_campaign","get_email_send","list_landing_pages","get_landing_page","list_sequences","get_sequence","list_transactional_emails","get_transactional_email","get_stats","get_campaign_stats","get_sequence_stats","get_subscriber_activity","list_team_members","list_conversations","get_conversation","list_webhooks","list_webhook_deliveries","generate_email","generate_sequence","generate_subject_lines"]),nM=new Set(["select_company","create_company","create_api_key","add_website","add_subscriber","update_subscriber","remove_subscriber","upsert_products","delete_product","attach_product_file","remove_product_file","sync_products","create_tag","update_tag","delete_tag","create_list","update_list","delete_list","add_subscribers_to_list","remove_subscribers_from_list","create_segment","update_segment","delete_segment","create_audience_sync","update_audience_sync","delete_audience_sync","sync_audience_now","create_template","update_template","delete_template","restart_ab_test","update_ab_test_variant","create_ab_test","add_ab_test_variant","delete_ab_test_variant","delete_ab_test","create_campaign","update_campaign","schedule_campaign","send_test_email","cancel_campaign","pause_campaign","resume_campaign","delete_campaign","duplicate_campaign","create_landing_page","update_landing_page","delete_landing_page","publish_landing_page","unpublish_landing_page","connect_landing_page_domain","update_landing_page_domain_settings","create_sequence","update_sequence","enable_sequence","disable_sequence","pause_sequence_enrollments","resume_sequence_enrollments","enroll_subscribers_in_sequence","cancel_sequence_enrollments","delete_sequence","create_transactional_email","update_transactional_email","send_email","invite_team_member","cancel_team_invitation","reply_to_conversation","update_conversation_status","mark_conversation_read","create_webhook","update_webhook","delete_webhook","test_webhook","replay_webhook_delivery"]),rM=new Set(["send_test_email","schedule_campaign","resume_campaign","publish_landing_page","connect_landing_page_domain","update_landing_page_domain_settings","enable_sequence","resume_sequence_enrollments","send_email","invite_team_member","reply_to_conversation","create_webhook","update_webhook","test_webhook","replay_webhook_delivery"]),dM=new Set(["remove_subscriber","delete_product","remove_product_file","delete_tag","delete_list","remove_subscribers_from_list","delete_segment","delete_audience_sync","delete_template","restart_ab_test","delete_ab_test_variant","delete_ab_test","cancel_campaign","delete_campaign","delete_landing_page","unpublish_landing_page","disable_sequence","cancel_sequence_enrollments","delete_sequence","cancel_team_invitation","delete_webhook"]);function oM(Q){let Y=iM.has(Q),X=nM.has(Q);if(Y===X)throw Error(`MCP tool "${Q}" must be classified as exactly one of read-only or mutating.`);return{readOnlyHint:Y,destructiveHint:Y?!1:dM.has(Q),openWorldHint:rM.has(Q)}}function tM(Q){return{...Q,annotations:{...Q.annotations,...oM(Q.name)}}}var nY={status:["is","is_not"],tag:["contains","not_contains","is_empty","is_not_empty"],email:["contains","not_contains"],emailProvider:["is","is_not","is_empty","is_not_empty"],added:["less_than","more_than"],firstName:["contains","not_contains","is_empty","is_not_empty"],lastName:["contains","not_contains","is_empty","is_not_empty"],list:["is","is_not","is_empty","is_not_empty"],emailSent:["is","is_not","at_least","less_than_count"],emailDelivered:["is","is_not","at_least","less_than_count"],emailOpened:["is","is_not","at_least","less_than_count"],emailClicked:["is","is_not","at_least","less_than_count"],emailBounced:["is","is_temporary_bounce","is_permanent_bounce","is_not","at_least","less_than_count"],emailComplained:["is","is_not","at_least","less_than_count"],attribute:["is","is_not","is_empty","is_not_empty","gte","lte","gt","lt","contains","not_contains"],event:["is","is_not","at_least","less_than_count"],segment:["is","is_not"],stripeProduct:["is","is_not","at_least","less_than_count"],stripeCurrentProduct:["is","is_not","gte","lte","gt","lt"],stripeTrialProduct:["is","is_not","gte","lte","gt","lt"],commerceProduct:["is","is_not","at_least","less_than_count"]},aM=Object.entries(nY).map(([Q,Y])=>`${Q}: ${Y.join(", ")}`).join("; "),y5={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","emailDelivered","emailOpened","emailClicked","emailBounced","emailComplained","attribute","event","segment","stripeProduct","stripeCurrentProduct","stripeTrialProduct","commerceProduct"],description:"Filter field. Use `event` for custom subscriber events, `segment` for saved segment membership, `stripeProduct`/`stripeCurrentProduct`/`stripeTrialProduct` for Stripe product-based segments, and `commerceProduct` for products purchased through commerce orders - the value is `provider:productId` (provider one of `shopify`, `woocommerce`, `api`; product ids are provider-scoped), optionally with an order-count threshold (`provider:productId:count`) for at_least/less_than_count; a bare product id matches the id on any provider. Engagement fields (`emailSent`, `emailDelivered`, `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","is_temporary_bounce","is_permanent_bounce","at_least","less_than_count","gte","lte","gt","lt"],description:`Filter operator. Allowed operators by field: ${aM}.`},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/current/trialing, `prod_123:3` for payment thresholds, `prod_123:is_canceled` for products set to cancel, `prod_123:cancels_at:2026-05-26`, `prod_123:end_at:2026-05-26`, or `prod_123:start_at:7 days ago` for product-scoped dates. 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},u5={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 rY(Q){if(!Array.isArray(Q))return Q;return Q.map((Y)=>{if(typeof Y!=="object"||Y===null)return Y;let X=Y;if(typeof X.id==="string"&&X.id.trim()!=="")return X;return{...X,id:crypto.randomUUID()}})}function dY(Q){if(typeof Q!=="object"||Q===null)return Q;let Y=Q;if(Y.kind==="filter"||"field"in Y||"operator"in Y||"value"in Y){let X=rY([Y]);return Array.isArray(X)?X[0]:Y}if(Y.kind!=="group")return Q;return{...Y,id:typeof Y.id==="string"&&Y.id.trim()!==""?Y.id:crypto.randomUUID(),children:Array.isArray(Y.children)?Y.children.map(dY):[]}}function sM(Q){let Y=Q.indexOf(":");return Y!==-1&&Q.substring(0,Y).trim().length>0}function eM(Q){let Y=Q.indexOf(":");return Y!==-1&&Q.substring(Y+1).trim().length>0}function h5(Q){if(Q==="all")return!0;let Y=Q.match(/^(\d+)d$/);if(!Y?.[1])return!1;let X=Number.parseInt(Y[1],10);return Number.isInteger(X)&&X>0}function QV(Q,Y){let X=Y.split(":");if(Q==="at_least"||Q==="less_than_count"){if(X.length<3)return'Event count filters must use "eventName:count:timeRange", like "saas.purchase:2:30d".';let $=X.slice(0,-2).join(":").trim(),z=X.at(-2),J=X.at(-1),H=z===void 0?Number.NaN:Number.parseInt(z,10);return $&&Number.isInteger(H)&&H>0&&J!==void 0&&h5(J)?null:'Event count filters must use "eventName:count:timeRange", like "saas.purchase:2:30d".'}if(X.length<2)return'Event filters must use "eventName:timeRange", like "saas.purchase:30d".';let W=X.slice(0,-1).join(":").trim(),G=X.at(-1);return W&&G!==void 0&&h5(G)?null:'Event filters must use "eventName:timeRange", like "saas.purchase:30d".'}function YV(Q){let Y=Q.indexOf(":");if(Y===-1)return{productId:Q,subfilter:null,rawValue:null};let X=Q.substring(0,Y),W=Q.substring(Y+1),G=W.indexOf(":");if(G===-1)return{productId:X,subfilter:W,rawValue:null};return{productId:X,subfilter:W.substring(0,G),rawValue:W.substring(G+1)}}function XV(Q){return Q.trim().toLowerCase().replace(/[-\s]+/g,"_")}function WV(Q){return["is_canceled","is_cancelled","canceled","cancelled","will_cancel","cancel_at_period_end","is_not_canceled","is_not_cancelled","not_canceled","not_cancelled","will_not_cancel"].includes(Q)}function GV(Q,Y){if(Y==="cancels_at"||Y==="cancel_at"||Y==="cancellation_at")return!0;if(Q==="stripeCurrentProduct")return["end_at","ends_at","period_end","period_ends_at","current_period_end"].includes(Y);return["start_at","started_at","trial_start","trial_started_at","end_at","ends_at","trial_end","trial_ends_at"].includes(Y)}function $V(Q){return["is","is_not","gte","lte","gt","lt"].includes(Q)}function zV(Q,Y,X){if(Q==="stripeProduct"){if(Y!=="at_least"&&Y!=="less_than_count")return null;let J=X.indexOf(":");if(J===-1)return null;let H=X.substring(0,J).trim(),U=Number.parseInt(X.substring(J+1).trim(),10);return H&&Number.isInteger(U)&&U>=1?null:'Stripe Product threshold filters must use "productId:count" with a count of at least 1.'}if(Q!=="stripeCurrentProduct"&&Q!=="stripeTrialProduct")return null;let{productId:W,subfilter:G,rawValue:$}=YV(X);if(!W.trim())return"Stripe product filters must include a product ID.";if(!G)return Y==="is"||Y==="is_not"?null:'Stripe current/trial date filters must use "productId:dateField:value".';let z=XV(G);if(WV(z))return Y==="is"||Y==="is_not"?null:"Stripe cancellation flag filters only support is and is_not operators.";if(!GV(Q,z))return`Unsupported Stripe product subfilter "${G}".`;if(!$V(Y))return"Stripe date filters only support is, is_not, gte, lte, gt, and lt operators.";return $?.trim()?null:'Stripe date filters must include a value like "productId:end_at:2026-05-26".'}var JV=new Set(["shopify","woocommerce","api"]);function HV(Q,Y){let X=Y.trim(),W=X.indexOf(":");if(W!==-1&&JV.has(X.substring(0,W).trim()))X=X.substring(W+1).trim();if(!X)return'Purchased Product filters must include a product ID, like "shopify:42".';if(Q!=="at_least"&&Q!=="less_than_count")return null;let G=X.lastIndexOf(":");if(G===-1)return null;let $=X.substring(0,G).trim(),z=Number.parseInt(X.substring(G+1).trim(),10);return $&&Number.isInteger(z)&&z>=1?null:'Purchased Product threshold filters must use "provider:productId:count" with a count of at least 1.'}function tY(Q){if(typeof Q!=="object"||Q===null)return"Segment filters must be objects.";let Y=Q,X=Y.field,W=Y.operator,G=Y.value;if(typeof X!=="string"||!(X in nY))return`Unsupported segment filter field "${String(X)}".`;if(typeof W!=="string")return`Segment filter "${X}" must include an operator.`;let $=nY[X];if(!$.includes(W))return`Operator "${W}" is not supported for ${X} filters. Use one of: ${$.join(", ")}.`;if(W!=="is_empty"&&W!=="is_not_empty"&&(typeof G!=="string"||G.trim().length===0))return`Segment filter "${X}" must include a value.`;if(X==="attribute"&&typeof G==="string"){if(!sM(G))return'Attribute filters must use "attributeName:value" or "attributeName:" for empty checks.';if(W!=="is_empty"&&W!=="is_not_empty"&&!eM(G))return'Attribute filters must include a value after "attributeName:".'}if(X==="event"&&typeof G==="string"){let z=QV(W,G);if(z)return z}if((X==="stripeProduct"||X==="stripeCurrentProduct"||X==="stripeTrialProduct")&&typeof G==="string"){let z=zV(X,W,G);if(z)return z}if(X==="commerceProduct"&&typeof G==="string"){let z=HV(W,G);if(z)return z}if(X==="tag"&&(W==="contains"||W==="not_contains")){if(!(typeof G==="string"&&G.split(",").map((J)=>J.trim()).some(Boolean)))return"Tag filters must include at least one tag name."}return null}function aY(Q){if(typeof Q!=="object"||Q===null)return[];let Y=Q;if(Y.kind==="filter"||"field"in Y||"operator"in Y||"value"in Y){let X=tY(Y);return X?[X]:[]}if(Array.isArray(Y.children))return Y.children.flatMap(aY);return[]}function S1(Q,Y,X){if(Y.html!==void 0&&Y.blocks!==void 0)throw Error(`Provide either \`html\` or \`blocks\` when calling \`${Q}\`, not both.`);if(Y.blocks!==void 0&&!Array.isArray(Y.blocks))throw Error(`\`blocks\` must be an array when calling \`${Q}\`.`);if(X?.requireContent&&Y.html===void 0&&Y.blocks===void 0)throw Error(`Provide either \`html\` or \`blocks\` when calling \`${Q}\`.`)}function ZQ(Q,Y){if(Y.labels===void 0)return;if(!Array.isArray(Y.labels))throw Error(`\`labels\` must be an array when calling \`${Q}\`.`);if(Y.labels.some((X)=>typeof X!=="string"||X.trim().length===0))throw Error(`\`labels\` must contain only non-empty strings when calling \`${Q}\`.`)}function UV(Q){let Y=Q.filters!==void 0,X=Q.root!==void 0;if(Y&&X)throw Error("Provide either `filters` or `root` when calling `create_segment`, not both.");if(!Y&&!X)throw Error("Provide either `filters` or `root` when calling `create_segment`.");if(Y){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(X&&(typeof Q.root!=="object"||Q.root===null))throw Error("`root` must be an object when calling `create_segment`.");let W=Y?Q.filters.flatMap((G)=>{let $=tY(G);return $?[$]:[]}):aY(Q.root);if(W.length>0)throw Error(W[0]??"Invalid segment filter in `create_segment`.")}function AV(Q){let Y=Q.filters!==void 0,X=Q.root!==void 0;if(Y&&X)throw Error("Provide either `filters` or `root` when calling `update_segment`, not both.");if(Q.name===void 0&&Q.filterJoinOperator===void 0&&!Y&&!X)throw Error("Provide at least one of `name`, `filters`, `root`, or `filterJoinOperator` when calling `update_segment`.");if(Y){if(!Array.isArray(Q.filters))throw Error("`filters` must be an array when calling `update_segment`.");if(Q.filters.length===0)throw Error("`filters` must include at least one filter when calling `update_segment`.")}if(X&&(typeof Q.root!=="object"||Q.root===null))throw Error("`root` must be an object when calling `update_segment`.");let W=Y?Q.filters.flatMap((G)=>{let $=tY(G);return $?[$]:[]}):X?aY(Q.root):[];if(W.length>0)throw Error(W[0]??"Invalid segment filter in `update_segment`.")}function BV(Q){if(Q.clearEnrollmentFieldPath===!0&&Q.enrollmentFieldPath!==void 0)throw Error("Provide either `enrollmentFieldPath` or `clearEnrollmentFieldPath` when calling `update_sequence`, not both.");if(Q.clearSendingWindow===!0&&Q.sendingWindow!==void 0)throw Error("Provide either `sendingWindow` or `clearSendingWindow` when calling `update_sequence`, not both.");if(Q.branch!==void 0&&Q.insertSteps!==void 0)throw Error("Provide either `branch` or `insertSteps` when calling `update_sequence`, not both.");let Y={...Q};if(delete Y.clearEnrollmentFieldPath,delete Y.clearSendingWindow,Q.clearEnrollmentFieldPath===!0)Y.enrollmentFieldPath=null;if(Q.clearSendingWindow===!0)Y.sendingWindow=null;return Y}function KV(Q){let Y=w(Q,"subscriberId"),X=Q.fieldValues,W=X===void 0?void 0:Array.isArray(X)?X:void 0;if(X!==void 0&&W===void 0)throw Error("`fieldValues` must be an array when calling `cancel_sequence_enrollments`.");let G=W?.map((J)=>typeof J==="string"?J.trim():"").filter((J)=>J.length>0)??[];if(W?.some((J)=>typeof J!=="string")||W!==void 0&&G.length===0)throw Error("`fieldValues` must contain at least one non-empty string when calling `cancel_sequence_enrollments`.");if(Y!==void 0===G.length>0)throw Error("Provide exactly one target when calling `cancel_sequence_enrollments`: `subscriberId` or `fieldValues`.");let $=w(Q,"fieldPath"),z=w(Q,"reason");return{...Y!==void 0&&{subscriberId:Y},...$!==void 0&&{fieldPath:$},...G.length>0&&{fieldValues:G},...typeof Q.dryRun==="boolean"&&{dryRun:Q.dryRun},...z!==void 0&&{reason:z}}}function DV(Q){S1("create_campaign",Q),ZQ("create_campaign",Q);let Y=w(Q,"prompt")!==void 0,X=Q.html!==void 0,W=Q.blocks!==void 0,G=Q.templateId!==void 0;if(Q.prompt!==void 0&&!Y)throw Error("`prompt` cannot be empty when calling `create_campaign`.");if(Y&&(X||W||G))throw Error("Provide either `prompt`, `html`, `blocks`, or `templateId` when calling `create_campaign`, not multiple content sources.");if(!Y&&(Q.style!==void 0||Q.tone!==void 0))throw Error("`style` and `tone` can only be used with `prompt` when calling `create_campaign`.");if(!Y&&w(Q,"subject")===void 0)throw Error("`subject` is required unless `prompt` is provided when calling `create_campaign`.")}function LV(Q){if(w(Q,"scheduledAt")===void 0)throw Error("`scheduledAt` is required when calling `schedule_campaign`.");if(Q.targetLists!==void 0&&!J0(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 mY(Q,Y,X){let W=new Set(["companyId","landingPageId","name","slug","content"]),G=Object.keys(Y).filter(($)=>!W.has($));if(G.length>0)throw Error(`\`${Q}\` accepts only \`name\`, \`slug\`, and \`content\` update fields. Unsupported field${G.length===1?"":"s"}: ${G.map(($)=>`\`${$}\``).join(", ")}.`);if(X.requireUpdate&&Y.name===void 0&&Y.slug===void 0&&Y.content===void 0)throw Error(`Provide at least one of \`name\`, \`slug\`, or \`content\` when calling \`${Q}\`.`);return{...Y.name!==void 0&&{name:Y.name},...Y.slug!==void 0&&{slug:Y.slug},...Y.content!==void 0&&{content:Y.content}}}function FV(Q){let Y=new Set(["companyId","domain","verify"]),X=Object.keys(Q).filter((W)=>!Y.has(W));if(X.length>0)throw Error(`\`update_landing_page_domain_settings\` accepts only \`domain\` and \`verify\`. Unsupported field${X.length===1?"":"s"}: ${X.map((W)=>`\`${W}\``).join(", ")}.`);if(Q.domain===void 0&&Q.verify!==!0)throw Error("Provide `domain` or `verify: true` when calling `update_landing_page_domain_settings`.");return{...Q.domain!==void 0&&{domain:Q.domain},...typeof Q.verify==="boolean"&&{verify:Q.verify}}}function qV(Q){S1("create_transactional_email",Q);let Y=w(Q,"prompt")!==void 0,X=Q.html!==void 0,W=Q.blocks!==void 0;if(Q.prompt!==void 0&&!Y)throw Error("`prompt` cannot be empty when calling `create_transactional_email`.");if(Y&&(X||W))throw Error("Provide either `prompt`, `html`, or `blocks` when calling `create_transactional_email`, not multiple content sources.");if(!Y&&(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(!Y&&!X&&!W)throw Error("Provide either `prompt`, `html`, or `blocks` when calling `create_transactional_email`.");if(!Y&&w(Q,"subject")===void 0)throw Error("`subject` is required unless `prompt` is provided when calling `create_transactional_email`.")}var cY={type:"object",description:"A step to create inside a sequence path. Use type:'delay' for a standalone delay, type:'email' for an email, type:'create_discount' for a discount action, or type:'condition' for a condition gate.",properties:{type:{type:"string",enum:["email","delay","create_discount","discount","condition","webhook"],description:"Sequence 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","logic_condition","action_webhook"],description:"Advanced sequence 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/condition actions.",additionalProperties:!0},subject:{type:"string",description:"Email subject. Required for email steps."},previewText:{type:"string",description:"Email preview text."},blocks:{type:"array",description:p5,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 OV(Q){if(!Q||typeof Q!=="object")return null;let Y=Q;if(Y.success!==!1)return null;if(typeof Y.error==="string")return Error(Y.error);if(Y.error&&typeof Y.error==="object"&&typeof Y.error.message==="string")return Error(Y.error.message);if(typeof Y.message==="string")return Error(Y.message);return Error("The tool returned an unsuccessful response.")}function J0(Q){return typeof Q==="object"&&Q!==null&&!Array.isArray(Q)}function f5(Q){return Q.trim().toLowerCase().replace(/\s+/g,"-")}function MV(Q){let Y=new URLSearchParams;if(typeof Q.query==="string"&&Q.query.trim()!=="")Y.set("query",Q.query.trim());if(Array.isArray(Q.tags)&&Q.tags.length>0)Y.set("tags",Q.tags.filter((X)=>typeof X==="string"&&X.trim()!=="").join(","));if(typeof Q.list==="string"&&Q.list.trim()!=="")Y.set("list",Q.list.trim());if(typeof Q.listId==="string"&&Q.listId.trim()!=="")Y.set("listId",Q.listId.trim());if(typeof Q.listName==="string"&&Q.listName.trim()!=="")Y.set("listName",Q.listName.trim());if(typeof Q.segmentId==="string"&&Q.segmentId.trim()!=="")Y.set("segmentId",Q.segmentId);if(typeof Q.status==="string"&&Q.status.trim()!=="")Y.set("status",Q.status.trim());return Y.set("page",String(Q.page)),Y.set("limit",String(Q.pageSize)),Y}async function VV(Q,Y){let X=typeof Q.limit==="number"&&Number.isFinite(Q.limit)?Math.max(1,Math.trunc(Q.limit)):void 0,W=Math.min(100,Math.max(1,X??100)),G=[],$=1,z=0,J=0,H=0;while(!0){let A=MV({query:Q.query,tags:Q.tags,list:Q.list,listId:Q.listId,listName:Q.listName,segmentId:Q.segmentId,status:Q.status,page:$,pageSize:W}),B=await L("GET",`/api/v1/subscribers?${A.toString()}`,void 0,Y);z=B.pagination?.total??B.subscribers.length,J=B.pagination?.totalPages??1,H+=1,G.push(...B.subscribers??[]);let K=X!==void 0&&G.length>=X,D=B.pagination?$>=B.pagination.totalPages:(B.subscribers??[]).length<W;if(K||D)break;$+=1}let U=X!==void 0?G.slice(0,X):G;return{success:!0,subscribers:U,pagination:{page:1,limit:W,total:z,totalPages:J,fetchedPages:H},returned:U.length,truncated:X!==void 0&&z>0&&U.length<z}}function NV(Q){let Y=typeof Q.email==="string"&&Q.email.trim()!==""?Q.email.trim():void 0,X=typeof Q.externalId==="string"&&Q.externalId.trim()!==""?Q.externalId.trim():void 0;return{...Y?{email:Y}:{},...X?{externalId:X}:{}}}function a6(Q,Y){let X=NV(Y);if(!X.email&&!X.externalId)throw Error(`Provide either \`email\` or \`externalId\` when calling \`${Q}\`.`);return X}function oY(Q,Y){let X=new URLSearchParams;if(Y?.includeMachineEngagement)X.set("includeMachineEngagement","true");let W=X.toString(),G=W?`?${W}`:"";if(Q.email)return`/api/v1/subscribers/${encodeURIComponent(Q.email)}${G}`;return X.set("externalId",String(Q.externalId)),`/api/v1/subscribers/external?${X.toString()}`}async function pY(Q,Y,X){return L("GET",oY(Q,X),void 0,Y)}function w(Q,Y){let X=Q[Y];if(typeof X!=="string")return;let W=X.trim();return W.length>0?W:void 0}function v(Q,Y,X){let W=w(Y,X);if(W===void 0)throw Error(`\`${X}\` is required when calling \`${Q}\`.`);return W}function W1(Q,Y,X,W){let G=w(Y,X);if(G===void 0)return;if(!W.includes(G))throw Error(`\`${X}\` must be one of ${W.join(", ")} when calling \`${Q}\`.`);return G}function iY(Q,Y,X,W){let G=v(Q,Y,X);if(!W.includes(G))throw Error(`\`${X}\` must be one of ${W.join(", ")} when calling \`${Q}\`.`);return G}function s6(Q,Y,X,W,G){let $=Y[X];if($===void 0)return;if(typeof $!=="number"||!Number.isInteger($)||$<W||$>G)throw Error(`\`${X}\` must be an integer between ${W} and ${G} when calling \`${Q}\`.`);return $}function l5(Q,Y){if(Y.events===void 0)return;if(!Array.isArray(Y.events))throw Error(`\`events\` must be an array when calling \`${Q}\`.`);let X=Y.events.map((W,G)=>{if(typeof W!=="string"||!jQ.includes(W))throw Error(`\`events\` item ${G+1} must be one of ${jQ.join(", ")} when calling \`${Q}\`.`);return W});if(X.length===0)throw Error(`\`events\` must include at least one event type when calling \`${Q}\`.`);return X}function m5(Q,Y){if(!Array.isArray(Y.emails))throw Error(`\`emails\` must be an array when calling \`${Q}\`.`);let X=[];if(Y.emails.forEach((W,G)=>{if(typeof W!=="string")throw Error(`\`emails\` item ${G+1} must be a string when calling \`${Q}\`.`);let $=W.trim();if($.length>0)X.push($)}),X.length===0)throw Error(`\`emails\` must include at least one email address when calling \`${Q}\`.`);if(X.length>x5)throw Error(`\`emails\` must include no more than ${x5} email addresses when calling \`${Q}\`. Split larger batches into multiple calls.`);return X}function c5(Q,Y,X,W){let G=Y[X];if(G===void 0)return;if(!Array.isArray(G))throw Error(`\`${X}\` must be an array when calling \`${Q}\`.`);let $=[];if(G.forEach((z,J)=>{if(typeof z!=="string")throw Error(`\`${X}\` item ${J+1} must be a string when calling \`${Q}\`.`);let H=z.trim();if(H.length>0)$.push(H)}),$.length===0)throw Error(`\`${X}\` must include at least one ${W} when calling \`${Q}\`.`);return $}function ZV(Q){let X=c5("enroll_subscribers_in_sequence",Q,"emails","email address"),W=c5("enroll_subscribers_in_sequence",Q,"subscriberIds","subscriber ID"),G=(X?.length??0)+(W?.length??0);if(G===0)throw Error("Provide `emails` or `subscriberIds` when calling `enroll_subscribers_in_sequence`.");if(G>_5)throw Error(`\`emails\` and \`subscriberIds\` must include no more than ${_5} total targets when calling \`enroll_subscribers_in_sequence\`. Split larger batches into multiple calls.`);let $=w(Q,"targetNodeId");return{...X!==void 0&&{emails:X},...W!==void 0&&{subscriberIds:W},...$!==void 0&&{targetNodeId:$}}}var wV={pdf:"application/pdf",epub:"application/epub+zip",zip:"application/zip",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",mp3:"audio/mpeg",wav:"audio/wav",mp4:"video/mp4",txt:"text/plain",csv:"text/csv"};function jV(Q){let Y=Q.split(".").pop()?.toLowerCase()??"";return wV[Y]??null}var PV=104857600;async function bV(Q,Y){if(!WX())throw Error("`filePath` is only supported when the MCP server runs locally on your machine. Host the file somewhere public and pass `url` instead.");let X=jV(Q);if(!X)throw Error("Unsupported file type. Use PDF, ePub, ZIP, image, audio, video, or text files.");let W=mM(Q).size;if(W>PV)throw Error(`File is too large (${Math.round(W/1048576)}MB). Delivery files must be 100MB or smaller.`);let G=lM(Q),$=await L("POST","/api/v1/products/delivery/upload-url",{filename:cM(Q),contentType:X,fileSizeBytes:W},Y),z=await fetch($.uploadUrl,{method:"PUT",headers:{"Content-Type":X},body:G});if(!z.ok)throw Error(`File upload failed (${z.status})`);return{url:$.publicUrl,fileName:$.fileName,fileSizeBytes:W,mimeType:X}}async function i5(Q){let Y=w(Q,"companyId");if(Y)return Y;let X=N1();if(X)return X;try{return(await L("GET","/api/v1/account")).currentCompanyId??void 0}catch{return}}function e1(Q,Y){if(!J0(Q)||!Y)return Q;return{...Q,url:Y}}function n5(Q,Y){if(!J0(Q))return Q;return{...Q,...Y.campaign!==void 0&&{url:Y.campaign},...Y.campaignPreview!==void 0&&{previewUrl:Y.campaignPreview}}}function e6(Q,Y,X){if(!Array.isArray(Q)||!Y)return Q;return Q.map((W)=>{if(!J0(W))return W;let G=w(W,"id");if(!G)return W;let $=M1({companyId:Y,...X==="campaign"&&{campaignId:G},...X==="landingPage"&&{landingPageId:G},...X==="sequence"&&{sequenceId:G},...X==="template"&&{emailId:G},...X==="transactional"&&{transactionalId:G}});if(X==="campaign")return n5(W,$.urls);let z=X==="sequence"?$.urls.sequence:X==="landingPage"?$.urls.landingPage:X==="template"?$.urls.email:$.urls.transactionalEmail;return e1(W,z)})}function IV(Q){if(!Array.isArray(Q))return Q;return Q.map((Y)=>{if(!J0(Y))return Y;let X=w(Y,"id");if(!X)return Y;let W=M1({companyId:X});return{...Y,url:W.urls.dashboard,settingsUrl:W.urls.settings}})}var r5=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","cancel_campaign","pause_campaign","resume_campaign","duplicate_campaign","list_landing_pages","get_landing_page","create_landing_page","update_landing_page","publish_landing_page","unpublish_landing_page","delete_landing_page","list_sequences","get_sequence","create_sequence","update_sequence","enable_sequence","disable_sequence","pause_sequence_enrollments","resume_sequence_enrollments","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 EV(Q,Y,X){if(!J0(X)||!r5.has(Q))return X;let W=J0(X.company)?X.company:void 0,$=w(X,"selectedCompanyId")??w(X,"currentCompanyId")??w(X,"companyId")??(W?w(W,"id"):void 0)??(W?w(W,"companyId"):void 0)??await i5(Y);if(!$)return X;let z=J0(X.campaign)?X.campaign:void 0,J=J0(X.sequence)?X.sequence:void 0,H=J0(X.landingPage)?X.landingPage:void 0,U=J0(X.template)?X.template:void 0,A=J0(X.transactional)&&!Array.isArray(X.transactional)?X.transactional:void 0,B={companyId:$,campaignId:w(Y,"campaignId")??w(X,"campaignId")??(z?w(z,"id"):void 0),landingPageId:w(Y,"landingPageId")??w(X,"landingPageId")??(H?w(H,"id"):void 0),sequenceId:w(Y,"sequenceId")??w(X,"sequenceId")??(J?w(J,"id"):void 0),emailId:w(X,"templateId")??(U?w(U,"id"):void 0)??(A?w(A,"emailId"):void 0)??w(Y,"templateId"),transactionalId:w(Y,"transactionalId")??(A?w(A,"id"):void 0)??w(Y,"idOrSlug"),emailSendId:w(Y,"emailSendId")??w(X,"emailSendId")??(J0(X.emailSend)?w(X.emailSend,"id"):void 0),status:w(Y,"status")},K=M1(B),D=W?M1({companyId:$}):void 0;return{...X,...Array.isArray(X.companies)&&{companies:IV(X.companies)},...Array.isArray(X.campaigns)&&{campaigns:e6(X.campaigns,$,"campaign")},...Array.isArray(X.landingPages)&&{landingPages:e6(X.landingPages,$,"landingPage")},...Array.isArray(X.sequences)&&{sequences:e6(X.sequences,$,"sequence")},...Array.isArray(X.templates)&&{templates:e6(X.templates,$,"template")},...Array.isArray(X.transactional)&&{transactional:e6(X.transactional,$,"transactional")},...W&&D!==void 0&&{company:{...W,url:D.urls.dashboard,settingsUrl:D.urls.settings}},...z&&K.urls.campaign!==void 0&&{campaign:n5(z,K.urls)},...J&&K.urls.sequence!==void 0&&{sequence:e1(J,K.urls.sequence)},...H&&K.urls.landingPage!==void 0&&{landingPage:e1(H,K.urls.landingPage)},...U&&K.urls.email!==void 0&&{template:e1(U,K.urls.email)},...A&&K.urls.transactionalEmail!==void 0&&{transactional:e1(A,K.urls.transactionalEmail)},...J0(X.emailSend)&&K.urls.emailSend!==void 0&&{emailSend:e1(X.emailSend,K.urls.emailSend)},appUrls:K.urls}}var TV={type:"boolean",description:"Whether the Sequenzy operation succeeded."},SV={type:"string",description:"Human-readable status, confirmation, or next-step message."},RV={type:"string",description:"Additional context about the result."};function l0(Q){return{type:"object",description:Q,additionalProperties:!0}}function CV(Q){return{type:"array",description:Q,items:l0("One item in the returned collection.")}}function k(Q){return{type:"string",description:Q}}function C0(Q){return{type:"number",description:Q}}function s1(Q){return{type:"boolean",description:Q}}function N(Q){return l0(`The ${Q} record returned by Sequenzy.`)}function r(Q){return CV(`List of ${Q} records returned by Sequenzy.`)}var kV={appUrls:l0("Dashboard URLs for relevant Sequenzy resources."),url:k("Primary dashboard URL for this result."),settingsUrl:k("Company settings URL when available.")},vV={success:TV,message:SV,note:RV,items:{type:"array",description:"Fallback array wrapper used only when a tool returns a bare array.",items:l0("One returned item.")},value:l0("Fallback object wrapper used only when a tool returns a non-object value.")},xV={get_account:{account:N("account"),companies:r("company"),currentCompanyId:k("Company ID selected by the authenticated API key, when available."),selectedCompanyId:k("Company ID selected locally for subsequent MCP calls, when available.")},select_company:{companyId:k("Selected company ID."),companyName:k("Selected company name.")},get_app_urls:{dashboard:k("Company dashboard URL."),settings:k("Company settings URL."),campaign:k("Campaign editor URL."),landingPage:k("Landing page editor URL."),sequence:k("Sequence editor URL."),email:k("Email editor URL."),transactionalEmail:k("Transactional email URL."),emailSend:k("Sent email detail URL."),domain:k("Sending domain settings URL."),urls:l0("All generated URLs keyed by resource type.")},create_company:{company:N("company"),autoSelected:s1("Whether the new company was selected for subsequent MCP calls.")},get_company:{company:N("company")},create_api_key:{apiKey:k("Newly created API key. This secret is returned only once."),key:k("Newly created API key if the API response uses the short key field.")},list_websites:{websites:r("sender website")},add_website:{website:N("sender website")},check_website:{website:N("sender website"),ready:s1("Whether the sender website is ready."),status:k("Current processing or verification status.")},get_integration_guide:{guide:N("integration guide"),code:k("Generated integration code or example."),steps:{type:"array",description:"Setup steps for the requested integration.",items:l0("One setup step.")}},add_subscriber:{subscriber:N("subscriber")},update_subscriber:{subscriber:N("subscriber")},remove_subscriber:{subscriber:N("subscriber"),hardDeleted:s1("Whether the subscriber was permanently deleted.")},get_subscriber:{subscriber:N("subscriber")},search_subscribers:{subscribers:r("subscriber"),pagination:l0("Pagination metadata."),returned:C0("Number of subscribers returned."),truncated:s1("Whether the result was truncated by the requested limit.")},list_products:{products:r("product")},upsert_products:{products:r("product"),created:C0("Number of products created."),updated:C0("Number of products updated.")},delete_product:{productId:k("Deleted product ID.")},attach_product_file:{product:N("product"),delivery:N("digital delivery file")},remove_product_file:{product:N("product")},sync_products:{job:N("product sync job"),jobId:k("Queued product sync job ID.")},list_tags:{tags:r("tag")},create_tag:{tag:N("tag")},update_tag:{tag:N("tag")},delete_tag:{tagId:k("Deleted tag ID.")},list_lists:{lists:r("list")},create_list:{list:N("list")},update_list:{list:N("list")},delete_list:{listId:k("Deleted list ID.")},add_subscribers_to_list:{list:N("list"),added:C0("Number of subscribers added to the list."),skipped:C0("Number of subscribers skipped.")},remove_subscribers_from_list:{list:N("list"),removed:C0("Number of subscribers removed from the list."),skipped:C0("Number of subscribers skipped.")},list_segments:{segments:r("segment")},create_segment:{segment:N("segment")},update_segment:{segment:N("segment")},delete_segment:{segmentId:k("Deleted segment ID.")},get_segment_count:{count:C0("Number of subscribers matching the segment."),segmentId:k("Segment ID that was counted.")},list_audience_syncs:{audienceSyncs:r("audience sync")},list_ad_accounts:{adAccounts:r("ad account")},create_audience_sync:{audienceSync:N("audience sync")},update_audience_sync:{audienceSync:N("audience sync")},delete_audience_sync:{audienceSyncId:k("Deleted audience sync ID.")},sync_audience_now:{audienceSync:N("audience sync"),job:N("audience sync job"),jobId:k("Queued audience sync job ID.")},list_templates:{templates:r("email template")},get_template:{template:N("email template")},create_template:{template:N("email template")},update_template:{template:N("email template")},delete_template:{templateId:k("Deleted template ID.")},list_ab_tests:{abTests:r("A/B test")},get_ab_test:{abTest:N("A/B test")},get_ab_test_stats:{abTest:N("A/B test"),stats:N("A/B test statistics")},restart_ab_test:{abTest:N("A/B test")},update_ab_test_variant:{abTest:N("A/B test"),variant:N("A/B test variant")},create_ab_test:{abTest:N("A/B test")},add_ab_test_variant:{abTest:N("A/B test"),variant:N("A/B test variant")},delete_ab_test_variant:{abTest:N("A/B test"),variantId:k("Deleted A/B test variant ID.")},delete_ab_test:{abTestId:k("Deleted A/B test ID.")},list_campaigns:{campaigns:r("campaign")},get_campaign:{campaign:N("campaign")},get_email_send:{emailSend:N("email send")},create_campaign:{campaign:N("campaign")},update_campaign:{campaign:N("campaign")},schedule_campaign:{campaign:N("campaign"),scheduledAt:k("Scheduled send timestamp.")},send_test_email:{emailSend:N("test email send"),recipient:k("Test email recipient.")},cancel_campaign:{campaign:N("campaign")},pause_campaign:{campaign:N("campaign")},resume_campaign:{campaign:N("campaign")},delete_campaign:{campaignId:k("Deleted campaign ID.")},duplicate_campaign:{campaign:N("duplicated campaign")},list_landing_pages:{landingPages:r("landing page")},get_landing_page:{landingPage:N("landing page")},create_landing_page:{landingPage:N("landing page")},update_landing_page:{landingPage:N("landing page")},delete_landing_page:{landingPageId:k("Deleted landing page ID.")},publish_landing_page:{landingPage:N("landing page")},unpublish_landing_page:{landingPage:N("landing page")},connect_landing_page_domain:{landingPage:N("landing page"),domain:k("Connected landing page domain.")},update_landing_page_domain_settings:{landingPage:N("landing page"),domain:k("Landing page domain.")},list_sequences:{sequences:r("sequence")},get_sequence:{sequence:N("sequence")},create_sequence:{sequence:N("sequence")},update_sequence:{sequence:N("sequence")},enable_sequence:{sequence:N("sequence")},disable_sequence:{sequence:N("sequence")},pause_sequence_enrollments:{sequenceId:k("Sequence ID."),enrollmentPaused:s1("Whether new sequence enrollments are paused.")},resume_sequence_enrollments:{sequenceId:k("Sequence ID."),enrollmentPaused:s1("Whether new sequence enrollments are paused.")},enroll_subscribers_in_sequence:{sequence:N("sequence"),enrollments:r("sequence enrollment"),enrolled:C0("Number of subscribers enrolled."),skipped:C0("Number of subscribers skipped.")},cancel_sequence_enrollments:{sequence:N("sequence"),cancelled:C0("Number of enrollments cancelled."),skipped:C0("Number of enrollments skipped.")},delete_sequence:{sequenceId:k("Deleted sequence ID.")},list_transactional_emails:{transactional:r("transactional email")},get_transactional_email:{transactional:N("transactional email")},create_transactional_email:{transactional:N("transactional email")},update_transactional_email:{transactional:N("transactional email")},send_email:{emailSend:N("transactional email send"),transactional:N("transactional email")},get_stats:{stats:N("account or company statistics")},get_campaign_stats:{campaign:N("campaign"),stats:N("campaign statistics")},get_sequence_stats:{sequence:N("sequence"),stats:N("sequence statistics")},get_subscriber_activity:{activity:r("subscriber activity event"),subscribers:r("subscriber"),pagination:l0("Pagination metadata.")},list_team_members:{members:r("team member"),invitations:r("team invitation")},invite_team_member:{invitation:N("team invitation")},cancel_team_invitation:{invitationId:k("Cancelled invitation ID.")},list_conversations:{conversations:r("inbox conversation"),pagination:l0("Pagination metadata.")},get_conversation:{conversation:N("inbox conversation"),messages:r("conversation message")},reply_to_conversation:{conversation:N("inbox conversation"),message:N("conversation message")},update_conversation_status:{conversation:N("inbox conversation")},mark_conversation_read:{conversation:N("inbox conversation")},list_webhooks:{webhooks:r("outbound webhook")},create_webhook:{webhook:N("outbound webhook")},update_webhook:{webhook:N("outbound webhook")},delete_webhook:{webhookId:k("Deleted outbound webhook ID.")},test_webhook:{webhook:N("outbound webhook"),delivery:N("test webhook delivery")},list_webhook_deliveries:{deliveries:r("webhook delivery")},replay_webhook_delivery:{delivery:N("webhook delivery"),job:N("webhook replay job")},generate_email:{email:N("generated email"),html:k("Generated HTML email body."),blocks:{type:"array",description:"Generated Sequenzy email blocks.",items:l0("One generated email block.")},subject:k("Generated subject line."),previewText:k("Generated inbox preview text.")},generate_sequence:{sequence:N("generated sequence"),steps:r("generated sequence step")},generate_subject_lines:{subjectLines:{type:"array",description:"Generated subject line variants.",items:k("One generated subject line.")},variants:r("generated subject line variant")}};function _V(Q){let Y=xV[Q];if(Y===void 0)throw Error(`MCP tool "${Q}" must define outputSchema properties.`);return{type:"object",description:`Structured content returned by the \`${Q}\` MCP tool.`,properties:{...vV,...Y,...r5.has(Q)?kV:{}},additionalProperties:!0}}function gV(Q){return{...Q,outputSchema:_V(Q.name)}}function yV(Q){if(J0(Q))return Q;if(Array.isArray(Q))return{items:Q};return{value:Q}}var uV=[{name:"get_account",description:`Get current account information including available companies. IMPORTANT: If you have access to multiple companies, you MUST either:
|
|
29
29
|
1. Call select_company first to choose which company to work with, OR
|
|
30
30
|
2. Pass companyId explicitly in each tool call
|
|
31
31
|
|
|
@@ -47,7 +47,7 @@ Use cases:
|
|
|
47
47
|
- 'event_tracking': Tracking CUSTOM events only (not payment events - those come from the integration)
|
|
48
48
|
- 'ecommerce': Connecting a custom e-commerce platform via the Commerce API (sync products, push orders/checkouts, power abandoned cart + back-in-stock automations)
|
|
49
49
|
|
|
50
|
-
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), 'ecommerce' (connecting a custom e-commerce platform via the Commerce API)"}}}},{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"},status:{type:"string",description:"Initial subscriber status: active, unsubscribed, or bounced. Defaults to active."},optInMode:{type:"string",description:"Consent mode: confirmed creates active immediately when consent is verified, double_opt_in sends a confirmation email before activation, and default obeys company double opt-in settings."}},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."},includeMachineEngagement:a1},required:[]}},{name:"search_subscribers",description:"Search subscribers by free-text query, tags, list, 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"},list:{type:"string",description:"Filter by subscriber list ID or exact list name. Prefer listId when known."},listId:{type:"string",description:"Filter by subscriber list ID."},listName:{type:"string",description:"Filter by exact subscriber list name when the list ID is not known."},segmentId:{type:"string",description:"Filter by segment ID"},status:{type:"string",description:"Filter by subscriber status: active, unsubscribed, or bounced."},limit:{type:"number",description:"Maximum results to return. If omitted, the tool returns all matches across pages."}}}},{name:"list_products",description:"List synced products (Stripe, Shopify, WooCommerce) including any attached digital delivery file. Useful before attaching a file or building a purchase sequence for a specific product.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to list products for. If not provided, uses the currently selected company."},provider:{type:"string",description:"Filter by provider: stripe, shopify, woocommerce, or manual."},search:{type:"string",description:"Filter products by title."}}}},{name:"upsert_products",description:"Create or update products in the catalog (Commerce API, keyed by your productId, stored under the api provider). Use this to add products that are not synced from Stripe/Shopify/WooCommerce, then attach a deliverable file with attach_product_file and build a purchase sequence for them.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},products:{type:"array",description:"Products to create or update (max 100).",items:{type:"object",properties:{productId:{type:"string",description:"Your stable product identifier (used for upserts and order line items)."},title:{type:"string",description:"Product title."},description:{type:"string",description:"Product description."},imageUrl:{type:"string",description:"Product image URL."},url:{type:"string",description:"Product page URL."},priceCents:{type:"number",description:"Price in the smallest currency unit."},currency:{type:"string",description:"ISO currency code, e.g. USD."},inStock:{type:"boolean",description:"Whether the product is in stock."}},required:["productId","title"]}}},required:["products"]}},{name:"delete_product",description:"Delete a product previously pushed via upsert_products (Commerce API products only), identified by your productId.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},productId:{type:"string",description:"Your productId used when upserting the product."}},required:["productId"]}},{name:"attach_product_file",description:"Attach a distributable file to a product, either by public URL or by uploading a local file (filePath, local MCP server only). After a purchase of the product, sequence emails can link to it with {{event.download.url}} and {{event.download.name}}.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},productId:{type:"string",description:"Product ID from list_products, or your own productId for products pushed via upsert_products."},url:{type:"string",description:"Public http(s) URL of the file to deliver. Provide url or filePath, not both."},filePath:{type:"string",description:"Local path of a file to upload and attach (PDF, ePub, ZIP, image, audio, video, or text, up to 100MB). Only available when the MCP server runs locally on this machine."},fileName:{type:"string",description:"Display name for the file (e.g. guide.pdf). Used as {{event.download.name}}."}},required:["productId"]}},{name:"remove_product_file",description:"Remove the attached distributable file from a product.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},productId:{type:"string",description:"Product ID from list_products, or your own productId for products pushed via upsert_products."}},required:["productId"]}},{name:"sync_products",description:"Queue a sync of the Stripe product catalog into the products list. Requires an active Stripe integration.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."}}}},{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:"create_tag",description:"Create a new tag definition. The name is normalized to lowercase with hyphens (e.g. 'VIP Customer' becomes 'vip-customer'). Color defaults to gray.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},name:{type:"string",description:"Tag name. Normalized to lowercase with hyphens."},color:{type:"string",enum:[...wQ],description:"Tag color. Defaults to gray."}},required:["name"]}},{name:"update_tag",description:"Update a tag's color. System tags cannot be updated.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},tagId:{type:"string",description:"Tag ID. Use list_tags to find tag IDs."},color:{type:"string",enum:[...wQ],description:"New tag color."}},required:["tagId","color"]}},{name:"delete_tag",description:"Permanently delete a tag and remove it from all subscribers. This cannot be undone. System tags and tags used by sequences cannot be deleted.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},tagId:{type:"string",description:"Tag ID. Use list_tags to find tag IDs."}},required:["tagId"]}},{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:"update_list",description:"Update a subscriber list's name, description, or privacy. Only the provided fields are changed.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},listId:{type:"string",description:"Subscriber list ID to update."},name:{type:"string",description:"New list name."},description:{type:["string","null"],description:"New list description. Pass null to clear it."},isPrivate:{type:"boolean",description:"Whether the list is private."}},required:["listId"]}},{name:"delete_list",description:"Permanently delete a subscriber list and remove all of its memberships. Subscribers themselves are kept. This cannot be undone.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},listId:{type:"string",description:"Subscriber list ID to delete."}},required:["listId"]}},{name:"add_subscribers_to_list",description:"Bulk add existing or new subscribers to a subscriber list from an email array. Existing subscribers are added to the list without requiring a per-subscriber update call.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},listId:{type:"string",description:"Subscriber list ID to add subscribers to."},emails:{type:"array",items:{type:"string"},description:"Email addresses to add to the list. Maximum 500 per call."},duplicateStrategy:{type:"string",description:"Duplicate strategy for existing subscribers: skip, merge, or overwrite. Defaults to skip."},enrollInSequences:{type:"boolean",description:"Whether newly created subscribers should enroll in matching sequences. Defaults to false."},optInMode:{type:"string",description:"Consent mode for newly created subscribers: default, confirmed, or double_opt_in. Defaults to default."}},required:["listId","emails"]}},{name:"remove_subscribers_from_list",description:"Remove subscribers from a list by email address. Maximum 500 emails per call. Subscribers stay in the account; only the list membership is removed. Returns the removed count plus a notFound array of emails that did not match a subscriber.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},listId:{type:"string",description:"Subscriber list ID to remove subscribers from."},emails:{type:"array",items:{type:"string"},description:"Email addresses to remove from the list. Maximum 500 per call."}},required:["listId","emails"]}},{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/current/trial/date 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:g5,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 commerce product purchase filter (value is provider:productId since product ids are provider-scoped): [{"id":"filter-1","field":"commerceProduct","operator":"is","value":"api:prod-starter-kit"}]. Example repeat-buyer filter: [{"id":"filter-1","field":"commerceProduct","operator":"at_least","value":"shopify:42:2"}]. Example trial cancellation filter: [{"id":"filter-1","field":"stripeTrialProduct","operator":"is","value":"prod_123:is_canceled"}]. Example trial end filter: [{"id":"filter-1","field":"stripeTrialProduct","operator":"is","value":"prod_123:end_at:2026-05-26"}]. 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:{...y5,description:"Nested filter root. Mutually exclusive with `filters` and `filterJoinOperator`."}},required:["name"]}},{name:"update_segment",description:"Update a segment's name and/or filter rules. Use the same `filters` plus `filterJoinOperator` or nested `root` shapes as create_segment; providing `filters` or `root` replaces the segment's existing rules.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},segmentId:{type:"string",description:"Segment ID to update."},name:{type:"string",description:"New 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:g5,minItems:1,description:"Replacement segment filters. Same shape and validation rules as create_segment. Mutually exclusive with `root`."},root:{...y5,description:"Replacement nested filter root. Mutually exclusive with `filters` and `filterJoinOperator`."}},required:["segmentId"]}},{name:"delete_segment",description:"Permanently delete a segment. This cannot be undone. Subscribers are not affected.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},segmentId:{type:"string",description:"Segment ID to delete."}},required:["segmentId"]}},{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_audience_syncs",description:"List Meta custom audience syncs (segment -> ad audience mappings) with their schedule and last sync status. Requires the Meta Ads integration to be connected in the dashboard.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."}}}},{name:"list_ad_accounts",description:"List the Meta ad accounts available through the connected Meta Ads integration. Use the returned account id as `adAccountId` when creating an audience sync.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."}}}},{name:"create_audience_sync",description:'Push a segment to a Meta custom audience and keep it synced on a schedule. Provide `segmentId` for an existing segment OR `predefinedSegmentId` for a ready-made template (for example "zero-ltv", "no-purchase-1y", "recent-buyers", "high-spenders-ecom", "non-buyers", "engaged") - the template segment is created automatically on first use. The first upload runs immediately. Note: audiences are add-only; subscribers who later leave the segment stay in the Meta audience.',inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},segmentId:{type:"string",description:"Existing segment ID to sync. Mutually exclusive with `predefinedSegmentId`."},predefinedSegmentId:{type:"string",description:'Predefined segment template ID (for example "zero-ltv", "no-purchase-1y", "recent-buyers"). The segment is created automatically if it does not exist. Mutually exclusive with `segmentId`.'},adAccountId:{type:"string",description:"Meta ad account ID (act_...) from `list_ad_accounts`."},audienceName:{type:"string",description:"Name for the custom audience in Meta Ads Manager."},frequency:{type:"string",enum:["hourly","daily","weekly"],description:"How often to re-upload the segment. Default: daily."}},required:["adAccountId","audienceName"]}},{name:"update_audience_sync",description:"Update an audience sync's frequency or pause/resume it (`isActive`).",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},syncId:{type:"string",description:"Audience sync ID"},frequency:{type:"string",enum:["hourly","daily","weekly"],description:"New sync frequency."},isActive:{type:"boolean",description:"Set false to pause the sync, true to resume it."}},required:["syncId"]}},{name:"delete_audience_sync",description:"Remove an audience sync mapping. The Meta audience itself is kept (running ads are not disrupted) - only future syncs stop.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},syncId:{type:"string",description:"Audience sync ID to remove."}},required:["syncId"]}},{name:"sync_audience_now",description:"Trigger an immediate upload of the segment's subscribers to its Meta custom audience, outside the regular schedule.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},syncId:{type:"string",description:"Audience sync ID to run."}},required:["syncId"]}},{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:o6,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:o6,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."},includeMachineEngagement:a1},required:["abTestId"]}},{name:"restart_ab_test",description:"Run another sequence A/B test after a winner is selected. By default the winner becomes the new control; pass sourceVariantId to use another variant as the control email.",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 to restart"},sourceVariantId:{type:"string",description:"Optional variant ID to use as the new control email. Defaults to the selected winner."},testType:{type:"string",description:"Optional test type: subject or content."},winnerThreshold:{type:"number",description:"Optional number of subscribers before selecting a winner. Must be from 10 to 1000."},variantCount:{type:"number",description:"Optional total variants including the control. Must be from 2 to 4."}},required:["abTestId"],additionalProperties:!1}},{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:`${t1} Mutually exclusive with html.`,items:{type:"object"}}},required:["abTestId","variantId"],additionalProperties:!1}},{name:"create_ab_test",description:"Create a campaign A/B test. Control variant A is created automatically from the campaign's current email; optionally provide extra variants. The campaign must be in draft or rejected status, and each campaign can only have one A/B test.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},campaignId:{type:"string",description:"Draft campaign ID to create the A/B test for."},name:{type:"string",description:"Optional A/B test name."},testPercentage:{type:"number",description:"Percentage of the audience used for the test phase, from 5 to 50. Defaults to 20."},testDurationMinutes:{type:"number",description:"Test phase duration in minutes before the winner is selected, from 15 to 1440. Defaults to 240."},winnerCriteria:{type:"string",enum:["open_rate","click_rate"],description:"Winner selection criteria. Defaults to open_rate."},variants:{type:"array",description:"Optional extra variants to create in addition to control variant A.",items:{type:"object",properties:{subject:{type:"string",description:"Variant subject line."},previewText:{type:"string",description:"Variant preview text."},blocks:{type:"array",description:t1,items:{type:"object"}}},required:["subject"]}}},required:["campaignId"]}},{name:"add_ab_test_variant",description:"Add a variant to a draft campaign A/B test. Variants cannot be added after the test has started.",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"},subject:{type:"string",description:"Variant subject line."},previewText:{type:"string",description:"Variant preview text."},blocks:{type:"array",description:t1,items:{type:"object"}}},required:["abTestId","subject"]}},{name:"delete_ab_test_variant",description:"Permanently delete a variant from a draft campaign A/B test. This cannot be undone. Variant A is the control and cannot be deleted, and the test must keep at least the minimum number of variants. Variants cannot be removed after the test has started.",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 to delete."}},required:["abTestId","variantId"]}},{name:"delete_ab_test",description:"Permanently delete a campaign A/B test and all of its variants. This cannot be undone. Running tests (testing or winner_selected) cannot be deleted, and the linked campaign must be in draft or rejected 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 to delete."}},required:["abTestId"]}},{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. Defaults to draft; use status 'sent' only to archive an already-sent campaign without sending email.",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."},trackingCode:{type:"string",description:"Optional campaign tracking code for UTM templates. Use only when explicitly requested."},status:{type:"string",description:"Initial status: draft or sent. Defaults to draft. Use sent only for imported/already-sent campaigns; it does not send email or create delivery history."},sentAt:{type:"string",description:"ISO date-time for an imported/already-sent campaign. Only valid when status is sent; defaults to now if omitted."},html:{type:"string",description:"Email HTML content. Mutually exclusive with `blocks`."},blocks:{type:"array",description:o6,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"},campaignData:{type:"object",description:"Optional campaign-scoped JSON data for repeat blocks and personalization."},computedLists:{type:"array",description:"Optional computed list definitions derived from campaignData at send time.",items:{type:"object"}},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"},trackingCode:{type:"string",description:"Optional campaign tracking code for UTM templates. Use only when explicitly requested. Send an empty string to clear it."},html:{type:"string",description:"Email HTML content. Mutually exclusive with `blocks`."},blocks:{type:"array",description:o6,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."},campaignData:{type:"object",description:"Set campaign-scoped JSON data for repeat blocks and personalization."},computedLists:{type:"array",description:"Set computed list definitions derived from campaignData at send time.",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:["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:"cancel_campaign",description:"Cancel a campaign. Stops scheduled and sending campaigns (also works for paused and approval-pending ones). Remaining emails will not be sent and the campaign cannot be restarted - this cannot be undone.",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 cancel."}},required:["campaignId"]}},{name:"pause_campaign",description:"Pause a campaign that is currently sending. Only campaigns in sending status can be paused. Use resume_campaign to continue delivery later.",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 pause."}},required:["campaignId"]}},{name:"resume_campaign",description:"Resume a paused campaign. Only campaigns in paused status can be resumed. Optionally spread the remaining delivery over a number of hours.",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 resume."},spreadOverHours:{type:"number",description:"Spread the remaining delivery over an integer number of hours from 1 to 72."}},required:["campaignId"]}},{name:"delete_campaign",description:"Permanently delete a campaign. This cannot be undone. Sending, scheduled, or paused campaigns must be cancelled with cancel_campaign first.",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 delete."}},required:["campaignId"]}},{name:"duplicate_campaign",description:"Duplicate a campaign as a new draft. mode 'campaign' (default) copies the campaign and its email, 'ab_test' also duplicates the campaign's A/B test with all variants, and 'variant' copies a single variant's content as the new campaign email (requires variantId).",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 duplicate."},mode:{type:"string",enum:["campaign","ab_test","variant"],description:"Duplication mode. Defaults to campaign."},variantId:{type:"string",description:"A/B test variant ID whose content becomes the new campaign email. Required when mode is variant."}},required:["campaignId"]}},{name:"list_landing_pages",description:"List all landing pages for a company",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to list landing pages for. If not provided, uses the currently selected company."}},additionalProperties:!1}},{name:"get_landing_page",description:"Get landing page details, content, metrics, and URLs",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},landingPageId:{type:"string",description:"Landing page ID."}},required:["landingPageId"],additionalProperties:!1}},{name:"create_landing_page",description:"Create a draft landing page. Provide content for an exact page, or a template for generated starter content.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to create the landing page in. If not provided, uses the currently selected company."},name:{type:"string",description:"Landing page name. Optional; defaults to a template-specific name."},slug:{type:"string",description:"Optional URL slug. It will be normalized and made unique within the company."},template:{type:"string",description:pM},content:{type:"object",description:VQ,additionalProperties:!0}},additionalProperties:!1}},{name:"update_landing_page",description:"Edit a landing page's name, slug, or full content. Provide at least one update field.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},landingPageId:{type:"string",description:"Landing page ID."},name:{type:"string",description:"Landing page name."},slug:{type:"string",description:"Landing page URL slug. It will be normalized and made unique within the company."},content:{type:"object",description:VQ,additionalProperties:!0}},required:["landingPageId"],additionalProperties:!1}},{name:"delete_landing_page",description:"Delete a landing page",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},landingPageId:{type:"string",description:"Landing page ID."}},required:["landingPageId"],additionalProperties:!1}},{name:"publish_landing_page",description:"Publish a landing page. Optional name, slug, or content updates are saved before publishing.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},landingPageId:{type:"string",description:"Landing page ID."},name:{type:"string",description:"Optional landing page name update."},slug:{type:"string",description:"Optional slug update before publishing."},content:{type:"object",description:VQ,additionalProperties:!0}},required:["landingPageId"],additionalProperties:!1}},{name:"unpublish_landing_page",description:"Unpublish a landing page and return it to draft status. Optional name, slug, or content updates are saved first.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},landingPageId:{type:"string",description:"Landing page ID."},name:{type:"string",description:"Optional landing page name update."},slug:{type:"string",description:"Optional slug update before unpublishing."},content:{type:"object",description:VQ,additionalProperties:!0}},required:["landingPageId"],additionalProperties:!1}},{name:"connect_landing_page_domain",description:"Connect a custom domain for published landing pages. Returns the DNS target and verification records.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},domain:{type:"string",description:"Custom domain, for example pages.example.com."}},required:["domain"],additionalProperties:!1}},{name:"update_landing_page_domain_settings",description:"Update landing page domain settings. Provide domain to replace the custom domain, verify true to refresh verification, or both.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},domain:{type:"string",description:"Replacement custom domain."},verify:{type:"boolean",description:"Refresh domain verification after any domain update."}},additionalProperties:!1}},{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).
|
|
50
|
+
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), 'ecommerce' (connecting a custom e-commerce platform via the Commerce API)"}}}},{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"},status:{type:"string",description:"Initial subscriber status: active, unsubscribed, or bounced. Defaults to active."},optInMode:{type:"string",description:"Consent mode: confirmed creates active immediately when consent is verified, double_opt_in sends a confirmation email before activation, and default obeys company double opt-in settings."}},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."},includeMachineEngagement:a1},required:[]}},{name:"search_subscribers",description:"Search subscribers by free-text query, tags, list, 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"},list:{type:"string",description:"Filter by subscriber list ID or exact list name. Prefer listId when known."},listId:{type:"string",description:"Filter by subscriber list ID."},listName:{type:"string",description:"Filter by exact subscriber list name when the list ID is not known."},segmentId:{type:"string",description:"Filter by segment ID"},status:{type:"string",description:"Filter by subscriber status: active, unsubscribed, or bounced."},limit:{type:"number",description:"Maximum results to return. If omitted, the tool returns all matches across pages."}}}},{name:"list_products",description:"List synced products (Stripe, Shopify, WooCommerce) including any attached digital delivery file. Useful before attaching a file or building a purchase sequence for a specific product.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to list products for. If not provided, uses the currently selected company."},provider:{type:"string",description:"Filter by provider: stripe, shopify, woocommerce, or manual."},search:{type:"string",description:"Filter products by title."}}}},{name:"upsert_products",description:"Create or update products in the catalog (Commerce API, keyed by your productId, stored under the api provider). Use this to add products that are not synced from Stripe/Shopify/WooCommerce, then attach a deliverable file with attach_product_file and build a purchase sequence for them.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},products:{type:"array",description:"Products to create or update (max 100).",items:{type:"object",properties:{productId:{type:"string",description:"Your stable product identifier (used for upserts and order line items)."},title:{type:"string",description:"Product title."},description:{type:"string",description:"Product description."},imageUrl:{type:"string",description:"Product image URL."},url:{type:"string",description:"Product page URL."},priceCents:{type:"number",description:"Price in the smallest currency unit."},currency:{type:"string",description:"ISO currency code, e.g. USD."},inStock:{type:"boolean",description:"Whether the product is in stock."}},required:["productId","title"]}}},required:["products"]}},{name:"delete_product",description:"Delete a product previously pushed via upsert_products (Commerce API products only), identified by your productId.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},productId:{type:"string",description:"Your productId used when upserting the product."}},required:["productId"]}},{name:"attach_product_file",description:"Attach a distributable file to a product, either by public URL or by uploading a local file (filePath, local MCP server only). After a purchase of the product, sequence emails can link to it with {{event.download.url}} and {{event.download.name}}.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},productId:{type:"string",description:"Product ID from list_products, or your own productId for products pushed via upsert_products."},url:{type:"string",description:"Public http(s) URL of the file to deliver. Provide url or filePath, not both."},filePath:{type:"string",description:"Local path of a file to upload and attach (PDF, ePub, ZIP, image, audio, video, or text, up to 100MB). Only available when the MCP server runs locally on this machine."},fileName:{type:"string",description:"Display name for the file (e.g. guide.pdf). Used as {{event.download.name}}."}},required:["productId"]}},{name:"remove_product_file",description:"Remove the attached distributable file from a product.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},productId:{type:"string",description:"Product ID from list_products, or your own productId for products pushed via upsert_products."}},required:["productId"]}},{name:"sync_products",description:"Queue a sync of the Stripe product catalog into the products list. Requires an active Stripe integration.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."}}}},{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:"create_tag",description:"Create a new tag definition. The name is normalized to lowercase with hyphens (e.g. 'VIP Customer' becomes 'vip-customer'). Color defaults to gray.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},name:{type:"string",description:"Tag name. Normalized to lowercase with hyphens."},color:{type:"string",enum:[...wQ],description:"Tag color. Defaults to gray."}},required:["name"]}},{name:"update_tag",description:"Update a tag's color. System tags cannot be updated.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},tagId:{type:"string",description:"Tag ID. Use list_tags to find tag IDs."},color:{type:"string",enum:[...wQ],description:"New tag color."}},required:["tagId","color"]}},{name:"delete_tag",description:"Permanently delete a tag and remove it from all subscribers. This cannot be undone. System tags and tags used by sequences cannot be deleted.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},tagId:{type:"string",description:"Tag ID. Use list_tags to find tag IDs."}},required:["tagId"]}},{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:"update_list",description:"Update a subscriber list's name, description, or privacy. Only the provided fields are changed.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},listId:{type:"string",description:"Subscriber list ID to update."},name:{type:"string",description:"New list name."},description:{type:["string","null"],description:"New list description. Pass null to clear it."},isPrivate:{type:"boolean",description:"Whether the list is private."}},required:["listId"]}},{name:"delete_list",description:"Permanently delete a subscriber list and remove all of its memberships. Subscribers themselves are kept. This cannot be undone.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},listId:{type:"string",description:"Subscriber list ID to delete."}},required:["listId"]}},{name:"add_subscribers_to_list",description:"Bulk add existing or new subscribers to a subscriber list from an email array. Existing subscribers are added to the list without requiring a per-subscriber update call.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},listId:{type:"string",description:"Subscriber list ID to add subscribers to."},emails:{type:"array",items:{type:"string"},description:"Email addresses to add to the list. Maximum 500 per call."},duplicateStrategy:{type:"string",description:"Duplicate strategy for existing subscribers: skip, merge, or overwrite. Defaults to skip."},enrollInSequences:{type:"boolean",description:"Whether newly created subscribers should enroll in matching sequences. Defaults to false."},optInMode:{type:"string",description:"Consent mode for newly created subscribers: default, confirmed, or double_opt_in. Defaults to default."}},required:["listId","emails"]}},{name:"remove_subscribers_from_list",description:"Remove subscribers from a list by email address. Maximum 500 emails per call. Subscribers stay in the account; only the list membership is removed. Returns the removed count plus a notFound array of emails that did not match a subscriber.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},listId:{type:"string",description:"Subscriber list ID to remove subscribers from."},emails:{type:"array",items:{type:"string"},description:"Email addresses to remove from the list. Maximum 500 per call."}},required:["listId","emails"]}},{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/current/trial/date 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:y5,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 commerce product purchase filter (value is provider:productId since product ids are provider-scoped): [{"id":"filter-1","field":"commerceProduct","operator":"is","value":"api:prod-starter-kit"}]. Example repeat-buyer filter: [{"id":"filter-1","field":"commerceProduct","operator":"at_least","value":"shopify:42:2"}]. Example trial cancellation filter: [{"id":"filter-1","field":"stripeTrialProduct","operator":"is","value":"prod_123:is_canceled"}]. Example trial end filter: [{"id":"filter-1","field":"stripeTrialProduct","operator":"is","value":"prod_123:end_at:2026-05-26"}]. 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:{...u5,description:"Nested filter root. Mutually exclusive with `filters` and `filterJoinOperator`."}},required:["name"]}},{name:"update_segment",description:"Update a segment's name and/or filter rules. Use the same `filters` plus `filterJoinOperator` or nested `root` shapes as create_segment; providing `filters` or `root` replaces the segment's existing rules.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},segmentId:{type:"string",description:"Segment ID to update."},name:{type:"string",description:"New 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:y5,minItems:1,description:"Replacement segment filters. Same shape and validation rules as create_segment. Mutually exclusive with `root`."},root:{...u5,description:"Replacement nested filter root. Mutually exclusive with `filters` and `filterJoinOperator`."}},required:["segmentId"]}},{name:"delete_segment",description:"Permanently delete a segment. This cannot be undone. Subscribers are not affected.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},segmentId:{type:"string",description:"Segment ID to delete."}},required:["segmentId"]}},{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_audience_syncs",description:"List Meta custom audience syncs (segment -> ad audience mappings) with their schedule and last sync status. Requires the Meta Ads integration to be connected in the dashboard.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."}}}},{name:"list_ad_accounts",description:"List the Meta ad accounts available through the connected Meta Ads integration. Use the returned account id as `adAccountId` when creating an audience sync.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."}}}},{name:"create_audience_sync",description:'Push a segment to a Meta custom audience and keep it synced on a schedule. Provide `segmentId` for an existing segment OR `predefinedSegmentId` for a ready-made template (for example "zero-ltv", "no-purchase-1y", "recent-buyers", "high-spenders-ecom", "non-buyers", "engaged") - the template segment is created automatically on first use. The first upload runs immediately. Note: audiences are add-only; subscribers who later leave the segment stay in the Meta audience.',inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},segmentId:{type:"string",description:"Existing segment ID to sync. Mutually exclusive with `predefinedSegmentId`."},predefinedSegmentId:{type:"string",description:'Predefined segment template ID (for example "zero-ltv", "no-purchase-1y", "recent-buyers"). The segment is created automatically if it does not exist. Mutually exclusive with `segmentId`.'},adAccountId:{type:"string",description:"Meta ad account ID (act_...) from `list_ad_accounts`."},audienceName:{type:"string",description:"Name for the custom audience in Meta Ads Manager."},frequency:{type:"string",enum:["hourly","daily","weekly"],description:"How often to re-upload the segment. Default: daily."}},required:["adAccountId","audienceName"]}},{name:"update_audience_sync",description:"Update an audience sync's frequency or pause/resume it (`isActive`).",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},syncId:{type:"string",description:"Audience sync ID"},frequency:{type:"string",enum:["hourly","daily","weekly"],description:"New sync frequency."},isActive:{type:"boolean",description:"Set false to pause the sync, true to resume it."}},required:["syncId"]}},{name:"delete_audience_sync",description:"Remove an audience sync mapping. The Meta audience itself is kept (running ads are not disrupted) - only future syncs stop.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},syncId:{type:"string",description:"Audience sync ID to remove."}},required:["syncId"]}},{name:"sync_audience_now",description:"Trigger an immediate upload of the segment's subscribers to its Meta custom audience, outside the regular schedule.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},syncId:{type:"string",description:"Audience sync ID to run."}},required:["syncId"]}},{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:t6,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:t6,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."},includeMachineEngagement:a1},required:["abTestId"]}},{name:"restart_ab_test",description:"Run another sequence A/B test after a winner is selected. By default the winner becomes the new control; pass sourceVariantId to use another variant as the control email.",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 to restart"},sourceVariantId:{type:"string",description:"Optional variant ID to use as the new control email. Defaults to the selected winner."},testType:{type:"string",description:"Optional test type: subject or content."},winnerThreshold:{type:"number",description:"Optional number of subscribers before selecting a winner. Must be from 10 to 1000."},variantCount:{type:"number",description:"Optional total variants including the control. Must be from 2 to 4."}},required:["abTestId"],additionalProperties:!1}},{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:`${t1} Mutually exclusive with html.`,items:{type:"object"}}},required:["abTestId","variantId"],additionalProperties:!1}},{name:"create_ab_test",description:"Create a campaign A/B test. Control variant A is created automatically from the campaign's current email; optionally provide extra variants. The campaign must be in draft or rejected status, and each campaign can only have one A/B test.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},campaignId:{type:"string",description:"Draft campaign ID to create the A/B test for."},name:{type:"string",description:"Optional A/B test name."},testPercentage:{type:"number",description:"Percentage of the audience used for the test phase, from 5 to 50. Defaults to 20."},testDurationMinutes:{type:"number",description:"Test phase duration in minutes before the winner is selected, from 15 to 1440. Defaults to 240."},winnerCriteria:{type:"string",enum:["open_rate","click_rate"],description:"Winner selection criteria. Defaults to open_rate."},variants:{type:"array",description:"Optional extra variants to create in addition to control variant A.",items:{type:"object",properties:{subject:{type:"string",description:"Variant subject line."},previewText:{type:"string",description:"Variant preview text."},blocks:{type:"array",description:t1,items:{type:"object"}}},required:["subject"]}}},required:["campaignId"]}},{name:"add_ab_test_variant",description:"Add a variant to a draft campaign A/B test. Variants cannot be added after the test has started.",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"},subject:{type:"string",description:"Variant subject line."},previewText:{type:"string",description:"Variant preview text."},blocks:{type:"array",description:t1,items:{type:"object"}}},required:["abTestId","subject"]}},{name:"delete_ab_test_variant",description:"Permanently delete a variant from a draft campaign A/B test. This cannot be undone. Variant A is the control and cannot be deleted, and the test must keep at least the minimum number of variants. Variants cannot be removed after the test has started.",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 to delete."}},required:["abTestId","variantId"]}},{name:"delete_ab_test",description:"Permanently delete a campaign A/B test and all of its variants. This cannot be undone. Running tests (testing or winner_selected) cannot be deleted, and the linked campaign must be in draft or rejected 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 to delete."}},required:["abTestId"]}},{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. Defaults to draft; use status 'sent' only to archive an already-sent campaign without sending email.",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."},trackingCode:{type:"string",description:"Optional campaign tracking code for UTM templates. Use only when explicitly requested."},status:{type:"string",description:"Initial status: draft or sent. Defaults to draft. Use sent only for imported/already-sent campaigns; it does not send email or create delivery history."},sentAt:{type:"string",description:"ISO date-time for an imported/already-sent campaign. Only valid when status is sent; defaults to now if omitted."},html:{type:"string",description:"Email HTML content. Mutually exclusive with `blocks`."},blocks:{type:"array",description:t6,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"},campaignData:{type:"object",description:"Optional campaign-scoped JSON data for repeat blocks and personalization."},computedLists:{type:"array",description:"Optional computed list definitions derived from campaignData at send time.",items:{type:"object"}},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"},trackingCode:{type:"string",description:"Optional campaign tracking code for UTM templates. Use only when explicitly requested. Send an empty string to clear it."},html:{type:"string",description:"Email HTML content. Mutually exclusive with `blocks`."},blocks:{type:"array",description:t6,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."},campaignData:{type:"object",description:"Set campaign-scoped JSON data for repeat blocks and personalization."},computedLists:{type:"array",description:"Set computed list definitions derived from campaignData at send time.",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:["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:"cancel_campaign",description:"Cancel a campaign. Stops scheduled and sending campaigns (also works for paused and approval-pending ones). Remaining emails will not be sent and the campaign cannot be restarted - this cannot be undone.",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 cancel."}},required:["campaignId"]}},{name:"pause_campaign",description:"Pause a campaign that is currently sending. Only campaigns in sending status can be paused. Use resume_campaign to continue delivery later.",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 pause."}},required:["campaignId"]}},{name:"resume_campaign",description:"Resume a paused campaign. Only campaigns in paused status can be resumed. Optionally spread the remaining delivery over a number of hours.",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 resume."},spreadOverHours:{type:"number",description:"Spread the remaining delivery over an integer number of hours from 1 to 72."}},required:["campaignId"]}},{name:"delete_campaign",description:"Permanently delete a campaign. This cannot be undone. Sending, scheduled, or paused campaigns must be cancelled with cancel_campaign first.",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 delete."}},required:["campaignId"]}},{name:"duplicate_campaign",description:"Duplicate a campaign as a new draft. mode 'campaign' (default) copies the campaign and its email, 'ab_test' also duplicates the campaign's A/B test with all variants, and 'variant' copies a single variant's content as the new campaign email (requires variantId).",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 duplicate."},mode:{type:"string",enum:["campaign","ab_test","variant"],description:"Duplication mode. Defaults to campaign."},variantId:{type:"string",description:"A/B test variant ID whose content becomes the new campaign email. Required when mode is variant."}},required:["campaignId"]}},{name:"list_landing_pages",description:"List all landing pages for a company",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to list landing pages for. If not provided, uses the currently selected company."}},additionalProperties:!1}},{name:"get_landing_page",description:"Get landing page details, content, metrics, and URLs",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},landingPageId:{type:"string",description:"Landing page ID."}},required:["landingPageId"],additionalProperties:!1}},{name:"create_landing_page",description:"Create a draft landing page. Provide content for an exact page, or a template for generated starter content.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to create the landing page in. If not provided, uses the currently selected company."},name:{type:"string",description:"Landing page name. Optional; defaults to a template-specific name."},slug:{type:"string",description:"Optional URL slug. It will be normalized and made unique within the company."},template:{type:"string",description:pM},content:{type:"object",description:NQ,additionalProperties:!0}},additionalProperties:!1}},{name:"update_landing_page",description:"Edit a landing page's name, slug, or full content. Provide at least one update field.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},landingPageId:{type:"string",description:"Landing page ID."},name:{type:"string",description:"Landing page name."},slug:{type:"string",description:"Landing page URL slug. It will be normalized and made unique within the company."},content:{type:"object",description:NQ,additionalProperties:!0}},required:["landingPageId"],additionalProperties:!1}},{name:"delete_landing_page",description:"Delete a landing page",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},landingPageId:{type:"string",description:"Landing page ID."}},required:["landingPageId"],additionalProperties:!1}},{name:"publish_landing_page",description:"Publish a landing page. Optional name, slug, or content updates are saved before publishing.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},landingPageId:{type:"string",description:"Landing page ID."},name:{type:"string",description:"Optional landing page name update."},slug:{type:"string",description:"Optional slug update before publishing."},content:{type:"object",description:NQ,additionalProperties:!0}},required:["landingPageId"],additionalProperties:!1}},{name:"unpublish_landing_page",description:"Unpublish a landing page and return it to draft status. Optional name, slug, or content updates are saved first.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},landingPageId:{type:"string",description:"Landing page ID."},name:{type:"string",description:"Optional landing page name update."},slug:{type:"string",description:"Optional slug update before unpublishing."},content:{type:"object",description:NQ,additionalProperties:!0}},required:["landingPageId"],additionalProperties:!1}},{name:"connect_landing_page_domain",description:"Connect a custom domain for published landing pages. Returns the DNS target and verification records.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},domain:{type:"string",description:"Custom domain, for example pages.example.com."}},required:["domain"],additionalProperties:!1}},{name:"update_landing_page_domain_settings",description:"Update landing page domain settings. Provide domain to replace the custom domain, verify true to refresh verification, or both.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},domain:{type:"string",description:"Replacement custom domain."},verify:{type:"boolean",description:"Refresh domain verification after any domain update."}},additionalProperties:!1}},{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).
|
|
51
51
|
|
|
52
52
|
IMPORTANT GUIDELINES:
|
|
53
53
|
|
|
@@ -182,4 +182,4 @@ BUILT-IN EVENTS (auto-fired by payment integrations):
|
|
|
182
182
|
|
|
183
183
|
OTHER BUILT-IN EVENTS:
|
|
184
184
|
- email.opened, email.clicked, email.replied, email.bounced, email.unsubscribed
|
|
185
|
-
- 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)"},propertyFilters:{type:"array",description:"Optional event property filters for event_received triggers. The sequence only starts when the triggering event's properties match ALL filters. Use a dot-path into the event properties; use [] to match inside arrays. Examples: scope a purchase sequence to one product with { path: 'lineItems[].providerProductId', operator: 'equals', value: 'prod_123' } (ecommerce.order_placed) or { path: 'productIds', operator: 'equals', value: 'prod_123' } (saas.purchase); to match any of several products use { path: 'lineItems[].providerProductId', operator: 'one_of', value: ['prod_123', 'prod_456'] }. Max 10 filters.",items:{type:"object",properties:{path:{type:"string",description:"Dot-path into the event properties, e.g. 'lineItems[].providerProductId' or 'plan'."},operator:{type:"string",enum:["exists","not_exists","equals","not_equals","one_of","contains","greater_than","less_than"],description:"Comparison operator. one_of matches when the property equals any entry of the value array."},value:{type:["string","number","boolean","array"],items:{type:["string","number"]},maxItems:50,description:"Value to compare against. Required for every operator except exists/not_exists. For one_of, pass an array of strings or numbers (max 50 values); all other operators take a single value."}},required:["path","operator"]}},inactiveDays:{type:"number",description:"Number of days of inactivity (required for inactivity trigger, must be >= 1)"},inactivityBaseline:{type:"string",enum:["sequence_created_at","subscriber_created_at"],description:"When to start counting inactivity for subscribers who never had the event. Defaults to sequence_created_at."},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)"},durationDays:{type:"number",description:"Total duration in days used to space AI-generated sequence emails. Only applies when using goal-based AI generation."},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."},sendingWindow:_5,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: 'entered_segment', value: 'segment_123' } when they enter a segment, { type: 'field_changed', value: 'plan' } when a subscriber field changes, { 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","entered_segment","field_changed","event_received"],description:"Stop condition type."},value:{type:["string","null"],description:"Tag name, list ID, segment ID, field path, 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:p5,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."},sendingWindow:_5,clearSendingWindow:{type:"boolean",description:"Set true to remove the sequence sending window. Do not provide this together with sendingWindow."},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: 'entered_segment', value: 'segment_123' } to stop when they enter a segment, { type: 'field_changed', value: 'plan' } to stop when a subscriber field changes, { 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","entered_segment","field_changed","event_received"]},value:{type:["string","null"],description:"Tag name, list ID, segment ID, field path, 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:h5}},required:["conditionType"]}},elseSteps:{type:"array",description:"Steps to create inside the else fallback path. Required by default so the else arm is usable.",items:h5},allowEmptyPaths:{type:"boolean",description:"Set true only when intentionally creating empty UI placeholders. Normal API/MCP use should omit this and provide branch steps plus elseSteps."}},required:["afterNodeId","branches"]},emails:{type:"array",description:"Updated sequence emails. If you omit emailId/nodeId, items are matched by existing step order.",items:{type:"object",properties:{emailId:{type:"string",description:"Optional target linked email template ID for a step. Use the emailId returned in get_sequence.sequence.emails."},nodeId:{type:"string",description:"Optional target action_email node ID for a step. Use the nodeId returned in get_sequence.sequence.emails."},name:{type:"string",description:"Updated step/template name"},subject:{type:"string",description:"Updated email subject"},previewText:{type:"string",description:"Updated preview text"},html:{type:"string",description:"Updated HTML content. Will be converted to Sequenzy blocks."},htmlContent:{type:"string",description:"Alias for html. Use this when updating HTML content for a step."},blocks:{type:"array",description:t1,items:{type:"object"}}}}},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:t1,items:{type:"object"}}}}}},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:"enroll_subscribers_in_sequence",description:"Manually enroll subscribers in a sequence by email address or subscriber ID. Maximum 500 total targets per call across emails and subscriberIds. Only active subscribers are enrolled: unknown emails are returned in `notFound`, while inactive, unavailable, and already actively enrolled subscribers are counted in `skipped`. By default enrollment starts at the first step after the trigger; pass targetNodeId to start at a specific step.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},sequenceId:{type:"string",description:"Sequence ID to enroll subscribers in."},emails:{type:"array",items:{type:"string"},description:"Email addresses of subscribers to enroll. Combined with subscriberIds, maximum 500 total targets per call."},subscriberIds:{type:"array",items:{type:"string"},description:"Subscriber IDs to enroll. Combined with emails, maximum 500 total targets per call."},targetNodeId:{type:"string",description:"Optional node ID to start enrollment at. Use a non-trigger nodeId from get_sequence. Defaults to the first step after the trigger."}},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:`${o6} 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:`${t1} 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. Maximum length: 255 characters."}},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)"},includeMachineEngagement:a1}}},{name:"get_campaign_stats",description:"Get detailed statistics for a campaign, including attributed conversions and revenue (revenueCents)",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},campaignId:{type:"string",description:"Campaign ID"},includeMachineEngagement:a1},required:["campaignId"]}},{name:"get_sequence_stats",description:"Get statistics for a sequence, including attributed conversions and revenue (revenueCents) plus 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"},includeMachineEngagement:a1},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."},includeMachineEngagement:a1},required:[]}},{name:"list_team_members",description:"List team members for the company, including the owner, members with their roles, and pending or expired invitations.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."}}}},{name:"invite_team_member",description:"Invite a team member by email with role admin or viewer. Existing Sequenzy users are added to the team immediately; others receive an email invitation. Billing access (canManageBilling) can only be granted by the company owner.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},email:{type:"string",description:"Email address of the person to invite."},role:{type:"string",enum:["admin","viewer"],description:"Team role. Admins can manage the workspace; viewers have read-only access."},canManageBilling:{type:"boolean",description:"Whether the member can manage billing. Only the company owner can grant billing access. Defaults to false."}},required:["email","role"]}},{name:"cancel_team_invitation",description:"Cancel a pending team invitation. Invitations that have already been accepted cannot be cancelled.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},invitationId:{type:"string",description:"Invitation ID to cancel. Use list_team_members to find pending invitations."}},required:["invitationId"]}},{name:"list_conversations",description:"List inbox conversations (email replies from subscribers). Filter by status, free-text search, or unread state, with pagination.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},status:{type:"string",enum:["open","closed","all"],description:"Filter by conversation status. Defaults to all."},search:{type:"string",description:"Free-text search across conversation subjects and participants."},unread:{type:"boolean",description:"Set true to only return conversations with unread messages."},page:{type:"number",description:"Page number. Defaults to 1."},limit:{type:"number",description:"Results per page, from 1 to 100. Defaults to 20."}}}},{name:"get_conversation",description:"Get a conversation with its full message history, subscriber details, and context.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},conversationId:{type:"string",description:"Conversation ID."}},required:["conversationId"]}},{name:"reply_to_conversation",description:"Send a reply in a conversation, or add an internal note. type 'outbound' (default) emails the subscriber and requires bodyText or bodyHtml; type 'note' adds a private team-only note. Replying to a closed conversation reopens it.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},conversationId:{type:"string",description:"Conversation ID to reply in."},type:{type:"string",enum:["outbound","note"],description:"Message type: outbound emails the subscriber, note is internal-only. Defaults to outbound."},subject:{type:"string",description:"Optional subject override. Defaults to the conversation subject."},bodyText:{type:"string",description:"Plain-text message body."},bodyHtml:{type:"string",description:"HTML message body."}},required:["conversationId"]}},{name:"update_conversation_status",description:"Open or close a conversation.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},conversationId:{type:"string",description:"Conversation ID."},status:{type:"string",enum:["open","closed"],description:"New conversation status."}},required:["conversationId","status"]}},{name:"mark_conversation_read",description:"Mark all unread inbound messages in a conversation as read.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},conversationId:{type:"string",description:"Conversation ID."}},required:["conversationId"]}},{name:"list_webhooks",description:"List outbound webhook endpoints and their subscribed event types.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."}}}},{name:"create_webhook",description:"Create an outbound webhook endpoint. IMPORTANT: the response includes a signingSecret that is returned only once - show it to the user immediately so they can store it and verify webhook signatures. If events is omitted, a default set of event types is subscribed.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},name:{type:"string",description:"Webhook endpoint name."},url:{type:"string",description:"HTTPS URL that will receive webhook events."},events:{type:"array",items:{type:"string",enum:[...jQ]},description:"Event types to subscribe to. If omitted, a default set is used."}},required:["name","url"]}},{name:"update_webhook",description:"Update an outbound webhook endpoint's name, URL, subscribed events, or status (enabled/disabled). Providing events replaces the existing event list.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},webhookId:{type:"string",description:"Webhook endpoint ID."},name:{type:"string",description:"New webhook endpoint name."},url:{type:"string",description:"New HTTPS URL that will receive webhook events."},events:{type:"array",items:{type:"string",enum:[...jQ]},description:"Replacement event type subscriptions."},status:{type:"string",enum:["enabled","disabled"],description:"Enable or disable deliveries to this endpoint."}},required:["webhookId"]}},{name:"delete_webhook",description:"Permanently delete an outbound webhook endpoint along with its delivery history. This cannot be undone. To keep the endpoint but stop deliveries, use update_webhook with status disabled instead.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},webhookId:{type:"string",description:"Webhook endpoint ID to delete."}},required:["webhookId"]}},{name:"test_webhook",description:"Send a test event to an outbound webhook endpoint to verify it is reachable and signatures can be validated.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},webhookId:{type:"string",description:"Webhook endpoint ID to test."}},required:["webhookId"]}},{name:"list_webhook_deliveries",description:"List recent delivery attempts for an outbound webhook endpoint, including status and response codes.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},webhookId:{type:"string",description:"Webhook endpoint ID."},limit:{type:"number",description:"Maximum number of deliveries to return, from 1 to 100. Defaults to 20."}},required:["webhookId"]}},{name:"replay_webhook_delivery",description:"Replay a previous webhook delivery, re-sending the same event payload to the endpoint.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},webhookId:{type:"string",description:"Webhook endpoint ID."},deliveryId:{type:"string",description:"Delivery ID to replay. Use list_webhook_deliveries to find delivery IDs."}},required:["webhookId","deliveryId"]}},{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"]}}],d5=uV.map(gV).map(tM);async function o5(Q,Y){try{let X;switch(Q){case"get_account":{let G=await L("GET","/api/v1/account"),$=N1();X={...G,selectedCompanyId:$??G.currentCompanyId};break}case"select_company":{let G=Y.companyId,$=await L("GET","/api/v1/account"),z=$.companies?.find((J)=>J.id===G);if(!z)throw Error(`Company not found. Available companies: ${$.companies?.map((J)=>`${J.name} (${J.id})`).join(", ")??"none"}`);TQ(G),X={success:!0,message:`Switched to company: ${z.name}`,companyId:z.id,companyName:z.name};break}case"get_app_urls":{let G=await i5(Y);X={...M1({companyId:G,campaignId:w(Y,"campaignId"),landingPageId:w(Y,"landingPageId"),sequenceId:w(Y,"sequenceId"),emailId:w(Y,"emailId")??w(Y,"templateId"),transactionalId:w(Y,"transactionalId"),emailSendId:w(Y,"emailSendId"),domainId:w(Y,"domainId"),status:w(Y,"status"),settingsTab:w(Y,"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 L("POST","/api/v1/companies",{name:Y.name,domain:Y.domain});if(!G.success)throw Error("Failed to create company");let $=G.company.id,z=6,J=0,H=G.company.status;while(H==="processing"&&J<z){await new Promise((B)=>setTimeout(B,20000)),J++;let A=await L("GET",`/api/v1/companies/${$}`);if(A.success)H=A.company.status}TQ($);let U=await L("GET",`/api/v1/companies/${$}`);X={success:!0,company:U.company,message:H==="processing"?"Company created but still processing. You can continue using it while processing completes.":`Company '${U.company.name}' created and ready to use.`,autoSelected:!0};break}case"get_company":{let G=Y.companyId;X=await L("GET",`/api/v1/companies/${G}`);break}case"create_api_key":{let G=Y.companyId;X=await L("POST","/api/v1/api-keys",{name:Y.name},G);break}case"list_websites":{let G=Y.companyId;X=await L("GET","/api/v1/websites",void 0,G);break}case"add_website":{let G=Y.companyId;X=await L("POST","/api/v1/websites",{domain:Y.domain},G);break}case"check_website":{let G=Y.companyId;X=await L("GET",`/api/v1/websites/${Y.domain}`,void 0,G);break}case"get_integration_guide":X=await L("POST","/api/v1/integration-guide",Y);break;case"add_subscriber":{let G=Y.companyId,$=t6("add_subscriber",Y);X=await L("POST","/api/v1/subscribers",{...$,customAttributes:Y.attributes,tags:Y.tags,lists:Y.listIds,...Y.status!==void 0&&{status:Y.status},...Y.optInMode!==void 0&&{optInMode:Y.optInMode}},G);break}case"update_subscriber":{let G=Y.companyId,$=t6("update_subscriber",Y),z=await cY($,G),J=Array.isArray(z.subscriber.tags)?z.subscriber.tags.filter((K)=>typeof K==="string"):[],H=Array.isArray(Y.addTags)?Y.addTags.filter((K)=>typeof K==="string"&&K.trim()!=="").map(f5):[],U=new Set(Array.isArray(Y.removeTags)?Y.removeTags.filter((K)=>typeof K==="string"&&K.trim()!=="").map(f5):[]),A=J.filter((K)=>!U.has(K));for(let K of H)if(!A.includes(K))A.push(K);let B={};if($.email&&$.externalId)B.externalId=$.externalId;if(J0(Y.attributes))B.customAttributes={...J0(z.subscriber.customAttributes)?z.subscriber.customAttributes:{},...Y.attributes};if(Y.addTags||Y.removeTags)B.tags=A;X=await L("PATCH",dY($),B,G);break}case"remove_subscriber":{let G=Y.companyId,$=t6("remove_subscriber",Y),z=dY($);if(Y.hardDelete===!0)X=await L("DELETE",z,void 0,G);else X=await L("PATCH",z,{status:"unsubscribed"},G);break}case"get_subscriber":{let G=Y.companyId,$=t6("get_subscriber",Y);X=await cY($,G,{includeMachineEngagement:Y.includeMachineEngagement===!0});break}case"search_subscribers":{let G=Y.companyId;X=await VV(Y,G);break}case"list_products":{let G=Y.companyId,$=new URLSearchParams;if(typeof Y.provider==="string"&&Y.provider.trim())$.set("provider",Y.provider.trim());if(typeof Y.search==="string"&&Y.search.trim())$.set("search",Y.search.trim());let z=$.size>0?`?${$.toString()}`:"";X=await L("GET",`/api/v1/products${z}`,void 0,G);break}case"upsert_products":{let G=Y.companyId;if(!Array.isArray(Y.products)||Y.products.length===0)throw Error("`products` must be a non-empty array when calling `upsert_products`.");X=await L("POST","/api/v1/products",{products:Y.products},G);break}case"delete_product":{let G=Y.companyId,$=k("delete_product",Y,"productId");X=await L("DELETE",`/api/v1/products/${encodeURIComponent($)}`,void 0,G);break}case"attach_product_file":{let G=Y.companyId,$=k("attach_product_file",Y,"productId"),z=w(Y,"url"),J=w(Y,"filePath");if(z===void 0===(J===void 0))throw Error("Provide either `url` or `filePath` (not both) when calling `attach_product_file`.");let H;if(J!==void 0){let U=await bV(J,G);H={url:U.url,source:"upload",fileName:w(Y,"fileName")??U.fileName,fileSizeBytes:U.fileSizeBytes,mimeType:U.mimeType}}else{H={url:z};let U=w(Y,"fileName");if(U)H.fileName=U}X=await L("PUT",`/api/v1/products/${encodeURIComponent($)}/delivery`,H,G);break}case"remove_product_file":{let G=Y.companyId,$=k("remove_product_file",Y,"productId");X=await L("DELETE",`/api/v1/products/${encodeURIComponent($)}/delivery`,void 0,G);break}case"sync_products":{let G=Y.companyId;X=await L("POST","/api/v1/products/sync",void 0,G);break}case"list_tags":{let G=Y.companyId;X=await L("GET","/api/v1/tags",void 0,G);break}case"create_tag":{let G=Y.companyId,$=k("create_tag",Y,"name"),z=W1("create_tag",Y,"color",wQ);X=await L("POST","/api/v1/tags",{name:$,...z!==void 0&&{color:z}},G);break}case"update_tag":{let G=Y.companyId,$=k("update_tag",Y,"tagId"),z=pY("update_tag",Y,"color",wQ);X=await L("PATCH",`/api/v1/tags/${encodeURIComponent($)}`,{color:z},G);break}case"delete_tag":{let G=Y.companyId,$=k("delete_tag",Y,"tagId");X=await L("DELETE",`/api/v1/tags/${encodeURIComponent($)}`,void 0,G);break}case"list_lists":{let G=Y.companyId;X=await L("GET","/api/v1/lists",void 0,G);break}case"create_list":{let G=Y.companyId;X=await L("POST","/api/v1/lists",Y,G);break}case"update_list":{let G=Y.companyId,$=k("update_list",Y,"listId");if(Y.name===void 0&&Y.description===void 0&&Y.isPrivate===void 0)throw Error("Provide at least one of `name`, `description`, or `isPrivate` when calling `update_list`.");if(Y.name!==void 0&&w(Y,"name")===void 0)throw Error("`name` cannot be empty when calling `update_list`.");if(Y.description!==void 0&&Y.description!==null&&typeof Y.description!=="string")throw Error("`description` must be a string or null when calling `update_list`.");if(Y.isPrivate!==void 0&&typeof Y.isPrivate!=="boolean")throw Error("`isPrivate` must be a boolean when calling `update_list`.");X=await L("PATCH",`/api/v1/lists/${encodeURIComponent($)}`,{...Y.name!==void 0&&{name:w(Y,"name")},...Y.description!==void 0&&{description:Y.description},...Y.isPrivate!==void 0&&{isPrivate:Y.isPrivate}},G);break}case"delete_list":{let G=Y.companyId,$=k("delete_list",Y,"listId");X=await L("DELETE",`/api/v1/lists/${encodeURIComponent($)}`,void 0,G);break}case"add_subscribers_to_list":{let G=Y.companyId,$=k("add_subscribers_to_list",Y,"listId"),z=m5("add_subscribers_to_list",Y),J=W1("add_subscribers_to_list",Y,"duplicateStrategy",["skip","merge","overwrite"])??"skip",H=W1("add_subscribers_to_list",Y,"optInMode",["default","confirmed","double_opt_in"])??"default";X=await L("POST",`/api/v1/lists/${encodeURIComponent($)}/subscribers`,{emails:z,duplicateStrategy:J,enrollInSequences:Y.enrollInSequences===!0,optInMode:H},G);break}case"remove_subscribers_from_list":{let G=Y.companyId,$=k("remove_subscribers_from_list",Y,"listId"),z=m5("remove_subscribers_from_list",Y);X=await L("POST",`/api/v1/lists/${encodeURIComponent($)}/subscribers/remove`,{emails:z},G);break}case"list_segments":{let G=Y.companyId;X=await L("GET","/api/v1/segments",void 0,G);break}case"create_segment":{UV(Y);let G=Y.companyId;X=await L("POST","/api/v1/segments",{...Y,...Y.filters!==void 0?{filters:nY(Y.filters)}:{},...Y.root!==void 0?{root:rY(Y.root)}:{}},G);break}case"update_segment":{AV(Y);let G=Y.companyId,$=k("update_segment",Y,"segmentId"),z=w(Y,"name"),J=W1("update_segment",Y,"filterJoinOperator",["and","or"]);X=await L("PATCH",`/api/v1/segments/${encodeURIComponent($)}`,{...z!==void 0&&{name:z},...J!==void 0&&{filterJoinOperator:J},...Y.filters!==void 0?{filters:nY(Y.filters)}:{},...Y.root!==void 0?{root:rY(Y.root)}:{}},G);break}case"delete_segment":{let G=Y.companyId,$=k("delete_segment",Y,"segmentId");X=await L("DELETE",`/api/v1/segments/${encodeURIComponent($)}`,void 0,G);break}case"get_segment_count":{let G=Y.companyId;X=await L("GET",`/api/v1/segments/${Y.segmentId}/count`,void 0,G);break}case"list_audience_syncs":{let G=Y.companyId;X=await L("GET","/api/v1/audience-syncs",void 0,G);break}case"list_ad_accounts":{let G=Y.companyId;X=await L("GET","/api/v1/ad-accounts",void 0,G);break}case"create_audience_sync":{let G=Y.companyId,$=w(Y,"segmentId"),z=w(Y,"predefinedSegmentId");if($&&z)throw Error("Provide either `segmentId` or `predefinedSegmentId` when calling `create_audience_sync`, not both.");if(!$&&!z)throw Error("Provide either `segmentId` or `predefinedSegmentId` when calling `create_audience_sync`.");X=await L("POST","/api/v1/audience-syncs",{segmentId:$,predefinedSegmentId:z,adAccountId:k("create_audience_sync",Y,"adAccountId"),audienceName:k("create_audience_sync",Y,"audienceName"),...Y.frequency!==void 0?{frequency:Y.frequency}:{}},G);break}case"update_audience_sync":{let G=Y.companyId,$=k("update_audience_sync",Y,"syncId");X=await L("PATCH",`/api/v1/audience-syncs/${encodeURIComponent($)}`,{...Y.frequency!==void 0?{frequency:Y.frequency}:{},...Y.isActive!==void 0?{isActive:Y.isActive}:{}},G);break}case"delete_audience_sync":{let G=Y.companyId,$=k("delete_audience_sync",Y,"syncId");X=await L("DELETE",`/api/v1/audience-syncs/${encodeURIComponent($)}`,void 0,G);break}case"sync_audience_now":{let G=Y.companyId,$=k("sync_audience_now",Y,"syncId");X=await L("POST",`/api/v1/audience-syncs/${encodeURIComponent($)}/sync`,void 0,G);break}case"list_templates":{let G=Y.companyId,$=new URLSearchParams,z=w(Y,"label");if(z)$.set("label",z);X=await L("GET",`/api/v1/templates${$.size>0?`?${$}`:""}`,void 0,G);break}case"get_template":{let G=Y.companyId;X=await L("GET",`/api/v1/templates/${Y.templateId}`,void 0,G);break}case"create_template":{let G=Y.companyId;S1("create_template",Y,{requireContent:!0}),ZQ("create_template",Y),X=await L("POST","/api/v1/templates",Y,G);break}case"update_template":{let G=Y.companyId,$=new Set(["companyId","templateId","name","subject","html","blocks","labels"]),z=Object.keys(Y).filter((J)=>!$.has(J));if(z.length>0)throw Error(`\`update_template\` accepts only \`name\`, \`subject\`, \`html\`, \`blocks\`, and \`labels\` update fields. Unsupported field${z.length===1?"":"s"}: ${z.map((J)=>`\`${J}\``).join(", ")}.`);if(S1("update_template",Y),ZQ("update_template",Y),Y.name===void 0&&Y.subject===void 0&&Y.html===void 0&&Y.blocks===void 0&&Y.labels===void 0)throw Error("Provide at least one of `name`, `subject`, `html`, `blocks`, or `labels` when calling `update_template`.");X=await L("PUT",`/api/v1/templates/${Y.templateId}`,Y,G);break}case"delete_template":{let G=Y.companyId;X=await L("DELETE",`/api/v1/templates/${Y.templateId}`,void 0,G);break}case"list_ab_tests":{let G=Y.companyId,$=new URLSearchParams,z=w(Y,"sequenceId");if(z)$.set("sequenceId",z);X=await L("GET",`/api/v1/ab-tests${$.size>0?`?${$}`:""}`,void 0,G);break}case"get_ab_test":{let G=Y.companyId;X=await L("GET",`/api/v1/ab-tests/${Y.abTestId}`,void 0,G);break}case"get_ab_test_stats":{let G=Y.companyId,$=new URLSearchParams,z=w(Y,"period"),J=w(Y,"start"),H=w(Y,"end");if(z)$.set("period",z);if(J)$.set("start",J);if(H)$.set("end",H);if(Y.includeMachineEngagement===!0)$.set("includeMachineEngagement","true");X=await L("GET",`/api/v1/ab-tests/${Y.abTestId}/stats${$.size>0?`?${$}`:""}`,void 0,G);break}case"restart_ab_test":{let G=Y.companyId,$=new Set(["companyId","abTestId","sourceVariantId","testType","winnerThreshold","variantCount"]),z=Object.keys(Y).filter((A)=>!$.has(A));if(z.length>0)throw Error(`\`restart_ab_test\` accepts only \`sourceVariantId\`, \`testType\`, \`winnerThreshold\`, and \`variantCount\` option fields. Unsupported field${z.length===1?"":"s"}: ${z.map((A)=>`\`${A}\``).join(", ")}.`);let J=w(Y,"testType");if(J!==void 0&&J!=="subject"&&J!=="content")throw Error("`restart_ab_test` testType must be `subject` or `content`.");let H=Y.winnerThreshold===void 0?void 0:Number(Y.winnerThreshold);if(H!==void 0&&(!Number.isInteger(H)||H<10||H>1000))throw Error("`restart_ab_test` winnerThreshold must be an integer from 10 to 1000.");let U=Y.variantCount===void 0?void 0:Number(Y.variantCount);if(U!==void 0&&(!Number.isInteger(U)||U<2||U>4))throw Error("`restart_ab_test` variantCount must be an integer from 2 to 4.");X=await L("POST",`/api/v1/ab-tests/${Y.abTestId}/restart`,{sourceVariantId:w(Y,"sourceVariantId"),testType:J,winnerThreshold:H,variantCount:U},G);break}case"update_ab_test_variant":{let G=Y.companyId,$=new Set(["companyId","abTestId","variantId","subject","previewText","html","blocks"]),z=Object.keys(Y).filter((J)=>!$.has(J));if(z.length>0)throw Error(`\`update_ab_test_variant\` accepts only \`subject\`, \`previewText\`, \`html\`, and \`blocks\` update fields. Unsupported field${z.length===1?"":"s"}: ${z.map((J)=>`\`${J}\``).join(", ")}.`);if(S1("update_ab_test_variant",Y),Y.subject===void 0&&Y.previewText===void 0&&Y.html===void 0&&Y.blocks===void 0)throw Error("Provide at least one of `subject`, `previewText`, `html`, or `blocks` when calling `update_ab_test_variant`.");X=await L("PATCH",`/api/v1/ab-tests/${Y.abTestId}/variants/${Y.variantId}`,Y,G);break}case"create_ab_test":{let G=Y.companyId,$=k("create_ab_test",Y,"campaignId"),z=w(Y,"name"),J=a6("create_ab_test",Y,"testPercentage",5,50),H=a6("create_ab_test",Y,"testDurationMinutes",15,1440),U=W1("create_ab_test",Y,"winnerCriteria",["open_rate","click_rate"]);if(Y.variants!==void 0){if(!Array.isArray(Y.variants))throw Error("`variants` must be an array when calling `create_ab_test`.");Y.variants.forEach((A,B)=>{if(!J0(A)||typeof A.subject!=="string"||A.subject.trim()==="")throw Error(`\`variants\` item ${B+1} must include a non-empty \`subject\` when calling \`create_ab_test\`.`);if(A.blocks!==void 0&&!Array.isArray(A.blocks))throw Error(`\`variants\` item ${B+1} \`blocks\` must be an array when calling \`create_ab_test\`.`)})}X=await L("POST","/api/v1/ab-tests",{campaignId:$,...z!==void 0&&{name:z},...J!==void 0&&{testPercentage:J},...H!==void 0&&{testDurationMinutes:H},...U!==void 0&&{winnerCriteria:U},...Y.variants!==void 0&&{variants:Y.variants}},G);break}case"add_ab_test_variant":{let G=Y.companyId,$=k("add_ab_test_variant",Y,"abTestId"),z=k("add_ab_test_variant",Y,"subject"),J=w(Y,"previewText");if(Y.blocks!==void 0&&!Array.isArray(Y.blocks))throw Error("`blocks` must be an array when calling `add_ab_test_variant`.");X=await L("POST",`/api/v1/ab-tests/${encodeURIComponent($)}/variants`,{subject:z,...J!==void 0&&{previewText:J},...Y.blocks!==void 0&&{blocks:Y.blocks}},G);break}case"delete_ab_test_variant":{let G=Y.companyId,$=k("delete_ab_test_variant",Y,"abTestId"),z=k("delete_ab_test_variant",Y,"variantId");X=await L("DELETE",`/api/v1/ab-tests/${encodeURIComponent($)}/variants/${encodeURIComponent(z)}`,void 0,G);break}case"delete_ab_test":{let G=Y.companyId,$=k("delete_ab_test",Y,"abTestId");X=await L("DELETE",`/api/v1/ab-tests/${encodeURIComponent($)}`,void 0,G);break}case"list_campaigns":{let G=Y.companyId,$=new URLSearchParams;if(Y.status)$.set("status",String(Y.status));let z=w(Y,"label");if(z)$.set("label",z);X=await L("GET",`/api/v1/campaigns?${$}`,void 0,G);break}case"get_campaign":{let G=Y.companyId;X=await L("GET",`/api/v1/campaigns/${Y.campaignId}`,void 0,G);break}case"get_email_send":{let G=Y.companyId;X=await L("GET",`/api/v1/email-sends/${encodeURIComponent(String(Y.emailSendId))}`,void 0,G);break}case"create_campaign":{let G=Y.companyId;DV(Y);let $=w(Y,"prompt");if($!==void 0){let z=await L("POST","/api/v1/generate/email",{prompt:$,...Y.style!==void 0&&{style:Y.style},...Y.tone!==void 0&&{tone:Y.tone}},G),J=w(Y,"subject")??(typeof z.subject==="string"&&z.subject.trim()!==""?z.subject.trim():void 0);if(!J)throw Error("`create_campaign` prompt generation did not return a subject. Provide `subject` explicitly.");let H=Array.isArray(z.blocks)&&z.blocks.length>0?z.blocks:void 0,U=typeof z.html==="string"&&z.html.trim()!==""?z.html:void 0;if(H===void 0&&U===void 0)throw Error("`create_campaign` prompt generation did not return email blocks. Try again or provide `html` or `blocks` explicitly.");X=await L("POST","/api/v1/campaigns",{name:Y.name,subject:J,...H!==void 0?{blocks:H}:{html:U},...Y.segmentId!==void 0&&{segmentId:Y.segmentId},...Y.trackingCode!==void 0&&{trackingCode:Y.trackingCode},...Y.status!==void 0&&{status:Y.status},...Y.sentAt!==void 0&&{sentAt:Y.sentAt},...Y.campaignData!==void 0&&{campaignData:Y.campaignData},...Y.computedLists!==void 0&&{computedLists:Y.computedLists},...Y.labels!==void 0&&{labels:Y.labels}},G);break}X=await L("POST","/api/v1/campaigns",Y,G);break}case"update_campaign":{let G=Y.companyId,$=new Set(["companyId","campaignId","name","subject","trackingCode","html","blocks","replyTo","replyProfileId","campaignData","computedLists","labels"]),z=Object.keys(Y).filter((J)=>!$.has(J));if(z.length>0)throw Error(`\`update_campaign\` accepts only \`name\`, \`subject\`, \`trackingCode\`, \`html\`, \`blocks\`, \`replyTo\`, \`replyProfileId\`, \`campaignData\`, \`computedLists\`, and \`labels\` update fields. Unsupported field${z.length===1?"":"s"}: ${z.map((J)=>`\`${J}\``).join(", ")}.`);if(S1("update_campaign",Y),ZQ("update_campaign",Y),Y.replyTo!==void 0&&Y.replyProfileId!==void 0)throw Error("Provide either `replyTo` or `replyProfileId` when calling `update_campaign`, not both.");if(Y.name===void 0&&Y.subject===void 0&&Y.trackingCode===void 0&&Y.html===void 0&&Y.blocks===void 0&&Y.replyTo===void 0&&Y.replyProfileId===void 0&&Y.campaignData===void 0&&Y.computedLists===void 0&&Y.labels===void 0)throw Error("Provide at least one of `name`, `subject`, `trackingCode`, `html`, `blocks`, `replyTo`, `replyProfileId`, `campaignData`, `computedLists`, or `labels` when calling `update_campaign`.");X=await L("PUT",`/api/v1/campaigns/${Y.campaignId}`,Y,G);break}case"schedule_campaign":{let G=Y.companyId,$=new Set(["companyId","campaignId","scheduledAt","targetLists","sendTimeOptimization","spreadOverHours"]),z=Object.keys(Y).filter((J)=>!$.has(J));if(z.length>0)throw Error(`\`schedule_campaign\` accepts only \`campaignId\`, \`scheduledAt\`, \`targetLists\`, \`sendTimeOptimization\`, and \`spreadOverHours\`. Unsupported field${z.length===1?"":"s"}: ${z.map((J)=>`\`${J}\``).join(", ")}.`);LV(Y),X=await L("POST",`/api/v1/campaigns/${Y.campaignId}/schedule`,{scheduledAt:Y.scheduledAt,...Y.targetLists!==void 0&&{targetLists:Y.targetLists},...Y.sendTimeOptimization!==void 0&&{sendTimeOptimization:Y.sendTimeOptimization},...Y.spreadOverHours!==void 0&&{spreadOverHours:Y.spreadOverHours}},G);break}case"send_test_email":{let G=Y.companyId;X=await L("POST",`/api/v1/campaigns/${Y.campaignId}/test`,{to:Y.to},G);break}case"cancel_campaign":{let G=Y.companyId,$=k("cancel_campaign",Y,"campaignId");X=await L("POST",`/api/v1/campaigns/${encodeURIComponent($)}/cancel`,void 0,G);break}case"pause_campaign":{let G=Y.companyId,$=k("pause_campaign",Y,"campaignId");X=await L("POST",`/api/v1/campaigns/${encodeURIComponent($)}/pause`,void 0,G);break}case"resume_campaign":{let G=Y.companyId,$=k("resume_campaign",Y,"campaignId"),z=a6("resume_campaign",Y,"spreadOverHours",1,72);X=await L("POST",`/api/v1/campaigns/${encodeURIComponent($)}/resume`,{...z!==void 0&&{spreadOverHours:z}},G);break}case"delete_campaign":{let G=Y.companyId,$=k("delete_campaign",Y,"campaignId");X=await L("DELETE",`/api/v1/campaigns/${encodeURIComponent($)}`,void 0,G);break}case"duplicate_campaign":{let G=Y.companyId,$=k("duplicate_campaign",Y,"campaignId"),z=W1("duplicate_campaign",Y,"mode",["campaign","ab_test","variant"]),J=w(Y,"variantId");if(z==="variant"&&J===void 0)throw Error("`variantId` is required when calling `duplicate_campaign` with mode `variant`.");X=await L("POST",`/api/v1/campaigns/${encodeURIComponent($)}/duplicate`,{...z!==void 0&&{mode:z},...J!==void 0&&{variantId:J}},G);break}case"list_landing_pages":{let G=Y.companyId;X=await L("GET","/api/v1/landing-pages",void 0,G);break}case"get_landing_page":{let G=Y.companyId;X=await L("GET",`/api/v1/landing-pages/${Y.landingPageId}`,void 0,G);break}case"create_landing_page":{let G=Y.companyId,$=new Set(["companyId","name","slug","template","content"]),z=Object.keys(Y).filter((J)=>!$.has(J));if(z.length>0)throw Error(`\`create_landing_page\` accepts only \`name\`, \`slug\`, \`template\`, and \`content\` fields. Unsupported field${z.length===1?"":"s"}: ${z.map((J)=>`\`${J}\``).join(", ")}.`);X=await L("POST","/api/v1/landing-pages",{...Y.name!==void 0&&{name:Y.name},...Y.slug!==void 0&&{slug:Y.slug},...Y.template!==void 0&&{template:Y.template},...Y.content!==void 0&&{content:Y.content}},G);break}case"update_landing_page":{let G=Y.companyId,$=mY("update_landing_page",Y,{requireUpdate:!0});X=await L("PUT",`/api/v1/landing-pages/${Y.landingPageId}`,$,G);break}case"publish_landing_page":{let G=Y.companyId,$=mY("publish_landing_page",Y,{requireUpdate:!1});X=await L("POST",`/api/v1/landing-pages/${Y.landingPageId}/publish`,$,G);break}case"unpublish_landing_page":{let G=Y.companyId,$=mY("unpublish_landing_page",Y,{requireUpdate:!1});X=await L("POST",`/api/v1/landing-pages/${Y.landingPageId}/unpublish`,$,G);break}case"delete_landing_page":{let G=Y.companyId;X=await L("DELETE",`/api/v1/landing-pages/${Y.landingPageId}`,void 0,G);break}case"connect_landing_page_domain":{let G=Y.companyId;X=await L("POST","/api/v1/landing-pages/domain",{domain:Y.domain},G);break}case"update_landing_page_domain_settings":{let G=Y.companyId,$=FV(Y);X=await L("PUT","/api/v1/landing-pages/domain",$,G);break}case"list_sequences":{let G=Y.companyId;X=await L("GET","/api/v1/sequences",void 0,G);break}case"get_sequence":{let G=Y.companyId;X=await L("GET",`/api/v1/sequences/${Y.sequenceId}`,void 0,G);break}case"create_sequence":{let G=Y.companyId,$=Array.isArray(Y.steps)&&Y.steps.length>0,z=await L("POST","/api/v1/sequences",Y,G);if(!z.success){X=z;break}let J=z.sequence.id;if($){let K=await L("GET",`/api/v1/sequences/${J}`,void 0,G);if(K.success)X={success:!0,sequence:K.sequence,message:`Sequence "${K.sequence.name}" created with explicit steps. Review it before enabling.`};else X=K;break}let H=6,U=0,A="pending";while(A!=="complete"&&U<H){await new Promise((D)=>setTimeout(D,20000)),U++;let K=await L("GET",`/api/v1/sequences/${J}`,void 0,G);if(K.success)A=K.sequence.enrichmentStatus}let B=await L("GET",`/api/v1/sequences/${J}`,void 0,G);if(B.success)X={success:!0,sequence:B.sequence,message:B.sequence.enrichmentStatus==="complete"?`Sequence "${B.sequence.name}" created with ${B.sequence.emailCount} AI-generated emails. The sequence is ready to review and enable.`:`Sequence "${B.sequence.name}" created. Email enrichment is still in progress (${B.sequence.enrichedCount}/${B.sequence.emailCount} emails generated). You can check status with get_sequence.`};else X=B;break}case"update_sequence":{let G=Y.companyId,$=BV(Y);X=await L("PUT",`/api/v1/sequences/${Y.sequenceId}`,$,G);break}case"enable_sequence":{let G=Y.companyId;X=await L("POST",`/api/v1/sequences/${Y.sequenceId}/enable`,void 0,G);break}case"disable_sequence":{let G=Y.companyId;X=await L("POST",`/api/v1/sequences/${Y.sequenceId}/disable`,void 0,G);break}case"enroll_subscribers_in_sequence":{let G=Y.companyId,$=k("enroll_subscribers_in_sequence",Y,"sequenceId"),z=ZV(Y);X=await L("POST",`/api/v1/sequences/${encodeURIComponent($)}/enroll`,z,G);break}case"cancel_sequence_enrollments":{let G=Y.companyId,$=KV(Y);X=await L("POST",`/api/v1/sequences/${Y.sequenceId}/enrollments/cancel`,$,G);break}case"delete_sequence":{let G=Y.companyId;X=await L("DELETE",`/api/v1/sequences/${Y.sequenceId}`,void 0,G);break}case"list_transactional_emails":{let G=Y.companyId;X=await L("GET","/api/v1/transactional",void 0,G);break}case"get_transactional_email":{let G=Y.companyId;X=await L("GET",`/api/v1/transactional/${Y.idOrSlug}`,void 0,G);break}case"create_transactional_email":{let G=Y.companyId,$=new Set(["companyId","name","slug","subject","previewText","html","blocks","prompt","style","tone","enabled"]),z=Object.keys(Y).filter((U)=>!$.has(U));if(z.length>0)throw Error(`\`create_transactional_email\` accepts only \`name\`, \`slug\`, \`subject\`, \`previewText\`, \`html\`, \`blocks\`, \`prompt\`, \`style\`, \`tone\`, and \`enabled\` fields. Unsupported field${z.length===1?"":"s"}: ${z.map((U)=>`\`${U}\``).join(", ")}.`);qV(Y);let J=w(Y,"prompt");if(J!==void 0){let U={companyId:G??N1()??"",name:typeof Y.name==="string"&&Y.name.trim()!==""?Y.name.trim():"",slug:typeof Y.slug==="string"&&Y.slug.trim()!==""?Y.slug.trim():"",promptLength:J.length,style:typeof Y.style==="string"?Y.style:"",tone:typeof Y.tone==="string"?Y.tone:""};try{console.error("[mcp:create_transactional_email] generating from prompt",U);let A=await L("POST","/api/v1/generate/email",{prompt:J,...Y.style!==void 0&&{style:Y.style},...Y.tone!==void 0&&{tone:Y.tone}},G);console.error("[mcp:create_transactional_email] prompt generation complete",{...U,subject:A.subject??"",previewTextLength:typeof A.previewText==="string"?A.previewText.length:0,blockCount:Array.isArray(A.blocks)?A.blocks.length:0,htmlLength:typeof A.html==="string"?A.html.length:0});let B=w(Y,"subject")??(typeof A.subject==="string"&&A.subject.trim()!==""?A.subject.trim():void 0);if(!B)throw Error("`create_transactional_email` prompt generation did not return a subject. Provide `subject` explicitly.");let K=Array.isArray(A.blocks)&&A.blocks.length>0?A.blocks:void 0,D=typeof A.html==="string"&&A.html.trim()!==""?A.html:void 0,O=w(Y,"previewText")??(typeof A.previewText==="string"?A.previewText.trim():void 0);if(K===void 0&&D===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",{...U,subject:B,contentSource:K!==void 0?"blocks":"html",blockCount:K?.length??0,htmlLength:D?.length??0}),X=await L("POST","/api/v1/transactional",{name:Y.name,...Y.slug!==void 0&&{slug:Y.slug},subject:B,...O!==void 0&&{previewText:O},...K!==void 0?{blocks:K}:{html:D},...Y.enabled!==void 0&&{enabled:Y.enabled}},G),console.error("[mcp:create_transactional_email] generated transactional created",U)}catch(A){throw console.error("[mcp:create_transactional_email] prompt-based create failed",{...U,error:A instanceof Error?A.message:String(A)}),A}break}let H=Object.fromEntries(Object.entries(Y).filter(([U])=>U!=="companyId"));X=await L("POST","/api/v1/transactional",H,G);break}case"update_transactional_email":{let G=Y.companyId,$=new Set(["companyId","idOrSlug","name","enabled","subject","previewText","html","blocks"]),z=Object.keys(Y).filter((H)=>!$.has(H));if(z.length>0)throw Error(`\`update_transactional_email\` accepts only \`name\`, \`enabled\`, \`subject\`, \`previewText\`, \`html\`, and \`blocks\` update fields. Unsupported field${z.length===1?"":"s"}: ${z.map((H)=>`\`${H}\``).join(", ")}.`);if(S1("update_transactional_email",Y),Y.name===void 0&&Y.enabled===void 0&&Y.subject===void 0&&Y.previewText===void 0&&Y.html===void 0&&Y.blocks===void 0)throw Error("Provide at least one of `name`, `enabled`, `subject`, `previewText`, `html`, or `blocks` when calling `update_transactional_email`.");let J=Object.fromEntries(Object.entries(Y).filter(([H])=>H!=="companyId"&&H!=="idOrSlug"));X=await L("PATCH",`/api/v1/transactional/${Y.idOrSlug}`,J,G);break}case"send_email":{let G=Y.companyId;X=await L("POST","/api/v1/transactional/send",Y,G);break}case"get_stats":{let G=Y.companyId,$=Y.period??"7d",z=new URLSearchParams({period:String($)});if(Y.includeMachineEngagement===!0)z.set("includeMachineEngagement","true");X=await L("GET",`/api/v1/metrics?${z.toString()}`,void 0,G);break}case"get_campaign_stats":{let G=Y.companyId,$=new URLSearchParams;if(Y.includeMachineEngagement===!0)$.set("includeMachineEngagement","true");let z=$.toString();X=await L("GET",`/api/v1/metrics/campaigns/${Y.campaignId}${z?`?${z}`:""}`,void 0,G);break}case"get_sequence_stats":{let G=Y.companyId,$=new URLSearchParams;if(Y.includeMachineEngagement===!0)$.set("includeMachineEngagement","true");let z=$.toString();X=await L("GET",`/api/v1/metrics/sequences/${Y.sequenceId}${z?`?${z}`:""}`,void 0,G);break}case"get_subscriber_activity":{let G=Y.companyId,$=t6("get_subscriber_activity",Y),z=await cY($,G,{includeMachineEngagement:Y.includeMachineEngagement===!0});X={success:z.success,email:z.subscriber.email,emailStats:z.subscriber.emailStats??null,activity:z.subscriber.activity??[],sequenceEnrollments:z.subscriber.sequenceEnrollments??[]};break}case"list_team_members":{let G=Y.companyId;X=await L("GET","/api/v1/team",void 0,G);break}case"invite_team_member":{let G=Y.companyId,$=k("invite_team_member",Y,"email"),z=pY("invite_team_member",Y,"role",["admin","viewer"]);if(Y.canManageBilling!==void 0&&typeof Y.canManageBilling!=="boolean")throw Error("`canManageBilling` must be a boolean when calling `invite_team_member`.");X=await L("POST","/api/v1/team/invitations",{email:$,role:z,...Y.canManageBilling!==void 0&&{canManageBilling:Y.canManageBilling}},G);break}case"cancel_team_invitation":{let G=Y.companyId,$=k("cancel_team_invitation",Y,"invitationId");X=await L("DELETE",`/api/v1/team/invitations/${encodeURIComponent($)}`,void 0,G);break}case"list_conversations":{let G=Y.companyId,$=new URLSearchParams,z=W1("list_conversations",Y,"status",["open","closed","all"]);if(z)$.set("status",z);let J=w(Y,"search");if(J)$.set("search",J);if(Y.unread!==void 0){if(typeof Y.unread!=="boolean")throw Error("`unread` must be a boolean when calling `list_conversations`.");if(Y.unread)$.set("unread","true")}if(Y.page!==void 0){if(typeof Y.page!=="number"||!Number.isInteger(Y.page)||Y.page<1)throw Error("`page` must be a positive integer when calling `list_conversations`.");$.set("page",String(Y.page))}let H=a6("list_conversations",Y,"limit",1,100);if(H!==void 0)$.set("limit",String(H));X=await L("GET",`/api/v1/conversations${$.size>0?`?${$}`:""}`,void 0,G);break}case"get_conversation":{let G=Y.companyId,$=k("get_conversation",Y,"conversationId");X=await L("GET",`/api/v1/conversations/${encodeURIComponent($)}`,void 0,G);break}case"reply_to_conversation":{let G=Y.companyId,$=k("reply_to_conversation",Y,"conversationId"),z=W1("reply_to_conversation",Y,"type",["outbound","note"])??"outbound",J=w(Y,"subject"),H=w(Y,"bodyText"),U=w(Y,"bodyHtml");if(z==="outbound"&&H===void 0&&U===void 0)throw Error("Provide `bodyText` or `bodyHtml` when calling `reply_to_conversation` with an outbound message.");X=await L("POST",`/api/v1/conversations/${encodeURIComponent($)}/messages`,{type:z,...J!==void 0&&{subject:J},...H!==void 0&&{bodyText:H},...U!==void 0&&{bodyHtml:U}},G);break}case"update_conversation_status":{let G=Y.companyId,$=k("update_conversation_status",Y,"conversationId"),z=pY("update_conversation_status",Y,"status",["open","closed"]);X=await L("POST",`/api/v1/conversations/${encodeURIComponent($)}/status`,{status:z},G);break}case"mark_conversation_read":{let G=Y.companyId,$=k("mark_conversation_read",Y,"conversationId");X=await L("POST",`/api/v1/conversations/${encodeURIComponent($)}/read`,void 0,G);break}case"list_webhooks":{let G=Y.companyId;X=await L("GET","/api/v1/webhooks",void 0,G);break}case"create_webhook":{let G=Y.companyId,$=k("create_webhook",Y,"name"),z=k("create_webhook",Y,"url"),J=l5("create_webhook",Y);X=await L("POST","/api/v1/webhooks",{name:$,url:z,...J!==void 0&&{events:J}},G);break}case"update_webhook":{let G=Y.companyId,$=k("update_webhook",Y,"webhookId"),z=w(Y,"name"),J=w(Y,"url"),H=l5("update_webhook",Y),U=W1("update_webhook",Y,"status",["enabled","disabled"]);if(z===void 0&&J===void 0&&H===void 0&&U===void 0)throw Error("Provide at least one of `name`, `url`, `events`, or `status` when calling `update_webhook`.");X=await L("PATCH",`/api/v1/webhooks/${encodeURIComponent($)}`,{...z!==void 0&&{name:z},...J!==void 0&&{url:J},...H!==void 0&&{events:H},...U!==void 0&&{status:U}},G);break}case"delete_webhook":{let G=Y.companyId,$=k("delete_webhook",Y,"webhookId");X=await L("DELETE",`/api/v1/webhooks/${encodeURIComponent($)}`,void 0,G);break}case"test_webhook":{let G=Y.companyId,$=k("test_webhook",Y,"webhookId");X=await L("POST",`/api/v1/webhooks/${encodeURIComponent($)}/test`,void 0,G);break}case"list_webhook_deliveries":{let G=Y.companyId,$=k("list_webhook_deliveries",Y,"webhookId"),z=a6("list_webhook_deliveries",Y,"limit",1,100),J=new URLSearchParams;if(z!==void 0)J.set("limit",String(z));X=await L("GET",`/api/v1/webhooks/${encodeURIComponent($)}/deliveries${J.size>0?`?${J}`:""}`,void 0,G);break}case"replay_webhook_delivery":{let G=Y.companyId,$=k("replay_webhook_delivery",Y,"webhookId"),z=k("replay_webhook_delivery",Y,"deliveryId");X=await L("POST",`/api/v1/webhooks/${encodeURIComponent($)}/deliveries/${encodeURIComponent(z)}/replay`,void 0,G);break}case"generate_email":{let G=Y.companyId;X=await L("POST","/api/v1/generate/email",Y,G);break}case"generate_sequence":{let G=Y.companyId;X=await L("POST","/api/v1/generate/sequence",Y,G);break}case"generate_subject_lines":{let G=Y.companyId;X=await L("POST","/api/v1/generate/subjects",Y,G);break}default:throw Error(`Unknown tool: ${Q}`)}let W=OV(X);if(W)throw W;return X=await EV(Q,Y,X),{structuredContent:yV(X),content:[{type:"text",text:JSON.stringify(X,null,2)}]}}catch(X){return{isError:!0,content:[{type:"text",text:R1(X)}]}}}async function t5(Q,Y,X){let W=Y.getRequestContext?.(Q)??{};try{return await GX(W,X)}finally{await Y.onRequestContextUpdated?.(W,Q)}}function iE(Q={}){let Y=new fY({name:"sequenzy",version:T5.version},{capabilities:{tools:{},resources:{}}});return Y.setRequestHandler(E9,async()=>{return{tools:d5}}),Y.setRequestHandler(j6,async(X,W)=>{let{name:G,arguments:$}=X.params;return t5(W,Q,()=>o5(G,$??{}))}),Y.setRequestHandler(N9,async()=>{return{resources:C5}}),Y.setRequestHandler(w9,async(X,W)=>{let{uri:G}=X.params;return t5(W,Q,()=>k5(G))}),Y}export{iE as createSequenzyMcpServer};
|
|
185
|
+
- 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)"},propertyFilters:{type:"array",description:"Optional event property filters for event_received triggers. The sequence only starts when the triggering event's properties match ALL filters. Use a dot-path into the event properties; use [] to match inside arrays. Examples: scope a purchase sequence to one product with { path: 'lineItems[].providerProductId', operator: 'equals', value: 'prod_123' } (ecommerce.order_placed) or { path: 'productIds', operator: 'equals', value: 'prod_123' } (saas.purchase); to match any of several products use { path: 'lineItems[].providerProductId', operator: 'one_of', value: ['prod_123', 'prod_456'] }. Max 10 filters.",items:{type:"object",properties:{path:{type:"string",description:"Dot-path into the event properties, e.g. 'lineItems[].providerProductId' or 'plan'."},operator:{type:"string",enum:["exists","not_exists","equals","not_equals","one_of","contains","greater_than","less_than"],description:"Comparison operator. one_of matches when the property equals any entry of the value array."},value:{type:["string","number","boolean","array"],items:{type:["string","number"]},maxItems:50,description:"Value to compare against. Required for every operator except exists/not_exists. For one_of, pass an array of strings or numbers (max 50 values); all other operators take a single value."}},required:["path","operator"]}},inactiveDays:{type:"number",description:"Number of days of inactivity (required for inactivity trigger, must be >= 1)"},inactivityBaseline:{type:"string",enum:["sequence_created_at","subscriber_created_at"],description:"When to start counting inactivity for subscribers who never had the event. Defaults to sequence_created_at."},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)"},durationDays:{type:"number",description:"Total duration in days used to space AI-generated sequence emails. Only applies when using goal-based AI generation."},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."},sendingWindow:g5,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: 'entered_segment', value: 'segment_123' } when they enter a segment, { type: 'field_changed', value: 'plan' } when a subscriber field changes, { 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","entered_segment","field_changed","event_received"],description:"Stop condition type."},value:{type:["string","null"],description:"Tag name, list ID, segment ID, field path, 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:p5,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 existing step, use the emailId or nodeId returned in get_sequence.sequence.emails. To insert new linear steps, use insertSteps with an afterNodeId from get_sequence; omit afterNodeId only to append to an unambiguous linear tail. 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"},enrollmentPaused:{type:"boolean",description:"Set true to stop new enrollments for an active sequence while current recipients continue. Set false to resume new enrollments. The sequence must already be active."},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."},sendingWindow:g5,clearSendingWindow:{type:"boolean",description:"Set true to remove the sequence sending window. Do not provide this together with sendingWindow."},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: 'entered_segment', value: 'segment_123' } to stop when they enter a segment, { type: 'field_changed', value: 'plan' } to stop when a subscriber field changes, { 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","entered_segment","field_changed","event_received"]},value:{type:["string","null"],description:"Tag name, list ID, segment ID, field path, 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:cY}},required:["conditionType"]}},elseSteps:{type:"array",description:"Steps to create inside the else fallback path. Required by default so the else arm is usable.",items:cY},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"]},insertSteps:{type:"object",description:"Insert one or more new linear steps into an existing sequence. Use get_sequence first, then pass afterNodeId to insert after a specific node. If afterNodeId is omitted, the steps are appended only when the sequence has exactly one linear tail. Inserted email steps require subject plus blocks or html.",properties:{afterNodeId:{type:"string",description:"Existing node ID to insert after. Use a nodeId from get_sequence.sequence.nodes or get_sequence.sequence.emails. Omit only to append to an unambiguous linear tail."},steps:{type:"array",description:"New steps to insert. Supports emails, delays, create_discount actions, webhooks, and other supported sequence path node types.",items:cY}},required:["steps"]},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:t1,items:{type:"object"}}}}},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:t1,items:{type:"object"}}}}}},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/freeze a sequence. This blocks new enrollments and holds current recipients until the sequence is enabled again. To only stop new enrollments while current recipients continue, use pause_sequence_enrollments.",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:"pause_sequence_enrollments",description:"Stop new enrollments for an active sequence while current recipients continue through the sequence. This matches the dashboard 'Stop new enrollments' control and does not freeze current recipients.",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:"resume_sequence_enrollments",description:"Resume new enrollments for an active sequence whose enrollment gate was paused. Use enable_sequence instead for a fully disabled/frozen 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:"enroll_subscribers_in_sequence",description:"Manually enroll subscribers in a sequence by email address or subscriber ID. Maximum 500 total targets per call across emails and subscriberIds. Only active subscribers are enrolled: unknown emails are returned in `notFound`, while inactive, unavailable, and already actively enrolled subscribers are counted in `skipped`. By default enrollment starts at the first step after the trigger; pass targetNodeId to start at a specific step.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},sequenceId:{type:"string",description:"Sequence ID to enroll subscribers in."},emails:{type:"array",items:{type:"string"},description:"Email addresses of subscribers to enroll. Combined with subscriberIds, maximum 500 total targets per call."},subscriberIds:{type:"array",items:{type:"string"},description:"Subscriber IDs to enroll. Combined with emails, maximum 500 total targets per call."},targetNodeId:{type:"string",description:"Optional node ID to start enrollment at. Use a non-trigger nodeId from get_sequence. Defaults to the first step after the trigger."}},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:`${t6} 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:`${t1} 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. Maximum length: 255 characters."}},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)"},includeMachineEngagement:a1}}},{name:"get_campaign_stats",description:"Get detailed statistics for a campaign, including attributed conversions and revenue (revenueCents)",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},campaignId:{type:"string",description:"Campaign ID"},includeMachineEngagement:a1},required:["campaignId"]}},{name:"get_sequence_stats",description:"Get statistics for a sequence, including attributed conversions and revenue (revenueCents) plus 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"},includeMachineEngagement:a1},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."},includeMachineEngagement:a1},required:[]}},{name:"list_team_members",description:"List team members for the company, including the owner, members with their roles, and pending or expired invitations.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."}}}},{name:"invite_team_member",description:"Invite a team member by email with role admin or viewer. Existing Sequenzy users are added to the team immediately; others receive an email invitation. Billing access (canManageBilling) can only be granted by the company owner.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},email:{type:"string",description:"Email address of the person to invite."},role:{type:"string",enum:["admin","viewer"],description:"Team role. Admins can manage the workspace; viewers have read-only access."},canManageBilling:{type:"boolean",description:"Whether the member can manage billing. Only the company owner can grant billing access. Defaults to false."}},required:["email","role"]}},{name:"cancel_team_invitation",description:"Cancel a pending team invitation. Invitations that have already been accepted cannot be cancelled.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},invitationId:{type:"string",description:"Invitation ID to cancel. Use list_team_members to find pending invitations."}},required:["invitationId"]}},{name:"list_conversations",description:"List inbox conversations (email replies from subscribers). Filter by status, free-text search, or unread state, with pagination.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},status:{type:"string",enum:["open","closed","all"],description:"Filter by conversation status. Defaults to all."},search:{type:"string",description:"Free-text search across conversation subjects and participants."},unread:{type:"boolean",description:"Set true to only return conversations with unread messages."},page:{type:"number",description:"Page number. Defaults to 1."},limit:{type:"number",description:"Results per page, from 1 to 100. Defaults to 20."}}}},{name:"get_conversation",description:"Get a conversation with its full message history, subscriber details, and context.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},conversationId:{type:"string",description:"Conversation ID."}},required:["conversationId"]}},{name:"reply_to_conversation",description:"Send a reply in a conversation, or add an internal note. type 'outbound' (default) emails the subscriber and requires bodyText or bodyHtml; type 'note' adds a private team-only note. Replying to a closed conversation reopens it.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},conversationId:{type:"string",description:"Conversation ID to reply in."},type:{type:"string",enum:["outbound","note"],description:"Message type: outbound emails the subscriber, note is internal-only. Defaults to outbound."},subject:{type:"string",description:"Optional subject override. Defaults to the conversation subject."},bodyText:{type:"string",description:"Plain-text message body."},bodyHtml:{type:"string",description:"HTML message body."}},required:["conversationId"]}},{name:"update_conversation_status",description:"Open or close a conversation.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},conversationId:{type:"string",description:"Conversation ID."},status:{type:"string",enum:["open","closed"],description:"New conversation status."}},required:["conversationId","status"]}},{name:"mark_conversation_read",description:"Mark all unread inbound messages in a conversation as read.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},conversationId:{type:"string",description:"Conversation ID."}},required:["conversationId"]}},{name:"list_webhooks",description:"List outbound webhook endpoints and their subscribed event types.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."}}}},{name:"create_webhook",description:"Create an outbound webhook endpoint. IMPORTANT: the response includes a signingSecret that is returned only once - show it to the user immediately so they can store it and verify webhook signatures. If events is omitted, a default set of event types is subscribed.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},name:{type:"string",description:"Webhook endpoint name."},url:{type:"string",description:"HTTPS URL that will receive webhook events."},events:{type:"array",items:{type:"string",enum:[...jQ]},description:"Event types to subscribe to. If omitted, a default set is used."}},required:["name","url"]}},{name:"update_webhook",description:"Update an outbound webhook endpoint's name, URL, subscribed events, or status (enabled/disabled). Providing events replaces the existing event list.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},webhookId:{type:"string",description:"Webhook endpoint ID."},name:{type:"string",description:"New webhook endpoint name."},url:{type:"string",description:"New HTTPS URL that will receive webhook events."},events:{type:"array",items:{type:"string",enum:[...jQ]},description:"Replacement event type subscriptions."},status:{type:"string",enum:["enabled","disabled"],description:"Enable or disable deliveries to this endpoint."}},required:["webhookId"]}},{name:"delete_webhook",description:"Permanently delete an outbound webhook endpoint along with its delivery history. This cannot be undone. To keep the endpoint but stop deliveries, use update_webhook with status disabled instead.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},webhookId:{type:"string",description:"Webhook endpoint ID to delete."}},required:["webhookId"]}},{name:"test_webhook",description:"Send a test event to an outbound webhook endpoint to verify it is reachable and signatures can be validated.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},webhookId:{type:"string",description:"Webhook endpoint ID to test."}},required:["webhookId"]}},{name:"list_webhook_deliveries",description:"List recent delivery attempts for an outbound webhook endpoint, including status and response codes.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},webhookId:{type:"string",description:"Webhook endpoint ID."},limit:{type:"number",description:"Maximum number of deliveries to return, from 1 to 100. Defaults to 20."}},required:["webhookId"]}},{name:"replay_webhook_delivery",description:"Replay a previous webhook delivery, re-sending the same event payload to the endpoint.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},webhookId:{type:"string",description:"Webhook endpoint ID."},deliveryId:{type:"string",description:"Delivery ID to replay. Use list_webhook_deliveries to find delivery IDs."}},required:["webhookId","deliveryId"]}},{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"]}}],d5=uV.map(gV).map(tM);async function o5(Q,Y){try{let X;switch(Q){case"get_account":{let G=await L("GET","/api/v1/account"),$=N1();X={...G,selectedCompanyId:$??G.currentCompanyId};break}case"select_company":{let G=Y.companyId,$=await L("GET","/api/v1/account"),z=$.companies?.find((J)=>J.id===G);if(!z)throw Error(`Company not found. Available companies: ${$.companies?.map((J)=>`${J.name} (${J.id})`).join(", ")??"none"}`);TQ(G),X={success:!0,message:`Switched to company: ${z.name}`,companyId:z.id,companyName:z.name};break}case"get_app_urls":{let G=await i5(Y);X={...M1({companyId:G,campaignId:w(Y,"campaignId"),landingPageId:w(Y,"landingPageId"),sequenceId:w(Y,"sequenceId"),emailId:w(Y,"emailId")??w(Y,"templateId"),transactionalId:w(Y,"transactionalId"),emailSendId:w(Y,"emailSendId"),domainId:w(Y,"domainId"),status:w(Y,"status"),settingsTab:w(Y,"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 L("POST","/api/v1/companies",{name:Y.name,domain:Y.domain});if(!G.success)throw Error("Failed to create company");let $=G.company.id,z=6,J=0,H=G.company.status;while(H==="processing"&&J<z){await new Promise((B)=>setTimeout(B,20000)),J++;let A=await L("GET",`/api/v1/companies/${$}`);if(A.success)H=A.company.status}TQ($);let U=await L("GET",`/api/v1/companies/${$}`);X={success:!0,company:U.company,message:H==="processing"?"Company created but still processing. You can continue using it while processing completes.":`Company '${U.company.name}' created and ready to use.`,autoSelected:!0};break}case"get_company":{let G=Y.companyId;X=await L("GET",`/api/v1/companies/${G}`);break}case"create_api_key":{let G=Y.companyId;X=await L("POST","/api/v1/api-keys",{name:Y.name},G);break}case"list_websites":{let G=Y.companyId;X=await L("GET","/api/v1/websites",void 0,G);break}case"add_website":{let G=Y.companyId;X=await L("POST","/api/v1/websites",{domain:Y.domain},G);break}case"check_website":{let G=Y.companyId;X=await L("GET",`/api/v1/websites/${Y.domain}`,void 0,G);break}case"get_integration_guide":X=await L("POST","/api/v1/integration-guide",Y);break;case"add_subscriber":{let G=Y.companyId,$=a6("add_subscriber",Y);X=await L("POST","/api/v1/subscribers",{...$,customAttributes:Y.attributes,tags:Y.tags,lists:Y.listIds,...Y.status!==void 0&&{status:Y.status},...Y.optInMode!==void 0&&{optInMode:Y.optInMode}},G);break}case"update_subscriber":{let G=Y.companyId,$=a6("update_subscriber",Y),z=await pY($,G),J=Array.isArray(z.subscriber.tags)?z.subscriber.tags.filter((K)=>typeof K==="string"):[],H=Array.isArray(Y.addTags)?Y.addTags.filter((K)=>typeof K==="string"&&K.trim()!=="").map(f5):[],U=new Set(Array.isArray(Y.removeTags)?Y.removeTags.filter((K)=>typeof K==="string"&&K.trim()!=="").map(f5):[]),A=J.filter((K)=>!U.has(K));for(let K of H)if(!A.includes(K))A.push(K);let B={};if($.email&&$.externalId)B.externalId=$.externalId;if(J0(Y.attributes))B.customAttributes={...J0(z.subscriber.customAttributes)?z.subscriber.customAttributes:{},...Y.attributes};if(Y.addTags||Y.removeTags)B.tags=A;X=await L("PATCH",oY($),B,G);break}case"remove_subscriber":{let G=Y.companyId,$=a6("remove_subscriber",Y),z=oY($);if(Y.hardDelete===!0)X=await L("DELETE",z,void 0,G);else X=await L("PATCH",z,{status:"unsubscribed"},G);break}case"get_subscriber":{let G=Y.companyId,$=a6("get_subscriber",Y);X=await pY($,G,{includeMachineEngagement:Y.includeMachineEngagement===!0});break}case"search_subscribers":{let G=Y.companyId;X=await VV(Y,G);break}case"list_products":{let G=Y.companyId,$=new URLSearchParams;if(typeof Y.provider==="string"&&Y.provider.trim())$.set("provider",Y.provider.trim());if(typeof Y.search==="string"&&Y.search.trim())$.set("search",Y.search.trim());let z=$.size>0?`?${$.toString()}`:"";X=await L("GET",`/api/v1/products${z}`,void 0,G);break}case"upsert_products":{let G=Y.companyId;if(!Array.isArray(Y.products)||Y.products.length===0)throw Error("`products` must be a non-empty array when calling `upsert_products`.");X=await L("POST","/api/v1/products",{products:Y.products},G);break}case"delete_product":{let G=Y.companyId,$=v("delete_product",Y,"productId");X=await L("DELETE",`/api/v1/products/${encodeURIComponent($)}`,void 0,G);break}case"attach_product_file":{let G=Y.companyId,$=v("attach_product_file",Y,"productId"),z=w(Y,"url"),J=w(Y,"filePath");if(z===void 0===(J===void 0))throw Error("Provide either `url` or `filePath` (not both) when calling `attach_product_file`.");let H;if(J!==void 0){let U=await bV(J,G);H={url:U.url,source:"upload",fileName:w(Y,"fileName")??U.fileName,fileSizeBytes:U.fileSizeBytes,mimeType:U.mimeType}}else{H={url:z};let U=w(Y,"fileName");if(U)H.fileName=U}X=await L("PUT",`/api/v1/products/${encodeURIComponent($)}/delivery`,H,G);break}case"remove_product_file":{let G=Y.companyId,$=v("remove_product_file",Y,"productId");X=await L("DELETE",`/api/v1/products/${encodeURIComponent($)}/delivery`,void 0,G);break}case"sync_products":{let G=Y.companyId;X=await L("POST","/api/v1/products/sync",void 0,G);break}case"list_tags":{let G=Y.companyId;X=await L("GET","/api/v1/tags",void 0,G);break}case"create_tag":{let G=Y.companyId,$=v("create_tag",Y,"name"),z=W1("create_tag",Y,"color",wQ);X=await L("POST","/api/v1/tags",{name:$,...z!==void 0&&{color:z}},G);break}case"update_tag":{let G=Y.companyId,$=v("update_tag",Y,"tagId"),z=iY("update_tag",Y,"color",wQ);X=await L("PATCH",`/api/v1/tags/${encodeURIComponent($)}`,{color:z},G);break}case"delete_tag":{let G=Y.companyId,$=v("delete_tag",Y,"tagId");X=await L("DELETE",`/api/v1/tags/${encodeURIComponent($)}`,void 0,G);break}case"list_lists":{let G=Y.companyId;X=await L("GET","/api/v1/lists",void 0,G);break}case"create_list":{let G=Y.companyId;X=await L("POST","/api/v1/lists",Y,G);break}case"update_list":{let G=Y.companyId,$=v("update_list",Y,"listId");if(Y.name===void 0&&Y.description===void 0&&Y.isPrivate===void 0)throw Error("Provide at least one of `name`, `description`, or `isPrivate` when calling `update_list`.");if(Y.name!==void 0&&w(Y,"name")===void 0)throw Error("`name` cannot be empty when calling `update_list`.");if(Y.description!==void 0&&Y.description!==null&&typeof Y.description!=="string")throw Error("`description` must be a string or null when calling `update_list`.");if(Y.isPrivate!==void 0&&typeof Y.isPrivate!=="boolean")throw Error("`isPrivate` must be a boolean when calling `update_list`.");X=await L("PATCH",`/api/v1/lists/${encodeURIComponent($)}`,{...Y.name!==void 0&&{name:w(Y,"name")},...Y.description!==void 0&&{description:Y.description},...Y.isPrivate!==void 0&&{isPrivate:Y.isPrivate}},G);break}case"delete_list":{let G=Y.companyId,$=v("delete_list",Y,"listId");X=await L("DELETE",`/api/v1/lists/${encodeURIComponent($)}`,void 0,G);break}case"add_subscribers_to_list":{let G=Y.companyId,$=v("add_subscribers_to_list",Y,"listId"),z=m5("add_subscribers_to_list",Y),J=W1("add_subscribers_to_list",Y,"duplicateStrategy",["skip","merge","overwrite"])??"skip",H=W1("add_subscribers_to_list",Y,"optInMode",["default","confirmed","double_opt_in"])??"default";X=await L("POST",`/api/v1/lists/${encodeURIComponent($)}/subscribers`,{emails:z,duplicateStrategy:J,enrollInSequences:Y.enrollInSequences===!0,optInMode:H},G);break}case"remove_subscribers_from_list":{let G=Y.companyId,$=v("remove_subscribers_from_list",Y,"listId"),z=m5("remove_subscribers_from_list",Y);X=await L("POST",`/api/v1/lists/${encodeURIComponent($)}/subscribers/remove`,{emails:z},G);break}case"list_segments":{let G=Y.companyId;X=await L("GET","/api/v1/segments",void 0,G);break}case"create_segment":{UV(Y);let G=Y.companyId;X=await L("POST","/api/v1/segments",{...Y,...Y.filters!==void 0?{filters:rY(Y.filters)}:{},...Y.root!==void 0?{root:dY(Y.root)}:{}},G);break}case"update_segment":{AV(Y);let G=Y.companyId,$=v("update_segment",Y,"segmentId"),z=w(Y,"name"),J=W1("update_segment",Y,"filterJoinOperator",["and","or"]);X=await L("PATCH",`/api/v1/segments/${encodeURIComponent($)}`,{...z!==void 0&&{name:z},...J!==void 0&&{filterJoinOperator:J},...Y.filters!==void 0?{filters:rY(Y.filters)}:{},...Y.root!==void 0?{root:dY(Y.root)}:{}},G);break}case"delete_segment":{let G=Y.companyId,$=v("delete_segment",Y,"segmentId");X=await L("DELETE",`/api/v1/segments/${encodeURIComponent($)}`,void 0,G);break}case"get_segment_count":{let G=Y.companyId;X=await L("GET",`/api/v1/segments/${Y.segmentId}/count`,void 0,G);break}case"list_audience_syncs":{let G=Y.companyId;X=await L("GET","/api/v1/audience-syncs",void 0,G);break}case"list_ad_accounts":{let G=Y.companyId;X=await L("GET","/api/v1/ad-accounts",void 0,G);break}case"create_audience_sync":{let G=Y.companyId,$=w(Y,"segmentId"),z=w(Y,"predefinedSegmentId");if($&&z)throw Error("Provide either `segmentId` or `predefinedSegmentId` when calling `create_audience_sync`, not both.");if(!$&&!z)throw Error("Provide either `segmentId` or `predefinedSegmentId` when calling `create_audience_sync`.");X=await L("POST","/api/v1/audience-syncs",{segmentId:$,predefinedSegmentId:z,adAccountId:v("create_audience_sync",Y,"adAccountId"),audienceName:v("create_audience_sync",Y,"audienceName"),...Y.frequency!==void 0?{frequency:Y.frequency}:{}},G);break}case"update_audience_sync":{let G=Y.companyId,$=v("update_audience_sync",Y,"syncId");X=await L("PATCH",`/api/v1/audience-syncs/${encodeURIComponent($)}`,{...Y.frequency!==void 0?{frequency:Y.frequency}:{},...Y.isActive!==void 0?{isActive:Y.isActive}:{}},G);break}case"delete_audience_sync":{let G=Y.companyId,$=v("delete_audience_sync",Y,"syncId");X=await L("DELETE",`/api/v1/audience-syncs/${encodeURIComponent($)}`,void 0,G);break}case"sync_audience_now":{let G=Y.companyId,$=v("sync_audience_now",Y,"syncId");X=await L("POST",`/api/v1/audience-syncs/${encodeURIComponent($)}/sync`,void 0,G);break}case"list_templates":{let G=Y.companyId,$=new URLSearchParams,z=w(Y,"label");if(z)$.set("label",z);X=await L("GET",`/api/v1/templates${$.size>0?`?${$}`:""}`,void 0,G);break}case"get_template":{let G=Y.companyId;X=await L("GET",`/api/v1/templates/${Y.templateId}`,void 0,G);break}case"create_template":{let G=Y.companyId;S1("create_template",Y,{requireContent:!0}),ZQ("create_template",Y),X=await L("POST","/api/v1/templates",Y,G);break}case"update_template":{let G=Y.companyId,$=new Set(["companyId","templateId","name","subject","html","blocks","labels"]),z=Object.keys(Y).filter((J)=>!$.has(J));if(z.length>0)throw Error(`\`update_template\` accepts only \`name\`, \`subject\`, \`html\`, \`blocks\`, and \`labels\` update fields. Unsupported field${z.length===1?"":"s"}: ${z.map((J)=>`\`${J}\``).join(", ")}.`);if(S1("update_template",Y),ZQ("update_template",Y),Y.name===void 0&&Y.subject===void 0&&Y.html===void 0&&Y.blocks===void 0&&Y.labels===void 0)throw Error("Provide at least one of `name`, `subject`, `html`, `blocks`, or `labels` when calling `update_template`.");X=await L("PUT",`/api/v1/templates/${Y.templateId}`,Y,G);break}case"delete_template":{let G=Y.companyId;X=await L("DELETE",`/api/v1/templates/${Y.templateId}`,void 0,G);break}case"list_ab_tests":{let G=Y.companyId,$=new URLSearchParams,z=w(Y,"sequenceId");if(z)$.set("sequenceId",z);X=await L("GET",`/api/v1/ab-tests${$.size>0?`?${$}`:""}`,void 0,G);break}case"get_ab_test":{let G=Y.companyId;X=await L("GET",`/api/v1/ab-tests/${Y.abTestId}`,void 0,G);break}case"get_ab_test_stats":{let G=Y.companyId,$=new URLSearchParams,z=w(Y,"period"),J=w(Y,"start"),H=w(Y,"end");if(z)$.set("period",z);if(J)$.set("start",J);if(H)$.set("end",H);if(Y.includeMachineEngagement===!0)$.set("includeMachineEngagement","true");X=await L("GET",`/api/v1/ab-tests/${Y.abTestId}/stats${$.size>0?`?${$}`:""}`,void 0,G);break}case"restart_ab_test":{let G=Y.companyId,$=new Set(["companyId","abTestId","sourceVariantId","testType","winnerThreshold","variantCount"]),z=Object.keys(Y).filter((A)=>!$.has(A));if(z.length>0)throw Error(`\`restart_ab_test\` accepts only \`sourceVariantId\`, \`testType\`, \`winnerThreshold\`, and \`variantCount\` option fields. Unsupported field${z.length===1?"":"s"}: ${z.map((A)=>`\`${A}\``).join(", ")}.`);let J=w(Y,"testType");if(J!==void 0&&J!=="subject"&&J!=="content")throw Error("`restart_ab_test` testType must be `subject` or `content`.");let H=Y.winnerThreshold===void 0?void 0:Number(Y.winnerThreshold);if(H!==void 0&&(!Number.isInteger(H)||H<10||H>1000))throw Error("`restart_ab_test` winnerThreshold must be an integer from 10 to 1000.");let U=Y.variantCount===void 0?void 0:Number(Y.variantCount);if(U!==void 0&&(!Number.isInteger(U)||U<2||U>4))throw Error("`restart_ab_test` variantCount must be an integer from 2 to 4.");X=await L("POST",`/api/v1/ab-tests/${Y.abTestId}/restart`,{sourceVariantId:w(Y,"sourceVariantId"),testType:J,winnerThreshold:H,variantCount:U},G);break}case"update_ab_test_variant":{let G=Y.companyId,$=new Set(["companyId","abTestId","variantId","subject","previewText","html","blocks"]),z=Object.keys(Y).filter((J)=>!$.has(J));if(z.length>0)throw Error(`\`update_ab_test_variant\` accepts only \`subject\`, \`previewText\`, \`html\`, and \`blocks\` update fields. Unsupported field${z.length===1?"":"s"}: ${z.map((J)=>`\`${J}\``).join(", ")}.`);if(S1("update_ab_test_variant",Y),Y.subject===void 0&&Y.previewText===void 0&&Y.html===void 0&&Y.blocks===void 0)throw Error("Provide at least one of `subject`, `previewText`, `html`, or `blocks` when calling `update_ab_test_variant`.");X=await L("PATCH",`/api/v1/ab-tests/${Y.abTestId}/variants/${Y.variantId}`,Y,G);break}case"create_ab_test":{let G=Y.companyId,$=v("create_ab_test",Y,"campaignId"),z=w(Y,"name"),J=s6("create_ab_test",Y,"testPercentage",5,50),H=s6("create_ab_test",Y,"testDurationMinutes",15,1440),U=W1("create_ab_test",Y,"winnerCriteria",["open_rate","click_rate"]);if(Y.variants!==void 0){if(!Array.isArray(Y.variants))throw Error("`variants` must be an array when calling `create_ab_test`.");Y.variants.forEach((A,B)=>{if(!J0(A)||typeof A.subject!=="string"||A.subject.trim()==="")throw Error(`\`variants\` item ${B+1} must include a non-empty \`subject\` when calling \`create_ab_test\`.`);if(A.blocks!==void 0&&!Array.isArray(A.blocks))throw Error(`\`variants\` item ${B+1} \`blocks\` must be an array when calling \`create_ab_test\`.`)})}X=await L("POST","/api/v1/ab-tests",{campaignId:$,...z!==void 0&&{name:z},...J!==void 0&&{testPercentage:J},...H!==void 0&&{testDurationMinutes:H},...U!==void 0&&{winnerCriteria:U},...Y.variants!==void 0&&{variants:Y.variants}},G);break}case"add_ab_test_variant":{let G=Y.companyId,$=v("add_ab_test_variant",Y,"abTestId"),z=v("add_ab_test_variant",Y,"subject"),J=w(Y,"previewText");if(Y.blocks!==void 0&&!Array.isArray(Y.blocks))throw Error("`blocks` must be an array when calling `add_ab_test_variant`.");X=await L("POST",`/api/v1/ab-tests/${encodeURIComponent($)}/variants`,{subject:z,...J!==void 0&&{previewText:J},...Y.blocks!==void 0&&{blocks:Y.blocks}},G);break}case"delete_ab_test_variant":{let G=Y.companyId,$=v("delete_ab_test_variant",Y,"abTestId"),z=v("delete_ab_test_variant",Y,"variantId");X=await L("DELETE",`/api/v1/ab-tests/${encodeURIComponent($)}/variants/${encodeURIComponent(z)}`,void 0,G);break}case"delete_ab_test":{let G=Y.companyId,$=v("delete_ab_test",Y,"abTestId");X=await L("DELETE",`/api/v1/ab-tests/${encodeURIComponent($)}`,void 0,G);break}case"list_campaigns":{let G=Y.companyId,$=new URLSearchParams;if(Y.status)$.set("status",String(Y.status));let z=w(Y,"label");if(z)$.set("label",z);X=await L("GET",`/api/v1/campaigns?${$}`,void 0,G);break}case"get_campaign":{let G=Y.companyId;X=await L("GET",`/api/v1/campaigns/${Y.campaignId}`,void 0,G);break}case"get_email_send":{let G=Y.companyId;X=await L("GET",`/api/v1/email-sends/${encodeURIComponent(String(Y.emailSendId))}`,void 0,G);break}case"create_campaign":{let G=Y.companyId;DV(Y);let $=w(Y,"prompt");if($!==void 0){let z=await L("POST","/api/v1/generate/email",{prompt:$,...Y.style!==void 0&&{style:Y.style},...Y.tone!==void 0&&{tone:Y.tone}},G),J=w(Y,"subject")??(typeof z.subject==="string"&&z.subject.trim()!==""?z.subject.trim():void 0);if(!J)throw Error("`create_campaign` prompt generation did not return a subject. Provide `subject` explicitly.");let H=Array.isArray(z.blocks)&&z.blocks.length>0?z.blocks:void 0,U=typeof z.html==="string"&&z.html.trim()!==""?z.html:void 0;if(H===void 0&&U===void 0)throw Error("`create_campaign` prompt generation did not return email blocks. Try again or provide `html` or `blocks` explicitly.");X=await L("POST","/api/v1/campaigns",{name:Y.name,subject:J,...H!==void 0?{blocks:H}:{html:U},...Y.segmentId!==void 0&&{segmentId:Y.segmentId},...Y.trackingCode!==void 0&&{trackingCode:Y.trackingCode},...Y.status!==void 0&&{status:Y.status},...Y.sentAt!==void 0&&{sentAt:Y.sentAt},...Y.campaignData!==void 0&&{campaignData:Y.campaignData},...Y.computedLists!==void 0&&{computedLists:Y.computedLists},...Y.labels!==void 0&&{labels:Y.labels}},G);break}X=await L("POST","/api/v1/campaigns",Y,G);break}case"update_campaign":{let G=Y.companyId,$=new Set(["companyId","campaignId","name","subject","trackingCode","html","blocks","replyTo","replyProfileId","campaignData","computedLists","labels"]),z=Object.keys(Y).filter((J)=>!$.has(J));if(z.length>0)throw Error(`\`update_campaign\` accepts only \`name\`, \`subject\`, \`trackingCode\`, \`html\`, \`blocks\`, \`replyTo\`, \`replyProfileId\`, \`campaignData\`, \`computedLists\`, and \`labels\` update fields. Unsupported field${z.length===1?"":"s"}: ${z.map((J)=>`\`${J}\``).join(", ")}.`);if(S1("update_campaign",Y),ZQ("update_campaign",Y),Y.replyTo!==void 0&&Y.replyProfileId!==void 0)throw Error("Provide either `replyTo` or `replyProfileId` when calling `update_campaign`, not both.");if(Y.name===void 0&&Y.subject===void 0&&Y.trackingCode===void 0&&Y.html===void 0&&Y.blocks===void 0&&Y.replyTo===void 0&&Y.replyProfileId===void 0&&Y.campaignData===void 0&&Y.computedLists===void 0&&Y.labels===void 0)throw Error("Provide at least one of `name`, `subject`, `trackingCode`, `html`, `blocks`, `replyTo`, `replyProfileId`, `campaignData`, `computedLists`, or `labels` when calling `update_campaign`.");X=await L("PUT",`/api/v1/campaigns/${Y.campaignId}`,Y,G);break}case"schedule_campaign":{let G=Y.companyId,$=new Set(["companyId","campaignId","scheduledAt","targetLists","sendTimeOptimization","spreadOverHours"]),z=Object.keys(Y).filter((J)=>!$.has(J));if(z.length>0)throw Error(`\`schedule_campaign\` accepts only \`campaignId\`, \`scheduledAt\`, \`targetLists\`, \`sendTimeOptimization\`, and \`spreadOverHours\`. Unsupported field${z.length===1?"":"s"}: ${z.map((J)=>`\`${J}\``).join(", ")}.`);LV(Y),X=await L("POST",`/api/v1/campaigns/${Y.campaignId}/schedule`,{scheduledAt:Y.scheduledAt,...Y.targetLists!==void 0&&{targetLists:Y.targetLists},...Y.sendTimeOptimization!==void 0&&{sendTimeOptimization:Y.sendTimeOptimization},...Y.spreadOverHours!==void 0&&{spreadOverHours:Y.spreadOverHours}},G);break}case"send_test_email":{let G=Y.companyId;X=await L("POST",`/api/v1/campaigns/${Y.campaignId}/test`,{to:Y.to},G);break}case"cancel_campaign":{let G=Y.companyId,$=v("cancel_campaign",Y,"campaignId");X=await L("POST",`/api/v1/campaigns/${encodeURIComponent($)}/cancel`,void 0,G);break}case"pause_campaign":{let G=Y.companyId,$=v("pause_campaign",Y,"campaignId");X=await L("POST",`/api/v1/campaigns/${encodeURIComponent($)}/pause`,void 0,G);break}case"resume_campaign":{let G=Y.companyId,$=v("resume_campaign",Y,"campaignId"),z=s6("resume_campaign",Y,"spreadOverHours",1,72);X=await L("POST",`/api/v1/campaigns/${encodeURIComponent($)}/resume`,{...z!==void 0&&{spreadOverHours:z}},G);break}case"delete_campaign":{let G=Y.companyId,$=v("delete_campaign",Y,"campaignId");X=await L("DELETE",`/api/v1/campaigns/${encodeURIComponent($)}`,void 0,G);break}case"duplicate_campaign":{let G=Y.companyId,$=v("duplicate_campaign",Y,"campaignId"),z=W1("duplicate_campaign",Y,"mode",["campaign","ab_test","variant"]),J=w(Y,"variantId");if(z==="variant"&&J===void 0)throw Error("`variantId` is required when calling `duplicate_campaign` with mode `variant`.");X=await L("POST",`/api/v1/campaigns/${encodeURIComponent($)}/duplicate`,{...z!==void 0&&{mode:z},...J!==void 0&&{variantId:J}},G);break}case"list_landing_pages":{let G=Y.companyId;X=await L("GET","/api/v1/landing-pages",void 0,G);break}case"get_landing_page":{let G=Y.companyId;X=await L("GET",`/api/v1/landing-pages/${Y.landingPageId}`,void 0,G);break}case"create_landing_page":{let G=Y.companyId,$=new Set(["companyId","name","slug","template","content"]),z=Object.keys(Y).filter((J)=>!$.has(J));if(z.length>0)throw Error(`\`create_landing_page\` accepts only \`name\`, \`slug\`, \`template\`, and \`content\` fields. Unsupported field${z.length===1?"":"s"}: ${z.map((J)=>`\`${J}\``).join(", ")}.`);X=await L("POST","/api/v1/landing-pages",{...Y.name!==void 0&&{name:Y.name},...Y.slug!==void 0&&{slug:Y.slug},...Y.template!==void 0&&{template:Y.template},...Y.content!==void 0&&{content:Y.content}},G);break}case"update_landing_page":{let G=Y.companyId,$=mY("update_landing_page",Y,{requireUpdate:!0});X=await L("PUT",`/api/v1/landing-pages/${Y.landingPageId}`,$,G);break}case"publish_landing_page":{let G=Y.companyId,$=mY("publish_landing_page",Y,{requireUpdate:!1});X=await L("POST",`/api/v1/landing-pages/${Y.landingPageId}/publish`,$,G);break}case"unpublish_landing_page":{let G=Y.companyId,$=mY("unpublish_landing_page",Y,{requireUpdate:!1});X=await L("POST",`/api/v1/landing-pages/${Y.landingPageId}/unpublish`,$,G);break}case"delete_landing_page":{let G=Y.companyId;X=await L("DELETE",`/api/v1/landing-pages/${Y.landingPageId}`,void 0,G);break}case"connect_landing_page_domain":{let G=Y.companyId;X=await L("POST","/api/v1/landing-pages/domain",{domain:Y.domain},G);break}case"update_landing_page_domain_settings":{let G=Y.companyId,$=FV(Y);X=await L("PUT","/api/v1/landing-pages/domain",$,G);break}case"list_sequences":{let G=Y.companyId;X=await L("GET","/api/v1/sequences",void 0,G);break}case"get_sequence":{let G=Y.companyId;X=await L("GET",`/api/v1/sequences/${Y.sequenceId}`,void 0,G);break}case"create_sequence":{let G=Y.companyId,$=Array.isArray(Y.steps)&&Y.steps.length>0,z=await L("POST","/api/v1/sequences",Y,G);if(!z.success){X=z;break}let J=z.sequence.id;if($){let K=await L("GET",`/api/v1/sequences/${J}`,void 0,G);if(K.success)X={success:!0,sequence:K.sequence,message:`Sequence "${K.sequence.name}" created with explicit steps. Review it before enabling.`};else X=K;break}let H=6,U=0,A="pending";while(A!=="complete"&&U<H){await new Promise((D)=>setTimeout(D,20000)),U++;let K=await L("GET",`/api/v1/sequences/${J}`,void 0,G);if(K.success)A=K.sequence.enrichmentStatus}let B=await L("GET",`/api/v1/sequences/${J}`,void 0,G);if(B.success)X={success:!0,sequence:B.sequence,message:B.sequence.enrichmentStatus==="complete"?`Sequence "${B.sequence.name}" created with ${B.sequence.emailCount} AI-generated emails. The sequence is ready to review and enable.`:`Sequence "${B.sequence.name}" created. Email enrichment is still in progress (${B.sequence.enrichedCount}/${B.sequence.emailCount} emails generated). You can check status with get_sequence.`};else X=B;break}case"update_sequence":{let G=Y.companyId,$=BV(Y);X=await L("PUT",`/api/v1/sequences/${Y.sequenceId}`,$,G);break}case"enable_sequence":{let G=Y.companyId;X=await L("POST",`/api/v1/sequences/${Y.sequenceId}/enable`,void 0,G);break}case"disable_sequence":{let G=Y.companyId;X=await L("POST",`/api/v1/sequences/${Y.sequenceId}/disable`,void 0,G);break}case"pause_sequence_enrollments":{let G=Y.companyId;X=await L("POST",`/api/v1/sequences/${Y.sequenceId}/pause-enrollments`,void 0,G);break}case"resume_sequence_enrollments":{let G=Y.companyId;X=await L("POST",`/api/v1/sequences/${Y.sequenceId}/resume-enrollments`,void 0,G);break}case"enroll_subscribers_in_sequence":{let G=Y.companyId,$=v("enroll_subscribers_in_sequence",Y,"sequenceId"),z=ZV(Y);X=await L("POST",`/api/v1/sequences/${encodeURIComponent($)}/enroll`,z,G);break}case"cancel_sequence_enrollments":{let G=Y.companyId,$=KV(Y);X=await L("POST",`/api/v1/sequences/${Y.sequenceId}/enrollments/cancel`,$,G);break}case"delete_sequence":{let G=Y.companyId;X=await L("DELETE",`/api/v1/sequences/${Y.sequenceId}`,void 0,G);break}case"list_transactional_emails":{let G=Y.companyId;X=await L("GET","/api/v1/transactional",void 0,G);break}case"get_transactional_email":{let G=Y.companyId;X=await L("GET",`/api/v1/transactional/${Y.idOrSlug}`,void 0,G);break}case"create_transactional_email":{let G=Y.companyId,$=new Set(["companyId","name","slug","subject","previewText","html","blocks","prompt","style","tone","enabled"]),z=Object.keys(Y).filter((U)=>!$.has(U));if(z.length>0)throw Error(`\`create_transactional_email\` accepts only \`name\`, \`slug\`, \`subject\`, \`previewText\`, \`html\`, \`blocks\`, \`prompt\`, \`style\`, \`tone\`, and \`enabled\` fields. Unsupported field${z.length===1?"":"s"}: ${z.map((U)=>`\`${U}\``).join(", ")}.`);qV(Y);let J=w(Y,"prompt");if(J!==void 0){let U={companyId:G??N1()??"",name:typeof Y.name==="string"&&Y.name.trim()!==""?Y.name.trim():"",slug:typeof Y.slug==="string"&&Y.slug.trim()!==""?Y.slug.trim():"",promptLength:J.length,style:typeof Y.style==="string"?Y.style:"",tone:typeof Y.tone==="string"?Y.tone:""};try{console.error("[mcp:create_transactional_email] generating from prompt",U);let A=await L("POST","/api/v1/generate/email",{prompt:J,...Y.style!==void 0&&{style:Y.style},...Y.tone!==void 0&&{tone:Y.tone}},G);console.error("[mcp:create_transactional_email] prompt generation complete",{...U,subject:A.subject??"",previewTextLength:typeof A.previewText==="string"?A.previewText.length:0,blockCount:Array.isArray(A.blocks)?A.blocks.length:0,htmlLength:typeof A.html==="string"?A.html.length:0});let B=w(Y,"subject")??(typeof A.subject==="string"&&A.subject.trim()!==""?A.subject.trim():void 0);if(!B)throw Error("`create_transactional_email` prompt generation did not return a subject. Provide `subject` explicitly.");let K=Array.isArray(A.blocks)&&A.blocks.length>0?A.blocks:void 0,D=typeof A.html==="string"&&A.html.trim()!==""?A.html:void 0,O=w(Y,"previewText")??(typeof A.previewText==="string"?A.previewText.trim():void 0);if(K===void 0&&D===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",{...U,subject:B,contentSource:K!==void 0?"blocks":"html",blockCount:K?.length??0,htmlLength:D?.length??0}),X=await L("POST","/api/v1/transactional",{name:Y.name,...Y.slug!==void 0&&{slug:Y.slug},subject:B,...O!==void 0&&{previewText:O},...K!==void 0?{blocks:K}:{html:D},...Y.enabled!==void 0&&{enabled:Y.enabled}},G),console.error("[mcp:create_transactional_email] generated transactional created",U)}catch(A){throw console.error("[mcp:create_transactional_email] prompt-based create failed",{...U,error:A instanceof Error?A.message:String(A)}),A}break}let H=Object.fromEntries(Object.entries(Y).filter(([U])=>U!=="companyId"));X=await L("POST","/api/v1/transactional",H,G);break}case"update_transactional_email":{let G=Y.companyId,$=new Set(["companyId","idOrSlug","name","enabled","subject","previewText","html","blocks"]),z=Object.keys(Y).filter((H)=>!$.has(H));if(z.length>0)throw Error(`\`update_transactional_email\` accepts only \`name\`, \`enabled\`, \`subject\`, \`previewText\`, \`html\`, and \`blocks\` update fields. Unsupported field${z.length===1?"":"s"}: ${z.map((H)=>`\`${H}\``).join(", ")}.`);if(S1("update_transactional_email",Y),Y.name===void 0&&Y.enabled===void 0&&Y.subject===void 0&&Y.previewText===void 0&&Y.html===void 0&&Y.blocks===void 0)throw Error("Provide at least one of `name`, `enabled`, `subject`, `previewText`, `html`, or `blocks` when calling `update_transactional_email`.");let J=Object.fromEntries(Object.entries(Y).filter(([H])=>H!=="companyId"&&H!=="idOrSlug"));X=await L("PATCH",`/api/v1/transactional/${Y.idOrSlug}`,J,G);break}case"send_email":{let G=Y.companyId;X=await L("POST","/api/v1/transactional/send",Y,G);break}case"get_stats":{let G=Y.companyId,$=Y.period??"7d",z=new URLSearchParams({period:String($)});if(Y.includeMachineEngagement===!0)z.set("includeMachineEngagement","true");X=await L("GET",`/api/v1/metrics?${z.toString()}`,void 0,G);break}case"get_campaign_stats":{let G=Y.companyId,$=new URLSearchParams;if(Y.includeMachineEngagement===!0)$.set("includeMachineEngagement","true");let z=$.toString();X=await L("GET",`/api/v1/metrics/campaigns/${Y.campaignId}${z?`?${z}`:""}`,void 0,G);break}case"get_sequence_stats":{let G=Y.companyId,$=new URLSearchParams;if(Y.includeMachineEngagement===!0)$.set("includeMachineEngagement","true");let z=$.toString();X=await L("GET",`/api/v1/metrics/sequences/${Y.sequenceId}${z?`?${z}`:""}`,void 0,G);break}case"get_subscriber_activity":{let G=Y.companyId,$=a6("get_subscriber_activity",Y),z=await pY($,G,{includeMachineEngagement:Y.includeMachineEngagement===!0});X={success:z.success,email:z.subscriber.email,emailStats:z.subscriber.emailStats??null,activity:z.subscriber.activity??[],sequenceEnrollments:z.subscriber.sequenceEnrollments??[]};break}case"list_team_members":{let G=Y.companyId;X=await L("GET","/api/v1/team",void 0,G);break}case"invite_team_member":{let G=Y.companyId,$=v("invite_team_member",Y,"email"),z=iY("invite_team_member",Y,"role",["admin","viewer"]);if(Y.canManageBilling!==void 0&&typeof Y.canManageBilling!=="boolean")throw Error("`canManageBilling` must be a boolean when calling `invite_team_member`.");X=await L("POST","/api/v1/team/invitations",{email:$,role:z,...Y.canManageBilling!==void 0&&{canManageBilling:Y.canManageBilling}},G);break}case"cancel_team_invitation":{let G=Y.companyId,$=v("cancel_team_invitation",Y,"invitationId");X=await L("DELETE",`/api/v1/team/invitations/${encodeURIComponent($)}`,void 0,G);break}case"list_conversations":{let G=Y.companyId,$=new URLSearchParams,z=W1("list_conversations",Y,"status",["open","closed","all"]);if(z)$.set("status",z);let J=w(Y,"search");if(J)$.set("search",J);if(Y.unread!==void 0){if(typeof Y.unread!=="boolean")throw Error("`unread` must be a boolean when calling `list_conversations`.");if(Y.unread)$.set("unread","true")}if(Y.page!==void 0){if(typeof Y.page!=="number"||!Number.isInteger(Y.page)||Y.page<1)throw Error("`page` must be a positive integer when calling `list_conversations`.");$.set("page",String(Y.page))}let H=s6("list_conversations",Y,"limit",1,100);if(H!==void 0)$.set("limit",String(H));X=await L("GET",`/api/v1/conversations${$.size>0?`?${$}`:""}`,void 0,G);break}case"get_conversation":{let G=Y.companyId,$=v("get_conversation",Y,"conversationId");X=await L("GET",`/api/v1/conversations/${encodeURIComponent($)}`,void 0,G);break}case"reply_to_conversation":{let G=Y.companyId,$=v("reply_to_conversation",Y,"conversationId"),z=W1("reply_to_conversation",Y,"type",["outbound","note"])??"outbound",J=w(Y,"subject"),H=w(Y,"bodyText"),U=w(Y,"bodyHtml");if(z==="outbound"&&H===void 0&&U===void 0)throw Error("Provide `bodyText` or `bodyHtml` when calling `reply_to_conversation` with an outbound message.");X=await L("POST",`/api/v1/conversations/${encodeURIComponent($)}/messages`,{type:z,...J!==void 0&&{subject:J},...H!==void 0&&{bodyText:H},...U!==void 0&&{bodyHtml:U}},G);break}case"update_conversation_status":{let G=Y.companyId,$=v("update_conversation_status",Y,"conversationId"),z=iY("update_conversation_status",Y,"status",["open","closed"]);X=await L("POST",`/api/v1/conversations/${encodeURIComponent($)}/status`,{status:z},G);break}case"mark_conversation_read":{let G=Y.companyId,$=v("mark_conversation_read",Y,"conversationId");X=await L("POST",`/api/v1/conversations/${encodeURIComponent($)}/read`,void 0,G);break}case"list_webhooks":{let G=Y.companyId;X=await L("GET","/api/v1/webhooks",void 0,G);break}case"create_webhook":{let G=Y.companyId,$=v("create_webhook",Y,"name"),z=v("create_webhook",Y,"url"),J=l5("create_webhook",Y);X=await L("POST","/api/v1/webhooks",{name:$,url:z,...J!==void 0&&{events:J}},G);break}case"update_webhook":{let G=Y.companyId,$=v("update_webhook",Y,"webhookId"),z=w(Y,"name"),J=w(Y,"url"),H=l5("update_webhook",Y),U=W1("update_webhook",Y,"status",["enabled","disabled"]);if(z===void 0&&J===void 0&&H===void 0&&U===void 0)throw Error("Provide at least one of `name`, `url`, `events`, or `status` when calling `update_webhook`.");X=await L("PATCH",`/api/v1/webhooks/${encodeURIComponent($)}`,{...z!==void 0&&{name:z},...J!==void 0&&{url:J},...H!==void 0&&{events:H},...U!==void 0&&{status:U}},G);break}case"delete_webhook":{let G=Y.companyId,$=v("delete_webhook",Y,"webhookId");X=await L("DELETE",`/api/v1/webhooks/${encodeURIComponent($)}`,void 0,G);break}case"test_webhook":{let G=Y.companyId,$=v("test_webhook",Y,"webhookId");X=await L("POST",`/api/v1/webhooks/${encodeURIComponent($)}/test`,void 0,G);break}case"list_webhook_deliveries":{let G=Y.companyId,$=v("list_webhook_deliveries",Y,"webhookId"),z=s6("list_webhook_deliveries",Y,"limit",1,100),J=new URLSearchParams;if(z!==void 0)J.set("limit",String(z));X=await L("GET",`/api/v1/webhooks/${encodeURIComponent($)}/deliveries${J.size>0?`?${J}`:""}`,void 0,G);break}case"replay_webhook_delivery":{let G=Y.companyId,$=v("replay_webhook_delivery",Y,"webhookId"),z=v("replay_webhook_delivery",Y,"deliveryId");X=await L("POST",`/api/v1/webhooks/${encodeURIComponent($)}/deliveries/${encodeURIComponent(z)}/replay`,void 0,G);break}case"generate_email":{let G=Y.companyId;X=await L("POST","/api/v1/generate/email",Y,G);break}case"generate_sequence":{let G=Y.companyId;X=await L("POST","/api/v1/generate/sequence",Y,G);break}case"generate_subject_lines":{let G=Y.companyId;X=await L("POST","/api/v1/generate/subjects",Y,G);break}default:throw Error(`Unknown tool: ${Q}`)}let W=OV(X);if(W)throw W;return X=await EV(Q,Y,X),{structuredContent:yV(X),content:[{type:"text",text:JSON.stringify(X,null,2)}]}}catch(X){return{isError:!0,content:[{type:"text",text:R1(X)}]}}}async function t5(Q,Y,X){let W=Y.getRequestContext?.(Q)??{};try{return await $X(W,X)}finally{await Y.onRequestContextUpdated?.(W,Q)}}function iE(Q={}){let Y=new fY({name:"sequenzy",version:S5.version},{capabilities:{tools:{},resources:{}}});return Y.setRequestHandler(E9,async()=>{return{tools:d5}}),Y.setRequestHandler(P6,async(X,W)=>{let{name:G,arguments:$}=X.params;return t5(W,Q,()=>o5(G,$??{}))}),Y.setRequestHandler(N9,async()=>{return{resources:k5}}),Y.setRequestHandler(w9,async(X,W)=>{let{uri:G}=X.params;return t5(W,Q,()=>v5(G))}),Y}export{iE as createSequenzyMcpServer};
|