superpowers-mcp 6.4.1 → 6.4.2

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/out/server.js CHANGED
@@ -1,14 +1,14 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var I$=Object.create;var Zs=Object.defineProperty;var P$=Object.getOwnPropertyDescriptor;var j$=Object.getOwnPropertyNames;var E$=Object.getPrototypeOf,T$=Object.prototype.hasOwnProperty;var j=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},Tn=(e,t)=>{for(var r in t)Zs(e,r,{get:t[r],enumerable:!0})},O$=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of j$(t))!T$.call(e,o)&&o!==r&&Zs(e,o,{get:()=>t[o],enumerable:!(n=P$(t,o))||n.enumerable});return e};var ot=(e,t,r)=>(r=e!=null?I$(E$(e)):{},O$(t||!e||!e.__esModule?Zs(r,"default",{value:e,enumerable:!0}):r,e));var Lo=j(oe=>{"use strict";Object.defineProperty(oe,"__esModule",{value:!0});oe.regexpCode=oe.getEsmExportName=oe.getProperty=oe.safeStringify=oe.stringify=oe.strConcat=oe.addCodeArg=oe.str=oe._=oe.nil=oe._Code=oe.Name=oe.IDENTIFIER=oe._CodeOrName=void 0;var Fo=class{};oe._CodeOrName=Fo;oe.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var br=class extends Fo{constructor(t){if(super(),!oe.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};oe.Name=br;var lt=class extends Fo{constructor(t){super(),this._items=typeof t=="string"?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let t=this._items[0];return t===""||t==='""'}get str(){var t;return(t=this._str)!==null&&t!==void 0?t:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var t;return(t=this._names)!==null&&t!==void 0?t:this._names=this._items.reduce((r,n)=>(n instanceof br&&(r[n.str]=(r[n.str]||0)+1),r),{})}};oe._Code=lt;oe.nil=new lt("");function sv(e,...t){let r=[e[0]],n=0;for(;n<t.length;)Cd(r,t[n]),r.push(e[++n]);return new lt(r)}oe._=sv;var Rd=new lt("+");function cv(e,...t){let r=[qo(e[0])],n=0;for(;n<t.length;)r.push(Rd),Cd(r,t[n]),r.push(Rd,qo(e[++n]));return hS(r),new lt(r)}oe.str=cv;function Cd(e,t){t instanceof lt?e.push(...t._items):t instanceof br?e.push(t):e.push(yS(t))}oe.addCodeArg=Cd;function hS(e){let t=1;for(;t<e.length-1;){if(e[t]===Rd){let r=gS(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function gS(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof br||e[e.length-1]!=='"'?void 0:typeof t!="string"?`${e.slice(0,-1)}${t}"`:t[0]==='"'?e.slice(0,-1)+t.slice(1):void 0;if(typeof t=="string"&&t[0]==='"'&&!(e instanceof br))return`"${e}${t.slice(1)}`}function vS(e,t){return t.emptyStr()?e:e.emptyStr()?t:cv`${e}${t}`}oe.strConcat=vS;function yS(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:qo(Array.isArray(e)?e.join(","):e)}function _S(e){return new lt(qo(e))}oe.stringify=_S;function qo(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}oe.safeStringify=qo;function $S(e){return typeof e=="string"&&oe.IDENTIFIER.test(e)?new lt(`.${e}`):sv`[${e}]`}oe.getProperty=$S;function bS(e){if(typeof e=="string"&&oe.IDENTIFIER.test(e))return new lt(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}oe.getEsmExportName=bS;function xS(e){return new lt(e.toString())}oe.regexpCode=xS});var Ud=j(We=>{"use strict";Object.defineProperty(We,"__esModule",{value:!0});We.ValueScope=We.ValueScopeName=We.Scope=We.varKinds=We.UsedValueState=void 0;var Be=Lo(),Zd=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}},Ja;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(Ja||(We.UsedValueState=Ja={}));We.varKinds={const:new Be.Name("const"),let:new Be.Name("let"),var:new Be.Name("var")};var Ka=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof Be.Name?t:this.name(t)}name(t){return new Be.Name(this._newName(t))}_newName(t){let r=this._names[t]||this._nameGroup(t);return`${t}${r.index++}`}_nameGroup(t){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(t)||this._prefixes&&!this._prefixes.has(t))throw new Error(`CodeGen: prefix "${t}" is not allowed in this scope`);return this._names[t]={prefix:t,index:0}}};We.Scope=Ka;var Ha=class extends Be.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:r,itemIndex:n}){this.value=t,this.scopePath=(0,Be._)`.${new Be.Name(r)}[${n}]`}};We.ValueScopeName=Ha;var kS=(0,Be._)`\n`,Ad=class extends Ka{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?kS:Be.nil}}get(){return this._scope}name(t){return new Ha(t,this._newName(t))}value(t,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let o=this.toName(t),{prefix:i}=o,a=(n=r.key)!==null&&n!==void 0?n:r.ref,s=this._values[i];if(s){let l=s.get(a);if(l)return l}else s=this._values[i]=new Map;s.set(a,o);let c=this._scope[i]||(this._scope[i]=[]),u=c.length;return c[u]=r.ref,o.setValue(r,{property:i,itemIndex:u}),o}getValue(t,r){let n=this._values[t];if(n)return n.get(r)}scopeRefs(t,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Be._)`${t}${n.scopePath}`})}scopeCode(t=this._values,r,n){return this._reduceValues(t,o=>{if(o.value===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return o.value.code},r,n)}_reduceValues(t,r,n={},o){let i=Be.nil;for(let a in t){let s=t[a];if(!s)continue;let c=n[a]=n[a]||new Map;s.forEach(u=>{if(c.has(u))return;c.set(u,Ja.Started);let l=r(u);if(l){let d=this.opts.es5?We.varKinds.var:We.varKinds.const;i=(0,Be._)`${i}${d} ${u} = ${l};${this.opts._n}`}else if(l=o?.(u))i=(0,Be._)`${i}${l}${this.opts._n}`;else throw new Zd(u);c.set(u,Ja.Completed)})}return i}};We.ValueScope=Ad});var W=j(X=>{"use strict";Object.defineProperty(X,"__esModule",{value:!0});X.or=X.and=X.not=X.CodeGen=X.operators=X.varKinds=X.ValueScopeName=X.ValueScope=X.Scope=X.Name=X.regexpCode=X.stringify=X.getProperty=X.nil=X.strConcat=X.str=X._=void 0;var te=Lo(),vt=Ud(),rr=Lo();Object.defineProperty(X,"_",{enumerable:!0,get:function(){return rr._}});Object.defineProperty(X,"str",{enumerable:!0,get:function(){return rr.str}});Object.defineProperty(X,"strConcat",{enumerable:!0,get:function(){return rr.strConcat}});Object.defineProperty(X,"nil",{enumerable:!0,get:function(){return rr.nil}});Object.defineProperty(X,"getProperty",{enumerable:!0,get:function(){return rr.getProperty}});Object.defineProperty(X,"stringify",{enumerable:!0,get:function(){return rr.stringify}});Object.defineProperty(X,"regexpCode",{enumerable:!0,get:function(){return rr.regexpCode}});Object.defineProperty(X,"Name",{enumerable:!0,get:function(){return rr.Name}});var Xa=Ud();Object.defineProperty(X,"Scope",{enumerable:!0,get:function(){return Xa.Scope}});Object.defineProperty(X,"ValueScope",{enumerable:!0,get:function(){return Xa.ValueScope}});Object.defineProperty(X,"ValueScopeName",{enumerable:!0,get:function(){return Xa.ValueScopeName}});Object.defineProperty(X,"varKinds",{enumerable:!0,get:function(){return Xa.varKinds}});X.operators={GT:new te._Code(">"),GTE:new te._Code(">="),LT:new te._Code("<"),LTE:new te._Code("<="),EQ:new te._Code("==="),NEQ:new te._Code("!=="),NOT:new te._Code("!"),OR:new te._Code("||"),AND:new te._Code("&&"),ADD:new te._Code("+")};var Ft=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},Md=class extends Ft{constructor(t,r,n){super(),this.varKind=t,this.name=r,this.rhs=n}render({es5:t,_n:r}){let n=t?vt.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=pn(this.rhs,t,r)),this}get names(){return this.rhs instanceof te._CodeOrName?this.rhs.names:{}}},Ba=class extends Ft{constructor(t,r,n){super(),this.lhs=t,this.rhs=r,this.sideEffects=n}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,r){if(!(this.lhs instanceof te.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=pn(this.rhs,t,r),this}get names(){let t=this.lhs instanceof te.Name?{}:{...this.lhs.names};return Ga(t,this.rhs)}},Fd=class extends Ba{constructor(t,r,n,o){super(t,n,o),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},qd=class extends Ft{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},Ld=class extends Ft{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},Vd=class extends Ft{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},Jd=class extends Ft{constructor(t){super(),this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(t,r){return this.code=pn(this.code,t,r),this}get names(){return this.code instanceof te._CodeOrName?this.code.names:{}}},Vo=class extends Ft{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce((r,n)=>r+n.render(t),"")}optimizeNodes(){let{nodes:t}=this,r=t.length;for(;r--;){let n=t[r].optimizeNodes();Array.isArray(n)?t.splice(r,1,...n):n?t[r]=n:t.splice(r,1)}return t.length>0?this:void 0}optimizeNames(t,r){let{nodes:n}=this,o=n.length;for(;o--;){let i=n[o];i.optimizeNames(t,r)||(wS(t,i.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>wr(t,r.names),{})}},qt=class extends Vo{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},Kd=class extends Vo{},dn=class extends qt{};dn.kind="else";var xr=class e extends qt{constructor(t,r){super(r),this.condition=t}render(t){let r=`if(${this.condition})`+super.render(t);return this.else&&(r+="else "+this.else.render(t)),r}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new dn(n):n}if(r)return t===!1?r instanceof e?r:r.nodes:this.nodes.length?this:new e(uv(t),r instanceof e?[r]:r.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(t,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(t,r),!!(super.optimizeNames(t,r)||this.else))return this.condition=pn(this.condition,t,r),this}get names(){let t=super.names;return Ga(t,this.condition),this.else&&wr(t,this.else.names),t}};xr.kind="if";var kr=class extends qt{};kr.kind="for";var Hd=class extends kr{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iteration=pn(this.iteration,t,r),this}get names(){return wr(super.names,this.iteration.names)}},Bd=class extends kr{constructor(t,r,n,o){super(),this.varKind=t,this.name=r,this.from=n,this.to=o}render(t){let r=t.es5?vt.varKinds.var:this.varKind,{name:n,from:o,to:i}=this;return`for(${r} ${n}=${o}; ${n}<${i}; ${n}++)`+super.render(t)}get names(){let t=Ga(super.names,this.from);return Ga(t,this.to)}},Wa=class extends kr{constructor(t,r,n,o){super(),this.loop=t,this.varKind=r,this.name=n,this.iterable=o}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iterable=pn(this.iterable,t,r),this}get names(){return wr(super.names,this.iterable.names)}},Jo=class extends qt{constructor(t,r,n){super(),this.name=t,this.args=r,this.async=n}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}};Jo.kind="func";var Ko=class extends Vo{render(t){return"return "+super.render(t)}};Ko.kind="return";var Wd=class extends qt{render(t){let r="try"+super.render(t);return this.catch&&(r+=this.catch.render(t)),this.finally&&(r+=this.finally.render(t)),r}optimizeNodes(){var t,r;return super.optimizeNodes(),(t=this.catch)===null||t===void 0||t.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(t,r){var n,o;return super.optimizeNames(t,r),(n=this.catch)===null||n===void 0||n.optimizeNames(t,r),(o=this.finally)===null||o===void 0||o.optimizeNames(t,r),this}get names(){let t=super.names;return this.catch&&wr(t,this.catch.names),this.finally&&wr(t,this.finally.names),t}},Ho=class extends qt{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};Ho.kind="catch";var Bo=class extends qt{render(t){return"finally"+super.render(t)}};Bo.kind="finally";var Gd=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
3
- `:""},this._extScope=t,this._scope=new vt.Scope({parent:t}),this._nodes=[new Kd]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,r){let n=this._extScope.value(t,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(t,r){return this._extScope.getValue(t,r)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,r,n,o){let i=this._scope.toName(r);return n!==void 0&&o&&(this._constants[i.str]=n),this._leafNode(new Md(t,i,n)),i}const(t,r,n){return this._def(vt.varKinds.const,t,r,n)}let(t,r,n){return this._def(vt.varKinds.let,t,r,n)}var(t,r,n){return this._def(vt.varKinds.var,t,r,n)}assign(t,r,n){return this._leafNode(new Ba(t,r,n))}add(t,r){return this._leafNode(new Fd(t,X.operators.ADD,r))}code(t){return typeof t=="function"?t():t!==te.nil&&this._leafNode(new Jd(t)),this}object(...t){let r=["{"];for(let[n,o]of t)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0,te.addCodeArg)(r,o));return r.push("}"),new te._Code(r)}if(t,r,n){if(this._blockNode(new xr(t)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new xr(t))}else(){return this._elseNode(new dn)}endIf(){return this._endBlockNode(xr,dn)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new Hd(t),r)}forRange(t,r,n,o,i=this.opts.es5?vt.varKinds.var:vt.varKinds.let){let a=this._scope.toName(t);return this._for(new Bd(i,a,r,n),()=>o(a))}forOf(t,r,n,o=vt.varKinds.const){let i=this._scope.toName(t);if(this.opts.es5){let a=r instanceof te.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,te._)`${a}.length`,s=>{this.var(i,(0,te._)`${a}[${s}]`),n(i)})}return this._for(new Wa("of",o,i,r),()=>n(i))}forIn(t,r,n,o=this.opts.es5?vt.varKinds.var:vt.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,te._)`Object.keys(${r})`,n);let i=this._scope.toName(t);return this._for(new Wa("in",o,i,r),()=>n(i))}endFor(){return this._endBlockNode(kr)}label(t){return this._leafNode(new qd(t))}break(t){return this._leafNode(new Ld(t))}return(t){let r=new Ko;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Ko)}try(t,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new Wd;if(this._blockNode(o),this.code(t),r){let i=this.name("e");this._currNode=o.catch=new Ho(i),r(i)}return n&&(this._currNode=o.finally=new Bo,this.code(n)),this._endBlockNode(Ho,Bo)}throw(t){return this._leafNode(new Vd(t))}block(t,r){return this._blockStarts.push(this._nodes.length),t&&this.code(t).endBlock(r),this}endBlock(t){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||t!==void 0&&n!==t)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${t} expected`);return this._nodes.length=r,this}func(t,r=te.nil,n,o){return this._blockNode(new Jo(t,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(Jo)}optimize(t=1){for(;t-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(t){return this._currNode.nodes.push(t),this}_blockNode(t){this._currNode.nodes.push(t),this._nodes.push(t)}_endBlockNode(t,r){let n=this._currNode;if(n instanceof t||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${t.kind}/${r.kind}`:t.kind}"`)}_elseNode(t){let r=this._currNode;if(!(r instanceof xr))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=t,this}get _root(){return this._nodes[0]}get _currNode(){let t=this._nodes;return t[t.length-1]}set _currNode(t){let r=this._nodes;r[r.length-1]=t}};X.CodeGen=Gd;function wr(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function Ga(e,t){return t instanceof te._CodeOrName?wr(e,t.names):e}function pn(e,t,r){if(e instanceof te.Name)return n(e);if(!o(e))return e;return new te._Code(e._items.reduce((i,a)=>(a instanceof te.Name&&(a=n(a)),a instanceof te._Code?i.push(...a._items):i.push(a),i),[]));function n(i){let a=r[i.str];return a===void 0||t[i.str]!==1?i:(delete t[i.str],a)}function o(i){return i instanceof te._Code&&i._items.some(a=>a instanceof te.Name&&t[a.str]===1&&r[a.str]!==void 0)}}function wS(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function uv(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,te._)`!${Xd(e)}`}X.not=uv;var SS=lv(X.operators.AND);function zS(...e){return e.reduce(SS)}X.and=zS;var IS=lv(X.operators.OR);function PS(...e){return e.reduce(IS)}X.or=PS;function lv(e){return(t,r)=>t===te.nil?r:r===te.nil?t:(0,te._)`${Xd(t)} ${e} ${Xd(r)}`}function Xd(e){return e instanceof te.Name?e:(0,te._)`(${e})`}});var re=j(Q=>{"use strict";Object.defineProperty(Q,"__esModule",{value:!0});Q.checkStrictMode=Q.getErrorPath=Q.Type=Q.useFunc=Q.setEvaluated=Q.evaluatedPropsToName=Q.mergeEvaluated=Q.eachItem=Q.unescapeJsonPointer=Q.escapeJsonPointer=Q.escapeFragment=Q.unescapeFragment=Q.schemaRefOrVal=Q.schemaHasRulesButRef=Q.schemaHasRules=Q.checkUnknownRules=Q.alwaysValidSchema=Q.toHash=void 0;var pe=W(),jS=Lo();function ES(e){let t={};for(let r of e)t[r]=!0;return t}Q.toHash=ES;function TS(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(fv(e,t),!mv(t,e.self.RULES.all))}Q.alwaysValidSchema=TS;function fv(e,t=e.schema){let{opts:r,self:n}=e;if(!r.strictSchema||typeof t=="boolean")return;let o=n.RULES.keywords;for(let i in t)o[i]||vv(e,`unknown keyword: "${i}"`)}Q.checkUnknownRules=fv;function mv(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}Q.schemaHasRules=mv;function OS(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}Q.schemaHasRulesButRef=OS;function NS({topSchemaRef:e,schemaPath:t},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,pe._)`${r}`}return(0,pe._)`${e}${t}${(0,pe.getProperty)(n)}`}Q.schemaRefOrVal=NS;function DS(e){return hv(decodeURIComponent(e))}Q.unescapeFragment=DS;function RS(e){return encodeURIComponent(Qd(e))}Q.escapeFragment=RS;function Qd(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}Q.escapeJsonPointer=Qd;function hv(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}Q.unescapeJsonPointer=hv;function CS(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}Q.eachItem=CS;function dv({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(o,i,a,s)=>{let c=a===void 0?i:a instanceof pe.Name?(i instanceof pe.Name?e(o,i,a):t(o,i,a),a):i instanceof pe.Name?(t(o,a,i),i):r(i,a);return s===pe.Name&&!(c instanceof pe.Name)?n(o,c):c}}Q.mergeEvaluated={props:dv({mergeNames:(e,t,r)=>e.if((0,pe._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,pe._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,pe._)`${r} || {}`).code((0,pe._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,pe._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,pe._)`${r} || {}`),ep(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:gv}),items:dv({mergeNames:(e,t,r)=>e.if((0,pe._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,pe._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,pe._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,pe._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function gv(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",(0,pe._)`{}`);return t!==void 0&&ep(e,r,t),r}Q.evaluatedPropsToName=gv;function ep(e,t,r){Object.keys(r).forEach(n=>e.assign((0,pe._)`${t}${(0,pe.getProperty)(n)}`,!0))}Q.setEvaluated=ep;var pv={};function ZS(e,t){return e.scopeValue("func",{ref:t,code:pv[t.code]||(pv[t.code]=new jS._Code(t.code))})}Q.useFunc=ZS;var Yd;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Yd||(Q.Type=Yd={}));function AS(e,t,r){if(e instanceof pe.Name){let n=t===Yd.Num;return r?n?(0,pe._)`"[" + ${e} + "]"`:(0,pe._)`"['" + ${e} + "']"`:n?(0,pe._)`"/" + ${e}`:(0,pe._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,pe.getProperty)(e).toString():"/"+Qd(e)}Q.getErrorPath=AS;function vv(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,r===!0)throw new Error(t);e.self.logger.warn(t)}}Q.checkStrictMode=vv});var Lt=j(tp=>{"use strict";Object.defineProperty(tp,"__esModule",{value:!0});var Ce=W(),US={data:new Ce.Name("data"),valCxt:new Ce.Name("valCxt"),instancePath:new Ce.Name("instancePath"),parentData:new Ce.Name("parentData"),parentDataProperty:new Ce.Name("parentDataProperty"),rootData:new Ce.Name("rootData"),dynamicAnchors:new Ce.Name("dynamicAnchors"),vErrors:new Ce.Name("vErrors"),errors:new Ce.Name("errors"),this:new Ce.Name("this"),self:new Ce.Name("self"),scope:new Ce.Name("scope"),json:new Ce.Name("json"),jsonPos:new Ce.Name("jsonPos"),jsonLen:new Ce.Name("jsonLen"),jsonPart:new Ce.Name("jsonPart")};tp.default=US});var Wo=j(Ze=>{"use strict";Object.defineProperty(Ze,"__esModule",{value:!0});Ze.extendErrors=Ze.resetErrorsCount=Ze.reportExtraError=Ze.reportError=Ze.keyword$DataError=Ze.keywordError=void 0;var ne=W(),Ya=re(),Je=Lt();Ze.keywordError={message:({keyword:e})=>(0,ne.str)`must pass "${e}" keyword validation`};Ze.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,ne.str)`"${e}" keyword must be ${t} ($data)`:(0,ne.str)`"${e}" keyword is invalid ($data)`};function MS(e,t=Ze.keywordError,r,n){let{it:o}=e,{gen:i,compositeRule:a,allErrors:s}=o,c=$v(e,t,r);n??(a||s)?yv(i,c):_v(o,(0,ne._)`[${c}]`)}Ze.reportError=MS;function FS(e,t=Ze.keywordError,r){let{it:n}=e,{gen:o,compositeRule:i,allErrors:a}=n,s=$v(e,t,r);yv(o,s),i||a||_v(n,Je.default.vErrors)}Ze.reportExtraError=FS;function qS(e,t){e.assign(Je.default.errors,t),e.if((0,ne._)`${Je.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,ne._)`${Je.default.vErrors}.length`,t),()=>e.assign(Je.default.vErrors,null)))}Ze.resetErrorsCount=qS;function LS({gen:e,keyword:t,schemaValue:r,data:n,errsCount:o,it:i}){if(o===void 0)throw new Error("ajv implementation error");let a=e.name("err");e.forRange("i",o,Je.default.errors,s=>{e.const(a,(0,ne._)`${Je.default.vErrors}[${s}]`),e.if((0,ne._)`${a}.instancePath === undefined`,()=>e.assign((0,ne._)`${a}.instancePath`,(0,ne.strConcat)(Je.default.instancePath,i.errorPath))),e.assign((0,ne._)`${a}.schemaPath`,(0,ne.str)`${i.errSchemaPath}/${t}`),i.opts.verbose&&(e.assign((0,ne._)`${a}.schema`,r),e.assign((0,ne._)`${a}.data`,n))})}Ze.extendErrors=LS;function yv(e,t){let r=e.const("err",t);e.if((0,ne._)`${Je.default.vErrors} === null`,()=>e.assign(Je.default.vErrors,(0,ne._)`[${r}]`),(0,ne._)`${Je.default.vErrors}.push(${r})`),e.code((0,ne._)`${Je.default.errors}++`)}function _v(e,t){let{gen:r,validateName:n,schemaEnv:o}=e;o.$async?r.throw((0,ne._)`new ${e.ValidationError}(${t})`):(r.assign((0,ne._)`${n}.errors`,t),r.return(!1))}var Sr={keyword:new ne.Name("keyword"),schemaPath:new ne.Name("schemaPath"),params:new ne.Name("params"),propertyName:new ne.Name("propertyName"),message:new ne.Name("message"),schema:new ne.Name("schema"),parentSchema:new ne.Name("parentSchema")};function $v(e,t,r){let{createErrors:n}=e.it;return n===!1?(0,ne._)`{}`:VS(e,t,r)}function VS(e,t,r={}){let{gen:n,it:o}=e,i=[JS(o,r),KS(e,r)];return HS(e,t,i),n.object(...i)}function JS({errorPath:e},{instancePath:t}){let r=t?(0,ne.str)`${e}${(0,Ya.getErrorPath)(t,Ya.Type.Str)}`:e;return[Je.default.instancePath,(0,ne.strConcat)(Je.default.instancePath,r)]}function KS({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let o=n?t:(0,ne.str)`${t}/${e}`;return r&&(o=(0,ne.str)`${o}${(0,Ya.getErrorPath)(r,Ya.Type.Str)}`),[Sr.schemaPath,o]}function HS(e,{params:t,message:r},n){let{keyword:o,data:i,schemaValue:a,it:s}=e,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=s;n.push([Sr.keyword,o],[Sr.params,typeof t=="function"?t(e):t||(0,ne._)`{}`]),c.messages&&n.push([Sr.message,typeof r=="function"?r(e):r]),c.verbose&&n.push([Sr.schema,a],[Sr.parentSchema,(0,ne._)`${l}${d}`],[Je.default.data,i]),u&&n.push([Sr.propertyName,u])}});var xv=j(fn=>{"use strict";Object.defineProperty(fn,"__esModule",{value:!0});fn.boolOrEmptySchema=fn.topBoolOrEmptySchema=void 0;var BS=Wo(),WS=W(),GS=Lt(),XS={message:"boolean schema is false"};function YS(e){let{gen:t,schema:r,validateName:n}=e;r===!1?bv(e,!1):typeof r=="object"&&r.$async===!0?t.return(GS.default.data):(t.assign((0,WS._)`${n}.errors`,null),t.return(!0))}fn.topBoolOrEmptySchema=YS;function QS(e,t){let{gen:r,schema:n}=e;n===!1?(r.var(t,!1),bv(e)):r.var(t,!0)}fn.boolOrEmptySchema=QS;function bv(e,t){let{gen:r,data:n}=e,o={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,BS.reportError)(o,XS,void 0,t)}});var rp=j(mn=>{"use strict";Object.defineProperty(mn,"__esModule",{value:!0});mn.getRules=mn.isJSONType=void 0;var e0=["string","number","integer","boolean","null","object","array"],t0=new Set(e0);function r0(e){return typeof e=="string"&&t0.has(e)}mn.isJSONType=r0;function n0(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}mn.getRules=n0});var np=j(nr=>{"use strict";Object.defineProperty(nr,"__esModule",{value:!0});nr.shouldUseRule=nr.shouldUseGroup=nr.schemaHasRulesForType=void 0;function o0({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&kv(e,n)}nr.schemaHasRulesForType=o0;function kv(e,t){return t.rules.some(r=>wv(e,r))}nr.shouldUseGroup=kv;function wv(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(n=>e[n]!==void 0))}nr.shouldUseRule=wv});var Go=j(Ae=>{"use strict";Object.defineProperty(Ae,"__esModule",{value:!0});Ae.reportTypeError=Ae.checkDataTypes=Ae.checkDataType=Ae.coerceAndCheckDataType=Ae.getJSONTypes=Ae.getSchemaTypes=Ae.DataType=void 0;var i0=rp(),a0=np(),s0=Wo(),B=W(),Sv=re(),hn;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(hn||(Ae.DataType=hn={}));function c0(e){let t=zv(e.type);if(t.includes("null")){if(e.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');e.nullable===!0&&t.push("null")}return t}Ae.getSchemaTypes=c0;function zv(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(i0.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}Ae.getJSONTypes=zv;function u0(e,t){let{gen:r,data:n,opts:o}=e,i=l0(t,o.coerceTypes),a=t.length>0&&!(i.length===0&&t.length===1&&(0,a0.schemaHasRulesForType)(e,t[0]));if(a){let s=ip(t,n,o.strictNumbers,hn.Wrong);r.if(s,()=>{i.length?d0(e,t,i):ap(e)})}return a}Ae.coerceAndCheckDataType=u0;var Iv=new Set(["string","number","integer","boolean","null"]);function l0(e,t){return t?e.filter(r=>Iv.has(r)||t==="array"&&r==="array"):[]}function d0(e,t,r){let{gen:n,data:o,opts:i}=e,a=n.let("dataType",(0,B._)`typeof ${o}`),s=n.let("coerced",(0,B._)`undefined`);i.coerceTypes==="array"&&n.if((0,B._)`${a} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,(0,B._)`${o}[0]`).assign(a,(0,B._)`typeof ${o}`).if(ip(t,o,i.strictNumbers),()=>n.assign(s,o))),n.if((0,B._)`${s} !== undefined`);for(let u of r)(Iv.has(u)||u==="array"&&i.coerceTypes==="array")&&c(u);n.else(),ap(e),n.endIf(),n.if((0,B._)`${s} !== undefined`,()=>{n.assign(o,s),p0(e,s)});function c(u){switch(u){case"string":n.elseIf((0,B._)`${a} == "number" || ${a} == "boolean"`).assign(s,(0,B._)`"" + ${o}`).elseIf((0,B._)`${o} === null`).assign(s,(0,B._)`""`);return;case"number":n.elseIf((0,B._)`${a} == "boolean" || ${o} === null
4
- || (${a} == "string" && ${o} && ${o} == +${o})`).assign(s,(0,B._)`+${o}`);return;case"integer":n.elseIf((0,B._)`${a} === "boolean" || ${o} === null
5
- || (${a} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(s,(0,B._)`+${o}`);return;case"boolean":n.elseIf((0,B._)`${o} === "false" || ${o} === 0 || ${o} === null`).assign(s,!1).elseIf((0,B._)`${o} === "true" || ${o} === 1`).assign(s,!0);return;case"null":n.elseIf((0,B._)`${o} === "" || ${o} === 0 || ${o} === false`),n.assign(s,null);return;case"array":n.elseIf((0,B._)`${a} === "string" || ${a} === "number"
6
- || ${a} === "boolean" || ${o} === null`).assign(s,(0,B._)`[${o}]`)}}}function p0({gen:e,parentData:t,parentDataProperty:r},n){e.if((0,B._)`${t} !== undefined`,()=>e.assign((0,B._)`${t}[${r}]`,n))}function op(e,t,r,n=hn.Correct){let o=n===hn.Correct?B.operators.EQ:B.operators.NEQ,i;switch(e){case"null":return(0,B._)`${t} ${o} null`;case"array":i=(0,B._)`Array.isArray(${t})`;break;case"object":i=(0,B._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":i=a((0,B._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":i=a();break;default:return(0,B._)`typeof ${t} ${o} ${e}`}return n===hn.Correct?i:(0,B.not)(i);function a(s=B.nil){return(0,B.and)((0,B._)`typeof ${t} == "number"`,s,r?(0,B._)`isFinite(${t})`:B.nil)}}Ae.checkDataType=op;function ip(e,t,r,n){if(e.length===1)return op(e[0],t,r,n);let o,i=(0,Sv.toHash)(e);if(i.array&&i.object){let a=(0,B._)`typeof ${t} != "object"`;o=i.null?a:(0,B._)`!${t} || ${a}`,delete i.null,delete i.array,delete i.object}else o=B.nil;i.number&&delete i.integer;for(let a in i)o=(0,B.and)(o,op(a,t,r,n));return o}Ae.checkDataTypes=ip;var f0={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,B._)`{type: ${e}}`:(0,B._)`{type: ${t}}`};function ap(e){let t=m0(e);(0,s0.reportError)(t,f0)}Ae.reportTypeError=ap;function m0(e){let{gen:t,data:r,schema:n}=e,o=(0,Sv.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:e}}});var jv=j(Qa=>{"use strict";Object.defineProperty(Qa,"__esModule",{value:!0});Qa.assignDefaults=void 0;var gn=W(),h0=re();function g0(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let o in r)Pv(e,o,r[o].default);else t==="array"&&Array.isArray(n)&&n.forEach((o,i)=>Pv(e,i,o.default))}Qa.assignDefaults=g0;function Pv(e,t,r){let{gen:n,compositeRule:o,data:i,opts:a}=e;if(r===void 0)return;let s=(0,gn._)`${i}${(0,gn.getProperty)(t)}`;if(o){(0,h0.checkStrictMode)(e,`default is ignored for: ${s}`);return}let c=(0,gn._)`${s} === undefined`;a.useDefaults==="empty"&&(c=(0,gn._)`${c} || ${s} === null || ${s} === ""`),n.if(c,(0,gn._)`${s} = ${(0,gn.stringify)(r)}`)}});var dt=j(ce=>{"use strict";Object.defineProperty(ce,"__esModule",{value:!0});ce.validateUnion=ce.validateArray=ce.usePattern=ce.callValidateCode=ce.schemaProperties=ce.allSchemaProperties=ce.noPropertyInData=ce.propertyInData=ce.isOwnProperty=ce.hasPropFunc=ce.reportMissingProp=ce.checkMissingProp=ce.checkReportMissingProp=void 0;var ge=W(),sp=re(),or=Lt(),v0=re();function y0(e,t){let{gen:r,data:n,it:o}=e;r.if(up(r,n,t,o.opts.ownProperties),()=>{e.setParams({missingProperty:(0,ge._)`${t}`},!0),e.error()})}ce.checkReportMissingProp=y0;function _0({gen:e,data:t,it:{opts:r}},n,o){return(0,ge.or)(...n.map(i=>(0,ge.and)(up(e,t,i,r.ownProperties),(0,ge._)`${o} = ${i}`)))}ce.checkMissingProp=_0;function $0(e,t){e.setParams({missingProperty:t},!0),e.error()}ce.reportMissingProp=$0;function Ev(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,ge._)`Object.prototype.hasOwnProperty`})}ce.hasPropFunc=Ev;function cp(e,t,r){return(0,ge._)`${Ev(e)}.call(${t}, ${r})`}ce.isOwnProperty=cp;function b0(e,t,r,n){let o=(0,ge._)`${t}${(0,ge.getProperty)(r)} !== undefined`;return n?(0,ge._)`${o} && ${cp(e,t,r)}`:o}ce.propertyInData=b0;function up(e,t,r,n){let o=(0,ge._)`${t}${(0,ge.getProperty)(r)} === undefined`;return n?(0,ge.or)(o,(0,ge.not)(cp(e,t,r))):o}ce.noPropertyInData=up;function Tv(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}ce.allSchemaProperties=Tv;function x0(e,t){return Tv(t).filter(r=>!(0,sp.alwaysValidSchema)(e,t[r]))}ce.schemaProperties=x0;function k0({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:i},it:a},s,c,u){let l=u?(0,ge._)`${e}, ${t}, ${n}${o}`:t,d=[[or.default.instancePath,(0,ge.strConcat)(or.default.instancePath,i)],[or.default.parentData,a.parentData],[or.default.parentDataProperty,a.parentDataProperty],[or.default.rootData,or.default.rootData]];a.opts.dynamicRef&&d.push([or.default.dynamicAnchors,or.default.dynamicAnchors]);let p=(0,ge._)`${l}, ${r.object(...d)}`;return c!==ge.nil?(0,ge._)`${s}.call(${c}, ${p})`:(0,ge._)`${s}(${p})`}ce.callValidateCode=k0;var w0=(0,ge._)`new RegExp`;function S0({gen:e,it:{opts:t}},r){let n=t.unicodeRegExp?"u":"",{regExp:o}=t.code,i=o(r,n);return e.scopeValue("pattern",{key:i.toString(),ref:i,code:(0,ge._)`${o.code==="new RegExp"?w0:(0,v0.useFunc)(e,o)}(${r}, ${n})`})}ce.usePattern=S0;function z0(e){let{gen:t,data:r,keyword:n,it:o}=e,i=t.name("valid");if(o.allErrors){let s=t.let("valid",!0);return a(()=>t.assign(s,!1)),s}return t.var(i,!0),a(()=>t.break()),i;function a(s){let c=t.const("len",(0,ge._)`${r}.length`);t.forRange("i",0,c,u=>{e.subschema({keyword:n,dataProp:u,dataPropType:sp.Type.Num},i),t.if((0,ge.not)(i),s)})}}ce.validateArray=z0;function I0(e){let{gen:t,schema:r,keyword:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,sp.alwaysValidSchema)(o,c))&&!o.opts.unevaluated)return;let a=t.let("valid",!1),s=t.name("_valid");t.block(()=>r.forEach((c,u)=>{let l=e.subschema({keyword:n,schemaProp:u,compositeRule:!0},s);t.assign(a,(0,ge._)`${a} || ${s}`),e.mergeValidEvaluated(l,s)||t.if((0,ge.not)(a))})),e.result(a,()=>e.reset(),()=>e.error(!0))}ce.validateUnion=I0});var Dv=j(St=>{"use strict";Object.defineProperty(St,"__esModule",{value:!0});St.validateKeywordUsage=St.validSchemaType=St.funcKeywordCode=St.macroKeywordCode=void 0;var Ke=W(),zr=Lt(),P0=dt(),j0=Wo();function E0(e,t){let{gen:r,keyword:n,schema:o,parentSchema:i,it:a}=e,s=t.macro.call(a.self,o,i,a),c=Nv(r,n,s);a.opts.validateSchema!==!1&&a.self.validateSchema(s,!0);let u=r.name("valid");e.subschema({schema:s,schemaPath:Ke.nil,errSchemaPath:`${a.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}St.macroKeywordCode=E0;function T0(e,t){var r;let{gen:n,keyword:o,schema:i,parentSchema:a,$data:s,it:c}=e;N0(c,t);let u=!s&&t.compile?t.compile.call(c.self,i,a,c):t.validate,l=Nv(n,o,u),d=n.let("valid");e.block$data(d,p),e.ok((r=t.valid)!==null&&r!==void 0?r:d);function p(){if(t.errors===!1)h(),t.modifying&&Ov(e),v(()=>e.error());else{let _=t.async?f():m();t.modifying&&Ov(e),v(()=>O0(e,_))}}function f(){let _=n.let("ruleErrs",null);return n.try(()=>h((0,Ke._)`await `),$=>n.assign(d,!1).if((0,Ke._)`${$} instanceof ${c.ValidationError}`,()=>n.assign(_,(0,Ke._)`${$}.errors`),()=>n.throw($))),_}function m(){let _=(0,Ke._)`${l}.errors`;return n.assign(_,null),h(Ke.nil),_}function h(_=t.async?(0,Ke._)`await `:Ke.nil){let $=c.opts.passContext?zr.default.this:zr.default.self,b=!("compile"in t&&!s||t.schema===!1);n.assign(d,(0,Ke._)`${_}${(0,P0.callValidateCode)(e,l,$,b)}`,t.modifying)}function v(_){var $;n.if((0,Ke.not)(($=t.valid)!==null&&$!==void 0?$:d),_)}}St.funcKeywordCode=T0;function Ov(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0,Ke._)`${n.parentData}[${n.parentDataProperty}]`))}function O0(e,t){let{gen:r}=e;r.if((0,Ke._)`Array.isArray(${t})`,()=>{r.assign(zr.default.vErrors,(0,Ke._)`${zr.default.vErrors} === null ? ${t} : ${zr.default.vErrors}.concat(${t})`).assign(zr.default.errors,(0,Ke._)`${zr.default.vErrors}.length`),(0,j0.extendErrors)(e)},()=>e.error())}function N0({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function Nv(e,t,r){if(r===void 0)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Ke.stringify)(r)})}function D0(e,t,r=!1){return!t.length||t.some(n=>n==="array"?Array.isArray(e):n==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==n||r&&typeof e>"u")}St.validSchemaType=D0;function R0({schema:e,opts:t,self:r,errSchemaPath:n},o,i){if(Array.isArray(o.keyword)?!o.keyword.includes(i):o.keyword!==i)throw new Error("ajv implementation error");let a=o.dependencies;if(a?.some(s=>!Object.prototype.hasOwnProperty.call(e,s)))throw new Error(`parent schema must have dependencies of ${i}: ${a.join(",")}`);if(o.validateSchema&&!o.validateSchema(e[i])){let c=`keyword "${i}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}St.validateKeywordUsage=R0});var Cv=j(ir=>{"use strict";Object.defineProperty(ir,"__esModule",{value:!0});ir.extendSubschemaMode=ir.extendSubschemaData=ir.getSubschema=void 0;var zt=W(),Rv=re();function C0(e,{keyword:t,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:i,topSchemaRef:a}){if(t!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let s=e.schema[t];return r===void 0?{schema:s,schemaPath:(0,zt._)`${e.schemaPath}${(0,zt.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:s[r],schemaPath:(0,zt._)`${e.schemaPath}${(0,zt.getProperty)(t)}${(0,zt.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,Rv.escapeFragment)(r)}`}}if(n!==void 0){if(o===void 0||i===void 0||a===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:o,topSchemaRef:a,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')}ir.getSubschema=C0;function Z0(e,t,{dataProp:r,dataPropType:n,data:o,dataTypes:i,propertyName:a}){if(o!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:s}=t;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=t,p=s.let("data",(0,zt._)`${t.data}${(0,zt.getProperty)(r)}`,!0);c(p),e.errorPath=(0,zt.str)`${u}${(0,Rv.getErrorPath)(r,n,d.jsPropertySyntax)}`,e.parentDataProperty=(0,zt._)`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(o!==void 0){let u=o instanceof zt.Name?o:s.let("data",o,!0);c(u),a!==void 0&&(e.propertyName=a)}i&&(e.dataTypes=i);function c(u){e.data=u,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,u]}}ir.extendSubschemaData=Z0;function A0(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:i}){n!==void 0&&(e.compositeRule=n),o!==void 0&&(e.createErrors=o),i!==void 0&&(e.allErrors=i),e.jtdDiscriminator=t,e.jtdMetadata=r}ir.extendSubschemaMode=A0});var lp=j((DA,Zv)=>{"use strict";Zv.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,o,i;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(o=n;o--!==0;)if(!e(t[o],r[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(i=Object.keys(t),n=i.length,n!==Object.keys(r).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[o]))return!1;for(o=n;o--!==0;){var a=i[o];if(!e(t[a],r[a]))return!1}return!0}return t!==t&&r!==r}});var Uv=j((RA,Av)=>{"use strict";var ar=Av.exports=function(e,t,r){typeof t=="function"&&(r=t,t={}),r=t.cb||r;var n=typeof r=="function"?r:r.pre||function(){},o=r.post||function(){};es(t,n,o,e,"",e)};ar.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};ar.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};ar.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};ar.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 es(e,t,r,n,o,i,a,s,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,o,i,a,s,c,u);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in ar.arrayKeywords)for(var p=0;p<d.length;p++)es(e,t,r,d[p],o+"/"+l+"/"+p,i,o,l,n,p)}else if(l in ar.propsKeywords){if(d&&typeof d=="object")for(var f in d)es(e,t,r,d[f],o+"/"+l+"/"+U0(f),i,o,l,n,f)}else(l in ar.keywords||e.allKeys&&!(l in ar.skipKeywords))&&es(e,t,r,d,o+"/"+l,i,o,l,n)}r(n,o,i,a,s,c,u)}}function U0(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var Xo=j(Ge=>{"use strict";Object.defineProperty(Ge,"__esModule",{value:!0});Ge.getSchemaRefs=Ge.resolveUrl=Ge.normalizeId=Ge._getFullPath=Ge.getFullPath=Ge.inlineRef=void 0;var M0=re(),F0=lp(),q0=Uv(),L0=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function V0(e,t=!0){return typeof e=="boolean"?!0:t===!0?!dp(e):t?Mv(e)<=t:!1}Ge.inlineRef=V0;var J0=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function dp(e){for(let t in e){if(J0.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(dp)||typeof r=="object"&&dp(r))return!0}return!1}function Mv(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!L0.has(r)&&(typeof e[r]=="object"&&(0,M0.eachItem)(e[r],n=>t+=Mv(n)),t===1/0))return 1/0}return t}function Fv(e,t="",r){r!==!1&&(t=vn(t));let n=e.parse(t);return qv(e,n)}Ge.getFullPath=Fv;function qv(e,t){return e.serialize(t).split("#")[0]+"#"}Ge._getFullPath=qv;var K0=/#\/?$/;function vn(e){return e?e.replace(K0,""):""}Ge.normalizeId=vn;function H0(e,t,r){return r=vn(r),e.resolve(t,r)}Ge.resolveUrl=H0;var B0=/^[a-z_][-a-z0-9._]*$/i;function W0(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=vn(e[r]||t),i={"":o},a=Fv(n,o,!1),s={},c=new Set;return q0(e,{allKeys:!0},(d,p,f,m)=>{if(m===void 0)return;let h=a+p,v=i[m];typeof d[r]=="string"&&(v=_.call(this,d[r])),$.call(this,d.$anchor),$.call(this,d.$dynamicAnchor),i[p]=v;function _(b){let S=this.opts.uriResolver.resolve;if(b=vn(v?S(v,b):b),c.has(b))throw l(b);c.add(b);let P=this.refs[b];return typeof P=="string"&&(P=this.refs[P]),typeof P=="object"?u(d,P.schema,b):b!==vn(h)&&(b[0]==="#"?(u(d,s[b],b),s[b]=d):this.refs[b]=h),b}function $(b){if(typeof b=="string"){if(!B0.test(b))throw new Error(`invalid anchor "${b}"`);_.call(this,`#${b}`)}}}),s;function u(d,p,f){if(p!==void 0&&!F0(d,p))throw l(f)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Ge.getSchemaRefs=W0});var ei=j(sr=>{"use strict";Object.defineProperty(sr,"__esModule",{value:!0});sr.getData=sr.KeywordCxt=sr.validateFunctionCode=void 0;var Hv=xv(),Lv=Go(),fp=np(),ts=Go(),G0=jv(),Qo=Dv(),pp=Cv(),D=W(),L=Lt(),X0=Xo(),Vt=re(),Yo=Wo();function Y0(e){if(Gv(e)&&(Xv(e),Wv(e))){tz(e);return}Bv(e,()=>(0,Hv.topBoolOrEmptySchema)(e))}sr.validateFunctionCode=Y0;function Bv({gen:e,validateName:t,schema:r,schemaEnv:n,opts:o},i){o.code.es5?e.func(t,(0,D._)`${L.default.data}, ${L.default.valCxt}`,n.$async,()=>{e.code((0,D._)`"use strict"; ${Vv(r,o)}`),ez(e,o),e.code(i)}):e.func(t,(0,D._)`${L.default.data}, ${Q0(o)}`,n.$async,()=>e.code(Vv(r,o)).code(i))}function Q0(e){return(0,D._)`{${L.default.instancePath}="", ${L.default.parentData}, ${L.default.parentDataProperty}, ${L.default.rootData}=${L.default.data}${e.dynamicRef?(0,D._)`, ${L.default.dynamicAnchors}={}`:D.nil}}={}`}function ez(e,t){e.if(L.default.valCxt,()=>{e.var(L.default.instancePath,(0,D._)`${L.default.valCxt}.${L.default.instancePath}`),e.var(L.default.parentData,(0,D._)`${L.default.valCxt}.${L.default.parentData}`),e.var(L.default.parentDataProperty,(0,D._)`${L.default.valCxt}.${L.default.parentDataProperty}`),e.var(L.default.rootData,(0,D._)`${L.default.valCxt}.${L.default.rootData}`),t.dynamicRef&&e.var(L.default.dynamicAnchors,(0,D._)`${L.default.valCxt}.${L.default.dynamicAnchors}`)},()=>{e.var(L.default.instancePath,(0,D._)`""`),e.var(L.default.parentData,(0,D._)`undefined`),e.var(L.default.parentDataProperty,(0,D._)`undefined`),e.var(L.default.rootData,L.default.data),t.dynamicRef&&e.var(L.default.dynamicAnchors,(0,D._)`{}`)})}function tz(e){let{schema:t,opts:r,gen:n}=e;Bv(e,()=>{r.$comment&&t.$comment&&Qv(e),az(e),n.let(L.default.vErrors,null),n.let(L.default.errors,0),r.unevaluated&&rz(e),Yv(e),uz(e)})}function rz(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,D._)`${r}.evaluated`),t.if((0,D._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,D._)`${e.evaluated}.props`,(0,D._)`undefined`)),t.if((0,D._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,D._)`${e.evaluated}.items`,(0,D._)`undefined`))}function Vv(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,D._)`/*# sourceURL=${r} */`:D.nil}function nz(e,t){if(Gv(e)&&(Xv(e),Wv(e))){oz(e,t);return}(0,Hv.boolOrEmptySchema)(e,t)}function Wv({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function Gv(e){return typeof e.schema!="boolean"}function oz(e,t){let{schema:r,gen:n,opts:o}=e;o.$comment&&r.$comment&&Qv(e),sz(e),cz(e);let i=n.const("_errs",L.default.errors);Yv(e,i),n.var(t,(0,D._)`${i} === ${L.default.errors}`)}function Xv(e){(0,Vt.checkUnknownRules)(e),iz(e)}function Yv(e,t){if(e.opts.jtd)return Jv(e,[],!1,t);let r=(0,Lv.getSchemaTypes)(e.schema),n=(0,Lv.coerceAndCheckDataType)(e,r);Jv(e,r,!n,t)}function iz(e){let{schema:t,errSchemaPath:r,opts:n,self:o}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,Vt.schemaHasRulesButRef)(t,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function az(e){let{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Vt.checkStrictMode)(e,"default is ignored in the schema root")}function sz(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,X0.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function cz(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function Qv({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:o}){let i=r.$comment;if(o.$comment===!0)e.code((0,D._)`${L.default.self}.logger.log(${i})`);else if(typeof o.$comment=="function"){let a=(0,D.str)`${n}/$comment`,s=e.scopeValue("root",{ref:t.root});e.code((0,D._)`${L.default.self}.opts.$comment(${i}, ${a}, ${s}.schema)`)}}function uz(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:o,opts:i}=e;r.$async?t.if((0,D._)`${L.default.errors} === 0`,()=>t.return(L.default.data),()=>t.throw((0,D._)`new ${o}(${L.default.vErrors})`)):(t.assign((0,D._)`${n}.errors`,L.default.vErrors),i.unevaluated&&lz(e),t.return((0,D._)`${L.default.errors} === 0`))}function lz({gen:e,evaluated:t,props:r,items:n}){r instanceof D.Name&&e.assign((0,D._)`${t}.props`,r),n instanceof D.Name&&e.assign((0,D._)`${t}.items`,n)}function Jv(e,t,r,n){let{gen:o,schema:i,data:a,allErrors:s,opts:c,self:u}=e,{RULES:l}=u;if(i.$ref&&(c.ignoreKeywordsWithRef||!(0,Vt.schemaHasRulesButRef)(i,l))){o.block(()=>ty(e,"$ref",l.all.$ref.definition));return}c.jtd||dz(e,t),o.block(()=>{for(let p of l.rules)d(p);d(l.post)});function d(p){(0,fp.shouldUseGroup)(i,p)&&(p.type?(o.if((0,ts.checkDataType)(p.type,a,c.strictNumbers)),Kv(e,p),t.length===1&&t[0]===p.type&&r&&(o.else(),(0,ts.reportTypeError)(e)),o.endIf()):Kv(e,p),s||o.if((0,D._)`${L.default.errors} === ${n||0}`))}}function Kv(e,t){let{gen:r,schema:n,opts:{useDefaults:o}}=e;o&&(0,G0.assignDefaults)(e,t.type),r.block(()=>{for(let i of t.rules)(0,fp.shouldUseRule)(n,i)&&ty(e,i.keyword,i.definition,t.type)})}function dz(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(pz(e,t),e.opts.allowUnionTypes||fz(e,t),mz(e,e.dataTypes))}function pz(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{ey(e.dataTypes,r)||mp(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),gz(e,t)}}function fz(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&mp(e,"use allowUnionTypes to allow union type keyword")}function mz(e,t){let r=e.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&(0,fp.shouldUseRule)(e.schema,o)){let{type:i}=o.definition;i.length&&!i.some(a=>hz(t,a))&&mp(e,`missing type "${i.join(",")}" for keyword "${n}"`)}}}function hz(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function ey(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function gz(e,t){let r=[];for(let n of e.dataTypes)ey(t,n)?r.push(n):t.includes("integer")&&n==="number"&&r.push("integer");e.dataTypes=r}function mp(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,Vt.checkStrictMode)(e,t,e.opts.strictTypes)}var rs=class{constructor(t,r,n){if((0,Qo.validateKeywordUsage)(t,r,n),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=n,this.data=t.data,this.schema=t.schema[n],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Vt.schemaRefOrVal)(t,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=r,this.$data)this.schemaCode=t.gen.const("vSchema",ry(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,Qo.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=t.gen.const("_errs",L.default.errors))}result(t,r,n){this.failResult((0,D.not)(t),r,n)}failResult(t,r,n){this.gen.if(t),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,r){this.failResult((0,D.not)(t),void 0,r)}fail(t){if(t===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(t),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);let{schemaCode:r}=this;this.fail((0,D._)`${r} !== undefined && (${(0,D.or)(this.invalid$data(),t)})`)}error(t,r,n){if(r){this.setParams(r),this._error(t,n),this.setParams({});return}this._error(t,n)}_error(t,r){(t?Yo.reportExtraError:Yo.reportError)(this,this.def.error,r)}$dataError(){(0,Yo.reportError)(this,this.def.$dataError||Yo.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Yo.resetErrorsCount)(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,r){r?Object.assign(this.params,t):this.params=t}block$data(t,r,n=D.nil){this.gen.block(()=>{this.check$data(t,n),r()})}check$data(t=D.nil,r=D.nil){if(!this.$data)return;let{gen:n,schemaCode:o,schemaType:i,def:a}=this;n.if((0,D.or)((0,D._)`${o} === undefined`,r)),t!==D.nil&&n.assign(t,!0),(i.length||a.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),t!==D.nil&&n.assign(t,!1)),n.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:n,def:o,it:i}=this;return(0,D.or)(a(),s());function a(){if(n.length){if(!(r instanceof D.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,D._)`${(0,ts.checkDataTypes)(c,r,i.opts.strictNumbers,ts.DataType.Wrong)}`}return D.nil}function s(){if(o.validateSchema){let c=t.scopeValue("validate$data",{ref:o.validateSchema});return(0,D._)`!${c}(${r})`}return D.nil}}subschema(t,r){let n=(0,pp.getSubschema)(this.it,t);(0,pp.extendSubschemaData)(n,this.it,t),(0,pp.extendSubschemaMode)(n,t);let o={...this.it,...n,items:void 0,props:void 0};return nz(o,r),o}mergeEvaluated(t,r){let{it:n,gen:o}=this;n.opts.unevaluated&&(n.props!==!0&&t.props!==void 0&&(n.props=Vt.mergeEvaluated.props(o,t.props,n.props,r)),n.items!==!0&&t.items!==void 0&&(n.items=Vt.mergeEvaluated.items(o,t.items,n.items,r)))}mergeValidEvaluated(t,r){let{it:n,gen:o}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return o.if(r,()=>this.mergeEvaluated(t,D.Name)),!0}};sr.KeywordCxt=rs;function ty(e,t,r,n){let o=new rs(e,r,t);"code"in r?r.code(o,n):o.$data&&r.validate?(0,Qo.funcKeywordCode)(o,r):"macro"in r?(0,Qo.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,Qo.funcKeywordCode)(o,r)}var vz=/^\/(?:[^~]|~0|~1)*$/,yz=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function ry(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let o,i;if(e==="")return L.default.rootData;if(e[0]==="/"){if(!vz.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);o=e,i=L.default.rootData}else{let u=yz.exec(e);if(!u)throw new Error(`Invalid JSON-pointer: ${e}`);let l=+u[1];if(o=u[2],o==="#"){if(l>=t)throw new Error(c("property/index",l));return n[t-l]}if(l>t)throw new Error(c("data",l));if(i=r[t-l],!o)return i}let a=i,s=o.split("/");for(let u of s)u&&(i=(0,D._)`${i}${(0,D.getProperty)((0,Vt.unescapeJsonPointer)(u))}`,a=(0,D._)`${a} && ${i}`);return a;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${t}`}}sr.getData=ry});var ns=j(gp=>{"use strict";Object.defineProperty(gp,"__esModule",{value:!0});var hp=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}};gp.default=hp});var ti=j(_p=>{"use strict";Object.defineProperty(_p,"__esModule",{value:!0});var vp=Xo(),yp=class extends Error{constructor(t,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,vp.resolveUrl)(t,r,n),this.missingSchema=(0,vp.normalizeId)((0,vp.getFullPath)(t,this.missingRef))}};_p.default=yp});var is=j(pt=>{"use strict";Object.defineProperty(pt,"__esModule",{value:!0});pt.resolveSchema=pt.getCompilingSchema=pt.resolveRef=pt.compileSchema=pt.SchemaEnv=void 0;var yt=W(),_z=ns(),Ir=Lt(),_t=Xo(),ny=re(),$z=ei(),yn=class{constructor(t){var r;this.refs={},this.dynamicAnchors={};let n;typeof t.schema=="object"&&(n=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=(r=t.baseId)!==null&&r!==void 0?r:(0,_t.normalizeId)(n?.[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=n?.$async,this.refs={}}};pt.SchemaEnv=yn;function bp(e){let t=oy.call(this,e);if(t)return t;let r=(0,_t.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:i}=this.opts,a=new yt.CodeGen(this.scope,{es5:n,lines:o,ownProperties:i}),s;e.$async&&(s=a.scopeValue("Error",{ref:_z.default,code:(0,yt._)`require("ajv/dist/runtime/validation_error").default`}));let c=a.scopeName("validate");e.validateName=c;let u={gen:a,allErrors:this.opts.allErrors,data:Ir.default.data,parentData:Ir.default.parentData,parentDataProperty:Ir.default.parentDataProperty,dataNames:[Ir.default.data],dataPathArr:[yt.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:a.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,yt.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:s,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:yt.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,yt._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),(0,$z.validateFunctionCode)(u),a.optimize(this.opts.code.optimize);let d=a.toString();l=`${a.scopeRefs(Ir.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,e));let f=new Function(`${Ir.default.self}`,`${Ir.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:f}),f.errors=null,f.schema=e.schema,f.schemaEnv=e,e.$async&&(f.$async=!0),this.opts.code.source===!0&&(f.source={validateName:c,validateCode:d,scopeValues:a._values}),this.opts.unevaluated){let{props:m,items:h}=u;f.evaluated={props:m instanceof yt.Name?void 0:m,items:h instanceof yt.Name?void 0:h,dynamicProps:m instanceof yt.Name,dynamicItems:h instanceof yt.Name},f.source&&(f.source.evaluated=(0,yt.stringify)(f.evaluated))}return e.validate=f,e}catch(d){throw delete e.validate,delete e.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(e)}}pt.compileSchema=bp;function bz(e,t,r){var n;r=(0,_t.resolveUrl)(this.opts.uriResolver,t,r);let o=e.refs[r];if(o)return o;let i=wz.call(this,e,r);if(i===void 0){let a=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:s}=this.opts;a&&(i=new yn({schema:a,schemaId:s,root:e,baseId:t}))}if(i!==void 0)return e.refs[r]=xz.call(this,i)}pt.resolveRef=bz;function xz(e){return(0,_t.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:bp.call(this,e)}function oy(e){for(let t of this._compilations)if(kz(t,e))return t}pt.getCompilingSchema=oy;function kz(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function wz(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||os.call(this,e,t)}function os(e,t){let r=this.opts.uriResolver.parse(t),n=(0,_t._getFullPath)(this.opts.uriResolver,r),o=(0,_t.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===o)return $p.call(this,r,e);let i=(0,_t.normalizeId)(n),a=this.refs[i]||this.schemas[i];if(typeof a=="string"){let s=os.call(this,e,a);return typeof s?.schema!="object"?void 0:$p.call(this,r,s)}if(typeof a?.schema=="object"){if(a.validate||bp.call(this,a),i===(0,_t.normalizeId)(t)){let{schema:s}=a,{schemaId:c}=this.opts,u=s[c];return u&&(o=(0,_t.resolveUrl)(this.opts.uriResolver,o,u)),new yn({schema:s,schemaId:c,root:e,baseId:o})}return $p.call(this,r,a)}}pt.resolveSchema=os;var Sz=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function $p(e,{baseId:t,schema:r,root:n}){var o;if(((o=e.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let s of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,ny.unescapeFragment)(s)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!Sz.has(s)&&u&&(t=(0,_t.resolveUrl)(this.opts.uriResolver,t,u))}let i;if(typeof r!="boolean"&&r.$ref&&!(0,ny.schemaHasRulesButRef)(r,this.RULES)){let s=(0,_t.resolveUrl)(this.opts.uriResolver,t,r.$ref);i=os.call(this,n,s)}let{schemaId:a}=this.opts;if(i=i||new yn({schema:r,schemaId:a,root:n,baseId:t}),i.schema!==i.root.schema)return i}});var iy=j((FA,zz)=>{zz.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 Pp=j((qA,dy)=>{"use strict";var Iz=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),kp=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),Pz=RegExp.prototype.test.bind(/^\d*$/u),Pr=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),wp=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),sy=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),Sp=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),jz=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u);function Ez(e){let t="",r=0,n=0;for(n=0;n<e.length;n++)if(r=e[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n];break}for(n+=1;n<e.length;n++){if(r=e[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n]}return t}var Tz=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),Oz=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),Nz=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),Dz=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u),Rz=RegExp.prototype.test.bind(/[^\d!"$&'()*+,\-.;=_`a-z{}~]/u),Cz=RegExp.prototype.test.bind(/(?:^|\.)\d+$/u);function Zz(e){return Rz(e)||Cz(e)}function Az(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++)if(!Nz(e[t])){if(e[t]==="%"&&t+2<e.length&&Pr(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function ay(e){let t=-1,r=0,n=-1,o=0;for(let s=0;s<e.length;s++)e[s]==="0"?(n===-1&&(n=s),o++,o>r&&(r=o,t=n)):(n=-1,o=0);if(r<2)return e.join(":");let i=e.slice(0,t).join(":"),a=e.slice(t+r).join(":");return i+"::"+a}function Uz(e){let t=e.indexOf("::");if(t!==-1&&e.indexOf("::",t+1)!==-1)return;let r=t===-1?e.split(":"):e.slice(0,t).split(":"),n=t===-1?[]:e.slice(t+2).split(":");t!==-1&&(r.length===1&&r[0]===""&&(r.length=0),n.length===1&&n[0]===""&&(n.length=0));let o=r.concat(n),i=0;for(let s=0;s<o.length;s++){let c=o[s];if(c==="")return;if(c.indexOf(".")!==-1){if(s!==o.length-1||t!==-1&&n.length===0||!kp(c))return;i+=2;continue}if(!Tz(c))return;o[s]=parseInt(c,16).toString(16),i++}if(t===-1)return i!==8?void 0:ay(o);if(i>=8)return;let a=o.slice(0,r.length);for(let s=i;s<8;s++)a.push("0");for(let s=r.length;s<o.length;s++)a.push(o[s]);return ay(a)}function xp(e){let t=e[0]==="["&&e[e.length-1]==="]";if((e[0]==="["||e[e.length-1]==="]")&&!t)return{host:e,isIPV6:!1,error:!0};let n=t?e.slice(1,-1):e;if(t&&Oz(n))return n=n.toLowerCase(),{host:`[${n}]`,escapedHost:n,isIPV6:!1,isIPVFuture:!0};if(Mz(n,":")<2)return{host:e,isIPV6:!1,error:t};let o="",i=n.indexOf("%");if(i!==-1){let s=n.slice(i,i+3).toLowerCase()==="%25"?3:1;if(o=n.slice(i+s),!Az(o))return{host:e,isIPV6:!1,error:!0};n=n.slice(0,i)}let a=Uz(n);return a===void 0?{host:e,isIPV6:!1,error:!0}:{host:a+(o?"%"+o:""),escapedHost:a+(o?"%25"+o:""),isIPV6:!0}}function Mz(e,t){let r=0;for(let n=0;n<e.length;n++)e[n]===t&&r++;return r}function Fz(e){let t=e,r=[],n=-1,o=0;for(;o=t.length;){if(o===1){if(t===".")break;if(t==="/"){r.push("/");break}else{r.push(t);break}}else if(o===2){if(t[0]==="."){if(t[1]===".")break;if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&t[1]==="."){r.push("/");break}}else if(o===3&&t==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."&&t[3]==="/"){t=t.slice(3),r.length!==0&&r.pop();continue}}if((n=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,n)),t=t.slice(n)}return r.join("")}var qz={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},Lz=/[@/?#:]/g,Vz=/[@/?#]/g;function cy(e,t){let r=t?Vz:Lz;return r.lastIndex=0,e.replace(r,n=>qz[n])}function uy(e,t=!1){if(e.indexOf("%")===-1)return e;let r="";for(let n=0;n<e.length;n++){if(e[n]==="%"&&n+2<e.length){let o=e.slice(n+1,n+3);if(Pr(o)){let i=o.toUpperCase(),a=String.fromCharCode(parseInt(i,16));t&&wp(a)?r+=a:r+="%"+i,n+=2;continue}}r+=e[n]}return r}var Ue=new Array(256);{let e="0123456789ABCDEF";for(let t=0;t<256;t++)Ue[t]="%"+e[t>>4]+e[t&15]}function zp(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===42||e===43||e===45||e===46||e===47||e===64||e===95}function ye(e){return e<2048?Ue[192|e>>6]+Ue[128|e&63]:e<65536?Ue[224|e>>12]+Ue[128|e>>6&63]+Ue[128|e&63]:Ue[240|e>>18]+Ue[128|e>>12&63]+Ue[128|e>>6&63]+Ue[128|e&63]}function Jz(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(Pr(o)){let i=o.toUpperCase(),a=String.fromCharCode(parseInt(i,16));a!=="."&&wp(a)?t+=a:t+="%"+i,r+=2;continue}}if(sy(n))t+=n;else{let o=e.charCodeAt(r);if(o<128)t+=zp(o)?n:Ue[o];else if(o<55296||o>57343)t+=ye(o);else if(o<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);i>=56320&&i<=57343?(t+=ye(65536+(o-55296<<10)+(i-56320)),r++):t+=ye(65533)}else t+=ye(65533)}}return t}function Kz(e,t=!1){let r="",n=t&&e[0]!=="/";for(let o=0;o<e.length;o++){let i=e[o];if(i==="%"&&o+2<e.length){let a=e.slice(o+1,o+3);if(Pr(a)){r+="%"+a.toUpperCase(),o+=2;continue}}if(i==="/"&&(n=!1),sy(i)&&(i!==":"||!n))r+=i;else{let a=e.charCodeAt(o);if(a<128)r+=Ue[a];else if(a<55296||a>57343)r+=ye(a);else if(a<=56319&&o+1<e.length){let s=e.charCodeAt(o+1);s>=56320&&s<=57343?(r+=ye(65536+(a-55296<<10)+(s-56320)),o++):r+=ye(65533)}else r+=ye(65533)}}return r}function Hz(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(Pr(o)){let i=o.toUpperCase(),a=String.fromCharCode(parseInt(i,16));wp(a)?t+=a:t+="%"+i,r+=2;continue}}if(Sp(n))t+=n;else{let o=e.charCodeAt(r);if(o<128)t+=zp(o)?n:Ue[o];else if(o<55296||o>57343)t+=ye(o);else if(o<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);i>=56320&&i<=57343?(t+=ye(65536+(o-55296<<10)+(i-56320)),r++):t+=ye(65533)}else t+=ye(65533)}}return t}function Ip(e,t){let r="";for(let n=0;n<e.length;n++){let o=e[n];if(o==="%"&&n+2<e.length){let i=e.slice(n+1,n+3);if(Pr(i)){r+="%"+i.toUpperCase(),n+=2;continue}}if(t(o))r+=o;else{let i=e.charCodeAt(n);if(i<128)r+=Ue[i];else if(i<55296||i>57343)r+=ye(i);else if(i<=56319&&n+1<e.length){let a=e.charCodeAt(n+1);a>=56320&&a<=57343?(r+=ye(65536+(i-55296<<10)+(a-56320)),n++):r+=ye(65533)}else r+=ye(65533)}}return r}function ly(e){return Ip(e,jz)}function Bz(e){return Ip(e,Sp)}function Wz(e){return Ip(e,Sp)}function Gz(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let i=e.slice(r+1,r+3);if(Pr(i)){t+="%"+i.toUpperCase(),r+=2;continue}}let o=e.charCodeAt(r);if(o<128)t+=zp(o)?n:Ue[o];else if(o<55296||o>57343)t+=ye(o);else if(o<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);i>=56320&&i<=57343?(t+=ye(65536+(o-55296<<10)+(i-56320)),r++):t+=ye(65533)}else t+=ye(65533)}return t}function Xz(e){let t=[];if(e.userinfo!==void 0&&(t.push(ly(e.userinfo)),t.push("@")),e.host!==void 0){let r=e.host;if(!kp(r)){let n=xp(r);n.isIPV6!==!0&&n.isIPVFuture!==!0&&(r=uy(r,!0),n=xp(r)),n.isIPV6===!0||n.isIPVFuture===!0?r=`[${n.escapedHost}]`:r=cy(r,!1)}t.push(r)}if(typeof e.port=="number"||typeof e.port=="string"){let r=String(e.port);if(!Pz(r))throw new TypeError("URI port is malformed.");t.push(":"),t.push(r)}return t.length?t.join(""):void 0}dy.exports={BYTE_HEX:Ue,percentEncodeNonAscii:ye,nonSimpleDomain:Dz,nonSimpleMailtoDomain:Zz,recomposeAuthority:Xz,reescapeHostDelimiters:cy,normalizePercentEncoding:uy,normalizePathEncoding:Jz,serializePathEncoding:Kz,normalizeQueryFragmentEncoding:Hz,encodeUserinfo:ly,encodeQuery:Bz,encodeFragment:Wz,escapePreservingEscapes:Gz,removeDotSegments:Fz,isIPv4:kp,isUUID:Iz,normalizeIPv6:xp,stringArrayToHexStripped:Ez}});var by=j((LA,$y)=>{"use strict";var{isUUID:Yz,BYTE_HEX:Qz,percentEncodeNonAscii:jp,nonSimpleMailtoDomain:eI}=Pp(),tI=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,rI=["http","https","ws","wss","urn","urn:uuid","mailto"];function nI(e){return rI.indexOf(e)!==-1}function Tp(e){return e.secure===!0?!0:e.secure===!1?!1:e.scheme?e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S"):!1}function hy(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function gy(e){let t=String(e.scheme).toLowerCase()==="https";return(e.port===(t?443:80)||e.port==="")&&(e.port=void 0),e.path||(e.path="/"),e}function oI(e){return e.secure=Tp(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function iI(e){if((e.port===(Tp(e)?443:80)||e.port==="")&&(e.port=void 0),typeof e.secure=="boolean"&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){let t=e.resourceName.indexOf("?"),r=t===-1?e.resourceName:e.resourceName.slice(0,t);e.path=r&&r!=="/"?r:void 0,e.query=t===-1?void 0:e.resourceName.slice(t+1),e.resourceName=void 0}return e.fragment=void 0,e}function aI(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(tI);if(r&&r[0]===e.path){let n=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let o=`${n}:${t.nid||e.nid}`,i=Op(o);e.path=void 0,i&&(e=i.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function sI(e,t){if(e.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",n=e.nid.toLowerCase(),o=`${r}:${t.nid||n}`,i=Op(o);i&&(e=i.serialize(e,t));let a=e,s=e.nss;return a.path=`${n||t.nid}:${s}`,t.skipEscape=!0,a}function cI(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!Yz(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function uI(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var vy={scheme:"http",domainHost:!0,parse:hy,serialize:gy},lI={scheme:"https",domainHost:vy.domainHost,parse:hy,serialize:gy},as={scheme:"ws",domainHost:!0,parse:oI,serialize:iI},dI={scheme:"wss",domainHost:as.domainHost,parse:as.parse,serialize:as.serialize},pI={scheme:"urn",parse:aI,serialize:sI,skipNormalize:!0},fI={scheme:"urn:uuid",parse:cI,serialize:uI,skipNormalize:!0},mI="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$'()*+=",hI="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$'()*+,;:@",yy="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$'()*+;:";function cs(e,t=!1){let r=new Uint8Array(128);for(let i=0;i<e.length;i++)r[e.charCodeAt(i)]=1;let n=e.replace(/[\\\]^-]/gu,"\\$&"),o=t?`[${n}]|[^\\0-\\x7F\\uD800-\\uDFFF]`:`[${n}]`;return{all:new RegExp(`^(?:${o})*$`,"u"),table:r,allowNonAscii:t}}var gI=cs(mI),py=cs(hI),vI=cs(yy),yI=cs(yy,!0),_I=/^[\da-f]{2}$/iu,$I=/^\[[\x21-\x5A\x5E-\x7E]*\]$/u,Ep="URI mailto has an invalid recipient domain.",fy=/[\uD800-\uDFFF]/u;function cr(e){if(typeof e!="string"||e.indexOf("%")===-1)return e;try{return decodeURIComponent(e)}catch{return e}}function my(e){let t="";for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);if(n>=55296&&n<=56319&&r+1<e.length){let o=e.charCodeAt(r+1);if(o>=56320&&o<=57343){t+=e[r]+e[r+1],r++;continue}}t+=n>=55296&&n<=57343?"\uFFFD":e[r]}return t}function ri(e,t){if(t.all.test(e))return e;let r=t.table,n="";for(let o=0;o<e.length;o++){let i=e.charCodeAt(o);if(i<128){r[i]===1?n+=e[o]:i===37&&o+2<e.length&&_I.test(e.slice(o+1,o+3))?(n+="%"+e.slice(o+1,o+3).toUpperCase(),o+=2):n+=Qz[i];continue}if(i<55296||i>57343){n+=t.allowNonAscii?e[o]:jp(i);continue}if(i<=56319&&o+1<e.length){let a=e.charCodeAt(o+1);if(a>=56320&&a<=57343){n+=t.allowNonAscii?e[o]+e[o+1]:jp(65536+(i-55296<<10)+(a-56320)),o++;continue}}n+=t.allowNonAscii?"\uFFFD":jp(65533)}return n}function _y(e,t,r){let n=String(e).toLowerCase();if($I.test(n)||n!==""&&!eI(n))return n;try{let o=new URL("http://"+n);if(o.username||o.password||o.port||o.pathname!=="/"||o.search||o.hash||!o.hostname)throw new Error(Ep);return t&&t.unicodeSupport?n:o.hostname}catch{return r&&(r.error=r.error||Ep),n}}function bI(e,t){let r=t&&t.unicodeSupport?yI:vI;return e.length>1&&e[0]==="["&&e[e.length-1]==="]"?"["+ri(e.slice(1,-1),r)+"]":ri(e,r)}function xI(e,t){let r=e,n=r.path,o=r.query;n&&fy.test(n)&&(n=my(n)),o&&fy.test(o)&&(o=my(o));let i=n?n.indexOf(",")===-1?[n]:n.split(","):[];if(r.path=void 0,o){let a=null,s=0;for(;s<=o.length;){let c=o.indexOf("&",s);c===-1&&(c=o.length);let u=o.slice(s,c);s=c+1;let l=u.indexOf("=");if(l!==u.lastIndexOf("=")){r.error=r.error||"URI mailto has malformed header fields.";continue}let d=l===-1?u:u.slice(0,l),p=l===-1?"":u.slice(l+1);if(d==="to"){let f=p.split(",");for(let m=0;m<f.length;m++)i.push(f[m]);continue}if(d==="subject"){r.subject=cr(p);continue}if(d==="body"){r.body=cr(p);continue}a===null&&(a=Object.create(null)),a[cr(d)]=cr(p)}a!==null&&(r.headers=a)}r.query=void 0;for(let a=0;a<i.length;a++){let s=i[a],c=s.lastIndexOf("@");if(c<0){r.error=r.error||Ep,i[a]=cr(s);continue}let u=cr(s.slice(0,c)),l=_y(cr(s.slice(c+1)),t,r);i[a]=u+"@"+l}return i.length&&(r.to=i),r}function kI(e,t){let r=e,n=Array.isArray(r.to)?r.to.slice():[];if(n.length){for(let s=0;s<n.length;s++){let c=String(n[s]),u=c.lastIndexOf("@"),l=u>=0?c.slice(0,u):c,d=u>=0?c.slice(u+1):"",p=ri(l,gI),f=cr(d),m=_y(f,t);n[s]=p+"@"+bI(m,t)}r.path=n.join(","),t.skipEscape=!0}else r.path=void 0;let o=r.headers&&typeof r.headers=="object"?Object.assign(Object.create(null),r.headers):Object.create(null);r.subject&&(o.subject=r.subject),r.body&&(o.body=r.body),r.headers=o;let i="",a=0;for(let s in o)a++!==0&&(i+="&"),i+=ri(s,py)+"="+ri(String(o[s]),py);return a!==0?r.query=i:r.headers=void 0,r}var wI={scheme:"mailto",parse:xI,serialize:kI,domainHost:!1,unicodeSupport:!0,skipNormalize:!0,absolutePath:!0},ss={http:vy,https:lI,ws:as,wss:dI,urn:pI,"urn:uuid":fI,mailto:wI};Object.setPrototypeOf(ss,null);function Op(e){return e&&(ss[e]||ss[e.toLowerCase()])||void 0}$y.exports={wsIsSecure:Tp,SCHEMES:ss,isValidSchemeName:nI,getSchemeHandler:Op}});var Ry=j((VA,ds)=>{"use strict";var{normalizeIPv6:zy,removeDotSegments:oi,recomposeAuthority:SI,normalizePercentEncoding:Iy,normalizePathEncoding:zI,serializePathEncoding:xy,normalizeQueryFragmentEncoding:ky,encodeQuery:II,encodeFragment:PI,reescapeHostDelimiters:jI,isIPv4:Py,nonSimpleDomain:EI}=Pp(),{SCHEMES:jy,getSchemeHandler:Np}=by(),Ey=/^[A-Za-z][A-Za-z0-9+.-]*$/u,Ty="URI scheme is malformed.";function wy(e){let t=unescape(String(e));if(!Ey.test(t))throw new TypeError(Ty);return t}function TI(e,t){return typeof e=="string"?e=UI(e,t):typeof e=="object"&&(e=ls(jr(e,t),t)),e}function OI(e,t,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},{parsed:o,malformedAuthorityOrPort:i,malformedPercentEncoding:a,malformedSchemeSpecific:s,malformedHost:c,malformedScheme:u}=us(e,n),{parsed:l,malformedAuthorityOrPort:d,malformedPercentEncoding:p,malformedSchemeSpecific:f,malformedHost:m,malformedScheme:h}=us(t,n);if(i||d||a||p||s||f||c||m||u||h)throw new Error(o.error||l.error||"URI is malformed.");let v=Oy(o,l,n,!0),_=Np(r&&r.scheme||v.scheme),$=v.host,b=$!==void 0&&$!==""&&(Py($)||zy($).isIPV6);Ny(v,r||{},_,b);let S=$&&$.indexOf("%")!==-1&&!new RegExp("\\P{ASCII}","u").test($);if(v.error&&!S)throw new Error(v.error);return n.skipEscape=!0,jr(v,n)}function Oy(e,t,r,n){let o={};return n||(e=ls(jr(e,r),r),t=ls(jr(t,r),r)),r=r||{},!r.tolerant&&t.scheme?(o.scheme=t.scheme,o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=oi(t.path||""),o.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=oi(t.path||""),o.query=t.query):(t.path?(t.path[0]==="/"?o.path=oi(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?o.path="/"+t.path:e.path?o.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:o.path=t.path,o.path=oi(o.path)),o.query=t.query):(o.path=e.path,t.query!==void 0?o.query=t.query:o.query=e.query),o.userinfo=e.userinfo,o.host=e.host,o.port=e.port),o.scheme=e.scheme),o.fragment=t.fragment,o}function NI(e,t,r){let n=Sy(e,r),o=Sy(t,r);return n!==void 0&&o!==void 0&&n===o}function jr(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,to:e.to,subject:e.subject,body:e.body,headers:e.headers,error:""},n=Object.assign({},t),o=[];r.scheme&&(r.scheme=wy(r.scheme));let i=Np(n.scheme||r.scheme);i&&i.serialize&&i.serialize(r,n);let a=r.userinfo!==void 0||r.host!==void 0||r.port!==void 0,s=!n.skipEscape&&r.scheme===void 0&&!a;r.path!==void 0&&(n.skipEscape?r.path=Iy(r.path):r.path=xy(r.path,s)),n.reference!=="suffix"&&r.scheme&&(r.scheme=wy(r.scheme),o.push(r.scheme,":"));let c=SI(r);if(c!==void 0&&(n.reference!=="suffix"&&o.push("//"),o.push(c),r.path&&r.path[0]!=="/"&&o.push("/")),r.path!==void 0){let u=r.path;!n.absolutePath&&(!i||!i.absolutePath)&&(u=oi(u)),s&&(u=xy(u,!0)),c===void 0&&u[0]==="/"&&u[1]==="/"&&(u="/%2F"+u.slice(2)),o.push(u)}return r.query!==void 0&&o.push("?",II(r.query)),r.fragment!==void 0&&o.push("#",PI(r.fragment)),o.join("")}var DI=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,RI=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,CI=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function ZI(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof e.port=="number"&&(e.port<0||e.port>65535))return"URI port is malformed."}function ni(e){if(e===void 0)return!1;let t=e.indexOf("%");for(;t!==-1;){if(t+2>=e.length||!/^[\da-f]{2}$/iu.test(e.slice(t+1,t+3)))return!0;t=e.indexOf("%",t+3)}return!1}function Dp(e){return e[0]==="["&&e[e.length-1]==="]"}function AI(e){let t=e[4];return ni(e[3])||t!==void 0&&!Dp(t)&&ni(t)||ni(e[6])||ni(e[7])||ni(e[8])}function Ny(e,t,r,n){let o=e.host&&e.host[0]==="["&&e.host[e.host.length-1]==="]";if(!t.unicodeSupport&&(!r||!r.unicodeSupport)&&e.host&&!Dp(e.host)&&(t.domainHost||r&&r.domainHost)&&n===!1&&!o&&EI(e.host))try{e.host=new URL("http://"+e.host).hostname}catch(i){return e.error=e.error||"Host's domain name can not be converted to ASCII: "+i,!0}return!1}function us(e,t){let r=Object.assign({},t),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=!1,i=!1,a=!1,s=!1,c=!1,u=!1,l=!1;r.reference==="suffix"&&(r.scheme?e=r.scheme+":"+e:e="//"+e);let d=e.match(RI);d!==null&&d[1].indexOf("\\")!==-1&&(n.error="URI authority must not contain a literal backslash.",o=!0);let p=e.match(CI);if(p!==null){let m=p[1],h=m.replace(/[\t\n\r]/g,"");h.length>=2&&(h.slice(0,2)!=="//"?(n.error=n.error||"URI authority must not contain a literal backslash.",o=!0):m.length!==h.length&&(n.error=n.error||"URI authority introducer must not contain whitespace.",o=!0))}let f=e.match(DI);if(f){if(n.scheme=f[1],n.userinfo=f[3],n.host=f[4],n.port=parseInt(f[5],10),n.path=f[6]||"",n.query=f[7],n.fragment=f[8],n.scheme!==void 0){let v=unescape(n.scheme);Ey.test(v)?n.scheme=v.toLowerCase():(n.error=n.error||Ty,u=!0)}i=AI(f),i&&(n.error=n.error||"URI contains malformed percent-encoding."),isNaN(n.port)&&(n.port=f[5]);let m=ZI(n,f);if(m!==void 0&&(n.error=n.error||m,o=!0),n.host)if(Py(n.host)===!1){let _=Dp(n.host),$=n.host.indexOf("[")!==-1||n.host.indexOf("]")!==-1,b=zy(n.host);l=b.isIPV6||b.isIPVFuture===!0,c=$&&(!_||b.error===!0),n.host=l?b.host:b.host.toLowerCase(),c&&(n.error=n.error||"URI host is malformed.",o=!0)}else l=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let h=Np(r.scheme||n.scheme);if(c||(s=Ny(n,r,h,l)),!h||h&&!h.skipNormalize){if(e.indexOf("%")!==-1&&n.host!==void 0&&!c){let v=l?n.host:Iy(n.host,!0);n.host=jI(v,l)}n.path&&(n.path=zI(n.path)),n.query&&(n.query=ky(n.query)),n.fragment&&(n.fragment=ky(n.fragment))}h&&h.parse&&(h.parse(n,r),h===jy.urn&&n.nid===void 0&&(a=!0))}else n.error=n.error||"URI can not be parsed.";return{parsed:n,malformedAuthorityOrPort:o,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:s,malformedScheme:u}}function ls(e,t){return us(e,t).parsed}function UI(e,t){return Dy(e,t).normalized}function Dy(e,t){let{parsed:r,malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:s}=us(e,t);return{normalized:n||o||i||a||s?e:jr(r,t),malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:s}}function Sy(e,t){if(typeof e!="string"&&typeof e!="object")return;let r;try{r=typeof e=="string"?e:jr(e,t)}catch{return}let{normalized:n,malformedAuthorityOrPort:o,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:s,malformedScheme:c}=Dy(r,t);return o||i||a||s||c?void 0:n}var Rp={SCHEMES:jy,normalize:TI,resolve:OI,resolveComponent:Oy,equal:NI,serialize:jr,parse:ls};ds.exports=Rp;ds.exports.default=Rp;ds.exports.fastUri=Rp});var Zy=j(Cp=>{"use strict";Object.defineProperty(Cp,"__esModule",{value:!0});var Cy=Ry();Cy.code='require("ajv/dist/runtime/uri").default';Cp.default=Cy});var Jy=j(Ee=>{"use strict";Object.defineProperty(Ee,"__esModule",{value:!0});Ee.CodeGen=Ee.Name=Ee.nil=Ee.stringify=Ee.str=Ee._=Ee.KeywordCxt=void 0;var MI=ei();Object.defineProperty(Ee,"KeywordCxt",{enumerable:!0,get:function(){return MI.KeywordCxt}});var _n=W();Object.defineProperty(Ee,"_",{enumerable:!0,get:function(){return _n._}});Object.defineProperty(Ee,"str",{enumerable:!0,get:function(){return _n.str}});Object.defineProperty(Ee,"stringify",{enumerable:!0,get:function(){return _n.stringify}});Object.defineProperty(Ee,"nil",{enumerable:!0,get:function(){return _n.nil}});Object.defineProperty(Ee,"Name",{enumerable:!0,get:function(){return _n.Name}});Object.defineProperty(Ee,"CodeGen",{enumerable:!0,get:function(){return _n.CodeGen}});var FI=ns(),qy=ti(),qI=rp(),ii=is(),LI=W(),ai=Xo(),ps=Go(),Ap=re(),Ay=iy(),VI=Zy(),Ly=(e,t)=>new RegExp(e,t);Ly.code="new RegExp";var JI=["removeAdditional","useDefaults","coerceTypes"],KI=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),HI={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."},BI={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},Uy=200;function WI(e){var t,r,n,o,i,a,s,c,u,l,d,p,f,m,h,v,_,$,b,S,P,Se,Oe,jn,Rs;let En=e.strict,Cs=(t=e.code)===null||t===void 0?void 0:t.optimize,Mf=Cs===!0||Cs===void 0?1:Cs||0,Ff=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:Ly,z$=(o=e.uriResolver)!==null&&o!==void 0?o:VI.default;return{strictSchema:(a=(i=e.strictSchema)!==null&&i!==void 0?i:En)!==null&&a!==void 0?a:!0,strictNumbers:(c=(s=e.strictNumbers)!==null&&s!==void 0?s:En)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=e.strictTypes)!==null&&u!==void 0?u:En)!==null&&l!==void 0?l:"log",strictTuples:(p=(d=e.strictTuples)!==null&&d!==void 0?d:En)!==null&&p!==void 0?p:"log",strictRequired:(m=(f=e.strictRequired)!==null&&f!==void 0?f:En)!==null&&m!==void 0?m:!1,code:e.code?{...e.code,optimize:Mf,regExp:Ff}:{optimize:Mf,regExp:Ff},loopRequired:(h=e.loopRequired)!==null&&h!==void 0?h:Uy,loopEnum:(v=e.loopEnum)!==null&&v!==void 0?v:Uy,meta:(_=e.meta)!==null&&_!==void 0?_:!0,messages:($=e.messages)!==null&&$!==void 0?$:!0,inlineRefs:(b=e.inlineRefs)!==null&&b!==void 0?b:!0,schemaId:(S=e.schemaId)!==null&&S!==void 0?S:"$id",addUsedSchema:(P=e.addUsedSchema)!==null&&P!==void 0?P:!0,validateSchema:(Se=e.validateSchema)!==null&&Se!==void 0?Se:!0,validateFormats:(Oe=e.validateFormats)!==null&&Oe!==void 0?Oe:!0,unicodeRegExp:(jn=e.unicodeRegExp)!==null&&jn!==void 0?jn:!0,int32range:(Rs=e.int32range)!==null&&Rs!==void 0?Rs:!0,uriResolver:z$}}var si=class{constructor(t={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...WI(t)};let{es5:r,lines:n}=this.opts.code;this.scope=new LI.ValueScope({scope:{},prefixes:KI,es5:r,lines:n}),this.logger=tP(t.logger);let o=t.validateFormats;t.validateFormats=!1,this.RULES=(0,qI.getRules)(),My.call(this,HI,t,"NOT SUPPORTED"),My.call(this,BI,t,"DEPRECATED","warn"),this._metaOpts=QI.call(this),t.formats&&XI.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&YI.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),GI.call(this),t.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:n}=this.opts,o=Ay;n==="id"&&(o={...Ay},o.id=o.$id,delete o.$id),r&&t&&this.addMetaSchema(o,o[n],!1)}defaultMeta(){let{meta:t,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof t=="object"?t[r]||t:void 0}validate(t,r){let n;if(typeof t=="string"){if(n=this.getSchema(t),!n)throw new Error(`no schema with key or ref "${t}"`)}else n=this.compile(t);let o=n(r);return"$async"in n||(this.errors=n.errors),o}compile(t,r){let n=this._addSchema(t,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(t,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return o.call(this,t,r);async function o(l,d){await i.call(this,l.$schema);let p=this._addSchema(l,d);return p.validate||a.call(this,p)}async function i(l){l&&!this.getSchema(l)&&await o.call(this,{$ref:l},!0)}async function a(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof qy.default))throw d;return s.call(this,d),await c.call(this,d.missingSchema),a.call(this,l)}}function s({missingSchema:l,missingRef:d}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${d} cannot be resolved`)}async function c(l){let d=await u.call(this,l);this.refs[l]||await i.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,r)}async function u(l){let d=this._loading[l];if(d)return d;try{return await(this._loading[l]=n(l))}finally{delete this._loading[l]}}}addSchema(t,r,n,o=this.opts.validateSchema){if(Array.isArray(t)){for(let a of t)this.addSchema(a,void 0,n,o);return this}let i;if(typeof t=="object"){let{schemaId:a}=this.opts;if(i=t[a],i!==void 0&&typeof i!="string")throw new Error(`schema ${a} must be string`)}return r=(0,ai.normalizeId)(r||i),this._checkUnique(r),this.schemas[r]=this._addSchema(t,n,r,o,!0),this}addMetaSchema(t,r,n=this.opts.validateSchema){return this.addSchema(t,r,!0,n),this}validateSchema(t,r){if(typeof t=="boolean")return!0;let n;if(n=t.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let o=this.validate(n,t);if(!o&&r){let i="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(i);else throw new Error(i)}return o}getSchema(t){let r;for(;typeof(r=Fy.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:n}=this.opts,o=new ii.SchemaEnv({schema:{},schemaId:n});if(r=ii.resolveSchema.call(this,o,t),!r)return;this.refs[t]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(t){if(t instanceof RegExp)return this._removeAllSchemas(this.schemas,t),this._removeAllSchemas(this.refs,t),this;switch(typeof t){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=Fy.call(this,t);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[t],delete this.refs[t],this}case"object":{let r=t;this._cache.delete(r);let n=t[this.opts.schemaId];return n&&(n=(0,ai.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(t){for(let r of t)this.addKeyword(r);return this}addKeyword(t,r){let n;if(typeof t=="string")n=t,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof t=="object"&&r===void 0){if(r=t,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(nP.call(this,n,r),!r)return(0,Ap.eachItem)(n,i=>Zp.call(this,i)),this;iP.call(this,r);let o={...r,type:(0,ps.getJSONTypes)(r.type),schemaType:(0,ps.getJSONTypes)(r.schemaType)};return(0,Ap.eachItem)(n,o.type.length===0?i=>Zp.call(this,i,o):i=>o.type.forEach(a=>Zp.call(this,i,o,a))),this}getKeyword(t){let r=this.RULES.all[t];return typeof r=="object"?r.definition:!!r}removeKeyword(t){let{RULES:r}=this;delete r.keywords[t],delete r.all[t];for(let n of r.rules){let o=n.rules.findIndex(i=>i.keyword===t);o>=0&&n.rules.splice(o,1)}return this}addFormat(t,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[t]=r,this}errorsText(t=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!t||t.length===0?"No errors":t.map(o=>`${n}${o.instancePath} ${o.message}`).reduce((o,i)=>o+r+i)}$dataMetaSchema(t,r){let n=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(let o of r){let i=o.split("/").slice(1),a=t;for(let s of i)a=a[s];for(let s in n){let c=n[s];if(typeof c!="object")continue;let{$data:u}=c.definition,l=a[s];u&&l&&(a[s]=Vy(l))}}return t}_removeAllSchemas(t,r){for(let n in t){let o=t[n];(!r||r.test(n))&&(typeof o=="string"?delete t[n]:o&&!o.meta&&(this._cache.delete(o.schema),delete t[n]))}}_addSchema(t,r,n,o=this.opts.validateSchema,i=this.opts.addUsedSchema){let a,{schemaId:s}=this.opts;if(typeof t=="object")a=t[s];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof t!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(t);if(c!==void 0)return c;n=(0,ai.normalizeId)(a||n);let u=ai.getSchemaRefs.call(this,t,n);return c=new ii.SchemaEnv({schema:t,schemaId:s,meta:r,baseId:n,localRefs:u}),this._cache.set(c.schema,c),i&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),o&&this.validateSchema(t,!0),c}_checkUnique(t){if(this.schemas[t]||this.refs[t])throw new Error(`schema with key or id "${t}" already exists`)}_compileSchemaEnv(t){if(t.meta?this._compileMetaSchema(t):ii.compileSchema.call(this,t),!t.validate)throw new Error("ajv implementation error");return t.validate}_compileMetaSchema(t){let r=this.opts;this.opts=this._metaOpts;try{ii.compileSchema.call(this,t)}finally{this.opts=r}}};si.ValidationError=FI.default;si.MissingRefError=qy.default;Ee.default=si;function My(e,t,r,n="error"){for(let o in e){let i=o;i in t&&this.logger[n](`${r}: option ${o}. ${e[i]}`)}}function Fy(e){return e=(0,ai.normalizeId)(e),this.schemas[e]||this.refs[e]}function GI(){let e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function XI(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function YI(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}function QI(){let e={...this.opts};for(let t of JI)delete e[t];return e}var eP={log(){},warn(){},error(){}};function tP(e){if(e===!1)return eP;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}var rP=/^[a-z_$][a-z0-9_$:-]*$/i;function nP(e,t){let{RULES:r}=this;if((0,Ap.eachItem)(e,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!rP.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!t&&t.$data&&!("code"in t||"validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function Zp(e,t,r){var n;let o=t?.post;if(r&&o)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:i}=this,a=o?i.post:i.rules.find(({type:c})=>c===r);if(a||(a={type:r,rules:[]},i.rules.push(a)),i.keywords[e]=!0,!t)return;let s={keyword:e,definition:{...t,type:(0,ps.getJSONTypes)(t.type),schemaType:(0,ps.getJSONTypes)(t.schemaType)}};t.before?oP.call(this,a,s,t.before):a.rules.push(s),i.all[e]=s,(n=t.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function oP(e,t,r){let n=e.rules.findIndex(o=>o.keyword===r);n>=0?e.rules.splice(n,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function iP(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=Vy(t)),e.validateSchema=this.compile(t,!0))}var aP={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Vy(e){return{anyOf:[e,aP]}}});var Ky=j(Up=>{"use strict";Object.defineProperty(Up,"__esModule",{value:!0});var sP={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Up.default=sP});var Gy=j(Er=>{"use strict";Object.defineProperty(Er,"__esModule",{value:!0});Er.callRef=Er.getValidate=void 0;var cP=ti(),Hy=dt(),Xe=W(),$n=Lt(),By=is(),fs=re(),uP={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:n}=e,{baseId:o,schemaEnv:i,validateName:a,opts:s,self:c}=n,{root:u}=i;if((r==="#"||r==="#/")&&o===u.baseId)return d();let l=By.resolveRef.call(c,u,o,r);if(l===void 0)throw new cP.default(n.opts.uriResolver,o,r);if(l instanceof By.SchemaEnv)return p(l);return f(l);function d(){if(i===u)return ms(e,a,i,i.$async);let m=t.scopeValue("root",{ref:u});return ms(e,(0,Xe._)`${m}.validate`,u,u.$async)}function p(m){let h=Wy(e,m);ms(e,h,m,m.$async)}function f(m){let h=t.scopeValue("schema",s.code.source===!0?{ref:m,code:(0,Xe.stringify)(m)}:{ref:m}),v=t.name("valid"),_=e.subschema({schema:m,dataTypes:[],schemaPath:Xe.nil,topSchemaRef:h,errSchemaPath:r},v);e.mergeEvaluated(_),e.ok(v)}}};function Wy(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,Xe._)`${r.scopeValue("wrapper",{ref:t})}.validate`}Er.getValidate=Wy;function ms(e,t,r,n){let{gen:o,it:i}=e,{allErrors:a,schemaEnv:s,opts:c}=i,u=c.passContext?$n.default.this:Xe.nil;n?l():d();function l(){if(!s.$async)throw new Error("async schema referenced by sync schema");let m=o.let("valid");o.try(()=>{o.code((0,Xe._)`await ${(0,Hy.callValidateCode)(e,t,u)}`),f(t),a||o.assign(m,!0)},h=>{o.if((0,Xe._)`!(${h} instanceof ${i.ValidationError})`,()=>o.throw(h)),p(h),a||o.assign(m,!1)}),e.ok(m)}function d(){e.result((0,Hy.callValidateCode)(e,t,u),()=>f(t),()=>p(t))}function p(m){let h=(0,Xe._)`${m}.errors`;o.assign($n.default.vErrors,(0,Xe._)`${$n.default.vErrors} === null ? ${h} : ${$n.default.vErrors}.concat(${h})`),o.assign($n.default.errors,(0,Xe._)`${$n.default.vErrors}.length`)}function f(m){var h;if(!i.opts.unevaluated)return;let v=(h=r?.validate)===null||h===void 0?void 0:h.evaluated;if(i.props!==!0)if(v&&!v.dynamicProps)v.props!==void 0&&(i.props=fs.mergeEvaluated.props(o,v.props,i.props));else{let _=o.var("props",(0,Xe._)`${m}.evaluated.props`);i.props=fs.mergeEvaluated.props(o,_,i.props,Xe.Name)}if(i.items!==!0)if(v&&!v.dynamicItems)v.items!==void 0&&(i.items=fs.mergeEvaluated.items(o,v.items,i.items));else{let _=o.var("items",(0,Xe._)`${m}.evaluated.items`);i.items=fs.mergeEvaluated.items(o,_,i.items,Xe.Name)}}}Er.callRef=ms;Er.default=uP});var Xy=j(Mp=>{"use strict";Object.defineProperty(Mp,"__esModule",{value:!0});var lP=Ky(),dP=Gy(),pP=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",lP.default,dP.default];Mp.default=pP});var Yy=j(Fp=>{"use strict";Object.defineProperty(Fp,"__esModule",{value:!0});var hs=W(),ur=hs.operators,gs={maximum:{okStr:"<=",ok:ur.LTE,fail:ur.GT},minimum:{okStr:">=",ok:ur.GTE,fail:ur.LT},exclusiveMaximum:{okStr:"<",ok:ur.LT,fail:ur.GTE},exclusiveMinimum:{okStr:">",ok:ur.GT,fail:ur.LTE}},fP={message:({keyword:e,schemaCode:t})=>(0,hs.str)`must be ${gs[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,hs._)`{comparison: ${gs[e].okStr}, limit: ${t}}`},mP={keyword:Object.keys(gs),type:"number",schemaType:"number",$data:!0,error:fP,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,hs._)`${r} ${gs[t].fail} ${n} || isNaN(${r})`)}};Fp.default=mP});var Qy=j(qp=>{"use strict";Object.defineProperty(qp,"__esModule",{value:!0});var ci=W(),hP={message:({schemaCode:e})=>(0,ci.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,ci._)`{multipleOf: ${e}}`},gP={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:hP,code(e){let{gen:t,data:r,schemaCode:n,it:o}=e,i=o.opts.multipleOfPrecision,a=t.let("res"),s=i?(0,ci._)`Math.abs(Math.round(${a}) - ${a}) > 1e-${i}`:(0,ci._)`${a} !== parseInt(${a})`;e.fail$data((0,ci._)`(${n} === 0 || (${a} = ${r}/${n}, ${s}))`)}};qp.default=gP});var t_=j(Lp=>{"use strict";Object.defineProperty(Lp,"__esModule",{value:!0});function e_(e){let t=e.length,r=0,n=0,o;for(;n<t;)r++,o=e.charCodeAt(n++),o>=55296&&o<=56319&&n<t&&(o=e.charCodeAt(n),(o&64512)===56320&&n++);return r}Lp.default=e_;e_.code='require("ajv/dist/runtime/ucs2length").default'});var r_=j(Vp=>{"use strict";Object.defineProperty(Vp,"__esModule",{value:!0});var Tr=W(),vP=re(),yP=t_(),_P={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return(0,Tr.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,Tr._)`{limit: ${e}}`},$P={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:_P,code(e){let{keyword:t,data:r,schemaCode:n,it:o}=e,i=t==="maxLength"?Tr.operators.GT:Tr.operators.LT,a=o.opts.unicode===!1?(0,Tr._)`${r}.length`:(0,Tr._)`${(0,vP.useFunc)(e.gen,yP.default)}(${r})`;e.fail$data((0,Tr._)`${a} ${i} ${n}`)}};Vp.default=$P});var n_=j(Jp=>{"use strict";Object.defineProperty(Jp,"__esModule",{value:!0});var bP=dt(),xP=re(),bn=W(),kP={message:({schemaCode:e})=>(0,bn.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,bn._)`{pattern: ${e}}`},wP={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:kP,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:i,it:a}=e,s=a.opts.unicodeRegExp?"u":"";if(n){let{regExp:c}=a.opts.code,u=c.code==="new RegExp"?(0,bn._)`new RegExp`:(0,xP.useFunc)(t,c),l=t.let("valid");t.try(()=>t.assign(l,(0,bn._)`${u}(${i}, ${s}).test(${r})`),()=>t.assign(l,!1)),e.fail$data((0,bn._)`!${l}`)}else{let c=(0,bP.usePattern)(e,o);e.fail$data((0,bn._)`!${c}.test(${r})`)}}};Jp.default=wP});var o_=j(Kp=>{"use strict";Object.defineProperty(Kp,"__esModule",{value:!0});var ui=W(),SP={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return(0,ui.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,ui._)`{limit: ${e}}`},zP={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:SP,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxProperties"?ui.operators.GT:ui.operators.LT;e.fail$data((0,ui._)`Object.keys(${r}).length ${o} ${n}`)}};Kp.default=zP});var i_=j(Hp=>{"use strict";Object.defineProperty(Hp,"__esModule",{value:!0});var li=dt(),di=W(),IP=re(),PP={message:({params:{missingProperty:e}})=>(0,di.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,di._)`{missingProperty: ${e}}`},jP={keyword:"required",type:"object",schemaType:"array",$data:!0,error:PP,code(e){let{gen:t,schema:r,schemaCode:n,data:o,$data:i,it:a}=e,{opts:s}=a;if(!i&&r.length===0)return;let c=r.length>=s.loopRequired;if(a.allErrors?u():l(),s.strictRequired){let f=e.parentSchema.properties,{definedProperties:m}=e.it;for(let h of r)if(f?.[h]===void 0&&!m.has(h)){let v=a.schemaEnv.baseId+a.errSchemaPath,_=`required property "${h}" is not defined at "${v}" (strictRequired)`;(0,IP.checkStrictMode)(a,_,a.opts.strictRequired)}}function u(){if(c||i)e.block$data(di.nil,d);else for(let f of r)(0,li.checkReportMissingProp)(e,f)}function l(){let f=t.let("missing");if(c||i){let m=t.let("valid",!0);e.block$data(m,()=>p(f,m)),e.ok(m)}else t.if((0,li.checkMissingProp)(e,r,f)),(0,li.reportMissingProp)(e,f),t.else()}function d(){t.forOf("prop",n,f=>{e.setParams({missingProperty:f}),t.if((0,li.noPropertyInData)(t,o,f,s.ownProperties),()=>e.error())})}function p(f,m){e.setParams({missingProperty:f}),t.forOf(f,n,()=>{t.assign(m,(0,li.propertyInData)(t,o,f,s.ownProperties)),t.if((0,di.not)(m),()=>{e.error(),t.break()})},di.nil)}}};Hp.default=jP});var a_=j(Bp=>{"use strict";Object.defineProperty(Bp,"__esModule",{value:!0});var pi=W(),EP={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return(0,pi.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,pi._)`{limit: ${e}}`},TP={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:EP,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxItems"?pi.operators.GT:pi.operators.LT;e.fail$data((0,pi._)`${r}.length ${o} ${n}`)}};Bp.default=TP});var vs=j(Wp=>{"use strict";Object.defineProperty(Wp,"__esModule",{value:!0});var s_=lp();s_.code='require("ajv/dist/runtime/equal").default';Wp.default=s_});var c_=j(Xp=>{"use strict";Object.defineProperty(Xp,"__esModule",{value:!0});var Gp=Go(),Te=W(),OP=re(),NP=vs(),DP={message:({params:{i:e,j:t}})=>(0,Te.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,Te._)`{i: ${e}, j: ${t}}`},RP={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:DP,code(e){let{gen:t,data:r,$data:n,schema:o,parentSchema:i,schemaCode:a,it:s}=e;if(!n&&!o)return;let c=t.let("valid"),u=i.items?(0,Gp.getSchemaTypes)(i.items):[];e.block$data(c,l,(0,Te._)`${a} === false`),e.ok(c);function l(){let m=t.let("i",(0,Te._)`${r}.length`),h=t.let("j");e.setParams({i:m,j:h}),t.assign(c,!0),t.if((0,Te._)`${m} > 1`,()=>(d()?p:f)(m,h))}function d(){return u.length>0&&!u.some(m=>m==="object"||m==="array")}function p(m,h){let v=t.name("item"),_=(0,Gp.checkDataTypes)(u,v,s.opts.strictNumbers,Gp.DataType.Wrong),$=t.const("indices",(0,Te._)`{}`);t.for((0,Te._)`;${m}--;`,()=>{t.let(v,(0,Te._)`${r}[${m}]`),t.if(_,(0,Te._)`continue`),u.length>1&&t.if((0,Te._)`typeof ${v} == "string"`,(0,Te._)`${v} += "_"`),t.if((0,Te._)`typeof ${$}[${v}] == "number"`,()=>{t.assign(h,(0,Te._)`${$}[${v}]`),e.error(),t.assign(c,!1).break()}).code((0,Te._)`${$}[${v}] = ${m}`)})}function f(m,h){let v=(0,OP.useFunc)(t,NP.default),_=t.name("outer");t.label(_).for((0,Te._)`;${m}--;`,()=>t.for((0,Te._)`${h} = ${m}; ${h}--;`,()=>t.if((0,Te._)`${v}(${r}[${m}], ${r}[${h}])`,()=>{e.error(),t.assign(c,!1).break(_)})))}}};Xp.default=RP});var u_=j(Qp=>{"use strict";Object.defineProperty(Qp,"__esModule",{value:!0});var Yp=W(),CP=re(),ZP=vs(),AP={message:"must be equal to constant",params:({schemaCode:e})=>(0,Yp._)`{allowedValue: ${e}}`},UP={keyword:"const",$data:!0,error:AP,code(e){let{gen:t,data:r,$data:n,schemaCode:o,schema:i}=e;n||i&&typeof i=="object"?e.fail$data((0,Yp._)`!${(0,CP.useFunc)(t,ZP.default)}(${r}, ${o})`):e.fail((0,Yp._)`${i} !== ${r}`)}};Qp.default=UP});var l_=j(ef=>{"use strict";Object.defineProperty(ef,"__esModule",{value:!0});var fi=W(),MP=re(),FP=vs(),qP={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,fi._)`{allowedValues: ${e}}`},LP={keyword:"enum",schemaType:"array",$data:!0,error:qP,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:i,it:a}=e;if(!n&&o.length===0)throw new Error("enum must have non-empty array");let s=o.length>=a.opts.loopEnum,c,u=()=>c??(c=(0,MP.useFunc)(t,FP.default)),l;if(s||n)l=t.let("valid"),e.block$data(l,d);else{if(!Array.isArray(o))throw new Error("ajv implementation error");let f=t.const("vSchema",i);l=(0,fi.or)(...o.map((m,h)=>p(f,h)))}e.pass(l);function d(){t.assign(l,!1),t.forOf("v",i,f=>t.if((0,fi._)`${u()}(${r}, ${f})`,()=>t.assign(l,!0).break()))}function p(f,m){let h=o[m];return typeof h=="object"&&h!==null?(0,fi._)`${u()}(${r}, ${f}[${m}])`:(0,fi._)`${r} === ${h}`}}};ef.default=LP});var d_=j(tf=>{"use strict";Object.defineProperty(tf,"__esModule",{value:!0});var VP=Yy(),JP=Qy(),KP=r_(),HP=n_(),BP=o_(),WP=i_(),GP=a_(),XP=c_(),YP=u_(),QP=l_(),ej=[VP.default,JP.default,KP.default,HP.default,BP.default,WP.default,GP.default,XP.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},YP.default,QP.default];tf.default=ej});var nf=j(mi=>{"use strict";Object.defineProperty(mi,"__esModule",{value:!0});mi.validateAdditionalItems=void 0;var Or=W(),rf=re(),tj={message:({params:{len:e}})=>(0,Or.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,Or._)`{limit: ${e}}`},rj={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:tj,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0,rf.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}p_(e,n)}};function p_(e,t){let{gen:r,schema:n,data:o,keyword:i,it:a}=e;a.items=!0;let s=r.const("len",(0,Or._)`${o}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,Or._)`${s} <= ${t.length}`);else if(typeof n=="object"&&!(0,rf.alwaysValidSchema)(a,n)){let u=r.var("valid",(0,Or._)`${s} <= ${t.length}`);r.if((0,Or.not)(u),()=>c(u)),e.ok(u)}function c(u){r.forRange("i",t.length,s,l=>{e.subschema({keyword:i,dataProp:l,dataPropType:rf.Type.Num},u),a.allErrors||r.if((0,Or.not)(u),()=>r.break())})}}mi.validateAdditionalItems=p_;mi.default=rj});var of=j(hi=>{"use strict";Object.defineProperty(hi,"__esModule",{value:!0});hi.validateTuple=void 0;var f_=W(),ys=re(),nj=dt(),oj={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return m_(e,"additionalItems",t);r.items=!0,!(0,ys.alwaysValidSchema)(r,t)&&e.ok((0,nj.validateArray)(e))}};function m_(e,t,r=e.schema){let{gen:n,parentSchema:o,data:i,keyword:a,it:s}=e;l(o),s.opts.unevaluated&&r.length&&s.items!==!0&&(s.items=ys.mergeEvaluated.items(n,r.length,s.items));let c=n.name("valid"),u=n.const("len",(0,f_._)`${i}.length`);r.forEach((d,p)=>{(0,ys.alwaysValidSchema)(s,d)||(n.if((0,f_._)`${u} > ${p}`,()=>e.subschema({keyword:a,schemaProp:p,dataProp:p},c)),e.ok(c))});function l(d){let{opts:p,errSchemaPath:f}=s,m=r.length,h=m===d.minItems&&(m===d.maxItems||d[t]===!1);if(p.strictTuples&&!h){let v=`"${a}" is ${m}-tuple, but minItems or maxItems/${t} are not specified or different at path "${f}"`;(0,ys.checkStrictMode)(s,v,p.strictTuples)}}}hi.validateTuple=m_;hi.default=oj});var h_=j(af=>{"use strict";Object.defineProperty(af,"__esModule",{value:!0});var ij=of(),aj={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,ij.validateTuple)(e,"items")};af.default=aj});var v_=j(sf=>{"use strict";Object.defineProperty(sf,"__esModule",{value:!0});var g_=W(),sj=re(),cj=dt(),uj=nf(),lj={message:({params:{len:e}})=>(0,g_.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,g_._)`{limit: ${e}}`},dj={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:lj,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:o}=r;n.items=!0,!(0,sj.alwaysValidSchema)(n,t)&&(o?(0,uj.validateAdditionalItems)(e,o):e.ok((0,cj.validateArray)(e)))}};sf.default=dj});var y_=j(cf=>{"use strict";Object.defineProperty(cf,"__esModule",{value:!0});var ft=W(),_s=re(),pj={message:({params:{min:e,max:t}})=>t===void 0?(0,ft.str)`must contain at least ${e} valid item(s)`:(0,ft.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,ft._)`{minContains: ${e}}`:(0,ft._)`{minContains: ${e}, maxContains: ${t}}`},fj={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:pj,code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:i}=e,a,s,{minContains:c,maxContains:u}=n;i.opts.next?(a=c===void 0?1:c,s=u):a=1;let l=t.const("len",(0,ft._)`${o}.length`);if(e.setParams({min:a,max:s}),s===void 0&&a===0){(0,_s.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(s!==void 0&&a>s){(0,_s.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,_s.alwaysValidSchema)(i,r)){let h=(0,ft._)`${l} >= ${a}`;s!==void 0&&(h=(0,ft._)`${h} && ${l} <= ${s}`),e.pass(h);return}i.items=!0;let d=t.name("valid");s===void 0&&a===1?f(d,()=>t.if(d,()=>t.break())):a===0?(t.let(d,!0),s!==void 0&&t.if((0,ft._)`${o}.length > 0`,p)):(t.let(d,!1),p()),e.result(d,()=>e.reset());function p(){let h=t.name("_valid"),v=t.let("count",0);f(h,()=>t.if(h,()=>m(v)))}function f(h,v){t.forRange("i",0,l,_=>{e.subschema({keyword:"contains",dataProp:_,dataPropType:_s.Type.Num,compositeRule:!0},h),v()})}function m(h){t.code((0,ft._)`${h}++`),s===void 0?t.if((0,ft._)`${h} >= ${a}`,()=>t.assign(d,!0).break()):(t.if((0,ft._)`${h} > ${s}`,()=>t.assign(d,!1).break()),a===1?t.assign(d,!0):t.if((0,ft._)`${h} >= ${a}`,()=>t.assign(d,!0)))}}};cf.default=fj});var b_=j(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.validateSchemaDeps=It.validatePropertyDeps=It.error=void 0;var uf=W(),mj=re(),gi=dt();It.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let n=t===1?"property":"properties";return(0,uf.str)`must have ${n} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>(0,uf._)`{property: ${e},
2
+ "use strict";var P$=Object.create;var Zs=Object.defineProperty;var j$=Object.getOwnPropertyDescriptor;var E$=Object.getOwnPropertyNames;var T$=Object.getPrototypeOf,O$=Object.prototype.hasOwnProperty;var j=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},Tn=(e,t)=>{for(var r in t)Zs(e,r,{get:t[r],enumerable:!0})},N$=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of E$(t))!O$.call(e,i)&&i!==r&&Zs(e,i,{get:()=>t[i],enumerable:!(n=j$(t,i))||n.enumerable});return e};var it=(e,t,r)=>(r=e!=null?P$(T$(e)):{},N$(t||!e||!e.__esModule?Zs(r,"default",{value:e,enumerable:!0}):r,e));var Li=j(ie=>{"use strict";Object.defineProperty(ie,"__esModule",{value:!0});ie.regexpCode=ie.getEsmExportName=ie.getProperty=ie.safeStringify=ie.stringify=ie.strConcat=ie.addCodeArg=ie.str=ie._=ie.nil=ie._Code=ie.Name=ie.IDENTIFIER=ie._CodeOrName=void 0;var Mi=class{};ie._CodeOrName=Mi;ie.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var br=class extends Mi{constructor(t){if(super(),!ie.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};ie.Name=br;var lt=class extends Mi{constructor(t){super(),this._items=typeof t=="string"?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let t=this._items[0];return t===""||t==='""'}get str(){var t;return(t=this._str)!==null&&t!==void 0?t:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var t;return(t=this._names)!==null&&t!==void 0?t:this._names=this._items.reduce((r,n)=>(n instanceof br&&(r[n.str]=(r[n.str]||0)+1),r),{})}};ie._Code=lt;ie.nil=new lt("");function cv(e,...t){let r=[e[0]],n=0;for(;n<t.length;)Cd(r,t[n]),r.push(e[++n]);return new lt(r)}ie._=cv;var Rd=new lt("+");function uv(e,...t){let r=[Fi(e[0])],n=0;for(;n<t.length;)r.push(Rd),Cd(r,t[n]),r.push(Rd,Fi(e[++n]));return gS(r),new lt(r)}ie.str=uv;function Cd(e,t){t instanceof lt?e.push(...t._items):t instanceof br?e.push(t):e.push(_S(t))}ie.addCodeArg=Cd;function gS(e){let t=1;for(;t<e.length-1;){if(e[t]===Rd){let r=vS(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function vS(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof br||e[e.length-1]!=='"'?void 0:typeof t!="string"?`${e.slice(0,-1)}${t}"`:t[0]==='"'?e.slice(0,-1)+t.slice(1):void 0;if(typeof t=="string"&&t[0]==='"'&&!(e instanceof br))return`"${e}${t.slice(1)}`}function yS(e,t){return t.emptyStr()?e:e.emptyStr()?t:uv`${e}${t}`}ie.strConcat=yS;function _S(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:Fi(Array.isArray(e)?e.join(","):e)}function $S(e){return new lt(Fi(e))}ie.stringify=$S;function Fi(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}ie.safeStringify=Fi;function bS(e){return typeof e=="string"&&ie.IDENTIFIER.test(e)?new lt(`.${e}`):cv`[${e}]`}ie.getProperty=bS;function xS(e){if(typeof e=="string"&&ie.IDENTIFIER.test(e))return new lt(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}ie.getEsmExportName=xS;function kS(e){return new lt(e.toString())}ie.regexpCode=kS});var Ud=j(We=>{"use strict";Object.defineProperty(We,"__esModule",{value:!0});We.ValueScope=We.ValueScopeName=We.Scope=We.varKinds=We.UsedValueState=void 0;var He=Li(),Zd=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}},Ja;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(Ja||(We.UsedValueState=Ja={}));We.varKinds={const:new He.Name("const"),let:new He.Name("let"),var:new He.Name("var")};var Ka=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof He.Name?t:this.name(t)}name(t){return new He.Name(this._newName(t))}_newName(t){let r=this._names[t]||this._nameGroup(t);return`${t}${r.index++}`}_nameGroup(t){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(t)||this._prefixes&&!this._prefixes.has(t))throw new Error(`CodeGen: prefix "${t}" is not allowed in this scope`);return this._names[t]={prefix:t,index:0}}};We.Scope=Ka;var Ba=class extends He.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:r,itemIndex:n}){this.value=t,this.scopePath=(0,He._)`.${new He.Name(r)}[${n}]`}};We.ValueScopeName=Ba;var wS=(0,He._)`\n`,Ad=class extends Ka{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?wS:He.nil}}get(){return this._scope}name(t){return new Ba(t,this._newName(t))}value(t,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let i=this.toName(t),{prefix:o}=i,a=(n=r.key)!==null&&n!==void 0?n:r.ref,s=this._values[o];if(s){let l=s.get(a);if(l)return l}else s=this._values[o]=new Map;s.set(a,i);let c=this._scope[o]||(this._scope[o]=[]),u=c.length;return c[u]=r.ref,i.setValue(r,{property:o,itemIndex:u}),i}getValue(t,r){let n=this._values[t];if(n)return n.get(r)}scopeRefs(t,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,He._)`${t}${n.scopePath}`})}scopeCode(t=this._values,r,n){return this._reduceValues(t,i=>{if(i.value===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return i.value.code},r,n)}_reduceValues(t,r,n={},i){let o=He.nil;for(let a in t){let s=t[a];if(!s)continue;let c=n[a]=n[a]||new Map;s.forEach(u=>{if(c.has(u))return;c.set(u,Ja.Started);let l=r(u);if(l){let d=this.opts.es5?We.varKinds.var:We.varKinds.const;o=(0,He._)`${o}${d} ${u} = ${l};${this.opts._n}`}else if(l=i?.(u))o=(0,He._)`${o}${l}${this.opts._n}`;else throw new Zd(u);c.set(u,Ja.Completed)})}return o}};We.ValueScope=Ad});var W=j(X=>{"use strict";Object.defineProperty(X,"__esModule",{value:!0});X.or=X.and=X.not=X.CodeGen=X.operators=X.varKinds=X.ValueScopeName=X.ValueScope=X.Scope=X.Name=X.regexpCode=X.stringify=X.getProperty=X.nil=X.strConcat=X.str=X._=void 0;var te=Li(),vt=Ud(),rr=Li();Object.defineProperty(X,"_",{enumerable:!0,get:function(){return rr._}});Object.defineProperty(X,"str",{enumerable:!0,get:function(){return rr.str}});Object.defineProperty(X,"strConcat",{enumerable:!0,get:function(){return rr.strConcat}});Object.defineProperty(X,"nil",{enumerable:!0,get:function(){return rr.nil}});Object.defineProperty(X,"getProperty",{enumerable:!0,get:function(){return rr.getProperty}});Object.defineProperty(X,"stringify",{enumerable:!0,get:function(){return rr.stringify}});Object.defineProperty(X,"regexpCode",{enumerable:!0,get:function(){return rr.regexpCode}});Object.defineProperty(X,"Name",{enumerable:!0,get:function(){return rr.Name}});var Xa=Ud();Object.defineProperty(X,"Scope",{enumerable:!0,get:function(){return Xa.Scope}});Object.defineProperty(X,"ValueScope",{enumerable:!0,get:function(){return Xa.ValueScope}});Object.defineProperty(X,"ValueScopeName",{enumerable:!0,get:function(){return Xa.ValueScopeName}});Object.defineProperty(X,"varKinds",{enumerable:!0,get:function(){return Xa.varKinds}});X.operators={GT:new te._Code(">"),GTE:new te._Code(">="),LT:new te._Code("<"),LTE:new te._Code("<="),EQ:new te._Code("==="),NEQ:new te._Code("!=="),NOT:new te._Code("!"),OR:new te._Code("||"),AND:new te._Code("&&"),ADD:new te._Code("+")};var Mt=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},Md=class extends Mt{constructor(t,r,n){super(),this.varKind=t,this.name=r,this.rhs=n}render({es5:t,_n:r}){let n=t?vt.varKinds.var:this.varKind,i=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${i};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=fn(this.rhs,t,r)),this}get names(){return this.rhs instanceof te._CodeOrName?this.rhs.names:{}}},Ha=class extends Mt{constructor(t,r,n){super(),this.lhs=t,this.rhs=r,this.sideEffects=n}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,r){if(!(this.lhs instanceof te.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=fn(this.rhs,t,r),this}get names(){let t=this.lhs instanceof te.Name?{}:{...this.lhs.names};return Ga(t,this.rhs)}},Fd=class extends Ha{constructor(t,r,n,i){super(t,n,i),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},Ld=class extends Mt{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},qd=class extends Mt{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},Vd=class extends Mt{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},Jd=class extends Mt{constructor(t){super(),this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(t,r){return this.code=fn(this.code,t,r),this}get names(){return this.code instanceof te._CodeOrName?this.code.names:{}}},qi=class extends Mt{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce((r,n)=>r+n.render(t),"")}optimizeNodes(){let{nodes:t}=this,r=t.length;for(;r--;){let n=t[r].optimizeNodes();Array.isArray(n)?t.splice(r,1,...n):n?t[r]=n:t.splice(r,1)}return t.length>0?this:void 0}optimizeNames(t,r){let{nodes:n}=this,i=n.length;for(;i--;){let o=n[i];o.optimizeNames(t,r)||(SS(t,o.names),n.splice(i,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>wr(t,r.names),{})}},Ft=class extends qi{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},Kd=class extends qi{},pn=class extends Ft{};pn.kind="else";var xr=class e extends Ft{constructor(t,r){super(r),this.condition=t}render(t){let r=`if(${this.condition})`+super.render(t);return this.else&&(r+="else "+this.else.render(t)),r}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new pn(n):n}if(r)return t===!1?r instanceof e?r:r.nodes:this.nodes.length?this:new e(lv(t),r instanceof e?[r]:r.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(t,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(t,r),!!(super.optimizeNames(t,r)||this.else))return this.condition=fn(this.condition,t,r),this}get names(){let t=super.names;return Ga(t,this.condition),this.else&&wr(t,this.else.names),t}};xr.kind="if";var kr=class extends Ft{};kr.kind="for";var Bd=class extends kr{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iteration=fn(this.iteration,t,r),this}get names(){return wr(super.names,this.iteration.names)}},Hd=class extends kr{constructor(t,r,n,i){super(),this.varKind=t,this.name=r,this.from=n,this.to=i}render(t){let r=t.es5?vt.varKinds.var:this.varKind,{name:n,from:i,to:o}=this;return`for(${r} ${n}=${i}; ${n}<${o}; ${n}++)`+super.render(t)}get names(){let t=Ga(super.names,this.from);return Ga(t,this.to)}},Wa=class extends kr{constructor(t,r,n,i){super(),this.loop=t,this.varKind=r,this.name=n,this.iterable=i}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iterable=fn(this.iterable,t,r),this}get names(){return wr(super.names,this.iterable.names)}},Vi=class extends Ft{constructor(t,r,n){super(),this.name=t,this.args=r,this.async=n}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}};Vi.kind="func";var Ji=class extends qi{render(t){return"return "+super.render(t)}};Ji.kind="return";var Wd=class extends Ft{render(t){let r="try"+super.render(t);return this.catch&&(r+=this.catch.render(t)),this.finally&&(r+=this.finally.render(t)),r}optimizeNodes(){var t,r;return super.optimizeNodes(),(t=this.catch)===null||t===void 0||t.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(t,r){var n,i;return super.optimizeNames(t,r),(n=this.catch)===null||n===void 0||n.optimizeNames(t,r),(i=this.finally)===null||i===void 0||i.optimizeNames(t,r),this}get names(){let t=super.names;return this.catch&&wr(t,this.catch.names),this.finally&&wr(t,this.finally.names),t}},Ki=class extends Ft{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};Ki.kind="catch";var Bi=class extends Ft{render(t){return"finally"+super.render(t)}};Bi.kind="finally";var Gd=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
3
+ `:""},this._extScope=t,this._scope=new vt.Scope({parent:t}),this._nodes=[new Kd]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,r){let n=this._extScope.value(t,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(t,r){return this._extScope.getValue(t,r)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,r,n,i){let o=this._scope.toName(r);return n!==void 0&&i&&(this._constants[o.str]=n),this._leafNode(new Md(t,o,n)),o}const(t,r,n){return this._def(vt.varKinds.const,t,r,n)}let(t,r,n){return this._def(vt.varKinds.let,t,r,n)}var(t,r,n){return this._def(vt.varKinds.var,t,r,n)}assign(t,r,n){return this._leafNode(new Ha(t,r,n))}add(t,r){return this._leafNode(new Fd(t,X.operators.ADD,r))}code(t){return typeof t=="function"?t():t!==te.nil&&this._leafNode(new Jd(t)),this}object(...t){let r=["{"];for(let[n,i]of t)r.length>1&&r.push(","),r.push(n),(n!==i||this.opts.es5)&&(r.push(":"),(0,te.addCodeArg)(r,i));return r.push("}"),new te._Code(r)}if(t,r,n){if(this._blockNode(new xr(t)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new xr(t))}else(){return this._elseNode(new pn)}endIf(){return this._endBlockNode(xr,pn)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new Bd(t),r)}forRange(t,r,n,i,o=this.opts.es5?vt.varKinds.var:vt.varKinds.let){let a=this._scope.toName(t);return this._for(new Hd(o,a,r,n),()=>i(a))}forOf(t,r,n,i=vt.varKinds.const){let o=this._scope.toName(t);if(this.opts.es5){let a=r instanceof te.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,te._)`${a}.length`,s=>{this.var(o,(0,te._)`${a}[${s}]`),n(o)})}return this._for(new Wa("of",i,o,r),()=>n(o))}forIn(t,r,n,i=this.opts.es5?vt.varKinds.var:vt.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,te._)`Object.keys(${r})`,n);let o=this._scope.toName(t);return this._for(new Wa("in",i,o,r),()=>n(o))}endFor(){return this._endBlockNode(kr)}label(t){return this._leafNode(new Ld(t))}break(t){return this._leafNode(new qd(t))}return(t){let r=new Ji;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Ji)}try(t,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let i=new Wd;if(this._blockNode(i),this.code(t),r){let o=this.name("e");this._currNode=i.catch=new Ki(o),r(o)}return n&&(this._currNode=i.finally=new Bi,this.code(n)),this._endBlockNode(Ki,Bi)}throw(t){return this._leafNode(new Vd(t))}block(t,r){return this._blockStarts.push(this._nodes.length),t&&this.code(t).endBlock(r),this}endBlock(t){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||t!==void 0&&n!==t)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${t} expected`);return this._nodes.length=r,this}func(t,r=te.nil,n,i){return this._blockNode(new Vi(t,r,n)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(Vi)}optimize(t=1){for(;t-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(t){return this._currNode.nodes.push(t),this}_blockNode(t){this._currNode.nodes.push(t),this._nodes.push(t)}_endBlockNode(t,r){let n=this._currNode;if(n instanceof t||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${t.kind}/${r.kind}`:t.kind}"`)}_elseNode(t){let r=this._currNode;if(!(r instanceof xr))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=t,this}get _root(){return this._nodes[0]}get _currNode(){let t=this._nodes;return t[t.length-1]}set _currNode(t){let r=this._nodes;r[r.length-1]=t}};X.CodeGen=Gd;function wr(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function Ga(e,t){return t instanceof te._CodeOrName?wr(e,t.names):e}function fn(e,t,r){if(e instanceof te.Name)return n(e);if(!i(e))return e;return new te._Code(e._items.reduce((o,a)=>(a instanceof te.Name&&(a=n(a)),a instanceof te._Code?o.push(...a._items):o.push(a),o),[]));function n(o){let a=r[o.str];return a===void 0||t[o.str]!==1?o:(delete t[o.str],a)}function i(o){return o instanceof te._Code&&o._items.some(a=>a instanceof te.Name&&t[a.str]===1&&r[a.str]!==void 0)}}function SS(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function lv(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,te._)`!${Xd(e)}`}X.not=lv;var zS=dv(X.operators.AND);function IS(...e){return e.reduce(zS)}X.and=IS;var PS=dv(X.operators.OR);function jS(...e){return e.reduce(PS)}X.or=jS;function dv(e){return(t,r)=>t===te.nil?r:r===te.nil?t:(0,te._)`${Xd(t)} ${e} ${Xd(r)}`}function Xd(e){return e instanceof te.Name?e:(0,te._)`(${e})`}});var re=j(Q=>{"use strict";Object.defineProperty(Q,"__esModule",{value:!0});Q.checkStrictMode=Q.getErrorPath=Q.Type=Q.useFunc=Q.setEvaluated=Q.evaluatedPropsToName=Q.mergeEvaluated=Q.eachItem=Q.unescapeJsonPointer=Q.escapeJsonPointer=Q.escapeFragment=Q.unescapeFragment=Q.schemaRefOrVal=Q.schemaHasRulesButRef=Q.schemaHasRules=Q.checkUnknownRules=Q.alwaysValidSchema=Q.toHash=void 0;var pe=W(),ES=Li();function TS(e){let t={};for(let r of e)t[r]=!0;return t}Q.toHash=TS;function OS(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(mv(e,t),!hv(t,e.self.RULES.all))}Q.alwaysValidSchema=OS;function mv(e,t=e.schema){let{opts:r,self:n}=e;if(!r.strictSchema||typeof t=="boolean")return;let i=n.RULES.keywords;for(let o in t)i[o]||yv(e,`unknown keyword: "${o}"`)}Q.checkUnknownRules=mv;function hv(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}Q.schemaHasRules=hv;function NS(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}Q.schemaHasRulesButRef=NS;function DS({topSchemaRef:e,schemaPath:t},r,n,i){if(!i){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,pe._)`${r}`}return(0,pe._)`${e}${t}${(0,pe.getProperty)(n)}`}Q.schemaRefOrVal=DS;function RS(e){return gv(decodeURIComponent(e))}Q.unescapeFragment=RS;function CS(e){return encodeURIComponent(Qd(e))}Q.escapeFragment=CS;function Qd(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}Q.escapeJsonPointer=Qd;function gv(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}Q.unescapeJsonPointer=gv;function ZS(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}Q.eachItem=ZS;function pv({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(i,o,a,s)=>{let c=a===void 0?o:a instanceof pe.Name?(o instanceof pe.Name?e(i,o,a):t(i,o,a),a):o instanceof pe.Name?(t(i,a,o),o):r(o,a);return s===pe.Name&&!(c instanceof pe.Name)?n(i,c):c}}Q.mergeEvaluated={props:pv({mergeNames:(e,t,r)=>e.if((0,pe._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,pe._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,pe._)`${r} || {}`).code((0,pe._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,pe._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,pe._)`${r} || {}`),ep(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:vv}),items:pv({mergeNames:(e,t,r)=>e.if((0,pe._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,pe._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,pe._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,pe._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function vv(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",(0,pe._)`{}`);return t!==void 0&&ep(e,r,t),r}Q.evaluatedPropsToName=vv;function ep(e,t,r){Object.keys(r).forEach(n=>e.assign((0,pe._)`${t}${(0,pe.getProperty)(n)}`,!0))}Q.setEvaluated=ep;var fv={};function AS(e,t){return e.scopeValue("func",{ref:t,code:fv[t.code]||(fv[t.code]=new ES._Code(t.code))})}Q.useFunc=AS;var Yd;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Yd||(Q.Type=Yd={}));function US(e,t,r){if(e instanceof pe.Name){let n=t===Yd.Num;return r?n?(0,pe._)`"[" + ${e} + "]"`:(0,pe._)`"['" + ${e} + "']"`:n?(0,pe._)`"/" + ${e}`:(0,pe._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,pe.getProperty)(e).toString():"/"+Qd(e)}Q.getErrorPath=US;function yv(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,r===!0)throw new Error(t);e.self.logger.warn(t)}}Q.checkStrictMode=yv});var Lt=j(tp=>{"use strict";Object.defineProperty(tp,"__esModule",{value:!0});var Ce=W(),MS={data:new Ce.Name("data"),valCxt:new Ce.Name("valCxt"),instancePath:new Ce.Name("instancePath"),parentData:new Ce.Name("parentData"),parentDataProperty:new Ce.Name("parentDataProperty"),rootData:new Ce.Name("rootData"),dynamicAnchors:new Ce.Name("dynamicAnchors"),vErrors:new Ce.Name("vErrors"),errors:new Ce.Name("errors"),this:new Ce.Name("this"),self:new Ce.Name("self"),scope:new Ce.Name("scope"),json:new Ce.Name("json"),jsonPos:new Ce.Name("jsonPos"),jsonLen:new Ce.Name("jsonLen"),jsonPart:new Ce.Name("jsonPart")};tp.default=MS});var Hi=j(Ze=>{"use strict";Object.defineProperty(Ze,"__esModule",{value:!0});Ze.extendErrors=Ze.resetErrorsCount=Ze.reportExtraError=Ze.reportError=Ze.keyword$DataError=Ze.keywordError=void 0;var ne=W(),Ya=re(),Je=Lt();Ze.keywordError={message:({keyword:e})=>(0,ne.str)`must pass "${e}" keyword validation`};Ze.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,ne.str)`"${e}" keyword must be ${t} ($data)`:(0,ne.str)`"${e}" keyword is invalid ($data)`};function FS(e,t=Ze.keywordError,r,n){let{it:i}=e,{gen:o,compositeRule:a,allErrors:s}=i,c=bv(e,t,r);n??(a||s)?_v(o,c):$v(i,(0,ne._)`[${c}]`)}Ze.reportError=FS;function LS(e,t=Ze.keywordError,r){let{it:n}=e,{gen:i,compositeRule:o,allErrors:a}=n,s=bv(e,t,r);_v(i,s),o||a||$v(n,Je.default.vErrors)}Ze.reportExtraError=LS;function qS(e,t){e.assign(Je.default.errors,t),e.if((0,ne._)`${Je.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,ne._)`${Je.default.vErrors}.length`,t),()=>e.assign(Je.default.vErrors,null)))}Ze.resetErrorsCount=qS;function VS({gen:e,keyword:t,schemaValue:r,data:n,errsCount:i,it:o}){if(i===void 0)throw new Error("ajv implementation error");let a=e.name("err");e.forRange("i",i,Je.default.errors,s=>{e.const(a,(0,ne._)`${Je.default.vErrors}[${s}]`),e.if((0,ne._)`${a}.instancePath === undefined`,()=>e.assign((0,ne._)`${a}.instancePath`,(0,ne.strConcat)(Je.default.instancePath,o.errorPath))),e.assign((0,ne._)`${a}.schemaPath`,(0,ne.str)`${o.errSchemaPath}/${t}`),o.opts.verbose&&(e.assign((0,ne._)`${a}.schema`,r),e.assign((0,ne._)`${a}.data`,n))})}Ze.extendErrors=VS;function _v(e,t){let r=e.const("err",t);e.if((0,ne._)`${Je.default.vErrors} === null`,()=>e.assign(Je.default.vErrors,(0,ne._)`[${r}]`),(0,ne._)`${Je.default.vErrors}.push(${r})`),e.code((0,ne._)`${Je.default.errors}++`)}function $v(e,t){let{gen:r,validateName:n,schemaEnv:i}=e;i.$async?r.throw((0,ne._)`new ${e.ValidationError}(${t})`):(r.assign((0,ne._)`${n}.errors`,t),r.return(!1))}var Sr={keyword:new ne.Name("keyword"),schemaPath:new ne.Name("schemaPath"),params:new ne.Name("params"),propertyName:new ne.Name("propertyName"),message:new ne.Name("message"),schema:new ne.Name("schema"),parentSchema:new ne.Name("parentSchema")};function bv(e,t,r){let{createErrors:n}=e.it;return n===!1?(0,ne._)`{}`:JS(e,t,r)}function JS(e,t,r={}){let{gen:n,it:i}=e,o=[KS(i,r),BS(e,r)];return HS(e,t,o),n.object(...o)}function KS({errorPath:e},{instancePath:t}){let r=t?(0,ne.str)`${e}${(0,Ya.getErrorPath)(t,Ya.Type.Str)}`:e;return[Je.default.instancePath,(0,ne.strConcat)(Je.default.instancePath,r)]}function BS({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let i=n?t:(0,ne.str)`${t}/${e}`;return r&&(i=(0,ne.str)`${i}${(0,Ya.getErrorPath)(r,Ya.Type.Str)}`),[Sr.schemaPath,i]}function HS(e,{params:t,message:r},n){let{keyword:i,data:o,schemaValue:a,it:s}=e,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=s;n.push([Sr.keyword,i],[Sr.params,typeof t=="function"?t(e):t||(0,ne._)`{}`]),c.messages&&n.push([Sr.message,typeof r=="function"?r(e):r]),c.verbose&&n.push([Sr.schema,a],[Sr.parentSchema,(0,ne._)`${l}${d}`],[Je.default.data,o]),u&&n.push([Sr.propertyName,u])}});var kv=j(mn=>{"use strict";Object.defineProperty(mn,"__esModule",{value:!0});mn.boolOrEmptySchema=mn.topBoolOrEmptySchema=void 0;var WS=Hi(),GS=W(),XS=Lt(),YS={message:"boolean schema is false"};function QS(e){let{gen:t,schema:r,validateName:n}=e;r===!1?xv(e,!1):typeof r=="object"&&r.$async===!0?t.return(XS.default.data):(t.assign((0,GS._)`${n}.errors`,null),t.return(!0))}mn.topBoolOrEmptySchema=QS;function e0(e,t){let{gen:r,schema:n}=e;n===!1?(r.var(t,!1),xv(e)):r.var(t,!0)}mn.boolOrEmptySchema=e0;function xv(e,t){let{gen:r,data:n}=e,i={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,WS.reportError)(i,YS,void 0,t)}});var rp=j(hn=>{"use strict";Object.defineProperty(hn,"__esModule",{value:!0});hn.getRules=hn.isJSONType=void 0;var t0=["string","number","integer","boolean","null","object","array"],r0=new Set(t0);function n0(e){return typeof e=="string"&&r0.has(e)}hn.isJSONType=n0;function i0(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}hn.getRules=i0});var np=j(nr=>{"use strict";Object.defineProperty(nr,"__esModule",{value:!0});nr.shouldUseRule=nr.shouldUseGroup=nr.schemaHasRulesForType=void 0;function o0({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&wv(e,n)}nr.schemaHasRulesForType=o0;function wv(e,t){return t.rules.some(r=>Sv(e,r))}nr.shouldUseGroup=wv;function Sv(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(n=>e[n]!==void 0))}nr.shouldUseRule=Sv});var Wi=j(Ae=>{"use strict";Object.defineProperty(Ae,"__esModule",{value:!0});Ae.reportTypeError=Ae.checkDataTypes=Ae.checkDataType=Ae.coerceAndCheckDataType=Ae.getJSONTypes=Ae.getSchemaTypes=Ae.DataType=void 0;var a0=rp(),s0=np(),c0=Hi(),H=W(),zv=re(),gn;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(gn||(Ae.DataType=gn={}));function u0(e){let t=Iv(e.type);if(t.includes("null")){if(e.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');e.nullable===!0&&t.push("null")}return t}Ae.getSchemaTypes=u0;function Iv(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(a0.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}Ae.getJSONTypes=Iv;function l0(e,t){let{gen:r,data:n,opts:i}=e,o=d0(t,i.coerceTypes),a=t.length>0&&!(o.length===0&&t.length===1&&(0,s0.schemaHasRulesForType)(e,t[0]));if(a){let s=op(t,n,i.strictNumbers,gn.Wrong);r.if(s,()=>{o.length?p0(e,t,o):ap(e)})}return a}Ae.coerceAndCheckDataType=l0;var Pv=new Set(["string","number","integer","boolean","null"]);function d0(e,t){return t?e.filter(r=>Pv.has(r)||t==="array"&&r==="array"):[]}function p0(e,t,r){let{gen:n,data:i,opts:o}=e,a=n.let("dataType",(0,H._)`typeof ${i}`),s=n.let("coerced",(0,H._)`undefined`);o.coerceTypes==="array"&&n.if((0,H._)`${a} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>n.assign(i,(0,H._)`${i}[0]`).assign(a,(0,H._)`typeof ${i}`).if(op(t,i,o.strictNumbers),()=>n.assign(s,i))),n.if((0,H._)`${s} !== undefined`);for(let u of r)(Pv.has(u)||u==="array"&&o.coerceTypes==="array")&&c(u);n.else(),ap(e),n.endIf(),n.if((0,H._)`${s} !== undefined`,()=>{n.assign(i,s),f0(e,s)});function c(u){switch(u){case"string":n.elseIf((0,H._)`${a} == "number" || ${a} == "boolean"`).assign(s,(0,H._)`"" + ${i}`).elseIf((0,H._)`${i} === null`).assign(s,(0,H._)`""`);return;case"number":n.elseIf((0,H._)`${a} == "boolean" || ${i} === null
4
+ || (${a} == "string" && ${i} && ${i} == +${i})`).assign(s,(0,H._)`+${i}`);return;case"integer":n.elseIf((0,H._)`${a} === "boolean" || ${i} === null
5
+ || (${a} === "string" && ${i} && ${i} == +${i} && !(${i} % 1))`).assign(s,(0,H._)`+${i}`);return;case"boolean":n.elseIf((0,H._)`${i} === "false" || ${i} === 0 || ${i} === null`).assign(s,!1).elseIf((0,H._)`${i} === "true" || ${i} === 1`).assign(s,!0);return;case"null":n.elseIf((0,H._)`${i} === "" || ${i} === 0 || ${i} === false`),n.assign(s,null);return;case"array":n.elseIf((0,H._)`${a} === "string" || ${a} === "number"
6
+ || ${a} === "boolean" || ${i} === null`).assign(s,(0,H._)`[${i}]`)}}}function f0({gen:e,parentData:t,parentDataProperty:r},n){e.if((0,H._)`${t} !== undefined`,()=>e.assign((0,H._)`${t}[${r}]`,n))}function ip(e,t,r,n=gn.Correct){let i=n===gn.Correct?H.operators.EQ:H.operators.NEQ,o;switch(e){case"null":return(0,H._)`${t} ${i} null`;case"array":o=(0,H._)`Array.isArray(${t})`;break;case"object":o=(0,H._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":o=a((0,H._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":o=a();break;default:return(0,H._)`typeof ${t} ${i} ${e}`}return n===gn.Correct?o:(0,H.not)(o);function a(s=H.nil){return(0,H.and)((0,H._)`typeof ${t} == "number"`,s,r?(0,H._)`isFinite(${t})`:H.nil)}}Ae.checkDataType=ip;function op(e,t,r,n){if(e.length===1)return ip(e[0],t,r,n);let i,o=(0,zv.toHash)(e);if(o.array&&o.object){let a=(0,H._)`typeof ${t} != "object"`;i=o.null?a:(0,H._)`!${t} || ${a}`,delete o.null,delete o.array,delete o.object}else i=H.nil;o.number&&delete o.integer;for(let a in o)i=(0,H.and)(i,ip(a,t,r,n));return i}Ae.checkDataTypes=op;var m0={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,H._)`{type: ${e}}`:(0,H._)`{type: ${t}}`};function ap(e){let t=h0(e);(0,c0.reportError)(t,m0)}Ae.reportTypeError=ap;function h0(e){let{gen:t,data:r,schema:n}=e,i=(0,zv.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:i,schemaValue:i,parentSchema:n,params:{},it:e}}});var Ev=j(Qa=>{"use strict";Object.defineProperty(Qa,"__esModule",{value:!0});Qa.assignDefaults=void 0;var vn=W(),g0=re();function v0(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let i in r)jv(e,i,r[i].default);else t==="array"&&Array.isArray(n)&&n.forEach((i,o)=>jv(e,o,i.default))}Qa.assignDefaults=v0;function jv(e,t,r){let{gen:n,compositeRule:i,data:o,opts:a}=e;if(r===void 0)return;let s=(0,vn._)`${o}${(0,vn.getProperty)(t)}`;if(i){(0,g0.checkStrictMode)(e,`default is ignored for: ${s}`);return}let c=(0,vn._)`${s} === undefined`;a.useDefaults==="empty"&&(c=(0,vn._)`${c} || ${s} === null || ${s} === ""`),n.if(c,(0,vn._)`${s} = ${(0,vn.stringify)(r)}`)}});var dt=j(ce=>{"use strict";Object.defineProperty(ce,"__esModule",{value:!0});ce.validateUnion=ce.validateArray=ce.usePattern=ce.callValidateCode=ce.schemaProperties=ce.allSchemaProperties=ce.noPropertyInData=ce.propertyInData=ce.isOwnProperty=ce.hasPropFunc=ce.reportMissingProp=ce.checkMissingProp=ce.checkReportMissingProp=void 0;var ge=W(),sp=re(),ir=Lt(),y0=re();function _0(e,t){let{gen:r,data:n,it:i}=e;r.if(up(r,n,t,i.opts.ownProperties),()=>{e.setParams({missingProperty:(0,ge._)`${t}`},!0),e.error()})}ce.checkReportMissingProp=_0;function $0({gen:e,data:t,it:{opts:r}},n,i){return(0,ge.or)(...n.map(o=>(0,ge.and)(up(e,t,o,r.ownProperties),(0,ge._)`${i} = ${o}`)))}ce.checkMissingProp=$0;function b0(e,t){e.setParams({missingProperty:t},!0),e.error()}ce.reportMissingProp=b0;function Tv(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,ge._)`Object.prototype.hasOwnProperty`})}ce.hasPropFunc=Tv;function cp(e,t,r){return(0,ge._)`${Tv(e)}.call(${t}, ${r})`}ce.isOwnProperty=cp;function x0(e,t,r,n){let i=(0,ge._)`${t}${(0,ge.getProperty)(r)} !== undefined`;return n?(0,ge._)`${i} && ${cp(e,t,r)}`:i}ce.propertyInData=x0;function up(e,t,r,n){let i=(0,ge._)`${t}${(0,ge.getProperty)(r)} === undefined`;return n?(0,ge.or)(i,(0,ge.not)(cp(e,t,r))):i}ce.noPropertyInData=up;function Ov(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}ce.allSchemaProperties=Ov;function k0(e,t){return Ov(t).filter(r=>!(0,sp.alwaysValidSchema)(e,t[r]))}ce.schemaProperties=k0;function w0({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:i,errorPath:o},it:a},s,c,u){let l=u?(0,ge._)`${e}, ${t}, ${n}${i}`:t,d=[[ir.default.instancePath,(0,ge.strConcat)(ir.default.instancePath,o)],[ir.default.parentData,a.parentData],[ir.default.parentDataProperty,a.parentDataProperty],[ir.default.rootData,ir.default.rootData]];a.opts.dynamicRef&&d.push([ir.default.dynamicAnchors,ir.default.dynamicAnchors]);let f=(0,ge._)`${l}, ${r.object(...d)}`;return c!==ge.nil?(0,ge._)`${s}.call(${c}, ${f})`:(0,ge._)`${s}(${f})`}ce.callValidateCode=w0;var S0=(0,ge._)`new RegExp`;function z0({gen:e,it:{opts:t}},r){let n=t.unicodeRegExp?"u":"",{regExp:i}=t.code,o=i(r,n);return e.scopeValue("pattern",{key:o.toString(),ref:o,code:(0,ge._)`${i.code==="new RegExp"?S0:(0,y0.useFunc)(e,i)}(${r}, ${n})`})}ce.usePattern=z0;function I0(e){let{gen:t,data:r,keyword:n,it:i}=e,o=t.name("valid");if(i.allErrors){let s=t.let("valid",!0);return a(()=>t.assign(s,!1)),s}return t.var(o,!0),a(()=>t.break()),o;function a(s){let c=t.const("len",(0,ge._)`${r}.length`);t.forRange("i",0,c,u=>{e.subschema({keyword:n,dataProp:u,dataPropType:sp.Type.Num},o),t.if((0,ge.not)(o),s)})}}ce.validateArray=I0;function P0(e){let{gen:t,schema:r,keyword:n,it:i}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,sp.alwaysValidSchema)(i,c))&&!i.opts.unevaluated)return;let a=t.let("valid",!1),s=t.name("_valid");t.block(()=>r.forEach((c,u)=>{let l=e.subschema({keyword:n,schemaProp:u,compositeRule:!0},s);t.assign(a,(0,ge._)`${a} || ${s}`),e.mergeValidEvaluated(l,s)||t.if((0,ge.not)(a))})),e.result(a,()=>e.reset(),()=>e.error(!0))}ce.validateUnion=P0});var Rv=j(St=>{"use strict";Object.defineProperty(St,"__esModule",{value:!0});St.validateKeywordUsage=St.validSchemaType=St.funcKeywordCode=St.macroKeywordCode=void 0;var Ke=W(),zr=Lt(),j0=dt(),E0=Hi();function T0(e,t){let{gen:r,keyword:n,schema:i,parentSchema:o,it:a}=e,s=t.macro.call(a.self,i,o,a),c=Dv(r,n,s);a.opts.validateSchema!==!1&&a.self.validateSchema(s,!0);let u=r.name("valid");e.subschema({schema:s,schemaPath:Ke.nil,errSchemaPath:`${a.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}St.macroKeywordCode=T0;function O0(e,t){var r;let{gen:n,keyword:i,schema:o,parentSchema:a,$data:s,it:c}=e;D0(c,t);let u=!s&&t.compile?t.compile.call(c.self,o,a,c):t.validate,l=Dv(n,i,u),d=n.let("valid");e.block$data(d,f),e.ok((r=t.valid)!==null&&r!==void 0?r:d);function f(){if(t.errors===!1)h(),t.modifying&&Nv(e),v(()=>e.error());else{let _=t.async?p():m();t.modifying&&Nv(e),v(()=>N0(e,_))}}function p(){let _=n.let("ruleErrs",null);return n.try(()=>h((0,Ke._)`await `),b=>n.assign(d,!1).if((0,Ke._)`${b} instanceof ${c.ValidationError}`,()=>n.assign(_,(0,Ke._)`${b}.errors`),()=>n.throw(b))),_}function m(){let _=(0,Ke._)`${l}.errors`;return n.assign(_,null),h(Ke.nil),_}function h(_=t.async?(0,Ke._)`await `:Ke.nil){let b=c.opts.passContext?zr.default.this:zr.default.self,$=!("compile"in t&&!s||t.schema===!1);n.assign(d,(0,Ke._)`${_}${(0,j0.callValidateCode)(e,l,b,$)}`,t.modifying)}function v(_){var b;n.if((0,Ke.not)((b=t.valid)!==null&&b!==void 0?b:d),_)}}St.funcKeywordCode=O0;function Nv(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0,Ke._)`${n.parentData}[${n.parentDataProperty}]`))}function N0(e,t){let{gen:r}=e;r.if((0,Ke._)`Array.isArray(${t})`,()=>{r.assign(zr.default.vErrors,(0,Ke._)`${zr.default.vErrors} === null ? ${t} : ${zr.default.vErrors}.concat(${t})`).assign(zr.default.errors,(0,Ke._)`${zr.default.vErrors}.length`),(0,E0.extendErrors)(e)},()=>e.error())}function D0({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function Dv(e,t,r){if(r===void 0)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Ke.stringify)(r)})}function R0(e,t,r=!1){return!t.length||t.some(n=>n==="array"?Array.isArray(e):n==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==n||r&&typeof e>"u")}St.validSchemaType=R0;function C0({schema:e,opts:t,self:r,errSchemaPath:n},i,o){if(Array.isArray(i.keyword)?!i.keyword.includes(o):i.keyword!==o)throw new Error("ajv implementation error");let a=i.dependencies;if(a?.some(s=>!Object.prototype.hasOwnProperty.call(e,s)))throw new Error(`parent schema must have dependencies of ${o}: ${a.join(",")}`);if(i.validateSchema&&!i.validateSchema(e[o])){let c=`keyword "${o}" value is invalid at path "${n}": `+r.errorsText(i.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}St.validateKeywordUsage=C0});var Zv=j(or=>{"use strict";Object.defineProperty(or,"__esModule",{value:!0});or.extendSubschemaMode=or.extendSubschemaData=or.getSubschema=void 0;var zt=W(),Cv=re();function Z0(e,{keyword:t,schemaProp:r,schema:n,schemaPath:i,errSchemaPath:o,topSchemaRef:a}){if(t!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let s=e.schema[t];return r===void 0?{schema:s,schemaPath:(0,zt._)`${e.schemaPath}${(0,zt.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:s[r],schemaPath:(0,zt._)`${e.schemaPath}${(0,zt.getProperty)(t)}${(0,zt.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,Cv.escapeFragment)(r)}`}}if(n!==void 0){if(i===void 0||o===void 0||a===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:i,topSchemaRef:a,errSchemaPath:o}}throw new Error('either "keyword" or "schema" must be passed')}or.getSubschema=Z0;function A0(e,t,{dataProp:r,dataPropType:n,data:i,dataTypes:o,propertyName:a}){if(i!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:s}=t;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=t,f=s.let("data",(0,zt._)`${t.data}${(0,zt.getProperty)(r)}`,!0);c(f),e.errorPath=(0,zt.str)`${u}${(0,Cv.getErrorPath)(r,n,d.jsPropertySyntax)}`,e.parentDataProperty=(0,zt._)`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(i!==void 0){let u=i instanceof zt.Name?i:s.let("data",i,!0);c(u),a!==void 0&&(e.propertyName=a)}o&&(e.dataTypes=o);function c(u){e.data=u,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,u]}}or.extendSubschemaData=A0;function U0(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:i,allErrors:o}){n!==void 0&&(e.compositeRule=n),i!==void 0&&(e.createErrors=i),o!==void 0&&(e.allErrors=o),e.jtdDiscriminator=t,e.jtdMetadata=r}or.extendSubschemaMode=U0});var lp=j((CA,Av)=>{"use strict";Av.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,i,o;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(i=n;i--!==0;)if(!e(t[i],r[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(o=Object.keys(t),n=o.length,n!==Object.keys(r).length)return!1;for(i=n;i--!==0;)if(!Object.prototype.hasOwnProperty.call(r,o[i]))return!1;for(i=n;i--!==0;){var a=o[i];if(!e(t[a],r[a]))return!1}return!0}return t!==t&&r!==r}});var Mv=j((ZA,Uv)=>{"use strict";var ar=Uv.exports=function(e,t,r){typeof t=="function"&&(r=t,t={}),r=t.cb||r;var n=typeof r=="function"?r:r.pre||function(){},i=r.post||function(){};es(t,n,i,e,"",e)};ar.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};ar.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};ar.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};ar.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 es(e,t,r,n,i,o,a,s,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,i,o,a,s,c,u);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in ar.arrayKeywords)for(var f=0;f<d.length;f++)es(e,t,r,d[f],i+"/"+l+"/"+f,o,i,l,n,f)}else if(l in ar.propsKeywords){if(d&&typeof d=="object")for(var p in d)es(e,t,r,d[p],i+"/"+l+"/"+M0(p),o,i,l,n,p)}else(l in ar.keywords||e.allKeys&&!(l in ar.skipKeywords))&&es(e,t,r,d,i+"/"+l,o,i,l,n)}r(n,i,o,a,s,c,u)}}function M0(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var Gi=j(Ge=>{"use strict";Object.defineProperty(Ge,"__esModule",{value:!0});Ge.getSchemaRefs=Ge.resolveUrl=Ge.normalizeId=Ge._getFullPath=Ge.getFullPath=Ge.inlineRef=void 0;var F0=re(),L0=lp(),q0=Mv(),V0=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function J0(e,t=!0){return typeof e=="boolean"?!0:t===!0?!dp(e):t?Fv(e)<=t:!1}Ge.inlineRef=J0;var K0=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function dp(e){for(let t in e){if(K0.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(dp)||typeof r=="object"&&dp(r))return!0}return!1}function Fv(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!V0.has(r)&&(typeof e[r]=="object"&&(0,F0.eachItem)(e[r],n=>t+=Fv(n)),t===1/0))return 1/0}return t}function Lv(e,t="",r){r!==!1&&(t=yn(t));let n=e.parse(t);return qv(e,n)}Ge.getFullPath=Lv;function qv(e,t){return e.serialize(t).split("#")[0]+"#"}Ge._getFullPath=qv;var B0=/#\/?$/;function yn(e){return e?e.replace(B0,""):""}Ge.normalizeId=yn;function H0(e,t,r){return r=yn(r),e.resolve(t,r)}Ge.resolveUrl=H0;var W0=/^[a-z_][-a-z0-9._]*$/i;function G0(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,i=yn(e[r]||t),o={"":i},a=Lv(n,i,!1),s={},c=new Set;return q0(e,{allKeys:!0},(d,f,p,m)=>{if(m===void 0)return;let h=a+f,v=o[m];typeof d[r]=="string"&&(v=_.call(this,d[r])),b.call(this,d.$anchor),b.call(this,d.$dynamicAnchor),o[f]=v;function _($){let S=this.opts.uriResolver.resolve;if($=yn(v?S(v,$):$),c.has($))throw l($);c.add($);let P=this.refs[$];return typeof P=="string"&&(P=this.refs[P]),typeof P=="object"?u(d,P.schema,$):$!==yn(h)&&($[0]==="#"?(u(d,s[$],$),s[$]=d):this.refs[$]=h),$}function b($){if(typeof $=="string"){if(!W0.test($))throw new Error(`invalid anchor "${$}"`);_.call(this,`#${$}`)}}}),s;function u(d,f,p){if(f!==void 0&&!L0(d,f))throw l(p)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Ge.getSchemaRefs=G0});var Qi=j(sr=>{"use strict";Object.defineProperty(sr,"__esModule",{value:!0});sr.getData=sr.KeywordCxt=sr.validateFunctionCode=void 0;var Hv=kv(),Vv=Wi(),fp=np(),ts=Wi(),X0=Ev(),Yi=Rv(),pp=Zv(),D=W(),q=Lt(),Y0=Gi(),qt=re(),Xi=Hi();function Q0(e){if(Xv(e)&&(Yv(e),Gv(e))){rz(e);return}Wv(e,()=>(0,Hv.topBoolOrEmptySchema)(e))}sr.validateFunctionCode=Q0;function Wv({gen:e,validateName:t,schema:r,schemaEnv:n,opts:i},o){i.code.es5?e.func(t,(0,D._)`${q.default.data}, ${q.default.valCxt}`,n.$async,()=>{e.code((0,D._)`"use strict"; ${Jv(r,i)}`),tz(e,i),e.code(o)}):e.func(t,(0,D._)`${q.default.data}, ${ez(i)}`,n.$async,()=>e.code(Jv(r,i)).code(o))}function ez(e){return(0,D._)`{${q.default.instancePath}="", ${q.default.parentData}, ${q.default.parentDataProperty}, ${q.default.rootData}=${q.default.data}${e.dynamicRef?(0,D._)`, ${q.default.dynamicAnchors}={}`:D.nil}}={}`}function tz(e,t){e.if(q.default.valCxt,()=>{e.var(q.default.instancePath,(0,D._)`${q.default.valCxt}.${q.default.instancePath}`),e.var(q.default.parentData,(0,D._)`${q.default.valCxt}.${q.default.parentData}`),e.var(q.default.parentDataProperty,(0,D._)`${q.default.valCxt}.${q.default.parentDataProperty}`),e.var(q.default.rootData,(0,D._)`${q.default.valCxt}.${q.default.rootData}`),t.dynamicRef&&e.var(q.default.dynamicAnchors,(0,D._)`${q.default.valCxt}.${q.default.dynamicAnchors}`)},()=>{e.var(q.default.instancePath,(0,D._)`""`),e.var(q.default.parentData,(0,D._)`undefined`),e.var(q.default.parentDataProperty,(0,D._)`undefined`),e.var(q.default.rootData,q.default.data),t.dynamicRef&&e.var(q.default.dynamicAnchors,(0,D._)`{}`)})}function rz(e){let{schema:t,opts:r,gen:n}=e;Wv(e,()=>{r.$comment&&t.$comment&&ey(e),sz(e),n.let(q.default.vErrors,null),n.let(q.default.errors,0),r.unevaluated&&nz(e),Qv(e),lz(e)})}function nz(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,D._)`${r}.evaluated`),t.if((0,D._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,D._)`${e.evaluated}.props`,(0,D._)`undefined`)),t.if((0,D._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,D._)`${e.evaluated}.items`,(0,D._)`undefined`))}function Jv(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,D._)`/*# sourceURL=${r} */`:D.nil}function iz(e,t){if(Xv(e)&&(Yv(e),Gv(e))){oz(e,t);return}(0,Hv.boolOrEmptySchema)(e,t)}function Gv({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function Xv(e){return typeof e.schema!="boolean"}function oz(e,t){let{schema:r,gen:n,opts:i}=e;i.$comment&&r.$comment&&ey(e),cz(e),uz(e);let o=n.const("_errs",q.default.errors);Qv(e,o),n.var(t,(0,D._)`${o} === ${q.default.errors}`)}function Yv(e){(0,qt.checkUnknownRules)(e),az(e)}function Qv(e,t){if(e.opts.jtd)return Kv(e,[],!1,t);let r=(0,Vv.getSchemaTypes)(e.schema),n=(0,Vv.coerceAndCheckDataType)(e,r);Kv(e,r,!n,t)}function az(e){let{schema:t,errSchemaPath:r,opts:n,self:i}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,qt.schemaHasRulesButRef)(t,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function sz(e){let{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,qt.checkStrictMode)(e,"default is ignored in the schema root")}function cz(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,Y0.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function uz(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function ey({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:i}){let o=r.$comment;if(i.$comment===!0)e.code((0,D._)`${q.default.self}.logger.log(${o})`);else if(typeof i.$comment=="function"){let a=(0,D.str)`${n}/$comment`,s=e.scopeValue("root",{ref:t.root});e.code((0,D._)`${q.default.self}.opts.$comment(${o}, ${a}, ${s}.schema)`)}}function lz(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:i,opts:o}=e;r.$async?t.if((0,D._)`${q.default.errors} === 0`,()=>t.return(q.default.data),()=>t.throw((0,D._)`new ${i}(${q.default.vErrors})`)):(t.assign((0,D._)`${n}.errors`,q.default.vErrors),o.unevaluated&&dz(e),t.return((0,D._)`${q.default.errors} === 0`))}function dz({gen:e,evaluated:t,props:r,items:n}){r instanceof D.Name&&e.assign((0,D._)`${t}.props`,r),n instanceof D.Name&&e.assign((0,D._)`${t}.items`,n)}function Kv(e,t,r,n){let{gen:i,schema:o,data:a,allErrors:s,opts:c,self:u}=e,{RULES:l}=u;if(o.$ref&&(c.ignoreKeywordsWithRef||!(0,qt.schemaHasRulesButRef)(o,l))){i.block(()=>ry(e,"$ref",l.all.$ref.definition));return}c.jtd||pz(e,t),i.block(()=>{for(let f of l.rules)d(f);d(l.post)});function d(f){(0,fp.shouldUseGroup)(o,f)&&(f.type?(i.if((0,ts.checkDataType)(f.type,a,c.strictNumbers)),Bv(e,f),t.length===1&&t[0]===f.type&&r&&(i.else(),(0,ts.reportTypeError)(e)),i.endIf()):Bv(e,f),s||i.if((0,D._)`${q.default.errors} === ${n||0}`))}}function Bv(e,t){let{gen:r,schema:n,opts:{useDefaults:i}}=e;i&&(0,X0.assignDefaults)(e,t.type),r.block(()=>{for(let o of t.rules)(0,fp.shouldUseRule)(n,o)&&ry(e,o.keyword,o.definition,t.type)})}function pz(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(fz(e,t),e.opts.allowUnionTypes||mz(e,t),hz(e,e.dataTypes))}function fz(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{ty(e.dataTypes,r)||mp(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),vz(e,t)}}function mz(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&mp(e,"use allowUnionTypes to allow union type keyword")}function hz(e,t){let r=e.self.RULES.all;for(let n in r){let i=r[n];if(typeof i=="object"&&(0,fp.shouldUseRule)(e.schema,i)){let{type:o}=i.definition;o.length&&!o.some(a=>gz(t,a))&&mp(e,`missing type "${o.join(",")}" for keyword "${n}"`)}}}function gz(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function ty(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function vz(e,t){let r=[];for(let n of e.dataTypes)ty(t,n)?r.push(n):t.includes("integer")&&n==="number"&&r.push("integer");e.dataTypes=r}function mp(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,qt.checkStrictMode)(e,t,e.opts.strictTypes)}var rs=class{constructor(t,r,n){if((0,Yi.validateKeywordUsage)(t,r,n),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=n,this.data=t.data,this.schema=t.schema[n],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,qt.schemaRefOrVal)(t,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=r,this.$data)this.schemaCode=t.gen.const("vSchema",ny(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,Yi.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=t.gen.const("_errs",q.default.errors))}result(t,r,n){this.failResult((0,D.not)(t),r,n)}failResult(t,r,n){this.gen.if(t),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,r){this.failResult((0,D.not)(t),void 0,r)}fail(t){if(t===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(t),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);let{schemaCode:r}=this;this.fail((0,D._)`${r} !== undefined && (${(0,D.or)(this.invalid$data(),t)})`)}error(t,r,n){if(r){this.setParams(r),this._error(t,n),this.setParams({});return}this._error(t,n)}_error(t,r){(t?Xi.reportExtraError:Xi.reportError)(this,this.def.error,r)}$dataError(){(0,Xi.reportError)(this,this.def.$dataError||Xi.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Xi.resetErrorsCount)(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,r){r?Object.assign(this.params,t):this.params=t}block$data(t,r,n=D.nil){this.gen.block(()=>{this.check$data(t,n),r()})}check$data(t=D.nil,r=D.nil){if(!this.$data)return;let{gen:n,schemaCode:i,schemaType:o,def:a}=this;n.if((0,D.or)((0,D._)`${i} === undefined`,r)),t!==D.nil&&n.assign(t,!0),(o.length||a.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),t!==D.nil&&n.assign(t,!1)),n.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:n,def:i,it:o}=this;return(0,D.or)(a(),s());function a(){if(n.length){if(!(r instanceof D.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,D._)`${(0,ts.checkDataTypes)(c,r,o.opts.strictNumbers,ts.DataType.Wrong)}`}return D.nil}function s(){if(i.validateSchema){let c=t.scopeValue("validate$data",{ref:i.validateSchema});return(0,D._)`!${c}(${r})`}return D.nil}}subschema(t,r){let n=(0,pp.getSubschema)(this.it,t);(0,pp.extendSubschemaData)(n,this.it,t),(0,pp.extendSubschemaMode)(n,t);let i={...this.it,...n,items:void 0,props:void 0};return iz(i,r),i}mergeEvaluated(t,r){let{it:n,gen:i}=this;n.opts.unevaluated&&(n.props!==!0&&t.props!==void 0&&(n.props=qt.mergeEvaluated.props(i,t.props,n.props,r)),n.items!==!0&&t.items!==void 0&&(n.items=qt.mergeEvaluated.items(i,t.items,n.items,r)))}mergeValidEvaluated(t,r){let{it:n,gen:i}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return i.if(r,()=>this.mergeEvaluated(t,D.Name)),!0}};sr.KeywordCxt=rs;function ry(e,t,r,n){let i=new rs(e,r,t);"code"in r?r.code(i,n):i.$data&&r.validate?(0,Yi.funcKeywordCode)(i,r):"macro"in r?(0,Yi.macroKeywordCode)(i,r):(r.compile||r.validate)&&(0,Yi.funcKeywordCode)(i,r)}var yz=/^\/(?:[^~]|~0|~1)*$/,_z=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function ny(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let i,o;if(e==="")return q.default.rootData;if(e[0]==="/"){if(!yz.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);i=e,o=q.default.rootData}else{let u=_z.exec(e);if(!u)throw new Error(`Invalid JSON-pointer: ${e}`);let l=+u[1];if(i=u[2],i==="#"){if(l>=t)throw new Error(c("property/index",l));return n[t-l]}if(l>t)throw new Error(c("data",l));if(o=r[t-l],!i)return o}let a=o,s=i.split("/");for(let u of s)u&&(o=(0,D._)`${o}${(0,D.getProperty)((0,qt.unescapeJsonPointer)(u))}`,a=(0,D._)`${a} && ${o}`);return a;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${t}`}}sr.getData=ny});var ns=j(gp=>{"use strict";Object.defineProperty(gp,"__esModule",{value:!0});var hp=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}};gp.default=hp});var eo=j(_p=>{"use strict";Object.defineProperty(_p,"__esModule",{value:!0});var vp=Gi(),yp=class extends Error{constructor(t,r,n,i){super(i||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,vp.resolveUrl)(t,r,n),this.missingSchema=(0,vp.normalizeId)((0,vp.getFullPath)(t,this.missingRef))}};_p.default=yp});var os=j(pt=>{"use strict";Object.defineProperty(pt,"__esModule",{value:!0});pt.resolveSchema=pt.getCompilingSchema=pt.resolveRef=pt.compileSchema=pt.SchemaEnv=void 0;var yt=W(),$z=ns(),Ir=Lt(),_t=Gi(),iy=re(),bz=Qi(),_n=class{constructor(t){var r;this.refs={},this.dynamicAnchors={};let n;typeof t.schema=="object"&&(n=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=(r=t.baseId)!==null&&r!==void 0?r:(0,_t.normalizeId)(n?.[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=n?.$async,this.refs={}}};pt.SchemaEnv=_n;function bp(e){let t=oy.call(this,e);if(t)return t;let r=(0,_t.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:i}=this.opts.code,{ownProperties:o}=this.opts,a=new yt.CodeGen(this.scope,{es5:n,lines:i,ownProperties:o}),s;e.$async&&(s=a.scopeValue("Error",{ref:$z.default,code:(0,yt._)`require("ajv/dist/runtime/validation_error").default`}));let c=a.scopeName("validate");e.validateName=c;let u={gen:a,allErrors:this.opts.allErrors,data:Ir.default.data,parentData:Ir.default.parentData,parentDataProperty:Ir.default.parentDataProperty,dataNames:[Ir.default.data],dataPathArr:[yt.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:a.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,yt.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:s,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:yt.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,yt._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),(0,bz.validateFunctionCode)(u),a.optimize(this.opts.code.optimize);let d=a.toString();l=`${a.scopeRefs(Ir.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,e));let p=new Function(`${Ir.default.self}`,`${Ir.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:p}),p.errors=null,p.schema=e.schema,p.schemaEnv=e,e.$async&&(p.$async=!0),this.opts.code.source===!0&&(p.source={validateName:c,validateCode:d,scopeValues:a._values}),this.opts.unevaluated){let{props:m,items:h}=u;p.evaluated={props:m instanceof yt.Name?void 0:m,items:h instanceof yt.Name?void 0:h,dynamicProps:m instanceof yt.Name,dynamicItems:h instanceof yt.Name},p.source&&(p.source.evaluated=(0,yt.stringify)(p.evaluated))}return e.validate=p,e}catch(d){throw delete e.validate,delete e.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(e)}}pt.compileSchema=bp;function xz(e,t,r){var n;r=(0,_t.resolveUrl)(this.opts.uriResolver,t,r);let i=e.refs[r];if(i)return i;let o=Sz.call(this,e,r);if(o===void 0){let a=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:s}=this.opts;a&&(o=new _n({schema:a,schemaId:s,root:e,baseId:t}))}if(o!==void 0)return e.refs[r]=kz.call(this,o)}pt.resolveRef=xz;function kz(e){return(0,_t.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:bp.call(this,e)}function oy(e){for(let t of this._compilations)if(wz(t,e))return t}pt.getCompilingSchema=oy;function wz(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function Sz(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||is.call(this,e,t)}function is(e,t){let r=this.opts.uriResolver.parse(t),n=(0,_t._getFullPath)(this.opts.uriResolver,r),i=(0,_t.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===i)return $p.call(this,r,e);let o=(0,_t.normalizeId)(n),a=this.refs[o]||this.schemas[o];if(typeof a=="string"){let s=is.call(this,e,a);return typeof s?.schema!="object"?void 0:$p.call(this,r,s)}if(typeof a?.schema=="object"){if(a.validate||bp.call(this,a),o===(0,_t.normalizeId)(t)){let{schema:s}=a,{schemaId:c}=this.opts,u=s[c];return u&&(i=(0,_t.resolveUrl)(this.opts.uriResolver,i,u)),new _n({schema:s,schemaId:c,root:e,baseId:i})}return $p.call(this,r,a)}}pt.resolveSchema=is;var zz=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function $p(e,{baseId:t,schema:r,root:n}){var i;if(((i=e.fragment)===null||i===void 0?void 0:i[0])!=="/")return;for(let s of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,iy.unescapeFragment)(s)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!zz.has(s)&&u&&(t=(0,_t.resolveUrl)(this.opts.uriResolver,t,u))}let o;if(typeof r!="boolean"&&r.$ref&&!(0,iy.schemaHasRulesButRef)(r,this.RULES)){let s=(0,_t.resolveUrl)(this.opts.uriResolver,t,r.$ref);o=is.call(this,n,s)}let{schemaId:a}=this.opts;if(o=o||new _n({schema:r,schemaId:a,root:n,baseId:t}),o.schema!==o.root.schema)return o}});var ay=j((qA,Iz)=>{Iz.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 Pp=j((VA,py)=>{"use strict";var Pz=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),kp=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),jz=RegExp.prototype.test.bind(/^\d*$/u),Pr=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),wp=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),cy=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),Sp=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),Ez=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u);function Tz(e){let t="",r=0,n=0;for(n=0;n<e.length;n++)if(r=e[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n];break}for(n+=1;n<e.length;n++){if(r=e[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n]}return t}var Oz=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),Nz=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),Dz=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),Rz=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u),Cz=RegExp.prototype.test.bind(/[^\d!"$&'()*+,\-.;=_`a-z{}~]/u),Zz=RegExp.prototype.test.bind(/(?:^|\.)\d+$/u);function Az(e){return Cz(e)||Zz(e)}function Uz(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++)if(!Dz(e[t])){if(e[t]==="%"&&t+2<e.length&&Pr(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function sy(e){let t=-1,r=0,n=-1,i=0;for(let s=0;s<e.length;s++)e[s]==="0"?(n===-1&&(n=s),i++,i>r&&(r=i,t=n)):(n=-1,i=0);if(r<2)return e.join(":");let o=e.slice(0,t).join(":"),a=e.slice(t+r).join(":");return o+"::"+a}function Mz(e){let t=e.indexOf("::");if(t!==-1&&e.indexOf("::",t+1)!==-1)return;let r=t===-1?e.split(":"):e.slice(0,t).split(":"),n=t===-1?[]:e.slice(t+2).split(":");t!==-1&&(r.length===1&&r[0]===""&&(r.length=0),n.length===1&&n[0]===""&&(n.length=0));let i=r.concat(n),o=0;for(let s=0;s<i.length;s++){let c=i[s];if(c==="")return;if(c.indexOf(".")!==-1){if(s!==i.length-1||t!==-1&&n.length===0||!kp(c))return;o+=2;continue}if(!Oz(c))return;i[s]=parseInt(c,16).toString(16),o++}if(t===-1)return o!==8?void 0:sy(i);if(o>=8)return;let a=i.slice(0,r.length);for(let s=o;s<8;s++)a.push("0");for(let s=r.length;s<i.length;s++)a.push(i[s]);return sy(a)}function xp(e){let t=e[0]==="["&&e[e.length-1]==="]";if((e[0]==="["||e[e.length-1]==="]")&&!t)return{host:e,isIPV6:!1,error:!0};let n=t?e.slice(1,-1):e;if(t&&Nz(n))return n=n.toLowerCase(),{host:`[${n}]`,escapedHost:n,isIPV6:!1,isIPVFuture:!0};if(Fz(n,":")<2)return{host:e,isIPV6:!1,error:t};let i="",o=n.indexOf("%");if(o!==-1){let s=n.slice(o,o+3).toLowerCase()==="%25"?3:1;if(i=n.slice(o+s),!Uz(i))return{host:e,isIPV6:!1,error:!0};n=n.slice(0,o)}let a=Mz(n);return a===void 0?{host:e,isIPV6:!1,error:!0}:{host:a+(i?"%"+i:""),escapedHost:a+(i?"%25"+i:""),isIPV6:!0}}function Fz(e,t){let r=0;for(let n=0;n<e.length;n++)e[n]===t&&r++;return r}function Lz(e){let t=e,r=[],n=-1,i=0;for(;i=t.length;){if(i===1){if(t===".")break;if(t==="/"){r.push("/");break}else{r.push(t);break}}else if(i===2){if(t[0]==="."){if(t[1]===".")break;if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&t[1]==="."){r.push("/");break}}else if(i===3&&t==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."&&t[3]==="/"){t=t.slice(3),r.length!==0&&r.pop();continue}}if((n=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,n)),t=t.slice(n)}return r.join("")}var qz={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},Vz=/[@/?#:]/g,Jz=/[@/?#]/g;function uy(e,t){let r=t?Jz:Vz;return r.lastIndex=0,e.replace(r,n=>qz[n])}function ly(e,t=!1){if(e.indexOf("%")===-1)return e;let r="";for(let n=0;n<e.length;n++){if(e[n]==="%"&&n+2<e.length){let i=e.slice(n+1,n+3);if(Pr(i)){let o=i.toUpperCase(),a=String.fromCharCode(parseInt(o,16));t&&wp(a)?r+=a:r+="%"+o,n+=2;continue}}r+=e[n]}return r}var Ue=new Array(256);{let e="0123456789ABCDEF";for(let t=0;t<256;t++)Ue[t]="%"+e[t>>4]+e[t&15]}function zp(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===42||e===43||e===45||e===46||e===47||e===64||e===95}function ye(e){return e<2048?Ue[192|e>>6]+Ue[128|e&63]:e<65536?Ue[224|e>>12]+Ue[128|e>>6&63]+Ue[128|e&63]:Ue[240|e>>18]+Ue[128|e>>12&63]+Ue[128|e>>6&63]+Ue[128|e&63]}function Kz(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let i=e.slice(r+1,r+3);if(Pr(i)){let o=i.toUpperCase(),a=String.fromCharCode(parseInt(o,16));a!=="."&&wp(a)?t+=a:t+="%"+o,r+=2;continue}}if(cy(n))t+=n;else{let i=e.charCodeAt(r);if(i<128)t+=zp(i)?n:Ue[i];else if(i<55296||i>57343)t+=ye(i);else if(i<=56319&&r+1<e.length){let o=e.charCodeAt(r+1);o>=56320&&o<=57343?(t+=ye(65536+(i-55296<<10)+(o-56320)),r++):t+=ye(65533)}else t+=ye(65533)}}return t}function Bz(e,t=!1){let r="",n=t&&e[0]!=="/";for(let i=0;i<e.length;i++){let o=e[i];if(o==="%"&&i+2<e.length){let a=e.slice(i+1,i+3);if(Pr(a)){r+="%"+a.toUpperCase(),i+=2;continue}}if(o==="/"&&(n=!1),cy(o)&&(o!==":"||!n))r+=o;else{let a=e.charCodeAt(i);if(a<128)r+=Ue[a];else if(a<55296||a>57343)r+=ye(a);else if(a<=56319&&i+1<e.length){let s=e.charCodeAt(i+1);s>=56320&&s<=57343?(r+=ye(65536+(a-55296<<10)+(s-56320)),i++):r+=ye(65533)}else r+=ye(65533)}}return r}function Hz(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let i=e.slice(r+1,r+3);if(Pr(i)){let o=i.toUpperCase(),a=String.fromCharCode(parseInt(o,16));wp(a)?t+=a:t+="%"+o,r+=2;continue}}if(Sp(n))t+=n;else{let i=e.charCodeAt(r);if(i<128)t+=zp(i)?n:Ue[i];else if(i<55296||i>57343)t+=ye(i);else if(i<=56319&&r+1<e.length){let o=e.charCodeAt(r+1);o>=56320&&o<=57343?(t+=ye(65536+(i-55296<<10)+(o-56320)),r++):t+=ye(65533)}else t+=ye(65533)}}return t}function Ip(e,t){let r="";for(let n=0;n<e.length;n++){let i=e[n];if(i==="%"&&n+2<e.length){let o=e.slice(n+1,n+3);if(Pr(o)){r+="%"+o.toUpperCase(),n+=2;continue}}if(t(i))r+=i;else{let o=e.charCodeAt(n);if(o<128)r+=Ue[o];else if(o<55296||o>57343)r+=ye(o);else if(o<=56319&&n+1<e.length){let a=e.charCodeAt(n+1);a>=56320&&a<=57343?(r+=ye(65536+(o-55296<<10)+(a-56320)),n++):r+=ye(65533)}else r+=ye(65533)}}return r}function dy(e){return Ip(e,Ez)}function Wz(e){return Ip(e,Sp)}function Gz(e){return Ip(e,Sp)}function Xz(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(Pr(o)){t+="%"+o.toUpperCase(),r+=2;continue}}let i=e.charCodeAt(r);if(i<128)t+=zp(i)?n:Ue[i];else if(i<55296||i>57343)t+=ye(i);else if(i<=56319&&r+1<e.length){let o=e.charCodeAt(r+1);o>=56320&&o<=57343?(t+=ye(65536+(i-55296<<10)+(o-56320)),r++):t+=ye(65533)}else t+=ye(65533)}return t}function Yz(e){let t=[];if(e.userinfo!==void 0&&(t.push(dy(e.userinfo)),t.push("@")),e.host!==void 0){let r=e.host;if(!kp(r)){let n=xp(r);n.isIPV6!==!0&&n.isIPVFuture!==!0&&(r=ly(r,!0),n=xp(r)),n.isIPV6===!0||n.isIPVFuture===!0?r=`[${n.escapedHost}]`:r=uy(r,!1)}t.push(r)}if(typeof e.port=="number"||typeof e.port=="string"){let r=String(e.port);if(!jz(r))throw new TypeError("URI port is malformed.");t.push(":"),t.push(r)}return t.length?t.join(""):void 0}py.exports={BYTE_HEX:Ue,percentEncodeNonAscii:ye,nonSimpleDomain:Rz,nonSimpleMailtoDomain:Az,recomposeAuthority:Yz,reescapeHostDelimiters:uy,normalizePercentEncoding:ly,normalizePathEncoding:Kz,serializePathEncoding:Bz,normalizeQueryFragmentEncoding:Hz,encodeUserinfo:dy,encodeQuery:Wz,encodeFragment:Gz,escapePreservingEscapes:Xz,removeDotSegments:Lz,isIPv4:kp,isUUID:Pz,normalizeIPv6:xp,stringArrayToHexStripped:Tz}});var xy=j((JA,by)=>{"use strict";var{isUUID:Qz,BYTE_HEX:eI,percentEncodeNonAscii:jp,nonSimpleMailtoDomain:tI}=Pp(),rI=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,nI=["http","https","ws","wss","urn","urn:uuid","mailto"];function iI(e){return nI.indexOf(e)!==-1}function Tp(e){return e.secure===!0?!0:e.secure===!1?!1:e.scheme?e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S"):!1}function gy(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function vy(e){let t=String(e.scheme).toLowerCase()==="https";return(e.port===(t?443:80)||e.port==="")&&(e.port=void 0),e.path||(e.path="/"),e}function oI(e){return e.secure=Tp(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function aI(e){if((e.port===(Tp(e)?443:80)||e.port==="")&&(e.port=void 0),typeof e.secure=="boolean"&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){let t=e.resourceName.indexOf("?"),r=t===-1?e.resourceName:e.resourceName.slice(0,t);e.path=r&&r!=="/"?r:void 0,e.query=t===-1?void 0:e.resourceName.slice(t+1),e.resourceName=void 0}return e.fragment=void 0,e}function sI(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(rI);if(r&&r[0]===e.path){let n=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let i=`${n}:${t.nid||e.nid}`,o=Op(i);e.path=void 0,o&&(e=o.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function cI(e,t){if(e.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",n=e.nid.toLowerCase(),i=`${r}:${t.nid||n}`,o=Op(i);o&&(e=o.serialize(e,t));let a=e,s=e.nss;return a.path=`${n||t.nid}:${s}`,t.skipEscape=!0,a}function uI(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!Qz(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function lI(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var yy={scheme:"http",domainHost:!0,parse:gy,serialize:vy},dI={scheme:"https",domainHost:yy.domainHost,parse:gy,serialize:vy},as={scheme:"ws",domainHost:!0,parse:oI,serialize:aI},pI={scheme:"wss",domainHost:as.domainHost,parse:as.parse,serialize:as.serialize},fI={scheme:"urn",parse:sI,serialize:cI,skipNormalize:!0},mI={scheme:"urn:uuid",parse:uI,serialize:lI,skipNormalize:!0},hI="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$'()*+=",gI="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$'()*+,;:@",_y="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$'()*+;:";function cs(e,t=!1){let r=new Uint8Array(128);for(let o=0;o<e.length;o++)r[e.charCodeAt(o)]=1;let n=e.replace(/[\\\]^-]/gu,"\\$&"),i=t?`[${n}]|[^\\0-\\x7F\\uD800-\\uDFFF]`:`[${n}]`;return{all:new RegExp(`^(?:${i})*$`,"u"),table:r,allowNonAscii:t}}var vI=cs(hI),fy=cs(gI),yI=cs(_y),_I=cs(_y,!0),$I=/^[\da-f]{2}$/iu,bI=/^\[[\x21-\x5A\x5E-\x7E]*\]$/u,Ep="URI mailto has an invalid recipient domain.",my=/[\uD800-\uDFFF]/u;function cr(e){if(typeof e!="string"||e.indexOf("%")===-1)return e;try{return decodeURIComponent(e)}catch{return e}}function hy(e){let t="";for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);if(n>=55296&&n<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);if(i>=56320&&i<=57343){t+=e[r]+e[r+1],r++;continue}}t+=n>=55296&&n<=57343?"\uFFFD":e[r]}return t}function to(e,t){if(t.all.test(e))return e;let r=t.table,n="";for(let i=0;i<e.length;i++){let o=e.charCodeAt(i);if(o<128){r[o]===1?n+=e[i]:o===37&&i+2<e.length&&$I.test(e.slice(i+1,i+3))?(n+="%"+e.slice(i+1,i+3).toUpperCase(),i+=2):n+=eI[o];continue}if(o<55296||o>57343){n+=t.allowNonAscii?e[i]:jp(o);continue}if(o<=56319&&i+1<e.length){let a=e.charCodeAt(i+1);if(a>=56320&&a<=57343){n+=t.allowNonAscii?e[i]+e[i+1]:jp(65536+(o-55296<<10)+(a-56320)),i++;continue}}n+=t.allowNonAscii?"\uFFFD":jp(65533)}return n}function $y(e,t,r){let n=String(e).toLowerCase();if(bI.test(n)||n!==""&&!tI(n))return n;try{let i=new URL("http://"+n);if(i.username||i.password||i.port||i.pathname!=="/"||i.search||i.hash||!i.hostname)throw new Error(Ep);return t&&t.unicodeSupport?n:i.hostname}catch{return r&&(r.error=r.error||Ep),n}}function xI(e,t){let r=t&&t.unicodeSupport?_I:yI;return e.length>1&&e[0]==="["&&e[e.length-1]==="]"?"["+to(e.slice(1,-1),r)+"]":to(e,r)}function kI(e,t){let r=e,n=r.path,i=r.query;n&&my.test(n)&&(n=hy(n)),i&&my.test(i)&&(i=hy(i));let o=n?n.indexOf(",")===-1?[n]:n.split(","):[];if(r.path=void 0,i){let a=null,s=0;for(;s<=i.length;){let c=i.indexOf("&",s);c===-1&&(c=i.length);let u=i.slice(s,c);s=c+1;let l=u.indexOf("=");if(l!==u.lastIndexOf("=")){r.error=r.error||"URI mailto has malformed header fields.";continue}let d=l===-1?u:u.slice(0,l),f=l===-1?"":u.slice(l+1);if(d==="to"){let p=f.split(",");for(let m=0;m<p.length;m++)o.push(p[m]);continue}if(d==="subject"){r.subject=cr(f);continue}if(d==="body"){r.body=cr(f);continue}a===null&&(a=Object.create(null)),a[cr(d)]=cr(f)}a!==null&&(r.headers=a)}r.query=void 0;for(let a=0;a<o.length;a++){let s=o[a],c=s.lastIndexOf("@");if(c<0){r.error=r.error||Ep,o[a]=cr(s);continue}let u=cr(s.slice(0,c)),l=$y(cr(s.slice(c+1)),t,r);o[a]=u+"@"+l}return o.length&&(r.to=o),r}function wI(e,t){let r=e,n=Array.isArray(r.to)?r.to.slice():[];if(n.length){for(let s=0;s<n.length;s++){let c=String(n[s]),u=c.lastIndexOf("@"),l=u>=0?c.slice(0,u):c,d=u>=0?c.slice(u+1):"",f=to(l,vI),p=cr(d),m=$y(p,t);n[s]=f+"@"+xI(m,t)}r.path=n.join(","),t.skipEscape=!0}else r.path=void 0;let i=r.headers&&typeof r.headers=="object"?Object.assign(Object.create(null),r.headers):Object.create(null);r.subject&&(i.subject=r.subject),r.body&&(i.body=r.body),r.headers=i;let o="",a=0;for(let s in i)a++!==0&&(o+="&"),o+=to(s,fy)+"="+to(String(i[s]),fy);return a!==0?r.query=o:r.headers=void 0,r}var SI={scheme:"mailto",parse:kI,serialize:wI,domainHost:!1,unicodeSupport:!0,skipNormalize:!0,absolutePath:!0},ss={http:yy,https:dI,ws:as,wss:pI,urn:fI,"urn:uuid":mI,mailto:SI};Object.setPrototypeOf(ss,null);function Op(e){return e&&(ss[e]||ss[e.toLowerCase()])||void 0}by.exports={wsIsSecure:Tp,SCHEMES:ss,isValidSchemeName:iI,getSchemeHandler:Op}});var Cy=j((KA,ds)=>{"use strict";var{normalizeIPv6:Iy,removeDotSegments:no,recomposeAuthority:zI,normalizePercentEncoding:Py,normalizePathEncoding:II,serializePathEncoding:ky,normalizeQueryFragmentEncoding:wy,encodeQuery:PI,encodeFragment:jI,reescapeHostDelimiters:EI,isIPv4:jy,nonSimpleDomain:TI}=Pp(),{SCHEMES:Ey,getSchemeHandler:Np}=xy(),Ty=/^[A-Za-z][A-Za-z0-9+.-]*$/u,Oy="URI scheme is malformed.";function Sy(e){let t=unescape(String(e));if(!Ty.test(t))throw new TypeError(Oy);return t}function OI(e,t){return typeof e=="string"?e=MI(e,t):typeof e=="object"&&(e=ls(jr(e,t),t)),e}function NI(e,t,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},{parsed:i,malformedAuthorityOrPort:o,malformedPercentEncoding:a,malformedSchemeSpecific:s,malformedHost:c,malformedScheme:u}=us(e,n),{parsed:l,malformedAuthorityOrPort:d,malformedPercentEncoding:f,malformedSchemeSpecific:p,malformedHost:m,malformedScheme:h}=us(t,n);if(o||d||a||f||s||p||c||m||u||h)throw new Error(i.error||l.error||"URI is malformed.");let v=Ny(i,l,n,!0),_=Np(r&&r.scheme||v.scheme),b=v.host,$=b!==void 0&&b!==""&&(jy(b)||Iy(b).isIPV6);Dy(v,r||{},_,$);let S=b&&b.indexOf("%")!==-1&&!new RegExp("\\P{ASCII}","u").test(b);if(v.error&&!S)throw new Error(v.error);return n.skipEscape=!0,jr(v,n)}function Ny(e,t,r,n){let i={};return n||(e=ls(jr(e,r),r),t=ls(jr(t,r),r)),r=r||{},!r.tolerant&&t.scheme?(i.scheme=t.scheme,i.userinfo=t.userinfo,i.host=t.host,i.port=t.port,i.path=no(t.path||""),i.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(i.userinfo=t.userinfo,i.host=t.host,i.port=t.port,i.path=no(t.path||""),i.query=t.query):(t.path?(t.path[0]==="/"?i.path=no(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?i.path="/"+t.path:e.path?i.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:i.path=t.path,i.path=no(i.path)),i.query=t.query):(i.path=e.path,t.query!==void 0?i.query=t.query:i.query=e.query),i.userinfo=e.userinfo,i.host=e.host,i.port=e.port),i.scheme=e.scheme),i.fragment=t.fragment,i}function DI(e,t,r){let n=zy(e,r),i=zy(t,r);return n!==void 0&&i!==void 0&&n===i}function jr(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,to:e.to,subject:e.subject,body:e.body,headers:e.headers,error:""},n=Object.assign({},t),i=[];r.scheme&&(r.scheme=Sy(r.scheme));let o=Np(n.scheme||r.scheme);o&&o.serialize&&o.serialize(r,n);let a=r.userinfo!==void 0||r.host!==void 0||r.port!==void 0,s=!n.skipEscape&&r.scheme===void 0&&!a;r.path!==void 0&&(n.skipEscape?r.path=Py(r.path):r.path=ky(r.path,s)),n.reference!=="suffix"&&r.scheme&&(r.scheme=Sy(r.scheme),i.push(r.scheme,":"));let c=zI(r);if(c!==void 0&&(n.reference!=="suffix"&&i.push("//"),i.push(c),r.path&&r.path[0]!=="/"&&i.push("/")),r.path!==void 0){let u=r.path;!n.absolutePath&&(!o||!o.absolutePath)&&(u=no(u)),s&&(u=ky(u,!0)),c===void 0&&u[0]==="/"&&u[1]==="/"&&(u="/%2F"+u.slice(2)),i.push(u)}return r.query!==void 0&&i.push("?",PI(r.query)),r.fragment!==void 0&&i.push("#",jI(r.fragment)),i.join("")}var RI=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,CI=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,ZI=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function AI(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof e.port=="number"&&(e.port<0||e.port>65535))return"URI port is malformed."}function ro(e){if(e===void 0)return!1;let t=e.indexOf("%");for(;t!==-1;){if(t+2>=e.length||!/^[\da-f]{2}$/iu.test(e.slice(t+1,t+3)))return!0;t=e.indexOf("%",t+3)}return!1}function Dp(e){return e[0]==="["&&e[e.length-1]==="]"}function UI(e){let t=e[4];return ro(e[3])||t!==void 0&&!Dp(t)&&ro(t)||ro(e[6])||ro(e[7])||ro(e[8])}function Dy(e,t,r,n){let i=e.host&&e.host[0]==="["&&e.host[e.host.length-1]==="]";if(!t.unicodeSupport&&(!r||!r.unicodeSupport)&&e.host&&!Dp(e.host)&&(t.domainHost||r&&r.domainHost)&&n===!1&&!i&&TI(e.host))try{e.host=new URL("http://"+e.host).hostname}catch(o){return e.error=e.error||"Host's domain name can not be converted to ASCII: "+o,!0}return!1}function us(e,t){let r=Object.assign({},t),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},i=!1,o=!1,a=!1,s=!1,c=!1,u=!1,l=!1;r.reference==="suffix"&&(r.scheme?e=r.scheme+":"+e:e="//"+e);let d=e.match(CI);d!==null&&d[1].indexOf("\\")!==-1&&(n.error="URI authority must not contain a literal backslash.",i=!0);let f=e.match(ZI);if(f!==null){let m=f[1],h=m.replace(/[\t\n\r]/g,"");h.length>=2&&(h.slice(0,2)!=="//"?(n.error=n.error||"URI authority must not contain a literal backslash.",i=!0):m.length!==h.length&&(n.error=n.error||"URI authority introducer must not contain whitespace.",i=!0))}let p=e.match(RI);if(p){if(n.scheme=p[1],n.userinfo=p[3],n.host=p[4],n.port=parseInt(p[5],10),n.path=p[6]||"",n.query=p[7],n.fragment=p[8],n.scheme!==void 0){let v=unescape(n.scheme);Ty.test(v)?n.scheme=v.toLowerCase():(n.error=n.error||Oy,u=!0)}o=UI(p),o&&(n.error=n.error||"URI contains malformed percent-encoding."),isNaN(n.port)&&(n.port=p[5]);let m=AI(n,p);if(m!==void 0&&(n.error=n.error||m,i=!0),n.host)if(jy(n.host)===!1){let _=Dp(n.host),b=n.host.indexOf("[")!==-1||n.host.indexOf("]")!==-1,$=Iy(n.host);l=$.isIPV6||$.isIPVFuture===!0,c=b&&(!_||$.error===!0),n.host=l?$.host:$.host.toLowerCase(),c&&(n.error=n.error||"URI host is malformed.",i=!0)}else l=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let h=Np(r.scheme||n.scheme);if(c||(s=Dy(n,r,h,l)),!h||h&&!h.skipNormalize){if(e.indexOf("%")!==-1&&n.host!==void 0&&!c){let v=l?n.host:Py(n.host,!0);n.host=EI(v,l)}n.path&&(n.path=II(n.path)),n.query&&(n.query=wy(n.query)),n.fragment&&(n.fragment=wy(n.fragment))}h&&h.parse&&(h.parse(n,r),h===Ey.urn&&n.nid===void 0&&(a=!0))}else n.error=n.error||"URI can not be parsed.";return{parsed:n,malformedAuthorityOrPort:i,malformedPercentEncoding:o,malformedSchemeSpecific:a,malformedHost:s,malformedScheme:u}}function ls(e,t){return us(e,t).parsed}function MI(e,t){return Ry(e,t).normalized}function Ry(e,t){let{parsed:r,malformedAuthorityOrPort:n,malformedPercentEncoding:i,malformedSchemeSpecific:o,malformedHost:a,malformedScheme:s}=us(e,t);return{normalized:n||i||o||a||s?e:jr(r,t),malformedAuthorityOrPort:n,malformedPercentEncoding:i,malformedSchemeSpecific:o,malformedHost:a,malformedScheme:s}}function zy(e,t){if(typeof e!="string"&&typeof e!="object")return;let r;try{r=typeof e=="string"?e:jr(e,t)}catch{return}let{normalized:n,malformedAuthorityOrPort:i,malformedPercentEncoding:o,malformedSchemeSpecific:a,malformedHost:s,malformedScheme:c}=Ry(r,t);return i||o||a||s||c?void 0:n}var Rp={SCHEMES:Ey,normalize:OI,resolve:NI,resolveComponent:Ny,equal:DI,serialize:jr,parse:ls};ds.exports=Rp;ds.exports.default=Rp;ds.exports.fastUri=Rp});var Ay=j(Cp=>{"use strict";Object.defineProperty(Cp,"__esModule",{value:!0});var Zy=Cy();Zy.code='require("ajv/dist/runtime/uri").default';Cp.default=Zy});var Ky=j(Te=>{"use strict";Object.defineProperty(Te,"__esModule",{value:!0});Te.CodeGen=Te.Name=Te.nil=Te.stringify=Te.str=Te._=Te.KeywordCxt=void 0;var FI=Qi();Object.defineProperty(Te,"KeywordCxt",{enumerable:!0,get:function(){return FI.KeywordCxt}});var $n=W();Object.defineProperty(Te,"_",{enumerable:!0,get:function(){return $n._}});Object.defineProperty(Te,"str",{enumerable:!0,get:function(){return $n.str}});Object.defineProperty(Te,"stringify",{enumerable:!0,get:function(){return $n.stringify}});Object.defineProperty(Te,"nil",{enumerable:!0,get:function(){return $n.nil}});Object.defineProperty(Te,"Name",{enumerable:!0,get:function(){return $n.Name}});Object.defineProperty(Te,"CodeGen",{enumerable:!0,get:function(){return $n.CodeGen}});var LI=ns(),qy=eo(),qI=rp(),io=os(),VI=W(),oo=Gi(),ps=Wi(),Ap=re(),Uy=ay(),JI=Ay(),Vy=(e,t)=>new RegExp(e,t);Vy.code="new RegExp";var KI=["removeAdditional","useDefaults","coerceTypes"],BI=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),HI={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."},WI={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},My=200;function GI(e){var t,r,n,i,o,a,s,c,u,l,d,f,p,m,h,v,_,b,$,S,P,$e,be,Zr,Rs;let En=e.strict,Cs=(t=e.code)===null||t===void 0?void 0:t.optimize,Ff=Cs===!0||Cs===void 0?1:Cs||0,Lf=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:Vy,I$=(i=e.uriResolver)!==null&&i!==void 0?i:JI.default;return{strictSchema:(a=(o=e.strictSchema)!==null&&o!==void 0?o:En)!==null&&a!==void 0?a:!0,strictNumbers:(c=(s=e.strictNumbers)!==null&&s!==void 0?s:En)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=e.strictTypes)!==null&&u!==void 0?u:En)!==null&&l!==void 0?l:"log",strictTuples:(f=(d=e.strictTuples)!==null&&d!==void 0?d:En)!==null&&f!==void 0?f:"log",strictRequired:(m=(p=e.strictRequired)!==null&&p!==void 0?p:En)!==null&&m!==void 0?m:!1,code:e.code?{...e.code,optimize:Ff,regExp:Lf}:{optimize:Ff,regExp:Lf},loopRequired:(h=e.loopRequired)!==null&&h!==void 0?h:My,loopEnum:(v=e.loopEnum)!==null&&v!==void 0?v:My,meta:(_=e.meta)!==null&&_!==void 0?_:!0,messages:(b=e.messages)!==null&&b!==void 0?b:!0,inlineRefs:($=e.inlineRefs)!==null&&$!==void 0?$:!0,schemaId:(S=e.schemaId)!==null&&S!==void 0?S:"$id",addUsedSchema:(P=e.addUsedSchema)!==null&&P!==void 0?P:!0,validateSchema:($e=e.validateSchema)!==null&&$e!==void 0?$e:!0,validateFormats:(be=e.validateFormats)!==null&&be!==void 0?be:!0,unicodeRegExp:(Zr=e.unicodeRegExp)!==null&&Zr!==void 0?Zr:!0,int32range:(Rs=e.int32range)!==null&&Rs!==void 0?Rs:!0,uriResolver:I$}}var ao=class{constructor(t={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...GI(t)};let{es5:r,lines:n}=this.opts.code;this.scope=new VI.ValueScope({scope:{},prefixes:BI,es5:r,lines:n}),this.logger=rP(t.logger);let i=t.validateFormats;t.validateFormats=!1,this.RULES=(0,qI.getRules)(),Fy.call(this,HI,t,"NOT SUPPORTED"),Fy.call(this,WI,t,"DEPRECATED","warn"),this._metaOpts=eP.call(this),t.formats&&YI.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&QI.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),XI.call(this),t.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:n}=this.opts,i=Uy;n==="id"&&(i={...Uy},i.id=i.$id,delete i.$id),r&&t&&this.addMetaSchema(i,i[n],!1)}defaultMeta(){let{meta:t,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof t=="object"?t[r]||t:void 0}validate(t,r){let n;if(typeof t=="string"){if(n=this.getSchema(t),!n)throw new Error(`no schema with key or ref "${t}"`)}else n=this.compile(t);let i=n(r);return"$async"in n||(this.errors=n.errors),i}compile(t,r){let n=this._addSchema(t,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(t,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return i.call(this,t,r);async function i(l,d){await o.call(this,l.$schema);let f=this._addSchema(l,d);return f.validate||a.call(this,f)}async function o(l){l&&!this.getSchema(l)&&await i.call(this,{$ref:l},!0)}async function a(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof qy.default))throw d;return s.call(this,d),await c.call(this,d.missingSchema),a.call(this,l)}}function s({missingSchema:l,missingRef:d}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${d} cannot be resolved`)}async function c(l){let d=await u.call(this,l);this.refs[l]||await o.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,r)}async function u(l){let d=this._loading[l];if(d)return d;try{return await(this._loading[l]=n(l))}finally{delete this._loading[l]}}}addSchema(t,r,n,i=this.opts.validateSchema){if(Array.isArray(t)){for(let a of t)this.addSchema(a,void 0,n,i);return this}let o;if(typeof t=="object"){let{schemaId:a}=this.opts;if(o=t[a],o!==void 0&&typeof o!="string")throw new Error(`schema ${a} must be string`)}return r=(0,oo.normalizeId)(r||o),this._checkUnique(r),this.schemas[r]=this._addSchema(t,n,r,i,!0),this}addMetaSchema(t,r,n=this.opts.validateSchema){return this.addSchema(t,r,!0,n),this}validateSchema(t,r){if(typeof t=="boolean")return!0;let n;if(n=t.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let i=this.validate(n,t);if(!i&&r){let o="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(o);else throw new Error(o)}return i}getSchema(t){let r;for(;typeof(r=Ly.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:n}=this.opts,i=new io.SchemaEnv({schema:{},schemaId:n});if(r=io.resolveSchema.call(this,i,t),!r)return;this.refs[t]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(t){if(t instanceof RegExp)return this._removeAllSchemas(this.schemas,t),this._removeAllSchemas(this.refs,t),this;switch(typeof t){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=Ly.call(this,t);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[t],delete this.refs[t],this}case"object":{let r=t;this._cache.delete(r);let n=t[this.opts.schemaId];return n&&(n=(0,oo.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(t){for(let r of t)this.addKeyword(r);return this}addKeyword(t,r){let n;if(typeof t=="string")n=t,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof t=="object"&&r===void 0){if(r=t,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(iP.call(this,n,r),!r)return(0,Ap.eachItem)(n,o=>Zp.call(this,o)),this;aP.call(this,r);let i={...r,type:(0,ps.getJSONTypes)(r.type),schemaType:(0,ps.getJSONTypes)(r.schemaType)};return(0,Ap.eachItem)(n,i.type.length===0?o=>Zp.call(this,o,i):o=>i.type.forEach(a=>Zp.call(this,o,i,a))),this}getKeyword(t){let r=this.RULES.all[t];return typeof r=="object"?r.definition:!!r}removeKeyword(t){let{RULES:r}=this;delete r.keywords[t],delete r.all[t];for(let n of r.rules){let i=n.rules.findIndex(o=>o.keyword===t);i>=0&&n.rules.splice(i,1)}return this}addFormat(t,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[t]=r,this}errorsText(t=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!t||t.length===0?"No errors":t.map(i=>`${n}${i.instancePath} ${i.message}`).reduce((i,o)=>i+r+o)}$dataMetaSchema(t,r){let n=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(let i of r){let o=i.split("/").slice(1),a=t;for(let s of o)a=a[s];for(let s in n){let c=n[s];if(typeof c!="object")continue;let{$data:u}=c.definition,l=a[s];u&&l&&(a[s]=Jy(l))}}return t}_removeAllSchemas(t,r){for(let n in t){let i=t[n];(!r||r.test(n))&&(typeof i=="string"?delete t[n]:i&&!i.meta&&(this._cache.delete(i.schema),delete t[n]))}}_addSchema(t,r,n,i=this.opts.validateSchema,o=this.opts.addUsedSchema){let a,{schemaId:s}=this.opts;if(typeof t=="object")a=t[s];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof t!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(t);if(c!==void 0)return c;n=(0,oo.normalizeId)(a||n);let u=oo.getSchemaRefs.call(this,t,n);return c=new io.SchemaEnv({schema:t,schemaId:s,meta:r,baseId:n,localRefs:u}),this._cache.set(c.schema,c),o&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),i&&this.validateSchema(t,!0),c}_checkUnique(t){if(this.schemas[t]||this.refs[t])throw new Error(`schema with key or id "${t}" already exists`)}_compileSchemaEnv(t){if(t.meta?this._compileMetaSchema(t):io.compileSchema.call(this,t),!t.validate)throw new Error("ajv implementation error");return t.validate}_compileMetaSchema(t){let r=this.opts;this.opts=this._metaOpts;try{io.compileSchema.call(this,t)}finally{this.opts=r}}};ao.ValidationError=LI.default;ao.MissingRefError=qy.default;Te.default=ao;function Fy(e,t,r,n="error"){for(let i in e){let o=i;o in t&&this.logger[n](`${r}: option ${i}. ${e[o]}`)}}function Ly(e){return e=(0,oo.normalizeId)(e),this.schemas[e]||this.refs[e]}function XI(){let e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function YI(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function QI(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}function eP(){let e={...this.opts};for(let t of KI)delete e[t];return e}var tP={log(){},warn(){},error(){}};function rP(e){if(e===!1)return tP;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}var nP=/^[a-z_$][a-z0-9_$:-]*$/i;function iP(e,t){let{RULES:r}=this;if((0,Ap.eachItem)(e,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!nP.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!t&&t.$data&&!("code"in t||"validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function Zp(e,t,r){var n;let i=t?.post;if(r&&i)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:o}=this,a=i?o.post:o.rules.find(({type:c})=>c===r);if(a||(a={type:r,rules:[]},o.rules.push(a)),o.keywords[e]=!0,!t)return;let s={keyword:e,definition:{...t,type:(0,ps.getJSONTypes)(t.type),schemaType:(0,ps.getJSONTypes)(t.schemaType)}};t.before?oP.call(this,a,s,t.before):a.rules.push(s),o.all[e]=s,(n=t.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function oP(e,t,r){let n=e.rules.findIndex(i=>i.keyword===r);n>=0?e.rules.splice(n,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function aP(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=Jy(t)),e.validateSchema=this.compile(t,!0))}var sP={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Jy(e){return{anyOf:[e,sP]}}});var By=j(Up=>{"use strict";Object.defineProperty(Up,"__esModule",{value:!0});var cP={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Up.default=cP});var Xy=j(Er=>{"use strict";Object.defineProperty(Er,"__esModule",{value:!0});Er.callRef=Er.getValidate=void 0;var uP=eo(),Hy=dt(),Xe=W(),bn=Lt(),Wy=os(),fs=re(),lP={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:n}=e,{baseId:i,schemaEnv:o,validateName:a,opts:s,self:c}=n,{root:u}=o;if((r==="#"||r==="#/")&&i===u.baseId)return d();let l=Wy.resolveRef.call(c,u,i,r);if(l===void 0)throw new uP.default(n.opts.uriResolver,i,r);if(l instanceof Wy.SchemaEnv)return f(l);return p(l);function d(){if(o===u)return ms(e,a,o,o.$async);let m=t.scopeValue("root",{ref:u});return ms(e,(0,Xe._)`${m}.validate`,u,u.$async)}function f(m){let h=Gy(e,m);ms(e,h,m,m.$async)}function p(m){let h=t.scopeValue("schema",s.code.source===!0?{ref:m,code:(0,Xe.stringify)(m)}:{ref:m}),v=t.name("valid"),_=e.subschema({schema:m,dataTypes:[],schemaPath:Xe.nil,topSchemaRef:h,errSchemaPath:r},v);e.mergeEvaluated(_),e.ok(v)}}};function Gy(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,Xe._)`${r.scopeValue("wrapper",{ref:t})}.validate`}Er.getValidate=Gy;function ms(e,t,r,n){let{gen:i,it:o}=e,{allErrors:a,schemaEnv:s,opts:c}=o,u=c.passContext?bn.default.this:Xe.nil;n?l():d();function l(){if(!s.$async)throw new Error("async schema referenced by sync schema");let m=i.let("valid");i.try(()=>{i.code((0,Xe._)`await ${(0,Hy.callValidateCode)(e,t,u)}`),p(t),a||i.assign(m,!0)},h=>{i.if((0,Xe._)`!(${h} instanceof ${o.ValidationError})`,()=>i.throw(h)),f(h),a||i.assign(m,!1)}),e.ok(m)}function d(){e.result((0,Hy.callValidateCode)(e,t,u),()=>p(t),()=>f(t))}function f(m){let h=(0,Xe._)`${m}.errors`;i.assign(bn.default.vErrors,(0,Xe._)`${bn.default.vErrors} === null ? ${h} : ${bn.default.vErrors}.concat(${h})`),i.assign(bn.default.errors,(0,Xe._)`${bn.default.vErrors}.length`)}function p(m){var h;if(!o.opts.unevaluated)return;let v=(h=r?.validate)===null||h===void 0?void 0:h.evaluated;if(o.props!==!0)if(v&&!v.dynamicProps)v.props!==void 0&&(o.props=fs.mergeEvaluated.props(i,v.props,o.props));else{let _=i.var("props",(0,Xe._)`${m}.evaluated.props`);o.props=fs.mergeEvaluated.props(i,_,o.props,Xe.Name)}if(o.items!==!0)if(v&&!v.dynamicItems)v.items!==void 0&&(o.items=fs.mergeEvaluated.items(i,v.items,o.items));else{let _=i.var("items",(0,Xe._)`${m}.evaluated.items`);o.items=fs.mergeEvaluated.items(i,_,o.items,Xe.Name)}}}Er.callRef=ms;Er.default=lP});var Yy=j(Mp=>{"use strict";Object.defineProperty(Mp,"__esModule",{value:!0});var dP=By(),pP=Xy(),fP=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",dP.default,pP.default];Mp.default=fP});var Qy=j(Fp=>{"use strict";Object.defineProperty(Fp,"__esModule",{value:!0});var hs=W(),ur=hs.operators,gs={maximum:{okStr:"<=",ok:ur.LTE,fail:ur.GT},minimum:{okStr:">=",ok:ur.GTE,fail:ur.LT},exclusiveMaximum:{okStr:"<",ok:ur.LT,fail:ur.GTE},exclusiveMinimum:{okStr:">",ok:ur.GT,fail:ur.LTE}},mP={message:({keyword:e,schemaCode:t})=>(0,hs.str)`must be ${gs[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,hs._)`{comparison: ${gs[e].okStr}, limit: ${t}}`},hP={keyword:Object.keys(gs),type:"number",schemaType:"number",$data:!0,error:mP,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,hs._)`${r} ${gs[t].fail} ${n} || isNaN(${r})`)}};Fp.default=hP});var e_=j(Lp=>{"use strict";Object.defineProperty(Lp,"__esModule",{value:!0});var so=W(),gP={message:({schemaCode:e})=>(0,so.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,so._)`{multipleOf: ${e}}`},vP={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:gP,code(e){let{gen:t,data:r,schemaCode:n,it:i}=e,o=i.opts.multipleOfPrecision,a=t.let("res"),s=o?(0,so._)`Math.abs(Math.round(${a}) - ${a}) > 1e-${o}`:(0,so._)`${a} !== parseInt(${a})`;e.fail$data((0,so._)`(${n} === 0 || (${a} = ${r}/${n}, ${s}))`)}};Lp.default=vP});var r_=j(qp=>{"use strict";Object.defineProperty(qp,"__esModule",{value:!0});function t_(e){let t=e.length,r=0,n=0,i;for(;n<t;)r++,i=e.charCodeAt(n++),i>=55296&&i<=56319&&n<t&&(i=e.charCodeAt(n),(i&64512)===56320&&n++);return r}qp.default=t_;t_.code='require("ajv/dist/runtime/ucs2length").default'});var n_=j(Vp=>{"use strict";Object.defineProperty(Vp,"__esModule",{value:!0});var Tr=W(),yP=re(),_P=r_(),$P={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return(0,Tr.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,Tr._)`{limit: ${e}}`},bP={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:$P,code(e){let{keyword:t,data:r,schemaCode:n,it:i}=e,o=t==="maxLength"?Tr.operators.GT:Tr.operators.LT,a=i.opts.unicode===!1?(0,Tr._)`${r}.length`:(0,Tr._)`${(0,yP.useFunc)(e.gen,_P.default)}(${r})`;e.fail$data((0,Tr._)`${a} ${o} ${n}`)}};Vp.default=bP});var i_=j(Jp=>{"use strict";Object.defineProperty(Jp,"__esModule",{value:!0});var xP=dt(),kP=re(),xn=W(),wP={message:({schemaCode:e})=>(0,xn.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,xn._)`{pattern: ${e}}`},SP={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:wP,code(e){let{gen:t,data:r,$data:n,schema:i,schemaCode:o,it:a}=e,s=a.opts.unicodeRegExp?"u":"";if(n){let{regExp:c}=a.opts.code,u=c.code==="new RegExp"?(0,xn._)`new RegExp`:(0,kP.useFunc)(t,c),l=t.let("valid");t.try(()=>t.assign(l,(0,xn._)`${u}(${o}, ${s}).test(${r})`),()=>t.assign(l,!1)),e.fail$data((0,xn._)`!${l}`)}else{let c=(0,xP.usePattern)(e,i);e.fail$data((0,xn._)`!${c}.test(${r})`)}}};Jp.default=SP});var o_=j(Kp=>{"use strict";Object.defineProperty(Kp,"__esModule",{value:!0});var co=W(),zP={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return(0,co.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,co._)`{limit: ${e}}`},IP={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:zP,code(e){let{keyword:t,data:r,schemaCode:n}=e,i=t==="maxProperties"?co.operators.GT:co.operators.LT;e.fail$data((0,co._)`Object.keys(${r}).length ${i} ${n}`)}};Kp.default=IP});var a_=j(Bp=>{"use strict";Object.defineProperty(Bp,"__esModule",{value:!0});var uo=dt(),lo=W(),PP=re(),jP={message:({params:{missingProperty:e}})=>(0,lo.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,lo._)`{missingProperty: ${e}}`},EP={keyword:"required",type:"object",schemaType:"array",$data:!0,error:jP,code(e){let{gen:t,schema:r,schemaCode:n,data:i,$data:o,it:a}=e,{opts:s}=a;if(!o&&r.length===0)return;let c=r.length>=s.loopRequired;if(a.allErrors?u():l(),s.strictRequired){let p=e.parentSchema.properties,{definedProperties:m}=e.it;for(let h of r)if(p?.[h]===void 0&&!m.has(h)){let v=a.schemaEnv.baseId+a.errSchemaPath,_=`required property "${h}" is not defined at "${v}" (strictRequired)`;(0,PP.checkStrictMode)(a,_,a.opts.strictRequired)}}function u(){if(c||o)e.block$data(lo.nil,d);else for(let p of r)(0,uo.checkReportMissingProp)(e,p)}function l(){let p=t.let("missing");if(c||o){let m=t.let("valid",!0);e.block$data(m,()=>f(p,m)),e.ok(m)}else t.if((0,uo.checkMissingProp)(e,r,p)),(0,uo.reportMissingProp)(e,p),t.else()}function d(){t.forOf("prop",n,p=>{e.setParams({missingProperty:p}),t.if((0,uo.noPropertyInData)(t,i,p,s.ownProperties),()=>e.error())})}function f(p,m){e.setParams({missingProperty:p}),t.forOf(p,n,()=>{t.assign(m,(0,uo.propertyInData)(t,i,p,s.ownProperties)),t.if((0,lo.not)(m),()=>{e.error(),t.break()})},lo.nil)}}};Bp.default=EP});var s_=j(Hp=>{"use strict";Object.defineProperty(Hp,"__esModule",{value:!0});var po=W(),TP={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return(0,po.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,po._)`{limit: ${e}}`},OP={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:TP,code(e){let{keyword:t,data:r,schemaCode:n}=e,i=t==="maxItems"?po.operators.GT:po.operators.LT;e.fail$data((0,po._)`${r}.length ${i} ${n}`)}};Hp.default=OP});var vs=j(Wp=>{"use strict";Object.defineProperty(Wp,"__esModule",{value:!0});var c_=lp();c_.code='require("ajv/dist/runtime/equal").default';Wp.default=c_});var u_=j(Xp=>{"use strict";Object.defineProperty(Xp,"__esModule",{value:!0});var Gp=Wi(),Oe=W(),NP=re(),DP=vs(),RP={message:({params:{i:e,j:t}})=>(0,Oe.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,Oe._)`{i: ${e}, j: ${t}}`},CP={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:RP,code(e){let{gen:t,data:r,$data:n,schema:i,parentSchema:o,schemaCode:a,it:s}=e;if(!n&&!i)return;let c=t.let("valid"),u=o.items?(0,Gp.getSchemaTypes)(o.items):[];e.block$data(c,l,(0,Oe._)`${a} === false`),e.ok(c);function l(){let m=t.let("i",(0,Oe._)`${r}.length`),h=t.let("j");e.setParams({i:m,j:h}),t.assign(c,!0),t.if((0,Oe._)`${m} > 1`,()=>(d()?f:p)(m,h))}function d(){return u.length>0&&!u.some(m=>m==="object"||m==="array")}function f(m,h){let v=t.name("item"),_=(0,Gp.checkDataTypes)(u,v,s.opts.strictNumbers,Gp.DataType.Wrong),b=t.const("indices",(0,Oe._)`{}`);t.for((0,Oe._)`;${m}--;`,()=>{t.let(v,(0,Oe._)`${r}[${m}]`),t.if(_,(0,Oe._)`continue`),u.length>1&&t.if((0,Oe._)`typeof ${v} == "string"`,(0,Oe._)`${v} += "_"`),t.if((0,Oe._)`typeof ${b}[${v}] == "number"`,()=>{t.assign(h,(0,Oe._)`${b}[${v}]`),e.error(),t.assign(c,!1).break()}).code((0,Oe._)`${b}[${v}] = ${m}`)})}function p(m,h){let v=(0,NP.useFunc)(t,DP.default),_=t.name("outer");t.label(_).for((0,Oe._)`;${m}--;`,()=>t.for((0,Oe._)`${h} = ${m}; ${h}--;`,()=>t.if((0,Oe._)`${v}(${r}[${m}], ${r}[${h}])`,()=>{e.error(),t.assign(c,!1).break(_)})))}}};Xp.default=CP});var l_=j(Qp=>{"use strict";Object.defineProperty(Qp,"__esModule",{value:!0});var Yp=W(),ZP=re(),AP=vs(),UP={message:"must be equal to constant",params:({schemaCode:e})=>(0,Yp._)`{allowedValue: ${e}}`},MP={keyword:"const",$data:!0,error:UP,code(e){let{gen:t,data:r,$data:n,schemaCode:i,schema:o}=e;n||o&&typeof o=="object"?e.fail$data((0,Yp._)`!${(0,ZP.useFunc)(t,AP.default)}(${r}, ${i})`):e.fail((0,Yp._)`${o} !== ${r}`)}};Qp.default=MP});var d_=j(ef=>{"use strict";Object.defineProperty(ef,"__esModule",{value:!0});var fo=W(),FP=re(),LP=vs(),qP={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,fo._)`{allowedValues: ${e}}`},VP={keyword:"enum",schemaType:"array",$data:!0,error:qP,code(e){let{gen:t,data:r,$data:n,schema:i,schemaCode:o,it:a}=e;if(!n&&i.length===0)throw new Error("enum must have non-empty array");let s=i.length>=a.opts.loopEnum,c,u=()=>c??(c=(0,FP.useFunc)(t,LP.default)),l;if(s||n)l=t.let("valid"),e.block$data(l,d);else{if(!Array.isArray(i))throw new Error("ajv implementation error");let p=t.const("vSchema",o);l=(0,fo.or)(...i.map((m,h)=>f(p,h)))}e.pass(l);function d(){t.assign(l,!1),t.forOf("v",o,p=>t.if((0,fo._)`${u()}(${r}, ${p})`,()=>t.assign(l,!0).break()))}function f(p,m){let h=i[m];return typeof h=="object"&&h!==null?(0,fo._)`${u()}(${r}, ${p}[${m}])`:(0,fo._)`${r} === ${h}`}}};ef.default=VP});var p_=j(tf=>{"use strict";Object.defineProperty(tf,"__esModule",{value:!0});var JP=Qy(),KP=e_(),BP=n_(),HP=i_(),WP=o_(),GP=a_(),XP=s_(),YP=u_(),QP=l_(),ej=d_(),tj=[JP.default,KP.default,BP.default,HP.default,WP.default,GP.default,XP.default,YP.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},QP.default,ej.default];tf.default=tj});var nf=j(mo=>{"use strict";Object.defineProperty(mo,"__esModule",{value:!0});mo.validateAdditionalItems=void 0;var Or=W(),rf=re(),rj={message:({params:{len:e}})=>(0,Or.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,Or._)`{limit: ${e}}`},nj={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:rj,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0,rf.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}f_(e,n)}};function f_(e,t){let{gen:r,schema:n,data:i,keyword:o,it:a}=e;a.items=!0;let s=r.const("len",(0,Or._)`${i}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,Or._)`${s} <= ${t.length}`);else if(typeof n=="object"&&!(0,rf.alwaysValidSchema)(a,n)){let u=r.var("valid",(0,Or._)`${s} <= ${t.length}`);r.if((0,Or.not)(u),()=>c(u)),e.ok(u)}function c(u){r.forRange("i",t.length,s,l=>{e.subschema({keyword:o,dataProp:l,dataPropType:rf.Type.Num},u),a.allErrors||r.if((0,Or.not)(u),()=>r.break())})}}mo.validateAdditionalItems=f_;mo.default=nj});var of=j(ho=>{"use strict";Object.defineProperty(ho,"__esModule",{value:!0});ho.validateTuple=void 0;var m_=W(),ys=re(),ij=dt(),oj={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return h_(e,"additionalItems",t);r.items=!0,!(0,ys.alwaysValidSchema)(r,t)&&e.ok((0,ij.validateArray)(e))}};function h_(e,t,r=e.schema){let{gen:n,parentSchema:i,data:o,keyword:a,it:s}=e;l(i),s.opts.unevaluated&&r.length&&s.items!==!0&&(s.items=ys.mergeEvaluated.items(n,r.length,s.items));let c=n.name("valid"),u=n.const("len",(0,m_._)`${o}.length`);r.forEach((d,f)=>{(0,ys.alwaysValidSchema)(s,d)||(n.if((0,m_._)`${u} > ${f}`,()=>e.subschema({keyword:a,schemaProp:f,dataProp:f},c)),e.ok(c))});function l(d){let{opts:f,errSchemaPath:p}=s,m=r.length,h=m===d.minItems&&(m===d.maxItems||d[t]===!1);if(f.strictTuples&&!h){let v=`"${a}" is ${m}-tuple, but minItems or maxItems/${t} are not specified or different at path "${p}"`;(0,ys.checkStrictMode)(s,v,f.strictTuples)}}}ho.validateTuple=h_;ho.default=oj});var g_=j(af=>{"use strict";Object.defineProperty(af,"__esModule",{value:!0});var aj=of(),sj={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,aj.validateTuple)(e,"items")};af.default=sj});var y_=j(sf=>{"use strict";Object.defineProperty(sf,"__esModule",{value:!0});var v_=W(),cj=re(),uj=dt(),lj=nf(),dj={message:({params:{len:e}})=>(0,v_.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,v_._)`{limit: ${e}}`},pj={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:dj,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:i}=r;n.items=!0,!(0,cj.alwaysValidSchema)(n,t)&&(i?(0,lj.validateAdditionalItems)(e,i):e.ok((0,uj.validateArray)(e)))}};sf.default=pj});var __=j(cf=>{"use strict";Object.defineProperty(cf,"__esModule",{value:!0});var ft=W(),_s=re(),fj={message:({params:{min:e,max:t}})=>t===void 0?(0,ft.str)`must contain at least ${e} valid item(s)`:(0,ft.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,ft._)`{minContains: ${e}}`:(0,ft._)`{minContains: ${e}, maxContains: ${t}}`},mj={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:fj,code(e){let{gen:t,schema:r,parentSchema:n,data:i,it:o}=e,a,s,{minContains:c,maxContains:u}=n;o.opts.next?(a=c===void 0?1:c,s=u):a=1;let l=t.const("len",(0,ft._)`${i}.length`);if(e.setParams({min:a,max:s}),s===void 0&&a===0){(0,_s.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(s!==void 0&&a>s){(0,_s.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,_s.alwaysValidSchema)(o,r)){let h=(0,ft._)`${l} >= ${a}`;s!==void 0&&(h=(0,ft._)`${h} && ${l} <= ${s}`),e.pass(h);return}o.items=!0;let d=t.name("valid");s===void 0&&a===1?p(d,()=>t.if(d,()=>t.break())):a===0?(t.let(d,!0),s!==void 0&&t.if((0,ft._)`${i}.length > 0`,f)):(t.let(d,!1),f()),e.result(d,()=>e.reset());function f(){let h=t.name("_valid"),v=t.let("count",0);p(h,()=>t.if(h,()=>m(v)))}function p(h,v){t.forRange("i",0,l,_=>{e.subschema({keyword:"contains",dataProp:_,dataPropType:_s.Type.Num,compositeRule:!0},h),v()})}function m(h){t.code((0,ft._)`${h}++`),s===void 0?t.if((0,ft._)`${h} >= ${a}`,()=>t.assign(d,!0).break()):(t.if((0,ft._)`${h} > ${s}`,()=>t.assign(d,!1).break()),a===1?t.assign(d,!0):t.if((0,ft._)`${h} >= ${a}`,()=>t.assign(d,!0)))}}};cf.default=mj});var x_=j(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.validateSchemaDeps=It.validatePropertyDeps=It.error=void 0;var uf=W(),hj=re(),go=dt();It.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let n=t===1?"property":"properties";return(0,uf.str)`must have ${n} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>(0,uf._)`{property: ${e},
7
7
  missingProperty: ${n},
8
8
  depsCount: ${t},
9
- deps: ${r}}`};var hj={keyword:"dependencies",type:"object",schemaType:"object",error:It.error,code(e){let[t,r]=gj(e);__(e,t),$_(e,r)}};function gj({schema:e}){let t={},r={};for(let n in e){if(n==="__proto__")continue;let o=Array.isArray(e[n])?t:r;o[n]=e[n]}return[t,r]}function __(e,t=e.schema){let{gen:r,data:n,it:o}=e;if(Object.keys(t).length===0)return;let i=r.let("missing");for(let a in t){let s=t[a];if(s.length===0)continue;let c=(0,gi.propertyInData)(r,n,a,o.opts.ownProperties);e.setParams({property:a,depsCount:s.length,deps:s.join(", ")}),o.allErrors?r.if(c,()=>{for(let u of s)(0,gi.checkReportMissingProp)(e,u)}):(r.if((0,uf._)`${c} && (${(0,gi.checkMissingProp)(e,s,i)})`),(0,gi.reportMissingProp)(e,i),r.else())}}It.validatePropertyDeps=__;function $_(e,t=e.schema){let{gen:r,data:n,keyword:o,it:i}=e,a=r.name("valid");for(let s in t)(0,mj.alwaysValidSchema)(i,t[s])||(r.if((0,gi.propertyInData)(r,n,s,i.opts.ownProperties),()=>{let c=e.subschema({keyword:o,schemaProp:s},a);e.mergeValidEvaluated(c,a)},()=>r.var(a,!0)),e.ok(a))}It.validateSchemaDeps=$_;It.default=hj});var k_=j(lf=>{"use strict";Object.defineProperty(lf,"__esModule",{value:!0});var x_=W(),vj=re(),yj={message:"property name must be valid",params:({params:e})=>(0,x_._)`{propertyName: ${e.propertyName}}`},_j={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:yj,code(e){let{gen:t,schema:r,data:n,it:o}=e;if((0,vj.alwaysValidSchema)(o,r))return;let i=t.name("valid");t.forIn("key",n,a=>{e.setParams({propertyName:a}),e.subschema({keyword:"propertyNames",data:a,dataTypes:["string"],propertyName:a,compositeRule:!0},i),t.if((0,x_.not)(i),()=>{e.error(!0),o.allErrors||t.break()})}),e.ok(i)}};lf.default=_j});var pf=j(df=>{"use strict";Object.defineProperty(df,"__esModule",{value:!0});var $s=dt(),$t=W(),$j=Lt(),bs=re(),bj={message:"must NOT have additional properties",params:({params:e})=>(0,$t._)`{additionalProperty: ${e.additionalProperty}}`},xj={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:bj,code(e){let{gen:t,schema:r,parentSchema:n,data:o,errsCount:i,it:a}=e;if(!i)throw new Error("ajv implementation error");let{allErrors:s,opts:c}=a;if(a.props=!0,c.removeAdditional!=="all"&&(0,bs.alwaysValidSchema)(a,r))return;let u=(0,$s.allSchemaProperties)(n.properties),l=(0,$s.allSchemaProperties)(n.patternProperties);d(),e.ok((0,$t._)`${i} === ${$j.default.errors}`);function d(){t.forIn("key",o,v=>{!u.length&&!l.length?m(v):t.if(p(v),()=>m(v))})}function p(v){let _;if(u.length>8){let $=(0,bs.schemaRefOrVal)(a,n.properties,"properties");_=(0,$s.isOwnProperty)(t,$,v)}else u.length?_=(0,$t.or)(...u.map($=>(0,$t._)`${v} === ${$}`)):_=$t.nil;return l.length&&(_=(0,$t.or)(_,...l.map($=>(0,$t._)`${(0,$s.usePattern)(e,$)}.test(${v})`))),(0,$t.not)(_)}function f(v){t.code((0,$t._)`delete ${o}[${v}]`)}function m(v){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){f(v);return}if(r===!1){e.setParams({additionalProperty:v}),e.error(),s||t.break();return}if(typeof r=="object"&&!(0,bs.alwaysValidSchema)(a,r)){let _=t.name("valid");c.removeAdditional==="failing"?(h(v,_,!1),t.if((0,$t.not)(_),()=>{e.reset(),f(v)})):(h(v,_),s||t.if((0,$t.not)(_),()=>t.break()))}}function h(v,_,$){let b={keyword:"additionalProperties",dataProp:v,dataPropType:bs.Type.Str};$===!1&&Object.assign(b,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(b,_)}}};df.default=xj});var z_=j(mf=>{"use strict";Object.defineProperty(mf,"__esModule",{value:!0});var kj=ei(),w_=dt(),ff=re(),S_=pf(),wj={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:i}=e;i.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&S_.default.code(new kj.KeywordCxt(i,S_.default,"additionalProperties"));let a=(0,w_.allSchemaProperties)(r);for(let d of a)i.definedProperties.add(d);i.opts.unevaluated&&a.length&&i.props!==!0&&(i.props=ff.mergeEvaluated.props(t,(0,ff.toHash)(a),i.props));let s=a.filter(d=>!(0,ff.alwaysValidSchema)(i,r[d]));if(s.length===0)return;let c=t.name("valid");for(let d of s)u(d)?l(d):(t.if((0,w_.propertyInData)(t,o,d,i.opts.ownProperties)),l(d),i.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(d),e.ok(c);function u(d){return i.opts.useDefaults&&!i.compositeRule&&r[d].default!==void 0}function l(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};mf.default=wj});var E_=j(hf=>{"use strict";Object.defineProperty(hf,"__esModule",{value:!0});var I_=dt(),xs=W(),P_=re(),j_=re(),Sj={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:o,it:i}=e,{opts:a}=i,s=(0,I_.allSchemaProperties)(r),c=s.filter(h=>(0,P_.alwaysValidSchema)(i,r[h]));if(s.length===0||c.length===s.length&&(!i.opts.unevaluated||i.props===!0))return;let u=a.strictSchema&&!a.allowMatchingProperties&&o.properties,l=t.name("valid");i.props!==!0&&!(i.props instanceof xs.Name)&&(i.props=(0,j_.evaluatedPropsToName)(t,i.props));let{props:d}=i;p();function p(){for(let h of s)u&&f(h),i.allErrors?m(h):(t.var(l,!0),m(h),t.if(l))}function f(h){for(let v in u)new RegExp(h).test(v)&&(0,P_.checkStrictMode)(i,`property ${v} matches pattern ${h} (use allowMatchingProperties)`)}function m(h){t.forIn("key",n,v=>{t.if((0,xs._)`${(0,I_.usePattern)(e,h)}.test(${v})`,()=>{let _=c.includes(h);_||e.subschema({keyword:"patternProperties",schemaProp:h,dataProp:v,dataPropType:j_.Type.Str},l),i.opts.unevaluated&&d!==!0?t.assign((0,xs._)`${d}[${v}]`,!0):!_&&!i.allErrors&&t.if((0,xs.not)(l),()=>t.break())})})}}};hf.default=Sj});var T_=j(gf=>{"use strict";Object.defineProperty(gf,"__esModule",{value:!0});var zj=re(),Ij={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if((0,zj.alwaysValidSchema)(n,r)){e.fail();return}let o=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),e.failResult(o,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};gf.default=Ij});var O_=j(vf=>{"use strict";Object.defineProperty(vf,"__esModule",{value:!0});var Pj=dt(),jj={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Pj.validateUnion,error:{message:"must match a schema in anyOf"}};vf.default=jj});var N_=j(yf=>{"use strict";Object.defineProperty(yf,"__esModule",{value:!0});var ks=W(),Ej=re(),Tj={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,ks._)`{passingSchemas: ${e.passing}}`},Oj={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Tj,code(e){let{gen:t,schema:r,parentSchema:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;let i=r,a=t.let("valid",!1),s=t.let("passing",null),c=t.name("_valid");e.setParams({passing:s}),t.block(u),e.result(a,()=>e.reset(),()=>e.error(!0));function u(){i.forEach((l,d)=>{let p;(0,Ej.alwaysValidSchema)(o,l)?t.var(c,!0):p=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&t.if((0,ks._)`${c} && ${a}`).assign(a,!1).assign(s,(0,ks._)`[${s}, ${d}]`).else(),t.if(c,()=>{t.assign(a,!0),t.assign(s,d),p&&e.mergeEvaluated(p,ks.Name)})})}}};yf.default=Oj});var D_=j(_f=>{"use strict";Object.defineProperty(_f,"__esModule",{value:!0});var Nj=re(),Dj={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");let o=t.name("valid");r.forEach((i,a)=>{if((0,Nj.alwaysValidSchema)(n,i))return;let s=e.subschema({keyword:"allOf",schemaProp:a},o);e.ok(o),e.mergeEvaluated(s)})}};_f.default=Dj});var Z_=j($f=>{"use strict";Object.defineProperty($f,"__esModule",{value:!0});var ws=W(),C_=re(),Rj={message:({params:e})=>(0,ws.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,ws._)`{failingKeyword: ${e.ifClause}}`},Cj={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Rj,code(e){let{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,C_.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let o=R_(n,"then"),i=R_(n,"else");if(!o&&!i)return;let a=t.let("valid",!0),s=t.name("_valid");if(c(),e.reset(),o&&i){let l=t.let("ifClause");e.setParams({ifClause:l}),t.if(s,u("then",l),u("else",l))}else o?t.if(s,u("then")):t.if((0,ws.not)(s),u("else"));e.pass(a,()=>e.error(!0));function c(){let l=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},s);e.mergeEvaluated(l)}function u(l,d){return()=>{let p=e.subschema({keyword:l},s);t.assign(a,s),e.mergeValidEvaluated(p,a),d?t.assign(d,(0,ws._)`${l}`):e.setParams({ifClause:l})}}}};function R_(e,t){let r=e.schema[t];return r!==void 0&&!(0,C_.alwaysValidSchema)(e,r)}$f.default=Cj});var A_=j(bf=>{"use strict";Object.defineProperty(bf,"__esModule",{value:!0});var Zj=re(),Aj={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,Zj.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};bf.default=Aj});var U_=j(xf=>{"use strict";Object.defineProperty(xf,"__esModule",{value:!0});var Uj=nf(),Mj=h_(),Fj=of(),qj=v_(),Lj=y_(),Vj=b_(),Jj=k_(),Kj=pf(),Hj=z_(),Bj=E_(),Wj=T_(),Gj=O_(),Xj=N_(),Yj=D_(),Qj=Z_(),eE=A_();function tE(e=!1){let t=[Wj.default,Gj.default,Xj.default,Yj.default,Qj.default,eE.default,Jj.default,Kj.default,Vj.default,Hj.default,Bj.default];return e?t.push(Mj.default,qj.default):t.push(Uj.default,Fj.default),t.push(Lj.default),t}xf.default=tE});var M_=j(kf=>{"use strict";Object.defineProperty(kf,"__esModule",{value:!0});var _e=W(),rE={message:({schemaCode:e})=>(0,_e.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,_e._)`{format: ${e}}`},nE={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:rE,code(e,t){let{gen:r,data:n,$data:o,schema:i,schemaCode:a,it:s}=e,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=s;if(!c.validateFormats)return;o?p():f();function p(){let m=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),h=r.const("fDef",(0,_e._)`${m}[${a}]`),v=r.let("fType"),_=r.let("format");r.if((0,_e._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(v,(0,_e._)`${h}.type || "string"`).assign(_,(0,_e._)`${h}.validate`),()=>r.assign(v,(0,_e._)`"string"`).assign(_,h)),e.fail$data((0,_e.or)($(),b()));function $(){return c.strictSchema===!1?_e.nil:(0,_e._)`${a} && !${_}`}function b(){let S=l.$async?(0,_e._)`(${h}.async ? await ${_}(${n}) : ${_}(${n}))`:(0,_e._)`${_}(${n})`,P=(0,_e._)`(typeof ${_} == "function" ? ${S} : ${_}.test(${n}))`;return(0,_e._)`${_} && ${_} !== true && ${v} === ${t} && !${P}`}}function f(){let m=d.formats[i];if(!m){$();return}if(m===!0)return;let[h,v,_]=b(m);h===t&&e.pass(S());function $(){if(c.strictSchema===!1){d.logger.warn(P());return}throw new Error(P());function P(){return`unknown format "${i}" ignored in schema at path "${u}"`}}function b(P){let Se=P instanceof RegExp?(0,_e.regexpCode)(P):c.code.formats?(0,_e._)`${c.code.formats}${(0,_e.getProperty)(i)}`:void 0,Oe=r.scopeValue("formats",{key:i,ref:P,code:Se});return typeof P=="object"&&!(P instanceof RegExp)?[P.type||"string",P.validate,(0,_e._)`${Oe}.validate`]:["string",P,Oe]}function S(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!l.$async)throw new Error("async format in sync schema");return(0,_e._)`await ${_}(${n})`}return typeof v=="function"?(0,_e._)`${_}(${n})`:(0,_e._)`${_}.test(${n})`}}}};kf.default=nE});var F_=j(wf=>{"use strict";Object.defineProperty(wf,"__esModule",{value:!0});var oE=M_(),iE=[oE.default];wf.default=iE});var q_=j(xn=>{"use strict";Object.defineProperty(xn,"__esModule",{value:!0});xn.contentVocabulary=xn.metadataVocabulary=void 0;xn.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];xn.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var V_=j(Sf=>{"use strict";Object.defineProperty(Sf,"__esModule",{value:!0});var aE=Xy(),sE=d_(),cE=U_(),uE=F_(),L_=q_(),lE=[aE.default,sE.default,(0,cE.default)(),uE.default,L_.metadataVocabulary,L_.contentVocabulary];Sf.default=lE});var K_=j(Ss=>{"use strict";Object.defineProperty(Ss,"__esModule",{value:!0});Ss.DiscrError=void 0;var J_;(function(e){e.Tag="tag",e.Mapping="mapping"})(J_||(Ss.DiscrError=J_={}))});var B_=j(If=>{"use strict";Object.defineProperty(If,"__esModule",{value:!0});var kn=W(),zf=K_(),H_=is(),dE=ti(),pE=re(),fE={message:({params:{discrError:e,tagName:t}})=>e===zf.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,kn._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},mE={keyword:"discriminator",type:"object",schemaType:"object",error:fE,code(e){let{gen:t,data:r,schema:n,parentSchema:o,it:i}=e,{oneOf:a}=o;if(!i.opts.discriminator)throw new Error("discriminator: requires discriminator option");let s=n.propertyName;if(typeof s!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!a)throw new Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),u=t.const("tag",(0,kn._)`${r}${(0,kn.getProperty)(s)}`);t.if((0,kn._)`typeof ${u} == "string"`,()=>l(),()=>e.error(!1,{discrError:zf.DiscrError.Tag,tag:u,tagName:s})),e.ok(c);function l(){let f=p();t.if(!1);for(let m in f)t.elseIf((0,kn._)`${u} === ${m}`),t.assign(c,d(f[m]));t.else(),e.error(!1,{discrError:zf.DiscrError.Mapping,tag:u,tagName:s}),t.endIf()}function d(f){let m=t.name("valid"),h=e.subschema({keyword:"oneOf",schemaProp:f},m);return e.mergeEvaluated(h,kn.Name),m}function p(){var f;let m={},h=_(o),v=!0;for(let S=0;S<a.length;S++){let P=a[S];if(P?.$ref&&!(0,pE.schemaHasRulesButRef)(P,i.self.RULES)){let Oe=P.$ref;if(P=H_.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,Oe),P instanceof H_.SchemaEnv&&(P=P.schema),P===void 0)throw new dE.default(i.opts.uriResolver,i.baseId,Oe)}let Se=(f=P?.properties)===null||f===void 0?void 0:f[s];if(typeof Se!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${s}"`);v=v&&(h||_(P)),$(Se,S)}if(!v)throw new Error(`discriminator: "${s}" must be required`);return m;function _({required:S}){return Array.isArray(S)&&S.includes(s)}function $(S,P){if(S.const)b(S.const,P);else if(S.enum)for(let Se of S.enum)b(Se,P);else throw new Error(`discriminator: "properties/${s}" must have "const" or "enum"`)}function b(S,P){if(typeof S!="string"||S in m)throw new Error(`discriminator: "${s}" values must be unique strings`);m[S]=P}}}};If.default=mE});var W_=j((OU,hE)=>{hE.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 jf=j((ve,Pf)=>{"use strict";Object.defineProperty(ve,"__esModule",{value:!0});ve.MissingRefError=ve.ValidationError=ve.CodeGen=ve.Name=ve.nil=ve.stringify=ve.str=ve._=ve.KeywordCxt=ve.Ajv=void 0;var gE=Jy(),vE=V_(),yE=B_(),G_=W_(),_E=["/properties"],zs="http://json-schema.org/draft-07/schema",wn=class extends gE.default{_addVocabularies(){super._addVocabularies(),vE.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(yE.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(G_,_E):G_;this.addMetaSchema(t,zs,!1),this.refs["http://json-schema.org/schema"]=zs}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(zs)?zs:void 0)}};ve.Ajv=wn;Pf.exports=ve=wn;Pf.exports.Ajv=wn;Object.defineProperty(ve,"__esModule",{value:!0});ve.default=wn;var $E=ei();Object.defineProperty(ve,"KeywordCxt",{enumerable:!0,get:function(){return $E.KeywordCxt}});var Sn=W();Object.defineProperty(ve,"_",{enumerable:!0,get:function(){return Sn._}});Object.defineProperty(ve,"str",{enumerable:!0,get:function(){return Sn.str}});Object.defineProperty(ve,"stringify",{enumerable:!0,get:function(){return Sn.stringify}});Object.defineProperty(ve,"nil",{enumerable:!0,get:function(){return Sn.nil}});Object.defineProperty(ve,"Name",{enumerable:!0,get:function(){return Sn.Name}});Object.defineProperty(ve,"CodeGen",{enumerable:!0,get:function(){return Sn.CodeGen}});var bE=ns();Object.defineProperty(ve,"ValidationError",{enumerable:!0,get:function(){return bE.default}});var xE=ti();Object.defineProperty(ve,"MissingRefError",{enumerable:!0,get:function(){return xE.default}})});var o$=j(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.formatNames=jt.fastFormats=jt.fullFormats=void 0;function Pt(e,t){return{validate:e,compare:t}}jt.fullFormats={date:Pt(e$,Nf),time:Pt(Tf(!0),Df),"date-time":Pt(X_(!0),r$),"iso-time":Pt(Tf(),t$),"iso-date-time":Pt(X_(),n$),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:PE,"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:RE,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:jE,int32:{type:"number",validate:OE},int64:{type:"number",validate:NE},float:{type:"number",validate:Q_},double:{type:"number",validate:Q_},password:!0,binary:!0};jt.fastFormats={...jt.fullFormats,date:Pt(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Nf),time:Pt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Df),"date-time":Pt(/^\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,r$),"iso-time":Pt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,t$),"iso-date-time":Pt(/^\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,n$),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};jt.formatNames=Object.keys(jt.fullFormats);function kE(e){return e%4===0&&(e%100!==0||e%400===0)}var wE=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,SE=[0,31,28,31,30,31,30,31,31,30,31,30,31];function e$(e){let t=wE.exec(e);if(!t)return!1;let r=+t[1],n=+t[2],o=+t[3];return n>=1&&n<=12&&o>=1&&o<=(n===2&&kE(r)?29:SE[n])}function Nf(e,t){if(e&&t)return e>t?1:e<t?-1:0}var Ef=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Tf(e){return function(r){let n=Ef.exec(r);if(!n)return!1;let o=+n[1],i=+n[2],a=+n[3],s=n[4],c=n[5]==="-"?-1:1,u=+(n[6]||0),l=+(n[7]||0);if(u>23||l>59||e&&!s)return!1;if(o<=23&&i<=59&&a<60)return!0;let d=i-l*c,p=o-u*c-(d<0?1:0);return(p===23||p===-1)&&(d===59||d===-1)&&a<61}}function Df(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),n=new Date("2020-01-01T"+t).valueOf();if(r&&n)return r-n}function t$(e,t){if(!(e&&t))return;let r=Ef.exec(e),n=Ef.exec(t);if(r&&n)return e=r[1]+r[2]+r[3],t=n[1]+n[2]+n[3],e>t?1:e<t?-1:0}var Of=/t|\s/i;function X_(e){let t=Tf(e);return function(n){let o=n.split(Of);return o.length===2&&e$(o[0])&&t(o[1])}}function r$(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),n=new Date(t).valueOf();if(r&&n)return r-n}function n$(e,t){if(!(e&&t))return;let[r,n]=e.split(Of),[o,i]=t.split(Of),a=Nf(r,o);if(a!==void 0)return a||Df(n,i)}var zE=/\/|:/,IE=/^(?:[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 PE(e){return zE.test(e)&&IE.test(e)}var Y_=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function jE(e){return Y_.lastIndex=0,Y_.test(e)}var EE=-(2**31),TE=2**31-1;function OE(e){return Number.isInteger(e)&&e<=TE&&e>=EE}function NE(e){return Number.isInteger(e)}function Q_(){return!0}var DE=/[^\\]\\Z/;function RE(e){if(DE.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var i$=j(zn=>{"use strict";Object.defineProperty(zn,"__esModule",{value:!0});zn.formatLimitDefinition=void 0;var CE=jf(),bt=W(),lr=bt.operators,Is={formatMaximum:{okStr:"<=",ok:lr.LTE,fail:lr.GT},formatMinimum:{okStr:">=",ok:lr.GTE,fail:lr.LT},formatExclusiveMaximum:{okStr:"<",ok:lr.LT,fail:lr.GTE},formatExclusiveMinimum:{okStr:">",ok:lr.GT,fail:lr.LTE}},ZE={message:({keyword:e,schemaCode:t})=>(0,bt.str)`should be ${Is[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,bt._)`{comparison: ${Is[e].okStr}, limit: ${t}}`};zn.formatLimitDefinition={keyword:Object.keys(Is),type:"string",schemaType:"string",$data:!0,error:ZE,code(e){let{gen:t,data:r,schemaCode:n,keyword:o,it:i}=e,{opts:a,self:s}=i;if(!a.validateFormats)return;let c=new CE.KeywordCxt(i,s.RULES.all.format.definition,"format");c.$data?u():l();function u(){let p=t.scopeValue("formats",{ref:s.formats,code:a.code.formats}),f=t.const("fmt",(0,bt._)`${p}[${c.schemaCode}]`);e.fail$data((0,bt.or)((0,bt._)`typeof ${f} != "object"`,(0,bt._)`${f} instanceof RegExp`,(0,bt._)`typeof ${f}.compare != "function"`,d(f)))}function l(){let p=c.schema,f=s.formats[p];if(!f||f===!0)return;if(typeof f!="object"||f instanceof RegExp||typeof f.compare!="function")throw new Error(`"${o}": format "${p}" does not define "compare" function`);let m=t.scopeValue("formats",{key:p,ref:f,code:a.code.formats?(0,bt._)`${a.code.formats}${(0,bt.getProperty)(p)}`:void 0});e.fail$data(d(m))}function d(p){return(0,bt._)`${p}.compare(${r}, ${n}) ${Is[o].fail} 0`}},dependencies:["format"]};var AE=e=>(e.addKeyword(zn.formatLimitDefinition),e);zn.default=AE});var u$=j((vi,c$)=>{"use strict";Object.defineProperty(vi,"__esModule",{value:!0});var In=o$(),UE=i$(),Rf=W(),a$=new Rf.Name("fullFormats"),ME=new Rf.Name("fastFormats"),Cf=(e,t={keywords:!0})=>{if(Array.isArray(t))return s$(e,t,In.fullFormats,a$),e;let[r,n]=t.mode==="fast"?[In.fastFormats,ME]:[In.fullFormats,a$],o=t.formats||In.formatNames;return s$(e,o,r,n),t.keywords&&(0,UE.default)(e),e};Cf.get=(e,t="full")=>{let n=(t==="fast"?In.fastFormats:In.fullFormats)[e];if(!n)throw new Error(`Unknown format "${e}"`);return n};function s$(e,t,r,n){var o,i;(o=(i=e.opts.code).formats)!==null&&o!==void 0||(i.formats=(0,Rf._)`require("ajv-formats/dist/formats").${n}`);for(let a of t)e.addFormat(a,r[a])}c$.exports=vi=Cf;Object.defineProperty(vi,"__esModule",{value:!0});vi.default=Cf});var we=ot(require("path")),Cr=ot(require("fs")),w$=ot(require("os"));var ee;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function r(o){throw new Error}e.assertNever=r,e.arrayToEnum=o=>{let i={};for(let a of o)i[a]=a;return i},e.getValidEnumValues=o=>{let i=e.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(let s of i)a[s]=o[s];return e.objectValues(a)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let a in o)Object.prototype.hasOwnProperty.call(o,a)&&i.push(a);return i},e.find=(o,i)=>{for(let a of o)if(i(a))return a},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}e.joinValues=n,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(ee||(ee={}));var qf;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(qf||(qf={}));var E=ee.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Tt=e=>{switch(typeof e){case"undefined":return E.undefined;case"string":return E.string;case"number":return Number.isNaN(e)?E.nan:E.number;case"boolean":return E.boolean;case"function":return E.function;case"bigint":return E.bigint;case"symbol":return E.symbol;case"object":return Array.isArray(e)?E.array:e===null?E.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?E.promise:typeof Map<"u"&&e instanceof Map?E.map:typeof Set<"u"&&e instanceof Set?E.set:typeof Date<"u"&&e instanceof Date?E.date:E.object;default:return E.unknown}};var x=ee.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);var Ye=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(i){return i.message},n={_errors:[]},o=i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let s=n,c=0;for(;c<a.path.length;){let u=a.path[c];c===a.path.length-1?(s[u]=s[u]||{_errors:[]},s[u]._errors.push(r(a))):s[u]=s[u]||{_errors:[]},s=s[u],c++}}};return o(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ee.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r=Object.create(null),n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];r[i]=r[i]||[],r[i].push(t(o))}else n.push(t(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Ye.create=e=>new Ye(e);var N$=(e,t)=>{let r;switch(e.code){case x.invalid_type:e.received===E.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case x.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,ee.jsonStringifyReplacer)}`;break;case x.unrecognized_keys:r=`Unrecognized key(s) in object: ${ee.joinValues(e.keys,", ")}`;break;case x.invalid_union:r="Invalid input";break;case x.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ee.joinValues(e.options)}`;break;case x.invalid_enum_value:r=`Invalid enum value. Expected ${ee.joinValues(e.options)}, received '${e.received}'`;break;case x.invalid_arguments:r="Invalid function arguments";break;case x.invalid_return_type:r="Invalid function return type";break;case x.invalid_date:r="Invalid date";break;case x.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:ee.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case x.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case x.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case x.custom:r="Invalid input";break;case x.invalid_intersection_types:r="Intersection results could not be merged";break;case x.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case x.not_finite:r="Number must be finite";break;default:r=t.defaultError,ee.assertNever(e)}return{message:r}},Jt=N$;var D$=Jt;function On(){return D$}var xi=e=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,i=[...r,...o.path||[]],a={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let s="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)s=u(a,{data:t,defaultError:s}).message;return{...o,path:i,message:s}};function z(e,t){let r=On(),n=xi({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Jt?void 0:Jt].filter(o=>!!o)});e.common.issues.push(n)}var Ne=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let o of r){if(o.status==="aborted")return M;o.status==="dirty"&&t.dirty(),n.push(o.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let o of r){let i=await o.key,a=await o.value;n.push({key:i,value:a})}return e.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let o of r){let{key:i,value:a}=o;if(i.status==="aborted"||a.status==="aborted")return M;i.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||o.alwaysSet)&&(n[i.value]=a.value)}return{status:t.value,value:n}}},M=Object.freeze({status:"aborted"}),Zr=e=>({status:"dirty",value:e}),Me=e=>({status:"valid",value:e}),As=e=>e.status==="aborted",Us=e=>e.status==="dirty",pr=e=>e.status==="valid",Nn=e=>typeof Promise<"u"&&e instanceof Promise;var O;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(O||(O={}));var it=class{constructor(t,r,n,o){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Lf=(e,t)=>{if(pr(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Ye(e.common.issues);return this._error=r,this._error}}};function J(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:o}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(a,s)=>{let{message:c}=e;return a.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:c??n??s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:c??r??s.defaultError}},description:o}}var G=class{get description(){return this._def.description}_getType(t){return Tt(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Tt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Ne,ctx:{common:t.parent.common,data:t.data,parsedType:Tt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(Nn(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Tt(t)},o=this._parseSync({data:t,path:n.path,parent:n});return Lf(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Tt(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return pr(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(n=>pr(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Tt(t)},o=this._parse({data:t,path:n.path,parent:n}),i=await(Nn(o)?o:Promise.resolve(o));return Lf(n,i)}refine(t,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let a=t(o),s=()=>i.addIssue({code:x.custom,...n(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(t,r){return this._refinement((n,o)=>t(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(t){return new ht({schema:this,typeName:C.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return mt.create(this,this._def)}nullable(){return Dt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ht.create(this)}promise(){return fr.create(this,this._def)}or(t){return qr.create([this,t],this._def)}and(t){return Lr.create(this,t,this._def)}transform(t){return new ht({...J(this._def),schema:this,typeName:C.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new Br({...J(this._def),innerType:this,defaultValue:r,typeName:C.ZodDefault})}brand(){return new ki({typeName:C.ZodBranded,type:this,...J(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new Wr({...J(this._def),innerType:this,catchValue:r,typeName:C.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return wi.create(this,t)}readonly(){return Gr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},R$=/^c[^\s-]{8,}$/i,C$=/^[0-9a-z]+$/,Z$=/^[0-9A-HJKMNP-TV-Z]{26}$/i,A$=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,U$=/^[a-z0-9_-]{21}$/i,M$=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,F$=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,q$=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,L$="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Ms,V$=/^(?:(?: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])$/,J$=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,K$=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,H$=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,B$=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,W$=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Vf="((\\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])))",G$=new RegExp(`^${Vf}$`);function Jf(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function X$(e){return new RegExp(`^${Jf(e)}$`)}function Y$(e){let t=`${Vf}T${Jf(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function Q$(e,t){return!!((t==="v4"||!t)&&V$.test(e)||(t==="v6"||!t)&&K$.test(e))}function eb(e,t){if(!M$.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||t&&o.alg!==t)}catch{return!1}}function tb(e,t){return!!((t==="v4"||!t)&&J$.test(e)||(t==="v6"||!t)&&H$.test(e))}var Ur=class e extends G{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==E.string){let i=this._getOrReturnCtx(t);return z(i,{code:x.invalid_type,expected:E.string,received:i.parsedType}),M}let n=new Ne,o;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),z(o,{code:x.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")t.data.length>i.value&&(o=this._getOrReturnCtx(t,o),z(o,{code:x.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let a=t.data.length>i.value,s=t.data.length<i.value;(a||s)&&(o=this._getOrReturnCtx(t,o),a?z(o,{code:x.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&z(o,{code:x.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")q$.test(t.data)||(o=this._getOrReturnCtx(t,o),z(o,{validation:"email",code:x.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Ms||(Ms=new RegExp(L$,"u")),Ms.test(t.data)||(o=this._getOrReturnCtx(t,o),z(o,{validation:"emoji",code:x.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")A$.test(t.data)||(o=this._getOrReturnCtx(t,o),z(o,{validation:"uuid",code:x.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")U$.test(t.data)||(o=this._getOrReturnCtx(t,o),z(o,{validation:"nanoid",code:x.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")R$.test(t.data)||(o=this._getOrReturnCtx(t,o),z(o,{validation:"cuid",code:x.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")C$.test(t.data)||(o=this._getOrReturnCtx(t,o),z(o,{validation:"cuid2",code:x.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")Z$.test(t.data)||(o=this._getOrReturnCtx(t,o),z(o,{validation:"ulid",code:x.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),z(o,{validation:"url",code:x.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),z(o,{validation:"regex",code:x.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(t,o),z(o,{code:x.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(o=this._getOrReturnCtx(t,o),z(o,{code:x.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),z(o,{code:x.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?Y$(i).test(t.data)||(o=this._getOrReturnCtx(t,o),z(o,{code:x.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?G$.test(t.data)||(o=this._getOrReturnCtx(t,o),z(o,{code:x.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?X$(i).test(t.data)||(o=this._getOrReturnCtx(t,o),z(o,{code:x.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?F$.test(t.data)||(o=this._getOrReturnCtx(t,o),z(o,{validation:"duration",code:x.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?Q$(t.data,i.version)||(o=this._getOrReturnCtx(t,o),z(o,{validation:"ip",code:x.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?eb(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),z(o,{validation:"jwt",code:x.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?tb(t.data,i.version)||(o=this._getOrReturnCtx(t,o),z(o,{validation:"cidr",code:x.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?B$.test(t.data)||(o=this._getOrReturnCtx(t,o),z(o,{validation:"base64",code:x.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?W$.test(t.data)||(o=this._getOrReturnCtx(t,o),z(o,{validation:"base64url",code:x.invalid_string,message:i.message}),n.dirty()):ee.assertNever(i);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(o=>t.test(o),{validation:r,code:x.invalid_string,...O.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...O.errToObj(t)})}url(t){return this._addCheck({kind:"url",...O.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...O.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...O.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...O.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...O.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...O.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...O.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...O.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...O.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...O.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...O.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...O.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...O.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...O.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...O.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...O.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...O.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...O.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...O.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...O.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...O.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...O.errToObj(r)})}nonempty(t){return this.min(1,O.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Ur.create=e=>new Ur({checks:[],typeName:C.ZodString,coerce:e?.coerce??!1,...J(e)});function rb(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(e.toFixed(o).replace(".","")),a=Number.parseInt(t.toFixed(o).replace(".",""));return i%a/10**o}var Dn=class e extends G{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==E.number){let i=this._getOrReturnCtx(t);return z(i,{code:x.invalid_type,expected:E.number,received:i.parsedType}),M}let n,o=new Ne;for(let i of this._def.checks)i.kind==="int"?ee.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),z(n,{code:x.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),z(n,{code:x.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),z(n,{code:x.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?rb(t.data,i.value)!==0&&(n=this._getOrReturnCtx(t,n),z(n,{code:x.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),z(n,{code:x.not_finite,message:i.message}),o.dirty()):ee.assertNever(i);return{status:o.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,O.toString(r))}gt(t,r){return this.setLimit("min",t,!1,O.toString(r))}lte(t,r){return this.setLimit("max",t,!0,O.toString(r))}lt(t,r){return this.setLimit("max",t,!1,O.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:O.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:O.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:O.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:O.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:O.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:O.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:O.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:O.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:O.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:O.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&ee.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};Dn.create=e=>new Dn({checks:[],typeName:C.ZodNumber,coerce:e?.coerce||!1,...J(e)});var Rn=class e extends G{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==E.bigint)return this._getInvalidInput(t);let n,o=new Ne;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),z(n,{code:x.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),z(n,{code:x.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),z(n,{code:x.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):ee.assertNever(i);return{status:o.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return z(r,{code:x.invalid_type,expected:E.bigint,received:r.parsedType}),M}gte(t,r){return this.setLimit("min",t,!0,O.toString(r))}gt(t,r){return this.setLimit("min",t,!1,O.toString(r))}lte(t,r){return this.setLimit("max",t,!0,O.toString(r))}lt(t,r){return this.setLimit("max",t,!1,O.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:O.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:O.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:O.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:O.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:O.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:O.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Rn.create=e=>new Rn({checks:[],typeName:C.ZodBigInt,coerce:e?.coerce??!1,...J(e)});var Cn=class extends G{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==E.boolean){let n=this._getOrReturnCtx(t);return z(n,{code:x.invalid_type,expected:E.boolean,received:n.parsedType}),M}return Me(t.data)}};Cn.create=e=>new Cn({typeName:C.ZodBoolean,coerce:e?.coerce||!1,...J(e)});var Zn=class e extends G{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==E.date){let i=this._getOrReturnCtx(t);return z(i,{code:x.invalid_type,expected:E.date,received:i.parsedType}),M}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return z(i,{code:x.invalid_date}),M}let n=new Ne,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),z(o,{code:x.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(o=this._getOrReturnCtx(t,o),z(o,{code:x.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):ee.assertNever(i);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:O.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:O.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};Zn.create=e=>new Zn({checks:[],coerce:e?.coerce||!1,typeName:C.ZodDate,...J(e)});var An=class extends G{_parse(t){if(this._getType(t)!==E.symbol){let n=this._getOrReturnCtx(t);return z(n,{code:x.invalid_type,expected:E.symbol,received:n.parsedType}),M}return Me(t.data)}};An.create=e=>new An({typeName:C.ZodSymbol,...J(e)});var Mr=class extends G{_parse(t){if(this._getType(t)!==E.undefined){let n=this._getOrReturnCtx(t);return z(n,{code:x.invalid_type,expected:E.undefined,received:n.parsedType}),M}return Me(t.data)}};Mr.create=e=>new Mr({typeName:C.ZodUndefined,...J(e)});var Fr=class extends G{_parse(t){if(this._getType(t)!==E.null){let n=this._getOrReturnCtx(t);return z(n,{code:x.invalid_type,expected:E.null,received:n.parsedType}),M}return Me(t.data)}};Fr.create=e=>new Fr({typeName:C.ZodNull,...J(e)});var Un=class extends G{constructor(){super(...arguments),this._any=!0}_parse(t){return Me(t.data)}};Un.create=e=>new Un({typeName:C.ZodAny,...J(e)});var Kt=class extends G{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Me(t.data)}};Kt.create=e=>new Kt({typeName:C.ZodUnknown,...J(e)});var xt=class extends G{_parse(t){let r=this._getOrReturnCtx(t);return z(r,{code:x.invalid_type,expected:E.never,received:r.parsedType}),M}};xt.create=e=>new xt({typeName:C.ZodNever,...J(e)});var Mn=class extends G{_parse(t){if(this._getType(t)!==E.undefined){let n=this._getOrReturnCtx(t);return z(n,{code:x.invalid_type,expected:E.void,received:n.parsedType}),M}return Me(t.data)}};Mn.create=e=>new Mn({typeName:C.ZodVoid,...J(e)});var Ht=class e extends G{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==E.array)return z(r,{code:x.invalid_type,expected:E.array,received:r.parsedType}),M;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&(z(r,{code:a?x.too_big:x.too_small,minimum:s?o.exactLength.value:void 0,maximum:a?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(z(r,{code:x.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(z(r,{code:x.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((a,s)=>o.type._parseAsync(new it(r,a,r.path,s)))).then(a=>Ne.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new it(r,a,r.path,s)));return Ne.mergeArray(n,i)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:O.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:O.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:O.toString(r)}})}nonempty(t){return this.min(1,t)}};Ht.create=(e,t)=>new Ht({type:e,minLength:null,maxLength:null,exactLength:null,typeName:C.ZodArray,...J(t)});function Ar(e){if(e instanceof Qe){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=mt.create(Ar(n))}return new Qe({...e._def,shape:()=>t})}else return e instanceof Ht?new Ht({...e._def,type:Ar(e.element)}):e instanceof mt?mt.create(Ar(e.unwrap())):e instanceof Dt?Dt.create(Ar(e.unwrap())):e instanceof Nt?Nt.create(e.items.map(t=>Ar(t))):e}var Qe=class e extends G{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=ee.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==E.object){let u=this._getOrReturnCtx(t);return z(u,{code:x.invalid_type,expected:E.object,received:u.parsedType}),M}let{status:n,ctx:o}=this._processInputParams(t),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof xt&&this._def.unknownKeys==="strip"))for(let u in o.data)a.includes(u)||s.push(u);let c=[];for(let u of a){let l=i[u],d=o.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new it(o,d,o.path,u)),alwaysSet:u in o.data})}if(this._def.catchall instanceof xt){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of s)c.push({key:{status:"valid",value:l},value:{status:"valid",value:o.data[l]}});else if(u==="strict")s.length>0&&(z(o,{code:x.unrecognized_keys,keys:s}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let l of s){let d=o.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new it(o,d,o.path,l)),alwaysSet:l in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let d=await l.key,p=await l.value;u.push({key:d,value:p,alwaysSet:l.alwaysSet})}return u}).then(u=>Ne.mergeObjectSync(n,u)):Ne.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return O.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:O.errToObj(t).message??o}:{message:o}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:C.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of ee.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let n of ee.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return Ar(this)}partial(t){let r={};for(let n of ee.objectKeys(this.shape)){let o=this.shape[n];t&&!t[n]?r[n]=o:r[n]=o.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of ee.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof mt;)i=i._def.innerType;r[n]=i}return new e({...this._def,shape:()=>r})}keyof(){return Kf(ee.objectKeys(this.shape))}};Qe.create=(e,t)=>new Qe({shape:()=>e,unknownKeys:"strip",catchall:xt.create(),typeName:C.ZodObject,...J(t)});Qe.strictCreate=(e,t)=>new Qe({shape:()=>e,unknownKeys:"strict",catchall:xt.create(),typeName:C.ZodObject,...J(t)});Qe.lazycreate=(e,t)=>new Qe({shape:e,unknownKeys:"strip",catchall:xt.create(),typeName:C.ZodObject,...J(t)});var qr=class extends G{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function o(i){for(let s of i)if(s.result.status==="valid")return s.result;for(let s of i)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(s=>new Ye(s.ctx.common.issues));return z(r,{code:x.invalid_union,unionErrors:a}),M}if(r.common.async)return Promise.all(n.map(async i=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(o);{let i,a=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!i&&(i={result:l,ctx:u}),u.common.issues.length&&a.push(u.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let s=a.map(c=>new Ye(c));return z(r,{code:x.invalid_union,unionErrors:s}),M}}get options(){return this._def.options}};qr.create=(e,t)=>new qr({options:e,typeName:C.ZodUnion,...J(t)});var Ot=e=>e instanceof Vr?Ot(e.schema):e instanceof ht?Ot(e.innerType()):e instanceof Jr?[e.value]:e instanceof Kr?e.options:e instanceof Hr?ee.objectValues(e.enum):e instanceof Br?Ot(e._def.innerType):e instanceof Mr?[void 0]:e instanceof Fr?[null]:e instanceof mt?[void 0,...Ot(e.unwrap())]:e instanceof Dt?[null,...Ot(e.unwrap())]:e instanceof ki||e instanceof Gr?Ot(e.unwrap()):e instanceof Wr?Ot(e._def.innerType):[],Fs=class e extends G{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==E.object)return z(r,{code:x.invalid_type,expected:E.object,received:r.parsedType}),M;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(z(r,{code:x.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),M)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let o=new Map;for(let i of r){let a=Ot(i.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let s of a){if(o.has(s))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(s)}`);o.set(s,i)}}return new e({typeName:C.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...J(n)})}};function qs(e,t){let r=Tt(e),n=Tt(t);if(e===t)return{valid:!0,data:e};if(r===E.object&&n===E.object){let o=ee.objectKeys(t),i=ee.objectKeys(e).filter(s=>o.indexOf(s)!==-1),a={...e,...t};for(let s of i){let c=qs(e[s],t[s]);if(!c.valid)return{valid:!1};a[s]=c.data}return{valid:!0,data:a}}else if(r===E.array&&n===E.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let i=0;i<e.length;i++){let a=e[i],s=t[i],c=qs(a,s);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return r===E.date&&n===E.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var Lr=class extends G{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(i,a)=>{if(As(i)||As(a))return M;let s=qs(i.value,a.value);return s.valid?((Us(i)||Us(a))&&r.dirty(),{status:r.value,value:s.data}):(z(n,{code:x.invalid_intersection_types}),M)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,a])=>o(i,a)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Lr.create=(e,t,r)=>new Lr({left:e,right:t,typeName:C.ZodIntersection,...J(r)});var Nt=class e extends G{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==E.array)return z(n,{code:x.invalid_type,expected:E.array,received:n.parsedType}),M;if(n.data.length<this._def.items.length)return z(n,{code:x.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),M;!this._def.rest&&n.data.length>this._def.items.length&&(z(n,{code:x.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((a,s)=>{let c=this._def.items[s]||this._def.rest;return c?c._parse(new it(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>Ne.mergeArray(r,a)):Ne.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Nt.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Nt({items:e,typeName:C.ZodTuple,rest:null,...J(t)})};var Ls=class e extends G{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==E.object)return z(n,{code:x.invalid_type,expected:E.object,received:n.parsedType}),M;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new it(n,s,n.path,s)),value:a._parse(new it(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?Ne.mergeObjectAsync(r,o):Ne.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof G?new e({keyType:t,valueType:r,typeName:C.ZodRecord,...J(n)}):new e({keyType:Ur.create(),valueType:t,typeName:C.ZodRecord,...J(r)})}},Fn=class extends G{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==E.map)return z(n,{code:x.invalid_type,expected:E.map,received:n.parsedType}),M;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,c],u)=>({key:o._parse(new it(n,s,n.path,[u,"key"])),value:i._parse(new it(n,c,n.path,[u,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let c of a){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return M;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),s.set(u.value,l.value)}return{status:r.value,value:s}})}else{let s=new Map;for(let c of a){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return M;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),s.set(u.value,l.value)}return{status:r.value,value:s}}}};Fn.create=(e,t,r)=>new Fn({valueType:t,keyType:e,typeName:C.ZodMap,...J(r)});var qn=class e extends G{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==E.set)return z(n,{code:x.invalid_type,expected:E.set,received:n.parsedType}),M;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(z(n,{code:x.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(z(n,{code:x.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function a(c){let u=new Set;for(let l of c){if(l.status==="aborted")return M;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let s=[...n.data.values()].map((c,u)=>i._parse(new it(n,c,n.path,u)));return n.common.async?Promise.all(s).then(c=>a(c)):a(s)}min(t,r){return new e({...this._def,minSize:{value:t,message:O.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:O.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};qn.create=(e,t)=>new qn({valueType:e,minSize:null,maxSize:null,typeName:C.ZodSet,...J(t)});var Vs=class e extends G{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==E.function)return z(r,{code:x.invalid_type,expected:E.function,received:r.parsedType}),M;function n(s,c){return xi({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,On(),Jt].filter(u=>!!u),issueData:{code:x.invalid_arguments,argumentsError:c}})}function o(s,c){return xi({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,On(),Jt].filter(u=>!!u),issueData:{code:x.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof fr){let s=this;return Me(async function(...c){let u=new Ye([]),l=await s._def.args.parseAsync(c,i).catch(f=>{throw u.addIssue(n(c,f)),u}),d=await Reflect.apply(a,this,l);return await s._def.returns._def.type.parseAsync(d,i).catch(f=>{throw u.addIssue(o(d,f)),u})})}else{let s=this;return Me(function(...c){let u=s._def.args.safeParse(c,i);if(!u.success)throw new Ye([n(c,u.error)]);let l=Reflect.apply(a,this,u.data),d=s._def.returns.safeParse(l,i);if(!d.success)throw new Ye([o(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Nt.create(t).rest(Kt.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||Nt.create([]).rest(Kt.create()),returns:r||Kt.create(),typeName:C.ZodFunction,...J(n)})}},Vr=class extends G{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Vr.create=(e,t)=>new Vr({getter:e,typeName:C.ZodLazy,...J(t)});var Jr=class extends G{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return z(r,{received:r.data,code:x.invalid_literal,expected:this._def.value}),M}return{status:"valid",value:t.data}}get value(){return this._def.value}};Jr.create=(e,t)=>new Jr({value:e,typeName:C.ZodLiteral,...J(t)});function Kf(e,t){return new Kr({values:e,typeName:C.ZodEnum,...J(t)})}var Kr=class e extends G{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return z(r,{expected:ee.joinValues(n),received:r.parsedType,code:x.invalid_type}),M}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return z(r,{received:r.data,code:x.invalid_enum_value,options:n}),M}return Me(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};Kr.create=Kf;var Hr=class extends G{_parse(t){let r=ee.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==E.string&&n.parsedType!==E.number){let o=ee.objectValues(r);return z(n,{expected:ee.joinValues(o),received:n.parsedType,code:x.invalid_type}),M}if(this._cache||(this._cache=new Set(ee.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=ee.objectValues(r);return z(n,{received:n.data,code:x.invalid_enum_value,options:o}),M}return Me(t.data)}get enum(){return this._def.values}};Hr.create=(e,t)=>new Hr({values:e,typeName:C.ZodNativeEnum,...J(t)});var fr=class extends G{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==E.promise&&r.common.async===!1)return z(r,{code:x.invalid_type,expected:E.promise,received:r.parsedType}),M;let n=r.parsedType===E.promise?r.data:Promise.resolve(r.data);return Me(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};fr.create=(e,t)=>new fr({type:e,typeName:C.ZodPromise,...J(t)});var ht=class extends G{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===C.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:a=>{z(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let a=o.transform(n.data,i);if(n.common.async)return Promise.resolve(a).then(async s=>{if(r.value==="aborted")return M;let c=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return c.status==="aborted"?M:c.status==="dirty"?Zr(c.value):r.value==="dirty"?Zr(c.value):c});{if(r.value==="aborted")return M;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?M:s.status==="dirty"?Zr(s.value):r.value==="dirty"?Zr(s.value):s}}if(o.type==="refinement"){let a=s=>{let c=o.refinement(s,i);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?M:(s.status==="dirty"&&r.dirty(),a(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?M:(s.status==="dirty"&&r.dirty(),a(s.value).then(()=>({status:r.value,value:s.value}))))}if(o.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!pr(a))return M;let s=o.transform(a.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>pr(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):M);ee.assertNever(o)}};ht.create=(e,t,r)=>new ht({schema:e,typeName:C.ZodEffects,effect:t,...J(r)});ht.createWithPreprocess=(e,t,r)=>new ht({schema:t,effect:{type:"preprocess",transform:e},typeName:C.ZodEffects,...J(r)});var mt=class extends G{_parse(t){return this._getType(t)===E.undefined?Me(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};mt.create=(e,t)=>new mt({innerType:e,typeName:C.ZodOptional,...J(t)});var Dt=class extends G{_parse(t){return this._getType(t)===E.null?Me(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Dt.create=(e,t)=>new Dt({innerType:e,typeName:C.ZodNullable,...J(t)});var Br=class extends G{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===E.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Br.create=(e,t)=>new Br({innerType:e,typeName:C.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...J(t)});var Wr=class extends G{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Nn(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Ye(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Ye(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Wr.create=(e,t)=>new Wr({innerType:e,typeName:C.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...J(t)});var Ln=class extends G{_parse(t){if(this._getType(t)!==E.nan){let n=this._getOrReturnCtx(t);return z(n,{code:x.invalid_type,expected:E.nan,received:n.parsedType}),M}return{status:"valid",value:t.data}}};Ln.create=e=>new Ln({typeName:C.ZodNaN,...J(e)});var ki=class extends G{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},wi=class e extends G{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?M:i.status==="dirty"?(r.dirty(),Zr(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?M:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:C.ZodPipeline})}},Gr=class extends G{_parse(t){let r=this._def.innerType._parse(t),n=o=>(pr(o)&&(o.value=Object.freeze(o.value)),o);return Nn(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Gr.create=(e,t)=>new Gr({innerType:e,typeName:C.ZodReadonly,...J(t)});var bT={object:Qe.lazycreate},C;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(C||(C={}));var xT=Ur.create,kT=Dn.create,wT=Ln.create,ST=Rn.create,zT=Cn.create,IT=Zn.create,PT=An.create,jT=Mr.create,ET=Fr.create,TT=Un.create,OT=Kt.create,NT=xt.create,DT=Mn.create,RT=Ht.create,nb=Qe.create,CT=Qe.strictCreate,ZT=qr.create,AT=Fs.create,UT=Lr.create,MT=Nt.create,FT=Ls.create,qT=Fn.create,LT=qn.create,VT=Vs.create,JT=Vr.create,KT=Jr.create,HT=Kr.create,BT=Hr.create,WT=fr.create,GT=ht.create,XT=mt.create,YT=Dt.create,QT=ht.createWithPreprocess,eO=wi.create;var Hf=Object.freeze({status:"aborted"});function g(e,t,r){function n(s,c){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:c,constr:a,traits:new Set},enumerable:!1}),s._zod.traits.has(e))return;s._zod.traits.add(e),t(s,c);let u=a.prototype,l=Object.keys(u);for(let d=0;d<l.length;d++){let p=l[d];p in s||(s[p]=u[p].bind(s))}}let o=r?.Parent??Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function a(s){var c;let u=r?.Parent?new i:this;n(u,s),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:s=>r?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}var kt=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},mr=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},Si={};function xe(e){return e&&Object.assign(Si,e),Si}var k={};Tn(k,{BIGINT_FORMAT_RANGES:()=>ec,Class:()=>Ks,NUMBER_FORMAT_RANGES:()=>Qs,aborted:()=>Xt,allowsEval:()=>Ws,assert:()=>lb,assertEqual:()=>ab,assertIs:()=>cb,assertNever:()=>ub,assertNotEqual:()=>sb,assignProp:()=>Wt,base64ToUint8Array:()=>tm,base64urlToUint8Array:()=>bb,cached:()=>Yr,captureStackTrace:()=>Ii,cleanEnum:()=>$b,cleanRegex:()=>Kn,clone:()=>Fe,cloneDef:()=>pb,createTransparentProxy:()=>yb,defineLazy:()=>K,esc:()=>zi,escapeRegex:()=>at,extend:()=>Xf,finalizeIssue:()=>He,floatSafeRemainder:()=>Hs,getElementAtPath:()=>fb,getEnumValues:()=>Jn,getLengthableOrigin:()=>Wn,getParsedType:()=>vb,getSizableOrigin:()=>Bn,hexToUint8Array:()=>kb,isObject:()=>hr,isPlainObject:()=>Gt,issue:()=>Qr,joinValues:()=>Z,jsonStringifyReplacer:()=>Xr,merge:()=>_b,mergeDefs:()=>Rt,normalizeParams:()=>I,nullish:()=>Bt,numKeys:()=>gb,objectClone:()=>db,omit:()=>Gf,optionalKeys:()=>Ys,parsedType:()=>F,partial:()=>Qf,pick:()=>Wf,prefixIssues:()=>et,primitiveTypes:()=>Xs,promiseAllObject:()=>mb,propertyKeyTypes:()=>Hn,randomString:()=>hb,required:()=>em,safeExtend:()=>Yf,shallowClone:()=>Gs,slugify:()=>Bs,stringifyPrimitive:()=>A,uint8ArrayToBase64:()=>rm,uint8ArrayToBase64url:()=>xb,uint8ArrayToHex:()=>wb,unwrapMessage:()=>Vn});function ab(e){return e}function sb(e){return e}function cb(e){}function ub(e){throw new Error("Unexpected value in exhaustive check")}function lb(e){}function Jn(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function Z(e,t="|"){return e.map(r=>A(r)).join(t)}function Xr(e,t){return typeof t=="bigint"?t.toString():t}function Yr(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Bt(e){return e==null}function Kn(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Hs(e,t){let r=(e.toString().split(".")[1]||"").length,n=t.toString(),o=(n.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(n)){let c=n.match(/\d?e-(\d?)/);c?.[1]&&(o=Number.parseInt(c[1]))}let i=r>o?r:o,a=Number.parseInt(e.toFixed(i).replace(".","")),s=Number.parseInt(t.toFixed(i).replace(".",""));return a%s/10**i}var Bf=Symbol("evaluating");function K(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Bf)return n===void 0&&(n=Bf,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function db(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Wt(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Rt(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function pb(e){return Rt(e._zod.def)}function fb(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function mb(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let o={};for(let i=0;i<t.length;i++)o[t[i]]=n[i];return o})}function hb(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function zi(e){return JSON.stringify(e)}function Bs(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Ii="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function hr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Ws=Yr(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Gt(e){if(hr(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(hr(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Gs(e){return Gt(e)?{...e}:Array.isArray(e)?[...e]:e}function gb(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var vb=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},Hn=new Set(["string","number","symbol"]),Xs=new Set(["string","number","bigint","boolean","symbol","undefined"]);function at(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Fe(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function I(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function yb(e){let t;return new Proxy({},{get(r,n,o){return t??(t=e()),Reflect.get(t,n,o)},set(r,n,o,i){return t??(t=e()),Reflect.set(t,n,o,i)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,o){return t??(t=e()),Reflect.defineProperty(t,n,o)}})}function A(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Ys(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Qs={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},ec={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Wf(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i=Rt(e._zod.def,{get shape(){let a={};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(a[s]=r.shape[s])}return Wt(this,"shape",a),a},checks:[]});return Fe(e,i)}function Gf(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=Rt(e._zod.def,{get shape(){let a={...e._zod.def.shape};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete a[s]}return Wt(this,"shape",a),a},checks:[]});return Fe(e,i)}function Xf(e,t){if(!Gt(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let i=e._zod.def.shape;for(let a in t)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let o=Rt(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return Wt(this,"shape",i),i}});return Fe(e,o)}function Yf(e,t){if(!Gt(t))throw new Error("Invalid input to safeExtend: expected a plain object");let r=Rt(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Wt(this,"shape",n),n}});return Fe(e,r)}function _b(e,t){let r=Rt(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Wt(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return Fe(e,r)}function Qf(e,t,r){let o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let a=Rt(t._zod.def,{get shape(){let s=t._zod.def.shape,c={...s};if(r)for(let u in r){if(!(u in s))throw new Error(`Unrecognized key: "${u}"`);r[u]&&(c[u]=e?new e({type:"optional",innerType:s[u]}):s[u])}else for(let u in s)c[u]=e?new e({type:"optional",innerType:s[u]}):s[u];return Wt(this,"shape",c),c},checks:[]});return Fe(t,a)}function em(e,t,r){let n=Rt(t._zod.def,{get shape(){let o=t._zod.def.shape,i={...o};if(r)for(let a in r){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(i[a]=new e({type:"nonoptional",innerType:o[a]}))}else for(let a in o)i[a]=new e({type:"nonoptional",innerType:o[a]});return Wt(this,"shape",i),i}});return Fe(t,n)}function Xt(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function et(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Vn(e){return typeof e=="string"?e:e?.message}function He(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let o=Vn(e.inst?._zod.def?.error?.(e))??Vn(t?.error?.(e))??Vn(r.customError?.(e))??Vn(r.localeError?.(e))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function Bn(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Wn(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function F(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function Qr(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function $b(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function tm(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function rm(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function bb(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return tm(t+r)}function xb(e){return rm(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function kb(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n/2]=Number.parseInt(t.slice(n,n+2),16);return r}function wb(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Ks=class{constructor(...t){}};var nm=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Xr,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Pi=g("$ZodError",nm),Gn=g("$ZodError",nm,{Parent:Error});function ji(e,t=r=>r.message){let r={},n=[];for(let o of e.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):n.push(t(o));return{formErrors:n,fieldErrors:r}}function Ei(e,t=r=>r.message){let r={_errors:[]},n=o=>{for(let i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>n({issues:a}));else if(i.code==="invalid_key")n({issues:i.issues});else if(i.code==="invalid_element")n({issues:i.issues});else if(i.path.length===0)r._errors.push(t(i));else{let a=r,s=0;for(;s<i.path.length;){let c=i.path[s];s===i.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(t(i))):a[c]=a[c]||{_errors:[]},a=a[c],s++}}};return n(e),r}var Xn=e=>(t,r,n,o)=>{let i=n?Object.assign(n,{async:!1}):{async:!1},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new kt;if(a.issues.length){let s=new(o?.Err??e)(a.issues.map(c=>He(c,i,xe())));throw Ii(s,o?.callee),s}return a.value},Yn=Xn(Gn),Qn=e=>async(t,r,n,o)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){let s=new(o?.Err??e)(a.issues.map(c=>He(c,i,xe())));throw Ii(s,o?.callee),s}return a.value},eo=Qn(Gn),to=e=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new kt;return i.issues.length?{success:!1,error:new(e??Pi)(i.issues.map(a=>He(a,o,xe())))}:{success:!0,data:i.value}},en=to(Gn),ro=e=>async(t,r,n)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},i=t._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(a=>He(a,o,xe())))}:{success:!0,data:i.value}},no=ro(Gn),om=e=>(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Xn(e)(t,r,o)};var im=e=>(t,r,n)=>Xn(e)(t,r,n);var am=e=>async(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Qn(e)(t,r,o)};var sm=e=>async(t,r,n)=>Qn(e)(t,r,n);var cm=e=>(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return to(e)(t,r,o)};var um=e=>(t,r,n)=>to(e)(t,r,n);var lm=e=>async(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return ro(e)(t,r,o)};var dm=e=>async(t,r,n)=>ro(e)(t,r,n);var st={};Tn(st,{base64:()=>gc,base64url:()=>Ti,bigint:()=>xc,boolean:()=>wc,browserEmail:()=>Nb,cidrv4:()=>mc,cidrv6:()=>hc,cuid:()=>tc,cuid2:()=>rc,date:()=>yc,datetime:()=>$c,domain:()=>Cb,duration:()=>sc,e164:()=>vc,email:()=>uc,emoji:()=>lc,extendedDuration:()=>zb,guid:()=>cc,hex:()=>Zb,hostname:()=>Rb,html5Email:()=>Eb,idnEmail:()=>Ob,integer:()=>kc,ipv4:()=>dc,ipv6:()=>pc,ksuid:()=>ic,lowercase:()=>Ic,mac:()=>fc,md5_base64:()=>Ub,md5_base64url:()=>Mb,md5_hex:()=>Ab,nanoid:()=>ac,null:()=>Sc,number:()=>Oi,rfc5322Email:()=>Tb,sha1_base64:()=>qb,sha1_base64url:()=>Lb,sha1_hex:()=>Fb,sha256_base64:()=>Jb,sha256_base64url:()=>Kb,sha256_hex:()=>Vb,sha384_base64:()=>Bb,sha384_base64url:()=>Wb,sha384_hex:()=>Hb,sha512_base64:()=>Xb,sha512_base64url:()=>Yb,sha512_hex:()=>Gb,string:()=>bc,time:()=>_c,ulid:()=>nc,undefined:()=>zc,unicodeEmail:()=>pm,uppercase:()=>Pc,uuid:()=>gr,uuid4:()=>Ib,uuid6:()=>Pb,uuid7:()=>jb,xid:()=>oc});var tc=/^[cC][^\s-]{8,}$/,rc=/^[0-9a-z]+$/,nc=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,oc=/^[0-9a-vA-V]{20}$/,ic=/^[A-Za-z0-9]{27}$/,ac=/^[a-zA-Z0-9_-]{21}$/,sc=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,zb=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,cc=/^([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})$/,gr=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([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)$/,Ib=gr(4),Pb=gr(6),jb=gr(7),uc=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Eb=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Tb=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,pm=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,Ob=pm,Nb=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Db="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function lc(){return new RegExp(Db,"u")}var dc=/^(?:(?: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])$/,pc=/^(([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}|:))$/,fc=e=>{let t=at(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},mc=/^((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])$/,hc=/^(([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])$/,gc=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ti=/^[A-Za-z0-9_-]*$/,Rb=/^(?=.{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])?)*\.?$/,Cb=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,vc=/^\+[1-9]\d{6,14}$/,fm="(?:(?:\\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])))",yc=new RegExp(`^${fm}$`);function mm(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function _c(e){return new RegExp(`^${mm(e)}$`)}function $c(e){let t=mm({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${t}(?:${r.join("|")})`;return new RegExp(`^${fm}T(?:${n})$`)}var bc=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},xc=/^-?\d+n?$/,kc=/^-?\d+$/,Oi=/^-?\d+(?:\.\d+)?$/,wc=/^(?:true|false)$/i,Sc=/^null$/i;var zc=/^undefined$/i;var Ic=/^[^A-Z]*$/,Pc=/^[^a-z]*$/,Zb=/^[0-9a-fA-F]*$/;function oo(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function io(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var Ab=/^[0-9a-fA-F]{32}$/,Ub=oo(22,"=="),Mb=io(22),Fb=/^[0-9a-fA-F]{40}$/,qb=oo(27,"="),Lb=io(27),Vb=/^[0-9a-fA-F]{64}$/,Jb=oo(43,"="),Kb=io(43),Hb=/^[0-9a-fA-F]{96}$/,Bb=oo(64,""),Wb=io(64),Gb=/^[0-9a-fA-F]{128}$/,Xb=oo(86,"=="),Yb=io(86);var ue=g("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),gm={number:"number",bigint:"bigint",object:"date"},jc=g("$ZodCheckLessThan",(e,t)=>{ue.init(e,t);let r=gm[typeof t.value];e._zod.onattach.push(n=>{let o=n._zod.bag,i=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ec=g("$ZodCheckGreaterThan",(e,t)=>{ue.init(e,t);let r=gm[typeof t.value];e._zod.onattach.push(n=>{let o=n._zod.bag,i=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),vm=g("$ZodCheckMultipleOf",(e,t)=>{ue.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):Hs(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),ym=g("$ZodCheckNumberFormat",(e,t)=>{ue.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,i]=Qs[t.format];e._zod.onattach.push(a=>{let s=a._zod.bag;s.format=t.format,s.minimum=o,s.maximum=i,r&&(s.pattern=kc)}),e._zod.check=a=>{let s=a.value;if(r){if(!Number.isInteger(s)){a.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}s<o&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),s>i&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),_m=g("$ZodCheckBigIntFormat",(e,t)=>{ue.init(e,t);let[r,n]=ec[t.format];e._zod.onattach.push(o=>{let i=o._zod.bag;i.format=t.format,i.minimum=r,i.maximum=n}),e._zod.check=o=>{let i=o.value;i<r&&o.issues.push({origin:"bigint",input:i,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),i>n&&o.issues.push({origin:"bigint",input:i,code:"too_big",maximum:n,inclusive:!0,inst:e,continue:!t.abort})}}),$m=g("$ZodCheckMaxSize",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Bt(o)&&o.size!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let o=n.value;o.size<=t.maximum||n.issues.push({origin:Bn(o),code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),bm=g("$ZodCheckMinSize",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Bt(o)&&o.size!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let o=n.value;o.size>=t.minimum||n.issues.push({origin:Bn(o),code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),xm=g("$ZodCheckSizeEquals",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Bt(o)&&o.size!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=t.size,o.maximum=t.size,o.size=t.size}),e._zod.check=n=>{let o=n.value,i=o.size;if(i===t.size)return;let a=i>t.size;n.issues.push({origin:Bn(o),...a?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),km=g("$ZodCheckMaxLength",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Bt(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let o=n.value;if(o.length<=t.maximum)return;let a=Wn(o);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),wm=g("$ZodCheckMinLength",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Bt(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let o=n.value;if(o.length>=t.minimum)return;let a=Wn(o);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Sm=g("$ZodCheckLengthEquals",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Bt(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=n=>{let o=n.value,i=o.length;if(i===t.length)return;let a=Wn(o),s=i>t.length;n.issues.push({origin:a,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),ao=g("$ZodCheckStringFormat",(e,t)=>{var r,n;ue.init(e,t),e._zod.onattach.push(o=>{let i=o._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),zm=g("$ZodCheckRegex",(e,t)=>{ao.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Im=g("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Ic),ao.init(e,t)}),Pm=g("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Pc),ao.init(e,t)}),jm=g("$ZodCheckIncludes",(e,t)=>{ue.init(e,t);let r=at(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(o=>{let i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Em=g("$ZodCheckStartsWith",(e,t)=>{ue.init(e,t);let r=new RegExp(`^${at(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Tm=g("$ZodCheckEndsWith",(e,t)=>{ue.init(e,t);let r=new RegExp(`.*${at(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});function hm(e,t,r){e.issues.length&&t.issues.push(...et(r,e.issues))}var Om=g("$ZodCheckProperty",(e,t)=>{ue.init(e,t),e._zod.check=r=>{let n=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(n instanceof Promise)return n.then(o=>hm(o,r,t.property));hm(n,r,t.property)}}),Nm=g("$ZodCheckMimeType",(e,t)=>{ue.init(e,t);let r=new Set(t.mime);e._zod.onattach.push(n=>{n._zod.bag.mime=t.mime}),e._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:t.mime,input:n.value.type,inst:e,continue:!t.abort})}}),Dm=g("$ZodCheckOverwrite",(e,t)=>{ue.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var Ni=class{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let n=t.split(`
10
- `).filter(a=>a),o=Math.min(...n.map(a=>a.length-a.trimStart().length)),i=n.map(a=>a.slice(o)).map(a=>" ".repeat(this.indent*2)+a);for(let a of i)this.content.push(a)}compile(){let t=Function,r=this?.args,o=[...(this?.content??[""]).map(i=>` ${i}`)];return new t(...r,o.join(`
11
- `))}};var Cm={major:4,minor:3,patch:6};var V=g("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Cm;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let o of n)for(let i of o._zod.onattach)i(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let o=(a,s,c)=>{let u=Xt(a),l;for(let d of s){if(d._zod.def.when){if(!d._zod.def.when(a))continue}else if(u)continue;let p=a.issues.length,f=d._zod.check(a);if(f instanceof Promise&&c?.async===!1)throw new kt;if(l||f instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await f,a.issues.length!==p&&(u||(u=Xt(a,p)))});else{if(a.issues.length===p)continue;u||(u=Xt(a,p))}}return l?l.then(()=>a):a},i=(a,s,c)=>{if(Xt(a))return a.aborted=!0,a;let u=o(s,n,c);if(u instanceof Promise){if(c.async===!1)throw new kt;return u.then(l=>e._zod.parse(l,c))}return e._zod.parse(u,c)};e._zod.run=(a,s)=>{if(s.skipChecks)return e._zod.parse(a,s);if(s.direction==="backward"){let u=e._zod.parse({value:a.value,issues:[]},{...s,skipChecks:!0});return u instanceof Promise?u.then(l=>i(l,a,s)):i(u,a,s)}let c=e._zod.parse(a,s);if(c instanceof Promise){if(s.async===!1)throw new kt;return c.then(u=>o(u,n,s))}return o(c,n,s)}}K(e,"~standard",()=>({validate:o=>{try{let i=en(e,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return no(e,o).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),vr=g("$ZodString",(e,t)=>{V.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??bc(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),ae=g("$ZodStringFormat",(e,t)=>{ao.init(e,t),vr.init(e,t)}),Oc=g("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=cc),ae.init(e,t)}),Nc=g("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=gr(n))}else t.pattern??(t.pattern=gr());ae.init(e,t)}),Dc=g("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=uc),ae.init(e,t)}),Rc=g("$ZodURL",(e,t)=>{ae.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),o=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=o.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Cc=g("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=lc()),ae.init(e,t)}),Zc=g("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=ac),ae.init(e,t)}),Ac=g("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=tc),ae.init(e,t)}),Uc=g("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=rc),ae.init(e,t)}),Mc=g("$ZodULID",(e,t)=>{t.pattern??(t.pattern=nc),ae.init(e,t)}),Fc=g("$ZodXID",(e,t)=>{t.pattern??(t.pattern=oc),ae.init(e,t)}),qc=g("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=ic),ae.init(e,t)}),Lc=g("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=$c(t)),ae.init(e,t)}),Vc=g("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=yc),ae.init(e,t)}),Jc=g("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=_c(t)),ae.init(e,t)}),Kc=g("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=sc),ae.init(e,t)}),Hc=g("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=dc),ae.init(e,t),e._zod.bag.format="ipv4"}),Bc=g("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=pc),ae.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),Wc=g("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=fc(t.delimiter)),ae.init(e,t),e._zod.bag.format="mac"}),Gc=g("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=mc),ae.init(e,t)}),Xc=g("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=hc),ae.init(e,t),e._zod.check=r=>{let n=r.value.split("/");try{if(n.length!==2)throw new Error;let[o,i]=n;if(!i)throw new Error;let a=Number(i);if(`${a}`!==i)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Bm(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Yc=g("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=gc),ae.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Bm(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function Qb(e){if(!Ti.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Bm(r)}var Qc=g("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Ti),ae.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{Qb(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),eu=g("$ZodE164",(e,t)=>{t.pattern??(t.pattern=vc),ae.init(e,t)});function ex(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}var tu=g("$ZodJWT",(e,t)=>{ae.init(e,t),e._zod.check=r=>{ex(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),ru=g("$ZodCustomStringFormat",(e,t)=>{ae.init(e,t),e._zod.check=r=>{t.fn(r.value)||r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),Ui=g("$ZodNumber",(e,t)=>{V.init(e,t),e._zod.pattern=e._zod.bag.pattern??Oi,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),r}}),nu=g("$ZodNumberFormat",(e,t)=>{ym.init(e,t),Ui.init(e,t)}),so=g("$ZodBoolean",(e,t)=>{V.init(e,t),e._zod.pattern=wc,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}}),Mi=g("$ZodBigInt",(e,t)=>{V.init(e,t),e._zod.pattern=xc,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}}),ou=g("$ZodBigIntFormat",(e,t)=>{_m.init(e,t),Mi.init(e,t)}),iu=g("$ZodSymbol",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return typeof o=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:e}),r}}),au=g("$ZodUndefined",(e,t)=>{V.init(e,t),e._zod.pattern=zc,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:e}),r}}),su=g("$ZodNull",(e,t)=>{V.init(e,t),e._zod.pattern=Sc,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),r}}),cu=g("$ZodAny",(e,t)=>{V.init(e,t),e._zod.parse=r=>r}),uu=g("$ZodUnknown",(e,t)=>{V.init(e,t),e._zod.parse=r=>r}),lu=g("$ZodNever",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),du=g("$ZodVoid",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),r}}),pu=g("$ZodDate",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let o=r.value,i=o instanceof Date;return i&&!Number.isNaN(o.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:e}),r}});function Zm(e,t,r){e.issues.length&&t.issues.push(...et(r,e.issues)),t.value[r]=e.value}var fu=g("$ZodArray",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=Array(o.length);let i=[];for(let a=0;a<o.length;a++){let s=o[a],c=t.element._zod.run({value:s,issues:[]},n);c instanceof Promise?i.push(c.then(u=>Zm(u,r,a))):Zm(c,r,a)}return i.length?Promise.all(i).then(()=>r):r}});function Ai(e,t,r,n,o){if(e.issues.length){if(o&&!(r in n))return;t.issues.push(...et(r,e.issues))}e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function Wm(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=Ys(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Gm(e,t,r,n,o,i){let a=[],s=o.keySet,c=o.catchall._zod,u=c.def.type,l=c.optout==="optional";for(let d in t){if(s.has(d))continue;if(u==="never"){a.push(d);continue}let p=c.run({value:t[d],issues:[]},n);p instanceof Promise?e.push(p.then(f=>Ai(f,r,d,t,l))):Ai(p,r,d,t,l)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i}),e.length?Promise.all(e).then(()=>r):r}var Xm=g("$ZodObject",(e,t)=>{if(V.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let s=t.shape;Object.defineProperty(t,"shape",{get:()=>{let c={...s};return Object.defineProperty(t,"shape",{value:c}),c}})}let n=Yr(()=>Wm(t));K(e._zod,"propValues",()=>{let s=t.shape,c={};for(let u in s){let l=s[u]._zod;if(l.values){c[u]??(c[u]=new Set);for(let d of l.values)c[u].add(d)}}return c});let o=hr,i=t.catchall,a;e._zod.parse=(s,c)=>{a??(a=n.value);let u=s.value;if(!o(u))return s.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),s;s.value={};let l=[],d=a.shape;for(let p of a.keys){let f=d[p],m=f._zod.optout==="optional",h=f._zod.run({value:u[p],issues:[]},c);h instanceof Promise?l.push(h.then(v=>Ai(v,s,p,u,m))):Ai(h,s,p,u,m)}return i?Gm(l,u,s,c,n.value,e):l.length?Promise.all(l).then(()=>s):s}}),Ym=g("$ZodObjectJIT",(e,t)=>{Xm.init(e,t);let r=e._zod.parse,n=Yr(()=>Wm(t)),o=p=>{let f=new Ni(["shape","payload","ctx"]),m=n.value,h=b=>{let S=zi(b);return`shape[${S}]._zod.run({ value: input[${S}], issues: [] }, ctx)`};f.write("const input = payload.value;");let v=Object.create(null),_=0;for(let b of m.keys)v[b]=`key_${_++}`;f.write("const newResult = {};");for(let b of m.keys){let S=v[b],P=zi(b),Oe=p[b]?._zod?.optout==="optional";f.write(`const ${S} = ${h(b)};`),Oe?f.write(`
9
+ deps: ${r}}`};var gj={keyword:"dependencies",type:"object",schemaType:"object",error:It.error,code(e){let[t,r]=vj(e);$_(e,t),b_(e,r)}};function vj({schema:e}){let t={},r={};for(let n in e){if(n==="__proto__")continue;let i=Array.isArray(e[n])?t:r;i[n]=e[n]}return[t,r]}function $_(e,t=e.schema){let{gen:r,data:n,it:i}=e;if(Object.keys(t).length===0)return;let o=r.let("missing");for(let a in t){let s=t[a];if(s.length===0)continue;let c=(0,go.propertyInData)(r,n,a,i.opts.ownProperties);e.setParams({property:a,depsCount:s.length,deps:s.join(", ")}),i.allErrors?r.if(c,()=>{for(let u of s)(0,go.checkReportMissingProp)(e,u)}):(r.if((0,uf._)`${c} && (${(0,go.checkMissingProp)(e,s,o)})`),(0,go.reportMissingProp)(e,o),r.else())}}It.validatePropertyDeps=$_;function b_(e,t=e.schema){let{gen:r,data:n,keyword:i,it:o}=e,a=r.name("valid");for(let s in t)(0,hj.alwaysValidSchema)(o,t[s])||(r.if((0,go.propertyInData)(r,n,s,o.opts.ownProperties),()=>{let c=e.subschema({keyword:i,schemaProp:s},a);e.mergeValidEvaluated(c,a)},()=>r.var(a,!0)),e.ok(a))}It.validateSchemaDeps=b_;It.default=gj});var w_=j(lf=>{"use strict";Object.defineProperty(lf,"__esModule",{value:!0});var k_=W(),yj=re(),_j={message:"property name must be valid",params:({params:e})=>(0,k_._)`{propertyName: ${e.propertyName}}`},$j={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:_j,code(e){let{gen:t,schema:r,data:n,it:i}=e;if((0,yj.alwaysValidSchema)(i,r))return;let o=t.name("valid");t.forIn("key",n,a=>{e.setParams({propertyName:a}),e.subschema({keyword:"propertyNames",data:a,dataTypes:["string"],propertyName:a,compositeRule:!0},o),t.if((0,k_.not)(o),()=>{e.error(!0),i.allErrors||t.break()})}),e.ok(o)}};lf.default=$j});var pf=j(df=>{"use strict";Object.defineProperty(df,"__esModule",{value:!0});var $s=dt(),$t=W(),bj=Lt(),bs=re(),xj={message:"must NOT have additional properties",params:({params:e})=>(0,$t._)`{additionalProperty: ${e.additionalProperty}}`},kj={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:xj,code(e){let{gen:t,schema:r,parentSchema:n,data:i,errsCount:o,it:a}=e;if(!o)throw new Error("ajv implementation error");let{allErrors:s,opts:c}=a;if(a.props=!0,c.removeAdditional!=="all"&&(0,bs.alwaysValidSchema)(a,r))return;let u=(0,$s.allSchemaProperties)(n.properties),l=(0,$s.allSchemaProperties)(n.patternProperties);d(),e.ok((0,$t._)`${o} === ${bj.default.errors}`);function d(){t.forIn("key",i,v=>{!u.length&&!l.length?m(v):t.if(f(v),()=>m(v))})}function f(v){let _;if(u.length>8){let b=(0,bs.schemaRefOrVal)(a,n.properties,"properties");_=(0,$s.isOwnProperty)(t,b,v)}else u.length?_=(0,$t.or)(...u.map(b=>(0,$t._)`${v} === ${b}`)):_=$t.nil;return l.length&&(_=(0,$t.or)(_,...l.map(b=>(0,$t._)`${(0,$s.usePattern)(e,b)}.test(${v})`))),(0,$t.not)(_)}function p(v){t.code((0,$t._)`delete ${i}[${v}]`)}function m(v){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){p(v);return}if(r===!1){e.setParams({additionalProperty:v}),e.error(),s||t.break();return}if(typeof r=="object"&&!(0,bs.alwaysValidSchema)(a,r)){let _=t.name("valid");c.removeAdditional==="failing"?(h(v,_,!1),t.if((0,$t.not)(_),()=>{e.reset(),p(v)})):(h(v,_),s||t.if((0,$t.not)(_),()=>t.break()))}}function h(v,_,b){let $={keyword:"additionalProperties",dataProp:v,dataPropType:bs.Type.Str};b===!1&&Object.assign($,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema($,_)}}};df.default=kj});var I_=j(mf=>{"use strict";Object.defineProperty(mf,"__esModule",{value:!0});var wj=Qi(),S_=dt(),ff=re(),z_=pf(),Sj={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:n,data:i,it:o}=e;o.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&z_.default.code(new wj.KeywordCxt(o,z_.default,"additionalProperties"));let a=(0,S_.allSchemaProperties)(r);for(let d of a)o.definedProperties.add(d);o.opts.unevaluated&&a.length&&o.props!==!0&&(o.props=ff.mergeEvaluated.props(t,(0,ff.toHash)(a),o.props));let s=a.filter(d=>!(0,ff.alwaysValidSchema)(o,r[d]));if(s.length===0)return;let c=t.name("valid");for(let d of s)u(d)?l(d):(t.if((0,S_.propertyInData)(t,i,d,o.opts.ownProperties)),l(d),o.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(d),e.ok(c);function u(d){return o.opts.useDefaults&&!o.compositeRule&&r[d].default!==void 0}function l(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};mf.default=Sj});var T_=j(hf=>{"use strict";Object.defineProperty(hf,"__esModule",{value:!0});var P_=dt(),xs=W(),j_=re(),E_=re(),zj={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:i,it:o}=e,{opts:a}=o,s=(0,P_.allSchemaProperties)(r),c=s.filter(h=>(0,j_.alwaysValidSchema)(o,r[h]));if(s.length===0||c.length===s.length&&(!o.opts.unevaluated||o.props===!0))return;let u=a.strictSchema&&!a.allowMatchingProperties&&i.properties,l=t.name("valid");o.props!==!0&&!(o.props instanceof xs.Name)&&(o.props=(0,E_.evaluatedPropsToName)(t,o.props));let{props:d}=o;f();function f(){for(let h of s)u&&p(h),o.allErrors?m(h):(t.var(l,!0),m(h),t.if(l))}function p(h){for(let v in u)new RegExp(h).test(v)&&(0,j_.checkStrictMode)(o,`property ${v} matches pattern ${h} (use allowMatchingProperties)`)}function m(h){t.forIn("key",n,v=>{t.if((0,xs._)`${(0,P_.usePattern)(e,h)}.test(${v})`,()=>{let _=c.includes(h);_||e.subschema({keyword:"patternProperties",schemaProp:h,dataProp:v,dataPropType:E_.Type.Str},l),o.opts.unevaluated&&d!==!0?t.assign((0,xs._)`${d}[${v}]`,!0):!_&&!o.allErrors&&t.if((0,xs.not)(l),()=>t.break())})})}}};hf.default=zj});var O_=j(gf=>{"use strict";Object.defineProperty(gf,"__esModule",{value:!0});var Ij=re(),Pj={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if((0,Ij.alwaysValidSchema)(n,r)){e.fail();return}let i=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},i),e.failResult(i,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};gf.default=Pj});var N_=j(vf=>{"use strict";Object.defineProperty(vf,"__esModule",{value:!0});var jj=dt(),Ej={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:jj.validateUnion,error:{message:"must match a schema in anyOf"}};vf.default=Ej});var D_=j(yf=>{"use strict";Object.defineProperty(yf,"__esModule",{value:!0});var ks=W(),Tj=re(),Oj={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,ks._)`{passingSchemas: ${e.passing}}`},Nj={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Oj,code(e){let{gen:t,schema:r,parentSchema:n,it:i}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(i.opts.discriminator&&n.discriminator)return;let o=r,a=t.let("valid",!1),s=t.let("passing",null),c=t.name("_valid");e.setParams({passing:s}),t.block(u),e.result(a,()=>e.reset(),()=>e.error(!0));function u(){o.forEach((l,d)=>{let f;(0,Tj.alwaysValidSchema)(i,l)?t.var(c,!0):f=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&t.if((0,ks._)`${c} && ${a}`).assign(a,!1).assign(s,(0,ks._)`[${s}, ${d}]`).else(),t.if(c,()=>{t.assign(a,!0),t.assign(s,d),f&&e.mergeEvaluated(f,ks.Name)})})}}};yf.default=Nj});var R_=j(_f=>{"use strict";Object.defineProperty(_f,"__esModule",{value:!0});var Dj=re(),Rj={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");let i=t.name("valid");r.forEach((o,a)=>{if((0,Dj.alwaysValidSchema)(n,o))return;let s=e.subschema({keyword:"allOf",schemaProp:a},i);e.ok(i),e.mergeEvaluated(s)})}};_f.default=Rj});var A_=j($f=>{"use strict";Object.defineProperty($f,"__esModule",{value:!0});var ws=W(),Z_=re(),Cj={message:({params:e})=>(0,ws.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,ws._)`{failingKeyword: ${e.ifClause}}`},Zj={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Cj,code(e){let{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,Z_.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let i=C_(n,"then"),o=C_(n,"else");if(!i&&!o)return;let a=t.let("valid",!0),s=t.name("_valid");if(c(),e.reset(),i&&o){let l=t.let("ifClause");e.setParams({ifClause:l}),t.if(s,u("then",l),u("else",l))}else i?t.if(s,u("then")):t.if((0,ws.not)(s),u("else"));e.pass(a,()=>e.error(!0));function c(){let l=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},s);e.mergeEvaluated(l)}function u(l,d){return()=>{let f=e.subschema({keyword:l},s);t.assign(a,s),e.mergeValidEvaluated(f,a),d?t.assign(d,(0,ws._)`${l}`):e.setParams({ifClause:l})}}}};function C_(e,t){let r=e.schema[t];return r!==void 0&&!(0,Z_.alwaysValidSchema)(e,r)}$f.default=Zj});var U_=j(bf=>{"use strict";Object.defineProperty(bf,"__esModule",{value:!0});var Aj=re(),Uj={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,Aj.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};bf.default=Uj});var M_=j(xf=>{"use strict";Object.defineProperty(xf,"__esModule",{value:!0});var Mj=nf(),Fj=g_(),Lj=of(),qj=y_(),Vj=__(),Jj=x_(),Kj=w_(),Bj=pf(),Hj=I_(),Wj=T_(),Gj=O_(),Xj=N_(),Yj=D_(),Qj=R_(),eE=A_(),tE=U_();function rE(e=!1){let t=[Gj.default,Xj.default,Yj.default,Qj.default,eE.default,tE.default,Kj.default,Bj.default,Jj.default,Hj.default,Wj.default];return e?t.push(Fj.default,qj.default):t.push(Mj.default,Lj.default),t.push(Vj.default),t}xf.default=rE});var F_=j(kf=>{"use strict";Object.defineProperty(kf,"__esModule",{value:!0});var _e=W(),nE={message:({schemaCode:e})=>(0,_e.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,_e._)`{format: ${e}}`},iE={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:nE,code(e,t){let{gen:r,data:n,$data:i,schema:o,schemaCode:a,it:s}=e,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=s;if(!c.validateFormats)return;i?f():p();function f(){let m=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),h=r.const("fDef",(0,_e._)`${m}[${a}]`),v=r.let("fType"),_=r.let("format");r.if((0,_e._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(v,(0,_e._)`${h}.type || "string"`).assign(_,(0,_e._)`${h}.validate`),()=>r.assign(v,(0,_e._)`"string"`).assign(_,h)),e.fail$data((0,_e.or)(b(),$()));function b(){return c.strictSchema===!1?_e.nil:(0,_e._)`${a} && !${_}`}function $(){let S=l.$async?(0,_e._)`(${h}.async ? await ${_}(${n}) : ${_}(${n}))`:(0,_e._)`${_}(${n})`,P=(0,_e._)`(typeof ${_} == "function" ? ${S} : ${_}.test(${n}))`;return(0,_e._)`${_} && ${_} !== true && ${v} === ${t} && !${P}`}}function p(){let m=d.formats[o];if(!m){b();return}if(m===!0)return;let[h,v,_]=$(m);h===t&&e.pass(S());function b(){if(c.strictSchema===!1){d.logger.warn(P());return}throw new Error(P());function P(){return`unknown format "${o}" ignored in schema at path "${u}"`}}function $(P){let $e=P instanceof RegExp?(0,_e.regexpCode)(P):c.code.formats?(0,_e._)`${c.code.formats}${(0,_e.getProperty)(o)}`:void 0,be=r.scopeValue("formats",{key:o,ref:P,code:$e});return typeof P=="object"&&!(P instanceof RegExp)?[P.type||"string",P.validate,(0,_e._)`${be}.validate`]:["string",P,be]}function S(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!l.$async)throw new Error("async format in sync schema");return(0,_e._)`await ${_}(${n})`}return typeof v=="function"?(0,_e._)`${_}(${n})`:(0,_e._)`${_}.test(${n})`}}}};kf.default=iE});var L_=j(wf=>{"use strict";Object.defineProperty(wf,"__esModule",{value:!0});var oE=F_(),aE=[oE.default];wf.default=aE});var q_=j(kn=>{"use strict";Object.defineProperty(kn,"__esModule",{value:!0});kn.contentVocabulary=kn.metadataVocabulary=void 0;kn.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];kn.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var J_=j(Sf=>{"use strict";Object.defineProperty(Sf,"__esModule",{value:!0});var sE=Yy(),cE=p_(),uE=M_(),lE=L_(),V_=q_(),dE=[sE.default,cE.default,(0,uE.default)(),lE.default,V_.metadataVocabulary,V_.contentVocabulary];Sf.default=dE});var B_=j(Ss=>{"use strict";Object.defineProperty(Ss,"__esModule",{value:!0});Ss.DiscrError=void 0;var K_;(function(e){e.Tag="tag",e.Mapping="mapping"})(K_||(Ss.DiscrError=K_={}))});var W_=j(If=>{"use strict";Object.defineProperty(If,"__esModule",{value:!0});var wn=W(),zf=B_(),H_=os(),pE=eo(),fE=re(),mE={message:({params:{discrError:e,tagName:t}})=>e===zf.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,wn._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},hE={keyword:"discriminator",type:"object",schemaType:"object",error:mE,code(e){let{gen:t,data:r,schema:n,parentSchema:i,it:o}=e,{oneOf:a}=i;if(!o.opts.discriminator)throw new Error("discriminator: requires discriminator option");let s=n.propertyName;if(typeof s!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!a)throw new Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),u=t.const("tag",(0,wn._)`${r}${(0,wn.getProperty)(s)}`);t.if((0,wn._)`typeof ${u} == "string"`,()=>l(),()=>e.error(!1,{discrError:zf.DiscrError.Tag,tag:u,tagName:s})),e.ok(c);function l(){let p=f();t.if(!1);for(let m in p)t.elseIf((0,wn._)`${u} === ${m}`),t.assign(c,d(p[m]));t.else(),e.error(!1,{discrError:zf.DiscrError.Mapping,tag:u,tagName:s}),t.endIf()}function d(p){let m=t.name("valid"),h=e.subschema({keyword:"oneOf",schemaProp:p},m);return e.mergeEvaluated(h,wn.Name),m}function f(){var p;let m={},h=_(i),v=!0;for(let S=0;S<a.length;S++){let P=a[S];if(P?.$ref&&!(0,fE.schemaHasRulesButRef)(P,o.self.RULES)){let be=P.$ref;if(P=H_.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,be),P instanceof H_.SchemaEnv&&(P=P.schema),P===void 0)throw new pE.default(o.opts.uriResolver,o.baseId,be)}let $e=(p=P?.properties)===null||p===void 0?void 0:p[s];if(typeof $e!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${s}"`);v=v&&(h||_(P)),b($e,S)}if(!v)throw new Error(`discriminator: "${s}" must be required`);return m;function _({required:S}){return Array.isArray(S)&&S.includes(s)}function b(S,P){if(S.const)$(S.const,P);else if(S.enum)for(let $e of S.enum)$($e,P);else throw new Error(`discriminator: "properties/${s}" must have "const" or "enum"`)}function $(S,P){if(typeof S!="string"||S in m)throw new Error(`discriminator: "${s}" values must be unique strings`);m[S]=P}}}};If.default=hE});var G_=j((DU,gE)=>{gE.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 jf=j((ve,Pf)=>{"use strict";Object.defineProperty(ve,"__esModule",{value:!0});ve.MissingRefError=ve.ValidationError=ve.CodeGen=ve.Name=ve.nil=ve.stringify=ve.str=ve._=ve.KeywordCxt=ve.Ajv=void 0;var vE=Ky(),yE=J_(),_E=W_(),X_=G_(),$E=["/properties"],zs="http://json-schema.org/draft-07/schema",Sn=class extends vE.default{_addVocabularies(){super._addVocabularies(),yE.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(_E.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(X_,$E):X_;this.addMetaSchema(t,zs,!1),this.refs["http://json-schema.org/schema"]=zs}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(zs)?zs:void 0)}};ve.Ajv=Sn;Pf.exports=ve=Sn;Pf.exports.Ajv=Sn;Object.defineProperty(ve,"__esModule",{value:!0});ve.default=Sn;var bE=Qi();Object.defineProperty(ve,"KeywordCxt",{enumerable:!0,get:function(){return bE.KeywordCxt}});var zn=W();Object.defineProperty(ve,"_",{enumerable:!0,get:function(){return zn._}});Object.defineProperty(ve,"str",{enumerable:!0,get:function(){return zn.str}});Object.defineProperty(ve,"stringify",{enumerable:!0,get:function(){return zn.stringify}});Object.defineProperty(ve,"nil",{enumerable:!0,get:function(){return zn.nil}});Object.defineProperty(ve,"Name",{enumerable:!0,get:function(){return zn.Name}});Object.defineProperty(ve,"CodeGen",{enumerable:!0,get:function(){return zn.CodeGen}});var xE=ns();Object.defineProperty(ve,"ValidationError",{enumerable:!0,get:function(){return xE.default}});var kE=eo();Object.defineProperty(ve,"MissingRefError",{enumerable:!0,get:function(){return kE.default}})});var o$=j(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.formatNames=jt.fastFormats=jt.fullFormats=void 0;function Pt(e,t){return{validate:e,compare:t}}jt.fullFormats={date:Pt(t$,Nf),time:Pt(Tf(!0),Df),"date-time":Pt(Y_(!0),n$),"iso-time":Pt(Tf(),r$),"iso-date-time":Pt(Y_(),i$),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:jE,"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:CE,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:EE,int32:{type:"number",validate:NE},int64:{type:"number",validate:DE},float:{type:"number",validate:e$},double:{type:"number",validate:e$},password:!0,binary:!0};jt.fastFormats={...jt.fullFormats,date:Pt(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Nf),time:Pt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Df),"date-time":Pt(/^\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,n$),"iso-time":Pt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,r$),"iso-date-time":Pt(/^\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,i$),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};jt.formatNames=Object.keys(jt.fullFormats);function wE(e){return e%4===0&&(e%100!==0||e%400===0)}var SE=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,zE=[0,31,28,31,30,31,30,31,31,30,31,30,31];function t$(e){let t=SE.exec(e);if(!t)return!1;let r=+t[1],n=+t[2],i=+t[3];return n>=1&&n<=12&&i>=1&&i<=(n===2&&wE(r)?29:zE[n])}function Nf(e,t){if(e&&t)return e>t?1:e<t?-1:0}var Ef=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Tf(e){return function(r){let n=Ef.exec(r);if(!n)return!1;let i=+n[1],o=+n[2],a=+n[3],s=n[4],c=n[5]==="-"?-1:1,u=+(n[6]||0),l=+(n[7]||0);if(u>23||l>59||e&&!s)return!1;if(i<=23&&o<=59&&a<60)return!0;let d=o-l*c,f=i-u*c-(d<0?1:0);return(f===23||f===-1)&&(d===59||d===-1)&&a<61}}function Df(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),n=new Date("2020-01-01T"+t).valueOf();if(r&&n)return r-n}function r$(e,t){if(!(e&&t))return;let r=Ef.exec(e),n=Ef.exec(t);if(r&&n)return e=r[1]+r[2]+r[3],t=n[1]+n[2]+n[3],e>t?1:e<t?-1:0}var Of=/t|\s/i;function Y_(e){let t=Tf(e);return function(n){let i=n.split(Of);return i.length===2&&t$(i[0])&&t(i[1])}}function n$(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),n=new Date(t).valueOf();if(r&&n)return r-n}function i$(e,t){if(!(e&&t))return;let[r,n]=e.split(Of),[i,o]=t.split(Of),a=Nf(r,i);if(a!==void 0)return a||Df(n,o)}var IE=/\/|:/,PE=/^(?:[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 jE(e){return IE.test(e)&&PE.test(e)}var Q_=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function EE(e){return Q_.lastIndex=0,Q_.test(e)}var TE=-(2**31),OE=2**31-1;function NE(e){return Number.isInteger(e)&&e<=OE&&e>=TE}function DE(e){return Number.isInteger(e)}function e$(){return!0}var RE=/[^\\]\\Z/;function CE(e){if(RE.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var a$=j(In=>{"use strict";Object.defineProperty(In,"__esModule",{value:!0});In.formatLimitDefinition=void 0;var ZE=jf(),bt=W(),lr=bt.operators,Is={formatMaximum:{okStr:"<=",ok:lr.LTE,fail:lr.GT},formatMinimum:{okStr:">=",ok:lr.GTE,fail:lr.LT},formatExclusiveMaximum:{okStr:"<",ok:lr.LT,fail:lr.GTE},formatExclusiveMinimum:{okStr:">",ok:lr.GT,fail:lr.LTE}},AE={message:({keyword:e,schemaCode:t})=>(0,bt.str)`should be ${Is[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,bt._)`{comparison: ${Is[e].okStr}, limit: ${t}}`};In.formatLimitDefinition={keyword:Object.keys(Is),type:"string",schemaType:"string",$data:!0,error:AE,code(e){let{gen:t,data:r,schemaCode:n,keyword:i,it:o}=e,{opts:a,self:s}=o;if(!a.validateFormats)return;let c=new ZE.KeywordCxt(o,s.RULES.all.format.definition,"format");c.$data?u():l();function u(){let f=t.scopeValue("formats",{ref:s.formats,code:a.code.formats}),p=t.const("fmt",(0,bt._)`${f}[${c.schemaCode}]`);e.fail$data((0,bt.or)((0,bt._)`typeof ${p} != "object"`,(0,bt._)`${p} instanceof RegExp`,(0,bt._)`typeof ${p}.compare != "function"`,d(p)))}function l(){let f=c.schema,p=s.formats[f];if(!p||p===!0)return;if(typeof p!="object"||p instanceof RegExp||typeof p.compare!="function")throw new Error(`"${i}": format "${f}" does not define "compare" function`);let m=t.scopeValue("formats",{key:f,ref:p,code:a.code.formats?(0,bt._)`${a.code.formats}${(0,bt.getProperty)(f)}`:void 0});e.fail$data(d(m))}function d(f){return(0,bt._)`${f}.compare(${r}, ${n}) ${Is[i].fail} 0`}},dependencies:["format"]};var UE=e=>(e.addKeyword(In.formatLimitDefinition),e);In.default=UE});var l$=j((vo,u$)=>{"use strict";Object.defineProperty(vo,"__esModule",{value:!0});var Pn=o$(),ME=a$(),Rf=W(),s$=new Rf.Name("fullFormats"),FE=new Rf.Name("fastFormats"),Cf=(e,t={keywords:!0})=>{if(Array.isArray(t))return c$(e,t,Pn.fullFormats,s$),e;let[r,n]=t.mode==="fast"?[Pn.fastFormats,FE]:[Pn.fullFormats,s$],i=t.formats||Pn.formatNames;return c$(e,i,r,n),t.keywords&&(0,ME.default)(e),e};Cf.get=(e,t="full")=>{let n=(t==="fast"?Pn.fastFormats:Pn.fullFormats)[e];if(!n)throw new Error(`Unknown format "${e}"`);return n};function c$(e,t,r,n){var i,o;(i=(o=e.opts.code).formats)!==null&&i!==void 0||(o.formats=(0,Rf._)`require("ajv-formats/dist/formats").${n}`);for(let a of t)e.addFormat(a,r[a])}u$.exports=vo=Cf;Object.defineProperty(vo,"__esModule",{value:!0});vo.default=Cf});var ze=it(require("path")),Cr=it(require("fs")),S$=it(require("os"));var ee;(function(e){e.assertEqual=i=>{};function t(i){}e.assertIs=t;function r(i){throw new Error}e.assertNever=r,e.arrayToEnum=i=>{let o={};for(let a of i)o[a]=a;return o},e.getValidEnumValues=i=>{let o=e.objectKeys(i).filter(s=>typeof i[i[s]]!="number"),a={};for(let s of o)a[s]=i[s];return e.objectValues(a)},e.objectValues=i=>e.objectKeys(i).map(function(o){return i[o]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let o=[];for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&o.push(a);return o},e.find=(i,o)=>{for(let a of i)if(o(a))return a},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,o=" | "){return i.map(a=>typeof a=="string"?`'${a}'`:a).join(o)}e.joinValues=n,e.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(ee||(ee={}));var qf;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(qf||(qf={}));var E=ee.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Et=e=>{switch(typeof e){case"undefined":return E.undefined;case"string":return E.string;case"number":return Number.isNaN(e)?E.nan:E.number;case"boolean":return E.boolean;case"function":return E.function;case"bigint":return E.bigint;case"symbol":return E.symbol;case"object":return Array.isArray(e)?E.array:e===null?E.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?E.promise:typeof Map<"u"&&e instanceof Map?E.map:typeof Set<"u"&&e instanceof Set?E.set:typeof Date<"u"&&e instanceof Date?E.date:E.object;default:return E.unknown}};var x=ee.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);var Ye=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(o){return o.message},n={_errors:[]},i=o=>{for(let a of o.issues)if(a.code==="invalid_union")a.unionErrors.map(i);else if(a.code==="invalid_return_type")i(a.returnTypeError);else if(a.code==="invalid_arguments")i(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let s=n,c=0;for(;c<a.path.length;){let u=a.path[c];c===a.path.length-1?(s[u]=s[u]||{_errors:[]},s[u]._errors.push(r(a))):s[u]=s[u]||{_errors:[]},s=s[u],c++}}};return i(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ee.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r=Object.create(null),n=[];for(let i of this.issues)if(i.path.length>0){let o=i.path[0];r[o]=r[o]||[],r[o].push(t(i))}else n.push(t(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Ye.create=e=>new Ye(e);var D$=(e,t)=>{let r;switch(e.code){case x.invalid_type:e.received===E.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case x.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,ee.jsonStringifyReplacer)}`;break;case x.unrecognized_keys:r=`Unrecognized key(s) in object: ${ee.joinValues(e.keys,", ")}`;break;case x.invalid_union:r="Invalid input";break;case x.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ee.joinValues(e.options)}`;break;case x.invalid_enum_value:r=`Invalid enum value. Expected ${ee.joinValues(e.options)}, received '${e.received}'`;break;case x.invalid_arguments:r="Invalid function arguments";break;case x.invalid_return_type:r="Invalid function return type";break;case x.invalid_date:r="Invalid date";break;case x.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:ee.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case x.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case x.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case x.custom:r="Invalid input";break;case x.invalid_intersection_types:r="Intersection results could not be merged";break;case x.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case x.not_finite:r="Number must be finite";break;default:r=t.defaultError,ee.assertNever(e)}return{message:r}},Jt=D$;var R$=Jt;function On(){return R$}var xo=e=>{let{data:t,path:r,errorMaps:n,issueData:i}=e,o=[...r,...i.path||[]],a={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let s="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)s=u(a,{data:t,defaultError:s}).message;return{...i,path:o,message:s}};function z(e,t){let r=On(),n=xo({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Jt?void 0:Jt].filter(i=>!!i)});e.common.issues.push(n)}var Ne=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let i of r){if(i.status==="aborted")return F;i.status==="dirty"&&t.dirty(),n.push(i.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let i of r){let o=await i.key,a=await i.value;n.push({key:o,value:a})}return e.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let i of r){let{key:o,value:a}=i;if(o.status==="aborted"||a.status==="aborted")return F;o.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof a.value<"u"||i.alwaysSet)&&(n[o.value]=a.value)}return{status:t.value,value:n}}},F=Object.freeze({status:"aborted"}),Ar=e=>({status:"dirty",value:e}),Me=e=>({status:"valid",value:e}),As=e=>e.status==="aborted",Us=e=>e.status==="dirty",pr=e=>e.status==="valid",Nn=e=>typeof Promise<"u"&&e instanceof Promise;var O;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(O||(O={}));var ot=class{constructor(t,r,n,i){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Vf=(e,t)=>{if(pr(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Ye(e.common.issues);return this._error=r,this._error}}};function J(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:i}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(a,s)=>{let{message:c}=e;return a.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:c??n??s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:c??r??s.defaultError}},description:i}}var G=class{get description(){return this._def.description}_getType(t){return Et(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Et(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Ne,ctx:{common:t.parent.common,data:t.data,parsedType:Et(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(Nn(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Et(t)},i=this._parseSync({data:t,path:n.path,parent:n});return Vf(n,i)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Et(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return pr(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(n=>pr(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Et(t)},i=this._parse({data:t,path:n.path,parent:n}),o=await(Nn(i)?i:Promise.resolve(i));return Vf(n,o)}refine(t,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,o)=>{let a=t(i),s=()=>o.addIssue({code:x.custom,...n(i)});return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(t,r){return this._refinement((n,i)=>t(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(t){return new ht({schema:this,typeName:A.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return mt.create(this,this._def)}nullable(){return Nt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Bt.create(this)}promise(){return fr.create(this,this._def)}or(t){return qr.create([this,t],this._def)}and(t){return Vr.create(this,t,this._def)}transform(t){return new ht({...J(this._def),schema:this,typeName:A.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new Wr({...J(this._def),innerType:this,defaultValue:r,typeName:A.ZodDefault})}brand(){return new ko({typeName:A.ZodBranded,type:this,...J(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new Gr({...J(this._def),innerType:this,catchValue:r,typeName:A.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return wo.create(this,t)}readonly(){return Xr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},C$=/^c[^\s-]{8,}$/i,Z$=/^[0-9a-z]+$/,A$=/^[0-9A-HJKMNP-TV-Z]{26}$/i,U$=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,M$=/^[a-z0-9_-]{21}$/i,F$=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,L$=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,q$=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,V$="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Ms,J$=/^(?:(?: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])$/,K$=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,B$=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,H$=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,W$=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,G$=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Jf="((\\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])))",X$=new RegExp(`^${Jf}$`);function Kf(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function Y$(e){return new RegExp(`^${Kf(e)}$`)}function Q$(e){let t=`${Jf}T${Kf(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function eb(e,t){return!!((t==="v4"||!t)&&J$.test(e)||(t==="v6"||!t)&&B$.test(e))}function tb(e,t){if(!F$.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||t&&i.alg!==t)}catch{return!1}}function rb(e,t){return!!((t==="v4"||!t)&&K$.test(e)||(t==="v6"||!t)&&H$.test(e))}var Mr=class e extends G{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==E.string){let o=this._getOrReturnCtx(t);return z(o,{code:x.invalid_type,expected:E.string,received:o.parsedType}),F}let n=new Ne,i;for(let o of this._def.checks)if(o.kind==="min")t.data.length<o.value&&(i=this._getOrReturnCtx(t,i),z(i,{code:x.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="max")t.data.length>o.value&&(i=this._getOrReturnCtx(t,i),z(i,{code:x.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){let a=t.data.length>o.value,s=t.data.length<o.value;(a||s)&&(i=this._getOrReturnCtx(t,i),a?z(i,{code:x.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):s&&z(i,{code:x.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind==="email")q$.test(t.data)||(i=this._getOrReturnCtx(t,i),z(i,{validation:"email",code:x.invalid_string,message:o.message}),n.dirty());else if(o.kind==="emoji")Ms||(Ms=new RegExp(V$,"u")),Ms.test(t.data)||(i=this._getOrReturnCtx(t,i),z(i,{validation:"emoji",code:x.invalid_string,message:o.message}),n.dirty());else if(o.kind==="uuid")U$.test(t.data)||(i=this._getOrReturnCtx(t,i),z(i,{validation:"uuid",code:x.invalid_string,message:o.message}),n.dirty());else if(o.kind==="nanoid")M$.test(t.data)||(i=this._getOrReturnCtx(t,i),z(i,{validation:"nanoid",code:x.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid")C$.test(t.data)||(i=this._getOrReturnCtx(t,i),z(i,{validation:"cuid",code:x.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid2")Z$.test(t.data)||(i=this._getOrReturnCtx(t,i),z(i,{validation:"cuid2",code:x.invalid_string,message:o.message}),n.dirty());else if(o.kind==="ulid")A$.test(t.data)||(i=this._getOrReturnCtx(t,i),z(i,{validation:"ulid",code:x.invalid_string,message:o.message}),n.dirty());else if(o.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),z(i,{validation:"url",code:x.invalid_string,message:o.message}),n.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),z(i,{validation:"regex",code:x.invalid_string,message:o.message}),n.dirty())):o.kind==="trim"?t.data=t.data.trim():o.kind==="includes"?t.data.includes(o.value,o.position)||(i=this._getOrReturnCtx(t,i),z(i,{code:x.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),n.dirty()):o.kind==="toLowerCase"?t.data=t.data.toLowerCase():o.kind==="toUpperCase"?t.data=t.data.toUpperCase():o.kind==="startsWith"?t.data.startsWith(o.value)||(i=this._getOrReturnCtx(t,i),z(i,{code:x.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind==="endsWith"?t.data.endsWith(o.value)||(i=this._getOrReturnCtx(t,i),z(i,{code:x.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind==="datetime"?Q$(o).test(t.data)||(i=this._getOrReturnCtx(t,i),z(i,{code:x.invalid_string,validation:"datetime",message:o.message}),n.dirty()):o.kind==="date"?X$.test(t.data)||(i=this._getOrReturnCtx(t,i),z(i,{code:x.invalid_string,validation:"date",message:o.message}),n.dirty()):o.kind==="time"?Y$(o).test(t.data)||(i=this._getOrReturnCtx(t,i),z(i,{code:x.invalid_string,validation:"time",message:o.message}),n.dirty()):o.kind==="duration"?L$.test(t.data)||(i=this._getOrReturnCtx(t,i),z(i,{validation:"duration",code:x.invalid_string,message:o.message}),n.dirty()):o.kind==="ip"?eb(t.data,o.version)||(i=this._getOrReturnCtx(t,i),z(i,{validation:"ip",code:x.invalid_string,message:o.message}),n.dirty()):o.kind==="jwt"?tb(t.data,o.alg)||(i=this._getOrReturnCtx(t,i),z(i,{validation:"jwt",code:x.invalid_string,message:o.message}),n.dirty()):o.kind==="cidr"?rb(t.data,o.version)||(i=this._getOrReturnCtx(t,i),z(i,{validation:"cidr",code:x.invalid_string,message:o.message}),n.dirty()):o.kind==="base64"?W$.test(t.data)||(i=this._getOrReturnCtx(t,i),z(i,{validation:"base64",code:x.invalid_string,message:o.message}),n.dirty()):o.kind==="base64url"?G$.test(t.data)||(i=this._getOrReturnCtx(t,i),z(i,{validation:"base64url",code:x.invalid_string,message:o.message}),n.dirty()):ee.assertNever(o);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(i=>t.test(i),{validation:r,code:x.invalid_string,...O.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...O.errToObj(t)})}url(t){return this._addCheck({kind:"url",...O.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...O.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...O.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...O.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...O.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...O.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...O.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...O.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...O.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...O.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...O.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...O.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...O.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...O.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...O.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...O.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...O.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...O.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...O.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...O.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...O.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...O.errToObj(r)})}nonempty(t){return this.min(1,O.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Mr.create=e=>new Mr({checks:[],typeName:A.ZodString,coerce:e?.coerce??!1,...J(e)});function nb(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n,o=Number.parseInt(e.toFixed(i).replace(".","")),a=Number.parseInt(t.toFixed(i).replace(".",""));return o%a/10**i}var Dn=class e extends G{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==E.number){let o=this._getOrReturnCtx(t);return z(o,{code:x.invalid_type,expected:E.number,received:o.parsedType}),F}let n,i=new Ne;for(let o of this._def.checks)o.kind==="int"?ee.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),z(n,{code:x.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(n=this._getOrReturnCtx(t,n),z(n,{code:x.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),z(n,{code:x.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?nb(t.data,o.value)!==0&&(n=this._getOrReturnCtx(t,n),z(n,{code:x.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),z(n,{code:x.not_finite,message:o.message}),i.dirty()):ee.assertNever(o);return{status:i.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,O.toString(r))}gt(t,r){return this.setLimit("min",t,!1,O.toString(r))}lte(t,r){return this.setLimit("max",t,!0,O.toString(r))}lt(t,r){return this.setLimit("max",t,!1,O.toString(r))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:O.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:O.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:O.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:O.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:O.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:O.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:O.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:O.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:O.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:O.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&ee.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};Dn.create=e=>new Dn({checks:[],typeName:A.ZodNumber,coerce:e?.coerce||!1,...J(e)});var Rn=class e extends G{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==E.bigint)return this._getInvalidInput(t);let n,i=new Ne;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(n=this._getOrReturnCtx(t,n),z(n,{code:x.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),z(n,{code:x.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),z(n,{code:x.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):ee.assertNever(o);return{status:i.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return z(r,{code:x.invalid_type,expected:E.bigint,received:r.parsedType}),F}gte(t,r){return this.setLimit("min",t,!0,O.toString(r))}gt(t,r){return this.setLimit("min",t,!1,O.toString(r))}lte(t,r){return this.setLimit("max",t,!0,O.toString(r))}lt(t,r){return this.setLimit("max",t,!1,O.toString(r))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:O.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:O.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:O.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:O.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:O.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:O.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Rn.create=e=>new Rn({checks:[],typeName:A.ZodBigInt,coerce:e?.coerce??!1,...J(e)});var Cn=class extends G{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==E.boolean){let n=this._getOrReturnCtx(t);return z(n,{code:x.invalid_type,expected:E.boolean,received:n.parsedType}),F}return Me(t.data)}};Cn.create=e=>new Cn({typeName:A.ZodBoolean,coerce:e?.coerce||!1,...J(e)});var Zn=class e extends G{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==E.date){let o=this._getOrReturnCtx(t);return z(o,{code:x.invalid_type,expected:E.date,received:o.parsedType}),F}if(Number.isNaN(t.data.getTime())){let o=this._getOrReturnCtx(t);return z(o,{code:x.invalid_date}),F}let n=new Ne,i;for(let o of this._def.checks)o.kind==="min"?t.data.getTime()<o.value&&(i=this._getOrReturnCtx(t,i),z(i,{code:x.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),n.dirty()):o.kind==="max"?t.data.getTime()>o.value&&(i=this._getOrReturnCtx(t,i),z(i,{code:x.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):ee.assertNever(o);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:O.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:O.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};Zn.create=e=>new Zn({checks:[],coerce:e?.coerce||!1,typeName:A.ZodDate,...J(e)});var An=class extends G{_parse(t){if(this._getType(t)!==E.symbol){let n=this._getOrReturnCtx(t);return z(n,{code:x.invalid_type,expected:E.symbol,received:n.parsedType}),F}return Me(t.data)}};An.create=e=>new An({typeName:A.ZodSymbol,...J(e)});var Fr=class extends G{_parse(t){if(this._getType(t)!==E.undefined){let n=this._getOrReturnCtx(t);return z(n,{code:x.invalid_type,expected:E.undefined,received:n.parsedType}),F}return Me(t.data)}};Fr.create=e=>new Fr({typeName:A.ZodUndefined,...J(e)});var Lr=class extends G{_parse(t){if(this._getType(t)!==E.null){let n=this._getOrReturnCtx(t);return z(n,{code:x.invalid_type,expected:E.null,received:n.parsedType}),F}return Me(t.data)}};Lr.create=e=>new Lr({typeName:A.ZodNull,...J(e)});var Un=class extends G{constructor(){super(...arguments),this._any=!0}_parse(t){return Me(t.data)}};Un.create=e=>new Un({typeName:A.ZodAny,...J(e)});var Kt=class extends G{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Me(t.data)}};Kt.create=e=>new Kt({typeName:A.ZodUnknown,...J(e)});var xt=class extends G{_parse(t){let r=this._getOrReturnCtx(t);return z(r,{code:x.invalid_type,expected:E.never,received:r.parsedType}),F}};xt.create=e=>new xt({typeName:A.ZodNever,...J(e)});var Mn=class extends G{_parse(t){if(this._getType(t)!==E.undefined){let n=this._getOrReturnCtx(t);return z(n,{code:x.invalid_type,expected:E.void,received:n.parsedType}),F}return Me(t.data)}};Mn.create=e=>new Mn({typeName:A.ZodVoid,...J(e)});var Bt=class e extends G{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),i=this._def;if(r.parsedType!==E.array)return z(r,{code:x.invalid_type,expected:E.array,received:r.parsedType}),F;if(i.exactLength!==null){let a=r.data.length>i.exactLength.value,s=r.data.length<i.exactLength.value;(a||s)&&(z(r,{code:a?x.too_big:x.too_small,minimum:s?i.exactLength.value:void 0,maximum:a?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(z(r,{code:x.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(z(r,{code:x.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((a,s)=>i.type._parseAsync(new ot(r,a,r.path,s)))).then(a=>Ne.mergeArray(n,a));let o=[...r.data].map((a,s)=>i.type._parseSync(new ot(r,a,r.path,s)));return Ne.mergeArray(n,o)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:O.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:O.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:O.toString(r)}})}nonempty(t){return this.min(1,t)}};Bt.create=(e,t)=>new Bt({type:e,minLength:null,maxLength:null,exactLength:null,typeName:A.ZodArray,...J(t)});function Ur(e){if(e instanceof Qe){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=mt.create(Ur(n))}return new Qe({...e._def,shape:()=>t})}else return e instanceof Bt?new Bt({...e._def,type:Ur(e.element)}):e instanceof mt?mt.create(Ur(e.unwrap())):e instanceof Nt?Nt.create(Ur(e.unwrap())):e instanceof Ot?Ot.create(e.items.map(t=>Ur(t))):e}var Qe=class e extends G{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=ee.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==E.object){let u=this._getOrReturnCtx(t);return z(u,{code:x.invalid_type,expected:E.object,received:u.parsedType}),F}let{status:n,ctx:i}=this._processInputParams(t),{shape:o,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof xt&&this._def.unknownKeys==="strip"))for(let u in i.data)a.includes(u)||s.push(u);let c=[];for(let u of a){let l=o[u],d=i.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new ot(i,d,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof xt){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of s)c.push({key:{status:"valid",value:l},value:{status:"valid",value:i.data[l]}});else if(u==="strict")s.length>0&&(z(i,{code:x.unrecognized_keys,keys:s}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let l of s){let d=i.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new ot(i,d,i.path,l)),alwaysSet:l in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let d=await l.key,f=await l.value;u.push({key:d,value:f,alwaysSet:l.alwaysSet})}return u}).then(u=>Ne.mergeObjectSync(n,u)):Ne.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return O.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{let i=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:O.errToObj(t).message??i}:{message:i}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:A.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of ee.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let n of ee.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return Ur(this)}partial(t){let r={};for(let n of ee.objectKeys(this.shape)){let i=this.shape[n];t&&!t[n]?r[n]=i:r[n]=i.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of ee.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof mt;)o=o._def.innerType;r[n]=o}return new e({...this._def,shape:()=>r})}keyof(){return Bf(ee.objectKeys(this.shape))}};Qe.create=(e,t)=>new Qe({shape:()=>e,unknownKeys:"strip",catchall:xt.create(),typeName:A.ZodObject,...J(t)});Qe.strictCreate=(e,t)=>new Qe({shape:()=>e,unknownKeys:"strict",catchall:xt.create(),typeName:A.ZodObject,...J(t)});Qe.lazycreate=(e,t)=>new Qe({shape:e,unknownKeys:"strip",catchall:xt.create(),typeName:A.ZodObject,...J(t)});var qr=class extends G{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function i(o){for(let s of o)if(s.result.status==="valid")return s.result;for(let s of o)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let a=o.map(s=>new Ye(s.ctx.common.issues));return z(r,{code:x.invalid_union,unionErrors:a}),F}if(r.common.async)return Promise.all(n.map(async o=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(i);{let o,a=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!o&&(o={result:l,ctx:u}),u.common.issues.length&&a.push(u.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let s=a.map(c=>new Ye(c));return z(r,{code:x.invalid_union,unionErrors:s}),F}}get options(){return this._def.options}};qr.create=(e,t)=>new qr({options:e,typeName:A.ZodUnion,...J(t)});var Tt=e=>e instanceof Jr?Tt(e.schema):e instanceof ht?Tt(e.innerType()):e instanceof Kr?[e.value]:e instanceof Br?e.options:e instanceof Hr?ee.objectValues(e.enum):e instanceof Wr?Tt(e._def.innerType):e instanceof Fr?[void 0]:e instanceof Lr?[null]:e instanceof mt?[void 0,...Tt(e.unwrap())]:e instanceof Nt?[null,...Tt(e.unwrap())]:e instanceof ko||e instanceof Xr?Tt(e.unwrap()):e instanceof Gr?Tt(e._def.innerType):[],Fs=class e extends G{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==E.object)return z(r,{code:x.invalid_type,expected:E.object,received:r.parsedType}),F;let n=this.discriminator,i=r.data[n],o=this.optionsMap.get(i);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(z(r,{code:x.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),F)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let i=new Map;for(let o of r){let a=Tt(o.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let s of a){if(i.has(s))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(s)}`);i.set(s,o)}}return new e({typeName:A.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:i,...J(n)})}};function Ls(e,t){let r=Et(e),n=Et(t);if(e===t)return{valid:!0,data:e};if(r===E.object&&n===E.object){let i=ee.objectKeys(t),o=ee.objectKeys(e).filter(s=>i.indexOf(s)!==-1),a={...e,...t};for(let s of o){let c=Ls(e[s],t[s]);if(!c.valid)return{valid:!1};a[s]=c.data}return{valid:!0,data:a}}else if(r===E.array&&n===E.array){if(e.length!==t.length)return{valid:!1};let i=[];for(let o=0;o<e.length;o++){let a=e[o],s=t[o],c=Ls(a,s);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else return r===E.date&&n===E.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var Vr=class extends G{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),i=(o,a)=>{if(As(o)||As(a))return F;let s=Ls(o.value,a.value);return s.valid?((Us(o)||Us(a))&&r.dirty(),{status:r.value,value:s.data}):(z(n,{code:x.invalid_intersection_types}),F)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([o,a])=>i(o,a)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Vr.create=(e,t,r)=>new Vr({left:e,right:t,typeName:A.ZodIntersection,...J(r)});var Ot=class e extends G{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==E.array)return z(n,{code:x.invalid_type,expected:E.array,received:n.parsedType}),F;if(n.data.length<this._def.items.length)return z(n,{code:x.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),F;!this._def.rest&&n.data.length>this._def.items.length&&(z(n,{code:x.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let o=[...n.data].map((a,s)=>{let c=this._def.items[s]||this._def.rest;return c?c._parse(new ot(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(o).then(a=>Ne.mergeArray(r,a)):Ne.mergeArray(r,o)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Ot.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ot({items:e,typeName:A.ZodTuple,rest:null,...J(t)})};var qs=class e extends G{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==E.object)return z(n,{code:x.invalid_type,expected:E.object,received:n.parsedType}),F;let i=[],o=this._def.keyType,a=this._def.valueType;for(let s in n.data)i.push({key:o._parse(new ot(n,s,n.path,s)),value:a._parse(new ot(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?Ne.mergeObjectAsync(r,i):Ne.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof G?new e({keyType:t,valueType:r,typeName:A.ZodRecord,...J(n)}):new e({keyType:Mr.create(),valueType:t,typeName:A.ZodRecord,...J(r)})}},Fn=class extends G{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==E.map)return z(n,{code:x.invalid_type,expected:E.map,received:n.parsedType}),F;let i=this._def.keyType,o=this._def.valueType,a=[...n.data.entries()].map(([s,c],u)=>({key:i._parse(new ot(n,s,n.path,[u,"key"])),value:o._parse(new ot(n,c,n.path,[u,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let c of a){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return F;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),s.set(u.value,l.value)}return{status:r.value,value:s}})}else{let s=new Map;for(let c of a){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return F;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),s.set(u.value,l.value)}return{status:r.value,value:s}}}};Fn.create=(e,t,r)=>new Fn({valueType:t,keyType:e,typeName:A.ZodMap,...J(r)});var Ln=class e extends G{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==E.set)return z(n,{code:x.invalid_type,expected:E.set,received:n.parsedType}),F;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(z(n,{code:x.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(z(n,{code:x.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let o=this._def.valueType;function a(c){let u=new Set;for(let l of c){if(l.status==="aborted")return F;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let s=[...n.data.values()].map((c,u)=>o._parse(new ot(n,c,n.path,u)));return n.common.async?Promise.all(s).then(c=>a(c)):a(s)}min(t,r){return new e({...this._def,minSize:{value:t,message:O.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:O.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};Ln.create=(e,t)=>new Ln({valueType:e,minSize:null,maxSize:null,typeName:A.ZodSet,...J(t)});var Vs=class e extends G{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==E.function)return z(r,{code:x.invalid_type,expected:E.function,received:r.parsedType}),F;function n(s,c){return xo({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,On(),Jt].filter(u=>!!u),issueData:{code:x.invalid_arguments,argumentsError:c}})}function i(s,c){return xo({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,On(),Jt].filter(u=>!!u),issueData:{code:x.invalid_return_type,returnTypeError:c}})}let o={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof fr){let s=this;return Me(async function(...c){let u=new Ye([]),l=await s._def.args.parseAsync(c,o).catch(p=>{throw u.addIssue(n(c,p)),u}),d=await Reflect.apply(a,this,l);return await s._def.returns._def.type.parseAsync(d,o).catch(p=>{throw u.addIssue(i(d,p)),u})})}else{let s=this;return Me(function(...c){let u=s._def.args.safeParse(c,o);if(!u.success)throw new Ye([n(c,u.error)]);let l=Reflect.apply(a,this,u.data),d=s._def.returns.safeParse(l,o);if(!d.success)throw new Ye([i(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Ot.create(t).rest(Kt.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||Ot.create([]).rest(Kt.create()),returns:r||Kt.create(),typeName:A.ZodFunction,...J(n)})}},Jr=class extends G{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Jr.create=(e,t)=>new Jr({getter:e,typeName:A.ZodLazy,...J(t)});var Kr=class extends G{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return z(r,{received:r.data,code:x.invalid_literal,expected:this._def.value}),F}return{status:"valid",value:t.data}}get value(){return this._def.value}};Kr.create=(e,t)=>new Kr({value:e,typeName:A.ZodLiteral,...J(t)});function Bf(e,t){return new Br({values:e,typeName:A.ZodEnum,...J(t)})}var Br=class e extends G{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return z(r,{expected:ee.joinValues(n),received:r.parsedType,code:x.invalid_type}),F}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return z(r,{received:r.data,code:x.invalid_enum_value,options:n}),F}return Me(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};Br.create=Bf;var Hr=class extends G{_parse(t){let r=ee.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==E.string&&n.parsedType!==E.number){let i=ee.objectValues(r);return z(n,{expected:ee.joinValues(i),received:n.parsedType,code:x.invalid_type}),F}if(this._cache||(this._cache=new Set(ee.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let i=ee.objectValues(r);return z(n,{received:n.data,code:x.invalid_enum_value,options:i}),F}return Me(t.data)}get enum(){return this._def.values}};Hr.create=(e,t)=>new Hr({values:e,typeName:A.ZodNativeEnum,...J(t)});var fr=class extends G{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==E.promise&&r.common.async===!1)return z(r,{code:x.invalid_type,expected:E.promise,received:r.parsedType}),F;let n=r.parsedType===E.promise?r.data:Promise.resolve(r.data);return Me(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};fr.create=(e,t)=>new fr({type:e,typeName:A.ZodPromise,...J(t)});var ht=class extends G{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===A.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),i=this._def.effect||null,o={addIssue:a=>{z(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){let a=i.transform(n.data,o);if(n.common.async)return Promise.resolve(a).then(async s=>{if(r.value==="aborted")return F;let c=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return c.status==="aborted"?F:c.status==="dirty"?Ar(c.value):r.value==="dirty"?Ar(c.value):c});{if(r.value==="aborted")return F;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?F:s.status==="dirty"?Ar(s.value):r.value==="dirty"?Ar(s.value):s}}if(i.type==="refinement"){let a=s=>{let c=i.refinement(s,o);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?F:(s.status==="dirty"&&r.dirty(),a(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?F:(s.status==="dirty"&&r.dirty(),a(s.value).then(()=>({status:r.value,value:s.value}))))}if(i.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!pr(a))return F;let s=i.transform(a.value,o);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>pr(a)?Promise.resolve(i.transform(a.value,o)).then(s=>({status:r.value,value:s})):F);ee.assertNever(i)}};ht.create=(e,t,r)=>new ht({schema:e,typeName:A.ZodEffects,effect:t,...J(r)});ht.createWithPreprocess=(e,t,r)=>new ht({schema:t,effect:{type:"preprocess",transform:e},typeName:A.ZodEffects,...J(r)});var mt=class extends G{_parse(t){return this._getType(t)===E.undefined?Me(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};mt.create=(e,t)=>new mt({innerType:e,typeName:A.ZodOptional,...J(t)});var Nt=class extends G{_parse(t){return this._getType(t)===E.null?Me(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Nt.create=(e,t)=>new Nt({innerType:e,typeName:A.ZodNullable,...J(t)});var Wr=class extends G{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===E.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Wr.create=(e,t)=>new Wr({innerType:e,typeName:A.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...J(t)});var Gr=class extends G{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Nn(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Ye(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Ye(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Gr.create=(e,t)=>new Gr({innerType:e,typeName:A.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...J(t)});var qn=class extends G{_parse(t){if(this._getType(t)!==E.nan){let n=this._getOrReturnCtx(t);return z(n,{code:x.invalid_type,expected:E.nan,received:n.parsedType}),F}return{status:"valid",value:t.data}}};qn.create=e=>new qn({typeName:A.ZodNaN,...J(e)});var ko=class extends G{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},wo=class e extends G{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?F:o.status==="dirty"?(r.dirty(),Ar(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?F:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:A.ZodPipeline})}},Xr=class extends G{_parse(t){let r=this._def.innerType._parse(t),n=i=>(pr(i)&&(i.value=Object.freeze(i.value)),i);return Nn(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};Xr.create=(e,t)=>new Xr({innerType:e,typeName:A.ZodReadonly,...J(t)});var kT={object:Qe.lazycreate},A;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(A||(A={}));var wT=Mr.create,ST=Dn.create,zT=qn.create,IT=Rn.create,PT=Cn.create,jT=Zn.create,ET=An.create,TT=Fr.create,OT=Lr.create,NT=Un.create,DT=Kt.create,RT=xt.create,CT=Mn.create,ZT=Bt.create,ib=Qe.create,AT=Qe.strictCreate,UT=qr.create,MT=Fs.create,FT=Vr.create,LT=Ot.create,qT=qs.create,VT=Fn.create,JT=Ln.create,KT=Vs.create,BT=Jr.create,HT=Kr.create,WT=Br.create,GT=Hr.create,XT=fr.create,YT=ht.create,QT=mt.create,eO=Nt.create,tO=ht.createWithPreprocess,rO=wo.create;var Hf=Object.freeze({status:"aborted"});function g(e,t,r){function n(s,c){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:c,constr:a,traits:new Set},enumerable:!1}),s._zod.traits.has(e))return;s._zod.traits.add(e),t(s,c);let u=a.prototype,l=Object.keys(u);for(let d=0;d<l.length;d++){let f=l[d];f in s||(s[f]=u[f].bind(s))}}let i=r?.Parent??Object;class o extends i{}Object.defineProperty(o,"name",{value:e});function a(s){var c;let u=r?.Parent?new o:this;n(u,s),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:s=>r?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}var kt=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},mr=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},So={};function we(e){return e&&Object.assign(So,e),So}var k={};Tn(k,{BIGINT_FORMAT_RANGES:()=>ec,Class:()=>Ks,NUMBER_FORMAT_RANGES:()=>Qs,aborted:()=>Xt,allowsEval:()=>Ws,assert:()=>db,assertEqual:()=>sb,assertIs:()=>ub,assertNever:()=>lb,assertNotEqual:()=>cb,assignProp:()=>Wt,base64ToUint8Array:()=>rm,base64urlToUint8Array:()=>xb,cached:()=>Qr,captureStackTrace:()=>Io,cleanEnum:()=>bb,cleanRegex:()=>Kn,clone:()=>Fe,cloneDef:()=>fb,createTransparentProxy:()=>_b,defineLazy:()=>K,esc:()=>zo,escapeRegex:()=>at,extend:()=>Yf,finalizeIssue:()=>Be,floatSafeRemainder:()=>Bs,getElementAtPath:()=>mb,getEnumValues:()=>Jn,getLengthableOrigin:()=>Wn,getParsedType:()=>yb,getSizableOrigin:()=>Hn,hexToUint8Array:()=>wb,isObject:()=>hr,isPlainObject:()=>Gt,issue:()=>en,joinValues:()=>U,jsonStringifyReplacer:()=>Yr,merge:()=>$b,mergeDefs:()=>Dt,normalizeParams:()=>I,nullish:()=>Ht,numKeys:()=>vb,objectClone:()=>pb,omit:()=>Xf,optionalKeys:()=>Ys,parsedType:()=>L,partial:()=>em,pick:()=>Gf,prefixIssues:()=>et,primitiveTypes:()=>Xs,promiseAllObject:()=>hb,propertyKeyTypes:()=>Bn,randomString:()=>gb,required:()=>tm,safeExtend:()=>Qf,shallowClone:()=>Gs,slugify:()=>Hs,stringifyPrimitive:()=>M,uint8ArrayToBase64:()=>nm,uint8ArrayToBase64url:()=>kb,uint8ArrayToHex:()=>Sb,unwrapMessage:()=>Vn});function sb(e){return e}function cb(e){return e}function ub(e){}function lb(e){throw new Error("Unexpected value in exhaustive check")}function db(e){}function Jn(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,i])=>t.indexOf(+n)===-1).map(([n,i])=>i)}function U(e,t="|"){return e.map(r=>M(r)).join(t)}function Yr(e,t){return typeof t=="bigint"?t.toString():t}function Qr(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Ht(e){return e==null}function Kn(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Bs(e,t){let r=(e.toString().split(".")[1]||"").length,n=t.toString(),i=(n.split(".")[1]||"").length;if(i===0&&/\d?e-\d?/.test(n)){let c=n.match(/\d?e-(\d?)/);c?.[1]&&(i=Number.parseInt(c[1]))}let o=r>i?r:i,a=Number.parseInt(e.toFixed(o).replace(".","")),s=Number.parseInt(t.toFixed(o).replace(".",""));return a%s/10**o}var Wf=Symbol("evaluating");function K(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Wf)return n===void 0&&(n=Wf,n=r()),n},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}function pb(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Wt(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Dt(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function fb(e){return Dt(e._zod.def)}function mb(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function hb(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let i={};for(let o=0;o<t.length;o++)i[t[o]]=n[o];return i})}function gb(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function zo(e){return JSON.stringify(e)}function Hs(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Io="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function hr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Ws=Qr(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Gt(e){if(hr(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(hr(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Gs(e){return Gt(e)?{...e}:Array.isArray(e)?[...e]:e}function vb(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var yb=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},Bn=new Set(["string","number","symbol"]),Xs=new Set(["string","number","bigint","boolean","symbol","undefined"]);function at(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Fe(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function I(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function _b(e){let t;return new Proxy({},{get(r,n,i){return t??(t=e()),Reflect.get(t,n,i)},set(r,n,i,o){return t??(t=e()),Reflect.set(t,n,i,o)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,i){return t??(t=e()),Reflect.defineProperty(t,n,i)}})}function M(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Ys(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Qs={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},ec={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Gf(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let o=Dt(e._zod.def,{get shape(){let a={};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(a[s]=r.shape[s])}return Wt(this,"shape",a),a},checks:[]});return Fe(e,o)}function Xf(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let o=Dt(e._zod.def,{get shape(){let a={...e._zod.def.shape};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete a[s]}return Wt(this,"shape",a),a},checks:[]});return Fe(e,o)}function Yf(e,t){if(!Gt(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=e._zod.def.shape;for(let a in t)if(Object.getOwnPropertyDescriptor(o,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let i=Dt(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return Wt(this,"shape",o),o}});return Fe(e,i)}function Qf(e,t){if(!Gt(t))throw new Error("Invalid input to safeExtend: expected a plain object");let r=Dt(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Wt(this,"shape",n),n}});return Fe(e,r)}function $b(e,t){let r=Dt(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Wt(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return Fe(e,r)}function em(e,t,r){let i=t._zod.def.checks;if(i&&i.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let a=Dt(t._zod.def,{get shape(){let s=t._zod.def.shape,c={...s};if(r)for(let u in r){if(!(u in s))throw new Error(`Unrecognized key: "${u}"`);r[u]&&(c[u]=e?new e({type:"optional",innerType:s[u]}):s[u])}else for(let u in s)c[u]=e?new e({type:"optional",innerType:s[u]}):s[u];return Wt(this,"shape",c),c},checks:[]});return Fe(t,a)}function tm(e,t,r){let n=Dt(t._zod.def,{get shape(){let i=t._zod.def.shape,o={...i};if(r)for(let a in r){if(!(a in o))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(o[a]=new e({type:"nonoptional",innerType:i[a]}))}else for(let a in i)o[a]=new e({type:"nonoptional",innerType:i[a]});return Wt(this,"shape",o),o}});return Fe(t,n)}function Xt(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function et(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Vn(e){return typeof e=="string"?e:e?.message}function Be(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let i=Vn(e.inst?._zod.def?.error?.(e))??Vn(t?.error?.(e))??Vn(r.customError?.(e))??Vn(r.localeError?.(e))??"Invalid input";n.message=i}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function Hn(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Wn(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function L(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function en(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function bb(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function rm(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function nm(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function xb(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return rm(t+r)}function kb(e){return nm(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function wb(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n/2]=Number.parseInt(t.slice(n,n+2),16);return r}function Sb(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Ks=class{constructor(...t){}};var im=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Yr,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Po=g("$ZodError",im),Gn=g("$ZodError",im,{Parent:Error});function jo(e,t=r=>r.message){let r={},n=[];for(let i of e.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(t(i))):n.push(t(i));return{formErrors:n,fieldErrors:r}}function Eo(e,t=r=>r.message){let r={_errors:[]},n=i=>{for(let o of i.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(a=>n({issues:a}));else if(o.code==="invalid_key")n({issues:o.issues});else if(o.code==="invalid_element")n({issues:o.issues});else if(o.path.length===0)r._errors.push(t(o));else{let a=r,s=0;for(;s<o.path.length;){let c=o.path[s];s===o.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(t(o))):a[c]=a[c]||{_errors:[]},a=a[c],s++}}};return n(e),r}var Xn=e=>(t,r,n,i)=>{let o=n?Object.assign(n,{async:!1}):{async:!1},a=t._zod.run({value:r,issues:[]},o);if(a instanceof Promise)throw new kt;if(a.issues.length){let s=new(i?.Err??e)(a.issues.map(c=>Be(c,o,we())));throw Io(s,i?.callee),s}return a.value},Yn=Xn(Gn),Qn=e=>async(t,r,n,i)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},a=t._zod.run({value:r,issues:[]},o);if(a instanceof Promise&&(a=await a),a.issues.length){let s=new(i?.Err??e)(a.issues.map(c=>Be(c,o,we())));throw Io(s,i?.callee),s}return a.value},ei=Qn(Gn),ti=e=>(t,r,n)=>{let i=n?{...n,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},i);if(o instanceof Promise)throw new kt;return o.issues.length?{success:!1,error:new(e??Po)(o.issues.map(a=>Be(a,i,we())))}:{success:!0,data:o.value}},tn=ti(Gn),ri=e=>async(t,r,n)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},o=t._zod.run({value:r,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(a=>Be(a,i,we())))}:{success:!0,data:o.value}},ni=ri(Gn),om=e=>(t,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Xn(e)(t,r,i)};var am=e=>(t,r,n)=>Xn(e)(t,r,n);var sm=e=>async(t,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Qn(e)(t,r,i)};var cm=e=>async(t,r,n)=>Qn(e)(t,r,n);var um=e=>(t,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return ti(e)(t,r,i)};var lm=e=>(t,r,n)=>ti(e)(t,r,n);var dm=e=>async(t,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return ri(e)(t,r,i)};var pm=e=>async(t,r,n)=>ri(e)(t,r,n);var st={};Tn(st,{base64:()=>gc,base64url:()=>To,bigint:()=>xc,boolean:()=>wc,browserEmail:()=>Db,cidrv4:()=>mc,cidrv6:()=>hc,cuid:()=>tc,cuid2:()=>rc,date:()=>yc,datetime:()=>$c,domain:()=>Zb,duration:()=>sc,e164:()=>vc,email:()=>uc,emoji:()=>lc,extendedDuration:()=>Ib,guid:()=>cc,hex:()=>Ab,hostname:()=>Cb,html5Email:()=>Tb,idnEmail:()=>Nb,integer:()=>kc,ipv4:()=>dc,ipv6:()=>pc,ksuid:()=>oc,lowercase:()=>Ic,mac:()=>fc,md5_base64:()=>Mb,md5_base64url:()=>Fb,md5_hex:()=>Ub,nanoid:()=>ac,null:()=>Sc,number:()=>Oo,rfc5322Email:()=>Ob,sha1_base64:()=>qb,sha1_base64url:()=>Vb,sha1_hex:()=>Lb,sha256_base64:()=>Kb,sha256_base64url:()=>Bb,sha256_hex:()=>Jb,sha384_base64:()=>Wb,sha384_base64url:()=>Gb,sha384_hex:()=>Hb,sha512_base64:()=>Yb,sha512_base64url:()=>Qb,sha512_hex:()=>Xb,string:()=>bc,time:()=>_c,ulid:()=>nc,undefined:()=>zc,unicodeEmail:()=>fm,uppercase:()=>Pc,uuid:()=>gr,uuid4:()=>Pb,uuid6:()=>jb,uuid7:()=>Eb,xid:()=>ic});var tc=/^[cC][^\s-]{8,}$/,rc=/^[0-9a-z]+$/,nc=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,ic=/^[0-9a-vA-V]{20}$/,oc=/^[A-Za-z0-9]{27}$/,ac=/^[a-zA-Z0-9_-]{21}$/,sc=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Ib=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,cc=/^([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})$/,gr=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([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)$/,Pb=gr(4),jb=gr(6),Eb=gr(7),uc=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Tb=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Ob=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,fm=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,Nb=fm,Db=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Rb="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function lc(){return new RegExp(Rb,"u")}var dc=/^(?:(?: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])$/,pc=/^(([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}|:))$/,fc=e=>{let t=at(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},mc=/^((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])$/,hc=/^(([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])$/,gc=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,To=/^[A-Za-z0-9_-]*$/,Cb=/^(?=.{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])?)*\.?$/,Zb=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,vc=/^\+[1-9]\d{6,14}$/,mm="(?:(?:\\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])))",yc=new RegExp(`^${mm}$`);function hm(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function _c(e){return new RegExp(`^${hm(e)}$`)}function $c(e){let t=hm({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${t}(?:${r.join("|")})`;return new RegExp(`^${mm}T(?:${n})$`)}var bc=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},xc=/^-?\d+n?$/,kc=/^-?\d+$/,Oo=/^-?\d+(?:\.\d+)?$/,wc=/^(?:true|false)$/i,Sc=/^null$/i;var zc=/^undefined$/i;var Ic=/^[^A-Z]*$/,Pc=/^[^a-z]*$/,Ab=/^[0-9a-fA-F]*$/;function ii(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function oi(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var Ub=/^[0-9a-fA-F]{32}$/,Mb=ii(22,"=="),Fb=oi(22),Lb=/^[0-9a-fA-F]{40}$/,qb=ii(27,"="),Vb=oi(27),Jb=/^[0-9a-fA-F]{64}$/,Kb=ii(43,"="),Bb=oi(43),Hb=/^[0-9a-fA-F]{96}$/,Wb=ii(64,""),Gb=oi(64),Xb=/^[0-9a-fA-F]{128}$/,Yb=ii(86,"=="),Qb=oi(86);var ue=g("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),vm={number:"number",bigint:"bigint",object:"date"},jc=g("$ZodCheckLessThan",(e,t)=>{ue.init(e,t);let r=vm[typeof t.value];e._zod.onattach.push(n=>{let i=n._zod.bag,o=(t.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<o&&(t.inclusive?i.maximum=t.value:i.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ec=g("$ZodCheckGreaterThan",(e,t)=>{ue.init(e,t);let r=vm[typeof t.value];e._zod.onattach.push(n=>{let i=n._zod.bag,o=(t.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?i.minimum=t.value:i.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ym=g("$ZodCheckMultipleOf",(e,t)=>{ue.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):Bs(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),_m=g("$ZodCheckNumberFormat",(e,t)=>{ue.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[i,o]=Qs[t.format];e._zod.onattach.push(a=>{let s=a._zod.bag;s.format=t.format,s.minimum=i,s.maximum=o,r&&(s.pattern=kc)}),e._zod.check=a=>{let s=a.value;if(r){if(!Number.isInteger(s)){a.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}s<i&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>o&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),$m=g("$ZodCheckBigIntFormat",(e,t)=>{ue.init(e,t);let[r,n]=ec[t.format];e._zod.onattach.push(i=>{let o=i._zod.bag;o.format=t.format,o.minimum=r,o.maximum=n}),e._zod.check=i=>{let o=i.value;o<r&&i.issues.push({origin:"bigint",input:o,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),o>n&&i.issues.push({origin:"bigint",input:o,code:"too_big",maximum:n,inclusive:!0,inst:e,continue:!t.abort})}}),bm=g("$ZodCheckMaxSize",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!Ht(i)&&i.size!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let i=n.value;i.size<=t.maximum||n.issues.push({origin:Hn(i),code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),xm=g("$ZodCheckMinSize",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!Ht(i)&&i.size!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let i=n.value;i.size>=t.minimum||n.issues.push({origin:Hn(i),code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),km=g("$ZodCheckSizeEquals",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!Ht(i)&&i.size!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag;i.minimum=t.size,i.maximum=t.size,i.size=t.size}),e._zod.check=n=>{let i=n.value,o=i.size;if(o===t.size)return;let a=o>t.size;n.issues.push({origin:Hn(i),...a?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),wm=g("$ZodCheckMaxLength",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!Ht(i)&&i.length!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let i=n.value;if(i.length<=t.maximum)return;let a=Wn(i);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Sm=g("$ZodCheckMinLength",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!Ht(i)&&i.length!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let i=n.value;if(i.length>=t.minimum)return;let a=Wn(i);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),zm=g("$ZodCheckLengthEquals",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!Ht(i)&&i.length!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),e._zod.check=n=>{let i=n.value,o=i.length;if(o===t.length)return;let a=Wn(i),s=o>t.length;n.issues.push({origin:a,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),ai=g("$ZodCheckStringFormat",(e,t)=>{var r,n;ue.init(e,t),e._zod.onattach.push(i=>{let o=i._zod.bag;o.format=t.format,t.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),Im=g("$ZodCheckRegex",(e,t)=>{ai.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Pm=g("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Ic),ai.init(e,t)}),jm=g("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Pc),ai.init(e,t)}),Em=g("$ZodCheckIncludes",(e,t)=>{ue.init(e,t);let r=at(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(i=>{let o=i._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=i=>{i.value.includes(t.includes,t.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:i.value,inst:e,continue:!t.abort})}}),Tm=g("$ZodCheckStartsWith",(e,t)=>{ue.init(e,t);let r=new RegExp(`^${at(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Om=g("$ZodCheckEndsWith",(e,t)=>{ue.init(e,t);let r=new RegExp(`.*${at(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});function gm(e,t,r){e.issues.length&&t.issues.push(...et(r,e.issues))}var Nm=g("$ZodCheckProperty",(e,t)=>{ue.init(e,t),e._zod.check=r=>{let n=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(n instanceof Promise)return n.then(i=>gm(i,r,t.property));gm(n,r,t.property)}}),Dm=g("$ZodCheckMimeType",(e,t)=>{ue.init(e,t);let r=new Set(t.mime);e._zod.onattach.push(n=>{n._zod.bag.mime=t.mime}),e._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:t.mime,input:n.value.type,inst:e,continue:!t.abort})}}),Rm=g("$ZodCheckOverwrite",(e,t)=>{ue.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var No=class{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let n=t.split(`
10
+ `).filter(a=>a),i=Math.min(...n.map(a=>a.length-a.trimStart().length)),o=n.map(a=>a.slice(i)).map(a=>" ".repeat(this.indent*2)+a);for(let a of o)this.content.push(a)}compile(){let t=Function,r=this?.args,i=[...(this?.content??[""]).map(o=>` ${o}`)];return new t(...r,i.join(`
11
+ `))}};var Zm={major:4,minor:3,patch:6};var V=g("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Zm;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let i of n)for(let o of i._zod.onattach)o(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(a,s,c)=>{let u=Xt(a),l;for(let d of s){if(d._zod.def.when){if(!d._zod.def.when(a))continue}else if(u)continue;let f=a.issues.length,p=d._zod.check(a);if(p instanceof Promise&&c?.async===!1)throw new kt;if(l||p instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await p,a.issues.length!==f&&(u||(u=Xt(a,f)))});else{if(a.issues.length===f)continue;u||(u=Xt(a,f))}}return l?l.then(()=>a):a},o=(a,s,c)=>{if(Xt(a))return a.aborted=!0,a;let u=i(s,n,c);if(u instanceof Promise){if(c.async===!1)throw new kt;return u.then(l=>e._zod.parse(l,c))}return e._zod.parse(u,c)};e._zod.run=(a,s)=>{if(s.skipChecks)return e._zod.parse(a,s);if(s.direction==="backward"){let u=e._zod.parse({value:a.value,issues:[]},{...s,skipChecks:!0});return u instanceof Promise?u.then(l=>o(l,a,s)):o(u,a,s)}let c=e._zod.parse(a,s);if(c instanceof Promise){if(s.async===!1)throw new kt;return c.then(u=>i(u,n,s))}return i(c,n,s)}}K(e,"~standard",()=>({validate:i=>{try{let o=tn(e,i);return o.success?{value:o.data}:{issues:o.error?.issues}}catch{return ni(e,i).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),vr=g("$ZodString",(e,t)=>{V.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??bc(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),ae=g("$ZodStringFormat",(e,t)=>{ai.init(e,t),vr.init(e,t)}),Oc=g("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=cc),ae.init(e,t)}),Nc=g("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=gr(n))}else t.pattern??(t.pattern=gr());ae.init(e,t)}),Dc=g("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=uc),ae.init(e,t)}),Rc=g("$ZodURL",(e,t)=>{ae.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),i=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=i.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Cc=g("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=lc()),ae.init(e,t)}),Zc=g("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=ac),ae.init(e,t)}),Ac=g("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=tc),ae.init(e,t)}),Uc=g("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=rc),ae.init(e,t)}),Mc=g("$ZodULID",(e,t)=>{t.pattern??(t.pattern=nc),ae.init(e,t)}),Fc=g("$ZodXID",(e,t)=>{t.pattern??(t.pattern=ic),ae.init(e,t)}),Lc=g("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=oc),ae.init(e,t)}),qc=g("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=$c(t)),ae.init(e,t)}),Vc=g("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=yc),ae.init(e,t)}),Jc=g("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=_c(t)),ae.init(e,t)}),Kc=g("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=sc),ae.init(e,t)}),Bc=g("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=dc),ae.init(e,t),e._zod.bag.format="ipv4"}),Hc=g("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=pc),ae.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),Wc=g("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=fc(t.delimiter)),ae.init(e,t),e._zod.bag.format="mac"}),Gc=g("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=mc),ae.init(e,t)}),Xc=g("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=hc),ae.init(e,t),e._zod.check=r=>{let n=r.value.split("/");try{if(n.length!==2)throw new Error;let[i,o]=n;if(!o)throw new Error;let a=Number(o);if(`${a}`!==o)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${i}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Wm(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Yc=g("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=gc),ae.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Wm(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function ex(e){if(!To.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Wm(r)}var Qc=g("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=To),ae.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{ex(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),eu=g("$ZodE164",(e,t)=>{t.pattern??(t.pattern=vc),ae.init(e,t)});function tx(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let i=JSON.parse(atob(n));return!("typ"in i&&i?.typ!=="JWT"||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}}var tu=g("$ZodJWT",(e,t)=>{ae.init(e,t),e._zod.check=r=>{tx(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),ru=g("$ZodCustomStringFormat",(e,t)=>{ae.init(e,t),e._zod.check=r=>{t.fn(r.value)||r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),Uo=g("$ZodNumber",(e,t)=>{V.init(e,t),e._zod.pattern=e._zod.bag.pattern??Oo,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let i=r.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return r;let o=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...o?{received:o}:{}}),r}}),nu=g("$ZodNumberFormat",(e,t)=>{_m.init(e,t),Uo.init(e,t)}),si=g("$ZodBoolean",(e,t)=>{V.init(e,t),e._zod.pattern=wc,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let i=r.value;return typeof i=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),r}}),Mo=g("$ZodBigInt",(e,t)=>{V.init(e,t),e._zod.pattern=xc,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}}),iu=g("$ZodBigIntFormat",(e,t)=>{$m.init(e,t),Mo.init(e,t)}),ou=g("$ZodSymbol",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;return typeof i=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:i,inst:e}),r}}),au=g("$ZodUndefined",(e,t)=>{V.init(e,t),e._zod.pattern=zc,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(r,n)=>{let i=r.value;return typeof i>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:i,inst:e}),r}}),su=g("$ZodNull",(e,t)=>{V.init(e,t),e._zod.pattern=Sc,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let i=r.value;return i===null||r.issues.push({expected:"null",code:"invalid_type",input:i,inst:e}),r}}),cu=g("$ZodAny",(e,t)=>{V.init(e,t),e._zod.parse=r=>r}),uu=g("$ZodUnknown",(e,t)=>{V.init(e,t),e._zod.parse=r=>r}),lu=g("$ZodNever",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),du=g("$ZodVoid",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;return typeof i>"u"||r.issues.push({expected:"void",code:"invalid_type",input:i,inst:e}),r}}),pu=g("$ZodDate",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let i=r.value,o=i instanceof Date;return o&&!Number.isNaN(i.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:i,...o?{received:"Invalid Date"}:{},inst:e}),r}});function Am(e,t,r){e.issues.length&&t.issues.push(...et(r,e.issues)),t.value[r]=e.value}var fu=g("$ZodArray",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=Array(i.length);let o=[];for(let a=0;a<i.length;a++){let s=i[a],c=t.element._zod.run({value:s,issues:[]},n);c instanceof Promise?o.push(c.then(u=>Am(u,r,a))):Am(c,r,a)}return o.length?Promise.all(o).then(()=>r):r}});function Ao(e,t,r,n,i){if(e.issues.length){if(i&&!(r in n))return;t.issues.push(...et(r,e.issues))}e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function Gm(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=Ys(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Xm(e,t,r,n,i,o){let a=[],s=i.keySet,c=i.catchall._zod,u=c.def.type,l=c.optout==="optional";for(let d in t){if(s.has(d))continue;if(u==="never"){a.push(d);continue}let f=c.run({value:t[d],issues:[]},n);f instanceof Promise?e.push(f.then(p=>Ao(p,r,d,t,l))):Ao(f,r,d,t,l)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:o}),e.length?Promise.all(e).then(()=>r):r}var Ym=g("$ZodObject",(e,t)=>{if(V.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let s=t.shape;Object.defineProperty(t,"shape",{get:()=>{let c={...s};return Object.defineProperty(t,"shape",{value:c}),c}})}let n=Qr(()=>Gm(t));K(e._zod,"propValues",()=>{let s=t.shape,c={};for(let u in s){let l=s[u]._zod;if(l.values){c[u]??(c[u]=new Set);for(let d of l.values)c[u].add(d)}}return c});let i=hr,o=t.catchall,a;e._zod.parse=(s,c)=>{a??(a=n.value);let u=s.value;if(!i(u))return s.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),s;s.value={};let l=[],d=a.shape;for(let f of a.keys){let p=d[f],m=p._zod.optout==="optional",h=p._zod.run({value:u[f],issues:[]},c);h instanceof Promise?l.push(h.then(v=>Ao(v,s,f,u,m))):Ao(h,s,f,u,m)}return o?Xm(l,u,s,c,n.value,e):l.length?Promise.all(l).then(()=>s):s}}),Qm=g("$ZodObjectJIT",(e,t)=>{Ym.init(e,t);let r=e._zod.parse,n=Qr(()=>Gm(t)),i=f=>{let p=new No(["shape","payload","ctx"]),m=n.value,h=$=>{let S=zo($);return`shape[${S}]._zod.run({ value: input[${S}], issues: [] }, ctx)`};p.write("const input = payload.value;");let v=Object.create(null),_=0;for(let $ of m.keys)v[$]=`key_${_++}`;p.write("const newResult = {};");for(let $ of m.keys){let S=v[$],P=zo($),be=f[$]?._zod?.optout==="optional";p.write(`const ${S} = ${h($)};`),be?p.write(`
12
12
  if (${S}.issues.length) {
13
13
  if (${P} in input) {
14
14
  payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
@@ -26,7 +26,7 @@
26
26
  newResult[${P}] = ${S}.value;
27
27
  }
28
28
 
29
- `):f.write(`
29
+ `):p.write(`
30
30
  if (${S}.issues.length) {
31
31
  payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
32
32
  ...iss,
@@ -42,40 +42,41 @@
42
42
  newResult[${P}] = ${S}.value;
43
43
  }
44
44
 
45
- `)}f.write("payload.value = newResult;"),f.write("return payload;");let $=f.compile();return(b,S)=>$(p,b,S)},i,a=hr,s=!Si.jitless,u=s&&Ws.value,l=t.catchall,d;e._zod.parse=(p,f)=>{d??(d=n.value);let m=p.value;return a(m)?s&&u&&f?.async===!1&&f.jitless!==!0?(i||(i=o(t.shape)),p=i(p,f),l?Gm([],m,p,f,d,e):p):r(p,f):(p.issues.push({expected:"object",code:"invalid_type",input:m,inst:e}),p)}});function Am(e,t,r,n){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter(i=>!Xt(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(a=>He(a,n,xe())))}),t)}var co=g("$ZodUnion",(e,t)=>{V.init(e,t),K(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),K(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),K(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),K(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){let o=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>Kn(i.source)).join("|")})$`)}});let r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(r)return n(o,i);let a=!1,s=[];for(let c of t.options){let u=c._zod.run({value:o.value,issues:[]},i);if(u instanceof Promise)s.push(u),a=!0;else{if(u.issues.length===0)return u;s.push(u)}}return a?Promise.all(s).then(c=>Am(c,o,e,i)):Am(s,o,e,i)}});function Um(e,t,r,n){let o=e.filter(i=>i.issues.length===0);return o.length===1?(t.value=o[0].value,t):(o.length===0?t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(a=>He(a,n,xe())))}):t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1}),t)}var mu=g("$ZodXor",(e,t)=>{co.init(e,t),t.inclusive=!1;let r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(r)return n(o,i);let a=!1,s=[];for(let c of t.options){let u=c._zod.run({value:o.value,issues:[]},i);u instanceof Promise?(s.push(u),a=!0):s.push(u)}return a?Promise.all(s).then(c=>Um(c,o,e,i)):Um(s,o,e,i)}}),hu=g("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,co.init(e,t);let r=e._zod.parse;K(e._zod,"propValues",()=>{let o={};for(let i of t.options){let a=i._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let[s,c]of Object.entries(a)){o[s]||(o[s]=new Set);for(let u of c)o[s].add(u)}}return o});let n=Yr(()=>{let o=t.options,i=new Map;for(let a of o){let s=a._zod.propValues?.[t.discriminator];if(!s||s.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(let c of s){if(i.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);i.set(c,a)}}return i});e._zod.parse=(o,i)=>{let a=o.value;if(!hr(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),o;let s=n.value.get(a?.[t.discriminator]);return s?s._zod.run(o,i):t.unionFallback?r(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:a,path:[t.discriminator],inst:e}),o)}}),gu=g("$ZodIntersection",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,i=t.left._zod.run({value:o,issues:[]},n),a=t.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([c,u])=>Mm(r,c,u)):Mm(r,i,a)}});function Tc(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Gt(e)&&Gt(t)){let r=Object.keys(t),n=Object.keys(e).filter(i=>r.indexOf(i)!==-1),o={...e,...t};for(let i of n){let a=Tc(e[i],t[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};o[i]=a.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],i=t[n],a=Tc(o,i);if(!a.valid)return{valid:!1,mergeErrorPath:[n,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Mm(e,t,r){let n=new Map,o;for(let s of t.issues)if(s.code==="unrecognized_keys"){o??(o=s);for(let c of s.keys)n.has(c)||n.set(c,{}),n.get(c).l=!0}else e.issues.push(s);for(let s of r.issues)if(s.code==="unrecognized_keys")for(let c of s.keys)n.has(c)||n.set(c,{}),n.get(c).r=!0;else e.issues.push(s);let i=[...n].filter(([,s])=>s.l&&s.r).map(([s])=>s);if(i.length&&o&&e.issues.push({...o,keys:i}),Xt(e))return e;let a=Tc(t.value,r.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}var Fi=g("$ZodTuple",(e,t)=>{V.init(e,t);let r=t.items;e._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({input:i,inst:e,expected:"tuple",code:"invalid_type"}),n;n.value=[];let a=[],s=[...r].reverse().findIndex(l=>l._zod.optin!=="optional"),c=s===-1?0:r.length-s;if(!t.rest){let l=i.length>r.length,d=i.length<c-1;if(l||d)return n.issues.push({...l?{code:"too_big",maximum:r.length,inclusive:!0}:{code:"too_small",minimum:r.length},input:i,inst:e,origin:"array"}),n}let u=-1;for(let l of r){if(u++,u>=i.length&&u>=c)continue;let d=l._zod.run({value:i[u],issues:[]},o);d instanceof Promise?a.push(d.then(p=>Di(p,n,u))):Di(d,n,u)}if(t.rest){let l=i.slice(r.length);for(let d of l){u++;let p=t.rest._zod.run({value:d,issues:[]},o);p instanceof Promise?a.push(p.then(f=>Di(f,n,u))):Di(p,n,u)}}return a.length?Promise.all(a).then(()=>n):n}});function Di(e,t,r){e.issues.length&&t.issues.push(...et(r,e.issues)),t.value[r]=e.value}var vu=g("$ZodRecord",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!Gt(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),r;let i=[],a=t.keyType._zod.values;if(a){r.value={};let s=new Set;for(let u of a)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){s.add(typeof u=="number"?u.toString():u);let l=t.valueType._zod.run({value:o[u],issues:[]},n);l instanceof Promise?i.push(l.then(d=>{d.issues.length&&r.issues.push(...et(u,d.issues)),r.value[u]=d.value})):(l.issues.length&&r.issues.push(...et(u,l.issues)),r.value[u]=l.value)}let c;for(let u in o)s.has(u)||(c=c??[],c.push(u));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:c})}else{r.value={};for(let s of Reflect.ownKeys(o)){if(s==="__proto__")continue;let c=t.keyType._zod.run({value:s,issues:[]},n);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof s=="string"&&Oi.test(s)&&c.issues.length){let d=t.keyType._zod.run({value:Number(s),issues:[]},n);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");d.issues.length===0&&(c=d)}if(c.issues.length){t.mode==="loose"?r.value[s]=o[s]:r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(d=>He(d,n,xe())),input:s,path:[s],inst:e});continue}let l=t.valueType._zod.run({value:o[s],issues:[]},n);l instanceof Promise?i.push(l.then(d=>{d.issues.length&&r.issues.push(...et(s,d.issues)),r.value[c.value]=d.value})):(l.issues.length&&r.issues.push(...et(s,l.issues)),r.value[c.value]=l.value)}}return i.length?Promise.all(i).then(()=>r):r}}),yu=g("$ZodMap",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!(o instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:o,inst:e}),r;let i=[];r.value=new Map;for(let[a,s]of o){let c=t.keyType._zod.run({value:a,issues:[]},n),u=t.valueType._zod.run({value:s,issues:[]},n);c instanceof Promise||u instanceof Promise?i.push(Promise.all([c,u]).then(([l,d])=>{Fm(l,d,r,a,o,e,n)})):Fm(c,u,r,a,o,e,n)}return i.length?Promise.all(i).then(()=>r):r}});function Fm(e,t,r,n,o,i,a){e.issues.length&&(Hn.has(typeof n)?r.issues.push(...et(n,e.issues)):r.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:e.issues.map(s=>He(s,a,xe()))})),t.issues.length&&(Hn.has(typeof n)?r.issues.push(...et(n,t.issues)):r.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:n,issues:t.issues.map(s=>He(s,a,xe()))})),r.value.set(e.value,t.value)}var _u=g("$ZodSet",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!(o instanceof Set))return r.issues.push({input:o,inst:e,expected:"set",code:"invalid_type"}),r;let i=[];r.value=new Set;for(let a of o){let s=t.valueType._zod.run({value:a,issues:[]},n);s instanceof Promise?i.push(s.then(c=>qm(c,r))):qm(s,r)}return i.length?Promise.all(i).then(()=>r):r}});function qm(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}var $u=g("$ZodEnum",(e,t)=>{V.init(e,t);let r=Jn(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>Hn.has(typeof o)).map(o=>typeof o=="string"?at(o):o.toString()).join("|")})$`),e._zod.parse=(o,i)=>{let a=o.value;return n.has(a)||o.issues.push({code:"invalid_value",values:r,input:a,inst:e}),o}}),bu=g("$ZodLiteral",(e,t)=>{if(V.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map(n=>typeof n=="string"?at(n):n?at(n.toString()):String(n)).join("|")})$`),e._zod.parse=(n,o)=>{let i=n.value;return r.has(i)||n.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),n}}),xu=g("$ZodFile",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return o instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:o,inst:e}),r}}),ku=g("$ZodTransform",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new mr(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(a=>(r.value=a,r));if(o instanceof Promise)throw new kt;return r.value=o,r}});function Lm(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var qi=g("$ZodOptional",(e,t)=>{V.init(e,t),e._zod.optin="optional",e._zod.optout="optional",K(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),K(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Kn(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>Lm(i,r.value)):Lm(o,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),wu=g("$ZodExactOptional",(e,t)=>{qi.init(e,t),K(e._zod,"values",()=>t.innerType._zod.values),K(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),Su=g("$ZodNullable",(e,t)=>{V.init(e,t),K(e._zod,"optin",()=>t.innerType._zod.optin),K(e._zod,"optout",()=>t.innerType._zod.optout),K(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Kn(r.source)}|null)$`):void 0}),K(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),zu=g("$ZodDefault",(e,t)=>{V.init(e,t),e._zod.optin="optional",K(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>Vm(i,t)):Vm(o,t)}});function Vm(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Iu=g("$ZodPrefault",(e,t)=>{V.init(e,t),e._zod.optin="optional",K(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),Pu=g("$ZodNonOptional",(e,t)=>{V.init(e,t),K(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>Jm(i,e)):Jm(o,e)}});function Jm(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}var ju=g("$ZodSuccess",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new mr("ZodSuccess");let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.issues.length===0,r)):(r.value=o.issues.length===0,r)}}),Eu=g("$ZodCatch",(e,t)=>{V.init(e,t),K(e._zod,"optin",()=>t.innerType._zod.optin),K(e._zod,"optout",()=>t.innerType._zod.optout),K(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.value,i.issues.length&&(r.value=t.catchValue({...r,error:{issues:i.issues.map(a=>He(a,n,xe()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(i=>He(i,n,xe()))},input:r.value}),r.issues=[]),r)}}),Tu=g("$ZodNaN",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:e,expected:"nan",code:"invalid_type"}),r)}),Ou=g("$ZodPipe",(e,t)=>{V.init(e,t),K(e._zod,"values",()=>t.in._zod.values),K(e._zod,"optin",()=>t.in._zod.optin),K(e._zod,"optout",()=>t.out._zod.optout),K(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let i=t.out._zod.run(r,n);return i instanceof Promise?i.then(a=>Ri(a,t.in,n)):Ri(i,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(i=>Ri(i,t.out,n)):Ri(o,t.out,n)}});function Ri(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}var uo=g("$ZodCodec",(e,t)=>{V.init(e,t),K(e._zod,"values",()=>t.in._zod.values),K(e._zod,"optin",()=>t.in._zod.optin),K(e._zod,"optout",()=>t.out._zod.optout),K(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if((n.direction||"forward")==="forward"){let i=t.in._zod.run(r,n);return i instanceof Promise?i.then(a=>Ci(a,t,n)):Ci(i,t,n)}else{let i=t.out._zod.run(r,n);return i instanceof Promise?i.then(a=>Ci(a,t,n)):Ci(i,t,n)}}});function Ci(e,t,r){if(e.issues.length)return e.aborted=!0,e;if((r.direction||"forward")==="forward"){let o=t.transform(e.value,e);return o instanceof Promise?o.then(i=>Zi(e,i,t.out,r)):Zi(e,o,t.out,r)}else{let o=t.reverseTransform(e.value,e);return o instanceof Promise?o.then(i=>Zi(e,i,t.in,r)):Zi(e,o,t.in,r)}}function Zi(e,t,r,n){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:t,issues:e.issues},n)}var Nu=g("$ZodReadonly",(e,t)=>{V.init(e,t),K(e._zod,"propValues",()=>t.innerType._zod.propValues),K(e._zod,"values",()=>t.innerType._zod.values),K(e._zod,"optin",()=>t.innerType?._zod?.optin),K(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(Km):Km(o)}});function Km(e){return e.value=Object.freeze(e.value),e}var Du=g("$ZodTemplateLiteral",(e,t)=>{V.init(e,t);let r=[];for(let n of t.parts)if(typeof n=="object"&&n!==null){if(!n._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...n._zod.traits].shift()}`);let o=n._zod.pattern instanceof RegExp?n._zod.pattern.source:n._zod.pattern;if(!o)throw new Error(`Invalid template literal part: ${n._zod.traits}`);let i=o.startsWith("^")?1:0,a=o.endsWith("$")?o.length-1:o.length;r.push(o.slice(i,a))}else if(n===null||Xs.has(typeof n))r.push(at(`${n}`));else throw new Error(`Invalid template literal part: ${n}`);e._zod.pattern=new RegExp(`^${r.join("")}$`),e._zod.parse=(n,o)=>typeof n.value!="string"?(n.issues.push({input:n.value,inst:e,expected:"string",code:"invalid_type"}),n):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),n)}),Ru=g("$ZodFunction",(e,t)=>(V.init(e,t),e._def=t,e._zod.def=t,e.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return function(...n){let o=e._def.input?Yn(e._def.input,n):n,i=Reflect.apply(r,this,o);return e._def.output?Yn(e._def.output,i):i}},e.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return async function(...n){let o=e._def.input?await eo(e._def.input,n):n,i=await Reflect.apply(r,this,o);return e._def.output?await eo(e._def.output,i):i}},e._zod.parse=(r,n)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:e}),r):(e._def.output&&e._def.output._zod.def.type==="promise"?r.value=e.implementAsync(r.value):r.value=e.implement(r.value),r),e.input=(...r)=>{let n=e.constructor;return Array.isArray(r[0])?new n({type:"function",input:new Fi({type:"tuple",items:r[0],rest:r[1]}),output:e._def.output}):new n({type:"function",input:r[0],output:e._def.output})},e.output=r=>{let n=e.constructor;return new n({type:"function",input:e._def.input,output:r})},e)),Cu=g("$ZodPromise",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>Promise.resolve(r.value).then(o=>t.innerType._zod.run({value:o,issues:[]},n))}),Zu=g("$ZodLazy",(e,t)=>{V.init(e,t),K(e._zod,"innerType",()=>t.getter()),K(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),K(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),K(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),K(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(r,n)=>e._zod.innerType._zod.run(r,n)}),Au=g("$ZodCustom",(e,t)=>{ue.init(e,t),V.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(i=>Hm(i,r,n,e));Hm(o,r,n,e)}});function Hm(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(Qr(o))}}var rx=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(o){return e[o]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};return o=>{switch(o.code){case"invalid_type":{let i=n[o.expected]??o.expected,a=F(o.input),s=n[a]??a;return`Invalid input: expected ${i}, received ${s}`}case"invalid_value":return o.values.length===1?`Invalid input: expected ${A(o.values[0])}`:`Invalid option: expected one of ${Z(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=t(o.origin);return a?`Too big: expected ${o.origin??"value"} to have ${i}${o.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${o.origin??"value"} to be ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=t(o.origin);return a?`Too small: expected ${o.origin} to have ${i}${o.minimum.toString()} ${a.unit}`:`Too small: expected ${o.origin} to be ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Invalid string: must start with "${i.prefix}"`:i.format==="ends_with"?`Invalid string: must end with "${i.suffix}"`:i.format==="includes"?`Invalid string: must include "${i.includes}"`:i.format==="regex"?`Invalid string: must match pattern ${i.pattern}`:`Invalid ${r[i.format]??o.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${o.divisor}`;case"unrecognized_keys":return`Unrecognized key${o.keys.length>1?"s":""}: ${Z(o.keys,", ")}`;case"invalid_key":return`Invalid key in ${o.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${o.origin}`;default:return"Invalid input"}}};function Uu(){return{localeError:rx()}}var Qm;var Fu=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let o={...n,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function qu(){return new Fu}(Qm=globalThis).__zod_globalRegistry??(Qm.__zod_globalRegistry=qu());var qe=globalThis.__zod_globalRegistry;function Lu(e,t){return new e({type:"string",...I(t)})}function Li(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...I(t)})}function lo(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...I(t)})}function Vi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...I(t)})}function Ji(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...I(t)})}function Ki(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...I(t)})}function Hi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...I(t)})}function po(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...I(t)})}function Bi(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...I(t)})}function Wi(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...I(t)})}function Gi(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...I(t)})}function Xi(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...I(t)})}function Yi(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...I(t)})}function Qi(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...I(t)})}function ea(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...I(t)})}function ta(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...I(t)})}function ra(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...I(t)})}function Vu(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...I(t)})}function na(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...I(t)})}function oa(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...I(t)})}function ia(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...I(t)})}function aa(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...I(t)})}function sa(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...I(t)})}function ca(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...I(t)})}function Ju(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...I(t)})}function Ku(e,t){return new e({type:"string",format:"date",check:"string_format",...I(t)})}function Hu(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...I(t)})}function Bu(e,t){return new e({type:"string",format:"duration",check:"string_format",...I(t)})}function Wu(e,t){return new e({type:"number",checks:[],...I(t)})}function Gu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...I(t)})}function Xu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...I(t)})}function Yu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...I(t)})}function Qu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...I(t)})}function el(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...I(t)})}function tl(e,t){return new e({type:"boolean",...I(t)})}function rl(e,t){return new e({type:"bigint",...I(t)})}function nl(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...I(t)})}function ol(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...I(t)})}function il(e,t){return new e({type:"symbol",...I(t)})}function al(e,t){return new e({type:"undefined",...I(t)})}function sl(e,t){return new e({type:"null",...I(t)})}function cl(e){return new e({type:"any"})}function ul(e){return new e({type:"unknown"})}function ll(e,t){return new e({type:"never",...I(t)})}function dl(e,t){return new e({type:"void",...I(t)})}function pl(e,t){return new e({type:"date",...I(t)})}function fl(e,t){return new e({type:"nan",...I(t)})}function Ct(e,t){return new jc({check:"less_than",...I(t),value:e,inclusive:!1})}function tt(e,t){return new jc({check:"less_than",...I(t),value:e,inclusive:!0})}function Zt(e,t){return new Ec({check:"greater_than",...I(t),value:e,inclusive:!1})}function Le(e,t){return new Ec({check:"greater_than",...I(t),value:e,inclusive:!0})}function ml(e){return Zt(0,e)}function hl(e){return Ct(0,e)}function gl(e){return tt(0,e)}function vl(e){return Le(0,e)}function yr(e,t){return new vm({check:"multiple_of",...I(t),value:e})}function _r(e,t){return new $m({check:"max_size",...I(t),maximum:e})}function At(e,t){return new bm({check:"min_size",...I(t),minimum:e})}function tn(e,t){return new xm({check:"size_equals",...I(t),size:e})}function rn(e,t){return new km({check:"max_length",...I(t),maximum:e})}function Yt(e,t){return new wm({check:"min_length",...I(t),minimum:e})}function nn(e,t){return new Sm({check:"length_equals",...I(t),length:e})}function fo(e,t){return new zm({check:"string_format",format:"regex",...I(t),pattern:e})}function mo(e){return new Im({check:"string_format",format:"lowercase",...I(e)})}function ho(e){return new Pm({check:"string_format",format:"uppercase",...I(e)})}function go(e,t){return new jm({check:"string_format",format:"includes",...I(t),includes:e})}function vo(e,t){return new Em({check:"string_format",format:"starts_with",...I(t),prefix:e})}function yo(e,t){return new Tm({check:"string_format",format:"ends_with",...I(t),suffix:e})}function yl(e,t,r){return new Om({check:"property",property:e,schema:t,...I(r)})}function _o(e,t){return new Nm({check:"mime_type",mime:e,...I(t)})}function wt(e){return new Dm({check:"overwrite",tx:e})}function $o(e){return wt(t=>t.normalize(e))}function bo(){return wt(e=>e.trim())}function xo(){return wt(e=>e.toLowerCase())}function ko(){return wt(e=>e.toUpperCase())}function ua(){return wt(e=>Bs(e))}function eh(e,t,r){return new e({type:"array",element:t,...I(r)})}function _l(e,t){return new e({type:"file",...I(t)})}function $l(e,t,r){let n=I(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function bl(e,t,r){return new e({type:"custom",check:"custom",fn:t,...I(r)})}function xl(e){let t=ax(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(Qr(n,r.value,t._zod.def));else{let o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),r.issues.push(Qr(o))}},e(r.value,r)));return t}function ax(e,t){let r=new ue({check:"custom",...I(t)});return r._zod.check=e,r}function kl(e){let t=new ue({check:"describe"});return t._zod.onattach=[r=>{let n=qe.get(r)??{};qe.add(r,{...n,description:e})}],t._zod.check=()=>{},t}function wl(e){let t=new ue({check:"meta"});return t._zod.onattach=[r=>{let n=qe.get(r)??{};qe.add(r,{...n,...e})}],t._zod.check=()=>{},t}function Sl(e,t){let r=I(t),n=r.truthy??["true","1","yes","on","y","enabled"],o=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(n=n.map(f=>typeof f=="string"?f.toLowerCase():f),o=o.map(f=>typeof f=="string"?f.toLowerCase():f));let i=new Set(n),a=new Set(o),s=e.Codec??uo,c=e.Boolean??so,u=e.String??vr,l=new u({type:"string",error:r.error}),d=new c({type:"boolean",error:r.error}),p=new s({type:"pipe",in:l,out:d,transform:((f,m)=>{let h=f;return r.case!=="sensitive"&&(h=h.toLowerCase()),i.has(h)?!0:a.has(h)?!1:(m.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...a],input:m.value,inst:p,continue:!1}),{})}),reverseTransform:((f,m)=>f===!0?n[0]||"true":o[0]||"false"),error:r.error});return p}function on(e,t,r,n={}){let o=I(n),i={...I(n),check:"string_format",type:"string",format:t,fn:typeof r=="function"?r:s=>r.test(s),...o};return r instanceof RegExp&&(i.pattern=r),new e(i)}function la(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??qe,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function fe(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,r.schemaPath.includes(e)&&(i.cycle=r.path),i.schema;let a={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,a);let s=e._zod.toJSONSchema?.();if(s)a.schema=s;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,l);else{let p=a.schema,f=t.processors[o.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);f(e,t,p,l)}let d=e._zod.parent;d&&(a.ref||(a.ref=d),fe(d,t,l),t.seen.get(d).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(a.schema,c),t.io==="input"&&Ve(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&a.schema._prefault&&((n=a.schema).default??(n.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function da(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=new Map;for(let a of e.seen.entries()){let s=e.metadataRegistry.get(a[0])?.id;if(s){let c=n.get(s);if(c&&c!==a[0])throw new Error(`Duplicate schema id "${s}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(s,a[0])}}let o=a=>{let s=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(a[0])?.id,p=e.external.uri??(m=>m);if(d)return{ref:p(d)};let f=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=f,{defId:f,ref:`${p("__shared")}#/${s}/${f}`}}if(a[1]===r)return{ref:"#"};let u=`#/${s}/`,l=a[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+l}},i=a=>{if(a[1].schema.$ref)return;let s=a[1],{ref:c,defId:u}=o(a);s.def={...s.schema},u&&(s.defId=u);let l=s.schema;for(let d in l)delete l[d];l.$ref=c};if(e.cycles==="throw")for(let a of e.seen.entries()){let s=a[1];if(s.cycle)throw new Error(`Cycle detected: #/${s.cycle?.join("/")}/<root>
46
-
47
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of e.seen.entries()){let s=a[1];if(t===a[0]){i(a);continue}if(e.external){let u=e.external.registry.get(a[0])?.id;if(t!==a[0]&&u){i(a);continue}}if(e.metadataRegistry.get(a[0])?.id){i(a);continue}if(s.cycle){i(a);continue}if(s.count>1&&e.reused==="ref"){i(a);continue}}}function pa(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=a=>{let s=e.seen.get(a);if(s.ref===null)return;let c=s.def??s.schema,u={...c},l=s.ref;if(s.ref=null,l){n(l);let p=e.seen.get(l),f=p.schema;if(f.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(f)):Object.assign(c,f),Object.assign(c,u),a._zod.parent===l)for(let h in c)h==="$ref"||h==="allOf"||h in u||delete c[h];if(f.$ref&&p.def)for(let h in c)h==="$ref"||h==="allOf"||h in p.def&&JSON.stringify(c[h])===JSON.stringify(p.def[h])&&delete c[h]}let d=a._zod.parent;if(d&&d!==l){n(d);let p=e.seen.get(d);if(p?.schema.$ref&&(c.$ref=p.schema.$ref,p.def))for(let f in c)f==="$ref"||f==="allOf"||f in p.def&&JSON.stringify(c[f])===JSON.stringify(p.def[f])&&delete c[f]}e.override({zodSchema:a,jsonSchema:c,path:s.path??[]})};for(let a of[...e.seen.entries()].reverse())n(a[0]);let o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}Object.assign(o,r.def??r.schema);let i=e.external?.defs??{};for(let a of e.seen.entries()){let s=a[1];s.def&&s.defId&&(i[s.defId]=s.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:wo(t,"input",e.processors),output:wo(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Ve(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return Ve(n.element,r);if(n.type==="set")return Ve(n.valueType,r);if(n.type==="lazy")return Ve(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return Ve(n.innerType,r);if(n.type==="intersection")return Ve(n.left,r)||Ve(n.right,r);if(n.type==="record"||n.type==="map")return Ve(n.keyType,r)||Ve(n.valueType,r);if(n.type==="pipe")return Ve(n.in,r)||Ve(n.out,r);if(n.type==="object"){for(let o in n.shape)if(Ve(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(Ve(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(Ve(o,r))return!0;return!!(n.rest&&Ve(n.rest,r))}return!1}var th=(e,t={})=>r=>{let n=la({...r,processors:t});return fe(e,n),da(n,e),pa(n,e)},wo=(e,t,r={})=>n=>{let{libraryOptions:o,target:i}=n??{},a=la({...o??{},target:i,io:t,processors:r});return fe(e,a),da(a,e),pa(a,e)};var sx={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},rh=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:a,format:s,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof a=="number"&&(o.maxLength=a),s&&(o.format=sx[s]??s,o.format===""&&delete o.format,s==="time"&&delete o.format),u&&(o.contentEncoding=u),c&&c.size>0){let l=[...c];l.length===1?o.pattern=l[0].source:l.length>1&&(o.allOf=[...l.map(d=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},nh=(e,t,r,n)=>{let o=r,{minimum:i,maximum:a,format:s,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=e._zod.bag;typeof s=="string"&&s.includes("int")?o.type="integer":o.type="number",typeof l=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=l,o.exclusiveMinimum=!0):o.exclusiveMinimum=l),typeof i=="number"&&(o.minimum=i,typeof l=="number"&&t.target!=="draft-04"&&(l>=i?delete o.minimum:delete o.exclusiveMinimum)),typeof u=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=u,o.exclusiveMaximum=!0):o.exclusiveMaximum=u),typeof a=="number"&&(o.maximum=a,typeof u=="number"&&t.target!=="draft-04"&&(u<=a?delete o.maximum:delete o.exclusiveMaximum)),typeof c=="number"&&(o.multipleOf=c)},oh=(e,t,r,n)=>{r.type="boolean"},ih=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},ah=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},sh=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},ch=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},uh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},lh=(e,t,r,n)=>{r.not={}},dh=(e,t,r,n)=>{},ph=(e,t,r,n)=>{},fh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},mh=(e,t,r,n)=>{let o=e._zod.def,i=Jn(o.entries);i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),r.enum=i},hh=(e,t,r,n)=>{let o=e._zod.def,i=[];for(let a of o.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(a))}else i.push(a);if(i.length!==0)if(i.length===1){let a=i[0];r.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[a]:r.const=a}else i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),i.every(a=>typeof a=="boolean")&&(r.type="boolean"),i.every(a=>a===null)&&(r.type="null"),r.enum=i},gh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},vh=(e,t,r,n)=>{let o=r,i=e._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},yh=(e,t,r,n)=>{let o=r,i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:s,mime:c}=e._zod.bag;a!==void 0&&(i.minLength=a),s!==void 0&&(i.maxLength=s),c?c.length===1?(i.contentMediaType=c[0],Object.assign(o,i)):(Object.assign(o,i),o.anyOf=c.map(u=>({contentMediaType:u}))):Object.assign(o,i)},_h=(e,t,r,n)=>{r.type="boolean"},$h=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},bh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},xh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},kh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},wh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},Sh=(e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:a,maximum:s}=e._zod.bag;typeof a=="number"&&(o.minItems=a),typeof s=="number"&&(o.maxItems=s),o.type="array",o.items=fe(i.element,t,{...n,path:[...n.path,"items"]})},zh=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object",o.properties={};let a=i.shape;for(let u in a)o.properties[u]=fe(a[u],t,{...n,path:[...n.path,"properties",u]});let s=new Set(Object.keys(a)),c=new Set([...s].filter(u=>{let l=i.shape[u]._zod;return t.io==="input"?l.optin===void 0:l.optout===void 0}));c.size>0&&(o.required=Array.from(c)),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=fe(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},zl=(e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,a=o.options.map((s,c)=>fe(s,t,{...n,path:[...n.path,i?"oneOf":"anyOf",c]}));i?r.oneOf=a:r.anyOf=a},Ih=(e,t,r,n)=>{let o=e._zod.def,i=fe(o.left,t,{...n,path:[...n.path,"allOf",0]}),a=fe(o.right,t,{...n,path:[...n.path,"allOf",1]}),s=u=>"allOf"in u&&Object.keys(u).length===1,c=[...s(i)?i.allOf:[i],...s(a)?a.allOf:[a]];r.allOf=c},Ph=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="array";let a=t.target==="draft-2020-12"?"prefixItems":"items",s=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",c=i.items.map((p,f)=>fe(p,t,{...n,path:[...n.path,a,f]})),u=i.rest?fe(i.rest,t,{...n,path:[...n.path,s,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null;t.target==="draft-2020-12"?(o.prefixItems=c,u&&(o.items=u)):t.target==="openapi-3.0"?(o.items={anyOf:c},u&&o.items.anyOf.push(u),o.minItems=c.length,u||(o.maxItems=c.length)):(o.items=c,u&&(o.additionalItems=u));let{minimum:l,maximum:d}=e._zod.bag;typeof l=="number"&&(o.minItems=l),typeof d=="number"&&(o.maxItems=d)},jh=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object";let a=i.keyType,c=a._zod.bag?.patterns;if(i.mode==="loose"&&c&&c.size>0){let l=fe(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let d of c)o.patternProperties[d.source]=l}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=fe(i.keyType,t,{...n,path:[...n.path,"propertyNames"]})),o.additionalProperties=fe(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]});let u=a._zod.values;if(u){let l=[...u].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(o.required=l)}},Eh=(e,t,r,n)=>{let o=e._zod.def,i=fe(o.innerType,t,n),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=o.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},Th=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Oh=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},Nh=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},Dh=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=a},Rh=(e,t,r,n)=>{let o=e._zod.def,i=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;fe(i,t,n);let a=t.seen.get(e);a.ref=i},Ch=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0},Zh=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Il=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Ah=(e,t,r,n)=>{let o=e._zod.innerType;fe(o,t,n);let i=t.seen.get(e);i.ref=o};function an(e){return!!e._zod}function Qt(e,t){return an(e)?en(e,t):e.safeParse(t)}function fa(e){if(!e)return;let t;if(an(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function qh(e){if(an(e)){let i=e._zod?.def;if(i){if(i.value!==void 0)return i.value;if(Array.isArray(i.values)&&i.values.length>0)return i.values[0]}}let r=e._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let n=e.value;if(n!==void 0)return n}var So={};Tn(So,{ZodAny:()=>ag,ZodArray:()=>lg,ZodBase64:()=>Xl,ZodBase64URL:()=>Yl,ZodBigInt:()=>xa,ZodBigIntFormat:()=>td,ZodBoolean:()=>ba,ZodCIDRv4:()=>Wl,ZodCIDRv6:()=>Gl,ZodCUID:()=>ql,ZodCUID2:()=>Ll,ZodCatch:()=>Eg,ZodCodec:()=>cd,ZodCustom:()=>Ia,ZodCustomStringFormat:()=>Io,ZodDate:()=>nd,ZodDefault:()=>wg,ZodDiscriminatedUnion:()=>pg,ZodE164:()=>Ql,ZodEmail:()=>Ul,ZodEmoji:()=>Ml,ZodEnum:()=>zo,ZodExactOptional:()=>bg,ZodFile:()=>_g,ZodFunction:()=>Ug,ZodGUID:()=>ha,ZodIPv4:()=>Hl,ZodIPv6:()=>Bl,ZodIntersection:()=>fg,ZodJWT:()=>ed,ZodKSUID:()=>Kl,ZodLazy:()=>Cg,ZodLiteral:()=>yg,ZodMAC:()=>rg,ZodMap:()=>gg,ZodNaN:()=>Og,ZodNanoID:()=>Fl,ZodNever:()=>cg,ZodNonOptional:()=>ad,ZodNull:()=>ig,ZodNullable:()=>kg,ZodNumber:()=>$a,ZodNumberFormat:()=>sn,ZodObject:()=>ka,ZodOptional:()=>id,ZodPipe:()=>sd,ZodPrefault:()=>zg,ZodPromise:()=>Ag,ZodReadonly:()=>Ng,ZodRecord:()=>za,ZodSet:()=>vg,ZodString:()=>ya,ZodStringFormat:()=>le,ZodSuccess:()=>jg,ZodSymbol:()=>ng,ZodTemplateLiteral:()=>Rg,ZodTransform:()=>$g,ZodTuple:()=>mg,ZodType:()=>H,ZodULID:()=>Vl,ZodURL:()=>_a,ZodUUID:()=>Ut,ZodUndefined:()=>og,ZodUnion:()=>wa,ZodUnknown:()=>sg,ZodVoid:()=>ug,ZodXID:()=>Jl,ZodXor:()=>dg,_ZodString:()=>Al,_default:()=>Sg,_function:()=>Sk,any:()=>sk,array:()=>Y,base64:()=>Vx,base64url:()=>Jx,bigint:()=>rk,boolean:()=>$e,catch:()=>Tg,check:()=>zk,cidrv4:()=>qx,cidrv6:()=>Lx,codec:()=>xk,cuid:()=>Dx,cuid2:()=>Rx,custom:()=>ud,date:()=>uk,describe:()=>Ik,discriminatedUnion:()=>Sa,e164:()=>Kx,email:()=>wx,emoji:()=>Ox,enum:()=>Re,exactOptional:()=>xg,file:()=>yk,float32:()=>Yx,float64:()=>Qx,function:()=>Sk,guid:()=>Sx,hash:()=>Xx,hex:()=>Gx,hostname:()=>Wx,httpUrl:()=>Tx,instanceof:()=>jk,int:()=>Zl,int32:()=>ek,int64:()=>nk,intersection:()=>jo,ipv4:()=>Ux,ipv6:()=>Fx,json:()=>Tk,jwt:()=>Hx,keyof:()=>lk,ksuid:()=>Ax,lazy:()=>Zg,literal:()=>N,looseObject:()=>De,looseRecord:()=>mk,mac:()=>Mx,map:()=>hk,meta:()=>Pk,nan:()=>bk,nanoid:()=>Nx,nativeEnum:()=>vk,never:()=>rd,nonoptional:()=>Pg,null:()=>Po,nullable:()=>ga,nullish:()=>_k,number:()=>ie,object:()=>T,optional:()=>he,partialRecord:()=>fk,pipe:()=>va,prefault:()=>Ig,preprocess:()=>Pa,promise:()=>wk,readonly:()=>Dg,record:()=>me,refine:()=>Mg,set:()=>gk,strictObject:()=>dk,string:()=>y,stringFormat:()=>Bx,stringbool:()=>Ek,success:()=>$k,superRefine:()=>Fg,symbol:()=>ik,templateLiteral:()=>kk,transform:()=>od,tuple:()=>hg,uint32:()=>tk,uint64:()=>ok,ulid:()=>Cx,undefined:()=>ak,union:()=>se,unknown:()=>de,url:()=>Ex,uuid:()=>zx,uuidv4:()=>Ix,uuidv6:()=>Px,uuidv7:()=>jx,void:()=>ck,xid:()=>Zx,xor:()=>pk});var ma={};Tn(ma,{endsWith:()=>yo,gt:()=>Zt,gte:()=>Le,includes:()=>go,length:()=>nn,lowercase:()=>mo,lt:()=>Ct,lte:()=>tt,maxLength:()=>rn,maxSize:()=>_r,mime:()=>_o,minLength:()=>Yt,minSize:()=>At,multipleOf:()=>yr,negative:()=>hl,nonnegative:()=>vl,nonpositive:()=>gl,normalize:()=>$o,overwrite:()=>wt,positive:()=>ml,property:()=>yl,regex:()=>fo,size:()=>tn,slugify:()=>ua,startsWith:()=>vo,toLowerCase:()=>xo,toUpperCase:()=>ko,trim:()=>bo,uppercase:()=>ho});var $r={};Tn($r,{ZodISODate:()=>Tl,ZodISODateTime:()=>jl,ZodISODuration:()=>Rl,ZodISOTime:()=>Nl,date:()=>Ol,datetime:()=>El,duration:()=>Cl,time:()=>Dl});var jl=g("ZodISODateTime",(e,t)=>{Lc.init(e,t),le.init(e,t)});function El(e){return Ju(jl,e)}var Tl=g("ZodISODate",(e,t)=>{Vc.init(e,t),le.init(e,t)});function Ol(e){return Ku(Tl,e)}var Nl=g("ZodISOTime",(e,t)=>{Jc.init(e,t),le.init(e,t)});function Dl(e){return Hu(Nl,e)}var Rl=g("ZodISODuration",(e,t)=>{Kc.init(e,t),le.init(e,t)});function Cl(e){return Bu(Rl,e)}var Lh=(e,t)=>{Pi.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>Ei(e,r)},flatten:{value:r=>ji(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Xr,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Xr,2)}},isEmpty:{get(){return e.issues.length===0}}})},rR=g("ZodError",Lh),rt=g("ZodError",Lh,{Parent:Error});var Vh=Xn(rt),Jh=Qn(rt),Kh=to(rt),Hh=ro(rt),Bh=om(rt),Wh=im(rt),Gh=am(rt),Xh=sm(rt),Yh=cm(rt),Qh=um(rt),eg=lm(rt),tg=dm(rt);var H=g("ZodType",(e,t)=>(V.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:wo(e,"input"),output:wo(e,"output")}}),e.toJSONSchema=th(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(k.mergeDefs(t,{checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0}),e.with=e.check,e.clone=(r,n)=>Fe(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>Vh(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>Kh(e,r,n),e.parseAsync=async(r,n)=>Jh(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>Hh(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>Bh(e,r,n),e.decode=(r,n)=>Wh(e,r,n),e.encodeAsync=async(r,n)=>Gh(e,r,n),e.decodeAsync=async(r,n)=>Xh(e,r,n),e.safeEncode=(r,n)=>Yh(e,r,n),e.safeDecode=(r,n)=>Qh(e,r,n),e.safeEncodeAsync=async(r,n)=>eg(e,r,n),e.safeDecodeAsync=async(r,n)=>tg(e,r,n),e.refine=(r,n)=>e.check(Mg(r,n)),e.superRefine=r=>e.check(Fg(r)),e.overwrite=r=>e.check(wt(r)),e.optional=()=>he(e),e.exactOptional=()=>xg(e),e.nullable=()=>ga(e),e.nullish=()=>he(ga(e)),e.nonoptional=r=>Pg(e,r),e.array=()=>Y(e),e.or=r=>se([e,r]),e.and=r=>jo(e,r),e.transform=r=>va(e,od(r)),e.default=r=>Sg(e,r),e.prefault=r=>Ig(e,r),e.catch=r=>Tg(e,r),e.pipe=r=>va(e,r),e.readonly=()=>Dg(e),e.describe=r=>{let n=e.clone();return qe.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return qe.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return qe.get(e);let n=e.clone();return qe.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=r=>r(e),e)),Al=g("_ZodString",(e,t)=>{vr.init(e,t),H.init(e,t),e._zod.processJSONSchema=(n,o,i)=>rh(e,n,o,i);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(fo(...n)),e.includes=(...n)=>e.check(go(...n)),e.startsWith=(...n)=>e.check(vo(...n)),e.endsWith=(...n)=>e.check(yo(...n)),e.min=(...n)=>e.check(Yt(...n)),e.max=(...n)=>e.check(rn(...n)),e.length=(...n)=>e.check(nn(...n)),e.nonempty=(...n)=>e.check(Yt(1,...n)),e.lowercase=n=>e.check(mo(n)),e.uppercase=n=>e.check(ho(n)),e.trim=()=>e.check(bo()),e.normalize=(...n)=>e.check($o(...n)),e.toLowerCase=()=>e.check(xo()),e.toUpperCase=()=>e.check(ko()),e.slugify=()=>e.check(ua())}),ya=g("ZodString",(e,t)=>{vr.init(e,t),Al.init(e,t),e.email=r=>e.check(Li(Ul,r)),e.url=r=>e.check(po(_a,r)),e.jwt=r=>e.check(ca(ed,r)),e.emoji=r=>e.check(Bi(Ml,r)),e.guid=r=>e.check(lo(ha,r)),e.uuid=r=>e.check(Vi(Ut,r)),e.uuidv4=r=>e.check(Ji(Ut,r)),e.uuidv6=r=>e.check(Ki(Ut,r)),e.uuidv7=r=>e.check(Hi(Ut,r)),e.nanoid=r=>e.check(Wi(Fl,r)),e.guid=r=>e.check(lo(ha,r)),e.cuid=r=>e.check(Gi(ql,r)),e.cuid2=r=>e.check(Xi(Ll,r)),e.ulid=r=>e.check(Yi(Vl,r)),e.base64=r=>e.check(ia(Xl,r)),e.base64url=r=>e.check(aa(Yl,r)),e.xid=r=>e.check(Qi(Jl,r)),e.ksuid=r=>e.check(ea(Kl,r)),e.ipv4=r=>e.check(ta(Hl,r)),e.ipv6=r=>e.check(ra(Bl,r)),e.cidrv4=r=>e.check(na(Wl,r)),e.cidrv6=r=>e.check(oa(Gl,r)),e.e164=r=>e.check(sa(Ql,r)),e.datetime=r=>e.check(El(r)),e.date=r=>e.check(Ol(r)),e.time=r=>e.check(Dl(r)),e.duration=r=>e.check(Cl(r))});function y(e){return Lu(ya,e)}var le=g("ZodStringFormat",(e,t)=>{ae.init(e,t),Al.init(e,t)}),Ul=g("ZodEmail",(e,t)=>{Dc.init(e,t),le.init(e,t)});function wx(e){return Li(Ul,e)}var ha=g("ZodGUID",(e,t)=>{Oc.init(e,t),le.init(e,t)});function Sx(e){return lo(ha,e)}var Ut=g("ZodUUID",(e,t)=>{Nc.init(e,t),le.init(e,t)});function zx(e){return Vi(Ut,e)}function Ix(e){return Ji(Ut,e)}function Px(e){return Ki(Ut,e)}function jx(e){return Hi(Ut,e)}var _a=g("ZodURL",(e,t)=>{Rc.init(e,t),le.init(e,t)});function Ex(e){return po(_a,e)}function Tx(e){return po(_a,{protocol:/^https?$/,hostname:st.domain,...k.normalizeParams(e)})}var Ml=g("ZodEmoji",(e,t)=>{Cc.init(e,t),le.init(e,t)});function Ox(e){return Bi(Ml,e)}var Fl=g("ZodNanoID",(e,t)=>{Zc.init(e,t),le.init(e,t)});function Nx(e){return Wi(Fl,e)}var ql=g("ZodCUID",(e,t)=>{Ac.init(e,t),le.init(e,t)});function Dx(e){return Gi(ql,e)}var Ll=g("ZodCUID2",(e,t)=>{Uc.init(e,t),le.init(e,t)});function Rx(e){return Xi(Ll,e)}var Vl=g("ZodULID",(e,t)=>{Mc.init(e,t),le.init(e,t)});function Cx(e){return Yi(Vl,e)}var Jl=g("ZodXID",(e,t)=>{Fc.init(e,t),le.init(e,t)});function Zx(e){return Qi(Jl,e)}var Kl=g("ZodKSUID",(e,t)=>{qc.init(e,t),le.init(e,t)});function Ax(e){return ea(Kl,e)}var Hl=g("ZodIPv4",(e,t)=>{Hc.init(e,t),le.init(e,t)});function Ux(e){return ta(Hl,e)}var rg=g("ZodMAC",(e,t)=>{Wc.init(e,t),le.init(e,t)});function Mx(e){return Vu(rg,e)}var Bl=g("ZodIPv6",(e,t)=>{Bc.init(e,t),le.init(e,t)});function Fx(e){return ra(Bl,e)}var Wl=g("ZodCIDRv4",(e,t)=>{Gc.init(e,t),le.init(e,t)});function qx(e){return na(Wl,e)}var Gl=g("ZodCIDRv6",(e,t)=>{Xc.init(e,t),le.init(e,t)});function Lx(e){return oa(Gl,e)}var Xl=g("ZodBase64",(e,t)=>{Yc.init(e,t),le.init(e,t)});function Vx(e){return ia(Xl,e)}var Yl=g("ZodBase64URL",(e,t)=>{Qc.init(e,t),le.init(e,t)});function Jx(e){return aa(Yl,e)}var Ql=g("ZodE164",(e,t)=>{eu.init(e,t),le.init(e,t)});function Kx(e){return sa(Ql,e)}var ed=g("ZodJWT",(e,t)=>{tu.init(e,t),le.init(e,t)});function Hx(e){return ca(ed,e)}var Io=g("ZodCustomStringFormat",(e,t)=>{ru.init(e,t),le.init(e,t)});function Bx(e,t,r={}){return on(Io,e,t,r)}function Wx(e){return on(Io,"hostname",st.hostname,e)}function Gx(e){return on(Io,"hex",st.hex,e)}function Xx(e,t){let r=t?.enc??"hex",n=`${e}_${r}`,o=st[n];if(!o)throw new Error(`Unrecognized hash format: ${n}`);return on(Io,n,o,t)}var $a=g("ZodNumber",(e,t)=>{Ui.init(e,t),H.init(e,t),e._zod.processJSONSchema=(n,o,i)=>nh(e,n,o,i),e.gt=(n,o)=>e.check(Zt(n,o)),e.gte=(n,o)=>e.check(Le(n,o)),e.min=(n,o)=>e.check(Le(n,o)),e.lt=(n,o)=>e.check(Ct(n,o)),e.lte=(n,o)=>e.check(tt(n,o)),e.max=(n,o)=>e.check(tt(n,o)),e.int=n=>e.check(Zl(n)),e.safe=n=>e.check(Zl(n)),e.positive=n=>e.check(Zt(0,n)),e.nonnegative=n=>e.check(Le(0,n)),e.negative=n=>e.check(Ct(0,n)),e.nonpositive=n=>e.check(tt(0,n)),e.multipleOf=(n,o)=>e.check(yr(n,o)),e.step=(n,o)=>e.check(yr(n,o)),e.finite=()=>e;let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function ie(e){return Wu($a,e)}var sn=g("ZodNumberFormat",(e,t)=>{nu.init(e,t),$a.init(e,t)});function Zl(e){return Gu(sn,e)}function Yx(e){return Xu(sn,e)}function Qx(e){return Yu(sn,e)}function ek(e){return Qu(sn,e)}function tk(e){return el(sn,e)}var ba=g("ZodBoolean",(e,t)=>{so.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>oh(e,r,n,o)});function $e(e){return tl(ba,e)}var xa=g("ZodBigInt",(e,t)=>{Mi.init(e,t),H.init(e,t),e._zod.processJSONSchema=(n,o,i)=>ih(e,n,o,i),e.gte=(n,o)=>e.check(Le(n,o)),e.min=(n,o)=>e.check(Le(n,o)),e.gt=(n,o)=>e.check(Zt(n,o)),e.gte=(n,o)=>e.check(Le(n,o)),e.min=(n,o)=>e.check(Le(n,o)),e.lt=(n,o)=>e.check(Ct(n,o)),e.lte=(n,o)=>e.check(tt(n,o)),e.max=(n,o)=>e.check(tt(n,o)),e.positive=n=>e.check(Zt(BigInt(0),n)),e.negative=n=>e.check(Ct(BigInt(0),n)),e.nonpositive=n=>e.check(tt(BigInt(0),n)),e.nonnegative=n=>e.check(Le(BigInt(0),n)),e.multipleOf=(n,o)=>e.check(yr(n,o));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});function rk(e){return rl(xa,e)}var td=g("ZodBigIntFormat",(e,t)=>{ou.init(e,t),xa.init(e,t)});function nk(e){return nl(td,e)}function ok(e){return ol(td,e)}var ng=g("ZodSymbol",(e,t)=>{iu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ah(e,r,n,o)});function ik(e){return il(ng,e)}var og=g("ZodUndefined",(e,t)=>{au.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ch(e,r,n,o)});function ak(e){return al(og,e)}var ig=g("ZodNull",(e,t)=>{su.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>sh(e,r,n,o)});function Po(e){return sl(ig,e)}var ag=g("ZodAny",(e,t)=>{cu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>dh(e,r,n,o)});function sk(){return cl(ag)}var sg=g("ZodUnknown",(e,t)=>{uu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ph(e,r,n,o)});function de(){return ul(sg)}var cg=g("ZodNever",(e,t)=>{lu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>lh(e,r,n,o)});function rd(e){return ll(cg,e)}var ug=g("ZodVoid",(e,t)=>{du.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>uh(e,r,n,o)});function ck(e){return dl(ug,e)}var nd=g("ZodDate",(e,t)=>{pu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(n,o,i)=>fh(e,n,o,i),e.min=(n,o)=>e.check(Le(n,o)),e.max=(n,o)=>e.check(tt(n,o));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});function uk(e){return pl(nd,e)}var lg=g("ZodArray",(e,t)=>{fu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Sh(e,r,n,o),e.element=t.element,e.min=(r,n)=>e.check(Yt(r,n)),e.nonempty=r=>e.check(Yt(1,r)),e.max=(r,n)=>e.check(rn(r,n)),e.length=(r,n)=>e.check(nn(r,n)),e.unwrap=()=>e.element});function Y(e,t){return eh(lg,e,t)}function lk(e){let t=e._zod.def.shape;return Re(Object.keys(t))}var ka=g("ZodObject",(e,t)=>{Ym.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>zh(e,r,n,o),k.defineLazy(e,"shape",()=>t.shape),e.keyof=()=>Re(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:de()}),e.loose=()=>e.clone({...e._zod.def,catchall:de()}),e.strict=()=>e.clone({...e._zod.def,catchall:rd()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>k.extend(e,r),e.safeExtend=r=>k.safeExtend(e,r),e.merge=r=>k.merge(e,r),e.pick=r=>k.pick(e,r),e.omit=r=>k.omit(e,r),e.partial=(...r)=>k.partial(id,e,r[0]),e.required=(...r)=>k.required(ad,e,r[0])});function T(e,t){let r={type:"object",shape:e??{},...k.normalizeParams(t)};return new ka(r)}function dk(e,t){return new ka({type:"object",shape:e,catchall:rd(),...k.normalizeParams(t)})}function De(e,t){return new ka({type:"object",shape:e,catchall:de(),...k.normalizeParams(t)})}var wa=g("ZodUnion",(e,t)=>{co.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>zl(e,r,n,o),e.options=t.options});function se(e,t){return new wa({type:"union",options:e,...k.normalizeParams(t)})}var dg=g("ZodXor",(e,t)=>{wa.init(e,t),mu.init(e,t),e._zod.processJSONSchema=(r,n,o)=>zl(e,r,n,o),e.options=t.options});function pk(e,t){return new dg({type:"union",options:e,inclusive:!1,...k.normalizeParams(t)})}var pg=g("ZodDiscriminatedUnion",(e,t)=>{wa.init(e,t),hu.init(e,t)});function Sa(e,t,r){return new pg({type:"union",options:t,discriminator:e,...k.normalizeParams(r)})}var fg=g("ZodIntersection",(e,t)=>{gu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ih(e,r,n,o)});function jo(e,t){return new fg({type:"intersection",left:e,right:t})}var mg=g("ZodTuple",(e,t)=>{Fi.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ph(e,r,n,o),e.rest=r=>e.clone({...e._zod.def,rest:r})});function hg(e,t,r){let n=t instanceof V,o=n?r:t,i=n?t:null;return new mg({type:"tuple",items:e,rest:i,...k.normalizeParams(o)})}var za=g("ZodRecord",(e,t)=>{vu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>jh(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function me(e,t,r){return new za({type:"record",keyType:e,valueType:t,...k.normalizeParams(r)})}function fk(e,t,r){let n=Fe(e);return n._zod.values=void 0,new za({type:"record",keyType:n,valueType:t,...k.normalizeParams(r)})}function mk(e,t,r){return new za({type:"record",keyType:e,valueType:t,mode:"loose",...k.normalizeParams(r)})}var gg=g("ZodMap",(e,t)=>{yu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>kh(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(At(...r)),e.nonempty=r=>e.check(At(1,r)),e.max=(...r)=>e.check(_r(...r)),e.size=(...r)=>e.check(tn(...r))});function hk(e,t,r){return new gg({type:"map",keyType:e,valueType:t,...k.normalizeParams(r)})}var vg=g("ZodSet",(e,t)=>{_u.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wh(e,r,n,o),e.min=(...r)=>e.check(At(...r)),e.nonempty=r=>e.check(At(1,r)),e.max=(...r)=>e.check(_r(...r)),e.size=(...r)=>e.check(tn(...r))});function gk(e,t){return new vg({type:"set",valueType:e,...k.normalizeParams(t)})}var zo=g("ZodEnum",(e,t)=>{$u.init(e,t),H.init(e,t),e._zod.processJSONSchema=(n,o,i)=>mh(e,n,o,i),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let i={};for(let a of n)if(r.has(a))i[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new zo({...t,checks:[],...k.normalizeParams(o),entries:i})},e.exclude=(n,o)=>{let i={...t.entries};for(let a of n)if(r.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new zo({...t,checks:[],...k.normalizeParams(o),entries:i})}});function Re(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new zo({type:"enum",entries:r,...k.normalizeParams(t)})}function vk(e,t){return new zo({type:"enum",entries:e,...k.normalizeParams(t)})}var yg=g("ZodLiteral",(e,t)=>{bu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>hh(e,r,n,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function N(e,t){return new yg({type:"literal",values:Array.isArray(e)?e:[e],...k.normalizeParams(t)})}var _g=g("ZodFile",(e,t)=>{xu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>yh(e,r,n,o),e.min=(r,n)=>e.check(At(r,n)),e.max=(r,n)=>e.check(_r(r,n)),e.mime=(r,n)=>e.check(_o(Array.isArray(r)?r:[r],n))});function yk(e){return _l(_g,e)}var $g=g("ZodTransform",(e,t)=>{ku.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xh(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new mr(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(k.issue(i,r.value,t));else{let a=i;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=e),r.issues.push(k.issue(a))}};let o=t.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});function od(e){return new $g({type:"transform",transform:e})}var id=g("ZodOptional",(e,t)=>{qi.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Il(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function he(e){return new id({type:"optional",innerType:e})}var bg=g("ZodExactOptional",(e,t)=>{wu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Il(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function xg(e){return new bg({type:"optional",innerType:e})}var kg=g("ZodNullable",(e,t)=>{Su.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Eh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ga(e){return new kg({type:"nullable",innerType:e})}function _k(e){return he(ga(e))}var wg=g("ZodDefault",(e,t)=>{zu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Oh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Sg(e,t){return new wg({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():k.shallowClone(t)}})}var zg=g("ZodPrefault",(e,t)=>{Iu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Nh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Ig(e,t){return new zg({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():k.shallowClone(t)}})}var ad=g("ZodNonOptional",(e,t)=>{Pu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Th(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Pg(e,t){return new ad({type:"nonoptional",innerType:e,...k.normalizeParams(t)})}var jg=g("ZodSuccess",(e,t)=>{ju.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_h(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function $k(e){return new jg({type:"success",innerType:e})}var Eg=g("ZodCatch",(e,t)=>{Eu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Dh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Tg(e,t){return new Eg({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var Og=g("ZodNaN",(e,t)=>{Tu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>gh(e,r,n,o)});function bk(e){return fl(Og,e)}var sd=g("ZodPipe",(e,t)=>{Ou.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Rh(e,r,n,o),e.in=t.in,e.out=t.out});function va(e,t){return new sd({type:"pipe",in:e,out:t})}var cd=g("ZodCodec",(e,t)=>{sd.init(e,t),uo.init(e,t)});function xk(e,t,r){return new cd({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}var Ng=g("ZodReadonly",(e,t)=>{Nu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ch(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Dg(e){return new Ng({type:"readonly",innerType:e})}var Rg=g("ZodTemplateLiteral",(e,t)=>{Du.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>vh(e,r,n,o)});function kk(e,t){return new Rg({type:"template_literal",parts:e,...k.normalizeParams(t)})}var Cg=g("ZodLazy",(e,t)=>{Zu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ah(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});function Zg(e){return new Cg({type:"lazy",getter:e})}var Ag=g("ZodPromise",(e,t)=>{Cu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function wk(e){return new Ag({type:"promise",innerType:e})}var Ug=g("ZodFunction",(e,t)=>{Ru.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>bh(e,r,n,o)});function Sk(e){return new Ug({type:"function",input:Array.isArray(e?.input)?hg(e?.input):e?.input??Y(de()),output:e?.output??de()})}var Ia=g("ZodCustom",(e,t)=>{Au.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$h(e,r,n,o)});function zk(e){let t=new ue({check:"custom"});return t._zod.check=e,t}function ud(e,t){return $l(Ia,e??(()=>!0),t)}function Mg(e,t={}){return bl(Ia,e,t)}function Fg(e){return xl(e)}var Ik=kl,Pk=wl;function jk(e,t={}){let r=new Ia({type:"custom",check:"custom",fn:n=>n instanceof e,abort:!0,...k.normalizeParams(t)});return r._zod.bag.Class=e,r._zod.check=n=>{n.value instanceof e||n.issues.push({code:"invalid_type",expected:e.name,input:n.value,inst:r,path:[...r._zod.def.path??[]]})},r}var Ek=(...e)=>Sl({Codec:cd,Boolean:ba,String:ya},...e);function Tk(e){let t=Zg(()=>se([y(e),ie(),$e(),Po(),Y(t),me(y(),t)]));return t}function Pa(e,t){return va(od(e),t)}var qg;qg||(qg={});var lR={...So,...ma,iso:$r};xe(Uu());var dd="2025-11-25";var Lg=[dd,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],er="io.modelcontextprotocol/related-task",Ea="2.0",ze=ud(e=>e!==null&&(typeof e=="object"||typeof e=="function")),Vg=se([y(),ie().int()]),Jg=y(),jR=De({ttl:se([ie(),Po()]).optional(),pollInterval:ie().optional()}),Rk=T({ttl:ie().optional()}),Ck=T({taskId:y()}),pd=De({progressToken:Vg.optional(),[er]:Ck.optional()}),nt=T({_meta:pd.optional()}),Eo=nt.extend({task:Rk.optional()}),Kg=e=>Eo.safeParse(e).success,Ie=T({method:y(),params:nt.loose().optional()}),ct=T({_meta:pd.optional()}),ut=T({method:y(),params:ct.loose().optional()}),Pe=De({_meta:pd.optional()}),Ta=se([y(),ie().int()]),Hg=T({jsonrpc:N(Ea),id:Ta,...Ie.shape}).strict(),fd=e=>Hg.safeParse(e).success,Bg=T({jsonrpc:N(Ea),...ut.shape}).strict(),Wg=e=>Bg.safeParse(e).success,md=T({jsonrpc:N(Ea),id:Ta,result:Pe}).strict(),To=e=>md.safeParse(e).success;var q;(function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(q||(q={}));var hd=T({jsonrpc:N(Ea),id:Ta.optional(),error:T({code:ie().int(),message:y(),data:de().optional()})}).strict();var Gg=e=>hd.safeParse(e).success;var Xg=se([Hg,Bg,md,hd]),ER=se([md,hd]),Oa=Pe.strict(),Zk=ct.extend({requestId:Ta.optional(),reason:y().optional()}),Na=ut.extend({method:N("notifications/cancelled"),params:Zk}),Ak=T({src:y(),mimeType:y().optional(),sizes:Y(y()).optional(),theme:Re(["light","dark"]).optional()}),Oo=T({icons:Y(Ak).optional()}),cn=T({name:y(),title:y().optional()}),Yg=cn.extend({...cn.shape,...Oo.shape,version:y(),websiteUrl:y().optional(),description:y().optional()}),Uk=jo(T({applyDefaults:$e().optional()}),me(y(),de())),Mk=Pa(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,jo(T({form:Uk.optional(),url:ze.optional()}),me(y(),de()).optional())),Fk=De({list:ze.optional(),cancel:ze.optional(),requests:De({sampling:De({createMessage:ze.optional()}).optional(),elicitation:De({create:ze.optional()}).optional()}).optional()}),qk=De({list:ze.optional(),cancel:ze.optional(),requests:De({tools:De({call:ze.optional()}).optional()}).optional()}),Lk=T({experimental:me(y(),ze).optional(),sampling:T({context:ze.optional(),tools:ze.optional()}).optional(),elicitation:Mk.optional(),roots:T({listChanged:$e().optional()}).optional(),tasks:Fk.optional()}),Vk=nt.extend({protocolVersion:y(),capabilities:Lk,clientInfo:Yg}),gd=Ie.extend({method:N("initialize"),params:Vk});var Jk=T({experimental:me(y(),ze).optional(),logging:ze.optional(),completions:ze.optional(),prompts:T({listChanged:$e().optional()}).optional(),resources:T({subscribe:$e().optional(),listChanged:$e().optional()}).optional(),tools:T({listChanged:$e().optional()}).optional(),tasks:qk.optional()}),Kk=Pe.extend({protocolVersion:y(),capabilities:Jk,serverInfo:Yg,instructions:y().optional()}),vd=ut.extend({method:N("notifications/initialized"),params:ct.optional()});var Da=Ie.extend({method:N("ping"),params:nt.optional()}),Hk=T({progress:ie(),total:he(ie()),message:he(y())}),Bk=T({...ct.shape,...Hk.shape,progressToken:Vg}),Ra=ut.extend({method:N("notifications/progress"),params:Bk}),Wk=nt.extend({cursor:Jg.optional()}),No=Ie.extend({params:Wk.optional()}),Do=Pe.extend({nextCursor:Jg.optional()}),Gk=Re(["working","input_required","completed","failed","cancelled"]),Ro=T({taskId:y(),status:Gk,ttl:se([ie(),Po()]),createdAt:y(),lastUpdatedAt:y(),pollInterval:he(ie()),statusMessage:he(y())}),un=Pe.extend({task:Ro}),Xk=ct.merge(Ro),Co=ut.extend({method:N("notifications/tasks/status"),params:Xk}),Ca=Ie.extend({method:N("tasks/get"),params:nt.extend({taskId:y()})}),Za=Pe.merge(Ro),Aa=Ie.extend({method:N("tasks/result"),params:nt.extend({taskId:y()})}),TR=Pe.loose(),Ua=No.extend({method:N("tasks/list")}),Ma=Do.extend({tasks:Y(Ro)}),Fa=Ie.extend({method:N("tasks/cancel"),params:nt.extend({taskId:y()})}),Qg=Pe.merge(Ro),ev=T({uri:y(),mimeType:he(y()),_meta:me(y(),de()).optional()}),tv=ev.extend({text:y()}),yd=y().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),rv=ev.extend({blob:yd}),Zo=Re(["user","assistant"]),ln=T({audience:Y(Zo).optional(),priority:ie().min(0).max(1).optional(),lastModified:$r.datetime({offset:!0}).optional()}),nv=T({...cn.shape,...Oo.shape,uri:y(),description:he(y()),mimeType:he(y()),annotations:ln.optional(),_meta:he(De({}))}),Yk=T({...cn.shape,...Oo.shape,uriTemplate:y(),description:he(y()),mimeType:he(y()),annotations:ln.optional(),_meta:he(De({}))}),_d=No.extend({method:N("resources/list")}),Qk=Do.extend({resources:Y(nv)}),ew=No.extend({method:N("resources/templates/list")}),tw=Do.extend({resourceTemplates:Y(Yk)}),$d=nt.extend({uri:y()}),rw=$d,bd=Ie.extend({method:N("resources/read"),params:rw}),nw=Pe.extend({contents:Y(se([tv,rv]))}),ow=ut.extend({method:N("notifications/resources/list_changed"),params:ct.optional()}),iw=$d,aw=Ie.extend({method:N("resources/subscribe"),params:iw}),sw=$d,cw=Ie.extend({method:N("resources/unsubscribe"),params:sw}),uw=ct.extend({uri:y()}),lw=ut.extend({method:N("notifications/resources/updated"),params:uw}),dw=T({name:y(),description:he(y()),required:he($e())}),pw=T({...cn.shape,...Oo.shape,description:he(y()),arguments:he(Y(dw)),_meta:he(De({}))}),xd=No.extend({method:N("prompts/list")}),fw=Do.extend({prompts:Y(pw)}),mw=nt.extend({name:y(),arguments:me(y(),y()).optional()}),kd=Ie.extend({method:N("prompts/get"),params:mw}),wd=T({type:N("text"),text:y(),annotations:ln.optional(),_meta:me(y(),de()).optional()}),Sd=T({type:N("image"),data:yd,mimeType:y(),annotations:ln.optional(),_meta:me(y(),de()).optional()}),zd=T({type:N("audio"),data:yd,mimeType:y(),annotations:ln.optional(),_meta:me(y(),de()).optional()}),hw=T({type:N("tool_use"),name:y(),id:y(),input:me(y(),de()),_meta:me(y(),de()).optional()}),gw=T({type:N("resource"),resource:se([tv,rv]),annotations:ln.optional(),_meta:me(y(),de()).optional()}),vw=nv.extend({type:N("resource_link")}),Id=se([wd,Sd,zd,vw,gw]),yw=T({role:Zo,content:Id}),_w=Pe.extend({description:y().optional(),messages:Y(yw)}),$w=ut.extend({method:N("notifications/prompts/list_changed"),params:ct.optional()}),bw=T({title:y().optional(),readOnlyHint:$e().optional(),destructiveHint:$e().optional(),idempotentHint:$e().optional(),openWorldHint:$e().optional()}),xw=T({taskSupport:Re(["required","optional","forbidden"]).optional()}),ov=T({...cn.shape,...Oo.shape,description:y().optional(),inputSchema:T({type:N("object"),properties:me(y(),ze).optional(),required:Y(y()).optional()}).catchall(de()),outputSchema:T({type:N("object"),properties:me(y(),ze).optional(),required:Y(y()).optional()}).catchall(de()).optional(),annotations:bw.optional(),execution:xw.optional(),_meta:me(y(),de()).optional()}),Pd=No.extend({method:N("tools/list")}),kw=Do.extend({tools:Y(ov)}),qa=Pe.extend({content:Y(Id).default([]),structuredContent:me(y(),de()).optional(),isError:$e().optional()}),OR=qa.or(Pe.extend({toolResult:de()})),ww=Eo.extend({name:y(),arguments:me(y(),de()).optional()}),Ao=Ie.extend({method:N("tools/call"),params:ww}),Sw=ut.extend({method:N("notifications/tools/list_changed"),params:ct.optional()}),NR=T({autoRefresh:$e().default(!0),debounceMs:ie().int().nonnegative().default(300)}),Uo=Re(["debug","info","notice","warning","error","critical","alert","emergency"]),zw=nt.extend({level:Uo}),jd=Ie.extend({method:N("logging/setLevel"),params:zw}),Iw=ct.extend({level:Uo,logger:y().optional(),data:de()}),Pw=ut.extend({method:N("notifications/message"),params:Iw}),jw=T({name:y().optional()}),Ew=T({hints:Y(jw).optional(),costPriority:ie().min(0).max(1).optional(),speedPriority:ie().min(0).max(1).optional(),intelligencePriority:ie().min(0).max(1).optional()}),Tw=T({mode:Re(["auto","required","none"]).optional()}),Ow=T({type:N("tool_result"),toolUseId:y().describe("The unique identifier for the corresponding tool call."),content:Y(Id).default([]),structuredContent:T({}).loose().optional(),isError:$e().optional(),_meta:me(y(),de()).optional()}),Nw=Sa("type",[wd,Sd,zd]),ja=Sa("type",[wd,Sd,zd,hw,Ow]),Dw=T({role:Zo,content:se([ja,Y(ja)]),_meta:me(y(),de()).optional()}),Rw=Eo.extend({messages:Y(Dw),modelPreferences:Ew.optional(),systemPrompt:y().optional(),includeContext:Re(["none","thisServer","allServers"]).optional(),temperature:ie().optional(),maxTokens:ie().int(),stopSequences:Y(y()).optional(),metadata:ze.optional(),tools:Y(ov).optional(),toolChoice:Tw.optional()}),Cw=Ie.extend({method:N("sampling/createMessage"),params:Rw}),Ed=Pe.extend({model:y(),stopReason:he(Re(["endTurn","stopSequence","maxTokens"]).or(y())),role:Zo,content:Nw}),Td=Pe.extend({model:y(),stopReason:he(Re(["endTurn","stopSequence","maxTokens","toolUse"]).or(y())),role:Zo,content:se([ja,Y(ja)])}),Zw=T({type:N("boolean"),title:y().optional(),description:y().optional(),default:$e().optional()}),Aw=T({type:N("string"),title:y().optional(),description:y().optional(),minLength:ie().optional(),maxLength:ie().optional(),format:Re(["email","uri","date","date-time"]).optional(),default:y().optional()}),Uw=T({type:Re(["number","integer"]),title:y().optional(),description:y().optional(),minimum:ie().optional(),maximum:ie().optional(),default:ie().optional()}),Mw=T({type:N("string"),title:y().optional(),description:y().optional(),enum:Y(y()),default:y().optional()}),Fw=T({type:N("string"),title:y().optional(),description:y().optional(),oneOf:Y(T({const:y(),title:y()})),default:y().optional()}),qw=T({type:N("string"),title:y().optional(),description:y().optional(),enum:Y(y()),enumNames:Y(y()).optional(),default:y().optional()}),Lw=se([Mw,Fw]),Vw=T({type:N("array"),title:y().optional(),description:y().optional(),minItems:ie().optional(),maxItems:ie().optional(),items:T({type:N("string"),enum:Y(y())}),default:Y(y()).optional()}),Jw=T({type:N("array"),title:y().optional(),description:y().optional(),minItems:ie().optional(),maxItems:ie().optional(),items:T({anyOf:Y(T({const:y(),title:y()}))}),default:Y(y()).optional()}),Kw=se([Vw,Jw]),Hw=se([qw,Lw,Kw]),Bw=se([Hw,Zw,Aw,Uw]),Ww=Eo.extend({mode:N("form").optional(),message:y(),requestedSchema:T({type:N("object"),properties:me(y(),Bw),required:Y(y()).optional()})}),Gw=Eo.extend({mode:N("url"),message:y(),elicitationId:y(),url:y().url()}),Xw=se([Ww,Gw]),Yw=Ie.extend({method:N("elicitation/create"),params:Xw}),Qw=ct.extend({elicitationId:y()}),eS=ut.extend({method:N("notifications/elicitation/complete"),params:Qw}),La=Pe.extend({action:Re(["accept","decline","cancel"]),content:Pa(e=>e===null?void 0:e,me(y(),se([y(),ie(),$e(),Y(y())])).optional())}),tS=T({type:N("ref/resource"),uri:y()});var rS=T({type:N("ref/prompt"),name:y()}),nS=nt.extend({ref:se([rS,tS]),argument:T({name:y(),value:y()}),context:T({arguments:me(y(),y()).optional()}).optional()}),oS=Ie.extend({method:N("completion/complete"),params:nS});var iS=Pe.extend({completion:De({values:Y(y()).max(100),total:he(ie().int()),hasMore:he($e())})}),aS=T({uri:y().startsWith("file://"),name:y().optional(),_meta:me(y(),de()).optional()}),sS=Ie.extend({method:N("roots/list"),params:nt.optional()}),Od=Pe.extend({roots:Y(aS)}),cS=ut.extend({method:N("notifications/roots/list_changed"),params:ct.optional()}),DR=se([Da,gd,oS,jd,kd,xd,_d,ew,bd,aw,cw,Ao,Pd,Ca,Aa,Ua,Fa]),RR=se([Na,Ra,vd,cS,Co]),CR=se([Oa,Ed,Td,La,Od,Za,Ma,un]),ZR=se([Da,Cw,Yw,sS,Ca,Aa,Ua,Fa]),AR=se([Na,Ra,Pw,lw,ow,Sw,$w,Co,eS]),UR=se([Oa,Kk,iS,_w,fw,Qk,tw,nw,qa,kw,Za,Ma,un]),R=class e extends Error{constructor(t,r,n){super(`MCP error ${t}: ${r}`),this.code=t,this.data=n,this.name="McpError"}static fromError(t,r,n){if(t===q.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new ld(o.elicitations,r)}return new e(t,r,n)}},ld=class extends R{constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(q.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}};function tr(e){return e==="completed"||e==="failed"||e==="cancelled"}var _4=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Nd(e){let r=fa(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=qh(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function Dd(e,t){let r=Qt(e,t);if(!r.success)throw r.error;return r.data}var mS=6e4,Va=class{constructor(t){this._options=t,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(Na,r=>{this._oncancel(r)}),this.setNotificationHandler(Ra,r=>{this._onprogress(r)}),this.setRequestHandler(Da,r=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Ca,async(r,n)=>{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new R(q.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(Aa,async(r,n)=>{let o=async()=>{let i=r.params.taskId;if(this._taskMessageQueue){let s;for(;s=await this._taskMessageQueue.dequeue(i,n.sessionId);){if(s.type==="response"||s.type==="error"){let c=s.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),s.type==="response")l(c);else{let d=c,p=new R(d.error.code,d.error.message,d.error.data);l(p)}else{let d=s.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${u}`))}continue}await this._transport?.send(s.message,{relatedRequestId:n.requestId})}}let a=await this._taskStore.getTask(i,n.sessionId);if(!a)throw new R(q.InvalidParams,`Task not found: ${i}`);if(!tr(a.status))return await this._waitForTaskUpdate(i,n.signal),await o();if(tr(a.status)){let s=await this._taskStore.getTaskResult(i,n.sessionId);return this._clearTaskQueue(i),{...s,_meta:{...s._meta,[er]:{taskId:i}}}}return await o()};return await o()}),this.setRequestHandler(Ua,async(r,n)=>{try{let{tasks:o,nextCursor:i}=await this._taskStore.listTasks(r.params?.cursor,n.sessionId);return{tasks:o,nextCursor:i,_meta:{}}}catch(o){throw new R(q.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(Fa,async(r,n)=>{try{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new R(q.InvalidParams,`Task not found: ${r.params.taskId}`);if(tr(o.status))throw new R(q.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new R(q.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...i}}catch(o){throw o instanceof R?o:new R(q.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}}))}async _oncancel(t){if(!t.params.requestId)return;this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,r,n,o,i=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(o,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:o})}_resetTimeout(t){let r=this._timeoutInfo.get(t);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(t),R.fromError(q.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(t){let r=this._timeoutInfo.get(t);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(t))}async connect(t){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=t;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=i=>{n?.(i),this._onerror(i)};let o=this._transport?.onmessage;this._transport.onmessage=(i,a)=>{o?.(i,a),To(i)||Gg(i)?this._onresponse(i):fd(i)?this._onrequest(i,a):Wg(i)?this._onnotification(i):this._onerror(new Error(`Unknown message type: ${JSON.stringify(i)}`))},await this._transport.start()}_onclose(){let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let n of this._requestHandlerAbortControllers.values())n.abort();this._requestHandlerAbortControllers.clear();let r=R.fromError(q.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of t.values())n(r)}_onerror(t){this.onerror?.(t)}_onnotification(t){let r=this._notificationHandlers.get(t.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(t)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(t,r){let n=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,o=this._transport,i=t.params?._meta?.[er]?.taskId;if(n===void 0){let l={jsonrpc:"2.0",id:t.id,error:{code:q.MethodNotFound,message:"Method not found"}};i&&this._taskMessageQueue?this._enqueueTaskMessage(i,{type:"error",message:l,timestamp:Date.now()},o?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):o?.send(l).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let a=new AbortController;this._requestHandlerAbortControllers.set(t.id,a);let s=Kg(t.params)?t.params.task:void 0,c=this._taskStore?this.requestTaskStore(t,o?.sessionId):void 0,u={signal:a.signal,sessionId:o?.sessionId,_meta:t.params?._meta,sendNotification:async l=>{if(a.signal.aborted)return;let d={relatedRequestId:t.id};i&&(d.relatedTask={taskId:i}),await this.notification(l,d)},sendRequest:async(l,d,p)=>{if(a.signal.aborted)throw new R(q.ConnectionClosed,"Request was cancelled");let f={...p,relatedRequestId:t.id};i&&!f.relatedTask&&(f.relatedTask={taskId:i});let m=f.relatedTask?.taskId??i;return m&&c&&await c.updateTaskStatus(m,"input_required"),await this.request(l,d,f)},authInfo:r?.authInfo,requestId:t.id,requestInfo:r?.requestInfo,taskId:i,taskStore:c,taskRequestedTtl:s?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{s&&this.assertTaskHandlerCapability(t.method)}).then(()=>n(t,u)).then(async l=>{if(a.signal.aborted)return;let d={result:l,jsonrpc:"2.0",id:t.id};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"response",message:d,timestamp:Date.now()},o?.sessionId):await o?.send(d)},async l=>{if(a.signal.aborted)return;let d={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(l.code)?l.code:q.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"error",message:d,timestamp:Date.now()},o?.sessionId):await o?.send(d)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){let{progressToken:r,...n}=t.params,o=Number(r),i=this._progressHandlers.get(o);if(!i){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}let a=this._responseHandlers.get(o),s=this._timeoutInfo.get(o);if(s&&a&&s.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(c){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),a(c);return}i(n)}_onresponse(t){let r=Number(t.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),To(t))n(t);else{let a=new R(t.error.code,t.error.message,t.error.data);n(a)}return}let o=this._responseHandlers.get(r);if(o===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let i=!1;if(To(t)&&t.result&&typeof t.result=="object"){let a=t.result;if(a.task&&typeof a.task=="object"){let s=a.task;typeof s.taskId=="string"&&(i=!0,this._taskProgressTokens.set(s.taskId,r))}}if(i||this._progressHandlers.delete(r),To(t))o(t);else{let a=R.fromError(t.error.code,t.error.message,t.error.data);o(a)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(t,r,n){let{task:o}=n??{};if(!o){try{yield{type:"result",result:await this.request(t,r,n)}}catch(a){yield{type:"error",error:a instanceof R?a:new R(q.InternalError,String(a))}}return}let i;try{let a=await this.request(t,un,n);if(a.task)i=a.task.taskId,yield{type:"taskCreated",task:a.task};else throw new R(q.InternalError,"Task creation did not return a task");for(;;){let s=await this.getTask({taskId:i},n);if(yield{type:"taskStatus",task:s},tr(s.status)){s.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:i},r,n)}:s.status==="failed"?yield{type:"error",error:new R(q.InternalError,`Task ${i} failed`)}:s.status==="cancelled"&&(yield{type:"error",error:new R(q.InternalError,`Task ${i} was cancelled`)});return}if(s.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:i},r,n)};return}let c=s.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),n?.signal?.throwIfAborted()}}catch(a){yield{type:"error",error:a instanceof R?a:new R(q.InternalError,String(a))}}}request(t,r,n){let{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a,task:s,relatedTask:c}=n??{};return new Promise((u,l)=>{let d=$=>{l($)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method),s&&this.assertTaskCapability(t.method)}catch($){d($);return}n?.signal?.throwIfAborted();let p=this._requestMessageId++,f={...t,jsonrpc:"2.0",id:p};n?.onprogress&&(this._progressHandlers.set(p,n.onprogress),f.params={...t.params,_meta:{...t.params?._meta||{},progressToken:p}}),s&&(f.params={...f.params,task:s}),c&&(f.params={...f.params,_meta:{...f.params?._meta||{},[er]:c}});let m=$=>{this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String($)}},{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a}).catch(S=>this._onerror(new Error(`Failed to send cancellation: ${S}`)));let b=$ instanceof R?$:new R(q.RequestTimeout,String($));l(b)};this._responseHandlers.set(p,$=>{if(!n?.signal?.aborted){if($ instanceof Error)return l($);try{let b=Qt(r,$.result);b.success?u(b.data):l(b.error)}catch(b){l(b)}}}),n?.signal?.addEventListener("abort",()=>{m(n?.signal?.reason)});let h=n?.timeout??mS,v=()=>m(R.fromError(q.RequestTimeout,"Request timed out",{timeout:h}));this._setupTimeout(p,h,n?.maxTotalTimeout,v,n?.resetTimeoutOnProgress??!1);let _=c?.taskId;if(_){let $=b=>{let S=this._responseHandlers.get(p);S?S(b):this._onerror(new Error(`Response handler missing for side-channeled request ${p}`))};this._requestResolvers.set(p,$),this._enqueueTaskMessage(_,{type:"request",message:f,timestamp:Date.now()}).catch(b=>{this._cleanupTimeout(p),l(b)})}else this._transport.send(f,{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a}).catch($=>{this._cleanupTimeout(p),l($)})})}async getTask(t,r){return this.request({method:"tasks/get",params:t},Za,r)}async getTaskResult(t,r,n){return this.request({method:"tasks/result",params:t},r,n)}async listTasks(t,r){return this.request({method:"tasks/list",params:t},Ma,r)}async cancelTask(t,r){return this.request({method:"tasks/cancel",params:t},Qg,r)}async notification(t,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);let n=r?.relatedTask?.taskId;if(n){let s={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...t.params?._meta||{},[er]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:s,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;let s={...t,jsonrpc:"2.0"};r?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[er]:r.relatedTask}}}),this._transport?.send(s,r).catch(c=>this._onerror(c))});return}let a={...t,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[er]:r.relatedTask}}}),await this._transport.send(a,r)}setRequestHandler(t,r){let n=Nd(t);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(o,i)=>{let a=Dd(t,o);return Promise.resolve(r(a,i))})}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw new Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,r){let n=Nd(t);this._notificationHandlers.set(n,o=>{let i=Dd(t,o);return Promise.resolve(r(i))})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}_cleanupTaskProgressHandler(t){let r=this._taskProgressTokens.get(t);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(t))}async _enqueueTaskMessage(t,r,n){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let o=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,r,n,o)}async _clearTaskQueue(t,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(t,r);for(let o of n)if(o.type==="request"&&fd(o.message)){let i=o.message.id,a=this._requestResolvers.get(i);a?(a(new R(q.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(i)):this._onerror(new Error(`Resolver missing for request ${i} during task ${t} cleanup`))}}}async _waitForTaskUpdate(t,r){let n=this._options?.defaultTaskPollInterval??1e3;try{let o=await this._taskStore?.getTask(t);o?.pollInterval&&(n=o.pollInterval)}catch{}return new Promise((o,i)=>{if(r.aborted){i(new R(q.InvalidRequest,"Request cancelled"));return}let a=setTimeout(o,n);r.addEventListener("abort",()=>{clearTimeout(a),i(new R(q.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async o=>{if(!t)throw new Error("No request provided");return await n.createTask(o,t.id,{method:t.method,params:t.params},r)},getTask:async o=>{let i=await n.getTask(o,r);if(!i)throw new R(q.InvalidParams,"Failed to retrieve task: Task not found");return i},storeTaskResult:async(o,i,a)=>{await n.storeTaskResult(o,i,a,r);let s=await n.getTask(o,r);if(s){let c=Co.parse({method:"notifications/tasks/status",params:s});await this.notification(c),tr(s.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>n.getTaskResult(o,r),updateTaskStatus:async(o,i,a)=>{let s=await n.getTask(o,r);if(!s)throw new R(q.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(tr(s.status))throw new R(q.InvalidParams,`Cannot update task "${o}" from terminal status "${s.status}" to "${i}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(o,i,a,r);let c=await n.getTask(o,r);if(c){let u=Co.parse({method:"notifications/tasks/status",params:c});await this.notification(u),tr(c.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>n.listTasks(o,r)}}};function iv(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function av(e,t){let r={...e};for(let n in t){let o=n,i=t[o];if(i===void 0)continue;let a=r[o];iv(a)&&iv(i)?r[o]={...a,...i}:r[o]=i}return r}var l$=ot(jf(),1),d$=ot(u$(),1);function FE(){let e=new l$.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,d$.default)(e),e}var Ps=class{constructor(t){this._ajv=t??FE()}getValidator(t){let r="$id"in t&&typeof t.$id=="string"?this._ajv.getSchema(t.$id)??this._ajv.compile(t):this._ajv.compile(t);return n=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var js=class{constructor(t){this._server=t}requestStream(t,r,n){return this._server.requestStream(t,r,n)}async getTask(t,r){return this._server.getTask({taskId:t},r)}async getTaskResult(t,r,n){return this._server.getTaskResult({taskId:t},r,n)}async listTasks(t,r){return this._server.listTasks(t?{cursor:t}:void 0,r)}async cancelTask(t,r){return this._server.cancelTask({taskId:t},r)}};function p$(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!e.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${t})`);break;default:break}}function f$(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!e.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!e.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${t})`);break;default:break}}var Es=class extends Va{constructor(t,r){super(r),this._serverInfo=t,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Uo.options.map((n,o)=>[n,o])),this.isMessageIgnored=(n,o)=>{let i=this._loggingLevels.get(o);return i?this.LOG_LEVEL_SEVERITY.get(n)<this.LOG_LEVEL_SEVERITY.get(i):!1},this._capabilities=r?.capabilities??{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new Ps,this.setRequestHandler(gd,n=>this._oninitialize(n)),this.setNotificationHandler(vd,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(jd,async(n,o)=>{let i=o.sessionId||o.requestInfo?.headers["mcp-session-id"]||void 0,{level:a}=n.params,s=Uo.safeParse(a);return s.success&&this._loggingLevels.set(i,s.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new js(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=av(this._capabilities,t)}setRequestHandler(t,r){let o=fa(t)?.method;if(!o)throw new Error("Schema is missing a method literal");let i;if(an(o)){let s=o;i=s._zod?.def?.value??s.value}else{let s=o;i=s._def?.value??s.value}if(typeof i!="string")throw new Error("Schema method literal must be a string");if(i==="tools/call"){let s=async(c,u)=>{let l=Qt(Ao,c);if(!l.success){let m=l.error instanceof Error?l.error.message:String(l.error);throw new R(q.InvalidParams,`Invalid tools/call request: ${m}`)}let{params:d}=l.data,p=await Promise.resolve(r(c,u));if(d.task){let m=Qt(un,p);if(!m.success){let h=m.error instanceof Error?m.error.message:String(m.error);throw new R(q.InvalidParams,`Invalid task creation result: ${h}`)}return m.data}let f=Qt(qa,p);if(!f.success){let m=f.error instanceof Error?f.error.message:String(f.error);throw new R(q.InvalidParams,`Invalid tools/call result: ${m}`)}return f.data};return super.setRequestHandler(t,s)}return super.setRequestHandler(t,r)}assertCapabilityForMethod(t){switch(t){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${t})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${t})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${t})`);break;case"ping":break}}assertNotificationCapability(t){switch(t){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${t})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${t})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${t})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${t})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(t){if(this._capabilities)switch(t){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${t})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${t})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${t})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${t})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${t})`);break;case"ping":case"initialize":break}}assertTaskCapability(t){f$(this._clientCapabilities?.tasks?.requests,t,"Client")}assertTaskHandlerCapability(t){this._capabilities&&p$(this._capabilities.tasks?.requests,t,"Server")}async _oninitialize(t){let r=t.params.protocolVersion;return this._clientCapabilities=t.params.capabilities,this._clientVersion=t.params.clientInfo,{protocolVersion:Lg.includes(r)?r:dd,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"},Oa)}async createMessage(t,r){if((t.tools||t.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(t.messages.length>0){let n=t.messages[t.messages.length-1],o=Array.isArray(n.content)?n.content:[n.content],i=o.some(u=>u.type==="tool_result"),a=t.messages.length>1?t.messages[t.messages.length-2]:void 0,s=a?Array.isArray(a.content)?a.content:[a.content]:[],c=s.some(u=>u.type==="tool_use");if(i){if(o.some(u=>u.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!c)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let u=new Set(s.filter(d=>d.type==="tool_use").map(d=>d.id)),l=new Set(o.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(u.size!==l.size||![...u].every(d=>l.has(d)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return t.tools?this.request({method:"sampling/createMessage",params:t},Td,r):this.request({method:"sampling/createMessage",params:t},Ed,r)}async elicitInput(t,r){switch(t.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let o=t;return this.request({method:"elicitation/create",params:o},La,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let o=t.mode==="form"?t:{...t,mode:"form"},i=await this.request({method:"elicitation/create",params:o},La,r);if(i.action==="accept"&&i.content&&o.requestedSchema)try{let s=this._jsonSchemaValidator.getValidator(o.requestedSchema)(i.content);if(!s.valid)throw new R(q.InvalidParams,`Elicitation response content does not match requested schema: ${s.errorMessage}`)}catch(a){throw a instanceof R?a:new R(q.InternalError,`Error validating elicitation response: ${a instanceof Error?a.message:String(a)}`)}return i}}}createElicitationCompletionNotifier(t,r){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:t}},r)}async listRoots(t,r){return this.request({method:"roots/list",params:t},Od,r)}async sendLoggingMessage(t,r){if(this._capabilities.logging&&!this.isMessageIgnored(t.level,r))return this.notification({method:"notifications/message",params:t})}async sendResourceUpdated(t){return this.notification({method:"notifications/resources/updated",params:t})}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 Zf=ot(require("node:process"),1);var Ts=class{append(t){this._buffer=this._buffer?Buffer.concat([this._buffer,t]):t}readMessage(){if(!this._buffer)return null;let t=this._buffer.indexOf(`
48
- `);if(t===-1)return null;let r=this._buffer.toString("utf8",0,t).replace(/\r$/,"");return this._buffer=this._buffer.subarray(t+1),qE(r)}clear(){this._buffer=void 0}};function qE(e){return Xg.parse(JSON.parse(e))}function m$(e){return JSON.stringify(e)+`
49
- `}var Os=class{constructor(t=Zf.default.stdin,r=Zf.default.stdout){this._stdin=t,this._stdout=r,this._readBuffer=new Ts,this._started=!1,this._ondata=n=>{this._readBuffer.append(n),this.processReadBuffer()},this._onerror=n=>{this.onerror?.(n)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(;;)try{let t=this._readBuffer.readMessage();if(t===null)break;this.onmessage?.(t)}catch(t){this.onerror?.(t)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(t){return new Promise(r=>{let n=m$(t);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};var ke=ot(require("fs/promises")),be=ot(require("path")),Pn=10*1024*1024,LE=1e3,Ns=class{skillsPath;cachedSkills=null;loadingPromise=null;loadingEpoch=-1;skillMap=new Map;contentCache=new Map;contentCacheStat=new Map;canonicalPathMap=new Map;scanEpoch=0;lastSuccessfulScanAt=0;skillSignature=null;constructor(t){this.skillsPath=be.resolve(t)}stripQuotes(t){return t.replace(/^"(.*)"$|^'(.*)'$/,"$1$2").trim()}parseFrontmatter(t){let r=t;if(r.charCodeAt(0)===65279&&(r=r.slice(1)),!r.startsWith("---"))return{name:"",description:"",body:r.trim()};let n=r.slice(3).match(/\r?\n[ \t]*---[ \t]*(?:\r?\n|$)/);if(!n||n.index===void 0)return{name:"",description:"",body:r.trim()};let o=r.slice(3,3+n.index),i=r.slice(3+n.index+n[0].length).trim(),a=o.split(/\r?\n/),s="",c="",u=!1;for(let l of a){let d=l.match(/^name:\s*(.*?)\s*$/);if(d){s=this.stripQuotes(d[1]),u=!1;continue}let p=l.match(/^description:\s*(.*?)\s*$/);if(p){c=this.stripQuotes(p[1]),u=!0;continue}u&&/^\s+/.test(l)?c+=" "+l.trim():u=!1}return{name:s,description:c,body:i}}async listSkills(t=!1){if(!t&&this.cachedSkills){if(Date.now()-this.lastSuccessfulScanAt<LE)return this.cachedSkills;if(this.skillSignature!==null&&await this.computeSkillSignature()===this.skillSignature)return this.lastSuccessfulScanAt=Date.now(),this.cachedSkills}t&&this.dropContentCaches();let r=this.loadingPromise;if(r&&this.loadingEpoch===this.scanEpoch)return r;let n=++this.scanEpoch,o=this.internalListSkills(n);this.loadingPromise=o,this.loadingEpoch=n;try{return await o}finally{this.loadingPromise===o&&(this.loadingPromise=null,this.loadingEpoch=-1)}}dropContentCaches(){this.contentCache.clear(),this.contentCacheStat.clear(),this.canonicalPathMap.clear(),this.skillSignature=null}async computeSkillSignature(){let t=async r=>{try{let n=await ke.lstat(r);return`${n.mode}\0${n.ino}\0${n.size}\0${n.mtimeMs}`}catch{return"-"}};try{let r=await ke.readdir(this.skillsPath,{withFileTypes:!0}),n=[];for(let o of r){let i=be.join(this.skillsPath,o.name),a=o.isDirectory()?"d":o.isSymbolicLink()?"l":"f",s=a==="l"?await t(i):"-",c=await t(be.join(i,"SKILL.md"));n.push(`${o.name}\0${a}\0${s}\0${c}`)}return n.sort(),n.join("")}catch{return null}}async internalListSkills(t=this.scanEpoch){let r;try{let l=be.resolve(this.skillsPath),d=await ke.realpath(l),p=await ke.stat(d);if(!p.isDirectory())return this.cachedSkills??[];r={realRootPath:d,rootStat:p}}catch{return this.cachedSkills??[]}let n=await this.computeSkillSignature(),o=[],i=new Map,a=new Map,s=new Map,c=new Map,u=!1;try{let d=(await ke.readdir(this.skillsPath,{withFileTypes:!0})).filter(f=>f.isDirectory()||f.isSymbolicLink()),p=await Promise.all(d.map(async f=>{let m=be.join(this.skillsPath,f.name),h=be.join(m,"SKILL.md");try{let{content:v,realFilePath:_,stat:$}=await this.readFileNoFollow(h,this.skillsPath,r),{name:b,description:S,body:P}=this.parseFrontmatter(v);return{item:{name:b||f.name,description:S,skillPath:h},body:P,realFilePath:_,directoryName:f.name,stat:$}}catch(v){return v&&typeof v=="object"&&"code"in v&&v.code==="ENOENT"||process.stderr.write(`Warning: Failed to read skill file in directory "${f.name}"
50
- `),null}}));for(let f of p.filter(m=>m!==null).sort((m,h)=>m.directoryName<h.directoryName?-1:m.directoryName>h.directoryName?1:0)){let{item:m,body:h,realFilePath:v,directoryName:_,stat:$}=f,b=new Set([m.name.toLowerCase(),_.toLowerCase()]),S=[...b].find(Se=>i.has(Se));if(S){process.stderr.write(`Warning: Skipping skill directory "${_}" because name or alias "${S}" is already registered
51
- `);continue}o.push(m);for(let Se of b)i.set(Se,m);let P=be.resolve(m.skillPath);a.set(v,h),s.set(v,{dev:$.dev,ino:$.ino,size:$.size,mtimeMs:$.mtimeMs}),c.set(P,v),c.set(v,v)}u=!0}catch(l){process.stderr.write(`Error reading skills directory: ${String(l)}
52
- `)}return u&&t===this.scanEpoch?(this.skillMap=i,this.cachedSkills=o.sort((l,d)=>l.name.localeCompare(d.name)),this.lastSuccessfulScanAt=Date.now(),this.contentCache=a,this.contentCacheStat=s,this.canonicalPathMap=c,this.skillSignature=n):u||(this.skillSignature=null),this.cachedSkills??[]}async findSkill(t){let r=typeof t=="string"?t.trim():"";if(!(!r||r==="."||r===".."||r.includes("/")||r.includes("\\")||r.includes("\0")))return this.cachedSkills||await this.listSkills(),this.skillMap.get(r.toLowerCase())}async readFileNoFollow(t,r,n){let o=be.resolve(t),i=be.resolve(r),a=await ke.realpath(o),s=n?n.realRootPath:await ke.realpath(i);if(!(n?n.rootStat:await ke.stat(s)).isDirectory())throw new Error("Skills directory must be a directory");let u=be.relative(s,a);if(u===".."||u.startsWith(`..${be.sep}`)||be.isAbsolute(u))throw new Error("File is outside skills directory");let l=await ke.stat(a);if(!l.isFile()||l.nlink<1)throw new Error("Skill path is not a regular file");if(l.size>Pn)throw new Error("Skill file exceeds size limit");let d=process.platform==="win32"?0:ke.constants.O_NOFOLLOW,p=await ke.open(a,ke.constants.O_RDONLY|d);try{let f=await p.stat();if(!f.isFile()||f.nlink<1||f.dev!==l.dev||f.ino!==l.ino||f.size>Pn)throw new Error("File changed while opening");let m=f.size,h;if(m<=64*1024){h=Buffer.allocUnsafe(m);let _=0;for(;_<m;){let{bytesRead:$}=await p.read(h,_,m-_,null);if($===0)break;_+=$}_<m&&(h=h.subarray(0,_))}else{let _=[],b=0;for(;b<=Pn;){let S=Buffer.allocUnsafe(Math.min(65536,Pn+1-b)),{bytesRead:P}=await p.read(S,0,S.length,null);if(P===0)break;if(b+=P,_.push(S.subarray(0,P)),b>Pn)throw new Error("Skill file exceeds size limit")}h=Buffer.concat(_,b)}let v=await p.stat();if(v.size>Pn||v.dev!==l.dev||v.ino!==l.ino)throw new Error("File changed while reading");return{content:h.toString("utf-8"),realFilePath:a,stat:v}}finally{await p.close()}}async readSkillContent(t,r=!1){let n=be.isAbsolute(t)?be.resolve(t):be.resolve(this.skillsPath,t);if(!r){let o=await this.tryReadFromContentCache(n);if(o!==void 0)return o}try{let{content:o,realFilePath:i,stat:a}=await this.readFileNoFollow(n,this.skillsPath),{body:s}=this.parseFrontmatter(o);return this.contentCache.set(i,s),this.contentCacheStat.set(i,{dev:a.dev,ino:a.ino,size:a.size,mtimeMs:a.mtimeMs}),this.canonicalPathMap.set(n,i),this.canonicalPathMap.set(i,i),s}catch(o){throw new Error(`Failed to read skill content: ${o instanceof Error?o.message:String(o)}`)}}async tryReadFromContentCache(t){let r=this.canonicalPathMap.get(t);if(!r)return;let n=this.contentCache.get(r),o=this.contentCacheStat.get(r);if(!(n===void 0||!o))try{let i=await ke.stat(t);if(i.isFile()&&i.dev===o.dev&&i.ino===o.ino&&i.size===o.size&&i.mtimeMs===o.mtimeMs)return n}catch{}}clearCache(){this.scanEpoch++,this.cachedSkills=null,this.loadingPromise=null,this.loadingEpoch=-1,this.skillMap.clear(),this.contentCache.clear(),this.contentCacheStat.clear(),this.canonicalPathMap.clear(),this.skillSignature=null,this.lastSuccessfulScanAt=0}};var U=ot(require("fs")),w=ot(require("path")),Nr=ot(require("os")),g$=ot(require("crypto")),yi={lmstudio:{name:"LM Studio",aliases:["lmstudio","lm-studio"],getConfigPath:(e,t)=>w.join(t,".lmstudio","mcp.json"),type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},roo:{name:"Roo Code (VS Code Desktop)",aliases:["roo","roo-code","roocode"],getConfigPath:(e,t,r)=>{let n=e==="win32"?r||w.join(t,"AppData","Roaming"):e==="darwin"?w.join(t,"Library","Application Support"):w.join(t,".config");return w.join(n,"Code","User","globalStorage","rooveterinaryinc.roo-cline","settings","mcp_settings.json")},type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},copilot:{name:"GitHub Copilot (VS Code)",aliases:["vscode","code","copilot"],getConfigPath:(e,t,r,n)=>e==="win32"?w.join(r||w.join(t,"AppData","Roaming"),"Code","User","mcp.json"):e==="darwin"?w.join(t,"Library","Application Support","Code","User","mcp.json"):w.join(t,".config","Code","User","mcp.json"),type:"json-servers",defaultConfig:(e,t)=>({command:e,args:t,type:"stdio"})},"copilot-insiders":{name:"GitHub Copilot (VS Code Insiders)",aliases:["vscode-insiders","code-insiders","insiders","insider","vscode-insider","code-insider","copilot-insider"],getConfigPath:(e,t,r,n)=>e==="win32"?w.join(r||w.join(t,"AppData","Roaming"),"Code - Insiders","User","mcp.json"):e==="darwin"?w.join(t,"Library","Application Support","Code - Insiders","User","mcp.json"):w.join(t,".config","Code - Insiders","User","mcp.json"),type:"json-servers",defaultConfig:(e,t)=>({command:e,args:t,type:"stdio"})},cursor:{name:"Cursor",aliases:["cursor"],getConfigPath:(e,t)=>w.join(t,".cursor","mcp.json"),type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},hermes:{name:"Hermes Desktop / Agent",aliases:["hermes","hermes-desktop"],getConfigPath:(e,t,r,n)=>{if(e==="win32"){let o=n||w.join(t,"AppData","Local");return w.join(o,"hermes","config.yaml")}return w.join(t,".hermes","config.yaml")},type:"yaml",defaultConfig:(e,t)=>({command:e,args:t})},kimi:{name:"Kimi Work / Kimi Code",aliases:["kimi","kimi-work","kimi-code"],getConfigPath:(e,t)=>w.join(t,".kimi-code","mcp.json"),type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},claude:{name:"Claude Desktop",aliases:["claude","claude-desktop"],getConfigPath:(e,t,r)=>e==="win32"?w.join(r||w.join(t,"AppData","Roaming"),"Claude","claude_desktop_config.json"):e==="darwin"?w.join(t,"Library","Application Support","Claude","claude_desktop_config.json"):w.join(t,".config","Claude","claude_desktop_config.json"),type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},devin:{name:"Devin Desktop (formerly Windsurf)",aliases:["devin","devin-desktop","windsurf","codeium"],getConfigPath:(e,t)=>{let r=w.join(t,".config","devin","mcp_config.json");return U.existsSync(r)?r:w.join(t,".codeium","windsurf","mcp_config.json")},type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},antigravity:{name:"Antigravity (Google DeepMind)",aliases:["antigravity","agy","gemini"],getConfigPath:(e,t)=>w.join(t,".gemini","config","mcp_config.json"),type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},"pi-desktop":{name:"Pi Desktop / Pi Agent",aliases:["pi-desktop","pi","pi-agent"],getConfigPath:(e,t,r)=>{if(e==="win32"){let i=w.join(r||w.join(t,"AppData","Roaming"),".pi","agent","mcp.json");if(U.existsSync(i))return i;let a=w.join(t,".pi","agent","mcp.json");if(U.existsSync(a))return a;let s=w.join(t,".pi","mcp.json");return U.existsSync(s)?s:a}let n=w.join(t,".pi","agent","mcp.json");if(U.existsSync(n))return n;let o=w.join(t,".pi","mcp.json");return U.existsSync(o)?o:n},type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},qwenpaw:{name:"QwenPaw (Personal Agent Workstation)",aliases:["qwenpaw","qwen-paw","copaw"],getConfigPath:(e,t)=>{let r=w.join(t,".qwenpaw","config.json");if(U.existsSync(r))return r;let n=w.join(t,".copaw","config.json");return U.existsSync(n)?n:r},type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},cline:{name:"Cline (VS Code / CLI)",aliases:["cline","claude-dev"],getConfigPath:(e,t,r)=>{let n="";if(e==="win32"?n=w.join(r||w.join(t,"AppData","Roaming"),"Code","User","globalStorage","saoudrizwan.claude-dev","settings","cline_mcp_settings.json"):e==="darwin"?n=w.join(t,"Library","Application Support","Code","User","globalStorage","saoudrizwan.claude-dev","settings","cline_mcp_settings.json"):n=w.join(t,".config","Code","User","globalStorage","saoudrizwan.claude-dev","settings","cline_mcp_settings.json"),U.existsSync(n))return n;let o=w.join(t,".cline","data","settings","cline_mcp_settings.json");return U.existsSync(o)?o:n},type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},kilo:{name:"Kilo Code",aliases:["kilo","kilocode","kilo-code"],getConfigPath:(e,t)=>{let r=w.join(t,".config","kilo","kilo.jsonc");if(U.existsSync(r))return r;let n=w.join(t,".config","kilo","kilo.json");return U.existsSync(n)?n:r},type:"json-mcp",defaultConfig:(e,t)=>({type:"local",command:[e,...t],enabled:!0})},qoder:{name:"Qoder",aliases:["qoder"],getConfigPath:(e,t)=>w.join(t,".qoder","settings.json"),type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},kiro:{name:"Kiro",aliases:["kiro","kiro-code"],getConfigPath:(e,t)=>w.join(t,".kiro","settings","mcp.json"),type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},trae:{name:"Trae",aliases:["trae"],getConfigPath:(e,t,r)=>{if(e==="win32"){let n=w.join(r||w.join(t,"AppData","Roaming"),"Trae","User","mcp.json");if(U.existsSync(n))return n;let o=w.join(r||w.join(t,"AppData","Roaming"),"Trae CN","User","mcp.json");return U.existsSync(o)?o:n}else if(e==="darwin"){let n=w.join(t,"Library","Application Support","Trae","User","mcp.json");if(U.existsSync(n))return n;let o=w.join(t,"Library","Application Support","Trae CN","User","mcp.json");return U.existsSync(o)?o:n}else{let n=w.join(t,".config","Trae","User","mcp.json");if(U.existsSync(n))return n;let o=w.join(t,".config","Trae CN","User","mcp.json");return U.existsSync(o)?o:n}},type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})}},VE=["mcpServers","servers","mcp"];function _i(e){return Object.prototype.toString.call(e)==="[object Object]"}function JE(e,t=!1){if(!e)return"";if(!t)try{return JSON.parse(e),e}catch{}let r=e.length,n=[],o=!1,i=!1,a=!1,s=!1,c=-1;for(let u=0;u<r;u++){let l=e[u],d=u+1<r?e[u+1]:"";if(a){(l===`
53
- `||l==="\r")&&(a=!1,n.push(l));continue}if(s){l==="*"&&d==="/"&&(s=!1,u++);continue}if(o){n.push(l),i?i=!1:l==="\\"?i=!0:l==='"'&&(o=!1);continue}if(l==='"'){o=!0,i=!1,c=-1,n.push(l);continue}if(l==="/"&&d==="/"){a=!0,u++;continue}if(l==="/"&&d==="*"){s=!0,u++;continue}if(l===","){c=n.length,n.push(l);continue}if(l==="}"||l==="]"){c!==-1&&(n[c]=" ",c=-1),n.push(l);continue}l!==" "&&l!==" "&&l!==`
54
- `&&l!=="\r"&&(c=-1),n.push(l)}return n.join("")}var h$=/\s/;function KE(e){for(let t=1;t<e.length;t++){if(e[t]!=="#"||!h$.test(e[t-1]))continue;let r=t-1;for(;r>0&&h$.test(e[r-1]);)r--;return e.slice(r)}return""}function HE(e,t,r,n=!1){let o=e?e.split(/\r?\n/):[],i=o.map((p,f)=>{let m=p.match(/^(\s*)mcp_servers:/);return m?{index:f,indent:m[1],tail:p.slice(m[0].length).trim()}:null}).filter(p=>p!==null);if(i.length>1)throw new Error("Cannot safely update YAML with duplicate mcp_servers keys");if(i.length===1){let p=i[0];if(p.indent!==""||p.tail!==""&&!p.tail.startsWith("#"))throw new Error("Cannot safely update YAML unless mcp_servers is a root-level block mapping")}let a=" ";if(i.length===1)for(let p=i[0].index+1;p<o.length;p++){if(o[p].trim()===""||o[p].trimStart().startsWith("#"))continue;if(/^[^\s]/.test(o[p]))break;let f=o[p].match(/^(\s+)\S/);f&&(a=f[1]);break}if(n){let p=[],f=!1,m=0,h=!1,v=0;for(let _=0;_<o.length;_++){let $=o[_],b=$.match(/^(\s*)mcp_servers:\s*(?:#.*)?$/);if(b){f=!0,m=b[1].length,p.push($);continue}if(f){let S=$.match(/^(\s*)/)?.[1].length||0;if($.trimStart().startsWith("#")){p.push($);continue}if($.trim()!==""&&S<=m)f=!1,h=!1;else{let P=$.match(/^(\s*)superpowers:\s*(?:#.*)?$/);if(P&&P[1]===a){h=!0,v=P[1].length;continue}if(h){if(S>v||$.trim()==="")continue;h=!1}}}p.push($)}return p.join(`
55
- `)}let s=JSON.stringify(t),c=JSON.stringify(r),u=[`${a}superpowers:`,`${a}${a}command: ${s}`,`${a}${a}args: ${c}`];if(!e||e.trim()==="")return`mcp_servers:
56
- ${u.join(`
45
+ `)}p.write("payload.value = newResult;"),p.write("return payload;");let b=p.compile();return($,S)=>b(f,$,S)},o,a=hr,s=!So.jitless,u=s&&Ws.value,l=t.catchall,d;e._zod.parse=(f,p)=>{d??(d=n.value);let m=f.value;return a(m)?s&&u&&p?.async===!1&&p.jitless!==!0?(o||(o=i(t.shape)),f=o(f,p),l?Xm([],m,f,p,d,e):f):r(f,p):(f.issues.push({expected:"object",code:"invalid_type",input:m,inst:e}),f)}});function Um(e,t,r,n){for(let o of e)if(o.issues.length===0)return t.value=o.value,t;let i=e.filter(o=>!Xt(o));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(o=>o.issues.map(a=>Be(a,n,we())))}),t)}var ci=g("$ZodUnion",(e,t)=>{V.init(e,t),K(e._zod,"optin",()=>t.options.some(i=>i._zod.optin==="optional")?"optional":void 0),K(e._zod,"optout",()=>t.options.some(i=>i._zod.optout==="optional")?"optional":void 0),K(e._zod,"values",()=>{if(t.options.every(i=>i._zod.values))return new Set(t.options.flatMap(i=>Array.from(i._zod.values)))}),K(e._zod,"pattern",()=>{if(t.options.every(i=>i._zod.pattern)){let i=t.options.map(o=>o._zod.pattern);return new RegExp(`^(${i.map(o=>Kn(o.source)).join("|")})$`)}});let r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(i,o)=>{if(r)return n(i,o);let a=!1,s=[];for(let c of t.options){let u=c._zod.run({value:i.value,issues:[]},o);if(u instanceof Promise)s.push(u),a=!0;else{if(u.issues.length===0)return u;s.push(u)}}return a?Promise.all(s).then(c=>Um(c,i,e,o)):Um(s,i,e,o)}});function Mm(e,t,r,n){let i=e.filter(o=>o.issues.length===0);return i.length===1?(t.value=i[0].value,t):(i.length===0?t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(o=>o.issues.map(a=>Be(a,n,we())))}):t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1}),t)}var mu=g("$ZodXor",(e,t)=>{ci.init(e,t),t.inclusive=!1;let r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(i,o)=>{if(r)return n(i,o);let a=!1,s=[];for(let c of t.options){let u=c._zod.run({value:i.value,issues:[]},o);u instanceof Promise?(s.push(u),a=!0):s.push(u)}return a?Promise.all(s).then(c=>Mm(c,i,e,o)):Mm(s,i,e,o)}}),hu=g("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,ci.init(e,t);let r=e._zod.parse;K(e._zod,"propValues",()=>{let i={};for(let o of t.options){let a=o._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(o)}"`);for(let[s,c]of Object.entries(a)){i[s]||(i[s]=new Set);for(let u of c)i[s].add(u)}}return i});let n=Qr(()=>{let i=t.options,o=new Map;for(let a of i){let s=a._zod.propValues?.[t.discriminator];if(!s||s.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(let c of s){if(o.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);o.set(c,a)}}return o});e._zod.parse=(i,o)=>{let a=i.value;if(!hr(a))return i.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),i;let s=n.value.get(a?.[t.discriminator]);return s?s._zod.run(i,o):t.unionFallback?r(i,o):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:a,path:[t.discriminator],inst:e}),i)}}),gu=g("$ZodIntersection",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{let i=r.value,o=t.left._zod.run({value:i,issues:[]},n),a=t.right._zod.run({value:i,issues:[]},n);return o instanceof Promise||a instanceof Promise?Promise.all([o,a]).then(([c,u])=>Fm(r,c,u)):Fm(r,o,a)}});function Tc(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Gt(e)&&Gt(t)){let r=Object.keys(t),n=Object.keys(e).filter(o=>r.indexOf(o)!==-1),i={...e,...t};for(let o of n){let a=Tc(e[o],t[o]);if(!a.valid)return{valid:!1,mergeErrorPath:[o,...a.mergeErrorPath]};i[o]=a.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let i=e[n],o=t[n],a=Tc(i,o);if(!a.valid)return{valid:!1,mergeErrorPath:[n,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Fm(e,t,r){let n=new Map,i;for(let s of t.issues)if(s.code==="unrecognized_keys"){i??(i=s);for(let c of s.keys)n.has(c)||n.set(c,{}),n.get(c).l=!0}else e.issues.push(s);for(let s of r.issues)if(s.code==="unrecognized_keys")for(let c of s.keys)n.has(c)||n.set(c,{}),n.get(c).r=!0;else e.issues.push(s);let o=[...n].filter(([,s])=>s.l&&s.r).map(([s])=>s);if(o.length&&i&&e.issues.push({...i,keys:o}),Xt(e))return e;let a=Tc(t.value,r.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}var Fo=g("$ZodTuple",(e,t)=>{V.init(e,t);let r=t.items;e._zod.parse=(n,i)=>{let o=n.value;if(!Array.isArray(o))return n.issues.push({input:o,inst:e,expected:"tuple",code:"invalid_type"}),n;n.value=[];let a=[],s=[...r].reverse().findIndex(l=>l._zod.optin!=="optional"),c=s===-1?0:r.length-s;if(!t.rest){let l=o.length>r.length,d=o.length<c-1;if(l||d)return n.issues.push({...l?{code:"too_big",maximum:r.length,inclusive:!0}:{code:"too_small",minimum:r.length},input:o,inst:e,origin:"array"}),n}let u=-1;for(let l of r){if(u++,u>=o.length&&u>=c)continue;let d=l._zod.run({value:o[u],issues:[]},i);d instanceof Promise?a.push(d.then(f=>Do(f,n,u))):Do(d,n,u)}if(t.rest){let l=o.slice(r.length);for(let d of l){u++;let f=t.rest._zod.run({value:d,issues:[]},i);f instanceof Promise?a.push(f.then(p=>Do(p,n,u))):Do(f,n,u)}}return a.length?Promise.all(a).then(()=>n):n}});function Do(e,t,r){e.issues.length&&t.issues.push(...et(r,e.issues)),t.value[r]=e.value}var vu=g("$ZodRecord",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!Gt(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;let o=[],a=t.keyType._zod.values;if(a){r.value={};let s=new Set;for(let u of a)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){s.add(typeof u=="number"?u.toString():u);let l=t.valueType._zod.run({value:i[u],issues:[]},n);l instanceof Promise?o.push(l.then(d=>{d.issues.length&&r.issues.push(...et(u,d.issues)),r.value[u]=d.value})):(l.issues.length&&r.issues.push(...et(u,l.issues)),r.value[u]=l.value)}let c;for(let u in i)s.has(u)||(c=c??[],c.push(u));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:c})}else{r.value={};for(let s of Reflect.ownKeys(i)){if(s==="__proto__")continue;let c=t.keyType._zod.run({value:s,issues:[]},n);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof s=="string"&&Oo.test(s)&&c.issues.length){let d=t.keyType._zod.run({value:Number(s),issues:[]},n);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");d.issues.length===0&&(c=d)}if(c.issues.length){t.mode==="loose"?r.value[s]=i[s]:r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(d=>Be(d,n,we())),input:s,path:[s],inst:e});continue}let l=t.valueType._zod.run({value:i[s],issues:[]},n);l instanceof Promise?o.push(l.then(d=>{d.issues.length&&r.issues.push(...et(s,d.issues)),r.value[c.value]=d.value})):(l.issues.length&&r.issues.push(...et(s,l.issues)),r.value[c.value]=l.value)}}return o.length?Promise.all(o).then(()=>r):r}}),yu=g("$ZodMap",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!(i instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:i,inst:e}),r;let o=[];r.value=new Map;for(let[a,s]of i){let c=t.keyType._zod.run({value:a,issues:[]},n),u=t.valueType._zod.run({value:s,issues:[]},n);c instanceof Promise||u instanceof Promise?o.push(Promise.all([c,u]).then(([l,d])=>{Lm(l,d,r,a,i,e,n)})):Lm(c,u,r,a,i,e,n)}return o.length?Promise.all(o).then(()=>r):r}});function Lm(e,t,r,n,i,o,a){e.issues.length&&(Bn.has(typeof n)?r.issues.push(...et(n,e.issues)):r.issues.push({code:"invalid_key",origin:"map",input:i,inst:o,issues:e.issues.map(s=>Be(s,a,we()))})),t.issues.length&&(Bn.has(typeof n)?r.issues.push(...et(n,t.issues)):r.issues.push({origin:"map",code:"invalid_element",input:i,inst:o,key:n,issues:t.issues.map(s=>Be(s,a,we()))})),r.value.set(e.value,t.value)}var _u=g("$ZodSet",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!(i instanceof Set))return r.issues.push({input:i,inst:e,expected:"set",code:"invalid_type"}),r;let o=[];r.value=new Set;for(let a of i){let s=t.valueType._zod.run({value:a,issues:[]},n);s instanceof Promise?o.push(s.then(c=>qm(c,r))):qm(s,r)}return o.length?Promise.all(o).then(()=>r):r}});function qm(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}var $u=g("$ZodEnum",(e,t)=>{V.init(e,t);let r=Jn(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(i=>Bn.has(typeof i)).map(i=>typeof i=="string"?at(i):i.toString()).join("|")})$`),e._zod.parse=(i,o)=>{let a=i.value;return n.has(a)||i.issues.push({code:"invalid_value",values:r,input:a,inst:e}),i}}),bu=g("$ZodLiteral",(e,t)=>{if(V.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map(n=>typeof n=="string"?at(n):n?at(n.toString()):String(n)).join("|")})$`),e._zod.parse=(n,i)=>{let o=n.value;return r.has(o)||n.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),n}}),xu=g("$ZodFile",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;return i instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:i,inst:e}),r}}),ku=g("$ZodTransform",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new mr(e.constructor.name);let i=t.transform(r.value,r);if(n.async)return(i instanceof Promise?i:Promise.resolve(i)).then(a=>(r.value=a,r));if(i instanceof Promise)throw new kt;return r.value=i,r}});function Vm(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var Lo=g("$ZodOptional",(e,t)=>{V.init(e,t),e._zod.optin="optional",e._zod.optout="optional",K(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),K(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Kn(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>Vm(o,r.value)):Vm(i,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),wu=g("$ZodExactOptional",(e,t)=>{Lo.init(e,t),K(e._zod,"values",()=>t.innerType._zod.values),K(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),Su=g("$ZodNullable",(e,t)=>{V.init(e,t),K(e._zod,"optin",()=>t.innerType._zod.optin),K(e._zod,"optout",()=>t.innerType._zod.optout),K(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Kn(r.source)}|null)$`):void 0}),K(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),zu=g("$ZodDefault",(e,t)=>{V.init(e,t),e._zod.optin="optional",K(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>Jm(o,t)):Jm(i,t)}});function Jm(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Iu=g("$ZodPrefault",(e,t)=>{V.init(e,t),e._zod.optin="optional",K(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),Pu=g("$ZodNonOptional",(e,t)=>{V.init(e,t),K(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>Km(o,e)):Km(i,e)}});function Km(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}var ju=g("$ZodSuccess",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new mr("ZodSuccess");let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>(r.value=o.issues.length===0,r)):(r.value=i.issues.length===0,r)}}),Eu=g("$ZodCatch",(e,t)=>{V.init(e,t),K(e._zod,"optin",()=>t.innerType._zod.optin),K(e._zod,"optout",()=>t.innerType._zod.optout),K(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(a=>Be(a,n,we()))},input:r.value}),r.issues=[]),r)):(r.value=i.value,i.issues.length&&(r.value=t.catchValue({...r,error:{issues:i.issues.map(o=>Be(o,n,we()))},input:r.value}),r.issues=[]),r)}}),Tu=g("$ZodNaN",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:e,expected:"nan",code:"invalid_type"}),r)}),Ou=g("$ZodPipe",(e,t)=>{V.init(e,t),K(e._zod,"values",()=>t.in._zod.values),K(e._zod,"optin",()=>t.in._zod.optin),K(e._zod,"optout",()=>t.out._zod.optout),K(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let o=t.out._zod.run(r,n);return o instanceof Promise?o.then(a=>Ro(a,t.in,n)):Ro(o,t.in,n)}let i=t.in._zod.run(r,n);return i instanceof Promise?i.then(o=>Ro(o,t.out,n)):Ro(i,t.out,n)}});function Ro(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}var ui=g("$ZodCodec",(e,t)=>{V.init(e,t),K(e._zod,"values",()=>t.in._zod.values),K(e._zod,"optin",()=>t.in._zod.optin),K(e._zod,"optout",()=>t.out._zod.optout),K(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if((n.direction||"forward")==="forward"){let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(a=>Co(a,t,n)):Co(o,t,n)}else{let o=t.out._zod.run(r,n);return o instanceof Promise?o.then(a=>Co(a,t,n)):Co(o,t,n)}}});function Co(e,t,r){if(e.issues.length)return e.aborted=!0,e;if((r.direction||"forward")==="forward"){let i=t.transform(e.value,e);return i instanceof Promise?i.then(o=>Zo(e,o,t.out,r)):Zo(e,i,t.out,r)}else{let i=t.reverseTransform(e.value,e);return i instanceof Promise?i.then(o=>Zo(e,o,t.in,r)):Zo(e,i,t.in,r)}}function Zo(e,t,r,n){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:t,issues:e.issues},n)}var Nu=g("$ZodReadonly",(e,t)=>{V.init(e,t),K(e._zod,"propValues",()=>t.innerType._zod.propValues),K(e._zod,"values",()=>t.innerType._zod.values),K(e._zod,"optin",()=>t.innerType?._zod?.optin),K(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(Bm):Bm(i)}});function Bm(e){return e.value=Object.freeze(e.value),e}var Du=g("$ZodTemplateLiteral",(e,t)=>{V.init(e,t);let r=[];for(let n of t.parts)if(typeof n=="object"&&n!==null){if(!n._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...n._zod.traits].shift()}`);let i=n._zod.pattern instanceof RegExp?n._zod.pattern.source:n._zod.pattern;if(!i)throw new Error(`Invalid template literal part: ${n._zod.traits}`);let o=i.startsWith("^")?1:0,a=i.endsWith("$")?i.length-1:i.length;r.push(i.slice(o,a))}else if(n===null||Xs.has(typeof n))r.push(at(`${n}`));else throw new Error(`Invalid template literal part: ${n}`);e._zod.pattern=new RegExp(`^${r.join("")}$`),e._zod.parse=(n,i)=>typeof n.value!="string"?(n.issues.push({input:n.value,inst:e,expected:"string",code:"invalid_type"}),n):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),n)}),Ru=g("$ZodFunction",(e,t)=>(V.init(e,t),e._def=t,e._zod.def=t,e.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return function(...n){let i=e._def.input?Yn(e._def.input,n):n,o=Reflect.apply(r,this,i);return e._def.output?Yn(e._def.output,o):o}},e.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return async function(...n){let i=e._def.input?await ei(e._def.input,n):n,o=await Reflect.apply(r,this,i);return e._def.output?await ei(e._def.output,o):o}},e._zod.parse=(r,n)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:e}),r):(e._def.output&&e._def.output._zod.def.type==="promise"?r.value=e.implementAsync(r.value):r.value=e.implement(r.value),r),e.input=(...r)=>{let n=e.constructor;return Array.isArray(r[0])?new n({type:"function",input:new Fo({type:"tuple",items:r[0],rest:r[1]}),output:e._def.output}):new n({type:"function",input:r[0],output:e._def.output})},e.output=r=>{let n=e.constructor;return new n({type:"function",input:e._def.input,output:r})},e)),Cu=g("$ZodPromise",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>Promise.resolve(r.value).then(i=>t.innerType._zod.run({value:i,issues:[]},n))}),Zu=g("$ZodLazy",(e,t)=>{V.init(e,t),K(e._zod,"innerType",()=>t.getter()),K(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),K(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),K(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),K(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(r,n)=>e._zod.innerType._zod.run(r,n)}),Au=g("$ZodCustom",(e,t)=>{ue.init(e,t),V.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,i=t.fn(n);if(i instanceof Promise)return i.then(o=>Hm(o,r,n,e));Hm(i,r,n,e)}});function Hm(e,t,r,n){if(!e){let i={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(i.params=n._zod.def.params),t.issues.push(en(i))}}var nx=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(i){return e[i]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,a=L(i.input),s=n[a]??a;return`Invalid input: expected ${o}, received ${s}`}case"invalid_value":return i.values.length===1?`Invalid input: expected ${M(i.values[0])}`:`Invalid option: expected one of ${U(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",a=t(i.origin);return a?`Too big: expected ${i.origin??"value"} to have ${o}${i.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${i.origin??"value"} to be ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",a=t(i.origin);return a?`Too small: expected ${i.origin} to have ${o}${i.minimum.toString()} ${a.unit}`:`Too small: expected ${i.origin} to be ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`Invalid string: must start with "${o.prefix}"`:o.format==="ends_with"?`Invalid string: must end with "${o.suffix}"`:o.format==="includes"?`Invalid string: must include "${o.includes}"`:o.format==="regex"?`Invalid string: must match pattern ${o.pattern}`:`Invalid ${r[o.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${U(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};function Uu(){return{localeError:nx()}}var eh;var Fu=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let i={...n,...this._map.get(t)};return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function Lu(){return new Fu}(eh=globalThis).__zod_globalRegistry??(eh.__zod_globalRegistry=Lu());var Le=globalThis.__zod_globalRegistry;function qu(e,t){return new e({type:"string",...I(t)})}function qo(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...I(t)})}function li(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...I(t)})}function Vo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...I(t)})}function Jo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...I(t)})}function Ko(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...I(t)})}function Bo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...I(t)})}function di(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...I(t)})}function Ho(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...I(t)})}function Wo(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...I(t)})}function Go(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...I(t)})}function Xo(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...I(t)})}function Yo(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...I(t)})}function Qo(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...I(t)})}function ea(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...I(t)})}function ta(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...I(t)})}function ra(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...I(t)})}function Vu(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...I(t)})}function na(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...I(t)})}function ia(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...I(t)})}function oa(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...I(t)})}function aa(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...I(t)})}function sa(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...I(t)})}function ca(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...I(t)})}function Ju(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...I(t)})}function Ku(e,t){return new e({type:"string",format:"date",check:"string_format",...I(t)})}function Bu(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...I(t)})}function Hu(e,t){return new e({type:"string",format:"duration",check:"string_format",...I(t)})}function Wu(e,t){return new e({type:"number",checks:[],...I(t)})}function Gu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...I(t)})}function Xu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...I(t)})}function Yu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...I(t)})}function Qu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...I(t)})}function el(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...I(t)})}function tl(e,t){return new e({type:"boolean",...I(t)})}function rl(e,t){return new e({type:"bigint",...I(t)})}function nl(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...I(t)})}function il(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...I(t)})}function ol(e,t){return new e({type:"symbol",...I(t)})}function al(e,t){return new e({type:"undefined",...I(t)})}function sl(e,t){return new e({type:"null",...I(t)})}function cl(e){return new e({type:"any"})}function ul(e){return new e({type:"unknown"})}function ll(e,t){return new e({type:"never",...I(t)})}function dl(e,t){return new e({type:"void",...I(t)})}function pl(e,t){return new e({type:"date",...I(t)})}function fl(e,t){return new e({type:"nan",...I(t)})}function Rt(e,t){return new jc({check:"less_than",...I(t),value:e,inclusive:!1})}function tt(e,t){return new jc({check:"less_than",...I(t),value:e,inclusive:!0})}function Ct(e,t){return new Ec({check:"greater_than",...I(t),value:e,inclusive:!1})}function qe(e,t){return new Ec({check:"greater_than",...I(t),value:e,inclusive:!0})}function ml(e){return Ct(0,e)}function hl(e){return Rt(0,e)}function gl(e){return tt(0,e)}function vl(e){return qe(0,e)}function yr(e,t){return new ym({check:"multiple_of",...I(t),value:e})}function _r(e,t){return new bm({check:"max_size",...I(t),maximum:e})}function Zt(e,t){return new xm({check:"min_size",...I(t),minimum:e})}function rn(e,t){return new km({check:"size_equals",...I(t),size:e})}function nn(e,t){return new wm({check:"max_length",...I(t),maximum:e})}function Yt(e,t){return new Sm({check:"min_length",...I(t),minimum:e})}function on(e,t){return new zm({check:"length_equals",...I(t),length:e})}function pi(e,t){return new Im({check:"string_format",format:"regex",...I(t),pattern:e})}function fi(e){return new Pm({check:"string_format",format:"lowercase",...I(e)})}function mi(e){return new jm({check:"string_format",format:"uppercase",...I(e)})}function hi(e,t){return new Em({check:"string_format",format:"includes",...I(t),includes:e})}function gi(e,t){return new Tm({check:"string_format",format:"starts_with",...I(t),prefix:e})}function vi(e,t){return new Om({check:"string_format",format:"ends_with",...I(t),suffix:e})}function yl(e,t,r){return new Nm({check:"property",property:e,schema:t,...I(r)})}function yi(e,t){return new Dm({check:"mime_type",mime:e,...I(t)})}function wt(e){return new Rm({check:"overwrite",tx:e})}function _i(e){return wt(t=>t.normalize(e))}function $i(){return wt(e=>e.trim())}function bi(){return wt(e=>e.toLowerCase())}function xi(){return wt(e=>e.toUpperCase())}function ua(){return wt(e=>Hs(e))}function th(e,t,r){return new e({type:"array",element:t,...I(r)})}function _l(e,t){return new e({type:"file",...I(t)})}function $l(e,t,r){let n=I(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function bl(e,t,r){return new e({type:"custom",check:"custom",fn:t,...I(r)})}function xl(e){let t=sx(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(en(n,r.value,t._zod.def));else{let i=n;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=t),i.continue??(i.continue=!t._zod.def.abort),r.issues.push(en(i))}},e(r.value,r)));return t}function sx(e,t){let r=new ue({check:"custom",...I(t)});return r._zod.check=e,r}function kl(e){let t=new ue({check:"describe"});return t._zod.onattach=[r=>{let n=Le.get(r)??{};Le.add(r,{...n,description:e})}],t._zod.check=()=>{},t}function wl(e){let t=new ue({check:"meta"});return t._zod.onattach=[r=>{let n=Le.get(r)??{};Le.add(r,{...n,...e})}],t._zod.check=()=>{},t}function Sl(e,t){let r=I(t),n=r.truthy??["true","1","yes","on","y","enabled"],i=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(n=n.map(p=>typeof p=="string"?p.toLowerCase():p),i=i.map(p=>typeof p=="string"?p.toLowerCase():p));let o=new Set(n),a=new Set(i),s=e.Codec??ui,c=e.Boolean??si,u=e.String??vr,l=new u({type:"string",error:r.error}),d=new c({type:"boolean",error:r.error}),f=new s({type:"pipe",in:l,out:d,transform:((p,m)=>{let h=p;return r.case!=="sensitive"&&(h=h.toLowerCase()),o.has(h)?!0:a.has(h)?!1:(m.issues.push({code:"invalid_value",expected:"stringbool",values:[...o,...a],input:m.value,inst:f,continue:!1}),{})}),reverseTransform:((p,m)=>p===!0?n[0]||"true":i[0]||"false"),error:r.error});return f}function an(e,t,r,n={}){let i=I(n),o={...I(n),check:"string_format",type:"string",format:t,fn:typeof r=="function"?r:s=>r.test(s),...i};return r instanceof RegExp&&(o.pattern=r),new e(o)}function la(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Le,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function fe(e,t,r={path:[],schemaPath:[]}){var n;let i=e._zod.def,o=t.seen.get(e);if(o)return o.count++,r.schemaPath.includes(e)&&(o.cycle=r.path),o.schema;let a={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,a);let s=e._zod.toJSONSchema?.();if(s)a.schema=s;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,l);else{let f=a.schema,p=t.processors[i.type];if(!p)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);p(e,t,f,l)}let d=e._zod.parent;d&&(a.ref||(a.ref=d),fe(d,t,l),t.seen.get(d).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(a.schema,c),t.io==="input"&&Ve(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&a.schema._prefault&&((n=a.schema).default??(n.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function da(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=new Map;for(let a of e.seen.entries()){let s=e.metadataRegistry.get(a[0])?.id;if(s){let c=n.get(s);if(c&&c!==a[0])throw new Error(`Duplicate schema id "${s}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(s,a[0])}}let i=a=>{let s=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(a[0])?.id,f=e.external.uri??(m=>m);if(d)return{ref:f(d)};let p=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=p,{defId:p,ref:`${f("__shared")}#/${s}/${p}`}}if(a[1]===r)return{ref:"#"};let u=`#/${s}/`,l=a[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+l}},o=a=>{if(a[1].schema.$ref)return;let s=a[1],{ref:c,defId:u}=i(a);s.def={...s.schema},u&&(s.defId=u);let l=s.schema;for(let d in l)delete l[d];l.$ref=c};if(e.cycles==="throw")for(let a of e.seen.entries()){let s=a[1];if(s.cycle)throw new Error(`Cycle detected: #/${s.cycle?.join("/")}/<root>
46
+
47
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of e.seen.entries()){let s=a[1];if(t===a[0]){o(a);continue}if(e.external){let u=e.external.registry.get(a[0])?.id;if(t!==a[0]&&u){o(a);continue}}if(e.metadataRegistry.get(a[0])?.id){o(a);continue}if(s.cycle){o(a);continue}if(s.count>1&&e.reused==="ref"){o(a);continue}}}function pa(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=a=>{let s=e.seen.get(a);if(s.ref===null)return;let c=s.def??s.schema,u={...c},l=s.ref;if(s.ref=null,l){n(l);let f=e.seen.get(l),p=f.schema;if(p.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(p)):Object.assign(c,p),Object.assign(c,u),a._zod.parent===l)for(let h in c)h==="$ref"||h==="allOf"||h in u||delete c[h];if(p.$ref&&f.def)for(let h in c)h==="$ref"||h==="allOf"||h in f.def&&JSON.stringify(c[h])===JSON.stringify(f.def[h])&&delete c[h]}let d=a._zod.parent;if(d&&d!==l){n(d);let f=e.seen.get(d);if(f?.schema.$ref&&(c.$ref=f.schema.$ref,f.def))for(let p in c)p==="$ref"||p==="allOf"||p in f.def&&JSON.stringify(c[p])===JSON.stringify(f.def[p])&&delete c[p]}e.override({zodSchema:a,jsonSchema:c,path:s.path??[]})};for(let a of[...e.seen.entries()].reverse())n(a[0]);let i={};if(e.target==="draft-2020-12"?i.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?i.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");i.$id=e.external.uri(a)}Object.assign(i,r.def??r.schema);let o=e.external?.defs??{};for(let a of e.seen.entries()){let s=a[1];s.def&&s.defId&&(o[s.defId]=s.def)}e.external||Object.keys(o).length>0&&(e.target==="draft-2020-12"?i.$defs=o:i.definitions=o);try{let a=JSON.parse(JSON.stringify(i));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:ki(t,"input",e.processors),output:ki(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Ve(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return Ve(n.element,r);if(n.type==="set")return Ve(n.valueType,r);if(n.type==="lazy")return Ve(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return Ve(n.innerType,r);if(n.type==="intersection")return Ve(n.left,r)||Ve(n.right,r);if(n.type==="record"||n.type==="map")return Ve(n.keyType,r)||Ve(n.valueType,r);if(n.type==="pipe")return Ve(n.in,r)||Ve(n.out,r);if(n.type==="object"){for(let i in n.shape)if(Ve(n.shape[i],r))return!0;return!1}if(n.type==="union"){for(let i of n.options)if(Ve(i,r))return!0;return!1}if(n.type==="tuple"){for(let i of n.items)if(Ve(i,r))return!0;return!!(n.rest&&Ve(n.rest,r))}return!1}var rh=(e,t={})=>r=>{let n=la({...r,processors:t});return fe(e,n),da(n,e),pa(n,e)},ki=(e,t,r={})=>n=>{let{libraryOptions:i,target:o}=n??{},a=la({...i??{},target:o,io:t,processors:r});return fe(e,a),da(a,e),pa(a,e)};var cx={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},nh=(e,t,r,n)=>{let i=r;i.type="string";let{minimum:o,maximum:a,format:s,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof o=="number"&&(i.minLength=o),typeof a=="number"&&(i.maxLength=a),s&&(i.format=cx[s]??s,i.format===""&&delete i.format,s==="time"&&delete i.format),u&&(i.contentEncoding=u),c&&c.size>0){let l=[...c];l.length===1?i.pattern=l[0].source:l.length>1&&(i.allOf=[...l.map(d=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},ih=(e,t,r,n)=>{let i=r,{minimum:o,maximum:a,format:s,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=e._zod.bag;typeof s=="string"&&s.includes("int")?i.type="integer":i.type="number",typeof l=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l),typeof o=="number"&&(i.minimum=o,typeof l=="number"&&t.target!=="draft-04"&&(l>=o?delete i.minimum:delete i.exclusiveMinimum)),typeof u=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(i.maximum=u,i.exclusiveMaximum=!0):i.exclusiveMaximum=u),typeof a=="number"&&(i.maximum=a,typeof u=="number"&&t.target!=="draft-04"&&(u<=a?delete i.maximum:delete i.exclusiveMaximum)),typeof c=="number"&&(i.multipleOf=c)},oh=(e,t,r,n)=>{r.type="boolean"},ah=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},sh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},ch=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},uh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},lh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},dh=(e,t,r,n)=>{r.not={}},ph=(e,t,r,n)=>{},fh=(e,t,r,n)=>{},mh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},hh=(e,t,r,n)=>{let i=e._zod.def,o=Jn(i.entries);o.every(a=>typeof a=="number")&&(r.type="number"),o.every(a=>typeof a=="string")&&(r.type="string"),r.enum=o},gh=(e,t,r,n)=>{let i=e._zod.def,o=[];for(let a of i.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");o.push(Number(a))}else o.push(a);if(o.length!==0)if(o.length===1){let a=o[0];r.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[a]:r.const=a}else o.every(a=>typeof a=="number")&&(r.type="number"),o.every(a=>typeof a=="string")&&(r.type="string"),o.every(a=>typeof a=="boolean")&&(r.type="boolean"),o.every(a=>a===null)&&(r.type="null"),r.enum=o},vh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},yh=(e,t,r,n)=>{let i=r,o=e._zod.pattern;if(!o)throw new Error("Pattern not found in template literal");i.type="string",i.pattern=o.source},_h=(e,t,r,n)=>{let i=r,o={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:s,mime:c}=e._zod.bag;a!==void 0&&(o.minLength=a),s!==void 0&&(o.maxLength=s),c?c.length===1?(o.contentMediaType=c[0],Object.assign(i,o)):(Object.assign(i,o),i.anyOf=c.map(u=>({contentMediaType:u}))):Object.assign(i,o)},$h=(e,t,r,n)=>{r.type="boolean"},bh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},xh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},kh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},wh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},Sh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},zh=(e,t,r,n)=>{let i=r,o=e._zod.def,{minimum:a,maximum:s}=e._zod.bag;typeof a=="number"&&(i.minItems=a),typeof s=="number"&&(i.maxItems=s),i.type="array",i.items=fe(o.element,t,{...n,path:[...n.path,"items"]})},Ih=(e,t,r,n)=>{let i=r,o=e._zod.def;i.type="object",i.properties={};let a=o.shape;for(let u in a)i.properties[u]=fe(a[u],t,{...n,path:[...n.path,"properties",u]});let s=new Set(Object.keys(a)),c=new Set([...s].filter(u=>{let l=o.shape[u]._zod;return t.io==="input"?l.optin===void 0:l.optout===void 0}));c.size>0&&(i.required=Array.from(c)),o.catchall?._zod.def.type==="never"?i.additionalProperties=!1:o.catchall?o.catchall&&(i.additionalProperties=fe(o.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(i.additionalProperties=!1)},zl=(e,t,r,n)=>{let i=e._zod.def,o=i.inclusive===!1,a=i.options.map((s,c)=>fe(s,t,{...n,path:[...n.path,o?"oneOf":"anyOf",c]}));o?r.oneOf=a:r.anyOf=a},Ph=(e,t,r,n)=>{let i=e._zod.def,o=fe(i.left,t,{...n,path:[...n.path,"allOf",0]}),a=fe(i.right,t,{...n,path:[...n.path,"allOf",1]}),s=u=>"allOf"in u&&Object.keys(u).length===1,c=[...s(o)?o.allOf:[o],...s(a)?a.allOf:[a]];r.allOf=c},jh=(e,t,r,n)=>{let i=r,o=e._zod.def;i.type="array";let a=t.target==="draft-2020-12"?"prefixItems":"items",s=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",c=o.items.map((f,p)=>fe(f,t,{...n,path:[...n.path,a,p]})),u=o.rest?fe(o.rest,t,{...n,path:[...n.path,s,...t.target==="openapi-3.0"?[o.items.length]:[]]}):null;t.target==="draft-2020-12"?(i.prefixItems=c,u&&(i.items=u)):t.target==="openapi-3.0"?(i.items={anyOf:c},u&&i.items.anyOf.push(u),i.minItems=c.length,u||(i.maxItems=c.length)):(i.items=c,u&&(i.additionalItems=u));let{minimum:l,maximum:d}=e._zod.bag;typeof l=="number"&&(i.minItems=l),typeof d=="number"&&(i.maxItems=d)},Eh=(e,t,r,n)=>{let i=r,o=e._zod.def;i.type="object";let a=o.keyType,c=a._zod.bag?.patterns;if(o.mode==="loose"&&c&&c.size>0){let l=fe(o.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});i.patternProperties={};for(let d of c)i.patternProperties[d.source]=l}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(i.propertyNames=fe(o.keyType,t,{...n,path:[...n.path,"propertyNames"]})),i.additionalProperties=fe(o.valueType,t,{...n,path:[...n.path,"additionalProperties"]});let u=a._zod.values;if(u){let l=[...u].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(i.required=l)}},Th=(e,t,r,n)=>{let i=e._zod.def,o=fe(i.innerType,t,n),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=i.innerType,r.nullable=!0):r.anyOf=[o,{type:"null"}]},Oh=(e,t,r,n)=>{let i=e._zod.def;fe(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType},Nh=(e,t,r,n)=>{let i=e._zod.def;fe(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType,r.default=JSON.parse(JSON.stringify(i.defaultValue))},Dh=(e,t,r,n)=>{let i=e._zod.def;fe(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Rh=(e,t,r,n)=>{let i=e._zod.def;fe(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType;let a;try{a=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=a},Ch=(e,t,r,n)=>{let i=e._zod.def,o=t.io==="input"?i.in._zod.def.type==="transform"?i.out:i.in:i.out;fe(o,t,n);let a=t.seen.get(e);a.ref=o},Zh=(e,t,r,n)=>{let i=e._zod.def;fe(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType,r.readOnly=!0},Ah=(e,t,r,n)=>{let i=e._zod.def;fe(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType},Il=(e,t,r,n)=>{let i=e._zod.def;fe(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType},Uh=(e,t,r,n)=>{let i=e._zod.innerType;fe(i,t,n);let o=t.seen.get(e);o.ref=i};function sn(e){return!!e._zod}function Qt(e,t){return sn(e)?tn(e,t):e.safeParse(t)}function fa(e){if(!e)return;let t;if(sn(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function qh(e){if(sn(e)){let o=e._zod?.def;if(o){if(o.value!==void 0)return o.value;if(Array.isArray(o.values)&&o.values.length>0)return o.values[0]}}let r=e._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let n=e.value;if(n!==void 0)return n}var wi={};Tn(wi,{ZodAny:()=>sg,ZodArray:()=>dg,ZodBase64:()=>Xl,ZodBase64URL:()=>Yl,ZodBigInt:()=>xa,ZodBigIntFormat:()=>td,ZodBoolean:()=>ba,ZodCIDRv4:()=>Wl,ZodCIDRv6:()=>Gl,ZodCUID:()=>Ll,ZodCUID2:()=>ql,ZodCatch:()=>Tg,ZodCodec:()=>cd,ZodCustom:()=>Ia,ZodCustomStringFormat:()=>zi,ZodDate:()=>nd,ZodDefault:()=>Sg,ZodDiscriminatedUnion:()=>fg,ZodE164:()=>Ql,ZodEmail:()=>Ul,ZodEmoji:()=>Ml,ZodEnum:()=>Si,ZodExactOptional:()=>xg,ZodFile:()=>$g,ZodFunction:()=>Mg,ZodGUID:()=>ha,ZodIPv4:()=>Bl,ZodIPv6:()=>Hl,ZodIntersection:()=>mg,ZodJWT:()=>ed,ZodKSUID:()=>Kl,ZodLazy:()=>Zg,ZodLiteral:()=>_g,ZodMAC:()=>ng,ZodMap:()=>vg,ZodNaN:()=>Ng,ZodNanoID:()=>Fl,ZodNever:()=>ug,ZodNonOptional:()=>ad,ZodNull:()=>ag,ZodNullable:()=>wg,ZodNumber:()=>$a,ZodNumberFormat:()=>cn,ZodObject:()=>ka,ZodOptional:()=>od,ZodPipe:()=>sd,ZodPrefault:()=>Ig,ZodPromise:()=>Ug,ZodReadonly:()=>Dg,ZodRecord:()=>za,ZodSet:()=>yg,ZodString:()=>ya,ZodStringFormat:()=>le,ZodSuccess:()=>Eg,ZodSymbol:()=>ig,ZodTemplateLiteral:()=>Cg,ZodTransform:()=>bg,ZodTuple:()=>hg,ZodType:()=>B,ZodULID:()=>Vl,ZodURL:()=>_a,ZodUUID:()=>At,ZodUndefined:()=>og,ZodUnion:()=>wa,ZodUnknown:()=>cg,ZodVoid:()=>lg,ZodXID:()=>Jl,ZodXor:()=>pg,_ZodString:()=>Al,_default:()=>zg,_function:()=>zk,any:()=>ck,array:()=>Y,base64:()=>Jx,base64url:()=>Kx,bigint:()=>nk,boolean:()=>xe,catch:()=>Og,check:()=>Ik,cidrv4:()=>qx,cidrv6:()=>Vx,codec:()=>kk,cuid:()=>Rx,cuid2:()=>Cx,custom:()=>ud,date:()=>lk,describe:()=>Pk,discriminatedUnion:()=>Sa,e164:()=>Bx,email:()=>Sx,emoji:()=>Nx,enum:()=>Re,exactOptional:()=>kg,file:()=>_k,float32:()=>Qx,float64:()=>ek,function:()=>zk,guid:()=>zx,hash:()=>Yx,hex:()=>Xx,hostname:()=>Gx,httpUrl:()=>Ox,instanceof:()=>Ek,int:()=>Zl,int32:()=>tk,int64:()=>ik,intersection:()=>Pi,ipv4:()=>Mx,ipv6:()=>Lx,json:()=>Ok,jwt:()=>Hx,keyof:()=>dk,ksuid:()=>Ux,lazy:()=>Ag,literal:()=>N,looseObject:()=>De,looseRecord:()=>hk,mac:()=>Fx,map:()=>gk,meta:()=>jk,nan:()=>xk,nanoid:()=>Dx,nativeEnum:()=>yk,never:()=>rd,nonoptional:()=>jg,null:()=>Ii,nullable:()=>ga,nullish:()=>$k,number:()=>oe,object:()=>T,optional:()=>he,partialRecord:()=>mk,pipe:()=>va,prefault:()=>Pg,preprocess:()=>Pa,promise:()=>Sk,readonly:()=>Rg,record:()=>me,refine:()=>Fg,set:()=>vk,strictObject:()=>pk,string:()=>y,stringFormat:()=>Wx,stringbool:()=>Tk,success:()=>bk,superRefine:()=>Lg,symbol:()=>ak,templateLiteral:()=>wk,transform:()=>id,tuple:()=>gg,uint32:()=>rk,uint64:()=>ok,ulid:()=>Zx,undefined:()=>sk,union:()=>se,unknown:()=>de,url:()=>Tx,uuid:()=>Ix,uuidv4:()=>Px,uuidv6:()=>jx,uuidv7:()=>Ex,void:()=>uk,xid:()=>Ax,xor:()=>fk});var ma={};Tn(ma,{endsWith:()=>vi,gt:()=>Ct,gte:()=>qe,includes:()=>hi,length:()=>on,lowercase:()=>fi,lt:()=>Rt,lte:()=>tt,maxLength:()=>nn,maxSize:()=>_r,mime:()=>yi,minLength:()=>Yt,minSize:()=>Zt,multipleOf:()=>yr,negative:()=>hl,nonnegative:()=>vl,nonpositive:()=>gl,normalize:()=>_i,overwrite:()=>wt,positive:()=>ml,property:()=>yl,regex:()=>pi,size:()=>rn,slugify:()=>ua,startsWith:()=>gi,toLowerCase:()=>bi,toUpperCase:()=>xi,trim:()=>$i,uppercase:()=>mi});var $r={};Tn($r,{ZodISODate:()=>Tl,ZodISODateTime:()=>jl,ZodISODuration:()=>Rl,ZodISOTime:()=>Nl,date:()=>Ol,datetime:()=>El,duration:()=>Cl,time:()=>Dl});var jl=g("ZodISODateTime",(e,t)=>{qc.init(e,t),le.init(e,t)});function El(e){return Ju(jl,e)}var Tl=g("ZodISODate",(e,t)=>{Vc.init(e,t),le.init(e,t)});function Ol(e){return Ku(Tl,e)}var Nl=g("ZodISOTime",(e,t)=>{Jc.init(e,t),le.init(e,t)});function Dl(e){return Bu(Nl,e)}var Rl=g("ZodISODuration",(e,t)=>{Kc.init(e,t),le.init(e,t)});function Cl(e){return Hu(Rl,e)}var Vh=(e,t)=>{Po.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>Eo(e,r)},flatten:{value:r=>jo(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Yr,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Yr,2)}},isEmpty:{get(){return e.issues.length===0}}})},i4=g("ZodError",Vh),rt=g("ZodError",Vh,{Parent:Error});var Jh=Xn(rt),Kh=Qn(rt),Bh=ti(rt),Hh=ri(rt),Wh=om(rt),Gh=am(rt),Xh=sm(rt),Yh=cm(rt),Qh=um(rt),eg=lm(rt),tg=dm(rt),rg=pm(rt);var B=g("ZodType",(e,t)=>(V.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:ki(e,"input"),output:ki(e,"output")}}),e.toJSONSchema=rh(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(k.mergeDefs(t,{checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0}),e.with=e.check,e.clone=(r,n)=>Fe(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>Jh(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>Bh(e,r,n),e.parseAsync=async(r,n)=>Kh(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>Hh(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>Wh(e,r,n),e.decode=(r,n)=>Gh(e,r,n),e.encodeAsync=async(r,n)=>Xh(e,r,n),e.decodeAsync=async(r,n)=>Yh(e,r,n),e.safeEncode=(r,n)=>Qh(e,r,n),e.safeDecode=(r,n)=>eg(e,r,n),e.safeEncodeAsync=async(r,n)=>tg(e,r,n),e.safeDecodeAsync=async(r,n)=>rg(e,r,n),e.refine=(r,n)=>e.check(Fg(r,n)),e.superRefine=r=>e.check(Lg(r)),e.overwrite=r=>e.check(wt(r)),e.optional=()=>he(e),e.exactOptional=()=>kg(e),e.nullable=()=>ga(e),e.nullish=()=>he(ga(e)),e.nonoptional=r=>jg(e,r),e.array=()=>Y(e),e.or=r=>se([e,r]),e.and=r=>Pi(e,r),e.transform=r=>va(e,id(r)),e.default=r=>zg(e,r),e.prefault=r=>Pg(e,r),e.catch=r=>Og(e,r),e.pipe=r=>va(e,r),e.readonly=()=>Rg(e),e.describe=r=>{let n=e.clone();return Le.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return Le.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Le.get(e);let n=e.clone();return Le.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=r=>r(e),e)),Al=g("_ZodString",(e,t)=>{vr.init(e,t),B.init(e,t),e._zod.processJSONSchema=(n,i,o)=>nh(e,n,i,o);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(pi(...n)),e.includes=(...n)=>e.check(hi(...n)),e.startsWith=(...n)=>e.check(gi(...n)),e.endsWith=(...n)=>e.check(vi(...n)),e.min=(...n)=>e.check(Yt(...n)),e.max=(...n)=>e.check(nn(...n)),e.length=(...n)=>e.check(on(...n)),e.nonempty=(...n)=>e.check(Yt(1,...n)),e.lowercase=n=>e.check(fi(n)),e.uppercase=n=>e.check(mi(n)),e.trim=()=>e.check($i()),e.normalize=(...n)=>e.check(_i(...n)),e.toLowerCase=()=>e.check(bi()),e.toUpperCase=()=>e.check(xi()),e.slugify=()=>e.check(ua())}),ya=g("ZodString",(e,t)=>{vr.init(e,t),Al.init(e,t),e.email=r=>e.check(qo(Ul,r)),e.url=r=>e.check(di(_a,r)),e.jwt=r=>e.check(ca(ed,r)),e.emoji=r=>e.check(Ho(Ml,r)),e.guid=r=>e.check(li(ha,r)),e.uuid=r=>e.check(Vo(At,r)),e.uuidv4=r=>e.check(Jo(At,r)),e.uuidv6=r=>e.check(Ko(At,r)),e.uuidv7=r=>e.check(Bo(At,r)),e.nanoid=r=>e.check(Wo(Fl,r)),e.guid=r=>e.check(li(ha,r)),e.cuid=r=>e.check(Go(Ll,r)),e.cuid2=r=>e.check(Xo(ql,r)),e.ulid=r=>e.check(Yo(Vl,r)),e.base64=r=>e.check(oa(Xl,r)),e.base64url=r=>e.check(aa(Yl,r)),e.xid=r=>e.check(Qo(Jl,r)),e.ksuid=r=>e.check(ea(Kl,r)),e.ipv4=r=>e.check(ta(Bl,r)),e.ipv6=r=>e.check(ra(Hl,r)),e.cidrv4=r=>e.check(na(Wl,r)),e.cidrv6=r=>e.check(ia(Gl,r)),e.e164=r=>e.check(sa(Ql,r)),e.datetime=r=>e.check(El(r)),e.date=r=>e.check(Ol(r)),e.time=r=>e.check(Dl(r)),e.duration=r=>e.check(Cl(r))});function y(e){return qu(ya,e)}var le=g("ZodStringFormat",(e,t)=>{ae.init(e,t),Al.init(e,t)}),Ul=g("ZodEmail",(e,t)=>{Dc.init(e,t),le.init(e,t)});function Sx(e){return qo(Ul,e)}var ha=g("ZodGUID",(e,t)=>{Oc.init(e,t),le.init(e,t)});function zx(e){return li(ha,e)}var At=g("ZodUUID",(e,t)=>{Nc.init(e,t),le.init(e,t)});function Ix(e){return Vo(At,e)}function Px(e){return Jo(At,e)}function jx(e){return Ko(At,e)}function Ex(e){return Bo(At,e)}var _a=g("ZodURL",(e,t)=>{Rc.init(e,t),le.init(e,t)});function Tx(e){return di(_a,e)}function Ox(e){return di(_a,{protocol:/^https?$/,hostname:st.domain,...k.normalizeParams(e)})}var Ml=g("ZodEmoji",(e,t)=>{Cc.init(e,t),le.init(e,t)});function Nx(e){return Ho(Ml,e)}var Fl=g("ZodNanoID",(e,t)=>{Zc.init(e,t),le.init(e,t)});function Dx(e){return Wo(Fl,e)}var Ll=g("ZodCUID",(e,t)=>{Ac.init(e,t),le.init(e,t)});function Rx(e){return Go(Ll,e)}var ql=g("ZodCUID2",(e,t)=>{Uc.init(e,t),le.init(e,t)});function Cx(e){return Xo(ql,e)}var Vl=g("ZodULID",(e,t)=>{Mc.init(e,t),le.init(e,t)});function Zx(e){return Yo(Vl,e)}var Jl=g("ZodXID",(e,t)=>{Fc.init(e,t),le.init(e,t)});function Ax(e){return Qo(Jl,e)}var Kl=g("ZodKSUID",(e,t)=>{Lc.init(e,t),le.init(e,t)});function Ux(e){return ea(Kl,e)}var Bl=g("ZodIPv4",(e,t)=>{Bc.init(e,t),le.init(e,t)});function Mx(e){return ta(Bl,e)}var ng=g("ZodMAC",(e,t)=>{Wc.init(e,t),le.init(e,t)});function Fx(e){return Vu(ng,e)}var Hl=g("ZodIPv6",(e,t)=>{Hc.init(e,t),le.init(e,t)});function Lx(e){return ra(Hl,e)}var Wl=g("ZodCIDRv4",(e,t)=>{Gc.init(e,t),le.init(e,t)});function qx(e){return na(Wl,e)}var Gl=g("ZodCIDRv6",(e,t)=>{Xc.init(e,t),le.init(e,t)});function Vx(e){return ia(Gl,e)}var Xl=g("ZodBase64",(e,t)=>{Yc.init(e,t),le.init(e,t)});function Jx(e){return oa(Xl,e)}var Yl=g("ZodBase64URL",(e,t)=>{Qc.init(e,t),le.init(e,t)});function Kx(e){return aa(Yl,e)}var Ql=g("ZodE164",(e,t)=>{eu.init(e,t),le.init(e,t)});function Bx(e){return sa(Ql,e)}var ed=g("ZodJWT",(e,t)=>{tu.init(e,t),le.init(e,t)});function Hx(e){return ca(ed,e)}var zi=g("ZodCustomStringFormat",(e,t)=>{ru.init(e,t),le.init(e,t)});function Wx(e,t,r={}){return an(zi,e,t,r)}function Gx(e){return an(zi,"hostname",st.hostname,e)}function Xx(e){return an(zi,"hex",st.hex,e)}function Yx(e,t){let r=t?.enc??"hex",n=`${e}_${r}`,i=st[n];if(!i)throw new Error(`Unrecognized hash format: ${n}`);return an(zi,n,i,t)}var $a=g("ZodNumber",(e,t)=>{Uo.init(e,t),B.init(e,t),e._zod.processJSONSchema=(n,i,o)=>ih(e,n,i,o),e.gt=(n,i)=>e.check(Ct(n,i)),e.gte=(n,i)=>e.check(qe(n,i)),e.min=(n,i)=>e.check(qe(n,i)),e.lt=(n,i)=>e.check(Rt(n,i)),e.lte=(n,i)=>e.check(tt(n,i)),e.max=(n,i)=>e.check(tt(n,i)),e.int=n=>e.check(Zl(n)),e.safe=n=>e.check(Zl(n)),e.positive=n=>e.check(Ct(0,n)),e.nonnegative=n=>e.check(qe(0,n)),e.negative=n=>e.check(Rt(0,n)),e.nonpositive=n=>e.check(tt(0,n)),e.multipleOf=(n,i)=>e.check(yr(n,i)),e.step=(n,i)=>e.check(yr(n,i)),e.finite=()=>e;let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function oe(e){return Wu($a,e)}var cn=g("ZodNumberFormat",(e,t)=>{nu.init(e,t),$a.init(e,t)});function Zl(e){return Gu(cn,e)}function Qx(e){return Xu(cn,e)}function ek(e){return Yu(cn,e)}function tk(e){return Qu(cn,e)}function rk(e){return el(cn,e)}var ba=g("ZodBoolean",(e,t)=>{si.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>oh(e,r,n,i)});function xe(e){return tl(ba,e)}var xa=g("ZodBigInt",(e,t)=>{Mo.init(e,t),B.init(e,t),e._zod.processJSONSchema=(n,i,o)=>ah(e,n,i,o),e.gte=(n,i)=>e.check(qe(n,i)),e.min=(n,i)=>e.check(qe(n,i)),e.gt=(n,i)=>e.check(Ct(n,i)),e.gte=(n,i)=>e.check(qe(n,i)),e.min=(n,i)=>e.check(qe(n,i)),e.lt=(n,i)=>e.check(Rt(n,i)),e.lte=(n,i)=>e.check(tt(n,i)),e.max=(n,i)=>e.check(tt(n,i)),e.positive=n=>e.check(Ct(BigInt(0),n)),e.negative=n=>e.check(Rt(BigInt(0),n)),e.nonpositive=n=>e.check(tt(BigInt(0),n)),e.nonnegative=n=>e.check(qe(BigInt(0),n)),e.multipleOf=(n,i)=>e.check(yr(n,i));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});function nk(e){return rl(xa,e)}var td=g("ZodBigIntFormat",(e,t)=>{iu.init(e,t),xa.init(e,t)});function ik(e){return nl(td,e)}function ok(e){return il(td,e)}var ig=g("ZodSymbol",(e,t)=>{ou.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>sh(e,r,n,i)});function ak(e){return ol(ig,e)}var og=g("ZodUndefined",(e,t)=>{au.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>uh(e,r,n,i)});function sk(e){return al(og,e)}var ag=g("ZodNull",(e,t)=>{su.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>ch(e,r,n,i)});function Ii(e){return sl(ag,e)}var sg=g("ZodAny",(e,t)=>{cu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>ph(e,r,n,i)});function ck(){return cl(sg)}var cg=g("ZodUnknown",(e,t)=>{uu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>fh(e,r,n,i)});function de(){return ul(cg)}var ug=g("ZodNever",(e,t)=>{lu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>dh(e,r,n,i)});function rd(e){return ll(ug,e)}var lg=g("ZodVoid",(e,t)=>{du.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>lh(e,r,n,i)});function uk(e){return dl(lg,e)}var nd=g("ZodDate",(e,t)=>{pu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(n,i,o)=>mh(e,n,i,o),e.min=(n,i)=>e.check(qe(n,i)),e.max=(n,i)=>e.check(tt(n,i));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});function lk(e){return pl(nd,e)}var dg=g("ZodArray",(e,t)=>{fu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>zh(e,r,n,i),e.element=t.element,e.min=(r,n)=>e.check(Yt(r,n)),e.nonempty=r=>e.check(Yt(1,r)),e.max=(r,n)=>e.check(nn(r,n)),e.length=(r,n)=>e.check(on(r,n)),e.unwrap=()=>e.element});function Y(e,t){return th(dg,e,t)}function dk(e){let t=e._zod.def.shape;return Re(Object.keys(t))}var ka=g("ZodObject",(e,t)=>{Qm.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Ih(e,r,n,i),k.defineLazy(e,"shape",()=>t.shape),e.keyof=()=>Re(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:de()}),e.loose=()=>e.clone({...e._zod.def,catchall:de()}),e.strict=()=>e.clone({...e._zod.def,catchall:rd()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>k.extend(e,r),e.safeExtend=r=>k.safeExtend(e,r),e.merge=r=>k.merge(e,r),e.pick=r=>k.pick(e,r),e.omit=r=>k.omit(e,r),e.partial=(...r)=>k.partial(od,e,r[0]),e.required=(...r)=>k.required(ad,e,r[0])});function T(e,t){let r={type:"object",shape:e??{},...k.normalizeParams(t)};return new ka(r)}function pk(e,t){return new ka({type:"object",shape:e,catchall:rd(),...k.normalizeParams(t)})}function De(e,t){return new ka({type:"object",shape:e,catchall:de(),...k.normalizeParams(t)})}var wa=g("ZodUnion",(e,t)=>{ci.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>zl(e,r,n,i),e.options=t.options});function se(e,t){return new wa({type:"union",options:e,...k.normalizeParams(t)})}var pg=g("ZodXor",(e,t)=>{wa.init(e,t),mu.init(e,t),e._zod.processJSONSchema=(r,n,i)=>zl(e,r,n,i),e.options=t.options});function fk(e,t){return new pg({type:"union",options:e,inclusive:!1,...k.normalizeParams(t)})}var fg=g("ZodDiscriminatedUnion",(e,t)=>{wa.init(e,t),hu.init(e,t)});function Sa(e,t,r){return new fg({type:"union",options:t,discriminator:e,...k.normalizeParams(r)})}var mg=g("ZodIntersection",(e,t)=>{gu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Ph(e,r,n,i)});function Pi(e,t){return new mg({type:"intersection",left:e,right:t})}var hg=g("ZodTuple",(e,t)=>{Fo.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>jh(e,r,n,i),e.rest=r=>e.clone({...e._zod.def,rest:r})});function gg(e,t,r){let n=t instanceof V,i=n?r:t,o=n?t:null;return new hg({type:"tuple",items:e,rest:o,...k.normalizeParams(i)})}var za=g("ZodRecord",(e,t)=>{vu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Eh(e,r,n,i),e.keyType=t.keyType,e.valueType=t.valueType});function me(e,t,r){return new za({type:"record",keyType:e,valueType:t,...k.normalizeParams(r)})}function mk(e,t,r){let n=Fe(e);return n._zod.values=void 0,new za({type:"record",keyType:n,valueType:t,...k.normalizeParams(r)})}function hk(e,t,r){return new za({type:"record",keyType:e,valueType:t,mode:"loose",...k.normalizeParams(r)})}var vg=g("ZodMap",(e,t)=>{yu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>wh(e,r,n,i),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(Zt(...r)),e.nonempty=r=>e.check(Zt(1,r)),e.max=(...r)=>e.check(_r(...r)),e.size=(...r)=>e.check(rn(...r))});function gk(e,t,r){return new vg({type:"map",keyType:e,valueType:t,...k.normalizeParams(r)})}var yg=g("ZodSet",(e,t)=>{_u.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Sh(e,r,n,i),e.min=(...r)=>e.check(Zt(...r)),e.nonempty=r=>e.check(Zt(1,r)),e.max=(...r)=>e.check(_r(...r)),e.size=(...r)=>e.check(rn(...r))});function vk(e,t){return new yg({type:"set",valueType:e,...k.normalizeParams(t)})}var Si=g("ZodEnum",(e,t)=>{$u.init(e,t),B.init(e,t),e._zod.processJSONSchema=(n,i,o)=>hh(e,n,i,o),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(n,i)=>{let o={};for(let a of n)if(r.has(a))o[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new Si({...t,checks:[],...k.normalizeParams(i),entries:o})},e.exclude=(n,i)=>{let o={...t.entries};for(let a of n)if(r.has(a))delete o[a];else throw new Error(`Key ${a} not found in enum`);return new Si({...t,checks:[],...k.normalizeParams(i),entries:o})}});function Re(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Si({type:"enum",entries:r,...k.normalizeParams(t)})}function yk(e,t){return new Si({type:"enum",entries:e,...k.normalizeParams(t)})}var _g=g("ZodLiteral",(e,t)=>{bu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>gh(e,r,n,i),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function N(e,t){return new _g({type:"literal",values:Array.isArray(e)?e:[e],...k.normalizeParams(t)})}var $g=g("ZodFile",(e,t)=>{xu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>_h(e,r,n,i),e.min=(r,n)=>e.check(Zt(r,n)),e.max=(r,n)=>e.check(_r(r,n)),e.mime=(r,n)=>e.check(yi(Array.isArray(r)?r:[r],n))});function _k(e){return _l($g,e)}var bg=g("ZodTransform",(e,t)=>{ku.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>kh(e,r,n,i),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new mr(e.constructor.name);r.addIssue=o=>{if(typeof o=="string")r.issues.push(k.issue(o,r.value,t));else{let a=o;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=e),r.issues.push(k.issue(a))}};let i=t.transform(r.value,r);return i instanceof Promise?i.then(o=>(r.value=o,r)):(r.value=i,r)}});function id(e){return new bg({type:"transform",transform:e})}var od=g("ZodOptional",(e,t)=>{Lo.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Il(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function he(e){return new od({type:"optional",innerType:e})}var xg=g("ZodExactOptional",(e,t)=>{wu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Il(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function kg(e){return new xg({type:"optional",innerType:e})}var wg=g("ZodNullable",(e,t)=>{Su.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Th(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function ga(e){return new wg({type:"nullable",innerType:e})}function $k(e){return he(ga(e))}var Sg=g("ZodDefault",(e,t)=>{zu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Nh(e,r,n,i),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function zg(e,t){return new Sg({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():k.shallowClone(t)}})}var Ig=g("ZodPrefault",(e,t)=>{Iu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Dh(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function Pg(e,t){return new Ig({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():k.shallowClone(t)}})}var ad=g("ZodNonOptional",(e,t)=>{Pu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Oh(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function jg(e,t){return new ad({type:"nonoptional",innerType:e,...k.normalizeParams(t)})}var Eg=g("ZodSuccess",(e,t)=>{ju.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>$h(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function bk(e){return new Eg({type:"success",innerType:e})}var Tg=g("ZodCatch",(e,t)=>{Eu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Rh(e,r,n,i),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Og(e,t){return new Tg({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var Ng=g("ZodNaN",(e,t)=>{Tu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>vh(e,r,n,i)});function xk(e){return fl(Ng,e)}var sd=g("ZodPipe",(e,t)=>{Ou.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Ch(e,r,n,i),e.in=t.in,e.out=t.out});function va(e,t){return new sd({type:"pipe",in:e,out:t})}var cd=g("ZodCodec",(e,t)=>{sd.init(e,t),ui.init(e,t)});function kk(e,t,r){return new cd({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}var Dg=g("ZodReadonly",(e,t)=>{Nu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Zh(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function Rg(e){return new Dg({type:"readonly",innerType:e})}var Cg=g("ZodTemplateLiteral",(e,t)=>{Du.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>yh(e,r,n,i)});function wk(e,t){return new Cg({type:"template_literal",parts:e,...k.normalizeParams(t)})}var Zg=g("ZodLazy",(e,t)=>{Zu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Uh(e,r,n,i),e.unwrap=()=>e._zod.def.getter()});function Ag(e){return new Zg({type:"lazy",getter:e})}var Ug=g("ZodPromise",(e,t)=>{Cu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Ah(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function Sk(e){return new Ug({type:"promise",innerType:e})}var Mg=g("ZodFunction",(e,t)=>{Ru.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>xh(e,r,n,i)});function zk(e){return new Mg({type:"function",input:Array.isArray(e?.input)?gg(e?.input):e?.input??Y(de()),output:e?.output??de()})}var Ia=g("ZodCustom",(e,t)=>{Au.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>bh(e,r,n,i)});function Ik(e){let t=new ue({check:"custom"});return t._zod.check=e,t}function ud(e,t){return $l(Ia,e??(()=>!0),t)}function Fg(e,t={}){return bl(Ia,e,t)}function Lg(e){return xl(e)}var Pk=kl,jk=wl;function Ek(e,t={}){let r=new Ia({type:"custom",check:"custom",fn:n=>n instanceof e,abort:!0,...k.normalizeParams(t)});return r._zod.bag.Class=e,r._zod.check=n=>{n.value instanceof e||n.issues.push({code:"invalid_type",expected:e.name,input:n.value,inst:r,path:[...r._zod.def.path??[]]})},r}var Tk=(...e)=>Sl({Codec:cd,Boolean:ba,String:ya},...e);function Ok(e){let t=Ag(()=>se([y(e),oe(),xe(),Ii(),Y(t),me(y(),t)]));return t}function Pa(e,t){return va(id(e),t)}var qg;qg||(qg={});var p4={...wi,...ma,iso:$r};we(Uu());var dd="2025-11-25";var Vg=[dd,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],er="io.modelcontextprotocol/related-task",Ea="2.0",Ie=ud(e=>e!==null&&(typeof e=="object"||typeof e=="function")),Jg=se([y(),oe().int()]),Kg=y(),T4=De({ttl:se([oe(),Ii()]).optional(),pollInterval:oe().optional()}),Ck=T({ttl:oe().optional()}),Zk=T({taskId:y()}),pd=De({progressToken:Jg.optional(),[er]:Zk.optional()}),nt=T({_meta:pd.optional()}),ji=nt.extend({task:Ck.optional()}),Bg=e=>ji.safeParse(e).success,Pe=T({method:y(),params:nt.loose().optional()}),ct=T({_meta:pd.optional()}),ut=T({method:y(),params:ct.loose().optional()}),je=De({_meta:pd.optional()}),Ta=se([y(),oe().int()]),Hg=T({jsonrpc:N(Ea),id:Ta,...Pe.shape}).strict(),fd=e=>Hg.safeParse(e).success,Wg=T({jsonrpc:N(Ea),...ut.shape}).strict(),Gg=e=>Wg.safeParse(e).success,md=T({jsonrpc:N(Ea),id:Ta,result:je}).strict(),Ei=e=>md.safeParse(e).success;var Z;(function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(Z||(Z={}));var hd=T({jsonrpc:N(Ea),id:Ta.optional(),error:T({code:oe().int(),message:y(),data:de().optional()})}).strict();var Xg=e=>hd.safeParse(e).success;var Yg=se([Hg,Wg,md,hd]),O4=se([md,hd]),Oa=je.strict(),Ak=ct.extend({requestId:Ta.optional(),reason:y().optional()}),Na=ut.extend({method:N("notifications/cancelled"),params:Ak}),Uk=T({src:y(),mimeType:y().optional(),sizes:Y(y()).optional(),theme:Re(["light","dark"]).optional()}),Ti=T({icons:Y(Uk).optional()}),un=T({name:y(),title:y().optional()}),Qg=un.extend({...un.shape,...Ti.shape,version:y(),websiteUrl:y().optional(),description:y().optional()}),Mk=Pi(T({applyDefaults:xe().optional()}),me(y(),de())),Fk=Pa(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Pi(T({form:Mk.optional(),url:Ie.optional()}),me(y(),de()).optional())),Lk=De({list:Ie.optional(),cancel:Ie.optional(),requests:De({sampling:De({createMessage:Ie.optional()}).optional(),elicitation:De({create:Ie.optional()}).optional()}).optional()}),qk=De({list:Ie.optional(),cancel:Ie.optional(),requests:De({tools:De({call:Ie.optional()}).optional()}).optional()}),Vk=T({experimental:me(y(),Ie).optional(),sampling:T({context:Ie.optional(),tools:Ie.optional()}).optional(),elicitation:Fk.optional(),roots:T({listChanged:xe().optional()}).optional(),tasks:Lk.optional()}),Jk=nt.extend({protocolVersion:y(),capabilities:Vk,clientInfo:Qg}),gd=Pe.extend({method:N("initialize"),params:Jk});var Kk=T({experimental:me(y(),Ie).optional(),logging:Ie.optional(),completions:Ie.optional(),prompts:T({listChanged:xe().optional()}).optional(),resources:T({subscribe:xe().optional(),listChanged:xe().optional()}).optional(),tools:T({listChanged:xe().optional()}).optional(),tasks:qk.optional()}),Bk=je.extend({protocolVersion:y(),capabilities:Kk,serverInfo:Qg,instructions:y().optional()}),vd=ut.extend({method:N("notifications/initialized"),params:ct.optional()});var Da=Pe.extend({method:N("ping"),params:nt.optional()}),Hk=T({progress:oe(),total:he(oe()),message:he(y())}),Wk=T({...ct.shape,...Hk.shape,progressToken:Jg}),Ra=ut.extend({method:N("notifications/progress"),params:Wk}),Gk=nt.extend({cursor:Kg.optional()}),Oi=Pe.extend({params:Gk.optional()}),Ni=je.extend({nextCursor:Kg.optional()}),Xk=Re(["working","input_required","completed","failed","cancelled"]),Di=T({taskId:y(),status:Xk,ttl:se([oe(),Ii()]),createdAt:y(),lastUpdatedAt:y(),pollInterval:he(oe()),statusMessage:he(y())}),ln=je.extend({task:Di}),Yk=ct.merge(Di),Ri=ut.extend({method:N("notifications/tasks/status"),params:Yk}),Ca=Pe.extend({method:N("tasks/get"),params:nt.extend({taskId:y()})}),Za=je.merge(Di),Aa=Pe.extend({method:N("tasks/result"),params:nt.extend({taskId:y()})}),N4=je.loose(),Ua=Oi.extend({method:N("tasks/list")}),Ma=Ni.extend({tasks:Y(Di)}),Fa=Pe.extend({method:N("tasks/cancel"),params:nt.extend({taskId:y()})}),ev=je.merge(Di),tv=T({uri:y(),mimeType:he(y()),_meta:me(y(),de()).optional()}),rv=tv.extend({text:y()}),yd=y().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),nv=tv.extend({blob:yd}),Ci=Re(["user","assistant"]),dn=T({audience:Y(Ci).optional(),priority:oe().min(0).max(1).optional(),lastModified:$r.datetime({offset:!0}).optional()}),iv=T({...un.shape,...Ti.shape,uri:y(),description:he(y()),mimeType:he(y()),annotations:dn.optional(),_meta:he(De({}))}),Qk=T({...un.shape,...Ti.shape,uriTemplate:y(),description:he(y()),mimeType:he(y()),annotations:dn.optional(),_meta:he(De({}))}),_d=Oi.extend({method:N("resources/list")}),ew=Ni.extend({resources:Y(iv)}),tw=Oi.extend({method:N("resources/templates/list")}),rw=Ni.extend({resourceTemplates:Y(Qk)}),$d=nt.extend({uri:y()}),nw=$d,bd=Pe.extend({method:N("resources/read"),params:nw}),iw=je.extend({contents:Y(se([rv,nv]))}),ow=ut.extend({method:N("notifications/resources/list_changed"),params:ct.optional()}),aw=$d,sw=Pe.extend({method:N("resources/subscribe"),params:aw}),cw=$d,uw=Pe.extend({method:N("resources/unsubscribe"),params:cw}),lw=ct.extend({uri:y()}),dw=ut.extend({method:N("notifications/resources/updated"),params:lw}),pw=T({name:y(),description:he(y()),required:he(xe())}),fw=T({...un.shape,...Ti.shape,description:he(y()),arguments:he(Y(pw)),_meta:he(De({}))}),xd=Oi.extend({method:N("prompts/list")}),mw=Ni.extend({prompts:Y(fw)}),hw=nt.extend({name:y(),arguments:me(y(),y()).optional()}),kd=Pe.extend({method:N("prompts/get"),params:hw}),wd=T({type:N("text"),text:y(),annotations:dn.optional(),_meta:me(y(),de()).optional()}),Sd=T({type:N("image"),data:yd,mimeType:y(),annotations:dn.optional(),_meta:me(y(),de()).optional()}),zd=T({type:N("audio"),data:yd,mimeType:y(),annotations:dn.optional(),_meta:me(y(),de()).optional()}),gw=T({type:N("tool_use"),name:y(),id:y(),input:me(y(),de()),_meta:me(y(),de()).optional()}),vw=T({type:N("resource"),resource:se([rv,nv]),annotations:dn.optional(),_meta:me(y(),de()).optional()}),yw=iv.extend({type:N("resource_link")}),Id=se([wd,Sd,zd,yw,vw]),_w=T({role:Ci,content:Id}),$w=je.extend({description:y().optional(),messages:Y(_w)}),bw=ut.extend({method:N("notifications/prompts/list_changed"),params:ct.optional()}),xw=T({title:y().optional(),readOnlyHint:xe().optional(),destructiveHint:xe().optional(),idempotentHint:xe().optional(),openWorldHint:xe().optional()}),kw=T({taskSupport:Re(["required","optional","forbidden"]).optional()}),ov=T({...un.shape,...Ti.shape,description:y().optional(),inputSchema:T({type:N("object"),properties:me(y(),Ie).optional(),required:Y(y()).optional()}).catchall(de()),outputSchema:T({type:N("object"),properties:me(y(),Ie).optional(),required:Y(y()).optional()}).catchall(de()).optional(),annotations:xw.optional(),execution:kw.optional(),_meta:me(y(),de()).optional()}),Pd=Oi.extend({method:N("tools/list")}),ww=Ni.extend({tools:Y(ov)}),La=je.extend({content:Y(Id).default([]),structuredContent:me(y(),de()).optional(),isError:xe().optional()}),D4=La.or(je.extend({toolResult:de()})),Sw=ji.extend({name:y(),arguments:me(y(),de()).optional()}),Zi=Pe.extend({method:N("tools/call"),params:Sw}),zw=ut.extend({method:N("notifications/tools/list_changed"),params:ct.optional()}),R4=T({autoRefresh:xe().default(!0),debounceMs:oe().int().nonnegative().default(300)}),Ai=Re(["debug","info","notice","warning","error","critical","alert","emergency"]),Iw=nt.extend({level:Ai}),jd=Pe.extend({method:N("logging/setLevel"),params:Iw}),Pw=ct.extend({level:Ai,logger:y().optional(),data:de()}),jw=ut.extend({method:N("notifications/message"),params:Pw}),Ew=T({name:y().optional()}),Tw=T({hints:Y(Ew).optional(),costPriority:oe().min(0).max(1).optional(),speedPriority:oe().min(0).max(1).optional(),intelligencePriority:oe().min(0).max(1).optional()}),Ow=T({mode:Re(["auto","required","none"]).optional()}),Nw=T({type:N("tool_result"),toolUseId:y().describe("The unique identifier for the corresponding tool call."),content:Y(Id).default([]),structuredContent:T({}).loose().optional(),isError:xe().optional(),_meta:me(y(),de()).optional()}),Dw=Sa("type",[wd,Sd,zd]),ja=Sa("type",[wd,Sd,zd,gw,Nw]),Rw=T({role:Ci,content:se([ja,Y(ja)]),_meta:me(y(),de()).optional()}),Cw=ji.extend({messages:Y(Rw),modelPreferences:Tw.optional(),systemPrompt:y().optional(),includeContext:Re(["none","thisServer","allServers"]).optional(),temperature:oe().optional(),maxTokens:oe().int(),stopSequences:Y(y()).optional(),metadata:Ie.optional(),tools:Y(ov).optional(),toolChoice:Ow.optional()}),Zw=Pe.extend({method:N("sampling/createMessage"),params:Cw}),Ed=je.extend({model:y(),stopReason:he(Re(["endTurn","stopSequence","maxTokens"]).or(y())),role:Ci,content:Dw}),Td=je.extend({model:y(),stopReason:he(Re(["endTurn","stopSequence","maxTokens","toolUse"]).or(y())),role:Ci,content:se([ja,Y(ja)])}),Aw=T({type:N("boolean"),title:y().optional(),description:y().optional(),default:xe().optional()}),Uw=T({type:N("string"),title:y().optional(),description:y().optional(),minLength:oe().optional(),maxLength:oe().optional(),format:Re(["email","uri","date","date-time"]).optional(),default:y().optional()}),Mw=T({type:Re(["number","integer"]),title:y().optional(),description:y().optional(),minimum:oe().optional(),maximum:oe().optional(),default:oe().optional()}),Fw=T({type:N("string"),title:y().optional(),description:y().optional(),enum:Y(y()),default:y().optional()}),Lw=T({type:N("string"),title:y().optional(),description:y().optional(),oneOf:Y(T({const:y(),title:y()})),default:y().optional()}),qw=T({type:N("string"),title:y().optional(),description:y().optional(),enum:Y(y()),enumNames:Y(y()).optional(),default:y().optional()}),Vw=se([Fw,Lw]),Jw=T({type:N("array"),title:y().optional(),description:y().optional(),minItems:oe().optional(),maxItems:oe().optional(),items:T({type:N("string"),enum:Y(y())}),default:Y(y()).optional()}),Kw=T({type:N("array"),title:y().optional(),description:y().optional(),minItems:oe().optional(),maxItems:oe().optional(),items:T({anyOf:Y(T({const:y(),title:y()}))}),default:Y(y()).optional()}),Bw=se([Jw,Kw]),Hw=se([qw,Vw,Bw]),Ww=se([Hw,Aw,Uw,Mw]),Gw=ji.extend({mode:N("form").optional(),message:y(),requestedSchema:T({type:N("object"),properties:me(y(),Ww),required:Y(y()).optional()})}),Xw=ji.extend({mode:N("url"),message:y(),elicitationId:y(),url:y().url()}),Yw=se([Gw,Xw]),Qw=Pe.extend({method:N("elicitation/create"),params:Yw}),eS=ct.extend({elicitationId:y()}),tS=ut.extend({method:N("notifications/elicitation/complete"),params:eS}),qa=je.extend({action:Re(["accept","decline","cancel"]),content:Pa(e=>e===null?void 0:e,me(y(),se([y(),oe(),xe(),Y(y())])).optional())}),rS=T({type:N("ref/resource"),uri:y()});var nS=T({type:N("ref/prompt"),name:y()}),iS=nt.extend({ref:se([nS,rS]),argument:T({name:y(),value:y()}),context:T({arguments:me(y(),y()).optional()}).optional()}),oS=Pe.extend({method:N("completion/complete"),params:iS});var aS=je.extend({completion:De({values:Y(y()).max(100),total:he(oe().int()),hasMore:he(xe())})}),sS=T({uri:y().startsWith("file://"),name:y().optional(),_meta:me(y(),de()).optional()}),cS=Pe.extend({method:N("roots/list"),params:nt.optional()}),Od=je.extend({roots:Y(sS)}),uS=ut.extend({method:N("notifications/roots/list_changed"),params:ct.optional()}),C4=se([Da,gd,oS,jd,kd,xd,_d,tw,bd,sw,uw,Zi,Pd,Ca,Aa,Ua,Fa]),Z4=se([Na,Ra,vd,uS,Ri]),A4=se([Oa,Ed,Td,qa,Od,Za,Ma,ln]),U4=se([Da,Zw,Qw,cS,Ca,Aa,Ua,Fa]),M4=se([Na,Ra,jw,dw,ow,zw,bw,Ri,tS]),F4=se([Oa,Bk,aS,$w,mw,ew,rw,iw,La,ww,Za,Ma,ln]),R=class e extends Error{constructor(t,r,n){super(`MCP error ${t}: ${r}`),this.code=t,this.data=n,this.name="McpError"}static fromError(t,r,n){if(t===Z.UrlElicitationRequired&&n){let i=n;if(i.elicitations)return new ld(i.elicitations,r)}return new e(t,r,n)}},ld=class extends R{constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(Z.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}};function tr(e){return e==="completed"||e==="failed"||e==="cancelled"}var bR=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Nd(e){let r=fa(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=qh(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function Dd(e,t){let r=Qt(e,t);if(!r.success)throw r.error;return r.data}var hS=6e4,Va=class{constructor(t){this._options=t,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(Na,r=>{this._oncancel(r)}),this.setNotificationHandler(Ra,r=>{this._onprogress(r)}),this.setRequestHandler(Da,r=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Ca,async(r,n)=>{let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new R(Z.InvalidParams,"Failed to retrieve task: Task not found");return{...i}}),this.setRequestHandler(Aa,async(r,n)=>{let i=async()=>{let o=r.params.taskId;if(this._taskMessageQueue){let s;for(;s=await this._taskMessageQueue.dequeue(o,n.sessionId);){if(s.type==="response"||s.type==="error"){let c=s.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),s.type==="response")l(c);else{let d=c,f=new R(d.error.code,d.error.message,d.error.data);l(f)}else{let d=s.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${u}`))}continue}await this._transport?.send(s.message,{relatedRequestId:n.requestId})}}let a=await this._taskStore.getTask(o,n.sessionId);if(!a)throw new R(Z.InvalidParams,`Task not found: ${o}`);if(!tr(a.status))return await this._waitForTaskUpdate(o,n.signal),await i();if(tr(a.status)){let s=await this._taskStore.getTaskResult(o,n.sessionId);return this._clearTaskQueue(o),{...s,_meta:{...s._meta,[er]:{taskId:o}}}}return await i()};return await i()}),this.setRequestHandler(Ua,async(r,n)=>{try{let{tasks:i,nextCursor:o}=await this._taskStore.listTasks(r.params?.cursor,n.sessionId);return{tasks:i,nextCursor:o,_meta:{}}}catch(i){throw new R(Z.InvalidParams,`Failed to list tasks: ${i instanceof Error?i.message:String(i)}`)}}),this.setRequestHandler(Fa,async(r,n)=>{try{let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new R(Z.InvalidParams,`Task not found: ${r.params.taskId}`);if(tr(i.status))throw new R(Z.InvalidParams,`Cannot cancel task in terminal status: ${i.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new R(Z.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...o}}catch(i){throw i instanceof R?i:new R(Z.InvalidRequest,`Failed to cancel task: ${i instanceof Error?i.message:String(i)}`)}}))}async _oncancel(t){if(!t.params.requestId)return;this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,r,n,i,o=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(i,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:o,onTimeout:i})}_resetTimeout(t){let r=this._timeoutInfo.get(t);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(t),R.fromError(Z.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(t){let r=this._timeoutInfo.get(t);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(t))}async connect(t){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=t;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=o=>{n?.(o),this._onerror(o)};let i=this._transport?.onmessage;this._transport.onmessage=(o,a)=>{i?.(o,a),Ei(o)||Xg(o)?this._onresponse(o):fd(o)?this._onrequest(o,a):Gg(o)?this._onnotification(o):this._onerror(new Error(`Unknown message type: ${JSON.stringify(o)}`))},await this._transport.start()}_onclose(){let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let n of this._requestHandlerAbortControllers.values())n.abort();this._requestHandlerAbortControllers.clear();let r=R.fromError(Z.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of t.values())n(r)}_onerror(t){this.onerror?.(t)}_onnotification(t){let r=this._notificationHandlers.get(t.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(t)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(t,r){let n=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,i=this._transport,o=t.params?._meta?.[er]?.taskId;if(n===void 0){let l={jsonrpc:"2.0",id:t.id,error:{code:Z.MethodNotFound,message:"Method not found"}};o&&this._taskMessageQueue?this._enqueueTaskMessage(o,{type:"error",message:l,timestamp:Date.now()},i?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):i?.send(l).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let a=new AbortController;this._requestHandlerAbortControllers.set(t.id,a);let s=Bg(t.params)?t.params.task:void 0,c=this._taskStore?this.requestTaskStore(t,i?.sessionId):void 0,u={signal:a.signal,sessionId:i?.sessionId,_meta:t.params?._meta,sendNotification:async l=>{if(a.signal.aborted)return;let d={relatedRequestId:t.id};o&&(d.relatedTask={taskId:o}),await this.notification(l,d)},sendRequest:async(l,d,f)=>{if(a.signal.aborted)throw new R(Z.ConnectionClosed,"Request was cancelled");let p={...f,relatedRequestId:t.id};o&&!p.relatedTask&&(p.relatedTask={taskId:o});let m=p.relatedTask?.taskId??o;return m&&c&&await c.updateTaskStatus(m,"input_required"),await this.request(l,d,p)},authInfo:r?.authInfo,requestId:t.id,requestInfo:r?.requestInfo,taskId:o,taskStore:c,taskRequestedTtl:s?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{s&&this.assertTaskHandlerCapability(t.method)}).then(()=>n(t,u)).then(async l=>{if(a.signal.aborted)return;let d={result:l,jsonrpc:"2.0",id:t.id};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"response",message:d,timestamp:Date.now()},i?.sessionId):await i?.send(d)},async l=>{if(a.signal.aborted)return;let d={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(l.code)?l.code:Z.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"error",message:d,timestamp:Date.now()},i?.sessionId):await i?.send(d)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){let{progressToken:r,...n}=t.params,i=Number(r),o=this._progressHandlers.get(i);if(!o){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}let a=this._responseHandlers.get(i),s=this._timeoutInfo.get(i);if(s&&a&&s.resetTimeoutOnProgress)try{this._resetTimeout(i)}catch(c){this._responseHandlers.delete(i),this._progressHandlers.delete(i),this._cleanupTimeout(i),a(c);return}o(n)}_onresponse(t){let r=Number(t.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),Ei(t))n(t);else{let a=new R(t.error.code,t.error.message,t.error.data);n(a)}return}let i=this._responseHandlers.get(r);if(i===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let o=!1;if(Ei(t)&&t.result&&typeof t.result=="object"){let a=t.result;if(a.task&&typeof a.task=="object"){let s=a.task;typeof s.taskId=="string"&&(o=!0,this._taskProgressTokens.set(s.taskId,r))}}if(o||this._progressHandlers.delete(r),Ei(t))i(t);else{let a=R.fromError(t.error.code,t.error.message,t.error.data);i(a)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(t,r,n){let{task:i}=n??{};if(!i){try{yield{type:"result",result:await this.request(t,r,n)}}catch(a){yield{type:"error",error:a instanceof R?a:new R(Z.InternalError,String(a))}}return}let o;try{let a=await this.request(t,ln,n);if(a.task)o=a.task.taskId,yield{type:"taskCreated",task:a.task};else throw new R(Z.InternalError,"Task creation did not return a task");for(;;){let s=await this.getTask({taskId:o},n);if(yield{type:"taskStatus",task:s},tr(s.status)){s.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:o},r,n)}:s.status==="failed"?yield{type:"error",error:new R(Z.InternalError,`Task ${o} failed`)}:s.status==="cancelled"&&(yield{type:"error",error:new R(Z.InternalError,`Task ${o} was cancelled`)});return}if(s.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:o},r,n)};return}let c=s.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),n?.signal?.throwIfAborted()}}catch(a){yield{type:"error",error:a instanceof R?a:new R(Z.InternalError,String(a))}}}request(t,r,n){let{relatedRequestId:i,resumptionToken:o,onresumptiontoken:a,task:s,relatedTask:c}=n??{};return new Promise((u,l)=>{let d=b=>{l(b)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method),s&&this.assertTaskCapability(t.method)}catch(b){d(b);return}n?.signal?.throwIfAborted();let f=this._requestMessageId++,p={...t,jsonrpc:"2.0",id:f};n?.onprogress&&(this._progressHandlers.set(f,n.onprogress),p.params={...t.params,_meta:{...t.params?._meta||{},progressToken:f}}),s&&(p.params={...p.params,task:s}),c&&(p.params={...p.params,_meta:{...p.params?._meta||{},[er]:c}});let m=b=>{this._responseHandlers.delete(f),this._progressHandlers.delete(f),this._cleanupTimeout(f),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:f,reason:String(b)}},{relatedRequestId:i,resumptionToken:o,onresumptiontoken:a}).catch(S=>this._onerror(new Error(`Failed to send cancellation: ${S}`)));let $=b instanceof R?b:new R(Z.RequestTimeout,String(b));l($)};this._responseHandlers.set(f,b=>{if(!n?.signal?.aborted){if(b instanceof Error)return l(b);try{let $=Qt(r,b.result);$.success?u($.data):l($.error)}catch($){l($)}}}),n?.signal?.addEventListener("abort",()=>{m(n?.signal?.reason)});let h=n?.timeout??hS,v=()=>m(R.fromError(Z.RequestTimeout,"Request timed out",{timeout:h}));this._setupTimeout(f,h,n?.maxTotalTimeout,v,n?.resetTimeoutOnProgress??!1);let _=c?.taskId;if(_){let b=$=>{let S=this._responseHandlers.get(f);S?S($):this._onerror(new Error(`Response handler missing for side-channeled request ${f}`))};this._requestResolvers.set(f,b),this._enqueueTaskMessage(_,{type:"request",message:p,timestamp:Date.now()}).catch($=>{this._cleanupTimeout(f),l($)})}else this._transport.send(p,{relatedRequestId:i,resumptionToken:o,onresumptiontoken:a}).catch(b=>{this._cleanupTimeout(f),l(b)})})}async getTask(t,r){return this.request({method:"tasks/get",params:t},Za,r)}async getTaskResult(t,r,n){return this.request({method:"tasks/result",params:t},r,n)}async listTasks(t,r){return this.request({method:"tasks/list",params:t},Ma,r)}async cancelTask(t,r){return this.request({method:"tasks/cancel",params:t},ev,r)}async notification(t,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);let n=r?.relatedTask?.taskId;if(n){let s={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...t.params?._meta||{},[er]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:s,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;let s={...t,jsonrpc:"2.0"};r?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[er]:r.relatedTask}}}),this._transport?.send(s,r).catch(c=>this._onerror(c))});return}let a={...t,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[er]:r.relatedTask}}}),await this._transport.send(a,r)}setRequestHandler(t,r){let n=Nd(t);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(i,o)=>{let a=Dd(t,i);return Promise.resolve(r(a,o))})}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw new Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,r){let n=Nd(t);this._notificationHandlers.set(n,i=>{let o=Dd(t,i);return Promise.resolve(r(o))})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}_cleanupTaskProgressHandler(t){let r=this._taskProgressTokens.get(t);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(t))}async _enqueueTaskMessage(t,r,n){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let i=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,r,n,i)}async _clearTaskQueue(t,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(t,r);for(let i of n)if(i.type==="request"&&fd(i.message)){let o=i.message.id,a=this._requestResolvers.get(o);a?(a(new R(Z.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(o)):this._onerror(new Error(`Resolver missing for request ${o} during task ${t} cleanup`))}}}async _waitForTaskUpdate(t,r){let n=this._options?.defaultTaskPollInterval??1e3;try{let i=await this._taskStore?.getTask(t);i?.pollInterval&&(n=i.pollInterval)}catch{}return new Promise((i,o)=>{if(r.aborted){o(new R(Z.InvalidRequest,"Request cancelled"));return}let a=setTimeout(i,n);r.addEventListener("abort",()=>{clearTimeout(a),o(new R(Z.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async i=>{if(!t)throw new Error("No request provided");return await n.createTask(i,t.id,{method:t.method,params:t.params},r)},getTask:async i=>{let o=await n.getTask(i,r);if(!o)throw new R(Z.InvalidParams,"Failed to retrieve task: Task not found");return o},storeTaskResult:async(i,o,a)=>{await n.storeTaskResult(i,o,a,r);let s=await n.getTask(i,r);if(s){let c=Ri.parse({method:"notifications/tasks/status",params:s});await this.notification(c),tr(s.status)&&this._cleanupTaskProgressHandler(i)}},getTaskResult:i=>n.getTaskResult(i,r),updateTaskStatus:async(i,o,a)=>{let s=await n.getTask(i,r);if(!s)throw new R(Z.InvalidParams,`Task "${i}" not found - it may have been cleaned up`);if(tr(s.status))throw new R(Z.InvalidParams,`Cannot update task "${i}" from terminal status "${s.status}" to "${o}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(i,o,a,r);let c=await n.getTask(i,r);if(c){let u=Ri.parse({method:"notifications/tasks/status",params:c});await this.notification(u),tr(c.status)&&this._cleanupTaskProgressHandler(i)}},listTasks:i=>n.listTasks(i,r)}}};function av(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function sv(e,t){let r={...e};for(let n in t){let i=n,o=t[i];if(o===void 0)continue;let a=r[i];av(a)&&av(o)?r[i]={...a,...o}:r[i]=o}return r}var d$=it(jf(),1),p$=it(l$(),1);function LE(){let e=new d$.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,p$.default)(e),e}var Ps=class{constructor(t){this._ajv=t??LE()}getValidator(t){let r="$id"in t&&typeof t.$id=="string"?this._ajv.getSchema(t.$id)??this._ajv.compile(t):this._ajv.compile(t);return n=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var js=class{constructor(t){this._server=t}requestStream(t,r,n){return this._server.requestStream(t,r,n)}async getTask(t,r){return this._server.getTask({taskId:t},r)}async getTaskResult(t,r,n){return this._server.getTaskResult({taskId:t},r,n)}async listTasks(t,r){return this._server.listTasks(t?{cursor:t}:void 0,r)}async cancelTask(t,r){return this._server.cancelTask({taskId:t},r)}};function f$(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!e.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${t})`);break;default:break}}function m$(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!e.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!e.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${t})`);break;default:break}}var Es=class extends Va{constructor(t,r){super(r),this._serverInfo=t,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Ai.options.map((n,i)=>[n,i])),this.isMessageIgnored=(n,i)=>{let o=this._loggingLevels.get(i);return o?this.LOG_LEVEL_SEVERITY.get(n)<this.LOG_LEVEL_SEVERITY.get(o):!1},this._capabilities=r?.capabilities??{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new Ps,this.setRequestHandler(gd,n=>this._oninitialize(n)),this.setNotificationHandler(vd,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(jd,async(n,i)=>{let o=i.sessionId||i.requestInfo?.headers["mcp-session-id"]||void 0,{level:a}=n.params,s=Ai.safeParse(a);return s.success&&this._loggingLevels.set(o,s.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new js(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=sv(this._capabilities,t)}setRequestHandler(t,r){let i=fa(t)?.method;if(!i)throw new Error("Schema is missing a method literal");let o;if(sn(i)){let s=i;o=s._zod?.def?.value??s.value}else{let s=i;o=s._def?.value??s.value}if(typeof o!="string")throw new Error("Schema method literal must be a string");if(o==="tools/call"){let s=async(c,u)=>{let l=Qt(Zi,c);if(!l.success){let m=l.error instanceof Error?l.error.message:String(l.error);throw new R(Z.InvalidParams,`Invalid tools/call request: ${m}`)}let{params:d}=l.data,f=await Promise.resolve(r(c,u));if(d.task){let m=Qt(ln,f);if(!m.success){let h=m.error instanceof Error?m.error.message:String(m.error);throw new R(Z.InvalidParams,`Invalid task creation result: ${h}`)}return m.data}let p=Qt(La,f);if(!p.success){let m=p.error instanceof Error?p.error.message:String(p.error);throw new R(Z.InvalidParams,`Invalid tools/call result: ${m}`)}return p.data};return super.setRequestHandler(t,s)}return super.setRequestHandler(t,r)}assertCapabilityForMethod(t){switch(t){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${t})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${t})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${t})`);break;case"ping":break}}assertNotificationCapability(t){switch(t){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${t})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${t})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${t})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${t})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(t){if(this._capabilities)switch(t){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${t})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${t})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${t})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${t})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${t})`);break;case"ping":case"initialize":break}}assertTaskCapability(t){m$(this._clientCapabilities?.tasks?.requests,t,"Client")}assertTaskHandlerCapability(t){this._capabilities&&f$(this._capabilities.tasks?.requests,t,"Server")}async _oninitialize(t){let r=t.params.protocolVersion;return this._clientCapabilities=t.params.capabilities,this._clientVersion=t.params.clientInfo,{protocolVersion:Vg.includes(r)?r:dd,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"},Oa)}async createMessage(t,r){if((t.tools||t.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(t.messages.length>0){let n=t.messages[t.messages.length-1],i=Array.isArray(n.content)?n.content:[n.content],o=i.some(u=>u.type==="tool_result"),a=t.messages.length>1?t.messages[t.messages.length-2]:void 0,s=a?Array.isArray(a.content)?a.content:[a.content]:[],c=s.some(u=>u.type==="tool_use");if(o){if(i.some(u=>u.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!c)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let u=new Set(s.filter(d=>d.type==="tool_use").map(d=>d.id)),l=new Set(i.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(u.size!==l.size||![...u].every(d=>l.has(d)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return t.tools?this.request({method:"sampling/createMessage",params:t},Td,r):this.request({method:"sampling/createMessage",params:t},Ed,r)}async elicitInput(t,r){switch(t.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let i=t;return this.request({method:"elicitation/create",params:i},qa,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let i=t.mode==="form"?t:{...t,mode:"form"},o=await this.request({method:"elicitation/create",params:i},qa,r);if(o.action==="accept"&&o.content&&i.requestedSchema)try{let s=this._jsonSchemaValidator.getValidator(i.requestedSchema)(o.content);if(!s.valid)throw new R(Z.InvalidParams,`Elicitation response content does not match requested schema: ${s.errorMessage}`)}catch(a){throw a instanceof R?a:new R(Z.InternalError,`Error validating elicitation response: ${a instanceof Error?a.message:String(a)}`)}return o}}}createElicitationCompletionNotifier(t,r){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:t}},r)}async listRoots(t,r){return this.request({method:"roots/list",params:t},Od,r)}async sendLoggingMessage(t,r){if(this._capabilities.logging&&!this.isMessageIgnored(t.level,r))return this.notification({method:"notifications/message",params:t})}async sendResourceUpdated(t){return this.notification({method:"notifications/resources/updated",params:t})}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 Zf=it(require("node:process"),1);var Ts=class{append(t){this._buffer=this._buffer?Buffer.concat([this._buffer,t]):t}readMessage(){if(!this._buffer)return null;let t=this._buffer.indexOf(`
48
+ `);if(t===-1)return null;let r=this._buffer.toString("utf8",0,t).replace(/\r$/,"");return this._buffer=this._buffer.subarray(t+1),qE(r)}clear(){this._buffer=void 0}};function qE(e){return Yg.parse(JSON.parse(e))}function h$(e){return JSON.stringify(e)+`
49
+ `}var Os=class{constructor(t=Zf.default.stdin,r=Zf.default.stdout){this._stdin=t,this._stdout=r,this._readBuffer=new Ts,this._started=!1,this._ondata=n=>{this._readBuffer.append(n),this.processReadBuffer()},this._onerror=n=>{this.onerror?.(n)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(;;)try{let t=this._readBuffer.readMessage();if(t===null)break;this.onmessage?.(t)}catch(t){this.onerror?.(t)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(t){return new Promise(r=>{let n=h$(t);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};var Se=it(require("fs/promises")),ke=it(require("path")),jn=10*1024*1024,VE=1e3,Ns=class{skillsPath;cachedSkills=null;loadingPromise=null;loadingEpoch=-1;skillMap=new Map;contentCache=new Map;contentCacheStat=new Map;canonicalPathMap=new Map;scanEpoch=0;lastSuccessfulScanAt=0;skillSignature=null;constructor(t){this.skillsPath=ke.resolve(t)}stripQuotes(t){return t.replace(/^"(.*)"$|^'(.*)'$/,"$1$2").trim()}parseFrontmatter(t){let r=t;if(r.charCodeAt(0)===65279&&(r=r.slice(1)),!r.startsWith("---"))return{name:"",description:"",body:r.trim()};let n=r.slice(3).match(/\r?\n[ \t]*---[ \t]*(?:\r?\n|$)/);if(!n||n.index===void 0)return{name:"",description:"",body:r.trim()};let i=r.slice(3,3+n.index),o=r.slice(3+n.index+n[0].length).trim(),a=i.split(/\r?\n/),s="",c="",u=!1;for(let l of a){let d=l.match(/^name:\s*(.*?)\s*$/);if(d){s=this.stripQuotes(d[1]),u=!1;continue}let f=l.match(/^description:\s*(.*?)\s*$/);if(f){c=this.stripQuotes(f[1]),u=!0;continue}u&&/^\s+/.test(l)?c+=" "+l.trim():u=!1}return{name:s,description:c,body:o}}async listSkills(t=!1){if(!t&&this.cachedSkills&&Date.now()-this.lastSuccessfulScanAt<VE)return this.cachedSkills;let r=await this.computeSkillSignature();if(!t&&this.cachedSkills&&this.skillSignature!==null&&r===this.skillSignature)return this.lastSuccessfulScanAt=Date.now(),this.cachedSkills;t&&this.dropContentCaches();let n=this.loadingPromise;if(!t&&n&&this.loadingEpoch===this.scanEpoch)return n;let i=++this.scanEpoch,o=this.internalListSkills(i,r);this.loadingPromise=o,this.loadingEpoch=i;try{return await o}finally{this.loadingPromise===o&&(this.loadingPromise=null,this.loadingEpoch=-1)}}dropContentCaches(){this.contentCache.clear(),this.contentCacheStat.clear(),this.canonicalPathMap.clear(),this.skillSignature=null}async computeSkillSignature(){let t=async r=>{try{let n=await Se.lstat(r);return`${n.mode}\0${n.ino}\0${n.size}\0${n.mtimeMs}`}catch{return"-"}};try{let n=(await Se.readdir(this.skillsPath,{withFileTypes:!0})).filter(o=>o.isDirectory()||o.isSymbolicLink()),i=await Promise.all(n.map(async o=>{let a=ke.join(this.skillsPath,o.name),s=o.isDirectory()?"d":"l",c=s==="l"?await t(a):"-",u=await t(ke.join(a,"SKILL.md"));return`${o.name}\0${s}\0${c}\0${u}`}));return i.sort(),i.join("")}catch{return null}}async internalListSkills(t=this.scanEpoch,r){let n;try{let d=ke.resolve(this.skillsPath),f=await Se.realpath(d),p=await Se.stat(f);if(!p.isDirectory())return this.cachedSkills??[];n={realRootPath:f,rootStat:p}}catch{return this.cachedSkills??[]}let i=r!==void 0?r:await this.computeSkillSignature(),o=[],a=new Map,s=new Map,c=new Map,u=new Map,l=!1;try{let f=(await Se.readdir(this.skillsPath,{withFileTypes:!0})).filter(m=>m.isDirectory()||m.isSymbolicLink()),p=await Promise.all(f.map(async m=>{let h=ke.join(this.skillsPath,m.name),v=ke.join(h,"SKILL.md");try{let{content:_,realFilePath:b,stat:$}=await this.readFileNoFollow(v,this.skillsPath,n),{name:S,description:P,body:$e}=this.parseFrontmatter(_);return{item:{name:S||m.name,description:P,skillPath:v},body:$e,realFilePath:b,directoryName:m.name,stat:$}}catch(_){return _&&typeof _=="object"&&"code"in _&&_.code==="ENOENT"||process.stderr.write(`Warning: Failed to read skill file in directory "${m.name}"
50
+ `),null}}));for(let m of p.filter(h=>h!==null).sort((h,v)=>h.directoryName<v.directoryName?-1:h.directoryName>v.directoryName?1:0)){let{item:h,body:v,realFilePath:_,directoryName:b,stat:$}=m,S=new Set([h.name.toLowerCase(),b.toLowerCase()]),P=[...S].find(be=>a.has(be));if(P){process.stderr.write(`Warning: Skipping skill directory "${b}" because name or alias "${P}" is already registered
51
+ `);continue}o.push(h);for(let be of S)a.set(be,h);let $e=ke.resolve(h.skillPath);s.set(_,v),c.set(_,{dev:$.dev,ino:$.ino,size:$.size,mtimeMs:$.mtimeMs}),u.set($e,_),u.set(_,_)}l=!0}catch(d){process.stderr.write(`Error reading skills directory: ${String(d)}
52
+ `)}return l&&t===this.scanEpoch?(this.skillMap=a,this.cachedSkills=o.sort((d,f)=>d.name.localeCompare(f.name)),this.lastSuccessfulScanAt=Date.now(),this.contentCache=s,this.contentCacheStat=c,this.canonicalPathMap=u,this.skillSignature=i):l||(this.skillSignature=null),this.cachedSkills??[]}async findSkill(t){let r=typeof t=="string"?t.trim():"";if(!(!r||r==="."||r===".."||r.includes("/")||r.includes("\\")||r.includes("\0")))return this.cachedSkills||await this.listSkills(),this.skillMap.get(r.toLowerCase())}async readFileNoFollow(t,r,n){let i=ke.resolve(t),o=ke.resolve(r),a=await Se.realpath(i),s=n?n.realRootPath:await Se.realpath(o);if(!(n?n.rootStat:await Se.stat(s)).isDirectory())throw new Error("Skills directory must be a directory");let u=ke.relative(s,a);if(u===".."||u.startsWith(`..${ke.sep}`)||ke.isAbsolute(u))throw new Error("File is outside skills directory");let l=await Se.stat(a);if(!l.isFile()||l.nlink<1)throw new Error("Skill path is not a regular file");if(l.size>jn)throw new Error("Skill file exceeds size limit");let d=process.platform==="win32"?0:Se.constants.O_NOFOLLOW,f=await Se.open(a,Se.constants.O_RDONLY|d);try{let p=await f.stat();if(!p.isFile()||p.nlink<1||p.dev!==l.dev||p.ino!==l.ino||p.size>jn)throw new Error("File changed while opening");let m=p.size,h;if(m<=64*1024){h=Buffer.allocUnsafe(m);let _=0;for(;_<m;){let{bytesRead:b}=await f.read(h,_,m-_,null);if(b===0)break;_+=b}_<m&&(h=h.subarray(0,_))}else{let _=[],$=0;for(;$<=jn;){let S=Buffer.allocUnsafe(Math.min(65536,jn+1-$)),{bytesRead:P}=await f.read(S,0,S.length,null);if(P===0)break;if($+=P,_.push(S.subarray(0,P)),$>jn)throw new Error("Skill file exceeds size limit")}h=Buffer.concat(_,$)}let v=await f.stat();if(v.size>jn||v.dev!==l.dev||v.ino!==l.ino||v.size!==l.size||v.mtimeMs!==l.mtimeMs)throw new Error("File changed while reading");return{content:h.toString("utf-8"),realFilePath:a,stat:v}}finally{await f.close()}}async readSkillContent(t,r=!1){let n=ke.isAbsolute(t)?ke.resolve(t):ke.resolve(this.skillsPath,t);if(!r){let i=await this.tryReadFromContentCache(n);if(i!==void 0)return i}try{let{content:i,realFilePath:o,stat:a}=await this.readFileNoFollow(n,this.skillsPath),{body:s}=this.parseFrontmatter(i);return this.contentCache.set(o,s),this.contentCacheStat.set(o,{dev:a.dev,ino:a.ino,size:a.size,mtimeMs:a.mtimeMs}),this.canonicalPathMap.set(n,o),this.canonicalPathMap.set(o,o),s}catch(i){throw new Error(`Failed to read skill content: ${i instanceof Error?i.message:String(i)}`)}}async tryReadFromContentCache(t){let r=this.canonicalPathMap.get(t);if(!r)return;let n=this.contentCache.get(r),i=this.contentCacheStat.get(r);if(!(n===void 0||!i))try{let o=await Se.stat(t);if(o.isFile()&&o.dev===i.dev&&o.ino===i.ino&&o.size===i.size&&o.mtimeMs===i.mtimeMs)return n}catch{}}clearCache(){this.scanEpoch++,this.cachedSkills=null,this.loadingPromise=null,this.loadingEpoch=-1,this.skillMap.clear(),this.contentCache.clear(),this.contentCacheStat.clear(),this.canonicalPathMap.clear(),this.skillSignature=null,this.lastSuccessfulScanAt=0}};var C=it(require("fs")),w=it(require("path")),Nr=it(require("os")),v$=it(require("crypto")),yo={lmstudio:{name:"LM Studio",aliases:["lmstudio","lm-studio"],getConfigPath:(e,t)=>w.join(t,".lmstudio","mcp.json"),type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},roo:{name:"Roo Code (VS Code Desktop)",aliases:["roo","roo-code","roocode"],getConfigPath:(e,t,r)=>{let n=e==="win32"?r||w.join(t,"AppData","Roaming"):e==="darwin"?w.join(t,"Library","Application Support"):w.join(t,".config");return w.join(n,"Code","User","globalStorage","rooveterinaryinc.roo-cline","settings","mcp_settings.json")},type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},copilot:{name:"GitHub Copilot (VS Code)",aliases:["vscode","code","copilot"],getConfigPath:(e,t,r,n)=>e==="win32"?w.join(r||w.join(t,"AppData","Roaming"),"Code","User","mcp.json"):e==="darwin"?w.join(t,"Library","Application Support","Code","User","mcp.json"):w.join(t,".config","Code","User","mcp.json"),type:"json-servers",defaultConfig:(e,t)=>({command:e,args:t,type:"stdio"})},"copilot-insiders":{name:"GitHub Copilot (VS Code Insiders)",aliases:["vscode-insiders","code-insiders","insiders","insider","vscode-insider","code-insider","copilot-insider"],getConfigPath:(e,t,r,n)=>e==="win32"?w.join(r||w.join(t,"AppData","Roaming"),"Code - Insiders","User","mcp.json"):e==="darwin"?w.join(t,"Library","Application Support","Code - Insiders","User","mcp.json"):w.join(t,".config","Code - Insiders","User","mcp.json"),type:"json-servers",defaultConfig:(e,t)=>({command:e,args:t,type:"stdio"})},cursor:{name:"Cursor",aliases:["cursor"],getConfigPath:(e,t)=>w.join(t,".cursor","mcp.json"),type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},hermes:{name:"Hermes Desktop / Agent",aliases:["hermes","hermes-desktop"],getConfigPath:(e,t,r,n)=>{if(e==="win32"){let i=n||w.join(t,"AppData","Local");return w.join(i,"hermes","config.yaml")}return w.join(t,".hermes","config.yaml")},type:"yaml",defaultConfig:(e,t)=>({command:e,args:t})},kimi:{name:"Kimi Work / Kimi Code",aliases:["kimi","kimi-work","kimi-code"],getConfigPath:(e,t)=>w.join(t,".kimi-code","mcp.json"),type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},claude:{name:"Claude Desktop",aliases:["claude","claude-desktop"],getConfigPath:(e,t,r)=>e==="win32"?w.join(r||w.join(t,"AppData","Roaming"),"Claude","claude_desktop_config.json"):e==="darwin"?w.join(t,"Library","Application Support","Claude","claude_desktop_config.json"):w.join(t,".config","Claude","claude_desktop_config.json"),type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},devin:{name:"Devin Desktop (formerly Windsurf)",aliases:["devin","devin-desktop","windsurf","codeium"],getConfigPath:(e,t,r)=>{let n=e==="win32"&&r?r:w.join(t,".config"),i=w.join(n,"devin","mcp_config.json");return C.existsSync(i)?i:w.join(t,".codeium","windsurf","mcp_config.json")},type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},antigravity:{name:"Antigravity (Google DeepMind)",aliases:["antigravity","agy","gemini"],getConfigPath:(e,t)=>w.join(t,".gemini","config","mcp_config.json"),type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},"pi-desktop":{name:"Pi Desktop / Pi Agent",aliases:["pi-desktop","pi","pi-agent"],getConfigPath:(e,t,r)=>{if(e==="win32"){let o=w.join(r||w.join(t,"AppData","Roaming"),".pi","agent","mcp.json");if(C.existsSync(o))return o;let a=w.join(t,".pi","agent","mcp.json");if(C.existsSync(a))return a;let s=w.join(t,".pi","mcp.json");return C.existsSync(s)?s:a}let n=w.join(t,".pi","agent","mcp.json");if(C.existsSync(n))return n;let i=w.join(t,".pi","mcp.json");return C.existsSync(i)?i:n},type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},qwenpaw:{name:"QwenPaw (Personal Agent Workstation)",aliases:["qwenpaw","qwen-paw","copaw"],getConfigPath:(e,t)=>{let r=w.join(t,".qwenpaw","config.json");if(C.existsSync(r))return r;let n=w.join(t,".copaw","config.json");return C.existsSync(n)?n:r},type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},cline:{name:"Cline (VS Code / CLI)",aliases:["cline","claude-dev"],getConfigPath:(e,t,r)=>{let n="";if(e==="win32"?n=w.join(r||w.join(t,"AppData","Roaming"),"Code","User","globalStorage","saoudrizwan.claude-dev","settings","cline_mcp_settings.json"):e==="darwin"?n=w.join(t,"Library","Application Support","Code","User","globalStorage","saoudrizwan.claude-dev","settings","cline_mcp_settings.json"):n=w.join(t,".config","Code","User","globalStorage","saoudrizwan.claude-dev","settings","cline_mcp_settings.json"),C.existsSync(n))return n;let i=w.join(t,".cline","data","settings","cline_mcp_settings.json");return C.existsSync(i)?i:n},type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},kilo:{name:"Kilo Code",aliases:["kilo","kilocode","kilo-code"],getConfigPath:(e,t)=>{let r=w.join(t,".config","kilo","kilo.jsonc");if(C.existsSync(r))return r;let n=w.join(t,".config","kilo","kilo.json");return C.existsSync(n)?n:r},type:"json-mcp",defaultConfig:(e,t)=>({type:"local",command:[e,...t],enabled:!0})},qoder:{name:"Qoder",aliases:["qoder"],getConfigPath:(e,t)=>w.join(t,".qoder","settings.json"),type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},kiro:{name:"Kiro",aliases:["kiro","kiro-code"],getConfigPath:(e,t)=>w.join(t,".kiro","settings","mcp.json"),type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},trae:{name:"Trae",aliases:["trae"],getConfigPath:(e,t,r)=>{if(e==="win32"){let n=w.join(r||w.join(t,"AppData","Roaming"),"Trae","User","mcp.json");if(C.existsSync(n))return n;let i=w.join(r||w.join(t,"AppData","Roaming"),"Trae CN","User","mcp.json");return C.existsSync(i)?i:n}else if(e==="darwin"){let n=w.join(t,"Library","Application Support","Trae","User","mcp.json");if(C.existsSync(n))return n;let i=w.join(t,"Library","Application Support","Trae CN","User","mcp.json");return C.existsSync(i)?i:n}else{let n=w.join(t,".config","Trae","User","mcp.json");if(C.existsSync(n))return n;let i=w.join(t,".config","Trae CN","User","mcp.json");return C.existsSync(i)?i:n}},type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})}},JE=["mcpServers","servers","mcp"];function _o(e){return Object.prototype.toString.call(e)==="[object Object]"}function KE(e,t=!1){if(!e)return"";if(!t)try{return JSON.parse(e),e}catch{}let r=e.length,n=[],i=!1,o=!1,a=!1,s=!1,c=-1;for(let u=0;u<r;u++){let l=e[u],d=u+1<r?e[u+1]:"";if(a){(l===`
53
+ `||l==="\r")&&(a=!1,n.push(l));continue}if(s){l==="*"&&d==="/"&&(s=!1,u++);continue}if(i){n.push(l),o?o=!1:l==="\\"?o=!0:l==='"'&&(i=!1);continue}if(l==='"'){i=!0,o=!1,c=-1,n.push(l);continue}if(l==="/"&&d==="/"){a=!0,u++;continue}if(l==="/"&&d==="*"){s=!0,u++;continue}if(l===","){c=n.length,n.push(l);continue}if(l==="}"||l==="]"){c!==-1&&(n[c]=" ",c=-1),n.push(l);continue}l!==" "&&l!==" "&&l!==`
54
+ `&&l!=="\r"&&(c=-1),n.push(l)}return n.join("")}var g$=/\s/;function BE(e){for(let t=1;t<e.length;t++){if(e[t]!=="#"||!g$.test(e[t-1]))continue;let r=t-1;for(;r>0&&g$.test(e[r-1]);)r--;return e.slice(r)}return""}function HE(e,t,r,n=!1){let i=e?e.split(/\r?\n/):[],o=i.map((p,m)=>{let h=p.match(/^(\s*)mcp_servers:/);return h?{index:m,indent:h[1],tail:p.slice(h[0].length).trim()}:null}).filter(p=>p!==null),a=o.filter(p=>p.indent==="");if(a.length>1)throw new Error("Cannot safely update YAML with duplicate mcp_servers keys");if(a.length===1){let p=a[0];if(p.tail!==""&&!p.tail.startsWith("#"))throw new Error("Cannot safely update YAML unless mcp_servers is a root-level block mapping")}else if(o.length>0)throw new Error("Cannot safely update YAML unless mcp_servers is a root-level block mapping");let s=" ";if(a.length===1)for(let p=a[0].index+1;p<i.length;p++){if(i[p].trim()===""||i[p].trimStart().startsWith("#"))continue;if(/^[^\s]/.test(i[p]))break;let m=i[p].match(/^(\s+)\S/);m&&(s=m[1]);break}if(n){let p=[],m=!1,h=0,v=!1,_=0;for(let b=0;b<i.length;b++){let $=i[b],S=$.match(/^(\s*)mcp_servers:\s*(?:#.*)?$/);if(S){m=!0,h=S[1].length,p.push($);continue}if(m){let P=$.match(/^(\s*)/)?.[1].length||0;if($.trimStart().startsWith("#")){p.push($);continue}if($.trim()!==""&&P<=h)m=!1,v=!1;else{let $e=$.match(/^(\s*)superpowers:\s*(?:#.*)?$/);if($e&&$e[1]===s){v=!0,_=$e[1].length;continue}if(v){if(P>_||$.trim()==="")continue;v=!1}}}p.push($)}return p.join(`
55
+ `)}let c=JSON.stringify(t),u=JSON.stringify(r),l=[`${s}superpowers:`,`${s}${s}command: ${c}`,`${s}${s}args: ${u}`];if(!e||e.trim()==="")return`mcp_servers:
56
+ ${l.join(`
57
57
  `)}
58
- `;let l=i.length===1?i[0].index:-1;if(l===-1)return`${e.trimEnd()}
58
+ `;let d=a.length===1?a[0].index:-1;if(d===-1)return`${e.trimEnd()}
59
59
 
60
60
  mcp_servers:
61
- ${u.join(`
61
+ ${l.join(`
62
62
  `)}
63
- `;let d=-1;for(let p=l+1;p<o.length;p++){let f=o[p];if(/^[^\s#]/.test(f))break;if((f.match(/^(\s*)/)?.[1]||"")===a&&/^\s+["']?superpowers["']?\s*:\s*(?:#.*)?$/.test(f)){d=p;break}}if(d!==-1){let p=o[d].match(/^(\s*)/)?.[1].length||2,f=d+1;for(;f<o.length;){let v=o[f];if((v.match(/^(\s*)/)?.[1].length||0)>p||v.trim()==="")f++;else break}let m=[],h=-1;for(let v=d+1;v<f;v++){let _=o[v];if(_.trim()==="")continue;let $=_.match(/^(\s*)/)?.[1].length??0;if(!(h!==-1&&$>h)){if(h=-1,$>p&&/^\s*["']?(?:command|args)["']?\s*:/.test(_)){h=$;continue}m.push(_)}}return u[0]+=KE(o[d]),o.splice(d,f-d,...u,...m),o.join(`
64
- `)}else return o.splice(l+1,0,...u),o.join(`
65
- `)}function BE(e,t,r,n,o=!1,i){let a={};if(e&&e.trim()!=="")try{let l=JSON.parse(e);if(!_i(l))throw new Error("Existing JSON root must be an object");a=l}catch{try{let d=JE(e,!0),p=JSON.parse(d);if(!_i(p))throw new Error("Existing JSON root must be an object");a=p}catch(d){let p=d instanceof Error?d.message:String(d);throw new Error(`Failed to parse existing JSON: ${p}`)}}let s=t==="json-servers"?"servers":t==="json-mcp"?"mcp":"mcpServers",c=VE.find(l=>_i(a[l])&&a[l].superpowers!==void 0)??s;if(a[c]!==void 0&&!_i(a[c]))throw new Error(`Existing JSON field "${c}" must be an object`);a[c]===void 0&&(a[c]={});let u=a[c];if(o)delete u.superpowers;else{let l;i?l={...i}:t==="json-servers"?l={command:r,args:n,type:"stdio"}:t==="json-mcp"?l={type:"local",command:[r,...n],enabled:!0}:l={command:r,args:n};let d=u.superpowers;if(!_i(d))u.superpowers=l;else{let p={...d,...l};(d.enabled!==void 0||d.disabled!==void 0)&&(d.enabled!==void 0?p.enabled=d.enabled:delete p.enabled),t==="json-mcp"&&Array.isArray(p.command)&&delete p.args,u.superpowers=p}}return JSON.stringify(a,null,2)+`
66
- `}function WE(e,t,r=!1,n=[],o){if(n.length===0)throw new Error("safeWriteConfig requires at least one allowed destination root");let i=e;try{let $=U.lstatSync(e,{throwIfNoEntry:!1});if($&&$.isSymbolicLink()){try{i=U.realpathSync(e)}catch{let jn=U.readlinkSync(e);i=w.resolve(w.dirname(e),jn)}let b=w.normalize(w.resolve(i)).toLowerCase(),S=w.normalize(w.resolve(Nr.tmpdir())).toLowerCase();if(!(b===S||b.startsWith(S+w.sep))&&(["/etc","/bin","/sbin","/usr","/root","/sys","/proc","/dev","/private/etc","c:\\windows"].some(Oe=>b===Oe||b.startsWith(Oe+w.sep))||b==="/var"||b.startsWith("/var"+w.sep)&&!b.startsWith("/var/folders"+w.sep)||b==="/private/var"||b.startsWith("/private/var"+w.sep)&&!b.startsWith("/private/var/folders"+w.sep)))throw new Error(`Refusing to write to unsafe symlink target: ${i}`)}}catch($){if($ instanceof Error&&$.message.includes("Refusing to write to unsafe symlink target"))throw $}let a=w.dirname(i);U.existsSync(a)||U.mkdirSync(a,{recursive:!0,mode:448});let s=U.realpathSync(a),c=U.statSync(s);i=w.join(s,w.basename(i));let u=w.normalize(w.resolve(i)).toLowerCase(),l=w.normalize(w.resolve(Nr.tmpdir())).toLowerCase(),d=u===l||u.startsWith(l+w.sep),f=["/etc","/bin","/sbin","/usr","/root","/sys","/proc","/dev","/private/etc","c:\\windows"].some($=>u===$||u.startsWith($+w.sep))||u==="/var"||u.startsWith("/var"+w.sep)&&!u.startsWith("/var/folders"+w.sep)||u==="/private/var"||u.startsWith("/private/var"+w.sep)&&!u.startsWith("/private/var/folders"+w.sep);if(!d&&f)throw new Error(`Refusing to write to unsafe configuration target: ${i}`);if(!n.some($=>{if(!$)return!1;let b=w.resolve($);try{b=U.realpathSync(b)}catch{}let S=w.relative(b,i);return S!==".."&&!S.startsWith(`..${w.sep}`)&&!w.isAbsolute(S)}))throw new Error(`Refusing to write configuration outside allowed roots: ${i}`);let h=384;if(U.existsSync(i)){try{h=U.statSync(i).mode}catch{}if(r){let $=U.readFileSync(i,"utf8"),b=`${i}.${Date.now()}.bak`;try{U.writeFileSync(b,$,{encoding:"utf8",mode:h})}catch(S){let P=S instanceof Error?S.message:String(S);throw new Error(`Failed to create safe backup before write: ${P}`)}}}let v=g$.randomBytes(8).toString("hex"),_=w.join(s,`.tmp.${w.basename(i)}.${process.pid}.${v}`);try{U.writeFileSync(_,t,{encoding:"utf8",mode:h,flag:"wx"});let $=U.existsSync(i);if(o===null&&$)throw new Error("Configuration changed concurrently before it could be created");if(o!=null&&(!$||U.readFileSync(i,"utf8")!==o))throw new Error("Configuration changed concurrently; refusing to overwrite newer content");let b=U.realpathSync(a),S=U.statSync(b);if(b!==s||S.dev!==c.dev||S.ino!==c.ino)throw new Error("Configuration directory changed while writing");U.renameSync(_,i)}catch($){try{U.existsSync(_)&&U.unlinkSync(_)}catch{}throw $}}async function GE(e={}){let t=e.platform||Nr.platform(),r=e.homeDir||Nr.homedir(),n=e.appData||process.env.APPDATA,o=e.localAppData||process.env.LOCALAPPDATA,i=!!e.dryRun,a=!!e.remove,s=!!e.bun,c=e.target?e.target.toLowerCase():null,u=s?"bunx":"npx",l=["-y","superpowers-mcp"],d=[];if(!c)throw new Error(`No target client specified. Please specify which client to configure using --target <${Object.keys(yi).join("|")}>.`);let p=Object.keys(yi).find(m=>m===c||yi[m].aliases.includes(c));if(!p)throw new Error(`Unknown harness target: "${c}". Supported targets: ${Object.keys(yi).join(", ")}`);let f=[p];for(let m of f){let h=yi[m],v=h.getConfigPath(t,r,n,o),_=U.existsSync(v);if(a&&!_){d.push({target:m,name:h.name,path:v,status:"up-to-date",message:"Already not configured (file does not exist)"});continue}try{let $="";_&&($=U.readFileSync(v,"utf8"));let b="";if(h.type==="yaml")b=HE($,u,l,a);else{let S=typeof h.defaultConfig=="function"?h.defaultConfig(u,l):void 0;b=BE($,h.type,u,l,a,S)}if($.trim()===b.trim()&&_){d.push({target:m,name:h.name,path:v,status:"up-to-date",message:a?"Already not configured":"Already configured and up-to-date"});continue}i||WE(v,b,!!e.backup,[r,n||"",o||""],_?$:null),d.push({target:m,name:h.name,path:v,status:a?"removed":_?"updated":"created",message:i?`[Dry Run] Would ${a?"remove from":_?"update":"create"} ${v}`:`Successfully ${a?"removed from":_?"updated":"configured"}!`})}catch($){let b=$ instanceof Error?$.message:String($);d.push({target:m,name:h.name,path:v,status:"error",message:b})}}return d}async function v$(e=process.argv.slice(2)){let t=!1,r={dryRun:!1,remove:!1,bun:!1,backup:!1,target:null};for(let n=0;n<e.length;n++){let o=e[n];if(!(o==="setup"||o==="install"||o==="--setup"))if(o==="--print-config")t=!0;else if(o==="--dry-run")r.dryRun=!0;else if(o==="--remove"||o==="--uninstall")r.remove=!0;else if(o==="--bun")r.bun=!0;else if(o==="--backup")r.backup=!0;else if(o==="--target"||o==="-t"){let i=e[n+1];if(!i||i.startsWith("-")){console.error(`\u274C Error: Missing value for --target flag.
67
- `),process.exitCode=1;return}r.target=e[++n]}else if(o.startsWith("--target=")){let i=o.split("=")[1];if(!i){console.error(`\u274C Error: Missing value for --target flag.
68
- `),process.exitCode=1;return}r.target=i}else if(o==="--help"||o==="-h"){XE();return}else if(o.startsWith("-")){console.error(`\u274C Error: Unknown option "${o}". Use --help for usage.
69
- `),process.exitCode=1;return}else if(!r.target)r.target=o;else{console.error(`\u274C Error: Unexpected argument "${o}". Use --help for usage.
63
+ `;let f=-1;for(let p=d+1;p<i.length;p++){let m=i[p];if(/^[^\s#]/.test(m))break;if((m.match(/^(\s*)/)?.[1]||"")===s&&/^\s+["']?superpowers["']?\s*:\s*(?:#.*)?$/.test(m)){f=p;break}}if(f!==-1){let p=i[f].match(/^(\s*)/)?.[1].length||2,m=f+1;for(;m<i.length;){let _=i[m];if((_.match(/^(\s*)/)?.[1].length||0)>p||_.trim()==="")m++;else break}let h=[],v=-1;for(let _=f+1;_<m;_++){let b=i[_];if(b.trim()==="")continue;let $=b.match(/^(\s*)/)?.[1].length??0;if(!(v!==-1&&$>v)){if(v=-1,$>p&&/^\s*["']?(?:command|args)["']?\s*:/.test(b)){v=$;continue}h.push(b)}}return l[0]+=BE(i[f]),i.splice(f,m-f,...l,...h),i.join(`
64
+ `)}else return i.splice(d+1,0,...l),i.join(`
65
+ `)}function WE(e,t,r,n,i=!1,o){let a={},s=!1;if(e&&e.trim()!=="")try{let f=JSON.parse(e);if(!_o(f))throw new Error("Existing JSON root must be an object");a=f}catch(f){try{let p=KE(e,!0),m=JSON.parse(p);if(!_o(m))throw new Error("Existing JSON root must be an object");a=m,s=p!==e}catch(p){let m=p instanceof Error?p.message:String(p),h=f instanceof Error?f.message:String(f);throw new Error(`Failed to parse existing JSON: ${m} (raw JSON error: ${h})`)}}let c=t==="json-servers"?"servers":t==="json-mcp"?"mcp":"mcpServers",u=JE.find(f=>_o(a[f])&&a[f].superpowers!==void 0)??c;if(a[u]!==void 0&&!_o(a[u]))throw new Error(`Existing JSON field "${u}" must be an object`);a[u]===void 0&&(a[u]={});let l=a[u];if(i)delete l.superpowers;else{let f;o?f={...o}:t==="json-servers"?f={command:r,args:n,type:"stdio"}:t==="json-mcp"?f={type:"local",command:[r,...n],enabled:!0}:f={command:r,args:n};let p=l.superpowers;if(!_o(p))l.superpowers=f;else{let m={...p,...f};(p.enabled!==void 0||p.disabled!==void 0)&&(p.enabled!==void 0?m.enabled=p.enabled:delete m.enabled),t==="json-mcp"&&Array.isArray(m.command)&&delete m.args,l.superpowers=m}}let d=JSON.stringify(a,null,2)+`
66
+ `;return s&&d!==e&&process.stderr.write(`[superpowers-mcp] Warning: JSONC comments/trailing commas in the existing config were removed while updating it (the file is rewritten as plain JSON).
67
+ `),d}function GE(e,t=10){try{let r=w.dirname(e),n=`${w.basename(e)}.`,i=".bak",o=C.readdirSync(r).filter(a=>{if(!a.startsWith(n)||!a.endsWith(i))return!1;let s=a.slice(n.length,a.length-i.length);return/^\d+$/.test(s)}).map(a=>{let s=w.join(r,a);try{return{full:s,mtimeMs:C.statSync(s).mtimeMs}}catch{return{full:s,mtimeMs:0}}}).sort((a,s)=>s.mtimeMs-a.mtimeMs);for(let a of o.slice(t))try{C.unlinkSync(a.full)}catch{}}catch{}}function XE(e,t,r=!1,n=[],i){if(n.length===0)throw new Error("safeWriteConfig requires at least one allowed destination root");let o=e;try{let b=C.lstatSync(e,{throwIfNoEntry:!1});if(b&&b.isSymbolicLink()){try{o=C.realpathSync(e)}catch{let Zr=C.readlinkSync(e);o=w.resolve(w.dirname(e),Zr)}let $=w.normalize(w.resolve(o)).toLowerCase(),S=w.normalize(w.resolve(Nr.tmpdir())).toLowerCase();if(!($===S||$.startsWith(S+w.sep))&&(["/etc","/bin","/sbin","/usr","/root","/sys","/proc","/dev","/private/etc","c:\\windows"].some(be=>$===be||$.startsWith(be+w.sep))||$==="/var"||$.startsWith("/var"+w.sep)&&!$.startsWith("/var/folders"+w.sep)||$==="/private/var"||$.startsWith("/private/var"+w.sep)&&!$.startsWith("/private/var/folders"+w.sep)))throw new Error(`Refusing to write to unsafe symlink target: ${o}`)}}catch(b){if(b instanceof Error&&b.message.includes("Refusing to write to unsafe symlink target"))throw b}let a=w.dirname(o);C.existsSync(a)||C.mkdirSync(a,{recursive:!0,mode:448});let s=C.realpathSync(a),c=C.statSync(s);o=w.join(s,w.basename(o));let u=w.normalize(w.resolve(o)).toLowerCase(),l=w.normalize(w.resolve(Nr.tmpdir())).toLowerCase(),d=u===l||u.startsWith(l+w.sep),p=["/etc","/bin","/sbin","/usr","/root","/sys","/proc","/dev","/private/etc","c:\\windows"].some(b=>u===b||u.startsWith(b+w.sep))||u==="/var"||u.startsWith("/var"+w.sep)&&!u.startsWith("/var/folders"+w.sep)||u==="/private/var"||u.startsWith("/private/var"+w.sep)&&!u.startsWith("/private/var/folders"+w.sep);if(!d&&p)throw new Error(`Refusing to write to unsafe configuration target: ${o}`);if(!n.some(b=>{if(!b)return!1;let $=w.resolve(b);try{$=C.realpathSync($)}catch{}let S=w.relative($,o);return S!==".."&&!S.startsWith(`..${w.sep}`)&&!w.isAbsolute(S)}))throw new Error(`Refusing to write configuration outside allowed roots: ${o}`);let h=384;if(C.existsSync(o)){try{h=C.statSync(o).mode}catch{}if(r){let b=C.readFileSync(o,"utf8"),$=`${o}.${Date.now()}.bak`;try{C.writeFileSync($,b,{encoding:"utf8",mode:h})}catch(S){let P=S instanceof Error?S.message:String(S);throw new Error(`Failed to create safe backup before write: ${P}`)}GE(o)}}let v=v$.randomBytes(8).toString("hex"),_=w.join(s,`.tmp.${w.basename(o)}.${process.pid}.${v}`);try{C.writeFileSync(_,t,{encoding:"utf8",mode:h,flag:"wx"});let b=C.existsSync(o);if(i===null&&b)throw new Error("Configuration changed concurrently before it could be created");if(i!=null&&(!b||C.readFileSync(o,"utf8")!==i))throw new Error("Configuration changed concurrently; refusing to overwrite newer content");let $=C.realpathSync(a),S=C.statSync($);if($!==s||S.dev!==c.dev||S.ino!==c.ino)throw new Error("Configuration directory changed while writing");C.renameSync(_,o)}catch(b){try{C.existsSync(_)&&C.unlinkSync(_)}catch{}throw b}}async function YE(e={}){let t=e.platform||Nr.platform(),r=e.homeDir||Nr.homedir(),n=e.appData||process.env.APPDATA,i=e.localAppData||process.env.LOCALAPPDATA,o=!!e.dryRun,a=!!e.remove,s=!!e.bun,c=e.target?e.target.toLowerCase():null,u=s?"bunx":"npx",l=["-y","superpowers-mcp"],d=[];if(!c)throw new Error(`No target client specified. Please specify which client to configure using --target <${Object.keys(yo).join("|")}>.`);let f=Object.keys(yo).find(m=>m===c||yo[m].aliases.includes(c));if(!f)throw new Error(`Unknown harness target: "${c}". Supported targets: ${Object.keys(yo).join(", ")}`);let p=[f];for(let m of p){let h=yo[m],v=h.getConfigPath(t,r,n,i),_=C.existsSync(v);if(a&&!_){d.push({target:m,name:h.name,path:v,status:"up-to-date",message:"Already not configured (file does not exist)"});continue}try{let b="";_&&(b=C.readFileSync(v,"utf8"));let $="";if(h.type==="yaml")$=HE(b,u,l,a);else{let S=typeof h.defaultConfig=="function"?h.defaultConfig(u,l):void 0;$=WE(b,h.type,u,l,a,S)}if(b.trim()===$.trim()&&_){d.push({target:m,name:h.name,path:v,status:"up-to-date",message:a?"Already not configured":"Already configured and up-to-date"});continue}o||XE(v,$,!!e.backup,[r,n||"",i||""],_?b:null),d.push({target:m,name:h.name,path:v,status:a?"removed":_?"updated":"created",message:o?`[Dry Run] Would ${a?"remove from":_?"update":"create"} ${v}`:`Successfully ${a?"removed from":_?"updated":"configured"}!`})}catch(b){let $=b instanceof Error?b.message:String(b);d.push({target:m,name:h.name,path:v,status:"error",message:$})}}return d}async function y$(e=process.argv.slice(2)){let t=!1,r={dryRun:!1,remove:!1,bun:!1,backup:!1,target:null};for(let n=0;n<e.length;n++){let i=e[n];if(!(i==="setup"||i==="install"||i==="--setup"))if(i==="--print-config")t=!0;else if(i==="--dry-run")r.dryRun=!0;else if(i==="--remove"||i==="--uninstall")r.remove=!0;else if(i==="--bun")r.bun=!0;else if(i==="--backup")r.backup=!0;else if(i==="--target"||i==="-t"){let o=e[n+1];if(!o||o.startsWith("-")){console.error(`\u274C Error: Missing value for --target flag.
68
+ `),process.exitCode=1;return}r.target=e[++n]}else if(i.startsWith("--target=")){let o=i.split("=")[1];if(!o){console.error(`\u274C Error: Missing value for --target flag.
69
+ `),process.exitCode=1;return}r.target=o}else if(i==="--help"||i==="-h"){QE();return}else if(i.startsWith("-")){console.error(`\u274C Error: Unknown option "${i}". Use --help for usage.
70
+ `),process.exitCode=1;return}else if(!r.target)r.target=i;else{console.error(`\u274C Error: Unexpected argument "${i}". Use --help for usage.
70
71
  `),process.exitCode=1;return}}if(t){if(r.target||r.remove||r.backup||r.dryRun){console.error("--print-config supports only --bun; omit target and file-operation flags."),process.exitCode=1;return}console.log(JSON.stringify({mcpServers:{superpowers:{command:r.bun?"bunx":"npx",args:["-y","superpowers-mcp"]}}},null,2));return}if(console.log(`
71
72
  ========================================================`),console.log("\u26A1 Superpowers MCP - Targeted Client Setup"),console.log(`========================================================
72
73
  `),!r.target){console.log(`Please select which AI Agent client you would like to configure:
73
74
  `),console.log(" npx -y superpowers-mcp setup --target lmstudio # LM Studio (~/.lmstudio/mcp.json)"),console.log(" npx -y superpowers-mcp setup --target roo # Roo Code in VS Code Desktop"),console.log(" npx -y superpowers-mcp setup --print-config # JSON for desktop app import"),console.log(" npx -y superpowers-mcp setup --target antigravity # Antigravity (~/.gemini/config/mcp_config.json)"),console.log(" npx -y superpowers-mcp setup --target pi-desktop # Pi Desktop / Pi Agent (~/.pi/agent/mcp.json)"),console.log(" npx -y superpowers-mcp setup --target cursor # Cursor (~/.cursor/mcp.json)"),console.log(" npx -y superpowers-mcp setup --target copilot # GitHub Copilot (VS Code mcp.json)"),console.log(" npx -y superpowers-mcp setup --target copilot-insiders # GitHub Copilot (VS Code Insiders mcp.json)"),console.log(" npx -y superpowers-mcp setup --target hermes # Hermes Desktop / Agent"),console.log(" npx -y superpowers-mcp setup --target kimi # Kimi Work / Kimi Code"),console.log(" npx -y superpowers-mcp setup --target claude # Claude Desktop"),console.log(" npx -y superpowers-mcp setup --target devin # Devin Desktop (formerly Windsurf)"),console.log(" npx -y superpowers-mcp setup --target qwenpaw # QwenPaw / CoPaw (~/.qwenpaw/config.json)"),console.log(" npx -y superpowers-mcp setup --target cline # Cline (~/.../cline_mcp_settings.json)"),console.log(" npx -y superpowers-mcp setup --target kilo # Kilo Code (~/.config/kilo/kilo.jsonc)"),console.log(" npx -y superpowers-mcp setup --target qoder # Qoder (~/.qoder/settings.json)"),console.log(" npx -y superpowers-mcp setup --target kiro # Kiro (~/.kiro/settings/mcp.json)"),console.log(` npx -y superpowers-mcp setup --target trae # Trae (~/.../Trae/User/mcp.json)
74
75
  `),console.log("\u{1F4A1} Tip:"),console.log(" You can run this setup command from ANY folder on your system."),console.log(` It automatically targets your global config files (~/...) without needing to clone this repo.
75
76
  `),console.log("\u{1F4A1} Privacy & Safety:"),console.log(" Superpowers MCP only configures the specific client you explicitly choose."),console.log(` It will NEVER silently scan or modify unselected environments.
76
- `),process.exitCode=1;return}try{let n=await GE(r),o=0,i=0,a=0;for(let s of n){let c=s.status==="created"||s.status==="updated"||s.status==="removed"?"\u2705":s.status==="up-to-date"?"\u2728":s.status==="skipped"?"\u23ED\uFE0F ":"\u274C";console.log(`${c} [${s.name}] (${s.status})`),console.log(` Path: ${s.path}`),console.log(` Info: ${s.message}
77
- `),s.status==="created"||s.status==="updated"||s.status==="up-to-date"||s.status==="removed"?o++:s.status==="skipped"?i++:s.status==="error"&&a++}if(console.log("--------------------------------------------------------"),a>0){console.error(`\u26A0\uFE0F Setup finished with errors: ${a} failure(s), ${o} succeeded.`),process.exitCode=1;return}console.log(`\u{1F389} Setup complete! ${o} environment(s) ready.`)}catch(n){let o=n instanceof Error?n.message:String(n);console.error(`\u274C Setup failed: ${o}
78
- `),process.exitCode=1}}function XE(){console.log(`
77
+ `),process.exitCode=1;return}try{let n=await YE(r),i=0,o=0,a=0;for(let s of n){let c=s.status==="created"||s.status==="updated"||s.status==="removed"?"\u2705":s.status==="up-to-date"?"\u2728":s.status==="skipped"?"\u23ED\uFE0F ":"\u274C";console.log(`${c} [${s.name}] (${s.status})`),console.log(` Path: ${s.path}`),console.log(` Info: ${s.message}
78
+ `),s.status==="created"||s.status==="updated"||s.status==="up-to-date"||s.status==="removed"?i++:s.status==="skipped"?o++:s.status==="error"&&a++}if(console.log("--------------------------------------------------------"),a>0){console.error(`\u26A0\uFE0F Setup finished with errors: ${a} failure(s), ${i} succeeded.`),process.exitCode=1;return}console.log(`\u{1F389} Setup complete! ${i} environment(s) ready.`)}catch(n){let i=n instanceof Error?n.message:String(n);console.error(`\u274C Setup failed: ${i}
79
+ `),process.exitCode=1}}function QE(){console.log(`
79
80
  Superpowers MCP - Targeted Global Setup
80
81
 
81
82
  Usage:
@@ -119,13 +120,13 @@ Any Directory:
119
120
  Privacy & Safety:
120
121
  Superpowers MCP only touches the client you explicitly choose.
121
122
  It never bulk-modifies your environment without your consent.
122
- `)}var Dr={promptName:"feature-pipeline",title:"Feature Development Pipeline",purpose:"Start an interactive feature workflow from requirements through branch finishing.",stages:[{title:"Requirements & Architecture Discovery",skills:[{name:"brainstorming"}],instructions:["Clarify user intent, requirements, constraints, and architecture decisions.","Produce a design specification document (for example, in `docs/superpowers/specs/`).","Stop at the skill's design-approval gate and wait for explicit user approval."]},{title:"Plan Construction",skills:[{name:"writing-plans"}],instructions:["Decompose the approved spec into bite-sized, independently testable tasks.","Specify recommended skills for each task and save the plan under `docs/superpowers/plans/`.","Stop at the plan-review gate and wait for explicit user approval before implementation."]},{title:"Workspace Isolation",skills:[{name:"using-git-worktrees"}],instructions:["Create or verify an isolated Git worktree before implementation."]},{title:"Execution & Implementation",skills:[{name:"subagent-driven-development",when:"when the host provides multi-agent tools"},{name:"executing-plans",when:"otherwise, as the inline fallback"},{name:"test-driven-development",when:"for implementation tasks"}],instructions:["Use Red -> Green -> Refactor for implementation work.","Run task-level verification and review as required by the selected execution skill.","Never claim that subagents were dispatched when the host does not provide multi-agent tools."]},{title:"Full Suite Verification",skills:[{name:"verification-before-completion"}],instructions:["Run the complete repository test suite, linter, and type checks; do not skip."]},{title:"Code Review",skills:[{name:"requesting-code-review"},{name:"receiving-code-review",when:"when findings are returned"}],instructions:["Generate a review package and resolve or explicitly rule on every finding."]},{title:"Branch Finishing & Cleanup",skills:[{name:"finishing-a-development-branch"}],instructions:["Present the skill's branch-finishing choices and wait for the user to select one.","Do not merge, push, create a PR, or delete a worktree without the authorization required by the skill."]}]},Rr={promptName:"structured-debug",title:"Structured Troubleshooting Pipeline",purpose:"Start an interactive root-cause debugging and regression-fix workflow.",stages:[{title:"Systematic Root Cause Analysis",skills:[{name:"systematic-debugging"}],instructions:["Gather exact error traces, logs, and state.","Decompose the failure into testable hypotheses before proposing fixes."]},{title:"Workspace Isolation",skills:[{name:"using-git-worktrees"}],instructions:["Create or verify an isolated worktree before changing code."]},{title:"Hypothesis Verification",skills:[{name:"dispatching-parallel-agents",when:"only when independent hypotheses and multi-agent tools are available"}],instructions:["Investigate independent hypotheses in parallel only when the host supports safe subagent dispatch.","Otherwise investigate hypotheses sequentially in the current agent; do not claim that subagents ran."]},{title:"Test-Driven Bugfix",skills:[{name:"test-driven-development"}],instructions:["Write a minimal failing reproduction test first, apply the smallest fix, and refactor only while green."]},{title:"Full Regression Verification",skills:[{name:"verification-before-completion"}],instructions:["Run the complete repository verification suite and report exact evidence."]},{title:"Review & Findings Resolution",skills:[{name:"requesting-code-review"},{name:"receiving-code-review",when:"when findings are returned"}],instructions:["Review the fix delta and resolve or explicitly rule on every finding."]},{title:"Branch Finishing & Cleanup",skills:[{name:"finishing-a-development-branch"}],instructions:["Present branch-finishing choices and perform only the option selected by the user."]}]};function y$(e){let t=e.when?` (${e.when})`:"";return[` - **Skill:** \`superpowers:${e.name}\`${t}`,` - **Load it with:** \`read_skill({"skill_name":"${e.name}"})\``].join(`
123
- `)}function _$(e,t){let r=t?`
123
+ `)}var Dr={promptName:"feature-pipeline",title:"Feature Development Pipeline",purpose:"Start an interactive feature workflow from requirements through branch finishing.",stages:[{title:"Requirements & Architecture Discovery",skills:[{name:"brainstorming"}],instructions:["Clarify user intent, requirements, constraints, and architecture decisions.","Produce a design specification document (for example, in `docs/superpowers/specs/`).","Stop at the skill's design-approval gate and wait for explicit user approval."]},{title:"Plan Construction",skills:[{name:"writing-plans"}],instructions:["Decompose the approved spec into bite-sized, independently testable tasks.","Specify recommended skills for each task and save the plan under `docs/superpowers/plans/`.","Stop at the plan-review gate and wait for explicit user approval before implementation."]},{title:"Workspace Isolation",skills:[{name:"using-git-worktrees"}],instructions:["Create or verify an isolated Git worktree before implementation."]},{title:"Execution & Implementation",skills:[{name:"subagent-driven-development",when:"when the host provides multi-agent tools"},{name:"executing-plans",when:"otherwise, as the inline fallback"},{name:"test-driven-development",when:"for implementation tasks"}],instructions:["Use Red -> Green -> Refactor for implementation work.","Run task-level verification and review as required by the selected execution skill.","Never claim that subagents were dispatched when the host does not provide multi-agent tools."]},{title:"Full Suite Verification",skills:[{name:"verification-before-completion"}],instructions:["Run the complete repository test suite, linter, and type checks; do not skip."]},{title:"Code Review",skills:[{name:"requesting-code-review"},{name:"receiving-code-review",when:"when findings are returned"}],instructions:["Generate a review package and resolve or explicitly rule on every finding."]},{title:"Branch Finishing & Cleanup",skills:[{name:"finishing-a-development-branch"}],instructions:["Present the skill's branch-finishing choices and wait for the user to select one.","Do not merge, push, create a PR, or delete a worktree without the authorization required by the skill."]}]},Rr={promptName:"structured-debug",title:"Structured Troubleshooting Pipeline",purpose:"Start an interactive root-cause debugging and regression-fix workflow.",stages:[{title:"Systematic Root Cause Analysis",skills:[{name:"systematic-debugging"}],instructions:["Gather exact error traces, logs, and state.","Decompose the failure into testable hypotheses before proposing fixes."]},{title:"Workspace Isolation",skills:[{name:"using-git-worktrees"}],instructions:["Create or verify an isolated worktree before changing code."]},{title:"Hypothesis Verification",skills:[{name:"dispatching-parallel-agents",when:"only when independent hypotheses and multi-agent tools are available"}],instructions:["Investigate independent hypotheses in parallel only when the host supports safe subagent dispatch.","Otherwise investigate hypotheses sequentially in the current agent; do not claim that subagents ran."]},{title:"Test-Driven Bugfix",skills:[{name:"test-driven-development"}],instructions:["Write a minimal failing reproduction test first, apply the smallest fix, and refactor only while green."]},{title:"Full Regression Verification",skills:[{name:"verification-before-completion"}],instructions:["Run the complete repository verification suite and report exact evidence."]},{title:"Review & Findings Resolution",skills:[{name:"requesting-code-review"},{name:"receiving-code-review",when:"when findings are returned"}],instructions:["Review the fix delta and resolve or explicitly rule on every finding."]},{title:"Branch Finishing & Cleanup",skills:[{name:"finishing-a-development-branch"}],instructions:["Present branch-finishing choices and perform only the option selected by the user."]}]};function _$(e){let t=e.when?` (${e.when})`:"";return[` - **Skill:** \`superpowers:${e.name}\`${t}`,` - **Load it with:** \`read_skill({"skill_name":"${e.name}"})\``].join(`
124
+ `)}function $$(e,t){let r=t?`
124
125
  ### Requirements / Context:
125
126
  ${t}
126
- `:"",n=Dr.stages.map((o,i)=>{let a=o.skills.map(y$).join(`
127
- `),s=o.instructions.map(c=>` - ${c}`).join(`
128
- `);return`${i+1}. **Stage ${i+1}: ${o.title}**
127
+ `:"",n=Dr.stages.map((i,o)=>{let a=i.skills.map(_$).join(`
128
+ `),s=i.instructions.map(c=>` - ${c}`).join(`
129
+ `);return`${o+1}. **Stage ${o+1}: ${i.title}**
129
130
  ${a}
130
131
  ${s}`}).join(`
131
132
 
@@ -139,15 +140,15 @@ For every stage, call \`read_skill\` with the exact bare skill name shown below
139
140
  ${r}
140
141
  ## Mandatory Execution Stages
141
142
 
142
- ${n}`}function $$(e,t){let r=e?`
143
+ ${n}`}function b$(e,t){let r=e?`
143
144
  ### Issue Description / Logs:
144
145
  ${e}
145
146
  `:"",n=t?`
146
147
  ### Failing Tests:
147
148
  ${t}
148
- `:"",o=Rr.stages.map((i,a)=>{let s=i.skills.map(y$).join(`
149
- `),c=i.instructions.map(u=>` - ${u}`).join(`
150
- `);return`${a+1}. **Stage ${a+1}: ${i.title}**
149
+ `:"",i=Rr.stages.map((o,a)=>{let s=o.skills.map(_$).join(`
150
+ `),c=o.instructions.map(u=>` - ${u}`).join(`
151
+ `);return`${a+1}. **Stage ${a+1}: ${o.title}**
151
152
  ${s}
152
153
  ${c}`}).join(`
153
154
 
@@ -159,11 +160,12 @@ For every applicable stage, call \`read_skill\` with the exact bare skill name s
159
160
  ${r}${n}
160
161
  ## Mandatory Troubleshooting Stages
161
162
 
162
- ${o}`}function YE(){let e=process.env.SKILLS_PATH;if(e){let r=we.resolve(e),n=r,o=!0;try{n=Cr.realpathSync(r)}catch{o=!1}let i=p=>process.platform==="darwin"||process.platform==="win32"?p.toLowerCase():p,a=i(we.normalize(n)),s=i(we.parse(n).root),c=["/etc","/var","/bin","/sbin","/usr","/root","/sys","/proc","/dev","/private/etc","/private/var","c:\\windows","c:\\program files","c:\\program files (x86)"],u=(()=>{try{return i(we.normalize(Cr.realpathSync(w$.tmpdir())))}catch{return null}})();if(!(u!==null&&(a===u||a.startsWith(u+we.sep)))&&(!o||a===s||c.some(p=>{let f=i(we.normalize(p));return a===f||a.startsWith(f+we.sep)})))process.stderr.write(`Warning: Potentially unsafe SKILLS_PATH: "${e}". Fallback to default.
163
- `);else return n}let t=we.join(__dirname,"..","skills");return Cr.existsSync(t)?t:we.join(__dirname,"skills")}var Af=YE(),Et=new Ns(Af),Uf="guide://superpowers/skill-compositions",QE=we.join(__dirname,"..","docs","skill-compositions.md");function S$(e){return e.trim().replace(/^superpowers:/i,"")}var eT="6.4.1",dr=new Es({name:"superpowers-mcp",version:eT},{capabilities:{resources:{subscribe:!1},prompts:{},tools:{}}});dr.setRequestHandler(_d,async()=>({resources:[...(await Et.listSkills()).map(t=>({uri:`skill://superpowers/${encodeURIComponent(t.name)}`,name:t.name,description:t.description,mimeType:"text/markdown"})),{uri:Uf,name:"Skill Compositions Guide",description:"Workflow selection, prerequisites, invocation, and lifecycle guidance for Superpowers pipelines.",mimeType:"text/markdown"}]}));dr.setRequestHandler(bd,async e=>{let t=e.params.uri;if(t===Uf)try{let i=await Cr.promises.readFile(QE,"utf8");return{contents:[{uri:t,mimeType:"text/markdown",text:i}]}}catch(i){let a=i instanceof Error?i.message:String(i);throw process.stderr.write(`[superpowers-mcp] Failed to read compositions guide: ${a}
164
- `),new R(q.InternalError,`Failed to read the skill compositions guide: ${a}`)}let r=t.match(/^skill:\/\/superpowers\/(.+)$/);if(!r)throw new R(q.InvalidRequest,`Invalid skill URI: ${t}`);let n;try{n=decodeURIComponent(r[1])}catch{throw new R(q.InvalidRequest,`Invalid skill URI: ${t}`)}let o=await Et.findSkill(S$(n));if(!o)throw new R(q.InvalidRequest,`Skill not found: ${n}`);try{let i=await Et.readSkillContent(o.skillPath);return{contents:[{uri:t,mimeType:"text/markdown",text:i}]}}catch(i){let a=i instanceof Error?i.message:String(i);throw process.stderr.write(`[superpowers-mcp] Failed to read resource "${t}": ${a}
165
- `),new R(q.InternalError,`Failed to read skill content for "${n}": ${a}`)}});function b$(e,t){return e.endsWith(t)?`${e.slice(0,-t.length)}-review.md`:""}function x$(e,t){if(!e||!t)return!1;let r=n=>{let o=we.resolve(n);return process.platform==="darwin"||process.platform==="win32"?o.toLowerCase():o};return r(e)===r(t)}function k$(e,t,r){if(e&&!x$(e,t)&&!x$(e,r))return e;let n=b$(t,"-report.md")||b$(r,"-brief.md");return n||(t?`${t.replace(/(\.[^./\\]*)?$/,"")}-review.md`:"")}var Ds=new Map;function tT(e){let t=Ds.get(e);if(t)return t;let r=new RegExp(e,"g");return Ds.size>=64&&Ds.clear(),Ds.set(e,r),r}function $i(e,t){let r=Object.keys(t).filter(i=>{let a=t[i];return a!==void 0&&a!==""});if(r.length===0)return e;let n=r.sort((i,a)=>a.length-i.length).map(i=>i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),o=tT(n);return o.lastIndex=0,e.replace(o,i=>{let a=t[i];return a!==void 0&&a!==""?String(a):i})}function bi(e,t){let r=new Set;for(let[n,o]of Object.entries(t))o!==void 0&&o!==""&&e.includes(n)&&r.add(String(o));return r}dr.setRequestHandler(xd,async()=>({prompts:[{name:"session-start",description:"Inject the Superpowers context into an AI agent session. Tells the agent it has superpowers and how to use the skill system."},{name:"sdd-implementer",description:"Subagent-Driven Development (SDD) Implementer Prompt. Directs a subagent to implement a specific task using TDD and self-verification.",arguments:[{name:"brief_file",description:"Path to the task brief file (scripts/task-brief PLAN N)",required:!1},{name:"task_name",description:"Name or description of the task to implement",required:!1},{name:"report_file",description:"Path where the implementer should write its detailed report",required:!1},{name:"work_dir",description:"Working directory path for implementation",required:!1},{name:"model",description:"Model tier/name selection for implementer",required:!1},{name:"plan_file",description:"Legacy alias: Path to the task brief or plan file",required:!1},{name:"task_description",description:"Legacy alias: Task description",required:!1}]},{name:"sdd-task-reviewer",description:"Subagent-Driven Development (SDD) Task Reviewer Prompt. Evaluates task implementation against specification and code quality.",arguments:[{name:"brief_file",description:"Path to the task brief file",required:!1},{name:"report_file",description:"Path to the implementer's report file",required:!1},{name:"diff_file",description:"Path to the review package diff file",required:!1},{name:"review_file",description:"Path the reviewer writes its full report to; defaults to the report or brief file's -review.md sibling",required:!1},{name:"base_sha",description:"Base commit SHA before this task",required:!1},{name:"head_sha",description:"Head commit SHA for this task",required:!1},{name:"global_constraints",description:"Binding global constraints copied verbatim from the plan or spec",required:!1},{name:"model",description:"Reviewer model selection",required:!1},{name:"task_description",description:"Legacy alias: Description of the task being reviewed",required:!1},{name:"review_target",description:"Legacy alias: Review target or diff path",required:!1}]},{name:"sdd-re-review",description:"SDD Scoped Re-Review Prompt. Reviews only fix-round deltas and previous feedback to prevent context bloat.",arguments:[{name:"brief_file",description:"Path to the task brief file",required:!1},{name:"report_file",description:"Path to the implementer's report file with fix notes",required:!1},{name:"diff_file",description:"Path to the scoped review package diff file over fix range",required:!1},{name:"review_file",description:"Path to the task's review file; this round's verdicts are appended to it",required:!1},{name:"fix_base_sha",description:"Alias: the head the previous review saw (same as base_sha for a fix round)",required:!1},{name:"previous_findings",description:"Previous reviewer findings that needed fixing",required:!1},{name:"base_sha",description:"Base commit SHA for the fix round",required:!1},{name:"head_sha",description:"Current head commit SHA",required:!1},{name:"model",description:"Re-reviewer model selection",required:!1},{name:"fix_summary",description:"Legacy alias: Summary of changes made to address previous findings",required:!1}]},{name:"spec-reviewer",description:"Spec Document Reviewer Prompt. Adversarially reviews a design specification across requirements, architecture, and edge cases.",arguments:[{name:"spec_file",description:"Path to the specification document to review (e.g., docs/superpowers/specs/...)",required:!1}]},{name:"plan-reviewer",description:"Plan Document Reviewer Prompt. Adversarially reviews an implementation plan for completeness, testability, and task contracts.",arguments:[{name:"plan_file",description:"Path to the implementation plan document to review",required:!1},{name:"spec_file",description:"Path to the reference specification document",required:!1}]},{name:Dr.promptName,description:Dr.purpose,arguments:[{name:"feature_name",description:"Name or title of the feature to develop",required:!0},{name:"requirements",description:"Initial feature requirements, constraints, or description",required:!1}]},{name:Rr.promptName,description:Rr.purpose,arguments:[{name:"issue_description",description:"Description of the bug, error logs, or symptoms",required:!1},{name:"failing_tests",description:"Names or paths of failing tests",required:!1}]},{name:"skill-composition",description:"Skill Composition & Workflow Guide Prompt. Recommends multi-skill compositions for feature development, debugging, refactoring, or legacy safety net.",arguments:[{name:"scenario",description:"Development scenario (feature, debug, refactor, legacy-safety)",required:!1}]}]}));dr.setRequestHandler(kd,async e=>{let t=e.params.name,r=e.params.arguments||{},n=32*1024,o=(a,s=n)=>{let c=Object.prototype.hasOwnProperty.call(r,a)?r[a]:void 0,u="";return typeof c=="string"?u=c.trim():c!=null&&(u=String(c).trim()),u.length>s?u.slice(0,s):u},i=async a=>{let s=we.join(Af,a);try{let c=await Et.readSkillContent(s);if(c.trim()==="")throw new Error("prompt template is empty");return c}catch(c){let u=c instanceof Error?c.message:String(c);throw process.stderr.write(`[superpowers-mcp] Failed to load prompt template "${a}": ${u}
166
- `),new R(q.InternalError,`Failed to load prompt template "${a}": ${u}. The Superpowers skills directory may be missing or incomplete.`)}};if(t==="session-start"){let a="";try{let c=await Et.findSkill("using-superpowers"),u=c?c.skillPath:we.join(Af,"using-superpowers","SKILL.md");a=await Et.readSkillContent(u)}catch{a=`# Superpowers
163
+ ${i}`}function eT(){let e=process.env.SKILLS_PATH;if(e){let r=ze.resolve(e),n=r,i=!0;try{n=Cr.realpathSync(r)}catch{i=!1}let o=f=>process.platform==="darwin"||process.platform==="win32"?f.toLowerCase():f,a=o(ze.normalize(n)),s=o(ze.parse(n).root),c=["/etc","/var","/bin","/sbin","/usr","/root","/sys","/proc","/dev","/private/etc","/private/var","c:\\windows","c:\\program files","c:\\program files (x86)"],u=(()=>{try{return o(ze.normalize(Cr.realpathSync(S$.tmpdir())))}catch{return null}})();if(!(u!==null&&(a===u||a.startsWith(u+ze.sep)))&&(!i||a===s||c.some(f=>{let p=o(ze.normalize(f));return a===p||a.startsWith(p+ze.sep)})))process.stderr.write(`Warning: Potentially unsafe SKILLS_PATH: "${e}". Fallback to default.
164
+ `);else return n}let t=ze.join(__dirname,"..","skills");return Cr.existsSync(t)?t:ze.join(__dirname,"skills")}var Uf=eT(),Vt=new Ns(Uf),Mf="guide://superpowers/skill-compositions",tT=ze.join(__dirname,"..","docs","skill-compositions.md"),Af=null;function z$(e){return e.trim().replace(/^superpowers:/i,"")}var rT="6.4.2",dr=new Es({name:"superpowers-mcp",version:rT},{capabilities:{resources:{subscribe:!1},prompts:{},tools:{}}});dr.setRequestHandler(_d,async()=>({resources:[...(await Vt.listSkills()).map(t=>({uri:`skill://superpowers/${encodeURIComponent(t.name)}`,name:t.name,description:t.description,mimeType:"text/markdown"})),{uri:Mf,name:"Skill Compositions Guide",description:"Workflow selection, prerequisites, invocation, and lifecycle guidance for Superpowers pipelines.",mimeType:"text/markdown"}]}));dr.setRequestHandler(bd,async e=>{let t=e.params.uri;if(t===Mf)try{return Af===null&&(Af=await Cr.promises.readFile(tT,"utf8")),{contents:[{uri:t,mimeType:"text/markdown",text:Af}]}}catch(o){let a=o instanceof Error?o.message:String(o);throw process.stderr.write(`[superpowers-mcp] Failed to read compositions guide: ${a}
165
+ `),new R(Z.InternalError,`Failed to read the skill compositions guide: ${a}`)}let r=t.match(/^skill:\/\/superpowers\/(.+)$/);if(!r)throw new R(Z.InvalidRequest,`Invalid skill URI: ${t}`);let n;try{n=decodeURIComponent(r[1])}catch{throw new R(Z.InvalidRequest,`Invalid skill URI: ${t}`)}if(!n||n.includes("/")||n.includes("\\")||n.includes("..")||n.includes("\0"))throw new R(Z.InvalidRequest,`Invalid skill URI: ${t}`);let i=await Vt.findSkill(z$(n));if(!i)throw new R(Z.InvalidRequest,`Skill not found: ${n}`);try{let o=await Vt.readSkillContent(i.skillPath);return{contents:[{uri:t,mimeType:"text/markdown",text:o}]}}catch(o){let a=o instanceof Error?o.message:String(o);throw process.stderr.write(`[superpowers-mcp] Failed to read resource "${t}": ${a}
166
+ `),new R(Z.InternalError,`Failed to read skill content for "${n}": ${a}`)}});function x$(e,t){return e.endsWith(t)?`${e.slice(0,-t.length)}-review.md`:""}function k$(e,t){if(!e||!t)return!1;let r=n=>{let i=ze.resolve(n);return process.platform==="darwin"||process.platform==="win32"?i.toLowerCase():i};return r(e)===r(t)}function w$(e,t,r){if(e&&!k$(e,t)&&!k$(e,r))return e;let n=x$(t,"-report.md")||x$(r,"-brief.md");if(n)return n;if(t){let i=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\")),o=t.slice(0,i+1),s=t.slice(i+1).replace(/\.[^./\\]*$/,"");return s===""?`${t}-review.md`:`${o}${s}-review.md`}return""}var Ds=new Map;function nT(e){let t=Ds.get(e);if(t)return t;let r=new RegExp(e,"g");return Ds.size>=64&&Ds.clear(),Ds.set(e,r),r}function $o(e,t){let r=Object.keys(t).filter(o=>{let a=t[o];return a!==void 0&&a!==""});if(r.length===0)return e;let n=r.sort((o,a)=>a.length-o.length).map(o=>o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),i=nT(n);return i.lastIndex=0,e.replace(i,o=>{let a=t[o];return a!==void 0&&a!==""?String(a):o})}function bo(e,t){let r=new Set;for(let[n,i]of Object.entries(t))i!==void 0&&i!==""&&e.includes(n)&&r.add(n);return r}dr.setRequestHandler(xd,async()=>({prompts:[{name:"session-start",description:"Inject the Superpowers context into an AI agent session. Tells the agent it has superpowers and how to use the skill system."},{name:"sdd-implementer",description:"Subagent-Driven Development (SDD) Implementer Prompt. Directs a subagent to implement a specific task using TDD and self-verification.",arguments:[{name:"brief_file",description:"Path to the task brief file (scripts/task-brief PLAN N)",required:!1},{name:"task_name",description:"Name or description of the task to implement",required:!1},{name:"report_file",description:"Path where the implementer should write its detailed report",required:!1},{name:"work_dir",description:"Working directory path for implementation",required:!1},{name:"model",description:"Model tier/name selection for implementer",required:!1},{name:"plan_file",description:"Legacy alias: Path to the task brief or plan file",required:!1},{name:"task_description",description:"Legacy alias: Task description",required:!1}]},{name:"sdd-task-reviewer",description:"Subagent-Driven Development (SDD) Task Reviewer Prompt. Evaluates task implementation against specification and code quality.",arguments:[{name:"brief_file",description:"Path to the task brief file",required:!1},{name:"report_file",description:"Path to the implementer's report file",required:!1},{name:"diff_file",description:"Path to the review package diff file",required:!1},{name:"review_file",description:"Path the reviewer writes its full report to; defaults to the report or brief file's -review.md sibling",required:!1},{name:"base_sha",description:"Base commit SHA before this task",required:!1},{name:"head_sha",description:"Head commit SHA for this task",required:!1},{name:"global_constraints",description:"Binding global constraints copied verbatim from the plan or spec",required:!1},{name:"model",description:"Reviewer model selection",required:!1},{name:"task_description",description:"Legacy alias: Description of the task being reviewed",required:!1},{name:"review_target",description:"Legacy alias: Review target or diff path",required:!1}]},{name:"sdd-re-review",description:"SDD Scoped Re-Review Prompt. Reviews only fix-round deltas and previous feedback to prevent context bloat.",arguments:[{name:"brief_file",description:"Path to the task brief file",required:!1},{name:"report_file",description:"Path to the implementer's report file with fix notes",required:!1},{name:"diff_file",description:"Path to the scoped review package diff file over fix range",required:!1},{name:"review_file",description:"Path to the task's review file; this round's verdicts are appended to it",required:!1},{name:"fix_base_sha",description:"Alias: the head the previous review saw (same as base_sha for a fix round)",required:!1},{name:"previous_findings",description:"Previous reviewer findings that needed fixing",required:!1},{name:"base_sha",description:"Base commit SHA for the fix round",required:!1},{name:"head_sha",description:"Current head commit SHA",required:!1},{name:"model",description:"Re-reviewer model selection",required:!1},{name:"fix_summary",description:"Legacy alias: Summary of changes made to address previous findings",required:!1}]},{name:"spec-reviewer",description:"Spec Document Reviewer Prompt. Adversarially reviews a design specification across requirements, architecture, and edge cases.",arguments:[{name:"spec_file",description:"Path to the specification document to review (e.g., docs/superpowers/specs/...)",required:!1}]},{name:"plan-reviewer",description:"Plan Document Reviewer Prompt. Adversarially reviews an implementation plan for completeness, testability, and task contracts.",arguments:[{name:"plan_file",description:"Path to the implementation plan document to review",required:!1},{name:"spec_file",description:"Path to the reference specification document",required:!1}]},{name:Dr.promptName,description:Dr.purpose,arguments:[{name:"feature_name",description:"Name or title of the feature to develop",required:!0},{name:"requirements",description:"Initial feature requirements, constraints, or description",required:!1}]},{name:Rr.promptName,description:Rr.purpose,arguments:[{name:"issue_description",description:"Description of the bug, error logs, or symptoms",required:!1},{name:"failing_tests",description:"Names or paths of failing tests",required:!1}]},{name:"skill-composition",description:"Skill Composition & Workflow Guide Prompt. Recommends multi-skill compositions for feature development, debugging, refactoring, or legacy safety net.",arguments:[{name:"scenario",description:"Development scenario (feature, debug, refactor, legacy-safety)",required:!1}]}]}));dr.setRequestHandler(kd,async e=>{let t=e.params.name,r=e.params.arguments||{},n=32*1024,i=(a,s=n)=>{let c=Object.prototype.hasOwnProperty.call(r,a)?r[a]:void 0;if(c==null)return"";if(typeof c!="string")throw new R(Z.InvalidParams,`Prompt argument "${a}" must be a string`);let u=c.trim();if(u.length>s)throw new R(Z.InvalidParams,`Prompt argument "${a}" exceeds the maximum length of ${s} characters`);return u},o=async a=>{let s=ze.join(Uf,a);try{let c=await Vt.readSkillContent(s);if(c.trim()==="")throw new Error("prompt template is empty");return c}catch(c){let u=c instanceof Error?c.message:String(c);throw process.stderr.write(`[superpowers-mcp] Failed to load prompt template "${a}": ${u}
167
+ `),new R(Z.InternalError,`Failed to load prompt template "${a}": ${u}. The Superpowers skills directory may be missing or incomplete.`)}};if(t==="session-start"){let a="";try{let c=await Vt.findSkill("using-superpowers"),u=c?c.skillPath:ze.join(Uf,"using-superpowers","SKILL.md");a=await Vt.readSkillContent(u)}catch(c){let u=c instanceof Error?c.message:String(c);process.stderr.write(`[superpowers-mcp] Failed to load using-superpowers skill, using fallback: ${u}
168
+ `),a=`# Superpowers
167
169
 
168
170
  You have superpowers. Use the read_skill and list_skills tools to discover and load skills.`}return{description:"Superpowers session start context \u2014 establishes how to find and use skills",messages:[{role:"user",content:{type:"text",text:`<EXTREMELY_IMPORTANT>
169
171
  You have superpowers.
@@ -171,37 +173,37 @@ You have superpowers.
171
173
  **Below is the full content of your 'superpowers:using-superpowers' skill - your introduction to using skills. For all other skills, use the read_skill tool:**
172
174
 
173
175
  ${a}
174
- </EXTREMELY_IMPORTANT>`}}]}}if(t==="sdd-implementer"){let a=await i("subagent-driven-development/implementer-prompt.md"),s=o("brief_file")||o("plan_file"),c=o("task_name")||o("task_description"),u=o("report_file"),l=o("work_dir"),d=o("model"),p=o("task_description"),f=o("plan_file"),m={"[BRIEF_FILE]":s,"[task name]":c,"[REPORT_FILE]":u,"[directory]":l,"[MODEL]":d},h=$i(a,m),v=bi(a,m),_=[p&&!v.has(p)?`
176
+ </EXTREMELY_IMPORTANT>`}}]}}if(t==="sdd-implementer"){let a=await o("subagent-driven-development/implementer-prompt.md"),s=i("brief_file")||i("plan_file"),c=i("task_name")||i("task_description"),u=i("report_file"),l=i("work_dir"),d=i("model"),f=i("task_description"),p=i("plan_file"),m={"[BRIEF_FILE]":s,"[task name]":c,"[REPORT_FILE]":u,"[directory]":l,"[MODEL]":d},h=$o(a,m),v=bo(a,m),_=[f&&!v.has("[task name]")?`
175
177
 
176
178
  ### Target Task:
177
- ${p}`:"",f&&!v.has(f)?`
179
+ ${f}`:"",p&&!v.has("[BRIEF_FILE]")?`
178
180
 
179
181
  ### Plan / Brief File:
180
- ${f}`:""].join("");return{description:"Subagent-Driven Development Implementer Prompt",messages:[{role:"user",content:{type:"text",text:`${h}${_}`}}]}}if(t==="sdd-task-reviewer"){let a=await i("subagent-driven-development/task-reviewer-prompt.md"),s=o("brief_file"),c=o("report_file"),u=o("diff_file")||o("review_target"),l=k$(o("review_file"),c,s),d=o("base_sha"),p=o("head_sha"),f=o("global_constraints"),m=o("model"),h=o("task_description"),v=o("review_target"),_={"[BRIEF_FILE]":s,"[REPORT_FILE]":c,"[DIFF_FILE]":u,"[BASE_SHA]":d,"[HEAD_SHA]":p,"[GLOBAL_CONSTRAINTS]":f,"[REVIEW_FILE]":l,"[MODEL]":m},$=$i(a,_),b=bi(a,_),S=[h&&!b.has(h)?`
182
+ ${p}`:""].join("");return{description:"Subagent-Driven Development Implementer Prompt",messages:[{role:"user",content:{type:"text",text:`${h}${_}`}}]}}if(t==="sdd-task-reviewer"){let a=await o("subagent-driven-development/task-reviewer-prompt.md"),s=i("brief_file"),c=i("report_file"),u=i("diff_file")||i("review_target"),l=w$(i("review_file"),c,s),d=i("base_sha"),f=i("head_sha"),p=i("global_constraints"),m=i("model"),h=i("task_description"),v=i("review_target"),_={"[BRIEF_FILE]":s,"[REPORT_FILE]":c,"[DIFF_FILE]":u,"[BASE_SHA]":d,"[HEAD_SHA]":f,"[GLOBAL_CONSTRAINTS]":p,"[REVIEW_FILE]":l,"[MODEL]":m},b=$o(a,_),$=bo(a,_),S=[h&&!$.has(h)?`
181
183
 
182
184
  ### Reviewed Task:
183
- ${h}`:"",v&&!b.has(v)?`
185
+ ${h}`:"",v&&!$.has(v)?`
184
186
 
185
187
  ### Review Target:
186
- ${v}`:""].join("");return{description:"Subagent-Driven Development Task Reviewer Prompt",messages:[{role:"user",content:{type:"text",text:`${$}${S}`}}]}}if(t==="sdd-re-review"){let a=await i("subagent-driven-development/re-review-prompt.md"),s=o("brief_file"),c=o("report_file"),u=o("diff_file"),l=k$(o("review_file"),c,s),d=o("previous_findings"),p=o("base_sha")||o("fix_base_sha"),f=o("head_sha"),m=o("model"),h=o("fix_summary"),v={"[BRIEF_FILE]":s,"[REPORT_FILE]":c,"[DIFF_FILE]":u,"[REVIEW_FILE]":l,"[FINDINGS]":d,"[BASE_SHA]":p,"[FIX_BASE_SHA]":p,"[HEAD_SHA]":f,"[MODEL]":m},_=$i(a,v),$=bi(a,v),b=[d&&!$.has(d)?`
188
+ ${v}`:""].join("");return{description:"Subagent-Driven Development Task Reviewer Prompt",messages:[{role:"user",content:{type:"text",text:`${b}${S}`}}]}}if(t==="sdd-re-review"){let a=await o("subagent-driven-development/re-review-prompt.md"),s=i("brief_file"),c=i("report_file"),u=i("diff_file"),l=w$(i("review_file"),c,s),d=i("previous_findings"),f=i("base_sha")||i("fix_base_sha"),p=i("fix_base_sha")||f,m=i("head_sha"),h=i("model"),v=i("fix_summary"),_={"[BRIEF_FILE]":s,"[REPORT_FILE]":c,"[DIFF_FILE]":u,"[REVIEW_FILE]":l,"[FINDINGS]":d,"[BASE_SHA]":f,"[FIX_BASE_SHA]":p,"[HEAD_SHA]":m,"[MODEL]":h},b=$o(a,_),$=bo(a,_),S=[d&&!$.has("[FINDINGS]")?`
187
189
 
188
190
  ### Previous Findings:
189
- ${d}`:"",h?`
191
+ ${d}`:"",v?`
190
192
 
191
193
  ### Fix Summary:
192
- ${h}`:""].join("");return{description:"SDD Scoped Re-Review Prompt",messages:[{role:"user",content:{type:"text",text:`${_}${b}`}}]}}if(t==="spec-reviewer"){let a=await i("brainstorming/spec-document-reviewer-prompt.md"),s=o("spec_file"),c={"[SPEC_FILE_PATH]":s},u=$i(a,c),l=bi(a,c),d=s&&!l.has(s)?`
194
+ ${v}`:""].join("");return{description:"SDD Scoped Re-Review Prompt",messages:[{role:"user",content:{type:"text",text:`${b}${S}`}}]}}if(t==="spec-reviewer"){let a=await o("brainstorming/spec-document-reviewer-prompt.md"),s=i("spec_file"),c={"[SPEC_FILE_PATH]":s},u=$o(a,c),l=bo(a,c),d=s&&!l.has(s)?`
193
195
 
194
196
  ### Target Specification:
195
- ${s}`:"";return{description:"Brainstorming Spec Document Reviewer Prompt",messages:[{role:"user",content:{type:"text",text:`${u}${d}`}}]}}if(t==="plan-reviewer"){let a=await i("writing-plans/plan-document-reviewer-prompt.md"),s=o("plan_file"),c=o("spec_file"),u={"[PLAN_FILE_PATH]":s,"[SPEC_FILE_PATH]":c},l=$i(a,u),d=bi(a,u),p=s&&!d.has(s)?`
197
+ ${s}`:"";return{description:"Brainstorming Spec Document Reviewer Prompt",messages:[{role:"user",content:{type:"text",text:`${u}${d}`}}]}}if(t==="plan-reviewer"){let a=await o("writing-plans/plan-document-reviewer-prompt.md"),s=i("plan_file"),c=i("spec_file"),u={"[PLAN_FILE_PATH]":s,"[SPEC_FILE_PATH]":c},l=$o(a,u),d=bo(a,u),f=s&&!d.has(s)?`
196
198
 
197
199
  ### Target Implementation Plan:
198
- ${s}`:"",f=c&&!d.has(c)?`
200
+ ${s}`:"",p=c&&!d.has(c)?`
199
201
 
200
202
  ### Reference Specification:
201
- ${c}`:"";return{description:"Writing-Plans Plan Document Reviewer Prompt",messages:[{role:"user",content:{type:"text",text:`${l}${p}${f}`}}]}}if(t===Dr.promptName){let a=o("feature_name"),s=a?a.replace(/[\r\n]+/g," "):"(Unspecified feature)",c=o("requirements"),u=_$(s,c);return{description:Dr.purpose,messages:[{role:"user",content:{type:"text",text:u}}]}}if(t===Rr.promptName){let a=o("issue_description"),s=o("failing_tests"),c=$$(a,s);return{description:Rr.purpose,messages:[{role:"user",content:{type:"text",text:c}}]}}if(t==="skill-composition"){let a=o("scenario"),s=a?`
203
+ ${c}`:"";return{description:"Writing-Plans Plan Document Reviewer Prompt",messages:[{role:"user",content:{type:"text",text:`${l}${f}${p}`}}]}}if(t===Dr.promptName){if(!Object.prototype.hasOwnProperty.call(r,"feature_name"))throw new R(Z.InvalidParams,'Prompt argument "feature_name" is required for the feature-pipeline prompt');let a=i("feature_name"),s=a?a.replace(/[\r\n]+/g," "):"(Unspecified feature)",c=i("requirements"),u=$$(s,c);return{description:Dr.purpose,messages:[{role:"user",content:{type:"text",text:u}}]}}if(t===Rr.promptName){let a=i("issue_description"),s=i("failing_tests"),c=b$(a,s);return{description:Rr.purpose,messages:[{role:"user",content:{type:"text",text:c}}]}}if(t==="skill-composition"){let a=i("scenario"),s=a?`
202
204
  ### Selected Scenario:
203
205
  ${a}
204
- `:"",c="";if(a){let l=a.toLowerCase();l.includes("debug")||l.includes("troubleshoot")||l.includes("bug")||l.includes("fix")?c=`
206
+ `:"",c="";if(a){let l=a.toLowerCase();l.includes("debug")||l.includes("troubleshoot")||l.includes("bug")||/\bfix(ing|ed)?\b/.test(l)?c=`
205
207
  > **Recommended Pipeline Focus:** Pipeline 2 (Structured Debugging & Troubleshooting)
206
208
  `:l.includes("refactor")||l.includes("migrat")||l.includes("upgrade")?c=`
207
209
  > **Recommended Pipeline Focus:** Pipeline 3 (Large Refactoring & System Migration)
@@ -215,7 +217,7 @@ You are selecting or executing a multi-skill workflow pipeline.
215
217
  ${s}${c}
216
218
  ## Available Workflow Pipelines
217
219
 
218
- The canonical published guide is available as the MCP resource \`${Uf}\`.
220
+ The canonical published guide is available as the MCP resource \`${Mf}\`.
219
221
 
220
222
  1. **New Feature Development:**
221
223
  \`brainstorming\` \u2794 \`writing-plans\` \u2794 \`using-git-worktrees\` \u2794 \`subagent-driven-development\` (TDD) \u2794 \`verification-before-completion\` \u2794 \`requesting-code-review\` \u2794 \`finishing-a-development-branch\`
@@ -229,8 +231,8 @@ The canonical published guide is available as the MCP resource \`${Uf}\`.
229
231
  4. **Legacy Codebase Safety Net:**
230
232
  \`brainstorming\` \u2794 \`writing-plans\` \u2794 \`test-driven-development\` (characterization tests) \u2794 \`systematic-debugging\` \u2794 \`verification-before-completion\`
231
233
 
232
- Use \`read_skill(skill_name)\` to inspect any skill before starting.`}}]}}throw new R(q.InvalidRequest,`Unknown prompt: ${t}`)});dr.setRequestHandler(Pd,async()=>({tools:[{name:"list_skills",description:"List all available Superpowers skills with their names and descriptions. Use this to discover which skills are available before loading one.",inputSchema:{type:"object",properties:{},required:[]}},{name:"read_skill",description:"Read the full content of a Superpowers skill by name. The skill content contains instructions, checklists, and patterns to follow. Read a skill before attempting the task it covers.",inputSchema:{type:"object",properties:{skill_name:{type:"string",description:'Name of the skill to read (e.g. "brainstorming", "test-driven-development", "systematic-debugging")'}},required:["skill_name"]}}]}));dr.setRequestHandler(Ao,async e=>{let{name:t,arguments:r}=e.params;if(t==="list_skills"){let n=await Et.listSkills(),o=n.map(i=>`**${i.name}**
233
- ${i.description}`).join(`
234
+ Use \`read_skill(skill_name)\` to inspect any skill before starting.`}}]}}throw new R(Z.InvalidParams,`Unknown prompt: ${t}`)});dr.setRequestHandler(Pd,async()=>({tools:[{name:"list_skills",description:"List all available Superpowers skills with their names and descriptions. Use this to discover which skills are available before loading one.",inputSchema:{type:"object",properties:{},required:[]}},{name:"read_skill",description:"Read the full content of a Superpowers skill by name. The skill content contains instructions, checklists, and patterns to follow. Read a skill before attempting the task it covers.",inputSchema:{type:"object",properties:{skill_name:{type:"string",description:'Name of the skill to read (e.g. "brainstorming", "test-driven-development", "systematic-debugging")'}},required:["skill_name"]}}]}));dr.setRequestHandler(Zi,async e=>{let{name:t,arguments:r}=e.params;if(t==="list_skills"){let n=await Vt.listSkills(),i=n.map(o=>`**${o.name}**
235
+ ${o.description}`).join(`
234
236
 
235
237
  ---
236
238
 
@@ -240,8 +242,8 @@ Use \`read_skill\` with the skill name to load its full content.
240
242
 
241
243
  ---
242
244
 
243
- ${o}`}]}}if(t==="read_skill"){let n=r,o=typeof n?.skill_name=="string"?S$(n.skill_name):void 0;if(!o)throw new R(q.InvalidParams,"skill_name is required");let i=await Et.findSkill(o);if(!i){let s=(await Et.listSkills()).map(c=>c.name).join(", ");throw new R(q.InvalidRequest,`Skill "${o}" not found. Available skills: ${s}`)}try{let a=await Et.readSkillContent(i.skillPath);return{content:[{type:"text",text:`# Skill: ${i.name}
245
+ ${i}`}]}}if(t==="read_skill"){let n=r,i=typeof n?.skill_name=="string"?z$(n.skill_name):void 0;if(!i)throw new R(Z.InvalidParams,"skill_name is required");let o=await Vt.findSkill(i);if(!o)throw new R(Z.InvalidParams,`Skill "${i}" not found. Use the list_skills tool to see available skills.`);try{let a=await Vt.readSkillContent(o.skillPath);return{content:[{type:"text",text:`# Skill: ${o.name}
244
246
 
245
- ${a}`}]}}catch(a){let s=a instanceof Error?a.message:String(a);throw process.stderr.write(`[superpowers-mcp] read_skill("${o}") failed: ${s}
246
- `),new R(q.InternalError,`Failed to read skill "${o}": ${s}`)}}throw new R(q.MethodNotFound,`Unknown tool: ${t}`)});async function rT(){let e=process.argv.slice(2),t=e[0];if(t==="setup"||t==="--setup"){try{await v$(e)}catch(o){console.error("Setup failed:",o),process.exitCode=1}return}let r=new Os;await dr.connect(r);let n=async()=>{try{await dr.close()}catch{}process.exit(0)};process.on("SIGINT",n),process.on("SIGTERM",n)}rT().catch(e=>{process.stderr.write(`MCP Server fatal error: ${String(e)}
247
+ ${a}`}]}}catch(a){let s=a instanceof Error?a.message:String(a);throw process.stderr.write(`[superpowers-mcp] read_skill("${i}") failed: ${s}
248
+ `),new R(Z.InternalError,`Failed to read skill "${i}": ${s}`)}}throw new R(Z.InvalidParams,`Unknown tool: ${t}`)});async function iT(){let e=process.argv.slice(2),t=e[0];if(t==="setup"||t==="--setup"){try{await y$(e)}catch(o){console.error("Setup failed:",o),process.exitCode=1}return}let r=new Os;await dr.connect(r);let n=!1,i=async()=>{if(!n){n=!0;try{await dr.close()}catch{}process.exitCode=0}};process.on("SIGINT",i),process.on("SIGTERM",i)}iT().catch(e=>{process.stderr.write(`MCP Server fatal error: ${String(e)}
247
249
  `),process.exitCode=1});