@sequenzy/mcp 0.0.46 → 0.0.48
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 w5=Object.create;var{getPrototypeOf:b5,defineProperty:LQ,getOwnPropertyNames:P5}=Object;var j5=Object.prototype.hasOwnProperty;function I5(Q){return this[Q]}var E5,T5,k9=(Q,Y,X)=>{var W=Q!=null&&typeof Q==="object";if(W){var G=Y?E5??=new WeakMap:T5??=new WeakMap,z=G.get(Q);if(z)return z}X=Q!=null?w5(b5(Q)):{};let J=Y||!Q||!Q.__esModule?LQ(X,"default",{value:Q,enumerable:!0}):X;for(let $ of P5(Q))if(!j5.call(J,$))LQ(J,$,{get:I5.bind(Q,$),enumerable:!0});if(W)G.set(Q,J);return J};var Z=(Q,Y)=>()=>(Y||Q((Y={exports:{}}).exports,Y),Y.exports);var S5=(Q)=>Q;function R5(Q,Y){this[Q]=S5.bind(null,Y)}var x9=(Q,Y)=>{for(var X in Y)LQ(Q,X,{get:Y[X],enumerable:!0,configurable:!0,set:R5.bind(Y,X)})};var O4=Z((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 P6{}TG._CodeOrName=P6;TG.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class v1 extends P6{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=v1;class S0 extends P6{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 v1)Y[X.str]=(Y[X.str]||0)+1;return Y},{})}}TG._Code=S0;TG.nil=new S0("");function IG(Q,...Y){let X=[Q[0]],W=0;while(W<Y.length)bY(X,Y[W]),X.push(Q[++W]);return new S0(X)}TG._=IG;var wY=new S0("+");function EG(Q,...Y){let X=[q4(Q[0])],W=0;while(W<Y.length)X.push(wY),bY(X,Y[W]),X.push(wY,q4(Q[++W]));return eU(X),new S0(X)}TG.str=EG;function bY(Q,Y){if(Y instanceof S0)Q.push(...Y._items);else if(Y instanceof v1)Q.push(Y);else Q.push(X3(Y))}TG.addCodeArg=bY;function eU(Q){let Y=1;while(Y<Q.length-1){if(Q[Y]===wY){let X=Q3(Q[Y-1],Q[Y+1]);if(X!==void 0){Q.splice(Y-1,3,X);continue}Q[Y++]="+"}Y++}}function Q3(Q,Y){if(Y==='""')return Q;if(Q==='""')return Y;if(typeof Q=="string"){if(Y instanceof v1||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 v1))return`"${Q}${Y.slice(1)}`;return}function Y3(Q,Y){return Y.emptyStr()?Q:Q.emptyStr()?Y:EG`${Q}${Y}`}TG.strConcat=Y3;function X3(Q){return typeof Q=="number"||typeof Q=="boolean"||Q===null?Q:q4(Array.isArray(Q)?Q.join(","):Q)}function W3(Q){return new S0(q4(Q))}TG.stringify=W3;function q4(Q){return JSON.stringify(Q).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}TG.safeStringify=q4;function G3(Q){return typeof Q=="string"&&TG.IDENTIFIER.test(Q)?new S0(`.${Q}`):IG`[${Q}]`}TG.getProperty=G3;function z3(Q){if(typeof Q=="string"&&TG.IDENTIFIER.test(Q))return new S0(`${Q}`);throw Error(`CodeGen: invalid export name: ${Q}, use explicit $id name mapping`)}TG.getEsmExportName=z3;function J3(Q){return new S0(Q.toString())}TG.regexpCode=J3});var EY=Z((vG)=>{Object.defineProperty(vG,"__esModule",{value:!0});vG.ValueScope=vG.ValueScopeName=vG.Scope=vG.varKinds=vG.UsedValueState=void 0;var F0=O4();class RG extends Error{constructor(Q){super(`CodeGen: "code" for ${Q} not defined`);this.value=Q.value}}var I6;(function(Q){Q[Q.Started=0]="Started",Q[Q.Completed=1]="Completed"})(I6||(vG.UsedValueState=I6={}));vG.varKinds={const:new F0.Name("const"),let:new F0.Name("let"),var:new F0.Name("var")};class jY{constructor({prefixes:Q,parent:Y}={}){this._names={},this._prefixes=Q,this._parent=Y}toName(Q){return Q instanceof F0.Name?Q:this.name(Q)}name(Q){return new F0.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}}}vG.Scope=jY;class IY extends F0.Name{constructor(Q,Y){super(Y);this.prefix=Q}setValue(Q,{property:Y,itemIndex:X}){this.value=Q,this.scopePath=F0._`.${new F0.Name(Y)}[${X}]`}}vG.ValueScopeName=IY;var V3=F0._`\n`;class CG extends jY{constructor(Q){super(Q);this._values={},this._scope=Q.scope,this.opts={...Q,_n:Q.lines?V3:F0.nil}}get(){return this._scope}name(Q){return new IY(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,z=(X=Y.key)!==null&&X!==void 0?X:Y.ref,J=this._values[G];if(J){let A=J.get(z);if(A)return A}else J=this._values[G]=new Map;J.set(z,W);let $=this._scope[G]||(this._scope[G]=[]),H=$.length;return $[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 F0._`${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=F0.nil;for(let z in Q){let J=Q[z];if(!J)continue;let $=X[z]=X[z]||new Map;J.forEach((H)=>{if($.has(H))return;$.set(H,I6.Started);let A=Y(H);if(A){let U=this.opts.es5?vG.varKinds.var:vG.varKinds.const;G=F0._`${G}${U} ${H} = ${A};${this.opts._n}`}else if(A=W===null||W===void 0?void 0:W(H))G=F0._`${G}${A}${this.opts._n}`;else throw new RG(H);$.set(H,I6.Completed)})}return G}}vG.ValueScope=CG});var k=Z((q0)=>{Object.defineProperty(q0,"__esModule",{value:!0});q0.or=q0.and=q0.not=q0.CodeGen=q0.operators=q0.varKinds=q0.ValueScopeName=q0.ValueScope=q0.Scope=q0.Name=q0.regexpCode=q0.stringify=q0.getProperty=q0.nil=q0.strConcat=q0.str=q0._=void 0;var y=O4(),R0=EY(),G1=O4();Object.defineProperty(q0,"_",{enumerable:!0,get:function(){return G1._}});Object.defineProperty(q0,"str",{enumerable:!0,get:function(){return G1.str}});Object.defineProperty(q0,"strConcat",{enumerable:!0,get:function(){return G1.strConcat}});Object.defineProperty(q0,"nil",{enumerable:!0,get:function(){return G1.nil}});Object.defineProperty(q0,"getProperty",{enumerable:!0,get:function(){return G1.getProperty}});Object.defineProperty(q0,"stringify",{enumerable:!0,get:function(){return G1.stringify}});Object.defineProperty(q0,"regexpCode",{enumerable:!0,get:function(){return G1.regexpCode}});Object.defineProperty(q0,"Name",{enumerable:!0,get:function(){return G1.Name}});var v6=EY();Object.defineProperty(q0,"Scope",{enumerable:!0,get:function(){return v6.Scope}});Object.defineProperty(q0,"ValueScope",{enumerable:!0,get:function(){return v6.ValueScope}});Object.defineProperty(q0,"ValueScopeName",{enumerable:!0,get:function(){return v6.ValueScopeName}});Object.defineProperty(q0,"varKinds",{enumerable:!0,get:function(){return v6.varKinds}});q0.operators={GT:new y._Code(">"),GTE:new y._Code(">="),LT:new y._Code("<"),LTE:new y._Code("<="),EQ:new y._Code("==="),NEQ:new y._Code("!=="),NOT:new y._Code("!"),OR:new y._Code("||"),AND:new y._Code("&&"),ADD:new y._Code("+")};class z1{optimizeNodes(){return this}optimizeNames(Q,Y){return this}}class xG extends z1{constructor(Q,Y,X){super();this.varKind=Q,this.name=Y,this.rhs=X}render({es5:Q,_n:Y}){let X=Q?R0.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=x1(this.rhs,Q,Y);return this}get names(){return this.rhs instanceof y._CodeOrName?this.rhs.names:{}}}class RY extends z1{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 y.Name&&!Q[this.lhs.str]&&!this.sideEffects)return;return this.rhs=x1(this.rhs,Q,Y),this}get names(){let Q=this.lhs instanceof y.Name?{}:{...this.lhs.names};return C6(Q,this.rhs)}}class _G extends RY{constructor(Q,Y,X,W){super(Q,X,W);this.op=Y}render({_n:Q}){return`${this.lhs} ${this.op}= ${this.rhs};`+Q}}class gG extends z1{constructor(Q){super();this.label=Q,this.names={}}render({_n:Q}){return`${this.label}:`+Q}}class yG extends z1{constructor(Q){super();this.label=Q,this.names={}}render({_n:Q}){return`break${this.label?` ${this.label}`:""};`+Q}}class uG extends z1{constructor(Q){super();this.error=Q}render({_n:Q}){return`throw ${this.error};`+Q}get names(){return this.error.names}}class hG extends z1{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=x1(this.code,Q,Y),this}get names(){return this.code instanceof y._CodeOrName?this.code.names:{}}}class k6 extends z1{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;b3(Q,G.names),X.splice(W,1)}return X.length>0?this:void 0}get names(){return this.nodes.reduce((Q,Y)=>q1(Q,Y.names),{})}}class J1 extends k6{render(Q){return"{"+Q._n+super.render(Q)+"}"+Q._n}}class fG extends k6{}class M4 extends J1{}M4.kind="else";class i0 extends J1{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 M4(X):X}if(Y){if(Q===!1)return Y instanceof i0?Y:Y.nodes;if(this.nodes.length)return this;return new i0(iG(Q),Y instanceof i0?[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=x1(this.condition,Q,Y),this}get names(){let Q=super.names;if(C6(Q,this.condition),this.else)q1(Q,this.else.names);return Q}}i0.kind="if";class k1 extends J1{}k1.kind="for";class lG extends k1{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=x1(this.iteration,Q,Y),this}get names(){return q1(super.names,this.iteration.names)}}class mG extends k1{constructor(Q,Y,X,W){super();this.varKind=Q,this.name=Y,this.from=X,this.to=W}render(Q){let Y=Q.es5?R0.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=C6(super.names,this.from);return C6(Q,this.to)}}class TY extends k1{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=x1(this.iterable,Q,Y),this}get names(){return q1(super.names,this.iterable.names)}}class E6 extends J1{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)}}E6.kind="func";class T6 extends k6{render(Q){return"return "+super.render(Q)}}T6.kind="return";class cG extends J1{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)q1(Q,this.catch.names);if(this.finally)q1(Q,this.finally.names);return Q}}class S6 extends J1{constructor(Q){super();this.error=Q}render(Q){return`catch(${this.error})`+super.render(Q)}}S6.kind="catch";class R6 extends J1{render(Q){return"finally"+super.render(Q)}}R6.kind="finally";class pG{constructor(Q,Y={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...Y,_n:Y.lines?`
|
|
2
|
-
`:""},this._extScope=Q,this._scope=new R0.Scope({parent:Q}),this._nodes=[new fG]}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 xG(Q,G,X)),G}const(Q,Y,X){return this._def(R0.varKinds.const,Q,Y,X)}let(Q,Y,X){return this._def(R0.varKinds.let,Q,Y,X)}var(Q,Y,X){return this._def(R0.varKinds.var,Q,Y,X)}assign(Q,Y,X){return this._leafNode(new RY(Q,Y,X))}add(Q,Y){return this._leafNode(new _G(Q,q0.operators.ADD,Y))}code(Q){if(typeof Q=="function")Q();else if(Q!==y.nil)this._leafNode(new hG(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,y.addCodeArg)(Y,W)}return Y.push("}"),new y._Code(Y)}if(Q,Y,X){if(this._blockNode(new i0(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 i0(Q))}else(){return this._elseNode(new M4)}endIf(){return this._endBlockNode(i0,M4)}_for(Q,Y){if(this._blockNode(Q),Y)this.code(Y).endFor();return this}for(Q,Y){return this._for(new lG(Q),Y)}forRange(Q,Y,X,W,G=this.opts.es5?R0.varKinds.var:R0.varKinds.let){let z=this._scope.toName(Q);return this._for(new mG(G,z,Y,X),()=>W(z))}forOf(Q,Y,X,W=R0.varKinds.const){let G=this._scope.toName(Q);if(this.opts.es5){let z=Y instanceof y.Name?Y:this.var("_arr",Y);return this.forRange("_i",0,y._`${z}.length`,(J)=>{this.var(G,y._`${z}[${J}]`),X(G)})}return this._for(new TY("of",W,G,Y),()=>X(G))}forIn(Q,Y,X,W=this.opts.es5?R0.varKinds.var:R0.varKinds.const){if(this.opts.ownProperties)return this.forOf(Q,y._`Object.keys(${Y})`,X);let G=this._scope.toName(Q);return this._for(new TY("in",W,G,Y),()=>X(G))}endFor(){return this._endBlockNode(k1)}label(Q){return this._leafNode(new gG(Q))}break(Q){return this._leafNode(new yG(Q))}return(Q){let Y=new T6;if(this._blockNode(Y),this.code(Q),Y.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(T6)}try(Q,Y,X){if(!Y&&!X)throw Error('CodeGen: "try" without "catch" and "finally"');let W=new cG;if(this._blockNode(W),this.code(Q),Y){let G=this.name("e");this._currNode=W.catch=new S6(G),Y(G)}if(X)this._currNode=W.finally=new R6,this.code(X);return this._endBlockNode(S6,R6)}throw(Q){return this._leafNode(new uG(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=y.nil,X,W){if(this._blockNode(new E6(Q,Y,X)),W)this.code(W).endFunc();return this}endFunc(){return this._endBlockNode(E6)}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 i0))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}}q0.CodeGen=pG;function q1(Q,Y){for(let X in Y)Q[X]=(Q[X]||0)+(Y[X]||0);return Q}function C6(Q,Y){return Y instanceof y._CodeOrName?q1(Q,Y.names):Q}function x1(Q,Y,X){if(Q instanceof y.Name)return W(Q);if(!G(Q))return Q;return new y._Code(Q._items.reduce((z,J)=>{if(J instanceof y.Name)J=W(J);if(J instanceof y._Code)z.push(...J._items);else z.push(J);return z},[]));function W(z){let J=X[z.str];if(J===void 0||Y[z.str]!==1)return z;return delete Y[z.str],J}function G(z){return z instanceof y._Code&&z._items.some((J)=>J instanceof y.Name&&Y[J.str]===1&&X[J.str]!==void 0)}}function b3(Q,Y){for(let X in Y)Q[X]=(Q[X]||0)-(Y[X]||0)}function iG(Q){return typeof Q=="boolean"||typeof Q=="number"||Q===null?!Q:y._`!${SY(Q)}`}q0.not=iG;var P3=rG(q0.operators.AND);function j3(...Q){return Q.reduce(P3)}q0.and=j3;var I3=rG(q0.operators.OR);function E3(...Q){return Q.reduce(I3)}q0.or=E3;function rG(Q){return(Y,X)=>Y===y.nil?X:X===y.nil?Y:y._`${SY(Y)} ${Q} ${SY(X)}`}function SY(Q){return Q instanceof y.Name?Q:y._`(${Q})`}});var f=Z((Yz)=>{Object.defineProperty(Yz,"__esModule",{value:!0});Yz.checkStrictMode=Yz.getErrorPath=Yz.Type=Yz.useFunc=Yz.setEvaluated=Yz.evaluatedPropsToName=Yz.mergeEvaluated=Yz.eachItem=Yz.unescapeJsonPointer=Yz.escapeJsonPointer=Yz.escapeFragment=Yz.unescapeFragment=Yz.schemaRefOrVal=Yz.schemaHasRulesButRef=Yz.schemaHasRules=Yz.checkUnknownRules=Yz.alwaysValidSchema=Yz.toHash=void 0;var c=k(),C3=O4();function v3(Q){let Y={};for(let X of Q)Y[X]=!0;return Y}Yz.toHash=v3;function k3(Q,Y){if(typeof Y=="boolean")return Y;if(Object.keys(Y).length===0)return!0;return tG(Q,Y),!aG(Y,Q.self.RULES.all)}Yz.alwaysValidSchema=k3;function tG(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 z in Y)if(!G[z])Qz(Q,`unknown keyword: "${z}"`)}Yz.checkUnknownRules=tG;function aG(Q,Y){if(typeof Q=="boolean")return!Q;for(let X in Q)if(Y[X])return!0;return!1}Yz.schemaHasRules=aG;function x3(Q,Y){if(typeof Q=="boolean")return!Q;for(let X in Q)if(X!=="$ref"&&Y.all[X])return!0;return!1}Yz.schemaHasRulesButRef=x3;function _3({topSchemaRef:Q,schemaPath:Y},X,W,G){if(!G){if(typeof X=="number"||typeof X=="boolean")return X;if(typeof X=="string")return c._`${X}`}return c._`${Q}${Y}${(0,c.getProperty)(W)}`}Yz.schemaRefOrVal=_3;function g3(Q){return sG(decodeURIComponent(Q))}Yz.unescapeFragment=g3;function y3(Q){return encodeURIComponent(vY(Q))}Yz.escapeFragment=y3;function vY(Q){if(typeof Q=="number")return`${Q}`;return Q.replace(/~/g,"~0").replace(/\//g,"~1")}Yz.escapeJsonPointer=vY;function sG(Q){return Q.replace(/~1/g,"/").replace(/~0/g,"~")}Yz.unescapeJsonPointer=sG;function u3(Q,Y){if(Array.isArray(Q))for(let X of Q)Y(X);else Y(Q)}Yz.eachItem=u3;function dG({mergeNames:Q,mergeToName:Y,mergeValues:X,resultToName:W}){return(G,z,J,$)=>{let H=J===void 0?z:J instanceof c.Name?(z instanceof c.Name?Q(G,z,J):Y(G,z,J),J):z instanceof c.Name?(Y(G,J,z),z):X(z,J);return $===c.Name&&!(H instanceof c.Name)?W(G,H):H}}Yz.mergeEvaluated={props:dG({mergeNames:(Q,Y,X)=>Q.if(c._`${X} !== true && ${Y} !== undefined`,()=>{Q.if(c._`${Y} === true`,()=>Q.assign(X,!0),()=>Q.assign(X,c._`${X} || {}`).code(c._`Object.assign(${X}, ${Y})`))}),mergeToName:(Q,Y,X)=>Q.if(c._`${X} !== true`,()=>{if(Y===!0)Q.assign(X,!0);else Q.assign(X,c._`${X} || {}`),kY(Q,X,Y)}),mergeValues:(Q,Y)=>Q===!0?!0:{...Q,...Y},resultToName:eG}),items:dG({mergeNames:(Q,Y,X)=>Q.if(c._`${X} !== true && ${Y} !== undefined`,()=>Q.assign(X,c._`${Y} === true ? true : ${X} > ${Y} ? ${X} : ${Y}`)),mergeToName:(Q,Y,X)=>Q.if(c._`${X} !== true`,()=>Q.assign(X,Y===!0?!0:c._`${X} > ${Y} ? ${X} : ${Y}`)),mergeValues:(Q,Y)=>Q===!0?!0:Math.max(Q,Y),resultToName:(Q,Y)=>Q.var("items",Y)})};function eG(Q,Y){if(Y===!0)return Q.var("props",!0);let X=Q.var("props",c._`{}`);if(Y!==void 0)kY(Q,X,Y);return X}Yz.evaluatedPropsToName=eG;function kY(Q,Y,X){Object.keys(X).forEach((W)=>Q.assign(c._`${Y}${(0,c.getProperty)(W)}`,!0))}Yz.setEvaluated=kY;var oG={};function h3(Q,Y){return Q.scopeValue("func",{ref:Y,code:oG[Y.code]||(oG[Y.code]=new C3._Code(Y.code))})}Yz.useFunc=h3;var CY;(function(Q){Q[Q.Num=0]="Num",Q[Q.Str=1]="Str"})(CY||(Yz.Type=CY={}));function f3(Q,Y,X){if(Q instanceof c.Name){let W=Y===CY.Num;return X?W?c._`"[" + ${Q} + "]"`:c._`"['" + ${Q} + "']"`:W?c._`"/" + ${Q}`:c._`"/" + ${Q}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return X?(0,c.getProperty)(Q).toString():"/"+vY(Q)}Yz.getErrorPath=f3;function Qz(Q,Y,X=Q.opts.strictSchema){if(!X)return;if(Y=`strict mode: ${Y}`,X===!0)throw Error(Y);Q.self.logger.warn(Y)}Yz.checkStrictMode=Qz});var r0=Z((Wz)=>{Object.defineProperty(Wz,"__esModule",{value:!0});var A0=k(),GK={data:new A0.Name("data"),valCxt:new A0.Name("valCxt"),instancePath:new A0.Name("instancePath"),parentData:new A0.Name("parentData"),parentDataProperty:new A0.Name("parentDataProperty"),rootData:new A0.Name("rootData"),dynamicAnchors:new A0.Name("dynamicAnchors"),vErrors:new A0.Name("vErrors"),errors:new A0.Name("errors"),this:new A0.Name("this"),self:new A0.Name("self"),scope:new A0.Name("scope"),json:new A0.Name("json"),jsonPos:new A0.Name("jsonPos"),jsonLen:new A0.Name("jsonLen"),jsonPart:new A0.Name("jsonPart")};Wz.default=GK});var V4=Z(($z)=>{Object.defineProperty($z,"__esModule",{value:!0});$z.extendErrors=$z.resetErrorsCount=$z.reportExtraError=$z.reportError=$z.keyword$DataError=$z.keywordError=void 0;var u=k(),_6=f(),K0=r0();$z.keywordError={message:({keyword:Q})=>u.str`must pass "${Q}" keyword validation`};$z.keyword$DataError={message:({keyword:Q,schemaType:Y})=>Y?u.str`"${Q}" keyword must be ${Y} ($data)`:u.str`"${Q}" keyword is invalid ($data)`};function JK(Q,Y=$z.keywordError,X,W){let{it:G}=Q,{gen:z,compositeRule:J,allErrors:$}=G,H=Jz(Q,Y,X);if(W!==null&&W!==void 0?W:J||$)Gz(z,H);else zz(G,u._`[${H}]`)}$z.reportError=JK;function $K(Q,Y=$z.keywordError,X){let{it:W}=Q,{gen:G,compositeRule:z,allErrors:J}=W,$=Jz(Q,Y,X);if(Gz(G,$),!(z||J))zz(W,K0.default.vErrors)}$z.reportExtraError=$K;function HK(Q,Y){Q.assign(K0.default.errors,Y),Q.if(u._`${K0.default.vErrors} !== null`,()=>Q.if(Y,()=>Q.assign(u._`${K0.default.vErrors}.length`,Y),()=>Q.assign(K0.default.vErrors,null)))}$z.resetErrorsCount=HK;function AK({gen:Q,keyword:Y,schemaValue:X,data:W,errsCount:G,it:z}){if(G===void 0)throw Error("ajv implementation error");let J=Q.name("err");Q.forRange("i",G,K0.default.errors,($)=>{if(Q.const(J,u._`${K0.default.vErrors}[${$}]`),Q.if(u._`${J}.instancePath === undefined`,()=>Q.assign(u._`${J}.instancePath`,(0,u.strConcat)(K0.default.instancePath,z.errorPath))),Q.assign(u._`${J}.schemaPath`,u.str`${z.errSchemaPath}/${Y}`),z.opts.verbose)Q.assign(u._`${J}.schema`,X),Q.assign(u._`${J}.data`,W)})}$z.extendErrors=AK;function Gz(Q,Y){let X=Q.const("err",Y);Q.if(u._`${K0.default.vErrors} === null`,()=>Q.assign(K0.default.vErrors,u._`[${X}]`),u._`${K0.default.vErrors}.push(${X})`),Q.code(u._`${K0.default.errors}++`)}function zz(Q,Y){let{gen:X,validateName:W,schemaEnv:G}=Q;if(G.$async)X.throw(u._`new ${Q.ValidationError}(${Y})`);else X.assign(u._`${W}.errors`,Y),X.return(!1)}var O1={keyword:new u.Name("keyword"),schemaPath:new u.Name("schemaPath"),params:new u.Name("params"),propertyName:new u.Name("propertyName"),message:new u.Name("message"),schema:new u.Name("schema"),parentSchema:new u.Name("parentSchema")};function Jz(Q,Y,X){let{createErrors:W}=Q.it;if(W===!1)return u._`{}`;return UK(Q,Y,X)}function UK(Q,Y,X={}){let{gen:W,it:G}=Q,z=[KK(G,X),DK(Q,X)];return BK(Q,Y,z),W.object(...z)}function KK({errorPath:Q},{instancePath:Y}){let X=Y?u.str`${Q}${(0,_6.getErrorPath)(Y,_6.Type.Str)}`:Q;return[K0.default.instancePath,(0,u.strConcat)(K0.default.instancePath,X)]}function DK({keyword:Q,it:{errSchemaPath:Y}},{schemaPath:X,parentSchema:W}){let G=W?Y:u.str`${Y}/${Q}`;if(X)G=u.str`${G}${(0,_6.getErrorPath)(X,_6.Type.Str)}`;return[O1.schemaPath,G]}function BK(Q,{params:Y,message:X},W){let{keyword:G,data:z,schemaValue:J,it:$}=Q,{opts:H,propertyName:A,topSchemaRef:U,schemaPath:K}=$;if(W.push([O1.keyword,G],[O1.params,typeof Y=="function"?Y(Q):Y||u._`{}`]),H.messages)W.push([O1.message,typeof X=="function"?X(Q):X]);if(H.verbose)W.push([O1.schema,J],[O1.parentSchema,u._`${U}${K}`],[K0.default.data,z]);if(A)W.push([O1.propertyName,A])}});var Dz=Z((Uz)=>{Object.defineProperty(Uz,"__esModule",{value:!0});Uz.boolOrEmptySchema=Uz.topBoolOrEmptySchema=void 0;var MK=V4(),VK=k(),NK=r0(),ZK={message:"boolean schema is false"};function wK(Q){let{gen:Y,schema:X,validateName:W}=Q;if(X===!1)Az(Q,!1);else if(typeof X=="object"&&X.$async===!0)Y.return(NK.default.data);else Y.assign(VK._`${W}.errors`,null),Y.return(!0)}Uz.topBoolOrEmptySchema=wK;function bK(Q,Y){let{gen:X,schema:W}=Q;if(W===!1)X.var(Y,!1),Az(Q);else X.var(Y,!0)}Uz.boolOrEmptySchema=bK;function Az(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,MK.reportError)(G,ZK,void 0,Y)}});var _Y=Z((Bz)=>{Object.defineProperty(Bz,"__esModule",{value:!0});Bz.getRules=Bz.isJSONType=void 0;var jK=["string","number","integer","boolean","null","object","array"],IK=new Set(jK);function EK(Q){return typeof Q=="string"&&IK.has(Q)}Bz.isJSONType=EK;function TK(){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:{}}}Bz.getRules=TK});var gY=Z((Oz)=>{Object.defineProperty(Oz,"__esModule",{value:!0});Oz.shouldUseRule=Oz.shouldUseGroup=Oz.schemaHasRulesForType=void 0;function RK({schema:Q,self:Y},X){let W=Y.RULES.types[X];return W&&W!==!0&&Fz(Q,W)}Oz.schemaHasRulesForType=RK;function Fz(Q,Y){return Y.rules.some((X)=>qz(Q,X))}Oz.shouldUseGroup=Fz;function qz(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))}Oz.shouldUseRule=qz});var N4=Z((wz)=>{Object.defineProperty(wz,"__esModule",{value:!0});wz.reportTypeError=wz.checkDataTypes=wz.checkDataType=wz.coerceAndCheckDataType=wz.getJSONTypes=wz.getSchemaTypes=wz.DataType=void 0;var kK=_Y(),xK=gY(),_K=V4(),C=k(),Vz=f(),_1;(function(Q){Q[Q.Correct=0]="Correct",Q[Q.Wrong=1]="Wrong"})(_1||(wz.DataType=_1={}));function gK(Q){let Y=Nz(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}wz.getSchemaTypes=gK;function Nz(Q){let Y=Array.isArray(Q)?Q:Q?[Q]:[];if(Y.every(kK.isJSONType))return Y;throw Error("type must be JSONType or JSONType[]: "+Y.join(","))}wz.getJSONTypes=Nz;function yK(Q,Y){let{gen:X,data:W,opts:G}=Q,z=uK(Y,G.coerceTypes),J=Y.length>0&&!(z.length===0&&Y.length===1&&(0,xK.schemaHasRulesForType)(Q,Y[0]));if(J){let $=uY(Y,W,G.strictNumbers,_1.Wrong);X.if($,()=>{if(z.length)hK(Q,Y,z);else hY(Q)})}return J}wz.coerceAndCheckDataType=yK;var Zz=new Set(["string","number","integer","boolean","null"]);function uK(Q,Y){return Y?Q.filter((X)=>Zz.has(X)||Y==="array"&&X==="array"):[]}function hK(Q,Y,X){let{gen:W,data:G,opts:z}=Q,J=W.let("dataType",C._`typeof ${G}`),$=W.let("coerced",C._`undefined`);if(z.coerceTypes==="array")W.if(C._`${J} == 'object' && Array.isArray(${G}) && ${G}.length == 1`,()=>W.assign(G,C._`${G}[0]`).assign(J,C._`typeof ${G}`).if(uY(Y,G,z.strictNumbers),()=>W.assign($,G)));W.if(C._`${$} !== undefined`);for(let A of X)if(Zz.has(A)||A==="array"&&z.coerceTypes==="array")H(A);W.else(),hY(Q),W.endIf(),W.if(C._`${$} !== undefined`,()=>{W.assign(G,$),fK(Q,$)});function H(A){switch(A){case"string":W.elseIf(C._`${J} == "number" || ${J} == "boolean"`).assign($,C._`"" + ${G}`).elseIf(C._`${G} === null`).assign($,C._`""`);return;case"number":W.elseIf(C._`${J} == "boolean" || ${G} === null
|
|
1
|
+
var T5=Object.create;var{getPrototypeOf:S5,defineProperty:L6,getOwnPropertyNames:R5}=Object;var C5=Object.prototype.hasOwnProperty;function v5(Q){return this[Q]}var k5,x5,x9=(Q,Y,X)=>{var W=Q!=null&&typeof Q==="object";if(W){var G=Y?k5??=new WeakMap:x5??=new WeakMap,z=G.get(Q);if(z)return z}X=Q!=null?T5(S5(Q)):{};let J=Y||!Q||!Q.__esModule?L6(X,"default",{value:Q,enumerable:!0}):X;for(let $ of R5(Q))if(!C5.call(J,$))L6(J,$,{get:v5.bind(Q,$),enumerable:!0});if(W)G.set(Q,J);return J};var Z=(Q,Y)=>()=>(Y||Q((Y={exports:{}}).exports,Y),Y.exports);var _5=(Q)=>Q;function g5(Q,Y){this[Q]=_5.bind(null,Y)}var _9=(Q,Y)=>{for(var X in Y)L6(Q,X,{get:Y[X],enumerable:!0,configurable:!0,set:g5.bind(Y,X)})};var O4=Z((SG)=>{Object.defineProperty(SG,"__esModule",{value:!0});SG.regexpCode=SG.getEsmExportName=SG.getProperty=SG.safeStringify=SG.stringify=SG.strConcat=SG.addCodeArg=SG.str=SG._=SG.nil=SG._Code=SG.Name=SG.IDENTIFIER=SG._CodeOrName=void 0;class PQ{}SG._CodeOrName=PQ;SG.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class v1 extends PQ{constructor(Q){super();if(!SG.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}}}SG.Name=v1;class S0 extends PQ{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 v1)Y[X.str]=(Y[X.str]||0)+1;return Y},{})}}SG._Code=S0;SG.nil=new S0("");function EG(Q,...Y){let X=[Q[0]],W=0;while(W<Y.length)bY(X,Y[W]),X.push(Q[++W]);return new S0(X)}SG._=EG;var wY=new S0("+");function TG(Q,...Y){let X=[q4(Q[0])],W=0;while(W<Y.length)X.push(wY),bY(X,Y[W]),X.push(wY,q4(Q[++W]));return z3(X),new S0(X)}SG.str=TG;function bY(Q,Y){if(Y instanceof S0)Q.push(...Y._items);else if(Y instanceof v1)Q.push(Y);else Q.push(H3(Y))}SG.addCodeArg=bY;function z3(Q){let Y=1;while(Y<Q.length-1){if(Q[Y]===wY){let X=J3(Q[Y-1],Q[Y+1]);if(X!==void 0){Q.splice(Y-1,3,X);continue}Q[Y++]="+"}Y++}}function J3(Q,Y){if(Y==='""')return Q;if(Q==='""')return Y;if(typeof Q=="string"){if(Y instanceof v1||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 v1))return`"${Q}${Y.slice(1)}`;return}function $3(Q,Y){return Y.emptyStr()?Q:Q.emptyStr()?Y:TG`${Q}${Y}`}SG.strConcat=$3;function H3(Q){return typeof Q=="number"||typeof Q=="boolean"||Q===null?Q:q4(Array.isArray(Q)?Q.join(","):Q)}function A3(Q){return new S0(q4(Q))}SG.stringify=A3;function q4(Q){return JSON.stringify(Q).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}SG.safeStringify=q4;function U3(Q){return typeof Q=="string"&&SG.IDENTIFIER.test(Q)?new S0(`.${Q}`):EG`[${Q}]`}SG.getProperty=U3;function K3(Q){if(typeof Q=="string"&&SG.IDENTIFIER.test(Q))return new S0(`${Q}`);throw Error(`CodeGen: invalid export name: ${Q}, use explicit $id name mapping`)}SG.getEsmExportName=K3;function D3(Q){return new S0(Q.toString())}SG.regexpCode=D3});var EY=Z((kG)=>{Object.defineProperty(kG,"__esModule",{value:!0});kG.ValueScope=kG.ValueScopeName=kG.Scope=kG.varKinds=kG.UsedValueState=void 0;var F0=O4();class CG extends Error{constructor(Q){super(`CodeGen: "code" for ${Q} not defined`);this.value=Q.value}}var IQ;(function(Q){Q[Q.Started=0]="Started",Q[Q.Completed=1]="Completed"})(IQ||(kG.UsedValueState=IQ={}));kG.varKinds={const:new F0.Name("const"),let:new F0.Name("let"),var:new F0.Name("var")};class jY{constructor({prefixes:Q,parent:Y}={}){this._names={},this._prefixes=Q,this._parent=Y}toName(Q){return Q instanceof F0.Name?Q:this.name(Q)}name(Q){return new F0.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}}}kG.Scope=jY;class IY extends F0.Name{constructor(Q,Y){super(Y);this.prefix=Q}setValue(Q,{property:Y,itemIndex:X}){this.value=Q,this.scopePath=F0._`.${new F0.Name(Y)}[${X}]`}}kG.ValueScopeName=IY;var j3=F0._`\n`;class vG extends jY{constructor(Q){super(Q);this._values={},this._scope=Q.scope,this.opts={...Q,_n:Q.lines?j3:F0.nil}}get(){return this._scope}name(Q){return new IY(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,z=(X=Y.key)!==null&&X!==void 0?X:Y.ref,J=this._values[G];if(J){let A=J.get(z);if(A)return A}else J=this._values[G]=new Map;J.set(z,W);let $=this._scope[G]||(this._scope[G]=[]),H=$.length;return $[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 F0._`${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=F0.nil;for(let z in Q){let J=Q[z];if(!J)continue;let $=X[z]=X[z]||new Map;J.forEach((H)=>{if($.has(H))return;$.set(H,IQ.Started);let A=Y(H);if(A){let U=this.opts.es5?kG.varKinds.var:kG.varKinds.const;G=F0._`${G}${U} ${H} = ${A};${this.opts._n}`}else if(A=W===null||W===void 0?void 0:W(H))G=F0._`${G}${A}${this.opts._n}`;else throw new CG(H);$.set(H,IQ.Completed)})}return G}}kG.ValueScope=vG});var k=Z((q0)=>{Object.defineProperty(q0,"__esModule",{value:!0});q0.or=q0.and=q0.not=q0.CodeGen=q0.operators=q0.varKinds=q0.ValueScopeName=q0.ValueScope=q0.Scope=q0.Name=q0.regexpCode=q0.stringify=q0.getProperty=q0.nil=q0.strConcat=q0.str=q0._=void 0;var y=O4(),R0=EY(),G1=O4();Object.defineProperty(q0,"_",{enumerable:!0,get:function(){return G1._}});Object.defineProperty(q0,"str",{enumerable:!0,get:function(){return G1.str}});Object.defineProperty(q0,"strConcat",{enumerable:!0,get:function(){return G1.strConcat}});Object.defineProperty(q0,"nil",{enumerable:!0,get:function(){return G1.nil}});Object.defineProperty(q0,"getProperty",{enumerable:!0,get:function(){return G1.getProperty}});Object.defineProperty(q0,"stringify",{enumerable:!0,get:function(){return G1.stringify}});Object.defineProperty(q0,"regexpCode",{enumerable:!0,get:function(){return G1.regexpCode}});Object.defineProperty(q0,"Name",{enumerable:!0,get:function(){return G1.Name}});var vQ=EY();Object.defineProperty(q0,"Scope",{enumerable:!0,get:function(){return vQ.Scope}});Object.defineProperty(q0,"ValueScope",{enumerable:!0,get:function(){return vQ.ValueScope}});Object.defineProperty(q0,"ValueScopeName",{enumerable:!0,get:function(){return vQ.ValueScopeName}});Object.defineProperty(q0,"varKinds",{enumerable:!0,get:function(){return vQ.varKinds}});q0.operators={GT:new y._Code(">"),GTE:new y._Code(">="),LT:new y._Code("<"),LTE:new y._Code("<="),EQ:new y._Code("==="),NEQ:new y._Code("!=="),NOT:new y._Code("!"),OR:new y._Code("||"),AND:new y._Code("&&"),ADD:new y._Code("+")};class z1{optimizeNodes(){return this}optimizeNames(Q,Y){return this}}class _G extends z1{constructor(Q,Y,X){super();this.varKind=Q,this.name=Y,this.rhs=X}render({es5:Q,_n:Y}){let X=Q?R0.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=x1(this.rhs,Q,Y);return this}get names(){return this.rhs instanceof y._CodeOrName?this.rhs.names:{}}}class RY extends z1{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 y.Name&&!Q[this.lhs.str]&&!this.sideEffects)return;return this.rhs=x1(this.rhs,Q,Y),this}get names(){let Q=this.lhs instanceof y.Name?{}:{...this.lhs.names};return CQ(Q,this.rhs)}}class gG extends RY{constructor(Q,Y,X,W){super(Q,X,W);this.op=Y}render({_n:Q}){return`${this.lhs} ${this.op}= ${this.rhs};`+Q}}class yG extends z1{constructor(Q){super();this.label=Q,this.names={}}render({_n:Q}){return`${this.label}:`+Q}}class uG extends z1{constructor(Q){super();this.label=Q,this.names={}}render({_n:Q}){return`break${this.label?` ${this.label}`:""};`+Q}}class hG extends z1{constructor(Q){super();this.error=Q}render({_n:Q}){return`throw ${this.error};`+Q}get names(){return this.error.names}}class fG extends z1{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=x1(this.code,Q,Y),this}get names(){return this.code instanceof y._CodeOrName?this.code.names:{}}}class kQ extends z1{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;S3(Q,G.names),X.splice(W,1)}return X.length>0?this:void 0}get names(){return this.nodes.reduce((Q,Y)=>q1(Q,Y.names),{})}}class J1 extends kQ{render(Q){return"{"+Q._n+super.render(Q)+"}"+Q._n}}class lG extends kQ{}class M4 extends J1{}M4.kind="else";class i0 extends J1{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 M4(X):X}if(Y){if(Q===!1)return Y instanceof i0?Y:Y.nodes;if(this.nodes.length)return this;return new i0(rG(Q),Y instanceof i0?[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=x1(this.condition,Q,Y),this}get names(){let Q=super.names;if(CQ(Q,this.condition),this.else)q1(Q,this.else.names);return Q}}i0.kind="if";class k1 extends J1{}k1.kind="for";class mG extends k1{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=x1(this.iteration,Q,Y),this}get names(){return q1(super.names,this.iteration.names)}}class cG extends k1{constructor(Q,Y,X,W){super();this.varKind=Q,this.name=Y,this.from=X,this.to=W}render(Q){let Y=Q.es5?R0.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=CQ(super.names,this.from);return CQ(Q,this.to)}}class TY extends k1{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=x1(this.iterable,Q,Y),this}get names(){return q1(super.names,this.iterable.names)}}class EQ extends J1{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)}}EQ.kind="func";class TQ extends kQ{render(Q){return"return "+super.render(Q)}}TQ.kind="return";class pG extends J1{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)q1(Q,this.catch.names);if(this.finally)q1(Q,this.finally.names);return Q}}class SQ extends J1{constructor(Q){super();this.error=Q}render(Q){return`catch(${this.error})`+super.render(Q)}}SQ.kind="catch";class RQ extends J1{render(Q){return"finally"+super.render(Q)}}RQ.kind="finally";class iG{constructor(Q,Y={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...Y,_n:Y.lines?`
|
|
2
|
+
`:""},this._extScope=Q,this._scope=new R0.Scope({parent:Q}),this._nodes=[new lG]}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 _G(Q,G,X)),G}const(Q,Y,X){return this._def(R0.varKinds.const,Q,Y,X)}let(Q,Y,X){return this._def(R0.varKinds.let,Q,Y,X)}var(Q,Y,X){return this._def(R0.varKinds.var,Q,Y,X)}assign(Q,Y,X){return this._leafNode(new RY(Q,Y,X))}add(Q,Y){return this._leafNode(new gG(Q,q0.operators.ADD,Y))}code(Q){if(typeof Q=="function")Q();else if(Q!==y.nil)this._leafNode(new fG(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,y.addCodeArg)(Y,W)}return Y.push("}"),new y._Code(Y)}if(Q,Y,X){if(this._blockNode(new i0(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 i0(Q))}else(){return this._elseNode(new M4)}endIf(){return this._endBlockNode(i0,M4)}_for(Q,Y){if(this._blockNode(Q),Y)this.code(Y).endFor();return this}for(Q,Y){return this._for(new mG(Q),Y)}forRange(Q,Y,X,W,G=this.opts.es5?R0.varKinds.var:R0.varKinds.let){let z=this._scope.toName(Q);return this._for(new cG(G,z,Y,X),()=>W(z))}forOf(Q,Y,X,W=R0.varKinds.const){let G=this._scope.toName(Q);if(this.opts.es5){let z=Y instanceof y.Name?Y:this.var("_arr",Y);return this.forRange("_i",0,y._`${z}.length`,(J)=>{this.var(G,y._`${z}[${J}]`),X(G)})}return this._for(new TY("of",W,G,Y),()=>X(G))}forIn(Q,Y,X,W=this.opts.es5?R0.varKinds.var:R0.varKinds.const){if(this.opts.ownProperties)return this.forOf(Q,y._`Object.keys(${Y})`,X);let G=this._scope.toName(Q);return this._for(new TY("in",W,G,Y),()=>X(G))}endFor(){return this._endBlockNode(k1)}label(Q){return this._leafNode(new yG(Q))}break(Q){return this._leafNode(new uG(Q))}return(Q){let Y=new TQ;if(this._blockNode(Y),this.code(Q),Y.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(TQ)}try(Q,Y,X){if(!Y&&!X)throw Error('CodeGen: "try" without "catch" and "finally"');let W=new pG;if(this._blockNode(W),this.code(Q),Y){let G=this.name("e");this._currNode=W.catch=new SQ(G),Y(G)}if(X)this._currNode=W.finally=new RQ,this.code(X);return this._endBlockNode(SQ,RQ)}throw(Q){return this._leafNode(new hG(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=y.nil,X,W){if(this._blockNode(new EQ(Q,Y,X)),W)this.code(W).endFunc();return this}endFunc(){return this._endBlockNode(EQ)}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 i0))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}}q0.CodeGen=iG;function q1(Q,Y){for(let X in Y)Q[X]=(Q[X]||0)+(Y[X]||0);return Q}function CQ(Q,Y){return Y instanceof y._CodeOrName?q1(Q,Y.names):Q}function x1(Q,Y,X){if(Q instanceof y.Name)return W(Q);if(!G(Q))return Q;return new y._Code(Q._items.reduce((z,J)=>{if(J instanceof y.Name)J=W(J);if(J instanceof y._Code)z.push(...J._items);else z.push(J);return z},[]));function W(z){let J=X[z.str];if(J===void 0||Y[z.str]!==1)return z;return delete Y[z.str],J}function G(z){return z instanceof y._Code&&z._items.some((J)=>J instanceof y.Name&&Y[J.str]===1&&X[J.str]!==void 0)}}function S3(Q,Y){for(let X in Y)Q[X]=(Q[X]||0)-(Y[X]||0)}function rG(Q){return typeof Q=="boolean"||typeof Q=="number"||Q===null?!Q:y._`!${SY(Q)}`}q0.not=rG;var R3=nG(q0.operators.AND);function C3(...Q){return Q.reduce(R3)}q0.and=C3;var v3=nG(q0.operators.OR);function k3(...Q){return Q.reduce(v3)}q0.or=k3;function nG(Q){return(Y,X)=>Y===y.nil?X:X===y.nil?Y:y._`${SY(Y)} ${Q} ${SY(X)}`}function SY(Q){return Q instanceof y.Name?Q:y._`(${Q})`}});var f=Z((Xz)=>{Object.defineProperty(Xz,"__esModule",{value:!0});Xz.checkStrictMode=Xz.getErrorPath=Xz.Type=Xz.useFunc=Xz.setEvaluated=Xz.evaluatedPropsToName=Xz.mergeEvaluated=Xz.eachItem=Xz.unescapeJsonPointer=Xz.escapeJsonPointer=Xz.escapeFragment=Xz.unescapeFragment=Xz.schemaRefOrVal=Xz.schemaHasRulesButRef=Xz.schemaHasRules=Xz.checkUnknownRules=Xz.alwaysValidSchema=Xz.toHash=void 0;var c=k(),y3=O4();function u3(Q){let Y={};for(let X of Q)Y[X]=!0;return Y}Xz.toHash=u3;function h3(Q,Y){if(typeof Y=="boolean")return Y;if(Object.keys(Y).length===0)return!0;return aG(Q,Y),!sG(Y,Q.self.RULES.all)}Xz.alwaysValidSchema=h3;function aG(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 z in Y)if(!G[z])Yz(Q,`unknown keyword: "${z}"`)}Xz.checkUnknownRules=aG;function sG(Q,Y){if(typeof Q=="boolean")return!Q;for(let X in Q)if(Y[X])return!0;return!1}Xz.schemaHasRules=sG;function f3(Q,Y){if(typeof Q=="boolean")return!Q;for(let X in Q)if(X!=="$ref"&&Y.all[X])return!0;return!1}Xz.schemaHasRulesButRef=f3;function l3({topSchemaRef:Q,schemaPath:Y},X,W,G){if(!G){if(typeof X=="number"||typeof X=="boolean")return X;if(typeof X=="string")return c._`${X}`}return c._`${Q}${Y}${(0,c.getProperty)(W)}`}Xz.schemaRefOrVal=l3;function m3(Q){return eG(decodeURIComponent(Q))}Xz.unescapeFragment=m3;function c3(Q){return encodeURIComponent(vY(Q))}Xz.escapeFragment=c3;function vY(Q){if(typeof Q=="number")return`${Q}`;return Q.replace(/~/g,"~0").replace(/\//g,"~1")}Xz.escapeJsonPointer=vY;function eG(Q){return Q.replace(/~1/g,"/").replace(/~0/g,"~")}Xz.unescapeJsonPointer=eG;function p3(Q,Y){if(Array.isArray(Q))for(let X of Q)Y(X);else Y(Q)}Xz.eachItem=p3;function oG({mergeNames:Q,mergeToName:Y,mergeValues:X,resultToName:W}){return(G,z,J,$)=>{let H=J===void 0?z:J instanceof c.Name?(z instanceof c.Name?Q(G,z,J):Y(G,z,J),J):z instanceof c.Name?(Y(G,J,z),z):X(z,J);return $===c.Name&&!(H instanceof c.Name)?W(G,H):H}}Xz.mergeEvaluated={props:oG({mergeNames:(Q,Y,X)=>Q.if(c._`${X} !== true && ${Y} !== undefined`,()=>{Q.if(c._`${Y} === true`,()=>Q.assign(X,!0),()=>Q.assign(X,c._`${X} || {}`).code(c._`Object.assign(${X}, ${Y})`))}),mergeToName:(Q,Y,X)=>Q.if(c._`${X} !== true`,()=>{if(Y===!0)Q.assign(X,!0);else Q.assign(X,c._`${X} || {}`),kY(Q,X,Y)}),mergeValues:(Q,Y)=>Q===!0?!0:{...Q,...Y},resultToName:Qz}),items:oG({mergeNames:(Q,Y,X)=>Q.if(c._`${X} !== true && ${Y} !== undefined`,()=>Q.assign(X,c._`${Y} === true ? true : ${X} > ${Y} ? ${X} : ${Y}`)),mergeToName:(Q,Y,X)=>Q.if(c._`${X} !== true`,()=>Q.assign(X,Y===!0?!0:c._`${X} > ${Y} ? ${X} : ${Y}`)),mergeValues:(Q,Y)=>Q===!0?!0:Math.max(Q,Y),resultToName:(Q,Y)=>Q.var("items",Y)})};function Qz(Q,Y){if(Y===!0)return Q.var("props",!0);let X=Q.var("props",c._`{}`);if(Y!==void 0)kY(Q,X,Y);return X}Xz.evaluatedPropsToName=Qz;function kY(Q,Y,X){Object.keys(X).forEach((W)=>Q.assign(c._`${Y}${(0,c.getProperty)(W)}`,!0))}Xz.setEvaluated=kY;var tG={};function i3(Q,Y){return Q.scopeValue("func",{ref:Y,code:tG[Y.code]||(tG[Y.code]=new y3._Code(Y.code))})}Xz.useFunc=i3;var CY;(function(Q){Q[Q.Num=0]="Num",Q[Q.Str=1]="Str"})(CY||(Xz.Type=CY={}));function r3(Q,Y,X){if(Q instanceof c.Name){let W=Y===CY.Num;return X?W?c._`"[" + ${Q} + "]"`:c._`"['" + ${Q} + "']"`:W?c._`"/" + ${Q}`:c._`"/" + ${Q}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return X?(0,c.getProperty)(Q).toString():"/"+vY(Q)}Xz.getErrorPath=r3;function Yz(Q,Y,X=Q.opts.strictSchema){if(!X)return;if(Y=`strict mode: ${Y}`,X===!0)throw Error(Y);Q.self.logger.warn(Y)}Xz.checkStrictMode=Yz});var r0=Z((Gz)=>{Object.defineProperty(Gz,"__esModule",{value:!0});var A0=k(),UK={data:new A0.Name("data"),valCxt:new A0.Name("valCxt"),instancePath:new A0.Name("instancePath"),parentData:new A0.Name("parentData"),parentDataProperty:new A0.Name("parentDataProperty"),rootData:new A0.Name("rootData"),dynamicAnchors:new A0.Name("dynamicAnchors"),vErrors:new A0.Name("vErrors"),errors:new A0.Name("errors"),this:new A0.Name("this"),self:new A0.Name("self"),scope:new A0.Name("scope"),json:new A0.Name("json"),jsonPos:new A0.Name("jsonPos"),jsonLen:new A0.Name("jsonLen"),jsonPart:new A0.Name("jsonPart")};Gz.default=UK});var V4=Z((Hz)=>{Object.defineProperty(Hz,"__esModule",{value:!0});Hz.extendErrors=Hz.resetErrorsCount=Hz.reportExtraError=Hz.reportError=Hz.keyword$DataError=Hz.keywordError=void 0;var u=k(),_Q=f(),K0=r0();Hz.keywordError={message:({keyword:Q})=>u.str`must pass "${Q}" keyword validation`};Hz.keyword$DataError={message:({keyword:Q,schemaType:Y})=>Y?u.str`"${Q}" keyword must be ${Y} ($data)`:u.str`"${Q}" keyword is invalid ($data)`};function DK(Q,Y=Hz.keywordError,X,W){let{it:G}=Q,{gen:z,compositeRule:J,allErrors:$}=G,H=$z(Q,Y,X);if(W!==null&&W!==void 0?W:J||$)zz(z,H);else Jz(G,u._`[${H}]`)}Hz.reportError=DK;function BK(Q,Y=Hz.keywordError,X){let{it:W}=Q,{gen:G,compositeRule:z,allErrors:J}=W,$=$z(Q,Y,X);if(zz(G,$),!(z||J))Jz(W,K0.default.vErrors)}Hz.reportExtraError=BK;function LK(Q,Y){Q.assign(K0.default.errors,Y),Q.if(u._`${K0.default.vErrors} !== null`,()=>Q.if(Y,()=>Q.assign(u._`${K0.default.vErrors}.length`,Y),()=>Q.assign(K0.default.vErrors,null)))}Hz.resetErrorsCount=LK;function FK({gen:Q,keyword:Y,schemaValue:X,data:W,errsCount:G,it:z}){if(G===void 0)throw Error("ajv implementation error");let J=Q.name("err");Q.forRange("i",G,K0.default.errors,($)=>{if(Q.const(J,u._`${K0.default.vErrors}[${$}]`),Q.if(u._`${J}.instancePath === undefined`,()=>Q.assign(u._`${J}.instancePath`,(0,u.strConcat)(K0.default.instancePath,z.errorPath))),Q.assign(u._`${J}.schemaPath`,u.str`${z.errSchemaPath}/${Y}`),z.opts.verbose)Q.assign(u._`${J}.schema`,X),Q.assign(u._`${J}.data`,W)})}Hz.extendErrors=FK;function zz(Q,Y){let X=Q.const("err",Y);Q.if(u._`${K0.default.vErrors} === null`,()=>Q.assign(K0.default.vErrors,u._`[${X}]`),u._`${K0.default.vErrors}.push(${X})`),Q.code(u._`${K0.default.errors}++`)}function Jz(Q,Y){let{gen:X,validateName:W,schemaEnv:G}=Q;if(G.$async)X.throw(u._`new ${Q.ValidationError}(${Y})`);else X.assign(u._`${W}.errors`,Y),X.return(!1)}var O1={keyword:new u.Name("keyword"),schemaPath:new u.Name("schemaPath"),params:new u.Name("params"),propertyName:new u.Name("propertyName"),message:new u.Name("message"),schema:new u.Name("schema"),parentSchema:new u.Name("parentSchema")};function $z(Q,Y,X){let{createErrors:W}=Q.it;if(W===!1)return u._`{}`;return qK(Q,Y,X)}function qK(Q,Y,X={}){let{gen:W,it:G}=Q,z=[OK(G,X),MK(Q,X)];return VK(Q,Y,z),W.object(...z)}function OK({errorPath:Q},{instancePath:Y}){let X=Y?u.str`${Q}${(0,_Q.getErrorPath)(Y,_Q.Type.Str)}`:Q;return[K0.default.instancePath,(0,u.strConcat)(K0.default.instancePath,X)]}function MK({keyword:Q,it:{errSchemaPath:Y}},{schemaPath:X,parentSchema:W}){let G=W?Y:u.str`${Y}/${Q}`;if(X)G=u.str`${G}${(0,_Q.getErrorPath)(X,_Q.Type.Str)}`;return[O1.schemaPath,G]}function VK(Q,{params:Y,message:X},W){let{keyword:G,data:z,schemaValue:J,it:$}=Q,{opts:H,propertyName:A,topSchemaRef:U,schemaPath:K}=$;if(W.push([O1.keyword,G],[O1.params,typeof Y=="function"?Y(Q):Y||u._`{}`]),H.messages)W.push([O1.message,typeof X=="function"?X(Q):X]);if(H.verbose)W.push([O1.schema,J],[O1.parentSchema,u._`${U}${K}`],[K0.default.data,z]);if(A)W.push([O1.propertyName,A])}});var Bz=Z((Kz)=>{Object.defineProperty(Kz,"__esModule",{value:!0});Kz.boolOrEmptySchema=Kz.topBoolOrEmptySchema=void 0;var PK=V4(),jK=k(),IK=r0(),EK={message:"boolean schema is false"};function TK(Q){let{gen:Y,schema:X,validateName:W}=Q;if(X===!1)Uz(Q,!1);else if(typeof X=="object"&&X.$async===!0)Y.return(IK.default.data);else Y.assign(jK._`${W}.errors`,null),Y.return(!0)}Kz.topBoolOrEmptySchema=TK;function SK(Q,Y){let{gen:X,schema:W}=Q;if(W===!1)X.var(Y,!1),Uz(Q);else X.var(Y,!0)}Kz.boolOrEmptySchema=SK;function Uz(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,PK.reportError)(G,EK,void 0,Y)}});var _Y=Z((Lz)=>{Object.defineProperty(Lz,"__esModule",{value:!0});Lz.getRules=Lz.isJSONType=void 0;var CK=["string","number","integer","boolean","null","object","array"],vK=new Set(CK);function kK(Q){return typeof Q=="string"&&vK.has(Q)}Lz.isJSONType=kK;function xK(){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:{}}}Lz.getRules=xK});var gY=Z((Mz)=>{Object.defineProperty(Mz,"__esModule",{value:!0});Mz.shouldUseRule=Mz.shouldUseGroup=Mz.schemaHasRulesForType=void 0;function gK({schema:Q,self:Y},X){let W=Y.RULES.types[X];return W&&W!==!0&&qz(Q,W)}Mz.schemaHasRulesForType=gK;function qz(Q,Y){return Y.rules.some((X)=>Oz(Q,X))}Mz.shouldUseGroup=qz;function Oz(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))}Mz.shouldUseRule=Oz});var N4=Z((bz)=>{Object.defineProperty(bz,"__esModule",{value:!0});bz.reportTypeError=bz.checkDataTypes=bz.checkDataType=bz.coerceAndCheckDataType=bz.getJSONTypes=bz.getSchemaTypes=bz.DataType=void 0;var hK=_Y(),fK=gY(),lK=V4(),C=k(),Nz=f(),_1;(function(Q){Q[Q.Correct=0]="Correct",Q[Q.Wrong=1]="Wrong"})(_1||(bz.DataType=_1={}));function mK(Q){let Y=Zz(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}bz.getSchemaTypes=mK;function Zz(Q){let Y=Array.isArray(Q)?Q:Q?[Q]:[];if(Y.every(hK.isJSONType))return Y;throw Error("type must be JSONType or JSONType[]: "+Y.join(","))}bz.getJSONTypes=Zz;function cK(Q,Y){let{gen:X,data:W,opts:G}=Q,z=pK(Y,G.coerceTypes),J=Y.length>0&&!(z.length===0&&Y.length===1&&(0,fK.schemaHasRulesForType)(Q,Y[0]));if(J){let $=uY(Y,W,G.strictNumbers,_1.Wrong);X.if($,()=>{if(z.length)iK(Q,Y,z);else hY(Q)})}return J}bz.coerceAndCheckDataType=cK;var wz=new Set(["string","number","integer","boolean","null"]);function pK(Q,Y){return Y?Q.filter((X)=>wz.has(X)||Y==="array"&&X==="array"):[]}function iK(Q,Y,X){let{gen:W,data:G,opts:z}=Q,J=W.let("dataType",C._`typeof ${G}`),$=W.let("coerced",C._`undefined`);if(z.coerceTypes==="array")W.if(C._`${J} == 'object' && Array.isArray(${G}) && ${G}.length == 1`,()=>W.assign(G,C._`${G}[0]`).assign(J,C._`typeof ${G}`).if(uY(Y,G,z.strictNumbers),()=>W.assign($,G)));W.if(C._`${$} !== undefined`);for(let A of X)if(wz.has(A)||A==="array"&&z.coerceTypes==="array")H(A);W.else(),hY(Q),W.endIf(),W.if(C._`${$} !== undefined`,()=>{W.assign(G,$),rK(Q,$)});function H(A){switch(A){case"string":W.elseIf(C._`${J} == "number" || ${J} == "boolean"`).assign($,C._`"" + ${G}`).elseIf(C._`${G} === null`).assign($,C._`""`);return;case"number":W.elseIf(C._`${J} == "boolean" || ${G} === null
|
|
3
3
|
|| (${J} == "string" && ${G} && ${G} == +${G})`).assign($,C._`+${G}`);return;case"integer":W.elseIf(C._`${J} === "boolean" || ${G} === null
|
|
4
4
|
|| (${J} === "string" && ${G} && ${G} == +${G} && !(${G} % 1))`).assign($,C._`+${G}`);return;case"boolean":W.elseIf(C._`${G} === "false" || ${G} === 0 || ${G} === null`).assign($,!1).elseIf(C._`${G} === "true" || ${G} === 1`).assign($,!0);return;case"null":W.elseIf(C._`${G} === "" || ${G} === 0 || ${G} === false`),W.assign($,null);return;case"array":W.elseIf(C._`${J} === "string" || ${J} === "number"
|
|
5
|
-
|| ${J} === "boolean" || ${G} === null`).assign($,C._`[${G}]`)}}}function fK({gen:Q,parentData:Y,parentDataProperty:X},W){Q.if(C._`${Y} !== undefined`,()=>Q.assign(C._`${Y}[${X}]`,W))}function yY(Q,Y,X,W=_1.Correct){let G=W===_1.Correct?C.operators.EQ:C.operators.NEQ,z;switch(Q){case"null":return C._`${Y} ${G} null`;case"array":z=C._`Array.isArray(${Y})`;break;case"object":z=C._`${Y} && typeof ${Y} == "object" && !Array.isArray(${Y})`;break;case"integer":z=J(C._`!(${Y} % 1) && !isNaN(${Y})`);break;case"number":z=J();break;default:return C._`typeof ${Y} ${G} ${Q}`}return W===_1.Correct?z:(0,C.not)(z);function J($=C.nil){return(0,C.and)(C._`typeof ${Y} == "number"`,$,X?C._`isFinite(${Y})`:C.nil)}}wz.checkDataType=yY;function uY(Q,Y,X,W){if(Q.length===1)return yY(Q[0],Y,X,W);let G,z=(0,Vz.toHash)(Q);if(z.array&&z.object){let J=C._`typeof ${Y} != "object"`;G=z.null?J:C._`!${Y} || ${J}`,delete z.null,delete z.array,delete z.object}else G=C.nil;if(z.number)delete z.integer;for(let J in z)G=(0,C.and)(G,yY(J,Y,X,W));return G}wz.checkDataTypes=uY;var lK={message:({schema:Q})=>`must be ${Q}`,params:({schema:Q,schemaValue:Y})=>typeof Q=="string"?C._`{type: ${Q}}`:C._`{type: ${Y}}`};function hY(Q){let Y=mK(Q);(0,_K.reportError)(Y,lK)}wz.reportTypeError=hY;function mK(Q){let{gen:Y,data:X,schema:W}=Q,G=(0,Vz.schemaRefOrVal)(Q,W,"type");return{gen:Y,keyword:"type",data:X,schema:W.type,schemaCode:G,schemaValue:G,parentSchema:W,params:{},it:Q}}});var Ez=Z((jz)=>{Object.defineProperty(jz,"__esModule",{value:!0});jz.assignDefaults=void 0;var g1=k(),oK=f();function tK(Q,Y){let{properties:X,items:W}=Q.schema;if(Y==="object"&&X)for(let G in X)Pz(Q,G,X[G].default);else if(Y==="array"&&Array.isArray(W))W.forEach((G,z)=>Pz(Q,z,G.default))}jz.assignDefaults=tK;function Pz(Q,Y,X){let{gen:W,compositeRule:G,data:z,opts:J}=Q;if(X===void 0)return;let $=g1._`${z}${(0,g1.getProperty)(Y)}`;if(G){(0,oK.checkStrictMode)(Q,`default is ignored for: ${$}`);return}let H=g1._`${$} === undefined`;if(J.useDefaults==="empty")H=g1._`${H} || ${$} === null || ${$} === ""`;W.if(H,g1._`${$} = ${(0,g1.stringify)(X)}`)}});var j0=Z((Rz)=>{Object.defineProperty(Rz,"__esModule",{value:!0});Rz.validateUnion=Rz.validateArray=Rz.usePattern=Rz.callValidateCode=Rz.schemaProperties=Rz.allSchemaProperties=Rz.noPropertyInData=Rz.propertyInData=Rz.isOwnProperty=Rz.hasPropFunc=Rz.reportMissingProp=Rz.checkMissingProp=Rz.checkReportMissingProp=void 0;var n=k(),fY=f(),$1=r0(),aK=f();function sK(Q,Y){let{gen:X,data:W,it:G}=Q;X.if(mY(X,W,Y,G.opts.ownProperties),()=>{Q.setParams({missingProperty:n._`${Y}`},!0),Q.error()})}Rz.checkReportMissingProp=sK;function eK({gen:Q,data:Y,it:{opts:X}},W,G){return(0,n.or)(...W.map((z)=>(0,n.and)(mY(Q,Y,z,X.ownProperties),n._`${G} = ${z}`)))}Rz.checkMissingProp=eK;function QD(Q,Y){Q.setParams({missingProperty:Y},!0),Q.error()}Rz.reportMissingProp=QD;function Tz(Q){return Q.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:n._`Object.prototype.hasOwnProperty`})}Rz.hasPropFunc=Tz;function lY(Q,Y,X){return n._`${Tz(Q)}.call(${Y}, ${X})`}Rz.isOwnProperty=lY;function YD(Q,Y,X,W){let G=n._`${Y}${(0,n.getProperty)(X)} !== undefined`;return W?n._`${G} && ${lY(Q,Y,X)}`:G}Rz.propertyInData=YD;function mY(Q,Y,X,W){let G=n._`${Y}${(0,n.getProperty)(X)} === undefined`;return W?(0,n.or)(G,(0,n.not)(lY(Q,Y,X))):G}Rz.noPropertyInData=mY;function Sz(Q){return Q?Object.keys(Q).filter((Y)=>Y!=="__proto__"):[]}Rz.allSchemaProperties=Sz;function XD(Q,Y){return Sz(Y).filter((X)=>!(0,fY.alwaysValidSchema)(Q,Y[X]))}Rz.schemaProperties=XD;function WD({schemaCode:Q,data:Y,it:{gen:X,topSchemaRef:W,schemaPath:G,errorPath:z},it:J},$,H,A){let U=A?n._`${Q}, ${Y}, ${W}${G}`:Y,K=[[$1.default.instancePath,(0,n.strConcat)($1.default.instancePath,z)],[$1.default.parentData,J.parentData],[$1.default.parentDataProperty,J.parentDataProperty],[$1.default.rootData,$1.default.rootData]];if(J.opts.dynamicRef)K.push([$1.default.dynamicAnchors,$1.default.dynamicAnchors]);let D=n._`${U}, ${X.object(...K)}`;return H!==n.nil?n._`${$}.call(${H}, ${D})`:n._`${$}(${D})`}Rz.callValidateCode=WD;var GD=n._`new RegExp`;function zD({gen:Q,it:{opts:Y}},X){let W=Y.unicodeRegExp?"u":"",{regExp:G}=Y.code,z=G(X,W);return Q.scopeValue("pattern",{key:z.toString(),ref:z,code:n._`${G.code==="new RegExp"?GD:(0,aK.useFunc)(Q,G)}(${X}, ${W})`})}Rz.usePattern=zD;function JD(Q){let{gen:Y,data:X,keyword:W,it:G}=Q,z=Y.name("valid");if(G.allErrors){let $=Y.let("valid",!0);return J(()=>Y.assign($,!1)),$}return Y.var(z,!0),J(()=>Y.break()),z;function J($){let H=Y.const("len",n._`${X}.length`);Y.forRange("i",0,H,(A)=>{Q.subschema({keyword:W,dataProp:A,dataPropType:fY.Type.Num},z),Y.if((0,n.not)(z),$)})}}Rz.validateArray=JD;function $D(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,fY.alwaysValidSchema)(G,H))&&!G.opts.unevaluated)return;let J=Y.let("valid",!1),$=Y.name("_valid");Y.block(()=>X.forEach((H,A)=>{let U=Q.subschema({keyword:W,schemaProp:A,compositeRule:!0},$);if(Y.assign(J,n._`${J} || ${$}`),!Q.mergeValidEvaluated(U,$))Y.if((0,n.not)(J))})),Q.result(J,()=>Q.reset(),()=>Q.error(!0))}Rz.validateUnion=$D});var gz=Z((xz)=>{Object.defineProperty(xz,"__esModule",{value:!0});xz.validateKeywordUsage=xz.validSchemaType=xz.funcKeywordCode=xz.macroKeywordCode=void 0;var D0=k(),M1=r0(),ND=j0(),ZD=V4();function wD(Q,Y){let{gen:X,keyword:W,schema:G,parentSchema:z,it:J}=Q,$=Y.macro.call(J.self,G,z,J),H=kz(X,W,$);if(J.opts.validateSchema!==!1)J.self.validateSchema($,!0);let A=X.name("valid");Q.subschema({schema:$,schemaPath:D0.nil,errSchemaPath:`${J.errSchemaPath}/${W}`,topSchemaRef:H,compositeRule:!0},A),Q.pass(A,()=>Q.error(!0))}xz.macroKeywordCode=wD;function bD(Q,Y){var X;let{gen:W,keyword:G,schema:z,parentSchema:J,$data:$,it:H}=Q;jD(H,Y);let A=!$&&Y.compile?Y.compile.call(H.self,z,J,H):Y.validate,U=kz(W,G,A),K=W.let("valid");Q.block$data(K,D),Q.ok((X=Y.valid)!==null&&X!==void 0?X:K);function D(){if(Y.errors===!1){if(O(),Y.modifying)vz(Q);V(()=>Q.error())}else{let M=Y.async?L():q();if(Y.modifying)vz(Q);V(()=>PD(Q,M))}}function L(){let M=W.let("ruleErrs",null);return W.try(()=>O(D0._`await `),(S)=>W.assign(K,!1).if(D0._`${S} instanceof ${H.ValidationError}`,()=>W.assign(M,D0._`${S}.errors`),()=>W.throw(S))),M}function q(){let M=D0._`${U}.errors`;return W.assign(M,null),O(D0.nil),M}function O(M=Y.async?D0._`await `:D0.nil){let S=H.opts.passContext?M1.default.this:M1.default.self,E=!(("compile"in Y)&&!$||Y.schema===!1);W.assign(K,D0._`${M}${(0,ND.callValidateCode)(Q,U,S,E)}`,Y.modifying)}function V(M){var S;W.if((0,D0.not)((S=Y.valid)!==null&&S!==void 0?S:K),M)}}xz.funcKeywordCode=bD;function vz(Q){let{gen:Y,data:X,it:W}=Q;Y.if(W.parentData,()=>Y.assign(X,D0._`${W.parentData}[${W.parentDataProperty}]`))}function PD(Q,Y){let{gen:X}=Q;X.if(D0._`Array.isArray(${Y})`,()=>{X.assign(M1.default.vErrors,D0._`${M1.default.vErrors} === null ? ${Y} : ${M1.default.vErrors}.concat(${Y})`).assign(M1.default.errors,D0._`${M1.default.vErrors}.length`),(0,ZD.extendErrors)(Q)},()=>Q.error())}function jD({schemaEnv:Q},Y){if(Y.async&&!Q.$async)throw Error("async keyword in sync schema")}function kz(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,D0.stringify)(X)})}function ID(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=ID;function ED({schema:Q,opts:Y,self:X,errSchemaPath:W},G,z){if(Array.isArray(G.keyword)?!G.keyword.includes(z):G.keyword!==z)throw Error("ajv implementation error");let J=G.dependencies;if(J===null||J===void 0?void 0:J.some(($)=>!Object.prototype.hasOwnProperty.call(Q,$)))throw Error(`parent schema must have dependencies of ${z}: ${J.join(",")}`);if(G.validateSchema){if(!G.validateSchema(Q[z])){let H=`keyword "${z}" 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=ED});var fz=Z((uz)=>{Object.defineProperty(uz,"__esModule",{value:!0});uz.extendSubschemaMode=uz.extendSubschemaData=uz.getSubschema=void 0;var g0=k(),yz=f();function CD(Q,{keyword:Y,schemaProp:X,schema:W,schemaPath:G,errSchemaPath:z,topSchemaRef:J}){if(Y!==void 0&&W!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(Y!==void 0){let $=Q.schema[Y];return X===void 0?{schema:$,schemaPath:g0._`${Q.schemaPath}${(0,g0.getProperty)(Y)}`,errSchemaPath:`${Q.errSchemaPath}/${Y}`}:{schema:$[X],schemaPath:g0._`${Q.schemaPath}${(0,g0.getProperty)(Y)}${(0,g0.getProperty)(X)}`,errSchemaPath:`${Q.errSchemaPath}/${Y}/${(0,yz.escapeFragment)(X)}`}}if(W!==void 0){if(G===void 0||z===void 0||J===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:W,schemaPath:G,topSchemaRef:J,errSchemaPath:z}}throw Error('either "keyword" or "schema" must be passed')}uz.getSubschema=CD;function vD(Q,Y,{dataProp:X,dataPropType:W,data:G,dataTypes:z,propertyName:J}){if(G!==void 0&&X!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:$}=Y;if(X!==void 0){let{errorPath:A,dataPathArr:U,opts:K}=Y,D=$.let("data",g0._`${Y.data}${(0,g0.getProperty)(X)}`,!0);H(D),Q.errorPath=g0.str`${A}${(0,yz.getErrorPath)(X,W,K.jsPropertySyntax)}`,Q.parentDataProperty=g0._`${X}`,Q.dataPathArr=[...U,Q.parentDataProperty]}if(G!==void 0){let A=G instanceof g0.Name?G:$.let("data",G,!0);if(H(A),J!==void 0)Q.propertyName=J}if(z)Q.dataTypes=z;function H(A){Q.data=A,Q.dataLevel=Y.dataLevel+1,Q.dataTypes=[],Y.definedProperties=new Set,Q.parentData=Y.data,Q.dataNames=[...Y.dataNames,A]}}uz.extendSubschemaData=vD;function kD(Q,{jtdDiscriminator:Y,jtdMetadata:X,compositeRule:W,createErrors:G,allErrors:z}){if(W!==void 0)Q.compositeRule=W;if(G!==void 0)Q.createErrors=G;if(z!==void 0)Q.allErrors=z;Q.jtdDiscriminator=Y,Q.jtdMetadata=X}uz.extendSubschemaMode=kD});var cY=Z((mP,lz)=>{lz.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,z;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(z=Object.keys(Y),W=z.length,W!==Object.keys(X).length)return!1;for(G=W;G--!==0;)if(!Object.prototype.hasOwnProperty.call(X,z[G]))return!1;for(G=W;G--!==0;){var J=z[G];if(!Q(Y[J],X[J]))return!1}return!0}return Y!==Y&&X!==X}});var cz=Z((cP,mz)=>{var H1=mz.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(){};g6(Y,W,G,Q,"",Q)};H1.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};H1.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};H1.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};H1.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function g6(Q,Y,X,W,G,z,J,$,H,A){if(W&&typeof W=="object"&&!Array.isArray(W)){Y(W,G,z,J,$,H,A);for(var U in W){var K=W[U];if(Array.isArray(K)){if(U in H1.arrayKeywords)for(var D=0;D<K.length;D++)g6(Q,Y,X,K[D],G+"/"+U+"/"+D,z,G,U,W,D)}else if(U in H1.propsKeywords){if(K&&typeof K=="object")for(var L in K)g6(Q,Y,X,K[L],G+"/"+U+"/"+gD(L),z,G,U,W,L)}else if(U in H1.keywords||Q.allKeys&&!(U in H1.skipKeywords))g6(Q,Y,X,K,G+"/"+U,z,G,U,W)}X(W,G,z,J,$,H,A)}}function gD(Q){return Q.replace(/~/g,"~0").replace(/\//g,"~1")}});var Z4=Z((nz)=>{Object.defineProperty(nz,"__esModule",{value:!0});nz.getSchemaRefs=nz.resolveUrl=nz.normalizeId=nz._getFullPath=nz.getFullPath=nz.inlineRef=void 0;var yD=f(),uD=cY(),hD=cz(),fD=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function lD(Q,Y=!0){if(typeof Q=="boolean")return!0;if(Y===!0)return!pY(Q);if(!Y)return!1;return pz(Q)<=Y}nz.inlineRef=lD;var mD=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function pY(Q){for(let Y in Q){if(mD.has(Y))return!0;let X=Q[Y];if(Array.isArray(X)&&X.some(pY))return!0;if(typeof X=="object"&&pY(X))return!0}return!1}function pz(Q){let Y=0;for(let X in Q){if(X==="$ref")return 1/0;if(Y++,fD.has(X))continue;if(typeof Q[X]=="object")(0,yD.eachItem)(Q[X],(W)=>Y+=pz(W));if(Y===1/0)return 1/0}return Y}function iz(Q,Y="",X){if(X!==!1)Y=y1(Y);let W=Q.parse(Y);return rz(Q,W)}nz.getFullPath=iz;function rz(Q,Y){return Q.serialize(Y).split("#")[0]+"#"}nz._getFullPath=rz;var cD=/#\/?$/;function y1(Q){return Q?Q.replace(cD,""):""}nz.normalizeId=y1;function pD(Q,Y,X){return X=y1(X),Q.resolve(Y,X)}nz.resolveUrl=pD;var iD=/^[a-z_][-a-z0-9._]*$/i;function rD(Q,Y){if(typeof Q=="boolean")return{};let{schemaId:X,uriResolver:W}=this.opts,G=y1(Q[X]||Y),z={"":G},J=iz(W,G,!1),$={},H=new Set;return hD(Q,{allKeys:!0},(K,D,L,q)=>{if(q===void 0)return;let O=J+D,V=z[q];if(typeof K[X]=="string")V=M.call(this,K[X]);S.call(this,K.$anchor),S.call(this,K.$dynamicAnchor),z[D]=V;function M(E){let x=this.opts.uriResolver.resolve;if(E=y1(V?x(V,E):E),H.has(E))throw U(E);H.add(E);let T=this.refs[E];if(typeof T=="string")T=this.refs[T];if(typeof T=="object")A(K,T.schema,E);else if(E!==y1(O))if(E[0]==="#")A(K,$[E],E),$[E]=K;else this.refs[E]=O;return E}function S(E){if(typeof E=="string"){if(!iD.test(E))throw Error(`invalid anchor "${E}"`);M.call(this,`#${E}`)}}}),$;function A(K,D,L){if(D!==void 0&&!uD(K,D))throw U(L)}function U(K){return Error(`reference "${K}" resolves to more than one schema`)}}nz.getSchemaRefs=rD});var P4=Z((AJ)=>{Object.defineProperty(AJ,"__esModule",{value:!0});AJ.getData=AJ.KeywordCxt=AJ.validateFunctionCode=void 0;var ez=Dz(),oz=N4(),rY=gY(),y6=N4(),sD=Ez(),b4=gz(),iY=fz(),P=k(),R=r0(),eD=Z4(),n0=f(),w4=V4();function QB(Q){if(XJ(Q)){if(WJ(Q),YJ(Q)){WB(Q);return}}QJ(Q,()=>(0,ez.topBoolOrEmptySchema)(Q))}AJ.validateFunctionCode=QB;function QJ({gen:Q,validateName:Y,schema:X,schemaEnv:W,opts:G},z){if(G.code.es5)Q.func(Y,P._`${R.default.data}, ${R.default.valCxt}`,W.$async,()=>{Q.code(P._`"use strict"; ${tz(X,G)}`),XB(Q,G),Q.code(z)});else Q.func(Y,P._`${R.default.data}, ${YB(G)}`,W.$async,()=>Q.code(tz(X,G)).code(z))}function YB(Q){return P._`{${R.default.instancePath}="", ${R.default.parentData}, ${R.default.parentDataProperty}, ${R.default.rootData}=${R.default.data}${Q.dynamicRef?P._`, ${R.default.dynamicAnchors}={}`:P.nil}}={}`}function XB(Q,Y){Q.if(R.default.valCxt,()=>{if(Q.var(R.default.instancePath,P._`${R.default.valCxt}.${R.default.instancePath}`),Q.var(R.default.parentData,P._`${R.default.valCxt}.${R.default.parentData}`),Q.var(R.default.parentDataProperty,P._`${R.default.valCxt}.${R.default.parentDataProperty}`),Q.var(R.default.rootData,P._`${R.default.valCxt}.${R.default.rootData}`),Y.dynamicRef)Q.var(R.default.dynamicAnchors,P._`${R.default.valCxt}.${R.default.dynamicAnchors}`)},()=>{if(Q.var(R.default.instancePath,P._`""`),Q.var(R.default.parentData,P._`undefined`),Q.var(R.default.parentDataProperty,P._`undefined`),Q.var(R.default.rootData,R.default.data),Y.dynamicRef)Q.var(R.default.dynamicAnchors,P._`{}`)})}function WB(Q){let{schema:Y,opts:X,gen:W}=Q;QJ(Q,()=>{if(X.$comment&&Y.$comment)zJ(Q);if(HB(Q),W.let(R.default.vErrors,null),W.let(R.default.errors,0),X.unevaluated)GB(Q);GJ(Q),KB(Q)});return}function GB(Q){let{gen:Y,validateName:X}=Q;Q.evaluated=Y.const("evaluated",P._`${X}.evaluated`),Y.if(P._`${Q.evaluated}.dynamicProps`,()=>Y.assign(P._`${Q.evaluated}.props`,P._`undefined`)),Y.if(P._`${Q.evaluated}.dynamicItems`,()=>Y.assign(P._`${Q.evaluated}.items`,P._`undefined`))}function tz(Q,Y){let X=typeof Q=="object"&&Q[Y.schemaId];return X&&(Y.code.source||Y.code.process)?P._`/*# sourceURL=${X} */`:P.nil}function zB(Q,Y){if(XJ(Q)){if(WJ(Q),YJ(Q)){JB(Q,Y);return}}(0,ez.boolOrEmptySchema)(Q,Y)}function YJ({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 XJ(Q){return typeof Q.schema!="boolean"}function JB(Q,Y){let{schema:X,gen:W,opts:G}=Q;if(G.$comment&&X.$comment)zJ(Q);AB(Q),UB(Q);let z=W.const("_errs",R.default.errors);GJ(Q,z),W.var(Y,P._`${z} === ${R.default.errors}`)}function WJ(Q){(0,n0.checkUnknownRules)(Q),$B(Q)}function GJ(Q,Y){if(Q.opts.jtd)return az(Q,[],!1,Y);let X=(0,oz.getSchemaTypes)(Q.schema),W=(0,oz.coerceAndCheckDataType)(Q,X);az(Q,X,!W,Y)}function $B(Q){let{schema:Y,errSchemaPath:X,opts:W,self:G}=Q;if(Y.$ref&&W.ignoreKeywordsWithRef&&(0,n0.schemaHasRulesButRef)(Y,G.RULES))G.logger.warn(`$ref: keywords ignored in schema at path "${X}"`)}function HB(Q){let{schema:Y,opts:X}=Q;if(Y.default!==void 0&&X.useDefaults&&X.strictSchema)(0,n0.checkStrictMode)(Q,"default is ignored in the schema root")}function AB(Q){let Y=Q.schema[Q.opts.schemaId];if(Y)Q.baseId=(0,eD.resolveUrl)(Q.opts.uriResolver,Q.baseId,Y)}function UB(Q){if(Q.schema.$async&&!Q.schemaEnv.$async)throw Error("async schema in sync schema")}function zJ({gen:Q,schemaEnv:Y,schema:X,errSchemaPath:W,opts:G}){let z=X.$comment;if(G.$comment===!0)Q.code(P._`${R.default.self}.logger.log(${z})`);else if(typeof G.$comment=="function"){let J=P.str`${W}/$comment`,$=Q.scopeValue("root",{ref:Y.root});Q.code(P._`${R.default.self}.opts.$comment(${z}, ${J}, ${$}.schema)`)}}function KB(Q){let{gen:Y,schemaEnv:X,validateName:W,ValidationError:G,opts:z}=Q;if(X.$async)Y.if(P._`${R.default.errors} === 0`,()=>Y.return(R.default.data),()=>Y.throw(P._`new ${G}(${R.default.vErrors})`));else{if(Y.assign(P._`${W}.errors`,R.default.vErrors),z.unevaluated)DB(Q);Y.return(P._`${R.default.errors} === 0`)}}function DB({gen:Q,evaluated:Y,props:X,items:W}){if(X instanceof P.Name)Q.assign(P._`${Y}.props`,X);if(W instanceof P.Name)Q.assign(P._`${Y}.items`,W)}function az(Q,Y,X,W){let{gen:G,schema:z,data:J,allErrors:$,opts:H,self:A}=Q,{RULES:U}=A;if(z.$ref&&(H.ignoreKeywordsWithRef||!(0,n0.schemaHasRulesButRef)(z,U))){G.block(()=>$J(Q,"$ref",U.all.$ref.definition));return}if(!H.jtd)BB(Q,Y);G.block(()=>{for(let D of U.rules)K(D);K(U.post)});function K(D){if(!(0,rY.shouldUseGroup)(z,D))return;if(D.type){if(G.if((0,y6.checkDataType)(D.type,J,H.strictNumbers)),sz(Q,D),Y.length===1&&Y[0]===D.type&&X)G.else(),(0,y6.reportTypeError)(Q);G.endIf()}else sz(Q,D);if(!$)G.if(P._`${R.default.errors} === ${W||0}`)}}function sz(Q,Y){let{gen:X,schema:W,opts:{useDefaults:G}}=Q;if(G)(0,sD.assignDefaults)(Q,Y.type);X.block(()=>{for(let z of Y.rules)if((0,rY.shouldUseRule)(W,z))$J(Q,z.keyword,z.definition,Y.type)})}function BB(Q,Y){if(Q.schemaEnv.meta||!Q.opts.strictTypes)return;if(LB(Q,Y),!Q.opts.allowUnionTypes)FB(Q,Y);qB(Q,Q.dataTypes)}function LB(Q,Y){if(!Y.length)return;if(!Q.dataTypes.length){Q.dataTypes=Y;return}Y.forEach((X)=>{if(!JJ(Q.dataTypes,X))nY(Q,`type "${X}" not allowed by context "${Q.dataTypes.join(",")}"`)}),MB(Q,Y)}function FB(Q,Y){if(Y.length>1&&!(Y.length===2&&Y.includes("null")))nY(Q,"use allowUnionTypes to allow union type keyword")}function qB(Q,Y){let X=Q.self.RULES.all;for(let W in X){let G=X[W];if(typeof G=="object"&&(0,rY.shouldUseRule)(Q.schema,G)){let{type:z}=G.definition;if(z.length&&!z.some((J)=>OB(Y,J)))nY(Q,`missing type "${z.join(",")}" for keyword "${W}"`)}}}function OB(Q,Y){return Q.includes(Y)||Y==="number"&&Q.includes("integer")}function JJ(Q,Y){return Q.includes(Y)||Y==="integer"&&Q.includes("number")}function MB(Q,Y){let X=[];for(let W of Q.dataTypes)if(JJ(Y,W))X.push(W);else if(Y.includes("integer")&&W==="number")X.push("integer");Q.dataTypes=X}function nY(Q,Y){let X=Q.schemaEnv.baseId+Q.errSchemaPath;Y+=` at "${X}" (strictTypes)`,(0,n0.checkStrictMode)(Q,Y,Q.opts.strictTypes)}class dY{constructor(Q,Y,X){if((0,b4.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,n0.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",HJ(this.$data,Q));else if(this.schemaCode=this.schemaValue,!(0,b4.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",R.default.errors)}result(Q,Y,X){this.failResult((0,P.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,P.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(P._`${Y} !== undefined && (${(0,P.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?w4.reportExtraError:w4.reportError)(this,this.def.error,Y)}$dataError(){(0,w4.reportError)(this,this.def.$dataError||w4.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,w4.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=P.nil){this.gen.block(()=>{this.check$data(Q,X),Y()})}check$data(Q=P.nil,Y=P.nil){if(!this.$data)return;let{gen:X,schemaCode:W,schemaType:G,def:z}=this;if(X.if((0,P.or)(P._`${W} === undefined`,Y)),Q!==P.nil)X.assign(Q,!0);if(G.length||z.validateSchema){if(X.elseIf(this.invalid$data()),this.$dataError(),Q!==P.nil)X.assign(Q,!1)}X.else()}invalid$data(){let{gen:Q,schemaCode:Y,schemaType:X,def:W,it:G}=this;return(0,P.or)(z(),J());function z(){if(X.length){if(!(Y instanceof P.Name))throw Error("ajv implementation error");let $=Array.isArray(X)?X:[X];return P._`${(0,y6.checkDataTypes)($,Y,G.opts.strictNumbers,y6.DataType.Wrong)}`}return P.nil}function J(){if(W.validateSchema){let $=Q.scopeValue("validate$data",{ref:W.validateSchema});return P._`!${$}(${Y})`}return P.nil}}subschema(Q,Y){let X=(0,iY.getSubschema)(this.it,Q);(0,iY.extendSubschemaData)(X,this.it,Q),(0,iY.extendSubschemaMode)(X,Q);let W={...this.it,...X,items:void 0,props:void 0};return zB(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=n0.mergeEvaluated.props(W,Q.props,X.props,Y);if(X.items!==!0&&Q.items!==void 0)X.items=n0.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,P.Name)),!0}}AJ.KeywordCxt=dY;function $J(Q,Y,X,W){let G=new dY(Q,X,Y);if("code"in X)X.code(G,W);else if(G.$data&&X.validate)(0,b4.funcKeywordCode)(G,X);else if("macro"in X)(0,b4.macroKeywordCode)(G,X);else if(X.compile||X.validate)(0,b4.funcKeywordCode)(G,X)}var VB=/^\/(?:[^~]|~0|~1)*$/,NB=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function HJ(Q,{dataLevel:Y,dataNames:X,dataPathArr:W}){let G,z;if(Q==="")return R.default.rootData;if(Q[0]==="/"){if(!VB.test(Q))throw Error(`Invalid JSON-pointer: ${Q}`);G=Q,z=R.default.rootData}else{let A=NB.exec(Q);if(!A)throw Error(`Invalid JSON-pointer: ${Q}`);let U=+A[1];if(G=A[2],G==="#"){if(U>=Y)throw Error(H("property/index",U));return W[Y-U]}if(U>Y)throw Error(H("data",U));if(z=X[Y-U],!G)return z}let J=z,$=G.split("/");for(let A of $)if(A)z=P._`${z}${(0,P.getProperty)((0,n0.unescapeJsonPointer)(A))}`,J=P._`${J} && ${z}`;return J;function H(A,U){return`Cannot access ${A} ${U} levels up, current level is ${Y}`}}AJ.getData=HJ});var u6=Z((DJ)=>{Object.defineProperty(DJ,"__esModule",{value:!0});class KJ extends Error{constructor(Q){super("validation failed");this.errors=Q,this.ajv=this.validation=!0}}DJ.default=KJ});var j4=Z((LJ)=>{Object.defineProperty(LJ,"__esModule",{value:!0});var oY=Z4();class BJ extends Error{constructor(Q,Y,X,W){super(W||`can't resolve reference ${X} from id ${Y}`);this.missingRef=(0,oY.resolveUrl)(Q,Y,X),this.missingSchema=(0,oY.normalizeId)((0,oY.getFullPath)(Q,this.missingRef))}}LJ.default=BJ});var f6=Z((OJ)=>{Object.defineProperty(OJ,"__esModule",{value:!0});OJ.resolveSchema=OJ.getCompilingSchema=OJ.resolveRef=OJ.compileSchema=OJ.SchemaEnv=void 0;var C0=k(),jB=u6(),V1=r0(),v0=Z4(),FJ=f(),IB=P4();class I4{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,v0.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={}}}OJ.SchemaEnv=I4;function aY(Q){let Y=qJ.call(this,Q);if(Y)return Y;let X=(0,v0.getFullPath)(this.opts.uriResolver,Q.root.baseId),{es5:W,lines:G}=this.opts.code,{ownProperties:z}=this.opts,J=new C0.CodeGen(this.scope,{es5:W,lines:G,ownProperties:z}),$;if(Q.$async)$=J.scopeValue("Error",{ref:jB.default,code:C0._`require("ajv/dist/runtime/validation_error").default`});let H=J.scopeName("validate");Q.validateName=H;let A={gen:J,allErrors:this.opts.allErrors,data:V1.default.data,parentData:V1.default.parentData,parentDataProperty:V1.default.parentDataProperty,dataNames:[V1.default.data],dataPathArr:[C0.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:J.scopeValue("schema",this.opts.code.source===!0?{ref:Q.schema,code:(0,C0.stringify)(Q.schema)}:{ref:Q.schema}),validateName:H,ValidationError:$,schema:Q.schema,schemaEnv:Q,rootId:X,baseId:Q.baseId||X,schemaPath:C0.nil,errSchemaPath:Q.schemaPath||(this.opts.jtd?"":"#"),errorPath:C0._`""`,opts:this.opts,self:this},U;try{this._compilations.add(Q),(0,IB.validateFunctionCode)(A),J.optimize(this.opts.code.optimize);let K=J.toString();if(U=`${J.scopeRefs(V1.default.scope)}return ${K}`,this.opts.code.process)U=this.opts.code.process(U,Q);let L=Function(`${V1.default.self}`,`${V1.default.scope}`,U)(this,this.scope.get());if(this.scope.value(H,{ref:L}),L.errors=null,L.schema=Q.schema,L.schemaEnv=Q,Q.$async)L.$async=!0;if(this.opts.code.source===!0)L.source={validateName:H,validateCode:K,scopeValues:J._values};if(this.opts.unevaluated){let{props:q,items:O}=A;if(L.evaluated={props:q instanceof C0.Name?void 0:q,items:O instanceof C0.Name?void 0:O,dynamicProps:q instanceof C0.Name,dynamicItems:O instanceof C0.Name},L.source)L.source.evaluated=(0,C0.stringify)(L.evaluated)}return Q.validate=L,Q}catch(K){if(delete Q.validate,delete Q.validateName,U)this.logger.error("Error compiling schema, function code:",U);throw K}finally{this._compilations.delete(Q)}}OJ.compileSchema=aY;function EB(Q,Y,X){var W;X=(0,v0.resolveUrl)(this.opts.uriResolver,Y,X);let G=Q.refs[X];if(G)return G;let z=RB.call(this,Q,X);if(z===void 0){let J=(W=Q.localRefs)===null||W===void 0?void 0:W[X],{schemaId:$}=this.opts;if(J)z=new I4({schema:J,schemaId:$,root:Q,baseId:Y})}if(z===void 0)return;return Q.refs[X]=TB.call(this,z)}OJ.resolveRef=EB;function TB(Q){if((0,v0.inlineRef)(Q.schema,this.opts.inlineRefs))return Q.schema;return Q.validate?Q:aY.call(this,Q)}function qJ(Q){for(let Y of this._compilations)if(SB(Y,Q))return Y}OJ.getCompilingSchema=qJ;function SB(Q,Y){return Q.schema===Y.schema&&Q.root===Y.root&&Q.baseId===Y.baseId}function RB(Q,Y){let X;while(typeof(X=this.refs[Y])=="string")Y=X;return X||this.schemas[Y]||h6.call(this,Q,Y)}function h6(Q,Y){let X=this.opts.uriResolver.parse(Y),W=(0,v0._getFullPath)(this.opts.uriResolver,X),G=(0,v0.getFullPath)(this.opts.uriResolver,Q.baseId,void 0);if(Object.keys(Q.schema).length>0&&W===G)return tY.call(this,X,Q);let z=(0,v0.normalizeId)(W),J=this.refs[z]||this.schemas[z];if(typeof J=="string"){let $=h6.call(this,Q,J);if(typeof($===null||$===void 0?void 0:$.schema)!=="object")return;return tY.call(this,X,$)}if(typeof(J===null||J===void 0?void 0:J.schema)!=="object")return;if(!J.validate)aY.call(this,J);if(z===(0,v0.normalizeId)(Y)){let{schema:$}=J,{schemaId:H}=this.opts,A=$[H];if(A)G=(0,v0.resolveUrl)(this.opts.uriResolver,G,A);return new I4({schema:$,schemaId:H,root:Q,baseId:G})}return tY.call(this,X,J)}OJ.resolveSchema=h6;var CB=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function tY(Q,{baseId:Y,schema:X,root:W}){var G;if(((G=Q.fragment)===null||G===void 0?void 0:G[0])!=="/")return;for(let $ of Q.fragment.slice(1).split("/")){if(typeof X==="boolean")return;let H=X[(0,FJ.unescapeFragment)($)];if(H===void 0)return;X=H;let A=typeof X==="object"&&X[this.opts.schemaId];if(!CB.has($)&&A)Y=(0,v0.resolveUrl)(this.opts.uriResolver,Y,A)}let z;if(typeof X!="boolean"&&X.$ref&&!(0,FJ.schemaHasRulesButRef)(X,this.RULES)){let $=(0,v0.resolveUrl)(this.opts.uriResolver,Y,X.$ref);z=h6.call(this,W,$)}let{schemaId:J}=this.opts;if(z=z||new I4({schema:X,schemaId:J,root:W,baseId:Y}),z.schema!==z.root.schema)return z;return}});var VJ=Z((oP,gB)=>{gB.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 eY=Z((tP,bJ)=>{var yB=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),ZJ=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 sY(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 uB=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function NJ(Q){return Q.length=0,!0}function hB(Q,Y,X){if(Q.length){let W=sY(Q);if(W!=="")Y.push(W);else return X.error=!0,!1;Q.length=0}return!0}function fB(Q){let Y=0,X={error:!1,address:"",zone:""},W=[],G=[],z=!1,J=!1,$=hB;for(let H=0;H<Q.length;H++){let A=Q[H];if(A==="["||A==="]")continue;if(A===":"){if(z===!0)J=!0;if(!$(G,W,X))break;if(++Y>7){X.error=!0;break}if(H>0&&Q[H-1]===":")z=!0;W.push(":");continue}else if(A==="%"){if(!$(G,W,X))break;$=NJ}else{G.push(A);continue}}if(G.length)if($===NJ)X.zone=G.join("");else if(J)W.push(G.join(""));else W.push(sY(G));return X.address=W.join(""),X}function wJ(Q){if(lB(Q,":")<2)return{host:Q,isIPV6:!1};let Y=fB(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 lB(Q,Y){let X=0;for(let W=0;W<Q.length;W++)if(Q[W]===Y)X++;return X}function mB(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 cB(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 pB(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(!ZJ(X)){let W=wJ(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}bJ.exports={nonSimpleDomain:uB,recomposeAuthority:pB,normalizeComponentEncoding:cB,removeDotSegments:mB,isIPv4:ZJ,isUUID:yB,normalizeIPv6:wJ,stringArrayToHexStripped:sY}});var TJ=Z((aP,EJ)=>{var{isUUID:iB}=eY(),rB=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,nB=["http","https","ws","wss","urn","urn:uuid"];function dB(Q){return nB.indexOf(Q)!==-1}function Q9(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 PJ(Q){if(!Q.host)Q.error=Q.error||"HTTP URIs must have a host.";return Q}function jJ(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 oB(Q){return Q.secure=Q9(Q),Q.resourceName=(Q.path||"/")+(Q.query?"?"+Q.query:""),Q.path=void 0,Q.query=void 0,Q}function tB(Q){if(Q.port===(Q9(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 aB(Q,Y){if(!Q.path)return Q.error="URN can not be parsed",Q;let X=Q.path.match(rB);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}`,z=Y9(G);if(Q.path=void 0,z)Q=z.parse(Q,Y)}else Q.error=Q.error||"URN can not be parsed.";return Q}function sB(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}`,z=Y9(G);if(z)Q=z.serialize(Q,Y);let J=Q,$=Q.nss;return J.path=`${W||Y.nid}:${$}`,Y.skipEscape=!0,J}function eB(Q,Y){let X=Q;if(X.uuid=X.nss,X.nss=void 0,!Y.tolerant&&(!X.uuid||!iB(X.uuid)))X.error=X.error||"UUID is not valid.";return X}function QL(Q){let Y=Q;return Y.nss=(Q.uuid||"").toLowerCase(),Y}var IJ={scheme:"http",domainHost:!0,parse:PJ,serialize:jJ},YL={scheme:"https",domainHost:IJ.domainHost,parse:PJ,serialize:jJ},l6={scheme:"ws",domainHost:!0,parse:oB,serialize:tB},XL={scheme:"wss",domainHost:l6.domainHost,parse:l6.parse,serialize:l6.serialize},WL={scheme:"urn",parse:aB,serialize:sB,skipNormalize:!0},GL={scheme:"urn:uuid",parse:eB,serialize:QL,skipNormalize:!0},m6={http:IJ,https:YL,ws:l6,wss:XL,urn:WL,"urn:uuid":GL};Object.setPrototypeOf(m6,null);function Y9(Q){return Q&&(m6[Q]||m6[Q.toLowerCase()])||void 0}EJ.exports={wsIsSecure:Q9,SCHEMES:m6,isValidSchemeName:dB,getSchemeHandler:Y9}});var CJ=Z((sP,p6)=>{var{normalizeIPv6:zL,removeDotSegments:E4,recomposeAuthority:JL,normalizeComponentEncoding:c6,isIPv4:$L,nonSimpleDomain:HL}=eY(),{SCHEMES:AL,getSchemeHandler:SJ}=TJ();function UL(Q,Y){if(typeof Q==="string")Q=y0(d0(Q,Y),Y);else if(typeof Q==="object")Q=d0(y0(Q,Y),Y);return Q}function KL(Q,Y,X){let W=X?Object.assign({scheme:"null"},X):{scheme:"null"},G=RJ(d0(Q,W),d0(Y,W),W,!0);return W.skipEscape=!0,y0(G,W)}function RJ(Q,Y,X,W){let G={};if(!W)Q=d0(y0(Q,X),X),Y=d0(y0(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=E4(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=E4(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=E4(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=E4(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 DL(Q,Y,X){if(typeof Q==="string")Q=unescape(Q),Q=y0(c6(d0(Q,X),!0),{...X,skipEscape:!0});else if(typeof Q==="object")Q=y0(c6(Q,!0),{...X,skipEscape:!0});if(typeof Y==="string")Y=unescape(Y),Y=y0(c6(d0(Y,X),!0),{...X,skipEscape:!0});else if(typeof Y==="object")Y=y0(c6(Y,!0),{...X,skipEscape:!0});return Q.toLowerCase()===Y.toLowerCase()}function y0(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=[],z=SJ(W.scheme||X.scheme);if(z&&z.serialize)z.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 J=JL(X);if(J!==void 0){if(W.reference!=="suffix")G.push("//");if(G.push(J),X.path&&X.path[0]!=="/")G.push("/")}if(X.path!==void 0){let $=X.path;if(!W.absolutePath&&(!z||!z.absolutePath))$=E4($);if(J===void 0&&$[0]==="/"&&$[1]==="/")$="/%2F"+$.slice(2);G.push($)}if(X.query!==void 0)G.push("?",X.query);if(X.fragment!==void 0)G.push("#",X.fragment);return G.join("")}var BL=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function d0(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 z=Q.match(BL);if(z){if(W.scheme=z[1],W.userinfo=z[3],W.host=z[4],W.port=parseInt(z[5],10),W.path=z[6]||"",W.query=z[7],W.fragment=z[8],isNaN(W.port))W.port=z[5];if(W.host)if($L(W.host)===!1){let H=zL(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 J=SJ(X.scheme||W.scheme);if(!X.unicodeSupport&&(!J||!J.unicodeSupport)){if(W.host&&(X.domainHost||J&&J.domainHost)&&G===!1&&HL(W.host))try{W.host=URL.domainToASCII(W.host.toLowerCase())}catch($){W.error=W.error||"Host's domain name can not be converted to ASCII: "+$}}if(!J||J&&!J.skipNormalize){if(Q.indexOf("%")!==-1){if(W.scheme!==void 0)W.scheme=unescape(W.scheme);if(W.host!==void 0)W.host=unescape(W.host)}if(W.path)W.path=escape(unescape(W.path));if(W.fragment)W.fragment=encodeURI(decodeURIComponent(W.fragment))}if(J&&J.parse)J.parse(W,X)}else W.error=W.error||"URI can not be parsed.";return W}var X9={SCHEMES:AL,normalize:UL,resolve:KL,resolveComponent:RJ,equal:DL,serialize:y0,parse:d0};p6.exports=X9;p6.exports.default=X9;p6.exports.fastUri=X9});var xJ=Z((kJ)=>{Object.defineProperty(kJ,"__esModule",{value:!0});var vJ=CJ();vJ.code='require("ajv/dist/runtime/uri").default';kJ.default=vJ});var mJ=Z((o0)=>{Object.defineProperty(o0,"__esModule",{value:!0});o0.CodeGen=o0.Name=o0.nil=o0.stringify=o0.str=o0._=o0.KeywordCxt=void 0;var FL=P4();Object.defineProperty(o0,"KeywordCxt",{enumerable:!0,get:function(){return FL.KeywordCxt}});var u1=k();Object.defineProperty(o0,"_",{enumerable:!0,get:function(){return u1._}});Object.defineProperty(o0,"str",{enumerable:!0,get:function(){return u1.str}});Object.defineProperty(o0,"stringify",{enumerable:!0,get:function(){return u1.stringify}});Object.defineProperty(o0,"nil",{enumerable:!0,get:function(){return u1.nil}});Object.defineProperty(o0,"Name",{enumerable:!0,get:function(){return u1.Name}});Object.defineProperty(o0,"CodeGen",{enumerable:!0,get:function(){return u1.CodeGen}});var qL=u6(),hJ=j4(),OL=_Y(),T4=f6(),ML=k(),S4=Z4(),i6=N4(),G9=f(),_J=VJ(),VL=xJ(),fJ=(Q,Y)=>new RegExp(Q,Y);fJ.code="new RegExp";var NL=["removeAdditional","useDefaults","coerceTypes"],ZL=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),wL={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},bL={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},gJ=200;function PL(Q){var Y,X,W,G,z,J,$,H,A,U,K,D,L,q,O,V,M,S,E,x,T,_0,f0,KQ,DQ;let c1=Q.strict,BQ=(Y=Q.code)===null||Y===void 0?void 0:Y.optimize,C9=BQ===!0||BQ===void 0?1:BQ||0,v9=(W=(X=Q.code)===null||X===void 0?void 0:X.regExp)!==null&&W!==void 0?W:fJ,Z5=(G=Q.uriResolver)!==null&&G!==void 0?G:VL.default;return{strictSchema:(J=(z=Q.strictSchema)!==null&&z!==void 0?z:c1)!==null&&J!==void 0?J:!0,strictNumbers:(H=($=Q.strictNumbers)!==null&&$!==void 0?$:c1)!==null&&H!==void 0?H:!0,strictTypes:(U=(A=Q.strictTypes)!==null&&A!==void 0?A:c1)!==null&&U!==void 0?U:"log",strictTuples:(D=(K=Q.strictTuples)!==null&&K!==void 0?K:c1)!==null&&D!==void 0?D:"log",strictRequired:(q=(L=Q.strictRequired)!==null&&L!==void 0?L:c1)!==null&&q!==void 0?q:!1,code:Q.code?{...Q.code,optimize:C9,regExp:v9}:{optimize:C9,regExp:v9},loopRequired:(O=Q.loopRequired)!==null&&O!==void 0?O:gJ,loopEnum:(V=Q.loopEnum)!==null&&V!==void 0?V:gJ,meta:(M=Q.meta)!==null&&M!==void 0?M:!0,messages:(S=Q.messages)!==null&&S!==void 0?S:!0,inlineRefs:(E=Q.inlineRefs)!==null&&E!==void 0?E:!0,schemaId:(x=Q.schemaId)!==null&&x!==void 0?x:"$id",addUsedSchema:(T=Q.addUsedSchema)!==null&&T!==void 0?T:!0,validateSchema:(_0=Q.validateSchema)!==null&&_0!==void 0?_0:!0,validateFormats:(f0=Q.validateFormats)!==null&&f0!==void 0?f0:!0,unicodeRegExp:(KQ=Q.unicodeRegExp)!==null&&KQ!==void 0?KQ:!0,int32range:(DQ=Q.int32range)!==null&&DQ!==void 0?DQ:!0,uriResolver:Z5}}class r6{constructor(Q={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,Q=this.opts={...Q,...PL(Q)};let{es5:Y,lines:X}=this.opts.code;this.scope=new ML.ValueScope({scope:{},prefixes:ZL,es5:Y,lines:X}),this.logger=RL(Q.logger);let W=Q.validateFormats;if(Q.validateFormats=!1,this.RULES=(0,OL.getRules)(),yJ.call(this,wL,Q,"NOT SUPPORTED"),yJ.call(this,bL,Q,"DEPRECATED","warn"),this._metaOpts=TL.call(this),Q.formats)IL.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),Q.keywords)EL.call(this,Q.keywords);if(typeof Q.meta=="object")this.addMetaSchema(Q.meta);jL.call(this),Q.validateFormats=W}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:Q,meta:Y,schemaId:X}=this.opts,W=_J;if(X==="id")W={..._J},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(A,U){await G.call(this,A.$schema);let K=this._addSchema(A,U);return K.validate||z.call(this,K)}async function G(A){if(A&&!this.getSchema(A))await W.call(this,{$ref:A},!0)}async function z(A){try{return this._compileSchemaEnv(A)}catch(U){if(!(U instanceof hJ.default))throw U;return J.call(this,U),await $.call(this,U.missingSchema),z.call(this,A)}}function J({missingSchema:A,missingRef:U}){if(this.refs[A])throw Error(`AnySchema ${A} is loaded but ${U} cannot be resolved`)}async function $(A){let U=await H.call(this,A);if(!this.refs[A])await G.call(this,U.$schema);if(!this.refs[A])this.addSchema(U,A,Y)}async function H(A){let U=this._loading[A];if(U)return U;try{return await(this._loading[A]=X(A))}finally{delete this._loading[A]}}}addSchema(Q,Y,X,W=this.opts.validateSchema){if(Array.isArray(Q)){for(let z of Q)this.addSchema(z,void 0,X,W);return this}let G;if(typeof Q==="object"){let{schemaId:z}=this.opts;if(G=Q[z],G!==void 0&&typeof G!="string")throw Error(`schema ${z} must be string`)}return Y=(0,S4.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=uJ.call(this,Q))=="string")Q=Y;if(Y===void 0){let{schemaId:X}=this.opts,W=new T4.SchemaEnv({schema:{},schemaId:X});if(Y=T4.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=uJ.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,S4.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(vL.call(this,X,Y),!Y)return(0,G9.eachItem)(X,(G)=>W9.call(this,G)),this;xL.call(this,Y);let W={...Y,type:(0,i6.getJSONTypes)(Y.type),schemaType:(0,i6.getJSONTypes)(Y.schemaType)};return(0,G9.eachItem)(X,W.type.length===0?(G)=>W9.call(this,G,W):(G)=>W.type.forEach((z)=>W9.call(this,G,W,z))),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),z=Q;for(let J of G)z=z[J];for(let J in X){let $=X[J];if(typeof $!="object")continue;let{$data:H}=$.definition,A=z[J];if(H&&A)z[J]=lJ(A)}}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 z,{schemaId:J}=this.opts;if(typeof Q=="object")z=Q[J];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof Q!="boolean")throw Error("schema must be object or boolean");let $=this._cache.get(Q);if($!==void 0)return $;X=(0,S4.normalizeId)(z||X);let H=S4.getSchemaRefs.call(this,Q,X);if($=new T4.SchemaEnv({schema:Q,schemaId:J,meta:Y,baseId:X,localRefs:H}),this._cache.set($.schema,$),G&&!X.startsWith("#")){if(X)this._checkUnique(X);this.refs[X]=$}if(W)this.validateSchema(Q,!0);return $}_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 T4.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{T4.compileSchema.call(this,Q)}finally{this.opts=Y}}}r6.ValidationError=qL.default;r6.MissingRefError=hJ.default;o0.default=r6;function yJ(Q,Y,X,W="error"){for(let G in Q){let z=G;if(z in Y)this.logger[W](`${X}: option ${G}. ${Q[z]}`)}}function uJ(Q){return Q=(0,S4.normalizeId)(Q),this.schemas[Q]||this.refs[Q]}function jL(){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 IL(){for(let Q in this.opts.formats){let Y=this.opts.formats[Q];if(Y)this.addFormat(Q,Y)}}function EL(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 TL(){let Q={...this.opts};for(let Y of NL)delete Q[Y];return Q}var SL={log(){},warn(){},error(){}};function RL(Q){if(Q===!1)return SL;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 CL=/^[a-z_$][a-z0-9_$:-]*$/i;function vL(Q,Y){let{RULES:X}=this;if((0,G9.eachItem)(Q,(W)=>{if(X.keywords[W])throw Error(`Keyword ${W} is already defined`);if(!CL.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 W9(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:z}=this,J=G?z.post:z.rules.find(({type:H})=>H===X);if(!J)J={type:X,rules:[]},z.rules.push(J);if(z.keywords[Q]=!0,!Y)return;let $={keyword:Q,definition:{...Y,type:(0,i6.getJSONTypes)(Y.type),schemaType:(0,i6.getJSONTypes)(Y.schemaType)}};if(Y.before)kL.call(this,J,$,Y.before);else J.rules.push($);z.all[Q]=$,(W=Y.implements)===null||W===void 0||W.forEach((H)=>this.addKeyword(H))}function kL(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 xL(Q){let{metaSchema:Y}=Q;if(Y===void 0)return;if(Q.$data&&this.opts.$data)Y=lJ(Y);Q.validateSchema=this.compile(Y,!0)}var _L={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function lJ(Q){return{anyOf:[Q,_L]}}});var pJ=Z((cJ)=>{Object.defineProperty(cJ,"__esModule",{value:!0});var uL={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};cJ.default=uL});var tJ=Z((dJ)=>{Object.defineProperty(dJ,"__esModule",{value:!0});dJ.callRef=dJ.getValidate=void 0;var fL=j4(),iJ=j0(),O0=k(),h1=r0(),rJ=f6(),n6=f(),lL={keyword:"$ref",schemaType:"string",code(Q){let{gen:Y,schema:X,it:W}=Q,{baseId:G,schemaEnv:z,validateName:J,opts:$,self:H}=W,{root:A}=z;if((X==="#"||X==="#/")&&G===A.baseId)return K();let U=rJ.resolveRef.call(H,A,G,X);if(U===void 0)throw new fL.default(W.opts.uriResolver,G,X);if(U instanceof rJ.SchemaEnv)return D(U);return L(U);function K(){if(z===A)return d6(Q,J,z,z.$async);let q=Y.scopeValue("root",{ref:A});return d6(Q,O0._`${q}.validate`,A,A.$async)}function D(q){let O=nJ(Q,q);d6(Q,O,q,q.$async)}function L(q){let O=Y.scopeValue("schema",$.code.source===!0?{ref:q,code:(0,O0.stringify)(q)}:{ref:q}),V=Y.name("valid"),M=Q.subschema({schema:q,dataTypes:[],schemaPath:O0.nil,topSchemaRef:O,errSchemaPath:X},V);Q.mergeEvaluated(M),Q.ok(V)}}};function nJ(Q,Y){let{gen:X}=Q;return Y.validate?X.scopeValue("validate",{ref:Y.validate}):O0._`${X.scopeValue("wrapper",{ref:Y})}.validate`}dJ.getValidate=nJ;function d6(Q,Y,X,W){let{gen:G,it:z}=Q,{allErrors:J,schemaEnv:$,opts:H}=z,A=H.passContext?h1.default.this:O0.nil;if(W)U();else K();function U(){if(!$.$async)throw Error("async schema referenced by sync schema");let q=G.let("valid");G.try(()=>{if(G.code(O0._`await ${(0,iJ.callValidateCode)(Q,Y,A)}`),L(Y),!J)G.assign(q,!0)},(O)=>{if(G.if(O0._`!(${O} instanceof ${z.ValidationError})`,()=>G.throw(O)),D(O),!J)G.assign(q,!1)}),Q.ok(q)}function K(){Q.result((0,iJ.callValidateCode)(Q,Y,A),()=>L(Y),()=>D(Y))}function D(q){let O=O0._`${q}.errors`;G.assign(h1.default.vErrors,O0._`${h1.default.vErrors} === null ? ${O} : ${h1.default.vErrors}.concat(${O})`),G.assign(h1.default.errors,O0._`${h1.default.vErrors}.length`)}function L(q){var O;if(!z.opts.unevaluated)return;let V=(O=X===null||X===void 0?void 0:X.validate)===null||O===void 0?void 0:O.evaluated;if(z.props!==!0)if(V&&!V.dynamicProps){if(V.props!==void 0)z.props=n6.mergeEvaluated.props(G,V.props,z.props)}else{let M=G.var("props",O0._`${q}.evaluated.props`);z.props=n6.mergeEvaluated.props(G,M,z.props,O0.Name)}if(z.items!==!0)if(V&&!V.dynamicItems){if(V.items!==void 0)z.items=n6.mergeEvaluated.items(G,V.items,z.items)}else{let M=G.var("items",O0._`${q}.evaluated.items`);z.items=n6.mergeEvaluated.items(G,M,z.items,O0.Name)}}}dJ.callRef=d6;dJ.default=lL});var sJ=Z((aJ)=>{Object.defineProperty(aJ,"__esModule",{value:!0});var pL=pJ(),iL=tJ(),rL=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",pL.default,iL.default];aJ.default=rL});var Q$=Z((eJ)=>{Object.defineProperty(eJ,"__esModule",{value:!0});var o6=k(),A1=o6.operators,t6={maximum:{okStr:"<=",ok:A1.LTE,fail:A1.GT},minimum:{okStr:">=",ok:A1.GTE,fail:A1.LT},exclusiveMaximum:{okStr:"<",ok:A1.LT,fail:A1.GTE},exclusiveMinimum:{okStr:">",ok:A1.GT,fail:A1.LTE}},dL={message:({keyword:Q,schemaCode:Y})=>o6.str`must be ${t6[Q].okStr} ${Y}`,params:({keyword:Q,schemaCode:Y})=>o6._`{comparison: ${t6[Q].okStr}, limit: ${Y}}`},oL={keyword:Object.keys(t6),type:"number",schemaType:"number",$data:!0,error:dL,code(Q){let{keyword:Y,data:X,schemaCode:W}=Q;Q.fail$data(o6._`${X} ${t6[Y].fail} ${W} || isNaN(${X})`)}};eJ.default=oL});var X$=Z((Y$)=>{Object.defineProperty(Y$,"__esModule",{value:!0});var R4=k(),aL={message:({schemaCode:Q})=>R4.str`must be multiple of ${Q}`,params:({schemaCode:Q})=>R4._`{multipleOf: ${Q}}`},sL={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:aL,code(Q){let{gen:Y,data:X,schemaCode:W,it:G}=Q,z=G.opts.multipleOfPrecision,J=Y.let("res"),$=z?R4._`Math.abs(Math.round(${J}) - ${J}) > 1e-${z}`:R4._`${J} !== parseInt(${J})`;Q.fail$data(R4._`(${W} === 0 || (${J} = ${X}/${W}, ${$}))`)}};Y$.default=sL});var z$=Z((G$)=>{Object.defineProperty(G$,"__esModule",{value:!0});function W$(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}G$.default=W$;W$.code='require("ajv/dist/runtime/ucs2length").default'});var $$=Z((J$)=>{Object.defineProperty(J$,"__esModule",{value:!0});var N1=k(),YF=f(),XF=z$(),WF={message({keyword:Q,schemaCode:Y}){let X=Q==="maxLength"?"more":"fewer";return N1.str`must NOT have ${X} than ${Y} characters`},params:({schemaCode:Q})=>N1._`{limit: ${Q}}`},GF={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:WF,code(Q){let{keyword:Y,data:X,schemaCode:W,it:G}=Q,z=Y==="maxLength"?N1.operators.GT:N1.operators.LT,J=G.opts.unicode===!1?N1._`${X}.length`:N1._`${(0,YF.useFunc)(Q.gen,XF.default)}(${X})`;Q.fail$data(N1._`${J} ${z} ${W}`)}};J$.default=GF});var A$=Z((H$)=>{Object.defineProperty(H$,"__esModule",{value:!0});var JF=j0(),a6=k(),$F={message:({schemaCode:Q})=>a6.str`must match pattern "${Q}"`,params:({schemaCode:Q})=>a6._`{pattern: ${Q}}`},HF={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:$F,code(Q){let{data:Y,$data:X,schema:W,schemaCode:G,it:z}=Q,J=z.opts.unicodeRegExp?"u":"",$=X?a6._`(new RegExp(${G}, ${J}))`:(0,JF.usePattern)(Q,W);Q.fail$data(a6._`!${$}.test(${Y})`)}};H$.default=HF});var K$=Z((U$)=>{Object.defineProperty(U$,"__esModule",{value:!0});var C4=k(),UF={message({keyword:Q,schemaCode:Y}){let X=Q==="maxProperties"?"more":"fewer";return C4.str`must NOT have ${X} than ${Y} properties`},params:({schemaCode:Q})=>C4._`{limit: ${Q}}`},KF={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:UF,code(Q){let{keyword:Y,data:X,schemaCode:W}=Q,G=Y==="maxProperties"?C4.operators.GT:C4.operators.LT;Q.fail$data(C4._`Object.keys(${X}).length ${G} ${W}`)}};U$.default=KF});var B$=Z((D$)=>{Object.defineProperty(D$,"__esModule",{value:!0});var v4=j0(),k4=k(),BF=f(),LF={message:({params:{missingProperty:Q}})=>k4.str`must have required property '${Q}'`,params:({params:{missingProperty:Q}})=>k4._`{missingProperty: ${Q}}`},FF={keyword:"required",type:"object",schemaType:"array",$data:!0,error:LF,code(Q){let{gen:Y,schema:X,schemaCode:W,data:G,$data:z,it:J}=Q,{opts:$}=J;if(!z&&X.length===0)return;let H=X.length>=$.loopRequired;if(J.allErrors)A();else U();if($.strictRequired){let L=Q.parentSchema.properties,{definedProperties:q}=Q.it;for(let O of X)if((L===null||L===void 0?void 0:L[O])===void 0&&!q.has(O)){let V=J.schemaEnv.baseId+J.errSchemaPath,M=`required property "${O}" is not defined at "${V}" (strictRequired)`;(0,BF.checkStrictMode)(J,M,J.opts.strictRequired)}}function A(){if(H||z)Q.block$data(k4.nil,K);else for(let L of X)(0,v4.checkReportMissingProp)(Q,L)}function U(){let L=Y.let("missing");if(H||z){let q=Y.let("valid",!0);Q.block$data(q,()=>D(L,q)),Q.ok(q)}else Y.if((0,v4.checkMissingProp)(Q,X,L)),(0,v4.reportMissingProp)(Q,L),Y.else()}function K(){Y.forOf("prop",W,(L)=>{Q.setParams({missingProperty:L}),Y.if((0,v4.noPropertyInData)(Y,G,L,$.ownProperties),()=>Q.error())})}function D(L,q){Q.setParams({missingProperty:L}),Y.forOf(L,W,()=>{Y.assign(q,(0,v4.propertyInData)(Y,G,L,$.ownProperties)),Y.if((0,k4.not)(q),()=>{Q.error(),Y.break()})},k4.nil)}}};D$.default=FF});var F$=Z((L$)=>{Object.defineProperty(L$,"__esModule",{value:!0});var x4=k(),OF={message({keyword:Q,schemaCode:Y}){let X=Q==="maxItems"?"more":"fewer";return x4.str`must NOT have ${X} than ${Y} items`},params:({schemaCode:Q})=>x4._`{limit: ${Q}}`},MF={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:OF,code(Q){let{keyword:Y,data:X,schemaCode:W}=Q,G=Y==="maxItems"?x4.operators.GT:x4.operators.LT;Q.fail$data(x4._`${X}.length ${G} ${W}`)}};L$.default=MF});var s6=Z((O$)=>{Object.defineProperty(O$,"__esModule",{value:!0});var q$=cY();q$.code='require("ajv/dist/runtime/equal").default';O$.default=q$});var V$=Z((M$)=>{Object.defineProperty(M$,"__esModule",{value:!0});var z9=N4(),H0=k(),ZF=f(),wF=s6(),bF={message:({params:{i:Q,j:Y}})=>H0.str`must NOT have duplicate items (items ## ${Y} and ${Q} are identical)`,params:({params:{i:Q,j:Y}})=>H0._`{i: ${Q}, j: ${Y}}`},PF={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:bF,code(Q){let{gen:Y,data:X,$data:W,schema:G,parentSchema:z,schemaCode:J,it:$}=Q;if(!W&&!G)return;let H=Y.let("valid"),A=z.items?(0,z9.getSchemaTypes)(z.items):[];Q.block$data(H,U,H0._`${J} === false`),Q.ok(H);function U(){let q=Y.let("i",H0._`${X}.length`),O=Y.let("j");Q.setParams({i:q,j:O}),Y.assign(H,!0),Y.if(H0._`${q} > 1`,()=>(K()?D:L)(q,O))}function K(){return A.length>0&&!A.some((q)=>q==="object"||q==="array")}function D(q,O){let V=Y.name("item"),M=(0,z9.checkDataTypes)(A,V,$.opts.strictNumbers,z9.DataType.Wrong),S=Y.const("indices",H0._`{}`);Y.for(H0._`;${q}--;`,()=>{if(Y.let(V,H0._`${X}[${q}]`),Y.if(M,H0._`continue`),A.length>1)Y.if(H0._`typeof ${V} == "string"`,H0._`${V} += "_"`);Y.if(H0._`typeof ${S}[${V}] == "number"`,()=>{Y.assign(O,H0._`${S}[${V}]`),Q.error(),Y.assign(H,!1).break()}).code(H0._`${S}[${V}] = ${q}`)})}function L(q,O){let V=(0,ZF.useFunc)(Y,wF.default),M=Y.name("outer");Y.label(M).for(H0._`;${q}--;`,()=>Y.for(H0._`${O} = ${q}; ${O}--;`,()=>Y.if(H0._`${V}(${X}[${q}], ${X}[${O}])`,()=>{Q.error(),Y.assign(H,!1).break(M)})))}}};M$.default=PF});var Z$=Z((N$)=>{Object.defineProperty(N$,"__esModule",{value:!0});var J9=k(),IF=f(),EF=s6(),TF={message:"must be equal to constant",params:({schemaCode:Q})=>J9._`{allowedValue: ${Q}}`},SF={keyword:"const",$data:!0,error:TF,code(Q){let{gen:Y,data:X,$data:W,schemaCode:G,schema:z}=Q;if(W||z&&typeof z=="object")Q.fail$data(J9._`!${(0,IF.useFunc)(Y,EF.default)}(${X}, ${G})`);else Q.fail(J9._`${z} !== ${X}`)}};N$.default=SF});var b$=Z((w$)=>{Object.defineProperty(w$,"__esModule",{value:!0});var _4=k(),CF=f(),vF=s6(),kF={message:"must be equal to one of the allowed values",params:({schemaCode:Q})=>_4._`{allowedValues: ${Q}}`},xF={keyword:"enum",schemaType:"array",$data:!0,error:kF,code(Q){let{gen:Y,data:X,$data:W,schema:G,schemaCode:z,it:J}=Q;if(!W&&G.length===0)throw Error("enum must have non-empty array");let $=G.length>=J.opts.loopEnum,H,A=()=>H!==null&&H!==void 0?H:H=(0,CF.useFunc)(Y,vF.default),U;if($||W)U=Y.let("valid"),Q.block$data(U,K);else{if(!Array.isArray(G))throw Error("ajv implementation error");let L=Y.const("vSchema",z);U=(0,_4.or)(...G.map((q,O)=>D(L,O)))}Q.pass(U);function K(){Y.assign(U,!1),Y.forOf("v",z,(L)=>Y.if(_4._`${A()}(${X}, ${L})`,()=>Y.assign(U,!0).break()))}function D(L,q){let O=G[q];return typeof O==="object"&&O!==null?_4._`${A()}(${X}, ${L}[${q}])`:_4._`${X} === ${O}`}}};w$.default=xF});var j$=Z((P$)=>{Object.defineProperty(P$,"__esModule",{value:!0});var gF=Q$(),yF=X$(),uF=$$(),hF=A$(),fF=K$(),lF=B$(),mF=F$(),cF=V$(),pF=Z$(),iF=b$(),rF=[gF.default,yF.default,uF.default,hF.default,fF.default,lF.default,mF.default,cF.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},pF.default,iF.default];P$.default=rF});var H9=Z((E$)=>{Object.defineProperty(E$,"__esModule",{value:!0});E$.validateAdditionalItems=void 0;var Z1=k(),$9=f(),dF={message:({params:{len:Q}})=>Z1.str`must NOT have more than ${Q} items`,params:({params:{len:Q}})=>Z1._`{limit: ${Q}}`},oF={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:dF,code(Q){let{parentSchema:Y,it:X}=Q,{items:W}=Y;if(!Array.isArray(W)){(0,$9.checkStrictMode)(X,'"additionalItems" is ignored when "items" is not an array of schemas');return}I$(Q,W)}};function I$(Q,Y){let{gen:X,schema:W,data:G,keyword:z,it:J}=Q;J.items=!0;let $=X.const("len",Z1._`${G}.length`);if(W===!1)Q.setParams({len:Y.length}),Q.pass(Z1._`${$} <= ${Y.length}`);else if(typeof W=="object"&&!(0,$9.alwaysValidSchema)(J,W)){let A=X.var("valid",Z1._`${$} <= ${Y.length}`);X.if((0,Z1.not)(A),()=>H(A)),Q.ok(A)}function H(A){X.forRange("i",Y.length,$,(U)=>{if(Q.subschema({keyword:z,dataProp:U,dataPropType:$9.Type.Num},A),!J.allErrors)X.if((0,Z1.not)(A),()=>X.break())})}}E$.validateAdditionalItems=I$;E$.default=oF});var A9=Z((C$)=>{Object.defineProperty(C$,"__esModule",{value:!0});C$.validateTuple=void 0;var S$=k(),e6=f(),aF=j0(),sF={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(Q){let{schema:Y,it:X}=Q;if(Array.isArray(Y))return R$(Q,"additionalItems",Y);if(X.items=!0,(0,e6.alwaysValidSchema)(X,Y))return;Q.ok((0,aF.validateArray)(Q))}};function R$(Q,Y,X=Q.schema){let{gen:W,parentSchema:G,data:z,keyword:J,it:$}=Q;if(U(G),$.opts.unevaluated&&X.length&&$.items!==!0)$.items=e6.mergeEvaluated.items(W,X.length,$.items);let H=W.name("valid"),A=W.const("len",S$._`${z}.length`);X.forEach((K,D)=>{if((0,e6.alwaysValidSchema)($,K))return;W.if(S$._`${A} > ${D}`,()=>Q.subschema({keyword:J,schemaProp:D,dataProp:D},H)),Q.ok(H)});function U(K){let{opts:D,errSchemaPath:L}=$,q=X.length,O=q===K.minItems&&(q===K.maxItems||K[Y]===!1);if(D.strictTuples&&!O){let V=`"${J}" is ${q}-tuple, but minItems or maxItems/${Y} are not specified or different at path "${L}"`;(0,e6.checkStrictMode)($,V,D.strictTuples)}}}C$.validateTuple=R$;C$.default=sF});var x$=Z((k$)=>{Object.defineProperty(k$,"__esModule",{value:!0});var Qq=A9(),Yq={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(Q)=>(0,Qq.validateTuple)(Q,"items")};k$.default=Yq});var y$=Z((g$)=>{Object.defineProperty(g$,"__esModule",{value:!0});var _$=k(),Wq=f(),Gq=j0(),zq=H9(),Jq={message:({params:{len:Q}})=>_$.str`must NOT have more than ${Q} items`,params:({params:{len:Q}})=>_$._`{limit: ${Q}}`},$q={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:Jq,code(Q){let{schema:Y,parentSchema:X,it:W}=Q,{prefixItems:G}=X;if(W.items=!0,(0,Wq.alwaysValidSchema)(W,Y))return;if(G)(0,zq.validateAdditionalItems)(Q,G);else Q.ok((0,Gq.validateArray)(Q))}};g$.default=$q});var h$=Z((u$)=>{Object.defineProperty(u$,"__esModule",{value:!0});var I0=k(),QQ=f(),Aq={message:({params:{min:Q,max:Y}})=>Y===void 0?I0.str`must contain at least ${Q} valid item(s)`:I0.str`must contain at least ${Q} and no more than ${Y} valid item(s)`,params:({params:{min:Q,max:Y}})=>Y===void 0?I0._`{minContains: ${Q}}`:I0._`{minContains: ${Q}, maxContains: ${Y}}`},Uq={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:Aq,code(Q){let{gen:Y,schema:X,parentSchema:W,data:G,it:z}=Q,J,$,{minContains:H,maxContains:A}=W;if(z.opts.next)J=H===void 0?1:H,$=A;else J=1;let U=Y.const("len",I0._`${G}.length`);if(Q.setParams({min:J,max:$}),$===void 0&&J===0){(0,QQ.checkStrictMode)(z,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if($!==void 0&&J>$){(0,QQ.checkStrictMode)(z,'"minContains" > "maxContains" is always invalid'),Q.fail();return}if((0,QQ.alwaysValidSchema)(z,X)){let O=I0._`${U} >= ${J}`;if($!==void 0)O=I0._`${O} && ${U} <= ${$}`;Q.pass(O);return}z.items=!0;let K=Y.name("valid");if($===void 0&&J===1)L(K,()=>Y.if(K,()=>Y.break()));else if(J===0){if(Y.let(K,!0),$!==void 0)Y.if(I0._`${G}.length > 0`,D)}else Y.let(K,!1),D();Q.result(K,()=>Q.reset());function D(){let O=Y.name("_valid"),V=Y.let("count",0);L(O,()=>Y.if(O,()=>q(V)))}function L(O,V){Y.forRange("i",0,U,(M)=>{Q.subschema({keyword:"contains",dataProp:M,dataPropType:QQ.Type.Num,compositeRule:!0},O),V()})}function q(O){if(Y.code(I0._`${O}++`),$===void 0)Y.if(I0._`${O} >= ${J}`,()=>Y.assign(K,!0).break());else if(Y.if(I0._`${O} > ${$}`,()=>Y.assign(K,!1).break()),J===1)Y.assign(K,!0);else Y.if(I0._`${O} >= ${J}`,()=>Y.assign(K,!0))}}};u$.default=Uq});var i$=Z((m$)=>{Object.defineProperty(m$,"__esModule",{value:!0});m$.validateSchemaDeps=m$.validatePropertyDeps=m$.error=void 0;var U9=k(),Dq=f(),g4=j0();m$.error={message:({params:{property:Q,depsCount:Y,deps:X}})=>{let W=Y===1?"property":"properties";return U9.str`must have ${W} ${X} when property ${Q} is present`},params:({params:{property:Q,depsCount:Y,deps:X,missingProperty:W}})=>U9._`{property: ${Q},
|
|
5
|
+
|| ${J} === "boolean" || ${G} === null`).assign($,C._`[${G}]`)}}}function rK({gen:Q,parentData:Y,parentDataProperty:X},W){Q.if(C._`${Y} !== undefined`,()=>Q.assign(C._`${Y}[${X}]`,W))}function yY(Q,Y,X,W=_1.Correct){let G=W===_1.Correct?C.operators.EQ:C.operators.NEQ,z;switch(Q){case"null":return C._`${Y} ${G} null`;case"array":z=C._`Array.isArray(${Y})`;break;case"object":z=C._`${Y} && typeof ${Y} == "object" && !Array.isArray(${Y})`;break;case"integer":z=J(C._`!(${Y} % 1) && !isNaN(${Y})`);break;case"number":z=J();break;default:return C._`typeof ${Y} ${G} ${Q}`}return W===_1.Correct?z:(0,C.not)(z);function J($=C.nil){return(0,C.and)(C._`typeof ${Y} == "number"`,$,X?C._`isFinite(${Y})`:C.nil)}}bz.checkDataType=yY;function uY(Q,Y,X,W){if(Q.length===1)return yY(Q[0],Y,X,W);let G,z=(0,Nz.toHash)(Q);if(z.array&&z.object){let J=C._`typeof ${Y} != "object"`;G=z.null?J:C._`!${Y} || ${J}`,delete z.null,delete z.array,delete z.object}else G=C.nil;if(z.number)delete z.integer;for(let J in z)G=(0,C.and)(G,yY(J,Y,X,W));return G}bz.checkDataTypes=uY;var nK={message:({schema:Q})=>`must be ${Q}`,params:({schema:Q,schemaValue:Y})=>typeof Q=="string"?C._`{type: ${Q}}`:C._`{type: ${Y}}`};function hY(Q){let Y=dK(Q);(0,lK.reportError)(Y,nK)}bz.reportTypeError=hY;function dK(Q){let{gen:Y,data:X,schema:W}=Q,G=(0,Nz.schemaRefOrVal)(Q,W,"type");return{gen:Y,keyword:"type",data:X,schema:W.type,schemaCode:G,schemaValue:G,parentSchema:W,params:{},it:Q}}});var Tz=Z((Iz)=>{Object.defineProperty(Iz,"__esModule",{value:!0});Iz.assignDefaults=void 0;var g1=k(),YD=f();function XD(Q,Y){let{properties:X,items:W}=Q.schema;if(Y==="object"&&X)for(let G in X)jz(Q,G,X[G].default);else if(Y==="array"&&Array.isArray(W))W.forEach((G,z)=>jz(Q,z,G.default))}Iz.assignDefaults=XD;function jz(Q,Y,X){let{gen:W,compositeRule:G,data:z,opts:J}=Q;if(X===void 0)return;let $=g1._`${z}${(0,g1.getProperty)(Y)}`;if(G){(0,YD.checkStrictMode)(Q,`default is ignored for: ${$}`);return}let H=g1._`${$} === undefined`;if(J.useDefaults==="empty")H=g1._`${H} || ${$} === null || ${$} === ""`;W.if(H,g1._`${$} = ${(0,g1.stringify)(X)}`)}});var j0=Z((Cz)=>{Object.defineProperty(Cz,"__esModule",{value:!0});Cz.validateUnion=Cz.validateArray=Cz.usePattern=Cz.callValidateCode=Cz.schemaProperties=Cz.allSchemaProperties=Cz.noPropertyInData=Cz.propertyInData=Cz.isOwnProperty=Cz.hasPropFunc=Cz.reportMissingProp=Cz.checkMissingProp=Cz.checkReportMissingProp=void 0;var n=k(),fY=f(),$1=r0(),WD=f();function GD(Q,Y){let{gen:X,data:W,it:G}=Q;X.if(mY(X,W,Y,G.opts.ownProperties),()=>{Q.setParams({missingProperty:n._`${Y}`},!0),Q.error()})}Cz.checkReportMissingProp=GD;function zD({gen:Q,data:Y,it:{opts:X}},W,G){return(0,n.or)(...W.map((z)=>(0,n.and)(mY(Q,Y,z,X.ownProperties),n._`${G} = ${z}`)))}Cz.checkMissingProp=zD;function JD(Q,Y){Q.setParams({missingProperty:Y},!0),Q.error()}Cz.reportMissingProp=JD;function Sz(Q){return Q.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:n._`Object.prototype.hasOwnProperty`})}Cz.hasPropFunc=Sz;function lY(Q,Y,X){return n._`${Sz(Q)}.call(${Y}, ${X})`}Cz.isOwnProperty=lY;function $D(Q,Y,X,W){let G=n._`${Y}${(0,n.getProperty)(X)} !== undefined`;return W?n._`${G} && ${lY(Q,Y,X)}`:G}Cz.propertyInData=$D;function mY(Q,Y,X,W){let G=n._`${Y}${(0,n.getProperty)(X)} === undefined`;return W?(0,n.or)(G,(0,n.not)(lY(Q,Y,X))):G}Cz.noPropertyInData=mY;function Rz(Q){return Q?Object.keys(Q).filter((Y)=>Y!=="__proto__"):[]}Cz.allSchemaProperties=Rz;function HD(Q,Y){return Rz(Y).filter((X)=>!(0,fY.alwaysValidSchema)(Q,Y[X]))}Cz.schemaProperties=HD;function AD({schemaCode:Q,data:Y,it:{gen:X,topSchemaRef:W,schemaPath:G,errorPath:z},it:J},$,H,A){let U=A?n._`${Q}, ${Y}, ${W}${G}`:Y,K=[[$1.default.instancePath,(0,n.strConcat)($1.default.instancePath,z)],[$1.default.parentData,J.parentData],[$1.default.parentDataProperty,J.parentDataProperty],[$1.default.rootData,$1.default.rootData]];if(J.opts.dynamicRef)K.push([$1.default.dynamicAnchors,$1.default.dynamicAnchors]);let D=n._`${U}, ${X.object(...K)}`;return H!==n.nil?n._`${$}.call(${H}, ${D})`:n._`${$}(${D})`}Cz.callValidateCode=AD;var UD=n._`new RegExp`;function KD({gen:Q,it:{opts:Y}},X){let W=Y.unicodeRegExp?"u":"",{regExp:G}=Y.code,z=G(X,W);return Q.scopeValue("pattern",{key:z.toString(),ref:z,code:n._`${G.code==="new RegExp"?UD:(0,WD.useFunc)(Q,G)}(${X}, ${W})`})}Cz.usePattern=KD;function DD(Q){let{gen:Y,data:X,keyword:W,it:G}=Q,z=Y.name("valid");if(G.allErrors){let $=Y.let("valid",!0);return J(()=>Y.assign($,!1)),$}return Y.var(z,!0),J(()=>Y.break()),z;function J($){let H=Y.const("len",n._`${X}.length`);Y.forRange("i",0,H,(A)=>{Q.subschema({keyword:W,dataProp:A,dataPropType:fY.Type.Num},z),Y.if((0,n.not)(z),$)})}}Cz.validateArray=DD;function BD(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,fY.alwaysValidSchema)(G,H))&&!G.opts.unevaluated)return;let J=Y.let("valid",!1),$=Y.name("_valid");Y.block(()=>X.forEach((H,A)=>{let U=Q.subschema({keyword:W,schemaProp:A,compositeRule:!0},$);if(Y.assign(J,n._`${J} || ${$}`),!Q.mergeValidEvaluated(U,$))Y.if((0,n.not)(J))})),Q.result(J,()=>Q.reset(),()=>Q.error(!0))}Cz.validateUnion=BD});var yz=Z((_z)=>{Object.defineProperty(_z,"__esModule",{value:!0});_z.validateKeywordUsage=_z.validSchemaType=_z.funcKeywordCode=_z.macroKeywordCode=void 0;var D0=k(),M1=r0(),ID=j0(),ED=V4();function TD(Q,Y){let{gen:X,keyword:W,schema:G,parentSchema:z,it:J}=Q,$=Y.macro.call(J.self,G,z,J),H=xz(X,W,$);if(J.opts.validateSchema!==!1)J.self.validateSchema($,!0);let A=X.name("valid");Q.subschema({schema:$,schemaPath:D0.nil,errSchemaPath:`${J.errSchemaPath}/${W}`,topSchemaRef:H,compositeRule:!0},A),Q.pass(A,()=>Q.error(!0))}_z.macroKeywordCode=TD;function SD(Q,Y){var X;let{gen:W,keyword:G,schema:z,parentSchema:J,$data:$,it:H}=Q;CD(H,Y);let A=!$&&Y.compile?Y.compile.call(H.self,z,J,H):Y.validate,U=xz(W,G,A),K=W.let("valid");Q.block$data(K,D),Q.ok((X=Y.valid)!==null&&X!==void 0?X:K);function D(){if(Y.errors===!1){if(O(),Y.modifying)kz(Q);V(()=>Q.error())}else{let M=Y.async?L():q();if(Y.modifying)kz(Q);V(()=>RD(Q,M))}}function L(){let M=W.let("ruleErrs",null);return W.try(()=>O(D0._`await `),(S)=>W.assign(K,!1).if(D0._`${S} instanceof ${H.ValidationError}`,()=>W.assign(M,D0._`${S}.errors`),()=>W.throw(S))),M}function q(){let M=D0._`${U}.errors`;return W.assign(M,null),O(D0.nil),M}function O(M=Y.async?D0._`await `:D0.nil){let S=H.opts.passContext?M1.default.this:M1.default.self,E=!(("compile"in Y)&&!$||Y.schema===!1);W.assign(K,D0._`${M}${(0,ID.callValidateCode)(Q,U,S,E)}`,Y.modifying)}function V(M){var S;W.if((0,D0.not)((S=Y.valid)!==null&&S!==void 0?S:K),M)}}_z.funcKeywordCode=SD;function kz(Q){let{gen:Y,data:X,it:W}=Q;Y.if(W.parentData,()=>Y.assign(X,D0._`${W.parentData}[${W.parentDataProperty}]`))}function RD(Q,Y){let{gen:X}=Q;X.if(D0._`Array.isArray(${Y})`,()=>{X.assign(M1.default.vErrors,D0._`${M1.default.vErrors} === null ? ${Y} : ${M1.default.vErrors}.concat(${Y})`).assign(M1.default.errors,D0._`${M1.default.vErrors}.length`),(0,ED.extendErrors)(Q)},()=>Q.error())}function CD({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,D0.stringify)(X)})}function vD(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")}_z.validSchemaType=vD;function kD({schema:Q,opts:Y,self:X,errSchemaPath:W},G,z){if(Array.isArray(G.keyword)?!G.keyword.includes(z):G.keyword!==z)throw Error("ajv implementation error");let J=G.dependencies;if(J===null||J===void 0?void 0:J.some(($)=>!Object.prototype.hasOwnProperty.call(Q,$)))throw Error(`parent schema must have dependencies of ${z}: ${J.join(",")}`);if(G.validateSchema){if(!G.validateSchema(Q[z])){let H=`keyword "${z}" value is invalid at path "${W}": `+X.errorsText(G.validateSchema.errors);if(Y.validateSchema==="log")X.logger.error(H);else throw Error(H)}}}_z.validateKeywordUsage=kD});var lz=Z((hz)=>{Object.defineProperty(hz,"__esModule",{value:!0});hz.extendSubschemaMode=hz.extendSubschemaData=hz.getSubschema=void 0;var g0=k(),uz=f();function yD(Q,{keyword:Y,schemaProp:X,schema:W,schemaPath:G,errSchemaPath:z,topSchemaRef:J}){if(Y!==void 0&&W!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(Y!==void 0){let $=Q.schema[Y];return X===void 0?{schema:$,schemaPath:g0._`${Q.schemaPath}${(0,g0.getProperty)(Y)}`,errSchemaPath:`${Q.errSchemaPath}/${Y}`}:{schema:$[X],schemaPath:g0._`${Q.schemaPath}${(0,g0.getProperty)(Y)}${(0,g0.getProperty)(X)}`,errSchemaPath:`${Q.errSchemaPath}/${Y}/${(0,uz.escapeFragment)(X)}`}}if(W!==void 0){if(G===void 0||z===void 0||J===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:W,schemaPath:G,topSchemaRef:J,errSchemaPath:z}}throw Error('either "keyword" or "schema" must be passed')}hz.getSubschema=yD;function uD(Q,Y,{dataProp:X,dataPropType:W,data:G,dataTypes:z,propertyName:J}){if(G!==void 0&&X!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:$}=Y;if(X!==void 0){let{errorPath:A,dataPathArr:U,opts:K}=Y,D=$.let("data",g0._`${Y.data}${(0,g0.getProperty)(X)}`,!0);H(D),Q.errorPath=g0.str`${A}${(0,uz.getErrorPath)(X,W,K.jsPropertySyntax)}`,Q.parentDataProperty=g0._`${X}`,Q.dataPathArr=[...U,Q.parentDataProperty]}if(G!==void 0){let A=G instanceof g0.Name?G:$.let("data",G,!0);if(H(A),J!==void 0)Q.propertyName=J}if(z)Q.dataTypes=z;function H(A){Q.data=A,Q.dataLevel=Y.dataLevel+1,Q.dataTypes=[],Y.definedProperties=new Set,Q.parentData=Y.data,Q.dataNames=[...Y.dataNames,A]}}hz.extendSubschemaData=uD;function hD(Q,{jtdDiscriminator:Y,jtdMetadata:X,compositeRule:W,createErrors:G,allErrors:z}){if(W!==void 0)Q.compositeRule=W;if(G!==void 0)Q.createErrors=G;if(z!==void 0)Q.allErrors=z;Q.jtdDiscriminator=Y,Q.jtdMetadata=X}hz.extendSubschemaMode=hD});var cY=Z((Jj,mz)=>{mz.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,z;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(z=Object.keys(Y),W=z.length,W!==Object.keys(X).length)return!1;for(G=W;G--!==0;)if(!Object.prototype.hasOwnProperty.call(X,z[G]))return!1;for(G=W;G--!==0;){var J=z[G];if(!Q(Y[J],X[J]))return!1}return!0}return Y!==Y&&X!==X}});var pz=Z(($j,cz)=>{var H1=cz.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(){};gQ(Y,W,G,Q,"",Q)};H1.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};H1.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};H1.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};H1.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function gQ(Q,Y,X,W,G,z,J,$,H,A){if(W&&typeof W=="object"&&!Array.isArray(W)){Y(W,G,z,J,$,H,A);for(var U in W){var K=W[U];if(Array.isArray(K)){if(U in H1.arrayKeywords)for(var D=0;D<K.length;D++)gQ(Q,Y,X,K[D],G+"/"+U+"/"+D,z,G,U,W,D)}else if(U in H1.propsKeywords){if(K&&typeof K=="object")for(var L in K)gQ(Q,Y,X,K[L],G+"/"+U+"/"+mD(L),z,G,U,W,L)}else if(U in H1.keywords||Q.allKeys&&!(U in H1.skipKeywords))gQ(Q,Y,X,K,G+"/"+U,z,G,U,W)}X(W,G,z,J,$,H,A)}}function mD(Q){return Q.replace(/~/g,"~0").replace(/\//g,"~1")}});var Z4=Z((dz)=>{Object.defineProperty(dz,"__esModule",{value:!0});dz.getSchemaRefs=dz.resolveUrl=dz.normalizeId=dz._getFullPath=dz.getFullPath=dz.inlineRef=void 0;var cD=f(),pD=cY(),iD=pz(),rD=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function nD(Q,Y=!0){if(typeof Q=="boolean")return!0;if(Y===!0)return!pY(Q);if(!Y)return!1;return iz(Q)<=Y}dz.inlineRef=nD;var dD=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function pY(Q){for(let Y in Q){if(dD.has(Y))return!0;let X=Q[Y];if(Array.isArray(X)&&X.some(pY))return!0;if(typeof X=="object"&&pY(X))return!0}return!1}function iz(Q){let Y=0;for(let X in Q){if(X==="$ref")return 1/0;if(Y++,rD.has(X))continue;if(typeof Q[X]=="object")(0,cD.eachItem)(Q[X],(W)=>Y+=iz(W));if(Y===1/0)return 1/0}return Y}function rz(Q,Y="",X){if(X!==!1)Y=y1(Y);let W=Q.parse(Y);return nz(Q,W)}dz.getFullPath=rz;function nz(Q,Y){return Q.serialize(Y).split("#")[0]+"#"}dz._getFullPath=nz;var oD=/#\/?$/;function y1(Q){return Q?Q.replace(oD,""):""}dz.normalizeId=y1;function tD(Q,Y,X){return X=y1(X),Q.resolve(Y,X)}dz.resolveUrl=tD;var aD=/^[a-z_][-a-z0-9._]*$/i;function sD(Q,Y){if(typeof Q=="boolean")return{};let{schemaId:X,uriResolver:W}=this.opts,G=y1(Q[X]||Y),z={"":G},J=rz(W,G,!1),$={},H=new Set;return iD(Q,{allKeys:!0},(K,D,L,q)=>{if(q===void 0)return;let O=J+D,V=z[q];if(typeof K[X]=="string")V=M.call(this,K[X]);S.call(this,K.$anchor),S.call(this,K.$dynamicAnchor),z[D]=V;function M(E){let x=this.opts.uriResolver.resolve;if(E=y1(V?x(V,E):E),H.has(E))throw U(E);H.add(E);let T=this.refs[E];if(typeof T=="string")T=this.refs[T];if(typeof T=="object")A(K,T.schema,E);else if(E!==y1(O))if(E[0]==="#")A(K,$[E],E),$[E]=K;else this.refs[E]=O;return E}function S(E){if(typeof E=="string"){if(!aD.test(E))throw Error(`invalid anchor "${E}"`);M.call(this,`#${E}`)}}}),$;function A(K,D,L){if(D!==void 0&&!pD(K,D))throw U(L)}function U(K){return Error(`reference "${K}" resolves to more than one schema`)}}dz.getSchemaRefs=sD});var P4=Z((UJ)=>{Object.defineProperty(UJ,"__esModule",{value:!0});UJ.getData=UJ.KeywordCxt=UJ.validateFunctionCode=void 0;var QJ=Bz(),tz=N4(),rY=gY(),yQ=N4(),GB=Tz(),b4=yz(),iY=lz(),P=k(),R=r0(),zB=Z4(),n0=f(),w4=V4();function JB(Q){if(WJ(Q)){if(GJ(Q),XJ(Q)){AB(Q);return}}YJ(Q,()=>(0,QJ.topBoolOrEmptySchema)(Q))}UJ.validateFunctionCode=JB;function YJ({gen:Q,validateName:Y,schema:X,schemaEnv:W,opts:G},z){if(G.code.es5)Q.func(Y,P._`${R.default.data}, ${R.default.valCxt}`,W.$async,()=>{Q.code(P._`"use strict"; ${az(X,G)}`),HB(Q,G),Q.code(z)});else Q.func(Y,P._`${R.default.data}, ${$B(G)}`,W.$async,()=>Q.code(az(X,G)).code(z))}function $B(Q){return P._`{${R.default.instancePath}="", ${R.default.parentData}, ${R.default.parentDataProperty}, ${R.default.rootData}=${R.default.data}${Q.dynamicRef?P._`, ${R.default.dynamicAnchors}={}`:P.nil}}={}`}function HB(Q,Y){Q.if(R.default.valCxt,()=>{if(Q.var(R.default.instancePath,P._`${R.default.valCxt}.${R.default.instancePath}`),Q.var(R.default.parentData,P._`${R.default.valCxt}.${R.default.parentData}`),Q.var(R.default.parentDataProperty,P._`${R.default.valCxt}.${R.default.parentDataProperty}`),Q.var(R.default.rootData,P._`${R.default.valCxt}.${R.default.rootData}`),Y.dynamicRef)Q.var(R.default.dynamicAnchors,P._`${R.default.valCxt}.${R.default.dynamicAnchors}`)},()=>{if(Q.var(R.default.instancePath,P._`""`),Q.var(R.default.parentData,P._`undefined`),Q.var(R.default.parentDataProperty,P._`undefined`),Q.var(R.default.rootData,R.default.data),Y.dynamicRef)Q.var(R.default.dynamicAnchors,P._`{}`)})}function AB(Q){let{schema:Y,opts:X,gen:W}=Q;YJ(Q,()=>{if(X.$comment&&Y.$comment)JJ(Q);if(LB(Q),W.let(R.default.vErrors,null),W.let(R.default.errors,0),X.unevaluated)UB(Q);zJ(Q),OB(Q)});return}function UB(Q){let{gen:Y,validateName:X}=Q;Q.evaluated=Y.const("evaluated",P._`${X}.evaluated`),Y.if(P._`${Q.evaluated}.dynamicProps`,()=>Y.assign(P._`${Q.evaluated}.props`,P._`undefined`)),Y.if(P._`${Q.evaluated}.dynamicItems`,()=>Y.assign(P._`${Q.evaluated}.items`,P._`undefined`))}function az(Q,Y){let X=typeof Q=="object"&&Q[Y.schemaId];return X&&(Y.code.source||Y.code.process)?P._`/*# sourceURL=${X} */`:P.nil}function KB(Q,Y){if(WJ(Q)){if(GJ(Q),XJ(Q)){DB(Q,Y);return}}(0,QJ.boolOrEmptySchema)(Q,Y)}function XJ({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 WJ(Q){return typeof Q.schema!="boolean"}function DB(Q,Y){let{schema:X,gen:W,opts:G}=Q;if(G.$comment&&X.$comment)JJ(Q);FB(Q),qB(Q);let z=W.const("_errs",R.default.errors);zJ(Q,z),W.var(Y,P._`${z} === ${R.default.errors}`)}function GJ(Q){(0,n0.checkUnknownRules)(Q),BB(Q)}function zJ(Q,Y){if(Q.opts.jtd)return sz(Q,[],!1,Y);let X=(0,tz.getSchemaTypes)(Q.schema),W=(0,tz.coerceAndCheckDataType)(Q,X);sz(Q,X,!W,Y)}function BB(Q){let{schema:Y,errSchemaPath:X,opts:W,self:G}=Q;if(Y.$ref&&W.ignoreKeywordsWithRef&&(0,n0.schemaHasRulesButRef)(Y,G.RULES))G.logger.warn(`$ref: keywords ignored in schema at path "${X}"`)}function LB(Q){let{schema:Y,opts:X}=Q;if(Y.default!==void 0&&X.useDefaults&&X.strictSchema)(0,n0.checkStrictMode)(Q,"default is ignored in the schema root")}function FB(Q){let Y=Q.schema[Q.opts.schemaId];if(Y)Q.baseId=(0,zB.resolveUrl)(Q.opts.uriResolver,Q.baseId,Y)}function qB(Q){if(Q.schema.$async&&!Q.schemaEnv.$async)throw Error("async schema in sync schema")}function JJ({gen:Q,schemaEnv:Y,schema:X,errSchemaPath:W,opts:G}){let z=X.$comment;if(G.$comment===!0)Q.code(P._`${R.default.self}.logger.log(${z})`);else if(typeof G.$comment=="function"){let J=P.str`${W}/$comment`,$=Q.scopeValue("root",{ref:Y.root});Q.code(P._`${R.default.self}.opts.$comment(${z}, ${J}, ${$}.schema)`)}}function OB(Q){let{gen:Y,schemaEnv:X,validateName:W,ValidationError:G,opts:z}=Q;if(X.$async)Y.if(P._`${R.default.errors} === 0`,()=>Y.return(R.default.data),()=>Y.throw(P._`new ${G}(${R.default.vErrors})`));else{if(Y.assign(P._`${W}.errors`,R.default.vErrors),z.unevaluated)MB(Q);Y.return(P._`${R.default.errors} === 0`)}}function MB({gen:Q,evaluated:Y,props:X,items:W}){if(X instanceof P.Name)Q.assign(P._`${Y}.props`,X);if(W instanceof P.Name)Q.assign(P._`${Y}.items`,W)}function sz(Q,Y,X,W){let{gen:G,schema:z,data:J,allErrors:$,opts:H,self:A}=Q,{RULES:U}=A;if(z.$ref&&(H.ignoreKeywordsWithRef||!(0,n0.schemaHasRulesButRef)(z,U))){G.block(()=>HJ(Q,"$ref",U.all.$ref.definition));return}if(!H.jtd)VB(Q,Y);G.block(()=>{for(let D of U.rules)K(D);K(U.post)});function K(D){if(!(0,rY.shouldUseGroup)(z,D))return;if(D.type){if(G.if((0,yQ.checkDataType)(D.type,J,H.strictNumbers)),ez(Q,D),Y.length===1&&Y[0]===D.type&&X)G.else(),(0,yQ.reportTypeError)(Q);G.endIf()}else ez(Q,D);if(!$)G.if(P._`${R.default.errors} === ${W||0}`)}}function ez(Q,Y){let{gen:X,schema:W,opts:{useDefaults:G}}=Q;if(G)(0,GB.assignDefaults)(Q,Y.type);X.block(()=>{for(let z of Y.rules)if((0,rY.shouldUseRule)(W,z))HJ(Q,z.keyword,z.definition,Y.type)})}function VB(Q,Y){if(Q.schemaEnv.meta||!Q.opts.strictTypes)return;if(NB(Q,Y),!Q.opts.allowUnionTypes)ZB(Q,Y);wB(Q,Q.dataTypes)}function NB(Q,Y){if(!Y.length)return;if(!Q.dataTypes.length){Q.dataTypes=Y;return}Y.forEach((X)=>{if(!$J(Q.dataTypes,X))nY(Q,`type "${X}" not allowed by context "${Q.dataTypes.join(",")}"`)}),PB(Q,Y)}function ZB(Q,Y){if(Y.length>1&&!(Y.length===2&&Y.includes("null")))nY(Q,"use allowUnionTypes to allow union type keyword")}function wB(Q,Y){let X=Q.self.RULES.all;for(let W in X){let G=X[W];if(typeof G=="object"&&(0,rY.shouldUseRule)(Q.schema,G)){let{type:z}=G.definition;if(z.length&&!z.some((J)=>bB(Y,J)))nY(Q,`missing type "${z.join(",")}" for keyword "${W}"`)}}}function bB(Q,Y){return Q.includes(Y)||Y==="number"&&Q.includes("integer")}function $J(Q,Y){return Q.includes(Y)||Y==="integer"&&Q.includes("number")}function PB(Q,Y){let X=[];for(let W of Q.dataTypes)if($J(Y,W))X.push(W);else if(Y.includes("integer")&&W==="number")X.push("integer");Q.dataTypes=X}function nY(Q,Y){let X=Q.schemaEnv.baseId+Q.errSchemaPath;Y+=` at "${X}" (strictTypes)`,(0,n0.checkStrictMode)(Q,Y,Q.opts.strictTypes)}class dY{constructor(Q,Y,X){if((0,b4.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,n0.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",AJ(this.$data,Q));else if(this.schemaCode=this.schemaValue,!(0,b4.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",R.default.errors)}result(Q,Y,X){this.failResult((0,P.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,P.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(P._`${Y} !== undefined && (${(0,P.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?w4.reportExtraError:w4.reportError)(this,this.def.error,Y)}$dataError(){(0,w4.reportError)(this,this.def.$dataError||w4.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,w4.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=P.nil){this.gen.block(()=>{this.check$data(Q,X),Y()})}check$data(Q=P.nil,Y=P.nil){if(!this.$data)return;let{gen:X,schemaCode:W,schemaType:G,def:z}=this;if(X.if((0,P.or)(P._`${W} === undefined`,Y)),Q!==P.nil)X.assign(Q,!0);if(G.length||z.validateSchema){if(X.elseIf(this.invalid$data()),this.$dataError(),Q!==P.nil)X.assign(Q,!1)}X.else()}invalid$data(){let{gen:Q,schemaCode:Y,schemaType:X,def:W,it:G}=this;return(0,P.or)(z(),J());function z(){if(X.length){if(!(Y instanceof P.Name))throw Error("ajv implementation error");let $=Array.isArray(X)?X:[X];return P._`${(0,yQ.checkDataTypes)($,Y,G.opts.strictNumbers,yQ.DataType.Wrong)}`}return P.nil}function J(){if(W.validateSchema){let $=Q.scopeValue("validate$data",{ref:W.validateSchema});return P._`!${$}(${Y})`}return P.nil}}subschema(Q,Y){let X=(0,iY.getSubschema)(this.it,Q);(0,iY.extendSubschemaData)(X,this.it,Q),(0,iY.extendSubschemaMode)(X,Q);let W={...this.it,...X,items:void 0,props:void 0};return KB(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=n0.mergeEvaluated.props(W,Q.props,X.props,Y);if(X.items!==!0&&Q.items!==void 0)X.items=n0.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,P.Name)),!0}}UJ.KeywordCxt=dY;function HJ(Q,Y,X,W){let G=new dY(Q,X,Y);if("code"in X)X.code(G,W);else if(G.$data&&X.validate)(0,b4.funcKeywordCode)(G,X);else if("macro"in X)(0,b4.macroKeywordCode)(G,X);else if(X.compile||X.validate)(0,b4.funcKeywordCode)(G,X)}var jB=/^\/(?:[^~]|~0|~1)*$/,IB=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function AJ(Q,{dataLevel:Y,dataNames:X,dataPathArr:W}){let G,z;if(Q==="")return R.default.rootData;if(Q[0]==="/"){if(!jB.test(Q))throw Error(`Invalid JSON-pointer: ${Q}`);G=Q,z=R.default.rootData}else{let A=IB.exec(Q);if(!A)throw Error(`Invalid JSON-pointer: ${Q}`);let U=+A[1];if(G=A[2],G==="#"){if(U>=Y)throw Error(H("property/index",U));return W[Y-U]}if(U>Y)throw Error(H("data",U));if(z=X[Y-U],!G)return z}let J=z,$=G.split("/");for(let A of $)if(A)z=P._`${z}${(0,P.getProperty)((0,n0.unescapeJsonPointer)(A))}`,J=P._`${J} && ${z}`;return J;function H(A,U){return`Cannot access ${A} ${U} levels up, current level is ${Y}`}}UJ.getData=AJ});var uQ=Z((BJ)=>{Object.defineProperty(BJ,"__esModule",{value:!0});class DJ extends Error{constructor(Q){super("validation failed");this.errors=Q,this.ajv=this.validation=!0}}BJ.default=DJ});var j4=Z((FJ)=>{Object.defineProperty(FJ,"__esModule",{value:!0});var oY=Z4();class LJ extends Error{constructor(Q,Y,X,W){super(W||`can't resolve reference ${X} from id ${Y}`);this.missingRef=(0,oY.resolveUrl)(Q,Y,X),this.missingSchema=(0,oY.normalizeId)((0,oY.getFullPath)(Q,this.missingRef))}}FJ.default=LJ});var fQ=Z((MJ)=>{Object.defineProperty(MJ,"__esModule",{value:!0});MJ.resolveSchema=MJ.getCompilingSchema=MJ.resolveRef=MJ.compileSchema=MJ.SchemaEnv=void 0;var C0=k(),CB=uQ(),V1=r0(),v0=Z4(),qJ=f(),vB=P4();class I4{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,v0.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={}}}MJ.SchemaEnv=I4;function aY(Q){let Y=OJ.call(this,Q);if(Y)return Y;let X=(0,v0.getFullPath)(this.opts.uriResolver,Q.root.baseId),{es5:W,lines:G}=this.opts.code,{ownProperties:z}=this.opts,J=new C0.CodeGen(this.scope,{es5:W,lines:G,ownProperties:z}),$;if(Q.$async)$=J.scopeValue("Error",{ref:CB.default,code:C0._`require("ajv/dist/runtime/validation_error").default`});let H=J.scopeName("validate");Q.validateName=H;let A={gen:J,allErrors:this.opts.allErrors,data:V1.default.data,parentData:V1.default.parentData,parentDataProperty:V1.default.parentDataProperty,dataNames:[V1.default.data],dataPathArr:[C0.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:J.scopeValue("schema",this.opts.code.source===!0?{ref:Q.schema,code:(0,C0.stringify)(Q.schema)}:{ref:Q.schema}),validateName:H,ValidationError:$,schema:Q.schema,schemaEnv:Q,rootId:X,baseId:Q.baseId||X,schemaPath:C0.nil,errSchemaPath:Q.schemaPath||(this.opts.jtd?"":"#"),errorPath:C0._`""`,opts:this.opts,self:this},U;try{this._compilations.add(Q),(0,vB.validateFunctionCode)(A),J.optimize(this.opts.code.optimize);let K=J.toString();if(U=`${J.scopeRefs(V1.default.scope)}return ${K}`,this.opts.code.process)U=this.opts.code.process(U,Q);let L=Function(`${V1.default.self}`,`${V1.default.scope}`,U)(this,this.scope.get());if(this.scope.value(H,{ref:L}),L.errors=null,L.schema=Q.schema,L.schemaEnv=Q,Q.$async)L.$async=!0;if(this.opts.code.source===!0)L.source={validateName:H,validateCode:K,scopeValues:J._values};if(this.opts.unevaluated){let{props:q,items:O}=A;if(L.evaluated={props:q instanceof C0.Name?void 0:q,items:O instanceof C0.Name?void 0:O,dynamicProps:q instanceof C0.Name,dynamicItems:O instanceof C0.Name},L.source)L.source.evaluated=(0,C0.stringify)(L.evaluated)}return Q.validate=L,Q}catch(K){if(delete Q.validate,delete Q.validateName,U)this.logger.error("Error compiling schema, function code:",U);throw K}finally{this._compilations.delete(Q)}}MJ.compileSchema=aY;function kB(Q,Y,X){var W;X=(0,v0.resolveUrl)(this.opts.uriResolver,Y,X);let G=Q.refs[X];if(G)return G;let z=gB.call(this,Q,X);if(z===void 0){let J=(W=Q.localRefs)===null||W===void 0?void 0:W[X],{schemaId:$}=this.opts;if(J)z=new I4({schema:J,schemaId:$,root:Q,baseId:Y})}if(z===void 0)return;return Q.refs[X]=xB.call(this,z)}MJ.resolveRef=kB;function xB(Q){if((0,v0.inlineRef)(Q.schema,this.opts.inlineRefs))return Q.schema;return Q.validate?Q:aY.call(this,Q)}function OJ(Q){for(let Y of this._compilations)if(_B(Y,Q))return Y}MJ.getCompilingSchema=OJ;function _B(Q,Y){return Q.schema===Y.schema&&Q.root===Y.root&&Q.baseId===Y.baseId}function gB(Q,Y){let X;while(typeof(X=this.refs[Y])=="string")Y=X;return X||this.schemas[Y]||hQ.call(this,Q,Y)}function hQ(Q,Y){let X=this.opts.uriResolver.parse(Y),W=(0,v0._getFullPath)(this.opts.uriResolver,X),G=(0,v0.getFullPath)(this.opts.uriResolver,Q.baseId,void 0);if(Object.keys(Q.schema).length>0&&W===G)return tY.call(this,X,Q);let z=(0,v0.normalizeId)(W),J=this.refs[z]||this.schemas[z];if(typeof J=="string"){let $=hQ.call(this,Q,J);if(typeof($===null||$===void 0?void 0:$.schema)!=="object")return;return tY.call(this,X,$)}if(typeof(J===null||J===void 0?void 0:J.schema)!=="object")return;if(!J.validate)aY.call(this,J);if(z===(0,v0.normalizeId)(Y)){let{schema:$}=J,{schemaId:H}=this.opts,A=$[H];if(A)G=(0,v0.resolveUrl)(this.opts.uriResolver,G,A);return new I4({schema:$,schemaId:H,root:Q,baseId:G})}return tY.call(this,X,J)}MJ.resolveSchema=hQ;var yB=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function tY(Q,{baseId:Y,schema:X,root:W}){var G;if(((G=Q.fragment)===null||G===void 0?void 0:G[0])!=="/")return;for(let $ of Q.fragment.slice(1).split("/")){if(typeof X==="boolean")return;let H=X[(0,qJ.unescapeFragment)($)];if(H===void 0)return;X=H;let A=typeof X==="object"&&X[this.opts.schemaId];if(!yB.has($)&&A)Y=(0,v0.resolveUrl)(this.opts.uriResolver,Y,A)}let z;if(typeof X!="boolean"&&X.$ref&&!(0,qJ.schemaHasRulesButRef)(X,this.RULES)){let $=(0,v0.resolveUrl)(this.opts.uriResolver,Y,X.$ref);z=hQ.call(this,W,$)}let{schemaId:J}=this.opts;if(z=z||new I4({schema:X,schemaId:J,root:W,baseId:Y}),z.schema!==z.root.schema)return z;return}});var NJ=Z((Bj,mB)=>{mB.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 eY=Z((Lj,PJ)=>{var cB=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),wJ=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 sY(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 pB=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function ZJ(Q){return Q.length=0,!0}function iB(Q,Y,X){if(Q.length){let W=sY(Q);if(W!=="")Y.push(W);else return X.error=!0,!1;Q.length=0}return!0}function rB(Q){let Y=0,X={error:!1,address:"",zone:""},W=[],G=[],z=!1,J=!1,$=iB;for(let H=0;H<Q.length;H++){let A=Q[H];if(A==="["||A==="]")continue;if(A===":"){if(z===!0)J=!0;if(!$(G,W,X))break;if(++Y>7){X.error=!0;break}if(H>0&&Q[H-1]===":")z=!0;W.push(":");continue}else if(A==="%"){if(!$(G,W,X))break;$=ZJ}else{G.push(A);continue}}if(G.length)if($===ZJ)X.zone=G.join("");else if(J)W.push(G.join(""));else W.push(sY(G));return X.address=W.join(""),X}function bJ(Q){if(nB(Q,":")<2)return{host:Q,isIPV6:!1};let Y=rB(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 nB(Q,Y){let X=0;for(let W=0;W<Q.length;W++)if(Q[W]===Y)X++;return X}function dB(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 oB(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 tB(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(!wJ(X)){let W=bJ(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}PJ.exports={nonSimpleDomain:pB,recomposeAuthority:tB,normalizeComponentEncoding:oB,removeDotSegments:dB,isIPv4:wJ,isUUID:cB,normalizeIPv6:bJ,stringArrayToHexStripped:sY}});var SJ=Z((Fj,TJ)=>{var{isUUID:aB}=eY(),sB=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,eB=["http","https","ws","wss","urn","urn:uuid"];function QL(Q){return eB.indexOf(Q)!==-1}function Q9(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 jJ(Q){if(!Q.host)Q.error=Q.error||"HTTP URIs must have a host.";return Q}function IJ(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 YL(Q){return Q.secure=Q9(Q),Q.resourceName=(Q.path||"/")+(Q.query?"?"+Q.query:""),Q.path=void 0,Q.query=void 0,Q}function XL(Q){if(Q.port===(Q9(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 WL(Q,Y){if(!Q.path)return Q.error="URN can not be parsed",Q;let X=Q.path.match(sB);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}`,z=Y9(G);if(Q.path=void 0,z)Q=z.parse(Q,Y)}else Q.error=Q.error||"URN can not be parsed.";return Q}function GL(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}`,z=Y9(G);if(z)Q=z.serialize(Q,Y);let J=Q,$=Q.nss;return J.path=`${W||Y.nid}:${$}`,Y.skipEscape=!0,J}function zL(Q,Y){let X=Q;if(X.uuid=X.nss,X.nss=void 0,!Y.tolerant&&(!X.uuid||!aB(X.uuid)))X.error=X.error||"UUID is not valid.";return X}function JL(Q){let Y=Q;return Y.nss=(Q.uuid||"").toLowerCase(),Y}var EJ={scheme:"http",domainHost:!0,parse:jJ,serialize:IJ},$L={scheme:"https",domainHost:EJ.domainHost,parse:jJ,serialize:IJ},lQ={scheme:"ws",domainHost:!0,parse:YL,serialize:XL},HL={scheme:"wss",domainHost:lQ.domainHost,parse:lQ.parse,serialize:lQ.serialize},AL={scheme:"urn",parse:WL,serialize:GL,skipNormalize:!0},UL={scheme:"urn:uuid",parse:zL,serialize:JL,skipNormalize:!0},mQ={http:EJ,https:$L,ws:lQ,wss:HL,urn:AL,"urn:uuid":UL};Object.setPrototypeOf(mQ,null);function Y9(Q){return Q&&(mQ[Q]||mQ[Q.toLowerCase()])||void 0}TJ.exports={wsIsSecure:Q9,SCHEMES:mQ,isValidSchemeName:QL,getSchemeHandler:Y9}});var vJ=Z((qj,pQ)=>{var{normalizeIPv6:KL,removeDotSegments:E4,recomposeAuthority:DL,normalizeComponentEncoding:cQ,isIPv4:BL,nonSimpleDomain:LL}=eY(),{SCHEMES:FL,getSchemeHandler:RJ}=SJ();function qL(Q,Y){if(typeof Q==="string")Q=y0(d0(Q,Y),Y);else if(typeof Q==="object")Q=d0(y0(Q,Y),Y);return Q}function OL(Q,Y,X){let W=X?Object.assign({scheme:"null"},X):{scheme:"null"},G=CJ(d0(Q,W),d0(Y,W),W,!0);return W.skipEscape=!0,y0(G,W)}function CJ(Q,Y,X,W){let G={};if(!W)Q=d0(y0(Q,X),X),Y=d0(y0(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=E4(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=E4(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=E4(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=E4(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=y0(cQ(d0(Q,X),!0),{...X,skipEscape:!0});else if(typeof Q==="object")Q=y0(cQ(Q,!0),{...X,skipEscape:!0});if(typeof Y==="string")Y=unescape(Y),Y=y0(cQ(d0(Y,X),!0),{...X,skipEscape:!0});else if(typeof Y==="object")Y=y0(cQ(Y,!0),{...X,skipEscape:!0});return Q.toLowerCase()===Y.toLowerCase()}function y0(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=[],z=RJ(W.scheme||X.scheme);if(z&&z.serialize)z.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 J=DL(X);if(J!==void 0){if(W.reference!=="suffix")G.push("//");if(G.push(J),X.path&&X.path[0]!=="/")G.push("/")}if(X.path!==void 0){let $=X.path;if(!W.absolutePath&&(!z||!z.absolutePath))$=E4($);if(J===void 0&&$[0]==="/"&&$[1]==="/")$="/%2F"+$.slice(2);G.push($)}if(X.query!==void 0)G.push("?",X.query);if(X.fragment!==void 0)G.push("#",X.fragment);return G.join("")}var VL=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function d0(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 z=Q.match(VL);if(z){if(W.scheme=z[1],W.userinfo=z[3],W.host=z[4],W.port=parseInt(z[5],10),W.path=z[6]||"",W.query=z[7],W.fragment=z[8],isNaN(W.port))W.port=z[5];if(W.host)if(BL(W.host)===!1){let H=KL(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 J=RJ(X.scheme||W.scheme);if(!X.unicodeSupport&&(!J||!J.unicodeSupport)){if(W.host&&(X.domainHost||J&&J.domainHost)&&G===!1&&LL(W.host))try{W.host=URL.domainToASCII(W.host.toLowerCase())}catch($){W.error=W.error||"Host's domain name can not be converted to ASCII: "+$}}if(!J||J&&!J.skipNormalize){if(Q.indexOf("%")!==-1){if(W.scheme!==void 0)W.scheme=unescape(W.scheme);if(W.host!==void 0)W.host=unescape(W.host)}if(W.path)W.path=escape(unescape(W.path));if(W.fragment)W.fragment=encodeURI(decodeURIComponent(W.fragment))}if(J&&J.parse)J.parse(W,X)}else W.error=W.error||"URI can not be parsed.";return W}var X9={SCHEMES:FL,normalize:qL,resolve:OL,resolveComponent:CJ,equal:ML,serialize:y0,parse:d0};pQ.exports=X9;pQ.exports.default=X9;pQ.exports.fastUri=X9});var _J=Z((xJ)=>{Object.defineProperty(xJ,"__esModule",{value:!0});var kJ=vJ();kJ.code='require("ajv/dist/runtime/uri").default';xJ.default=kJ});var cJ=Z((o0)=>{Object.defineProperty(o0,"__esModule",{value:!0});o0.CodeGen=o0.Name=o0.nil=o0.stringify=o0.str=o0._=o0.KeywordCxt=void 0;var ZL=P4();Object.defineProperty(o0,"KeywordCxt",{enumerable:!0,get:function(){return ZL.KeywordCxt}});var u1=k();Object.defineProperty(o0,"_",{enumerable:!0,get:function(){return u1._}});Object.defineProperty(o0,"str",{enumerable:!0,get:function(){return u1.str}});Object.defineProperty(o0,"stringify",{enumerable:!0,get:function(){return u1.stringify}});Object.defineProperty(o0,"nil",{enumerable:!0,get:function(){return u1.nil}});Object.defineProperty(o0,"Name",{enumerable:!0,get:function(){return u1.Name}});Object.defineProperty(o0,"CodeGen",{enumerable:!0,get:function(){return u1.CodeGen}});var wL=uQ(),fJ=j4(),bL=_Y(),T4=fQ(),PL=k(),S4=Z4(),iQ=N4(),G9=f(),gJ=NJ(),jL=_J(),lJ=(Q,Y)=>new RegExp(Q,Y);lJ.code="new RegExp";var IL=["removeAdditional","useDefaults","coerceTypes"],EL=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),TL={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."},SL={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},yJ=200;function RL(Q){var Y,X,W,G,z,J,$,H,A,U,K,D,L,q,O,V,M,S,E,x,T,_0,f0,K6,D6;let c1=Q.strict,B6=(Y=Q.code)===null||Y===void 0?void 0:Y.optimize,v9=B6===!0||B6===void 0?1:B6||0,k9=(W=(X=Q.code)===null||X===void 0?void 0:X.regExp)!==null&&W!==void 0?W:lJ,E5=(G=Q.uriResolver)!==null&&G!==void 0?G:jL.default;return{strictSchema:(J=(z=Q.strictSchema)!==null&&z!==void 0?z:c1)!==null&&J!==void 0?J:!0,strictNumbers:(H=($=Q.strictNumbers)!==null&&$!==void 0?$:c1)!==null&&H!==void 0?H:!0,strictTypes:(U=(A=Q.strictTypes)!==null&&A!==void 0?A:c1)!==null&&U!==void 0?U:"log",strictTuples:(D=(K=Q.strictTuples)!==null&&K!==void 0?K:c1)!==null&&D!==void 0?D:"log",strictRequired:(q=(L=Q.strictRequired)!==null&&L!==void 0?L:c1)!==null&&q!==void 0?q:!1,code:Q.code?{...Q.code,optimize:v9,regExp:k9}:{optimize:v9,regExp:k9},loopRequired:(O=Q.loopRequired)!==null&&O!==void 0?O:yJ,loopEnum:(V=Q.loopEnum)!==null&&V!==void 0?V:yJ,meta:(M=Q.meta)!==null&&M!==void 0?M:!0,messages:(S=Q.messages)!==null&&S!==void 0?S:!0,inlineRefs:(E=Q.inlineRefs)!==null&&E!==void 0?E:!0,schemaId:(x=Q.schemaId)!==null&&x!==void 0?x:"$id",addUsedSchema:(T=Q.addUsedSchema)!==null&&T!==void 0?T:!0,validateSchema:(_0=Q.validateSchema)!==null&&_0!==void 0?_0:!0,validateFormats:(f0=Q.validateFormats)!==null&&f0!==void 0?f0:!0,unicodeRegExp:(K6=Q.unicodeRegExp)!==null&&K6!==void 0?K6:!0,int32range:(D6=Q.int32range)!==null&&D6!==void 0?D6:!0,uriResolver:E5}}class rQ{constructor(Q={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,Q=this.opts={...Q,...RL(Q)};let{es5:Y,lines:X}=this.opts.code;this.scope=new PL.ValueScope({scope:{},prefixes:EL,es5:Y,lines:X}),this.logger=gL(Q.logger);let W=Q.validateFormats;if(Q.validateFormats=!1,this.RULES=(0,bL.getRules)(),uJ.call(this,TL,Q,"NOT SUPPORTED"),uJ.call(this,SL,Q,"DEPRECATED","warn"),this._metaOpts=xL.call(this),Q.formats)vL.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),Q.keywords)kL.call(this,Q.keywords);if(typeof Q.meta=="object")this.addMetaSchema(Q.meta);CL.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(A,U){await G.call(this,A.$schema);let K=this._addSchema(A,U);return K.validate||z.call(this,K)}async function G(A){if(A&&!this.getSchema(A))await W.call(this,{$ref:A},!0)}async function z(A){try{return this._compileSchemaEnv(A)}catch(U){if(!(U instanceof fJ.default))throw U;return J.call(this,U),await $.call(this,U.missingSchema),z.call(this,A)}}function J({missingSchema:A,missingRef:U}){if(this.refs[A])throw Error(`AnySchema ${A} is loaded but ${U} cannot be resolved`)}async function $(A){let U=await H.call(this,A);if(!this.refs[A])await G.call(this,U.$schema);if(!this.refs[A])this.addSchema(U,A,Y)}async function H(A){let U=this._loading[A];if(U)return U;try{return await(this._loading[A]=X(A))}finally{delete this._loading[A]}}}addSchema(Q,Y,X,W=this.opts.validateSchema){if(Array.isArray(Q)){for(let z of Q)this.addSchema(z,void 0,X,W);return this}let G;if(typeof Q==="object"){let{schemaId:z}=this.opts;if(G=Q[z],G!==void 0&&typeof G!="string")throw Error(`schema ${z} must be string`)}return Y=(0,S4.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=hJ.call(this,Q))=="string")Q=Y;if(Y===void 0){let{schemaId:X}=this.opts,W=new T4.SchemaEnv({schema:{},schemaId:X});if(Y=T4.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=hJ.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,S4.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(uL.call(this,X,Y),!Y)return(0,G9.eachItem)(X,(G)=>W9.call(this,G)),this;fL.call(this,Y);let W={...Y,type:(0,iQ.getJSONTypes)(Y.type),schemaType:(0,iQ.getJSONTypes)(Y.schemaType)};return(0,G9.eachItem)(X,W.type.length===0?(G)=>W9.call(this,G,W):(G)=>W.type.forEach((z)=>W9.call(this,G,W,z))),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),z=Q;for(let J of G)z=z[J];for(let J in X){let $=X[J];if(typeof $!="object")continue;let{$data:H}=$.definition,A=z[J];if(H&&A)z[J]=mJ(A)}}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 z,{schemaId:J}=this.opts;if(typeof Q=="object")z=Q[J];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof Q!="boolean")throw Error("schema must be object or boolean");let $=this._cache.get(Q);if($!==void 0)return $;X=(0,S4.normalizeId)(z||X);let H=S4.getSchemaRefs.call(this,Q,X);if($=new T4.SchemaEnv({schema:Q,schemaId:J,meta:Y,baseId:X,localRefs:H}),this._cache.set($.schema,$),G&&!X.startsWith("#")){if(X)this._checkUnique(X);this.refs[X]=$}if(W)this.validateSchema(Q,!0);return $}_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 T4.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{T4.compileSchema.call(this,Q)}finally{this.opts=Y}}}rQ.ValidationError=wL.default;rQ.MissingRefError=fJ.default;o0.default=rQ;function uJ(Q,Y,X,W="error"){for(let G in Q){let z=G;if(z in Y)this.logger[W](`${X}: option ${G}. ${Q[z]}`)}}function hJ(Q){return Q=(0,S4.normalizeId)(Q),this.schemas[Q]||this.refs[Q]}function CL(){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 vL(){for(let Q in this.opts.formats){let Y=this.opts.formats[Q];if(Y)this.addFormat(Q,Y)}}function kL(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 xL(){let Q={...this.opts};for(let Y of IL)delete Q[Y];return Q}var _L={log(){},warn(){},error(){}};function gL(Q){if(Q===!1)return _L;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 yL=/^[a-z_$][a-z0-9_$:-]*$/i;function uL(Q,Y){let{RULES:X}=this;if((0,G9.eachItem)(Q,(W)=>{if(X.keywords[W])throw Error(`Keyword ${W} is already defined`);if(!yL.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 W9(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:z}=this,J=G?z.post:z.rules.find(({type:H})=>H===X);if(!J)J={type:X,rules:[]},z.rules.push(J);if(z.keywords[Q]=!0,!Y)return;let $={keyword:Q,definition:{...Y,type:(0,iQ.getJSONTypes)(Y.type),schemaType:(0,iQ.getJSONTypes)(Y.schemaType)}};if(Y.before)hL.call(this,J,$,Y.before);else J.rules.push($);z.all[Q]=$,(W=Y.implements)===null||W===void 0||W.forEach((H)=>this.addKeyword(H))}function hL(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 fL(Q){let{metaSchema:Y}=Q;if(Y===void 0)return;if(Q.$data&&this.opts.$data)Y=mJ(Y);Q.validateSchema=this.compile(Y,!0)}var lL={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function mJ(Q){return{anyOf:[Q,lL]}}});var iJ=Z((pJ)=>{Object.defineProperty(pJ,"__esModule",{value:!0});var pL={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};pJ.default=pL});var aJ=Z((oJ)=>{Object.defineProperty(oJ,"__esModule",{value:!0});oJ.callRef=oJ.getValidate=void 0;var rL=j4(),rJ=j0(),O0=k(),h1=r0(),nJ=fQ(),nQ=f(),nL={keyword:"$ref",schemaType:"string",code(Q){let{gen:Y,schema:X,it:W}=Q,{baseId:G,schemaEnv:z,validateName:J,opts:$,self:H}=W,{root:A}=z;if((X==="#"||X==="#/")&&G===A.baseId)return K();let U=nJ.resolveRef.call(H,A,G,X);if(U===void 0)throw new rL.default(W.opts.uriResolver,G,X);if(U instanceof nJ.SchemaEnv)return D(U);return L(U);function K(){if(z===A)return dQ(Q,J,z,z.$async);let q=Y.scopeValue("root",{ref:A});return dQ(Q,O0._`${q}.validate`,A,A.$async)}function D(q){let O=dJ(Q,q);dQ(Q,O,q,q.$async)}function L(q){let O=Y.scopeValue("schema",$.code.source===!0?{ref:q,code:(0,O0.stringify)(q)}:{ref:q}),V=Y.name("valid"),M=Q.subschema({schema:q,dataTypes:[],schemaPath:O0.nil,topSchemaRef:O,errSchemaPath:X},V);Q.mergeEvaluated(M),Q.ok(V)}}};function dJ(Q,Y){let{gen:X}=Q;return Y.validate?X.scopeValue("validate",{ref:Y.validate}):O0._`${X.scopeValue("wrapper",{ref:Y})}.validate`}oJ.getValidate=dJ;function dQ(Q,Y,X,W){let{gen:G,it:z}=Q,{allErrors:J,schemaEnv:$,opts:H}=z,A=H.passContext?h1.default.this:O0.nil;if(W)U();else K();function U(){if(!$.$async)throw Error("async schema referenced by sync schema");let q=G.let("valid");G.try(()=>{if(G.code(O0._`await ${(0,rJ.callValidateCode)(Q,Y,A)}`),L(Y),!J)G.assign(q,!0)},(O)=>{if(G.if(O0._`!(${O} instanceof ${z.ValidationError})`,()=>G.throw(O)),D(O),!J)G.assign(q,!1)}),Q.ok(q)}function K(){Q.result((0,rJ.callValidateCode)(Q,Y,A),()=>L(Y),()=>D(Y))}function D(q){let O=O0._`${q}.errors`;G.assign(h1.default.vErrors,O0._`${h1.default.vErrors} === null ? ${O} : ${h1.default.vErrors}.concat(${O})`),G.assign(h1.default.errors,O0._`${h1.default.vErrors}.length`)}function L(q){var O;if(!z.opts.unevaluated)return;let V=(O=X===null||X===void 0?void 0:X.validate)===null||O===void 0?void 0:O.evaluated;if(z.props!==!0)if(V&&!V.dynamicProps){if(V.props!==void 0)z.props=nQ.mergeEvaluated.props(G,V.props,z.props)}else{let M=G.var("props",O0._`${q}.evaluated.props`);z.props=nQ.mergeEvaluated.props(G,M,z.props,O0.Name)}if(z.items!==!0)if(V&&!V.dynamicItems){if(V.items!==void 0)z.items=nQ.mergeEvaluated.items(G,V.items,z.items)}else{let M=G.var("items",O0._`${q}.evaluated.items`);z.items=nQ.mergeEvaluated.items(G,M,z.items,O0.Name)}}}oJ.callRef=dQ;oJ.default=nL});var eJ=Z((sJ)=>{Object.defineProperty(sJ,"__esModule",{value:!0});var tL=iJ(),aL=aJ(),sL=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",tL.default,aL.default];sJ.default=sL});var Y$=Z((Q$)=>{Object.defineProperty(Q$,"__esModule",{value:!0});var oQ=k(),A1=oQ.operators,tQ={maximum:{okStr:"<=",ok:A1.LTE,fail:A1.GT},minimum:{okStr:">=",ok:A1.GTE,fail:A1.LT},exclusiveMaximum:{okStr:"<",ok:A1.LT,fail:A1.GTE},exclusiveMinimum:{okStr:">",ok:A1.GT,fail:A1.LTE}},QF={message:({keyword:Q,schemaCode:Y})=>oQ.str`must be ${tQ[Q].okStr} ${Y}`,params:({keyword:Q,schemaCode:Y})=>oQ._`{comparison: ${tQ[Q].okStr}, limit: ${Y}}`},YF={keyword:Object.keys(tQ),type:"number",schemaType:"number",$data:!0,error:QF,code(Q){let{keyword:Y,data:X,schemaCode:W}=Q;Q.fail$data(oQ._`${X} ${tQ[Y].fail} ${W} || isNaN(${X})`)}};Q$.default=YF});var W$=Z((X$)=>{Object.defineProperty(X$,"__esModule",{value:!0});var R4=k(),WF={message:({schemaCode:Q})=>R4.str`must be multiple of ${Q}`,params:({schemaCode:Q})=>R4._`{multipleOf: ${Q}}`},GF={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:WF,code(Q){let{gen:Y,data:X,schemaCode:W,it:G}=Q,z=G.opts.multipleOfPrecision,J=Y.let("res"),$=z?R4._`Math.abs(Math.round(${J}) - ${J}) > 1e-${z}`:R4._`${J} !== parseInt(${J})`;Q.fail$data(R4._`(${W} === 0 || (${J} = ${X}/${W}, ${$}))`)}};X$.default=GF});var J$=Z((z$)=>{Object.defineProperty(z$,"__esModule",{value:!0});function G$(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}z$.default=G$;G$.code='require("ajv/dist/runtime/ucs2length").default'});var H$=Z(($$)=>{Object.defineProperty($$,"__esModule",{value:!0});var N1=k(),$F=f(),HF=J$(),AF={message({keyword:Q,schemaCode:Y}){let X=Q==="maxLength"?"more":"fewer";return N1.str`must NOT have ${X} than ${Y} characters`},params:({schemaCode:Q})=>N1._`{limit: ${Q}}`},UF={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:AF,code(Q){let{keyword:Y,data:X,schemaCode:W,it:G}=Q,z=Y==="maxLength"?N1.operators.GT:N1.operators.LT,J=G.opts.unicode===!1?N1._`${X}.length`:N1._`${(0,$F.useFunc)(Q.gen,HF.default)}(${X})`;Q.fail$data(N1._`${J} ${z} ${W}`)}};$$.default=UF});var U$=Z((A$)=>{Object.defineProperty(A$,"__esModule",{value:!0});var DF=j0(),aQ=k(),BF={message:({schemaCode:Q})=>aQ.str`must match pattern "${Q}"`,params:({schemaCode:Q})=>aQ._`{pattern: ${Q}}`},LF={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:BF,code(Q){let{data:Y,$data:X,schema:W,schemaCode:G,it:z}=Q,J=z.opts.unicodeRegExp?"u":"",$=X?aQ._`(new RegExp(${G}, ${J}))`:(0,DF.usePattern)(Q,W);Q.fail$data(aQ._`!${$}.test(${Y})`)}};A$.default=LF});var D$=Z((K$)=>{Object.defineProperty(K$,"__esModule",{value:!0});var C4=k(),qF={message({keyword:Q,schemaCode:Y}){let X=Q==="maxProperties"?"more":"fewer";return C4.str`must NOT have ${X} than ${Y} properties`},params:({schemaCode:Q})=>C4._`{limit: ${Q}}`},OF={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:qF,code(Q){let{keyword:Y,data:X,schemaCode:W}=Q,G=Y==="maxProperties"?C4.operators.GT:C4.operators.LT;Q.fail$data(C4._`Object.keys(${X}).length ${G} ${W}`)}};K$.default=OF});var L$=Z((B$)=>{Object.defineProperty(B$,"__esModule",{value:!0});var v4=j0(),k4=k(),VF=f(),NF={message:({params:{missingProperty:Q}})=>k4.str`must have required property '${Q}'`,params:({params:{missingProperty:Q}})=>k4._`{missingProperty: ${Q}}`},ZF={keyword:"required",type:"object",schemaType:"array",$data:!0,error:NF,code(Q){let{gen:Y,schema:X,schemaCode:W,data:G,$data:z,it:J}=Q,{opts:$}=J;if(!z&&X.length===0)return;let H=X.length>=$.loopRequired;if(J.allErrors)A();else U();if($.strictRequired){let L=Q.parentSchema.properties,{definedProperties:q}=Q.it;for(let O of X)if((L===null||L===void 0?void 0:L[O])===void 0&&!q.has(O)){let V=J.schemaEnv.baseId+J.errSchemaPath,M=`required property "${O}" is not defined at "${V}" (strictRequired)`;(0,VF.checkStrictMode)(J,M,J.opts.strictRequired)}}function A(){if(H||z)Q.block$data(k4.nil,K);else for(let L of X)(0,v4.checkReportMissingProp)(Q,L)}function U(){let L=Y.let("missing");if(H||z){let q=Y.let("valid",!0);Q.block$data(q,()=>D(L,q)),Q.ok(q)}else Y.if((0,v4.checkMissingProp)(Q,X,L)),(0,v4.reportMissingProp)(Q,L),Y.else()}function K(){Y.forOf("prop",W,(L)=>{Q.setParams({missingProperty:L}),Y.if((0,v4.noPropertyInData)(Y,G,L,$.ownProperties),()=>Q.error())})}function D(L,q){Q.setParams({missingProperty:L}),Y.forOf(L,W,()=>{Y.assign(q,(0,v4.propertyInData)(Y,G,L,$.ownProperties)),Y.if((0,k4.not)(q),()=>{Q.error(),Y.break()})},k4.nil)}}};B$.default=ZF});var q$=Z((F$)=>{Object.defineProperty(F$,"__esModule",{value:!0});var x4=k(),bF={message({keyword:Q,schemaCode:Y}){let X=Q==="maxItems"?"more":"fewer";return x4.str`must NOT have ${X} than ${Y} items`},params:({schemaCode:Q})=>x4._`{limit: ${Q}}`},PF={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:bF,code(Q){let{keyword:Y,data:X,schemaCode:W}=Q,G=Y==="maxItems"?x4.operators.GT:x4.operators.LT;Q.fail$data(x4._`${X}.length ${G} ${W}`)}};F$.default=PF});var sQ=Z((M$)=>{Object.defineProperty(M$,"__esModule",{value:!0});var O$=cY();O$.code='require("ajv/dist/runtime/equal").default';M$.default=O$});var N$=Z((V$)=>{Object.defineProperty(V$,"__esModule",{value:!0});var z9=N4(),H0=k(),EF=f(),TF=sQ(),SF={message:({params:{i:Q,j:Y}})=>H0.str`must NOT have duplicate items (items ## ${Y} and ${Q} are identical)`,params:({params:{i:Q,j:Y}})=>H0._`{i: ${Q}, j: ${Y}}`},RF={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:SF,code(Q){let{gen:Y,data:X,$data:W,schema:G,parentSchema:z,schemaCode:J,it:$}=Q;if(!W&&!G)return;let H=Y.let("valid"),A=z.items?(0,z9.getSchemaTypes)(z.items):[];Q.block$data(H,U,H0._`${J} === false`),Q.ok(H);function U(){let q=Y.let("i",H0._`${X}.length`),O=Y.let("j");Q.setParams({i:q,j:O}),Y.assign(H,!0),Y.if(H0._`${q} > 1`,()=>(K()?D:L)(q,O))}function K(){return A.length>0&&!A.some((q)=>q==="object"||q==="array")}function D(q,O){let V=Y.name("item"),M=(0,z9.checkDataTypes)(A,V,$.opts.strictNumbers,z9.DataType.Wrong),S=Y.const("indices",H0._`{}`);Y.for(H0._`;${q}--;`,()=>{if(Y.let(V,H0._`${X}[${q}]`),Y.if(M,H0._`continue`),A.length>1)Y.if(H0._`typeof ${V} == "string"`,H0._`${V} += "_"`);Y.if(H0._`typeof ${S}[${V}] == "number"`,()=>{Y.assign(O,H0._`${S}[${V}]`),Q.error(),Y.assign(H,!1).break()}).code(H0._`${S}[${V}] = ${q}`)})}function L(q,O){let V=(0,EF.useFunc)(Y,TF.default),M=Y.name("outer");Y.label(M).for(H0._`;${q}--;`,()=>Y.for(H0._`${O} = ${q}; ${O}--;`,()=>Y.if(H0._`${V}(${X}[${q}], ${X}[${O}])`,()=>{Q.error(),Y.assign(H,!1).break(M)})))}}};V$.default=RF});var w$=Z((Z$)=>{Object.defineProperty(Z$,"__esModule",{value:!0});var J9=k(),vF=f(),kF=sQ(),xF={message:"must be equal to constant",params:({schemaCode:Q})=>J9._`{allowedValue: ${Q}}`},_F={keyword:"const",$data:!0,error:xF,code(Q){let{gen:Y,data:X,$data:W,schemaCode:G,schema:z}=Q;if(W||z&&typeof z=="object")Q.fail$data(J9._`!${(0,vF.useFunc)(Y,kF.default)}(${X}, ${G})`);else Q.fail(J9._`${z} !== ${X}`)}};Z$.default=_F});var P$=Z((b$)=>{Object.defineProperty(b$,"__esModule",{value:!0});var _4=k(),yF=f(),uF=sQ(),hF={message:"must be equal to one of the allowed values",params:({schemaCode:Q})=>_4._`{allowedValues: ${Q}}`},fF={keyword:"enum",schemaType:"array",$data:!0,error:hF,code(Q){let{gen:Y,data:X,$data:W,schema:G,schemaCode:z,it:J}=Q;if(!W&&G.length===0)throw Error("enum must have non-empty array");let $=G.length>=J.opts.loopEnum,H,A=()=>H!==null&&H!==void 0?H:H=(0,yF.useFunc)(Y,uF.default),U;if($||W)U=Y.let("valid"),Q.block$data(U,K);else{if(!Array.isArray(G))throw Error("ajv implementation error");let L=Y.const("vSchema",z);U=(0,_4.or)(...G.map((q,O)=>D(L,O)))}Q.pass(U);function K(){Y.assign(U,!1),Y.forOf("v",z,(L)=>Y.if(_4._`${A()}(${X}, ${L})`,()=>Y.assign(U,!0).break()))}function D(L,q){let O=G[q];return typeof O==="object"&&O!==null?_4._`${A()}(${X}, ${L}[${q}])`:_4._`${X} === ${O}`}}};b$.default=fF});var I$=Z((j$)=>{Object.defineProperty(j$,"__esModule",{value:!0});var mF=Y$(),cF=W$(),pF=H$(),iF=U$(),rF=D$(),nF=L$(),dF=q$(),oF=N$(),tF=w$(),aF=P$(),sF=[mF.default,cF.default,pF.default,iF.default,rF.default,nF.default,dF.default,oF.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},tF.default,aF.default];j$.default=sF});var H9=Z((T$)=>{Object.defineProperty(T$,"__esModule",{value:!0});T$.validateAdditionalItems=void 0;var Z1=k(),$9=f(),Qq={message:({params:{len:Q}})=>Z1.str`must NOT have more than ${Q} items`,params:({params:{len:Q}})=>Z1._`{limit: ${Q}}`},Yq={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Qq,code(Q){let{parentSchema:Y,it:X}=Q,{items:W}=Y;if(!Array.isArray(W)){(0,$9.checkStrictMode)(X,'"additionalItems" is ignored when "items" is not an array of schemas');return}E$(Q,W)}};function E$(Q,Y){let{gen:X,schema:W,data:G,keyword:z,it:J}=Q;J.items=!0;let $=X.const("len",Z1._`${G}.length`);if(W===!1)Q.setParams({len:Y.length}),Q.pass(Z1._`${$} <= ${Y.length}`);else if(typeof W=="object"&&!(0,$9.alwaysValidSchema)(J,W)){let A=X.var("valid",Z1._`${$} <= ${Y.length}`);X.if((0,Z1.not)(A),()=>H(A)),Q.ok(A)}function H(A){X.forRange("i",Y.length,$,(U)=>{if(Q.subschema({keyword:z,dataProp:U,dataPropType:$9.Type.Num},A),!J.allErrors)X.if((0,Z1.not)(A),()=>X.break())})}}T$.validateAdditionalItems=E$;T$.default=Yq});var A9=Z((v$)=>{Object.defineProperty(v$,"__esModule",{value:!0});v$.validateTuple=void 0;var R$=k(),eQ=f(),Wq=j0(),Gq={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(Q){let{schema:Y,it:X}=Q;if(Array.isArray(Y))return C$(Q,"additionalItems",Y);if(X.items=!0,(0,eQ.alwaysValidSchema)(X,Y))return;Q.ok((0,Wq.validateArray)(Q))}};function C$(Q,Y,X=Q.schema){let{gen:W,parentSchema:G,data:z,keyword:J,it:$}=Q;if(U(G),$.opts.unevaluated&&X.length&&$.items!==!0)$.items=eQ.mergeEvaluated.items(W,X.length,$.items);let H=W.name("valid"),A=W.const("len",R$._`${z}.length`);X.forEach((K,D)=>{if((0,eQ.alwaysValidSchema)($,K))return;W.if(R$._`${A} > ${D}`,()=>Q.subschema({keyword:J,schemaProp:D,dataProp:D},H)),Q.ok(H)});function U(K){let{opts:D,errSchemaPath:L}=$,q=X.length,O=q===K.minItems&&(q===K.maxItems||K[Y]===!1);if(D.strictTuples&&!O){let V=`"${J}" is ${q}-tuple, but minItems or maxItems/${Y} are not specified or different at path "${L}"`;(0,eQ.checkStrictMode)($,V,D.strictTuples)}}}v$.validateTuple=C$;v$.default=Gq});var _$=Z((x$)=>{Object.defineProperty(x$,"__esModule",{value:!0});var Jq=A9(),$q={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(Q)=>(0,Jq.validateTuple)(Q,"items")};x$.default=$q});var u$=Z((y$)=>{Object.defineProperty(y$,"__esModule",{value:!0});var g$=k(),Aq=f(),Uq=j0(),Kq=H9(),Dq={message:({params:{len:Q}})=>g$.str`must NOT have more than ${Q} items`,params:({params:{len:Q}})=>g$._`{limit: ${Q}}`},Bq={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:Dq,code(Q){let{schema:Y,parentSchema:X,it:W}=Q,{prefixItems:G}=X;if(W.items=!0,(0,Aq.alwaysValidSchema)(W,Y))return;if(G)(0,Kq.validateAdditionalItems)(Q,G);else Q.ok((0,Uq.validateArray)(Q))}};y$.default=Bq});var f$=Z((h$)=>{Object.defineProperty(h$,"__esModule",{value:!0});var I0=k(),Q6=f(),Fq={message:({params:{min:Q,max:Y}})=>Y===void 0?I0.str`must contain at least ${Q} valid item(s)`:I0.str`must contain at least ${Q} and no more than ${Y} valid item(s)`,params:({params:{min:Q,max:Y}})=>Y===void 0?I0._`{minContains: ${Q}}`:I0._`{minContains: ${Q}, maxContains: ${Y}}`},qq={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:Fq,code(Q){let{gen:Y,schema:X,parentSchema:W,data:G,it:z}=Q,J,$,{minContains:H,maxContains:A}=W;if(z.opts.next)J=H===void 0?1:H,$=A;else J=1;let U=Y.const("len",I0._`${G}.length`);if(Q.setParams({min:J,max:$}),$===void 0&&J===0){(0,Q6.checkStrictMode)(z,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if($!==void 0&&J>$){(0,Q6.checkStrictMode)(z,'"minContains" > "maxContains" is always invalid'),Q.fail();return}if((0,Q6.alwaysValidSchema)(z,X)){let O=I0._`${U} >= ${J}`;if($!==void 0)O=I0._`${O} && ${U} <= ${$}`;Q.pass(O);return}z.items=!0;let K=Y.name("valid");if($===void 0&&J===1)L(K,()=>Y.if(K,()=>Y.break()));else if(J===0){if(Y.let(K,!0),$!==void 0)Y.if(I0._`${G}.length > 0`,D)}else Y.let(K,!1),D();Q.result(K,()=>Q.reset());function D(){let O=Y.name("_valid"),V=Y.let("count",0);L(O,()=>Y.if(O,()=>q(V)))}function L(O,V){Y.forRange("i",0,U,(M)=>{Q.subschema({keyword:"contains",dataProp:M,dataPropType:Q6.Type.Num,compositeRule:!0},O),V()})}function q(O){if(Y.code(I0._`${O}++`),$===void 0)Y.if(I0._`${O} >= ${J}`,()=>Y.assign(K,!0).break());else if(Y.if(I0._`${O} > ${$}`,()=>Y.assign(K,!1).break()),J===1)Y.assign(K,!0);else Y.if(I0._`${O} >= ${J}`,()=>Y.assign(K,!0))}}};h$.default=qq});var r$=Z((c$)=>{Object.defineProperty(c$,"__esModule",{value:!0});c$.validateSchemaDeps=c$.validatePropertyDeps=c$.error=void 0;var U9=k(),Mq=f(),g4=j0();c$.error={message:({params:{property:Q,depsCount:Y,deps:X}})=>{let W=Y===1?"property":"properties";return U9.str`must have ${W} ${X} when property ${Q} is present`},params:({params:{property:Q,depsCount:Y,deps:X,missingProperty:W}})=>U9._`{property: ${Q},
|
|
6
6
|
missingProperty: ${W},
|
|
7
7
|
depsCount: ${Y},
|
|
8
|
-
deps: ${X}}`};var Bq={keyword:"dependencies",type:"object",schemaType:"object",error:m$.error,code(Q){let[Y,X]=Lq(Q);f$(Q,Y),l$(Q,X)}};function Lq({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 f$(Q,Y=Q.schema){let{gen:X,data:W,it:G}=Q;if(Object.keys(Y).length===0)return;let z=X.let("missing");for(let J in Y){let $=Y[J];if($.length===0)continue;let H=(0,g4.propertyInData)(X,W,J,G.opts.ownProperties);if(Q.setParams({property:J,depsCount:$.length,deps:$.join(", ")}),G.allErrors)X.if(H,()=>{for(let A of $)(0,g4.checkReportMissingProp)(Q,A)});else X.if(U9._`${H} && (${(0,g4.checkMissingProp)(Q,$,z)})`),(0,g4.reportMissingProp)(Q,z),X.else()}}m$.validatePropertyDeps=f$;function l$(Q,Y=Q.schema){let{gen:X,data:W,keyword:G,it:z}=Q,J=X.name("valid");for(let $ in Y){if((0,Dq.alwaysValidSchema)(z,Y[$]))continue;X.if((0,g4.propertyInData)(X,W,$,z.opts.ownProperties),()=>{let H=Q.subschema({keyword:G,schemaProp:$},J);Q.mergeValidEvaluated(H,J)},()=>X.var(J,!0)),Q.ok(J)}}m$.validateSchemaDeps=l$;m$.default=Bq});var d$=Z((n$)=>{Object.defineProperty(n$,"__esModule",{value:!0});var r$=k(),Oq=f(),Mq={message:"property name must be valid",params:({params:Q})=>r$._`{propertyName: ${Q.propertyName}}`},Vq={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Mq,code(Q){let{gen:Y,schema:X,data:W,it:G}=Q;if((0,Oq.alwaysValidSchema)(G,X))return;let z=Y.name("valid");Y.forIn("key",W,(J)=>{Q.setParams({propertyName:J}),Q.subschema({keyword:"propertyNames",data:J,dataTypes:["string"],propertyName:J,compositeRule:!0},z),Y.if((0,r$.not)(z),()=>{if(Q.error(!0),!G.allErrors)Y.break()})}),Q.ok(z)}};n$.default=Vq});var K9=Z((o$)=>{Object.defineProperty(o$,"__esModule",{value:!0});var YQ=j0(),k0=k(),Zq=r0(),XQ=f(),wq={message:"must NOT have additional properties",params:({params:Q})=>k0._`{additionalProperty: ${Q.additionalProperty}}`},bq={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:wq,code(Q){let{gen:Y,schema:X,parentSchema:W,data:G,errsCount:z,it:J}=Q;if(!z)throw Error("ajv implementation error");let{allErrors:$,opts:H}=J;if(J.props=!0,H.removeAdditional!=="all"&&(0,XQ.alwaysValidSchema)(J,X))return;let A=(0,YQ.allSchemaProperties)(W.properties),U=(0,YQ.allSchemaProperties)(W.patternProperties);K(),Q.ok(k0._`${z} === ${Zq.default.errors}`);function K(){Y.forIn("key",G,(V)=>{if(!A.length&&!U.length)q(V);else Y.if(D(V),()=>q(V))})}function D(V){let M;if(A.length>8){let S=(0,XQ.schemaRefOrVal)(J,W.properties,"properties");M=(0,YQ.isOwnProperty)(Y,S,V)}else if(A.length)M=(0,k0.or)(...A.map((S)=>k0._`${V} === ${S}`));else M=k0.nil;if(U.length)M=(0,k0.or)(M,...U.map((S)=>k0._`${(0,YQ.usePattern)(Q,S)}.test(${V})`));return(0,k0.not)(M)}function L(V){Y.code(k0._`delete ${G}[${V}]`)}function q(V){if(H.removeAdditional==="all"||H.removeAdditional&&X===!1){L(V);return}if(X===!1){if(Q.setParams({additionalProperty:V}),Q.error(),!$)Y.break();return}if(typeof X=="object"&&!(0,XQ.alwaysValidSchema)(J,X)){let M=Y.name("valid");if(H.removeAdditional==="failing")O(V,M,!1),Y.if((0,k0.not)(M),()=>{Q.reset(),L(V)});else if(O(V,M),!$)Y.if((0,k0.not)(M),()=>Y.break())}}function O(V,M,S){let E={keyword:"additionalProperties",dataProp:V,dataPropType:XQ.Type.Str};if(S===!1)Object.assign(E,{compositeRule:!0,createErrors:!1,allErrors:!1});Q.subschema(E,M)}}};o$.default=bq});var e$=Z((s$)=>{Object.defineProperty(s$,"__esModule",{value:!0});var jq=P4(),t$=j0(),D9=f(),a$=K9(),Iq={keyword:"properties",type:"object",schemaType:"object",code(Q){let{gen:Y,schema:X,parentSchema:W,data:G,it:z}=Q;if(z.opts.removeAdditional==="all"&&W.additionalProperties===void 0)a$.default.code(new jq.KeywordCxt(z,a$.default,"additionalProperties"));let J=(0,t$.allSchemaProperties)(X);for(let K of J)z.definedProperties.add(K);if(z.opts.unevaluated&&J.length&&z.props!==!0)z.props=D9.mergeEvaluated.props(Y,(0,D9.toHash)(J),z.props);let $=J.filter((K)=>!(0,D9.alwaysValidSchema)(z,X[K]));if($.length===0)return;let H=Y.name("valid");for(let K of $){if(A(K))U(K);else{if(Y.if((0,t$.propertyInData)(Y,G,K,z.opts.ownProperties)),U(K),!z.allErrors)Y.else().var(H,!0);Y.endIf()}Q.it.definedProperties.add(K),Q.ok(H)}function A(K){return z.opts.useDefaults&&!z.compositeRule&&X[K].default!==void 0}function U(K){Q.subschema({keyword:"properties",schemaProp:K,dataProp:K},H)}}};s$.default=Iq});var G7=Z((W7)=>{Object.defineProperty(W7,"__esModule",{value:!0});var Q7=j0(),WQ=k(),Y7=f(),X7=f(),Tq={keyword:"patternProperties",type:"object",schemaType:"object",code(Q){let{gen:Y,schema:X,data:W,parentSchema:G,it:z}=Q,{opts:J}=z,$=(0,Q7.allSchemaProperties)(X),H=$.filter((O)=>(0,Y7.alwaysValidSchema)(z,X[O]));if($.length===0||H.length===$.length&&(!z.opts.unevaluated||z.props===!0))return;let A=J.strictSchema&&!J.allowMatchingProperties&&G.properties,U=Y.name("valid");if(z.props!==!0&&!(z.props instanceof WQ.Name))z.props=(0,X7.evaluatedPropsToName)(Y,z.props);let{props:K}=z;D();function D(){for(let O of $){if(A)L(O);if(z.allErrors)q(O);else Y.var(U,!0),q(O),Y.if(U)}}function L(O){for(let V in A)if(new RegExp(O).test(V))(0,Y7.checkStrictMode)(z,`property ${V} matches pattern ${O} (use allowMatchingProperties)`)}function q(O){Y.forIn("key",W,(V)=>{Y.if(WQ._`${(0,Q7.usePattern)(Q,O)}.test(${V})`,()=>{let M=H.includes(O);if(!M)Q.subschema({keyword:"patternProperties",schemaProp:O,dataProp:V,dataPropType:X7.Type.Str},U);if(z.opts.unevaluated&&K!==!0)Y.assign(WQ._`${K}[${V}]`,!0);else if(!M&&!z.allErrors)Y.if((0,WQ.not)(U),()=>Y.break())})})}}};W7.default=Tq});var J7=Z((z7)=>{Object.defineProperty(z7,"__esModule",{value:!0});var Rq=f(),Cq={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(Q){let{gen:Y,schema:X,it:W}=Q;if((0,Rq.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"}};z7.default=Cq});var H7=Z(($7)=>{Object.defineProperty($7,"__esModule",{value:!0});var kq=j0(),xq={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:kq.validateUnion,error:{message:"must match a schema in anyOf"}};$7.default=xq});var U7=Z((A7)=>{Object.defineProperty(A7,"__esModule",{value:!0});var GQ=k(),gq=f(),yq={message:"must match exactly one schema in oneOf",params:({params:Q})=>GQ._`{passingSchemas: ${Q.passing}}`},uq={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:yq,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 z=X,J=Y.let("valid",!1),$=Y.let("passing",null),H=Y.name("_valid");Q.setParams({passing:$}),Y.block(A),Q.result(J,()=>Q.reset(),()=>Q.error(!0));function A(){z.forEach((U,K)=>{let D;if((0,gq.alwaysValidSchema)(G,U))Y.var(H,!0);else D=Q.subschema({keyword:"oneOf",schemaProp:K,compositeRule:!0},H);if(K>0)Y.if(GQ._`${H} && ${J}`).assign(J,!1).assign($,GQ._`[${$}, ${K}]`).else();Y.if(H,()=>{if(Y.assign(J,!0),Y.assign($,K),D)Q.mergeEvaluated(D,GQ.Name)})})}}};A7.default=uq});var D7=Z((K7)=>{Object.defineProperty(K7,"__esModule",{value:!0});var fq=f(),lq={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,J)=>{if((0,fq.alwaysValidSchema)(W,z))return;let $=Q.subschema({keyword:"allOf",schemaProp:J},G);Q.ok(G),Q.mergeEvaluated($)})}};K7.default=lq});var q7=Z((F7)=>{Object.defineProperty(F7,"__esModule",{value:!0});var zQ=k(),L7=f(),cq={message:({params:Q})=>zQ.str`must match "${Q.ifClause}" schema`,params:({params:Q})=>zQ._`{failingKeyword: ${Q.ifClause}}`},pq={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:cq,code(Q){let{gen:Y,parentSchema:X,it:W}=Q;if(X.then===void 0&&X.else===void 0)(0,L7.checkStrictMode)(W,'"if" without "then" and "else" is ignored');let G=B7(W,"then"),z=B7(W,"else");if(!G&&!z)return;let J=Y.let("valid",!0),$=Y.name("_valid");if(H(),Q.reset(),G&&z){let U=Y.let("ifClause");Q.setParams({ifClause:U}),Y.if($,A("then",U),A("else",U))}else if(G)Y.if($,A("then"));else Y.if((0,zQ.not)($),A("else"));Q.pass(J,()=>Q.error(!0));function H(){let U=Q.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},$);Q.mergeEvaluated(U)}function A(U,K){return()=>{let D=Q.subschema({keyword:U},$);if(Y.assign(J,$),Q.mergeValidEvaluated(D,J),K)Y.assign(K,zQ._`${U}`);else Q.setParams({ifClause:U})}}}};function B7(Q,Y){let X=Q.schema[Y];return X!==void 0&&!(0,L7.alwaysValidSchema)(Q,X)}F7.default=pq});var M7=Z((O7)=>{Object.defineProperty(O7,"__esModule",{value:!0});var rq=f(),nq={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:Q,parentSchema:Y,it:X}){if(Y.if===void 0)(0,rq.checkStrictMode)(X,`"${Q}" without "if" is ignored`)}};O7.default=nq});var N7=Z((V7)=>{Object.defineProperty(V7,"__esModule",{value:!0});var oq=H9(),tq=x$(),aq=A9(),sq=y$(),eq=h$(),QO=i$(),YO=d$(),XO=K9(),WO=e$(),GO=G7(),zO=J7(),JO=H7(),$O=U7(),HO=D7(),AO=q7(),UO=M7();function KO(Q=!1){let Y=[zO.default,JO.default,$O.default,HO.default,AO.default,UO.default,YO.default,XO.default,QO.default,WO.default,GO.default];if(Q)Y.push(tq.default,sq.default);else Y.push(oq.default,aq.default);return Y.push(eq.default),Y}V7.default=KO});var w7=Z((Z7)=>{Object.defineProperty(Z7,"__esModule",{value:!0});var e=k(),BO={message:({schemaCode:Q})=>e.str`must match format "${Q}"`,params:({schemaCode:Q})=>e._`{format: ${Q}}`},LO={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:BO,code(Q,Y){let{gen:X,data:W,$data:G,schema:z,schemaCode:J,it:$}=Q,{opts:H,errSchemaPath:A,schemaEnv:U,self:K}=$;if(!H.validateFormats)return;if(G)D();else L();function D(){let q=X.scopeValue("formats",{ref:K.formats,code:H.code.formats}),O=X.const("fDef",e._`${q}[${J}]`),V=X.let("fType"),M=X.let("format");X.if(e._`typeof ${O} == "object" && !(${O} instanceof RegExp)`,()=>X.assign(V,e._`${O}.type || "string"`).assign(M,e._`${O}.validate`),()=>X.assign(V,e._`"string"`).assign(M,O)),Q.fail$data((0,e.or)(S(),E()));function S(){if(H.strictSchema===!1)return e.nil;return e._`${J} && !${M}`}function E(){let x=U.$async?e._`(${O}.async ? await ${M}(${W}) : ${M}(${W}))`:e._`${M}(${W})`,T=e._`(typeof ${M} == "function" ? ${x} : ${M}.test(${W}))`;return e._`${M} && ${M} !== true && ${V} === ${Y} && !${T}`}}function L(){let q=K.formats[z];if(!q){S();return}if(q===!0)return;let[O,V,M]=E(q);if(O===Y)Q.pass(x());function S(){if(H.strictSchema===!1){K.logger.warn(T());return}throw Error(T());function T(){return`unknown format "${z}" ignored in schema at path "${A}"`}}function E(T){let _0=T instanceof RegExp?(0,e.regexpCode)(T):H.code.formats?e._`${H.code.formats}${(0,e.getProperty)(z)}`:void 0,f0=X.scopeValue("formats",{key:z,ref:T,code:_0});if(typeof T=="object"&&!(T instanceof RegExp))return[T.type||"string",T.validate,e._`${f0}.validate`];return["string",T,f0]}function x(){if(typeof q=="object"&&!(q instanceof RegExp)&&q.async){if(!U.$async)throw Error("async format in sync schema");return e._`await ${M}(${W})`}return typeof V=="function"?e._`${M}(${W})`:e._`${M}.test(${W})`}}}};Z7.default=LO});var P7=Z((b7)=>{Object.defineProperty(b7,"__esModule",{value:!0});var qO=w7(),OO=[qO.default];b7.default=OO});var E7=Z((j7)=>{Object.defineProperty(j7,"__esModule",{value:!0});j7.contentVocabulary=j7.metadataVocabulary=void 0;j7.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];j7.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var R7=Z((S7)=>{Object.defineProperty(S7,"__esModule",{value:!0});var NO=sJ(),ZO=j$(),wO=N7(),bO=P7(),T7=E7(),PO=[NO.default,ZO.default,(0,wO.default)(),bO.default,T7.metadataVocabulary,T7.contentVocabulary];S7.default=PO});var x7=Z((v7)=>{Object.defineProperty(v7,"__esModule",{value:!0});v7.DiscrError=void 0;var C7;(function(Q){Q.Tag="tag",Q.Mapping="mapping"})(C7||(v7.DiscrError=C7={}))});var y7=Z((g7)=>{Object.defineProperty(g7,"__esModule",{value:!0});var f1=k(),B9=x7(),_7=f6(),IO=j4(),EO=f(),TO={message:({params:{discrError:Q,tagName:Y}})=>Q===B9.DiscrError.Tag?`tag "${Y}" must be string`:`value of tag "${Y}" must be in oneOf`,params:({params:{discrError:Q,tag:Y,tagName:X}})=>f1._`{error: ${Q}, tag: ${X}, tagValue: ${Y}}`},SO={keyword:"discriminator",type:"object",schemaType:"object",error:TO,code(Q){let{gen:Y,data:X,schema:W,parentSchema:G,it:z}=Q,{oneOf:J}=G;if(!z.opts.discriminator)throw Error("discriminator: requires discriminator option");let $=W.propertyName;if(typeof $!="string")throw Error("discriminator: requires propertyName");if(W.mapping)throw Error("discriminator: mapping is not supported");if(!J)throw Error("discriminator: requires oneOf keyword");let H=Y.let("valid",!1),A=Y.const("tag",f1._`${X}${(0,f1.getProperty)($)}`);Y.if(f1._`typeof ${A} == "string"`,()=>U(),()=>Q.error(!1,{discrError:B9.DiscrError.Tag,tag:A,tagName:$})),Q.ok(H);function U(){let L=D();Y.if(!1);for(let q in L)Y.elseIf(f1._`${A} === ${q}`),Y.assign(H,K(L[q]));Y.else(),Q.error(!1,{discrError:B9.DiscrError.Mapping,tag:A,tagName:$}),Y.endIf()}function K(L){let q=Y.name("valid"),O=Q.subschema({keyword:"oneOf",schemaProp:L},q);return Q.mergeEvaluated(O,f1.Name),q}function D(){var L;let q={},O=M(G),V=!0;for(let x=0;x<J.length;x++){let T=J[x];if((T===null||T===void 0?void 0:T.$ref)&&!(0,EO.schemaHasRulesButRef)(T,z.self.RULES)){let f0=T.$ref;if(T=_7.resolveRef.call(z.self,z.schemaEnv.root,z.baseId,f0),T instanceof _7.SchemaEnv)T=T.schema;if(T===void 0)throw new IO.default(z.opts.uriResolver,z.baseId,f0)}let _0=(L=T===null||T===void 0?void 0:T.properties)===null||L===void 0?void 0:L[$];if(typeof _0!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${$}"`);V=V&&(O||M(T)),S(_0,x)}if(!V)throw Error(`discriminator: "${$}" must be required`);return q;function M({required:x}){return Array.isArray(x)&&x.includes($)}function S(x,T){if(x.const)E(x.const,T);else if(x.enum)for(let _0 of x.enum)E(_0,T);else throw Error(`discriminator: "properties/${$}" must have "const" or "enum"`)}function E(x,T){if(typeof x!="string"||x in q)throw Error(`discriminator: "${$}" values must be unique strings`);q[x]=T}}}};g7.default=SO});var u7=Z((rj,CO)=>{CO.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 F9=Z((M0,L9)=>{Object.defineProperty(M0,"__esModule",{value:!0});M0.MissingRefError=M0.ValidationError=M0.CodeGen=M0.Name=M0.nil=M0.stringify=M0.str=M0._=M0.KeywordCxt=M0.Ajv=void 0;var vO=mJ(),kO=R7(),xO=y7(),h7=u7(),_O=["/properties"],JQ="http://json-schema.org/draft-07/schema";class y4 extends vO.default{_addVocabularies(){if(super._addVocabularies(),kO.default.forEach((Q)=>this.addVocabulary(Q)),this.opts.discriminator)this.addKeyword(xO.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let Q=this.opts.$data?this.$dataMetaSchema(h7,_O):h7;this.addMetaSchema(Q,JQ,!1),this.refs["http://json-schema.org/schema"]=JQ}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(JQ)?JQ:void 0)}}M0.Ajv=y4;L9.exports=M0=y4;L9.exports.Ajv=y4;Object.defineProperty(M0,"__esModule",{value:!0});M0.default=y4;var gO=P4();Object.defineProperty(M0,"KeywordCxt",{enumerable:!0,get:function(){return gO.KeywordCxt}});var l1=k();Object.defineProperty(M0,"_",{enumerable:!0,get:function(){return l1._}});Object.defineProperty(M0,"str",{enumerable:!0,get:function(){return l1.str}});Object.defineProperty(M0,"stringify",{enumerable:!0,get:function(){return l1.stringify}});Object.defineProperty(M0,"nil",{enumerable:!0,get:function(){return l1.nil}});Object.defineProperty(M0,"Name",{enumerable:!0,get:function(){return l1.Name}});Object.defineProperty(M0,"CodeGen",{enumerable:!0,get:function(){return l1.CodeGen}});var yO=u6();Object.defineProperty(M0,"ValidationError",{enumerable:!0,get:function(){return yO.default}});var uO=j4();Object.defineProperty(M0,"MissingRefError",{enumerable:!0,get:function(){return uO.default}})});var o7=Z((n7)=>{Object.defineProperty(n7,"__esModule",{value:!0});n7.formatNames=n7.fastFormats=n7.fullFormats=void 0;function u0(Q,Y){return{validate:Q,compare:Y}}n7.fullFormats={date:u0(c7,V9),time:u0(O9(!0),N9),"date-time":u0(f7(!0),i7),"iso-time":u0(O9(),p7),"iso-date-time":u0(f7(),r7),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:rO,"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:eO,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:nO,int32:{type:"number",validate:tO},int64:{type:"number",validate:aO},float:{type:"number",validate:m7},double:{type:"number",validate:m7},password:!0,binary:!0};n7.fastFormats={...n7.fullFormats,date:u0(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,V9),time:u0(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,N9),"date-time":u0(/^\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,i7),"iso-time":u0(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,p7),"iso-date-time":u0(/^\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,r7),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};n7.formatNames=Object.keys(n7.fullFormats);function lO(Q){return Q%4===0&&(Q%100!==0||Q%400===0)}var mO=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,cO=[0,31,28,31,30,31,30,31,31,30,31,30,31];function c7(Q){let Y=mO.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&&lO(X)?29:cO[W])}function V9(Q,Y){if(!(Q&&Y))return;if(Q>Y)return 1;if(Q<Y)return-1;return 0}var q9=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function O9(Q){return function(X){let W=q9.exec(X);if(!W)return!1;let G=+W[1],z=+W[2],J=+W[3],$=W[4],H=W[5]==="-"?-1:1,A=+(W[6]||0),U=+(W[7]||0);if(A>23||U>59||Q&&!$)return!1;if(G<=23&&z<=59&&J<60)return!0;let K=z-U*H,D=G-A*H-(K<0?1:0);return(D===23||D===-1)&&(K===59||K===-1)&&J<61}}function N9(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 p7(Q,Y){if(!(Q&&Y))return;let X=q9.exec(Q),W=q9.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 M9=/t|\s/i;function f7(Q){let Y=O9(Q);return function(W){let G=W.split(M9);return G.length===2&&c7(G[0])&&Y(G[1])}}function i7(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 r7(Q,Y){if(!(Q&&Y))return;let[X,W]=Q.split(M9),[G,z]=Y.split(M9),J=V9(X,G);if(J===void 0)return;return J||N9(W,z)}var pO=/\/|:/,iO=/^(?:[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 rO(Q){return pO.test(Q)&&iO.test(Q)}var l7=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function nO(Q){return l7.lastIndex=0,l7.test(Q)}var dO=-2147483648,oO=2147483647;function tO(Q){return Number.isInteger(Q)&&Q<=oO&&Q>=dO}function aO(Q){return Number.isInteger(Q)}function m7(){return!0}var sO=/[^\\]\\Z/;function eO(Q){if(sO.test(Q))return!1;try{return new RegExp(Q),!0}catch(Y){return!1}}});var a7=Z((t7)=>{Object.defineProperty(t7,"__esModule",{value:!0});t7.formatLimitDefinition=void 0;var YM=F9(),x0=k(),U1=x0.operators,$Q={formatMaximum:{okStr:"<=",ok:U1.LTE,fail:U1.GT},formatMinimum:{okStr:">=",ok:U1.GTE,fail:U1.LT},formatExclusiveMaximum:{okStr:"<",ok:U1.LT,fail:U1.GTE},formatExclusiveMinimum:{okStr:">",ok:U1.GT,fail:U1.LTE}},XM={message:({keyword:Q,schemaCode:Y})=>x0.str`should be ${$Q[Q].okStr} ${Y}`,params:({keyword:Q,schemaCode:Y})=>x0._`{comparison: ${$Q[Q].okStr}, limit: ${Y}}`};t7.formatLimitDefinition={keyword:Object.keys($Q),type:"string",schemaType:"string",$data:!0,error:XM,code(Q){let{gen:Y,data:X,schemaCode:W,keyword:G,it:z}=Q,{opts:J,self:$}=z;if(!J.validateFormats)return;let H=new YM.KeywordCxt(z,$.RULES.all.format.definition,"format");if(H.$data)A();else U();function A(){let D=Y.scopeValue("formats",{ref:$.formats,code:J.code.formats}),L=Y.const("fmt",x0._`${D}[${H.schemaCode}]`);Q.fail$data((0,x0.or)(x0._`typeof ${L} != "object"`,x0._`${L} instanceof RegExp`,x0._`typeof ${L}.compare != "function"`,K(L)))}function U(){let D=H.schema,L=$.formats[D];if(!L||L===!0)return;if(typeof L!="object"||L instanceof RegExp||typeof L.compare!="function")throw Error(`"${G}": format "${D}" does not define "compare" function`);let q=Y.scopeValue("formats",{key:D,ref:L,code:J.code.formats?x0._`${J.code.formats}${(0,x0.getProperty)(D)}`:void 0});Q.fail$data(K(q))}function K(D){return x0._`${D}.compare(${X}, ${W}) ${$Q[G].fail} 0`}},dependencies:["format"]};var WM=(Q)=>{return Q.addKeyword(t7.formatLimitDefinition),Q};t7.default=WM});var Y5=Z((u4,Q5)=>{Object.defineProperty(u4,"__esModule",{value:!0});var m1=o7(),zM=a7(),b9=k(),s7=new b9.Name("fullFormats"),JM=new b9.Name("fastFormats"),P9=(Q,Y={keywords:!0})=>{if(Array.isArray(Y))return e7(Q,Y,m1.fullFormats,s7),Q;let[X,W]=Y.mode==="fast"?[m1.fastFormats,JM]:[m1.fullFormats,s7],G=Y.formats||m1.formatNames;if(e7(Q,G,X,W),Y.keywords)(0,zM.default)(Q);return Q};P9.get=(Q,Y="full")=>{let W=(Y==="fast"?m1.fastFormats:m1.fullFormats)[Q];if(!W)throw Error(`Unknown format "${Q}"`);return W};function e7(Q,Y,X,W){var G,z;(G=(z=Q.opts.code).formats)!==null&&G!==void 0||(z.formats=b9._`require("ajv-formats/dist/formats").${W}`);for(let J of Y)Q.addFormat(J,X[J])}Q5.exports=u4=P9;Object.defineProperty(u4,"__esModule",{value:!0});u4.default=P9});import{AsyncLocalStorage as k5}from"node:async_hooks";class D1 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 C5(Q){if(Q instanceof D1)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 v5(Q){let Y=C5(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 b1(Q){let Y=v5(Q);return[`Sequenzy MCP error: ${Y.title}`,`Description: ${Y.description}`,`How to fix: ${Y.howToFix}`,`Docs: ${Y.docsUrl}`,`Details: ${Y.details}`].join(`
|
|
9
|
-
`)}var x5="https://api.sequenzy.com",p1=new k5,_9=null;function B1(){let Q=p1.getStore();if(Q)return Q.selectedCompanyId??null;return _9}function FQ(Q){let Y=p1.getStore();if(Y){Y.selectedCompanyId=Q;return}_9=Q}function g9(Q,Y){return p1.run(Q,Y)}function _5(){return p1.getStore()?.apiUrl??process.env.SEQUENZY_API_URL??x5}function y9(){return p1.getStore()?.apiKey??process.env.SEQUENZY_API_KEY}function RM(){if(y9())return;console.error(b1(new D1("SEQUENZY_API_KEY environment variable is required",401,void 0,"MCP_AUTH_REQUIRED"))),process.exit(1)}function V0(Q,Y){let X=Q[Y];return typeof X==="string"&&X.trim()!==""?X.trim():void 0}function g5(Q){if(Q===void 0)return;if(typeof Q==="string")return Q.trim()||void 0;return JSON.stringify(Q)}function y5(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=V0(Y,"code")??(X?V0(X,"code"):void 0),G=(typeof Y.error==="string"?Y.error:void 0)??(X?V0(X,"message"):void 0)??V0(Y,"message")??V0(Y,"error")??Q,z=V0(Y,"howToFix")??V0(Y,"resolution"),J={...V0(Y,"title")?{title:V0(Y,"title")}:{},...V0(Y,"description")?{description:V0(Y,"description")}:{},...z?{howToFix:z}:{},...V0(Y,"docsUrl")?{docsUrl:V0(Y,"docsUrl")}:{}},$=g5(Y.details);if(Object.keys(J).length>0||$)return{message:G,...W?{code:W}:{},...$?{details:$}:{},...Object.keys(J).length>0?{context:J}:{}};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 N(Q,Y,X,W){let G=y9();if(!G)throw new D1("SEQUENZY_API_KEY environment variable is required",401,void 0,"MCP_AUTH_REQUIRED");let z={"Content-Type":"application/json",Authorization:`Bearer ${G}`},J=W??B1();if(J)z["x-company-id"]=J;let $;try{$=await fetch(`${_5()}${Y}`,{method:Q,headers:z,body:X?JSON.stringify(X):void 0})}catch(H){throw new D1(H instanceof Error?H.message:"Failed to reach Sequenzy API",0,void 0,"NETWORK_ERROR")}if(!$.ok){let H=await $.text(),A=y5(H);throw new D1(A.message,$.status,A.details??H,A.code,A.context)}return $.json()}var vM=Object.freeze({status:"aborted"});function F(Q,Y,X){function W($,H){var A;Object.defineProperty($,"_zod",{value:$._zod??{},enumerable:!1}),(A=$._zod).traits??(A.traits=new Set),$._zod.traits.add(Q),Y($,H);for(let U in J.prototype)if(!(U in $))Object.defineProperty($,U,{value:J.prototype[U].bind($)});$._zod.constr=J,$._zod.def=H}let G=X?.Parent??Object;class z extends G{}Object.defineProperty(z,"name",{value:Q});function J($){var H;let A=X?.Parent?new z:this;W(A,$),(H=A._zod).deferred??(H.deferred=[]);for(let U of A._zod.deferred)U();return A}return Object.defineProperty(J,"init",{value:W}),Object.defineProperty(J,Symbol.hasInstance,{value:($)=>{if(X?.Parent&&$ instanceof X.Parent)return!0;return $?._zod?.traits?.has(Q)}}),Object.defineProperty(J,"name",{value:Q}),J}var kM=Symbol("zod_brand");class l0 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class i1 extends Error{constructor(Q){super(`Encountered unidirectional transform during encode: ${Q}`);this.name="ZodEncodeError"}}var m4={};function w0(Q){if(Q)Object.assign(m4,Q);return m4}var h={};x9(h,{unwrapMessage:()=>r1,uint8ArrayToHex:()=>HH,uint8ArrayToBase64url:()=>JH,uint8ArrayToBase64:()=>p9,stringifyPrimitive:()=>r4,shallowClone:()=>h9,safeExtend:()=>QH,required:()=>WH,randomString:()=>n5,propertyKeyTypes:()=>NQ,promiseAllObject:()=>r5,primitiveTypes:()=>f9,prefixIssues:()=>c0,pick:()=>a5,partial:()=>XH,optionalKeys:()=>ZQ,omit:()=>s5,objectClone:()=>c5,numKeys:()=>d5,nullish:()=>n1,normalizeParams:()=>I,mergeDefs:()=>s0,merge:()=>YH,jsonStringifyReplacer:()=>P1,joinValues:()=>c4,issue:()=>I1,isPlainObject:()=>e0,isObject:()=>L1,hexToUint8Array:()=>$H,getSizableOrigin:()=>m9,getParsedType:()=>o5,getLengthableOrigin:()=>o1,getEnumValues:()=>OQ,getElementAtPath:()=>i5,floatSafeRemainder:()=>MQ,finalizeIssue:()=>T0,extend:()=>e5,escapeRegex:()=>m0,esc:()=>p4,defineLazy:()=>m,createTransparentProxy:()=>t5,cloneDef:()=>p5,clone:()=>E0,cleanRegex:()=>d1,cleanEnum:()=>GH,captureStackTrace:()=>i4,cached:()=>j1,base64urlToUint8Array:()=>zH,base64ToUint8Array:()=>c9,assignProp:()=>a0,assertNotEqual:()=>h5,assertNever:()=>l5,assertIs:()=>f5,assertEqual:()=>u5,assert:()=>m5,allowsEval:()=>VQ,aborted:()=>Q1,NUMBER_FORMAT_RANGES:()=>wQ,Class:()=>i9,BIGINT_FORMAT_RANGES:()=>l9});function u5(Q){return Q}function h5(Q){return Q}function f5(Q){}function l5(Q){throw Error()}function m5(Q){}function OQ(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 c4(Q,Y="|"){return Q.map((X)=>r4(X)).join(Y)}function P1(Q,Y){if(typeof Y==="bigint")return Y.toString();return Y}function j1(Q){return{get value(){{let X=Q();return Object.defineProperty(this,"value",{value:X}),X}throw Error("cached value already set")}}}function n1(Q){return Q===null||Q===void 0}function d1(Q){let Y=Q.startsWith("^")?1:0,X=Q.endsWith("$")?Q.length-1:Q.length;return Q.slice(Y,X)}function MQ(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 z=X>G?X:G,J=Number.parseInt(Q.toFixed(z).replace(".","")),$=Number.parseInt(Y.toFixed(z).replace(".",""));return J%$/10**z}var u9=Symbol("evaluating");function m(Q,Y,X){let W=void 0;Object.defineProperty(Q,Y,{get(){if(W===u9)return;if(W===void 0)W=u9,W=X();return W},set(G){Object.defineProperty(Q,Y,{value:G})},configurable:!0})}function c5(Q){return Object.create(Object.getPrototypeOf(Q),Object.getOwnPropertyDescriptors(Q))}function a0(Q,Y,X){Object.defineProperty(Q,Y,{value:X,writable:!0,enumerable:!0,configurable:!0})}function s0(...Q){let Y={};for(let X of Q){let W=Object.getOwnPropertyDescriptors(X);Object.assign(Y,W)}return Object.defineProperties({},Y)}function p5(Q){return s0(Q._zod.def)}function i5(Q,Y){if(!Y)return Q;return Y.reduce((X,W)=>X?.[W],Q)}function r5(Q){let Y=Object.keys(Q),X=Y.map((W)=>Q[W]);return Promise.all(X).then((W)=>{let G={};for(let z=0;z<Y.length;z++)G[Y[z]]=W[z];return G})}function n5(Q=10){let X="";for(let W=0;W<Q;W++)X+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return X}function p4(Q){return JSON.stringify(Q)}var i4="captureStackTrace"in Error?Error.captureStackTrace:(...Q)=>{};function L1(Q){return typeof Q==="object"&&Q!==null&&!Array.isArray(Q)}var VQ=j1(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(Q){return!1}});function e0(Q){if(L1(Q)===!1)return!1;let Y=Q.constructor;if(Y===void 0)return!0;let X=Y.prototype;if(L1(X)===!1)return!1;if(Object.prototype.hasOwnProperty.call(X,"isPrototypeOf")===!1)return!1;return!0}function h9(Q){if(e0(Q))return{...Q};if(Array.isArray(Q))return[...Q];return Q}function d5(Q){let Y=0;for(let X in Q)if(Object.prototype.hasOwnProperty.call(Q,X))Y++;return Y}var o5=(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}`)}},NQ=new Set(["string","number","symbol"]),f9=new Set(["string","number","bigint","boolean","symbol","undefined"]);function m0(Q){return Q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function E0(Q,Y,X){let W=new Q._zod.constr(Y??Q._zod.def);if(!Y||X?.parent)W._zod.parent=Q;return W}function I(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 t5(Q){let Y;return new Proxy({},{get(X,W,G){return Y??(Y=Q()),Reflect.get(Y,W,G)},set(X,W,G,z){return Y??(Y=Q()),Reflect.set(Y,W,G,z)},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 r4(Q){if(typeof Q==="bigint")return Q.toString()+"n";if(typeof Q==="string")return`"${Q}"`;return`${Q}`}function ZQ(Q){return Object.keys(Q).filter((Y)=>{return Q[Y]._zod.optin==="optional"&&Q[Y]._zod.optout==="optional"})}var wQ={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]},l9={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function a5(Q,Y){let X=Q._zod.def,W=s0(Q._zod.def,{get shape(){let G={};for(let z in Y){if(!(z in X.shape))throw Error(`Unrecognized key: "${z}"`);if(!Y[z])continue;G[z]=X.shape[z]}return a0(this,"shape",G),G},checks:[]});return E0(Q,W)}function s5(Q,Y){let X=Q._zod.def,W=s0(Q._zod.def,{get shape(){let G={...Q._zod.def.shape};for(let z in Y){if(!(z in X.shape))throw Error(`Unrecognized key: "${z}"`);if(!Y[z])continue;delete G[z]}return a0(this,"shape",G),G},checks:[]});return E0(Q,W)}function e5(Q,Y){if(!e0(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=s0(Q._zod.def,{get shape(){let z={...Q._zod.def.shape,...Y};return a0(this,"shape",z),z},checks:[]});return E0(Q,G)}function QH(Q,Y){if(!e0(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 a0(this,"shape",W),W},checks:Q._zod.def.checks};return E0(Q,X)}function YH(Q,Y){let X=s0(Q._zod.def,{get shape(){let W={...Q._zod.def.shape,...Y._zod.def.shape};return a0(this,"shape",W),W},get catchall(){return Y._zod.def.catchall},checks:[]});return E0(Q,X)}function XH(Q,Y,X){let W=s0(Y._zod.def,{get shape(){let G=Y._zod.def.shape,z={...G};if(X)for(let J in X){if(!(J in G))throw Error(`Unrecognized key: "${J}"`);if(!X[J])continue;z[J]=Q?new Q({type:"optional",innerType:G[J]}):G[J]}else for(let J in G)z[J]=Q?new Q({type:"optional",innerType:G[J]}):G[J];return a0(this,"shape",z),z},checks:[]});return E0(Y,W)}function WH(Q,Y,X){let W=s0(Y._zod.def,{get shape(){let G=Y._zod.def.shape,z={...G};if(X)for(let J in X){if(!(J in z))throw Error(`Unrecognized key: "${J}"`);if(!X[J])continue;z[J]=new Q({type:"nonoptional",innerType:G[J]})}else for(let J in G)z[J]=new Q({type:"nonoptional",innerType:G[J]});return a0(this,"shape",z),z},checks:[]});return E0(Y,W)}function Q1(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 c0(Q,Y){return Y.map((X)=>{var W;return(W=X).path??(W.path=[]),X.path.unshift(Q),X})}function r1(Q){return typeof Q==="string"?Q:Q?.message}function T0(Q,Y,X){let W={...Q,path:Q.path??[]};if(!Q.message){let G=r1(Q.inst?._zod.def?.error?.(Q))??r1(Y?.error?.(Q))??r1(X.customError?.(Q))??r1(X.localeError?.(Q))??"Invalid input";W.message=G}if(delete W.inst,delete W.continue,!Y?.reportInput)delete W.input;return W}function m9(Q){if(Q instanceof Set)return"set";if(Q instanceof Map)return"map";if(Q instanceof File)return"file";return"unknown"}function o1(Q){if(Array.isArray(Q))return"array";if(typeof Q==="string")return"string";return"unknown"}function I1(...Q){let[Y,X,W]=Q;if(typeof Y==="string")return{message:Y,code:"custom",input:X,inst:W};return{...Y}}function GH(Q){return Object.entries(Q).filter(([Y,X])=>{return Number.isNaN(Number.parseInt(Y,10))}).map((Y)=>Y[1])}function c9(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 p9(Q){let Y="";for(let X=0;X<Q.length;X++)Y+=String.fromCharCode(Q[X]);return btoa(Y)}function zH(Q){let Y=Q.replace(/-/g,"+").replace(/_/g,"/"),X="=".repeat((4-Y.length%4)%4);return c9(Y+X)}function JH(Q){return p9(Q).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function $H(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 HH(Q){return Array.from(Q).map((Y)=>Y.toString(16).padStart(2,"0")).join("")}class i9{constructor(...Q){}}var r9=(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,P1,2),Object.defineProperty(Q,"toString",{value:()=>Q.message,enumerable:!1})},n4=F("$ZodError",r9),bQ=F("$ZodError",r9,{Parent:Error});function n9(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 d9(Q,Y=(X)=>X.message){let X={_errors:[]},W=(G)=>{for(let z of G.issues)if(z.code==="invalid_union"&&z.errors.length)z.errors.map((J)=>W({issues:J}));else if(z.code==="invalid_key")W({issues:z.issues});else if(z.code==="invalid_element")W({issues:z.issues});else if(z.path.length===0)X._errors.push(Y(z));else{let J=X,$=0;while($<z.path.length){let H=z.path[$];if($!==z.path.length-1)J[H]=J[H]||{_errors:[]};else J[H]=J[H]||{_errors:[]},J[H]._errors.push(Y(z));J=J[H],$++}}};return W(Q),X}var d4=(Q)=>(Y,X,W,G)=>{let z=W?Object.assign(W,{async:!1}):{async:!1},J=Y._zod.run({value:X,issues:[]},z);if(J instanceof Promise)throw new l0;if(J.issues.length){let $=new(G?.Err??Q)(J.issues.map((H)=>T0(H,z,w0())));throw i4($,G?.callee),$}return J.value};var o4=(Q)=>async(Y,X,W,G)=>{let z=W?Object.assign(W,{async:!0}):{async:!0},J=Y._zod.run({value:X,issues:[]},z);if(J instanceof Promise)J=await J;if(J.issues.length){let $=new(G?.Err??Q)(J.issues.map((H)=>T0(H,z,w0())));throw i4($,G?.callee),$}return J.value};var t1=(Q)=>(Y,X,W)=>{let G=W?{...W,async:!1}:{async:!1},z=Y._zod.run({value:X,issues:[]},G);if(z instanceof Promise)throw new l0;return z.issues.length?{success:!1,error:new(Q??n4)(z.issues.map((J)=>T0(J,G,w0())))}:{success:!0,data:z.value}},a1=t1(bQ),s1=(Q)=>async(Y,X,W)=>{let G=W?Object.assign(W,{async:!0}):{async:!0},z=Y._zod.run({value:X,issues:[]},G);if(z instanceof Promise)z=await z;return z.issues.length?{success:!1,error:new Q(z.issues.map((J)=>T0(J,G,w0())))}:{success:!0,data:z.value}},t4=s1(bQ),o9=(Q)=>(Y,X,W)=>{let G=W?Object.assign(W,{direction:"backward"}):{direction:"backward"};return d4(Q)(Y,X,G)};var t9=(Q)=>(Y,X,W)=>{return d4(Q)(Y,X,W)};var a9=(Q)=>async(Y,X,W)=>{let G=W?Object.assign(W,{direction:"backward"}):{direction:"backward"};return o4(Q)(Y,X,G)};var s9=(Q)=>async(Y,X,W)=>{return o4(Q)(Y,X,W)};var e9=(Q)=>(Y,X,W)=>{let G=W?Object.assign(W,{direction:"backward"}):{direction:"backward"};return t1(Q)(Y,X,G)};var QX=(Q)=>(Y,X,W)=>{return t1(Q)(Y,X,W)};var YX=(Q)=>async(Y,X,W)=>{let G=W?Object.assign(W,{direction:"backward"}):{direction:"backward"};return s1(Q)(Y,X,G)};var XX=(Q)=>async(Y,X,W)=>{return s1(Q)(Y,X,W)};var WX=/^[cC][^\s-]{8,}$/,GX=/^[0-9a-z]+$/,zX=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,JX=/^[0-9a-vA-V]{20}$/,$X=/^[A-Za-z0-9]{27}$/,HX=/^[a-zA-Z0-9_-]{21}$/,AX=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var UX=/^([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})$/,PQ=(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 KX=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function DX(){return new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}var BX=/^(?:(?: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])$/,LX=/^(([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}|:))$/,FX=/^((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])$/,qX=/^(([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])$/,OX=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,jQ=/^[A-Za-z0-9_-]*$/,MX=/^(?=.{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 VX=/^\+(?:[0-9]){6,14}[0-9]$/,NX="(?:(?:\\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])))",ZX=new RegExp(`^${NX}$`);function wX(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 bX(Q){return new RegExp(`^${wX(Q)}$`)}function PX(Q){let Y=wX({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(`^${NX}T(?:${W})$`)}var jX=(Q)=>{let Y=Q?`[\\s\\S]{${Q?.minimum??0},${Q?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${Y}$`)};var IX=/^-?\d+$/,EX=/^-?\d+(?:\.\d+)?/,TX=/^(?:true|false)$/i,SX=/^null$/i;var RX=/^[^A-Z]*$/,CX=/^[^a-z]*$/;var W0=F("$ZodCheck",(Q,Y)=>{var X;Q._zod??(Q._zod={}),Q._zod.def=Y,(X=Q._zod).onattach??(X.onattach=[])}),vX={number:"number",bigint:"bigint",object:"date"},IQ=F("$ZodCheckLessThan",(Q,Y)=>{W0.init(Q,Y);let X=vX[typeof Y.value];Q._zod.onattach.push((W)=>{let G=W._zod.bag,z=(Y.inclusive?G.maximum:G.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(Y.value<z)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})}}),EQ=F("$ZodCheckGreaterThan",(Q,Y)=>{W0.init(Q,Y);let X=vX[typeof Y.value];Q._zod.onattach.push((W)=>{let G=W._zod.bag,z=(Y.inclusive?G.minimum:G.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(Y.value>z)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})}}),kX=F("$ZodCheckMultipleOf",(Q,Y)=>{W0.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):MQ(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})}}),xX=F("$ZodCheckNumberFormat",(Q,Y)=>{W0.init(Q,Y),Y.format=Y.format||"float64";let X=Y.format?.includes("int"),W=X?"int":"number",[G,z]=wQ[Y.format];Q._zod.onattach.push((J)=>{let $=J._zod.bag;if($.format=Y.format,$.minimum=G,$.maximum=z,X)$.pattern=IX}),Q._zod.check=(J)=>{let $=J.value;if(X){if(!Number.isInteger($)){J.issues.push({expected:W,format:Y.format,code:"invalid_type",continue:!1,input:$,inst:Q});return}if(!Number.isSafeInteger($)){if($>0)J.issues.push({input:$,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 J.issues.push({input:$,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($<G)J.issues.push({origin:"number",input:$,code:"too_small",minimum:G,inclusive:!0,inst:Q,continue:!Y.abort});if($>z)J.issues.push({origin:"number",input:$,code:"too_big",maximum:z,inst:Q})}});var _X=F("$ZodCheckMaxLength",(Q,Y)=>{var X;W0.init(Q,Y),(X=Q._zod.def).when??(X.when=(W)=>{let G=W.value;return!n1(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 J=o1(G);W.issues.push({origin:J,code:"too_big",maximum:Y.maximum,inclusive:!0,input:G,inst:Q,continue:!Y.abort})}}),gX=F("$ZodCheckMinLength",(Q,Y)=>{var X;W0.init(Q,Y),(X=Q._zod.def).when??(X.when=(W)=>{let G=W.value;return!n1(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 J=o1(G);W.issues.push({origin:J,code:"too_small",minimum:Y.minimum,inclusive:!0,input:G,inst:Q,continue:!Y.abort})}}),yX=F("$ZodCheckLengthEquals",(Q,Y)=>{var X;W0.init(Q,Y),(X=Q._zod.def).when??(X.when=(W)=>{let G=W.value;return!n1(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,z=G.length;if(z===Y.length)return;let J=o1(G),$=z>Y.length;W.issues.push({origin: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})}}),e1=F("$ZodCheckStringFormat",(Q,Y)=>{var X,W;if(W0.init(Q,Y),Q._zod.onattach.push((G)=>{let z=G._zod.bag;if(z.format=Y.format,Y.pattern)z.patterns??(z.patterns=new Set),z.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=()=>{})}),uX=F("$ZodCheckRegex",(Q,Y)=>{e1.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})}}),hX=F("$ZodCheckLowerCase",(Q,Y)=>{Y.pattern??(Y.pattern=RX),e1.init(Q,Y)}),fX=F("$ZodCheckUpperCase",(Q,Y)=>{Y.pattern??(Y.pattern=CX),e1.init(Q,Y)}),lX=F("$ZodCheckIncludes",(Q,Y)=>{W0.init(Q,Y);let X=m0(Y.includes),W=new RegExp(typeof Y.position==="number"?`^.{${Y.position}}${X}`:X);Y.pattern=W,Q._zod.onattach.push((G)=>{let z=G._zod.bag;z.patterns??(z.patterns=new Set),z.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})}}),mX=F("$ZodCheckStartsWith",(Q,Y)=>{W0.init(Q,Y);let X=new RegExp(`^${m0(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})}}),cX=F("$ZodCheckEndsWith",(Q,Y)=>{W0.init(Q,Y);let X=new RegExp(`.*${m0(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 pX=F("$ZodCheckOverwrite",(Q,Y)=>{W0.init(Q,Y),Q._zod.check=(X)=>{X.value=Y.tx(X.value)}});class TQ{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 Vq={keyword:"dependencies",type:"object",schemaType:"object",error:c$.error,code(Q){let[Y,X]=Nq(Q);l$(Q,Y),m$(Q,X)}};function Nq({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 l$(Q,Y=Q.schema){let{gen:X,data:W,it:G}=Q;if(Object.keys(Y).length===0)return;let z=X.let("missing");for(let J in Y){let $=Y[J];if($.length===0)continue;let H=(0,g4.propertyInData)(X,W,J,G.opts.ownProperties);if(Q.setParams({property:J,depsCount:$.length,deps:$.join(", ")}),G.allErrors)X.if(H,()=>{for(let A of $)(0,g4.checkReportMissingProp)(Q,A)});else X.if(U9._`${H} && (${(0,g4.checkMissingProp)(Q,$,z)})`),(0,g4.reportMissingProp)(Q,z),X.else()}}c$.validatePropertyDeps=l$;function m$(Q,Y=Q.schema){let{gen:X,data:W,keyword:G,it:z}=Q,J=X.name("valid");for(let $ in Y){if((0,Mq.alwaysValidSchema)(z,Y[$]))continue;X.if((0,g4.propertyInData)(X,W,$,z.opts.ownProperties),()=>{let H=Q.subschema({keyword:G,schemaProp:$},J);Q.mergeValidEvaluated(H,J)},()=>X.var(J,!0)),Q.ok(J)}}c$.validateSchemaDeps=m$;c$.default=Vq});var o$=Z((d$)=>{Object.defineProperty(d$,"__esModule",{value:!0});var n$=k(),bq=f(),Pq={message:"property name must be valid",params:({params:Q})=>n$._`{propertyName: ${Q.propertyName}}`},jq={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Pq,code(Q){let{gen:Y,schema:X,data:W,it:G}=Q;if((0,bq.alwaysValidSchema)(G,X))return;let z=Y.name("valid");Y.forIn("key",W,(J)=>{Q.setParams({propertyName:J}),Q.subschema({keyword:"propertyNames",data:J,dataTypes:["string"],propertyName:J,compositeRule:!0},z),Y.if((0,n$.not)(z),()=>{if(Q.error(!0),!G.allErrors)Y.break()})}),Q.ok(z)}};d$.default=jq});var K9=Z((t$)=>{Object.defineProperty(t$,"__esModule",{value:!0});var Y6=j0(),k0=k(),Eq=r0(),X6=f(),Tq={message:"must NOT have additional properties",params:({params:Q})=>k0._`{additionalProperty: ${Q.additionalProperty}}`},Sq={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Tq,code(Q){let{gen:Y,schema:X,parentSchema:W,data:G,errsCount:z,it:J}=Q;if(!z)throw Error("ajv implementation error");let{allErrors:$,opts:H}=J;if(J.props=!0,H.removeAdditional!=="all"&&(0,X6.alwaysValidSchema)(J,X))return;let A=(0,Y6.allSchemaProperties)(W.properties),U=(0,Y6.allSchemaProperties)(W.patternProperties);K(),Q.ok(k0._`${z} === ${Eq.default.errors}`);function K(){Y.forIn("key",G,(V)=>{if(!A.length&&!U.length)q(V);else Y.if(D(V),()=>q(V))})}function D(V){let M;if(A.length>8){let S=(0,X6.schemaRefOrVal)(J,W.properties,"properties");M=(0,Y6.isOwnProperty)(Y,S,V)}else if(A.length)M=(0,k0.or)(...A.map((S)=>k0._`${V} === ${S}`));else M=k0.nil;if(U.length)M=(0,k0.or)(M,...U.map((S)=>k0._`${(0,Y6.usePattern)(Q,S)}.test(${V})`));return(0,k0.not)(M)}function L(V){Y.code(k0._`delete ${G}[${V}]`)}function q(V){if(H.removeAdditional==="all"||H.removeAdditional&&X===!1){L(V);return}if(X===!1){if(Q.setParams({additionalProperty:V}),Q.error(),!$)Y.break();return}if(typeof X=="object"&&!(0,X6.alwaysValidSchema)(J,X)){let M=Y.name("valid");if(H.removeAdditional==="failing")O(V,M,!1),Y.if((0,k0.not)(M),()=>{Q.reset(),L(V)});else if(O(V,M),!$)Y.if((0,k0.not)(M),()=>Y.break())}}function O(V,M,S){let E={keyword:"additionalProperties",dataProp:V,dataPropType:X6.Type.Str};if(S===!1)Object.assign(E,{compositeRule:!0,createErrors:!1,allErrors:!1});Q.subschema(E,M)}}};t$.default=Sq});var Q7=Z((e$)=>{Object.defineProperty(e$,"__esModule",{value:!0});var Cq=P4(),a$=j0(),D9=f(),s$=K9(),vq={keyword:"properties",type:"object",schemaType:"object",code(Q){let{gen:Y,schema:X,parentSchema:W,data:G,it:z}=Q;if(z.opts.removeAdditional==="all"&&W.additionalProperties===void 0)s$.default.code(new Cq.KeywordCxt(z,s$.default,"additionalProperties"));let J=(0,a$.allSchemaProperties)(X);for(let K of J)z.definedProperties.add(K);if(z.opts.unevaluated&&J.length&&z.props!==!0)z.props=D9.mergeEvaluated.props(Y,(0,D9.toHash)(J),z.props);let $=J.filter((K)=>!(0,D9.alwaysValidSchema)(z,X[K]));if($.length===0)return;let H=Y.name("valid");for(let K of $){if(A(K))U(K);else{if(Y.if((0,a$.propertyInData)(Y,G,K,z.opts.ownProperties)),U(K),!z.allErrors)Y.else().var(H,!0);Y.endIf()}Q.it.definedProperties.add(K),Q.ok(H)}function A(K){return z.opts.useDefaults&&!z.compositeRule&&X[K].default!==void 0}function U(K){Q.subschema({keyword:"properties",schemaProp:K,dataProp:K},H)}}};e$.default=vq});var z7=Z((G7)=>{Object.defineProperty(G7,"__esModule",{value:!0});var Y7=j0(),W6=k(),X7=f(),W7=f(),xq={keyword:"patternProperties",type:"object",schemaType:"object",code(Q){let{gen:Y,schema:X,data:W,parentSchema:G,it:z}=Q,{opts:J}=z,$=(0,Y7.allSchemaProperties)(X),H=$.filter((O)=>(0,X7.alwaysValidSchema)(z,X[O]));if($.length===0||H.length===$.length&&(!z.opts.unevaluated||z.props===!0))return;let A=J.strictSchema&&!J.allowMatchingProperties&&G.properties,U=Y.name("valid");if(z.props!==!0&&!(z.props instanceof W6.Name))z.props=(0,W7.evaluatedPropsToName)(Y,z.props);let{props:K}=z;D();function D(){for(let O of $){if(A)L(O);if(z.allErrors)q(O);else Y.var(U,!0),q(O),Y.if(U)}}function L(O){for(let V in A)if(new RegExp(O).test(V))(0,X7.checkStrictMode)(z,`property ${V} matches pattern ${O} (use allowMatchingProperties)`)}function q(O){Y.forIn("key",W,(V)=>{Y.if(W6._`${(0,Y7.usePattern)(Q,O)}.test(${V})`,()=>{let M=H.includes(O);if(!M)Q.subschema({keyword:"patternProperties",schemaProp:O,dataProp:V,dataPropType:W7.Type.Str},U);if(z.opts.unevaluated&&K!==!0)Y.assign(W6._`${K}[${V}]`,!0);else if(!M&&!z.allErrors)Y.if((0,W6.not)(U),()=>Y.break())})})}}};G7.default=xq});var $7=Z((J7)=>{Object.defineProperty(J7,"__esModule",{value:!0});var gq=f(),yq={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(Q){let{gen:Y,schema:X,it:W}=Q;if((0,gq.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"}};J7.default=yq});var A7=Z((H7)=>{Object.defineProperty(H7,"__esModule",{value:!0});var hq=j0(),fq={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:hq.validateUnion,error:{message:"must match a schema in anyOf"}};H7.default=fq});var K7=Z((U7)=>{Object.defineProperty(U7,"__esModule",{value:!0});var G6=k(),mq=f(),cq={message:"must match exactly one schema in oneOf",params:({params:Q})=>G6._`{passingSchemas: ${Q.passing}}`},pq={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:cq,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 z=X,J=Y.let("valid",!1),$=Y.let("passing",null),H=Y.name("_valid");Q.setParams({passing:$}),Y.block(A),Q.result(J,()=>Q.reset(),()=>Q.error(!0));function A(){z.forEach((U,K)=>{let D;if((0,mq.alwaysValidSchema)(G,U))Y.var(H,!0);else D=Q.subschema({keyword:"oneOf",schemaProp:K,compositeRule:!0},H);if(K>0)Y.if(G6._`${H} && ${J}`).assign(J,!1).assign($,G6._`[${$}, ${K}]`).else();Y.if(H,()=>{if(Y.assign(J,!0),Y.assign($,K),D)Q.mergeEvaluated(D,G6.Name)})})}}};U7.default=pq});var B7=Z((D7)=>{Object.defineProperty(D7,"__esModule",{value:!0});var rq=f(),nq={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,J)=>{if((0,rq.alwaysValidSchema)(W,z))return;let $=Q.subschema({keyword:"allOf",schemaProp:J},G);Q.ok(G),Q.mergeEvaluated($)})}};D7.default=nq});var O7=Z((q7)=>{Object.defineProperty(q7,"__esModule",{value:!0});var z6=k(),F7=f(),oq={message:({params:Q})=>z6.str`must match "${Q.ifClause}" schema`,params:({params:Q})=>z6._`{failingKeyword: ${Q.ifClause}}`},tq={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:oq,code(Q){let{gen:Y,parentSchema:X,it:W}=Q;if(X.then===void 0&&X.else===void 0)(0,F7.checkStrictMode)(W,'"if" without "then" and "else" is ignored');let G=L7(W,"then"),z=L7(W,"else");if(!G&&!z)return;let J=Y.let("valid",!0),$=Y.name("_valid");if(H(),Q.reset(),G&&z){let U=Y.let("ifClause");Q.setParams({ifClause:U}),Y.if($,A("then",U),A("else",U))}else if(G)Y.if($,A("then"));else Y.if((0,z6.not)($),A("else"));Q.pass(J,()=>Q.error(!0));function H(){let U=Q.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},$);Q.mergeEvaluated(U)}function A(U,K){return()=>{let D=Q.subschema({keyword:U},$);if(Y.assign(J,$),Q.mergeValidEvaluated(D,J),K)Y.assign(K,z6._`${U}`);else Q.setParams({ifClause:U})}}}};function L7(Q,Y){let X=Q.schema[Y];return X!==void 0&&!(0,F7.alwaysValidSchema)(Q,X)}q7.default=tq});var V7=Z((M7)=>{Object.defineProperty(M7,"__esModule",{value:!0});var sq=f(),eq={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:Q,parentSchema:Y,it:X}){if(Y.if===void 0)(0,sq.checkStrictMode)(X,`"${Q}" without "if" is ignored`)}};M7.default=eq});var Z7=Z((N7)=>{Object.defineProperty(N7,"__esModule",{value:!0});var YO=H9(),XO=_$(),WO=A9(),GO=u$(),zO=f$(),JO=r$(),$O=o$(),HO=K9(),AO=Q7(),UO=z7(),KO=$7(),DO=A7(),BO=K7(),LO=B7(),FO=O7(),qO=V7();function OO(Q=!1){let Y=[KO.default,DO.default,BO.default,LO.default,FO.default,qO.default,$O.default,HO.default,JO.default,AO.default,UO.default];if(Q)Y.push(XO.default,GO.default);else Y.push(YO.default,WO.default);return Y.push(zO.default),Y}N7.default=OO});var b7=Z((w7)=>{Object.defineProperty(w7,"__esModule",{value:!0});var e=k(),VO={message:({schemaCode:Q})=>e.str`must match format "${Q}"`,params:({schemaCode:Q})=>e._`{format: ${Q}}`},NO={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:VO,code(Q,Y){let{gen:X,data:W,$data:G,schema:z,schemaCode:J,it:$}=Q,{opts:H,errSchemaPath:A,schemaEnv:U,self:K}=$;if(!H.validateFormats)return;if(G)D();else L();function D(){let q=X.scopeValue("formats",{ref:K.formats,code:H.code.formats}),O=X.const("fDef",e._`${q}[${J}]`),V=X.let("fType"),M=X.let("format");X.if(e._`typeof ${O} == "object" && !(${O} instanceof RegExp)`,()=>X.assign(V,e._`${O}.type || "string"`).assign(M,e._`${O}.validate`),()=>X.assign(V,e._`"string"`).assign(M,O)),Q.fail$data((0,e.or)(S(),E()));function S(){if(H.strictSchema===!1)return e.nil;return e._`${J} && !${M}`}function E(){let x=U.$async?e._`(${O}.async ? await ${M}(${W}) : ${M}(${W}))`:e._`${M}(${W})`,T=e._`(typeof ${M} == "function" ? ${x} : ${M}.test(${W}))`;return e._`${M} && ${M} !== true && ${V} === ${Y} && !${T}`}}function L(){let q=K.formats[z];if(!q){S();return}if(q===!0)return;let[O,V,M]=E(q);if(O===Y)Q.pass(x());function S(){if(H.strictSchema===!1){K.logger.warn(T());return}throw Error(T());function T(){return`unknown format "${z}" ignored in schema at path "${A}"`}}function E(T){let _0=T instanceof RegExp?(0,e.regexpCode)(T):H.code.formats?e._`${H.code.formats}${(0,e.getProperty)(z)}`:void 0,f0=X.scopeValue("formats",{key:z,ref:T,code:_0});if(typeof T=="object"&&!(T instanceof RegExp))return[T.type||"string",T.validate,e._`${f0}.validate`];return["string",T,f0]}function x(){if(typeof q=="object"&&!(q instanceof RegExp)&&q.async){if(!U.$async)throw Error("async format in sync schema");return e._`await ${M}(${W})`}return typeof V=="function"?e._`${M}(${W})`:e._`${M}.test(${W})`}}}};w7.default=NO});var j7=Z((P7)=>{Object.defineProperty(P7,"__esModule",{value:!0});var wO=b7(),bO=[wO.default];P7.default=bO});var T7=Z((I7)=>{Object.defineProperty(I7,"__esModule",{value:!0});I7.contentVocabulary=I7.metadataVocabulary=void 0;I7.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];I7.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var C7=Z((R7)=>{Object.defineProperty(R7,"__esModule",{value:!0});var IO=eJ(),EO=I$(),TO=Z7(),SO=j7(),S7=T7(),RO=[IO.default,EO.default,(0,TO.default)(),SO.default,S7.metadataVocabulary,S7.contentVocabulary];R7.default=RO});var _7=Z((k7)=>{Object.defineProperty(k7,"__esModule",{value:!0});k7.DiscrError=void 0;var v7;(function(Q){Q.Tag="tag",Q.Mapping="mapping"})(v7||(k7.DiscrError=v7={}))});var u7=Z((y7)=>{Object.defineProperty(y7,"__esModule",{value:!0});var f1=k(),B9=_7(),g7=fQ(),vO=j4(),kO=f(),xO={message:({params:{discrError:Q,tagName:Y}})=>Q===B9.DiscrError.Tag?`tag "${Y}" must be string`:`value of tag "${Y}" must be in oneOf`,params:({params:{discrError:Q,tag:Y,tagName:X}})=>f1._`{error: ${Q}, tag: ${X}, tagValue: ${Y}}`},_O={keyword:"discriminator",type:"object",schemaType:"object",error:xO,code(Q){let{gen:Y,data:X,schema:W,parentSchema:G,it:z}=Q,{oneOf:J}=G;if(!z.opts.discriminator)throw Error("discriminator: requires discriminator option");let $=W.propertyName;if(typeof $!="string")throw Error("discriminator: requires propertyName");if(W.mapping)throw Error("discriminator: mapping is not supported");if(!J)throw Error("discriminator: requires oneOf keyword");let H=Y.let("valid",!1),A=Y.const("tag",f1._`${X}${(0,f1.getProperty)($)}`);Y.if(f1._`typeof ${A} == "string"`,()=>U(),()=>Q.error(!1,{discrError:B9.DiscrError.Tag,tag:A,tagName:$})),Q.ok(H);function U(){let L=D();Y.if(!1);for(let q in L)Y.elseIf(f1._`${A} === ${q}`),Y.assign(H,K(L[q]));Y.else(),Q.error(!1,{discrError:B9.DiscrError.Mapping,tag:A,tagName:$}),Y.endIf()}function K(L){let q=Y.name("valid"),O=Q.subschema({keyword:"oneOf",schemaProp:L},q);return Q.mergeEvaluated(O,f1.Name),q}function D(){var L;let q={},O=M(G),V=!0;for(let x=0;x<J.length;x++){let T=J[x];if((T===null||T===void 0?void 0:T.$ref)&&!(0,kO.schemaHasRulesButRef)(T,z.self.RULES)){let f0=T.$ref;if(T=g7.resolveRef.call(z.self,z.schemaEnv.root,z.baseId,f0),T instanceof g7.SchemaEnv)T=T.schema;if(T===void 0)throw new vO.default(z.opts.uriResolver,z.baseId,f0)}let _0=(L=T===null||T===void 0?void 0:T.properties)===null||L===void 0?void 0:L[$];if(typeof _0!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${$}"`);V=V&&(O||M(T)),S(_0,x)}if(!V)throw Error(`discriminator: "${$}" must be required`);return q;function M({required:x}){return Array.isArray(x)&&x.includes($)}function S(x,T){if(x.const)E(x.const,T);else if(x.enum)for(let _0 of x.enum)E(_0,T);else throw Error(`discriminator: "properties/${$}" must have "const" or "enum"`)}function E(x,T){if(typeof x!="string"||x in q)throw Error(`discriminator: "${$}" values must be unique strings`);q[x]=T}}}};y7.default=_O});var h7=Z((UI,yO)=>{yO.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 F9=Z((M0,L9)=>{Object.defineProperty(M0,"__esModule",{value:!0});M0.MissingRefError=M0.ValidationError=M0.CodeGen=M0.Name=M0.nil=M0.stringify=M0.str=M0._=M0.KeywordCxt=M0.Ajv=void 0;var uO=cJ(),hO=C7(),fO=u7(),f7=h7(),lO=["/properties"],J6="http://json-schema.org/draft-07/schema";class y4 extends uO.default{_addVocabularies(){if(super._addVocabularies(),hO.default.forEach((Q)=>this.addVocabulary(Q)),this.opts.discriminator)this.addKeyword(fO.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let Q=this.opts.$data?this.$dataMetaSchema(f7,lO):f7;this.addMetaSchema(Q,J6,!1),this.refs["http://json-schema.org/schema"]=J6}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(J6)?J6:void 0)}}M0.Ajv=y4;L9.exports=M0=y4;L9.exports.Ajv=y4;Object.defineProperty(M0,"__esModule",{value:!0});M0.default=y4;var mO=P4();Object.defineProperty(M0,"KeywordCxt",{enumerable:!0,get:function(){return mO.KeywordCxt}});var l1=k();Object.defineProperty(M0,"_",{enumerable:!0,get:function(){return l1._}});Object.defineProperty(M0,"str",{enumerable:!0,get:function(){return l1.str}});Object.defineProperty(M0,"stringify",{enumerable:!0,get:function(){return l1.stringify}});Object.defineProperty(M0,"nil",{enumerable:!0,get:function(){return l1.nil}});Object.defineProperty(M0,"Name",{enumerable:!0,get:function(){return l1.Name}});Object.defineProperty(M0,"CodeGen",{enumerable:!0,get:function(){return l1.CodeGen}});var cO=uQ();Object.defineProperty(M0,"ValidationError",{enumerable:!0,get:function(){return cO.default}});var pO=j4();Object.defineProperty(M0,"MissingRefError",{enumerable:!0,get:function(){return pO.default}})});var t7=Z((d7)=>{Object.defineProperty(d7,"__esModule",{value:!0});d7.formatNames=d7.fastFormats=d7.fullFormats=void 0;function u0(Q,Y){return{validate:Q,compare:Y}}d7.fullFormats={date:u0(p7,V9),time:u0(O9(!0),N9),"date-time":u0(l7(!0),r7),"iso-time":u0(O9(),i7),"iso-date-time":u0(l7(),n7),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:sO,"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:zM,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:eO,int32:{type:"number",validate:XM},int64:{type:"number",validate:WM},float:{type:"number",validate:c7},double:{type:"number",validate:c7},password:!0,binary:!0};d7.fastFormats={...d7.fullFormats,date:u0(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,V9),time:u0(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,N9),"date-time":u0(/^\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,r7),"iso-time":u0(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,i7),"iso-date-time":u0(/^\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,n7),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};d7.formatNames=Object.keys(d7.fullFormats);function nO(Q){return Q%4===0&&(Q%100!==0||Q%400===0)}var dO=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,oO=[0,31,28,31,30,31,30,31,31,30,31,30,31];function p7(Q){let Y=dO.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&&nO(X)?29:oO[W])}function V9(Q,Y){if(!(Q&&Y))return;if(Q>Y)return 1;if(Q<Y)return-1;return 0}var q9=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function O9(Q){return function(X){let W=q9.exec(X);if(!W)return!1;let G=+W[1],z=+W[2],J=+W[3],$=W[4],H=W[5]==="-"?-1:1,A=+(W[6]||0),U=+(W[7]||0);if(A>23||U>59||Q&&!$)return!1;if(G<=23&&z<=59&&J<60)return!0;let K=z-U*H,D=G-A*H-(K<0?1:0);return(D===23||D===-1)&&(K===59||K===-1)&&J<61}}function N9(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 i7(Q,Y){if(!(Q&&Y))return;let X=q9.exec(Q),W=q9.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 M9=/t|\s/i;function l7(Q){let Y=O9(Q);return function(W){let G=W.split(M9);return G.length===2&&p7(G[0])&&Y(G[1])}}function r7(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 n7(Q,Y){if(!(Q&&Y))return;let[X,W]=Q.split(M9),[G,z]=Y.split(M9),J=V9(X,G);if(J===void 0)return;return J||N9(W,z)}var tO=/\/|:/,aO=/^(?:[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 sO(Q){return tO.test(Q)&&aO.test(Q)}var m7=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function eO(Q){return m7.lastIndex=0,m7.test(Q)}var QM=-2147483648,YM=2147483647;function XM(Q){return Number.isInteger(Q)&&Q<=YM&&Q>=QM}function WM(Q){return Number.isInteger(Q)}function c7(){return!0}var GM=/[^\\]\\Z/;function zM(Q){if(GM.test(Q))return!1;try{return new RegExp(Q),!0}catch(Y){return!1}}});var s7=Z((a7)=>{Object.defineProperty(a7,"__esModule",{value:!0});a7.formatLimitDefinition=void 0;var $M=F9(),x0=k(),U1=x0.operators,$6={formatMaximum:{okStr:"<=",ok:U1.LTE,fail:U1.GT},formatMinimum:{okStr:">=",ok:U1.GTE,fail:U1.LT},formatExclusiveMaximum:{okStr:"<",ok:U1.LT,fail:U1.GTE},formatExclusiveMinimum:{okStr:">",ok:U1.GT,fail:U1.LTE}},HM={message:({keyword:Q,schemaCode:Y})=>x0.str`should be ${$6[Q].okStr} ${Y}`,params:({keyword:Q,schemaCode:Y})=>x0._`{comparison: ${$6[Q].okStr}, limit: ${Y}}`};a7.formatLimitDefinition={keyword:Object.keys($6),type:"string",schemaType:"string",$data:!0,error:HM,code(Q){let{gen:Y,data:X,schemaCode:W,keyword:G,it:z}=Q,{opts:J,self:$}=z;if(!J.validateFormats)return;let H=new $M.KeywordCxt(z,$.RULES.all.format.definition,"format");if(H.$data)A();else U();function A(){let D=Y.scopeValue("formats",{ref:$.formats,code:J.code.formats}),L=Y.const("fmt",x0._`${D}[${H.schemaCode}]`);Q.fail$data((0,x0.or)(x0._`typeof ${L} != "object"`,x0._`${L} instanceof RegExp`,x0._`typeof ${L}.compare != "function"`,K(L)))}function U(){let D=H.schema,L=$.formats[D];if(!L||L===!0)return;if(typeof L!="object"||L instanceof RegExp||typeof L.compare!="function")throw Error(`"${G}": format "${D}" does not define "compare" function`);let q=Y.scopeValue("formats",{key:D,ref:L,code:J.code.formats?x0._`${J.code.formats}${(0,x0.getProperty)(D)}`:void 0});Q.fail$data(K(q))}function K(D){return x0._`${D}.compare(${X}, ${W}) ${$6[G].fail} 0`}},dependencies:["format"]};var AM=(Q)=>{return Q.addKeyword(a7.formatLimitDefinition),Q};a7.default=AM});var X5=Z((u4,Y5)=>{Object.defineProperty(u4,"__esModule",{value:!0});var m1=t7(),KM=s7(),b9=k(),e7=new b9.Name("fullFormats"),DM=new b9.Name("fastFormats"),P9=(Q,Y={keywords:!0})=>{if(Array.isArray(Y))return Q5(Q,Y,m1.fullFormats,e7),Q;let[X,W]=Y.mode==="fast"?[m1.fastFormats,DM]:[m1.fullFormats,e7],G=Y.formats||m1.formatNames;if(Q5(Q,G,X,W),Y.keywords)(0,KM.default)(Q);return Q};P9.get=(Q,Y="full")=>{let W=(Y==="fast"?m1.fastFormats:m1.fullFormats)[Q];if(!W)throw Error(`Unknown format "${Q}"`);return W};function Q5(Q,Y,X,W){var G,z;(G=(z=Q.opts.code).formats)!==null&&G!==void 0||(z.formats=b9._`require("ajv-formats/dist/formats").${W}`);for(let J of Y)Q.addFormat(J,X[J])}Y5.exports=u4=P9;Object.defineProperty(u4,"__esModule",{value:!0});u4.default=P9});import{AsyncLocalStorage as h5}from"node:async_hooks";class D1 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 y5(Q){if(Q instanceof D1)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 u5(Q){let Y=y5(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 b1(Q){let Y=u5(Q);return[`Sequenzy MCP error: ${Y.title}`,`Description: ${Y.description}`,`How to fix: ${Y.howToFix}`,`Docs: ${Y.docsUrl}`,`Details: ${Y.details}`].join(`
|
|
9
|
+
`)}var f5="https://api.sequenzy.com",p1=new h5,g9=null;function B1(){let Q=p1.getStore();if(Q)return Q.selectedCompanyId??null;return g9}function F6(Q){let Y=p1.getStore();if(Y){Y.selectedCompanyId=Q;return}g9=Q}function y9(Q,Y){return p1.run(Q,Y)}function l5(){return p1.getStore()?.apiUrl??process.env.SEQUENZY_API_URL??f5}function u9(){return p1.getStore()?.apiKey??process.env.SEQUENZY_API_KEY}function dM(){if(u9())return;console.error(b1(new D1("SEQUENZY_API_KEY environment variable is required",401,void 0,"MCP_AUTH_REQUIRED"))),process.exit(1)}function V0(Q,Y){let X=Q[Y];return typeof X==="string"&&X.trim()!==""?X.trim():void 0}function m5(Q){if(Q===void 0)return;if(typeof Q==="string")return Q.trim()||void 0;return JSON.stringify(Q)}function c5(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=V0(Y,"code")??(X?V0(X,"code"):void 0),G=(typeof Y.error==="string"?Y.error:void 0)??(X?V0(X,"message"):void 0)??V0(Y,"message")??V0(Y,"error")??Q,z=V0(Y,"howToFix")??V0(Y,"resolution"),J={...V0(Y,"title")?{title:V0(Y,"title")}:{},...V0(Y,"description")?{description:V0(Y,"description")}:{},...z?{howToFix:z}:{},...V0(Y,"docsUrl")?{docsUrl:V0(Y,"docsUrl")}:{}},$=m5(Y.details);if(Object.keys(J).length>0||$)return{message:G,...W?{code:W}:{},...$?{details:$}:{},...Object.keys(J).length>0?{context:J}:{}};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 N(Q,Y,X,W){let G=u9();if(!G)throw new D1("SEQUENZY_API_KEY environment variable is required",401,void 0,"MCP_AUTH_REQUIRED");let z={"Content-Type":"application/json",Authorization:`Bearer ${G}`},J=W??B1();if(J)z["x-company-id"]=J;let $;try{$=await fetch(`${l5()}${Y}`,{method:Q,headers:z,body:X?JSON.stringify(X):void 0})}catch(H){throw new D1(H instanceof Error?H.message:"Failed to reach Sequenzy API",0,void 0,"NETWORK_ERROR")}if(!$.ok){let H=await $.text(),A=c5(H);throw new D1(A.message,$.status,A.details??H,A.code,A.context)}return $.json()}var tM=Object.freeze({status:"aborted"});function F(Q,Y,X){function W($,H){var A;Object.defineProperty($,"_zod",{value:$._zod??{},enumerable:!1}),(A=$._zod).traits??(A.traits=new Set),$._zod.traits.add(Q),Y($,H);for(let U in J.prototype)if(!(U in $))Object.defineProperty($,U,{value:J.prototype[U].bind($)});$._zod.constr=J,$._zod.def=H}let G=X?.Parent??Object;class z extends G{}Object.defineProperty(z,"name",{value:Q});function J($){var H;let A=X?.Parent?new z:this;W(A,$),(H=A._zod).deferred??(H.deferred=[]);for(let U of A._zod.deferred)U();return A}return Object.defineProperty(J,"init",{value:W}),Object.defineProperty(J,Symbol.hasInstance,{value:($)=>{if(X?.Parent&&$ instanceof X.Parent)return!0;return $?._zod?.traits?.has(Q)}}),Object.defineProperty(J,"name",{value:Q}),J}var aM=Symbol("zod_brand");class l0 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class i1 extends Error{constructor(Q){super(`Encountered unidirectional transform during encode: ${Q}`);this.name="ZodEncodeError"}}var m4={};function w0(Q){if(Q)Object.assign(m4,Q);return m4}var h={};_9(h,{unwrapMessage:()=>r1,uint8ArrayToHex:()=>LH,uint8ArrayToBase64url:()=>DH,uint8ArrayToBase64:()=>i9,stringifyPrimitive:()=>r4,shallowClone:()=>f9,safeExtend:()=>JH,required:()=>AH,randomString:()=>e5,propertyKeyTypes:()=>N6,promiseAllObject:()=>s5,primitiveTypes:()=>l9,prefixIssues:()=>c0,pick:()=>WH,partial:()=>HH,optionalKeys:()=>Z6,omit:()=>GH,objectClone:()=>o5,numKeys:()=>QH,nullish:()=>n1,normalizeParams:()=>I,mergeDefs:()=>s0,merge:()=>$H,jsonStringifyReplacer:()=>P1,joinValues:()=>c4,issue:()=>I1,isPlainObject:()=>e0,isObject:()=>L1,hexToUint8Array:()=>BH,getSizableOrigin:()=>c9,getParsedType:()=>YH,getLengthableOrigin:()=>o1,getEnumValues:()=>O6,getElementAtPath:()=>a5,floatSafeRemainder:()=>M6,finalizeIssue:()=>T0,extend:()=>zH,escapeRegex:()=>m0,esc:()=>p4,defineLazy:()=>m,createTransparentProxy:()=>XH,cloneDef:()=>t5,clone:()=>E0,cleanRegex:()=>d1,cleanEnum:()=>UH,captureStackTrace:()=>i4,cached:()=>j1,base64urlToUint8Array:()=>KH,base64ToUint8Array:()=>p9,assignProp:()=>a0,assertNotEqual:()=>i5,assertNever:()=>n5,assertIs:()=>r5,assertEqual:()=>p5,assert:()=>d5,allowsEval:()=>V6,aborted:()=>Q1,NUMBER_FORMAT_RANGES:()=>w6,Class:()=>r9,BIGINT_FORMAT_RANGES:()=>m9});function p5(Q){return Q}function i5(Q){return Q}function r5(Q){}function n5(Q){throw Error()}function d5(Q){}function O6(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 c4(Q,Y="|"){return Q.map((X)=>r4(X)).join(Y)}function P1(Q,Y){if(typeof Y==="bigint")return Y.toString();return Y}function j1(Q){return{get value(){{let X=Q();return Object.defineProperty(this,"value",{value:X}),X}throw Error("cached value already set")}}}function n1(Q){return Q===null||Q===void 0}function d1(Q){let Y=Q.startsWith("^")?1:0,X=Q.endsWith("$")?Q.length-1:Q.length;return Q.slice(Y,X)}function M6(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 z=X>G?X:G,J=Number.parseInt(Q.toFixed(z).replace(".","")),$=Number.parseInt(Y.toFixed(z).replace(".",""));return J%$/10**z}var h9=Symbol("evaluating");function m(Q,Y,X){let W=void 0;Object.defineProperty(Q,Y,{get(){if(W===h9)return;if(W===void 0)W=h9,W=X();return W},set(G){Object.defineProperty(Q,Y,{value:G})},configurable:!0})}function o5(Q){return Object.create(Object.getPrototypeOf(Q),Object.getOwnPropertyDescriptors(Q))}function a0(Q,Y,X){Object.defineProperty(Q,Y,{value:X,writable:!0,enumerable:!0,configurable:!0})}function s0(...Q){let Y={};for(let X of Q){let W=Object.getOwnPropertyDescriptors(X);Object.assign(Y,W)}return Object.defineProperties({},Y)}function t5(Q){return s0(Q._zod.def)}function a5(Q,Y){if(!Y)return Q;return Y.reduce((X,W)=>X?.[W],Q)}function s5(Q){let Y=Object.keys(Q),X=Y.map((W)=>Q[W]);return Promise.all(X).then((W)=>{let G={};for(let z=0;z<Y.length;z++)G[Y[z]]=W[z];return G})}function e5(Q=10){let X="";for(let W=0;W<Q;W++)X+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return X}function p4(Q){return JSON.stringify(Q)}var i4="captureStackTrace"in Error?Error.captureStackTrace:(...Q)=>{};function L1(Q){return typeof Q==="object"&&Q!==null&&!Array.isArray(Q)}var V6=j1(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(Q){return!1}});function e0(Q){if(L1(Q)===!1)return!1;let Y=Q.constructor;if(Y===void 0)return!0;let X=Y.prototype;if(L1(X)===!1)return!1;if(Object.prototype.hasOwnProperty.call(X,"isPrototypeOf")===!1)return!1;return!0}function f9(Q){if(e0(Q))return{...Q};if(Array.isArray(Q))return[...Q];return Q}function QH(Q){let Y=0;for(let X in Q)if(Object.prototype.hasOwnProperty.call(Q,X))Y++;return Y}var YH=(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}`)}},N6=new Set(["string","number","symbol"]),l9=new Set(["string","number","bigint","boolean","symbol","undefined"]);function m0(Q){return Q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function E0(Q,Y,X){let W=new Q._zod.constr(Y??Q._zod.def);if(!Y||X?.parent)W._zod.parent=Q;return W}function I(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 XH(Q){let Y;return new Proxy({},{get(X,W,G){return Y??(Y=Q()),Reflect.get(Y,W,G)},set(X,W,G,z){return Y??(Y=Q()),Reflect.set(Y,W,G,z)},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 r4(Q){if(typeof Q==="bigint")return Q.toString()+"n";if(typeof Q==="string")return`"${Q}"`;return`${Q}`}function Z6(Q){return Object.keys(Q).filter((Y)=>{return Q[Y]._zod.optin==="optional"&&Q[Y]._zod.optout==="optional"})}var w6={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]},m9={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function WH(Q,Y){let X=Q._zod.def,W=s0(Q._zod.def,{get shape(){let G={};for(let z in Y){if(!(z in X.shape))throw Error(`Unrecognized key: "${z}"`);if(!Y[z])continue;G[z]=X.shape[z]}return a0(this,"shape",G),G},checks:[]});return E0(Q,W)}function GH(Q,Y){let X=Q._zod.def,W=s0(Q._zod.def,{get shape(){let G={...Q._zod.def.shape};for(let z in Y){if(!(z in X.shape))throw Error(`Unrecognized key: "${z}"`);if(!Y[z])continue;delete G[z]}return a0(this,"shape",G),G},checks:[]});return E0(Q,W)}function zH(Q,Y){if(!e0(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=s0(Q._zod.def,{get shape(){let z={...Q._zod.def.shape,...Y};return a0(this,"shape",z),z},checks:[]});return E0(Q,G)}function JH(Q,Y){if(!e0(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 a0(this,"shape",W),W},checks:Q._zod.def.checks};return E0(Q,X)}function $H(Q,Y){let X=s0(Q._zod.def,{get shape(){let W={...Q._zod.def.shape,...Y._zod.def.shape};return a0(this,"shape",W),W},get catchall(){return Y._zod.def.catchall},checks:[]});return E0(Q,X)}function HH(Q,Y,X){let W=s0(Y._zod.def,{get shape(){let G=Y._zod.def.shape,z={...G};if(X)for(let J in X){if(!(J in G))throw Error(`Unrecognized key: "${J}"`);if(!X[J])continue;z[J]=Q?new Q({type:"optional",innerType:G[J]}):G[J]}else for(let J in G)z[J]=Q?new Q({type:"optional",innerType:G[J]}):G[J];return a0(this,"shape",z),z},checks:[]});return E0(Y,W)}function AH(Q,Y,X){let W=s0(Y._zod.def,{get shape(){let G=Y._zod.def.shape,z={...G};if(X)for(let J in X){if(!(J in z))throw Error(`Unrecognized key: "${J}"`);if(!X[J])continue;z[J]=new Q({type:"nonoptional",innerType:G[J]})}else for(let J in G)z[J]=new Q({type:"nonoptional",innerType:G[J]});return a0(this,"shape",z),z},checks:[]});return E0(Y,W)}function Q1(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 c0(Q,Y){return Y.map((X)=>{var W;return(W=X).path??(W.path=[]),X.path.unshift(Q),X})}function r1(Q){return typeof Q==="string"?Q:Q?.message}function T0(Q,Y,X){let W={...Q,path:Q.path??[]};if(!Q.message){let G=r1(Q.inst?._zod.def?.error?.(Q))??r1(Y?.error?.(Q))??r1(X.customError?.(Q))??r1(X.localeError?.(Q))??"Invalid input";W.message=G}if(delete W.inst,delete W.continue,!Y?.reportInput)delete W.input;return W}function c9(Q){if(Q instanceof Set)return"set";if(Q instanceof Map)return"map";if(Q instanceof File)return"file";return"unknown"}function o1(Q){if(Array.isArray(Q))return"array";if(typeof Q==="string")return"string";return"unknown"}function I1(...Q){let[Y,X,W]=Q;if(typeof Y==="string")return{message:Y,code:"custom",input:X,inst:W};return{...Y}}function UH(Q){return Object.entries(Q).filter(([Y,X])=>{return Number.isNaN(Number.parseInt(Y,10))}).map((Y)=>Y[1])}function p9(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 i9(Q){let Y="";for(let X=0;X<Q.length;X++)Y+=String.fromCharCode(Q[X]);return btoa(Y)}function KH(Q){let Y=Q.replace(/-/g,"+").replace(/_/g,"/"),X="=".repeat((4-Y.length%4)%4);return p9(Y+X)}function DH(Q){return i9(Q).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function BH(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 LH(Q){return Array.from(Q).map((Y)=>Y.toString(16).padStart(2,"0")).join("")}class r9{constructor(...Q){}}var n9=(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,P1,2),Object.defineProperty(Q,"toString",{value:()=>Q.message,enumerable:!1})},n4=F("$ZodError",n9),b6=F("$ZodError",n9,{Parent:Error});function d9(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 o9(Q,Y=(X)=>X.message){let X={_errors:[]},W=(G)=>{for(let z of G.issues)if(z.code==="invalid_union"&&z.errors.length)z.errors.map((J)=>W({issues:J}));else if(z.code==="invalid_key")W({issues:z.issues});else if(z.code==="invalid_element")W({issues:z.issues});else if(z.path.length===0)X._errors.push(Y(z));else{let J=X,$=0;while($<z.path.length){let H=z.path[$];if($!==z.path.length-1)J[H]=J[H]||{_errors:[]};else J[H]=J[H]||{_errors:[]},J[H]._errors.push(Y(z));J=J[H],$++}}};return W(Q),X}var d4=(Q)=>(Y,X,W,G)=>{let z=W?Object.assign(W,{async:!1}):{async:!1},J=Y._zod.run({value:X,issues:[]},z);if(J instanceof Promise)throw new l0;if(J.issues.length){let $=new(G?.Err??Q)(J.issues.map((H)=>T0(H,z,w0())));throw i4($,G?.callee),$}return J.value};var o4=(Q)=>async(Y,X,W,G)=>{let z=W?Object.assign(W,{async:!0}):{async:!0},J=Y._zod.run({value:X,issues:[]},z);if(J instanceof Promise)J=await J;if(J.issues.length){let $=new(G?.Err??Q)(J.issues.map((H)=>T0(H,z,w0())));throw i4($,G?.callee),$}return J.value};var t1=(Q)=>(Y,X,W)=>{let G=W?{...W,async:!1}:{async:!1},z=Y._zod.run({value:X,issues:[]},G);if(z instanceof Promise)throw new l0;return z.issues.length?{success:!1,error:new(Q??n4)(z.issues.map((J)=>T0(J,G,w0())))}:{success:!0,data:z.value}},a1=t1(b6),s1=(Q)=>async(Y,X,W)=>{let G=W?Object.assign(W,{async:!0}):{async:!0},z=Y._zod.run({value:X,issues:[]},G);if(z instanceof Promise)z=await z;return z.issues.length?{success:!1,error:new Q(z.issues.map((J)=>T0(J,G,w0())))}:{success:!0,data:z.value}},t4=s1(b6),t9=(Q)=>(Y,X,W)=>{let G=W?Object.assign(W,{direction:"backward"}):{direction:"backward"};return d4(Q)(Y,X,G)};var a9=(Q)=>(Y,X,W)=>{return d4(Q)(Y,X,W)};var s9=(Q)=>async(Y,X,W)=>{let G=W?Object.assign(W,{direction:"backward"}):{direction:"backward"};return o4(Q)(Y,X,G)};var e9=(Q)=>async(Y,X,W)=>{return o4(Q)(Y,X,W)};var Q8=(Q)=>(Y,X,W)=>{let G=W?Object.assign(W,{direction:"backward"}):{direction:"backward"};return t1(Q)(Y,X,G)};var Y8=(Q)=>(Y,X,W)=>{return t1(Q)(Y,X,W)};var X8=(Q)=>async(Y,X,W)=>{let G=W?Object.assign(W,{direction:"backward"}):{direction:"backward"};return s1(Q)(Y,X,G)};var W8=(Q)=>async(Y,X,W)=>{return s1(Q)(Y,X,W)};var G8=/^[cC][^\s-]{8,}$/,z8=/^[0-9a-z]+$/,J8=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,$8=/^[0-9a-vA-V]{20}$/,H8=/^[A-Za-z0-9]{27}$/,A8=/^[a-zA-Z0-9_-]{21}$/,U8=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var K8=/^([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})$/,P6=(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 D8=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function B8(){return new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}var L8=/^(?:(?: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])$/,F8=/^(([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}|:))$/,q8=/^((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])$/,O8=/^(([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])$/,M8=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,j6=/^[A-Za-z0-9_-]*$/,V8=/^(?=.{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 N8=/^\+(?:[0-9]){6,14}[0-9]$/,Z8="(?:(?:\\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])))",w8=new RegExp(`^${Z8}$`);function b8(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 P8(Q){return new RegExp(`^${b8(Q)}$`)}function j8(Q){let Y=b8({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(`^${Z8}T(?:${W})$`)}var I8=(Q)=>{let Y=Q?`[\\s\\S]{${Q?.minimum??0},${Q?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${Y}$`)};var E8=/^-?\d+$/,T8=/^-?\d+(?:\.\d+)?/,S8=/^(?:true|false)$/i,R8=/^null$/i;var C8=/^[^A-Z]*$/,v8=/^[^a-z]*$/;var W0=F("$ZodCheck",(Q,Y)=>{var X;Q._zod??(Q._zod={}),Q._zod.def=Y,(X=Q._zod).onattach??(X.onattach=[])}),k8={number:"number",bigint:"bigint",object:"date"},I6=F("$ZodCheckLessThan",(Q,Y)=>{W0.init(Q,Y);let X=k8[typeof Y.value];Q._zod.onattach.push((W)=>{let G=W._zod.bag,z=(Y.inclusive?G.maximum:G.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(Y.value<z)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})}}),E6=F("$ZodCheckGreaterThan",(Q,Y)=>{W0.init(Q,Y);let X=k8[typeof Y.value];Q._zod.onattach.push((W)=>{let G=W._zod.bag,z=(Y.inclusive?G.minimum:G.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(Y.value>z)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=F("$ZodCheckMultipleOf",(Q,Y)=>{W0.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):M6(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})}}),_8=F("$ZodCheckNumberFormat",(Q,Y)=>{W0.init(Q,Y),Y.format=Y.format||"float64";let X=Y.format?.includes("int"),W=X?"int":"number",[G,z]=w6[Y.format];Q._zod.onattach.push((J)=>{let $=J._zod.bag;if($.format=Y.format,$.minimum=G,$.maximum=z,X)$.pattern=E8}),Q._zod.check=(J)=>{let $=J.value;if(X){if(!Number.isInteger($)){J.issues.push({expected:W,format:Y.format,code:"invalid_type",continue:!1,input:$,inst:Q});return}if(!Number.isSafeInteger($)){if($>0)J.issues.push({input:$,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 J.issues.push({input:$,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($<G)J.issues.push({origin:"number",input:$,code:"too_small",minimum:G,inclusive:!0,inst:Q,continue:!Y.abort});if($>z)J.issues.push({origin:"number",input:$,code:"too_big",maximum:z,inst:Q})}});var g8=F("$ZodCheckMaxLength",(Q,Y)=>{var X;W0.init(Q,Y),(X=Q._zod.def).when??(X.when=(W)=>{let G=W.value;return!n1(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 J=o1(G);W.issues.push({origin:J,code:"too_big",maximum:Y.maximum,inclusive:!0,input:G,inst:Q,continue:!Y.abort})}}),y8=F("$ZodCheckMinLength",(Q,Y)=>{var X;W0.init(Q,Y),(X=Q._zod.def).when??(X.when=(W)=>{let G=W.value;return!n1(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 J=o1(G);W.issues.push({origin:J,code:"too_small",minimum:Y.minimum,inclusive:!0,input:G,inst:Q,continue:!Y.abort})}}),u8=F("$ZodCheckLengthEquals",(Q,Y)=>{var X;W0.init(Q,Y),(X=Q._zod.def).when??(X.when=(W)=>{let G=W.value;return!n1(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,z=G.length;if(z===Y.length)return;let J=o1(G),$=z>Y.length;W.issues.push({origin: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})}}),e1=F("$ZodCheckStringFormat",(Q,Y)=>{var X,W;if(W0.init(Q,Y),Q._zod.onattach.push((G)=>{let z=G._zod.bag;if(z.format=Y.format,Y.pattern)z.patterns??(z.patterns=new Set),z.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=()=>{})}),h8=F("$ZodCheckRegex",(Q,Y)=>{e1.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})}}),f8=F("$ZodCheckLowerCase",(Q,Y)=>{Y.pattern??(Y.pattern=C8),e1.init(Q,Y)}),l8=F("$ZodCheckUpperCase",(Q,Y)=>{Y.pattern??(Y.pattern=v8),e1.init(Q,Y)}),m8=F("$ZodCheckIncludes",(Q,Y)=>{W0.init(Q,Y);let X=m0(Y.includes),W=new RegExp(typeof Y.position==="number"?`^.{${Y.position}}${X}`:X);Y.pattern=W,Q._zod.onattach.push((G)=>{let z=G._zod.bag;z.patterns??(z.patterns=new Set),z.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})}}),c8=F("$ZodCheckStartsWith",(Q,Y)=>{W0.init(Q,Y);let X=new RegExp(`^${m0(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})}}),p8=F("$ZodCheckEndsWith",(Q,Y)=>{W0.init(Q,Y);let X=new RegExp(`.*${m0(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 i8=F("$ZodCheckOverwrite",(Q,Y)=>{W0.init(Q,Y),Q._zod.check=(X)=>{X.value=Y.tx(X.value)}});class T6{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((z)=>z),W=Math.min(...X.map((z)=>z.length-z.trimStart().length)),G=X.map((z)=>z.slice(W)).map((z)=>" ".repeat(this.indent*2)+z);for(let z of G)this.content.push(z)}compile(){let Q=Function,Y=this?.args,W=[...(this?.content??[""]).map((G)=>` ${G}`)];return new Q(...Y,W.join(`
|
|
11
|
-
`))}}var
|
|
11
|
+
`))}}var n8={major:4,minor:1,patch:12};var i=F("$ZodType",(Q,Y)=>{var X;Q??(Q={}),Q._zod.def=Y,Q._zod.bag=Q._zod.bag||{},Q._zod.version=n8;let W=[...Q._zod.def.checks??[]];if(Q._zod.traits.has("$ZodCheck"))W.unshift(Q);for(let G of W)for(let z of G._zod.onattach)z(Q);if(W.length===0)(X=Q._zod).deferred??(X.deferred=[]),Q._zod.deferred?.push(()=>{Q._zod.run=Q._zod.parse});else{let G=(J,$,H)=>{let A=Q1(J),U;for(let K of $){if(K._zod.def.when){if(!K._zod.def.when(J))continue}else if(A)continue;let D=J.issues.length,L=K._zod.check(J);if(L instanceof Promise&&H?.async===!1)throw new l0;if(U||L instanceof Promise)U=(U??Promise.resolve()).then(async()=>{if(await L,J.issues.length===D)return;if(!A)A=Q1(J,D)});else{if(J.issues.length===D)continue;if(!A)A=Q1(J,D)}}if(U)return U.then(()=>{return J});return J},z=(J,$,H)=>{if(Q1(J))return J.aborted=!0,J;let A=G($,W,H);if(A instanceof Promise){if(H.async===!1)throw new l0;return A.then((U)=>Q._zod.parse(U,H))}return Q._zod.parse(A,H)};Q._zod.run=(J,$)=>{if($.skipChecks)return Q._zod.parse(J,$);if($.direction==="backward"){let A=Q._zod.parse({value:J.value,issues:[]},{...$,skipChecks:!0});if(A instanceof Promise)return A.then((U)=>{return z(U,J,$)});return z(A,J,$)}let H=Q._zod.parse(J,$);if(H instanceof Promise){if($.async===!1)throw new l0;return H.then((A)=>G(A,W,$))}return G(H,W,$)}}Q["~standard"]={validate:(G)=>{try{let z=a1(Q,G);return z.success?{value:z.data}:{issues:z.error?.issues}}catch(z){return t4(Q,G).then((J)=>J.success?{value:J.data}:{issues:J.error?.issues})}},vendor:"zod",version:1}}),QQ=F("$ZodString",(Q,Y)=>{i.init(Q,Y),Q._zod.pattern=[...Q?._zod.bag?.patterns??[]].pop()??I8(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}}),r=F("$ZodStringFormat",(Q,Y)=>{e1.init(Q,Y),QQ.init(Q,Y)}),XX=F("$ZodGUID",(Q,Y)=>{Y.pattern??(Y.pattern=K8),r.init(Q,Y)}),WX=F("$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=P6(W))}else Y.pattern??(Y.pattern=P6());r.init(Q,Y)}),GX=F("$ZodEmail",(Q,Y)=>{Y.pattern??(Y.pattern=D8),r.init(Q,Y)}),zX=F("$ZodURL",(Q,Y)=>{r.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:V8.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})}}}),JX=F("$ZodEmoji",(Q,Y)=>{Y.pattern??(Y.pattern=B8()),r.init(Q,Y)}),$X=F("$ZodNanoID",(Q,Y)=>{Y.pattern??(Y.pattern=A8),r.init(Q,Y)}),HX=F("$ZodCUID",(Q,Y)=>{Y.pattern??(Y.pattern=G8),r.init(Q,Y)}),AX=F("$ZodCUID2",(Q,Y)=>{Y.pattern??(Y.pattern=z8),r.init(Q,Y)}),UX=F("$ZodULID",(Q,Y)=>{Y.pattern??(Y.pattern=J8),r.init(Q,Y)}),KX=F("$ZodXID",(Q,Y)=>{Y.pattern??(Y.pattern=$8),r.init(Q,Y)}),DX=F("$ZodKSUID",(Q,Y)=>{Y.pattern??(Y.pattern=H8),r.init(Q,Y)}),BX=F("$ZodISODateTime",(Q,Y)=>{Y.pattern??(Y.pattern=j8(Y)),r.init(Q,Y)}),LX=F("$ZodISODate",(Q,Y)=>{Y.pattern??(Y.pattern=w8),r.init(Q,Y)}),FX=F("$ZodISOTime",(Q,Y)=>{Y.pattern??(Y.pattern=P8(Y)),r.init(Q,Y)}),qX=F("$ZodISODuration",(Q,Y)=>{Y.pattern??(Y.pattern=U8),r.init(Q,Y)}),OX=F("$ZodIPv4",(Q,Y)=>{Y.pattern??(Y.pattern=L8),r.init(Q,Y),Q._zod.onattach.push((X)=>{let W=X._zod.bag;W.format="ipv4"})}),MX=F("$ZodIPv6",(Q,Y)=>{Y.pattern??(Y.pattern=F8),r.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})}}}),VX=F("$ZodCIDRv4",(Q,Y)=>{Y.pattern??(Y.pattern=q8),r.init(Q,Y)}),NX=F("$ZodCIDRv6",(Q,Y)=>{Y.pattern??(Y.pattern=O8),r.init(Q,Y),Q._zod.check=(X)=>{let W=X.value.split("/");try{if(W.length!==2)throw Error();let[G,z]=W;if(!z)throw Error();let J=Number(z);if(`${J}`!==z)throw Error();if(J<0||J>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 ZX(Q){if(Q==="")return!0;if(Q.length%4!==0)return!1;try{return atob(Q),!0}catch{return!1}}var wX=F("$ZodBase64",(Q,Y)=>{Y.pattern??(Y.pattern=M8),r.init(Q,Y),Q._zod.onattach.push((X)=>{X._zod.bag.contentEncoding="base64"}),Q._zod.check=(X)=>{if(ZX(X.value))return;X.issues.push({code:"invalid_format",format:"base64",input:X.value,inst:Q,continue:!Y.abort})}});function MH(Q){if(!j6.test(Q))return!1;let Y=Q.replace(/[-_]/g,(W)=>W==="-"?"+":"/"),X=Y.padEnd(Math.ceil(Y.length/4)*4,"=");return ZX(X)}var bX=F("$ZodBase64URL",(Q,Y)=>{Y.pattern??(Y.pattern=j6),r.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})}}),PX=F("$ZodE164",(Q,Y)=>{Y.pattern??(Y.pattern=N8),r.init(Q,Y)});function VH(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 jX=F("$ZodJWT",(Q,Y)=>{r.init(Q,Y),Q._zod.check=(X)=>{if(VH(X.value,Y.alg))return;X.issues.push({code:"invalid_format",format:"jwt",input:X.value,inst:Q,continue:!Y.abort})}});var R6=F("$ZodNumber",(Q,Y)=>{i.init(Q,Y),Q._zod.pattern=Q._zod.bag.pattern??T8,Q._zod.parse=(X,W)=>{if(Y.coerce)try{X.value=Number(X.value)}catch(J){}let G=X.value;if(typeof G==="number"&&!Number.isNaN(G)&&Number.isFinite(G))return X;let z=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,...z?{received:z}:{}}),X}}),IX=F("$ZodNumber",(Q,Y)=>{_8.init(Q,Y),R6.init(Q,Y)}),EX=F("$ZodBoolean",(Q,Y)=>{i.init(Q,Y),Q._zod.pattern=S8,Q._zod.parse=(X,W)=>{if(Y.coerce)try{X.value=Boolean(X.value)}catch(z){}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 TX=F("$ZodNull",(Q,Y)=>{i.init(Q,Y),Q._zod.pattern=R8,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 SX=F("$ZodUnknown",(Q,Y)=>{i.init(Q,Y),Q._zod.parse=(X)=>X}),RX=F("$ZodNever",(Q,Y)=>{i.init(Q,Y),Q._zod.parse=(X,W)=>{return X.issues.push({expected:"never",code:"invalid_type",input:X.value,inst:Q}),X}});function d8(Q,Y,X){if(Q.issues.length)Y.issues.push(...c0(X,Q.issues));Y.value[X]=Q.value}var CX=F("$ZodArray",(Q,Y)=>{i.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 z=[];for(let J=0;J<G.length;J++){let $=G[J],H=Y.element._zod.run({value:$,issues:[]},W);if(H instanceof Promise)z.push(H.then((A)=>d8(A,X,J)));else d8(H,X,J)}if(z.length)return Promise.all(z).then(()=>X);return X}});function e4(Q,Y,X,W){if(Q.issues.length)Y.issues.push(...c0(X,Q.issues));if(Q.value===void 0){if(X in W)Y.value[X]=void 0}else Y.value[X]=Q.value}function vX(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=Z6(Q.shape);return{...Q,keys:Y,keySet:new Set(Y),numKeys:Y.length,optionalKeys:new Set(X)}}function kX(Q,Y,X,W,G,z){let J=[],$=G.keySet,H=G.catchall._zod,A=H.def.type;for(let U of Object.keys(Y)){if($.has(U))continue;if(A==="never"){J.push(U);continue}let K=H.run({value:Y[U],issues:[]},W);if(K instanceof Promise)Q.push(K.then((D)=>e4(D,X,U,Y)));else e4(K,X,U,Y)}if(J.length)X.issues.push({code:"unrecognized_keys",keys:J,input:Y,inst:z});if(!Q.length)return X;return Promise.all(Q).then(()=>{return X})}var NH=F("$ZodObject",(Q,Y)=>{if(i.init(Q,Y),!Object.getOwnPropertyDescriptor(Y,"shape")?.get){let $=Y.shape;Object.defineProperty(Y,"shape",{get:()=>{let H={...$};return Object.defineProperty(Y,"shape",{value:H}),H}})}let W=j1(()=>vX(Y));m(Q._zod,"propValues",()=>{let $=Y.shape,H={};for(let A in $){let U=$[A]._zod;if(U.values){H[A]??(H[A]=new Set);for(let K of U.values)H[A].add(K)}}return H});let G=L1,z=Y.catchall,J;Q._zod.parse=($,H)=>{J??(J=W.value);let A=$.value;if(!G(A))return $.issues.push({expected:"object",code:"invalid_type",input:A,inst:Q}),$;$.value={};let U=[],K=J.shape;for(let D of J.keys){let q=K[D]._zod.run({value:A[D],issues:[]},H);if(q instanceof Promise)U.push(q.then((O)=>e4(O,$,D,A)));else e4(q,$,D,A)}if(!z)return U.length?Promise.all(U).then(()=>$):$;return kX(U,A,$,H,W.value,Q)}}),xX=F("$ZodObjectJIT",(Q,Y)=>{NH.init(Q,Y);let X=Q._zod.parse,W=j1(()=>vX(Y)),G=(D)=>{let L=new T6(["shape","payload","ctx"]),q=W.value,O=(E)=>{let x=p4(E);return`shape[${x}]._zod.run({ value: input[${x}], issues: [] }, ctx)`};L.write("const input = payload.value;");let V=Object.create(null),M=0;for(let E of q.keys)V[E]=`key_${M++}`;L.write("const newResult = {};");for(let E of q.keys){let x=V[E],T=p4(E);L.write(`const ${x} = ${O(E)};`),L.write(`
|
|
12
12
|
if (${x}.issues.length) {
|
|
13
13
|
payload.issues = payload.issues.concat(${x}.issues.map(iss => ({
|
|
14
14
|
...iss,
|
|
@@ -25,7 +25,7 @@ var w5=Object.create;var{getPrototypeOf:b5,defineProperty:LQ,getOwnPropertyNames
|
|
|
25
25
|
newResult[${T}] = ${x}.value;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
`)}L.write("payload.value = newResult;"),L.write("return payload;");let S=L.compile();return(E,x)=>S(D,E,x)},z,J=L1,$=!m4.jitless,A=$&&VQ.value,U=Y.catchall,K;Q._zod.parse=(D,L)=>{K??(K=W.value);let q=D.value;if(!J(q))return D.issues.push({expected:"object",code:"invalid_type",input:q,inst:Q}),D;if($&&A&&L?.async===!1&&L.jitless!==!0){if(!z)z=G(Y.shape);if(D=z(D,L),!U)return D;return v8([],q,D,L,K,Q)}return X(D,L)}});function dX(Q,Y,X,W){for(let z of Q)if(z.issues.length===0)return Y.value=z.value,Y;let G=Q.filter((z)=>!Q1(z));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((z)=>z.issues.map((J)=>T0(J,W,w0())))}),Y}var CQ=F("$ZodUnion",(Q,Y)=>{i.init(Q,Y),m(Q._zod,"optin",()=>Y.options.some((G)=>G._zod.optin==="optional")?"optional":void 0),m(Q._zod,"optout",()=>Y.options.some((G)=>G._zod.optout==="optional")?"optional":void 0),m(Q._zod,"values",()=>{if(Y.options.every((G)=>G._zod.values))return new Set(Y.options.flatMap((G)=>Array.from(G._zod.values)));return}),m(Q._zod,"pattern",()=>{if(Y.options.every((G)=>G._zod.pattern)){let G=Y.options.map((z)=>z._zod.pattern);return new RegExp(`^(${G.map((z)=>d1(z.source)).join("|")})$`)}return});let X=Y.options.length===1,W=Y.options[0]._zod.run;Q._zod.parse=(G,z)=>{if(X)return W(G,z);let J=!1,$=[];for(let H of Y.options){let A=H._zod.run({value:G.value,issues:[]},z);if(A instanceof Promise)$.push(A),J=!0;else{if(A.issues.length===0)return A;$.push(A)}}if(!J)return dX($,G,Q,z);return Promise.all($).then((H)=>{return dX(H,G,Q,z)})}}),x8=F("$ZodDiscriminatedUnion",(Q,Y)=>{CQ.init(Q,Y);let X=Q._zod.parse;m(Q._zod,"propValues",()=>{let G={};for(let z of Y.options){let J=z._zod.propValues;if(!J||Object.keys(J).length===0)throw Error(`Invalid discriminated union option at index "${Y.options.indexOf(z)}"`);for(let[$,H]of Object.entries(J)){if(!G[$])G[$]=new Set;for(let A of H)G[$].add(A)}}return G});let W=j1(()=>{let G=Y.options,z=new Map;for(let J of G){let $=J._zod.propValues?.[Y.discriminator];if(!$||$.size===0)throw Error(`Invalid discriminated union option at index "${Y.options.indexOf(J)}"`);for(let H of $){if(z.has(H))throw Error(`Duplicate discriminator value "${String(H)}"`);z.set(H,J)}}return z});Q._zod.parse=(G,z)=>{let J=G.value;if(!L1(J))return G.issues.push({code:"invalid_type",expected:"object",input:J,inst:Q}),G;let $=W.value.get(J?.[Y.discriminator]);if($)return $._zod.run(G,z);if(Y.unionFallback)return X(G,z);return G.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:Y.discriminator,input:J,path:[Y.discriminator],inst:Q}),G}}),_8=F("$ZodIntersection",(Q,Y)=>{i.init(Q,Y),Q._zod.parse=(X,W)=>{let G=X.value,z=Y.left._zod.run({value:G,issues:[]},W),J=Y.right._zod.run({value:G,issues:[]},W);if(z instanceof Promise||J instanceof Promise)return Promise.all([z,J]).then(([H,A])=>{return oX(X,H,A)});return oX(X,z,J)}});function SQ(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(e0(Q)&&e0(Y)){let X=Object.keys(Y),W=Object.keys(Q).filter((z)=>X.indexOf(z)!==-1),G={...Q,...Y};for(let z of W){let J=SQ(Q[z],Y[z]);if(!J.valid)return{valid:!1,mergeErrorPath:[z,...J.mergeErrorPath]};G[z]=J.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],z=Y[W],J=SQ(G,z);if(!J.valid)return{valid:!1,mergeErrorPath:[W,...J.mergeErrorPath]};X.push(J.data)}return{valid:!0,data:X}}return{valid:!1,mergeErrorPath:[]}}function oX(Q,Y,X){if(Y.issues.length)Q.issues.push(...Y.issues);if(X.issues.length)Q.issues.push(...X.issues);if(Q1(Q))return Q;let W=SQ(Y.value,X.value);if(!W.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(W.mergeErrorPath)}`);return Q.value=W.data,Q}var g8=F("$ZodRecord",(Q,Y)=>{i.init(Q,Y),Q._zod.parse=(X,W)=>{let G=X.value;if(!e0(G))return X.issues.push({expected:"record",code:"invalid_type",input:G,inst:Q}),X;let z=[];if(Y.keyType._zod.values){let J=Y.keyType._zod.values;X.value={};for(let H of J)if(typeof H==="string"||typeof H==="number"||typeof H==="symbol"){let A=Y.valueType._zod.run({value:G[H],issues:[]},W);if(A instanceof Promise)z.push(A.then((U)=>{if(U.issues.length)X.issues.push(...c0(H,U.issues));X.value[H]=U.value}));else{if(A.issues.length)X.issues.push(...c0(H,A.issues));X.value[H]=A.value}}let $;for(let H in G)if(!J.has(H))$=$??[],$.push(H);if($&&$.length>0)X.issues.push({code:"unrecognized_keys",input:G,inst:Q,keys:$})}else{X.value={};for(let J of Reflect.ownKeys(G)){if(J==="__proto__")continue;let $=Y.keyType._zod.run({value:J,issues:[]},W);if($ instanceof Promise)throw Error("Async schemas not supported in object keys currently");if($.issues.length){X.issues.push({code:"invalid_key",origin:"record",issues:$.issues.map((A)=>T0(A,W,w0())),input:J,path:[J],inst:Q}),X.value[$.value]=$.value;continue}let H=Y.valueType._zod.run({value:G[J],issues:[]},W);if(H instanceof Promise)z.push(H.then((A)=>{if(A.issues.length)X.issues.push(...c0(J,A.issues));X.value[$.value]=A.value}));else{if(H.issues.length)X.issues.push(...c0(J,H.issues));X.value[$.value]=H.value}}}if(z.length)return Promise.all(z).then(()=>X);return X}});var y8=F("$ZodEnum",(Q,Y)=>{i.init(Q,Y);let X=OQ(Y.entries),W=new Set(X);Q._zod.values=W,Q._zod.pattern=new RegExp(`^(${X.filter((G)=>NQ.has(typeof G)).map((G)=>typeof G==="string"?m0(G):G.toString()).join("|")})$`),Q._zod.parse=(G,z)=>{let J=G.value;if(W.has(J))return G;return G.issues.push({code:"invalid_value",values:X,input:J,inst:Q}),G}}),u8=F("$ZodLiteral",(Q,Y)=>{if(i.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"?m0(X):X?m0(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 h8=F("$ZodTransform",(Q,Y)=>{i.init(Q,Y),Q._zod.parse=(X,W)=>{if(W.direction==="backward")throw new i1(Q.constructor.name);let G=Y.transform(X.value,X);if(W.async)return(G instanceof Promise?G:Promise.resolve(G)).then((J)=>{return X.value=J,X});if(G instanceof Promise)throw new l0;return X.value=G,X}});function tX(Q,Y){if(Q.issues.length&&Y===void 0)return{issues:[],value:void 0};return Q}var f8=F("$ZodOptional",(Q,Y)=>{i.init(Q,Y),Q._zod.optin="optional",Q._zod.optout="optional",m(Q._zod,"values",()=>{return Y.innerType._zod.values?new Set([...Y.innerType._zod.values,void 0]):void 0}),m(Q._zod,"pattern",()=>{let X=Y.innerType._zod.pattern;return X?new RegExp(`^(${d1(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((z)=>tX(z,X.value));return tX(G,X.value)}if(X.value===void 0)return X;return Y.innerType._zod.run(X,W)}}),l8=F("$ZodNullable",(Q,Y)=>{i.init(Q,Y),m(Q._zod,"optin",()=>Y.innerType._zod.optin),m(Q._zod,"optout",()=>Y.innerType._zod.optout),m(Q._zod,"pattern",()=>{let X=Y.innerType._zod.pattern;return X?new RegExp(`^(${d1(X.source)}|null)$`):void 0}),m(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)}}),m8=F("$ZodDefault",(Q,Y)=>{i.init(Q,Y),Q._zod.optin="optional",m(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((z)=>aX(z,Y));return aX(G,Y)}});function aX(Q,Y){if(Q.value===void 0)Q.value=Y.defaultValue;return Q}var c8=F("$ZodPrefault",(Q,Y)=>{i.init(Q,Y),Q._zod.optin="optional",m(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)}}),p8=F("$ZodNonOptional",(Q,Y)=>{i.init(Q,Y),m(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((z)=>sX(z,Q));return sX(G,Q)}});function sX(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 i8=F("$ZodCatch",(Q,Y)=>{i.init(Q,Y),m(Q._zod,"optin",()=>Y.innerType._zod.optin),m(Q._zod,"optout",()=>Y.innerType._zod.optout),m(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((z)=>{if(X.value=z.value,z.issues.length)X.value=Y.catchValue({...X,error:{issues:z.issues.map((J)=>T0(J,W,w0()))},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((z)=>T0(z,W,w0()))},input:X.value}),X.issues=[];return X}});var r8=F("$ZodPipe",(Q,Y)=>{i.init(Q,Y),m(Q._zod,"values",()=>Y.in._zod.values),m(Q._zod,"optin",()=>Y.in._zod.optin),m(Q._zod,"optout",()=>Y.out._zod.optout),m(Q._zod,"propValues",()=>Y.in._zod.propValues),Q._zod.parse=(X,W)=>{if(W.direction==="backward"){let z=Y.out._zod.run(X,W);if(z instanceof Promise)return z.then((J)=>s4(J,Y.in,W));return s4(z,Y.in,W)}let G=Y.in._zod.run(X,W);if(G instanceof Promise)return G.then((z)=>s4(z,Y.out,W));return s4(G,Y.out,W)}});function s4(Q,Y,X){if(Q.issues.length)return Q.aborted=!0,Q;return Y._zod.run({value:Q.value,issues:Q.issues},X)}var n8=F("$ZodReadonly",(Q,Y)=>{i.init(Q,Y),m(Q._zod,"propValues",()=>Y.innerType._zod.propValues),m(Q._zod,"values",()=>Y.innerType._zod.values),m(Q._zod,"optin",()=>Y.innerType._zod.optin),m(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(eX);return eX(G)}});function eX(Q){return Q.value=Object.freeze(Q.value),Q}var d8=F("$ZodCustom",(Q,Y)=>{W0.init(Q,Y),i.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((z)=>Q8(z,X,W,Q));Q8(G,X,W,Q);return}});function Q8(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(I1(G))}}var FH=(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},qH=()=>{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 ${FH(W.input)}`;case"invalid_value":if(W.values.length===1)return`Invalid input: expected ${r4(W.values[0])}`;return`Invalid option: expected one of ${c4(W.values,"|")}`;case"too_big":{let G=W.inclusive?"<=":"<",z=Y(W.origin);if(z)return`Too big: expected ${W.origin??"value"} to have ${G}${W.maximum.toString()} ${z.unit??"elements"}`;return`Too big: expected ${W.origin??"value"} to be ${G}${W.maximum.toString()}`}case"too_small":{let G=W.inclusive?">=":">",z=Y(W.origin);if(z)return`Too small: expected ${W.origin} to have ${G}${W.minimum.toString()} ${z.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":""}: ${c4(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 vQ(){return{localeError:qH()}}var nM=Symbol("ZodOutput"),dM=Symbol("ZodInput");class o8{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 OH(){return new o8}var Q4=OH();function t8(Q,Y){return new Q({type:"string",...I(Y)})}function a8(Q,Y){return new Q({type:"string",format:"email",check:"string_format",abort:!1,...I(Y)})}function kQ(Q,Y){return new Q({type:"string",format:"guid",check:"string_format",abort:!1,...I(Y)})}function s8(Q,Y){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,...I(Y)})}function e8(Q,Y){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...I(Y)})}function QW(Q,Y){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...I(Y)})}function YW(Q,Y){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...I(Y)})}function XW(Q,Y){return new Q({type:"string",format:"url",check:"string_format",abort:!1,...I(Y)})}function WW(Q,Y){return new Q({type:"string",format:"emoji",check:"string_format",abort:!1,...I(Y)})}function GW(Q,Y){return new Q({type:"string",format:"nanoid",check:"string_format",abort:!1,...I(Y)})}function zW(Q,Y){return new Q({type:"string",format:"cuid",check:"string_format",abort:!1,...I(Y)})}function JW(Q,Y){return new Q({type:"string",format:"cuid2",check:"string_format",abort:!1,...I(Y)})}function $W(Q,Y){return new Q({type:"string",format:"ulid",check:"string_format",abort:!1,...I(Y)})}function HW(Q,Y){return new Q({type:"string",format:"xid",check:"string_format",abort:!1,...I(Y)})}function AW(Q,Y){return new Q({type:"string",format:"ksuid",check:"string_format",abort:!1,...I(Y)})}function UW(Q,Y){return new Q({type:"string",format:"ipv4",check:"string_format",abort:!1,...I(Y)})}function KW(Q,Y){return new Q({type:"string",format:"ipv6",check:"string_format",abort:!1,...I(Y)})}function DW(Q,Y){return new Q({type:"string",format:"cidrv4",check:"string_format",abort:!1,...I(Y)})}function BW(Q,Y){return new Q({type:"string",format:"cidrv6",check:"string_format",abort:!1,...I(Y)})}function LW(Q,Y){return new Q({type:"string",format:"base64",check:"string_format",abort:!1,...I(Y)})}function FW(Q,Y){return new Q({type:"string",format:"base64url",check:"string_format",abort:!1,...I(Y)})}function qW(Q,Y){return new Q({type:"string",format:"e164",check:"string_format",abort:!1,...I(Y)})}function OW(Q,Y){return new Q({type:"string",format:"jwt",check:"string_format",abort:!1,...I(Y)})}function MW(Q,Y){return new Q({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...I(Y)})}function VW(Q,Y){return new Q({type:"string",format:"date",check:"string_format",...I(Y)})}function NW(Q,Y){return new Q({type:"string",format:"time",check:"string_format",precision:null,...I(Y)})}function ZW(Q,Y){return new Q({type:"string",format:"duration",check:"string_format",...I(Y)})}function wW(Q,Y){return new Q({type:"number",checks:[],...I(Y)})}function bW(Q,Y){return new Q({type:"number",check:"number_format",abort:!1,format:"safeint",...I(Y)})}function PW(Q,Y){return new Q({type:"boolean",...I(Y)})}function jW(Q,Y){return new Q({type:"null",...I(Y)})}function IW(Q){return new Q({type:"unknown"})}function EW(Q,Y){return new Q({type:"never",...I(Y)})}function Y6(Q,Y){return new IQ({check:"less_than",...I(Y),value:Q,inclusive:!1})}function Y4(Q,Y){return new IQ({check:"less_than",...I(Y),value:Q,inclusive:!0})}function X6(Q,Y){return new EQ({check:"greater_than",...I(Y),value:Q,inclusive:!1})}function X4(Q,Y){return new EQ({check:"greater_than",...I(Y),value:Q,inclusive:!0})}function W6(Q,Y){return new kX({check:"multiple_of",...I(Y),value:Q})}function G6(Q,Y){return new _X({check:"max_length",...I(Y),maximum:Q})}function E1(Q,Y){return new gX({check:"min_length",...I(Y),minimum:Q})}function z6(Q,Y){return new yX({check:"length_equals",...I(Y),length:Q})}function xQ(Q,Y){return new uX({check:"string_format",format:"regex",...I(Y),pattern:Q})}function _Q(Q){return new hX({check:"string_format",format:"lowercase",...I(Q)})}function gQ(Q){return new fX({check:"string_format",format:"uppercase",...I(Q)})}function yQ(Q,Y){return new lX({check:"string_format",format:"includes",...I(Y),includes:Q})}function uQ(Q,Y){return new mX({check:"string_format",format:"starts_with",...I(Y),prefix:Q})}function hQ(Q,Y){return new cX({check:"string_format",format:"ends_with",...I(Y),suffix:Q})}function F1(Q){return new pX({check:"overwrite",tx:Q})}function fQ(Q){return F1((Y)=>Y.normalize(Q))}function lQ(){return F1((Q)=>Q.trim())}function mQ(){return F1((Q)=>Q.toLowerCase())}function cQ(){return F1((Q)=>Q.toUpperCase())}function TW(Q,Y,X){return new Q({type:"array",element:Y,...I(X)})}function SW(Q,Y,X){let W=I(X);return W.abort??(W.abort=!0),new Q({type:"custom",check:"custom",fn:Y,...W})}function RW(Q,Y,X){return new Q({type:"custom",check:"custom",fn:Y,...I(X)})}function CW(Q){let Y=MH((X)=>{return X.addIssue=(W)=>{if(typeof W==="string")X.issues.push(I1(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(I1(G))}},Q(X.value,X)});return Y}function MH(Q,Y){let X=new W0({check:"custom",...I(Y)});return X._zod.check=Q,X}function T1(Q){return!!Q._zod}function Y1(Q,Y){if(T1(Q))return a1(Q,Y);return Q.safeParse(Y)}function J6(Q){if(!Q)return;let Y;if(T1(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 vW(Q){if(T1(Q)){let z=Q._zod?.def;if(z){if(z.value!==void 0)return z.value;if(Array.isArray(z.values)&&z.values.length>0)return z.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 G4={};x9(G4,{time:()=>rQ,duration:()=>nQ,datetime:()=>pQ,date:()=>iQ,ZodISOTime:()=>_W,ZodISODuration:()=>gW,ZodISODateTime:()=>kW,ZodISODate:()=>xW});var kW=F("ZodISODateTime",(Q,Y)=>{D8.init(Q,Y),d.init(Q,Y)});function pQ(Q){return MW(kW,Q)}var xW=F("ZodISODate",(Q,Y)=>{B8.init(Q,Y),d.init(Q,Y)});function iQ(Q){return VW(xW,Q)}var _W=F("ZodISOTime",(Q,Y)=>{L8.init(Q,Y),d.init(Q,Y)});function rQ(Q){return NW(_W,Q)}var gW=F("ZodISODuration",(Q,Y)=>{F8.init(Q,Y),d.init(Q,Y)});function nQ(Q){return ZW(gW,Q)}var yW=(Q,Y)=>{n4.init(Q,Y),Q.name="ZodError",Object.defineProperties(Q,{format:{value:(X)=>d9(Q,X)},flatten:{value:(X)=>n9(Q,X)},addIssue:{value:(X)=>{Q.issues.push(X),Q.message=JSON.stringify(Q.issues,P1,2)}},addIssues:{value:(X)=>{Q.issues.push(...X),Q.message=JSON.stringify(Q.issues,P1,2)}},isEmpty:{get(){return Q.issues.length===0}}})},kV=F("ZodError",yW),N0=F("ZodError",yW,{Parent:Error});var uW=d4(N0),hW=o4(N0),fW=t1(N0),lW=s1(N0),mW=o9(N0),cW=t9(N0),pW=a9(N0),iW=s9(N0),rW=e9(N0),nW=QX(N0),dW=YX(N0),oW=XX(N0);var s=F("ZodType",(Q,Y)=>{return i.init(Q,Y),Q.def=Y,Q.type=Y.type,Object.defineProperty(Q,"_def",{value:Y}),Q.check=(...X)=>{return Q.clone(h.mergeDefs(Y,{checks:[...Y.checks??[],...X.map((W)=>typeof W==="function"?{_zod:{check:W,def:{check:"custom"},onattach:[]}}:W)]}))},Q.clone=(X,W)=>E0(Q,X,W),Q.brand=()=>Q,Q.register=(X,W)=>{return X.add(Q,W),Q},Q.parse=(X,W)=>uW(Q,X,W,{callee:Q.parse}),Q.safeParse=(X,W)=>fW(Q,X,W),Q.parseAsync=async(X,W)=>hW(Q,X,W,{callee:Q.parseAsync}),Q.safeParseAsync=async(X,W)=>lW(Q,X,W),Q.spa=Q.safeParseAsync,Q.encode=(X,W)=>mW(Q,X,W),Q.decode=(X,W)=>cW(Q,X,W),Q.encodeAsync=async(X,W)=>pW(Q,X,W),Q.decodeAsync=async(X,W)=>iW(Q,X,W),Q.safeEncode=(X,W)=>rW(Q,X,W),Q.safeDecode=(X,W)=>nW(Q,X,W),Q.safeEncodeAsync=async(X,W)=>dW(Q,X,W),Q.safeDecodeAsync=async(X,W)=>oW(Q,X,W),Q.refine=(X,W)=>Q.check(LA(X,W)),Q.superRefine=(X)=>Q.check(FA(X)),Q.overwrite=(X)=>Q.check(F1(X)),Q.optional=()=>a(Q),Q.nullable=()=>sW(Q),Q.nullish=()=>a(sW(Q)),Q.nonoptional=(X)=>HA(Q,X),Q.array=()=>_(Q),Q.or=(X)=>p([Q,X]),Q.and=(X)=>H6(Q,X),Q.transform=(X)=>oQ(Q,WG(X)),Q.default=(X)=>zA(Q,X),Q.prefault=(X)=>$A(Q,X),Q.catch=(X)=>UA(Q,X),Q.pipe=(X)=>oQ(Q,X),Q.readonly=()=>BA(Q),Q.describe=(X)=>{let W=Q.clone();return Q4.add(W,{description:X}),W},Object.defineProperty(Q,"description",{get(){return Q4.get(Q)?.description},configurable:!0}),Q.meta=(...X)=>{if(X.length===0)return Q4.get(Q);let W=Q.clone();return Q4.add(W,X[0]),W},Q.isOptional=()=>Q.safeParse(void 0).success,Q.isNullable=()=>Q.safeParse(null).success,Q}),eW=F("_ZodString",(Q,Y)=>{Q6.init(Q,Y),s.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(xQ(...W)),Q.includes=(...W)=>Q.check(yQ(...W)),Q.startsWith=(...W)=>Q.check(uQ(...W)),Q.endsWith=(...W)=>Q.check(hQ(...W)),Q.min=(...W)=>Q.check(E1(...W)),Q.max=(...W)=>Q.check(G6(...W)),Q.length=(...W)=>Q.check(z6(...W)),Q.nonempty=(...W)=>Q.check(E1(1,...W)),Q.lowercase=(W)=>Q.check(_Q(W)),Q.uppercase=(W)=>Q.check(gQ(W)),Q.trim=()=>Q.check(lQ()),Q.normalize=(...W)=>Q.check(fQ(...W)),Q.toLowerCase=()=>Q.check(mQ()),Q.toUpperCase=()=>Q.check(cQ())}),EH=F("ZodString",(Q,Y)=>{Q6.init(Q,Y),eW.init(Q,Y),Q.email=(X)=>Q.check(a8(TH,X)),Q.url=(X)=>Q.check(XW(SH,X)),Q.jwt=(X)=>Q.check(OW(pH,X)),Q.emoji=(X)=>Q.check(WW(RH,X)),Q.guid=(X)=>Q.check(kQ(tW,X)),Q.uuid=(X)=>Q.check(s8($6,X)),Q.uuidv4=(X)=>Q.check(e8($6,X)),Q.uuidv6=(X)=>Q.check(QW($6,X)),Q.uuidv7=(X)=>Q.check(YW($6,X)),Q.nanoid=(X)=>Q.check(GW(CH,X)),Q.guid=(X)=>Q.check(kQ(tW,X)),Q.cuid=(X)=>Q.check(zW(vH,X)),Q.cuid2=(X)=>Q.check(JW(kH,X)),Q.ulid=(X)=>Q.check($W(xH,X)),Q.base64=(X)=>Q.check(LW(lH,X)),Q.base64url=(X)=>Q.check(FW(mH,X)),Q.xid=(X)=>Q.check(HW(_H,X)),Q.ksuid=(X)=>Q.check(AW(gH,X)),Q.ipv4=(X)=>Q.check(UW(yH,X)),Q.ipv6=(X)=>Q.check(KW(uH,X)),Q.cidrv4=(X)=>Q.check(DW(hH,X)),Q.cidrv6=(X)=>Q.check(BW(fH,X)),Q.e164=(X)=>Q.check(qW(cH,X)),Q.datetime=(X)=>Q.check(pQ(X)),Q.date=(X)=>Q.check(iQ(X)),Q.time=(X)=>Q.check(rQ(X)),Q.duration=(X)=>Q.check(nQ(X))});function B(Q){return t8(EH,Q)}var d=F("ZodStringFormat",(Q,Y)=>{r.init(Q,Y),eW.init(Q,Y)}),TH=F("ZodEmail",(Q,Y)=>{W8.init(Q,Y),d.init(Q,Y)});var tW=F("ZodGUID",(Q,Y)=>{Y8.init(Q,Y),d.init(Q,Y)});var $6=F("ZodUUID",(Q,Y)=>{X8.init(Q,Y),d.init(Q,Y)});var SH=F("ZodURL",(Q,Y)=>{G8.init(Q,Y),d.init(Q,Y)});var RH=F("ZodEmoji",(Q,Y)=>{z8.init(Q,Y),d.init(Q,Y)});var CH=F("ZodNanoID",(Q,Y)=>{J8.init(Q,Y),d.init(Q,Y)});var vH=F("ZodCUID",(Q,Y)=>{$8.init(Q,Y),d.init(Q,Y)});var kH=F("ZodCUID2",(Q,Y)=>{H8.init(Q,Y),d.init(Q,Y)});var xH=F("ZodULID",(Q,Y)=>{A8.init(Q,Y),d.init(Q,Y)});var _H=F("ZodXID",(Q,Y)=>{U8.init(Q,Y),d.init(Q,Y)});var gH=F("ZodKSUID",(Q,Y)=>{K8.init(Q,Y),d.init(Q,Y)});var yH=F("ZodIPv4",(Q,Y)=>{q8.init(Q,Y),d.init(Q,Y)});var uH=F("ZodIPv6",(Q,Y)=>{O8.init(Q,Y),d.init(Q,Y)});var hH=F("ZodCIDRv4",(Q,Y)=>{M8.init(Q,Y),d.init(Q,Y)});var fH=F("ZodCIDRv6",(Q,Y)=>{V8.init(Q,Y),d.init(Q,Y)});var lH=F("ZodBase64",(Q,Y)=>{Z8.init(Q,Y),d.init(Q,Y)});var mH=F("ZodBase64URL",(Q,Y)=>{w8.init(Q,Y),d.init(Q,Y)});var cH=F("ZodE164",(Q,Y)=>{b8.init(Q,Y),d.init(Q,Y)});var pH=F("ZodJWT",(Q,Y)=>{P8.init(Q,Y),d.init(Q,Y)});var QG=F("ZodNumber",(Q,Y)=>{RQ.init(Q,Y),s.init(Q,Y),Q.gt=(W,G)=>Q.check(X6(W,G)),Q.gte=(W,G)=>Q.check(X4(W,G)),Q.min=(W,G)=>Q.check(X4(W,G)),Q.lt=(W,G)=>Q.check(Y6(W,G)),Q.lte=(W,G)=>Q.check(Y4(W,G)),Q.max=(W,G)=>Q.check(Y4(W,G)),Q.int=(W)=>Q.check(aW(W)),Q.safe=(W)=>Q.check(aW(W)),Q.positive=(W)=>Q.check(X6(0,W)),Q.nonnegative=(W)=>Q.check(X4(0,W)),Q.negative=(W)=>Q.check(Y6(0,W)),Q.nonpositive=(W)=>Q.check(Y4(0,W)),Q.multipleOf=(W,G)=>Q.check(W6(W,G)),Q.step=(W,G)=>Q.check(W6(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 l(Q){return wW(QG,Q)}var iH=F("ZodNumberFormat",(Q,Y)=>{j8.init(Q,Y),QG.init(Q,Y)});function aW(Q){return bW(iH,Q)}var rH=F("ZodBoolean",(Q,Y)=>{I8.init(Q,Y),s.init(Q,Y)});function X0(Q){return PW(rH,Q)}var nH=F("ZodNull",(Q,Y)=>{E8.init(Q,Y),s.init(Q,Y)});function tQ(Q){return jW(nH,Q)}var dH=F("ZodUnknown",(Q,Y)=>{T8.init(Q,Y),s.init(Q,Y)});function o(){return IW(dH)}var oH=F("ZodNever",(Q,Y)=>{S8.init(Q,Y),s.init(Q,Y)});function tH(Q){return EW(oH,Q)}var aH=F("ZodArray",(Q,Y)=>{R8.init(Q,Y),s.init(Q,Y),Q.element=Y.element,Q.min=(X,W)=>Q.check(E1(X,W)),Q.nonempty=(X)=>Q.check(E1(1,X)),Q.max=(X,W)=>Q.check(G6(X,W)),Q.length=(X,W)=>Q.check(z6(X,W)),Q.unwrap=()=>Q.element});function _(Q,Y){return TW(aH,Q,Y)}var YG=F("ZodObject",(Q,Y)=>{k8.init(Q,Y),s.init(Q,Y),h.defineLazy(Q,"shape",()=>{return Y.shape}),Q.keyof=()=>L0(Object.keys(Q._zod.def.shape)),Q.catchall=(X)=>Q.clone({...Q._zod.def,catchall:X}),Q.passthrough=()=>Q.clone({...Q._zod.def,catchall:o()}),Q.loose=()=>Q.clone({...Q._zod.def,catchall:o()}),Q.strict=()=>Q.clone({...Q._zod.def,catchall:tH()}),Q.strip=()=>Q.clone({...Q._zod.def,catchall:void 0}),Q.extend=(X)=>{return h.extend(Q,X)},Q.safeExtend=(X)=>{return h.safeExtend(Q,X)},Q.merge=(X)=>h.merge(Q,X),Q.pick=(X)=>h.pick(Q,X),Q.omit=(X)=>h.omit(Q,X),Q.partial=(...X)=>h.partial(GG,Q,X[0]),Q.required=(...X)=>h.required(zG,Q,X[0])});function w(Q,Y){let X={type:"object",shape:Q??{},...h.normalizeParams(Y)};return new YG(X)}function U0(Q,Y){return new YG({type:"object",shape:Q,catchall:o(),...h.normalizeParams(Y)})}var XG=F("ZodUnion",(Q,Y)=>{CQ.init(Q,Y),s.init(Q,Y),Q.options=Y.options});function p(Q,Y){return new XG({type:"union",options:Q,...h.normalizeParams(Y)})}var sH=F("ZodDiscriminatedUnion",(Q,Y)=>{XG.init(Q,Y),x8.init(Q,Y)});function aQ(Q,Y,X){return new sH({type:"union",options:Y,discriminator:Q,...h.normalizeParams(X)})}var eH=F("ZodIntersection",(Q,Y)=>{_8.init(Q,Y),s.init(Q,Y)});function H6(Q,Y){return new eH({type:"intersection",left:Q,right:Y})}var QA=F("ZodRecord",(Q,Y)=>{g8.init(Q,Y),s.init(Q,Y),Q.keyType=Y.keyType,Q.valueType=Y.valueType});function t(Q,Y,X){return new QA({type:"record",keyType:Q,valueType:Y,...h.normalizeParams(X)})}var dQ=F("ZodEnum",(Q,Y)=>{y8.init(Q,Y),s.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 z={};for(let J of W)if(X.has(J))z[J]=Y.entries[J];else throw Error(`Key ${J} not found in enum`);return new dQ({...Y,checks:[],...h.normalizeParams(G),entries:z})},Q.exclude=(W,G)=>{let z={...Y.entries};for(let J of W)if(X.has(J))delete z[J];else throw Error(`Key ${J} not found in enum`);return new dQ({...Y,checks:[],...h.normalizeParams(G),entries:z})}});function L0(Q,Y){let X=Array.isArray(Q)?Object.fromEntries(Q.map((W)=>[W,W])):Q;return new dQ({type:"enum",entries:X,...h.normalizeParams(Y)})}var YA=F("ZodLiteral",(Q,Y)=>{u8.init(Q,Y),s.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 YA({type:"literal",values:Array.isArray(Q)?Q:[Q],...h.normalizeParams(Y)})}var XA=F("ZodTransform",(Q,Y)=>{h8.init(Q,Y),s.init(Q,Y),Q._zod.parse=(X,W)=>{if(W.direction==="backward")throw new i1(Q.constructor.name);X.addIssue=(z)=>{if(typeof z==="string")X.issues.push(h.issue(z,X.value,Y));else{let J=z;if(J.fatal)J.continue=!1;J.code??(J.code="custom"),J.input??(J.input=X.value),J.inst??(J.inst=Q),X.issues.push(h.issue(J))}};let G=Y.transform(X.value,X);if(G instanceof Promise)return G.then((z)=>{return X.value=z,X});return X.value=G,X}});function WG(Q){return new XA({type:"transform",transform:Q})}var GG=F("ZodOptional",(Q,Y)=>{f8.init(Q,Y),s.init(Q,Y),Q.unwrap=()=>Q._zod.def.innerType});function a(Q){return new GG({type:"optional",innerType:Q})}var WA=F("ZodNullable",(Q,Y)=>{l8.init(Q,Y),s.init(Q,Y),Q.unwrap=()=>Q._zod.def.innerType});function sW(Q){return new WA({type:"nullable",innerType:Q})}var GA=F("ZodDefault",(Q,Y)=>{m8.init(Q,Y),s.init(Q,Y),Q.unwrap=()=>Q._zod.def.innerType,Q.removeDefault=Q.unwrap});function zA(Q,Y){return new GA({type:"default",innerType:Q,get defaultValue(){return typeof Y==="function"?Y():h.shallowClone(Y)}})}var JA=F("ZodPrefault",(Q,Y)=>{c8.init(Q,Y),s.init(Q,Y),Q.unwrap=()=>Q._zod.def.innerType});function $A(Q,Y){return new JA({type:"prefault",innerType:Q,get defaultValue(){return typeof Y==="function"?Y():h.shallowClone(Y)}})}var zG=F("ZodNonOptional",(Q,Y)=>{p8.init(Q,Y),s.init(Q,Y),Q.unwrap=()=>Q._zod.def.innerType});function HA(Q,Y){return new zG({type:"nonoptional",innerType:Q,...h.normalizeParams(Y)})}var AA=F("ZodCatch",(Q,Y)=>{i8.init(Q,Y),s.init(Q,Y),Q.unwrap=()=>Q._zod.def.innerType,Q.removeCatch=Q.unwrap});function UA(Q,Y){return new AA({type:"catch",innerType:Q,catchValue:typeof Y==="function"?Y:()=>Y})}var KA=F("ZodPipe",(Q,Y)=>{r8.init(Q,Y),s.init(Q,Y),Q.in=Y.in,Q.out=Y.out});function oQ(Q,Y){return new KA({type:"pipe",in:Q,out:Y})}var DA=F("ZodReadonly",(Q,Y)=>{n8.init(Q,Y),s.init(Q,Y),Q.unwrap=()=>Q._zod.def.innerType});function BA(Q){return new DA({type:"readonly",innerType:Q})}var JG=F("ZodCustom",(Q,Y)=>{d8.init(Q,Y),s.init(Q,Y)});function $G(Q,Y){return SW(JG,Q??(()=>!0),Y)}function LA(Q,Y={}){return RW(JG,Q,Y)}function FA(Q){return CW(Q)}function sQ(Q,Y){return oQ(WG(Q),Y)}w0(vQ());var eQ="2025-11-25";var HG=[eQ,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],X1="io.modelcontextprotocol/related-task",U6="2.0",G0=$G((Q)=>Q!==null&&(typeof Q==="object"||typeof Q==="function")),AG=p([B(),l().int()]),UG=B(),TN=U0({ttl:p([l(),tQ()]).optional(),pollInterval:l().optional()}),qA=w({ttl:l().optional()}),OA=w({taskId:B()}),QY=U0({progressToken:AG.optional(),[X1]:OA.optional()}),Z0=w({_meta:QY.optional()}),z4=Z0.extend({task:qA.optional()}),KG=(Q)=>z4.safeParse(Q).success,z0=w({method:B(),params:Z0.loose().optional()}),b0=w({_meta:QY.optional()}),P0=w({method:B(),params:b0.loose().optional()}),J0=U0({_meta:QY.optional()}),K6=p([B(),l().int()]),DG=w({jsonrpc:b(U6),id:K6,...z0.shape}).strict(),YY=(Q)=>DG.safeParse(Q).success,BG=w({jsonrpc:b(U6),...P0.shape}).strict(),LG=(Q)=>BG.safeParse(Q).success,XY=w({jsonrpc:b(U6),id:K6,result:J0}).strict(),J4=(Q)=>XY.safeParse(Q).success;var g;(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"})(g||(g={}));var WY=w({jsonrpc:b(U6),id:K6.optional(),error:w({code:l().int(),message:B(),data:o().optional()})}).strict();var FG=(Q)=>WY.safeParse(Q).success;var SN=p([DG,BG,XY,WY]),RN=p([XY,WY]),D6=J0.strict(),MA=b0.extend({requestId:K6.optional(),reason:B().optional()}),B6=P0.extend({method:b("notifications/cancelled"),params:MA}),VA=w({src:B(),mimeType:B().optional(),sizes:_(B()).optional(),theme:L0(["light","dark"]).optional()}),$4=w({icons:_(VA).optional()}),S1=w({name:B(),title:B().optional()}),qG=S1.extend({...S1.shape,...$4.shape,version:B(),websiteUrl:B().optional(),description:B().optional()}),NA=H6(w({applyDefaults:X0().optional()}),t(B(),o())),ZA=sQ((Q)=>{if(Q&&typeof Q==="object"&&!Array.isArray(Q)){if(Object.keys(Q).length===0)return{form:{}}}return Q},H6(w({form:NA.optional(),url:G0.optional()}),t(B(),o()).optional())),wA=U0({list:G0.optional(),cancel:G0.optional(),requests:U0({sampling:U0({createMessage:G0.optional()}).optional(),elicitation:U0({create:G0.optional()}).optional()}).optional()}),bA=U0({list:G0.optional(),cancel:G0.optional(),requests:U0({tools:U0({call:G0.optional()}).optional()}).optional()}),PA=w({experimental:t(B(),G0).optional(),sampling:w({context:G0.optional(),tools:G0.optional()}).optional(),elicitation:ZA.optional(),roots:w({listChanged:X0().optional()}).optional(),tasks:wA.optional()}),jA=Z0.extend({protocolVersion:B(),capabilities:PA,clientInfo:qG}),GY=z0.extend({method:b("initialize"),params:jA});var IA=w({experimental:t(B(),G0).optional(),logging:G0.optional(),completions:G0.optional(),prompts:w({listChanged:X0().optional()}).optional(),resources:w({subscribe:X0().optional(),listChanged:X0().optional()}).optional(),tools:w({listChanged:X0().optional()}).optional(),tasks:bA.optional()}),EA=J0.extend({protocolVersion:B(),capabilities:IA,serverInfo:qG,instructions:B().optional()}),zY=P0.extend({method:b("notifications/initialized"),params:b0.optional()});var L6=z0.extend({method:b("ping"),params:Z0.optional()}),TA=w({progress:l(),total:a(l()),message:a(B())}),SA=w({...b0.shape,...TA.shape,progressToken:AG}),F6=P0.extend({method:b("notifications/progress"),params:SA}),RA=Z0.extend({cursor:UG.optional()}),H4=z0.extend({params:RA.optional()}),A4=J0.extend({nextCursor:UG.optional()}),CA=L0(["working","input_required","completed","failed","cancelled"]),U4=w({taskId:B(),status:CA,ttl:p([l(),tQ()]),createdAt:B(),lastUpdatedAt:B(),pollInterval:a(l()),statusMessage:a(B())}),R1=J0.extend({task:U4}),vA=b0.merge(U4),K4=P0.extend({method:b("notifications/tasks/status"),params:vA}),q6=z0.extend({method:b("tasks/get"),params:Z0.extend({taskId:B()})}),O6=J0.merge(U4),M6=z0.extend({method:b("tasks/result"),params:Z0.extend({taskId:B()})}),CN=J0.loose(),V6=H4.extend({method:b("tasks/list")}),N6=A4.extend({tasks:_(U4)}),Z6=z0.extend({method:b("tasks/cancel"),params:Z0.extend({taskId:B()})}),OG=J0.merge(U4),MG=w({uri:B(),mimeType:a(B()),_meta:t(B(),o()).optional()}),VG=MG.extend({text:B()}),JY=B().refine((Q)=>{try{return atob(Q),!0}catch{return!1}},{message:"Invalid Base64 string"}),NG=MG.extend({blob:JY}),D4=L0(["user","assistant"]),C1=w({audience:_(D4).optional(),priority:l().min(0).max(1).optional(),lastModified:G4.datetime({offset:!0}).optional()}),ZG=w({...S1.shape,...$4.shape,uri:B(),description:a(B()),mimeType:a(B()),annotations:C1.optional(),_meta:a(U0({}))}),kA=w({...S1.shape,...$4.shape,uriTemplate:B(),description:a(B()),mimeType:a(B()),annotations:C1.optional(),_meta:a(U0({}))}),$Y=H4.extend({method:b("resources/list")}),xA=A4.extend({resources:_(ZG)}),_A=H4.extend({method:b("resources/templates/list")}),gA=A4.extend({resourceTemplates:_(kA)}),HY=Z0.extend({uri:B()}),yA=HY,AY=z0.extend({method:b("resources/read"),params:yA}),uA=J0.extend({contents:_(p([VG,NG]))}),hA=P0.extend({method:b("notifications/resources/list_changed"),params:b0.optional()}),fA=HY,lA=z0.extend({method:b("resources/subscribe"),params:fA}),mA=HY,cA=z0.extend({method:b("resources/unsubscribe"),params:mA}),pA=b0.extend({uri:B()}),iA=P0.extend({method:b("notifications/resources/updated"),params:pA}),rA=w({name:B(),description:a(B()),required:a(X0())}),nA=w({...S1.shape,...$4.shape,description:a(B()),arguments:a(_(rA)),_meta:a(U0({}))}),dA=H4.extend({method:b("prompts/list")}),oA=A4.extend({prompts:_(nA)}),tA=Z0.extend({name:B(),arguments:t(B(),B()).optional()}),aA=z0.extend({method:b("prompts/get"),params:tA}),UY=w({type:b("text"),text:B(),annotations:C1.optional(),_meta:t(B(),o()).optional()}),KY=w({type:b("image"),data:JY,mimeType:B(),annotations:C1.optional(),_meta:t(B(),o()).optional()}),DY=w({type:b("audio"),data:JY,mimeType:B(),annotations:C1.optional(),_meta:t(B(),o()).optional()}),sA=w({type:b("tool_use"),name:B(),id:B(),input:t(B(),o()),_meta:t(B(),o()).optional()}),eA=w({type:b("resource"),resource:p([VG,NG]),annotations:C1.optional(),_meta:t(B(),o()).optional()}),QU=ZG.extend({type:b("resource_link")}),BY=p([UY,KY,DY,QU,eA]),YU=w({role:D4,content:BY}),XU=J0.extend({description:B().optional(),messages:_(YU)}),WU=P0.extend({method:b("notifications/prompts/list_changed"),params:b0.optional()}),GU=w({title:B().optional(),readOnlyHint:X0().optional(),destructiveHint:X0().optional(),idempotentHint:X0().optional(),openWorldHint:X0().optional()}),zU=w({taskSupport:L0(["required","optional","forbidden"]).optional()}),wG=w({...S1.shape,...$4.shape,description:B().optional(),inputSchema:w({type:b("object"),properties:t(B(),G0).optional(),required:_(B()).optional()}).catchall(o()),outputSchema:w({type:b("object"),properties:t(B(),G0).optional(),required:_(B()).optional()}).catchall(o()).optional(),annotations:GU.optional(),execution:zU.optional(),_meta:t(B(),o()).optional()}),LY=H4.extend({method:b("tools/list")}),JU=A4.extend({tools:_(wG)}),w6=J0.extend({content:_(BY).default([]),structuredContent:t(B(),o()).optional(),isError:X0().optional()}),vN=w6.or(J0.extend({toolResult:o()})),$U=z4.extend({name:B(),arguments:t(B(),o()).optional()}),B4=z0.extend({method:b("tools/call"),params:$U}),HU=P0.extend({method:b("notifications/tools/list_changed"),params:b0.optional()}),kN=w({autoRefresh:X0().default(!0),debounceMs:l().int().nonnegative().default(300)}),L4=L0(["debug","info","notice","warning","error","critical","alert","emergency"]),AU=Z0.extend({level:L4}),FY=z0.extend({method:b("logging/setLevel"),params:AU}),UU=b0.extend({level:L4,logger:B().optional(),data:o()}),KU=P0.extend({method:b("notifications/message"),params:UU}),DU=w({name:B().optional()}),BU=w({hints:_(DU).optional(),costPriority:l().min(0).max(1).optional(),speedPriority:l().min(0).max(1).optional(),intelligencePriority:l().min(0).max(1).optional()}),LU=w({mode:L0(["auto","required","none"]).optional()}),FU=w({type:b("tool_result"),toolUseId:B().describe("The unique identifier for the corresponding tool call."),content:_(BY).default([]),structuredContent:w({}).loose().optional(),isError:X0().optional(),_meta:t(B(),o()).optional()}),qU=aQ("type",[UY,KY,DY]),A6=aQ("type",[UY,KY,DY,sA,FU]),OU=w({role:D4,content:p([A6,_(A6)]),_meta:t(B(),o()).optional()}),MU=z4.extend({messages:_(OU),modelPreferences:BU.optional(),systemPrompt:B().optional(),includeContext:L0(["none","thisServer","allServers"]).optional(),temperature:l().optional(),maxTokens:l().int(),stopSequences:_(B()).optional(),metadata:G0.optional(),tools:_(wG).optional(),toolChoice:LU.optional()}),VU=z0.extend({method:b("sampling/createMessage"),params:MU}),qY=J0.extend({model:B(),stopReason:a(L0(["endTurn","stopSequence","maxTokens"]).or(B())),role:D4,content:qU}),OY=J0.extend({model:B(),stopReason:a(L0(["endTurn","stopSequence","maxTokens","toolUse"]).or(B())),role:D4,content:p([A6,_(A6)])}),NU=w({type:b("boolean"),title:B().optional(),description:B().optional(),default:X0().optional()}),ZU=w({type:b("string"),title:B().optional(),description:B().optional(),minLength:l().optional(),maxLength:l().optional(),format:L0(["email","uri","date","date-time"]).optional(),default:B().optional()}),wU=w({type:L0(["number","integer"]),title:B().optional(),description:B().optional(),minimum:l().optional(),maximum:l().optional(),default:l().optional()}),bU=w({type:b("string"),title:B().optional(),description:B().optional(),enum:_(B()),default:B().optional()}),PU=w({type:b("string"),title:B().optional(),description:B().optional(),oneOf:_(w({const:B(),title:B()})),default:B().optional()}),jU=w({type:b("string"),title:B().optional(),description:B().optional(),enum:_(B()),enumNames:_(B()).optional(),default:B().optional()}),IU=p([bU,PU]),EU=w({type:b("array"),title:B().optional(),description:B().optional(),minItems:l().optional(),maxItems:l().optional(),items:w({type:b("string"),enum:_(B())}),default:_(B()).optional()}),TU=w({type:b("array"),title:B().optional(),description:B().optional(),minItems:l().optional(),maxItems:l().optional(),items:w({anyOf:_(w({const:B(),title:B()}))}),default:_(B()).optional()}),SU=p([EU,TU]),RU=p([jU,IU,SU]),CU=p([RU,NU,ZU,wU]),vU=z4.extend({mode:b("form").optional(),message:B(),requestedSchema:w({type:b("object"),properties:t(B(),CU),required:_(B()).optional()})}),kU=z4.extend({mode:b("url"),message:B(),elicitationId:B(),url:B().url()}),xU=p([vU,kU]),_U=z0.extend({method:b("elicitation/create"),params:xU}),gU=b0.extend({elicitationId:B()}),yU=P0.extend({method:b("notifications/elicitation/complete"),params:gU}),b6=J0.extend({action:L0(["accept","decline","cancel"]),content:sQ((Q)=>Q===null?void 0:Q,t(B(),p([B(),l(),X0(),_(B())])).optional())}),uU=w({type:b("ref/resource"),uri:B()});var hU=w({type:b("ref/prompt"),name:B()}),fU=Z0.extend({ref:p([hU,uU]),argument:w({name:B(),value:B()}),context:w({arguments:t(B(),B()).optional()}).optional()}),lU=z0.extend({method:b("completion/complete"),params:fU});var mU=J0.extend({completion:U0({values:_(B()).max(100),total:a(l().int()),hasMore:a(X0())})}),cU=w({uri:B().startsWith("file://"),name:B().optional(),_meta:t(B(),o()).optional()}),pU=z0.extend({method:b("roots/list"),params:Z0.optional()}),MY=J0.extend({roots:_(cU)}),iU=P0.extend({method:b("notifications/roots/list_changed"),params:b0.optional()}),xN=p([L6,GY,lU,FY,aA,dA,$Y,_A,AY,lA,cA,B4,LY,q6,M6,V6,Z6]),_N=p([B6,F6,zY,iU,K4]),gN=p([D6,qY,OY,b6,MY,O6,N6,R1]),yN=p([L6,VU,_U,pU,q6,M6,V6,Z6]),uN=p([B6,F6,KU,iA,hA,HU,WU,K4,yU]),hN=p([D6,EA,mU,XU,oA,xA,gA,uA,w6,JU,O6,N6,R1]);class v 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===g.UrlElicitationRequired&&X){let W=X;if(W.elicitations)return new bG(W.elicitations,Y)}return new v(Q,Y,X)}}class bG extends v{constructor(Q,Y=`URL elicitation${Q.length>1?"s":""} required`){super(g.UrlElicitationRequired,Y,{elicitations:Q})}get elicitations(){return this.data?.elicitations??[]}}function W1(Q){return Q==="completed"||Q==="failed"||Q==="cancelled"}var rU=Symbol("Let zodToJsonSchema decide on which parser to use");var MZ=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function VY(Q){let X=J6(Q)?.method;if(!X)throw Error("Schema is missing a method literal");let W=vW(X);if(typeof W!=="string")throw Error("Schema method literal must be a string");return W}function NY(Q,Y){let X=Y1(Q,Y);if(!X.success)throw X.error;return X.data}var sU=60000;class ZY{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(B6,(Y)=>{this._oncancel(Y)}),this.setNotificationHandler(F6,(Y)=>{this._onprogress(Y)}),this.setRequestHandler(L6,(Y)=>({})),this._taskStore=Q?.taskStore,this._taskMessageQueue=Q?.taskMessageQueue,this._taskStore)this.setRequestHandler(q6,async(Y,X)=>{let W=await this._taskStore.getTask(Y.params.taskId,X.sessionId);if(!W)throw new v(g.InvalidParams,"Failed to retrieve task: Task not found");return{...W}}),this.setRequestHandler(M6,async(Y,X)=>{let W=async()=>{let G=Y.params.taskId;if(this._taskMessageQueue){let J;while(J=await this._taskMessageQueue.dequeue(G,X.sessionId)){if(J.type==="response"||J.type==="error"){let $=J.message,H=$.id,A=this._requestResolvers.get(H);if(A)if(this._requestResolvers.delete(H),J.type==="response")A($);else{let U=$,K=new v(U.error.code,U.error.message,U.error.data);A(K)}else{let U=J.type==="response"?"Response":"Error";this._onerror(Error(`${U} handler missing for request ${H}`))}continue}await this._transport?.send(J.message,{relatedRequestId:X.requestId})}}let z=await this._taskStore.getTask(G,X.sessionId);if(!z)throw new v(g.InvalidParams,`Task not found: ${G}`);if(!W1(z.status))return await this._waitForTaskUpdate(G,X.signal),await W();if(W1(z.status)){let J=await this._taskStore.getTaskResult(G,X.sessionId);return this._clearTaskQueue(G),{...J,_meta:{...J._meta,[X1]:{taskId:G}}}}return await W()};return await W()}),this.setRequestHandler(V6,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 v(g.InvalidParams,`Failed to list tasks: ${W instanceof Error?W.message:String(W)}`)}}),this.setRequestHandler(Z6,async(Y,X)=>{try{let W=await this._taskStore.getTask(Y.params.taskId,X.sessionId);if(!W)throw new v(g.InvalidParams,`Task not found: ${Y.params.taskId}`);if(W1(W.status))throw new v(g.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 v(g.InvalidParams,`Task not found after cancellation: ${Y.params.taskId}`);return{_meta:{},...G}}catch(W){if(W instanceof v)throw W;throw new v(g.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),v.fromError(g.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,z)=>{if(W?.(G,z),J4(G)||FG(G))this._onresponse(G);else if(YY(G))this._onrequest(G,z);else if(LG(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=v.fromError(g.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?.[X1]?.taskId;if(X===void 0){let A={jsonrpc:"2.0",id:Q.id,error:{code:g.MethodNotFound,message:"Method not found"}};if(G&&this._taskMessageQueue)this._enqueueTaskMessage(G,{type:"error",message:A,timestamp:Date.now()},W?.sessionId).catch((U)=>this._onerror(Error(`Failed to enqueue error response: ${U}`)));else W?.send(A).catch((U)=>this._onerror(Error(`Failed to send an error response: ${U}`)));return}let z=new AbortController;this._requestHandlerAbortControllers.set(Q.id,z);let J=KG(Q.params)?Q.params.task:void 0,$=this._taskStore?this.requestTaskStore(Q,W?.sessionId):void 0,H={signal:z.signal,sessionId:W?.sessionId,_meta:Q.params?._meta,sendNotification:async(A)=>{let U={relatedRequestId:Q.id};if(G)U.relatedTask={taskId:G};await this.notification(A,U)},sendRequest:async(A,U,K)=>{let D={...K,relatedRequestId:Q.id};if(G&&!D.relatedTask)D.relatedTask={taskId:G};let L=D.relatedTask?.taskId??G;if(L&&$)await $.updateTaskStatus(L,"input_required");return await this.request(A,U,D)},authInfo:Y?.authInfo,requestId:Q.id,requestInfo:Y?.requestInfo,taskId:G,taskStore:$,taskRequestedTtl:J?.ttl,closeSSEStream:Y?.closeSSEStream,closeStandaloneSSEStream:Y?.closeStandaloneSSEStream};Promise.resolve().then(()=>{if(J)this.assertTaskHandlerCapability(Q.method)}).then(()=>X(Q,H)).then(async(A)=>{if(z.signal.aborted)return;let U={result:A,jsonrpc:"2.0",id:Q.id};if(G&&this._taskMessageQueue)await this._enqueueTaskMessage(G,{type:"response",message:U,timestamp:Date.now()},W?.sessionId);else await W?.send(U)},async(A)=>{if(z.signal.aborted)return;let U={jsonrpc:"2.0",id:Q.id,error:{code:Number.isSafeInteger(A.code)?A.code:g.InternalError,message:A.message??"Internal error",...A.data!==void 0&&{data:A.data}}};if(G&&this._taskMessageQueue)await this._enqueueTaskMessage(G,{type:"error",message:U,timestamp:Date.now()},W?.sessionId);else await W?.send(U)}).catch((A)=>this._onerror(Error(`Failed to send response: ${A}`))).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 z=this._responseHandlers.get(W),J=this._timeoutInfo.get(W);if(J&&z&&J.resetTimeoutOnProgress)try{this._resetTimeout(W)}catch($){this._responseHandlers.delete(W),this._progressHandlers.delete(W),this._cleanupTimeout(W),z($);return}G(X)}_onresponse(Q){let Y=Number(Q.id),X=this._requestResolvers.get(Y);if(X){if(this._requestResolvers.delete(Y),J4(Q))X(Q);else{let z=new v(Q.error.code,Q.error.message,Q.error.data);X(z)}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(J4(Q)&&Q.result&&typeof Q.result==="object"){let z=Q.result;if(z.task&&typeof z.task==="object"){let J=z.task;if(typeof J.taskId==="string")G=!0,this._taskProgressTokens.set(J.taskId,Y)}}if(!G)this._progressHandlers.delete(Y);if(J4(Q))W(Q);else{let z=v.fromError(Q.error.code,Q.error.message,Q.error.data);W(z)}}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(z){yield{type:"error",error:z instanceof v?z:new v(g.InternalError,String(z))}}return}let G;try{let z=await this.request(Q,R1,X);if(z.task)G=z.task.taskId,yield{type:"taskCreated",task:z.task};else throw new v(g.InternalError,"Task creation did not return a task");while(!0){let J=await this.getTask({taskId:G},X);if(yield{type:"taskStatus",task:J},W1(J.status)){if(J.status==="completed")yield{type:"result",result:await this.getTaskResult({taskId:G},Y,X)};else if(J.status==="failed")yield{type:"error",error:new v(g.InternalError,`Task ${G} failed`)};else if(J.status==="cancelled")yield{type:"error",error:new v(g.InternalError,`Task ${G} was cancelled`)};return}if(J.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:G},Y,X)};return}let $=J.pollInterval??this._options?.defaultTaskPollInterval??1000;await new Promise((H)=>setTimeout(H,$)),X?.signal?.throwIfAborted()}}catch(z){yield{type:"error",error:z instanceof v?z:new v(g.InternalError,String(z))}}}request(Q,Y,X){let{relatedRequestId:W,resumptionToken:G,onresumptiontoken:z,task:J,relatedTask:$}=X??{};return new Promise((H,A)=>{let U=(M)=>{A(M)};if(!this._transport){U(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod(Q.method),J)this.assertTaskCapability(Q.method)}catch(M){U(M);return}X?.signal?.throwIfAborted();let K=this._requestMessageId++,D={...Q,jsonrpc:"2.0",id:K};if(X?.onprogress)this._progressHandlers.set(K,X.onprogress),D.params={...Q.params,_meta:{...Q.params?._meta||{},progressToken:K}};if(J)D.params={...D.params,task:J};if($)D.params={...D.params,_meta:{...D.params?._meta||{},[X1]:$}};let L=(M)=>{this._responseHandlers.delete(K),this._progressHandlers.delete(K),this._cleanupTimeout(K),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:K,reason:String(M)}},{relatedRequestId:W,resumptionToken:G,onresumptiontoken:z}).catch((E)=>this._onerror(Error(`Failed to send cancellation: ${E}`)));let S=M instanceof v?M:new v(g.RequestTimeout,String(M));A(S)};this._responseHandlers.set(K,(M)=>{if(X?.signal?.aborted)return;if(M instanceof Error)return A(M);try{let S=Y1(Y,M.result);if(!S.success)A(S.error);else H(S.data)}catch(S){A(S)}}),X?.signal?.addEventListener("abort",()=>{L(X?.signal?.reason)});let q=X?.timeout??sU,O=()=>L(v.fromError(g.RequestTimeout,"Request timed out",{timeout:q}));this._setupTimeout(K,q,X?.maxTotalTimeout,O,X?.resetTimeoutOnProgress??!1);let V=$?.taskId;if(V){let M=(S)=>{let E=this._responseHandlers.get(K);if(E)E(S);else this._onerror(Error(`Response handler missing for side-channeled request ${K}`))};this._requestResolvers.set(K,M),this._enqueueTaskMessage(V,{type:"request",message:D,timestamp:Date.now()}).catch((S)=>{this._cleanupTimeout(K),A(S)})}else this._transport.send(D,{relatedRequestId:W,resumptionToken:G,onresumptiontoken:z}).catch((M)=>{this._cleanupTimeout(K),A(M)})})}async getTask(Q,Y){return this.request({method:"tasks/get",params:Q},O6,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},N6,Y)}async cancelTask(Q,Y){return this.request({method:"tasks/cancel",params:Q},OG,Y)}async notification(Q,Y){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(Q.method);let X=Y?.relatedTask?.taskId;if(X){let J={...Q,jsonrpc:"2.0",params:{...Q.params,_meta:{...Q.params?._meta||{},[X1]:Y.relatedTask}}};await this._enqueueTaskMessage(X,{type:"notification",message:J,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 J={...Q,jsonrpc:"2.0"};if(Y?.relatedTask)J={...J,params:{...J.params,_meta:{...J.params?._meta||{},[X1]:Y.relatedTask}}};this._transport?.send(J,Y).catch(($)=>this._onerror($))});return}let z={...Q,jsonrpc:"2.0"};if(Y?.relatedTask)z={...z,params:{...z.params,_meta:{...z.params?._meta||{},[X1]:Y.relatedTask}}};await this._transport.send(z,Y)}setRequestHandler(Q,Y){let X=VY(Q);this.assertRequestHandlerCapability(X),this._requestHandlers.set(X,(W,G)=>{let z=NY(Q,W);return Promise.resolve(Y(z,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=VY(Q);this._notificationHandlers.set(X,(W)=>{let G=NY(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"&&YY(W.message)){let G=W.message.id,z=this._requestResolvers.get(G);if(z)z(new v(g.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 v(g.InvalidRequest,"Request cancelled"));return}let z=setTimeout(W,X);Y.addEventListener("abort",()=>{clearTimeout(z),G(new v(g.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 v(g.InvalidParams,"Failed to retrieve task: Task not found");return G},storeTaskResult:async(W,G,z)=>{await X.storeTaskResult(W,G,z,Y);let J=await X.getTask(W,Y);if(J){let $=K4.parse({method:"notifications/tasks/status",params:J});if(await this.notification($),W1(J.status))this._cleanupTaskProgressHandler(W)}},getTaskResult:(W)=>{return X.getTaskResult(W,Y)},updateTaskStatus:async(W,G,z)=>{let J=await X.getTask(W,Y);if(!J)throw new v(g.InvalidParams,`Task "${W}" not found - it may have been cleaned up`);if(W1(J.status))throw new v(g.InvalidParams,`Cannot update task "${W}" from terminal status "${J.status}" to "${G}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await X.updateTaskStatus(W,G,z,Y);let $=await X.getTask(W,Y);if($){let H=K4.parse({method:"notifications/tasks/status",params:$});if(await this.notification(H),W1($.status))this._cleanupTaskProgressHandler(W)}},listTasks:(W)=>{return X.listTasks(W,Y)}}}}function PG(Q){return Q!==null&&typeof Q==="object"&&!Array.isArray(Q)}function jG(Q,Y){let X={...Q};for(let W in Y){let G=W,z=Y[G];if(z===void 0)continue;let J=X[G];if(PG(J)&&PG(z))X[G]={...J,...z};else X[G]=z}return X}var X5=k9(F9(),1),W5=k9(Y5(),1);function $M(){let Q=new X5.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return W5.default(Q),Q}class j9{constructor(Q){this._ajv=Q??$M()}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 I9{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 G5(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 z5(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 E9 extends ZY{constructor(Q,Y){super(Y);if(this._serverInfo=Q,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(L4.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 j9,this.setRequestHandler(GY,(X)=>this._oninitialize(X)),this.setNotificationHandler(zY,()=>this.oninitialized?.()),this._capabilities.logging)this.setRequestHandler(FY,async(X,W)=>{let G=W.sessionId||W.requestInfo?.headers["mcp-session-id"]||void 0,{level:z}=X.params,J=L4.safeParse(z);if(J.success)this._loggingLevels.set(G,J.data);return{}})}get experimental(){if(!this._experimental)this._experimental={tasks:new I9(this)};return this._experimental}registerCapabilities(Q){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=jG(this._capabilities,Q)}setRequestHandler(Q,Y){let W=J6(Q)?.method;if(!W)throw Error("Schema is missing a method literal");let G;if(T1(W)){let J=W;G=J._zod?.def?.value??J.value}else{let J=W;G=J._def?.value??J.value}if(typeof G!=="string")throw Error("Schema method literal must be a string");if(G==="tools/call"){let J=async($,H)=>{let A=Y1(B4,$);if(!A.success){let L=A.error instanceof Error?A.error.message:String(A.error);throw new v(g.InvalidParams,`Invalid tools/call request: ${L}`)}let{params:U}=A.data,K=await Promise.resolve(Y($,H));if(U.task){let L=Y1(R1,K);if(!L.success){let q=L.error instanceof Error?L.error.message:String(L.error);throw new v(g.InvalidParams,`Invalid task creation result: ${q}`)}return L.data}let D=Y1(w6,K);if(!D.success){let L=D.error instanceof Error?D.error.message:String(D.error);throw new v(g.InvalidParams,`Invalid tools/call result: ${L}`)}return D.data};return super.setRequestHandler(Q,J)}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){z5(this._clientCapabilities?.tasks?.requests,Q,"Client")}assertTaskHandlerCapability(Q){if(!this._capabilities)return;G5(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:HG.includes(Y)?Y:eQ,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"},D6)}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"),z=Q.messages.length>1?Q.messages[Q.messages.length-2]:void 0,J=z?Array.isArray(z.content)?z.content:[z.content]:[],$=J.some((H)=>H.type==="tool_use");if(G){if(W.some((H)=>H.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!$)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if($){let H=new Set(J.filter((U)=>U.type==="tool_use").map((U)=>U.id)),A=new Set(W.filter((U)=>U.type==="tool_result").map((U)=>U.toolUseId));if(H.size!==A.size||![...H].every((U)=>A.has(U)))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},OY,Y);return this.request({method:"sampling/createMessage",params:Q},qY,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},b6,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},b6,Y);if(G.action==="accept"&&G.content&&W.requestedSchema)try{let J=this._jsonSchemaValidator.getValidator(W.requestedSchema)(G.content);if(!J.valid)throw new v(g.InvalidParams,`Elicitation response content does not match requested schema: ${J.errorMessage}`)}catch(z){if(z instanceof v)throw z;throw new v(g.InternalError,`Error validating elicitation response: ${z instanceof Error?z.message:String(z)}`)}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},MY,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 J5={name:"@sequenzy/mcp",version:"0.0.46",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 T9=["product-info","domain","tracking","localization","integrations","products","events","tags","labels","goals","sync-rules","api-keys","widgets","team","danger"],$5={dashboard:"/dashboard/company/{companyId}",campaigns:"/dashboard/company/{companyId}/campaign",campaign:"/dashboard/company/{companyId}/campaign/{campaignId}",campaignPreview:"/dashboard/company/{companyId}/campaign/{campaignId}?step=review",campaignList:"/dashboard/company/{companyId}/campaign/list/{status}",sequences:"/dashboard/company/{companyId}/sequences",sequence:"/dashboard/company/{companyId}/sequences/{sequenceId}",sequenceList:"/dashboard/company/{companyId}/sequences/list/{status}",settings:"/dashboard/company/{companyId}/settings",settingsTab:"/dashboard/company/{companyId}/settings?tab={tab}",emails:"/dashboard/company/{companyId}/emails",email:"/dashboard/company/{companyId}/emails/{emailId}",subscribers:"/dashboard/company/{companyId}/subscribers",sentEmails:"/dashboard/company/{companyId}/sent-emails",emailSend:"/dashboard/company/{companyId}/sent-emails/{emailSendId}",segments:"/dashboard/company/{companyId}/segments",metrics:"/dashboard/company/{companyId}/metrics",transactional:"/dashboard/company/{companyId}/transactional",transactionalEmail:"/dashboard/company/{companyId}/transactional/{transactionalId}",domain:"/dashboard/company/{companyId}/settings/domain/{domainId}",domainVerify:"/dashboard/company/{companyId}/settings/domain/{domainId}/verify"};function AM(Q){let X=(Q??process.env.SEQUENZY_APP_URL??"https://sequenzy.com").trim().replace(/\/+$/,"");return X.length>0?X:"https://sequenzy.com"}function h0(Q){let Y=Q?.trim();return Y?Y:void 0}function t0(Q){return encodeURIComponent(Q)}function Q0(Q,Y){return`${Q}${Y}`}function Y0(Q,Y=""){return`/dashboard/company/${t0(Q)}${Y}`}function H5(Q,Y,X){return Q0(Q,`${Y0(Y,"/settings")}?tab=${encodeURIComponent(X)}`)}function UM(Q,Y){let X=T9.map((W)=>[W,Y?H5(Q,Y,W):""]);return Object.fromEntries(X)}function K1(Q={},Y){let X=AM(Y),W=h0(Q.companyId),G={},z=UM(X,W);if(!W)return{appUrl:X,routeTemplates:$5,settingsTabValues:T9,urls:G,settingsUrls:z};G.dashboard=Q0(X,Y0(W)),G.campaigns=Q0(X,Y0(W,"/campaign")),G.sequences=Q0(X,Y0(W,"/sequences")),G.settings=Q0(X,Y0(W,"/settings")),G.emails=Q0(X,Y0(W,"/emails")),G.subscribers=Q0(X,Y0(W,"/subscribers")),G.sentEmails=Q0(X,Y0(W,"/sent-emails")),G.segments=Q0(X,Y0(W,"/segments")),G.metrics=Q0(X,Y0(W,"/metrics")),G.transactional=Q0(X,Y0(W,"/transactional"));let J=h0(Q.campaignId);if(J)G.campaign=Q0(X,Y0(W,`/campaign/${t0(J)}`)),G.campaignPreview=`${G.campaign}?step=review`;let $=h0(Q.sequenceId);if($)G.sequence=Q0(X,Y0(W,`/sequences/${t0($)}`));let H=h0(Q.emailId)??h0(Q.templateId);if(H)G.email=Q0(X,Y0(W,`/emails/${t0(H)}`)),G.template=G.email;let A=h0(Q.transactionalId);if(A)G.transactionalEmail=Q0(X,Y0(W,`/transactional/${t0(A)}`));let U=h0(Q.emailSendId);if(U)G.emailSend=Q0(X,Y0(W,`/sent-emails/${t0(U)}`));let K=h0(Q.domainId);if(K)G.domain=Q0(X,Y0(W,`/settings/domain/${t0(K)}`)),G.domainVerify=`${G.domain}/verify`;let D=h0(Q.status);if(D)G.campaignList=Q0(X,Y0(W,`/campaign/list/${t0(D)}`)),G.sequenceList=Q0(X,Y0(W,`/sequences/list/${t0(D)}`));let L=h0(Q.settingsTab);if(L)G.settingsTab=H5(X,W,L);return{appUrl:X,routeTemplates:$5,settingsTabValues:T9,urls:G,settingsUrls:z}}var A5=[{uri:"sequenzy://dashboard",name:"Dashboard Overview",description:"Live overview stats for the last 7 days",mimeType:"application/json"},{uri:"sequenzy://company",name:"Current Company",description:"The currently selected company, including localization settings",mimeType:"application/json"},{uri:"sequenzy://campaigns/recent",name:"Recent Campaigns",description:"Last 10 campaigns with status and basic stats",mimeType:"application/json"},{uri:"sequenzy://subscribers/recent",name:"Recent Subscribers",description:"Most recently added subscribers",mimeType:"application/json"},{uri:"sequenzy://subscribers/engaged",name:"Engaged Subscribers",description:"Most active/engaged subscribers",mimeType:"application/json"},{uri:"sequenzy://sequences",name:"Sequences",description:"All email sequences with status",mimeType:"application/json"},{uri:"sequenzy://templates",name:"Templates",description:"All available email templates with localization status",mimeType:"application/json"},{uri:"sequenzy://segments",name:"Segments",description:"All defined segments with subscriber counts",mimeType:"application/json"},{uri:"sequenzy://tags",name:"Tags",description:"All tags with usage counts",mimeType:"application/json"},{uri:"sequenzy://health",name:"Deliverability Health",description:"Email deliverability metrics and health status",mimeType:"application/json"},{uri:"sequenzy://app-routes",name:"Dashboard URL Routes",description:"Route templates and settings tabs for building Sequenzy dashboard links",mimeType:"application/json"}];async function U5(Q){try{let Y;switch(Q){case"sequenzy://dashboard":Y=await N("GET","/api/v1/metrics?period=7d");break;case"sequenzy://company":{let X=await N("GET","/api/v1/account"),W=B1()??X.currentCompanyId;if(!W)throw Error("No company available. Create or select a company first.");Y=await N("GET",`/api/v1/companies/${W}`);break}case"sequenzy://campaigns/recent":Y=await N("GET","/api/v1/campaigns?limit=10");break;case"sequenzy://subscribers/recent":Y=await N("GET","/api/v1/subscribers?sort=createdAt&limit=20");break;case"sequenzy://subscribers/engaged":Y=await N("GET","/api/v1/subscribers?sort=engagement&limit=20");break;case"sequenzy://sequences":Y=await N("GET","/api/v1/sequences");break;case"sequenzy://templates":Y=await N("GET","/api/v1/templates");break;case"sequenzy://segments":Y=await N("GET","/api/v1/segments");break;case"sequenzy://tags":Y=await N("GET","/api/v1/tags");break;case"sequenzy://health":Y=await N("GET","/api/v1/health/deliverability");break;case"sequenzy://app-routes":Y=K1();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:b1(Y)}]}}}var h4="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: [...] }.",HQ="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`.",B5="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.",KM={type:"object",properties:{id:{type:"string",description:"Optional filter ID. Any stable string works; one will be generated if omitted."},field:{type:"string",enum:["status","tag","email","emailProvider","added","firstName","lastName","list","emailSent","emailOpened","emailClicked","emailBounced","emailComplained","attribute","event","segment","stripeProduct","stripeCurrentProduct","stripeTrialProduct"],description:"Filter field. Use `event` for custom subscriber events, `segment` for saved segment membership, and `stripeProduct`/`stripeCurrentProduct`/`stripeTrialProduct` for Stripe product-based segments. Engagement fields (`emailSent`, `emailOpened`, `emailClicked`, `emailBounced`, `emailComplained`) accept a time range as the value or a specific campaign via `campaign:<campaign_id>`."},operator:{type:"string",enum:["is","is_not","is_empty","is_not_empty","contains","not_contains","less_than","more_than","at_least","less_than_count","gte","lte","gt","lt"],description:"Filter operator. Use `is_empty` or `is_not_empty` for fields that can be blank, including custom attributes. For `stripeProduct`, use `is` or `is_not` with a raw product ID, and `at_least` or `less_than_count` with `productId:count`. For `stripeCurrentProduct` and `stripeTrialProduct`, use a raw product ID for current/trialing checks, or product-scoped values like `productId:is_canceled`, `productId:cancels_at:2026-05-26`, `productId:end_at:2026-05-26`, and `productId:start_at:7 days ago` with `is`, `is_not`, `gte`, `lte`, `gt`, or `lt` as appropriate. For `event`, use `is`, `is_not`, `at_least`, or `less_than_count`. For engagement fields, use `is` (event happened) or `is_not` (event did not happen)."},value:{type:"string",description:"Filter value. For custom attribute empty checks, use `attributeName:` such as `last_logged_in:`. Event examples: `saas.purchase:30d`, `saas.purchase:all`, or `saas.purchase:5:30d` for thresholds. Segment values are segment IDs. Stripe product examples: `prod_123` for bought/didn't buy/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},DM={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 L5(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 F5(Q){if(typeof Q!=="object"||Q===null)return Q;let Y=Q;if(Y.kind==="filter"){let X=L5([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(F5):[]}}function w1(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 UQ(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 BM(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`.")}function LM(Q){if(Q.clearEnrollmentFieldPath===!0&&Q.enrollmentFieldPath!==void 0)throw Error("Provide either `enrollmentFieldPath` or `clearEnrollmentFieldPath` when calling `update_sequence`, not both.");let Y={...Q};if(delete Y.clearEnrollmentFieldPath,Q.clearEnrollmentFieldPath===!0)Y.enrollmentFieldPath=null;return Y}function FM(Q){let Y=j(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(($)=>typeof $==="string"?$.trim():"").filter(($)=>$.length>0)??[];if(W?.some(($)=>typeof $!=="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 z=j(Q,"fieldPath"),J=j(Q,"reason");return{...Y!==void 0&&{subscriberId:Y},...z!==void 0&&{fieldPath:z},...G.length>0&&{fieldValues:G},...typeof Q.dryRun==="boolean"&&{dryRun:Q.dryRun},...J!==void 0&&{reason:J}}}function qM(Q){w1("create_campaign",Q),UQ("create_campaign",Q);let Y=j(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&&j(Q,"subject")===void 0)throw Error("`subject` is required unless `prompt` is provided when calling `create_campaign`.")}function OM(Q){if(j(Q,"scheduledAt")===void 0)throw Error("`scheduledAt` is required when calling `schedule_campaign`.");if(Q.targetLists!==void 0&&!B0(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 MM(Q){w1("create_transactional_email",Q);let Y=j(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&&j(Q,"subject")===void 0)throw Error("`subject` is required unless `prompt` is provided when calling `create_transactional_email`.")}var K5={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:B5,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 VM(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 B0(Q){return typeof Q==="object"&&Q!==null&&!Array.isArray(Q)}function D5(Q){return Q.trim().toLowerCase().replace(/\s+/g,"-")}function NM(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.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 ZM(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=[],z=1,J=0,$=0,H=0;while(!0){let U=NM({query:Q.query,tags:Q.tags,segmentId:Q.segmentId,status:Q.status,page:z,pageSize:W}),K=await N("GET",`/api/v1/subscribers?${U.toString()}`,void 0,Y);J=K.pagination?.total??K.subscribers.length,$=K.pagination?.totalPages??1,H+=1,G.push(...K.subscribers??[]);let D=X!==void 0&&G.length>=X,L=K.pagination?z>=K.pagination.totalPages:(K.subscribers??[]).length<W;if(D||L)break;z+=1}let A=X!==void 0?G.slice(0,X):G;return{success:!0,subscribers:A,pagination:{page:1,limit:W,total:J,totalPages:$,fetchedPages:H},returned:A.length,truncated:X!==void 0&&J>0&&A.length<J}}function wM(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 f4(Q,Y){let X=wM(Y);if(!X.email&&!X.externalId)throw Error(`Provide either \`email\` or \`externalId\` when calling \`${Q}\`.`);return X}function R9(Q){if(Q.email)return`/api/v1/subscribers/${encodeURIComponent(Q.email)}`;return`/api/v1/subscribers/external?externalId=${encodeURIComponent(String(Q.externalId))}`}async function S9(Q,Y){return N("GET",R9(Q),void 0,Y)}function j(Q,Y){let X=Q[Y];if(typeof X!=="string")return;let W=X.trim();return W.length>0?W:void 0}async function q5(Q){let Y=j(Q,"companyId");if(Y)return Y;let X=B1();if(X)return X;try{return(await N("GET","/api/v1/account")).currentCompanyId??void 0}catch{return}}function l4(Q,Y){if(!B0(Q)||!Y)return Q;return{...Q,url:Y}}function O5(Q,Y){if(!B0(Q))return Q;return{...Q,...Y.campaign!==void 0&&{url:Y.campaign},...Y.campaignPreview!==void 0&&{previewUrl:Y.campaignPreview}}}function AQ(Q,Y,X){if(!Array.isArray(Q)||!Y)return Q;return Q.map((W)=>{if(!B0(W))return W;let G=j(W,"id");if(!G)return W;let z=K1({companyId:Y,...X==="campaign"&&{campaignId:G},...X==="sequence"&&{sequenceId:G},...X==="template"&&{emailId:G},...X==="transactional"&&{transactionalId:G}});if(X==="campaign")return O5(W,z.urls);let J=X==="sequence"?z.urls.sequence:X==="template"?z.urls.email:z.urls.transactionalEmail;return l4(W,J)})}function bM(Q){if(!Array.isArray(Q))return Q;return Q.map((Y)=>{if(!B0(Y))return Y;let X=j(Y,"id");if(!X)return Y;let W=K1({companyId:X});return{...Y,url:W.urls.dashboard,settingsUrl:W.urls.settings}})}var PM=new Set(["get_account","select_company","create_company","get_company","list_campaigns","get_campaign","get_email_send","create_campaign","update_campaign","schedule_campaign","send_test_email","list_sequences","get_sequence","create_sequence","update_sequence","enable_sequence","disable_sequence","cancel_sequence_enrollments","list_ab_tests","get_ab_test","get_ab_test_stats","update_ab_test_variant","list_templates","get_template","create_template","update_template","list_transactional_emails","get_transactional_email","create_transactional_email","update_transactional_email"]);async function jM(Q,Y,X){if(!B0(X)||!PM.has(Q))return X;let W=B0(X.company)?X.company:void 0,z=j(X,"selectedCompanyId")??j(X,"currentCompanyId")??j(X,"companyId")??(W?j(W,"id"):void 0)??(W?j(W,"companyId"):void 0)??await q5(Y);if(!z)return X;let J=B0(X.campaign)?X.campaign:void 0,$=B0(X.sequence)?X.sequence:void 0,H=B0(X.template)?X.template:void 0,A=B0(X.transactional)&&!Array.isArray(X.transactional)?X.transactional:void 0,U={companyId:z,campaignId:j(Y,"campaignId")??j(X,"campaignId")??(J?j(J,"id"):void 0),sequenceId:j(Y,"sequenceId")??j(X,"sequenceId")??($?j($,"id"):void 0),emailId:j(X,"templateId")??(H?j(H,"id"):void 0)??(A?j(A,"emailId"):void 0)??j(Y,"templateId"),transactionalId:j(Y,"transactionalId")??(A?j(A,"id"):void 0)??j(Y,"idOrSlug"),emailSendId:j(Y,"emailSendId")??j(X,"emailSendId")??(B0(X.emailSend)?j(X.emailSend,"id"):void 0),status:j(Y,"status")},K=K1(U),D=W?K1({companyId:z}):void 0;return{...X,...Array.isArray(X.companies)&&{companies:bM(X.companies)},...Array.isArray(X.campaigns)&&{campaigns:AQ(X.campaigns,z,"campaign")},...Array.isArray(X.sequences)&&{sequences:AQ(X.sequences,z,"sequence")},...Array.isArray(X.templates)&&{templates:AQ(X.templates,z,"template")},...Array.isArray(X.transactional)&&{transactional:AQ(X.transactional,z,"transactional")},...W&&D!==void 0&&{company:{...W,url:D.urls.dashboard,settingsUrl:D.urls.settings}},...J&&K.urls.campaign!==void 0&&{campaign:O5(J,K.urls)},...$&&K.urls.sequence!==void 0&&{sequence:l4($,K.urls.sequence)},...H&&K.urls.email!==void 0&&{template:l4(H,K.urls.email)},...A&&K.urls.transactionalEmail!==void 0&&{transactional:l4(A,K.urls.transactionalEmail)},...B0(X.emailSend)&&K.urls.emailSend!==void 0&&{emailSend:l4(X.emailSend,K.urls.emailSend)},appUrls:K.urls}}var M5=[{name:"get_account",description:`Get current account information including available companies. IMPORTANT: If you have access to multiple companies, you MUST either:
|
|
28
|
+
`)}L.write("payload.value = newResult;"),L.write("return payload;");let S=L.compile();return(E,x)=>S(D,E,x)},z,J=L1,$=!m4.jitless,A=$&&V6.value,U=Y.catchall,K;Q._zod.parse=(D,L)=>{K??(K=W.value);let q=D.value;if(!J(q))return D.issues.push({expected:"object",code:"invalid_type",input:q,inst:Q}),D;if($&&A&&L?.async===!1&&L.jitless!==!0){if(!z)z=G(Y.shape);if(D=z(D,L),!U)return D;return kX([],q,D,L,K,Q)}return X(D,L)}});function o8(Q,Y,X,W){for(let z of Q)if(z.issues.length===0)return Y.value=z.value,Y;let G=Q.filter((z)=>!Q1(z));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((z)=>z.issues.map((J)=>T0(J,W,w0())))}),Y}var C6=F("$ZodUnion",(Q,Y)=>{i.init(Q,Y),m(Q._zod,"optin",()=>Y.options.some((G)=>G._zod.optin==="optional")?"optional":void 0),m(Q._zod,"optout",()=>Y.options.some((G)=>G._zod.optout==="optional")?"optional":void 0),m(Q._zod,"values",()=>{if(Y.options.every((G)=>G._zod.values))return new Set(Y.options.flatMap((G)=>Array.from(G._zod.values)));return}),m(Q._zod,"pattern",()=>{if(Y.options.every((G)=>G._zod.pattern)){let G=Y.options.map((z)=>z._zod.pattern);return new RegExp(`^(${G.map((z)=>d1(z.source)).join("|")})$`)}return});let X=Y.options.length===1,W=Y.options[0]._zod.run;Q._zod.parse=(G,z)=>{if(X)return W(G,z);let J=!1,$=[];for(let H of Y.options){let A=H._zod.run({value:G.value,issues:[]},z);if(A instanceof Promise)$.push(A),J=!0;else{if(A.issues.length===0)return A;$.push(A)}}if(!J)return o8($,G,Q,z);return Promise.all($).then((H)=>{return o8(H,G,Q,z)})}}),_X=F("$ZodDiscriminatedUnion",(Q,Y)=>{C6.init(Q,Y);let X=Q._zod.parse;m(Q._zod,"propValues",()=>{let G={};for(let z of Y.options){let J=z._zod.propValues;if(!J||Object.keys(J).length===0)throw Error(`Invalid discriminated union option at index "${Y.options.indexOf(z)}"`);for(let[$,H]of Object.entries(J)){if(!G[$])G[$]=new Set;for(let A of H)G[$].add(A)}}return G});let W=j1(()=>{let G=Y.options,z=new Map;for(let J of G){let $=J._zod.propValues?.[Y.discriminator];if(!$||$.size===0)throw Error(`Invalid discriminated union option at index "${Y.options.indexOf(J)}"`);for(let H of $){if(z.has(H))throw Error(`Duplicate discriminator value "${String(H)}"`);z.set(H,J)}}return z});Q._zod.parse=(G,z)=>{let J=G.value;if(!L1(J))return G.issues.push({code:"invalid_type",expected:"object",input:J,inst:Q}),G;let $=W.value.get(J?.[Y.discriminator]);if($)return $._zod.run(G,z);if(Y.unionFallback)return X(G,z);return G.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:Y.discriminator,input:J,path:[Y.discriminator],inst:Q}),G}}),gX=F("$ZodIntersection",(Q,Y)=>{i.init(Q,Y),Q._zod.parse=(X,W)=>{let G=X.value,z=Y.left._zod.run({value:G,issues:[]},W),J=Y.right._zod.run({value:G,issues:[]},W);if(z instanceof Promise||J instanceof Promise)return Promise.all([z,J]).then(([H,A])=>{return t8(X,H,A)});return t8(X,z,J)}});function S6(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(e0(Q)&&e0(Y)){let X=Object.keys(Y),W=Object.keys(Q).filter((z)=>X.indexOf(z)!==-1),G={...Q,...Y};for(let z of W){let J=S6(Q[z],Y[z]);if(!J.valid)return{valid:!1,mergeErrorPath:[z,...J.mergeErrorPath]};G[z]=J.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],z=Y[W],J=S6(G,z);if(!J.valid)return{valid:!1,mergeErrorPath:[W,...J.mergeErrorPath]};X.push(J.data)}return{valid:!0,data:X}}return{valid:!1,mergeErrorPath:[]}}function t8(Q,Y,X){if(Y.issues.length)Q.issues.push(...Y.issues);if(X.issues.length)Q.issues.push(...X.issues);if(Q1(Q))return Q;let W=S6(Y.value,X.value);if(!W.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(W.mergeErrorPath)}`);return Q.value=W.data,Q}var yX=F("$ZodRecord",(Q,Y)=>{i.init(Q,Y),Q._zod.parse=(X,W)=>{let G=X.value;if(!e0(G))return X.issues.push({expected:"record",code:"invalid_type",input:G,inst:Q}),X;let z=[];if(Y.keyType._zod.values){let J=Y.keyType._zod.values;X.value={};for(let H of J)if(typeof H==="string"||typeof H==="number"||typeof H==="symbol"){let A=Y.valueType._zod.run({value:G[H],issues:[]},W);if(A instanceof Promise)z.push(A.then((U)=>{if(U.issues.length)X.issues.push(...c0(H,U.issues));X.value[H]=U.value}));else{if(A.issues.length)X.issues.push(...c0(H,A.issues));X.value[H]=A.value}}let $;for(let H in G)if(!J.has(H))$=$??[],$.push(H);if($&&$.length>0)X.issues.push({code:"unrecognized_keys",input:G,inst:Q,keys:$})}else{X.value={};for(let J of Reflect.ownKeys(G)){if(J==="__proto__")continue;let $=Y.keyType._zod.run({value:J,issues:[]},W);if($ instanceof Promise)throw Error("Async schemas not supported in object keys currently");if($.issues.length){X.issues.push({code:"invalid_key",origin:"record",issues:$.issues.map((A)=>T0(A,W,w0())),input:J,path:[J],inst:Q}),X.value[$.value]=$.value;continue}let H=Y.valueType._zod.run({value:G[J],issues:[]},W);if(H instanceof Promise)z.push(H.then((A)=>{if(A.issues.length)X.issues.push(...c0(J,A.issues));X.value[$.value]=A.value}));else{if(H.issues.length)X.issues.push(...c0(J,H.issues));X.value[$.value]=H.value}}}if(z.length)return Promise.all(z).then(()=>X);return X}});var uX=F("$ZodEnum",(Q,Y)=>{i.init(Q,Y);let X=O6(Y.entries),W=new Set(X);Q._zod.values=W,Q._zod.pattern=new RegExp(`^(${X.filter((G)=>N6.has(typeof G)).map((G)=>typeof G==="string"?m0(G):G.toString()).join("|")})$`),Q._zod.parse=(G,z)=>{let J=G.value;if(W.has(J))return G;return G.issues.push({code:"invalid_value",values:X,input:J,inst:Q}),G}}),hX=F("$ZodLiteral",(Q,Y)=>{if(i.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"?m0(X):X?m0(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 fX=F("$ZodTransform",(Q,Y)=>{i.init(Q,Y),Q._zod.parse=(X,W)=>{if(W.direction==="backward")throw new i1(Q.constructor.name);let G=Y.transform(X.value,X);if(W.async)return(G instanceof Promise?G:Promise.resolve(G)).then((J)=>{return X.value=J,X});if(G instanceof Promise)throw new l0;return X.value=G,X}});function a8(Q,Y){if(Q.issues.length&&Y===void 0)return{issues:[],value:void 0};return Q}var lX=F("$ZodOptional",(Q,Y)=>{i.init(Q,Y),Q._zod.optin="optional",Q._zod.optout="optional",m(Q._zod,"values",()=>{return Y.innerType._zod.values?new Set([...Y.innerType._zod.values,void 0]):void 0}),m(Q._zod,"pattern",()=>{let X=Y.innerType._zod.pattern;return X?new RegExp(`^(${d1(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((z)=>a8(z,X.value));return a8(G,X.value)}if(X.value===void 0)return X;return Y.innerType._zod.run(X,W)}}),mX=F("$ZodNullable",(Q,Y)=>{i.init(Q,Y),m(Q._zod,"optin",()=>Y.innerType._zod.optin),m(Q._zod,"optout",()=>Y.innerType._zod.optout),m(Q._zod,"pattern",()=>{let X=Y.innerType._zod.pattern;return X?new RegExp(`^(${d1(X.source)}|null)$`):void 0}),m(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)}}),cX=F("$ZodDefault",(Q,Y)=>{i.init(Q,Y),Q._zod.optin="optional",m(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((z)=>s8(z,Y));return s8(G,Y)}});function s8(Q,Y){if(Q.value===void 0)Q.value=Y.defaultValue;return Q}var pX=F("$ZodPrefault",(Q,Y)=>{i.init(Q,Y),Q._zod.optin="optional",m(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)}}),iX=F("$ZodNonOptional",(Q,Y)=>{i.init(Q,Y),m(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((z)=>e8(z,Q));return e8(G,Q)}});function e8(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 rX=F("$ZodCatch",(Q,Y)=>{i.init(Q,Y),m(Q._zod,"optin",()=>Y.innerType._zod.optin),m(Q._zod,"optout",()=>Y.innerType._zod.optout),m(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((z)=>{if(X.value=z.value,z.issues.length)X.value=Y.catchValue({...X,error:{issues:z.issues.map((J)=>T0(J,W,w0()))},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((z)=>T0(z,W,w0()))},input:X.value}),X.issues=[];return X}});var nX=F("$ZodPipe",(Q,Y)=>{i.init(Q,Y),m(Q._zod,"values",()=>Y.in._zod.values),m(Q._zod,"optin",()=>Y.in._zod.optin),m(Q._zod,"optout",()=>Y.out._zod.optout),m(Q._zod,"propValues",()=>Y.in._zod.propValues),Q._zod.parse=(X,W)=>{if(W.direction==="backward"){let z=Y.out._zod.run(X,W);if(z instanceof Promise)return z.then((J)=>s4(J,Y.in,W));return s4(z,Y.in,W)}let G=Y.in._zod.run(X,W);if(G instanceof Promise)return G.then((z)=>s4(z,Y.out,W));return s4(G,Y.out,W)}});function s4(Q,Y,X){if(Q.issues.length)return Q.aborted=!0,Q;return Y._zod.run({value:Q.value,issues:Q.issues},X)}var dX=F("$ZodReadonly",(Q,Y)=>{i.init(Q,Y),m(Q._zod,"propValues",()=>Y.innerType._zod.propValues),m(Q._zod,"values",()=>Y.innerType._zod.values),m(Q._zod,"optin",()=>Y.innerType._zod.optin),m(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(QX);return QX(G)}});function QX(Q){return Q.value=Object.freeze(Q.value),Q}var oX=F("$ZodCustom",(Q,Y)=>{W0.init(Q,Y),i.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((z)=>YX(z,X,W,Q));YX(G,X,W,Q);return}});function YX(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(I1(G))}}var ZH=(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},wH=()=>{let Q={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function 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 ${ZH(W.input)}`;case"invalid_value":if(W.values.length===1)return`Invalid input: expected ${r4(W.values[0])}`;return`Invalid option: expected one of ${c4(W.values,"|")}`;case"too_big":{let G=W.inclusive?"<=":"<",z=Y(W.origin);if(z)return`Too big: expected ${W.origin??"value"} to have ${G}${W.maximum.toString()} ${z.unit??"elements"}`;return`Too big: expected ${W.origin??"value"} to be ${G}${W.maximum.toString()}`}case"too_small":{let G=W.inclusive?">=":">",z=Y(W.origin);if(z)return`Too small: expected ${W.origin} to have ${G}${W.minimum.toString()} ${z.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":""}: ${c4(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 v6(){return{localeError:wH()}}var KV=Symbol("ZodOutput"),DV=Symbol("ZodInput");class tX{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 bH(){return new tX}var Q4=bH();function aX(Q,Y){return new Q({type:"string",...I(Y)})}function sX(Q,Y){return new Q({type:"string",format:"email",check:"string_format",abort:!1,...I(Y)})}function k6(Q,Y){return new Q({type:"string",format:"guid",check:"string_format",abort:!1,...I(Y)})}function eX(Q,Y){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,...I(Y)})}function QW(Q,Y){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...I(Y)})}function YW(Q,Y){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...I(Y)})}function XW(Q,Y){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...I(Y)})}function WW(Q,Y){return new Q({type:"string",format:"url",check:"string_format",abort:!1,...I(Y)})}function GW(Q,Y){return new Q({type:"string",format:"emoji",check:"string_format",abort:!1,...I(Y)})}function zW(Q,Y){return new Q({type:"string",format:"nanoid",check:"string_format",abort:!1,...I(Y)})}function JW(Q,Y){return new Q({type:"string",format:"cuid",check:"string_format",abort:!1,...I(Y)})}function $W(Q,Y){return new Q({type:"string",format:"cuid2",check:"string_format",abort:!1,...I(Y)})}function HW(Q,Y){return new Q({type:"string",format:"ulid",check:"string_format",abort:!1,...I(Y)})}function AW(Q,Y){return new Q({type:"string",format:"xid",check:"string_format",abort:!1,...I(Y)})}function UW(Q,Y){return new Q({type:"string",format:"ksuid",check:"string_format",abort:!1,...I(Y)})}function KW(Q,Y){return new Q({type:"string",format:"ipv4",check:"string_format",abort:!1,...I(Y)})}function DW(Q,Y){return new Q({type:"string",format:"ipv6",check:"string_format",abort:!1,...I(Y)})}function BW(Q,Y){return new Q({type:"string",format:"cidrv4",check:"string_format",abort:!1,...I(Y)})}function LW(Q,Y){return new Q({type:"string",format:"cidrv6",check:"string_format",abort:!1,...I(Y)})}function FW(Q,Y){return new Q({type:"string",format:"base64",check:"string_format",abort:!1,...I(Y)})}function qW(Q,Y){return new Q({type:"string",format:"base64url",check:"string_format",abort:!1,...I(Y)})}function OW(Q,Y){return new Q({type:"string",format:"e164",check:"string_format",abort:!1,...I(Y)})}function MW(Q,Y){return new Q({type:"string",format:"jwt",check:"string_format",abort:!1,...I(Y)})}function VW(Q,Y){return new Q({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...I(Y)})}function NW(Q,Y){return new Q({type:"string",format:"date",check:"string_format",...I(Y)})}function ZW(Q,Y){return new Q({type:"string",format:"time",check:"string_format",precision:null,...I(Y)})}function wW(Q,Y){return new Q({type:"string",format:"duration",check:"string_format",...I(Y)})}function bW(Q,Y){return new Q({type:"number",checks:[],...I(Y)})}function PW(Q,Y){return new Q({type:"number",check:"number_format",abort:!1,format:"safeint",...I(Y)})}function jW(Q,Y){return new Q({type:"boolean",...I(Y)})}function IW(Q,Y){return new Q({type:"null",...I(Y)})}function EW(Q){return new Q({type:"unknown"})}function TW(Q,Y){return new Q({type:"never",...I(Y)})}function YQ(Q,Y){return new I6({check:"less_than",...I(Y),value:Q,inclusive:!1})}function Y4(Q,Y){return new I6({check:"less_than",...I(Y),value:Q,inclusive:!0})}function XQ(Q,Y){return new E6({check:"greater_than",...I(Y),value:Q,inclusive:!1})}function X4(Q,Y){return new E6({check:"greater_than",...I(Y),value:Q,inclusive:!0})}function WQ(Q,Y){return new x8({check:"multiple_of",...I(Y),value:Q})}function GQ(Q,Y){return new g8({check:"max_length",...I(Y),maximum:Q})}function E1(Q,Y){return new y8({check:"min_length",...I(Y),minimum:Q})}function zQ(Q,Y){return new u8({check:"length_equals",...I(Y),length:Q})}function x6(Q,Y){return new h8({check:"string_format",format:"regex",...I(Y),pattern:Q})}function _6(Q){return new f8({check:"string_format",format:"lowercase",...I(Q)})}function g6(Q){return new l8({check:"string_format",format:"uppercase",...I(Q)})}function y6(Q,Y){return new m8({check:"string_format",format:"includes",...I(Y),includes:Q})}function u6(Q,Y){return new c8({check:"string_format",format:"starts_with",...I(Y),prefix:Q})}function h6(Q,Y){return new p8({check:"string_format",format:"ends_with",...I(Y),suffix:Q})}function F1(Q){return new i8({check:"overwrite",tx:Q})}function f6(Q){return F1((Y)=>Y.normalize(Q))}function l6(){return F1((Q)=>Q.trim())}function m6(){return F1((Q)=>Q.toLowerCase())}function c6(){return F1((Q)=>Q.toUpperCase())}function SW(Q,Y,X){return new Q({type:"array",element:Y,...I(X)})}function RW(Q,Y,X){let W=I(X);return W.abort??(W.abort=!0),new Q({type:"custom",check:"custom",fn:Y,...W})}function CW(Q,Y,X){return new Q({type:"custom",check:"custom",fn:Y,...I(X)})}function vW(Q){let Y=PH((X)=>{return X.addIssue=(W)=>{if(typeof W==="string")X.issues.push(I1(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(I1(G))}},Q(X.value,X)});return Y}function PH(Q,Y){let X=new W0({check:"custom",...I(Y)});return X._zod.check=Q,X}function T1(Q){return!!Q._zod}function Y1(Q,Y){if(T1(Q))return a1(Q,Y);return Q.safeParse(Y)}function JQ(Q){if(!Q)return;let Y;if(T1(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 kW(Q){if(T1(Q)){let z=Q._zod?.def;if(z){if(z.value!==void 0)return z.value;if(Array.isArray(z.values)&&z.values.length>0)return z.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 G4={};_9(G4,{time:()=>r6,duration:()=>n6,datetime:()=>p6,date:()=>i6,ZodISOTime:()=>gW,ZodISODuration:()=>yW,ZodISODateTime:()=>xW,ZodISODate:()=>_W});var xW=F("ZodISODateTime",(Q,Y)=>{BX.init(Q,Y),d.init(Q,Y)});function p6(Q){return VW(xW,Q)}var _W=F("ZodISODate",(Q,Y)=>{LX.init(Q,Y),d.init(Q,Y)});function i6(Q){return NW(_W,Q)}var gW=F("ZodISOTime",(Q,Y)=>{FX.init(Q,Y),d.init(Q,Y)});function r6(Q){return ZW(gW,Q)}var yW=F("ZodISODuration",(Q,Y)=>{qX.init(Q,Y),d.init(Q,Y)});function n6(Q){return wW(yW,Q)}var uW=(Q,Y)=>{n4.init(Q,Y),Q.name="ZodError",Object.defineProperties(Q,{format:{value:(X)=>o9(Q,X)},flatten:{value:(X)=>d9(Q,X)},addIssue:{value:(X)=>{Q.issues.push(X),Q.message=JSON.stringify(Q.issues,P1,2)}},addIssues:{value:(X)=>{Q.issues.push(...X),Q.message=JSON.stringify(Q.issues,P1,2)}},isEmpty:{get(){return Q.issues.length===0}}})},aV=F("ZodError",uW),N0=F("ZodError",uW,{Parent:Error});var hW=d4(N0),fW=o4(N0),lW=t1(N0),mW=s1(N0),cW=t9(N0),pW=a9(N0),iW=s9(N0),rW=e9(N0),nW=Q8(N0),dW=Y8(N0),oW=X8(N0),tW=W8(N0);var s=F("ZodType",(Q,Y)=>{return i.init(Q,Y),Q.def=Y,Q.type=Y.type,Object.defineProperty(Q,"_def",{value:Y}),Q.check=(...X)=>{return Q.clone(h.mergeDefs(Y,{checks:[...Y.checks??[],...X.map((W)=>typeof W==="function"?{_zod:{check:W,def:{check:"custom"},onattach:[]}}:W)]}))},Q.clone=(X,W)=>E0(Q,X,W),Q.brand=()=>Q,Q.register=(X,W)=>{return X.add(Q,W),Q},Q.parse=(X,W)=>hW(Q,X,W,{callee:Q.parse}),Q.safeParse=(X,W)=>lW(Q,X,W),Q.parseAsync=async(X,W)=>fW(Q,X,W,{callee:Q.parseAsync}),Q.safeParseAsync=async(X,W)=>mW(Q,X,W),Q.spa=Q.safeParseAsync,Q.encode=(X,W)=>cW(Q,X,W),Q.decode=(X,W)=>pW(Q,X,W),Q.encodeAsync=async(X,W)=>iW(Q,X,W),Q.decodeAsync=async(X,W)=>rW(Q,X,W),Q.safeEncode=(X,W)=>nW(Q,X,W),Q.safeDecode=(X,W)=>dW(Q,X,W),Q.safeEncodeAsync=async(X,W)=>oW(Q,X,W),Q.safeDecodeAsync=async(X,W)=>tW(Q,X,W),Q.refine=(X,W)=>Q.check(NA(X,W)),Q.superRefine=(X)=>Q.check(ZA(X)),Q.overwrite=(X)=>Q.check(F1(X)),Q.optional=()=>a(Q),Q.nullable=()=>eW(Q),Q.nullish=()=>a(eW(Q)),Q.nonoptional=(X)=>LA(Q,X),Q.array=()=>_(Q),Q.or=(X)=>p([Q,X]),Q.and=(X)=>HQ(Q,X),Q.transform=(X)=>o6(Q,GG(X)),Q.default=(X)=>KA(Q,X),Q.prefault=(X)=>BA(Q,X),Q.catch=(X)=>qA(Q,X),Q.pipe=(X)=>o6(Q,X),Q.readonly=()=>VA(Q),Q.describe=(X)=>{let W=Q.clone();return Q4.add(W,{description:X}),W},Object.defineProperty(Q,"description",{get(){return Q4.get(Q)?.description},configurable:!0}),Q.meta=(...X)=>{if(X.length===0)return Q4.get(Q);let W=Q.clone();return Q4.add(W,X[0]),W},Q.isOptional=()=>Q.safeParse(void 0).success,Q.isNullable=()=>Q.safeParse(null).success,Q}),QG=F("_ZodString",(Q,Y)=>{QQ.init(Q,Y),s.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(x6(...W)),Q.includes=(...W)=>Q.check(y6(...W)),Q.startsWith=(...W)=>Q.check(u6(...W)),Q.endsWith=(...W)=>Q.check(h6(...W)),Q.min=(...W)=>Q.check(E1(...W)),Q.max=(...W)=>Q.check(GQ(...W)),Q.length=(...W)=>Q.check(zQ(...W)),Q.nonempty=(...W)=>Q.check(E1(1,...W)),Q.lowercase=(W)=>Q.check(_6(W)),Q.uppercase=(W)=>Q.check(g6(W)),Q.trim=()=>Q.check(l6()),Q.normalize=(...W)=>Q.check(f6(...W)),Q.toLowerCase=()=>Q.check(m6()),Q.toUpperCase=()=>Q.check(c6())}),kH=F("ZodString",(Q,Y)=>{QQ.init(Q,Y),QG.init(Q,Y),Q.email=(X)=>Q.check(sX(xH,X)),Q.url=(X)=>Q.check(WW(_H,X)),Q.jwt=(X)=>Q.check(MW(tH,X)),Q.emoji=(X)=>Q.check(GW(gH,X)),Q.guid=(X)=>Q.check(k6(aW,X)),Q.uuid=(X)=>Q.check(eX($Q,X)),Q.uuidv4=(X)=>Q.check(QW($Q,X)),Q.uuidv6=(X)=>Q.check(YW($Q,X)),Q.uuidv7=(X)=>Q.check(XW($Q,X)),Q.nanoid=(X)=>Q.check(zW(yH,X)),Q.guid=(X)=>Q.check(k6(aW,X)),Q.cuid=(X)=>Q.check(JW(uH,X)),Q.cuid2=(X)=>Q.check($W(hH,X)),Q.ulid=(X)=>Q.check(HW(fH,X)),Q.base64=(X)=>Q.check(FW(nH,X)),Q.base64url=(X)=>Q.check(qW(dH,X)),Q.xid=(X)=>Q.check(AW(lH,X)),Q.ksuid=(X)=>Q.check(UW(mH,X)),Q.ipv4=(X)=>Q.check(KW(cH,X)),Q.ipv6=(X)=>Q.check(DW(pH,X)),Q.cidrv4=(X)=>Q.check(BW(iH,X)),Q.cidrv6=(X)=>Q.check(LW(rH,X)),Q.e164=(X)=>Q.check(OW(oH,X)),Q.datetime=(X)=>Q.check(p6(X)),Q.date=(X)=>Q.check(i6(X)),Q.time=(X)=>Q.check(r6(X)),Q.duration=(X)=>Q.check(n6(X))});function B(Q){return aX(kH,Q)}var d=F("ZodStringFormat",(Q,Y)=>{r.init(Q,Y),QG.init(Q,Y)}),xH=F("ZodEmail",(Q,Y)=>{GX.init(Q,Y),d.init(Q,Y)});var aW=F("ZodGUID",(Q,Y)=>{XX.init(Q,Y),d.init(Q,Y)});var $Q=F("ZodUUID",(Q,Y)=>{WX.init(Q,Y),d.init(Q,Y)});var _H=F("ZodURL",(Q,Y)=>{zX.init(Q,Y),d.init(Q,Y)});var gH=F("ZodEmoji",(Q,Y)=>{JX.init(Q,Y),d.init(Q,Y)});var yH=F("ZodNanoID",(Q,Y)=>{$X.init(Q,Y),d.init(Q,Y)});var uH=F("ZodCUID",(Q,Y)=>{HX.init(Q,Y),d.init(Q,Y)});var hH=F("ZodCUID2",(Q,Y)=>{AX.init(Q,Y),d.init(Q,Y)});var fH=F("ZodULID",(Q,Y)=>{UX.init(Q,Y),d.init(Q,Y)});var lH=F("ZodXID",(Q,Y)=>{KX.init(Q,Y),d.init(Q,Y)});var mH=F("ZodKSUID",(Q,Y)=>{DX.init(Q,Y),d.init(Q,Y)});var cH=F("ZodIPv4",(Q,Y)=>{OX.init(Q,Y),d.init(Q,Y)});var pH=F("ZodIPv6",(Q,Y)=>{MX.init(Q,Y),d.init(Q,Y)});var iH=F("ZodCIDRv4",(Q,Y)=>{VX.init(Q,Y),d.init(Q,Y)});var rH=F("ZodCIDRv6",(Q,Y)=>{NX.init(Q,Y),d.init(Q,Y)});var nH=F("ZodBase64",(Q,Y)=>{wX.init(Q,Y),d.init(Q,Y)});var dH=F("ZodBase64URL",(Q,Y)=>{bX.init(Q,Y),d.init(Q,Y)});var oH=F("ZodE164",(Q,Y)=>{PX.init(Q,Y),d.init(Q,Y)});var tH=F("ZodJWT",(Q,Y)=>{jX.init(Q,Y),d.init(Q,Y)});var YG=F("ZodNumber",(Q,Y)=>{R6.init(Q,Y),s.init(Q,Y),Q.gt=(W,G)=>Q.check(XQ(W,G)),Q.gte=(W,G)=>Q.check(X4(W,G)),Q.min=(W,G)=>Q.check(X4(W,G)),Q.lt=(W,G)=>Q.check(YQ(W,G)),Q.lte=(W,G)=>Q.check(Y4(W,G)),Q.max=(W,G)=>Q.check(Y4(W,G)),Q.int=(W)=>Q.check(sW(W)),Q.safe=(W)=>Q.check(sW(W)),Q.positive=(W)=>Q.check(XQ(0,W)),Q.nonnegative=(W)=>Q.check(X4(0,W)),Q.negative=(W)=>Q.check(YQ(0,W)),Q.nonpositive=(W)=>Q.check(Y4(0,W)),Q.multipleOf=(W,G)=>Q.check(WQ(W,G)),Q.step=(W,G)=>Q.check(WQ(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 l(Q){return bW(YG,Q)}var aH=F("ZodNumberFormat",(Q,Y)=>{IX.init(Q,Y),YG.init(Q,Y)});function sW(Q){return PW(aH,Q)}var sH=F("ZodBoolean",(Q,Y)=>{EX.init(Q,Y),s.init(Q,Y)});function X0(Q){return jW(sH,Q)}var eH=F("ZodNull",(Q,Y)=>{TX.init(Q,Y),s.init(Q,Y)});function t6(Q){return IW(eH,Q)}var QA=F("ZodUnknown",(Q,Y)=>{SX.init(Q,Y),s.init(Q,Y)});function o(){return EW(QA)}var YA=F("ZodNever",(Q,Y)=>{RX.init(Q,Y),s.init(Q,Y)});function XA(Q){return TW(YA,Q)}var WA=F("ZodArray",(Q,Y)=>{CX.init(Q,Y),s.init(Q,Y),Q.element=Y.element,Q.min=(X,W)=>Q.check(E1(X,W)),Q.nonempty=(X)=>Q.check(E1(1,X)),Q.max=(X,W)=>Q.check(GQ(X,W)),Q.length=(X,W)=>Q.check(zQ(X,W)),Q.unwrap=()=>Q.element});function _(Q,Y){return SW(WA,Q,Y)}var XG=F("ZodObject",(Q,Y)=>{xX.init(Q,Y),s.init(Q,Y),h.defineLazy(Q,"shape",()=>{return Y.shape}),Q.keyof=()=>L0(Object.keys(Q._zod.def.shape)),Q.catchall=(X)=>Q.clone({...Q._zod.def,catchall:X}),Q.passthrough=()=>Q.clone({...Q._zod.def,catchall:o()}),Q.loose=()=>Q.clone({...Q._zod.def,catchall:o()}),Q.strict=()=>Q.clone({...Q._zod.def,catchall:XA()}),Q.strip=()=>Q.clone({...Q._zod.def,catchall:void 0}),Q.extend=(X)=>{return h.extend(Q,X)},Q.safeExtend=(X)=>{return h.safeExtend(Q,X)},Q.merge=(X)=>h.merge(Q,X),Q.pick=(X)=>h.pick(Q,X),Q.omit=(X)=>h.omit(Q,X),Q.partial=(...X)=>h.partial(zG,Q,X[0]),Q.required=(...X)=>h.required(JG,Q,X[0])});function w(Q,Y){let X={type:"object",shape:Q??{},...h.normalizeParams(Y)};return new XG(X)}function U0(Q,Y){return new XG({type:"object",shape:Q,catchall:o(),...h.normalizeParams(Y)})}var WG=F("ZodUnion",(Q,Y)=>{C6.init(Q,Y),s.init(Q,Y),Q.options=Y.options});function p(Q,Y){return new WG({type:"union",options:Q,...h.normalizeParams(Y)})}var GA=F("ZodDiscriminatedUnion",(Q,Y)=>{WG.init(Q,Y),_X.init(Q,Y)});function a6(Q,Y,X){return new GA({type:"union",options:Y,discriminator:Q,...h.normalizeParams(X)})}var zA=F("ZodIntersection",(Q,Y)=>{gX.init(Q,Y),s.init(Q,Y)});function HQ(Q,Y){return new zA({type:"intersection",left:Q,right:Y})}var JA=F("ZodRecord",(Q,Y)=>{yX.init(Q,Y),s.init(Q,Y),Q.keyType=Y.keyType,Q.valueType=Y.valueType});function t(Q,Y,X){return new JA({type:"record",keyType:Q,valueType:Y,...h.normalizeParams(X)})}var d6=F("ZodEnum",(Q,Y)=>{uX.init(Q,Y),s.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 z={};for(let J of W)if(X.has(J))z[J]=Y.entries[J];else throw Error(`Key ${J} not found in enum`);return new d6({...Y,checks:[],...h.normalizeParams(G),entries:z})},Q.exclude=(W,G)=>{let z={...Y.entries};for(let J of W)if(X.has(J))delete z[J];else throw Error(`Key ${J} not found in enum`);return new d6({...Y,checks:[],...h.normalizeParams(G),entries:z})}});function L0(Q,Y){let X=Array.isArray(Q)?Object.fromEntries(Q.map((W)=>[W,W])):Q;return new d6({type:"enum",entries:X,...h.normalizeParams(Y)})}var $A=F("ZodLiteral",(Q,Y)=>{hX.init(Q,Y),s.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 $A({type:"literal",values:Array.isArray(Q)?Q:[Q],...h.normalizeParams(Y)})}var HA=F("ZodTransform",(Q,Y)=>{fX.init(Q,Y),s.init(Q,Y),Q._zod.parse=(X,W)=>{if(W.direction==="backward")throw new i1(Q.constructor.name);X.addIssue=(z)=>{if(typeof z==="string")X.issues.push(h.issue(z,X.value,Y));else{let J=z;if(J.fatal)J.continue=!1;J.code??(J.code="custom"),J.input??(J.input=X.value),J.inst??(J.inst=Q),X.issues.push(h.issue(J))}};let G=Y.transform(X.value,X);if(G instanceof Promise)return G.then((z)=>{return X.value=z,X});return X.value=G,X}});function GG(Q){return new HA({type:"transform",transform:Q})}var zG=F("ZodOptional",(Q,Y)=>{lX.init(Q,Y),s.init(Q,Y),Q.unwrap=()=>Q._zod.def.innerType});function a(Q){return new zG({type:"optional",innerType:Q})}var AA=F("ZodNullable",(Q,Y)=>{mX.init(Q,Y),s.init(Q,Y),Q.unwrap=()=>Q._zod.def.innerType});function eW(Q){return new AA({type:"nullable",innerType:Q})}var UA=F("ZodDefault",(Q,Y)=>{cX.init(Q,Y),s.init(Q,Y),Q.unwrap=()=>Q._zod.def.innerType,Q.removeDefault=Q.unwrap});function KA(Q,Y){return new UA({type:"default",innerType:Q,get defaultValue(){return typeof Y==="function"?Y():h.shallowClone(Y)}})}var DA=F("ZodPrefault",(Q,Y)=>{pX.init(Q,Y),s.init(Q,Y),Q.unwrap=()=>Q._zod.def.innerType});function BA(Q,Y){return new DA({type:"prefault",innerType:Q,get defaultValue(){return typeof Y==="function"?Y():h.shallowClone(Y)}})}var JG=F("ZodNonOptional",(Q,Y)=>{iX.init(Q,Y),s.init(Q,Y),Q.unwrap=()=>Q._zod.def.innerType});function LA(Q,Y){return new JG({type:"nonoptional",innerType:Q,...h.normalizeParams(Y)})}var FA=F("ZodCatch",(Q,Y)=>{rX.init(Q,Y),s.init(Q,Y),Q.unwrap=()=>Q._zod.def.innerType,Q.removeCatch=Q.unwrap});function qA(Q,Y){return new FA({type:"catch",innerType:Q,catchValue:typeof Y==="function"?Y:()=>Y})}var OA=F("ZodPipe",(Q,Y)=>{nX.init(Q,Y),s.init(Q,Y),Q.in=Y.in,Q.out=Y.out});function o6(Q,Y){return new OA({type:"pipe",in:Q,out:Y})}var MA=F("ZodReadonly",(Q,Y)=>{dX.init(Q,Y),s.init(Q,Y),Q.unwrap=()=>Q._zod.def.innerType});function VA(Q){return new MA({type:"readonly",innerType:Q})}var $G=F("ZodCustom",(Q,Y)=>{oX.init(Q,Y),s.init(Q,Y)});function HG(Q,Y){return RW($G,Q??(()=>!0),Y)}function NA(Q,Y={}){return CW($G,Q,Y)}function ZA(Q){return vW(Q)}function s6(Q,Y){return o6(GG(Q),Y)}w0(v6());var e6="2025-11-25";var AG=[e6,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],X1="io.modelcontextprotocol/related-task",UQ="2.0",G0=HG((Q)=>Q!==null&&(typeof Q==="object"||typeof Q==="function")),UG=p([B(),l().int()]),KG=B(),rN=U0({ttl:p([l(),t6()]).optional(),pollInterval:l().optional()}),wA=w({ttl:l().optional()}),bA=w({taskId:B()}),QY=U0({progressToken:UG.optional(),[X1]:bA.optional()}),Z0=w({_meta:QY.optional()}),z4=Z0.extend({task:wA.optional()}),DG=(Q)=>z4.safeParse(Q).success,z0=w({method:B(),params:Z0.loose().optional()}),b0=w({_meta:QY.optional()}),P0=w({method:B(),params:b0.loose().optional()}),J0=U0({_meta:QY.optional()}),KQ=p([B(),l().int()]),BG=w({jsonrpc:b(UQ),id:KQ,...z0.shape}).strict(),YY=(Q)=>BG.safeParse(Q).success,LG=w({jsonrpc:b(UQ),...P0.shape}).strict(),FG=(Q)=>LG.safeParse(Q).success,XY=w({jsonrpc:b(UQ),id:KQ,result:J0}).strict(),J4=(Q)=>XY.safeParse(Q).success;var g;(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"})(g||(g={}));var WY=w({jsonrpc:b(UQ),id:KQ.optional(),error:w({code:l().int(),message:B(),data:o().optional()})}).strict();var qG=(Q)=>WY.safeParse(Q).success;var nN=p([BG,LG,XY,WY]),dN=p([XY,WY]),DQ=J0.strict(),PA=b0.extend({requestId:KQ.optional(),reason:B().optional()}),BQ=P0.extend({method:b("notifications/cancelled"),params:PA}),jA=w({src:B(),mimeType:B().optional(),sizes:_(B()).optional(),theme:L0(["light","dark"]).optional()}),$4=w({icons:_(jA).optional()}),S1=w({name:B(),title:B().optional()}),OG=S1.extend({...S1.shape,...$4.shape,version:B(),websiteUrl:B().optional(),description:B().optional()}),IA=HQ(w({applyDefaults:X0().optional()}),t(B(),o())),EA=s6((Q)=>{if(Q&&typeof Q==="object"&&!Array.isArray(Q)){if(Object.keys(Q).length===0)return{form:{}}}return Q},HQ(w({form:IA.optional(),url:G0.optional()}),t(B(),o()).optional())),TA=U0({list:G0.optional(),cancel:G0.optional(),requests:U0({sampling:U0({createMessage:G0.optional()}).optional(),elicitation:U0({create:G0.optional()}).optional()}).optional()}),SA=U0({list:G0.optional(),cancel:G0.optional(),requests:U0({tools:U0({call:G0.optional()}).optional()}).optional()}),RA=w({experimental:t(B(),G0).optional(),sampling:w({context:G0.optional(),tools:G0.optional()}).optional(),elicitation:EA.optional(),roots:w({listChanged:X0().optional()}).optional(),tasks:TA.optional()}),CA=Z0.extend({protocolVersion:B(),capabilities:RA,clientInfo:OG}),GY=z0.extend({method:b("initialize"),params:CA});var vA=w({experimental:t(B(),G0).optional(),logging:G0.optional(),completions:G0.optional(),prompts:w({listChanged:X0().optional()}).optional(),resources:w({subscribe:X0().optional(),listChanged:X0().optional()}).optional(),tools:w({listChanged:X0().optional()}).optional(),tasks:SA.optional()}),kA=J0.extend({protocolVersion:B(),capabilities:vA,serverInfo:OG,instructions:B().optional()}),zY=P0.extend({method:b("notifications/initialized"),params:b0.optional()});var LQ=z0.extend({method:b("ping"),params:Z0.optional()}),xA=w({progress:l(),total:a(l()),message:a(B())}),_A=w({...b0.shape,...xA.shape,progressToken:UG}),FQ=P0.extend({method:b("notifications/progress"),params:_A}),gA=Z0.extend({cursor:KG.optional()}),H4=z0.extend({params:gA.optional()}),A4=J0.extend({nextCursor:KG.optional()}),yA=L0(["working","input_required","completed","failed","cancelled"]),U4=w({taskId:B(),status:yA,ttl:p([l(),t6()]),createdAt:B(),lastUpdatedAt:B(),pollInterval:a(l()),statusMessage:a(B())}),R1=J0.extend({task:U4}),uA=b0.merge(U4),K4=P0.extend({method:b("notifications/tasks/status"),params:uA}),qQ=z0.extend({method:b("tasks/get"),params:Z0.extend({taskId:B()})}),OQ=J0.merge(U4),MQ=z0.extend({method:b("tasks/result"),params:Z0.extend({taskId:B()})}),oN=J0.loose(),VQ=H4.extend({method:b("tasks/list")}),NQ=A4.extend({tasks:_(U4)}),ZQ=z0.extend({method:b("tasks/cancel"),params:Z0.extend({taskId:B()})}),MG=J0.merge(U4),VG=w({uri:B(),mimeType:a(B()),_meta:t(B(),o()).optional()}),NG=VG.extend({text:B()}),JY=B().refine((Q)=>{try{return atob(Q),!0}catch{return!1}},{message:"Invalid Base64 string"}),ZG=VG.extend({blob:JY}),D4=L0(["user","assistant"]),C1=w({audience:_(D4).optional(),priority:l().min(0).max(1).optional(),lastModified:G4.datetime({offset:!0}).optional()}),wG=w({...S1.shape,...$4.shape,uri:B(),description:a(B()),mimeType:a(B()),annotations:C1.optional(),_meta:a(U0({}))}),hA=w({...S1.shape,...$4.shape,uriTemplate:B(),description:a(B()),mimeType:a(B()),annotations:C1.optional(),_meta:a(U0({}))}),$Y=H4.extend({method:b("resources/list")}),fA=A4.extend({resources:_(wG)}),lA=H4.extend({method:b("resources/templates/list")}),mA=A4.extend({resourceTemplates:_(hA)}),HY=Z0.extend({uri:B()}),cA=HY,AY=z0.extend({method:b("resources/read"),params:cA}),pA=J0.extend({contents:_(p([NG,ZG]))}),iA=P0.extend({method:b("notifications/resources/list_changed"),params:b0.optional()}),rA=HY,nA=z0.extend({method:b("resources/subscribe"),params:rA}),dA=HY,oA=z0.extend({method:b("resources/unsubscribe"),params:dA}),tA=b0.extend({uri:B()}),aA=P0.extend({method:b("notifications/resources/updated"),params:tA}),sA=w({name:B(),description:a(B()),required:a(X0())}),eA=w({...S1.shape,...$4.shape,description:a(B()),arguments:a(_(sA)),_meta:a(U0({}))}),QU=H4.extend({method:b("prompts/list")}),YU=A4.extend({prompts:_(eA)}),XU=Z0.extend({name:B(),arguments:t(B(),B()).optional()}),WU=z0.extend({method:b("prompts/get"),params:XU}),UY=w({type:b("text"),text:B(),annotations:C1.optional(),_meta:t(B(),o()).optional()}),KY=w({type:b("image"),data:JY,mimeType:B(),annotations:C1.optional(),_meta:t(B(),o()).optional()}),DY=w({type:b("audio"),data:JY,mimeType:B(),annotations:C1.optional(),_meta:t(B(),o()).optional()}),GU=w({type:b("tool_use"),name:B(),id:B(),input:t(B(),o()),_meta:t(B(),o()).optional()}),zU=w({type:b("resource"),resource:p([NG,ZG]),annotations:C1.optional(),_meta:t(B(),o()).optional()}),JU=wG.extend({type:b("resource_link")}),BY=p([UY,KY,DY,JU,zU]),$U=w({role:D4,content:BY}),HU=J0.extend({description:B().optional(),messages:_($U)}),AU=P0.extend({method:b("notifications/prompts/list_changed"),params:b0.optional()}),UU=w({title:B().optional(),readOnlyHint:X0().optional(),destructiveHint:X0().optional(),idempotentHint:X0().optional(),openWorldHint:X0().optional()}),KU=w({taskSupport:L0(["required","optional","forbidden"]).optional()}),bG=w({...S1.shape,...$4.shape,description:B().optional(),inputSchema:w({type:b("object"),properties:t(B(),G0).optional(),required:_(B()).optional()}).catchall(o()),outputSchema:w({type:b("object"),properties:t(B(),G0).optional(),required:_(B()).optional()}).catchall(o()).optional(),annotations:UU.optional(),execution:KU.optional(),_meta:t(B(),o()).optional()}),LY=H4.extend({method:b("tools/list")}),DU=A4.extend({tools:_(bG)}),wQ=J0.extend({content:_(BY).default([]),structuredContent:t(B(),o()).optional(),isError:X0().optional()}),tN=wQ.or(J0.extend({toolResult:o()})),BU=z4.extend({name:B(),arguments:t(B(),o()).optional()}),B4=z0.extend({method:b("tools/call"),params:BU}),LU=P0.extend({method:b("notifications/tools/list_changed"),params:b0.optional()}),aN=w({autoRefresh:X0().default(!0),debounceMs:l().int().nonnegative().default(300)}),L4=L0(["debug","info","notice","warning","error","critical","alert","emergency"]),FU=Z0.extend({level:L4}),FY=z0.extend({method:b("logging/setLevel"),params:FU}),qU=b0.extend({level:L4,logger:B().optional(),data:o()}),OU=P0.extend({method:b("notifications/message"),params:qU}),MU=w({name:B().optional()}),VU=w({hints:_(MU).optional(),costPriority:l().min(0).max(1).optional(),speedPriority:l().min(0).max(1).optional(),intelligencePriority:l().min(0).max(1).optional()}),NU=w({mode:L0(["auto","required","none"]).optional()}),ZU=w({type:b("tool_result"),toolUseId:B().describe("The unique identifier for the corresponding tool call."),content:_(BY).default([]),structuredContent:w({}).loose().optional(),isError:X0().optional(),_meta:t(B(),o()).optional()}),wU=a6("type",[UY,KY,DY]),AQ=a6("type",[UY,KY,DY,GU,ZU]),bU=w({role:D4,content:p([AQ,_(AQ)]),_meta:t(B(),o()).optional()}),PU=z4.extend({messages:_(bU),modelPreferences:VU.optional(),systemPrompt:B().optional(),includeContext:L0(["none","thisServer","allServers"]).optional(),temperature:l().optional(),maxTokens:l().int(),stopSequences:_(B()).optional(),metadata:G0.optional(),tools:_(bG).optional(),toolChoice:NU.optional()}),jU=z0.extend({method:b("sampling/createMessage"),params:PU}),qY=J0.extend({model:B(),stopReason:a(L0(["endTurn","stopSequence","maxTokens"]).or(B())),role:D4,content:wU}),OY=J0.extend({model:B(),stopReason:a(L0(["endTurn","stopSequence","maxTokens","toolUse"]).or(B())),role:D4,content:p([AQ,_(AQ)])}),IU=w({type:b("boolean"),title:B().optional(),description:B().optional(),default:X0().optional()}),EU=w({type:b("string"),title:B().optional(),description:B().optional(),minLength:l().optional(),maxLength:l().optional(),format:L0(["email","uri","date","date-time"]).optional(),default:B().optional()}),TU=w({type:L0(["number","integer"]),title:B().optional(),description:B().optional(),minimum:l().optional(),maximum:l().optional(),default:l().optional()}),SU=w({type:b("string"),title:B().optional(),description:B().optional(),enum:_(B()),default:B().optional()}),RU=w({type:b("string"),title:B().optional(),description:B().optional(),oneOf:_(w({const:B(),title:B()})),default:B().optional()}),CU=w({type:b("string"),title:B().optional(),description:B().optional(),enum:_(B()),enumNames:_(B()).optional(),default:B().optional()}),vU=p([SU,RU]),kU=w({type:b("array"),title:B().optional(),description:B().optional(),minItems:l().optional(),maxItems:l().optional(),items:w({type:b("string"),enum:_(B())}),default:_(B()).optional()}),xU=w({type:b("array"),title:B().optional(),description:B().optional(),minItems:l().optional(),maxItems:l().optional(),items:w({anyOf:_(w({const:B(),title:B()}))}),default:_(B()).optional()}),_U=p([kU,xU]),gU=p([CU,vU,_U]),yU=p([gU,IU,EU,TU]),uU=z4.extend({mode:b("form").optional(),message:B(),requestedSchema:w({type:b("object"),properties:t(B(),yU),required:_(B()).optional()})}),hU=z4.extend({mode:b("url"),message:B(),elicitationId:B(),url:B().url()}),fU=p([uU,hU]),lU=z0.extend({method:b("elicitation/create"),params:fU}),mU=b0.extend({elicitationId:B()}),cU=P0.extend({method:b("notifications/elicitation/complete"),params:mU}),bQ=J0.extend({action:L0(["accept","decline","cancel"]),content:s6((Q)=>Q===null?void 0:Q,t(B(),p([B(),l(),X0(),_(B())])).optional())}),pU=w({type:b("ref/resource"),uri:B()});var iU=w({type:b("ref/prompt"),name:B()}),rU=Z0.extend({ref:p([iU,pU]),argument:w({name:B(),value:B()}),context:w({arguments:t(B(),B()).optional()}).optional()}),nU=z0.extend({method:b("completion/complete"),params:rU});var dU=J0.extend({completion:U0({values:_(B()).max(100),total:a(l().int()),hasMore:a(X0())})}),oU=w({uri:B().startsWith("file://"),name:B().optional(),_meta:t(B(),o()).optional()}),tU=z0.extend({method:b("roots/list"),params:Z0.optional()}),MY=J0.extend({roots:_(oU)}),aU=P0.extend({method:b("notifications/roots/list_changed"),params:b0.optional()}),sN=p([LQ,GY,nU,FY,WU,QU,$Y,lA,AY,nA,oA,B4,LY,qQ,MQ,VQ,ZQ]),eN=p([BQ,FQ,zY,aU,K4]),QZ=p([DQ,qY,OY,bQ,MY,OQ,NQ,R1]),YZ=p([LQ,jU,lU,tU,qQ,MQ,VQ,ZQ]),XZ=p([BQ,FQ,OU,aA,iA,LU,AU,K4,cU]),WZ=p([DQ,kA,dU,HU,YU,fA,mA,pA,wQ,DU,OQ,NQ,R1]);class v 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===g.UrlElicitationRequired&&X){let W=X;if(W.elicitations)return new PG(W.elicitations,Y)}return new v(Q,Y,X)}}class PG extends v{constructor(Q,Y=`URL elicitation${Q.length>1?"s":""} required`){super(g.UrlElicitationRequired,Y,{elicitations:Q})}get elicitations(){return this.data?.elicitations??[]}}function W1(Q){return Q==="completed"||Q==="failed"||Q==="cancelled"}var sU=Symbol("Let zodToJsonSchema decide on which parser to use");var gZ=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function VY(Q){let X=JQ(Q)?.method;if(!X)throw Error("Schema is missing a method literal");let W=kW(X);if(typeof W!=="string")throw Error("Schema method literal must be a string");return W}function NY(Q,Y){let X=Y1(Q,Y);if(!X.success)throw X.error;return X.data}var G3=60000;class ZY{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(BQ,(Y)=>{this._oncancel(Y)}),this.setNotificationHandler(FQ,(Y)=>{this._onprogress(Y)}),this.setRequestHandler(LQ,(Y)=>({})),this._taskStore=Q?.taskStore,this._taskMessageQueue=Q?.taskMessageQueue,this._taskStore)this.setRequestHandler(qQ,async(Y,X)=>{let W=await this._taskStore.getTask(Y.params.taskId,X.sessionId);if(!W)throw new v(g.InvalidParams,"Failed to retrieve task: Task not found");return{...W}}),this.setRequestHandler(MQ,async(Y,X)=>{let W=async()=>{let G=Y.params.taskId;if(this._taskMessageQueue){let J;while(J=await this._taskMessageQueue.dequeue(G,X.sessionId)){if(J.type==="response"||J.type==="error"){let $=J.message,H=$.id,A=this._requestResolvers.get(H);if(A)if(this._requestResolvers.delete(H),J.type==="response")A($);else{let U=$,K=new v(U.error.code,U.error.message,U.error.data);A(K)}else{let U=J.type==="response"?"Response":"Error";this._onerror(Error(`${U} handler missing for request ${H}`))}continue}await this._transport?.send(J.message,{relatedRequestId:X.requestId})}}let z=await this._taskStore.getTask(G,X.sessionId);if(!z)throw new v(g.InvalidParams,`Task not found: ${G}`);if(!W1(z.status))return await this._waitForTaskUpdate(G,X.signal),await W();if(W1(z.status)){let J=await this._taskStore.getTaskResult(G,X.sessionId);return this._clearTaskQueue(G),{...J,_meta:{...J._meta,[X1]:{taskId:G}}}}return await W()};return await W()}),this.setRequestHandler(VQ,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 v(g.InvalidParams,`Failed to list tasks: ${W instanceof Error?W.message:String(W)}`)}}),this.setRequestHandler(ZQ,async(Y,X)=>{try{let W=await this._taskStore.getTask(Y.params.taskId,X.sessionId);if(!W)throw new v(g.InvalidParams,`Task not found: ${Y.params.taskId}`);if(W1(W.status))throw new v(g.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 v(g.InvalidParams,`Task not found after cancellation: ${Y.params.taskId}`);return{_meta:{},...G}}catch(W){if(W instanceof v)throw W;throw new v(g.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),v.fromError(g.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,z)=>{if(W?.(G,z),J4(G)||qG(G))this._onresponse(G);else if(YY(G))this._onrequest(G,z);else if(FG(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=v.fromError(g.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?.[X1]?.taskId;if(X===void 0){let A={jsonrpc:"2.0",id:Q.id,error:{code:g.MethodNotFound,message:"Method not found"}};if(G&&this._taskMessageQueue)this._enqueueTaskMessage(G,{type:"error",message:A,timestamp:Date.now()},W?.sessionId).catch((U)=>this._onerror(Error(`Failed to enqueue error response: ${U}`)));else W?.send(A).catch((U)=>this._onerror(Error(`Failed to send an error response: ${U}`)));return}let z=new AbortController;this._requestHandlerAbortControllers.set(Q.id,z);let J=DG(Q.params)?Q.params.task:void 0,$=this._taskStore?this.requestTaskStore(Q,W?.sessionId):void 0,H={signal:z.signal,sessionId:W?.sessionId,_meta:Q.params?._meta,sendNotification:async(A)=>{let U={relatedRequestId:Q.id};if(G)U.relatedTask={taskId:G};await this.notification(A,U)},sendRequest:async(A,U,K)=>{let D={...K,relatedRequestId:Q.id};if(G&&!D.relatedTask)D.relatedTask={taskId:G};let L=D.relatedTask?.taskId??G;if(L&&$)await $.updateTaskStatus(L,"input_required");return await this.request(A,U,D)},authInfo:Y?.authInfo,requestId:Q.id,requestInfo:Y?.requestInfo,taskId:G,taskStore:$,taskRequestedTtl:J?.ttl,closeSSEStream:Y?.closeSSEStream,closeStandaloneSSEStream:Y?.closeStandaloneSSEStream};Promise.resolve().then(()=>{if(J)this.assertTaskHandlerCapability(Q.method)}).then(()=>X(Q,H)).then(async(A)=>{if(z.signal.aborted)return;let U={result:A,jsonrpc:"2.0",id:Q.id};if(G&&this._taskMessageQueue)await this._enqueueTaskMessage(G,{type:"response",message:U,timestamp:Date.now()},W?.sessionId);else await W?.send(U)},async(A)=>{if(z.signal.aborted)return;let U={jsonrpc:"2.0",id:Q.id,error:{code:Number.isSafeInteger(A.code)?A.code:g.InternalError,message:A.message??"Internal error",...A.data!==void 0&&{data:A.data}}};if(G&&this._taskMessageQueue)await this._enqueueTaskMessage(G,{type:"error",message:U,timestamp:Date.now()},W?.sessionId);else await W?.send(U)}).catch((A)=>this._onerror(Error(`Failed to send response: ${A}`))).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 z=this._responseHandlers.get(W),J=this._timeoutInfo.get(W);if(J&&z&&J.resetTimeoutOnProgress)try{this._resetTimeout(W)}catch($){this._responseHandlers.delete(W),this._progressHandlers.delete(W),this._cleanupTimeout(W),z($);return}G(X)}_onresponse(Q){let Y=Number(Q.id),X=this._requestResolvers.get(Y);if(X){if(this._requestResolvers.delete(Y),J4(Q))X(Q);else{let z=new v(Q.error.code,Q.error.message,Q.error.data);X(z)}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(J4(Q)&&Q.result&&typeof Q.result==="object"){let z=Q.result;if(z.task&&typeof z.task==="object"){let J=z.task;if(typeof J.taskId==="string")G=!0,this._taskProgressTokens.set(J.taskId,Y)}}if(!G)this._progressHandlers.delete(Y);if(J4(Q))W(Q);else{let z=v.fromError(Q.error.code,Q.error.message,Q.error.data);W(z)}}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(z){yield{type:"error",error:z instanceof v?z:new v(g.InternalError,String(z))}}return}let G;try{let z=await this.request(Q,R1,X);if(z.task)G=z.task.taskId,yield{type:"taskCreated",task:z.task};else throw new v(g.InternalError,"Task creation did not return a task");while(!0){let J=await this.getTask({taskId:G},X);if(yield{type:"taskStatus",task:J},W1(J.status)){if(J.status==="completed")yield{type:"result",result:await this.getTaskResult({taskId:G},Y,X)};else if(J.status==="failed")yield{type:"error",error:new v(g.InternalError,`Task ${G} failed`)};else if(J.status==="cancelled")yield{type:"error",error:new v(g.InternalError,`Task ${G} was cancelled`)};return}if(J.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:G},Y,X)};return}let $=J.pollInterval??this._options?.defaultTaskPollInterval??1000;await new Promise((H)=>setTimeout(H,$)),X?.signal?.throwIfAborted()}}catch(z){yield{type:"error",error:z instanceof v?z:new v(g.InternalError,String(z))}}}request(Q,Y,X){let{relatedRequestId:W,resumptionToken:G,onresumptiontoken:z,task:J,relatedTask:$}=X??{};return new Promise((H,A)=>{let U=(M)=>{A(M)};if(!this._transport){U(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod(Q.method),J)this.assertTaskCapability(Q.method)}catch(M){U(M);return}X?.signal?.throwIfAborted();let K=this._requestMessageId++,D={...Q,jsonrpc:"2.0",id:K};if(X?.onprogress)this._progressHandlers.set(K,X.onprogress),D.params={...Q.params,_meta:{...Q.params?._meta||{},progressToken:K}};if(J)D.params={...D.params,task:J};if($)D.params={...D.params,_meta:{...D.params?._meta||{},[X1]:$}};let L=(M)=>{this._responseHandlers.delete(K),this._progressHandlers.delete(K),this._cleanupTimeout(K),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:K,reason:String(M)}},{relatedRequestId:W,resumptionToken:G,onresumptiontoken:z}).catch((E)=>this._onerror(Error(`Failed to send cancellation: ${E}`)));let S=M instanceof v?M:new v(g.RequestTimeout,String(M));A(S)};this._responseHandlers.set(K,(M)=>{if(X?.signal?.aborted)return;if(M instanceof Error)return A(M);try{let S=Y1(Y,M.result);if(!S.success)A(S.error);else H(S.data)}catch(S){A(S)}}),X?.signal?.addEventListener("abort",()=>{L(X?.signal?.reason)});let q=X?.timeout??G3,O=()=>L(v.fromError(g.RequestTimeout,"Request timed out",{timeout:q}));this._setupTimeout(K,q,X?.maxTotalTimeout,O,X?.resetTimeoutOnProgress??!1);let V=$?.taskId;if(V){let M=(S)=>{let E=this._responseHandlers.get(K);if(E)E(S);else this._onerror(Error(`Response handler missing for side-channeled request ${K}`))};this._requestResolvers.set(K,M),this._enqueueTaskMessage(V,{type:"request",message:D,timestamp:Date.now()}).catch((S)=>{this._cleanupTimeout(K),A(S)})}else this._transport.send(D,{relatedRequestId:W,resumptionToken:G,onresumptiontoken:z}).catch((M)=>{this._cleanupTimeout(K),A(M)})})}async getTask(Q,Y){return this.request({method:"tasks/get",params:Q},OQ,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},NQ,Y)}async cancelTask(Q,Y){return this.request({method:"tasks/cancel",params:Q},MG,Y)}async notification(Q,Y){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(Q.method);let X=Y?.relatedTask?.taskId;if(X){let J={...Q,jsonrpc:"2.0",params:{...Q.params,_meta:{...Q.params?._meta||{},[X1]:Y.relatedTask}}};await this._enqueueTaskMessage(X,{type:"notification",message:J,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 J={...Q,jsonrpc:"2.0"};if(Y?.relatedTask)J={...J,params:{...J.params,_meta:{...J.params?._meta||{},[X1]:Y.relatedTask}}};this._transport?.send(J,Y).catch(($)=>this._onerror($))});return}let z={...Q,jsonrpc:"2.0"};if(Y?.relatedTask)z={...z,params:{...z.params,_meta:{...z.params?._meta||{},[X1]:Y.relatedTask}}};await this._transport.send(z,Y)}setRequestHandler(Q,Y){let X=VY(Q);this.assertRequestHandlerCapability(X),this._requestHandlers.set(X,(W,G)=>{let z=NY(Q,W);return Promise.resolve(Y(z,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=VY(Q);this._notificationHandlers.set(X,(W)=>{let G=NY(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"&&YY(W.message)){let G=W.message.id,z=this._requestResolvers.get(G);if(z)z(new v(g.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 v(g.InvalidRequest,"Request cancelled"));return}let z=setTimeout(W,X);Y.addEventListener("abort",()=>{clearTimeout(z),G(new v(g.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 v(g.InvalidParams,"Failed to retrieve task: Task not found");return G},storeTaskResult:async(W,G,z)=>{await X.storeTaskResult(W,G,z,Y);let J=await X.getTask(W,Y);if(J){let $=K4.parse({method:"notifications/tasks/status",params:J});if(await this.notification($),W1(J.status))this._cleanupTaskProgressHandler(W)}},getTaskResult:(W)=>{return X.getTaskResult(W,Y)},updateTaskStatus:async(W,G,z)=>{let J=await X.getTask(W,Y);if(!J)throw new v(g.InvalidParams,`Task "${W}" not found - it may have been cleaned up`);if(W1(J.status))throw new v(g.InvalidParams,`Cannot update task "${W}" from terminal status "${J.status}" to "${G}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await X.updateTaskStatus(W,G,z,Y);let $=await X.getTask(W,Y);if($){let H=K4.parse({method:"notifications/tasks/status",params:$});if(await this.notification(H),W1($.status))this._cleanupTaskProgressHandler(W)}},listTasks:(W)=>{return X.listTasks(W,Y)}}}}function jG(Q){return Q!==null&&typeof Q==="object"&&!Array.isArray(Q)}function IG(Q,Y){let X={...Q};for(let W in Y){let G=W,z=Y[G];if(z===void 0)continue;let J=X[G];if(jG(J)&&jG(z))X[G]={...J,...z};else X[G]=z}return X}var W5=x9(F9(),1),G5=x9(X5(),1);function BM(){let Q=new W5.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return G5.default(Q),Q}class j9{constructor(Q){this._ajv=Q??BM()}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 I9{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 z5(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 J5(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 E9 extends ZY{constructor(Q,Y){super(Y);if(this._serverInfo=Q,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(L4.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 j9,this.setRequestHandler(GY,(X)=>this._oninitialize(X)),this.setNotificationHandler(zY,()=>this.oninitialized?.()),this._capabilities.logging)this.setRequestHandler(FY,async(X,W)=>{let G=W.sessionId||W.requestInfo?.headers["mcp-session-id"]||void 0,{level:z}=X.params,J=L4.safeParse(z);if(J.success)this._loggingLevels.set(G,J.data);return{}})}get experimental(){if(!this._experimental)this._experimental={tasks:new I9(this)};return this._experimental}registerCapabilities(Q){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=IG(this._capabilities,Q)}setRequestHandler(Q,Y){let W=JQ(Q)?.method;if(!W)throw Error("Schema is missing a method literal");let G;if(T1(W)){let J=W;G=J._zod?.def?.value??J.value}else{let J=W;G=J._def?.value??J.value}if(typeof G!=="string")throw Error("Schema method literal must be a string");if(G==="tools/call"){let J=async($,H)=>{let A=Y1(B4,$);if(!A.success){let L=A.error instanceof Error?A.error.message:String(A.error);throw new v(g.InvalidParams,`Invalid tools/call request: ${L}`)}let{params:U}=A.data,K=await Promise.resolve(Y($,H));if(U.task){let L=Y1(R1,K);if(!L.success){let q=L.error instanceof Error?L.error.message:String(L.error);throw new v(g.InvalidParams,`Invalid task creation result: ${q}`)}return L.data}let D=Y1(wQ,K);if(!D.success){let L=D.error instanceof Error?D.error.message:String(D.error);throw new v(g.InvalidParams,`Invalid tools/call result: ${L}`)}return D.data};return super.setRequestHandler(Q,J)}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){J5(this._clientCapabilities?.tasks?.requests,Q,"Client")}assertTaskHandlerCapability(Q){if(!this._capabilities)return;z5(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:AG.includes(Y)?Y:e6,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"},DQ)}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"),z=Q.messages.length>1?Q.messages[Q.messages.length-2]:void 0,J=z?Array.isArray(z.content)?z.content:[z.content]:[],$=J.some((H)=>H.type==="tool_use");if(G){if(W.some((H)=>H.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!$)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if($){let H=new Set(J.filter((U)=>U.type==="tool_use").map((U)=>U.id)),A=new Set(W.filter((U)=>U.type==="tool_result").map((U)=>U.toolUseId));if(H.size!==A.size||![...H].every((U)=>A.has(U)))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},OY,Y);return this.request({method:"sampling/createMessage",params:Q},qY,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},bQ,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},bQ,Y);if(G.action==="accept"&&G.content&&W.requestedSchema)try{let J=this._jsonSchemaValidator.getValidator(W.requestedSchema)(G.content);if(!J.valid)throw new v(g.InvalidParams,`Elicitation response content does not match requested schema: ${J.errorMessage}`)}catch(z){if(z instanceof v)throw z;throw new v(g.InternalError,`Error validating elicitation response: ${z instanceof Error?z.message:String(z)}`)}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},MY,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 $5={name:"@sequenzy/mcp",version:"0.0.48",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 T9=["product-info","domain","tracking","localization","integrations","products","events","tags","labels","goals","sync-rules","api-keys","widgets","team","danger"],H5={dashboard:"/dashboard/company/{companyId}",campaigns:"/dashboard/company/{companyId}/campaign",campaign:"/dashboard/company/{companyId}/campaign/{campaignId}",campaignPreview:"/dashboard/company/{companyId}/campaign/{campaignId}?step=review",campaignList:"/dashboard/company/{companyId}/campaign/list/{status}",sequences:"/dashboard/company/{companyId}/sequences",sequence:"/dashboard/company/{companyId}/sequences/{sequenceId}",sequenceList:"/dashboard/company/{companyId}/sequences/list/{status}",settings:"/dashboard/company/{companyId}/settings",settingsTab:"/dashboard/company/{companyId}/settings?tab={tab}",emails:"/dashboard/company/{companyId}/emails",email:"/dashboard/company/{companyId}/emails/{emailId}",subscribers:"/dashboard/company/{companyId}/subscribers",sentEmails:"/dashboard/company/{companyId}/sent-emails",emailSend:"/dashboard/company/{companyId}/sent-emails/{emailSendId}",segments:"/dashboard/company/{companyId}/segments",metrics:"/dashboard/company/{companyId}/metrics",transactional:"/dashboard/company/{companyId}/transactional",transactionalEmail:"/dashboard/company/{companyId}/transactional/{transactionalId}",domain:"/dashboard/company/{companyId}/settings/domain/{domainId}",domainVerify:"/dashboard/company/{companyId}/settings/domain/{domainId}/verify"};function FM(Q){let X=(Q??process.env.SEQUENZY_APP_URL??"https://sequenzy.com").trim().replace(/\/+$/,"");return X.length>0?X:"https://sequenzy.com"}function h0(Q){let Y=Q?.trim();return Y?Y:void 0}function t0(Q){return encodeURIComponent(Q)}function Q0(Q,Y){return`${Q}${Y}`}function Y0(Q,Y=""){return`/dashboard/company/${t0(Q)}${Y}`}function A5(Q,Y,X){return Q0(Q,`${Y0(Y,"/settings")}?tab=${encodeURIComponent(X)}`)}function qM(Q,Y){let X=T9.map((W)=>[W,Y?A5(Q,Y,W):""]);return Object.fromEntries(X)}function K1(Q={},Y){let X=FM(Y),W=h0(Q.companyId),G={},z=qM(X,W);if(!W)return{appUrl:X,routeTemplates:H5,settingsTabValues:T9,urls:G,settingsUrls:z};G.dashboard=Q0(X,Y0(W)),G.campaigns=Q0(X,Y0(W,"/campaign")),G.sequences=Q0(X,Y0(W,"/sequences")),G.settings=Q0(X,Y0(W,"/settings")),G.emails=Q0(X,Y0(W,"/emails")),G.subscribers=Q0(X,Y0(W,"/subscribers")),G.sentEmails=Q0(X,Y0(W,"/sent-emails")),G.segments=Q0(X,Y0(W,"/segments")),G.metrics=Q0(X,Y0(W,"/metrics")),G.transactional=Q0(X,Y0(W,"/transactional"));let J=h0(Q.campaignId);if(J)G.campaign=Q0(X,Y0(W,`/campaign/${t0(J)}`)),G.campaignPreview=`${G.campaign}?step=review`;let $=h0(Q.sequenceId);if($)G.sequence=Q0(X,Y0(W,`/sequences/${t0($)}`));let H=h0(Q.emailId)??h0(Q.templateId);if(H)G.email=Q0(X,Y0(W,`/emails/${t0(H)}`)),G.template=G.email;let A=h0(Q.transactionalId);if(A)G.transactionalEmail=Q0(X,Y0(W,`/transactional/${t0(A)}`));let U=h0(Q.emailSendId);if(U)G.emailSend=Q0(X,Y0(W,`/sent-emails/${t0(U)}`));let K=h0(Q.domainId);if(K)G.domain=Q0(X,Y0(W,`/settings/domain/${t0(K)}`)),G.domainVerify=`${G.domain}/verify`;let D=h0(Q.status);if(D)G.campaignList=Q0(X,Y0(W,`/campaign/list/${t0(D)}`)),G.sequenceList=Q0(X,Y0(W,`/sequences/list/${t0(D)}`));let L=h0(Q.settingsTab);if(L)G.settingsTab=A5(X,W,L);return{appUrl:X,routeTemplates:H5,settingsTabValues:T9,urls:G,settingsUrls:z}}var U5=[{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 N("GET","/api/v1/metrics?period=7d");break;case"sequenzy://company":{let X=await N("GET","/api/v1/account"),W=B1()??X.currentCompanyId;if(!W)throw Error("No company available. Create or select a company first.");Y=await N("GET",`/api/v1/companies/${W}`);break}case"sequenzy://campaigns/recent":Y=await N("GET","/api/v1/campaigns?limit=10");break;case"sequenzy://subscribers/recent":Y=await N("GET","/api/v1/subscribers?sort=createdAt&limit=20");break;case"sequenzy://subscribers/engaged":Y=await N("GET","/api/v1/subscribers?sort=engagement&limit=20");break;case"sequenzy://sequences":Y=await N("GET","/api/v1/sequences");break;case"sequenzy://templates":Y=await N("GET","/api/v1/templates");break;case"sequenzy://segments":Y=await N("GET","/api/v1/segments");break;case"sequenzy://tags":Y=await N("GET","/api/v1/tags");break;case"sequenzy://health":Y=await N("GET","/api/v1/health/deliverability");break;case"sequenzy://app-routes":Y=K1();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:b1(Y)}]}}}var h4="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: [...] }.",H6="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`.",O5="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.",D5=100,R9={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"]},OM=Object.entries(R9).map(([Q,Y])=>`${Q}: ${Y.join(", ")}`).join("; "),MM={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"],description:"Filter field. Use `event` for custom subscriber events, `segment` for saved segment membership, and `stripeProduct`/`stripeCurrentProduct`/`stripeTrialProduct` for Stripe product-based segments. Engagement fields (`emailSent`, `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: ${OM}.`},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},VM={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 M5(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 V5(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=M5([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(V5):[]}}function NM(Q){let Y=Q.indexOf(":");return Y!==-1&&Q.substring(0,Y).trim().length>0}function ZM(Q){let Y=Q.indexOf(":");return Y!==-1&&Q.substring(Y+1).trim().length>0}function B5(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 wM(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 z=X.slice(0,-2).join(":").trim(),J=X.at(-2),$=X.at(-1),H=J===void 0?Number.NaN:Number.parseInt(J,10);return z&&Number.isInteger(H)&&H>0&&$!==void 0&&B5($)?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&&B5(G)?null:'Event filters must use "eventName:timeRange", like "saas.purchase:30d".'}function bM(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 PM(Q){return Q.trim().toLowerCase().replace(/[-\s]+/g,"_")}function jM(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 IM(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 EM(Q){return["is","is_not","gte","lte","gt","lt"].includes(Q)}function TM(Q,Y,X){if(Q==="stripeProduct"){if(Y!=="at_least"&&Y!=="less_than_count")return null;let $=X.indexOf(":");if($===-1)return null;let H=X.substring(0,$).trim(),A=Number.parseInt(X.substring($+1).trim(),10);return H&&Number.isInteger(A)&&A>=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:z}=bM(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 J=PM(G);if(jM(J))return Y==="is"||Y==="is_not"?null:"Stripe cancellation flag filters only support is and is_not operators.";if(!IM(Q,J))return`Unsupported Stripe product subfilter "${G}".`;if(!EM(Y))return"Stripe date filters only support is, is_not, gte, lte, gt, and lt operators.";return z?.trim()?null:'Stripe date filters must include a value like "productId:end_at:2026-05-26".'}function N5(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 R9))return`Unsupported segment filter field "${String(X)}".`;if(typeof W!=="string")return`Segment filter "${X}" must include an operator.`;let z=R9[X];if(!z.includes(W))return`Operator "${W}" is not supported for ${X} filters. Use one of: ${z.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(!NM(G))return'Attribute filters must use "attributeName:value" or "attributeName:" for empty checks.';if(W!=="is_empty"&&W!=="is_not_empty"&&!ZM(G))return'Attribute filters must include a value after "attributeName:".'}if(X==="event"&&typeof G==="string"){let J=wM(W,G);if(J)return J}if((X==="stripeProduct"||X==="stripeCurrentProduct"||X==="stripeTrialProduct")&&typeof G==="string"){let J=TM(X,W,G);if(J)return J}if(X==="tag"&&(W==="contains"||W==="not_contains")){if(!(typeof G==="string"&&G.split(",").map(($)=>$.trim()).some(Boolean)))return"Tag filters must include at least one tag name."}return null}function Z5(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=N5(Y);return X?[X]:[]}if(Array.isArray(Y.children))return Y.children.flatMap(Z5);return[]}function w1(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 U6(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 SM(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 z=N5(G);return z?[z]:[]}):Z5(Q.root);if(W.length>0)throw Error(W[0]??"Invalid segment filter in `create_segment`.")}function RM(Q){if(Q.clearEnrollmentFieldPath===!0&&Q.enrollmentFieldPath!==void 0)throw Error("Provide either `enrollmentFieldPath` or `clearEnrollmentFieldPath` when calling `update_sequence`, not both.");let Y={...Q};if(delete Y.clearEnrollmentFieldPath,Q.clearEnrollmentFieldPath===!0)Y.enrollmentFieldPath=null;return Y}function CM(Q){let Y=j(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(($)=>typeof $==="string"?$.trim():"").filter(($)=>$.length>0)??[];if(W?.some(($)=>typeof $!=="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 z=j(Q,"fieldPath"),J=j(Q,"reason");return{...Y!==void 0&&{subscriberId:Y},...z!==void 0&&{fieldPath:z},...G.length>0&&{fieldValues:G},...typeof Q.dryRun==="boolean"&&{dryRun:Q.dryRun},...J!==void 0&&{reason:J}}}function vM(Q){w1("create_campaign",Q),U6("create_campaign",Q);let Y=j(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&&j(Q,"subject")===void 0)throw Error("`subject` is required unless `prompt` is provided when calling `create_campaign`.")}function kM(Q){if(j(Q,"scheduledAt")===void 0)throw Error("`scheduledAt` is required when calling `schedule_campaign`.");if(Q.targetLists!==void 0&&!B0(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 xM(Q){w1("create_transactional_email",Q);let Y=j(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&&j(Q,"subject")===void 0)throw Error("`subject` is required unless `prompt` is provided when calling `create_transactional_email`.")}var L5={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:O5,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 _M(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 B0(Q){return typeof Q==="object"&&Q!==null&&!Array.isArray(Q)}function F5(Q){return Q.trim().toLowerCase().replace(/\s+/g,"-")}function gM(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.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 yM(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=[],z=1,J=0,$=0,H=0;while(!0){let U=gM({query:Q.query,tags:Q.tags,segmentId:Q.segmentId,status:Q.status,page:z,pageSize:W}),K=await N("GET",`/api/v1/subscribers?${U.toString()}`,void 0,Y);J=K.pagination?.total??K.subscribers.length,$=K.pagination?.totalPages??1,H+=1,G.push(...K.subscribers??[]);let D=X!==void 0&&G.length>=X,L=K.pagination?z>=K.pagination.totalPages:(K.subscribers??[]).length<W;if(D||L)break;z+=1}let A=X!==void 0?G.slice(0,X):G;return{success:!0,subscribers:A,pagination:{page:1,limit:W,total:J,totalPages:$,fetchedPages:H},returned:A.length,truncated:X!==void 0&&J>0&&A.length<J}}function uM(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 f4(Q,Y){let X=uM(Y);if(!X.email&&!X.externalId)throw Error(`Provide either \`email\` or \`externalId\` when calling \`${Q}\`.`);return X}function C9(Q){if(Q.email)return`/api/v1/subscribers/${encodeURIComponent(Q.email)}`;return`/api/v1/subscribers/external?externalId=${encodeURIComponent(String(Q.externalId))}`}async function S9(Q,Y){return N("GET",C9(Q),void 0,Y)}function j(Q,Y){let X=Q[Y];if(typeof X!=="string")return;let W=X.trim();return W.length>0?W:void 0}function hM(Q,Y,X){let W=j(Y,X);if(W===void 0)throw Error(`\`${X}\` is required when calling \`${Q}\`.`);return W}function q5(Q,Y,X,W){let G=j(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 fM(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 z=W.trim();if(z.length>0)X.push(z)}),X.length===0)throw Error(`\`emails\` must include at least one email address when calling \`${Q}\`.`);if(X.length>D5)throw Error(`\`emails\` must include no more than ${D5} email addresses when calling \`${Q}\`. Split larger batches into multiple calls.`);return X}async function w5(Q){let Y=j(Q,"companyId");if(Y)return Y;let X=B1();if(X)return X;try{return(await N("GET","/api/v1/account")).currentCompanyId??void 0}catch{return}}function l4(Q,Y){if(!B0(Q)||!Y)return Q;return{...Q,url:Y}}function b5(Q,Y){if(!B0(Q))return Q;return{...Q,...Y.campaign!==void 0&&{url:Y.campaign},...Y.campaignPreview!==void 0&&{previewUrl:Y.campaignPreview}}}function A6(Q,Y,X){if(!Array.isArray(Q)||!Y)return Q;return Q.map((W)=>{if(!B0(W))return W;let G=j(W,"id");if(!G)return W;let z=K1({companyId:Y,...X==="campaign"&&{campaignId:G},...X==="sequence"&&{sequenceId:G},...X==="template"&&{emailId:G},...X==="transactional"&&{transactionalId:G}});if(X==="campaign")return b5(W,z.urls);let J=X==="sequence"?z.urls.sequence:X==="template"?z.urls.email:z.urls.transactionalEmail;return l4(W,J)})}function lM(Q){if(!Array.isArray(Q))return Q;return Q.map((Y)=>{if(!B0(Y))return Y;let X=j(Y,"id");if(!X)return Y;let W=K1({companyId:X});return{...Y,url:W.urls.dashboard,settingsUrl:W.urls.settings}})}var mM=new Set(["get_account","select_company","create_company","get_company","list_campaigns","get_campaign","get_email_send","create_campaign","update_campaign","schedule_campaign","send_test_email","list_sequences","get_sequence","create_sequence","update_sequence","enable_sequence","disable_sequence","cancel_sequence_enrollments","list_ab_tests","get_ab_test","get_ab_test_stats","update_ab_test_variant","list_templates","get_template","create_template","update_template","list_transactional_emails","get_transactional_email","create_transactional_email","update_transactional_email"]);async function cM(Q,Y,X){if(!B0(X)||!mM.has(Q))return X;let W=B0(X.company)?X.company:void 0,z=j(X,"selectedCompanyId")??j(X,"currentCompanyId")??j(X,"companyId")??(W?j(W,"id"):void 0)??(W?j(W,"companyId"):void 0)??await w5(Y);if(!z)return X;let J=B0(X.campaign)?X.campaign:void 0,$=B0(X.sequence)?X.sequence:void 0,H=B0(X.template)?X.template:void 0,A=B0(X.transactional)&&!Array.isArray(X.transactional)?X.transactional:void 0,U={companyId:z,campaignId:j(Y,"campaignId")??j(X,"campaignId")??(J?j(J,"id"):void 0),sequenceId:j(Y,"sequenceId")??j(X,"sequenceId")??($?j($,"id"):void 0),emailId:j(X,"templateId")??(H?j(H,"id"):void 0)??(A?j(A,"emailId"):void 0)??j(Y,"templateId"),transactionalId:j(Y,"transactionalId")??(A?j(A,"id"):void 0)??j(Y,"idOrSlug"),emailSendId:j(Y,"emailSendId")??j(X,"emailSendId")??(B0(X.emailSend)?j(X.emailSend,"id"):void 0),status:j(Y,"status")},K=K1(U),D=W?K1({companyId:z}):void 0;return{...X,...Array.isArray(X.companies)&&{companies:lM(X.companies)},...Array.isArray(X.campaigns)&&{campaigns:A6(X.campaigns,z,"campaign")},...Array.isArray(X.sequences)&&{sequences:A6(X.sequences,z,"sequence")},...Array.isArray(X.templates)&&{templates:A6(X.templates,z,"template")},...Array.isArray(X.transactional)&&{transactional:A6(X.transactional,z,"transactional")},...W&&D!==void 0&&{company:{...W,url:D.urls.dashboard,settingsUrl:D.urls.settings}},...J&&K.urls.campaign!==void 0&&{campaign:b5(J,K.urls)},...$&&K.urls.sequence!==void 0&&{sequence:l4($,K.urls.sequence)},...H&&K.urls.email!==void 0&&{template:l4(H,K.urls.email)},...A&&K.urls.transactionalEmail!==void 0&&{transactional:l4(A,K.urls.transactionalEmail)},...B0(X.emailSend)&&K.urls.emailSend!==void 0&&{emailSend:l4(X.emailSend,K.urls.emailSend)},appUrls:K.urls}}var P5=[{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
|
|
|
@@ -42,7 +42,7 @@ Use cases:
|
|
|
42
42
|
- 'subscribe_form': Adding subscribers from signup forms
|
|
43
43
|
- 'event_tracking': Tracking CUSTOM events only (not payment events - those come from the integration)
|
|
44
44
|
|
|
45
|
-
Before implementing, use create_api_key to generate an API key and save it to .env as SEQUENZY_API_KEY.`,inputSchema:{type:"object",properties:{framework:{type:"string",description:"Framework/language (nextjs, express, python, etc.)"},use_case:{type:"string",description:"Use case: 'transactional' (sending emails), 'subscribe_form' (adding subscribers), 'event_tracking' (tracking CUSTOM events only - payment events should come from Stripe/Polar/etc integration)"}}}},{name:"add_subscriber",description:"Add a new subscriber to your list",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to add subscriber to. If not provided, uses the currently selected company."},email:{type:"string",description:"Subscriber email address"},externalId:{type:"string",description:"Customer-owned subscriber ID. Provide this with email when creating, or instead of email for an existing subscriber."},attributes:{type:"object",description:"Custom attributes (name, plan, etc.)"},tags:{type:"array",items:{type:"string"},description:"Tags to apply to the subscriber"},listIds:{type:"array",items:{type:"string"},description:"List IDs to add subscriber to"},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."}},required:[]}},{name:"search_subscribers",description:"Search subscribers by free-text query, tags, or segment. If you omit limit, the tool fetches all pages and returns every match.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},query:{type:"string",description:"Search query (email or name)"},tags:{type:"array",items:{type:"string"},description:"Filter by tags"},segmentId:{type:"string",description:"Filter by segment ID"},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_tags",description:"List all tags in the account",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to list tags for. If not provided, uses the currently selected company."}}}},{name:"list_lists",description:"List all subscriber lists",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to list lists for. If not provided, uses the currently selected company."}}}},{name:"create_list",description:"Create a new subscriber list",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to create the list in. If not provided, uses the currently selected company."},name:{type:"string",description:"List name"},description:{type:"string",description:"List description"}},required:["name"]}},{name:"list_segments",description:"List all segments",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to list segments for. If not provided, uses the currently selected company."}}}},{name:"create_segment",description:'Create a new segment from explicit filter rules. Use `filters` plus `filterJoinOperator` for flat legacy rules, or `root` for nested AND/OR groups such as `{ "kind": "group", "joinOperator": "and", "children": [{ "kind": "filter", "field": "attribute", "operator": "gte", "value": "mrr:50" }, { "kind": "group", "joinOperator": "or", "children": [{ "kind": "filter", "field": "tag", "operator": "contains", "value": "vip" }, { "kind": "filter", "field": "event", "operator": "is_not", "value": "saas.purchase:30d" }] }] }`. Supports `event` and `segment` fields, Stripe product purchase/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:KM,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 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:{...DM,description:"Nested filter root. Mutually exclusive with `filters` and `filterJoinOperator`."}},required:["name"]}},{name:"get_segment_count",description:"Get the number of subscribers in a segment",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},segmentId:{type:"string",description:"Segment ID"}},required:["segmentId"]}},{name:"list_templates",description:"List all email templates, including per-locale localization sync status",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."}}}},{name:"get_template",description:"Get a template's details, content, and all localized variants with sync status",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},templateId:{type:"string",description:"Template ID"}},required:["templateId"]}},{name:"create_template",description:"Create a new email template",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},name:{type:"string",description:"Template name"},subject:{type:"string",description:"Email subject line"},html:{type:"string",description:"Email HTML content. Mutually exclusive with `blocks`."},blocks:{type:"array",description:h4,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:h4,items:{type:"object"}},labels:{type:"array",description:"Replacement label names. Send an empty array to clear labels. Missing labels are created automatically.",items:{type:"string"}}},required:["templateId"],additionalProperties:!1}},{name:"delete_template",description:"Delete a template",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},templateId:{type:"string",description:"Template ID"}},required:["templateId"]}},{name:"list_ab_tests",description:"List A/B tests and their variants",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},sequenceId:{type:"string",description:"Optional sequence ID to filter automation A/B tests."}}}},{name:"get_ab_test",description:"Get A/B test details, variants, and per-locale localization sync status",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},abTestId:{type:"string",description:"A/B test ID"}},required:["abTestId"]}},{name:"get_ab_test_stats",description:"Get A/B test aggregate stats and per-variant stats. Supports period or custom start/end ranges.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},abTestId:{type:"string",description:"A/B test ID"},period:{type:"string",description:"Optional period: 1h, 24h, 7d, 30d, or 90d."},start:{type:"string",description:"Custom range start as ISO 8601. Requires end."},end:{type:"string",description:"Custom range end as ISO 8601. Requires start."}},required:["abTestId"]}},{name:"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:`${HQ} Mutually exclusive with html.`,items:{type:"object"}}},required:["abTestId","variantId"],additionalProperties:!1}},{name:"list_campaigns",description:"List all campaigns",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to list campaigns for. If not provided, uses the currently selected company."},status:{type:"string",description:"Filter by status (draft, scheduled, sent)"},label:{type:"string",description:"Optional label name filter. Only campaigns assigned this label are returned."}}}},{name:"get_campaign",description:"Get campaign details and stats",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},campaignId:{type:"string",description:"Campaign ID"}},required:["campaignId"]}},{name:"get_email_send",description:"Get a sent email by emailSendId, including the stored HTML body when available and the ClickHouse event timeline. If the short-lived email send row has been cleaned up, returns the retained ClickHouse events and a sparse summary.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},emailSendId:{type:"string",description:"Email send ID to inspect."}},required:["emailSendId"]}},{name:"create_campaign",description:"Create a new campaign (as draft)",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to create the campaign in. If not provided, uses the currently selected company."},name:{type:"string",description:"Campaign name"},subject:{type:"string",description:"Email subject line. Optional when `prompt` is provided because the generated subject will be used."},trackingCode:{type:"string",description:"Optional campaign tracking code for UTM templates. Use only when explicitly requested."},html:{type:"string",description:"Email HTML content. Mutually exclusive with `blocks`."},blocks:{type:"array",description:h4,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:h4,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:"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).
|
|
45
|
+
Before implementing, use create_api_key to generate an API key and save it to .env as SEQUENZY_API_KEY.`,inputSchema:{type:"object",properties:{framework:{type:"string",description:"Framework/language (nextjs, express, python, etc.)"},use_case:{type:"string",description:"Use case: 'transactional' (sending emails), 'subscribe_form' (adding subscribers), 'event_tracking' (tracking CUSTOM events only - payment events should come from Stripe/Polar/etc integration)"}}}},{name:"add_subscriber",description:"Add a new subscriber to your list",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to add subscriber to. If not provided, uses the currently selected company."},email:{type:"string",description:"Subscriber email address"},externalId:{type:"string",description:"Customer-owned subscriber ID. Provide this with email when creating, or instead of email for an existing subscriber."},attributes:{type:"object",description:"Custom attributes (name, plan, etc.)"},tags:{type:"array",items:{type:"string"},description:"Tags to apply to the subscriber"},listIds:{type:"array",items:{type:"string"},description:"List IDs to add subscriber to"},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."}},required:[]}},{name:"search_subscribers",description:"Search subscribers by free-text query, tags, or segment. If you omit limit, the tool fetches all pages and returns every match.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},query:{type:"string",description:"Search query (email or name)"},tags:{type:"array",items:{type:"string"},description:"Filter by tags"},segmentId:{type:"string",description:"Filter by segment ID"},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_tags",description:"List all tags in the account",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to list tags for. If not provided, uses the currently selected company."}}}},{name:"list_lists",description:"List all subscriber lists",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to list lists for. If not provided, uses the currently selected company."}}}},{name:"create_list",description:"Create a new subscriber list",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to create the list in. If not provided, uses the currently selected company."},name:{type:"string",description:"List name"},description:{type:"string",description:"List description"}},required:["name"]}},{name:"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 100 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:"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:MM,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 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:{...VM,description:"Nested filter root. Mutually exclusive with `filters` and `filterJoinOperator`."}},required:["name"]}},{name:"get_segment_count",description:"Get the number of subscribers in a segment",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},segmentId:{type:"string",description:"Segment ID"}},required:["segmentId"]}},{name:"list_templates",description:"List all email templates, including per-locale localization sync status",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."}}}},{name:"get_template",description:"Get a template's details, content, and all localized variants with sync status",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},templateId:{type:"string",description:"Template ID"}},required:["templateId"]}},{name:"create_template",description:"Create a new email template",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},name:{type:"string",description:"Template name"},subject:{type:"string",description:"Email subject line"},html:{type:"string",description:"Email HTML content. Mutually exclusive with `blocks`."},blocks:{type:"array",description:h4,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:h4,items:{type:"object"}},labels:{type:"array",description:"Replacement label names. Send an empty array to clear labels. Missing labels are created automatically.",items:{type:"string"}}},required:["templateId"],additionalProperties:!1}},{name:"delete_template",description:"Delete a template",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},templateId:{type:"string",description:"Template ID"}},required:["templateId"]}},{name:"list_ab_tests",description:"List A/B tests and their variants",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},sequenceId:{type:"string",description:"Optional sequence ID to filter automation A/B tests."}}}},{name:"get_ab_test",description:"Get A/B test details, variants, and per-locale localization sync status",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},abTestId:{type:"string",description:"A/B test ID"}},required:["abTestId"]}},{name:"get_ab_test_stats",description:"Get A/B test aggregate stats and per-variant stats. Supports period or custom start/end ranges.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},abTestId:{type:"string",description:"A/B test ID"},period:{type:"string",description:"Optional period: 1h, 24h, 7d, 30d, or 90d."},start:{type:"string",description:"Custom range start as ISO 8601. Requires end."},end:{type:"string",description:"Custom range end as ISO 8601. Requires start."}},required:["abTestId"]}},{name:"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:`${H6} Mutually exclusive with html.`,items:{type:"object"}}},required:["abTestId","variantId"],additionalProperties:!1}},{name:"list_campaigns",description:"List all campaigns",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to list campaigns for. If not provided, uses the currently selected company."},status:{type:"string",description:"Filter by status (draft, scheduled, sent)"},label:{type:"string",description:"Optional label name filter. Only campaigns assigned this label are returned."}}}},{name:"get_campaign",description:"Get campaign details and stats",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},campaignId:{type:"string",description:"Campaign ID"}},required:["campaignId"]}},{name:"get_email_send",description:"Get a sent email by emailSendId, including the stored HTML body when available and the ClickHouse event timeline. If the short-lived email send row has been cleaned up, returns the retained ClickHouse events and a sparse summary.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},emailSendId:{type:"string",description:"Email send ID to inspect."}},required:["emailSendId"]}},{name:"create_campaign",description:"Create a new campaign (as draft)",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to create the campaign in. If not provided, uses the currently selected company."},name:{type:"string",description:"Campaign name"},subject:{type:"string",description:"Email subject line. Optional when `prompt` is provided because the generated subject will be used."},trackingCode:{type:"string",description:"Optional campaign tracking code for UTM templates. Use only when explicitly requested."},html:{type:"string",description:"Email HTML content. Mutually exclusive with `blocks`."},blocks:{type:"array",description:h4,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:h4,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:"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).
|
|
46
46
|
|
|
47
47
|
IMPORTANT GUIDELINES:
|
|
48
48
|
|
|
@@ -171,4 +171,4 @@ BUILT-IN EVENTS (auto-fired by payment integrations):
|
|
|
171
171
|
|
|
172
172
|
OTHER BUILT-IN EVENTS:
|
|
173
173
|
- email.opened, email.clicked, email.replied, email.bounced, email.unsubscribed
|
|
174
|
-
- contact.subscribed, contact.unsubscribed`,inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to create the sequence in. If not provided, uses the currently selected company."},name:{type:"string",description:"Sequence name (e.g., 'User Onboarding', 'Welcome Series')"},trigger:{type:"string",enum:["contact_added","tag_added","segment_entered","event_received","inactivity","frequency"],description:"Trigger type: 'contact_added' (when added to a list), 'tag_added' (when tag is applied), 'segment_entered' (when a contact newly enters a saved segment), 'event_received' (when custom event fires), 'inactivity' (when subscriber hasn't performed an event for X days), 'frequency' (when subscriber performs event X times in Y days)"},listId:{type:"string",description:"List ID to trigger on (for contact_added trigger). If not provided, triggers on any list."},tagName:{type:"string",description:"Tag name to trigger on (required for tag_added trigger)"},segmentId:{type:"string",description:"Segment ID to trigger on (required for segment_entered trigger). Use list_segments first to choose a saved segment."},eventName:{type:"string",description:"Event name to trigger on (required for event_received, inactivity, and frequency triggers)"},inactiveDays:{type:"number",description:"Number of days of inactivity (required for inactivity trigger, must be >= 1)"},minCount:{type:"number",description:"Minimum event count (required for frequency trigger, must be >= 1)"},timeWindowDays:{type:"number",description:"Time window in days for frequency trigger (required for frequency trigger, must be >= 1)"},emailCount:{type:"number",description:"Number of emails in the sequence (default: 5, max: 10)"},goal:{type:"string",description:"What this sequence should accomplish for AI generation. Be specific to the app's actual features and user journey. Avoid generic goals that don't match the app's business model."},enrollmentMode:{type:"string",enum:["unlimited","one_time","matching_field"],description:"Sequence re-entry mode. Use 'matching_field' only for event_received triggers when duplicate active runs should be blocked per event field value."},enrollmentFieldPath:{type:"string",description:"Dot-path event property used by enrollmentMode='matching_field', such as 'order.id' or 'product.providerVariantId'. Leave omitted for Shopify back-in-stock/replenishment product-variant defaults."},stopCondition:{type:"object",description:"Optional explicit auto-stop condition. Use { type: 'has_tag', value: 'customer' } to end the sequence when a subscriber gets a tag, { type: 'does_not_have_tag', value: 'trial' } when a tag is removed, { type: 'removed_from_list', value: 'list_123' } when they leave a list, { type: 'event_received', value: 'onboarding.completed' } when an event is tracked, or { type: 'none', value: null } for no auto-stop.",properties:{type:{type:"string",enum:["none","has_tag","does_not_have_tag","added_to_list","removed_from_list","event_received"],description:"Stop condition type."},value:{type:["string","null"],description:"Tag name, list ID, or event name for the stop condition. Use null or omit for type 'none'."}},required:["type"]},steps:{type:"array",description:"Explicit sequence steps. Omit type for email steps, or use type: 'create_discount' for a Stripe discount action. Later email steps can reference the most recent discount with {{discount.code}}, {{discount.percentOff}}, {{discount.amountOff}}, and {{discount.expiresAt}}.",items:{type:"object",properties:{type:{type:"string",enum:["email","create_discount","discount"],description:"Step type. Omit or use 'email' for email content. Use 'create_discount' to generate a discount code before later emails."},subject:{type:"string",description:"Email subject. Required for email steps."},previewText:{type:"string",description:"Email preview text."},blocks:{type:"array",description:B5,items:{type:"object"}},html:{type:"string",description:"HTML content for email steps. Will be converted to Sequenzy blocks."},delay:{type:"object",description:"Delay before this step.",properties:{days:{type:"number"},hours:{type:"number"},minutes:{type:"number"}}},name:{type:"string",description:"Email template name for email steps."},discount:{type:"object",description:"Discount configuration for create_discount steps. Prefer this nested shape for new integrations; legacy top-level discount fields are still accepted.",properties:{label:{type:"string",description:"Builder label for the discount step."},provider:{type:"string",enum:["stripe"],description:"Discount provider. Currently only 'stripe'."},discountType:{type:"string",enum:["percent","amount"],description:"Discount type."},percentOff:{type:"number",description:"Percent discount from 1 to 100. Required when discountType is percent."},amountOff:{type:"number",description:"Fixed amount discount in the smallest currency unit, for example 500 for $5. Required when discountType is amount."},currency:{type:"string",description:"ISO currency for amount discounts. Defaults to usd."},duration:{type:"string",enum:["once","forever","repeating"],description:"Stripe coupon duration. Defaults to once."},durationInMonths:{type:"number",description:"Required for repeating discounts."},appliesToAllPlans:{type:"boolean",description:"Whether the discount applies to all plans. Defaults to true."},planIds:{type:"array",description:"Stripe product IDs, such as prod_abc123, when appliesToAllPlans is false.",items:{type:"string"}},codePrefix:{type:"string",description:"Optional prefix for generated promotion codes."},maxRedemptions:{type:"number",description:"Maximum promotion code redemptions. Use 1 for subscriber-specific codes."},lockToSubscriber:{type:"boolean",description:"Stripe-only. Restrict each generated promotion code to the matched subscriber's Stripe customer."},expiresAt:{type:"string",description:"Optional future expiration date or ISO timestamp."},expiresInHours:{type:"number",description:"Optional relative expiration in hours, resolved when each subscriber's code is created (e.g., 48 for a 48-hour window per subscriber). Takes precedence over expiresAt."},name:{type:"string",description:"Optional provider coupon name."}}},label:{type:"string",description:"Legacy top-level discount label. Prefer discount.label."},provider:{type:"string",enum:["stripe"],description:"Legacy top-level discount provider. Prefer discount.provider."},discountType:{type:"string",enum:["percent","amount"],description:"Legacy top-level discount type. Prefer discount.discountType."},percentOff:{type:"number",description:"Percent discount from 1 to 100. Required when discountType is percent."},amountOff:{type:"number",description:"Fixed amount discount in the smallest currency unit, for example 500 for $5. Required when discountType is amount."},currency:{type:"string",description:"ISO currency for amount discounts. Defaults to usd."},duration:{type:"string",enum:["once","forever","repeating"],description:"Stripe coupon duration. Defaults to once."},durationInMonths:{type:"number",description:"Required for repeating discounts."},appliesToAllPlans:{type:"boolean",description:"Whether the discount applies to all plans. Defaults to true."},planIds:{type:"array",description:"Stripe product IDs, such as prod_abc123, when appliesToAllPlans is false.",items:{type:"string"}},codePrefix:{type:"string",description:"Optional prefix for generated promotion codes."},maxRedemptions:{type:"number",description:"Maximum promotion code redemptions. Use 1 for subscriber-specific codes."},lockToSubscriber:{type:"boolean",description:"Legacy top-level Stripe-only flag. Prefer discount.lockToSubscriber."},expiresAt:{type:"string",description:"Optional future expiration date or ISO timestamp."},expiresInHours:{type:"number",description:"Optional relative expiration in hours, resolved when each subscriber's code is created (e.g., 48 for a 48-hour window per subscriber). Takes precedence over expiresAt."}}}}},required:["name","trigger"]}},{name:"update_sequence",description:"Update an existing sequence. To target a specific step, use the emailId or nodeId returned in get_sequence.sequence.emails. You can also update enrollmentMode and enrollmentFieldPath for event-triggered matching-field enrollment. When inserting an if/else branch, include steps for every branch arm and elseSteps so the branch is usable immediately. Branch conditions support tags, lists, saved segments, custom events, clicked links, and subscriber field comparisons.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},sequenceId:{type:"string",description:"Sequence ID"},name:{type:"string",description:"Sequence name"},enrollmentMode:{type:"string",enum:["unlimited","one_time","matching_field"],description:"Updated sequence re-entry mode. 'matching_field' is only valid for event-based sequence triggers."},enrollmentFieldPath:{type:"string",description:"Dot-path event property used by enrollmentMode='matching_field', such as 'order.id' or 'product.providerVariantId'. Omit to leave unchanged. Use clearEnrollmentFieldPath to clear it."},clearEnrollmentFieldPath:{type:"boolean",description:"Set true to clear enrollmentFieldPath without sending a nullable schema value."},stopCondition:{type:"object",description:"Update the sequence auto-stop condition. Example: { type: 'has_tag', value: 'customer' } ends the sequence when the subscriber has that tag. Use { type: 'removed_from_list', value: 'list_123' } to stop when they leave a list, or { type: 'none', value: null } to clear it.",properties:{type:{type:"string",enum:["none","has_tag","does_not_have_tag","added_to_list","removed_from_list","event_received"]},value:{type:["string","null"],description:"Tag name, list ID, or event name for the stop condition."}},required:["type"]},branch:{type:"object",description:"Insert an if/else branch into an existing sequence. The branch is inserted after afterNodeId and creates an if path plus an else fallback path. Use get_sequence first to choose afterNodeId. Each branch condition should include steps, and elseSteps is required unless allowEmptyPaths is true. Conditions support tags, lists, saved segments, events, clicked links, and field comparisons. Use activityScope for event_received and link_clicked checks.",properties:{afterNodeId:{type:"string",description:"Existing node ID to insert the branch after. Use a nodeId from get_sequence.sequence.nodes or get_sequence.sequence.emails."},label:{type:"string",description:"Optional branch node label."},branches:{type:"array",description:"Conditional branches evaluated in order. An else fallback is created automatically.",items:{type:"object",properties:{id:{type:"string",description:"Optional stable branch ID. Defaults to branch-0, branch-1, etc."},label:{type:"string",description:"Display label, e.g. 'If has customer tag'."},conditionType:{type:"string",enum:["has_tag","in_list","in_segment","event_received","link_clicked","field_equals","field_contains","field_greater_than","field_less_than"],description:"Condition type for this branch."},tagName:{type:"string",description:"Tag name for has_tag conditions. This can be used instead of tagId."},tagId:{type:"string",description:"Tag ID or tag name for has_tag conditions."},listId:{type:"string",description:"List ID for in_list conditions."},segmentId:{type:"string",description:"Segment ID for in_segment conditions."},segmentName:{type:"string",description:"Optional display name for in_segment conditions."},eventName:{type:"string",description:"Event name for event_received conditions, such as project.invite.accepted."},linkUrl:{type:"string",description:"Optional URL substring for link_clicked conditions. Omit to match any clicked link."},activityScope:{type:"string",enum:["ever","this_sequence","previous_email"],description:"Scope for event_received and link_clicked conditions. Omit to check ever."},fieldName:{type:"string",description:"Subscriber attribute name for field conditions."},fieldValue:{type:"string",description:"Comparison value for field conditions."},steps:{type:"array",description:"Steps to create inside this branch path. Required by default so the branch is not an empty placeholder.",items:K5}},required:["conditionType"]}},elseSteps:{type:"array",description:"Steps to create inside the else fallback path. Required by default so the else arm is usable.",items:K5},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:HQ,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:HQ,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:"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:`${h4} 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:`${HQ} Mutually exclusive with \`html\`.`,items:{type:"object"}}},required:["idOrSlug"],additionalProperties:!1}},{name:"send_email",description:"Send a transactional email to a single recipient",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},to:{type:"string",description:"Recipient email address"},subject:{type:"string",description:"Email subject (required if not using templateId)"},html:{type:"string",description:"Email HTML content (required if not using templateId)"},templateId:{type:"string",description:"Template ID to use (alternative to html)"},variables:{type:"object",description:"Variables for template personalization. Nested objects and arrays are supported for repeat blocks, for example { items: [...] }."},subscriberExternalId:{type:"string",description:"Customer-owned subscriber ID for attaching analytics/localization on single-recipient sends."}},required:["to"]}},{name:"get_stats",description:"Get overview statistics for a time period",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},period:{type:"string",description:"Time period: 7d, 30d, or 90d (default: 7d)"}}}},{name:"get_campaign_stats",description:"Get detailed statistics for a campaign",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},campaignId:{type:"string",description:"Campaign ID"}},required:["campaignId"]}},{name:"get_sequence_stats",description:"Get statistics for a sequence, including per-step failed subscribers and failure reasons",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},sequenceId:{type:"string",description:"Sequence ID"}},required:["sequenceId"]}},{name:"get_subscriber_activity",description:"Get recent activity, email stats, and current sequence enrollments for a subscriber",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},email:{type:"string",description:"Subscriber email address. Provide email or externalId to identify the subscriber."},externalId:{type:"string",description:"Customer-owned subscriber ID. Provide email or externalId to identify the subscriber."}},required:[]}},{name:"generate_email",description:"Generate email blocks from a prompt",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},prompt:{type:"string",description:"Description of the email to generate"},style:{type:"string",description:"Style: minimal, branded, promotional"},tone:{type:"string",description:"Tone: professional, casual, friendly"}},required:["prompt"]}},{name:"generate_sequence",description:"[DEPRECATED - Use create_sequence instead] Generate a multi-email sequence from a goal. Note: create_sequence now handles AI generation automatically.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},goal:{type:"string",description:"Goal of the sequence (e.g., 'onboard new SaaS trial users')"},emailCount:{type:"number",description:"Number of emails in the sequence (default: 5, max: 10)"},durationDays:{type:"number",description:"Total duration in days (default: 14)"}},required:["goal"]}},{name:"generate_subject_lines",description:"Generate A/B test subject line variants",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},topic:{type:"string",description:"Topic or context for the subject lines"},count:{type:"number",description:"Number of variants to generate (default: 5)"}},required:["topic"]}}];async function V5(Q,Y){try{let X;switch(Q){case"get_account":{let G=await N("GET","/api/v1/account"),z=B1();X={...G,selectedCompanyId:z??G.currentCompanyId};break}case"select_company":{let G=Y.companyId,z=await N("GET","/api/v1/account"),J=z.companies?.find(($)=>$.id===G);if(!J)throw Error(`Company not found. Available companies: ${z.companies?.map(($)=>`${$.name} (${$.id})`).join(", ")??"none"}`);FQ(G),X={success:!0,message:`Switched to company: ${J.name}`,companyId:J.id,companyName:J.name};break}case"get_app_urls":{let G=await q5(Y);X={...K1({companyId:G,campaignId:j(Y,"campaignId"),sequenceId:j(Y,"sequenceId"),emailId:j(Y,"emailId")??j(Y,"templateId"),transactionalId:j(Y,"transactionalId"),emailSendId:j(Y,"emailSendId"),domainId:j(Y,"domainId"),status:j(Y,"status"),settingsTab:j(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 N("POST","/api/v1/companies",{name:Y.name,domain:Y.domain});if(!G.success)throw Error("Failed to create company");let z=G.company.id,J=6,$=0,H=G.company.status;while(H==="processing"&&$<J){await new Promise((K)=>setTimeout(K,20000)),$++;let U=await N("GET",`/api/v1/companies/${z}`);if(U.success)H=U.company.status}FQ(z);let A=await N("GET",`/api/v1/companies/${z}`);X={success:!0,company:A.company,message:H==="processing"?"Company created but still processing. You can continue using it while processing completes.":`Company '${A.company.name}' created and ready to use.`,autoSelected:!0};break}case"get_company":{let G=Y.companyId;X=await N("GET",`/api/v1/companies/${G}`);break}case"create_api_key":{let G=Y.companyId;X=await N("POST","/api/v1/api-keys",{name:Y.name},G);break}case"list_websites":{let G=Y.companyId;X=await N("GET","/api/v1/websites",void 0,G);break}case"add_website":{let G=Y.companyId;X=await N("POST","/api/v1/websites",{domain:Y.domain},G);break}case"check_website":{let G=Y.companyId;X=await N("GET",`/api/v1/websites/${Y.domain}`,void 0,G);break}case"get_integration_guide":X=await N("POST","/api/v1/integration-guide",Y);break;case"add_subscriber":{let G=Y.companyId,z=f4("add_subscriber",Y);X=await N("POST","/api/v1/subscribers",{...z,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,z=f4("update_subscriber",Y),J=await S9(z,G),$=Array.isArray(J.subscriber.tags)?J.subscriber.tags.filter((D)=>typeof D==="string"):[],H=Array.isArray(Y.addTags)?Y.addTags.filter((D)=>typeof D==="string"&&D.trim()!=="").map(D5):[],A=new Set(Array.isArray(Y.removeTags)?Y.removeTags.filter((D)=>typeof D==="string"&&D.trim()!=="").map(D5):[]),U=$.filter((D)=>!A.has(D));for(let D of H)if(!U.includes(D))U.push(D);let K={};if(z.email&&z.externalId)K.externalId=z.externalId;if(B0(Y.attributes))K.customAttributes={...B0(J.subscriber.customAttributes)?J.subscriber.customAttributes:{},...Y.attributes};if(Y.addTags||Y.removeTags)K.tags=U;X=await N("PATCH",R9(z),K,G);break}case"remove_subscriber":{let G=Y.companyId,z=f4("remove_subscriber",Y),J=R9(z);if(Y.hardDelete===!0)X=await N("DELETE",J,void 0,G);else X=await N("PATCH",J,{status:"unsubscribed"},G);break}case"get_subscriber":{let G=Y.companyId,z=f4("get_subscriber",Y);X=await S9(z,G);break}case"search_subscribers":{let G=Y.companyId;X=await ZM(Y,G);break}case"list_tags":{let G=Y.companyId;X=await N("GET","/api/v1/tags",void 0,G);break}case"list_lists":{let G=Y.companyId;X=await N("GET","/api/v1/lists",void 0,G);break}case"create_list":{let G=Y.companyId;X=await N("POST","/api/v1/lists",Y,G);break}case"list_segments":{let G=Y.companyId;X=await N("GET","/api/v1/segments",void 0,G);break}case"create_segment":{BM(Y);let G=Y.companyId;X=await N("POST","/api/v1/segments",{...Y,...Y.filters!==void 0?{filters:L5(Y.filters)}:{},...Y.root!==void 0?{root:F5(Y.root)}:{}},G);break}case"get_segment_count":{let G=Y.companyId;X=await N("GET",`/api/v1/segments/${Y.segmentId}/count`,void 0,G);break}case"list_templates":{let G=Y.companyId,z=new URLSearchParams,J=j(Y,"label");if(J)z.set("label",J);X=await N("GET",`/api/v1/templates${z.size>0?`?${z}`:""}`,void 0,G);break}case"get_template":{let G=Y.companyId;X=await N("GET",`/api/v1/templates/${Y.templateId}`,void 0,G);break}case"create_template":{let G=Y.companyId;w1("create_template",Y,{requireContent:!0}),UQ("create_template",Y),X=await N("POST","/api/v1/templates",Y,G);break}case"update_template":{let G=Y.companyId,z=new Set(["companyId","templateId","name","subject","html","blocks","labels"]),J=Object.keys(Y).filter(($)=>!z.has($));if(J.length>0)throw Error(`\`update_template\` accepts only \`name\`, \`subject\`, \`html\`, \`blocks\`, and \`labels\` update fields. Unsupported field${J.length===1?"":"s"}: ${J.map(($)=>`\`${$}\``).join(", ")}.`);if(w1("update_template",Y),UQ("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 N("PUT",`/api/v1/templates/${Y.templateId}`,Y,G);break}case"delete_template":{let G=Y.companyId;X=await N("DELETE",`/api/v1/templates/${Y.templateId}`,void 0,G);break}case"list_ab_tests":{let G=Y.companyId,z=new URLSearchParams,J=j(Y,"sequenceId");if(J)z.set("sequenceId",J);X=await N("GET",`/api/v1/ab-tests${z.size>0?`?${z}`:""}`,void 0,G);break}case"get_ab_test":{let G=Y.companyId;X=await N("GET",`/api/v1/ab-tests/${Y.abTestId}`,void 0,G);break}case"get_ab_test_stats":{let G=Y.companyId,z=new URLSearchParams,J=j(Y,"period"),$=j(Y,"start"),H=j(Y,"end");if(J)z.set("period",J);if($)z.set("start",$);if(H)z.set("end",H);X=await N("GET",`/api/v1/ab-tests/${Y.abTestId}/stats${z.size>0?`?${z}`:""}`,void 0,G);break}case"restart_ab_test":{let G=Y.companyId,z=new Set(["companyId","abTestId","sourceVariantId","testType","winnerThreshold","variantCount"]),J=Object.keys(Y).filter((U)=>!z.has(U));if(J.length>0)throw Error(`\`restart_ab_test\` accepts only \`sourceVariantId\`, \`testType\`, \`winnerThreshold\`, and \`variantCount\` option fields. Unsupported field${J.length===1?"":"s"}: ${J.map((U)=>`\`${U}\``).join(", ")}.`);let $=j(Y,"testType");if($!==void 0&&$!=="subject"&&$!=="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 A=Y.variantCount===void 0?void 0:Number(Y.variantCount);if(A!==void 0&&(!Number.isInteger(A)||A<2||A>4))throw Error("`restart_ab_test` variantCount must be an integer from 2 to 4.");X=await N("POST",`/api/v1/ab-tests/${Y.abTestId}/restart`,{sourceVariantId:j(Y,"sourceVariantId"),testType:$,winnerThreshold:H,variantCount:A},G);break}case"update_ab_test_variant":{let G=Y.companyId,z=new Set(["companyId","abTestId","variantId","subject","previewText","html","blocks"]),J=Object.keys(Y).filter(($)=>!z.has($));if(J.length>0)throw Error(`\`update_ab_test_variant\` accepts only \`subject\`, \`previewText\`, \`html\`, and \`blocks\` update fields. Unsupported field${J.length===1?"":"s"}: ${J.map(($)=>`\`${$}\``).join(", ")}.`);if(w1("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 N("PATCH",`/api/v1/ab-tests/${Y.abTestId}/variants/${Y.variantId}`,Y,G);break}case"list_campaigns":{let G=Y.companyId,z=new URLSearchParams;if(Y.status)z.set("status",String(Y.status));let J=j(Y,"label");if(J)z.set("label",J);X=await N("GET",`/api/v1/campaigns?${z}`,void 0,G);break}case"get_campaign":{let G=Y.companyId;X=await N("GET",`/api/v1/campaigns/${Y.campaignId}`,void 0,G);break}case"get_email_send":{let G=Y.companyId;X=await N("GET",`/api/v1/email-sends/${encodeURIComponent(String(Y.emailSendId))}`,void 0,G);break}case"create_campaign":{let G=Y.companyId;qM(Y);let z=j(Y,"prompt");if(z!==void 0){let J=await N("POST","/api/v1/generate/email",{prompt:z,...Y.style!==void 0&&{style:Y.style},...Y.tone!==void 0&&{tone:Y.tone}},G),$=j(Y,"subject")??(typeof J.subject==="string"&&J.subject.trim()!==""?J.subject.trim():void 0);if(!$)throw Error("`create_campaign` prompt generation did not return a subject. Provide `subject` explicitly.");let H=Array.isArray(J.blocks)&&J.blocks.length>0?J.blocks:void 0,A=typeof J.html==="string"&&J.html.trim()!==""?J.html:void 0;if(H===void 0&&A===void 0)throw Error("`create_campaign` prompt generation did not return email blocks. Try again or provide `html` or `blocks` explicitly.");X=await N("POST","/api/v1/campaigns",{name:Y.name,subject:$,...H!==void 0?{blocks:H}:{html:A},...Y.segmentId!==void 0&&{segmentId:Y.segmentId},...Y.trackingCode!==void 0&&{trackingCode:Y.trackingCode},...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 N("POST","/api/v1/campaigns",Y,G);break}case"update_campaign":{let G=Y.companyId,z=new Set(["companyId","campaignId","name","subject","trackingCode","html","blocks","replyTo","replyProfileId","campaignData","computedLists","labels"]),J=Object.keys(Y).filter(($)=>!z.has($));if(J.length>0)throw Error(`\`update_campaign\` accepts only \`name\`, \`subject\`, \`trackingCode\`, \`html\`, \`blocks\`, \`replyTo\`, \`replyProfileId\`, \`campaignData\`, \`computedLists\`, and \`labels\` update fields. Unsupported field${J.length===1?"":"s"}: ${J.map(($)=>`\`${$}\``).join(", ")}.`);if(w1("update_campaign",Y),UQ("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 N("PUT",`/api/v1/campaigns/${Y.campaignId}`,Y,G);break}case"schedule_campaign":{let G=Y.companyId,z=new Set(["companyId","campaignId","scheduledAt","targetLists","sendTimeOptimization","spreadOverHours"]),J=Object.keys(Y).filter(($)=>!z.has($));if(J.length>0)throw Error(`\`schedule_campaign\` accepts only \`campaignId\`, \`scheduledAt\`, \`targetLists\`, \`sendTimeOptimization\`, and \`spreadOverHours\`. Unsupported field${J.length===1?"":"s"}: ${J.map(($)=>`\`${$}\``).join(", ")}.`);OM(Y),X=await N("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 N("POST",`/api/v1/campaigns/${Y.campaignId}/test`,{to:Y.to},G);break}case"list_sequences":{let G=Y.companyId;X=await N("GET","/api/v1/sequences",void 0,G);break}case"get_sequence":{let G=Y.companyId;X=await N("GET",`/api/v1/sequences/${Y.sequenceId}`,void 0,G);break}case"create_sequence":{let G=Y.companyId,z=Array.isArray(Y.steps)&&Y.steps.length>0,J=await N("POST","/api/v1/sequences",Y,G);if(!J.success){X=J;break}let $=J.sequence.id;if(z){let D=await N("GET",`/api/v1/sequences/${$}`,void 0,G);if(D.success)X={success:!0,sequence:D.sequence,message:`Sequence "${D.sequence.name}" created with explicit steps. Review it before enabling.`};else X=D;break}let H=6,A=0,U="pending";while(U!=="complete"&&A<H){await new Promise((L)=>setTimeout(L,20000)),A++;let D=await N("GET",`/api/v1/sequences/${$}`,void 0,G);if(D.success)U=D.sequence.enrichmentStatus}let K=await N("GET",`/api/v1/sequences/${$}`,void 0,G);if(K.success)X={success:!0,sequence:K.sequence,message:K.sequence.enrichmentStatus==="complete"?`Sequence "${K.sequence.name}" created with ${K.sequence.emailCount} AI-generated emails. The sequence is ready to review and enable.`:`Sequence "${K.sequence.name}" created. Email enrichment is still in progress (${K.sequence.enrichedCount}/${K.sequence.emailCount} emails generated). You can check status with get_sequence.`};else X=K;break}case"update_sequence":{let G=Y.companyId,z=LM(Y);X=await N("PUT",`/api/v1/sequences/${Y.sequenceId}`,z,G);break}case"enable_sequence":{let G=Y.companyId;X=await N("POST",`/api/v1/sequences/${Y.sequenceId}/enable`,void 0,G);break}case"disable_sequence":{let G=Y.companyId;X=await N("POST",`/api/v1/sequences/${Y.sequenceId}/disable`,void 0,G);break}case"cancel_sequence_enrollments":{let G=Y.companyId,z=FM(Y);X=await N("POST",`/api/v1/sequences/${Y.sequenceId}/enrollments/cancel`,z,G);break}case"delete_sequence":{let G=Y.companyId;X=await N("DELETE",`/api/v1/sequences/${Y.sequenceId}`,void 0,G);break}case"list_transactional_emails":{let G=Y.companyId;X=await N("GET","/api/v1/transactional",void 0,G);break}case"get_transactional_email":{let G=Y.companyId;X=await N("GET",`/api/v1/transactional/${Y.idOrSlug}`,void 0,G);break}case"create_transactional_email":{let G=Y.companyId,z=new Set(["companyId","name","slug","subject","previewText","html","blocks","prompt","style","tone","enabled"]),J=Object.keys(Y).filter((A)=>!z.has(A));if(J.length>0)throw Error(`\`create_transactional_email\` accepts only \`name\`, \`slug\`, \`subject\`, \`previewText\`, \`html\`, \`blocks\`, \`prompt\`, \`style\`, \`tone\`, and \`enabled\` fields. Unsupported field${J.length===1?"":"s"}: ${J.map((A)=>`\`${A}\``).join(", ")}.`);MM(Y);let $=j(Y,"prompt");if($!==void 0){let A={companyId:G??B1()??"",name:typeof Y.name==="string"&&Y.name.trim()!==""?Y.name.trim():"",slug:typeof Y.slug==="string"&&Y.slug.trim()!==""?Y.slug.trim():"",promptLength:$.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",A);let U=await N("POST","/api/v1/generate/email",{prompt:$,...Y.style!==void 0&&{style:Y.style},...Y.tone!==void 0&&{tone:Y.tone}},G);console.error("[mcp:create_transactional_email] prompt generation complete",{...A,subject:U.subject??"",previewTextLength:typeof U.previewText==="string"?U.previewText.length:0,blockCount:Array.isArray(U.blocks)?U.blocks.length:0,htmlLength:typeof U.html==="string"?U.html.length:0});let K=j(Y,"subject")??(typeof U.subject==="string"&&U.subject.trim()!==""?U.subject.trim():void 0);if(!K)throw Error("`create_transactional_email` prompt generation did not return a subject. Provide `subject` explicitly.");let D=Array.isArray(U.blocks)&&U.blocks.length>0?U.blocks:void 0,L=typeof U.html==="string"&&U.html.trim()!==""?U.html:void 0,q=j(Y,"previewText")??(typeof U.previewText==="string"?U.previewText.trim():void 0);if(D===void 0&&L===void 0)throw Error("`create_transactional_email` prompt generation did not return email blocks. Try again or provide `html` or `blocks` explicitly.");console.error("[mcp:create_transactional_email] creating generated transactional",{...A,subject:K,contentSource:D!==void 0?"blocks":"html",blockCount:D?.length??0,htmlLength:L?.length??0}),X=await N("POST","/api/v1/transactional",{name:Y.name,...Y.slug!==void 0&&{slug:Y.slug},subject:K,...q!==void 0&&{previewText:q},...D!==void 0?{blocks:D}:{html:L},...Y.enabled!==void 0&&{enabled:Y.enabled}},G),console.error("[mcp:create_transactional_email] generated transactional created",A)}catch(U){throw console.error("[mcp:create_transactional_email] prompt-based create failed",{...A,error:U instanceof Error?U.message:String(U)}),U}break}let H=Object.fromEntries(Object.entries(Y).filter(([A])=>A!=="companyId"));X=await N("POST","/api/v1/transactional",H,G);break}case"update_transactional_email":{let G=Y.companyId,z=new Set(["companyId","idOrSlug","name","enabled","subject","previewText","html","blocks"]),J=Object.keys(Y).filter((H)=>!z.has(H));if(J.length>0)throw Error(`\`update_transactional_email\` accepts only \`name\`, \`enabled\`, \`subject\`, \`previewText\`, \`html\`, and \`blocks\` update fields. Unsupported field${J.length===1?"":"s"}: ${J.map((H)=>`\`${H}\``).join(", ")}.`);if(w1("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 $=Object.fromEntries(Object.entries(Y).filter(([H])=>H!=="companyId"&&H!=="idOrSlug"));X=await N("PATCH",`/api/v1/transactional/${Y.idOrSlug}`,$,G);break}case"send_email":{let G=Y.companyId;X=await N("POST","/api/v1/transactional/send",Y,G);break}case"get_stats":{let G=Y.companyId,z=Y.period??"7d";X=await N("GET",`/api/v1/metrics?period=${z}`,void 0,G);break}case"get_campaign_stats":{let G=Y.companyId;X=await N("GET",`/api/v1/metrics/campaigns/${Y.campaignId}`,void 0,G);break}case"get_sequence_stats":{let G=Y.companyId;X=await N("GET",`/api/v1/metrics/sequences/${Y.sequenceId}`,void 0,G);break}case"get_subscriber_activity":{let G=Y.companyId,z=f4("get_subscriber_activity",Y),J=await S9(z,G);X={success:J.success,email:J.subscriber.email,emailStats:J.subscriber.emailStats??null,activity:J.subscriber.activity??[],sequenceEnrollments:J.subscriber.sequenceEnrollments??[]};break}case"generate_email":{let G=Y.companyId;X=await N("POST","/api/v1/generate/email",Y,G);break}case"generate_sequence":{let G=Y.companyId;X=await N("POST","/api/v1/generate/sequence",Y,G);break}case"generate_subject_lines":{let G=Y.companyId;X=await N("POST","/api/v1/generate/subjects",Y,G);break}default:throw Error(`Unknown tool: ${Q}`)}let W=VM(X);if(W)throw W;return X=await jM(Q,Y,X),{content:[{type:"text",text:JSON.stringify(X,null,2)}]}}catch(X){return{isError:!0,content:[{type:"text",text:b1(X)}]}}}async function N5(Q,Y,X){let W=Y.getRequestContext?.(Q)??{};try{return await g9(W,X)}finally{await Y.onRequestContextUpdated?.(W,Q)}}function SI(Q={}){let Y=new E9({name:"sequenzy",version:J5.version},{capabilities:{tools:{},resources:{}}});return Y.setRequestHandler(LY,async()=>{return{tools:M5}}),Y.setRequestHandler(B4,async(X,W)=>{let{name:G,arguments:z}=X.params;return N5(W,Q,()=>V5(G,z??{}))}),Y.setRequestHandler($Y,async()=>{return{resources:A5}}),Y.setRequestHandler(AY,async(X,W)=>{let{uri:G}=X.params;return N5(W,Q,()=>U5(G))}),Y}export{SI as createSequenzyMcpServer};
|
|
174
|
+
- contact.subscribed, contact.unsubscribed`,inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to create the sequence in. If not provided, uses the currently selected company."},name:{type:"string",description:"Sequence name (e.g., 'User Onboarding', 'Welcome Series')"},trigger:{type:"string",enum:["contact_added","tag_added","segment_entered","event_received","inactivity","frequency"],description:"Trigger type: 'contact_added' (when added to a list), 'tag_added' (when tag is applied), 'segment_entered' (when a contact newly enters a saved segment), 'event_received' (when custom event fires), 'inactivity' (when subscriber hasn't performed an event for X days), 'frequency' (when subscriber performs event X times in Y days)"},listId:{type:"string",description:"List ID to trigger on (for contact_added trigger). If not provided, triggers on any list."},tagName:{type:"string",description:"Tag name to trigger on (required for tag_added trigger)"},segmentId:{type:"string",description:"Segment ID to trigger on (required for segment_entered trigger). Use list_segments first to choose a saved segment."},eventName:{type:"string",description:"Event name to trigger on (required for event_received, inactivity, and frequency triggers)"},inactiveDays:{type:"number",description:"Number of days of inactivity (required for inactivity trigger, must be >= 1)"},minCount:{type:"number",description:"Minimum event count (required for frequency trigger, must be >= 1)"},timeWindowDays:{type:"number",description:"Time window in days for frequency trigger (required for frequency trigger, must be >= 1)"},emailCount:{type:"number",description:"Number of emails in the sequence (default: 5, max: 10)"},goal:{type:"string",description:"What this sequence should accomplish for AI generation. Be specific to the app's actual features and user journey. Avoid generic goals that don't match the app's business model."},enrollmentMode:{type:"string",enum:["unlimited","one_time","matching_field"],description:"Sequence re-entry mode. Use 'matching_field' only for event_received triggers when duplicate active runs should be blocked per event field value."},enrollmentFieldPath:{type:"string",description:"Dot-path event property used by enrollmentMode='matching_field', such as 'order.id' or 'product.providerVariantId'. Leave omitted for Shopify back-in-stock/replenishment product-variant defaults."},stopCondition:{type:"object",description:"Optional explicit auto-stop condition. Use { type: 'has_tag', value: 'customer' } to end the sequence when a subscriber gets a tag, { type: 'does_not_have_tag', value: 'trial' } when a tag is removed, { type: 'removed_from_list', value: 'list_123' } when they leave a list, { type: 'event_received', value: 'onboarding.completed' } when an event is tracked, or { type: 'none', value: null } for no auto-stop.",properties:{type:{type:"string",enum:["none","has_tag","does_not_have_tag","added_to_list","removed_from_list","event_received"],description:"Stop condition type."},value:{type:["string","null"],description:"Tag name, list ID, or event name for the stop condition. Use null or omit for type 'none'."}},required:["type"]},steps:{type:"array",description:"Explicit sequence steps. Omit type for email steps, or use type: 'create_discount' for a Stripe discount action. Later email steps can reference the most recent discount with {{discount.code}}, {{discount.percentOff}}, {{discount.amountOff}}, and {{discount.expiresAt}}.",items:{type:"object",properties:{type:{type:"string",enum:["email","create_discount","discount"],description:"Step type. Omit or use 'email' for email content. Use 'create_discount' to generate a discount code before later emails."},subject:{type:"string",description:"Email subject. Required for email steps."},previewText:{type:"string",description:"Email preview text."},blocks:{type:"array",description:O5,items:{type:"object"}},html:{type:"string",description:"HTML content for email steps. Will be converted to Sequenzy blocks."},delay:{type:"object",description:"Delay before this step.",properties:{days:{type:"number"},hours:{type:"number"},minutes:{type:"number"}}},name:{type:"string",description:"Email template name for email steps."},discount:{type:"object",description:"Discount configuration for create_discount steps. Prefer this nested shape for new integrations; legacy top-level discount fields are still accepted.",properties:{label:{type:"string",description:"Builder label for the discount step."},provider:{type:"string",enum:["stripe"],description:"Discount provider. Currently only 'stripe'."},discountType:{type:"string",enum:["percent","amount"],description:"Discount type."},percentOff:{type:"number",description:"Percent discount from 1 to 100. Required when discountType is percent."},amountOff:{type:"number",description:"Fixed amount discount in the smallest currency unit, for example 500 for $5. Required when discountType is amount."},currency:{type:"string",description:"ISO currency for amount discounts. Defaults to usd."},duration:{type:"string",enum:["once","forever","repeating"],description:"Stripe coupon duration. Defaults to once."},durationInMonths:{type:"number",description:"Required for repeating discounts."},appliesToAllPlans:{type:"boolean",description:"Whether the discount applies to all plans. Defaults to true."},planIds:{type:"array",description:"Stripe product IDs, such as prod_abc123, when appliesToAllPlans is false.",items:{type:"string"}},codePrefix:{type:"string",description:"Optional prefix for generated promotion codes."},maxRedemptions:{type:"number",description:"Maximum promotion code redemptions. Use 1 for subscriber-specific codes."},lockToSubscriber:{type:"boolean",description:"Stripe-only. Restrict each generated promotion code to the matched subscriber's Stripe customer."},expiresAt:{type:"string",description:"Optional future expiration date or ISO timestamp."},expiresInHours:{type:"number",description:"Optional relative expiration in hours, resolved when each subscriber's code is created (e.g., 48 for a 48-hour window per subscriber). Takes precedence over expiresAt."},name:{type:"string",description:"Optional provider coupon name."}}},label:{type:"string",description:"Legacy top-level discount label. Prefer discount.label."},provider:{type:"string",enum:["stripe"],description:"Legacy top-level discount provider. Prefer discount.provider."},discountType:{type:"string",enum:["percent","amount"],description:"Legacy top-level discount type. Prefer discount.discountType."},percentOff:{type:"number",description:"Percent discount from 1 to 100. Required when discountType is percent."},amountOff:{type:"number",description:"Fixed amount discount in the smallest currency unit, for example 500 for $5. Required when discountType is amount."},currency:{type:"string",description:"ISO currency for amount discounts. Defaults to usd."},duration:{type:"string",enum:["once","forever","repeating"],description:"Stripe coupon duration. Defaults to once."},durationInMonths:{type:"number",description:"Required for repeating discounts."},appliesToAllPlans:{type:"boolean",description:"Whether the discount applies to all plans. Defaults to true."},planIds:{type:"array",description:"Stripe product IDs, such as prod_abc123, when appliesToAllPlans is false.",items:{type:"string"}},codePrefix:{type:"string",description:"Optional prefix for generated promotion codes."},maxRedemptions:{type:"number",description:"Maximum promotion code redemptions. Use 1 for subscriber-specific codes."},lockToSubscriber:{type:"boolean",description:"Legacy top-level Stripe-only flag. Prefer discount.lockToSubscriber."},expiresAt:{type:"string",description:"Optional future expiration date or ISO timestamp."},expiresInHours:{type:"number",description:"Optional relative expiration in hours, resolved when each subscriber's code is created (e.g., 48 for a 48-hour window per subscriber). Takes precedence over expiresAt."}}}}},required:["name","trigger"]}},{name:"update_sequence",description:"Update an existing sequence. To target a specific step, use the emailId or nodeId returned in get_sequence.sequence.emails. You can also update enrollmentMode and enrollmentFieldPath for event-triggered matching-field enrollment. When inserting an if/else branch, include steps for every branch arm and elseSteps so the branch is usable immediately. Branch conditions support tags, lists, saved segments, custom events, clicked links, and subscriber field comparisons.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},sequenceId:{type:"string",description:"Sequence ID"},name:{type:"string",description:"Sequence name"},enrollmentMode:{type:"string",enum:["unlimited","one_time","matching_field"],description:"Updated sequence re-entry mode. 'matching_field' is only valid for event-based sequence triggers."},enrollmentFieldPath:{type:"string",description:"Dot-path event property used by enrollmentMode='matching_field', such as 'order.id' or 'product.providerVariantId'. Omit to leave unchanged. Use clearEnrollmentFieldPath to clear it."},clearEnrollmentFieldPath:{type:"boolean",description:"Set true to clear enrollmentFieldPath without sending a nullable schema value."},stopCondition:{type:"object",description:"Update the sequence auto-stop condition. Example: { type: 'has_tag', value: 'customer' } ends the sequence when the subscriber has that tag. Use { type: 'removed_from_list', value: 'list_123' } to stop when they leave a list, or { type: 'none', value: null } to clear it.",properties:{type:{type:"string",enum:["none","has_tag","does_not_have_tag","added_to_list","removed_from_list","event_received"]},value:{type:["string","null"],description:"Tag name, list ID, or event name for the stop condition."}},required:["type"]},branch:{type:"object",description:"Insert an if/else branch into an existing sequence. The branch is inserted after afterNodeId and creates an if path plus an else fallback path. Use get_sequence first to choose afterNodeId. Each branch condition should include steps, and elseSteps is required unless allowEmptyPaths is true. Conditions support tags, lists, saved segments, events, clicked links, and field comparisons. Use activityScope for event_received and link_clicked checks.",properties:{afterNodeId:{type:"string",description:"Existing node ID to insert the branch after. Use a nodeId from get_sequence.sequence.nodes or get_sequence.sequence.emails."},label:{type:"string",description:"Optional branch node label."},branches:{type:"array",description:"Conditional branches evaluated in order. An else fallback is created automatically.",items:{type:"object",properties:{id:{type:"string",description:"Optional stable branch ID. Defaults to branch-0, branch-1, etc."},label:{type:"string",description:"Display label, e.g. 'If has customer tag'."},conditionType:{type:"string",enum:["has_tag","in_list","in_segment","event_received","link_clicked","field_equals","field_contains","field_greater_than","field_less_than"],description:"Condition type for this branch."},tagName:{type:"string",description:"Tag name for has_tag conditions. This can be used instead of tagId."},tagId:{type:"string",description:"Tag ID or tag name for has_tag conditions."},listId:{type:"string",description:"List ID for in_list conditions."},segmentId:{type:"string",description:"Segment ID for in_segment conditions."},segmentName:{type:"string",description:"Optional display name for in_segment conditions."},eventName:{type:"string",description:"Event name for event_received conditions, such as project.invite.accepted."},linkUrl:{type:"string",description:"Optional URL substring for link_clicked conditions. Omit to match any clicked link."},activityScope:{type:"string",enum:["ever","this_sequence","previous_email"],description:"Scope for event_received and link_clicked conditions. Omit to check ever."},fieldName:{type:"string",description:"Subscriber attribute name for field conditions."},fieldValue:{type:"string",description:"Comparison value for field conditions."},steps:{type:"array",description:"Steps to create inside this branch path. Required by default so the branch is not an empty placeholder.",items:L5}},required:["conditionType"]}},elseSteps:{type:"array",description:"Steps to create inside the else fallback path. Required by default so the else arm is usable.",items:L5},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:H6,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:H6,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:"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:`${h4} 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:`${H6} Mutually exclusive with \`html\`.`,items:{type:"object"}}},required:["idOrSlug"],additionalProperties:!1}},{name:"send_email",description:"Send a transactional email to a single recipient",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},to:{type:"string",description:"Recipient email address"},subject:{type:"string",description:"Email subject (required if not using templateId)"},html:{type:"string",description:"Email HTML content (required if not using templateId)"},templateId:{type:"string",description:"Template ID to use (alternative to html)"},variables:{type:"object",description:"Variables for template personalization. Nested objects and arrays are supported for repeat blocks, for example { items: [...] }."},subscriberExternalId:{type:"string",description:"Customer-owned subscriber ID for attaching analytics/localization on single-recipient sends."}},required:["to"]}},{name:"get_stats",description:"Get overview statistics for a time period",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},period:{type:"string",description:"Time period: 7d, 30d, or 90d (default: 7d)"}}}},{name:"get_campaign_stats",description:"Get detailed statistics for a campaign",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},campaignId:{type:"string",description:"Campaign ID"}},required:["campaignId"]}},{name:"get_sequence_stats",description:"Get statistics for a sequence, including per-step failed subscribers and failure reasons",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},sequenceId:{type:"string",description:"Sequence ID"}},required:["sequenceId"]}},{name:"get_subscriber_activity",description:"Get recent activity, email stats, and current sequence enrollments for a subscriber",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},email:{type:"string",description:"Subscriber email address. Provide email or externalId to identify the subscriber."},externalId:{type:"string",description:"Customer-owned subscriber ID. Provide email or externalId to identify the subscriber."}},required:[]}},{name:"generate_email",description:"Generate email blocks from a prompt",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},prompt:{type:"string",description:"Description of the email to generate"},style:{type:"string",description:"Style: minimal, branded, promotional"},tone:{type:"string",description:"Tone: professional, casual, friendly"}},required:["prompt"]}},{name:"generate_sequence",description:"[DEPRECATED - Use create_sequence instead] Generate a multi-email sequence from a goal. Note: create_sequence now handles AI generation automatically.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},goal:{type:"string",description:"Goal of the sequence (e.g., 'onboard new SaaS trial users')"},emailCount:{type:"number",description:"Number of emails in the sequence (default: 5, max: 10)"},durationDays:{type:"number",description:"Total duration in days (default: 14)"}},required:["goal"]}},{name:"generate_subject_lines",description:"Generate A/B test subject line variants",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},topic:{type:"string",description:"Topic or context for the subject lines"},count:{type:"number",description:"Number of variants to generate (default: 5)"}},required:["topic"]}}];async function j5(Q,Y){try{let X;switch(Q){case"get_account":{let G=await N("GET","/api/v1/account"),z=B1();X={...G,selectedCompanyId:z??G.currentCompanyId};break}case"select_company":{let G=Y.companyId,z=await N("GET","/api/v1/account"),J=z.companies?.find(($)=>$.id===G);if(!J)throw Error(`Company not found. Available companies: ${z.companies?.map(($)=>`${$.name} (${$.id})`).join(", ")??"none"}`);F6(G),X={success:!0,message:`Switched to company: ${J.name}`,companyId:J.id,companyName:J.name};break}case"get_app_urls":{let G=await w5(Y);X={...K1({companyId:G,campaignId:j(Y,"campaignId"),sequenceId:j(Y,"sequenceId"),emailId:j(Y,"emailId")??j(Y,"templateId"),transactionalId:j(Y,"transactionalId"),emailSendId:j(Y,"emailSendId"),domainId:j(Y,"domainId"),status:j(Y,"status"),settingsTab:j(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 N("POST","/api/v1/companies",{name:Y.name,domain:Y.domain});if(!G.success)throw Error("Failed to create company");let z=G.company.id,J=6,$=0,H=G.company.status;while(H==="processing"&&$<J){await new Promise((K)=>setTimeout(K,20000)),$++;let U=await N("GET",`/api/v1/companies/${z}`);if(U.success)H=U.company.status}F6(z);let A=await N("GET",`/api/v1/companies/${z}`);X={success:!0,company:A.company,message:H==="processing"?"Company created but still processing. You can continue using it while processing completes.":`Company '${A.company.name}' created and ready to use.`,autoSelected:!0};break}case"get_company":{let G=Y.companyId;X=await N("GET",`/api/v1/companies/${G}`);break}case"create_api_key":{let G=Y.companyId;X=await N("POST","/api/v1/api-keys",{name:Y.name},G);break}case"list_websites":{let G=Y.companyId;X=await N("GET","/api/v1/websites",void 0,G);break}case"add_website":{let G=Y.companyId;X=await N("POST","/api/v1/websites",{domain:Y.domain},G);break}case"check_website":{let G=Y.companyId;X=await N("GET",`/api/v1/websites/${Y.domain}`,void 0,G);break}case"get_integration_guide":X=await N("POST","/api/v1/integration-guide",Y);break;case"add_subscriber":{let G=Y.companyId,z=f4("add_subscriber",Y);X=await N("POST","/api/v1/subscribers",{...z,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,z=f4("update_subscriber",Y),J=await S9(z,G),$=Array.isArray(J.subscriber.tags)?J.subscriber.tags.filter((D)=>typeof D==="string"):[],H=Array.isArray(Y.addTags)?Y.addTags.filter((D)=>typeof D==="string"&&D.trim()!=="").map(F5):[],A=new Set(Array.isArray(Y.removeTags)?Y.removeTags.filter((D)=>typeof D==="string"&&D.trim()!=="").map(F5):[]),U=$.filter((D)=>!A.has(D));for(let D of H)if(!U.includes(D))U.push(D);let K={};if(z.email&&z.externalId)K.externalId=z.externalId;if(B0(Y.attributes))K.customAttributes={...B0(J.subscriber.customAttributes)?J.subscriber.customAttributes:{},...Y.attributes};if(Y.addTags||Y.removeTags)K.tags=U;X=await N("PATCH",C9(z),K,G);break}case"remove_subscriber":{let G=Y.companyId,z=f4("remove_subscriber",Y),J=C9(z);if(Y.hardDelete===!0)X=await N("DELETE",J,void 0,G);else X=await N("PATCH",J,{status:"unsubscribed"},G);break}case"get_subscriber":{let G=Y.companyId,z=f4("get_subscriber",Y);X=await S9(z,G);break}case"search_subscribers":{let G=Y.companyId;X=await yM(Y,G);break}case"list_tags":{let G=Y.companyId;X=await N("GET","/api/v1/tags",void 0,G);break}case"list_lists":{let G=Y.companyId;X=await N("GET","/api/v1/lists",void 0,G);break}case"create_list":{let G=Y.companyId;X=await N("POST","/api/v1/lists",Y,G);break}case"add_subscribers_to_list":{let G=Y.companyId,z=hM("add_subscribers_to_list",Y,"listId"),J=fM("add_subscribers_to_list",Y),$=q5("add_subscribers_to_list",Y,"duplicateStrategy",["skip","merge","overwrite"])??"skip",H=q5("add_subscribers_to_list",Y,"optInMode",["default","confirmed","double_opt_in"])??"default";X=await N("POST",`/api/v1/lists/${encodeURIComponent(z)}/subscribers`,{emails:J,duplicateStrategy:$,enrollInSequences:Y.enrollInSequences===!0,optInMode:H},G);break}case"list_segments":{let G=Y.companyId;X=await N("GET","/api/v1/segments",void 0,G);break}case"create_segment":{SM(Y);let G=Y.companyId;X=await N("POST","/api/v1/segments",{...Y,...Y.filters!==void 0?{filters:M5(Y.filters)}:{},...Y.root!==void 0?{root:V5(Y.root)}:{}},G);break}case"get_segment_count":{let G=Y.companyId;X=await N("GET",`/api/v1/segments/${Y.segmentId}/count`,void 0,G);break}case"list_templates":{let G=Y.companyId,z=new URLSearchParams,J=j(Y,"label");if(J)z.set("label",J);X=await N("GET",`/api/v1/templates${z.size>0?`?${z}`:""}`,void 0,G);break}case"get_template":{let G=Y.companyId;X=await N("GET",`/api/v1/templates/${Y.templateId}`,void 0,G);break}case"create_template":{let G=Y.companyId;w1("create_template",Y,{requireContent:!0}),U6("create_template",Y),X=await N("POST","/api/v1/templates",Y,G);break}case"update_template":{let G=Y.companyId,z=new Set(["companyId","templateId","name","subject","html","blocks","labels"]),J=Object.keys(Y).filter(($)=>!z.has($));if(J.length>0)throw Error(`\`update_template\` accepts only \`name\`, \`subject\`, \`html\`, \`blocks\`, and \`labels\` update fields. Unsupported field${J.length===1?"":"s"}: ${J.map(($)=>`\`${$}\``).join(", ")}.`);if(w1("update_template",Y),U6("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 N("PUT",`/api/v1/templates/${Y.templateId}`,Y,G);break}case"delete_template":{let G=Y.companyId;X=await N("DELETE",`/api/v1/templates/${Y.templateId}`,void 0,G);break}case"list_ab_tests":{let G=Y.companyId,z=new URLSearchParams,J=j(Y,"sequenceId");if(J)z.set("sequenceId",J);X=await N("GET",`/api/v1/ab-tests${z.size>0?`?${z}`:""}`,void 0,G);break}case"get_ab_test":{let G=Y.companyId;X=await N("GET",`/api/v1/ab-tests/${Y.abTestId}`,void 0,G);break}case"get_ab_test_stats":{let G=Y.companyId,z=new URLSearchParams,J=j(Y,"period"),$=j(Y,"start"),H=j(Y,"end");if(J)z.set("period",J);if($)z.set("start",$);if(H)z.set("end",H);X=await N("GET",`/api/v1/ab-tests/${Y.abTestId}/stats${z.size>0?`?${z}`:""}`,void 0,G);break}case"restart_ab_test":{let G=Y.companyId,z=new Set(["companyId","abTestId","sourceVariantId","testType","winnerThreshold","variantCount"]),J=Object.keys(Y).filter((U)=>!z.has(U));if(J.length>0)throw Error(`\`restart_ab_test\` accepts only \`sourceVariantId\`, \`testType\`, \`winnerThreshold\`, and \`variantCount\` option fields. Unsupported field${J.length===1?"":"s"}: ${J.map((U)=>`\`${U}\``).join(", ")}.`);let $=j(Y,"testType");if($!==void 0&&$!=="subject"&&$!=="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 A=Y.variantCount===void 0?void 0:Number(Y.variantCount);if(A!==void 0&&(!Number.isInteger(A)||A<2||A>4))throw Error("`restart_ab_test` variantCount must be an integer from 2 to 4.");X=await N("POST",`/api/v1/ab-tests/${Y.abTestId}/restart`,{sourceVariantId:j(Y,"sourceVariantId"),testType:$,winnerThreshold:H,variantCount:A},G);break}case"update_ab_test_variant":{let G=Y.companyId,z=new Set(["companyId","abTestId","variantId","subject","previewText","html","blocks"]),J=Object.keys(Y).filter(($)=>!z.has($));if(J.length>0)throw Error(`\`update_ab_test_variant\` accepts only \`subject\`, \`previewText\`, \`html\`, and \`blocks\` update fields. Unsupported field${J.length===1?"":"s"}: ${J.map(($)=>`\`${$}\``).join(", ")}.`);if(w1("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 N("PATCH",`/api/v1/ab-tests/${Y.abTestId}/variants/${Y.variantId}`,Y,G);break}case"list_campaigns":{let G=Y.companyId,z=new URLSearchParams;if(Y.status)z.set("status",String(Y.status));let J=j(Y,"label");if(J)z.set("label",J);X=await N("GET",`/api/v1/campaigns?${z}`,void 0,G);break}case"get_campaign":{let G=Y.companyId;X=await N("GET",`/api/v1/campaigns/${Y.campaignId}`,void 0,G);break}case"get_email_send":{let G=Y.companyId;X=await N("GET",`/api/v1/email-sends/${encodeURIComponent(String(Y.emailSendId))}`,void 0,G);break}case"create_campaign":{let G=Y.companyId;vM(Y);let z=j(Y,"prompt");if(z!==void 0){let J=await N("POST","/api/v1/generate/email",{prompt:z,...Y.style!==void 0&&{style:Y.style},...Y.tone!==void 0&&{tone:Y.tone}},G),$=j(Y,"subject")??(typeof J.subject==="string"&&J.subject.trim()!==""?J.subject.trim():void 0);if(!$)throw Error("`create_campaign` prompt generation did not return a subject. Provide `subject` explicitly.");let H=Array.isArray(J.blocks)&&J.blocks.length>0?J.blocks:void 0,A=typeof J.html==="string"&&J.html.trim()!==""?J.html:void 0;if(H===void 0&&A===void 0)throw Error("`create_campaign` prompt generation did not return email blocks. Try again or provide `html` or `blocks` explicitly.");X=await N("POST","/api/v1/campaigns",{name:Y.name,subject:$,...H!==void 0?{blocks:H}:{html:A},...Y.segmentId!==void 0&&{segmentId:Y.segmentId},...Y.trackingCode!==void 0&&{trackingCode:Y.trackingCode},...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 N("POST","/api/v1/campaigns",Y,G);break}case"update_campaign":{let G=Y.companyId,z=new Set(["companyId","campaignId","name","subject","trackingCode","html","blocks","replyTo","replyProfileId","campaignData","computedLists","labels"]),J=Object.keys(Y).filter(($)=>!z.has($));if(J.length>0)throw Error(`\`update_campaign\` accepts only \`name\`, \`subject\`, \`trackingCode\`, \`html\`, \`blocks\`, \`replyTo\`, \`replyProfileId\`, \`campaignData\`, \`computedLists\`, and \`labels\` update fields. Unsupported field${J.length===1?"":"s"}: ${J.map(($)=>`\`${$}\``).join(", ")}.`);if(w1("update_campaign",Y),U6("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 N("PUT",`/api/v1/campaigns/${Y.campaignId}`,Y,G);break}case"schedule_campaign":{let G=Y.companyId,z=new Set(["companyId","campaignId","scheduledAt","targetLists","sendTimeOptimization","spreadOverHours"]),J=Object.keys(Y).filter(($)=>!z.has($));if(J.length>0)throw Error(`\`schedule_campaign\` accepts only \`campaignId\`, \`scheduledAt\`, \`targetLists\`, \`sendTimeOptimization\`, and \`spreadOverHours\`. Unsupported field${J.length===1?"":"s"}: ${J.map(($)=>`\`${$}\``).join(", ")}.`);kM(Y),X=await N("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 N("POST",`/api/v1/campaigns/${Y.campaignId}/test`,{to:Y.to},G);break}case"list_sequences":{let G=Y.companyId;X=await N("GET","/api/v1/sequences",void 0,G);break}case"get_sequence":{let G=Y.companyId;X=await N("GET",`/api/v1/sequences/${Y.sequenceId}`,void 0,G);break}case"create_sequence":{let G=Y.companyId,z=Array.isArray(Y.steps)&&Y.steps.length>0,J=await N("POST","/api/v1/sequences",Y,G);if(!J.success){X=J;break}let $=J.sequence.id;if(z){let D=await N("GET",`/api/v1/sequences/${$}`,void 0,G);if(D.success)X={success:!0,sequence:D.sequence,message:`Sequence "${D.sequence.name}" created with explicit steps. Review it before enabling.`};else X=D;break}let H=6,A=0,U="pending";while(U!=="complete"&&A<H){await new Promise((L)=>setTimeout(L,20000)),A++;let D=await N("GET",`/api/v1/sequences/${$}`,void 0,G);if(D.success)U=D.sequence.enrichmentStatus}let K=await N("GET",`/api/v1/sequences/${$}`,void 0,G);if(K.success)X={success:!0,sequence:K.sequence,message:K.sequence.enrichmentStatus==="complete"?`Sequence "${K.sequence.name}" created with ${K.sequence.emailCount} AI-generated emails. The sequence is ready to review and enable.`:`Sequence "${K.sequence.name}" created. Email enrichment is still in progress (${K.sequence.enrichedCount}/${K.sequence.emailCount} emails generated). You can check status with get_sequence.`};else X=K;break}case"update_sequence":{let G=Y.companyId,z=RM(Y);X=await N("PUT",`/api/v1/sequences/${Y.sequenceId}`,z,G);break}case"enable_sequence":{let G=Y.companyId;X=await N("POST",`/api/v1/sequences/${Y.sequenceId}/enable`,void 0,G);break}case"disable_sequence":{let G=Y.companyId;X=await N("POST",`/api/v1/sequences/${Y.sequenceId}/disable`,void 0,G);break}case"cancel_sequence_enrollments":{let G=Y.companyId,z=CM(Y);X=await N("POST",`/api/v1/sequences/${Y.sequenceId}/enrollments/cancel`,z,G);break}case"delete_sequence":{let G=Y.companyId;X=await N("DELETE",`/api/v1/sequences/${Y.sequenceId}`,void 0,G);break}case"list_transactional_emails":{let G=Y.companyId;X=await N("GET","/api/v1/transactional",void 0,G);break}case"get_transactional_email":{let G=Y.companyId;X=await N("GET",`/api/v1/transactional/${Y.idOrSlug}`,void 0,G);break}case"create_transactional_email":{let G=Y.companyId,z=new Set(["companyId","name","slug","subject","previewText","html","blocks","prompt","style","tone","enabled"]),J=Object.keys(Y).filter((A)=>!z.has(A));if(J.length>0)throw Error(`\`create_transactional_email\` accepts only \`name\`, \`slug\`, \`subject\`, \`previewText\`, \`html\`, \`blocks\`, \`prompt\`, \`style\`, \`tone\`, and \`enabled\` fields. Unsupported field${J.length===1?"":"s"}: ${J.map((A)=>`\`${A}\``).join(", ")}.`);xM(Y);let $=j(Y,"prompt");if($!==void 0){let A={companyId:G??B1()??"",name:typeof Y.name==="string"&&Y.name.trim()!==""?Y.name.trim():"",slug:typeof Y.slug==="string"&&Y.slug.trim()!==""?Y.slug.trim():"",promptLength:$.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",A);let U=await N("POST","/api/v1/generate/email",{prompt:$,...Y.style!==void 0&&{style:Y.style},...Y.tone!==void 0&&{tone:Y.tone}},G);console.error("[mcp:create_transactional_email] prompt generation complete",{...A,subject:U.subject??"",previewTextLength:typeof U.previewText==="string"?U.previewText.length:0,blockCount:Array.isArray(U.blocks)?U.blocks.length:0,htmlLength:typeof U.html==="string"?U.html.length:0});let K=j(Y,"subject")??(typeof U.subject==="string"&&U.subject.trim()!==""?U.subject.trim():void 0);if(!K)throw Error("`create_transactional_email` prompt generation did not return a subject. Provide `subject` explicitly.");let D=Array.isArray(U.blocks)&&U.blocks.length>0?U.blocks:void 0,L=typeof U.html==="string"&&U.html.trim()!==""?U.html:void 0,q=j(Y,"previewText")??(typeof U.previewText==="string"?U.previewText.trim():void 0);if(D===void 0&&L===void 0)throw Error("`create_transactional_email` prompt generation did not return email blocks. Try again or provide `html` or `blocks` explicitly.");console.error("[mcp:create_transactional_email] creating generated transactional",{...A,subject:K,contentSource:D!==void 0?"blocks":"html",blockCount:D?.length??0,htmlLength:L?.length??0}),X=await N("POST","/api/v1/transactional",{name:Y.name,...Y.slug!==void 0&&{slug:Y.slug},subject:K,...q!==void 0&&{previewText:q},...D!==void 0?{blocks:D}:{html:L},...Y.enabled!==void 0&&{enabled:Y.enabled}},G),console.error("[mcp:create_transactional_email] generated transactional created",A)}catch(U){throw console.error("[mcp:create_transactional_email] prompt-based create failed",{...A,error:U instanceof Error?U.message:String(U)}),U}break}let H=Object.fromEntries(Object.entries(Y).filter(([A])=>A!=="companyId"));X=await N("POST","/api/v1/transactional",H,G);break}case"update_transactional_email":{let G=Y.companyId,z=new Set(["companyId","idOrSlug","name","enabled","subject","previewText","html","blocks"]),J=Object.keys(Y).filter((H)=>!z.has(H));if(J.length>0)throw Error(`\`update_transactional_email\` accepts only \`name\`, \`enabled\`, \`subject\`, \`previewText\`, \`html\`, and \`blocks\` update fields. Unsupported field${J.length===1?"":"s"}: ${J.map((H)=>`\`${H}\``).join(", ")}.`);if(w1("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 $=Object.fromEntries(Object.entries(Y).filter(([H])=>H!=="companyId"&&H!=="idOrSlug"));X=await N("PATCH",`/api/v1/transactional/${Y.idOrSlug}`,$,G);break}case"send_email":{let G=Y.companyId;X=await N("POST","/api/v1/transactional/send",Y,G);break}case"get_stats":{let G=Y.companyId,z=Y.period??"7d";X=await N("GET",`/api/v1/metrics?period=${z}`,void 0,G);break}case"get_campaign_stats":{let G=Y.companyId;X=await N("GET",`/api/v1/metrics/campaigns/${Y.campaignId}`,void 0,G);break}case"get_sequence_stats":{let G=Y.companyId;X=await N("GET",`/api/v1/metrics/sequences/${Y.sequenceId}`,void 0,G);break}case"get_subscriber_activity":{let G=Y.companyId,z=f4("get_subscriber_activity",Y),J=await S9(z,G);X={success:J.success,email:J.subscriber.email,emailStats:J.subscriber.emailStats??null,activity:J.subscriber.activity??[],sequenceEnrollments:J.subscriber.sequenceEnrollments??[]};break}case"generate_email":{let G=Y.companyId;X=await N("POST","/api/v1/generate/email",Y,G);break}case"generate_sequence":{let G=Y.companyId;X=await N("POST","/api/v1/generate/sequence",Y,G);break}case"generate_subject_lines":{let G=Y.companyId;X=await N("POST","/api/v1/generate/subjects",Y,G);break}default:throw Error(`Unknown tool: ${Q}`)}let W=_M(X);if(W)throw W;return X=await cM(Q,Y,X),{content:[{type:"text",text:JSON.stringify(X,null,2)}]}}catch(X){return{isError:!0,content:[{type:"text",text:b1(X)}]}}}async function I5(Q,Y,X){let W=Y.getRequestContext?.(Q)??{};try{return await y9(W,X)}finally{await Y.onRequestContextUpdated?.(W,Q)}}function nI(Q={}){let Y=new E9({name:"sequenzy",version:$5.version},{capabilities:{tools:{},resources:{}}});return Y.setRequestHandler(LY,async()=>{return{tools:P5}}),Y.setRequestHandler(B4,async(X,W)=>{let{name:G,arguments:z}=X.params;return I5(W,Q,()=>j5(G,z??{}))}),Y.setRequestHandler($Y,async()=>{return{resources:U5}}),Y.setRequestHandler(AY,async(X,W)=>{let{uri:G}=X.params;return I5(W,Q,()=>K5(G))}),Y}export{nI as createSequenzyMcpServer};
|