handout 0.1.3 → 0.2.0

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.
Files changed (2) hide show
  1. package/dist/handout.js +13 -13
  2. package/package.json +1 -1
package/dist/handout.js CHANGED
@@ -1,19 +1,19 @@
1
1
  #!/usr/bin/env node
2
- var Qx=Object.create;var{getPrototypeOf:eb,defineProperty:nd,getOwnPropertyNames:tb}=Object;var od=Object.prototype.hasOwnProperty;function rb(e){return this[e]}var nb,ob,sd=(e,t,r)=>{var n=e!=null&&typeof e==="object";if(n){var o=t?nb??=new WeakMap:ob??=new WeakMap,s=o.get(e);if(s)return s}r=e!=null?Qx(eb(e)):{};let i=t||!e||!e.__esModule||!od.call(e,"default")?nd(r,"default",{value:e,enumerable:!0}):r;if(e&&typeof e==="object"||typeof e==="function"){for(let a of tb(e))if(!od.call(i,a))nd(i,a,{get:rb.bind(e,a),enumerable:!0})}if(n)o.set(e,i);return i};var k=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Jn=k(function(Kh){Object.defineProperty(Kh,"__esModule",{value:!0});Kh.regexpCode=Kh.getEsmExportName=Kh.getProperty=Kh.safeStringify=Kh.stringify=Kh.strConcat=Kh.addCodeArg=Kh.str=Kh._=Kh.nil=Kh._Code=Kh.Name=Kh.IDENTIFIER=Kh._CodeOrName=void 0;class Zs{}Kh._CodeOrName=Zs;Kh.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class Cr extends Zs{constructor(e){super();if(!Kh.IDENTIFIER.test(e))throw Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}Kh.Name=Cr;class rt extends Zs{constructor(e){super();this._items=typeof e==="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((t,r)=>`${t}${r}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((t,r)=>{if(r instanceof Cr)t[r.str]=(t[r.str]||0)+1;return t},{})}}Kh._Code=rt;Kh.nil=new rt("");function Bh(e,...t){let r=[e[0]],n=0;while(n<t.length)Mu(r,t[n]),r.push(e[++n]);return new rt(r)}Kh._=Bh;var Zu=new rt("+");function Jh(e,...t){let r=[Bn(e[0])],n=0;while(n<t.length)r.push(Zu),Mu(r,t[n]),r.push(Zu,Bn(e[++n]));return sS(r),new rt(r)}Kh.str=Jh;function Mu(e,t){if(t instanceof rt)e.push(...t._items);else if(t instanceof Cr)e.push(t);else e.push(cS(t))}Kh.addCodeArg=Mu;function sS(e){let t=1;while(t<e.length-1){if(e[t]===Zu){let r=iS(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function iS(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string"){if(t instanceof Cr||e[e.length-1]!=='"')return;if(typeof t!="string")return`${e.slice(0,-1)}${t}"`;if(t[0]==='"')return e.slice(0,-1)+t.slice(1);return}if(typeof t=="string"&&t[0]==='"'&&!(e instanceof Cr))return`"${e}${t.slice(1)}`;return}function aS(e,t){return t.emptyStr()?e:e.emptyStr()?t:Jh`${e}${t}`}Kh.strConcat=aS;function cS(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:Bn(Array.isArray(e)?e.join(","):e)}function uS(e){return new rt(Bn(e))}Kh.stringify=uS;function Bn(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}Kh.safeStringify=Bn;function lS(e){return typeof e=="string"&&Kh.IDENTIFIER.test(e)?new rt(`.${e}`):Bh`[${e}]`}Kh.getProperty=lS;function dS(e){if(typeof e=="string"&&Kh.IDENTIFIER.test(e))return new rt(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}Kh.getEsmExportName=dS;function pS(e){return new rt(e.toString())}Kh.regexpCode=pS});var Fu=k(function(Yh){Object.defineProperty(Yh,"__esModule",{value:!0});Yh.ValueScope=Yh.ValueScopeName=Yh.Scope=Yh.varKinds=Yh.UsedValueState=void 0;var Ne=Jn();class Wh extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`);this.value=e.value}}var Ds;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(Ds||(Yh.UsedValueState=Ds={}));Yh.varKinds={const:new Ne.Name("const"),let:new Ne.Name("let"),var:new Ne.Name("var")};class qu{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof Ne.Name?e:this.name(e)}name(e){return new Ne.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){var t,r;if(((r=(t=this._parent)===null||t===void 0?void 0:t._prefixes)===null||r===void 0?void 0:r.has(e))||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}Yh.Scope=qu;class Lu extends Ne.Name{constructor(e,t){super(t);this.prefix=e}setValue(e,{property:t,itemIndex:r}){this.value=e,this.scopePath=Ne._`.${new Ne.Name(t)}[${r}]`}}Yh.ValueScopeName=Lu;var SS=Ne._`\n`;class Xh extends qu{constructor(e){super(e);this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?SS:Ne.nil}}get(){return this._scope}name(e){return new Lu(e,this._newName(e))}value(e,t){var r;if(t.ref===void 0)throw Error("CodeGen: ref must be passed in value");let n=this.toName(e),{prefix:o}=n,s=(r=t.key)!==null&&r!==void 0?r:t.ref,i=this._values[o];if(i){let u=i.get(s);if(u)return u}else i=this._values[o]=new Map;i.set(s,n);let a=this._scope[o]||(this._scope[o]=[]),c=a.length;return a[c]=t.ref,n.setValue(t,{property:o,itemIndex:c}),n}getValue(e,t){let r=this._values[e];if(!r)return;return r.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,(r)=>{if(r.scopePath===void 0)throw Error(`CodeGen: name "${r}" has no value`);return Ne._`${e}${r.scopePath}`})}scopeCode(e=this._values,t,r){return this._reduceValues(e,(n)=>{if(n.value===void 0)throw Error(`CodeGen: name "${n}" has no value`);return n.value.code},t,r)}_reduceValues(e,t,r={},n){let o=Ne.nil;for(let s in e){let i=e[s];if(!i)continue;let a=r[s]=r[s]||new Map;i.forEach((c)=>{if(a.has(c))return;a.set(c,Ds.Started);let u=t(c);if(u){let l=this.opts.es5?Yh.varKinds.var:Yh.varKinds.const;o=Ne._`${o}${l} ${c} = ${u};${this.opts._n}`}else if(u=n===null||n===void 0?void 0:n(c))o=Ne._`${o}${u}${this.opts._n}`;else throw new Wh(c);a.set(c,Ds.Completed)})}return o}}Yh.ValueScope=Xh});var L=k(function(je){Object.defineProperty(je,"__esModule",{value:!0});je.or=je.and=je.not=je.CodeGen=je.operators=je.varKinds=je.ValueScopeName=je.ValueScope=je.Scope=je.Name=je.regexpCode=je.stringify=je.getProperty=je.nil=je.strConcat=je.str=je._=void 0;var J=Jn(),nt=Fu(),Dt=Jn();Object.defineProperty(je,"_",{enumerable:!0,get:function(){return Dt._}});Object.defineProperty(je,"str",{enumerable:!0,get:function(){return Dt.str}});Object.defineProperty(je,"strConcat",{enumerable:!0,get:function(){return Dt.strConcat}});Object.defineProperty(je,"nil",{enumerable:!0,get:function(){return Dt.nil}});Object.defineProperty(je,"getProperty",{enumerable:!0,get:function(){return Dt.getProperty}});Object.defineProperty(je,"stringify",{enumerable:!0,get:function(){return Dt.stringify}});Object.defineProperty(je,"regexpCode",{enumerable:!0,get:function(){return Dt.regexpCode}});Object.defineProperty(je,"Name",{enumerable:!0,get:function(){return Dt.Name}});var Hs=Fu();Object.defineProperty(je,"Scope",{enumerable:!0,get:function(){return Hs.Scope}});Object.defineProperty(je,"ValueScope",{enumerable:!0,get:function(){return Hs.ValueScope}});Object.defineProperty(je,"ValueScopeName",{enumerable:!0,get:function(){return Hs.ValueScopeName}});Object.defineProperty(je,"varKinds",{enumerable:!0,get:function(){return Hs.varKinds}});je.operators={GT:new J._Code(">"),GTE:new J._Code(">="),LT:new J._Code("<"),LTE:new J._Code("<="),EQ:new J._Code("==="),NEQ:new J._Code("!=="),NOT:new J._Code("!"),OR:new J._Code("||"),AND:new J._Code("&&"),ADD:new J._Code("+")};class qt{optimizeNodes(){return this}optimizeNames(e,t){return this}}class eg extends qt{constructor(e,t,r){super();this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){let r=e?nt.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return`${r} ${this.name}${n};`+t}optimizeNames(e,t){if(!e[this.name.str])return;if(this.rhs)this.rhs=Nr(this.rhs,e,t);return this}get names(){return this.rhs instanceof J._CodeOrName?this.rhs.names:{}}}class Hu extends qt{constructor(e,t,r){super();this.lhs=e,this.rhs=t,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(this.lhs instanceof J.Name&&!e[this.lhs.str]&&!this.sideEffects)return;return this.rhs=Nr(this.rhs,e,t),this}get names(){let e=this.lhs instanceof J.Name?{}:{...this.lhs.names};return Vs(e,this.rhs)}}class tg extends Hu{constructor(e,t,r,n){super(e,r,n);this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class rg extends qt{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class ng extends qt{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class og extends qt{constructor(e){super();this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class sg extends qt{constructor(e){super();this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=Nr(this.code,e,t),this}get names(){return this.code instanceof J._CodeOrName?this.code.names:{}}}class Bs extends qt{constructor(e=[]){super();this.nodes=e}render(e){return this.nodes.reduce((t,r)=>t+r.render(e),"")}optimizeNodes(){let{nodes:e}=this,t=e.length;while(t--){let r=e[t].optimizeNodes();if(Array.isArray(r))e.splice(t,1,...r);else if(r)e[t]=r;else e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:r}=this,n=r.length;while(n--){let o=r[n];if(o.optimizeNames(e,t))continue;ES(e,o.names),r.splice(n,1)}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>or(e,t.names),{})}}class Lt extends Bs{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class ig extends Bs{}class Kn extends Lt{}Kn.kind="else";class St extends Lt{constructor(e,t){super(t);this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);if(this.else)t+="else "+this.else.render(e);return t}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let t=this.else;if(t){let r=t.optimizeNodes();t=this.else=Array.isArray(r)?new Kn(r):r}if(t){if(e===!1)return t instanceof St?t:t.nodes;if(this.nodes.length)return this;return new St(dg(e),t instanceof St?[t]:t.nodes)}if(e===!1||!this.nodes.length)return;return this}optimizeNames(e,t){var r;if(this.else=(r=this.else)===null||r===void 0?void 0:r.optimizeNames(e,t),!(super.optimizeNames(e,t)||this.else))return;return this.condition=Nr(this.condition,e,t),this}get names(){let e=super.names;if(Vs(e,this.condition),this.else)or(e,this.else.names);return e}}St.kind="if";class Ar extends Lt{}Ar.kind="for";class ag extends Ar{constructor(e){super();this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(!super.optimizeNames(e,t))return;return this.iteration=Nr(this.iteration,e,t),this}get names(){return or(super.names,this.iteration.names)}}class cg extends Ar{constructor(e,t,r,n){super();this.varKind=e,this.name=t,this.from=r,this.to=n}render(e){let t=e.es5?nt.varKinds.var:this.varKind,{name:r,from:n,to:o}=this;return`for(${t} ${r}=${n}; ${r}<${o}; ${r}++)`+super.render(e)}get names(){let e=Vs(super.names,this.from);return Vs(e,this.to)}}class Uu extends Ar{constructor(e,t,r,n){super();this.loop=e,this.varKind=t,this.name=r,this.iterable=n}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(!super.optimizeNames(e,t))return;return this.iterable=Nr(this.iterable,e,t),this}get names(){return or(super.names,this.iterable.names)}}class qs extends Lt{constructor(e,t,r){super();this.name=e,this.args=t,this.async=r}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}qs.kind="func";class Ls extends Bs{render(e){return"return "+super.render(e)}}Ls.kind="return";class ug extends Lt{render(e){let t="try"+super.render(e);if(this.catch)t+=this.catch.render(e);if(this.finally)t+=this.finally.render(e);return t}optimizeNodes(){var e,t;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(t=this.finally)===null||t===void 0||t.optimizeNodes(),this}optimizeNames(e,t){var r,n;return super.optimizeNames(e,t),(r=this.catch)===null||r===void 0||r.optimizeNames(e,t),(n=this.finally)===null||n===void 0||n.optimizeNames(e,t),this}get names(){let e=super.names;if(this.catch)or(e,this.catch.names);if(this.finally)or(e,this.finally.names);return e}}class Fs extends Lt{constructor(e){super();this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}Fs.kind="catch";class Us extends Lt{render(e){return"finally"+super.render(e)}}Us.kind="finally";class lg{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
3
- `:""},this._extScope=e,this._scope=new nt.Scope({parent:e}),this._nodes=[new ig]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let r=this._extScope.value(e,t);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,r,n){let o=this._scope.toName(t);if(r!==void 0&&n)this._constants[o.str]=r;return this._leafNode(new eg(e,o,r)),o}const(e,t,r){return this._def(nt.varKinds.const,e,t,r)}let(e,t,r){return this._def(nt.varKinds.let,e,t,r)}var(e,t,r){return this._def(nt.varKinds.var,e,t,r)}assign(e,t,r){return this._leafNode(new Hu(e,t,r))}add(e,t){return this._leafNode(new tg(e,je.operators.ADD,t))}code(e){if(typeof e=="function")e();else if(e!==J.nil)this._leafNode(new sg(e));return this}object(...e){let t=["{"];for(let[r,n]of e){if(t.length>1)t.push(",");if(t.push(r),r!==n||this.opts.es5)t.push(":"),J.addCodeArg(t,n)}return t.push("}"),new J._Code(t)}if(e,t,r){if(this._blockNode(new St(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new St(e))}else(){return this._elseNode(new Kn)}endIf(){return this._endBlockNode(St,Kn)}_for(e,t){if(this._blockNode(e),t)this.code(t).endFor();return this}for(e,t){return this._for(new ag(e),t)}forRange(e,t,r,n,o=this.opts.es5?nt.varKinds.var:nt.varKinds.let){let s=this._scope.toName(e);return this._for(new cg(o,s,t,r),()=>n(s))}forOf(e,t,r,n=nt.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let s=t instanceof J.Name?t:this.var("_arr",t);return this.forRange("_i",0,J._`${s}.length`,(i)=>{this.var(o,J._`${s}[${i}]`),r(o)})}return this._for(new Uu("of",n,o,t),()=>r(o))}forIn(e,t,r,n=this.opts.es5?nt.varKinds.var:nt.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,J._`Object.keys(${t})`,r);let o=this._scope.toName(e);return this._for(new Uu("in",n,o,t),()=>r(o))}endFor(){return this._endBlockNode(Ar)}label(e){return this._leafNode(new rg(e))}break(e){return this._leafNode(new ng(e))}return(e){let t=new Ls;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(Ls)}try(e,t,r){if(!t&&!r)throw Error('CodeGen: "try" without "catch" and "finally"');let n=new ug;if(this._blockNode(n),this.code(e),t){let o=this.name("e");this._currNode=n.catch=new Fs(o),t(o)}if(r)this._currNode=n.finally=new Us,this.code(r);return this._endBlockNode(Fs,Us)}throw(e){return this._leafNode(new og(e))}block(e,t){if(this._blockStarts.push(this._nodes.length),e)this.code(e).endBlock(t);return this}endBlock(e){let t=this._blockStarts.pop();if(t===void 0)throw Error("CodeGen: not in self-balancing block");let r=this._nodes.length-t;if(r<0||e!==void 0&&r!==e)throw Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=J.nil,r,n){if(this._blockNode(new qs(e,t,r)),n)this.code(n).endFunc();return this}endFunc(){return this._endBlockNode(qs)}optimize(e=1){while(e-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let r=this._currNode;if(r instanceof e||t&&r instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof St))throw Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}}je.CodeGen=lg;function or(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function Vs(e,t){return t instanceof J._CodeOrName?or(e,t.names):e}function Nr(e,t,r){if(e instanceof J.Name)return n(e);if(!o(e))return e;return new J._Code(e._items.reduce((s,i)=>{if(i instanceof J.Name)i=n(i);if(i instanceof J._Code)s.push(...i._items);else s.push(i);return s},[]));function n(s){let i=r[s.str];if(i===void 0||t[s.str]!==1)return s;return delete t[s.str],i}function o(s){return s instanceof J._Code&&s._items.some((i)=>i instanceof J.Name&&t[i.str]===1&&r[i.str]!==void 0)}}function ES(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function dg(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:J._`!${Vu(e)}`}je.not=dg;var OS=pg(je.operators.AND);function RS(...e){return e.reduce(OS)}je.and=RS;var IS=pg(je.operators.OR);function CS(...e){return e.reduce(IS)}je.or=CS;function pg(e){return(t,r)=>t===J.nil?r:r===J.nil?t:J._`${Vu(t)} ${e} ${Vu(r)}`}function Vu(e){return e instanceof J.Name?e:J._`(${e})`}});var W=k(function(bg){Object.defineProperty(bg,"__esModule",{value:!0});bg.checkStrictMode=bg.getErrorPath=bg.Type=bg.useFunc=bg.setEvaluated=bg.evaluatedPropsToName=bg.mergeEvaluated=bg.eachItem=bg.unescapeJsonPointer=bg.escapeJsonPointer=bg.escapeFragment=bg.unescapeFragment=bg.schemaRefOrVal=bg.schemaHasRulesButRef=bg.schemaHasRules=bg.checkUnknownRules=bg.alwaysValidSchema=bg.toHash=void 0;var re=L(),ZS=Jn();function MS(e){let t={};for(let r of e)t[r]=!0;return t}bg.toHash=MS;function DS(e,t){if(typeof t=="boolean")return t;if(Object.keys(t).length===0)return!0;return gg(e,t),!_g(t,e.self.RULES.all)}bg.alwaysValidSchema=DS;function gg(e,t=e.schema){let{opts:r,self:n}=e;if(!r.strictSchema)return;if(typeof t==="boolean")return;let o=n.RULES.keywords;for(let s in t)if(!o[s])xg(e,`unknown keyword: "${s}"`)}bg.checkUnknownRules=gg;function _g(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}bg.schemaHasRules=_g;function qS(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}bg.schemaHasRulesButRef=qS;function LS({topSchemaRef:e,schemaPath:t},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return re._`${r}`}return re._`${e}${t}${re.getProperty(n)}`}bg.schemaRefOrVal=LS;function FS(e){return yg(decodeURIComponent(e))}bg.unescapeFragment=FS;function US(e){return encodeURIComponent(Ju(e))}bg.escapeFragment=US;function Ju(e){if(typeof e=="number")return`${e}`;return e.replace(/~/g,"~0").replace(/\//g,"~1")}bg.escapeJsonPointer=Ju;function yg(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}bg.unescapeJsonPointer=yg;function VS(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}bg.eachItem=VS;function mg({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(o,s,i,a)=>{let c=i===void 0?s:i instanceof re.Name?(s instanceof re.Name?e(o,s,i):t(o,s,i),i):s instanceof re.Name?(t(o,i,s),s):r(s,i);return a===re.Name&&!(c instanceof re.Name)?n(o,c):c}}bg.mergeEvaluated={props:mg({mergeNames:(e,t,r)=>e.if(re._`${r} !== true && ${t} !== undefined`,()=>{e.if(re._`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,re._`${r} || {}`).code(re._`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if(re._`${r} !== true`,()=>{if(t===!0)e.assign(r,!0);else e.assign(r,re._`${r} || {}`),Ku(e,r,t)}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:vg}),items:mg({mergeNames:(e,t,r)=>e.if(re._`${r} !== true && ${t} !== undefined`,()=>e.assign(r,re._`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if(re._`${r} !== true`,()=>e.assign(r,t===!0?!0:re._`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function vg(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",re._`{}`);if(t!==void 0)Ku(e,r,t);return r}bg.evaluatedPropsToName=vg;function Ku(e,t,r){Object.keys(r).forEach((n)=>e.assign(re._`${t}${re.getProperty(n)}`,!0))}bg.setEvaluated=Ku;var hg={};function HS(e,t){return e.scopeValue("func",{ref:t,code:hg[t.code]||(hg[t.code]=new ZS._Code(t.code))})}bg.useFunc=HS;var Bu;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Bu||(bg.Type=Bu={}));function BS(e,t,r){if(e instanceof re.Name){let n=t===Bu.Num;return r?n?re._`"[" + ${e} + "]"`:re._`"['" + ${e} + "']"`:n?re._`"/" + ${e}`:re._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?re.getProperty(e).toString():"/"+Ju(e)}bg.getErrorPath=BS;function xg(e,t,r=e.opts.strictSchema){if(!r)return;if(t=`strict mode: ${t}`,r===!0)throw Error(t);e.self.logger.warn(t)}bg.checkStrictMode=xg});var zt=k(function(wg){Object.defineProperty(wg,"__esModule",{value:!0});var we=L(),l1={data:new we.Name("data"),valCxt:new we.Name("valCxt"),instancePath:new we.Name("instancePath"),parentData:new we.Name("parentData"),parentDataProperty:new we.Name("parentDataProperty"),rootData:new we.Name("rootData"),dynamicAnchors:new we.Name("dynamicAnchors"),vErrors:new we.Name("vErrors"),errors:new we.Name("errors"),this:new we.Name("this"),self:new we.Name("self"),scope:new we.Name("scope"),json:new we.Name("json"),jsonPos:new we.Name("jsonPos"),jsonLen:new we.Name("jsonLen"),jsonPart:new we.Name("jsonPart")};wg.default=l1});var Gn=k(function(Pg){Object.defineProperty(Pg,"__esModule",{value:!0});Pg.extendErrors=Pg.resetErrorsCount=Pg.reportExtraError=Pg.reportError=Pg.keyword$DataError=Pg.keywordError=void 0;var X=L(),Ks=W(),Oe=zt();Pg.keywordError={message:({keyword:e})=>X.str`must pass "${e}" keyword validation`};Pg.keyword$DataError={message:({keyword:e,schemaType:t})=>t?X.str`"${e}" keyword must be ${t} ($data)`:X.str`"${e}" keyword is invalid ($data)`};function p1(e,t=Pg.keywordError,r,n){let{it:o}=e,{gen:s,compositeRule:i,allErrors:a}=o,c=zg(e,t,r);if(n!==null&&n!==void 0?n:i||a)kg(s,c);else Sg(o,X._`[${c}]`)}Pg.reportError=p1;function f1(e,t=Pg.keywordError,r){let{it:n}=e,{gen:o,compositeRule:s,allErrors:i}=n,a=zg(e,t,r);if(kg(o,a),!(s||i))Sg(n,Oe.default.vErrors)}Pg.reportExtraError=f1;function m1(e,t){e.assign(Oe.default.errors,t),e.if(X._`${Oe.default.vErrors} !== null`,()=>e.if(t,()=>e.assign(X._`${Oe.default.vErrors}.length`,t),()=>e.assign(Oe.default.vErrors,null)))}Pg.resetErrorsCount=m1;function h1({gen:e,keyword:t,schemaValue:r,data:n,errsCount:o,it:s}){if(o===void 0)throw Error("ajv implementation error");let i=e.name("err");e.forRange("i",o,Oe.default.errors,(a)=>{if(e.const(i,X._`${Oe.default.vErrors}[${a}]`),e.if(X._`${i}.instancePath === undefined`,()=>e.assign(X._`${i}.instancePath`,X.strConcat(Oe.default.instancePath,s.errorPath))),e.assign(X._`${i}.schemaPath`,X.str`${s.errSchemaPath}/${t}`),s.opts.verbose)e.assign(X._`${i}.schema`,r),e.assign(X._`${i}.data`,n)})}Pg.extendErrors=h1;function kg(e,t){let r=e.const("err",t);e.if(X._`${Oe.default.vErrors} === null`,()=>e.assign(Oe.default.vErrors,X._`[${r}]`),X._`${Oe.default.vErrors}.push(${r})`),e.code(X._`${Oe.default.errors}++`)}function Sg(e,t){let{gen:r,validateName:n,schemaEnv:o}=e;if(o.$async)r.throw(X._`new ${e.ValidationError}(${t})`);else r.assign(X._`${n}.errors`,t),r.return(!1)}var sr={keyword:new X.Name("keyword"),schemaPath:new X.Name("schemaPath"),params:new X.Name("params"),propertyName:new X.Name("propertyName"),message:new X.Name("message"),schema:new X.Name("schema"),parentSchema:new X.Name("parentSchema")};function zg(e,t,r){let{createErrors:n}=e.it;if(n===!1)return X._`{}`;return g1(e,t,r)}function g1(e,t,r={}){let{gen:n,it:o}=e,s=[_1(o,r),y1(e,r)];return v1(e,t,s),n.object(...s)}function _1({errorPath:e},{instancePath:t}){let r=t?X.str`${e}${Ks.getErrorPath(t,Ks.Type.Str)}`:e;return[Oe.default.instancePath,X.strConcat(Oe.default.instancePath,r)]}function y1({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let o=n?t:X.str`${t}/${e}`;if(r)o=X.str`${o}${Ks.getErrorPath(r,Ks.Type.Str)}`;return[sr.schemaPath,o]}function v1(e,{params:t,message:r},n){let{keyword:o,data:s,schemaValue:i,it:a}=e,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;if(n.push([sr.keyword,o],[sr.params,typeof t=="function"?t(e):t||X._`{}`]),c.messages)n.push([sr.message,typeof r=="function"?r(e):r]);if(c.verbose)n.push([sr.schema,i],[sr.parentSchema,X._`${l}${d}`],[Oe.default.data,s]);if(u)n.push([sr.propertyName,u])}});var Ig=k(function(Og){Object.defineProperty(Og,"__esModule",{value:!0});Og.boolOrEmptySchema=Og.topBoolOrEmptySchema=void 0;var k1=Gn(),S1=L(),z1=zt(),P1={message:"boolean schema is false"};function T1(e){let{gen:t,schema:r,validateName:n}=e;if(r===!1)Eg(e,!1);else if(typeof r=="object"&&r.$async===!0)t.return(z1.default.data);else t.assign(S1._`${n}.errors`,null),t.return(!0)}Og.topBoolOrEmptySchema=T1;function E1(e,t){let{gen:r,schema:n}=e;if(n===!1)r.var(t,!1),Eg(e);else r.var(t,!0)}Og.boolOrEmptySchema=E1;function Eg(e,t){let{gen:r,data:n}=e;k1.reportError({gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e},P1,void 0,t)}});var Wu=k(function(Cg){Object.defineProperty(Cg,"__esModule",{value:!0});Cg.getRules=Cg.isJSONType=void 0;var R1=["string","number","integer","boolean","null","object","array"],I1=new Set(R1);function C1(e){return typeof e=="string"&&I1.has(e)}Cg.isJSONType=C1;function A1(){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:{}}}Cg.getRules=A1});var Xu=k(function(Zg){Object.defineProperty(Zg,"__esModule",{value:!0});Zg.shouldUseRule=Zg.shouldUseGroup=Zg.schemaHasRulesForType=void 0;function j1({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&Ng(e,n)}Zg.schemaHasRulesForType=j1;function Ng(e,t){return t.rules.some((r)=>jg(e,r))}Zg.shouldUseGroup=Ng;function jg(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))}Zg.shouldUseRule=jg});var Wn=k(function(Fg){Object.defineProperty(Fg,"__esModule",{value:!0});Fg.reportTypeError=Fg.checkDataTypes=Fg.checkDataType=Fg.coerceAndCheckDataType=Fg.getJSONTypes=Fg.getSchemaTypes=Fg.DataType=void 0;var D1=Wu(),q1=Xu(),L1=Gn(),q=L(),Dg=W(),jr;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(jr||(Fg.DataType=jr={}));function F1(e){let t=qg(e.type);if(t.includes("null")){if(e.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');if(e.nullable===!0)t.push("null")}return t}Fg.getSchemaTypes=F1;function qg(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(D1.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}Fg.getJSONTypes=qg;function U1(e,t){let{gen:r,data:n,opts:o}=e,s=V1(t,o.coerceTypes),i=t.length>0&&!(s.length===0&&t.length===1&&q1.schemaHasRulesForType(e,t[0]));if(i){let a=Qu(t,n,o.strictNumbers,jr.Wrong);r.if(a,()=>{if(s.length)H1(e,t,s);else el(e)})}return i}Fg.coerceAndCheckDataType=U1;var Lg=new Set(["string","number","integer","boolean","null"]);function V1(e,t){return t?e.filter((r)=>Lg.has(r)||t==="array"&&r==="array"):[]}function H1(e,t,r){let{gen:n,data:o,opts:s}=e,i=n.let("dataType",q._`typeof ${o}`),a=n.let("coerced",q._`undefined`);if(s.coerceTypes==="array")n.if(q._`${i} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,q._`${o}[0]`).assign(i,q._`typeof ${o}`).if(Qu(t,o,s.strictNumbers),()=>n.assign(a,o)));n.if(q._`${a} !== undefined`);for(let u of r)if(Lg.has(u)||u==="array"&&s.coerceTypes==="array")c(u);n.else(),el(e),n.endIf(),n.if(q._`${a} !== undefined`,()=>{n.assign(o,a),B1(e,a)});function c(u){switch(u){case"string":n.elseIf(q._`${i} == "number" || ${i} == "boolean"`).assign(a,q._`"" + ${o}`).elseIf(q._`${o} === null`).assign(a,q._`""`);return;case"number":n.elseIf(q._`${i} == "boolean" || ${o} === null
2
+ var Qx=Object.create;var{getPrototypeOf:eb,defineProperty:nd,getOwnPropertyNames:tb}=Object;var od=Object.prototype.hasOwnProperty;function rb(e){return this[e]}var nb,ob,sd=(e,t,r)=>{var n=e!=null&&typeof e==="object";if(n){var o=t?nb??=new WeakMap:ob??=new WeakMap,s=o.get(e);if(s)return s}r=e!=null?Qx(eb(e)):{};let i=t||!e||!e.__esModule||!od.call(e,"default")?nd(r,"default",{value:e,enumerable:!0}):r;if(e&&typeof e==="object"||typeof e==="function"){for(let a of tb(e))if(!od.call(i,a))nd(i,a,{get:rb.bind(e,a),enumerable:!0})}if(n)o.set(e,i);return i};var k=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Jn=k(function(Kh){Object.defineProperty(Kh,"__esModule",{value:!0});Kh.regexpCode=Kh.getEsmExportName=Kh.getProperty=Kh.safeStringify=Kh.stringify=Kh.strConcat=Kh.addCodeArg=Kh.str=Kh._=Kh.nil=Kh._Code=Kh.Name=Kh.IDENTIFIER=Kh._CodeOrName=void 0;class Zs{}Kh._CodeOrName=Zs;Kh.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class Cr extends Zs{constructor(e){super();if(!Kh.IDENTIFIER.test(e))throw Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}Kh.Name=Cr;class rt extends Zs{constructor(e){super();this._items=typeof e==="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((t,r)=>`${t}${r}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((t,r)=>{if(r instanceof Cr)t[r.str]=(t[r.str]||0)+1;return t},{})}}Kh._Code=rt;Kh.nil=new rt("");function Bh(e,...t){let r=[e[0]],n=0;while(n<t.length)Mu(r,t[n]),r.push(e[++n]);return new rt(r)}Kh._=Bh;var Zu=new rt("+");function Jh(e,...t){let r=[Bn(e[0])],n=0;while(n<t.length)r.push(Zu),Mu(r,t[n]),r.push(Zu,Bn(e[++n]));return sS(r),new rt(r)}Kh.str=Jh;function Mu(e,t){if(t instanceof rt)e.push(...t._items);else if(t instanceof Cr)e.push(t);else e.push(cS(t))}Kh.addCodeArg=Mu;function sS(e){let t=1;while(t<e.length-1){if(e[t]===Zu){let r=iS(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function iS(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string"){if(t instanceof Cr||e[e.length-1]!=='"')return;if(typeof t!="string")return`${e.slice(0,-1)}${t}"`;if(t[0]==='"')return e.slice(0,-1)+t.slice(1);return}if(typeof t=="string"&&t[0]==='"'&&!(e instanceof Cr))return`"${e}${t.slice(1)}`;return}function aS(e,t){return t.emptyStr()?e:e.emptyStr()?t:Jh`${e}${t}`}Kh.strConcat=aS;function cS(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:Bn(Array.isArray(e)?e.join(","):e)}function uS(e){return new rt(Bn(e))}Kh.stringify=uS;function Bn(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}Kh.safeStringify=Bn;function lS(e){return typeof e=="string"&&Kh.IDENTIFIER.test(e)?new rt(`.${e}`):Bh`[${e}]`}Kh.getProperty=lS;function dS(e){if(typeof e=="string"&&Kh.IDENTIFIER.test(e))return new rt(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}Kh.getEsmExportName=dS;function pS(e){return new rt(e.toString())}Kh.regexpCode=pS});var Fu=k(function(Yh){Object.defineProperty(Yh,"__esModule",{value:!0});Yh.ValueScope=Yh.ValueScopeName=Yh.Scope=Yh.varKinds=Yh.UsedValueState=void 0;var Ne=Jn();class Wh extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`);this.value=e.value}}var Ds;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(Ds||(Yh.UsedValueState=Ds={}));Yh.varKinds={const:new Ne.Name("const"),let:new Ne.Name("let"),var:new Ne.Name("var")};class qu{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof Ne.Name?e:this.name(e)}name(e){return new Ne.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){var t,r;if(((r=(t=this._parent)===null||t===void 0?void 0:t._prefixes)===null||r===void 0?void 0:r.has(e))||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}Yh.Scope=qu;class Lu extends Ne.Name{constructor(e,t){super(t);this.prefix=e}setValue(e,{property:t,itemIndex:r}){this.value=e,this.scopePath=Ne._`.${new Ne.Name(t)}[${r}]`}}Yh.ValueScopeName=Lu;var SS=Ne._`\n`;class Xh extends qu{constructor(e){super(e);this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?SS:Ne.nil}}get(){return this._scope}name(e){return new Lu(e,this._newName(e))}value(e,t){var r;if(t.ref===void 0)throw Error("CodeGen: ref must be passed in value");let n=this.toName(e),{prefix:o}=n,s=(r=t.key)!==null&&r!==void 0?r:t.ref,i=this._values[o];if(i){let u=i.get(s);if(u)return u}else i=this._values[o]=new Map;i.set(s,n);let a=this._scope[o]||(this._scope[o]=[]),c=a.length;return a[c]=t.ref,n.setValue(t,{property:o,itemIndex:c}),n}getValue(e,t){let r=this._values[e];if(!r)return;return r.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,(r)=>{if(r.scopePath===void 0)throw Error(`CodeGen: name "${r}" has no value`);return Ne._`${e}${r.scopePath}`})}scopeCode(e=this._values,t,r){return this._reduceValues(e,(n)=>{if(n.value===void 0)throw Error(`CodeGen: name "${n}" has no value`);return n.value.code},t,r)}_reduceValues(e,t,r={},n){let o=Ne.nil;for(let s in e){let i=e[s];if(!i)continue;let a=r[s]=r[s]||new Map;i.forEach((c)=>{if(a.has(c))return;a.set(c,Ds.Started);let u=t(c);if(u){let l=this.opts.es5?Yh.varKinds.var:Yh.varKinds.const;o=Ne._`${o}${l} ${c} = ${u};${this.opts._n}`}else if(u=n===null||n===void 0?void 0:n(c))o=Ne._`${o}${u}${this.opts._n}`;else throw new Wh(c);a.set(c,Ds.Completed)})}return o}}Yh.ValueScope=Xh});var L=k(function(je){Object.defineProperty(je,"__esModule",{value:!0});je.or=je.and=je.not=je.CodeGen=je.operators=je.varKinds=je.ValueScopeName=je.ValueScope=je.Scope=je.Name=je.regexpCode=je.stringify=je.getProperty=je.nil=je.strConcat=je.str=je._=void 0;var K=Jn(),nt=Fu(),Dt=Jn();Object.defineProperty(je,"_",{enumerable:!0,get:function(){return Dt._}});Object.defineProperty(je,"str",{enumerable:!0,get:function(){return Dt.str}});Object.defineProperty(je,"strConcat",{enumerable:!0,get:function(){return Dt.strConcat}});Object.defineProperty(je,"nil",{enumerable:!0,get:function(){return Dt.nil}});Object.defineProperty(je,"getProperty",{enumerable:!0,get:function(){return Dt.getProperty}});Object.defineProperty(je,"stringify",{enumerable:!0,get:function(){return Dt.stringify}});Object.defineProperty(je,"regexpCode",{enumerable:!0,get:function(){return Dt.regexpCode}});Object.defineProperty(je,"Name",{enumerable:!0,get:function(){return Dt.Name}});var Hs=Fu();Object.defineProperty(je,"Scope",{enumerable:!0,get:function(){return Hs.Scope}});Object.defineProperty(je,"ValueScope",{enumerable:!0,get:function(){return Hs.ValueScope}});Object.defineProperty(je,"ValueScopeName",{enumerable:!0,get:function(){return Hs.ValueScopeName}});Object.defineProperty(je,"varKinds",{enumerable:!0,get:function(){return Hs.varKinds}});je.operators={GT:new K._Code(">"),GTE:new K._Code(">="),LT:new K._Code("<"),LTE:new K._Code("<="),EQ:new K._Code("==="),NEQ:new K._Code("!=="),NOT:new K._Code("!"),OR:new K._Code("||"),AND:new K._Code("&&"),ADD:new K._Code("+")};class qt{optimizeNodes(){return this}optimizeNames(e,t){return this}}class eg extends qt{constructor(e,t,r){super();this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){let r=e?nt.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return`${r} ${this.name}${n};`+t}optimizeNames(e,t){if(!e[this.name.str])return;if(this.rhs)this.rhs=Nr(this.rhs,e,t);return this}get names(){return this.rhs instanceof K._CodeOrName?this.rhs.names:{}}}class Hu extends qt{constructor(e,t,r){super();this.lhs=e,this.rhs=t,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(this.lhs instanceof K.Name&&!e[this.lhs.str]&&!this.sideEffects)return;return this.rhs=Nr(this.rhs,e,t),this}get names(){let e=this.lhs instanceof K.Name?{}:{...this.lhs.names};return Vs(e,this.rhs)}}class tg extends Hu{constructor(e,t,r,n){super(e,r,n);this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class rg extends qt{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class ng extends qt{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class og extends qt{constructor(e){super();this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class sg extends qt{constructor(e){super();this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=Nr(this.code,e,t),this}get names(){return this.code instanceof K._CodeOrName?this.code.names:{}}}class Bs extends qt{constructor(e=[]){super();this.nodes=e}render(e){return this.nodes.reduce((t,r)=>t+r.render(e),"")}optimizeNodes(){let{nodes:e}=this,t=e.length;while(t--){let r=e[t].optimizeNodes();if(Array.isArray(r))e.splice(t,1,...r);else if(r)e[t]=r;else e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:r}=this,n=r.length;while(n--){let o=r[n];if(o.optimizeNames(e,t))continue;ES(e,o.names),r.splice(n,1)}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>or(e,t.names),{})}}class Lt extends Bs{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class ig extends Bs{}class Kn extends Lt{}Kn.kind="else";class St extends Lt{constructor(e,t){super(t);this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);if(this.else)t+="else "+this.else.render(e);return t}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let t=this.else;if(t){let r=t.optimizeNodes();t=this.else=Array.isArray(r)?new Kn(r):r}if(t){if(e===!1)return t instanceof St?t:t.nodes;if(this.nodes.length)return this;return new St(dg(e),t instanceof St?[t]:t.nodes)}if(e===!1||!this.nodes.length)return;return this}optimizeNames(e,t){var r;if(this.else=(r=this.else)===null||r===void 0?void 0:r.optimizeNames(e,t),!(super.optimizeNames(e,t)||this.else))return;return this.condition=Nr(this.condition,e,t),this}get names(){let e=super.names;if(Vs(e,this.condition),this.else)or(e,this.else.names);return e}}St.kind="if";class Ar extends Lt{}Ar.kind="for";class ag extends Ar{constructor(e){super();this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(!super.optimizeNames(e,t))return;return this.iteration=Nr(this.iteration,e,t),this}get names(){return or(super.names,this.iteration.names)}}class cg extends Ar{constructor(e,t,r,n){super();this.varKind=e,this.name=t,this.from=r,this.to=n}render(e){let t=e.es5?nt.varKinds.var:this.varKind,{name:r,from:n,to:o}=this;return`for(${t} ${r}=${n}; ${r}<${o}; ${r}++)`+super.render(e)}get names(){let e=Vs(super.names,this.from);return Vs(e,this.to)}}class Uu extends Ar{constructor(e,t,r,n){super();this.loop=e,this.varKind=t,this.name=r,this.iterable=n}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(!super.optimizeNames(e,t))return;return this.iterable=Nr(this.iterable,e,t),this}get names(){return or(super.names,this.iterable.names)}}class qs extends Lt{constructor(e,t,r){super();this.name=e,this.args=t,this.async=r}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}qs.kind="func";class Ls extends Bs{render(e){return"return "+super.render(e)}}Ls.kind="return";class ug extends Lt{render(e){let t="try"+super.render(e);if(this.catch)t+=this.catch.render(e);if(this.finally)t+=this.finally.render(e);return t}optimizeNodes(){var e,t;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(t=this.finally)===null||t===void 0||t.optimizeNodes(),this}optimizeNames(e,t){var r,n;return super.optimizeNames(e,t),(r=this.catch)===null||r===void 0||r.optimizeNames(e,t),(n=this.finally)===null||n===void 0||n.optimizeNames(e,t),this}get names(){let e=super.names;if(this.catch)or(e,this.catch.names);if(this.finally)or(e,this.finally.names);return e}}class Fs extends Lt{constructor(e){super();this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}Fs.kind="catch";class Us extends Lt{render(e){return"finally"+super.render(e)}}Us.kind="finally";class lg{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
3
+ `:""},this._extScope=e,this._scope=new nt.Scope({parent:e}),this._nodes=[new ig]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let r=this._extScope.value(e,t);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,r,n){let o=this._scope.toName(t);if(r!==void 0&&n)this._constants[o.str]=r;return this._leafNode(new eg(e,o,r)),o}const(e,t,r){return this._def(nt.varKinds.const,e,t,r)}let(e,t,r){return this._def(nt.varKinds.let,e,t,r)}var(e,t,r){return this._def(nt.varKinds.var,e,t,r)}assign(e,t,r){return this._leafNode(new Hu(e,t,r))}add(e,t){return this._leafNode(new tg(e,je.operators.ADD,t))}code(e){if(typeof e=="function")e();else if(e!==K.nil)this._leafNode(new sg(e));return this}object(...e){let t=["{"];for(let[r,n]of e){if(t.length>1)t.push(",");if(t.push(r),r!==n||this.opts.es5)t.push(":"),K.addCodeArg(t,n)}return t.push("}"),new K._Code(t)}if(e,t,r){if(this._blockNode(new St(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new St(e))}else(){return this._elseNode(new Kn)}endIf(){return this._endBlockNode(St,Kn)}_for(e,t){if(this._blockNode(e),t)this.code(t).endFor();return this}for(e,t){return this._for(new ag(e),t)}forRange(e,t,r,n,o=this.opts.es5?nt.varKinds.var:nt.varKinds.let){let s=this._scope.toName(e);return this._for(new cg(o,s,t,r),()=>n(s))}forOf(e,t,r,n=nt.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let s=t instanceof K.Name?t:this.var("_arr",t);return this.forRange("_i",0,K._`${s}.length`,(i)=>{this.var(o,K._`${s}[${i}]`),r(o)})}return this._for(new Uu("of",n,o,t),()=>r(o))}forIn(e,t,r,n=this.opts.es5?nt.varKinds.var:nt.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,K._`Object.keys(${t})`,r);let o=this._scope.toName(e);return this._for(new Uu("in",n,o,t),()=>r(o))}endFor(){return this._endBlockNode(Ar)}label(e){return this._leafNode(new rg(e))}break(e){return this._leafNode(new ng(e))}return(e){let t=new Ls;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(Ls)}try(e,t,r){if(!t&&!r)throw Error('CodeGen: "try" without "catch" and "finally"');let n=new ug;if(this._blockNode(n),this.code(e),t){let o=this.name("e");this._currNode=n.catch=new Fs(o),t(o)}if(r)this._currNode=n.finally=new Us,this.code(r);return this._endBlockNode(Fs,Us)}throw(e){return this._leafNode(new og(e))}block(e,t){if(this._blockStarts.push(this._nodes.length),e)this.code(e).endBlock(t);return this}endBlock(e){let t=this._blockStarts.pop();if(t===void 0)throw Error("CodeGen: not in self-balancing block");let r=this._nodes.length-t;if(r<0||e!==void 0&&r!==e)throw Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=K.nil,r,n){if(this._blockNode(new qs(e,t,r)),n)this.code(n).endFunc();return this}endFunc(){return this._endBlockNode(qs)}optimize(e=1){while(e-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let r=this._currNode;if(r instanceof e||t&&r instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof St))throw Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}}je.CodeGen=lg;function or(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function Vs(e,t){return t instanceof K._CodeOrName?or(e,t.names):e}function Nr(e,t,r){if(e instanceof K.Name)return n(e);if(!o(e))return e;return new K._Code(e._items.reduce((s,i)=>{if(i instanceof K.Name)i=n(i);if(i instanceof K._Code)s.push(...i._items);else s.push(i);return s},[]));function n(s){let i=r[s.str];if(i===void 0||t[s.str]!==1)return s;return delete t[s.str],i}function o(s){return s instanceof K._Code&&s._items.some((i)=>i instanceof K.Name&&t[i.str]===1&&r[i.str]!==void 0)}}function ES(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function dg(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:K._`!${Vu(e)}`}je.not=dg;var OS=pg(je.operators.AND);function RS(...e){return e.reduce(OS)}je.and=RS;var IS=pg(je.operators.OR);function CS(...e){return e.reduce(IS)}je.or=CS;function pg(e){return(t,r)=>t===K.nil?r:r===K.nil?t:K._`${Vu(t)} ${e} ${Vu(r)}`}function Vu(e){return e instanceof K.Name?e:K._`(${e})`}});var W=k(function(bg){Object.defineProperty(bg,"__esModule",{value:!0});bg.checkStrictMode=bg.getErrorPath=bg.Type=bg.useFunc=bg.setEvaluated=bg.evaluatedPropsToName=bg.mergeEvaluated=bg.eachItem=bg.unescapeJsonPointer=bg.escapeJsonPointer=bg.escapeFragment=bg.unescapeFragment=bg.schemaRefOrVal=bg.schemaHasRulesButRef=bg.schemaHasRules=bg.checkUnknownRules=bg.alwaysValidSchema=bg.toHash=void 0;var re=L(),ZS=Jn();function MS(e){let t={};for(let r of e)t[r]=!0;return t}bg.toHash=MS;function DS(e,t){if(typeof t=="boolean")return t;if(Object.keys(t).length===0)return!0;return gg(e,t),!_g(t,e.self.RULES.all)}bg.alwaysValidSchema=DS;function gg(e,t=e.schema){let{opts:r,self:n}=e;if(!r.strictSchema)return;if(typeof t==="boolean")return;let o=n.RULES.keywords;for(let s in t)if(!o[s])xg(e,`unknown keyword: "${s}"`)}bg.checkUnknownRules=gg;function _g(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}bg.schemaHasRules=_g;function qS(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}bg.schemaHasRulesButRef=qS;function LS({topSchemaRef:e,schemaPath:t},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return re._`${r}`}return re._`${e}${t}${re.getProperty(n)}`}bg.schemaRefOrVal=LS;function FS(e){return yg(decodeURIComponent(e))}bg.unescapeFragment=FS;function US(e){return encodeURIComponent(Ju(e))}bg.escapeFragment=US;function Ju(e){if(typeof e=="number")return`${e}`;return e.replace(/~/g,"~0").replace(/\//g,"~1")}bg.escapeJsonPointer=Ju;function yg(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}bg.unescapeJsonPointer=yg;function VS(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}bg.eachItem=VS;function mg({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(o,s,i,a)=>{let c=i===void 0?s:i instanceof re.Name?(s instanceof re.Name?e(o,s,i):t(o,s,i),i):s instanceof re.Name?(t(o,i,s),s):r(s,i);return a===re.Name&&!(c instanceof re.Name)?n(o,c):c}}bg.mergeEvaluated={props:mg({mergeNames:(e,t,r)=>e.if(re._`${r} !== true && ${t} !== undefined`,()=>{e.if(re._`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,re._`${r} || {}`).code(re._`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if(re._`${r} !== true`,()=>{if(t===!0)e.assign(r,!0);else e.assign(r,re._`${r} || {}`),Ku(e,r,t)}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:vg}),items:mg({mergeNames:(e,t,r)=>e.if(re._`${r} !== true && ${t} !== undefined`,()=>e.assign(r,re._`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if(re._`${r} !== true`,()=>e.assign(r,t===!0?!0:re._`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function vg(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",re._`{}`);if(t!==void 0)Ku(e,r,t);return r}bg.evaluatedPropsToName=vg;function Ku(e,t,r){Object.keys(r).forEach((n)=>e.assign(re._`${t}${re.getProperty(n)}`,!0))}bg.setEvaluated=Ku;var hg={};function HS(e,t){return e.scopeValue("func",{ref:t,code:hg[t.code]||(hg[t.code]=new ZS._Code(t.code))})}bg.useFunc=HS;var Bu;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Bu||(bg.Type=Bu={}));function BS(e,t,r){if(e instanceof re.Name){let n=t===Bu.Num;return r?n?re._`"[" + ${e} + "]"`:re._`"['" + ${e} + "']"`:n?re._`"/" + ${e}`:re._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?re.getProperty(e).toString():"/"+Ju(e)}bg.getErrorPath=BS;function xg(e,t,r=e.opts.strictSchema){if(!r)return;if(t=`strict mode: ${t}`,r===!0)throw Error(t);e.self.logger.warn(t)}bg.checkStrictMode=xg});var zt=k(function(wg){Object.defineProperty(wg,"__esModule",{value:!0});var we=L(),l1={data:new we.Name("data"),valCxt:new we.Name("valCxt"),instancePath:new we.Name("instancePath"),parentData:new we.Name("parentData"),parentDataProperty:new we.Name("parentDataProperty"),rootData:new we.Name("rootData"),dynamicAnchors:new we.Name("dynamicAnchors"),vErrors:new we.Name("vErrors"),errors:new we.Name("errors"),this:new we.Name("this"),self:new we.Name("self"),scope:new we.Name("scope"),json:new we.Name("json"),jsonPos:new we.Name("jsonPos"),jsonLen:new we.Name("jsonLen"),jsonPart:new we.Name("jsonPart")};wg.default=l1});var Gn=k(function(Pg){Object.defineProperty(Pg,"__esModule",{value:!0});Pg.extendErrors=Pg.resetErrorsCount=Pg.reportExtraError=Pg.reportError=Pg.keyword$DataError=Pg.keywordError=void 0;var X=L(),Ks=W(),Oe=zt();Pg.keywordError={message:({keyword:e})=>X.str`must pass "${e}" keyword validation`};Pg.keyword$DataError={message:({keyword:e,schemaType:t})=>t?X.str`"${e}" keyword must be ${t} ($data)`:X.str`"${e}" keyword is invalid ($data)`};function p1(e,t=Pg.keywordError,r,n){let{it:o}=e,{gen:s,compositeRule:i,allErrors:a}=o,c=zg(e,t,r);if(n!==null&&n!==void 0?n:i||a)kg(s,c);else Sg(o,X._`[${c}]`)}Pg.reportError=p1;function f1(e,t=Pg.keywordError,r){let{it:n}=e,{gen:o,compositeRule:s,allErrors:i}=n,a=zg(e,t,r);if(kg(o,a),!(s||i))Sg(n,Oe.default.vErrors)}Pg.reportExtraError=f1;function m1(e,t){e.assign(Oe.default.errors,t),e.if(X._`${Oe.default.vErrors} !== null`,()=>e.if(t,()=>e.assign(X._`${Oe.default.vErrors}.length`,t),()=>e.assign(Oe.default.vErrors,null)))}Pg.resetErrorsCount=m1;function h1({gen:e,keyword:t,schemaValue:r,data:n,errsCount:o,it:s}){if(o===void 0)throw Error("ajv implementation error");let i=e.name("err");e.forRange("i",o,Oe.default.errors,(a)=>{if(e.const(i,X._`${Oe.default.vErrors}[${a}]`),e.if(X._`${i}.instancePath === undefined`,()=>e.assign(X._`${i}.instancePath`,X.strConcat(Oe.default.instancePath,s.errorPath))),e.assign(X._`${i}.schemaPath`,X.str`${s.errSchemaPath}/${t}`),s.opts.verbose)e.assign(X._`${i}.schema`,r),e.assign(X._`${i}.data`,n)})}Pg.extendErrors=h1;function kg(e,t){let r=e.const("err",t);e.if(X._`${Oe.default.vErrors} === null`,()=>e.assign(Oe.default.vErrors,X._`[${r}]`),X._`${Oe.default.vErrors}.push(${r})`),e.code(X._`${Oe.default.errors}++`)}function Sg(e,t){let{gen:r,validateName:n,schemaEnv:o}=e;if(o.$async)r.throw(X._`new ${e.ValidationError}(${t})`);else r.assign(X._`${n}.errors`,t),r.return(!1)}var sr={keyword:new X.Name("keyword"),schemaPath:new X.Name("schemaPath"),params:new X.Name("params"),propertyName:new X.Name("propertyName"),message:new X.Name("message"),schema:new X.Name("schema"),parentSchema:new X.Name("parentSchema")};function zg(e,t,r){let{createErrors:n}=e.it;if(n===!1)return X._`{}`;return g1(e,t,r)}function g1(e,t,r={}){let{gen:n,it:o}=e,s=[_1(o,r),y1(e,r)];return v1(e,t,s),n.object(...s)}function _1({errorPath:e},{instancePath:t}){let r=t?X.str`${e}${Ks.getErrorPath(t,Ks.Type.Str)}`:e;return[Oe.default.instancePath,X.strConcat(Oe.default.instancePath,r)]}function y1({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let o=n?t:X.str`${t}/${e}`;if(r)o=X.str`${o}${Ks.getErrorPath(r,Ks.Type.Str)}`;return[sr.schemaPath,o]}function v1(e,{params:t,message:r},n){let{keyword:o,data:s,schemaValue:i,it:a}=e,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;if(n.push([sr.keyword,o],[sr.params,typeof t=="function"?t(e):t||X._`{}`]),c.messages)n.push([sr.message,typeof r=="function"?r(e):r]);if(c.verbose)n.push([sr.schema,i],[sr.parentSchema,X._`${l}${d}`],[Oe.default.data,s]);if(u)n.push([sr.propertyName,u])}});var Ig=k(function(Og){Object.defineProperty(Og,"__esModule",{value:!0});Og.boolOrEmptySchema=Og.topBoolOrEmptySchema=void 0;var k1=Gn(),S1=L(),z1=zt(),P1={message:"boolean schema is false"};function T1(e){let{gen:t,schema:r,validateName:n}=e;if(r===!1)Eg(e,!1);else if(typeof r=="object"&&r.$async===!0)t.return(z1.default.data);else t.assign(S1._`${n}.errors`,null),t.return(!0)}Og.topBoolOrEmptySchema=T1;function E1(e,t){let{gen:r,schema:n}=e;if(n===!1)r.var(t,!1),Eg(e);else r.var(t,!0)}Og.boolOrEmptySchema=E1;function Eg(e,t){let{gen:r,data:n}=e;k1.reportError({gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e},P1,void 0,t)}});var Wu=k(function(Cg){Object.defineProperty(Cg,"__esModule",{value:!0});Cg.getRules=Cg.isJSONType=void 0;var R1=["string","number","integer","boolean","null","object","array"],I1=new Set(R1);function C1(e){return typeof e=="string"&&I1.has(e)}Cg.isJSONType=C1;function A1(){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:{}}}Cg.getRules=A1});var Xu=k(function(Zg){Object.defineProperty(Zg,"__esModule",{value:!0});Zg.shouldUseRule=Zg.shouldUseGroup=Zg.schemaHasRulesForType=void 0;function j1({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&Ng(e,n)}Zg.schemaHasRulesForType=j1;function Ng(e,t){return t.rules.some((r)=>jg(e,r))}Zg.shouldUseGroup=Ng;function jg(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))}Zg.shouldUseRule=jg});var Wn=k(function(Fg){Object.defineProperty(Fg,"__esModule",{value:!0});Fg.reportTypeError=Fg.checkDataTypes=Fg.checkDataType=Fg.coerceAndCheckDataType=Fg.getJSONTypes=Fg.getSchemaTypes=Fg.DataType=void 0;var D1=Wu(),q1=Xu(),L1=Gn(),q=L(),Dg=W(),jr;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(jr||(Fg.DataType=jr={}));function F1(e){let t=qg(e.type);if(t.includes("null")){if(e.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');if(e.nullable===!0)t.push("null")}return t}Fg.getSchemaTypes=F1;function qg(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(D1.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}Fg.getJSONTypes=qg;function U1(e,t){let{gen:r,data:n,opts:o}=e,s=V1(t,o.coerceTypes),i=t.length>0&&!(s.length===0&&t.length===1&&q1.schemaHasRulesForType(e,t[0]));if(i){let a=Qu(t,n,o.strictNumbers,jr.Wrong);r.if(a,()=>{if(s.length)H1(e,t,s);else el(e)})}return i}Fg.coerceAndCheckDataType=U1;var Lg=new Set(["string","number","integer","boolean","null"]);function V1(e,t){return t?e.filter((r)=>Lg.has(r)||t==="array"&&r==="array"):[]}function H1(e,t,r){let{gen:n,data:o,opts:s}=e,i=n.let("dataType",q._`typeof ${o}`),a=n.let("coerced",q._`undefined`);if(s.coerceTypes==="array")n.if(q._`${i} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,q._`${o}[0]`).assign(i,q._`typeof ${o}`).if(Qu(t,o,s.strictNumbers),()=>n.assign(a,o)));n.if(q._`${a} !== undefined`);for(let u of r)if(Lg.has(u)||u==="array"&&s.coerceTypes==="array")c(u);n.else(),el(e),n.endIf(),n.if(q._`${a} !== undefined`,()=>{n.assign(o,a),B1(e,a)});function c(u){switch(u){case"string":n.elseIf(q._`${i} == "number" || ${i} == "boolean"`).assign(a,q._`"" + ${o}`).elseIf(q._`${o} === null`).assign(a,q._`""`);return;case"number":n.elseIf(q._`${i} == "boolean" || ${o} === null
4
4
  || (${i} == "string" && ${o} && ${o} == +${o})`).assign(a,q._`+${o}`);return;case"integer":n.elseIf(q._`${i} === "boolean" || ${o} === null
5
5
  || (${i} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(a,q._`+${o}`);return;case"boolean":n.elseIf(q._`${o} === "false" || ${o} === 0 || ${o} === null`).assign(a,!1).elseIf(q._`${o} === "true" || ${o} === 1`).assign(a,!0);return;case"null":n.elseIf(q._`${o} === "" || ${o} === 0 || ${o} === false`),n.assign(a,null);return;case"array":n.elseIf(q._`${i} === "string" || ${i} === "number"
6
- || ${i} === "boolean" || ${o} === null`).assign(a,q._`[${o}]`)}}}function B1({gen:e,parentData:t,parentDataProperty:r},n){e.if(q._`${t} !== undefined`,()=>e.assign(q._`${t}[${r}]`,n))}function Yu(e,t,r,n=jr.Correct){let o=n===jr.Correct?q.operators.EQ:q.operators.NEQ,s;switch(e){case"null":return q._`${t} ${o} null`;case"array":s=q._`Array.isArray(${t})`;break;case"object":s=q._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":s=i(q._`!(${t} % 1) && !isNaN(${t})`);break;case"number":s=i();break;default:return q._`typeof ${t} ${o} ${e}`}return n===jr.Correct?s:q.not(s);function i(a=q.nil){return q.and(q._`typeof ${t} == "number"`,a,r?q._`isFinite(${t})`:q.nil)}}Fg.checkDataType=Yu;function Qu(e,t,r,n){if(e.length===1)return Yu(e[0],t,r,n);let o,s=Dg.toHash(e);if(s.array&&s.object){let i=q._`typeof ${t} != "object"`;o=s.null?i:q._`!${t} || ${i}`,delete s.null,delete s.array,delete s.object}else o=q.nil;if(s.number)delete s.integer;for(let i in s)o=q.and(o,Yu(i,t,r,n));return o}Fg.checkDataTypes=Qu;var J1={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?q._`{type: ${e}}`:q._`{type: ${t}}`};function el(e){let t=K1(e);L1.reportError(t,J1)}Fg.reportTypeError=el;function K1(e){let{gen:t,data:r,schema:n}=e,o=Dg.schemaRefOrVal(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:e}}});var Jg=k(function(Hg){Object.defineProperty(Hg,"__esModule",{value:!0});Hg.assignDefaults=void 0;var Zr=L(),tz=W();function rz(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let o in r)Vg(e,o,r[o].default);else if(t==="array"&&Array.isArray(n))n.forEach((o,s)=>Vg(e,s,o.default))}Hg.assignDefaults=rz;function Vg(e,t,r){let{gen:n,compositeRule:o,data:s,opts:i}=e;if(r===void 0)return;let a=Zr._`${s}${Zr.getProperty(t)}`;if(o){tz.checkStrictMode(e,`default is ignored for: ${a}`);return}let c=Zr._`${a} === undefined`;if(i.useDefaults==="empty")c=Zr._`${c} || ${a} === null || ${a} === ""`;n.if(c,Zr._`${a} = ${Zr.stringify(r)}`)}});var Ge=k(function(Wg){Object.defineProperty(Wg,"__esModule",{value:!0});Wg.validateUnion=Wg.validateArray=Wg.usePattern=Wg.callValidateCode=Wg.schemaProperties=Wg.allSchemaProperties=Wg.noPropertyInData=Wg.propertyInData=Wg.isOwnProperty=Wg.hasPropFunc=Wg.reportMissingProp=Wg.checkMissingProp=Wg.checkReportMissingProp=void 0;var ie=L(),tl=W(),Ft=zt(),nz=W();function oz(e,t){let{gen:r,data:n,it:o}=e;r.if(nl(r,n,t,o.opts.ownProperties),()=>{e.setParams({missingProperty:ie._`${t}`},!0),e.error()})}Wg.checkReportMissingProp=oz;function sz({gen:e,data:t,it:{opts:r}},n,o){return ie.or(...n.map((s)=>ie.and(nl(e,t,s,r.ownProperties),ie._`${o} = ${s}`)))}Wg.checkMissingProp=sz;function iz(e,t){e.setParams({missingProperty:t},!0),e.error()}Wg.reportMissingProp=iz;function Kg(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:ie._`Object.prototype.hasOwnProperty`})}Wg.hasPropFunc=Kg;function rl(e,t,r){return ie._`${Kg(e)}.call(${t}, ${r})`}Wg.isOwnProperty=rl;function az(e,t,r,n){let o=ie._`${t}${ie.getProperty(r)} !== undefined`;return n?ie._`${o} && ${rl(e,t,r)}`:o}Wg.propertyInData=az;function nl(e,t,r,n){let o=ie._`${t}${ie.getProperty(r)} === undefined`;return n?ie.or(o,ie.not(rl(e,t,r))):o}Wg.noPropertyInData=nl;function Gg(e){return e?Object.keys(e).filter((t)=>t!=="__proto__"):[]}Wg.allSchemaProperties=Gg;function cz(e,t){return Gg(t).filter((r)=>!tl.alwaysValidSchema(e,t[r]))}Wg.schemaProperties=cz;function uz({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:s},it:i},a,c,u){let l=u?ie._`${e}, ${t}, ${n}${o}`:t,d=[[Ft.default.instancePath,ie.strConcat(Ft.default.instancePath,s)],[Ft.default.parentData,i.parentData],[Ft.default.parentDataProperty,i.parentDataProperty],[Ft.default.rootData,Ft.default.rootData]];if(i.opts.dynamicRef)d.push([Ft.default.dynamicAnchors,Ft.default.dynamicAnchors]);let f=ie._`${l}, ${r.object(...d)}`;return c!==ie.nil?ie._`${a}.call(${c}, ${f})`:ie._`${a}(${f})`}Wg.callValidateCode=uz;var lz=ie._`new RegExp`;function dz({gen:e,it:{opts:t}},r){let n=t.unicodeRegExp?"u":"",{regExp:o}=t.code,s=o(r,n);return e.scopeValue("pattern",{key:s.toString(),ref:s,code:ie._`${o.code==="new RegExp"?lz:nz.useFunc(e,o)}(${r}, ${n})`})}Wg.usePattern=dz;function pz(e){let{gen:t,data:r,keyword:n,it:o}=e,s=t.name("valid");if(o.allErrors){let a=t.let("valid",!0);return i(()=>t.assign(a,!1)),a}return t.var(s,!0),i(()=>t.break()),s;function i(a){let c=t.const("len",ie._`${r}.length`);t.forRange("i",0,c,(u)=>{e.subschema({keyword:n,dataProp:u,dataPropType:tl.Type.Num},s),t.if(ie.not(s),a)})}}Wg.validateArray=pz;function fz(e){let{gen:t,schema:r,keyword:n,it:o}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(r.some((c)=>tl.alwaysValidSchema(o,c))&&!o.opts.unevaluated)return;let i=t.let("valid",!1),a=t.name("_valid");t.block(()=>r.forEach((c,u)=>{let l=e.subschema({keyword:n,schemaProp:u,compositeRule:!0},a);if(t.assign(i,ie._`${i} || ${a}`),!e.mergeValidEvaluated(l,a))t.if(ie.not(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}Wg.validateUnion=fz});var r_=k(function(e_){Object.defineProperty(e_,"__esModule",{value:!0});e_.validateKeywordUsage=e_.validSchemaType=e_.funcKeywordCode=e_.macroKeywordCode=void 0;var Re=L(),ir=zt(),zz=Ge(),Pz=Gn();function Tz(e,t){let{gen:r,keyword:n,schema:o,parentSchema:s,it:i}=e,a=t.macro.call(i.self,o,s,i),c=Qg(r,n,a);if(i.opts.validateSchema!==!1)i.self.validateSchema(a,!0);let u=r.name("valid");e.subschema({schema:a,schemaPath:Re.nil,errSchemaPath:`${i.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}e_.macroKeywordCode=Tz;function Ez(e,t){var r;let{gen:n,keyword:o,schema:s,parentSchema:i,$data:a,it:c}=e;Rz(c,t);let u=!a&&t.compile?t.compile.call(c.self,s,i,c):t.validate,l=Qg(n,o,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){if(h(),t.modifying)Yg(e);_(()=>e.error())}else{let v=t.async?p():m();if(t.modifying)Yg(e);_(()=>Oz(e,v))}}function p(){let v=n.let("ruleErrs",null);return n.try(()=>h(Re._`await `),(z)=>n.assign(d,!1).if(Re._`${z} instanceof ${c.ValidationError}`,()=>n.assign(v,Re._`${z}.errors`),()=>n.throw(z))),v}function m(){let v=Re._`${l}.errors`;return n.assign(v,null),h(Re.nil),v}function h(v=t.async?Re._`await `:Re.nil){let z=c.opts.passContext?ir.default.this:ir.default.self,A=!(("compile"in t)&&!a||t.schema===!1);n.assign(d,Re._`${v}${zz.callValidateCode(e,l,z,A)}`,t.modifying)}function _(v){var z;n.if(Re.not((z=t.valid)!==null&&z!==void 0?z:d),v)}}e_.funcKeywordCode=Ez;function Yg(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,Re._`${n.parentData}[${n.parentDataProperty}]`))}function Oz(e,t){let{gen:r}=e;r.if(Re._`Array.isArray(${t})`,()=>{r.assign(ir.default.vErrors,Re._`${ir.default.vErrors} === null ? ${t} : ${ir.default.vErrors}.concat(${t})`).assign(ir.default.errors,Re._`${ir.default.vErrors}.length`),Pz.extendErrors(e)},()=>e.error())}function Rz({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}function Qg(e,t,r){if(r===void 0)throw Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:Re.stringify(r)})}function Iz(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")}e_.validSchemaType=Iz;function Cz({schema:e,opts:t,self:r,errSchemaPath:n},o,s){if(Array.isArray(o.keyword)?!o.keyword.includes(s):o.keyword!==s)throw Error("ajv implementation error");let i=o.dependencies;if(i===null||i===void 0?void 0:i.some((a)=>!Object.prototype.hasOwnProperty.call(e,a)))throw Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(o.validateSchema){if(!o.validateSchema(e[s])){let c=`keyword "${s}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw Error(c)}}}e_.validateKeywordUsage=Cz});var i_=k(function(o_){Object.defineProperty(o_,"__esModule",{value:!0});o_.extendSubschemaMode=o_.extendSubschemaData=o_.getSubschema=void 0;var gt=L(),n_=W();function Zz(e,{keyword:t,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:s,topSchemaRef:i}){if(t!==void 0&&n!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let a=e.schema[t];return r===void 0?{schema:a,schemaPath:gt._`${e.schemaPath}${gt.getProperty(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:gt._`${e.schemaPath}${gt.getProperty(t)}${gt.getProperty(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${n_.escapeFragment(r)}`}}if(n!==void 0){if(o===void 0||s===void 0||i===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:o,topSchemaRef:i,errSchemaPath:s}}throw Error('either "keyword" or "schema" must be passed')}o_.getSubschema=Zz;function Mz(e,t,{dataProp:r,dataPropType:n,data:o,dataTypes:s,propertyName:i}){if(o!==void 0&&r!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=t;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=t,f=a.let("data",gt._`${t.data}${gt.getProperty(r)}`,!0);c(f),e.errorPath=gt.str`${u}${n_.getErrorPath(r,n,d.jsPropertySyntax)}`,e.parentDataProperty=gt._`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(o!==void 0){let u=o instanceof gt.Name?o:a.let("data",o,!0);if(c(u),i!==void 0)e.propertyName=i}if(s)e.dataTypes=s;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]}}o_.extendSubschemaData=Mz;function Dz(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:s}){if(n!==void 0)e.compositeRule=n;if(o!==void 0)e.createErrors=o;if(s!==void 0)e.allErrors=s;e.jtdDiscriminator=t,e.jtdMetadata=r}o_.extendSubschemaMode=Dz});var ol=k(function(MD,a_){a_.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,s;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(s=Object.keys(t),n=s.length,n!==Object.keys(r).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[o]))return!1;for(o=n;o--!==0;){var i=s[o];if(!e(t[i],r[i]))return!1}return!0}return t!==t&&r!==r}});var u_=k(function(DD,c_){var Ut=c_.exports=function(e,t,r){if(typeof t=="function")r=t,t={};r=t.cb||r;var n=typeof r=="function"?r:r.pre||function(){},o=r.post||function(){};Gs(t,n,o,e,"",e)};Ut.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Ut.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Ut.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Ut.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 Gs(e,t,r,n,o,s,i,a,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,o,s,i,a,c,u);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in Ut.arrayKeywords)for(var f=0;f<d.length;f++)Gs(e,t,r,d[f],o+"/"+l+"/"+f,s,o,l,n,f)}else if(l in Ut.propsKeywords){if(d&&typeof d=="object")for(var p in d)Gs(e,t,r,d[p],o+"/"+l+"/"+Fz(p),s,o,l,n,p)}else if(l in Ut.keywords||e.allKeys&&!(l in Ut.skipKeywords))Gs(e,t,r,d,o+"/"+l,s,o,l,n)}r(n,o,s,i,a,c,u)}}function Fz(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var Xn=k(function(f_){Object.defineProperty(f_,"__esModule",{value:!0});f_.getSchemaRefs=f_.resolveUrl=f_.normalizeId=f_._getFullPath=f_.getFullPath=f_.inlineRef=void 0;var Uz=W(),Vz=ol(),Hz=u_(),Bz=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function Jz(e,t=!0){if(typeof e=="boolean")return!0;if(t===!0)return!sl(e);if(!t)return!1;return l_(e)<=t}f_.inlineRef=Jz;var Kz=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function sl(e){for(let t in e){if(Kz.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(sl))return!0;if(typeof r=="object"&&sl(r))return!0}return!1}function l_(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,Bz.has(r))continue;if(typeof e[r]=="object")Uz.eachItem(e[r],(n)=>t+=l_(n));if(t===1/0)return 1/0}return t}function d_(e,t="",r){if(r!==!1)t=Mr(t);let n=e.parse(t);return p_(e,n)}f_.getFullPath=d_;function p_(e,t){return e.serialize(t).split("#")[0]+"#"}f_._getFullPath=p_;var Gz=/#\/?$/;function Mr(e){return e?e.replace(Gz,""):""}f_.normalizeId=Mr;function Wz(e,t,r){return r=Mr(r),e.resolve(t,r)}f_.resolveUrl=Wz;var Xz=/^[a-z_][-a-z0-9._]*$/i;function Yz(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=Mr(e[r]||t),s={"":o},i=d_(n,o,!1),a={},c=new Set;return Hz(e,{allKeys:!0},(d,f,p,m)=>{if(m===void 0)return;let h=i+f,_=s[m];if(typeof d[r]=="string")_=v.call(this,d[r]);z.call(this,d.$anchor),z.call(this,d.$dynamicAnchor),s[f]=_;function v(A){let K=this.opts.uriResolver.resolve;if(A=Mr(_?K(_,A):A),c.has(A))throw l(A);c.add(A);let E=this.refs[A];if(typeof E=="string")E=this.refs[E];if(typeof E=="object")u(d,E.schema,A);else if(A!==Mr(h))if(A[0]==="#")u(d,a[A],A),a[A]=d;else this.refs[A]=h;return A}function z(A){if(typeof A=="string"){if(!Xz.test(A))throw Error(`invalid anchor "${A}"`);v.call(this,`#${A}`)}}}),a;function u(d,f,p){if(f!==void 0&&!Vz(d,f))throw l(p)}function l(d){return Error(`reference "${d}" resolves to more than one schema`)}}f_.getSchemaRefs=Yz});var eo=k(function(E_){Object.defineProperty(E_,"__esModule",{value:!0});E_.getData=E_.KeywordCxt=E_.validateFunctionCode=void 0;var y_=Ig(),v_=Wn(),il=Xu(),Ws=Wn(),oP=Jg(),Yn=r_(),al=i_(),C=L(),M=zt(),sP=Xn(),Pt=W(),Qn=Gn();function iP(e){if($_(e)){if(w_(e),b_(e)){uP(e);return}}x_(e,()=>y_.topBoolOrEmptySchema(e))}E_.validateFunctionCode=iP;function x_({gen:e,validateName:t,schema:r,schemaEnv:n,opts:o},s){if(o.code.es5)e.func(t,C._`${M.default.data}, ${M.default.valCxt}`,n.$async,()=>{e.code(C._`"use strict"; ${h_(r,o)}`),cP(e,o),e.code(s)});else e.func(t,C._`${M.default.data}, ${aP(o)}`,n.$async,()=>e.code(h_(r,o)).code(s))}function aP(e){return C._`{${M.default.instancePath}="", ${M.default.parentData}, ${M.default.parentDataProperty}, ${M.default.rootData}=${M.default.data}${e.dynamicRef?C._`, ${M.default.dynamicAnchors}={}`:C.nil}}={}`}function cP(e,t){e.if(M.default.valCxt,()=>{if(e.var(M.default.instancePath,C._`${M.default.valCxt}.${M.default.instancePath}`),e.var(M.default.parentData,C._`${M.default.valCxt}.${M.default.parentData}`),e.var(M.default.parentDataProperty,C._`${M.default.valCxt}.${M.default.parentDataProperty}`),e.var(M.default.rootData,C._`${M.default.valCxt}.${M.default.rootData}`),t.dynamicRef)e.var(M.default.dynamicAnchors,C._`${M.default.valCxt}.${M.default.dynamicAnchors}`)},()=>{if(e.var(M.default.instancePath,C._`""`),e.var(M.default.parentData,C._`undefined`),e.var(M.default.parentDataProperty,C._`undefined`),e.var(M.default.rootData,M.default.data),t.dynamicRef)e.var(M.default.dynamicAnchors,C._`{}`)})}function uP(e){let{schema:t,opts:r,gen:n}=e;x_(e,()=>{if(r.$comment&&t.$comment)S_(e);if(mP(e),n.let(M.default.vErrors,null),n.let(M.default.errors,0),r.unevaluated)lP(e);k_(e),_P(e)});return}function lP(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",C._`${r}.evaluated`),t.if(C._`${e.evaluated}.dynamicProps`,()=>t.assign(C._`${e.evaluated}.props`,C._`undefined`)),t.if(C._`${e.evaluated}.dynamicItems`,()=>t.assign(C._`${e.evaluated}.items`,C._`undefined`))}function h_(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?C._`/*# sourceURL=${r} */`:C.nil}function dP(e,t){if($_(e)){if(w_(e),b_(e)){pP(e,t);return}}y_.boolOrEmptySchema(e,t)}function b_({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 $_(e){return typeof e.schema!="boolean"}function pP(e,t){let{schema:r,gen:n,opts:o}=e;if(o.$comment&&r.$comment)S_(e);hP(e),gP(e);let s=n.const("_errs",M.default.errors);k_(e,s),n.var(t,C._`${s} === ${M.default.errors}`)}function w_(e){Pt.checkUnknownRules(e),fP(e)}function k_(e,t){if(e.opts.jtd)return g_(e,[],!1,t);let r=v_.getSchemaTypes(e.schema),n=v_.coerceAndCheckDataType(e,r);g_(e,r,!n,t)}function fP(e){let{schema:t,errSchemaPath:r,opts:n,self:o}=e;if(t.$ref&&n.ignoreKeywordsWithRef&&Pt.schemaHasRulesButRef(t,o.RULES))o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function mP(e){let{schema:t,opts:r}=e;if(t.default!==void 0&&r.useDefaults&&r.strictSchema)Pt.checkStrictMode(e,"default is ignored in the schema root")}function hP(e){let t=e.schema[e.opts.schemaId];if(t)e.baseId=sP.resolveUrl(e.opts.uriResolver,e.baseId,t)}function gP(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}function S_({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:o}){let s=r.$comment;if(o.$comment===!0)e.code(C._`${M.default.self}.logger.log(${s})`);else if(typeof o.$comment=="function"){let i=C.str`${n}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code(C._`${M.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function _P(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:o,opts:s}=e;if(r.$async)t.if(C._`${M.default.errors} === 0`,()=>t.return(M.default.data),()=>t.throw(C._`new ${o}(${M.default.vErrors})`));else{if(t.assign(C._`${n}.errors`,M.default.vErrors),s.unevaluated)yP(e);t.return(C._`${M.default.errors} === 0`)}}function yP({gen:e,evaluated:t,props:r,items:n}){if(r instanceof C.Name)e.assign(C._`${t}.props`,r);if(n instanceof C.Name)e.assign(C._`${t}.items`,n)}function g_(e,t,r,n){let{gen:o,schema:s,data:i,allErrors:a,opts:c,self:u}=e,{RULES:l}=u;if(s.$ref&&(c.ignoreKeywordsWithRef||!Pt.schemaHasRulesButRef(s,l))){o.block(()=>P_(e,"$ref",l.all.$ref.definition));return}if(!c.jtd)vP(e,t);o.block(()=>{for(let f of l.rules)d(f);d(l.post)});function d(f){if(!il.shouldUseGroup(s,f))return;if(f.type){if(o.if(Ws.checkDataType(f.type,i,c.strictNumbers)),__(e,f),t.length===1&&t[0]===f.type&&r)o.else(),Ws.reportTypeError(e);o.endIf()}else __(e,f);if(!a)o.if(C._`${M.default.errors} === ${n||0}`)}}function __(e,t){let{gen:r,schema:n,opts:{useDefaults:o}}=e;if(o)oP.assignDefaults(e,t.type);r.block(()=>{for(let s of t.rules)if(il.shouldUseRule(n,s))P_(e,s.keyword,s.definition,t.type)})}function vP(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;if(xP(e,t),!e.opts.allowUnionTypes)bP(e,t);$P(e,e.dataTypes)}function xP(e,t){if(!t.length)return;if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach((r)=>{if(!z_(e.dataTypes,r))cl(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),kP(e,t)}function bP(e,t){if(t.length>1&&!(t.length===2&&t.includes("null")))cl(e,"use allowUnionTypes to allow union type keyword")}function $P(e,t){let r=e.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&il.shouldUseRule(e.schema,o)){let{type:s}=o.definition;if(s.length&&!s.some((i)=>wP(t,i)))cl(e,`missing type "${s.join(",")}" for keyword "${n}"`)}}}function wP(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function z_(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function kP(e,t){let r=[];for(let n of e.dataTypes)if(z_(t,n))r.push(n);else if(t.includes("integer")&&n==="number")r.push("integer");e.dataTypes=r}function cl(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,Pt.checkStrictMode(e,t,e.opts.strictTypes)}class ul{constructor(e,t,r){if(Yn.validateKeywordUsage(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=Pt.schemaRefOrVal(e,this.schema,r,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",T_(this.$data,e));else if(this.schemaCode=this.schemaValue,!Yn.validSchemaType(this.schema,t.schemaType,t.allowUndefined))throw Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);if("code"in t?t.trackErrors:t.errors!==!1)this.errsCount=e.gen.const("_errs",M.default.errors)}result(e,t,r){this.failResult(C.not(e),t,r)}failResult(e,t,r){if(this.gen.if(e),r)r();else this.error();if(t){if(this.gen.else(),t(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(e,t){this.failResult(C.not(e),void 0,t)}fail(e){if(e===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if(e),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:t}=this;this.fail(C._`${t} !== undefined && (${C.or(this.invalid$data(),e)})`)}error(e,t,r){if(t){this.setParams(t),this._error(e,r),this.setParams({});return}this._error(e,r)}_error(e,t){(e?Qn.reportExtraError:Qn.reportError)(this,this.def.error,t)}$dataError(){Qn.reportError(this,this.def.$dataError||Qn.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');Qn.resetErrorsCount(this.gen,this.errsCount)}ok(e){if(!this.allErrors)this.gen.if(e)}setParams(e,t){if(t)Object.assign(this.params,e);else this.params=e}block$data(e,t,r=C.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=C.nil,t=C.nil){if(!this.$data)return;let{gen:r,schemaCode:n,schemaType:o,def:s}=this;if(r.if(C.or(C._`${n} === undefined`,t)),e!==C.nil)r.assign(e,!0);if(o.length||s.validateSchema){if(r.elseIf(this.invalid$data()),this.$dataError(),e!==C.nil)r.assign(e,!1)}r.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:r,def:n,it:o}=this;return C.or(s(),i());function s(){if(r.length){if(!(t instanceof C.Name))throw Error("ajv implementation error");let a=Array.isArray(r)?r:[r];return C._`${Ws.checkDataTypes(a,t,o.opts.strictNumbers,Ws.DataType.Wrong)}`}return C.nil}function i(){if(n.validateSchema){let a=e.scopeValue("validate$data",{ref:n.validateSchema});return C._`!${a}(${t})`}return C.nil}}subschema(e,t){let r=al.getSubschema(this.it,e);al.extendSubschemaData(r,this.it,e),al.extendSubschemaMode(r,e);let n={...this.it,...r,items:void 0,props:void 0};return dP(n,t),n}mergeEvaluated(e,t){let{it:r,gen:n}=this;if(!r.opts.unevaluated)return;if(r.props!==!0&&e.props!==void 0)r.props=Pt.mergeEvaluated.props(n,e.props,r.props,t);if(r.items!==!0&&e.items!==void 0)r.items=Pt.mergeEvaluated.items(n,e.items,r.items,t)}mergeValidEvaluated(e,t){let{it:r,gen:n}=this;if(r.opts.unevaluated&&(r.props!==!0||r.items!==!0))return n.if(t,()=>this.mergeEvaluated(e,C.Name)),!0}}E_.KeywordCxt=ul;function P_(e,t,r,n){let o=new ul(e,r,t);if("code"in r)r.code(o,n);else if(o.$data&&r.validate)Yn.funcKeywordCode(o,r);else if("macro"in r)Yn.macroKeywordCode(o,r);else if(r.compile||r.validate)Yn.funcKeywordCode(o,r)}var SP=/^\/(?:[^~]|~0|~1)*$/,zP=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function T_(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let o,s;if(e==="")return M.default.rootData;if(e[0]==="/"){if(!SP.test(e))throw Error(`Invalid JSON-pointer: ${e}`);o=e,s=M.default.rootData}else{let u=zP.exec(e);if(!u)throw Error(`Invalid JSON-pointer: ${e}`);let l=+u[1];if(o=u[2],o==="#"){if(l>=t)throw Error(c("property/index",l));return n[t-l]}if(l>t)throw Error(c("data",l));if(s=r[t-l],!o)return s}let i=s,a=o.split("/");for(let u of a)if(u)s=C._`${s}${C.getProperty(Pt.unescapeJsonPointer(u))}`,i=C._`${i} && ${s}`;return i;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${t}`}}E_.getData=T_});var Xs=k(function(I_){Object.defineProperty(I_,"__esModule",{value:!0});class R_ extends Error{constructor(e){super("validation failed");this.errors=e,this.ajv=this.validation=!0}}I_.default=R_});var to=k(function(A_){Object.defineProperty(A_,"__esModule",{value:!0});var ll=Xn();class C_ extends Error{constructor(e,t,r,n){super(n||`can't resolve reference ${r} from id ${t}`);this.missingRef=ll.resolveUrl(e,t,r),this.missingSchema=ll.normalizeId(ll.getFullPath(e,this.missingRef))}}A_.default=C_});var Qs=k(function(Z_){Object.defineProperty(Z_,"__esModule",{value:!0});Z_.resolveSchema=Z_.getCompilingSchema=Z_.resolveRef=Z_.compileSchema=Z_.SchemaEnv=void 0;var ot=L(),RP=Xs(),ar=zt(),st=Xn(),N_=W(),IP=eo();class ro{constructor(e){var t;this.refs={},this.dynamicAnchors={};let r;if(typeof e.schema=="object")r=e.schema;this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(t=e.baseId)!==null&&t!==void 0?t:st.normalizeId(r===null||r===void 0?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=r===null||r===void 0?void 0:r.$async,this.refs={}}}Z_.SchemaEnv=ro;function pl(e){let t=j_.call(this,e);if(t)return t;let r=st.getFullPath(this.opts.uriResolver,e.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:s}=this.opts,i=new ot.CodeGen(this.scope,{es5:n,lines:o,ownProperties:s}),a;if(e.$async)a=i.scopeValue("Error",{ref:RP.default,code:ot._`require("ajv/dist/runtime/validation_error").default`});let c=i.scopeName("validate");e.validateName=c;let u={gen:i,allErrors:this.opts.allErrors,data:ar.default.data,parentData:ar.default.parentData,parentDataProperty:ar.default.parentDataProperty,dataNames:[ar.default.data],dataPathArr:[ot.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:ot.stringify(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:ot.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:ot._`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),IP.validateFunctionCode(u),i.optimize(this.opts.code.optimize);let d=i.toString();if(l=`${i.scopeRefs(ar.default.scope)}return ${d}`,this.opts.code.process)l=this.opts.code.process(l,e);let p=Function(`${ar.default.self}`,`${ar.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;if(this.opts.code.source===!0)p.source={validateName:c,validateCode:d,scopeValues:i._values};if(this.opts.unevaluated){let{props:m,items:h}=u;if(p.evaluated={props:m instanceof ot.Name?void 0:m,items:h instanceof ot.Name?void 0:h,dynamicProps:m instanceof ot.Name,dynamicItems:h instanceof ot.Name},p.source)p.source.evaluated=ot.stringify(p.evaluated)}return e.validate=p,e}catch(d){if(delete e.validate,delete e.validateName,l)this.logger.error("Error compiling schema, function code:",l);throw d}finally{this._compilations.delete(e)}}Z_.compileSchema=pl;function CP(e,t,r){var n;r=st.resolveUrl(this.opts.uriResolver,t,r);let o=e.refs[r];if(o)return o;let s=jP.call(this,e,r);if(s===void 0){let i=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;if(i)s=new ro({schema:i,schemaId:a,root:e,baseId:t})}if(s===void 0)return;return e.refs[r]=AP.call(this,s)}Z_.resolveRef=CP;function AP(e){if(st.inlineRef(e.schema,this.opts.inlineRefs))return e.schema;return e.validate?e:pl.call(this,e)}function j_(e){for(let t of this._compilations)if(NP(t,e))return t}Z_.getCompilingSchema=j_;function NP(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function jP(e,t){let r;while(typeof(r=this.refs[t])=="string")t=r;return r||this.schemas[t]||Ys.call(this,e,t)}function Ys(e,t){let r=this.opts.uriResolver.parse(t),n=st._getFullPath(this.opts.uriResolver,r),o=st.getFullPath(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===o)return dl.call(this,r,e);let s=st.normalizeId(n),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=Ys.call(this,e,i);if(typeof(a===null||a===void 0?void 0:a.schema)!=="object")return;return dl.call(this,r,a)}if(typeof(i===null||i===void 0?void 0:i.schema)!=="object")return;if(!i.validate)pl.call(this,i);if(s===st.normalizeId(t)){let{schema:a}=i,{schemaId:c}=this.opts,u=a[c];if(u)o=st.resolveUrl(this.opts.uriResolver,o,u);return new ro({schema:a,schemaId:c,root:e,baseId:o})}return dl.call(this,r,i)}Z_.resolveSchema=Ys;var ZP=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function dl(e,{baseId:t,schema:r,root:n}){var o;if(((o=e.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if(typeof r==="boolean")return;let c=r[N_.unescapeFragment(a)];if(c===void 0)return;r=c;let u=typeof r==="object"&&r[this.opts.schemaId];if(!ZP.has(a)&&u)t=st.resolveUrl(this.opts.uriResolver,t,u)}let s;if(typeof r!="boolean"&&r.$ref&&!N_.schemaHasRulesButRef(r,this.RULES)){let a=st.resolveUrl(this.opts.uriResolver,t,r.$ref);s=Ys.call(this,n,a)}let{schemaId:i}=this.opts;if(s=s||new ro({schema:r,schemaId:i,root:n,baseId:t}),s.schema!==s.root.schema)return s;return}});var D_=k(function(HD,FP){FP.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 yl=k(function(BD,B_){var UP=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),ml=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),VP=RegExp.prototype.test.bind(/^\d*$/u),cr=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),hl=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),L_=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),gl=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),HP=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),Ze=Array(256);for(let t=0;t<256;t++)Ze[t]="%"+"0123456789ABCDEF"[t>>4]+"0123456789ABCDEF"[t&15];function ke(e){if(e<2048)return Ze[192|e>>6]+Ze[128|e&63];if(e<65536)return Ze[224|e>>12]+Ze[128|e>>6&63]+Ze[128|e&63];return Ze[240|e>>18]+Ze[128|e>>12&63]+Ze[128|e>>6&63]+Ze[128|e&63]}function BP(e){let t="",r=0,n=0;for(n=0;n<e.length;n++){if(r=e[n].charCodeAt(0),r===48)continue;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 JP=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),KP=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),GP=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),WP=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function XP(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++){if(GP(e[t]))continue;if(e[t]==="%"&&t+2<e.length&&cr(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function q_(e){let t=-1,r=0,n=-1,o=0;for(let a=0;a<e.length;a++)if(e[a]==="0"){if(n===-1)n=a;if(o++,o>r)r=o,t=n}else n=-1,o=0;if(r<2)return e.join(":");let s=e.slice(0,t).join(":"),i=e.slice(t+r).join(":");return s+"::"+i}function YP(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(":");if(t!==-1){if(r.length===1&&r[0]==="")r.length=0;if(n.length===1&&n[0]==="")n.length=0}let o=r.concat(n),s=0;for(let a=0;a<o.length;a++){let c=o[a];if(c==="")return;if(c.indexOf(".")!==-1){if(a!==o.length-1||t!==-1&&n.length===0||!ml(c))return;s+=2;continue}if(!JP(c))return;o[a]=parseInt(c,16).toString(16),s++}if(t===-1){if(s!==8)return;return q_(o)}if(s>=8)return;let i=o.slice(0,r.length);for(let a=s;a<8;a++)i.push("0");for(let a=r.length;a<o.length;a++)i.push(o[a]);return q_(i)}function fl(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&&KP(n))return n=n.toLowerCase(),{host:`[${n}]`,escapedHost:n,isIPV6:!1,isIPVFuture:!0};if(QP(n,":")<2)return{host:e,isIPV6:!1,error:t};let o="",s=n.indexOf("%");if(s!==-1){let a=n.slice(s,s+3).toLowerCase()==="%25"?3:1;if(o=n.slice(s+a),!XP(o))return{host:e,isIPV6:!1,error:!0};n=n.slice(0,s)}let i=YP(n);if(i===void 0)return{host:e,isIPV6:!1,error:!0};return{host:i+(o?"%"+o:""),escapedHost:i+(o?"%25"+o:""),isIPV6:!0}}function QP(e,t){let r=0;for(let n=0;n<e.length;n++)if(e[n]===t)r++;return r}function eT(e){let t=e,r=[],n=-1,o=0;while(o=t.length){if(o===1)if(t===".")break;else if(t==="/"){r.push("/");break}else{r.push(t);break}else if(o===2){if(t[0]==="."){if(t[1]===".")break;else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."||t[1]==="/"){r.push("/");break}}}else if(o===3){if(t==="/.."){if(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]==="/"){if(t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."){if(t[3]==="/"){if(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 tT={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},rT=/[@/?#:]/g,nT=/[@/?#]/g;function F_(e,t){let r=t?nT:rT;return r.lastIndex=0,e.replace(r,(n)=>tT[n])}function U_(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(cr(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));if(t&&hl(i))r+=i;else r+="%"+s;n+=2;continue}}r+=e[n]}return r}function oT(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(cr(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));if(i!=="."&&hl(i))t+=i;else t+="%"+s;r+=2;continue}}if(L_(n))t+=n;else{let o=e.charCodeAt(r);if(o<128)t+=H_(o)?n:Ze[o];else if(o<55296||o>57343)t+=ke(o);else if(o<=56319&&r+1<e.length){let s=e.charCodeAt(r+1);if(s>=56320&&s<=57343)t+=ke(65536+(o-55296<<10)+(s-56320)),r++;else t+=ke(65533)}else t+=ke(65533)}}return t}function sT(e,t=!1){let r="",n=t&&e[0]!=="/";for(let o=0;o<e.length;o++){let s=e[o];if(s==="%"&&o+2<e.length){let i=e.slice(o+1,o+3);if(cr(i)){r+="%"+i.toUpperCase(),o+=2;continue}}if(s==="/")n=!1;if(L_(s)&&(s!==":"||!n))r+=s;else{let i=e.charCodeAt(o);if(i<128)r+=Ze[i];else if(i<55296||i>57343)r+=ke(i);else if(i<=56319&&o+1<e.length){let a=e.charCodeAt(o+1);if(a>=56320&&a<=57343)r+=ke(65536+(i-55296<<10)+(a-56320)),o++;else r+=ke(65533)}else r+=ke(65533)}}return r}function _l(e,t){let r="";for(let n=0;n<e.length;n++){let o=e[n];if(o==="%"&&n+2<e.length){let s=e.slice(n+1,n+3);if(cr(s)){r+="%"+s.toUpperCase(),n+=2;continue}}if(t(o))r+=o;else{let s=e.charCodeAt(n);if(s<128)r+=Ze[s];else if(s<55296||s>57343)r+=ke(s);else if(s<=56319&&n+1<e.length){let i=e.charCodeAt(n+1);if(i>=56320&&i<=57343)r+=ke(65536+(s-55296<<10)+(i-56320)),n++;else r+=ke(65533)}else r+=ke(65533)}}return r}function V_(e){return _l(e,HP)}function iT(e){return _l(e,gl)}function aT(e){return _l(e,gl)}function H_(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 cT(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(cr(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));if(hl(i))t+=i;else t+="%"+s;r+=2;continue}}if(gl(n))t+=n;else{let o=e.charCodeAt(r);if(o<128)t+=H_(o)?n:Ze[o];else if(o<55296||o>57343)t+=ke(o);else if(o<=56319&&r+1<e.length){let s=e.charCodeAt(r+1);if(s>=56320&&s<=57343)t+=ke(65536+(o-55296<<10)+(s-56320)),r++;else t+=ke(65533)}else t+=ke(65533)}}return t}function uT(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let n=e.slice(r+1,r+3);if(cr(n)){t+="%"+n.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function lT(e){let t=[];if(e.userinfo!==void 0)t.push(V_(e.userinfo)),t.push("@");if(e.host!==void 0){let r=e.host;if(!ml(r)){let n=fl(r);if(n.isIPV6!==!0&&n.isIPVFuture!==!0)r=U_(r,!0),n=fl(r);if(n.isIPV6===!0||n.isIPVFuture===!0)r=`[${n.escapedHost}]`;else r=F_(r,!1)}t.push(r)}if(typeof e.port==="number"||typeof e.port==="string"){let r=String(e.port);if(!VP(r))throw TypeError("URI port is malformed.");t.push(":"),t.push(r)}return t.length?t.join(""):void 0}B_.exports={nonSimpleDomain:WP,recomposeAuthority:lT,reescapeHostDelimiters:F_,normalizePercentEncoding:U_,normalizePathEncoding:oT,serializePathEncoding:sT,normalizeQueryFragmentEncoding:cT,encodeUserinfo:V_,encodeQuery:iT,encodeFragment:aT,escapePreservingEscapes:uT,removeDotSegments:eT,isIPv4:ml,isUUID:UP,normalizeIPv6:fl,stringArrayToHexStripped:BP}});var X_=k(function(JD,W_){var{isUUID:dT}=yl(),pT=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,fT=["http","https","ws","wss","urn","urn:uuid"];function mT(e){return fT.indexOf(e)!==-1}function vl(e){if(e.secure===!0)return!0;else if(e.secure===!1)return!1;else if(e.scheme)return 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");else return!1}function J_(e){if(!e.host)e.error=e.error||"HTTP URIs must have a host.";return e}function K_(e){let t=String(e.scheme).toLowerCase()==="https";if(e.port===(t?443:80)||e.port==="")e.port=void 0;if(!e.path)e.path="/";return e}function hT(e){return e.secure=vl(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function gT(e){if(e.port===(vl(e)?443:80)||e.port==="")e.port=void 0;if(typeof e.secure==="boolean")e.scheme=e.secure?"wss":"ws",e.secure=void 0;if(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 _T(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(pT);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}`,s=xl(o);if(e.path=void 0,s)e=s.parse(e,t)}else e.error=e.error||"URN can not be parsed.";return e}function yT(e,t){if(e.nid===void 0)throw Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",n=e.nid.toLowerCase(),o=`${r}:${t.nid||n}`,s=xl(o);if(s)e=s.serialize(e,t);let i=e,a=e.nss;return i.path=`${n||t.nid}:${a}`,t.skipEscape=!0,i}function vT(e,t){let r=e;if(r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!dT(r.uuid)))r.error=r.error||"UUID is not valid.";return r}function xT(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var G_={scheme:"http",domainHost:!0,parse:J_,serialize:K_},bT={scheme:"https",domainHost:G_.domainHost,parse:J_,serialize:K_},ei={scheme:"ws",domainHost:!0,parse:hT,serialize:gT},$T={scheme:"wss",domainHost:ei.domainHost,parse:ei.parse,serialize:ei.serialize},wT={scheme:"urn",parse:_T,serialize:yT,skipNormalize:!0},kT={scheme:"urn:uuid",parse:vT,serialize:xT,skipNormalize:!0},ti={http:G_,https:bT,ws:ei,wss:$T,urn:wT,"urn:uuid":kT};Object.setPrototypeOf(ti,null);function xl(e){return e&&(ti[e]||ti[e.toLowerCase()])||void 0}W_.exports={wsIsSecure:vl,SCHEMES:ti,isValidSchemeName:mT,getSchemeHandler:xl}});var uy=k(function(KD,oi){var{normalizeIPv6:ry,removeDotSegments:oo,recomposeAuthority:ST,normalizePercentEncoding:bl,normalizePathEncoding:zT,serializePathEncoding:Y_,normalizeQueryFragmentEncoding:Q_,encodeQuery:PT,encodeFragment:TT,reescapeHostDelimiters:ET,isIPv4:ny,nonSimpleDomain:OT}=yl(),{SCHEMES:oy,getSchemeHandler:$l}=X_(),sy=/^[A-Za-z][A-Za-z0-9+.-]*$/u;function ey(e){let t=unescape(String(e));if(!sy.test(t))throw TypeError("URI scheme is malformed.");return t}function RT(e,t){if(typeof e==="string")e=DT(e,t);else if(typeof e==="object")e=ni(ur(e,t),t);return e}function IT(e,t,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},{parsed:o,malformedAuthorityOrPort:s,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:c,malformedScheme:u}=ri(e,n),{parsed:l,malformedAuthorityOrPort:d,malformedPercentEncoding:f,malformedSchemeSpecific:p,malformedHost:m,malformedScheme:h}=ri(t,n);if(s||d||i||f||a||p||c||m||u||h)throw Error(o.error||l.error||"URI is malformed.");let _=iy(o,l,n,!0),v=$l(r&&r.scheme||_.scheme),z=_.host,A=z!==void 0&&z!==""&&(ny(z)||ry(z).isIPV6);ay(_,r||{},v,A);let K=z&&z.indexOf("%")!==-1&&!/\P{ASCII}/u.test(z);if(_.error&&!K)throw Error(_.error);return n.skipEscape=!0,ur(_,n)}function iy(e,t,r,n){let o={};if(!n)e=ni(ur(e,r),r),t=ni(ur(t,r),r);if(r=r||{},!r.tolerant&&t.scheme)o.scheme=t.scheme,o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=oo(t.path||""),o.query=t.query;else{if(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=oo(t.path||""),o.query=t.query;else{if(!t.path)if(o.path=e.path,t.query!==void 0)o.query=t.query;else o.query=e.query;else{if(t.path[0]==="/")o.path=oo(t.path);else{if((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path)o.path="/"+t.path;else if(!e.path)o.path=t.path;else o.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path;o.path=oo(o.path)}o.query=t.query}o.userinfo=e.userinfo,o.host=e.host,o.port=e.port}o.scheme=e.scheme}return o.fragment=t.fragment,o}function CT(e,t,r){let n=ty(e,r),o=ty(t,r);return n!==void 0&&o!==void 0&&n===o}function ur(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,error:""},n=Object.assign({},t),o=[];if(r.scheme)r.scheme=ey(r.scheme);let s=$l(n.scheme||r.scheme);if(s&&s.serialize)s.serialize(r,n);let i=r.userinfo!==void 0||r.host!==void 0||r.port!==void 0,a=!n.skipEscape&&r.scheme===void 0&&!i;if(r.path!==void 0)if(!n.skipEscape)r.path=Y_(r.path,a);else r.path=bl(r.path);if(n.reference!=="suffix"&&r.scheme)r.scheme=ey(r.scheme),o.push(r.scheme,":");let c=ST(r);if(c!==void 0){if(n.reference!=="suffix")o.push("//");if(o.push(c),r.path&&r.path[0]!=="/")o.push("/")}if(r.path!==void 0){let u=r.path;if(!n.absolutePath&&(!s||!s.absolutePath))u=oo(u);if(a)u=Y_(u,!0);if(c===void 0&&u[0]==="/"&&u[1]==="/")u="/%2F"+u.slice(2);o.push(u)}if(r.query!==void 0)o.push("?",PT(r.query));if(r.fragment!==void 0)o.push("#",TT(r.fragment));return o.join("")}var AT=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,NT=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,jT=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function ZT(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.";return}function no(e){if(e===void 0)return!1;let t=e.indexOf("%");while(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 wl(e){return e[0]==="["&&e[e.length-1]==="]"}function MT(e){let t=e[4];return no(e[3])||t!==void 0&&!wl(t)&&no(t)||no(e[6])||no(e[7])||no(e[8])}function ay(e,t,r,n){if(!t.unicodeSupport&&(!r||!r.unicodeSupport)&&e.host&&!wl(e.host)&&(t.domainHost||r&&r.domainHost)&&n===!1&&OT(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 ri(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,s=!1,i=!1,a=!1,c=!1,u=!1,l=!1;if(r.reference==="suffix")if(r.scheme)e=r.scheme+":"+e;else e="//"+e;let d=e.match(NT);if(d!==null&&d[1].indexOf("\\")!==-1)n.error="URI authority must not contain a literal backslash.",o=!0;let f=e.match(jT);if(f!==null){let m=f[1],h=m.replace(/[\t\n\r]/g,"");if(h.length>=2){if(h.slice(0,2)!=="//")n.error=n.error||"URI authority must not contain a literal backslash.",o=!0;else if(m.length!==h.length)n.error=n.error||"URI authority introducer must not contain whitespace.",o=!0}}let p=e.match(AT);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 _=unescape(n.scheme);if(sy.test(_))n.scheme=_.toLowerCase();else n.error=n.error||"URI scheme is malformed.",u=!0}if(s=MT(p),s)n.error=n.error||"URI contains malformed percent-encoding.";if(isNaN(n.port))n.port=p[5];let m=ZT(n,p);if(m!==void 0)n.error=n.error||m,o=!0;if(n.host)if(ny(n.host)===!1){let v=wl(n.host),z=n.host.indexOf("[")!==-1||n.host.indexOf("]")!==-1,A=ry(n.host);if(l=A.isIPV6||A.isIPVFuture===!0,c=z&&(!v||A.error===!0),n.host=l?A.host:A.host.toLowerCase(),c)n.error=n.error||"URI host is malformed.",o=!0}else l=!0;if(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";else if(n.scheme===void 0)n.reference="relative";else if(n.fragment===void 0)n.reference="absolute";else n.reference="uri";if(r.reference&&r.reference!=="suffix"&&r.reference!==n.reference)n.error=n.error||"URI is not a "+r.reference+" reference.";let h=$l(r.scheme||n.scheme);if(!c)a=ay(n,r,h,l);if(e.indexOf("%")!==-1&&n.host!==void 0&&!c){let _=l?n.host:bl(n.host,!0);if(!l)_=bl(_.toLowerCase());n.host=ET(_,l)}if(!h||h&&!h.skipNormalize){if(n.path)n.path=zT(n.path);if(n.query)n.query=Q_(n.query);if(n.fragment)n.fragment=Q_(n.fragment)}if(h&&h.parse){if(h.parse(n,r),h===oy.urn&&n.nid===void 0)i=!0}}else n.error=n.error||"URI can not be parsed.";return{parsed:n,malformedAuthorityOrPort:o,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:u}}function ni(e,t){return ri(e,t).parsed}function DT(e,t){return cy(e,t).normalized}function cy(e,t){let{parsed:r,malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:s,malformedHost:i,malformedScheme:a}=ri(e,t);return{normalized:n||o||s||i||a?e:ur(r,t),malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:s,malformedHost:i,malformedScheme:a}}function ty(e,t){if(typeof e!=="string"&&typeof e!=="object")return;let r;try{r=typeof e==="string"?e:ur(e,t)}catch{return}let{normalized:n,malformedAuthorityOrPort:o,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:c}=cy(r,t);return o||s||i||a||c?void 0:n}var kl={SCHEMES:oy,normalize:RT,resolve:IT,resolveComponent:iy,equal:CT,serialize:ur,parse:ni};oi.exports=kl;oi.exports.default=kl;oi.exports.fastUri=kl});var py=k(function(dy){Object.defineProperty(dy,"__esModule",{value:!0});var ly=uy();ly.code='require("ajv/dist/runtime/uri").default';dy.default=ly});var xy=k(function(Tt){Object.defineProperty(Tt,"__esModule",{value:!0});Tt.CodeGen=Tt.Name=Tt.nil=Tt.stringify=Tt.str=Tt._=Tt.KeywordCxt=void 0;var LT=eo();Object.defineProperty(Tt,"KeywordCxt",{enumerable:!0,get:function(){return LT.KeywordCxt}});var Dr=L();Object.defineProperty(Tt,"_",{enumerable:!0,get:function(){return Dr._}});Object.defineProperty(Tt,"str",{enumerable:!0,get:function(){return Dr.str}});Object.defineProperty(Tt,"stringify",{enumerable:!0,get:function(){return Dr.stringify}});Object.defineProperty(Tt,"nil",{enumerable:!0,get:function(){return Dr.nil}});Object.defineProperty(Tt,"Name",{enumerable:!0,get:function(){return Dr.Name}});Object.defineProperty(Tt,"CodeGen",{enumerable:!0,get:function(){return Dr.CodeGen}});var FT=Xs(),_y=to(),UT=Wu(),io=Qs(),VT=L(),so=Xn(),si=Wn(),zl=W(),fy=D_(),HT=py(),yy=(e,t)=>new RegExp(e,t);yy.code="new RegExp";var BT=["removeAdditional","useDefaults","coerceTypes"],JT=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),KT={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."},GT={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},my=200;function WT(e){var t,r,n,o,s,i,a,c,u,l,d,f,p,m,h,_,v,z,A,K,E,V,me,Jt,fr;let yt=e.strict,mr=(t=e.code)===null||t===void 0?void 0:t.optimize,yo=mr===!0||mr===void 0?1:mr||0,vo=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:yy,Yx=(o=e.uriResolver)!==null&&o!==void 0?o:HT.default;return{strictSchema:(i=(s=e.strictSchema)!==null&&s!==void 0?s:yt)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=e.strictNumbers)!==null&&a!==void 0?a:yt)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=e.strictTypes)!==null&&u!==void 0?u:yt)!==null&&l!==void 0?l:"log",strictTuples:(f=(d=e.strictTuples)!==null&&d!==void 0?d:yt)!==null&&f!==void 0?f:"log",strictRequired:(m=(p=e.strictRequired)!==null&&p!==void 0?p:yt)!==null&&m!==void 0?m:!1,code:e.code?{...e.code,optimize:yo,regExp:vo}:{optimize:yo,regExp:vo},loopRequired:(h=e.loopRequired)!==null&&h!==void 0?h:my,loopEnum:(_=e.loopEnum)!==null&&_!==void 0?_:my,meta:(v=e.meta)!==null&&v!==void 0?v:!0,messages:(z=e.messages)!==null&&z!==void 0?z:!0,inlineRefs:(A=e.inlineRefs)!==null&&A!==void 0?A:!0,schemaId:(K=e.schemaId)!==null&&K!==void 0?K:"$id",addUsedSchema:(E=e.addUsedSchema)!==null&&E!==void 0?E:!0,validateSchema:(V=e.validateSchema)!==null&&V!==void 0?V:!0,validateFormats:(me=e.validateFormats)!==null&&me!==void 0?me:!0,unicodeRegExp:(Jt=e.unicodeRegExp)!==null&&Jt!==void 0?Jt:!0,int32range:(fr=e.int32range)!==null&&fr!==void 0?fr:!0,uriResolver:Yx}}class ii{constructor(e={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...WT(e)};let{es5:t,lines:r}=this.opts.code;this.scope=new VT.ValueScope({scope:{},prefixes:JT,es5:t,lines:r}),this.logger=rE(e.logger);let n=e.validateFormats;if(e.validateFormats=!1,this.RULES=UT.getRules(),hy.call(this,KT,e,"NOT SUPPORTED"),hy.call(this,GT,e,"DEPRECATED","warn"),this._metaOpts=eE.call(this),e.formats)YT.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords)QT.call(this,e.keywords);if(typeof e.meta=="object")this.addMetaSchema(e.meta);XT.call(this),e.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:r}=this.opts,n=fy;if(r==="id")n={...fy},n.id=n.$id,delete n.$id;if(t&&e)this.addMetaSchema(n,n[r],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[t]||e:void 0}validate(e,t){let r;if(typeof e=="string"){if(r=this.getSchema(e),!r)throw Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);let n=r(t);if(!("$async"in r))this.errors=r.errors;return n}compile(e,t){let r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:r}=this.opts;return n.call(this,e,t);async function n(u,l){await o.call(this,u.$schema);let d=this._addSchema(u,l);return d.validate||s.call(this,d)}async function o(u){if(u&&!this.getSchema(u))await n.call(this,{$ref:u},!0)}async function s(u){try{return this._compileSchemaEnv(u)}catch(l){if(!(l instanceof _y.default))throw l;return i.call(this,l),await a.call(this,l.missingSchema),s.call(this,u)}}function i({missingSchema:u,missingRef:l}){if(this.refs[u])throw Error(`AnySchema ${u} is loaded but ${l} cannot be resolved`)}async function a(u){let l=await c.call(this,u);if(!this.refs[u])await o.call(this,l.$schema);if(!this.refs[u])this.addSchema(l,u,t)}async function c(u){let l=this._loading[u];if(l)return l;try{return await(this._loading[u]=r(u))}finally{delete this._loading[u]}}}addSchema(e,t,r,n=this.opts.validateSchema){if(Array.isArray(e)){for(let s of e)this.addSchema(s,void 0,r,n);return this}let o;if(typeof e==="object"){let{schemaId:s}=this.opts;if(o=e[s],o!==void 0&&typeof o!="string")throw Error(`schema ${s} must be string`)}return t=so.normalizeId(t||o),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,n,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){if(typeof e=="boolean")return!0;let r;if(r=e.$schema,r!==void 0&&typeof r!="string")throw Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let n=this.validate(r,e);if(!n&&t){let o="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(o);else throw Error(o)}return n}getSchema(e){let t;while(typeof(t=gy.call(this,e))=="string")e=t;if(t===void 0){let{schemaId:r}=this.opts,n=new io.SchemaEnv({schema:{},schemaId:r});if(t=io.resolveSchema.call(this,n,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let t=gy.call(this,e);if(typeof t=="object")this._cache.delete(t.schema);return delete this.schemas[e],delete this.refs[e],this}case"object":{let t=e;this._cache.delete(t);let r=e[this.opts.schemaId];if(r)r=so.normalizeId(r),delete this.schemas[r],delete this.refs[r];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if(typeof e=="string"){if(r=e,typeof t=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r}else if(typeof e=="object"&&t===void 0){if(t=e,r=t.keyword,Array.isArray(r)&&!r.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(oE.call(this,r,t),!t)return zl.eachItem(r,(o)=>Sl.call(this,o)),this;iE.call(this,t);let n={...t,type:si.getJSONTypes(t.type),schemaType:si.getJSONTypes(t.schemaType)};return zl.eachItem(r,n.type.length===0?(o)=>Sl.call(this,o,n):(o)=>n.type.forEach((s)=>Sl.call(this,o,n,s))),this}getKeyword(e){let t=this.RULES.all[e];return typeof t=="object"?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(let r of t.rules){let n=r.rules.findIndex((o)=>o.keyword===e);if(n>=0)r.rules.splice(n,1)}return this}addFormat(e,t){if(typeof t=="string")t=new RegExp(t);return this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){if(!e||e.length===0)return"No errors";return e.map((n)=>`${r}${n.instancePath} ${n.message}`).reduce((n,o)=>n+t+o)}$dataMetaSchema(e,t){let r=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let n of t){let o=n.split("/").slice(1),s=e;for(let i of o)s=s[i];for(let i in r){let a=r[i];if(typeof a!="object")continue;let{$data:c}=a.definition,u=s[i];if(c&&u)s[i]=vy(u)}}return e}_removeAllSchemas(e,t){for(let r in e){let n=e[r];if(!t||t.test(r)){if(typeof n=="string")delete e[r];else if(n&&!n.meta)this._cache.delete(n.schema),delete e[r]}}}_addSchema(e,t,r,n=this.opts.validateSchema,o=this.opts.addUsedSchema){let s,{schemaId:i}=this.opts;if(typeof e=="object")s=e[i];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof e!="boolean")throw Error("schema must be object or boolean");let a=this._cache.get(e);if(a!==void 0)return a;r=so.normalizeId(s||r);let c=so.getSchemaRefs.call(this,e,r);if(a=new io.SchemaEnv({schema:e,schemaId:i,meta:t,baseId:r,localRefs:c}),this._cache.set(a.schema,a),o&&!r.startsWith("#")){if(r)this._checkUnique(r);this.refs[r]=a}if(n)this.validateSchema(e,!0);return a}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta)this._compileMetaSchema(e);else io.compileSchema.call(this,e);if(!e.validate)throw Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{io.compileSchema.call(this,e)}finally{this.opts=t}}}ii.ValidationError=FT.default;ii.MissingRefError=_y.default;Tt.default=ii;function hy(e,t,r,n="error"){for(let o in e){let s=o;if(s in t)this.logger[n](`${r}: option ${o}. ${e[s]}`)}}function gy(e){return e=so.normalizeId(e),this.schemas[e]||this.refs[e]}function XT(){let e=this.opts.schemas;if(!e)return;if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function YT(){for(let e in this.opts.formats){let t=this.opts.formats[e];if(t)this.addFormat(e,t)}}function QT(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];if(!r.keyword)r.keyword=t;this.addKeyword(r)}}function eE(){let e={...this.opts};for(let t of BT)delete e[t];return e}var tE={log(){},warn(){},error(){}};function rE(e){if(e===!1)return tE;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw Error("logger must implement log, warn and error methods")}var nE=/^[a-z_$][a-z0-9_$:-]*$/i;function oE(e,t){let{RULES:r}=this;if(zl.eachItem(e,(n)=>{if(r.keywords[n])throw Error(`Keyword ${n} is already defined`);if(!nE.test(n))throw Error(`Keyword ${n} has invalid name`)}),!t)return;if(t.$data&&!(("code"in t)||("validate"in t)))throw Error('$data keyword must have "code" or "validate" function')}function Sl(e,t,r){var n;let o=t===null||t===void 0?void 0:t.post;if(r&&o)throw Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,i=o?s.post:s.rules.find(({type:c})=>c===r);if(!i)i={type:r,rules:[]},s.rules.push(i);if(s.keywords[e]=!0,!t)return;let a={keyword:e,definition:{...t,type:si.getJSONTypes(t.type),schemaType:si.getJSONTypes(t.schemaType)}};if(t.before)sE.call(this,i,a,t.before);else i.rules.push(a);s.all[e]=a,(n=t.implements)===null||n===void 0||n.forEach((c)=>this.addKeyword(c))}function sE(e,t,r){let n=e.rules.findIndex((o)=>o.keyword===r);if(n>=0)e.rules.splice(n,0,t);else e.rules.push(t),this.logger.warn(`rule ${r} is not defined`)}function iE(e){let{metaSchema:t}=e;if(t===void 0)return;if(e.$data&&this.opts.$data)t=vy(t);e.validateSchema=this.compile(t,!0)}var aE={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function vy(e){return{anyOf:[e,aE]}}});var $y=k(function(by){Object.defineProperty(by,"__esModule",{value:!0});var lE={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};by.default=lE});var Ty=k(function(zy){Object.defineProperty(zy,"__esModule",{value:!0});zy.callRef=zy.getValidate=void 0;var pE=to(),wy=Ge(),Me=L(),qr=zt(),ky=Qs(),ai=W(),fE={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:n}=e,{baseId:o,schemaEnv:s,validateName:i,opts:a,self:c}=n,{root:u}=s;if((r==="#"||r==="#/")&&o===u.baseId)return d();let l=ky.resolveRef.call(c,u,o,r);if(l===void 0)throw new pE.default(n.opts.uriResolver,o,r);if(l instanceof ky.SchemaEnv)return f(l);return p(l);function d(){if(s===u)return ci(e,i,s,s.$async);let m=t.scopeValue("root",{ref:u});return ci(e,Me._`${m}.validate`,u,u.$async)}function f(m){let h=Sy(e,m);ci(e,h,m,m.$async)}function p(m){let h=t.scopeValue("schema",a.code.source===!0?{ref:m,code:Me.stringify(m)}:{ref:m}),_=t.name("valid"),v=e.subschema({schema:m,dataTypes:[],schemaPath:Me.nil,topSchemaRef:h,errSchemaPath:r},_);e.mergeEvaluated(v),e.ok(_)}}};function Sy(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):Me._`${r.scopeValue("wrapper",{ref:t})}.validate`}zy.getValidate=Sy;function ci(e,t,r,n){let{gen:o,it:s}=e,{allErrors:i,schemaEnv:a,opts:c}=s,u=c.passContext?qr.default.this:Me.nil;if(n)l();else d();function l(){if(!a.$async)throw Error("async schema referenced by sync schema");let m=o.let("valid");o.try(()=>{if(o.code(Me._`await ${wy.callValidateCode(e,t,u)}`),p(t),!i)o.assign(m,!0)},(h)=>{if(o.if(Me._`!(${h} instanceof ${s.ValidationError})`,()=>o.throw(h)),f(h),!i)o.assign(m,!1)}),e.ok(m)}function d(){e.result(wy.callValidateCode(e,t,u),()=>p(t),()=>f(t))}function f(m){let h=Me._`${m}.errors`;o.assign(qr.default.vErrors,Me._`${qr.default.vErrors} === null ? ${h} : ${qr.default.vErrors}.concat(${h})`),o.assign(qr.default.errors,Me._`${qr.default.vErrors}.length`)}function p(m){var h;if(!s.opts.unevaluated)return;let _=(h=r===null||r===void 0?void 0:r.validate)===null||h===void 0?void 0:h.evaluated;if(s.props!==!0)if(_&&!_.dynamicProps){if(_.props!==void 0)s.props=ai.mergeEvaluated.props(o,_.props,s.props)}else{let v=o.var("props",Me._`${m}.evaluated.props`);s.props=ai.mergeEvaluated.props(o,v,s.props,Me.Name)}if(s.items!==!0)if(_&&!_.dynamicItems){if(_.items!==void 0)s.items=ai.mergeEvaluated.items(o,_.items,s.items)}else{let v=o.var("items",Me._`${m}.evaluated.items`);s.items=ai.mergeEvaluated.items(o,v,s.items,Me.Name)}}}zy.callRef=ci;zy.default=fE});var Oy=k(function(Ey){Object.defineProperty(Ey,"__esModule",{value:!0});var gE=$y(),_E=Ty(),yE=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",gE.default,_E.default];Ey.default=yE});var Iy=k(function(Ry){Object.defineProperty(Ry,"__esModule",{value:!0});var li=L(),Vt=li.operators,ui={maximum:{okStr:"<=",ok:Vt.LTE,fail:Vt.GT},minimum:{okStr:">=",ok:Vt.GTE,fail:Vt.LT},exclusiveMaximum:{okStr:"<",ok:Vt.LT,fail:Vt.GTE},exclusiveMinimum:{okStr:">",ok:Vt.GT,fail:Vt.LTE}},xE={message:({keyword:e,schemaCode:t})=>li.str`must be ${ui[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>li._`{comparison: ${ui[e].okStr}, limit: ${t}}`},bE={keyword:Object.keys(ui),type:"number",schemaType:"number",$data:!0,error:xE,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data(li._`${r} ${ui[t].fail} ${n} || isNaN(${r})`)}};Ry.default=bE});var Ay=k(function(Cy){Object.defineProperty(Cy,"__esModule",{value:!0});var ao=L(),wE={message:({schemaCode:e})=>ao.str`must be multiple of ${e}`,params:({schemaCode:e})=>ao._`{multipleOf: ${e}}`},kE={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:wE,code(e){let{gen:t,data:r,schemaCode:n,it:o}=e,s=o.opts.multipleOfPrecision,i=t.let("res"),a=s?ao._`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:ao._`${i} !== parseInt(${i})`;e.fail$data(ao._`(${n} === 0 || (${i} = ${r}/${n}, ${a}))`)}};Cy.default=kE});var Zy=k(function(jy){Object.defineProperty(jy,"__esModule",{value:!0});function Ny(e){let t=e.length,r=0,n=0,o;while(n<t)if(r++,o=e.charCodeAt(n++),o>=55296&&o<=56319&&n<t){if(o=e.charCodeAt(n),(o&64512)===56320)n++}return r}jy.default=Ny;Ny.code='require("ajv/dist/runtime/ucs2length").default'});var Dy=k(function(My){Object.defineProperty(My,"__esModule",{value:!0});var lr=L(),PE=W(),TE=Zy(),EE={message({keyword:e,schemaCode:t}){return lr.str`must NOT have ${e==="maxLength"?"more":"fewer"} than ${t} characters`},params:({schemaCode:e})=>lr._`{limit: ${e}}`},OE={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:EE,code(e){let{keyword:t,data:r,schemaCode:n,it:o}=e,s=t==="maxLength"?lr.operators.GT:lr.operators.LT,i=o.opts.unicode===!1?lr._`${r}.length`:lr._`${PE.useFunc(e.gen,TE.default)}(${r})`;e.fail$data(lr._`${i} ${s} ${n}`)}};My.default=OE});var Ly=k(function(qy){Object.defineProperty(qy,"__esModule",{value:!0});var IE=Ge(),CE=W(),Lr=L(),AE={message:({schemaCode:e})=>Lr.str`must match pattern "${e}"`,params:({schemaCode:e})=>Lr._`{pattern: ${e}}`},NE={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:AE,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:s,it:i}=e,a=i.opts.unicodeRegExp?"u":"";if(n){let{regExp:c}=i.opts.code,u=c.code==="new RegExp"?Lr._`new RegExp`:CE.useFunc(t,c),l=t.let("valid");t.try(()=>t.assign(l,Lr._`${u}(${s}, ${a}).test(${r})`),()=>t.assign(l,!1)),e.fail$data(Lr._`!${l}`)}else{let c=IE.usePattern(e,o);e.fail$data(Lr._`!${c}.test(${r})`)}}};qy.default=NE});var Uy=k(function(Fy){Object.defineProperty(Fy,"__esModule",{value:!0});var co=L(),ZE={message({keyword:e,schemaCode:t}){return co.str`must NOT have ${e==="maxProperties"?"more":"fewer"} than ${t} properties`},params:({schemaCode:e})=>co._`{limit: ${e}}`},ME={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:ZE,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxProperties"?co.operators.GT:co.operators.LT;e.fail$data(co._`Object.keys(${r}).length ${o} ${n}`)}};Fy.default=ME});var Hy=k(function(Vy){Object.defineProperty(Vy,"__esModule",{value:!0});var lo=Ge(),uo=L(),qE=W(),LE={message:({params:{missingProperty:e}})=>uo.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>uo._`{missingProperty: ${e}}`},FE={keyword:"required",type:"object",schemaType:"array",$data:!0,error:LE,code(e){let{gen:t,schema:r,schemaCode:n,data:o,$data:s,it:i}=e,{opts:a}=i;if(!s&&r.length===0)return;let c=r.length>=a.loopRequired;if(i.allErrors)u();else l();if(a.strictRequired){let p=e.parentSchema.properties,{definedProperties:m}=e.it;for(let h of r)if((p===null||p===void 0?void 0:p[h])===void 0&&!m.has(h)){let _=i.schemaEnv.baseId+i.errSchemaPath,v=`required property "${h}" is not defined at "${_}" (strictRequired)`;qE.checkStrictMode(i,v,i.opts.strictRequired)}}function u(){if(c||s)e.block$data(uo.nil,d);else for(let p of r)lo.checkReportMissingProp(e,p)}function l(){let p=t.let("missing");if(c||s){let m=t.let("valid",!0);e.block$data(m,()=>f(p,m)),e.ok(m)}else t.if(lo.checkMissingProp(e,r,p)),lo.reportMissingProp(e,p),t.else()}function d(){t.forOf("prop",n,(p)=>{e.setParams({missingProperty:p}),t.if(lo.noPropertyInData(t,o,p,a.ownProperties),()=>e.error())})}function f(p,m){e.setParams({missingProperty:p}),t.forOf(p,n,()=>{t.assign(m,lo.propertyInData(t,o,p,a.ownProperties)),t.if(uo.not(m),()=>{e.error(),t.break()})},uo.nil)}}};Vy.default=FE});var Jy=k(function(By){Object.defineProperty(By,"__esModule",{value:!0});var po=L(),VE={message({keyword:e,schemaCode:t}){return po.str`must NOT have ${e==="maxItems"?"more":"fewer"} than ${t} items`},params:({schemaCode:e})=>po._`{limit: ${e}}`},HE={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:VE,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxItems"?po.operators.GT:po.operators.LT;e.fail$data(po._`${r}.length ${o} ${n}`)}};By.default=HE});var di=k(function(Gy){Object.defineProperty(Gy,"__esModule",{value:!0});var Ky=ol();Ky.code='require("ajv/dist/runtime/equal").default';Gy.default=Ky});var Xy=k(function(Wy){Object.defineProperty(Wy,"__esModule",{value:!0});var Pl=Wn(),be=L(),KE=W(),GE=di(),WE={message:({params:{i:e,j:t}})=>be.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>be._`{i: ${e}, j: ${t}}`},XE={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:WE,code(e){let{gen:t,data:r,$data:n,schema:o,parentSchema:s,schemaCode:i,it:a}=e;if(!n&&!o)return;let c=t.let("valid"),u=s.items?Pl.getSchemaTypes(s.items):[];e.block$data(c,l,be._`${i} === false`),e.ok(c);function l(){let m=t.let("i",be._`${r}.length`),h=t.let("j");e.setParams({i:m,j:h}),t.assign(c,!0),t.if(be._`${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 _=t.name("item"),v=Pl.checkDataTypes(u,_,a.opts.strictNumbers,Pl.DataType.Wrong),z=t.const("indices",be._`{}`);t.for(be._`;${m}--;`,()=>{if(t.let(_,be._`${r}[${m}]`),t.if(v,be._`continue`),u.length>1)t.if(be._`typeof ${_} == "string"`,be._`${_} += "_"`);t.if(be._`typeof ${z}[${_}] == "number"`,()=>{t.assign(h,be._`${z}[${_}]`),e.error(),t.assign(c,!1).break()}).code(be._`${z}[${_}] = ${m}`)})}function p(m,h){let _=KE.useFunc(t,GE.default),v=t.name("outer");t.label(v).for(be._`;${m}--;`,()=>t.for(be._`${h} = ${m}; ${h}--;`,()=>t.if(be._`${_}(${r}[${m}], ${r}[${h}])`,()=>{e.error(),t.assign(c,!1).break(v)})))}}};Wy.default=XE});var Qy=k(function(Yy){Object.defineProperty(Yy,"__esModule",{value:!0});var Tl=L(),QE=W(),eO=di(),tO={message:"must be equal to constant",params:({schemaCode:e})=>Tl._`{allowedValue: ${e}}`},rO={keyword:"const",$data:!0,error:tO,code(e){let{gen:t,data:r,$data:n,schemaCode:o,schema:s}=e;if(n||s&&typeof s=="object")e.fail$data(Tl._`!${QE.useFunc(t,eO.default)}(${r}, ${o})`);else e.fail(Tl._`${s} !== ${r}`)}};Yy.default=rO});var tv=k(function(ev){Object.defineProperty(ev,"__esModule",{value:!0});var fo=L(),oO=W(),sO=di(),iO={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>fo._`{allowedValues: ${e}}`},aO={keyword:"enum",schemaType:"array",$data:!0,error:iO,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:s,it:i}=e;if(!n&&o.length===0)throw Error("enum must have non-empty array");let a=o.length>=i.opts.loopEnum,c,u=()=>c!==null&&c!==void 0?c:c=oO.useFunc(t,sO.default),l;if(a||n)l=t.let("valid"),e.block$data(l,d);else{if(!Array.isArray(o))throw Error("ajv implementation error");let p=t.const("vSchema",s);l=fo.or(...o.map((m,h)=>f(p,h)))}e.pass(l);function d(){t.assign(l,!1),t.forOf("v",s,(p)=>t.if(fo._`${u()}(${r}, ${p})`,()=>t.assign(l,!0).break()))}function f(p,m){let h=o[m];return typeof h==="object"&&h!==null?fo._`${u()}(${r}, ${p}[${m}])`:fo._`${r} === ${h}`}}};ev.default=aO});var nv=k(function(rv){Object.defineProperty(rv,"__esModule",{value:!0});var uO=Iy(),lO=Ay(),dO=Dy(),pO=Ly(),fO=Uy(),mO=Hy(),hO=Jy(),gO=Xy(),_O=Qy(),yO=tv(),vO=[uO.default,lO.default,dO.default,pO.default,fO.default,mO.default,hO.default,gO.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},_O.default,yO.default];rv.default=vO});var Ol=k(function(sv){Object.defineProperty(sv,"__esModule",{value:!0});sv.validateAdditionalItems=void 0;var dr=L(),El=W(),bO={message:({params:{len:e}})=>dr.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>dr._`{limit: ${e}}`},$O={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:bO,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){El.checkStrictMode(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}ov(e,n)}};function ov(e,t){let{gen:r,schema:n,data:o,keyword:s,it:i}=e;i.items=!0;let a=r.const("len",dr._`${o}.length`);if(n===!1)e.setParams({len:t.length}),e.pass(dr._`${a} <= ${t.length}`);else if(typeof n=="object"&&!El.alwaysValidSchema(i,n)){let u=r.var("valid",dr._`${a} <= ${t.length}`);r.if(dr.not(u),()=>c(u)),e.ok(u)}function c(u){r.forRange("i",t.length,a,(l)=>{if(e.subschema({keyword:s,dataProp:l,dataPropType:El.Type.Num},u),!i.allErrors)r.if(dr.not(u),()=>r.break())})}}sv.validateAdditionalItems=ov;sv.default=$O});var Rl=k(function(uv){Object.defineProperty(uv,"__esModule",{value:!0});uv.validateTuple=void 0;var av=L(),pi=W(),kO=Ge(),SO={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return cv(e,"additionalItems",t);if(r.items=!0,pi.alwaysValidSchema(r,t))return;e.ok(kO.validateArray(e))}};function cv(e,t,r=e.schema){let{gen:n,parentSchema:o,data:s,keyword:i,it:a}=e;if(l(o),a.opts.unevaluated&&r.length&&a.items!==!0)a.items=pi.mergeEvaluated.items(n,r.length,a.items);let c=n.name("valid"),u=n.const("len",av._`${s}.length`);r.forEach((d,f)=>{if(pi.alwaysValidSchema(a,d))return;n.if(av._`${u} > ${f}`,()=>e.subschema({keyword:i,schemaProp:f,dataProp:f},c)),e.ok(c)});function l(d){let{opts:f,errSchemaPath:p}=a,m=r.length,h=m===d.minItems&&(m===d.maxItems||d[t]===!1);if(f.strictTuples&&!h){let _=`"${i}" is ${m}-tuple, but minItems or maxItems/${t} are not specified or different at path "${p}"`;pi.checkStrictMode(a,_,f.strictTuples)}}}uv.validateTuple=cv;uv.default=SO});var pv=k(function(dv){Object.defineProperty(dv,"__esModule",{value:!0});var PO=Rl(),TO={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(e)=>PO.validateTuple(e,"items")};dv.default=TO});var hv=k(function(mv){Object.defineProperty(mv,"__esModule",{value:!0});var fv=L(),OO=W(),RO=Ge(),IO=Ol(),CO={message:({params:{len:e}})=>fv.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>fv._`{limit: ${e}}`},AO={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:CO,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:o}=r;if(n.items=!0,OO.alwaysValidSchema(n,t))return;if(o)IO.validateAdditionalItems(e,o);else e.ok(RO.validateArray(e))}};mv.default=AO});var _v=k(function(gv){Object.defineProperty(gv,"__esModule",{value:!0});var We=L(),fi=W(),jO={message:({params:{min:e,max:t}})=>t===void 0?We.str`must contain at least ${e} valid item(s)`:We.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?We._`{minContains: ${e}}`:We._`{minContains: ${e}, maxContains: ${t}}`},ZO={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:jO,code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:s}=e,i,a,{minContains:c,maxContains:u}=n;if(s.opts.next)i=c===void 0?1:c,a=u;else i=1;let l=t.const("len",We._`${o}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){fi.checkStrictMode(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){fi.checkStrictMode(s,'"minContains" > "maxContains" is always invalid'),e.fail();return}if(fi.alwaysValidSchema(s,r)){let h=We._`${l} >= ${i}`;if(a!==void 0)h=We._`${h} && ${l} <= ${a}`;e.pass(h);return}s.items=!0;let d=t.name("valid");if(a===void 0&&i===1)p(d,()=>t.if(d,()=>t.break()));else if(i===0){if(t.let(d,!0),a!==void 0)t.if(We._`${o}.length > 0`,f)}else t.let(d,!1),f();e.result(d,()=>e.reset());function f(){let h=t.name("_valid"),_=t.let("count",0);p(h,()=>t.if(h,()=>m(_)))}function p(h,_){t.forRange("i",0,l,(v)=>{e.subschema({keyword:"contains",dataProp:v,dataPropType:fi.Type.Num,compositeRule:!0},h),_()})}function m(h){if(t.code(We._`${h}++`),a===void 0)t.if(We._`${h} >= ${i}`,()=>t.assign(d,!0).break());else if(t.if(We._`${h} > ${a}`,()=>t.assign(d,!1).break()),i===1)t.assign(d,!0);else t.if(We._`${h} >= ${i}`,()=>t.assign(d,!0))}}};gv.default=ZO});var wv=k(function(xv){Object.defineProperty(xv,"__esModule",{value:!0});xv.validateSchemaDeps=xv.validatePropertyDeps=xv.error=void 0;var Il=L(),DO=W(),mo=Ge();xv.error={message:({params:{property:e,depsCount:t,deps:r}})=>Il.str`must have ${t===1?"property":"properties"} ${r} when property ${e} is present`,params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>Il._`{property: ${e},
6
+ || ${i} === "boolean" || ${o} === null`).assign(a,q._`[${o}]`)}}}function B1({gen:e,parentData:t,parentDataProperty:r},n){e.if(q._`${t} !== undefined`,()=>e.assign(q._`${t}[${r}]`,n))}function Yu(e,t,r,n=jr.Correct){let o=n===jr.Correct?q.operators.EQ:q.operators.NEQ,s;switch(e){case"null":return q._`${t} ${o} null`;case"array":s=q._`Array.isArray(${t})`;break;case"object":s=q._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":s=i(q._`!(${t} % 1) && !isNaN(${t})`);break;case"number":s=i();break;default:return q._`typeof ${t} ${o} ${e}`}return n===jr.Correct?s:q.not(s);function i(a=q.nil){return q.and(q._`typeof ${t} == "number"`,a,r?q._`isFinite(${t})`:q.nil)}}Fg.checkDataType=Yu;function Qu(e,t,r,n){if(e.length===1)return Yu(e[0],t,r,n);let o,s=Dg.toHash(e);if(s.array&&s.object){let i=q._`typeof ${t} != "object"`;o=s.null?i:q._`!${t} || ${i}`,delete s.null,delete s.array,delete s.object}else o=q.nil;if(s.number)delete s.integer;for(let i in s)o=q.and(o,Yu(i,t,r,n));return o}Fg.checkDataTypes=Qu;var J1={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?q._`{type: ${e}}`:q._`{type: ${t}}`};function el(e){let t=K1(e);L1.reportError(t,J1)}Fg.reportTypeError=el;function K1(e){let{gen:t,data:r,schema:n}=e,o=Dg.schemaRefOrVal(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:e}}});var Jg=k(function(Hg){Object.defineProperty(Hg,"__esModule",{value:!0});Hg.assignDefaults=void 0;var Zr=L(),tz=W();function rz(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let o in r)Vg(e,o,r[o].default);else if(t==="array"&&Array.isArray(n))n.forEach((o,s)=>Vg(e,s,o.default))}Hg.assignDefaults=rz;function Vg(e,t,r){let{gen:n,compositeRule:o,data:s,opts:i}=e;if(r===void 0)return;let a=Zr._`${s}${Zr.getProperty(t)}`;if(o){tz.checkStrictMode(e,`default is ignored for: ${a}`);return}let c=Zr._`${a} === undefined`;if(i.useDefaults==="empty")c=Zr._`${c} || ${a} === null || ${a} === ""`;n.if(c,Zr._`${a} = ${Zr.stringify(r)}`)}});var Ge=k(function(Wg){Object.defineProperty(Wg,"__esModule",{value:!0});Wg.validateUnion=Wg.validateArray=Wg.usePattern=Wg.callValidateCode=Wg.schemaProperties=Wg.allSchemaProperties=Wg.noPropertyInData=Wg.propertyInData=Wg.isOwnProperty=Wg.hasPropFunc=Wg.reportMissingProp=Wg.checkMissingProp=Wg.checkReportMissingProp=void 0;var ie=L(),tl=W(),Ft=zt(),nz=W();function oz(e,t){let{gen:r,data:n,it:o}=e;r.if(nl(r,n,t,o.opts.ownProperties),()=>{e.setParams({missingProperty:ie._`${t}`},!0),e.error()})}Wg.checkReportMissingProp=oz;function sz({gen:e,data:t,it:{opts:r}},n,o){return ie.or(...n.map((s)=>ie.and(nl(e,t,s,r.ownProperties),ie._`${o} = ${s}`)))}Wg.checkMissingProp=sz;function iz(e,t){e.setParams({missingProperty:t},!0),e.error()}Wg.reportMissingProp=iz;function Kg(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:ie._`Object.prototype.hasOwnProperty`})}Wg.hasPropFunc=Kg;function rl(e,t,r){return ie._`${Kg(e)}.call(${t}, ${r})`}Wg.isOwnProperty=rl;function az(e,t,r,n){let o=ie._`${t}${ie.getProperty(r)} !== undefined`;return n?ie._`${o} && ${rl(e,t,r)}`:o}Wg.propertyInData=az;function nl(e,t,r,n){let o=ie._`${t}${ie.getProperty(r)} === undefined`;return n?ie.or(o,ie.not(rl(e,t,r))):o}Wg.noPropertyInData=nl;function Gg(e){return e?Object.keys(e).filter((t)=>t!=="__proto__"):[]}Wg.allSchemaProperties=Gg;function cz(e,t){return Gg(t).filter((r)=>!tl.alwaysValidSchema(e,t[r]))}Wg.schemaProperties=cz;function uz({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:s},it:i},a,c,u){let l=u?ie._`${e}, ${t}, ${n}${o}`:t,d=[[Ft.default.instancePath,ie.strConcat(Ft.default.instancePath,s)],[Ft.default.parentData,i.parentData],[Ft.default.parentDataProperty,i.parentDataProperty],[Ft.default.rootData,Ft.default.rootData]];if(i.opts.dynamicRef)d.push([Ft.default.dynamicAnchors,Ft.default.dynamicAnchors]);let f=ie._`${l}, ${r.object(...d)}`;return c!==ie.nil?ie._`${a}.call(${c}, ${f})`:ie._`${a}(${f})`}Wg.callValidateCode=uz;var lz=ie._`new RegExp`;function dz({gen:e,it:{opts:t}},r){let n=t.unicodeRegExp?"u":"",{regExp:o}=t.code,s=o(r,n);return e.scopeValue("pattern",{key:s.toString(),ref:s,code:ie._`${o.code==="new RegExp"?lz:nz.useFunc(e,o)}(${r}, ${n})`})}Wg.usePattern=dz;function pz(e){let{gen:t,data:r,keyword:n,it:o}=e,s=t.name("valid");if(o.allErrors){let a=t.let("valid",!0);return i(()=>t.assign(a,!1)),a}return t.var(s,!0),i(()=>t.break()),s;function i(a){let c=t.const("len",ie._`${r}.length`);t.forRange("i",0,c,(u)=>{e.subschema({keyword:n,dataProp:u,dataPropType:tl.Type.Num},s),t.if(ie.not(s),a)})}}Wg.validateArray=pz;function fz(e){let{gen:t,schema:r,keyword:n,it:o}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(r.some((c)=>tl.alwaysValidSchema(o,c))&&!o.opts.unevaluated)return;let i=t.let("valid",!1),a=t.name("_valid");t.block(()=>r.forEach((c,u)=>{let l=e.subschema({keyword:n,schemaProp:u,compositeRule:!0},a);if(t.assign(i,ie._`${i} || ${a}`),!e.mergeValidEvaluated(l,a))t.if(ie.not(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}Wg.validateUnion=fz});var r_=k(function(e_){Object.defineProperty(e_,"__esModule",{value:!0});e_.validateKeywordUsage=e_.validSchemaType=e_.funcKeywordCode=e_.macroKeywordCode=void 0;var Re=L(),ir=zt(),zz=Ge(),Pz=Gn();function Tz(e,t){let{gen:r,keyword:n,schema:o,parentSchema:s,it:i}=e,a=t.macro.call(i.self,o,s,i),c=Qg(r,n,a);if(i.opts.validateSchema!==!1)i.self.validateSchema(a,!0);let u=r.name("valid");e.subschema({schema:a,schemaPath:Re.nil,errSchemaPath:`${i.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}e_.macroKeywordCode=Tz;function Ez(e,t){var r;let{gen:n,keyword:o,schema:s,parentSchema:i,$data:a,it:c}=e;Rz(c,t);let u=!a&&t.compile?t.compile.call(c.self,s,i,c):t.validate,l=Qg(n,o,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){if(h(),t.modifying)Yg(e);_(()=>e.error())}else{let v=t.async?p():m();if(t.modifying)Yg(e);_(()=>Oz(e,v))}}function p(){let v=n.let("ruleErrs",null);return n.try(()=>h(Re._`await `),(z)=>n.assign(d,!1).if(Re._`${z} instanceof ${c.ValidationError}`,()=>n.assign(v,Re._`${z}.errors`),()=>n.throw(z))),v}function m(){let v=Re._`${l}.errors`;return n.assign(v,null),h(Re.nil),v}function h(v=t.async?Re._`await `:Re.nil){let z=c.opts.passContext?ir.default.this:ir.default.self,A=!(("compile"in t)&&!a||t.schema===!1);n.assign(d,Re._`${v}${zz.callValidateCode(e,l,z,A)}`,t.modifying)}function _(v){var z;n.if(Re.not((z=t.valid)!==null&&z!==void 0?z:d),v)}}e_.funcKeywordCode=Ez;function Yg(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,Re._`${n.parentData}[${n.parentDataProperty}]`))}function Oz(e,t){let{gen:r}=e;r.if(Re._`Array.isArray(${t})`,()=>{r.assign(ir.default.vErrors,Re._`${ir.default.vErrors} === null ? ${t} : ${ir.default.vErrors}.concat(${t})`).assign(ir.default.errors,Re._`${ir.default.vErrors}.length`),Pz.extendErrors(e)},()=>e.error())}function Rz({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}function Qg(e,t,r){if(r===void 0)throw Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:Re.stringify(r)})}function Iz(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")}e_.validSchemaType=Iz;function Cz({schema:e,opts:t,self:r,errSchemaPath:n},o,s){if(Array.isArray(o.keyword)?!o.keyword.includes(s):o.keyword!==s)throw Error("ajv implementation error");let i=o.dependencies;if(i===null||i===void 0?void 0:i.some((a)=>!Object.prototype.hasOwnProperty.call(e,a)))throw Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(o.validateSchema){if(!o.validateSchema(e[s])){let c=`keyword "${s}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw Error(c)}}}e_.validateKeywordUsage=Cz});var i_=k(function(o_){Object.defineProperty(o_,"__esModule",{value:!0});o_.extendSubschemaMode=o_.extendSubschemaData=o_.getSubschema=void 0;var gt=L(),n_=W();function Zz(e,{keyword:t,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:s,topSchemaRef:i}){if(t!==void 0&&n!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let a=e.schema[t];return r===void 0?{schema:a,schemaPath:gt._`${e.schemaPath}${gt.getProperty(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:gt._`${e.schemaPath}${gt.getProperty(t)}${gt.getProperty(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${n_.escapeFragment(r)}`}}if(n!==void 0){if(o===void 0||s===void 0||i===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:o,topSchemaRef:i,errSchemaPath:s}}throw Error('either "keyword" or "schema" must be passed')}o_.getSubschema=Zz;function Mz(e,t,{dataProp:r,dataPropType:n,data:o,dataTypes:s,propertyName:i}){if(o!==void 0&&r!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=t;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=t,f=a.let("data",gt._`${t.data}${gt.getProperty(r)}`,!0);c(f),e.errorPath=gt.str`${u}${n_.getErrorPath(r,n,d.jsPropertySyntax)}`,e.parentDataProperty=gt._`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(o!==void 0){let u=o instanceof gt.Name?o:a.let("data",o,!0);if(c(u),i!==void 0)e.propertyName=i}if(s)e.dataTypes=s;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]}}o_.extendSubschemaData=Mz;function Dz(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:s}){if(n!==void 0)e.compositeRule=n;if(o!==void 0)e.createErrors=o;if(s!==void 0)e.allErrors=s;e.jtdDiscriminator=t,e.jtdMetadata=r}o_.extendSubschemaMode=Dz});var ol=k(function(MD,a_){a_.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,s;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(s=Object.keys(t),n=s.length,n!==Object.keys(r).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[o]))return!1;for(o=n;o--!==0;){var i=s[o];if(!e(t[i],r[i]))return!1}return!0}return t!==t&&r!==r}});var u_=k(function(DD,c_){var Ut=c_.exports=function(e,t,r){if(typeof t=="function")r=t,t={};r=t.cb||r;var n=typeof r=="function"?r:r.pre||function(){},o=r.post||function(){};Gs(t,n,o,e,"",e)};Ut.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Ut.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Ut.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Ut.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 Gs(e,t,r,n,o,s,i,a,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,o,s,i,a,c,u);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in Ut.arrayKeywords)for(var f=0;f<d.length;f++)Gs(e,t,r,d[f],o+"/"+l+"/"+f,s,o,l,n,f)}else if(l in Ut.propsKeywords){if(d&&typeof d=="object")for(var p in d)Gs(e,t,r,d[p],o+"/"+l+"/"+Fz(p),s,o,l,n,p)}else if(l in Ut.keywords||e.allKeys&&!(l in Ut.skipKeywords))Gs(e,t,r,d,o+"/"+l,s,o,l,n)}r(n,o,s,i,a,c,u)}}function Fz(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var Xn=k(function(f_){Object.defineProperty(f_,"__esModule",{value:!0});f_.getSchemaRefs=f_.resolveUrl=f_.normalizeId=f_._getFullPath=f_.getFullPath=f_.inlineRef=void 0;var Uz=W(),Vz=ol(),Hz=u_(),Bz=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function Jz(e,t=!0){if(typeof e=="boolean")return!0;if(t===!0)return!sl(e);if(!t)return!1;return l_(e)<=t}f_.inlineRef=Jz;var Kz=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function sl(e){for(let t in e){if(Kz.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(sl))return!0;if(typeof r=="object"&&sl(r))return!0}return!1}function l_(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,Bz.has(r))continue;if(typeof e[r]=="object")Uz.eachItem(e[r],(n)=>t+=l_(n));if(t===1/0)return 1/0}return t}function d_(e,t="",r){if(r!==!1)t=Mr(t);let n=e.parse(t);return p_(e,n)}f_.getFullPath=d_;function p_(e,t){return e.serialize(t).split("#")[0]+"#"}f_._getFullPath=p_;var Gz=/#\/?$/;function Mr(e){return e?e.replace(Gz,""):""}f_.normalizeId=Mr;function Wz(e,t,r){return r=Mr(r),e.resolve(t,r)}f_.resolveUrl=Wz;var Xz=/^[a-z_][-a-z0-9._]*$/i;function Yz(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=Mr(e[r]||t),s={"":o},i=d_(n,o,!1),a={},c=new Set;return Hz(e,{allKeys:!0},(d,f,p,m)=>{if(m===void 0)return;let h=i+f,_=s[m];if(typeof d[r]=="string")_=v.call(this,d[r]);z.call(this,d.$anchor),z.call(this,d.$dynamicAnchor),s[f]=_;function v(A){let G=this.opts.uriResolver.resolve;if(A=Mr(_?G(_,A):A),c.has(A))throw l(A);c.add(A);let E=this.refs[A];if(typeof E=="string")E=this.refs[E];if(typeof E=="object")u(d,E.schema,A);else if(A!==Mr(h))if(A[0]==="#")u(d,a[A],A),a[A]=d;else this.refs[A]=h;return A}function z(A){if(typeof A=="string"){if(!Xz.test(A))throw Error(`invalid anchor "${A}"`);v.call(this,`#${A}`)}}}),a;function u(d,f,p){if(f!==void 0&&!Vz(d,f))throw l(p)}function l(d){return Error(`reference "${d}" resolves to more than one schema`)}}f_.getSchemaRefs=Yz});var eo=k(function(E_){Object.defineProperty(E_,"__esModule",{value:!0});E_.getData=E_.KeywordCxt=E_.validateFunctionCode=void 0;var y_=Ig(),v_=Wn(),il=Xu(),Ws=Wn(),oP=Jg(),Yn=r_(),al=i_(),C=L(),M=zt(),sP=Xn(),Pt=W(),Qn=Gn();function iP(e){if($_(e)){if(w_(e),b_(e)){uP(e);return}}x_(e,()=>y_.topBoolOrEmptySchema(e))}E_.validateFunctionCode=iP;function x_({gen:e,validateName:t,schema:r,schemaEnv:n,opts:o},s){if(o.code.es5)e.func(t,C._`${M.default.data}, ${M.default.valCxt}`,n.$async,()=>{e.code(C._`"use strict"; ${h_(r,o)}`),cP(e,o),e.code(s)});else e.func(t,C._`${M.default.data}, ${aP(o)}`,n.$async,()=>e.code(h_(r,o)).code(s))}function aP(e){return C._`{${M.default.instancePath}="", ${M.default.parentData}, ${M.default.parentDataProperty}, ${M.default.rootData}=${M.default.data}${e.dynamicRef?C._`, ${M.default.dynamicAnchors}={}`:C.nil}}={}`}function cP(e,t){e.if(M.default.valCxt,()=>{if(e.var(M.default.instancePath,C._`${M.default.valCxt}.${M.default.instancePath}`),e.var(M.default.parentData,C._`${M.default.valCxt}.${M.default.parentData}`),e.var(M.default.parentDataProperty,C._`${M.default.valCxt}.${M.default.parentDataProperty}`),e.var(M.default.rootData,C._`${M.default.valCxt}.${M.default.rootData}`),t.dynamicRef)e.var(M.default.dynamicAnchors,C._`${M.default.valCxt}.${M.default.dynamicAnchors}`)},()=>{if(e.var(M.default.instancePath,C._`""`),e.var(M.default.parentData,C._`undefined`),e.var(M.default.parentDataProperty,C._`undefined`),e.var(M.default.rootData,M.default.data),t.dynamicRef)e.var(M.default.dynamicAnchors,C._`{}`)})}function uP(e){let{schema:t,opts:r,gen:n}=e;x_(e,()=>{if(r.$comment&&t.$comment)S_(e);if(mP(e),n.let(M.default.vErrors,null),n.let(M.default.errors,0),r.unevaluated)lP(e);k_(e),_P(e)});return}function lP(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",C._`${r}.evaluated`),t.if(C._`${e.evaluated}.dynamicProps`,()=>t.assign(C._`${e.evaluated}.props`,C._`undefined`)),t.if(C._`${e.evaluated}.dynamicItems`,()=>t.assign(C._`${e.evaluated}.items`,C._`undefined`))}function h_(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?C._`/*# sourceURL=${r} */`:C.nil}function dP(e,t){if($_(e)){if(w_(e),b_(e)){pP(e,t);return}}y_.boolOrEmptySchema(e,t)}function b_({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 $_(e){return typeof e.schema!="boolean"}function pP(e,t){let{schema:r,gen:n,opts:o}=e;if(o.$comment&&r.$comment)S_(e);hP(e),gP(e);let s=n.const("_errs",M.default.errors);k_(e,s),n.var(t,C._`${s} === ${M.default.errors}`)}function w_(e){Pt.checkUnknownRules(e),fP(e)}function k_(e,t){if(e.opts.jtd)return g_(e,[],!1,t);let r=v_.getSchemaTypes(e.schema),n=v_.coerceAndCheckDataType(e,r);g_(e,r,!n,t)}function fP(e){let{schema:t,errSchemaPath:r,opts:n,self:o}=e;if(t.$ref&&n.ignoreKeywordsWithRef&&Pt.schemaHasRulesButRef(t,o.RULES))o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function mP(e){let{schema:t,opts:r}=e;if(t.default!==void 0&&r.useDefaults&&r.strictSchema)Pt.checkStrictMode(e,"default is ignored in the schema root")}function hP(e){let t=e.schema[e.opts.schemaId];if(t)e.baseId=sP.resolveUrl(e.opts.uriResolver,e.baseId,t)}function gP(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}function S_({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:o}){let s=r.$comment;if(o.$comment===!0)e.code(C._`${M.default.self}.logger.log(${s})`);else if(typeof o.$comment=="function"){let i=C.str`${n}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code(C._`${M.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function _P(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:o,opts:s}=e;if(r.$async)t.if(C._`${M.default.errors} === 0`,()=>t.return(M.default.data),()=>t.throw(C._`new ${o}(${M.default.vErrors})`));else{if(t.assign(C._`${n}.errors`,M.default.vErrors),s.unevaluated)yP(e);t.return(C._`${M.default.errors} === 0`)}}function yP({gen:e,evaluated:t,props:r,items:n}){if(r instanceof C.Name)e.assign(C._`${t}.props`,r);if(n instanceof C.Name)e.assign(C._`${t}.items`,n)}function g_(e,t,r,n){let{gen:o,schema:s,data:i,allErrors:a,opts:c,self:u}=e,{RULES:l}=u;if(s.$ref&&(c.ignoreKeywordsWithRef||!Pt.schemaHasRulesButRef(s,l))){o.block(()=>P_(e,"$ref",l.all.$ref.definition));return}if(!c.jtd)vP(e,t);o.block(()=>{for(let f of l.rules)d(f);d(l.post)});function d(f){if(!il.shouldUseGroup(s,f))return;if(f.type){if(o.if(Ws.checkDataType(f.type,i,c.strictNumbers)),__(e,f),t.length===1&&t[0]===f.type&&r)o.else(),Ws.reportTypeError(e);o.endIf()}else __(e,f);if(!a)o.if(C._`${M.default.errors} === ${n||0}`)}}function __(e,t){let{gen:r,schema:n,opts:{useDefaults:o}}=e;if(o)oP.assignDefaults(e,t.type);r.block(()=>{for(let s of t.rules)if(il.shouldUseRule(n,s))P_(e,s.keyword,s.definition,t.type)})}function vP(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;if(xP(e,t),!e.opts.allowUnionTypes)bP(e,t);$P(e,e.dataTypes)}function xP(e,t){if(!t.length)return;if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach((r)=>{if(!z_(e.dataTypes,r))cl(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),kP(e,t)}function bP(e,t){if(t.length>1&&!(t.length===2&&t.includes("null")))cl(e,"use allowUnionTypes to allow union type keyword")}function $P(e,t){let r=e.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&il.shouldUseRule(e.schema,o)){let{type:s}=o.definition;if(s.length&&!s.some((i)=>wP(t,i)))cl(e,`missing type "${s.join(",")}" for keyword "${n}"`)}}}function wP(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function z_(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function kP(e,t){let r=[];for(let n of e.dataTypes)if(z_(t,n))r.push(n);else if(t.includes("integer")&&n==="number")r.push("integer");e.dataTypes=r}function cl(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,Pt.checkStrictMode(e,t,e.opts.strictTypes)}class ul{constructor(e,t,r){if(Yn.validateKeywordUsage(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=Pt.schemaRefOrVal(e,this.schema,r,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",T_(this.$data,e));else if(this.schemaCode=this.schemaValue,!Yn.validSchemaType(this.schema,t.schemaType,t.allowUndefined))throw Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);if("code"in t?t.trackErrors:t.errors!==!1)this.errsCount=e.gen.const("_errs",M.default.errors)}result(e,t,r){this.failResult(C.not(e),t,r)}failResult(e,t,r){if(this.gen.if(e),r)r();else this.error();if(t){if(this.gen.else(),t(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(e,t){this.failResult(C.not(e),void 0,t)}fail(e){if(e===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if(e),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:t}=this;this.fail(C._`${t} !== undefined && (${C.or(this.invalid$data(),e)})`)}error(e,t,r){if(t){this.setParams(t),this._error(e,r),this.setParams({});return}this._error(e,r)}_error(e,t){(e?Qn.reportExtraError:Qn.reportError)(this,this.def.error,t)}$dataError(){Qn.reportError(this,this.def.$dataError||Qn.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');Qn.resetErrorsCount(this.gen,this.errsCount)}ok(e){if(!this.allErrors)this.gen.if(e)}setParams(e,t){if(t)Object.assign(this.params,e);else this.params=e}block$data(e,t,r=C.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=C.nil,t=C.nil){if(!this.$data)return;let{gen:r,schemaCode:n,schemaType:o,def:s}=this;if(r.if(C.or(C._`${n} === undefined`,t)),e!==C.nil)r.assign(e,!0);if(o.length||s.validateSchema){if(r.elseIf(this.invalid$data()),this.$dataError(),e!==C.nil)r.assign(e,!1)}r.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:r,def:n,it:o}=this;return C.or(s(),i());function s(){if(r.length){if(!(t instanceof C.Name))throw Error("ajv implementation error");let a=Array.isArray(r)?r:[r];return C._`${Ws.checkDataTypes(a,t,o.opts.strictNumbers,Ws.DataType.Wrong)}`}return C.nil}function i(){if(n.validateSchema){let a=e.scopeValue("validate$data",{ref:n.validateSchema});return C._`!${a}(${t})`}return C.nil}}subschema(e,t){let r=al.getSubschema(this.it,e);al.extendSubschemaData(r,this.it,e),al.extendSubschemaMode(r,e);let n={...this.it,...r,items:void 0,props:void 0};return dP(n,t),n}mergeEvaluated(e,t){let{it:r,gen:n}=this;if(!r.opts.unevaluated)return;if(r.props!==!0&&e.props!==void 0)r.props=Pt.mergeEvaluated.props(n,e.props,r.props,t);if(r.items!==!0&&e.items!==void 0)r.items=Pt.mergeEvaluated.items(n,e.items,r.items,t)}mergeValidEvaluated(e,t){let{it:r,gen:n}=this;if(r.opts.unevaluated&&(r.props!==!0||r.items!==!0))return n.if(t,()=>this.mergeEvaluated(e,C.Name)),!0}}E_.KeywordCxt=ul;function P_(e,t,r,n){let o=new ul(e,r,t);if("code"in r)r.code(o,n);else if(o.$data&&r.validate)Yn.funcKeywordCode(o,r);else if("macro"in r)Yn.macroKeywordCode(o,r);else if(r.compile||r.validate)Yn.funcKeywordCode(o,r)}var SP=/^\/(?:[^~]|~0|~1)*$/,zP=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function T_(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let o,s;if(e==="")return M.default.rootData;if(e[0]==="/"){if(!SP.test(e))throw Error(`Invalid JSON-pointer: ${e}`);o=e,s=M.default.rootData}else{let u=zP.exec(e);if(!u)throw Error(`Invalid JSON-pointer: ${e}`);let l=+u[1];if(o=u[2],o==="#"){if(l>=t)throw Error(c("property/index",l));return n[t-l]}if(l>t)throw Error(c("data",l));if(s=r[t-l],!o)return s}let i=s,a=o.split("/");for(let u of a)if(u)s=C._`${s}${C.getProperty(Pt.unescapeJsonPointer(u))}`,i=C._`${i} && ${s}`;return i;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${t}`}}E_.getData=T_});var Xs=k(function(I_){Object.defineProperty(I_,"__esModule",{value:!0});class R_ extends Error{constructor(e){super("validation failed");this.errors=e,this.ajv=this.validation=!0}}I_.default=R_});var to=k(function(A_){Object.defineProperty(A_,"__esModule",{value:!0});var ll=Xn();class C_ extends Error{constructor(e,t,r,n){super(n||`can't resolve reference ${r} from id ${t}`);this.missingRef=ll.resolveUrl(e,t,r),this.missingSchema=ll.normalizeId(ll.getFullPath(e,this.missingRef))}}A_.default=C_});var Qs=k(function(Z_){Object.defineProperty(Z_,"__esModule",{value:!0});Z_.resolveSchema=Z_.getCompilingSchema=Z_.resolveRef=Z_.compileSchema=Z_.SchemaEnv=void 0;var ot=L(),RP=Xs(),ar=zt(),st=Xn(),N_=W(),IP=eo();class ro{constructor(e){var t;this.refs={},this.dynamicAnchors={};let r;if(typeof e.schema=="object")r=e.schema;this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(t=e.baseId)!==null&&t!==void 0?t:st.normalizeId(r===null||r===void 0?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=r===null||r===void 0?void 0:r.$async,this.refs={}}}Z_.SchemaEnv=ro;function pl(e){let t=j_.call(this,e);if(t)return t;let r=st.getFullPath(this.opts.uriResolver,e.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:s}=this.opts,i=new ot.CodeGen(this.scope,{es5:n,lines:o,ownProperties:s}),a;if(e.$async)a=i.scopeValue("Error",{ref:RP.default,code:ot._`require("ajv/dist/runtime/validation_error").default`});let c=i.scopeName("validate");e.validateName=c;let u={gen:i,allErrors:this.opts.allErrors,data:ar.default.data,parentData:ar.default.parentData,parentDataProperty:ar.default.parentDataProperty,dataNames:[ar.default.data],dataPathArr:[ot.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:ot.stringify(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:ot.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:ot._`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),IP.validateFunctionCode(u),i.optimize(this.opts.code.optimize);let d=i.toString();if(l=`${i.scopeRefs(ar.default.scope)}return ${d}`,this.opts.code.process)l=this.opts.code.process(l,e);let p=Function(`${ar.default.self}`,`${ar.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;if(this.opts.code.source===!0)p.source={validateName:c,validateCode:d,scopeValues:i._values};if(this.opts.unevaluated){let{props:m,items:h}=u;if(p.evaluated={props:m instanceof ot.Name?void 0:m,items:h instanceof ot.Name?void 0:h,dynamicProps:m instanceof ot.Name,dynamicItems:h instanceof ot.Name},p.source)p.source.evaluated=ot.stringify(p.evaluated)}return e.validate=p,e}catch(d){if(delete e.validate,delete e.validateName,l)this.logger.error("Error compiling schema, function code:",l);throw d}finally{this._compilations.delete(e)}}Z_.compileSchema=pl;function CP(e,t,r){var n;r=st.resolveUrl(this.opts.uriResolver,t,r);let o=e.refs[r];if(o)return o;let s=jP.call(this,e,r);if(s===void 0){let i=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;if(i)s=new ro({schema:i,schemaId:a,root:e,baseId:t})}if(s===void 0)return;return e.refs[r]=AP.call(this,s)}Z_.resolveRef=CP;function AP(e){if(st.inlineRef(e.schema,this.opts.inlineRefs))return e.schema;return e.validate?e:pl.call(this,e)}function j_(e){for(let t of this._compilations)if(NP(t,e))return t}Z_.getCompilingSchema=j_;function NP(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function jP(e,t){let r;while(typeof(r=this.refs[t])=="string")t=r;return r||this.schemas[t]||Ys.call(this,e,t)}function Ys(e,t){let r=this.opts.uriResolver.parse(t),n=st._getFullPath(this.opts.uriResolver,r),o=st.getFullPath(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===o)return dl.call(this,r,e);let s=st.normalizeId(n),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=Ys.call(this,e,i);if(typeof(a===null||a===void 0?void 0:a.schema)!=="object")return;return dl.call(this,r,a)}if(typeof(i===null||i===void 0?void 0:i.schema)!=="object")return;if(!i.validate)pl.call(this,i);if(s===st.normalizeId(t)){let{schema:a}=i,{schemaId:c}=this.opts,u=a[c];if(u)o=st.resolveUrl(this.opts.uriResolver,o,u);return new ro({schema:a,schemaId:c,root:e,baseId:o})}return dl.call(this,r,i)}Z_.resolveSchema=Ys;var ZP=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function dl(e,{baseId:t,schema:r,root:n}){var o;if(((o=e.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if(typeof r==="boolean")return;let c=r[N_.unescapeFragment(a)];if(c===void 0)return;r=c;let u=typeof r==="object"&&r[this.opts.schemaId];if(!ZP.has(a)&&u)t=st.resolveUrl(this.opts.uriResolver,t,u)}let s;if(typeof r!="boolean"&&r.$ref&&!N_.schemaHasRulesButRef(r,this.RULES)){let a=st.resolveUrl(this.opts.uriResolver,t,r.$ref);s=Ys.call(this,n,a)}let{schemaId:i}=this.opts;if(s=s||new ro({schema:r,schemaId:i,root:n,baseId:t}),s.schema!==s.root.schema)return s;return}});var D_=k(function(HD,FP){FP.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 yl=k(function(BD,B_){var UP=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),ml=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),VP=RegExp.prototype.test.bind(/^\d*$/u),cr=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),hl=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),L_=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),gl=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),HP=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),Ze=Array(256);for(let t=0;t<256;t++)Ze[t]="%"+"0123456789ABCDEF"[t>>4]+"0123456789ABCDEF"[t&15];function ke(e){if(e<2048)return Ze[192|e>>6]+Ze[128|e&63];if(e<65536)return Ze[224|e>>12]+Ze[128|e>>6&63]+Ze[128|e&63];return Ze[240|e>>18]+Ze[128|e>>12&63]+Ze[128|e>>6&63]+Ze[128|e&63]}function BP(e){let t="",r=0,n=0;for(n=0;n<e.length;n++){if(r=e[n].charCodeAt(0),r===48)continue;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 JP=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),KP=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),GP=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),WP=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function XP(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++){if(GP(e[t]))continue;if(e[t]==="%"&&t+2<e.length&&cr(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function q_(e){let t=-1,r=0,n=-1,o=0;for(let a=0;a<e.length;a++)if(e[a]==="0"){if(n===-1)n=a;if(o++,o>r)r=o,t=n}else n=-1,o=0;if(r<2)return e.join(":");let s=e.slice(0,t).join(":"),i=e.slice(t+r).join(":");return s+"::"+i}function YP(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(":");if(t!==-1){if(r.length===1&&r[0]==="")r.length=0;if(n.length===1&&n[0]==="")n.length=0}let o=r.concat(n),s=0;for(let a=0;a<o.length;a++){let c=o[a];if(c==="")return;if(c.indexOf(".")!==-1){if(a!==o.length-1||t!==-1&&n.length===0||!ml(c))return;s+=2;continue}if(!JP(c))return;o[a]=parseInt(c,16).toString(16),s++}if(t===-1){if(s!==8)return;return q_(o)}if(s>=8)return;let i=o.slice(0,r.length);for(let a=s;a<8;a++)i.push("0");for(let a=r.length;a<o.length;a++)i.push(o[a]);return q_(i)}function fl(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&&KP(n))return n=n.toLowerCase(),{host:`[${n}]`,escapedHost:n,isIPV6:!1,isIPVFuture:!0};if(QP(n,":")<2)return{host:e,isIPV6:!1,error:t};let o="",s=n.indexOf("%");if(s!==-1){let a=n.slice(s,s+3).toLowerCase()==="%25"?3:1;if(o=n.slice(s+a),!XP(o))return{host:e,isIPV6:!1,error:!0};n=n.slice(0,s)}let i=YP(n);if(i===void 0)return{host:e,isIPV6:!1,error:!0};return{host:i+(o?"%"+o:""),escapedHost:i+(o?"%25"+o:""),isIPV6:!0}}function QP(e,t){let r=0;for(let n=0;n<e.length;n++)if(e[n]===t)r++;return r}function eT(e){let t=e,r=[],n=-1,o=0;while(o=t.length){if(o===1)if(t===".")break;else if(t==="/"){r.push("/");break}else{r.push(t);break}else if(o===2){if(t[0]==="."){if(t[1]===".")break;else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."||t[1]==="/"){r.push("/");break}}}else if(o===3){if(t==="/.."){if(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]==="/"){if(t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."){if(t[3]==="/"){if(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 tT={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},rT=/[@/?#:]/g,nT=/[@/?#]/g;function F_(e,t){let r=t?nT:rT;return r.lastIndex=0,e.replace(r,(n)=>tT[n])}function U_(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(cr(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));if(t&&hl(i))r+=i;else r+="%"+s;n+=2;continue}}r+=e[n]}return r}function oT(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(cr(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));if(i!=="."&&hl(i))t+=i;else t+="%"+s;r+=2;continue}}if(L_(n))t+=n;else{let o=e.charCodeAt(r);if(o<128)t+=H_(o)?n:Ze[o];else if(o<55296||o>57343)t+=ke(o);else if(o<=56319&&r+1<e.length){let s=e.charCodeAt(r+1);if(s>=56320&&s<=57343)t+=ke(65536+(o-55296<<10)+(s-56320)),r++;else t+=ke(65533)}else t+=ke(65533)}}return t}function sT(e,t=!1){let r="",n=t&&e[0]!=="/";for(let o=0;o<e.length;o++){let s=e[o];if(s==="%"&&o+2<e.length){let i=e.slice(o+1,o+3);if(cr(i)){r+="%"+i.toUpperCase(),o+=2;continue}}if(s==="/")n=!1;if(L_(s)&&(s!==":"||!n))r+=s;else{let i=e.charCodeAt(o);if(i<128)r+=Ze[i];else if(i<55296||i>57343)r+=ke(i);else if(i<=56319&&o+1<e.length){let a=e.charCodeAt(o+1);if(a>=56320&&a<=57343)r+=ke(65536+(i-55296<<10)+(a-56320)),o++;else r+=ke(65533)}else r+=ke(65533)}}return r}function _l(e,t){let r="";for(let n=0;n<e.length;n++){let o=e[n];if(o==="%"&&n+2<e.length){let s=e.slice(n+1,n+3);if(cr(s)){r+="%"+s.toUpperCase(),n+=2;continue}}if(t(o))r+=o;else{let s=e.charCodeAt(n);if(s<128)r+=Ze[s];else if(s<55296||s>57343)r+=ke(s);else if(s<=56319&&n+1<e.length){let i=e.charCodeAt(n+1);if(i>=56320&&i<=57343)r+=ke(65536+(s-55296<<10)+(i-56320)),n++;else r+=ke(65533)}else r+=ke(65533)}}return r}function V_(e){return _l(e,HP)}function iT(e){return _l(e,gl)}function aT(e){return _l(e,gl)}function H_(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 cT(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(cr(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));if(hl(i))t+=i;else t+="%"+s;r+=2;continue}}if(gl(n))t+=n;else{let o=e.charCodeAt(r);if(o<128)t+=H_(o)?n:Ze[o];else if(o<55296||o>57343)t+=ke(o);else if(o<=56319&&r+1<e.length){let s=e.charCodeAt(r+1);if(s>=56320&&s<=57343)t+=ke(65536+(o-55296<<10)+(s-56320)),r++;else t+=ke(65533)}else t+=ke(65533)}}return t}function uT(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let n=e.slice(r+1,r+3);if(cr(n)){t+="%"+n.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function lT(e){let t=[];if(e.userinfo!==void 0)t.push(V_(e.userinfo)),t.push("@");if(e.host!==void 0){let r=e.host;if(!ml(r)){let n=fl(r);if(n.isIPV6!==!0&&n.isIPVFuture!==!0)r=U_(r,!0),n=fl(r);if(n.isIPV6===!0||n.isIPVFuture===!0)r=`[${n.escapedHost}]`;else r=F_(r,!1)}t.push(r)}if(typeof e.port==="number"||typeof e.port==="string"){let r=String(e.port);if(!VP(r))throw TypeError("URI port is malformed.");t.push(":"),t.push(r)}return t.length?t.join(""):void 0}B_.exports={nonSimpleDomain:WP,recomposeAuthority:lT,reescapeHostDelimiters:F_,normalizePercentEncoding:U_,normalizePathEncoding:oT,serializePathEncoding:sT,normalizeQueryFragmentEncoding:cT,encodeUserinfo:V_,encodeQuery:iT,encodeFragment:aT,escapePreservingEscapes:uT,removeDotSegments:eT,isIPv4:ml,isUUID:UP,normalizeIPv6:fl,stringArrayToHexStripped:BP}});var X_=k(function(JD,W_){var{isUUID:dT}=yl(),pT=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,fT=["http","https","ws","wss","urn","urn:uuid"];function mT(e){return fT.indexOf(e)!==-1}function vl(e){if(e.secure===!0)return!0;else if(e.secure===!1)return!1;else if(e.scheme)return 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");else return!1}function J_(e){if(!e.host)e.error=e.error||"HTTP URIs must have a host.";return e}function K_(e){let t=String(e.scheme).toLowerCase()==="https";if(e.port===(t?443:80)||e.port==="")e.port=void 0;if(!e.path)e.path="/";return e}function hT(e){return e.secure=vl(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function gT(e){if(e.port===(vl(e)?443:80)||e.port==="")e.port=void 0;if(typeof e.secure==="boolean")e.scheme=e.secure?"wss":"ws",e.secure=void 0;if(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 _T(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(pT);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}`,s=xl(o);if(e.path=void 0,s)e=s.parse(e,t)}else e.error=e.error||"URN can not be parsed.";return e}function yT(e,t){if(e.nid===void 0)throw Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",n=e.nid.toLowerCase(),o=`${r}:${t.nid||n}`,s=xl(o);if(s)e=s.serialize(e,t);let i=e,a=e.nss;return i.path=`${n||t.nid}:${a}`,t.skipEscape=!0,i}function vT(e,t){let r=e;if(r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!dT(r.uuid)))r.error=r.error||"UUID is not valid.";return r}function xT(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var G_={scheme:"http",domainHost:!0,parse:J_,serialize:K_},bT={scheme:"https",domainHost:G_.domainHost,parse:J_,serialize:K_},ei={scheme:"ws",domainHost:!0,parse:hT,serialize:gT},$T={scheme:"wss",domainHost:ei.domainHost,parse:ei.parse,serialize:ei.serialize},wT={scheme:"urn",parse:_T,serialize:yT,skipNormalize:!0},kT={scheme:"urn:uuid",parse:vT,serialize:xT,skipNormalize:!0},ti={http:G_,https:bT,ws:ei,wss:$T,urn:wT,"urn:uuid":kT};Object.setPrototypeOf(ti,null);function xl(e){return e&&(ti[e]||ti[e.toLowerCase()])||void 0}W_.exports={wsIsSecure:vl,SCHEMES:ti,isValidSchemeName:mT,getSchemeHandler:xl}});var uy=k(function(KD,oi){var{normalizeIPv6:ry,removeDotSegments:oo,recomposeAuthority:ST,normalizePercentEncoding:bl,normalizePathEncoding:zT,serializePathEncoding:Y_,normalizeQueryFragmentEncoding:Q_,encodeQuery:PT,encodeFragment:TT,reescapeHostDelimiters:ET,isIPv4:ny,nonSimpleDomain:OT}=yl(),{SCHEMES:oy,getSchemeHandler:$l}=X_(),sy=/^[A-Za-z][A-Za-z0-9+.-]*$/u;function ey(e){let t=unescape(String(e));if(!sy.test(t))throw TypeError("URI scheme is malformed.");return t}function RT(e,t){if(typeof e==="string")e=DT(e,t);else if(typeof e==="object")e=ni(ur(e,t),t);return e}function IT(e,t,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},{parsed:o,malformedAuthorityOrPort:s,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:c,malformedScheme:u}=ri(e,n),{parsed:l,malformedAuthorityOrPort:d,malformedPercentEncoding:f,malformedSchemeSpecific:p,malformedHost:m,malformedScheme:h}=ri(t,n);if(s||d||i||f||a||p||c||m||u||h)throw Error(o.error||l.error||"URI is malformed.");let _=iy(o,l,n,!0),v=$l(r&&r.scheme||_.scheme),z=_.host,A=z!==void 0&&z!==""&&(ny(z)||ry(z).isIPV6);ay(_,r||{},v,A);let G=z&&z.indexOf("%")!==-1&&!/\P{ASCII}/u.test(z);if(_.error&&!G)throw Error(_.error);return n.skipEscape=!0,ur(_,n)}function iy(e,t,r,n){let o={};if(!n)e=ni(ur(e,r),r),t=ni(ur(t,r),r);if(r=r||{},!r.tolerant&&t.scheme)o.scheme=t.scheme,o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=oo(t.path||""),o.query=t.query;else{if(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=oo(t.path||""),o.query=t.query;else{if(!t.path)if(o.path=e.path,t.query!==void 0)o.query=t.query;else o.query=e.query;else{if(t.path[0]==="/")o.path=oo(t.path);else{if((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path)o.path="/"+t.path;else if(!e.path)o.path=t.path;else o.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path;o.path=oo(o.path)}o.query=t.query}o.userinfo=e.userinfo,o.host=e.host,o.port=e.port}o.scheme=e.scheme}return o.fragment=t.fragment,o}function CT(e,t,r){let n=ty(e,r),o=ty(t,r);return n!==void 0&&o!==void 0&&n===o}function ur(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,error:""},n=Object.assign({},t),o=[];if(r.scheme)r.scheme=ey(r.scheme);let s=$l(n.scheme||r.scheme);if(s&&s.serialize)s.serialize(r,n);let i=r.userinfo!==void 0||r.host!==void 0||r.port!==void 0,a=!n.skipEscape&&r.scheme===void 0&&!i;if(r.path!==void 0)if(!n.skipEscape)r.path=Y_(r.path,a);else r.path=bl(r.path);if(n.reference!=="suffix"&&r.scheme)r.scheme=ey(r.scheme),o.push(r.scheme,":");let c=ST(r);if(c!==void 0){if(n.reference!=="suffix")o.push("//");if(o.push(c),r.path&&r.path[0]!=="/")o.push("/")}if(r.path!==void 0){let u=r.path;if(!n.absolutePath&&(!s||!s.absolutePath))u=oo(u);if(a)u=Y_(u,!0);if(c===void 0&&u[0]==="/"&&u[1]==="/")u="/%2F"+u.slice(2);o.push(u)}if(r.query!==void 0)o.push("?",PT(r.query));if(r.fragment!==void 0)o.push("#",TT(r.fragment));return o.join("")}var AT=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,NT=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,jT=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function ZT(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.";return}function no(e){if(e===void 0)return!1;let t=e.indexOf("%");while(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 wl(e){return e[0]==="["&&e[e.length-1]==="]"}function MT(e){let t=e[4];return no(e[3])||t!==void 0&&!wl(t)&&no(t)||no(e[6])||no(e[7])||no(e[8])}function ay(e,t,r,n){if(!t.unicodeSupport&&(!r||!r.unicodeSupport)&&e.host&&!wl(e.host)&&(t.domainHost||r&&r.domainHost)&&n===!1&&OT(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 ri(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,s=!1,i=!1,a=!1,c=!1,u=!1,l=!1;if(r.reference==="suffix")if(r.scheme)e=r.scheme+":"+e;else e="//"+e;let d=e.match(NT);if(d!==null&&d[1].indexOf("\\")!==-1)n.error="URI authority must not contain a literal backslash.",o=!0;let f=e.match(jT);if(f!==null){let m=f[1],h=m.replace(/[\t\n\r]/g,"");if(h.length>=2){if(h.slice(0,2)!=="//")n.error=n.error||"URI authority must not contain a literal backslash.",o=!0;else if(m.length!==h.length)n.error=n.error||"URI authority introducer must not contain whitespace.",o=!0}}let p=e.match(AT);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 _=unescape(n.scheme);if(sy.test(_))n.scheme=_.toLowerCase();else n.error=n.error||"URI scheme is malformed.",u=!0}if(s=MT(p),s)n.error=n.error||"URI contains malformed percent-encoding.";if(isNaN(n.port))n.port=p[5];let m=ZT(n,p);if(m!==void 0)n.error=n.error||m,o=!0;if(n.host)if(ny(n.host)===!1){let v=wl(n.host),z=n.host.indexOf("[")!==-1||n.host.indexOf("]")!==-1,A=ry(n.host);if(l=A.isIPV6||A.isIPVFuture===!0,c=z&&(!v||A.error===!0),n.host=l?A.host:A.host.toLowerCase(),c)n.error=n.error||"URI host is malformed.",o=!0}else l=!0;if(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";else if(n.scheme===void 0)n.reference="relative";else if(n.fragment===void 0)n.reference="absolute";else n.reference="uri";if(r.reference&&r.reference!=="suffix"&&r.reference!==n.reference)n.error=n.error||"URI is not a "+r.reference+" reference.";let h=$l(r.scheme||n.scheme);if(!c)a=ay(n,r,h,l);if(e.indexOf("%")!==-1&&n.host!==void 0&&!c){let _=l?n.host:bl(n.host,!0);if(!l)_=bl(_.toLowerCase());n.host=ET(_,l)}if(!h||h&&!h.skipNormalize){if(n.path)n.path=zT(n.path);if(n.query)n.query=Q_(n.query);if(n.fragment)n.fragment=Q_(n.fragment)}if(h&&h.parse){if(h.parse(n,r),h===oy.urn&&n.nid===void 0)i=!0}}else n.error=n.error||"URI can not be parsed.";return{parsed:n,malformedAuthorityOrPort:o,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:u}}function ni(e,t){return ri(e,t).parsed}function DT(e,t){return cy(e,t).normalized}function cy(e,t){let{parsed:r,malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:s,malformedHost:i,malformedScheme:a}=ri(e,t);return{normalized:n||o||s||i||a?e:ur(r,t),malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:s,malformedHost:i,malformedScheme:a}}function ty(e,t){if(typeof e!=="string"&&typeof e!=="object")return;let r;try{r=typeof e==="string"?e:ur(e,t)}catch{return}let{normalized:n,malformedAuthorityOrPort:o,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:c}=cy(r,t);return o||s||i||a||c?void 0:n}var kl={SCHEMES:oy,normalize:RT,resolve:IT,resolveComponent:iy,equal:CT,serialize:ur,parse:ni};oi.exports=kl;oi.exports.default=kl;oi.exports.fastUri=kl});var py=k(function(dy){Object.defineProperty(dy,"__esModule",{value:!0});var ly=uy();ly.code='require("ajv/dist/runtime/uri").default';dy.default=ly});var xy=k(function(Tt){Object.defineProperty(Tt,"__esModule",{value:!0});Tt.CodeGen=Tt.Name=Tt.nil=Tt.stringify=Tt.str=Tt._=Tt.KeywordCxt=void 0;var LT=eo();Object.defineProperty(Tt,"KeywordCxt",{enumerable:!0,get:function(){return LT.KeywordCxt}});var Dr=L();Object.defineProperty(Tt,"_",{enumerable:!0,get:function(){return Dr._}});Object.defineProperty(Tt,"str",{enumerable:!0,get:function(){return Dr.str}});Object.defineProperty(Tt,"stringify",{enumerable:!0,get:function(){return Dr.stringify}});Object.defineProperty(Tt,"nil",{enumerable:!0,get:function(){return Dr.nil}});Object.defineProperty(Tt,"Name",{enumerable:!0,get:function(){return Dr.Name}});Object.defineProperty(Tt,"CodeGen",{enumerable:!0,get:function(){return Dr.CodeGen}});var FT=Xs(),_y=to(),UT=Wu(),io=Qs(),VT=L(),so=Xn(),si=Wn(),zl=W(),fy=D_(),HT=py(),yy=(e,t)=>new RegExp(e,t);yy.code="new RegExp";var BT=["removeAdditional","useDefaults","coerceTypes"],JT=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),KT={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."},GT={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},my=200;function WT(e){var t,r,n,o,s,i,a,c,u,l,d,f,p,m,h,_,v,z,A,G,E,V,me,Jt,fr;let yt=e.strict,mr=(t=e.code)===null||t===void 0?void 0:t.optimize,yo=mr===!0||mr===void 0?1:mr||0,vo=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:yy,Yx=(o=e.uriResolver)!==null&&o!==void 0?o:HT.default;return{strictSchema:(i=(s=e.strictSchema)!==null&&s!==void 0?s:yt)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=e.strictNumbers)!==null&&a!==void 0?a:yt)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=e.strictTypes)!==null&&u!==void 0?u:yt)!==null&&l!==void 0?l:"log",strictTuples:(f=(d=e.strictTuples)!==null&&d!==void 0?d:yt)!==null&&f!==void 0?f:"log",strictRequired:(m=(p=e.strictRequired)!==null&&p!==void 0?p:yt)!==null&&m!==void 0?m:!1,code:e.code?{...e.code,optimize:yo,regExp:vo}:{optimize:yo,regExp:vo},loopRequired:(h=e.loopRequired)!==null&&h!==void 0?h:my,loopEnum:(_=e.loopEnum)!==null&&_!==void 0?_:my,meta:(v=e.meta)!==null&&v!==void 0?v:!0,messages:(z=e.messages)!==null&&z!==void 0?z:!0,inlineRefs:(A=e.inlineRefs)!==null&&A!==void 0?A:!0,schemaId:(G=e.schemaId)!==null&&G!==void 0?G:"$id",addUsedSchema:(E=e.addUsedSchema)!==null&&E!==void 0?E:!0,validateSchema:(V=e.validateSchema)!==null&&V!==void 0?V:!0,validateFormats:(me=e.validateFormats)!==null&&me!==void 0?me:!0,unicodeRegExp:(Jt=e.unicodeRegExp)!==null&&Jt!==void 0?Jt:!0,int32range:(fr=e.int32range)!==null&&fr!==void 0?fr:!0,uriResolver:Yx}}class ii{constructor(e={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...WT(e)};let{es5:t,lines:r}=this.opts.code;this.scope=new VT.ValueScope({scope:{},prefixes:JT,es5:t,lines:r}),this.logger=rE(e.logger);let n=e.validateFormats;if(e.validateFormats=!1,this.RULES=UT.getRules(),hy.call(this,KT,e,"NOT SUPPORTED"),hy.call(this,GT,e,"DEPRECATED","warn"),this._metaOpts=eE.call(this),e.formats)YT.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords)QT.call(this,e.keywords);if(typeof e.meta=="object")this.addMetaSchema(e.meta);XT.call(this),e.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:r}=this.opts,n=fy;if(r==="id")n={...fy},n.id=n.$id,delete n.$id;if(t&&e)this.addMetaSchema(n,n[r],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[t]||e:void 0}validate(e,t){let r;if(typeof e=="string"){if(r=this.getSchema(e),!r)throw Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);let n=r(t);if(!("$async"in r))this.errors=r.errors;return n}compile(e,t){let r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:r}=this.opts;return n.call(this,e,t);async function n(u,l){await o.call(this,u.$schema);let d=this._addSchema(u,l);return d.validate||s.call(this,d)}async function o(u){if(u&&!this.getSchema(u))await n.call(this,{$ref:u},!0)}async function s(u){try{return this._compileSchemaEnv(u)}catch(l){if(!(l instanceof _y.default))throw l;return i.call(this,l),await a.call(this,l.missingSchema),s.call(this,u)}}function i({missingSchema:u,missingRef:l}){if(this.refs[u])throw Error(`AnySchema ${u} is loaded but ${l} cannot be resolved`)}async function a(u){let l=await c.call(this,u);if(!this.refs[u])await o.call(this,l.$schema);if(!this.refs[u])this.addSchema(l,u,t)}async function c(u){let l=this._loading[u];if(l)return l;try{return await(this._loading[u]=r(u))}finally{delete this._loading[u]}}}addSchema(e,t,r,n=this.opts.validateSchema){if(Array.isArray(e)){for(let s of e)this.addSchema(s,void 0,r,n);return this}let o;if(typeof e==="object"){let{schemaId:s}=this.opts;if(o=e[s],o!==void 0&&typeof o!="string")throw Error(`schema ${s} must be string`)}return t=so.normalizeId(t||o),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,n,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){if(typeof e=="boolean")return!0;let r;if(r=e.$schema,r!==void 0&&typeof r!="string")throw Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let n=this.validate(r,e);if(!n&&t){let o="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(o);else throw Error(o)}return n}getSchema(e){let t;while(typeof(t=gy.call(this,e))=="string")e=t;if(t===void 0){let{schemaId:r}=this.opts,n=new io.SchemaEnv({schema:{},schemaId:r});if(t=io.resolveSchema.call(this,n,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let t=gy.call(this,e);if(typeof t=="object")this._cache.delete(t.schema);return delete this.schemas[e],delete this.refs[e],this}case"object":{let t=e;this._cache.delete(t);let r=e[this.opts.schemaId];if(r)r=so.normalizeId(r),delete this.schemas[r],delete this.refs[r];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if(typeof e=="string"){if(r=e,typeof t=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r}else if(typeof e=="object"&&t===void 0){if(t=e,r=t.keyword,Array.isArray(r)&&!r.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(oE.call(this,r,t),!t)return zl.eachItem(r,(o)=>Sl.call(this,o)),this;iE.call(this,t);let n={...t,type:si.getJSONTypes(t.type),schemaType:si.getJSONTypes(t.schemaType)};return zl.eachItem(r,n.type.length===0?(o)=>Sl.call(this,o,n):(o)=>n.type.forEach((s)=>Sl.call(this,o,n,s))),this}getKeyword(e){let t=this.RULES.all[e];return typeof t=="object"?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(let r of t.rules){let n=r.rules.findIndex((o)=>o.keyword===e);if(n>=0)r.rules.splice(n,1)}return this}addFormat(e,t){if(typeof t=="string")t=new RegExp(t);return this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){if(!e||e.length===0)return"No errors";return e.map((n)=>`${r}${n.instancePath} ${n.message}`).reduce((n,o)=>n+t+o)}$dataMetaSchema(e,t){let r=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let n of t){let o=n.split("/").slice(1),s=e;for(let i of o)s=s[i];for(let i in r){let a=r[i];if(typeof a!="object")continue;let{$data:c}=a.definition,u=s[i];if(c&&u)s[i]=vy(u)}}return e}_removeAllSchemas(e,t){for(let r in e){let n=e[r];if(!t||t.test(r)){if(typeof n=="string")delete e[r];else if(n&&!n.meta)this._cache.delete(n.schema),delete e[r]}}}_addSchema(e,t,r,n=this.opts.validateSchema,o=this.opts.addUsedSchema){let s,{schemaId:i}=this.opts;if(typeof e=="object")s=e[i];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof e!="boolean")throw Error("schema must be object or boolean");let a=this._cache.get(e);if(a!==void 0)return a;r=so.normalizeId(s||r);let c=so.getSchemaRefs.call(this,e,r);if(a=new io.SchemaEnv({schema:e,schemaId:i,meta:t,baseId:r,localRefs:c}),this._cache.set(a.schema,a),o&&!r.startsWith("#")){if(r)this._checkUnique(r);this.refs[r]=a}if(n)this.validateSchema(e,!0);return a}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta)this._compileMetaSchema(e);else io.compileSchema.call(this,e);if(!e.validate)throw Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{io.compileSchema.call(this,e)}finally{this.opts=t}}}ii.ValidationError=FT.default;ii.MissingRefError=_y.default;Tt.default=ii;function hy(e,t,r,n="error"){for(let o in e){let s=o;if(s in t)this.logger[n](`${r}: option ${o}. ${e[s]}`)}}function gy(e){return e=so.normalizeId(e),this.schemas[e]||this.refs[e]}function XT(){let e=this.opts.schemas;if(!e)return;if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function YT(){for(let e in this.opts.formats){let t=this.opts.formats[e];if(t)this.addFormat(e,t)}}function QT(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];if(!r.keyword)r.keyword=t;this.addKeyword(r)}}function eE(){let e={...this.opts};for(let t of BT)delete e[t];return e}var tE={log(){},warn(){},error(){}};function rE(e){if(e===!1)return tE;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw Error("logger must implement log, warn and error methods")}var nE=/^[a-z_$][a-z0-9_$:-]*$/i;function oE(e,t){let{RULES:r}=this;if(zl.eachItem(e,(n)=>{if(r.keywords[n])throw Error(`Keyword ${n} is already defined`);if(!nE.test(n))throw Error(`Keyword ${n} has invalid name`)}),!t)return;if(t.$data&&!(("code"in t)||("validate"in t)))throw Error('$data keyword must have "code" or "validate" function')}function Sl(e,t,r){var n;let o=t===null||t===void 0?void 0:t.post;if(r&&o)throw Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,i=o?s.post:s.rules.find(({type:c})=>c===r);if(!i)i={type:r,rules:[]},s.rules.push(i);if(s.keywords[e]=!0,!t)return;let a={keyword:e,definition:{...t,type:si.getJSONTypes(t.type),schemaType:si.getJSONTypes(t.schemaType)}};if(t.before)sE.call(this,i,a,t.before);else i.rules.push(a);s.all[e]=a,(n=t.implements)===null||n===void 0||n.forEach((c)=>this.addKeyword(c))}function sE(e,t,r){let n=e.rules.findIndex((o)=>o.keyword===r);if(n>=0)e.rules.splice(n,0,t);else e.rules.push(t),this.logger.warn(`rule ${r} is not defined`)}function iE(e){let{metaSchema:t}=e;if(t===void 0)return;if(e.$data&&this.opts.$data)t=vy(t);e.validateSchema=this.compile(t,!0)}var aE={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function vy(e){return{anyOf:[e,aE]}}});var $y=k(function(by){Object.defineProperty(by,"__esModule",{value:!0});var lE={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};by.default=lE});var Ty=k(function(zy){Object.defineProperty(zy,"__esModule",{value:!0});zy.callRef=zy.getValidate=void 0;var pE=to(),wy=Ge(),Me=L(),qr=zt(),ky=Qs(),ai=W(),fE={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:n}=e,{baseId:o,schemaEnv:s,validateName:i,opts:a,self:c}=n,{root:u}=s;if((r==="#"||r==="#/")&&o===u.baseId)return d();let l=ky.resolveRef.call(c,u,o,r);if(l===void 0)throw new pE.default(n.opts.uriResolver,o,r);if(l instanceof ky.SchemaEnv)return f(l);return p(l);function d(){if(s===u)return ci(e,i,s,s.$async);let m=t.scopeValue("root",{ref:u});return ci(e,Me._`${m}.validate`,u,u.$async)}function f(m){let h=Sy(e,m);ci(e,h,m,m.$async)}function p(m){let h=t.scopeValue("schema",a.code.source===!0?{ref:m,code:Me.stringify(m)}:{ref:m}),_=t.name("valid"),v=e.subschema({schema:m,dataTypes:[],schemaPath:Me.nil,topSchemaRef:h,errSchemaPath:r},_);e.mergeEvaluated(v),e.ok(_)}}};function Sy(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):Me._`${r.scopeValue("wrapper",{ref:t})}.validate`}zy.getValidate=Sy;function ci(e,t,r,n){let{gen:o,it:s}=e,{allErrors:i,schemaEnv:a,opts:c}=s,u=c.passContext?qr.default.this:Me.nil;if(n)l();else d();function l(){if(!a.$async)throw Error("async schema referenced by sync schema");let m=o.let("valid");o.try(()=>{if(o.code(Me._`await ${wy.callValidateCode(e,t,u)}`),p(t),!i)o.assign(m,!0)},(h)=>{if(o.if(Me._`!(${h} instanceof ${s.ValidationError})`,()=>o.throw(h)),f(h),!i)o.assign(m,!1)}),e.ok(m)}function d(){e.result(wy.callValidateCode(e,t,u),()=>p(t),()=>f(t))}function f(m){let h=Me._`${m}.errors`;o.assign(qr.default.vErrors,Me._`${qr.default.vErrors} === null ? ${h} : ${qr.default.vErrors}.concat(${h})`),o.assign(qr.default.errors,Me._`${qr.default.vErrors}.length`)}function p(m){var h;if(!s.opts.unevaluated)return;let _=(h=r===null||r===void 0?void 0:r.validate)===null||h===void 0?void 0:h.evaluated;if(s.props!==!0)if(_&&!_.dynamicProps){if(_.props!==void 0)s.props=ai.mergeEvaluated.props(o,_.props,s.props)}else{let v=o.var("props",Me._`${m}.evaluated.props`);s.props=ai.mergeEvaluated.props(o,v,s.props,Me.Name)}if(s.items!==!0)if(_&&!_.dynamicItems){if(_.items!==void 0)s.items=ai.mergeEvaluated.items(o,_.items,s.items)}else{let v=o.var("items",Me._`${m}.evaluated.items`);s.items=ai.mergeEvaluated.items(o,v,s.items,Me.Name)}}}zy.callRef=ci;zy.default=fE});var Oy=k(function(Ey){Object.defineProperty(Ey,"__esModule",{value:!0});var gE=$y(),_E=Ty(),yE=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",gE.default,_E.default];Ey.default=yE});var Iy=k(function(Ry){Object.defineProperty(Ry,"__esModule",{value:!0});var li=L(),Vt=li.operators,ui={maximum:{okStr:"<=",ok:Vt.LTE,fail:Vt.GT},minimum:{okStr:">=",ok:Vt.GTE,fail:Vt.LT},exclusiveMaximum:{okStr:"<",ok:Vt.LT,fail:Vt.GTE},exclusiveMinimum:{okStr:">",ok:Vt.GT,fail:Vt.LTE}},xE={message:({keyword:e,schemaCode:t})=>li.str`must be ${ui[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>li._`{comparison: ${ui[e].okStr}, limit: ${t}}`},bE={keyword:Object.keys(ui),type:"number",schemaType:"number",$data:!0,error:xE,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data(li._`${r} ${ui[t].fail} ${n} || isNaN(${r})`)}};Ry.default=bE});var Ay=k(function(Cy){Object.defineProperty(Cy,"__esModule",{value:!0});var ao=L(),wE={message:({schemaCode:e})=>ao.str`must be multiple of ${e}`,params:({schemaCode:e})=>ao._`{multipleOf: ${e}}`},kE={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:wE,code(e){let{gen:t,data:r,schemaCode:n,it:o}=e,s=o.opts.multipleOfPrecision,i=t.let("res"),a=s?ao._`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:ao._`${i} !== parseInt(${i})`;e.fail$data(ao._`(${n} === 0 || (${i} = ${r}/${n}, ${a}))`)}};Cy.default=kE});var Zy=k(function(jy){Object.defineProperty(jy,"__esModule",{value:!0});function Ny(e){let t=e.length,r=0,n=0,o;while(n<t)if(r++,o=e.charCodeAt(n++),o>=55296&&o<=56319&&n<t){if(o=e.charCodeAt(n),(o&64512)===56320)n++}return r}jy.default=Ny;Ny.code='require("ajv/dist/runtime/ucs2length").default'});var Dy=k(function(My){Object.defineProperty(My,"__esModule",{value:!0});var lr=L(),PE=W(),TE=Zy(),EE={message({keyword:e,schemaCode:t}){return lr.str`must NOT have ${e==="maxLength"?"more":"fewer"} than ${t} characters`},params:({schemaCode:e})=>lr._`{limit: ${e}}`},OE={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:EE,code(e){let{keyword:t,data:r,schemaCode:n,it:o}=e,s=t==="maxLength"?lr.operators.GT:lr.operators.LT,i=o.opts.unicode===!1?lr._`${r}.length`:lr._`${PE.useFunc(e.gen,TE.default)}(${r})`;e.fail$data(lr._`${i} ${s} ${n}`)}};My.default=OE});var Ly=k(function(qy){Object.defineProperty(qy,"__esModule",{value:!0});var IE=Ge(),CE=W(),Lr=L(),AE={message:({schemaCode:e})=>Lr.str`must match pattern "${e}"`,params:({schemaCode:e})=>Lr._`{pattern: ${e}}`},NE={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:AE,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:s,it:i}=e,a=i.opts.unicodeRegExp?"u":"";if(n){let{regExp:c}=i.opts.code,u=c.code==="new RegExp"?Lr._`new RegExp`:CE.useFunc(t,c),l=t.let("valid");t.try(()=>t.assign(l,Lr._`${u}(${s}, ${a}).test(${r})`),()=>t.assign(l,!1)),e.fail$data(Lr._`!${l}`)}else{let c=IE.usePattern(e,o);e.fail$data(Lr._`!${c}.test(${r})`)}}};qy.default=NE});var Uy=k(function(Fy){Object.defineProperty(Fy,"__esModule",{value:!0});var co=L(),ZE={message({keyword:e,schemaCode:t}){return co.str`must NOT have ${e==="maxProperties"?"more":"fewer"} than ${t} properties`},params:({schemaCode:e})=>co._`{limit: ${e}}`},ME={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:ZE,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxProperties"?co.operators.GT:co.operators.LT;e.fail$data(co._`Object.keys(${r}).length ${o} ${n}`)}};Fy.default=ME});var Hy=k(function(Vy){Object.defineProperty(Vy,"__esModule",{value:!0});var lo=Ge(),uo=L(),qE=W(),LE={message:({params:{missingProperty:e}})=>uo.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>uo._`{missingProperty: ${e}}`},FE={keyword:"required",type:"object",schemaType:"array",$data:!0,error:LE,code(e){let{gen:t,schema:r,schemaCode:n,data:o,$data:s,it:i}=e,{opts:a}=i;if(!s&&r.length===0)return;let c=r.length>=a.loopRequired;if(i.allErrors)u();else l();if(a.strictRequired){let p=e.parentSchema.properties,{definedProperties:m}=e.it;for(let h of r)if((p===null||p===void 0?void 0:p[h])===void 0&&!m.has(h)){let _=i.schemaEnv.baseId+i.errSchemaPath,v=`required property "${h}" is not defined at "${_}" (strictRequired)`;qE.checkStrictMode(i,v,i.opts.strictRequired)}}function u(){if(c||s)e.block$data(uo.nil,d);else for(let p of r)lo.checkReportMissingProp(e,p)}function l(){let p=t.let("missing");if(c||s){let m=t.let("valid",!0);e.block$data(m,()=>f(p,m)),e.ok(m)}else t.if(lo.checkMissingProp(e,r,p)),lo.reportMissingProp(e,p),t.else()}function d(){t.forOf("prop",n,(p)=>{e.setParams({missingProperty:p}),t.if(lo.noPropertyInData(t,o,p,a.ownProperties),()=>e.error())})}function f(p,m){e.setParams({missingProperty:p}),t.forOf(p,n,()=>{t.assign(m,lo.propertyInData(t,o,p,a.ownProperties)),t.if(uo.not(m),()=>{e.error(),t.break()})},uo.nil)}}};Vy.default=FE});var Jy=k(function(By){Object.defineProperty(By,"__esModule",{value:!0});var po=L(),VE={message({keyword:e,schemaCode:t}){return po.str`must NOT have ${e==="maxItems"?"more":"fewer"} than ${t} items`},params:({schemaCode:e})=>po._`{limit: ${e}}`},HE={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:VE,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxItems"?po.operators.GT:po.operators.LT;e.fail$data(po._`${r}.length ${o} ${n}`)}};By.default=HE});var di=k(function(Gy){Object.defineProperty(Gy,"__esModule",{value:!0});var Ky=ol();Ky.code='require("ajv/dist/runtime/equal").default';Gy.default=Ky});var Xy=k(function(Wy){Object.defineProperty(Wy,"__esModule",{value:!0});var Pl=Wn(),be=L(),KE=W(),GE=di(),WE={message:({params:{i:e,j:t}})=>be.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>be._`{i: ${e}, j: ${t}}`},XE={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:WE,code(e){let{gen:t,data:r,$data:n,schema:o,parentSchema:s,schemaCode:i,it:a}=e;if(!n&&!o)return;let c=t.let("valid"),u=s.items?Pl.getSchemaTypes(s.items):[];e.block$data(c,l,be._`${i} === false`),e.ok(c);function l(){let m=t.let("i",be._`${r}.length`),h=t.let("j");e.setParams({i:m,j:h}),t.assign(c,!0),t.if(be._`${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 _=t.name("item"),v=Pl.checkDataTypes(u,_,a.opts.strictNumbers,Pl.DataType.Wrong),z=t.const("indices",be._`{}`);t.for(be._`;${m}--;`,()=>{if(t.let(_,be._`${r}[${m}]`),t.if(v,be._`continue`),u.length>1)t.if(be._`typeof ${_} == "string"`,be._`${_} += "_"`);t.if(be._`typeof ${z}[${_}] == "number"`,()=>{t.assign(h,be._`${z}[${_}]`),e.error(),t.assign(c,!1).break()}).code(be._`${z}[${_}] = ${m}`)})}function p(m,h){let _=KE.useFunc(t,GE.default),v=t.name("outer");t.label(v).for(be._`;${m}--;`,()=>t.for(be._`${h} = ${m}; ${h}--;`,()=>t.if(be._`${_}(${r}[${m}], ${r}[${h}])`,()=>{e.error(),t.assign(c,!1).break(v)})))}}};Wy.default=XE});var Qy=k(function(Yy){Object.defineProperty(Yy,"__esModule",{value:!0});var Tl=L(),QE=W(),eO=di(),tO={message:"must be equal to constant",params:({schemaCode:e})=>Tl._`{allowedValue: ${e}}`},rO={keyword:"const",$data:!0,error:tO,code(e){let{gen:t,data:r,$data:n,schemaCode:o,schema:s}=e;if(n||s&&typeof s=="object")e.fail$data(Tl._`!${QE.useFunc(t,eO.default)}(${r}, ${o})`);else e.fail(Tl._`${s} !== ${r}`)}};Yy.default=rO});var tv=k(function(ev){Object.defineProperty(ev,"__esModule",{value:!0});var fo=L(),oO=W(),sO=di(),iO={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>fo._`{allowedValues: ${e}}`},aO={keyword:"enum",schemaType:"array",$data:!0,error:iO,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:s,it:i}=e;if(!n&&o.length===0)throw Error("enum must have non-empty array");let a=o.length>=i.opts.loopEnum,c,u=()=>c!==null&&c!==void 0?c:c=oO.useFunc(t,sO.default),l;if(a||n)l=t.let("valid"),e.block$data(l,d);else{if(!Array.isArray(o))throw Error("ajv implementation error");let p=t.const("vSchema",s);l=fo.or(...o.map((m,h)=>f(p,h)))}e.pass(l);function d(){t.assign(l,!1),t.forOf("v",s,(p)=>t.if(fo._`${u()}(${r}, ${p})`,()=>t.assign(l,!0).break()))}function f(p,m){let h=o[m];return typeof h==="object"&&h!==null?fo._`${u()}(${r}, ${p}[${m}])`:fo._`${r} === ${h}`}}};ev.default=aO});var nv=k(function(rv){Object.defineProperty(rv,"__esModule",{value:!0});var uO=Iy(),lO=Ay(),dO=Dy(),pO=Ly(),fO=Uy(),mO=Hy(),hO=Jy(),gO=Xy(),_O=Qy(),yO=tv(),vO=[uO.default,lO.default,dO.default,pO.default,fO.default,mO.default,hO.default,gO.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},_O.default,yO.default];rv.default=vO});var Ol=k(function(sv){Object.defineProperty(sv,"__esModule",{value:!0});sv.validateAdditionalItems=void 0;var dr=L(),El=W(),bO={message:({params:{len:e}})=>dr.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>dr._`{limit: ${e}}`},$O={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:bO,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){El.checkStrictMode(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}ov(e,n)}};function ov(e,t){let{gen:r,schema:n,data:o,keyword:s,it:i}=e;i.items=!0;let a=r.const("len",dr._`${o}.length`);if(n===!1)e.setParams({len:t.length}),e.pass(dr._`${a} <= ${t.length}`);else if(typeof n=="object"&&!El.alwaysValidSchema(i,n)){let u=r.var("valid",dr._`${a} <= ${t.length}`);r.if(dr.not(u),()=>c(u)),e.ok(u)}function c(u){r.forRange("i",t.length,a,(l)=>{if(e.subschema({keyword:s,dataProp:l,dataPropType:El.Type.Num},u),!i.allErrors)r.if(dr.not(u),()=>r.break())})}}sv.validateAdditionalItems=ov;sv.default=$O});var Rl=k(function(uv){Object.defineProperty(uv,"__esModule",{value:!0});uv.validateTuple=void 0;var av=L(),pi=W(),kO=Ge(),SO={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return cv(e,"additionalItems",t);if(r.items=!0,pi.alwaysValidSchema(r,t))return;e.ok(kO.validateArray(e))}};function cv(e,t,r=e.schema){let{gen:n,parentSchema:o,data:s,keyword:i,it:a}=e;if(l(o),a.opts.unevaluated&&r.length&&a.items!==!0)a.items=pi.mergeEvaluated.items(n,r.length,a.items);let c=n.name("valid"),u=n.const("len",av._`${s}.length`);r.forEach((d,f)=>{if(pi.alwaysValidSchema(a,d))return;n.if(av._`${u} > ${f}`,()=>e.subschema({keyword:i,schemaProp:f,dataProp:f},c)),e.ok(c)});function l(d){let{opts:f,errSchemaPath:p}=a,m=r.length,h=m===d.minItems&&(m===d.maxItems||d[t]===!1);if(f.strictTuples&&!h){let _=`"${i}" is ${m}-tuple, but minItems or maxItems/${t} are not specified or different at path "${p}"`;pi.checkStrictMode(a,_,f.strictTuples)}}}uv.validateTuple=cv;uv.default=SO});var pv=k(function(dv){Object.defineProperty(dv,"__esModule",{value:!0});var PO=Rl(),TO={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(e)=>PO.validateTuple(e,"items")};dv.default=TO});var hv=k(function(mv){Object.defineProperty(mv,"__esModule",{value:!0});var fv=L(),OO=W(),RO=Ge(),IO=Ol(),CO={message:({params:{len:e}})=>fv.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>fv._`{limit: ${e}}`},AO={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:CO,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:o}=r;if(n.items=!0,OO.alwaysValidSchema(n,t))return;if(o)IO.validateAdditionalItems(e,o);else e.ok(RO.validateArray(e))}};mv.default=AO});var _v=k(function(gv){Object.defineProperty(gv,"__esModule",{value:!0});var We=L(),fi=W(),jO={message:({params:{min:e,max:t}})=>t===void 0?We.str`must contain at least ${e} valid item(s)`:We.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?We._`{minContains: ${e}}`:We._`{minContains: ${e}, maxContains: ${t}}`},ZO={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:jO,code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:s}=e,i,a,{minContains:c,maxContains:u}=n;if(s.opts.next)i=c===void 0?1:c,a=u;else i=1;let l=t.const("len",We._`${o}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){fi.checkStrictMode(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){fi.checkStrictMode(s,'"minContains" > "maxContains" is always invalid'),e.fail();return}if(fi.alwaysValidSchema(s,r)){let h=We._`${l} >= ${i}`;if(a!==void 0)h=We._`${h} && ${l} <= ${a}`;e.pass(h);return}s.items=!0;let d=t.name("valid");if(a===void 0&&i===1)p(d,()=>t.if(d,()=>t.break()));else if(i===0){if(t.let(d,!0),a!==void 0)t.if(We._`${o}.length > 0`,f)}else t.let(d,!1),f();e.result(d,()=>e.reset());function f(){let h=t.name("_valid"),_=t.let("count",0);p(h,()=>t.if(h,()=>m(_)))}function p(h,_){t.forRange("i",0,l,(v)=>{e.subschema({keyword:"contains",dataProp:v,dataPropType:fi.Type.Num,compositeRule:!0},h),_()})}function m(h){if(t.code(We._`${h}++`),a===void 0)t.if(We._`${h} >= ${i}`,()=>t.assign(d,!0).break());else if(t.if(We._`${h} > ${a}`,()=>t.assign(d,!1).break()),i===1)t.assign(d,!0);else t.if(We._`${h} >= ${i}`,()=>t.assign(d,!0))}}};gv.default=ZO});var wv=k(function(xv){Object.defineProperty(xv,"__esModule",{value:!0});xv.validateSchemaDeps=xv.validatePropertyDeps=xv.error=void 0;var Il=L(),DO=W(),mo=Ge();xv.error={message:({params:{property:e,depsCount:t,deps:r}})=>Il.str`must have ${t===1?"property":"properties"} ${r} when property ${e} is present`,params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>Il._`{property: ${e},
7
7
  missingProperty: ${n},
8
8
  depsCount: ${t},
9
- deps: ${r}}`};var qO={keyword:"dependencies",type:"object",schemaType:"object",error:xv.error,code(e){let[t,r]=LO(e);yv(e,t),vv(e,r)}};function LO({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 yv(e,t=e.schema){let{gen:r,data:n,it:o}=e;if(Object.keys(t).length===0)return;let s=r.let("missing");for(let i in t){let a=t[i];if(a.length===0)continue;let c=mo.propertyInData(r,n,i,o.opts.ownProperties);if(e.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),o.allErrors)r.if(c,()=>{for(let u of a)mo.checkReportMissingProp(e,u)});else r.if(Il._`${c} && (${mo.checkMissingProp(e,a,s)})`),mo.reportMissingProp(e,s),r.else()}}xv.validatePropertyDeps=yv;function vv(e,t=e.schema){let{gen:r,data:n,keyword:o,it:s}=e,i=r.name("valid");for(let a in t){if(DO.alwaysValidSchema(s,t[a]))continue;r.if(mo.propertyInData(r,n,a,s.opts.ownProperties),()=>{let c=e.subschema({keyword:o,schemaProp:a},i);e.mergeValidEvaluated(c,i)},()=>r.var(i,!0)),e.ok(i)}}xv.validateSchemaDeps=vv;xv.default=qO});var zv=k(function(Sv){Object.defineProperty(Sv,"__esModule",{value:!0});var kv=L(),VO=W(),HO={message:"property name must be valid",params:({params:e})=>kv._`{propertyName: ${e.propertyName}}`},BO={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:HO,code(e){let{gen:t,schema:r,data:n,it:o}=e;if(VO.alwaysValidSchema(o,r))return;let s=t.name("valid");t.forIn("key",n,(i)=>{e.setParams({propertyName:i}),e.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},s),t.if(kv.not(s),()=>{if(e.error(!0),!o.allErrors)t.break()})}),e.ok(s)}};Sv.default=BO});var Cl=k(function(Pv){Object.defineProperty(Pv,"__esModule",{value:!0});var mi=Ge(),it=L(),KO=zt(),hi=W(),GO={message:"must NOT have additional properties",params:({params:e})=>it._`{additionalProperty: ${e.additionalProperty}}`},WO={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:GO,code(e){let{gen:t,schema:r,parentSchema:n,data:o,errsCount:s,it:i}=e;if(!s)throw Error("ajv implementation error");let{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&hi.alwaysValidSchema(i,r))return;let u=mi.allSchemaProperties(n.properties),l=mi.allSchemaProperties(n.patternProperties);d(),e.ok(it._`${s} === ${KO.default.errors}`);function d(){t.forIn("key",o,(_)=>{if(!u.length&&!l.length)m(_);else t.if(f(_),()=>m(_))})}function f(_){let v;if(u.length>8){let z=hi.schemaRefOrVal(i,n.properties,"properties");v=mi.isOwnProperty(t,z,_)}else if(u.length)v=it.or(...u.map((z)=>it._`${_} === ${z}`));else v=it.nil;if(l.length)v=it.or(v,...l.map((z)=>it._`${mi.usePattern(e,z)}.test(${_})`));return it.not(v)}function p(_){t.code(it._`delete ${o}[${_}]`)}function m(_){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){p(_);return}if(r===!1){if(e.setParams({additionalProperty:_}),e.error(),!a)t.break();return}if(typeof r=="object"&&!hi.alwaysValidSchema(i,r)){let v=t.name("valid");if(c.removeAdditional==="failing")h(_,v,!1),t.if(it.not(v),()=>{e.reset(),p(_)});else if(h(_,v),!a)t.if(it.not(v),()=>t.break())}}function h(_,v,z){let A={keyword:"additionalProperties",dataProp:_,dataPropType:hi.Type.Str};if(z===!1)Object.assign(A,{compositeRule:!0,createErrors:!1,allErrors:!1});e.subschema(A,v)}}};Pv.default=WO});var Rv=k(function(Ov){Object.defineProperty(Ov,"__esModule",{value:!0});var YO=eo(),Ev=Ge(),Al=W(),Tv=Cl(),QO={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:s}=e;if(s.opts.removeAdditional==="all"&&n.additionalProperties===void 0)Tv.default.code(new YO.KeywordCxt(s,Tv.default,"additionalProperties"));let i=Ev.allSchemaProperties(r);for(let d of i)s.definedProperties.add(d);if(s.opts.unevaluated&&i.length&&s.props!==!0)s.props=Al.mergeEvaluated.props(t,Al.toHash(i),s.props);let a=i.filter((d)=>!Al.alwaysValidSchema(s,r[d]));if(a.length===0)return;let c=t.name("valid");for(let d of a){if(u(d))l(d);else{if(t.if(Ev.propertyInData(t,o,d,s.opts.ownProperties)),l(d),!s.allErrors)t.else().var(c,!0);t.endIf()}e.it.definedProperties.add(d),e.ok(c)}function u(d){return s.opts.useDefaults&&!s.compositeRule&&r[d].default!==void 0}function l(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};Ov.default=QO});var jv=k(function(Nv){Object.defineProperty(Nv,"__esModule",{value:!0});var Iv=Ge(),gi=L(),Cv=W(),Av=W(),tR={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:o,it:s}=e,{opts:i}=s,a=Iv.allSchemaProperties(r),c=a.filter((h)=>Cv.alwaysValidSchema(s,r[h]));if(a.length===0||c.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let u=i.strictSchema&&!i.allowMatchingProperties&&o.properties,l=t.name("valid");if(s.props!==!0&&!(s.props instanceof gi.Name))s.props=Av.evaluatedPropsToName(t,s.props);let{props:d}=s;f();function f(){for(let h of a){if(u)p(h);if(s.allErrors)m(h);else t.var(l,!0),m(h),t.if(l)}}function p(h){for(let _ in u)if(new RegExp(h).test(_))Cv.checkStrictMode(s,`property ${_} matches pattern ${h} (use allowMatchingProperties)`)}function m(h){t.forIn("key",n,(_)=>{t.if(gi._`${Iv.usePattern(e,h)}.test(${_})`,()=>{let v=c.includes(h);if(!v)e.subschema({keyword:"patternProperties",schemaProp:h,dataProp:_,dataPropType:Av.Type.Str},l);if(s.opts.unevaluated&&d!==!0)t.assign(gi._`${d}[${_}]`,!0);else if(!v&&!s.allErrors)t.if(gi.not(l),()=>t.break())})})}}};Nv.default=tR});var Mv=k(function(Zv){Object.defineProperty(Zv,"__esModule",{value:!0});var nR=W(),oR={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if(nR.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"}};Zv.default=oR});var qv=k(function(Dv){Object.defineProperty(Dv,"__esModule",{value:!0});var iR=Ge(),aR={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:iR.validateUnion,error:{message:"must match a schema in anyOf"}};Dv.default=aR});var Fv=k(function(Lv){Object.defineProperty(Lv,"__esModule",{value:!0});var _i=L(),uR=W(),lR={message:"must match exactly one schema in oneOf",params:({params:e})=>_i._`{passingSchemas: ${e.passing}}`},dR={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:lR,code(e){let{gen:t,schema:r,parentSchema:n,it:o}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;let s=r,i=t.let("valid",!1),a=t.let("passing",null),c=t.name("_valid");e.setParams({passing:a}),t.block(u),e.result(i,()=>e.reset(),()=>e.error(!0));function u(){s.forEach((l,d)=>{let f;if(uR.alwaysValidSchema(o,l))t.var(c,!0);else f=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c);if(d>0)t.if(_i._`${c} && ${i}`).assign(i,!1).assign(a,_i._`[${a}, ${d}]`).else();t.if(c,()=>{if(t.assign(i,!0),t.assign(a,d),f)e.mergeEvaluated(f,_i.Name)})})}}};Lv.default=dR});var Vv=k(function(Uv){Object.defineProperty(Uv,"__esModule",{value:!0});var fR=W(),mR={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");let o=t.name("valid");r.forEach((s,i)=>{if(fR.alwaysValidSchema(n,s))return;let a=e.subschema({keyword:"allOf",schemaProp:i},o);e.ok(o),e.mergeEvaluated(a)})}};Uv.default=mR});var Kv=k(function(Jv){Object.defineProperty(Jv,"__esModule",{value:!0});var yi=L(),Bv=W(),gR={message:({params:e})=>yi.str`must match "${e.ifClause}" schema`,params:({params:e})=>yi._`{failingKeyword: ${e.ifClause}}`},_R={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:gR,code(e){let{gen:t,parentSchema:r,it:n}=e;if(r.then===void 0&&r.else===void 0)Bv.checkStrictMode(n,'"if" without "then" and "else" is ignored');let o=Hv(n,"then"),s=Hv(n,"else");if(!o&&!s)return;let i=t.let("valid",!0),a=t.name("_valid");if(c(),e.reset(),o&&s){let l=t.let("ifClause");e.setParams({ifClause:l}),t.if(a,u("then",l),u("else",l))}else if(o)t.if(a,u("then"));else t.if(yi.not(a),u("else"));e.pass(i,()=>e.error(!0));function c(){let l=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(l)}function u(l,d){return()=>{let f=e.subschema({keyword:l},a);if(t.assign(i,a),e.mergeValidEvaluated(f,i),d)t.assign(d,yi._`${l}`);else e.setParams({ifClause:l})}}}};function Hv(e,t){let r=e.schema[t];return r!==void 0&&!Bv.alwaysValidSchema(e,r)}Jv.default=_R});var Wv=k(function(Gv){Object.defineProperty(Gv,"__esModule",{value:!0});var vR=W(),xR={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){if(t.if===void 0)vR.checkStrictMode(r,`"${e}" without "if" is ignored`)}};Gv.default=xR});var Yv=k(function(Xv){Object.defineProperty(Xv,"__esModule",{value:!0});var $R=Ol(),wR=pv(),kR=Rl(),SR=hv(),zR=_v(),PR=wv(),TR=zv(),ER=Cl(),OR=Rv(),RR=jv(),IR=Mv(),CR=qv(),AR=Fv(),NR=Vv(),jR=Kv(),ZR=Wv();function MR(e=!1){let t=[IR.default,CR.default,AR.default,NR.default,jR.default,ZR.default,TR.default,ER.default,PR.default,OR.default,RR.default];if(e)t.push(wR.default,SR.default);else t.push($R.default,kR.default);return t.push(zR.default),t}Xv.default=MR});var ex=k(function(Qv){Object.defineProperty(Qv,"__esModule",{value:!0});var fe=L(),qR={message:({schemaCode:e})=>fe.str`must match format "${e}"`,params:({schemaCode:e})=>fe._`{format: ${e}}`},LR={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:qR,code(e,t){let{gen:r,data:n,$data:o,schema:s,schemaCode:i,it:a}=e,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=a;if(!c.validateFormats)return;if(o)f();else p();function f(){let m=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),h=r.const("fDef",fe._`${m}[${i}]`),_=r.let("fType"),v=r.let("format");r.if(fe._`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(_,fe._`${h}.type || "string"`).assign(v,fe._`${h}.validate`),()=>r.assign(_,fe._`"string"`).assign(v,h)),e.fail$data(fe.or(z(),A()));function z(){if(c.strictSchema===!1)return fe.nil;return fe._`${i} && !${v}`}function A(){let K=l.$async?fe._`(${h}.async ? await ${v}(${n}) : ${v}(${n}))`:fe._`${v}(${n})`,E=fe._`(typeof ${v} == "function" ? ${K} : ${v}.test(${n}))`;return fe._`${v} && ${v} !== true && ${_} === ${t} && !${E}`}}function p(){let m=d.formats[s];if(!m){z();return}if(m===!0)return;let[h,_,v]=A(m);if(h===t)e.pass(K());function z(){if(c.strictSchema===!1){d.logger.warn(E());return}throw Error(E());function E(){return`unknown format "${s}" ignored in schema at path "${u}"`}}function A(E){let V=E instanceof RegExp?fe.regexpCode(E):c.code.formats?fe._`${c.code.formats}${fe.getProperty(s)}`:void 0,me=r.scopeValue("formats",{key:s,ref:E,code:V});if(typeof E=="object"&&!(E instanceof RegExp))return[E.type||"string",E.validate,fe._`${me}.validate`];return["string",E,me]}function K(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!l.$async)throw Error("async format in sync schema");return fe._`await ${v}(${n})`}return typeof _=="function"?fe._`${v}(${n})`:fe._`${v}.test(${n})`}}}};Qv.default=LR});var rx=k(function(tx){Object.defineProperty(tx,"__esModule",{value:!0});var UR=ex(),VR=[UR.default];tx.default=VR});var sx=k(function(nx){Object.defineProperty(nx,"__esModule",{value:!0});nx.contentVocabulary=nx.metadataVocabulary=void 0;nx.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];nx.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var cx=k(function(ax){Object.defineProperty(ax,"__esModule",{value:!0});var JR=Oy(),KR=nv(),GR=Yv(),WR=rx(),ix=sx(),XR=[JR.default,KR.default,(0,GR.default)(),WR.default,ix.metadataVocabulary,ix.contentVocabulary];ax.default=XR});var px=k(function(lx){Object.defineProperty(lx,"__esModule",{value:!0});lx.DiscrError=void 0;var ux;(function(e){e.Tag="tag",e.Mapping="mapping"})(ux||(lx.DiscrError=ux={}))});var hx=k(function(mx){Object.defineProperty(mx,"__esModule",{value:!0});var Fr=L(),Nl=px(),fx=Qs(),QR=to(),eI=W(),tI={message:({params:{discrError:e,tagName:t}})=>e===Nl.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>Fr._`{error: ${e}, tag: ${r}, tagValue: ${t}}`},rI={keyword:"discriminator",type:"object",schemaType:"object",error:tI,code(e){let{gen:t,data:r,schema:n,parentSchema:o,it:s}=e,{oneOf:i}=o;if(!s.opts.discriminator)throw Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw Error("discriminator: requires propertyName");if(n.mapping)throw Error("discriminator: mapping is not supported");if(!i)throw Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),u=t.const("tag",Fr._`${r}${Fr.getProperty(a)}`);t.if(Fr._`typeof ${u} == "string"`,()=>l(),()=>e.error(!1,{discrError:Nl.DiscrError.Tag,tag:u,tagName:a})),e.ok(c);function l(){let p=f();t.if(!1);for(let m in p)t.elseIf(Fr._`${u} === ${m}`),t.assign(c,d(p[m]));t.else(),e.error(!1,{discrError:Nl.DiscrError.Mapping,tag:u,tagName:a}),t.endIf()}function d(p){let m=t.name("valid"),h=e.subschema({keyword:"oneOf",schemaProp:p},m);return e.mergeEvaluated(h,Fr.Name),m}function f(){var p;let m={},h=v(o),_=!0;for(let K=0;K<i.length;K++){let E=i[K];if((E===null||E===void 0?void 0:E.$ref)&&!eI.schemaHasRulesButRef(E,s.self.RULES)){let me=E.$ref;if(E=fx.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,me),E instanceof fx.SchemaEnv)E=E.schema;if(E===void 0)throw new QR.default(s.opts.uriResolver,s.baseId,me)}let V=(p=E===null||E===void 0?void 0:E.properties)===null||p===void 0?void 0:p[a];if(typeof V!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);_=_&&(h||v(E)),z(V,K)}if(!_)throw Error(`discriminator: "${a}" must be required`);return m;function v({required:K}){return Array.isArray(K)&&K.includes(a)}function z(K,E){if(K.const)A(K.const,E);else if(K.enum)for(let V of K.enum)A(V,E);else throw Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function A(K,E){if(typeof K!="string"||K in m)throw Error(`discriminator: "${a}" values must be unique strings`);m[K]=E}}}};mx.default=rI});var gx=k(function(F4,oI){oI.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 Zl=k(function(De,jl){Object.defineProperty(De,"__esModule",{value:!0});De.MissingRefError=De.ValidationError=De.CodeGen=De.Name=De.nil=De.stringify=De.str=De._=De.KeywordCxt=De.Ajv=void 0;var sI=xy(),iI=cx(),aI=hx(),_x=gx(),cI=["/properties"],vi="http://json-schema.org/draft-07/schema";class ho extends sI.default{_addVocabularies(){if(super._addVocabularies(),iI.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(aI.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(_x,cI):_x;this.addMetaSchema(e,vi,!1),this.refs["http://json-schema.org/schema"]=vi}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(vi)?vi:void 0)}}De.Ajv=ho;jl.exports=De=ho;jl.exports.Ajv=ho;Object.defineProperty(De,"__esModule",{value:!0});De.default=ho;var uI=eo();Object.defineProperty(De,"KeywordCxt",{enumerable:!0,get:function(){return uI.KeywordCxt}});var Ur=L();Object.defineProperty(De,"_",{enumerable:!0,get:function(){return Ur._}});Object.defineProperty(De,"str",{enumerable:!0,get:function(){return Ur.str}});Object.defineProperty(De,"stringify",{enumerable:!0,get:function(){return Ur.stringify}});Object.defineProperty(De,"nil",{enumerable:!0,get:function(){return Ur.nil}});Object.defineProperty(De,"Name",{enumerable:!0,get:function(){return Ur.Name}});Object.defineProperty(De,"CodeGen",{enumerable:!0,get:function(){return Ur.CodeGen}});var lI=Xs();Object.defineProperty(De,"ValidationError",{enumerable:!0,get:function(){return lI.default}});var dI=to();Object.defineProperty(De,"MissingRefError",{enumerable:!0,get:function(){return dI.default}})});var Px=k(function(Sx){Object.defineProperty(Sx,"__esModule",{value:!0});Sx.formatNames=Sx.fastFormats=Sx.fullFormats=void 0;function _t(e,t){return{validate:e,compare:t}}Sx.fullFormats={date:_t(bx,Ll),time:_t(Dl(!0),Fl),"date-time":_t(yx(!0),wx),"iso-time":_t(Dl(),$x),"iso-date-time":_t(yx(),kx),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:vI,"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:zI,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:xI,int32:{type:"number",validate:wI},int64:{type:"number",validate:kI},float:{type:"number",validate:xx},double:{type:"number",validate:xx},password:!0,binary:!0};Sx.fastFormats={...Sx.fullFormats,date:_t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Ll),time:_t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Fl),"date-time":_t(/^\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,wx),"iso-time":_t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,$x),"iso-date-time":_t(/^\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,kx),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};Sx.formatNames=Object.keys(Sx.fullFormats);function mI(e){return e%4===0&&(e%100!==0||e%400===0)}var hI=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,gI=[0,31,28,31,30,31,30,31,31,30,31,30,31];function bx(e){let t=hI.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&&mI(r)?29:gI[n])}function Ll(e,t){if(!(e&&t))return;if(e>t)return 1;if(e<t)return-1;return 0}var Ml=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Dl(e){return function(r){let n=Ml.exec(r);if(!n)return!1;let o=+n[1],s=+n[2],i=+n[3],a=n[4],c=n[5]==="-"?-1:1,u=+(n[6]||0),l=+(n[7]||0);if(u>23||l>59||e&&!a)return!1;if(o<=23&&s<=59&&i<60)return!0;let d=s-l*c,f=o-u*c-(d<0?1:0);return(f===23||f===-1)&&(d===59||d===-1)&&i<61}}function Fl(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;return r-n}function $x(e,t){if(!(e&&t))return;let r=Ml.exec(e),n=Ml.exec(t);if(!(r&&n))return;if(e=r[1]+r[2]+r[3],t=n[1]+n[2]+n[3],e>t)return 1;if(e<t)return-1;return 0}var ql=/t|\s/i;function yx(e){let t=Dl(e);return function(n){let o=n.split(ql);return o.length===2&&bx(o[0])&&t(o[1])}}function wx(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),n=new Date(t).valueOf();if(!(r&&n))return;return r-n}function kx(e,t){if(!(e&&t))return;let[r,n]=e.split(ql),[o,s]=t.split(ql),i=Ll(r,o);if(i===void 0)return;return i||Fl(n,s)}var _I=/\/|:/,yI=/^(?:[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 vI(e){return _I.test(e)&&yI.test(e)}var vx=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function xI(e){return vx.lastIndex=0,vx.test(e)}var bI=-2147483648,$I=2147483647;function wI(e){return Number.isInteger(e)&&e<=$I&&e>=bI}function kI(e){return Number.isInteger(e)}function xx(){return!0}var SI=/[^\\]\\Z/;function zI(e){if(SI.test(e))return!1;try{return new RegExp(e),!0}catch(t){return!1}}});var Ex=k(function(Tx){Object.defineProperty(Tx,"__esModule",{value:!0});Tx.formatLimitDefinition=void 0;var TI=Zl(),at=L(),Ht=at.operators,xi={formatMaximum:{okStr:"<=",ok:Ht.LTE,fail:Ht.GT},formatMinimum:{okStr:">=",ok:Ht.GTE,fail:Ht.LT},formatExclusiveMaximum:{okStr:"<",ok:Ht.LT,fail:Ht.GTE},formatExclusiveMinimum:{okStr:">",ok:Ht.GT,fail:Ht.LTE}},EI={message:({keyword:e,schemaCode:t})=>at.str`should be ${xi[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>at._`{comparison: ${xi[e].okStr}, limit: ${t}}`};Tx.formatLimitDefinition={keyword:Object.keys(xi),type:"string",schemaType:"string",$data:!0,error:EI,code(e){let{gen:t,data:r,schemaCode:n,keyword:o,it:s}=e,{opts:i,self:a}=s;if(!i.validateFormats)return;let c=new TI.KeywordCxt(s,a.RULES.all.format.definition,"format");if(c.$data)u();else l();function u(){let f=t.scopeValue("formats",{ref:a.formats,code:i.code.formats}),p=t.const("fmt",at._`${f}[${c.schemaCode}]`);e.fail$data(at.or(at._`typeof ${p} != "object"`,at._`${p} instanceof RegExp`,at._`typeof ${p}.compare != "function"`,d(p)))}function l(){let f=c.schema,p=a.formats[f];if(!p||p===!0)return;if(typeof p!="object"||p instanceof RegExp||typeof p.compare!="function")throw Error(`"${o}": format "${f}" does not define "compare" function`);let m=t.scopeValue("formats",{key:f,ref:p,code:i.code.formats?at._`${i.code.formats}${at.getProperty(f)}`:void 0});e.fail$data(d(m))}function d(f){return at._`${f}.compare(${r}, ${n}) ${xi[o].fail} 0`}},dependencies:["format"]};var OI=(e)=>(e.addKeyword(Tx.formatLimitDefinition),e);Tx.default=OI});var Cx=k(function(go,Ix){Object.defineProperty(go,"__esModule",{value:!0});var Vr=Px(),II=Ex(),Hl=L(),Ox=new Hl.Name("fullFormats"),CI=new Hl.Name("fastFormats"),Bl=(e,t={keywords:!0})=>{if(Array.isArray(t))return Rx(e,t,Vr.fullFormats,Ox),e;let[r,n]=t.mode==="fast"?[Vr.fastFormats,CI]:[Vr.fullFormats,Ox],o=t.formats||Vr.formatNames;if(Rx(e,o,r,n),t.keywords)(0,II.default)(e);return e};Bl.get=(e,t="full")=>{let n=(t==="fast"?Vr.fastFormats:Vr.fullFormats)[e];if(!n)throw Error(`Unknown format "${e}"`);return n};function Rx(e,t,r,n){var o,s;(o=(s=e.opts.code).formats)!==null&&o!==void 0||(s.formats=Hl._`require("ajv-formats/dist/formats").${n}`);for(let i of t)e.addFormat(i,r[i])}Ix.exports=go=Bl;Object.defineProperty(go,"__esModule",{value:!0});go.default=Bl});function id(e,t=[]){let r={positional:[],flags:{}};for(let n=0;n<e.length;n++){let o=e[n];if(o==="--"){r.positional.push(...e.slice(n+1));break}if(o.startsWith("--")){let s=o.indexOf("="),i=s<0?o.slice(2):o.slice(2,s);if(s>=0)r.flags[i]=o.slice(s+1);else if(t.includes(i)||n+1>=e.length||e[n+1].startsWith("--"))r.flags[i]=!0;else r.flags[i]=e[++n]}else r.positional.push(o)}return r}function Xe(e,t){let r=e.flags[t];return typeof r==="string"?r:void 0}var Hr={name:"handout",version:"0.1.3",description:"Publish one HTML file from any LLM or any shell and get a shareable, versioned link",type:"module",main:"dist/handout.js",bin:{handout:"dist/handout.js"},files:["dist"],engines:{node:">=20"},scripts:{build:"bun build src/handout.ts --target=node --minify --outfile dist/handout.js && chmod +x dist/handout.js",typecheck:"tsc --noEmit",test:"bun test",prepublishOnly:"bun run build"},devDependencies:{"@types/node":"^24.0.0",typescript:"^5.9.3"},dependencies:{"@modelcontextprotocol/sdk":"^1.30.0",zod:"^4.6.5"},license:"MIT",repository:{type:"git",url:"git+https://github.com/YoseptF/handout.git",directory:"cli"},homepage:"https://handout.yosept.me",keywords:["html","publish","share","artifacts","llm","mcp","cli"],publishConfig:{access:"public"}};import{mkdirSync as ib,readFileSync as ab,writeFileSync as cb}from"node:fs";import{homedir as ub}from"node:os";import{join as bi}from"node:path";var lb="https://handout.yosept.me";function ad(){return process.env.XDG_CONFIG_HOME?bi(process.env.XDG_CONFIG_HOME,"handout"):bi(ub(),".config","handout")}function Br(){return bi(ad(),"config.json")}function ct(){let e={origin:lb};try{e={...e,...JSON.parse(ab(Br(),"utf8"))}}catch{}if(process.env.HANDOUT_ORIGIN)e.origin=process.env.HANDOUT_ORIGIN;if(process.env.HANDOUT_TOKEN)e.token=process.env.HANDOUT_TOKEN;return e}function Jr(e){ib(ad(),{recursive:!0,mode:448}),cb(Br(),JSON.stringify(e,null,2)+`
10
- `,{mode:384})}function cd(e){let t=e.includes("://")?e:`https://${e}`;return new URL(t).origin}import{spawn as db}from"node:child_process";function Kt(e){if(process.env.HANDOUT_NO_BROWSER)return!1;let t=process.platform==="darwin"?["open",e]:process.platform==="win32"?["cmd","/c","start","",e]:["xdg-open",e];try{let r=db(t[0],t.slice(1),{stdio:"ignore",detached:!0});return r.on("error",()=>{}),r.unref(),!0}catch{return!1}}class $i extends Error{status;constructor(e,t){super(e);this.status=t}}async function G(e,t={}){let r=ct(),n=new Headers(t.headers);if(t.auth!==!1){if(!r.token)throw new $i("not logged in. Run `handout login` or set HANDOUT_TOKEN.",401);n.set("authorization",`Bearer ${r.token}`)}n.set("user-agent",`handout-cli/${Hr.version}`);let o=await fetch(`${r.origin}${e}`,{...t,headers:n}),s=await o.text(),i=s;try{i=JSON.parse(s)}catch{}if(!o.ok)throw new $i(typeof i==="object"&&i?.error?i.error:`${o.status} ${o.statusText}`,o.status);return i}import{hostname as pb}from"node:os";async function ud(e){let t=ct(),r=Xe(e,"origin")??Xe(e,"host");if(r)t.origin=cd(r),Jr(t);let n=Xe(e,"token");if(n){t.token=n;let i=await fb(t.origin,n);t.account=i.account.handle,Jr(t),console.log(`logged in to ${t.origin} as ${i.user.login}, publishing into ${i.account.handle}. Saved to ${Br()}`);return}let o=await G("/api/device/start",{method:"POST",auth:!1,headers:{"content-type":"application/json"},body:JSON.stringify({client:`handout cli on ${pb()}`})});if(console.log(`Open ${o.verification_url}`),console.log(`and approve the code ${o.user_code}`),!e.flags["no-browser"])Kt(o.verification_url);let s=Date.now()+o.expires_in*1000;process.stdout.write("waiting");while(Date.now()<s){await new Promise((a)=>setTimeout(a,o.interval*1000));let i=await G("/api/device/poll",{method:"POST",auth:!1,headers:{"content-type":"application/json"},body:JSON.stringify({device_code:o.device_code})});if(i.status==="pending"){process.stdout.write(".");continue}if(process.stdout.write(`
11
- `),i.status==="approved"&&i.token){t.token=i.token,t.account=i.account?.handle,Jr(t),console.log(`logged in, publishing into ${i.account?.name??"your account"} (${i.account?.handle??"?"}). Saved to ${Br()}`);return}throw Error(i.status==="denied"?"login was denied in the browser":"login code expired, run `handout login` again")}throw Error("login timed out")}async function fb(e,t){let r=await fetch(`${e}/api/me`,{headers:{authorization:`Bearer ${t}`}});if(!r.ok)throw Error(`token rejected by ${e}: ${r.status}`);return await r.json()}async function ld(){let e=ct();delete e.token,delete e.account,Jr(e),console.log("logged out (token removed locally; revoke it on /settings/tokens if you want it dead)")}async function dd(){let e=await G("/api/me");console.log(`${e.user.login} → ${e.account.name} (${e.account.handle}) · links on https://${e.host}/`)}import{readFileSync as pd}from"node:fs";function mb(e){if(!e||e==="-")return new Uint8Array(pd(0));return new Uint8Array(pd(e))}async function fd(e){let t=mb(e.positional[0]);if(t.byteLength===0)throw Error("nothing to publish: pass a file or pipe HTML on stdin");let r=new URLSearchParams,n=Xe(e,"title"),o=Xe(e,"visibility"),s=Xe(e,"slug");if(n)r.set("title",n);if(o)r.set("visibility",o);let i=Xe(e,"update");if(s&&!i)r.set("slug",s);let a=i?`/api/artifacts/${encodeURIComponent(i)}?${r}`:`/api/artifacts?${r}`,c=await G(a,{method:i?"PUT":"POST",headers:{"content-type":"text/html; charset=utf-8"},body:t});if(e.flags.json)console.log(JSON.stringify(c,null,2));else console.log(c.url),console.error(`${i?"updated":"published"} ${c.slug} v${c.version}${c.title?` · ${c.title}`:""} · ${c.visibility}`);if(e.flags.open)Kt(c.url)}async function md(e){let t=e.positional[0];if(!t)throw Error("usage: handout versions <slug>");let r=await G(`/api/artifacts/${encodeURIComponent(t)}`);if(e.flags.json)return console.log(JSON.stringify(r,null,2));console.log(`${r.slug}${r.title?` · ${r.title}`:""} · ${r.visibility} · current v${r.version}`);for(let n of r.versions)console.log(` v${n.n} ${n.createdAt.slice(0,16).replace("T"," ")} ${String(n.size).padStart(8)} B ${n.by} ${n.url}`)}async function hd(e){let t=await G("/api/artifacts");if(e.flags.json)return console.log(JSON.stringify(t.artifacts,null,2));for(let r of t.artifacts)console.log(`${r.slug.padEnd(24)} v${String(r.version).padEnd(3)} ${r.visibility.padEnd(7)} ${r.title??""}`)}async function gd(e){let t=e.positional[0];if(!t)throw Error("usage: handout open <slug>");let r=await G(`/api/artifacts/${encodeURIComponent(t)}`);if(console.log(r.url),!e.flags["no-browser"])Kt(r.url)}function hb(e){if(console.log(`${e.slug} · ${e.visibility}${e.title?` · ${e.title}`:""}`),console.log(e.url),e.visibility==="people")console.log(e.people.length?`people: ${e.people.join(", ")}`:"people: nobody yet, add some with `handout share <slug> add <login|email>`")}async function _d(e){let[t,r,...n]=e.positional;if(!t)throw Error("usage: handout share <slug> [--visibility public|link|people] [add|remove <login|email>...]");let o=Xe(e,"visibility"),s=!!e.flags["rotate-link"];if(o||s){if(o&&!["public","link","people"].includes(o))throw Error("visibility must be public, link or people");await G(`/api/artifacts/${encodeURIComponent(t)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({visibility:o,rotateLink:s})})}if(r==="add"||r==="remove"){if(n.length===0)throw Error(`usage: handout share <slug> ${r} <login|email>...`);if(r==="add")await G(`/api/artifacts/${encodeURIComponent(t)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({visibility:"people"})});await G(`/api/artifacts/${encodeURIComponent(t)}/people`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({[r]:n})})}else if(r)throw Error(`unknown action "${r}", use add or remove`);let i=await G(`/api/artifacts/${encodeURIComponent(t)}`);if(e.flags.json)console.log(JSON.stringify(i,null,2));else hb(i)}async function yd(e){let[t,r]=e.positional;if(t==="add"||t==="remove"){if(!r)throw Error(`usage: handout members ${t} <login|email>`);if(t==="add")await G("/api/members",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({principal:r})});else await G(`/api/members/${encodeURIComponent(r.toLowerCase())}`,{method:"DELETE"})}else if(t)throw Error(`unknown action "${t}", use add or remove`);let n=await G("/api/members");if(e.flags.json)return console.log(JSON.stringify(n,null,2));console.log(`${n.owner} owner`);for(let o of n.members)console.log(`${o.principal} added by ${o.addedBy} on ${o.addedAt.slice(0,10)}`)}async function vd(e){let t=e.positional[0];if(!t)throw Error("usage: handout delete <slug>");let r=await G(`/api/artifacts/${encodeURIComponent(t)}`,{method:"DELETE"});console.log(`deleted ${r.deleted}; its versions are gone and the slug is free again`)}function wi(e){if(console.log(`${e.hostname} ${e.active?"✓ active":e.progress?`step ${e.progress.step} of 3: ${e.progress.title}`:e.state}`),e.active)return;if(e.progress&&e.progress.step!==1){console.log(` ${e.progress.detail}`),console.log(` wait for it with: handout domain verify ${e.hostname} --wait`);return}for(let t of e.records)console.log(` ${t.type.padEnd(5)} ${t.name} → ${t.value} (${t.required?"required":"optional"}: ${t.why})`);if(e.records.some((t)=>t.host))console.log(` if your registrar asks for a host relative to your domain: ${e.records.filter((t)=>t.host).map((t)=>`${t.type} ${t.host}`).join(", ")}`);console.log(` records usually show up within minutes, some registrars take up to an hour; check from outside: https://dnschecker.org/#CNAME/${e.hostname}`),console.log(` then: handout domain verify ${e.hostname}`)}async function xd(e){let[t,r]=e.positional;if(t==="add"){if(!r)throw Error("usage: handout domain add <hostname>");let o=await G("/api/domains",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({hostname:r})});return e.flags.json?console.log(JSON.stringify(o,null,2)):wi(o)}if(t==="verify"){let o=r;if(!o){let i=await G("/api/domains");if(i.domains.length!==1)throw Error("usage: handout domain verify <hostname>");o=i.domains[0].hostname}let s=Date.now()+900000;for(;;){let i=await G(`/api/domains/${encodeURIComponent(o)}/verify`,{method:"POST"});if(i.active||!e.flags.wait||Date.now()>s){if(e.flags.json)console.log(JSON.stringify(i,null,2));else wi(i);if(!i.active)process.exitCode=3;return}process.stderr.write(`${i.state}, checking again in 20s
12
- `),await new Promise((a)=>setTimeout(a,20000))}}if(t==="remove"){if(!r)throw Error("usage: handout domain remove <hostname>");await G(`/api/domains/${encodeURIComponent(r)}`,{method:"DELETE"}),console.log(`removed ${r}`);return}if(t)throw Error(`unknown action "${t}", use add, verify or remove`);let n=await G("/api/domains");if(e.flags.json)return console.log(JSON.stringify(n.domains,null,2));if(n.domains.length===0)return console.log("no custom domain. Add one with `handout domain add pages.example.com`");for(let o of n.domains)wi(o)}var H;(function(e){e.assertEqual=(o)=>{};function t(o){}e.assertIs=t;function r(o){throw Error()}e.assertNever=r,e.arrayToEnum=(o)=>{let s={};for(let i of o)s[i]=i;return s},e.getValidEnumValues=(o)=>{let s=e.objectKeys(o).filter((a)=>typeof o[o[a]]!=="number"),i={};for(let a of s)i[a]=o[a];return e.objectValues(i)},e.objectValues=(o)=>e.objectKeys(o).map(function(s){return o[s]}),e.objectKeys=typeof Object.keys==="function"?(o)=>Object.keys(o):(o)=>{let s=[];for(let i in o)if(Object.prototype.hasOwnProperty.call(o,i))s.push(i);return s},e.find=(o,s)=>{for(let i of o)if(s(i))return i;return},e.isInteger=typeof Number.isInteger==="function"?(o)=>Number.isInteger(o):(o)=>typeof o==="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,s=" | "){return o.map((i)=>typeof i==="string"?`'${i}'`:i).join(s)}e.joinValues=n,e.jsonStringifyReplacer=(o,s)=>{if(typeof s==="bigint")return s.toString();return s}})(H||(H={}));var bd;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(bd||(bd={}));var S=H.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),vt=(e)=>{switch(typeof e){case"undefined":return S.undefined;case"string":return S.string;case"number":return Number.isNaN(e)?S.nan:S.number;case"boolean":return S.boolean;case"function":return S.function;case"bigint":return S.bigint;case"symbol":return S.symbol;case"object":if(Array.isArray(e))return S.array;if(e===null)return S.null;if(e.then&&typeof e.then==="function"&&e.catch&&typeof e.catch==="function")return S.promise;if(typeof Map<"u"&&e instanceof Map)return S.map;if(typeof Set<"u"&&e instanceof Set)return S.set;if(typeof Date<"u"&&e instanceof Date)return S.date;return S.object;default:return S.unknown}};var x=H.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"]);class qe extends Error{get errors(){return this.issues}constructor(e){super();this.issues=[],this.addIssue=(r)=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let t=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,t);else this.__proto__=t;this.name="ZodError",this.issues=e}format(e){let t=e||function(o){return o.message},r={_errors:[]},n=(o)=>{for(let s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(n);else if(s.code==="invalid_return_type")n(s.returnTypeError);else if(s.code==="invalid_arguments")n(s.argumentsError);else if(s.path.length===0)r._errors.push(t(s));else{let i=r,a=0;while(a<s.path.length){let c=s.path[a],u=a===s.path.length-1;if(c==="_errors"){if(u)i._errors.push(t(s));a++;continue}if(!Object.prototype.hasOwnProperty.call(i,c))if(c==="__proto__")Object.defineProperty(i,c,{value:{_errors:[]},writable:!0,enumerable:!0,configurable:!0});else i[c]={_errors:[]};if(i=i[c],u)i._errors.push(t(s));a++}}};return n(this),r}static assert(e){if(!(e instanceof qe))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,H.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=(t)=>t.message){let t=Object.create(null),r=[];for(let n of this.issues)if(n.path.length>0){let o=n.path[0];t[o]=t[o]||[],t[o].push(e(n))}else r.push(e(n));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}qe.create=(e)=>new qe(e);var gb=(e,t)=>{let r;switch(e.code){case x.invalid_type:if(e.received===S.undefined)r="Required";else r=`Expected ${e.expected}, received ${e.received}`;break;case x.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,H.jsonStringifyReplacer)}`;break;case x.unrecognized_keys:r=`Unrecognized key(s) in object: ${H.joinValues(e.keys,", ")}`;break;case x.invalid_union:r="Invalid input";break;case x.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${H.joinValues(e.options)}`;break;case x.invalid_enum_value:r=`Invalid enum value. Expected ${H.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:if(typeof e.validation==="object")if("includes"in e.validation){if(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}`}else if("startsWith"in e.validation)r=`Invalid input: must start with "${e.validation.startsWith}"`;else if("endsWith"in e.validation)r=`Invalid input: must end with "${e.validation.endsWith}"`;else H.assertNever(e.validation);else if(e.validation!=="regex")r=`Invalid ${e.validation}`;else r="Invalid";break;case x.too_small:if(e.type==="array")r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`;else if(e.type==="string")r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`;else if(e.type==="number")r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`;else if(e.type==="bigint")r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`;else if(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))}`;else r="Invalid input";break;case x.too_big:if(e.type==="array")r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`;else if(e.type==="string")r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`;else if(e.type==="number")r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`;else if(e.type==="bigint")r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`;else if(e.type==="date")r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`;else 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,H.assertNever(e)}return{message:r}},Et=gb;var _b=Et;function Kr(){return _b}var xo=(e)=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,s=[...r,...o.path||[]],i={...o,path:s};if(o.message!==void 0)return{...o,path:s,message:o.message};let a="",c=n.filter((u)=>!!u).slice().reverse();for(let u of c)a=u(i,{data:t,defaultError:a}).message;return{...o,path:s,message:a}};function w(e,t){let r=Kr(),n=xo({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Et?void 0:Et].filter((o)=>!!o)});e.common.issues.push(n)}class $e{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(e,t){let r=[];for(let n of t){if(n.status==="aborted")return j;if(n.status==="dirty")e.dirty();r.push(n.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let n of t){let o=await n.key,s=await n.value;r.push({key:o,value:s})}return $e.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let n of t){let{key:o,value:s}=n;if(o.status==="aborted")return j;if(s.status==="aborted")return j;if(o.status==="dirty")e.dirty();if(s.status==="dirty")e.dirty();if(o.value!=="__proto__"&&(typeof s.value<"u"||n.alwaysSet))r[o.value]=s.value}return{status:e.value,value:r}}}var j=Object.freeze({status:"aborted"}),hr=(e)=>({status:"dirty",value:e}),Se=(e)=>({status:"valid",value:e}),ki=(e)=>e.status==="aborted",Si=(e)=>e.status==="dirty",Gt=(e)=>e.status==="valid",Gr=(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={}));class Ye{constructor(e,t,r,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=n}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var $d=(e,t)=>{if(Gt(t))return{success:!0,data:t.value};else{if(!e.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new qe(e.common.issues);return this._error=r,this._error}}}};function D(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:o}=e;if(t&&(r||n))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(t)return{errorMap:t,description:o};return{errorMap:(i,a)=>{let{message:c}=e;if(i.code==="invalid_enum_value")return{message:c??a.defaultError};if(typeof a.data>"u")return{message:c??n??a.defaultError};if(i.code!=="invalid_type")return{message:a.defaultError};return{message:c??r??a.defaultError}},description:o}}class F{get description(){return this._def.description}_getType(e){return vt(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:vt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new $e,ctx:{common:e.parent.common,data:e.data,parsedType:vt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(Gr(t))throw Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){let r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:vt(e)},n=this._parseSync({data:e,path:r.path,parent:r});return $d(r,n)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:vt(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return Gt(r)?{value:r.value}:{issues:t.common.issues}}catch(r){if(r?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then((r)=>Gt(r)?{value:r.value}:{issues:t.common.issues})}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:vt(e)},n=this._parse({data:e,path:r.path,parent:r}),o=await(Gr(n)?n:Promise.resolve(n));return $d(r,o)}refine(e,t){let r=(n)=>{if(typeof t==="string"||typeof t>"u")return{message:t};else if(typeof t==="function")return t(n);else return t};return this._refinement((n,o)=>{let s=e(n),i=()=>o.addIssue({code:x.custom,...r(n)});if(typeof Promise<"u"&&s instanceof Promise)return s.then((a)=>{if(!a)return i(),!1;else return!0});if(!s)return i(),!1;else return!0})}refinement(e,t){return this._refinement((r,n)=>{if(!e(r))return n.addIssue(typeof t==="function"?t(r,n):t),!1;else return!0})}_refinement(e){return new dt({schema:this,typeName:b.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,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:(t)=>this["~validate"](t)}}optional(){return lt.create(this,this._def)}nullable(){return Ot.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ut.create(this)}promise(){return xr.create(this,this._def)}or(e){return en.create([this,e],this._def)}and(e){return tn.create(this,e,this._def)}transform(e){return new dt({...D(this._def),schema:this,typeName:b.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e==="function"?e:()=>e;return new sn({...D(this._def),innerType:this,defaultValue:t,typeName:b.ZodDefault})}brand(){return new Ei({typeName:b.ZodBranded,type:this,...D(this._def)})}catch(e){let t=typeof e==="function"?e:()=>e;return new an({...D(this._def),innerType:this,catchValue:t,typeName:b.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return To.create(this,e)}readonly(){return cn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var yb=/^c[^\s-]{8,}$/i,vb=/^[0-9a-z]+$/,xb=/^[0-9A-HJKMNP-TV-Z]{26}$/i,bb=/^[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,$b=/^[a-z0-9_-]{21}$/i,wb=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,kb=/^[-+]?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)?)??$/,Sb=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,zb="^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$",zi,Pb=/^(?:(?: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])$/,Tb=/^(?:(?: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])$/,Eb=/^(([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]))$/,Ob=/^(([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])$/,Rb=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ib=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,wd="((\\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])))",Cb=new RegExp(`^${wd}$`);function kd(e){let t="[0-5]\\d";if(e.precision)t=`${t}\\.\\d{${e.precision}}`;else if(e.precision==null)t=`${t}(\\.\\d+)?`;let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function Ab(e){return new RegExp(`^${kd(e)}$`)}function Nb(e){let t=`${wd}T${kd(e)}`,r=[];if(r.push(e.local?"Z?":"Z"),e.offset)r.push("([+-]\\d{2}:?\\d{2})");return t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function jb(e,t){if((t==="v4"||!t)&&Pb.test(e))return!0;if((t==="v6"||!t)&&Eb.test(e))return!0;return!1}function Zb(e,t){if(!wb.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));if(typeof o!=="object"||o===null)return!1;if("typ"in o&&o?.typ!=="JWT")return!1;if(!o.alg)return!1;if(t&&o.alg!==t)return!1;return!0}catch{return!1}}function Mb(e,t){if((t==="v4"||!t)&&Tb.test(e))return!0;if((t==="v6"||!t)&&Ob.test(e))return!0;return!1}class bt extends F{_parse(e){if(this._def.coerce)e.data=String(e.data);if(this._getType(e)!==S.string){let o=this._getOrReturnCtx(e);return w(o,{code:x.invalid_type,expected:S.string,received:o.parsedType}),j}let r=new $e,n=void 0;for(let o of this._def.checks)if(o.kind==="min"){if(e.data.length<o.value)n=this._getOrReturnCtx(e,n),w(n,{code:x.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty()}else if(o.kind==="max"){if(e.data.length>o.value)n=this._getOrReturnCtx(e,n),w(n,{code:x.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty()}else if(o.kind==="length"){let s=e.data.length>o.value,i=e.data.length<o.value;if(s||i){if(n=this._getOrReturnCtx(e,n),s)w(n,{code:x.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message});else if(i)w(n,{code:x.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message});r.dirty()}}else if(o.kind==="email"){if(!Sb.test(e.data))n=this._getOrReturnCtx(e,n),w(n,{validation:"email",code:x.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="emoji"){if(!zi)zi=new RegExp(zb,"u");if(!zi.test(e.data))n=this._getOrReturnCtx(e,n),w(n,{validation:"emoji",code:x.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="uuid"){if(!bb.test(e.data))n=this._getOrReturnCtx(e,n),w(n,{validation:"uuid",code:x.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="nanoid"){if(!$b.test(e.data))n=this._getOrReturnCtx(e,n),w(n,{validation:"nanoid",code:x.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="cuid"){if(!yb.test(e.data))n=this._getOrReturnCtx(e,n),w(n,{validation:"cuid",code:x.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="cuid2"){if(!vb.test(e.data))n=this._getOrReturnCtx(e,n),w(n,{validation:"cuid2",code:x.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="ulid"){if(!xb.test(e.data))n=this._getOrReturnCtx(e,n),w(n,{validation:"ulid",code:x.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),w(n,{validation:"url",code:x.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="regex"){if(o.regex.lastIndex=0,!o.regex.test(e.data))n=this._getOrReturnCtx(e,n),w(n,{validation:"regex",code:x.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="trim")e.data=e.data.trim();else if(o.kind==="includes"){if(!e.data.includes(o.value,o.position))n=this._getOrReturnCtx(e,n),w(n,{code:x.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),r.dirty()}else if(o.kind==="toLowerCase")e.data=e.data.toLowerCase();else if(o.kind==="toUpperCase")e.data=e.data.toUpperCase();else if(o.kind==="startsWith"){if(!e.data.startsWith(o.value))n=this._getOrReturnCtx(e,n),w(n,{code:x.invalid_string,validation:{startsWith:o.value},message:o.message}),r.dirty()}else if(o.kind==="endsWith"){if(!e.data.endsWith(o.value))n=this._getOrReturnCtx(e,n),w(n,{code:x.invalid_string,validation:{endsWith:o.value},message:o.message}),r.dirty()}else if(o.kind==="datetime"){if(!Nb(o).test(e.data))n=this._getOrReturnCtx(e,n),w(n,{code:x.invalid_string,validation:"datetime",message:o.message}),r.dirty()}else if(o.kind==="date"){if(!Cb.test(e.data))n=this._getOrReturnCtx(e,n),w(n,{code:x.invalid_string,validation:"date",message:o.message}),r.dirty()}else if(o.kind==="time"){if(!Ab(o).test(e.data))n=this._getOrReturnCtx(e,n),w(n,{code:x.invalid_string,validation:"time",message:o.message}),r.dirty()}else if(o.kind==="duration"){if(!kb.test(e.data))n=this._getOrReturnCtx(e,n),w(n,{validation:"duration",code:x.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="ip"){if(!jb(e.data,o.version))n=this._getOrReturnCtx(e,n),w(n,{validation:"ip",code:x.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="jwt"){if(!Zb(e.data,o.alg))n=this._getOrReturnCtx(e,n),w(n,{validation:"jwt",code:x.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="cidr"){if(!Mb(e.data,o.version))n=this._getOrReturnCtx(e,n),w(n,{validation:"cidr",code:x.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="base64"){if(!Rb.test(e.data))n=this._getOrReturnCtx(e,n),w(n,{validation:"base64",code:x.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="base64url"){if(!Ib.test(e.data))n=this._getOrReturnCtx(e,n),w(n,{validation:"base64url",code:x.invalid_string,message:o.message}),r.dirty()}else H.assertNever(o);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement((n)=>e.test(n),{validation:t,code:x.invalid_string,...O.errToObj(r)})}_addCheck(e){return new bt({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...O.errToObj(e)})}url(e){return this._addCheck({kind:"url",...O.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...O.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...O.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...O.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...O.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...O.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...O.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...O.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...O.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...O.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...O.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...O.errToObj(e)})}datetime(e){if(typeof e==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e});return this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...O.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){if(typeof e==="string")return this._addCheck({kind:"time",precision:null,message:e});return this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...O.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...O.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...O.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...O.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...O.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...O.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...O.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...O.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...O.errToObj(t)})}nonempty(e){return this.min(1,O.errToObj(e))}trim(){return new bt({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new bt({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new bt({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e)=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find((e)=>e.kind==="date")}get isTime(){return!!this._def.checks.find((e)=>e.kind==="time")}get isDuration(){return!!this._def.checks.find((e)=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find((e)=>e.kind==="email")}get isURL(){return!!this._def.checks.find((e)=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find((e)=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find((e)=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((e)=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((e)=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((e)=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find((e)=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find((e)=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find((e)=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find((e)=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find((e)=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxLength(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}}bt.create=(e)=>new bt({checks:[],typeName:b.ZodString,coerce:e?.coerce??!1,...D(e)});function Db(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,s=Number.parseInt(e.toFixed(o).replace(".","")),i=Number.parseInt(t.toFixed(o).replace(".",""));return s%i/10**o}class _r extends F{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce)e.data=Number(e.data);if(this._getType(e)!==S.number){let o=this._getOrReturnCtx(e);return w(o,{code:x.invalid_type,expected:S.number,received:o.parsedType}),j}let r=void 0,n=new $e;for(let o of this._def.checks)if(o.kind==="int"){if(!H.isInteger(e.data))r=this._getOrReturnCtx(e,r),w(r,{code:x.invalid_type,expected:"integer",received:"float",message:o.message}),n.dirty()}else if(o.kind==="min"){if(o.inclusive?e.data<o.value:e.data<=o.value)r=this._getOrReturnCtx(e,r),w(r,{code:x.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),n.dirty()}else if(o.kind==="max"){if(o.inclusive?e.data>o.value:e.data>=o.value)r=this._getOrReturnCtx(e,r),w(r,{code:x.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),n.dirty()}else if(o.kind==="multipleOf"){if(Db(e.data,o.value)!==0)r=this._getOrReturnCtx(e,r),w(r,{code:x.not_multiple_of,multipleOf:o.value,message:o.message}),n.dirty()}else if(o.kind==="finite"){if(!Number.isFinite(e.data))r=this._getOrReturnCtx(e,r),w(r,{code:x.not_finite,message:o.message}),n.dirty()}else H.assertNever(o);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,O.toString(t))}gt(e,t){return this.setLimit("min",e,!1,O.toString(t))}lte(e,t){return this.setLimit("max",e,!0,O.toString(t))}lt(e,t){return this.setLimit("max",e,!1,O.toString(t))}setLimit(e,t,r,n){return new _r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:O.toString(n)}]})}_addCheck(e){return new _r({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:O.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:O.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:O.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:O.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:O.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:O.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:O.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:O.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:O.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxValue(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}get isInt(){return!!this._def.checks.find((e)=>e.kind==="int"||e.kind==="multipleOf"&&H.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks)if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;else if(r.kind==="min"){if(t===null||r.value>t)t=r.value}else if(r.kind==="max"){if(e===null||r.value<e)e=r.value}return Number.isFinite(t)&&Number.isFinite(e)}}_r.create=(e)=>new _r({checks:[],typeName:b.ZodNumber,coerce:e?.coerce||!1,...D(e)});class yr extends F{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==S.bigint)return this._getInvalidInput(e);let r=void 0,n=new $e;for(let o of this._def.checks)if(o.kind==="min"){if(o.inclusive?e.data<o.value:e.data<=o.value)r=this._getOrReturnCtx(e,r),w(r,{code:x.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),n.dirty()}else if(o.kind==="max"){if(o.inclusive?e.data>o.value:e.data>=o.value)r=this._getOrReturnCtx(e,r),w(r,{code:x.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),n.dirty()}else if(o.kind==="multipleOf"){if(e.data%o.value!==BigInt(0))r=this._getOrReturnCtx(e,r),w(r,{code:x.not_multiple_of,multipleOf:o.value,message:o.message}),n.dirty()}else H.assertNever(o);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return w(t,{code:x.invalid_type,expected:S.bigint,received:t.parsedType}),j}gte(e,t){return this.setLimit("min",e,!0,O.toString(t))}gt(e,t){return this.setLimit("min",e,!1,O.toString(t))}lte(e,t){return this.setLimit("max",e,!0,O.toString(t))}lt(e,t){return this.setLimit("max",e,!1,O.toString(t))}setLimit(e,t,r,n){return new yr({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:O.toString(n)}]})}_addCheck(e){return new yr({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:O.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:O.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:O.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:O.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:O.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxValue(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}}yr.create=(e)=>new yr({checks:[],typeName:b.ZodBigInt,coerce:e?.coerce??!1,...D(e)});class bo extends F{_parse(e){if(this._def.coerce)e.data=Boolean(e.data);if(this._getType(e)!==S.boolean){let r=this._getOrReturnCtx(e);return w(r,{code:x.invalid_type,expected:S.boolean,received:r.parsedType}),j}return Se(e.data)}}bo.create=(e)=>new bo({typeName:b.ZodBoolean,coerce:e?.coerce||!1,...D(e)});class Xr extends F{_parse(e){if(this._def.coerce)e.data=new Date(e.data);if(this._getType(e)!==S.date){let o=this._getOrReturnCtx(e);return w(o,{code:x.invalid_type,expected:S.date,received:o.parsedType}),j}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return w(o,{code:x.invalid_date}),j}let r=new $e,n=void 0;for(let o of this._def.checks)if(o.kind==="min"){if(e.data.getTime()<o.value)n=this._getOrReturnCtx(e,n),w(n,{code:x.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),r.dirty()}else if(o.kind==="max"){if(e.data.getTime()>o.value)n=this._getOrReturnCtx(e,n),w(n,{code:x.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()}else H.assertNever(o);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Xr({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:O.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:O.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e!=null?new Date(e):null}}Xr.create=(e)=>new Xr({checks:[],coerce:e?.coerce||!1,typeName:b.ZodDate,...D(e)});class $o extends F{_parse(e){if(this._getType(e)!==S.symbol){let r=this._getOrReturnCtx(e);return w(r,{code:x.invalid_type,expected:S.symbol,received:r.parsedType}),j}return Se(e.data)}}$o.create=(e)=>new $o({typeName:b.ZodSymbol,...D(e)});class Yr extends F{_parse(e){if(this._getType(e)!==S.undefined){let r=this._getOrReturnCtx(e);return w(r,{code:x.invalid_type,expected:S.undefined,received:r.parsedType}),j}return Se(e.data)}}Yr.create=(e)=>new Yr({typeName:b.ZodUndefined,...D(e)});class Qr extends F{_parse(e){if(this._getType(e)!==S.null){let r=this._getOrReturnCtx(e);return w(r,{code:x.invalid_type,expected:S.null,received:r.parsedType}),j}return Se(e.data)}}Qr.create=(e)=>new Qr({typeName:b.ZodNull,...D(e)});class wo extends F{constructor(){super(...arguments);this._any=!0}_parse(e){return Se(e.data)}}wo.create=(e)=>new wo({typeName:b.ZodAny,...D(e)});class Wt extends F{constructor(){super(...arguments);this._unknown=!0}_parse(e){return Se(e.data)}}Wt.create=(e)=>new Wt({typeName:b.ZodUnknown,...D(e)});class $t extends F{_parse(e){let t=this._getOrReturnCtx(e);return w(t,{code:x.invalid_type,expected:S.never,received:t.parsedType}),j}}$t.create=(e)=>new $t({typeName:b.ZodNever,...D(e)});class ko extends F{_parse(e){if(this._getType(e)!==S.undefined){let r=this._getOrReturnCtx(e);return w(r,{code:x.invalid_type,expected:S.void,received:r.parsedType}),j}return Se(e.data)}}ko.create=(e)=>new ko({typeName:b.ZodVoid,...D(e)});class ut extends F{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==S.array)return w(t,{code:x.invalid_type,expected:S.array,received:t.parsedType}),j;if(n.exactLength!==null){let s=t.data.length>n.exactLength.value,i=t.data.length<n.exactLength.value;if(s||i)w(t,{code:s?x.too_big:x.too_small,minimum:i?n.exactLength.value:void 0,maximum:s?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),r.dirty()}if(n.minLength!==null){if(t.data.length<n.minLength.value)w(t,{code:x.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),r.dirty()}if(n.maxLength!==null){if(t.data.length>n.maxLength.value)w(t,{code:x.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()}if(t.common.async)return Promise.all([...t.data].map((s,i)=>n.type._parseAsync(new Ye(t,s,t.path,i)))).then((s)=>$e.mergeArray(r,s));let o=[...t.data].map((s,i)=>n.type._parseSync(new Ye(t,s,t.path,i)));return $e.mergeArray(r,o)}get element(){return this._def.type}min(e,t){return new ut({...this._def,minLength:{value:e,message:O.toString(t)}})}max(e,t){return new ut({...this._def,maxLength:{value:e,message:O.toString(t)}})}length(e,t){return new ut({...this._def,exactLength:{value:e,message:O.toString(t)}})}nonempty(e){return this.min(1,e)}}ut.create=(e,t)=>new ut({type:e,minLength:null,maxLength:null,exactLength:null,typeName:b.ZodArray,...D(t)});function gr(e){if(e instanceof pe){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=lt.create(gr(n))}return new pe({...e._def,shape:()=>t})}else if(e instanceof ut)return new ut({...e._def,type:gr(e.element)});else if(e instanceof lt)return lt.create(gr(e.unwrap()));else if(e instanceof Ot)return Ot.create(gr(e.unwrap()));else if(e instanceof wt)return wt.create(e.items.map((t)=>gr(t)));else return e}class pe extends F{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=H.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==S.object){let c=this._getOrReturnCtx(e);return w(c,{code:x.invalid_type,expected:S.object,received:c.parsedType}),j}let{status:r,ctx:n}=this._processInputParams(e),{shape:o,keys:s}=this._getCached(),i=[];if(!(this._def.catchall instanceof $t&&this._def.unknownKeys==="strip")){for(let c in n.data)if(!s.includes(c))i.push(c)}let a=[];for(let c of s){let u=o[c],l=n.data[c];a.push({key:{status:"valid",value:c},value:u._parse(new Ye(n,l,n.path,c)),alwaysSet:c in n.data})}if(this._def.catchall instanceof $t){let c=this._def.unknownKeys;if(c==="passthrough")for(let u of i)a.push({key:{status:"valid",value:u},value:{status:"valid",value:n.data[u]}});else if(c==="strict"){if(i.length>0)w(n,{code:x.unrecognized_keys,keys:i}),r.dirty()}else if(c==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let u of i){let l=n.data[u];a.push({key:{status:"valid",value:u},value:c._parse(new Ye(n,l,n.path,u)),alwaysSet:u in n.data})}}if(n.common.async)return Promise.resolve().then(async()=>{let c=[];for(let u of a){let l=await u.key,d=await u.value;c.push({key:l,value:d,alwaysSet:u.alwaysSet})}return c}).then((c)=>$e.mergeObjectSync(r,c));else return $e.mergeObjectSync(r,a)}get shape(){return this._def.shape()}strict(e){return O.errToObj,new pe({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{let n=this._def.errorMap?.(t,r).message??r.defaultError;if(t.code==="unrecognized_keys")return{message:O.errToObj(e).message??n};return{message:n}}}:{}})}strip(){return new pe({...this._def,unknownKeys:"strip"})}passthrough(){return new pe({...this._def,unknownKeys:"passthrough"})}extend(e){return new pe({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new pe({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:b.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new pe({...this._def,catchall:e})}pick(e){let t={};for(let r of H.objectKeys(e))if(e[r]&&this.shape[r])t[r]=this.shape[r];return new pe({...this._def,shape:()=>t})}omit(e){let t={};for(let r of H.objectKeys(this.shape))if(!e[r])t[r]=this.shape[r];return new pe({...this._def,shape:()=>t})}deepPartial(){return gr(this)}partial(e){let t={};for(let r of H.objectKeys(this.shape)){let n=this.shape[r];if(e&&!e[r])t[r]=n;else t[r]=n.optional()}return new pe({...this._def,shape:()=>t})}required(e){let t={};for(let r of H.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let o=this.shape[r];while(o instanceof lt)o=o._def.innerType;t[r]=o}return new pe({...this._def,shape:()=>t})}keyof(){return Sd(H.objectKeys(this.shape))}}pe.create=(e,t)=>new pe({shape:()=>e,unknownKeys:"strip",catchall:$t.create(),typeName:b.ZodObject,...D(t)});pe.strictCreate=(e,t)=>new pe({shape:()=>e,unknownKeys:"strict",catchall:$t.create(),typeName:b.ZodObject,...D(t)});pe.lazycreate=(e,t)=>new pe({shape:e,unknownKeys:"strip",catchall:$t.create(),typeName:b.ZodObject,...D(t)});class en extends F{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;function n(o){for(let i of o)if(i.result.status==="valid")return i.result;for(let i of o)if(i.result.status==="dirty")return t.common.issues.push(...i.ctx.common.issues),i.result;let s=o.map((i)=>new qe(i.ctx.common.issues));return w(t,{code:x.invalid_union,unionErrors:s}),j}if(t.common.async)return Promise.all(r.map(async(o)=>{let s={...t,common:{...t.common,issues:[]},parent:null};return{result:await o._parseAsync({data:t.data,path:t.path,parent:s}),ctx:s}})).then(n);else{let o=void 0,s=[];for(let a of r){let c={...t,common:{...t.common,issues:[]},parent:null},u=a._parseSync({data:t.data,path:t.path,parent:c});if(u.status==="valid")return u;else if(u.status==="dirty"&&!o)o={result:u,ctx:c};if(c.common.issues.length)s.push(c.common.issues)}if(o)return t.common.issues.push(...o.ctx.common.issues),o.result;let i=s.map((a)=>new qe(a));return w(t,{code:x.invalid_union,unionErrors:i}),j}}get options(){return this._def.options}}en.create=(e,t)=>new en({options:e,typeName:b.ZodUnion,...D(t)});var xt=(e)=>{if(e instanceof rn)return xt(e.schema);else if(e instanceof dt)return xt(e.innerType());else if(e instanceof nn)return[e.value];else if(e instanceof Xt)return e.options;else if(e instanceof on)return H.objectValues(e.enum);else if(e instanceof sn)return xt(e._def.innerType);else if(e instanceof Yr)return[void 0];else if(e instanceof Qr)return[null];else if(e instanceof lt)return[void 0,...xt(e.unwrap())];else if(e instanceof Ot)return[null,...xt(e.unwrap())];else if(e instanceof Ei)return xt(e.unwrap());else if(e instanceof cn)return xt(e.unwrap());else if(e instanceof an)return xt(e._def.innerType);else return[]};class Ti extends F{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==S.object)return w(t,{code:x.invalid_type,expected:S.object,received:t.parsedType}),j;let r=this.discriminator,n=t.data[r],o=this.optionsMap.get(n);if(!o)return w(t,{code:x.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),j;if(t.common.async)return o._parseAsync({data:t.data,path:t.path,parent:t});else return o._parseSync({data:t.data,path:t.path,parent:t})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let n=new Map;for(let o of t){let s=xt(o.shape[e]);if(!s.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of s){if(n.has(i))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);n.set(i,o)}}return new Ti({typeName:b.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...D(r)})}}function Pi(e,t){let r=vt(e),n=vt(t);if(e===t)return{valid:!0,data:e};else if(r===S.object&&n===S.object){let o=H.objectKeys(t),s=H.objectKeys(e).filter((a)=>o.indexOf(a)!==-1),i={...e,...t};if(Object.prototype.hasOwnProperty.call(i,"__proto__"))delete i.__proto__;for(let a of s){if(a==="__proto__")continue;let c=Pi(e[a],t[a]);if(!c.valid)return{valid:!1};i[a]=c.data}return{valid:!0,data:i}}else if(r===S.array&&n===S.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let s=0;s<e.length;s++){let i=e[s],a=t[s],c=Pi(i,a);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else if(r===S.date&&n===S.date&&+e===+t)return{valid:!0,data:e};else return{valid:!1}}class tn extends F{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=(o,s)=>{if(ki(o)||ki(s))return j;let i=Pi(o.value,s.value);if(!i.valid)return w(r,{code:x.invalid_intersection_types}),j;if(Si(o)||Si(s))t.dirty();return{status:t.value,value:i.data}};if(r.common.async)return Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([o,s])=>n(o,s));else return n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}tn.create=(e,t,r)=>new tn({left:e,right:t,typeName:b.ZodIntersection,...D(r)});class wt extends F{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==S.array)return w(r,{code:x.invalid_type,expected:S.array,received:r.parsedType}),j;if(r.data.length<this._def.items.length)return w(r,{code:x.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),j;if(!this._def.rest&&r.data.length>this._def.items.length)w(r,{code:x.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty();let o=[...r.data].map((s,i)=>{let a=this._def.items[i]||this._def.rest;if(!a)return null;return a._parse(new Ye(r,s,r.path,i))}).filter((s)=>!!s);if(r.common.async)return Promise.all(o).then((s)=>$e.mergeArray(t,s));else return $e.mergeArray(t,o)}get items(){return this._def.items}rest(e){return new wt({...this._def,rest:e})}}wt.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new wt({items:e,typeName:b.ZodTuple,rest:null,...D(t)})};class So extends F{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==S.object)return w(r,{code:x.invalid_type,expected:S.object,received:r.parsedType}),j;let n=[],o=this._def.keyType,s=this._def.valueType;for(let i in r.data)n.push({key:o._parse(new Ye(r,i,r.path,i)),value:s._parse(new Ye(r,r.data[i],r.path,i)),alwaysSet:i in r.data});if(r.common.async)return $e.mergeObjectAsync(t,n);else return $e.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,r){if(t instanceof F)return new So({keyType:e,valueType:t,typeName:b.ZodRecord,...D(r)});return new So({keyType:bt.create(),valueType:e,typeName:b.ZodRecord,...D(t)})}}class zo extends F{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==S.map)return w(r,{code:x.invalid_type,expected:S.map,received:r.parsedType}),j;let n=this._def.keyType,o=this._def.valueType,s=[...r.data.entries()].map(([i,a],c)=>({key:n._parse(new Ye(r,i,r.path,[c,"key"])),value:o._parse(new Ye(r,a,r.path,[c,"value"]))}));if(r.common.async){let i=new Map;return Promise.resolve().then(async()=>{for(let a of s){let c=await a.key,u=await a.value;if(c.status==="aborted"||u.status==="aborted")return j;if(c.status==="dirty"||u.status==="dirty")t.dirty();i.set(c.value,u.value)}return{status:t.value,value:i}})}else{let i=new Map;for(let a of s){let{key:c,value:u}=a;if(c.status==="aborted"||u.status==="aborted")return j;if(c.status==="dirty"||u.status==="dirty")t.dirty();i.set(c.value,u.value)}return{status:t.value,value:i}}}}zo.create=(e,t,r)=>new zo({valueType:t,keyType:e,typeName:b.ZodMap,...D(r)});class vr extends F{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==S.set)return w(r,{code:x.invalid_type,expected:S.set,received:r.parsedType}),j;let n=this._def;if(n.minSize!==null){if(r.data.size<n.minSize.value)w(r,{code:x.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()}if(n.maxSize!==null){if(r.data.size>n.maxSize.value)w(r,{code:x.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty()}let o=this._def.valueType;function s(a){let c=new Set;for(let u of a){if(u.status==="aborted")return j;if(u.status==="dirty")t.dirty();c.add(u.value)}return{status:t.value,value:c}}let i=[...r.data.values()].map((a,c)=>o._parse(new Ye(r,a,r.path,c)));if(r.common.async)return Promise.all(i).then((a)=>s(a));else return s(i)}min(e,t){return new vr({...this._def,minSize:{value:e,message:O.toString(t)}})}max(e,t){return new vr({...this._def,maxSize:{value:e,message:O.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}vr.create=(e,t)=>new vr({valueType:e,minSize:null,maxSize:null,typeName:b.ZodSet,...D(t)});class Wr extends F{constructor(){super(...arguments);this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==S.function)return w(t,{code:x.invalid_type,expected:S.function,received:t.parsedType}),j;function r(i,a){return xo({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Kr(),Et].filter((c)=>!!c),issueData:{code:x.invalid_arguments,argumentsError:a}})}function n(i,a){return xo({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Kr(),Et].filter((c)=>!!c),issueData:{code:x.invalid_return_type,returnTypeError:a}})}let o={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof xr){let i=this;return Se(async function(...a){let c=new qe([]),u=await i._def.args.parseAsync(a,o).catch((f)=>{throw c.addIssue(r(a,f)),c}),l=await Reflect.apply(s,this,u);return await i._def.returns._def.type.parseAsync(l,o).catch((f)=>{throw c.addIssue(n(l,f)),c})})}else{let i=this;return Se(function(...a){let c=i._def.args.safeParse(a,o);if(!c.success)throw new qe([r(a,c.error)]);let u=Reflect.apply(s,this,c.data),l=i._def.returns.safeParse(u,o);if(!l.success)throw new qe([n(u,l.error)]);return l.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Wr({...this._def,args:wt.create(e).rest(Wt.create())})}returns(e){return new Wr({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new Wr({args:e?e:wt.create([]).rest(Wt.create()),returns:t||Wt.create(),typeName:b.ZodFunction,...D(r)})}}class rn extends F{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}rn.create=(e,t)=>new rn({getter:e,typeName:b.ZodLazy,...D(t)});class nn extends F{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return w(t,{received:t.data,code:x.invalid_literal,expected:this._def.value}),j}return{status:"valid",value:e.data}}get value(){return this._def.value}}nn.create=(e,t)=>new nn({value:e,typeName:b.ZodLiteral,...D(t)});function Sd(e,t){return new Xt({values:e,typeName:b.ZodEnum,...D(t)})}class Xt extends F{_parse(e){if(typeof e.data!=="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return w(t,{expected:H.joinValues(r),received:t.parsedType,code:x.invalid_type}),j}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return w(t,{received:t.data,code:x.invalid_enum_value,options:r}),j}return Se(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Xt.create(e,{...this._def,...t})}exclude(e,t=this._def){return Xt.create(this.options.filter((r)=>!e.includes(r)),{...this._def,...t})}}Xt.create=Sd;class on extends F{_parse(e){let t=H.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==S.string&&r.parsedType!==S.number){let n=H.objectValues(t);return w(r,{expected:H.joinValues(n),received:r.parsedType,code:x.invalid_type}),j}if(!this._cache)this._cache=new Set(H.getValidEnumValues(this._def.values));if(!this._cache.has(e.data)){let n=H.objectValues(t);return w(r,{received:r.data,code:x.invalid_enum_value,options:n}),j}return Se(e.data)}get enum(){return this._def.values}}on.create=(e,t)=>new on({values:e,typeName:b.ZodNativeEnum,...D(t)});class xr extends F{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==S.promise&&t.common.async===!1)return w(t,{code:x.invalid_type,expected:S.promise,received:t.parsedType}),j;let r=t.parsedType===S.promise?t.data:Promise.resolve(t.data);return Se(r.then((n)=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}}xr.create=(e,t)=>new xr({type:e,typeName:b.ZodPromise,...D(t)});class dt extends F{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===b.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null,o={addIssue:(s)=>{if(w(r,s),s.fatal)t.abort();else t.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),n.type==="preprocess"){let s=n.transform(r.data,o);if(r.common.async)return Promise.resolve(s).then(async(i)=>{if(t.value==="aborted")return j;let a=await this._def.schema._parseAsync({data:i,path:r.path,parent:r});if(a.status==="aborted")return j;if(a.status==="dirty")return hr(a.value);if(t.value==="dirty")return hr(a.value);return a});else{if(t.value==="aborted")return j;let i=this._def.schema._parseSync({data:s,path:r.path,parent:r});if(i.status==="aborted")return j;if(i.status==="dirty")return hr(i.value);if(t.value==="dirty")return hr(i.value);return i}}if(n.type==="refinement"){let s=(i)=>{let a=n.refinement(i,o);if(r.common.async)return Promise.resolve(a);if(a instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(r.common.async===!1){let i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(i.status==="aborted")return j;if(i.status==="dirty")t.dirty();return s(i.value),{status:t.value,value:i.value}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((i)=>{if(i.status==="aborted")return j;if(i.status==="dirty")t.dirty();return s(i.value).then(()=>({status:t.value,value:i.value}))})}if(n.type==="transform")if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Gt(s))return j;let i=n.transform(s.value,o);if(i instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((s)=>{if(!Gt(s))return j;return Promise.resolve(n.transform(s.value,o)).then((i)=>({status:t.value,value:i}))});H.assertNever(n)}}dt.create=(e,t,r)=>new dt({schema:e,typeName:b.ZodEffects,effect:t,...D(r)});dt.createWithPreprocess=(e,t,r)=>new dt({schema:t,effect:{type:"preprocess",transform:e},typeName:b.ZodEffects,...D(r)});class lt extends F{_parse(e){if(this._getType(e)===S.undefined)return Se(void 0);return this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}lt.create=(e,t)=>new lt({innerType:e,typeName:b.ZodOptional,...D(t)});class Ot extends F{_parse(e){if(this._getType(e)===S.null)return Se(null);return this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ot.create=(e,t)=>new Ot({innerType:e,typeName:b.ZodNullable,...D(t)});class sn extends F{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;if(t.parsedType===S.undefined)r=this._def.defaultValue();return this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}sn.create=(e,t)=>new sn({innerType:e,typeName:b.ZodDefault,defaultValue:typeof t.default==="function"?t.default:()=>t.default,...D(t)});class an extends F{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});if(Gr(n))return n.then((o)=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new qe(r.common.issues)},input:r.data})}));else return{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new qe(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}an.create=(e,t)=>new an({innerType:e,typeName:b.ZodCatch,catchValue:typeof t.catch==="function"?t.catch:()=>t.catch,...D(t)});class Po extends F{_parse(e){if(this._getType(e)!==S.nan){let r=this._getOrReturnCtx(e);return w(r,{code:x.invalid_type,expected:S.nan,received:r.parsedType}),j}return{status:"valid",value:e.data}}}Po.create=(e)=>new Po({typeName:b.ZodNaN,...D(e)});var jC=Symbol("zod_brand");class Ei extends F{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class To extends F{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});if(o.status==="aborted")return j;if(o.status==="dirty")return t.dirty(),hr(o.value);else return this._def.out._parseAsync({data:o.value,path:r.path,parent:r})})();else{let n=this._def.in._parseSync({data:r.data,path:r.path,parent:r});if(n.status==="aborted")return j;if(n.status==="dirty")return t.dirty(),{status:"dirty",value:n.value};else return this._def.out._parseSync({data:n.value,path:r.path,parent:r})}}static create(e,t){return new To({in:e,out:t,typeName:b.ZodPipeline})}}class cn extends F{_parse(e){let t=this._def.innerType._parse(e),r=(n)=>{if(Gt(n))n.value=Object.freeze(n.value);return n};return Gr(t)?t.then((n)=>r(n)):r(t)}unwrap(){return this._def.innerType}}cn.create=(e,t)=>new cn({innerType:e,typeName:b.ZodReadonly,...D(t)});var ZC={object:pe.lazycreate},b;(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"})(b||(b={}));var MC=bt.create,DC=_r.create,qC=Po.create,LC=yr.create,FC=bo.create,UC=Xr.create,VC=$o.create,HC=Yr.create,BC=Qr.create,JC=wo.create,KC=Wt.create,GC=$t.create,WC=ko.create,XC=ut.create,{create:zd,strictCreate:YC}=pe,QC=en.create,eA=Ti.create,tA=tn.create,rA=wt.create,nA=So.create,oA=zo.create,sA=vr.create,iA=Wr.create,aA=rn.create,cA=nn.create,uA=Xt.create,lA=on.create,dA=xr.create,pA=dt.create,fA=lt.create,mA=Ot.create,hA=dt.createWithPreprocess,gA=To.create;function ln(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 Ri(e,t="|"){return e.map((r)=>Ci(r)).join(t)}function dn(e,t){if(typeof t==="bigint")return t.toString();return t}class Pd{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;if(e!==void 0)this._value=e(),this._getter=void 0;return this._value}}function pn(e){return new Pd(e)}function Td(e){return e===null||e===void 0}function Eo(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Ed(e,t){let r=e/t,n=Math.round(r),o=4*Number.EPSILON*Math.max(Math.abs(r),1);if(Math.abs(r-n)<o)return 0;return r-n}function Le(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function fn(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function kt(e){return fn(e._zod.def)??e._zod.def.shape}function Od(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return Le(this,t,n),n},enumerable:!0,configurable:!0})}function Rd(e,t,r){if(t in e)Le(e,t,r);else e[t]=r}function Yt(e,t,r,n){let o=kt(t);for(let s of r){let i=Object.getOwnPropertyDescriptor(o,s);if(!i.enumerable)continue;if(i.get)Od(e,s,()=>{let a=t._zod.def.shape[s];return n?n(a,s):a});else Rd(e,s,n?n(i.value,s):i.value)}}function qb(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);if(!n.enumerable)continue;if(n.get)Od(e,r,()=>t[r]);else Rd(e,r,n.value)}}function Ie(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function Id(e){return JSON.stringify(e)}function Cd(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Ii="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function br(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var Ad=pn(()=>{if(Ce.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function Qt(e){if(br(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let r=t.prototype;if(br(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function Oo(e){if(Qt(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}var Nd=new Set(["string","number","symbol"]);function It(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Fe(e,t,r){let n=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)n._zod.parent=e;return n}function T(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 Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function Ci(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function jd(e){return Object.keys(e).filter((t)=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var Ro=(()=>({safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}))(),Ai={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Zd(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let s={};return Yt(s,e,Io(e,t)),Fe(e,Ie(r,{shape:s,checks:[]}))}function Io(e,t){let r=kt(e),n=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,o)?.enumerable)throw Error(`Unrecognized key: "${String(o)}"`);if(t[o])n.push(o)}return n}function Md(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let s=new Set(Io(e,t)),i={};return Yt(i,e,Reflect.ownKeys(kt(e)).filter((a)=>!s.has(a))),Fe(e,Ie(r,{shape:i,checks:[]}))}function Dd(e,t){if(!Qt(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=kt(e);for(let s of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,s)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return Fe(e,Ie(e._zod.def,{shape:qd(e,t)}))}function qd(e,t){let r={};return Yt(r,e,Reflect.ownKeys(kt(e))),qb(r,t),r}function Ld(e,t){if(!Qt(t))throw Error("Invalid input to safeExtend: expected a plain object");return Fe(e,Ie(e._zod.def,{shape:qd(e,t)}))}function Fd(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};Yt(r,e,Reflect.ownKeys(kt(e))),Yt(r,t,Reflect.ownKeys(kt(t)));let n=Ie(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Fe(e,n)}function Ni(e,t,r,n="partial"){let s=t._zod.def.checks;if(s&&s.length>0)throw Error(`.${n}() cannot be used on object schemas containing refinements`);let a=r?new Set(Io(t,r)):void 0,c={};return Yt(c,t,Reflect.ownKeys(kt(t)),e&&((u,l)=>a&&!a.has(l)?u:new e({type:"optional",innerType:u}))),Fe(t,Ie(t._zod.def,{shape:c,checks:[]}))}function Ud(e,t,r){let n=r?new Set(Io(t,r)):void 0,o={};return Yt(o,t,Reflect.ownKeys(kt(t)),(s,i)=>n&&!n.has(i)?s:new e({type:"nonoptional",innerType:s})),Fe(t,Ie(t._zod.def,{shape:o}))}function pt(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 Vd(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function Ct(e,t){return t.map((r)=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function un(e){return typeof e==="string"?e:e?.message}function ji(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}function ft(e,t,r){var n;let o=e.inst?._zod?.traits;if(o?.has("$ZodType"))if(o.has("$ZodCheck"))(n=e).schema??(n.schema=e.inst);else e.schema=e.inst;let s=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,i=e.message?e.message:un(e.inst?._zod.def?.error?.(e))??un(s?.(e))??un(t?.error?.(e))??un(r.customError?.(e))??un(r.localeError?.(e))??"Invalid input",a={};for(let c of Object.keys(e)){if(c==="inst"||c==="schema"||c==="continue"||c==="input"||c==="__proto__")continue;a[c]=e[c]}if(a.path??(a.path=[]),a.message=i,t?.reportInput)a.input=e.input;return a}var Lb=/[\uD800-\uDBFF]/;function Co(e){let t=e.length;if(!Lb.test(e))return t;let r=t;for(let n=0;n<t-1;n++)if((e.charCodeAt(n)&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320)r--,n++;return r}function Ao(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function Hd(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 er(...e){let[t,r,n]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:n};return{...t}}function Bd(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);if(n.get)Object.defineProperty(e,r,{...n,enumerable:!1});else Fb(e,r,n.value)}}function Qe(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function No(e,t,r){return Qe(e,t,r,!1)}function Jd(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return Qe(this,r,n(this))},set(o){Qe(this,r,o)}})}return t}function Fb(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:Qe(this,t,r.bind(this))},set(n){Qe(this,t,n)}})}function Ub(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var Oi,Rt=!1,Vb={configurable:!0,get(){Rt=!0;return}};function Y(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&Oi!==e._zod){Oi=void 0;return}Oi=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,Vb);let o=Rt;Rt=!1;try{let s=r(this);if(Rt)delete this[t];else Object.defineProperty(this,t,{configurable:!0,writable:!0,value:s});return Rt=Rt||o,s}catch(s){throw delete this[t],Rt=Rt||o,s}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function Zi(e,t,r,n){let o=Ub(e,t);if(!o)return;Object.defineProperty(o,t,{configurable:!0,get(){let s={configurable:!0,writable:!0,enumerable:n,value:void 0};return Object.defineProperty(this,t,s),s.value=r(this),Object.defineProperty(this,t,s),s.value},set(s){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:n,value:s})}})}var Hb="~constantCatch";function Kd(e){let t=()=>e;return t[Hb]=!0,t}var Gd;var Mi={value:void 0,enumerable:!1},Wd="captureStackTrace"in Error?Error:null;function Bb(e){let t=Wd;if(t){let r=t.stackTraceLimit;if(typeof r==="number"){try{t.stackTraceLimit=0}catch{return Wd=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function y(e,t,r,n){let o={};function s(f){this.def=f,this.constr=d,this.traits=new Set}s.prototype=o;let i=r,a=i&&new WeakSet;function c(f,p){if(!f._zod){Mi.value=new s(p);try{Object.defineProperty(f,"_zod",Mi)}finally{Mi.value=void 0}}else if(f._zod.traits.has(e))return;if(f._zod.traits.add(e),t(f,p),a){let h=Object.getPrototypeOf(f),_=f._zod.constr.prototype,v=h;while(v&&v!==_)v=Object.getPrototypeOf(v);let z=v??h;if(!a.has(z))a.add(z),Bd(z,i)}let m=d.prototype;for(let h in m){if(!Object.prototype.hasOwnProperty.call(m,h))continue;if(!(h in f))f[h]=m[h].bind(f)}}let u=n?.Parent??Object;class l extends u{}Object.defineProperty(l,"name",{value:e});function d(f){let p=n?.Parent?Bb(l):this;c(p,f);let m=p._zod.deferred;if(m){for(let _ of m)_();p._zod.deferred=void 0}let h=globalThis.__zod_globalConfig?.postProcessor;if(h)h(p);return p}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:(f)=>{if(n?.Parent&&f instanceof n.Parent)return!0;return f?._zod?.traits?.has(e)}}),Object.defineProperty(d,"name",{value:e}),d}class mt extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class mn extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(Gd=globalThis).__zod_globalConfig??(Gd.__zod_globalConfig={});var Ce=globalThis.__zod_globalConfig;function Ve(e){if(e)Object.assign(Ce,e);return Ce}function Jb(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,dn,2)),e.message}function Kb(e){this._zod.message=e}var Gb={get:Jb,set:Kb,enumerable:!0,configurable:!0},qi={value:void 0,enumerable:!1},Xd=new WeakSet([Object.prototype,Error.prototype]),Yd=(e,t)=>{e.name="$ZodError",qi.value=t,Object.defineProperty(e,"issues",qi),qi.value=void 0,Object.defineProperty(e,"message",Gb);let r=Object.getPrototypeOf(e);if(!Xd.has(r))Xd.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let n=()=>this.message;return Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0})}})},Qd=y("$ZodError",Yd),hn=y("$ZodError",Yd,void 0,{Parent:Error});function Wb(e,t,r){if(!Object.prototype.hasOwnProperty.call(e,t))if(t==="__proto__")Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0});else e[t]=r();return e[t]}function ep(e,t=(r)=>r.message){let r={},n=[];for(let o of e.issues)if(o.path.length>0)Wb(r,o.path[0],()=>[]).push(t(o));else n.push(t(o));return{formErrors:n,fieldErrors:r}}function tp(e,t=(r)=>r.message){let r={_errors:[]},n=(o,s=[])=>{for(let i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map((a)=>n({issues:a},[...s,...i.path]));else if(i.code==="invalid_key")n({issues:i.issues},[...s,...i.path]);else if(i.code==="invalid_element")n({issues:i.issues},[...s,...i.path]);else{let a=[...s,...i.path];if(a.length===0)r._errors.push(t(i));else{let c=r,u=0;while(u<a.length){let l=a[u],d=u===a.length-1;if(l==="_errors"){if(d)c._errors.push(t(i));u++;continue}if(!Object.prototype.hasOwnProperty.call(c,l))Object.defineProperty(c,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let f=c[l];if(d)f._errors.push(t(i));c=f,u++}}}};return n(e),r}function jo(e,t){return{callee:t?.callee??e,Err:t?.Err}}var gn=(e)=>{let t=(r,n,o,s)=>{let i=o?{...o,async:!1}:{async:!1},a=r._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new mt;if(a.issues.length){let c=new(s?.Err??e)(a.issues.map((u)=>ft(u,i,Ve())));throw Ii(c,s?.callee??t),c}return a.value};return t},Li=gn(hn),_n=(e)=>{let t=async(r,n,o,s)=>{let i=o?{...o,async:!0}:{async:!0},a=r._zod.run({value:n,issues:[]},i);if(a instanceof Promise)a=await a;if(a.issues.length){let c=new(s?.Err??e)(a.issues.map((u)=>ft(u,i,Ve())));throw Ii(c,s?.callee??t),c}return a.value};return t},Fi=_n(hn),yn=(e)=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new mt;return s.issues.length?rp(e,s.issues,o):{success:!0,data:s.value}},vn=yn(hn);function rp(e,t,r){let n;return{success:!1,get error(){if(!n)n=new e(t.map((o)=>ft(o,r,Ve()))),t=void 0,r=void 0;return n},set error(o){n=o,t=void 0,r=void 0}}}var xn=(e)=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)s=await s;return s.issues.length?rp(e,s.issues,o):{success:!0,data:s.value}},bn=xn(hn),Yb=Symbol.for("zod.compile.invalid"),Qb=Symbol.for("zod.compile.fallback"),Zo=(e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==Yb)return!0;if(n.definite===!0&&r===void 0)return!1}return e0(e,t,r)};function e0(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,s;if(o)n[Qb]=!0,s=o({value:t,issues:[]},n);else s=e._zod.run({value:t,issues:[]},n);if(s instanceof Promise)throw new mt;return s.issues.length===0}var Mo=async(e,t,r)=>{let n=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},n);if(o instanceof Promise)o=await o;return o.issues.length===0},np=(e)=>{let t=gn(e),r=(n,o,s,i)=>{let a=s?{...s,direction:"backward"}:{direction:"backward"};return t(n,o,a,jo(r,i))};return r};var op=(e)=>{let t=gn(e),r=(n,o,s,i)=>t(n,o,s,jo(r,i));return r};var sp=(e)=>{let t=_n(e),r=async(n,o,s,i)=>{let a=s?{...s,direction:"backward"}:{direction:"backward"};return await t(n,o,a,jo(r,i))};return r};var ip=(e)=>{let t=_n(e),r=async(n,o,s,i)=>await t(n,o,s,jo(r,i));return r};var ap=(e)=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return yn(e)(t,r,o)};var cp=(e)=>(t,r,n)=>yn(e)(t,r,n);var up=(e)=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return xn(e)(t,r,o)};var lp=(e)=>async(t,r,n)=>xn(e)(t,r,n);var dp=/^[cC][0-9a-z]{6,}$/,pp=/^[0-9a-z]+$/,fp=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,mp=/^[0-9a-vA-V]{20}$/,hp=/^[A-Za-z0-9]{27}$/,gp=/^[a-zA-Z0-9_-]{21}$/;function _p(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var yp=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var vp=/^([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})$/,Vi=(e)=>{if(!e)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var xp=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var t0="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function bp(){return new RegExp(t0,"u")}var $p=/^(?:(?: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])$/,wp=/^(([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}|:))$/;var kp=/^((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])$/,Sp=/^(([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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,zp=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Pp=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var Tp=/^https?$/,Ep=/^\+[1-9]\d{6,14}$/;var Op="(?:(?:\\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])))";function r0(e){return new RegExp(`^${e}$`)}var Rp=r0(Op);function Ui(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?":"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function Ip(e){return new RegExp(`^${Ui(e)}$`)}function Cp(e){let t=["Z"];if(e.offset)t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${Ui({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,n=e.local?`${r}|${Ui({precision:e.precision})}`:r;return new RegExp(`^${Op}T(?:${n})$`)}var Ap=/^[\s\S]{0,}$/;var Hi=/^-?\d+$/,$n=/^-?\d+(?:\.\d+)?$/,Np=/^(?:true|false)$/i,jp=/^null$/i;var Zp=/^[^A-Z]*$/,Mp=/^[^a-z]*$/;var _e=y("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var Bi=(e)=>{let t=e.value;return!Td(t)&&t.length!==void 0},Do={number:"number",bigint:"bigint",object:"date"},Ji=y("$ZodCheckLessThan",(e,t)=>{_e.init(e,t);let r=Do[typeof t.value];e._zod.check=(n)=>{if(t.inclusive?n.value<=t.value:n.value<t.value)return;n.issues.push({origin:Do[typeof n.value]??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})}}),Ki=y("$ZodCheckGreaterThan",(e,t)=>{_e.init(e,t);let r=Do[typeof t.value];e._zod.check=(n)=>{if(t.inclusive?n.value>=t.value:n.value>t.value)return;n.issues.push({origin:Do[typeof n.value]??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})}}),Dp=y("$ZodCheckMultipleOf",(e,t)=>{_e.init(e,t),e._zod.check=(r)=>{if(typeof r.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof r.value==="bigint"?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):Ed(r.value,t.value)===0)return;r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),qp=y("$ZodCheckNumberFormat",(e,t)=>{_e.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,s]=Ro[t.format];e._zod.check=(i)=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){if(a>0)i.issues.push({input:a,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});else i.issues.push({input:a,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}}if(a<o)i.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort});if(a>s)i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}});var Lp=y("$ZodCheckMaxLength",(e,t)=>{var r;_e.init(e,t),(r=e._zod.def).when??(r.when=Bi),e._zod.check=(n)=>{let o=n.value,s=o.length;if((typeof o==="string"&&s>t.maximum?Co(o):s)<=t.maximum)return;let a=Ao(o);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Fp=y("$ZodCheckMinLength",(e,t)=>{var r;_e.init(e,t),(r=e._zod.def).when??(r.when=Bi),e._zod.check=(n)=>{let o=n.value,s=o.length;if((typeof o==="string"&&s>=t.minimum&&s<t.minimum*2?Co(o):s)>=t.minimum)return;let a=Ao(o);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Up=y("$ZodCheckLengthEquals",(e,t)=>{var r;_e.init(e,t),(r=e._zod.def).when??(r.when=Bi),e._zod.check=(n)=>{let o=n.value,s=o.length,i=typeof o==="string"&&s>=t.length&&s<=t.length*2?Co(o):s;if(i===t.length)return;let a=Ao(o),c=i>t.length;n.issues.push({origin:a,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),wn=y("$ZodCheckStringFormat",(e,t)=>{var r,n;if(_e.init(e,t),t.pattern)(r=e._zod).check??(r.check=(o)=>{if(t.pattern.lastIndex=0,t.pattern.test(o.value))return;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})});else(n=e._zod).check??(n.check=()=>{})}),Vp=y("$ZodCheckRegex",(e,t)=>{wn.init(e,t),e._zod.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Hp=y("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Zp),wn.init(e,t)}),Bp=y("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Mp),wn.init(e,t)}),Jp=y("$ZodCheckIncludes",(e,t)=>{_e.init(e,t);let r=It(t.includes),n=new RegExp(typeof t.position==="number"?`^.{${t.position},}${r}`:r);t.pattern=n,e._zod.check=(o)=>{if(o.value.includes(t.includes,t.position))return;o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Kp=y("$ZodCheckStartsWith",(e,t)=>{_e.init(e,t);let r=new RegExp(`^${It(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=(n)=>{if(n.value.startsWith(t.prefix))return;n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Gp=y("$ZodCheckEndsWith",(e,t)=>{_e.init(e,t);let r=new RegExp(`.*${It(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=(n)=>{if(n.value.endsWith(t.suffix))return;n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});var Wp=y("$ZodCheckOverwrite",(e,t)=>{_e.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class Gi{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let r=e.split(`
9
+ deps: ${r}}`};var qO={keyword:"dependencies",type:"object",schemaType:"object",error:xv.error,code(e){let[t,r]=LO(e);yv(e,t),vv(e,r)}};function LO({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 yv(e,t=e.schema){let{gen:r,data:n,it:o}=e;if(Object.keys(t).length===0)return;let s=r.let("missing");for(let i in t){let a=t[i];if(a.length===0)continue;let c=mo.propertyInData(r,n,i,o.opts.ownProperties);if(e.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),o.allErrors)r.if(c,()=>{for(let u of a)mo.checkReportMissingProp(e,u)});else r.if(Il._`${c} && (${mo.checkMissingProp(e,a,s)})`),mo.reportMissingProp(e,s),r.else()}}xv.validatePropertyDeps=yv;function vv(e,t=e.schema){let{gen:r,data:n,keyword:o,it:s}=e,i=r.name("valid");for(let a in t){if(DO.alwaysValidSchema(s,t[a]))continue;r.if(mo.propertyInData(r,n,a,s.opts.ownProperties),()=>{let c=e.subschema({keyword:o,schemaProp:a},i);e.mergeValidEvaluated(c,i)},()=>r.var(i,!0)),e.ok(i)}}xv.validateSchemaDeps=vv;xv.default=qO});var zv=k(function(Sv){Object.defineProperty(Sv,"__esModule",{value:!0});var kv=L(),VO=W(),HO={message:"property name must be valid",params:({params:e})=>kv._`{propertyName: ${e.propertyName}}`},BO={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:HO,code(e){let{gen:t,schema:r,data:n,it:o}=e;if(VO.alwaysValidSchema(o,r))return;let s=t.name("valid");t.forIn("key",n,(i)=>{e.setParams({propertyName:i}),e.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},s),t.if(kv.not(s),()=>{if(e.error(!0),!o.allErrors)t.break()})}),e.ok(s)}};Sv.default=BO});var Cl=k(function(Pv){Object.defineProperty(Pv,"__esModule",{value:!0});var mi=Ge(),it=L(),KO=zt(),hi=W(),GO={message:"must NOT have additional properties",params:({params:e})=>it._`{additionalProperty: ${e.additionalProperty}}`},WO={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:GO,code(e){let{gen:t,schema:r,parentSchema:n,data:o,errsCount:s,it:i}=e;if(!s)throw Error("ajv implementation error");let{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&hi.alwaysValidSchema(i,r))return;let u=mi.allSchemaProperties(n.properties),l=mi.allSchemaProperties(n.patternProperties);d(),e.ok(it._`${s} === ${KO.default.errors}`);function d(){t.forIn("key",o,(_)=>{if(!u.length&&!l.length)m(_);else t.if(f(_),()=>m(_))})}function f(_){let v;if(u.length>8){let z=hi.schemaRefOrVal(i,n.properties,"properties");v=mi.isOwnProperty(t,z,_)}else if(u.length)v=it.or(...u.map((z)=>it._`${_} === ${z}`));else v=it.nil;if(l.length)v=it.or(v,...l.map((z)=>it._`${mi.usePattern(e,z)}.test(${_})`));return it.not(v)}function p(_){t.code(it._`delete ${o}[${_}]`)}function m(_){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){p(_);return}if(r===!1){if(e.setParams({additionalProperty:_}),e.error(),!a)t.break();return}if(typeof r=="object"&&!hi.alwaysValidSchema(i,r)){let v=t.name("valid");if(c.removeAdditional==="failing")h(_,v,!1),t.if(it.not(v),()=>{e.reset(),p(_)});else if(h(_,v),!a)t.if(it.not(v),()=>t.break())}}function h(_,v,z){let A={keyword:"additionalProperties",dataProp:_,dataPropType:hi.Type.Str};if(z===!1)Object.assign(A,{compositeRule:!0,createErrors:!1,allErrors:!1});e.subschema(A,v)}}};Pv.default=WO});var Rv=k(function(Ov){Object.defineProperty(Ov,"__esModule",{value:!0});var YO=eo(),Ev=Ge(),Al=W(),Tv=Cl(),QO={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:s}=e;if(s.opts.removeAdditional==="all"&&n.additionalProperties===void 0)Tv.default.code(new YO.KeywordCxt(s,Tv.default,"additionalProperties"));let i=Ev.allSchemaProperties(r);for(let d of i)s.definedProperties.add(d);if(s.opts.unevaluated&&i.length&&s.props!==!0)s.props=Al.mergeEvaluated.props(t,Al.toHash(i),s.props);let a=i.filter((d)=>!Al.alwaysValidSchema(s,r[d]));if(a.length===0)return;let c=t.name("valid");for(let d of a){if(u(d))l(d);else{if(t.if(Ev.propertyInData(t,o,d,s.opts.ownProperties)),l(d),!s.allErrors)t.else().var(c,!0);t.endIf()}e.it.definedProperties.add(d),e.ok(c)}function u(d){return s.opts.useDefaults&&!s.compositeRule&&r[d].default!==void 0}function l(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};Ov.default=QO});var jv=k(function(Nv){Object.defineProperty(Nv,"__esModule",{value:!0});var Iv=Ge(),gi=L(),Cv=W(),Av=W(),tR={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:o,it:s}=e,{opts:i}=s,a=Iv.allSchemaProperties(r),c=a.filter((h)=>Cv.alwaysValidSchema(s,r[h]));if(a.length===0||c.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let u=i.strictSchema&&!i.allowMatchingProperties&&o.properties,l=t.name("valid");if(s.props!==!0&&!(s.props instanceof gi.Name))s.props=Av.evaluatedPropsToName(t,s.props);let{props:d}=s;f();function f(){for(let h of a){if(u)p(h);if(s.allErrors)m(h);else t.var(l,!0),m(h),t.if(l)}}function p(h){for(let _ in u)if(new RegExp(h).test(_))Cv.checkStrictMode(s,`property ${_} matches pattern ${h} (use allowMatchingProperties)`)}function m(h){t.forIn("key",n,(_)=>{t.if(gi._`${Iv.usePattern(e,h)}.test(${_})`,()=>{let v=c.includes(h);if(!v)e.subschema({keyword:"patternProperties",schemaProp:h,dataProp:_,dataPropType:Av.Type.Str},l);if(s.opts.unevaluated&&d!==!0)t.assign(gi._`${d}[${_}]`,!0);else if(!v&&!s.allErrors)t.if(gi.not(l),()=>t.break())})})}}};Nv.default=tR});var Mv=k(function(Zv){Object.defineProperty(Zv,"__esModule",{value:!0});var nR=W(),oR={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if(nR.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"}};Zv.default=oR});var qv=k(function(Dv){Object.defineProperty(Dv,"__esModule",{value:!0});var iR=Ge(),aR={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:iR.validateUnion,error:{message:"must match a schema in anyOf"}};Dv.default=aR});var Fv=k(function(Lv){Object.defineProperty(Lv,"__esModule",{value:!0});var _i=L(),uR=W(),lR={message:"must match exactly one schema in oneOf",params:({params:e})=>_i._`{passingSchemas: ${e.passing}}`},dR={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:lR,code(e){let{gen:t,schema:r,parentSchema:n,it:o}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;let s=r,i=t.let("valid",!1),a=t.let("passing",null),c=t.name("_valid");e.setParams({passing:a}),t.block(u),e.result(i,()=>e.reset(),()=>e.error(!0));function u(){s.forEach((l,d)=>{let f;if(uR.alwaysValidSchema(o,l))t.var(c,!0);else f=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c);if(d>0)t.if(_i._`${c} && ${i}`).assign(i,!1).assign(a,_i._`[${a}, ${d}]`).else();t.if(c,()=>{if(t.assign(i,!0),t.assign(a,d),f)e.mergeEvaluated(f,_i.Name)})})}}};Lv.default=dR});var Vv=k(function(Uv){Object.defineProperty(Uv,"__esModule",{value:!0});var fR=W(),mR={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");let o=t.name("valid");r.forEach((s,i)=>{if(fR.alwaysValidSchema(n,s))return;let a=e.subschema({keyword:"allOf",schemaProp:i},o);e.ok(o),e.mergeEvaluated(a)})}};Uv.default=mR});var Kv=k(function(Jv){Object.defineProperty(Jv,"__esModule",{value:!0});var yi=L(),Bv=W(),gR={message:({params:e})=>yi.str`must match "${e.ifClause}" schema`,params:({params:e})=>yi._`{failingKeyword: ${e.ifClause}}`},_R={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:gR,code(e){let{gen:t,parentSchema:r,it:n}=e;if(r.then===void 0&&r.else===void 0)Bv.checkStrictMode(n,'"if" without "then" and "else" is ignored');let o=Hv(n,"then"),s=Hv(n,"else");if(!o&&!s)return;let i=t.let("valid",!0),a=t.name("_valid");if(c(),e.reset(),o&&s){let l=t.let("ifClause");e.setParams({ifClause:l}),t.if(a,u("then",l),u("else",l))}else if(o)t.if(a,u("then"));else t.if(yi.not(a),u("else"));e.pass(i,()=>e.error(!0));function c(){let l=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(l)}function u(l,d){return()=>{let f=e.subschema({keyword:l},a);if(t.assign(i,a),e.mergeValidEvaluated(f,i),d)t.assign(d,yi._`${l}`);else e.setParams({ifClause:l})}}}};function Hv(e,t){let r=e.schema[t];return r!==void 0&&!Bv.alwaysValidSchema(e,r)}Jv.default=_R});var Wv=k(function(Gv){Object.defineProperty(Gv,"__esModule",{value:!0});var vR=W(),xR={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){if(t.if===void 0)vR.checkStrictMode(r,`"${e}" without "if" is ignored`)}};Gv.default=xR});var Yv=k(function(Xv){Object.defineProperty(Xv,"__esModule",{value:!0});var $R=Ol(),wR=pv(),kR=Rl(),SR=hv(),zR=_v(),PR=wv(),TR=zv(),ER=Cl(),OR=Rv(),RR=jv(),IR=Mv(),CR=qv(),AR=Fv(),NR=Vv(),jR=Kv(),ZR=Wv();function MR(e=!1){let t=[IR.default,CR.default,AR.default,NR.default,jR.default,ZR.default,TR.default,ER.default,PR.default,OR.default,RR.default];if(e)t.push(wR.default,SR.default);else t.push($R.default,kR.default);return t.push(zR.default),t}Xv.default=MR});var ex=k(function(Qv){Object.defineProperty(Qv,"__esModule",{value:!0});var fe=L(),qR={message:({schemaCode:e})=>fe.str`must match format "${e}"`,params:({schemaCode:e})=>fe._`{format: ${e}}`},LR={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:qR,code(e,t){let{gen:r,data:n,$data:o,schema:s,schemaCode:i,it:a}=e,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=a;if(!c.validateFormats)return;if(o)f();else p();function f(){let m=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),h=r.const("fDef",fe._`${m}[${i}]`),_=r.let("fType"),v=r.let("format");r.if(fe._`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(_,fe._`${h}.type || "string"`).assign(v,fe._`${h}.validate`),()=>r.assign(_,fe._`"string"`).assign(v,h)),e.fail$data(fe.or(z(),A()));function z(){if(c.strictSchema===!1)return fe.nil;return fe._`${i} && !${v}`}function A(){let G=l.$async?fe._`(${h}.async ? await ${v}(${n}) : ${v}(${n}))`:fe._`${v}(${n})`,E=fe._`(typeof ${v} == "function" ? ${G} : ${v}.test(${n}))`;return fe._`${v} && ${v} !== true && ${_} === ${t} && !${E}`}}function p(){let m=d.formats[s];if(!m){z();return}if(m===!0)return;let[h,_,v]=A(m);if(h===t)e.pass(G());function z(){if(c.strictSchema===!1){d.logger.warn(E());return}throw Error(E());function E(){return`unknown format "${s}" ignored in schema at path "${u}"`}}function A(E){let V=E instanceof RegExp?fe.regexpCode(E):c.code.formats?fe._`${c.code.formats}${fe.getProperty(s)}`:void 0,me=r.scopeValue("formats",{key:s,ref:E,code:V});if(typeof E=="object"&&!(E instanceof RegExp))return[E.type||"string",E.validate,fe._`${me}.validate`];return["string",E,me]}function G(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!l.$async)throw Error("async format in sync schema");return fe._`await ${v}(${n})`}return typeof _=="function"?fe._`${v}(${n})`:fe._`${v}.test(${n})`}}}};Qv.default=LR});var rx=k(function(tx){Object.defineProperty(tx,"__esModule",{value:!0});var UR=ex(),VR=[UR.default];tx.default=VR});var sx=k(function(nx){Object.defineProperty(nx,"__esModule",{value:!0});nx.contentVocabulary=nx.metadataVocabulary=void 0;nx.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];nx.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var cx=k(function(ax){Object.defineProperty(ax,"__esModule",{value:!0});var JR=Oy(),KR=nv(),GR=Yv(),WR=rx(),ix=sx(),XR=[JR.default,KR.default,(0,GR.default)(),WR.default,ix.metadataVocabulary,ix.contentVocabulary];ax.default=XR});var px=k(function(lx){Object.defineProperty(lx,"__esModule",{value:!0});lx.DiscrError=void 0;var ux;(function(e){e.Tag="tag",e.Mapping="mapping"})(ux||(lx.DiscrError=ux={}))});var hx=k(function(mx){Object.defineProperty(mx,"__esModule",{value:!0});var Fr=L(),Nl=px(),fx=Qs(),QR=to(),eI=W(),tI={message:({params:{discrError:e,tagName:t}})=>e===Nl.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>Fr._`{error: ${e}, tag: ${r}, tagValue: ${t}}`},rI={keyword:"discriminator",type:"object",schemaType:"object",error:tI,code(e){let{gen:t,data:r,schema:n,parentSchema:o,it:s}=e,{oneOf:i}=o;if(!s.opts.discriminator)throw Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw Error("discriminator: requires propertyName");if(n.mapping)throw Error("discriminator: mapping is not supported");if(!i)throw Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),u=t.const("tag",Fr._`${r}${Fr.getProperty(a)}`);t.if(Fr._`typeof ${u} == "string"`,()=>l(),()=>e.error(!1,{discrError:Nl.DiscrError.Tag,tag:u,tagName:a})),e.ok(c);function l(){let p=f();t.if(!1);for(let m in p)t.elseIf(Fr._`${u} === ${m}`),t.assign(c,d(p[m]));t.else(),e.error(!1,{discrError:Nl.DiscrError.Mapping,tag:u,tagName:a}),t.endIf()}function d(p){let m=t.name("valid"),h=e.subschema({keyword:"oneOf",schemaProp:p},m);return e.mergeEvaluated(h,Fr.Name),m}function f(){var p;let m={},h=v(o),_=!0;for(let G=0;G<i.length;G++){let E=i[G];if((E===null||E===void 0?void 0:E.$ref)&&!eI.schemaHasRulesButRef(E,s.self.RULES)){let me=E.$ref;if(E=fx.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,me),E instanceof fx.SchemaEnv)E=E.schema;if(E===void 0)throw new QR.default(s.opts.uriResolver,s.baseId,me)}let V=(p=E===null||E===void 0?void 0:E.properties)===null||p===void 0?void 0:p[a];if(typeof V!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);_=_&&(h||v(E)),z(V,G)}if(!_)throw Error(`discriminator: "${a}" must be required`);return m;function v({required:G}){return Array.isArray(G)&&G.includes(a)}function z(G,E){if(G.const)A(G.const,E);else if(G.enum)for(let V of G.enum)A(V,E);else throw Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function A(G,E){if(typeof G!="string"||G in m)throw Error(`discriminator: "${a}" values must be unique strings`);m[G]=E}}}};mx.default=rI});var gx=k(function(F4,oI){oI.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 Zl=k(function(De,jl){Object.defineProperty(De,"__esModule",{value:!0});De.MissingRefError=De.ValidationError=De.CodeGen=De.Name=De.nil=De.stringify=De.str=De._=De.KeywordCxt=De.Ajv=void 0;var sI=xy(),iI=cx(),aI=hx(),_x=gx(),cI=["/properties"],vi="http://json-schema.org/draft-07/schema";class ho extends sI.default{_addVocabularies(){if(super._addVocabularies(),iI.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(aI.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(_x,cI):_x;this.addMetaSchema(e,vi,!1),this.refs["http://json-schema.org/schema"]=vi}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(vi)?vi:void 0)}}De.Ajv=ho;jl.exports=De=ho;jl.exports.Ajv=ho;Object.defineProperty(De,"__esModule",{value:!0});De.default=ho;var uI=eo();Object.defineProperty(De,"KeywordCxt",{enumerable:!0,get:function(){return uI.KeywordCxt}});var Ur=L();Object.defineProperty(De,"_",{enumerable:!0,get:function(){return Ur._}});Object.defineProperty(De,"str",{enumerable:!0,get:function(){return Ur.str}});Object.defineProperty(De,"stringify",{enumerable:!0,get:function(){return Ur.stringify}});Object.defineProperty(De,"nil",{enumerable:!0,get:function(){return Ur.nil}});Object.defineProperty(De,"Name",{enumerable:!0,get:function(){return Ur.Name}});Object.defineProperty(De,"CodeGen",{enumerable:!0,get:function(){return Ur.CodeGen}});var lI=Xs();Object.defineProperty(De,"ValidationError",{enumerable:!0,get:function(){return lI.default}});var dI=to();Object.defineProperty(De,"MissingRefError",{enumerable:!0,get:function(){return dI.default}})});var Px=k(function(Sx){Object.defineProperty(Sx,"__esModule",{value:!0});Sx.formatNames=Sx.fastFormats=Sx.fullFormats=void 0;function _t(e,t){return{validate:e,compare:t}}Sx.fullFormats={date:_t(bx,Ll),time:_t(Dl(!0),Fl),"date-time":_t(yx(!0),wx),"iso-time":_t(Dl(),$x),"iso-date-time":_t(yx(),kx),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:vI,"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:zI,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:xI,int32:{type:"number",validate:wI},int64:{type:"number",validate:kI},float:{type:"number",validate:xx},double:{type:"number",validate:xx},password:!0,binary:!0};Sx.fastFormats={...Sx.fullFormats,date:_t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Ll),time:_t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Fl),"date-time":_t(/^\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,wx),"iso-time":_t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,$x),"iso-date-time":_t(/^\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,kx),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};Sx.formatNames=Object.keys(Sx.fullFormats);function mI(e){return e%4===0&&(e%100!==0||e%400===0)}var hI=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,gI=[0,31,28,31,30,31,30,31,31,30,31,30,31];function bx(e){let t=hI.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&&mI(r)?29:gI[n])}function Ll(e,t){if(!(e&&t))return;if(e>t)return 1;if(e<t)return-1;return 0}var Ml=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Dl(e){return function(r){let n=Ml.exec(r);if(!n)return!1;let o=+n[1],s=+n[2],i=+n[3],a=n[4],c=n[5]==="-"?-1:1,u=+(n[6]||0),l=+(n[7]||0);if(u>23||l>59||e&&!a)return!1;if(o<=23&&s<=59&&i<60)return!0;let d=s-l*c,f=o-u*c-(d<0?1:0);return(f===23||f===-1)&&(d===59||d===-1)&&i<61}}function Fl(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;return r-n}function $x(e,t){if(!(e&&t))return;let r=Ml.exec(e),n=Ml.exec(t);if(!(r&&n))return;if(e=r[1]+r[2]+r[3],t=n[1]+n[2]+n[3],e>t)return 1;if(e<t)return-1;return 0}var ql=/t|\s/i;function yx(e){let t=Dl(e);return function(n){let o=n.split(ql);return o.length===2&&bx(o[0])&&t(o[1])}}function wx(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),n=new Date(t).valueOf();if(!(r&&n))return;return r-n}function kx(e,t){if(!(e&&t))return;let[r,n]=e.split(ql),[o,s]=t.split(ql),i=Ll(r,o);if(i===void 0)return;return i||Fl(n,s)}var _I=/\/|:/,yI=/^(?:[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 vI(e){return _I.test(e)&&yI.test(e)}var vx=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function xI(e){return vx.lastIndex=0,vx.test(e)}var bI=-2147483648,$I=2147483647;function wI(e){return Number.isInteger(e)&&e<=$I&&e>=bI}function kI(e){return Number.isInteger(e)}function xx(){return!0}var SI=/[^\\]\\Z/;function zI(e){if(SI.test(e))return!1;try{return new RegExp(e),!0}catch(t){return!1}}});var Ex=k(function(Tx){Object.defineProperty(Tx,"__esModule",{value:!0});Tx.formatLimitDefinition=void 0;var TI=Zl(),at=L(),Ht=at.operators,xi={formatMaximum:{okStr:"<=",ok:Ht.LTE,fail:Ht.GT},formatMinimum:{okStr:">=",ok:Ht.GTE,fail:Ht.LT},formatExclusiveMaximum:{okStr:"<",ok:Ht.LT,fail:Ht.GTE},formatExclusiveMinimum:{okStr:">",ok:Ht.GT,fail:Ht.LTE}},EI={message:({keyword:e,schemaCode:t})=>at.str`should be ${xi[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>at._`{comparison: ${xi[e].okStr}, limit: ${t}}`};Tx.formatLimitDefinition={keyword:Object.keys(xi),type:"string",schemaType:"string",$data:!0,error:EI,code(e){let{gen:t,data:r,schemaCode:n,keyword:o,it:s}=e,{opts:i,self:a}=s;if(!i.validateFormats)return;let c=new TI.KeywordCxt(s,a.RULES.all.format.definition,"format");if(c.$data)u();else l();function u(){let f=t.scopeValue("formats",{ref:a.formats,code:i.code.formats}),p=t.const("fmt",at._`${f}[${c.schemaCode}]`);e.fail$data(at.or(at._`typeof ${p} != "object"`,at._`${p} instanceof RegExp`,at._`typeof ${p}.compare != "function"`,d(p)))}function l(){let f=c.schema,p=a.formats[f];if(!p||p===!0)return;if(typeof p!="object"||p instanceof RegExp||typeof p.compare!="function")throw Error(`"${o}": format "${f}" does not define "compare" function`);let m=t.scopeValue("formats",{key:f,ref:p,code:i.code.formats?at._`${i.code.formats}${at.getProperty(f)}`:void 0});e.fail$data(d(m))}function d(f){return at._`${f}.compare(${r}, ${n}) ${xi[o].fail} 0`}},dependencies:["format"]};var OI=(e)=>(e.addKeyword(Tx.formatLimitDefinition),e);Tx.default=OI});var Cx=k(function(go,Ix){Object.defineProperty(go,"__esModule",{value:!0});var Vr=Px(),II=Ex(),Hl=L(),Ox=new Hl.Name("fullFormats"),CI=new Hl.Name("fastFormats"),Bl=(e,t={keywords:!0})=>{if(Array.isArray(t))return Rx(e,t,Vr.fullFormats,Ox),e;let[r,n]=t.mode==="fast"?[Vr.fastFormats,CI]:[Vr.fullFormats,Ox],o=t.formats||Vr.formatNames;if(Rx(e,o,r,n),t.keywords)(0,II.default)(e);return e};Bl.get=(e,t="full")=>{let n=(t==="fast"?Vr.fastFormats:Vr.fullFormats)[e];if(!n)throw Error(`Unknown format "${e}"`);return n};function Rx(e,t,r,n){var o,s;(o=(s=e.opts.code).formats)!==null&&o!==void 0||(s.formats=Hl._`require("ajv-formats/dist/formats").${n}`);for(let i of t)e.addFormat(i,r[i])}Ix.exports=go=Bl;Object.defineProperty(go,"__esModule",{value:!0});go.default=Bl});function id(e,t=[]){let r={positional:[],flags:{}};for(let n=0;n<e.length;n++){let o=e[n];if(o==="--"){r.positional.push(...e.slice(n+1));break}if(o.startsWith("--")){let s=o.indexOf("="),i=s<0?o.slice(2):o.slice(2,s);if(s>=0)r.flags[i]=o.slice(s+1);else if(t.includes(i)||n+1>=e.length||e[n+1].startsWith("--"))r.flags[i]=!0;else r.flags[i]=e[++n]}else r.positional.push(o)}return r}function Xe(e,t){let r=e.flags[t];return typeof r==="string"?r:void 0}var Hr={name:"handout",version:"0.2.0",description:"Publish one HTML file from any LLM or any shell and get a shareable, versioned link",type:"module",main:"dist/handout.js",bin:{handout:"dist/handout.js"},files:["dist"],engines:{node:">=20"},scripts:{build:"bun build src/handout.ts --target=node --minify --outfile dist/handout.js && chmod +x dist/handout.js",typecheck:"tsc --noEmit",test:"bun test",prepublishOnly:"bun run build"},devDependencies:{"@types/node":"^24.0.0",typescript:"^5.9.3"},dependencies:{"@modelcontextprotocol/sdk":"^1.30.0",zod:"^4.6.5"},license:"MIT",repository:{type:"git",url:"git+https://github.com/YoseptF/handout.git",directory:"cli"},homepage:"https://handout.yosept.me",keywords:["html","publish","share","artifacts","llm","mcp","cli"],publishConfig:{access:"public"}};import{mkdirSync as ib,readFileSync as ab,writeFileSync as cb}from"node:fs";import{homedir as ub}from"node:os";import{join as bi}from"node:path";var lb="https://handout.yosept.me";function ad(){return process.env.XDG_CONFIG_HOME?bi(process.env.XDG_CONFIG_HOME,"handout"):bi(ub(),".config","handout")}function Br(){return bi(ad(),"config.json")}function ct(){let e={origin:lb};try{e={...e,...JSON.parse(ab(Br(),"utf8"))}}catch{}if(process.env.HANDOUT_ORIGIN)e.origin=process.env.HANDOUT_ORIGIN;if(process.env.HANDOUT_TOKEN)e.token=process.env.HANDOUT_TOKEN;return e}function Jr(e){ib(ad(),{recursive:!0,mode:448}),cb(Br(),JSON.stringify(e,null,2)+`
10
+ `,{mode:384})}function cd(e){let t=e.includes("://")?e:`https://${e}`;return new URL(t).origin}import{spawn as db}from"node:child_process";function Kt(e){if(process.env.HANDOUT_NO_BROWSER)return!1;let t=process.platform==="darwin"?["open",e]:process.platform==="win32"?["cmd","/c","start","",e]:["xdg-open",e];try{let r=db(t[0],t.slice(1),{stdio:"ignore",detached:!0});return r.on("error",()=>{}),r.unref(),!0}catch{return!1}}class $i extends Error{status;constructor(e,t){super(e);this.status=t}}async function B(e,t={}){let r=ct(),n=new Headers(t.headers);if(t.auth!==!1){if(!r.token)throw new $i("not logged in. Run `handout login` or set HANDOUT_TOKEN.",401);n.set("authorization",`Bearer ${r.token}`)}n.set("user-agent",`handout-cli/${Hr.version}`);let o=await fetch(`${r.origin}${e}`,{...t,headers:n}),s=await o.text(),i=s;try{i=JSON.parse(s)}catch{}if(!o.ok)throw new $i(typeof i==="object"&&i?.error?i.error:`${o.status} ${o.statusText}`,o.status);return i}import{hostname as pb}from"node:os";async function ud(e){let t=ct(),r=Xe(e,"origin")??Xe(e,"host");if(r)t.origin=cd(r),Jr(t);let n=Xe(e,"token");if(n){t.token=n;let i=await fb(t.origin,n);t.account=i.account.handle,Jr(t),console.log(`logged in to ${t.origin} as ${i.user.label??i.user.login}, publishing into ${i.account.handle}. Saved to ${Br()}`);return}let o=await B("/api/device/start",{method:"POST",auth:!1,headers:{"content-type":"application/json"},body:JSON.stringify({client:`handout cli on ${pb()}`})});if(console.log(`Open ${o.verification_url}`),console.log(`and approve the code ${o.user_code}`),!e.flags["no-browser"])Kt(o.verification_url);let s=Date.now()+o.expires_in*1000;process.stdout.write("waiting");while(Date.now()<s){await new Promise((a)=>setTimeout(a,o.interval*1000));let i=await B("/api/device/poll",{method:"POST",auth:!1,headers:{"content-type":"application/json"},body:JSON.stringify({device_code:o.device_code})});if(i.status==="pending"){process.stdout.write(".");continue}if(process.stdout.write(`
11
+ `),i.status==="approved"&&i.token){t.token=i.token,t.account=i.account?.handle,Jr(t),console.log(`logged in, publishing into ${i.account?.name??"your account"} (${i.account?.handle??"?"}). Saved to ${Br()}`);return}throw Error(i.status==="denied"?"login was denied in the browser":"login code expired, run `handout login` again")}throw Error("login timed out")}async function fb(e,t){let r=await fetch(`${e}/api/me`,{headers:{authorization:`Bearer ${t}`}});if(!r.ok)throw Error(`token rejected by ${e}: ${r.status}`);return await r.json()}async function ld(){let e=ct();delete e.token,delete e.account,Jr(e),console.log("logged out (token removed locally; revoke it on /settings/tokens if you want it dead)")}async function dd(){let e=await B("/api/me");console.log(`${e.user.label??e.user.login} → ${e.account.name} (${e.account.handle}) · links on https://${e.host}/`)}import{readFileSync as pd}from"node:fs";function mb(e){if(!e||e==="-")return new Uint8Array(pd(0));return new Uint8Array(pd(e))}async function fd(e){let t=mb(e.positional[0]);if(t.byteLength===0)throw Error("nothing to publish: pass a file or pipe HTML on stdin");let r=new URLSearchParams,n=Xe(e,"title"),o=Xe(e,"visibility"),s=Xe(e,"slug");if(n)r.set("title",n);if(o)r.set("visibility",o);let i=Xe(e,"update");if(s&&!i)r.set("slug",s);let a=i?`/api/artifacts/${encodeURIComponent(i)}?${r}`:`/api/artifacts?${r}`,c=await B(a,{method:i?"PUT":"POST",headers:{"content-type":"text/html; charset=utf-8"},body:t});if(e.flags.json)console.log(JSON.stringify(c,null,2));else console.log(c.url),console.error(`${i?"updated":"published"} ${c.slug} v${c.version}${c.title?` · ${c.title}`:""} · ${c.visibility}`);if(e.flags.open)Kt(c.url)}async function md(e){let t=e.positional[0];if(!t)throw Error("usage: handout versions <slug>");let r=await B(`/api/artifacts/${encodeURIComponent(t)}`);if(e.flags.json)return console.log(JSON.stringify(r,null,2));console.log(`${r.slug}${r.title?` · ${r.title}`:""} · ${r.visibility} · current v${r.version}`);for(let n of r.versions)console.log(` v${n.n} ${n.createdAt.slice(0,16).replace("T"," ")} ${String(n.size).padStart(8)} B ${n.by} ${n.url}`)}async function hd(e){let t=await B("/api/artifacts");if(e.flags.json)return console.log(JSON.stringify(t.artifacts,null,2));for(let r of t.artifacts)console.log(`${r.slug.padEnd(24)} v${String(r.version).padEnd(3)} ${r.visibility.padEnd(7)} ${r.title??""}`)}async function gd(e){let t=e.positional[0];if(!t)throw Error("usage: handout open <slug>");let r=await B(`/api/artifacts/${encodeURIComponent(t)}`);if(console.log(r.url),!e.flags["no-browser"])Kt(r.url)}function hb(e){if(console.log(`${e.slug} · ${e.visibility}${e.title?` · ${e.title}`:""}`),console.log(e.url),e.visibility==="people")console.log(e.people.length?`people: ${e.people.join(", ")}`:"people: nobody yet, add some with `handout share <slug> add <login|email>`")}async function _d(e){let[t,r,...n]=e.positional;if(!t)throw Error("usage: handout share <slug> [--visibility public|link|people] [add|remove <login|email>...]");let o=Xe(e,"visibility"),s=!!e.flags["rotate-link"];if(o||s){if(o&&!["public","link","people"].includes(o))throw Error("visibility must be public, link or people");await B(`/api/artifacts/${encodeURIComponent(t)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({visibility:o,rotateLink:s})})}if(r==="add"||r==="remove"){if(n.length===0)throw Error(`usage: handout share <slug> ${r} <login|email>...`);if(r==="add")await B(`/api/artifacts/${encodeURIComponent(t)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({visibility:"people"})});await B(`/api/artifacts/${encodeURIComponent(t)}/people`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({[r]:n})})}else if(r)throw Error(`unknown action "${r}", use add or remove`);let i=await B(`/api/artifacts/${encodeURIComponent(t)}`);if(e.flags.json)console.log(JSON.stringify(i,null,2));else hb(i)}async function yd(e){let[t,r]=e.positional;if(t==="invite"){let o=await B("/api/members/invites",{method:"POST"});if(e.flags.json)return console.log(JSON.stringify(o,null,2));console.log(o.url),console.log(`send this link; whoever opens it and signs in joins as a member. Works until ${o.expiresAt.slice(0,10)}.`);return}if(t==="add"||t==="remove"){if(!r)throw Error(`usage: handout members ${t} <login|email>`);if(t==="add")await B("/api/members",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({principal:r})});else await B(`/api/members/${encodeURIComponent(r.toLowerCase())}`,{method:"DELETE"})}else if(t)throw Error(`unknown action "${t}", use add, remove or invite`);let n=await B("/api/members");if(e.flags.json)return console.log(JSON.stringify(n,null,2));console.log(`${n.owner} owner`);for(let o of n.members)console.log(`${o.principal} added by ${o.addedBy} on ${o.addedAt.slice(0,10)}`)}async function vd(e){let t=e.positional[0];if(!t)throw Error("usage: handout delete <slug>");let r=await B(`/api/artifacts/${encodeURIComponent(t)}`,{method:"DELETE"});console.log(`deleted ${r.deleted}; its versions are gone and the slug is free again`)}function wi(e){if(console.log(`${e.hostname} ${e.active?"✓ active":e.progress?`step ${e.progress.step} of 3: ${e.progress.title}`:e.state}`),e.active)return;if(e.progress&&e.progress.step!==1){console.log(` ${e.progress.detail}`),console.log(` wait for it with: handout domain verify ${e.hostname} --wait`);return}for(let t of e.records)console.log(` ${t.type.padEnd(5)} ${t.name} → ${t.value} (${t.required?"required":"optional"}: ${t.why})`);if(e.records.some((t)=>t.host))console.log(` if your registrar asks for a host relative to your domain: ${e.records.filter((t)=>t.host).map((t)=>`${t.type} ${t.host}`).join(", ")}`);console.log(` records usually show up within minutes, some registrars take up to an hour; check from outside: https://dnschecker.org/#CNAME/${e.hostname}`),console.log(` then: handout domain verify ${e.hostname}`)}async function xd(e){let[t,r]=e.positional;if(t==="add"){if(!r)throw Error("usage: handout domain add <hostname>");let o=await B("/api/domains",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({hostname:r})});return e.flags.json?console.log(JSON.stringify(o,null,2)):wi(o)}if(t==="verify"){let o=r;if(!o){let i=await B("/api/domains");if(i.domains.length!==1)throw Error("usage: handout domain verify <hostname>");o=i.domains[0].hostname}let s=Date.now()+900000;for(;;){let i=await B(`/api/domains/${encodeURIComponent(o)}/verify`,{method:"POST"});if(i.active||!e.flags.wait||Date.now()>s){if(e.flags.json)console.log(JSON.stringify(i,null,2));else wi(i);if(!i.active)process.exitCode=3;return}process.stderr.write(`${i.state}, checking again in 20s
12
+ `),await new Promise((a)=>setTimeout(a,20000))}}if(t==="remove"){if(!r)throw Error("usage: handout domain remove <hostname>");await B(`/api/domains/${encodeURIComponent(r)}`,{method:"DELETE"}),console.log(`removed ${r}`);return}if(t)throw Error(`unknown action "${t}", use add, verify or remove`);let n=await B("/api/domains");if(e.flags.json)return console.log(JSON.stringify(n.domains,null,2));if(n.domains.length===0)return console.log("no custom domain. Add one with `handout domain add pages.example.com`");for(let o of n.domains)wi(o)}var H;(function(e){e.assertEqual=(o)=>{};function t(o){}e.assertIs=t;function r(o){throw Error()}e.assertNever=r,e.arrayToEnum=(o)=>{let s={};for(let i of o)s[i]=i;return s},e.getValidEnumValues=(o)=>{let s=e.objectKeys(o).filter((a)=>typeof o[o[a]]!=="number"),i={};for(let a of s)i[a]=o[a];return e.objectValues(i)},e.objectValues=(o)=>e.objectKeys(o).map(function(s){return o[s]}),e.objectKeys=typeof Object.keys==="function"?(o)=>Object.keys(o):(o)=>{let s=[];for(let i in o)if(Object.prototype.hasOwnProperty.call(o,i))s.push(i);return s},e.find=(o,s)=>{for(let i of o)if(s(i))return i;return},e.isInteger=typeof Number.isInteger==="function"?(o)=>Number.isInteger(o):(o)=>typeof o==="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,s=" | "){return o.map((i)=>typeof i==="string"?`'${i}'`:i).join(s)}e.joinValues=n,e.jsonStringifyReplacer=(o,s)=>{if(typeof s==="bigint")return s.toString();return s}})(H||(H={}));var bd;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(bd||(bd={}));var S=H.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),vt=(e)=>{switch(typeof e){case"undefined":return S.undefined;case"string":return S.string;case"number":return Number.isNaN(e)?S.nan:S.number;case"boolean":return S.boolean;case"function":return S.function;case"bigint":return S.bigint;case"symbol":return S.symbol;case"object":if(Array.isArray(e))return S.array;if(e===null)return S.null;if(e.then&&typeof e.then==="function"&&e.catch&&typeof e.catch==="function")return S.promise;if(typeof Map<"u"&&e instanceof Map)return S.map;if(typeof Set<"u"&&e instanceof Set)return S.set;if(typeof Date<"u"&&e instanceof Date)return S.date;return S.object;default:return S.unknown}};var x=H.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"]);class qe extends Error{get errors(){return this.issues}constructor(e){super();this.issues=[],this.addIssue=(r)=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let t=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,t);else this.__proto__=t;this.name="ZodError",this.issues=e}format(e){let t=e||function(o){return o.message},r={_errors:[]},n=(o)=>{for(let s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(n);else if(s.code==="invalid_return_type")n(s.returnTypeError);else if(s.code==="invalid_arguments")n(s.argumentsError);else if(s.path.length===0)r._errors.push(t(s));else{let i=r,a=0;while(a<s.path.length){let c=s.path[a],u=a===s.path.length-1;if(c==="_errors"){if(u)i._errors.push(t(s));a++;continue}if(!Object.prototype.hasOwnProperty.call(i,c))if(c==="__proto__")Object.defineProperty(i,c,{value:{_errors:[]},writable:!0,enumerable:!0,configurable:!0});else i[c]={_errors:[]};if(i=i[c],u)i._errors.push(t(s));a++}}};return n(this),r}static assert(e){if(!(e instanceof qe))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,H.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=(t)=>t.message){let t=Object.create(null),r=[];for(let n of this.issues)if(n.path.length>0){let o=n.path[0];t[o]=t[o]||[],t[o].push(e(n))}else r.push(e(n));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}qe.create=(e)=>new qe(e);var gb=(e,t)=>{let r;switch(e.code){case x.invalid_type:if(e.received===S.undefined)r="Required";else r=`Expected ${e.expected}, received ${e.received}`;break;case x.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,H.jsonStringifyReplacer)}`;break;case x.unrecognized_keys:r=`Unrecognized key(s) in object: ${H.joinValues(e.keys,", ")}`;break;case x.invalid_union:r="Invalid input";break;case x.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${H.joinValues(e.options)}`;break;case x.invalid_enum_value:r=`Invalid enum value. Expected ${H.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:if(typeof e.validation==="object")if("includes"in e.validation){if(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}`}else if("startsWith"in e.validation)r=`Invalid input: must start with "${e.validation.startsWith}"`;else if("endsWith"in e.validation)r=`Invalid input: must end with "${e.validation.endsWith}"`;else H.assertNever(e.validation);else if(e.validation!=="regex")r=`Invalid ${e.validation}`;else r="Invalid";break;case x.too_small:if(e.type==="array")r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`;else if(e.type==="string")r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`;else if(e.type==="number")r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`;else if(e.type==="bigint")r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`;else if(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))}`;else r="Invalid input";break;case x.too_big:if(e.type==="array")r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`;else if(e.type==="string")r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`;else if(e.type==="number")r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`;else if(e.type==="bigint")r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`;else if(e.type==="date")r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`;else 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,H.assertNever(e)}return{message:r}},Et=gb;var _b=Et;function Kr(){return _b}var xo=(e)=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,s=[...r,...o.path||[]],i={...o,path:s};if(o.message!==void 0)return{...o,path:s,message:o.message};let a="",c=n.filter((u)=>!!u).slice().reverse();for(let u of c)a=u(i,{data:t,defaultError:a}).message;return{...o,path:s,message:a}};function w(e,t){let r=Kr(),n=xo({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Et?void 0:Et].filter((o)=>!!o)});e.common.issues.push(n)}class $e{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(e,t){let r=[];for(let n of t){if(n.status==="aborted")return j;if(n.status==="dirty")e.dirty();r.push(n.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let n of t){let o=await n.key,s=await n.value;r.push({key:o,value:s})}return $e.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let n of t){let{key:o,value:s}=n;if(o.status==="aborted")return j;if(s.status==="aborted")return j;if(o.status==="dirty")e.dirty();if(s.status==="dirty")e.dirty();if(o.value!=="__proto__"&&(typeof s.value<"u"||n.alwaysSet))r[o.value]=s.value}return{status:e.value,value:r}}}var j=Object.freeze({status:"aborted"}),hr=(e)=>({status:"dirty",value:e}),Se=(e)=>({status:"valid",value:e}),ki=(e)=>e.status==="aborted",Si=(e)=>e.status==="dirty",Gt=(e)=>e.status==="valid",Gr=(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={}));class Ye{constructor(e,t,r,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=n}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var $d=(e,t)=>{if(Gt(t))return{success:!0,data:t.value};else{if(!e.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new qe(e.common.issues);return this._error=r,this._error}}}};function D(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:o}=e;if(t&&(r||n))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(t)return{errorMap:t,description:o};return{errorMap:(i,a)=>{let{message:c}=e;if(i.code==="invalid_enum_value")return{message:c??a.defaultError};if(typeof a.data>"u")return{message:c??n??a.defaultError};if(i.code!=="invalid_type")return{message:a.defaultError};return{message:c??r??a.defaultError}},description:o}}class F{get description(){return this._def.description}_getType(e){return vt(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:vt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new $e,ctx:{common:e.parent.common,data:e.data,parsedType:vt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(Gr(t))throw Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){let r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:vt(e)},n=this._parseSync({data:e,path:r.path,parent:r});return $d(r,n)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:vt(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return Gt(r)?{value:r.value}:{issues:t.common.issues}}catch(r){if(r?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then((r)=>Gt(r)?{value:r.value}:{issues:t.common.issues})}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:vt(e)},n=this._parse({data:e,path:r.path,parent:r}),o=await(Gr(n)?n:Promise.resolve(n));return $d(r,o)}refine(e,t){let r=(n)=>{if(typeof t==="string"||typeof t>"u")return{message:t};else if(typeof t==="function")return t(n);else return t};return this._refinement((n,o)=>{let s=e(n),i=()=>o.addIssue({code:x.custom,...r(n)});if(typeof Promise<"u"&&s instanceof Promise)return s.then((a)=>{if(!a)return i(),!1;else return!0});if(!s)return i(),!1;else return!0})}refinement(e,t){return this._refinement((r,n)=>{if(!e(r))return n.addIssue(typeof t==="function"?t(r,n):t),!1;else return!0})}_refinement(e){return new dt({schema:this,typeName:b.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,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:(t)=>this["~validate"](t)}}optional(){return lt.create(this,this._def)}nullable(){return Ot.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ut.create(this)}promise(){return xr.create(this,this._def)}or(e){return en.create([this,e],this._def)}and(e){return tn.create(this,e,this._def)}transform(e){return new dt({...D(this._def),schema:this,typeName:b.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e==="function"?e:()=>e;return new sn({...D(this._def),innerType:this,defaultValue:t,typeName:b.ZodDefault})}brand(){return new Ei({typeName:b.ZodBranded,type:this,...D(this._def)})}catch(e){let t=typeof e==="function"?e:()=>e;return new an({...D(this._def),innerType:this,catchValue:t,typeName:b.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return To.create(this,e)}readonly(){return cn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var yb=/^c[^\s-]{8,}$/i,vb=/^[0-9a-z]+$/,xb=/^[0-9A-HJKMNP-TV-Z]{26}$/i,bb=/^[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,$b=/^[a-z0-9_-]{21}$/i,wb=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,kb=/^[-+]?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)?)??$/,Sb=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,zb="^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$",zi,Pb=/^(?:(?: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])$/,Tb=/^(?:(?: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])$/,Eb=/^(([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]))$/,Ob=/^(([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])$/,Rb=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ib=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,wd="((\\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])))",Cb=new RegExp(`^${wd}$`);function kd(e){let t="[0-5]\\d";if(e.precision)t=`${t}\\.\\d{${e.precision}}`;else if(e.precision==null)t=`${t}(\\.\\d+)?`;let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function Ab(e){return new RegExp(`^${kd(e)}$`)}function Nb(e){let t=`${wd}T${kd(e)}`,r=[];if(r.push(e.local?"Z?":"Z"),e.offset)r.push("([+-]\\d{2}:?\\d{2})");return t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function jb(e,t){if((t==="v4"||!t)&&Pb.test(e))return!0;if((t==="v6"||!t)&&Eb.test(e))return!0;return!1}function Zb(e,t){if(!wb.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));if(typeof o!=="object"||o===null)return!1;if("typ"in o&&o?.typ!=="JWT")return!1;if(!o.alg)return!1;if(t&&o.alg!==t)return!1;return!0}catch{return!1}}function Mb(e,t){if((t==="v4"||!t)&&Tb.test(e))return!0;if((t==="v6"||!t)&&Ob.test(e))return!0;return!1}class bt extends F{_parse(e){if(this._def.coerce)e.data=String(e.data);if(this._getType(e)!==S.string){let o=this._getOrReturnCtx(e);return w(o,{code:x.invalid_type,expected:S.string,received:o.parsedType}),j}let r=new $e,n=void 0;for(let o of this._def.checks)if(o.kind==="min"){if(e.data.length<o.value)n=this._getOrReturnCtx(e,n),w(n,{code:x.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty()}else if(o.kind==="max"){if(e.data.length>o.value)n=this._getOrReturnCtx(e,n),w(n,{code:x.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty()}else if(o.kind==="length"){let s=e.data.length>o.value,i=e.data.length<o.value;if(s||i){if(n=this._getOrReturnCtx(e,n),s)w(n,{code:x.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message});else if(i)w(n,{code:x.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message});r.dirty()}}else if(o.kind==="email"){if(!Sb.test(e.data))n=this._getOrReturnCtx(e,n),w(n,{validation:"email",code:x.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="emoji"){if(!zi)zi=new RegExp(zb,"u");if(!zi.test(e.data))n=this._getOrReturnCtx(e,n),w(n,{validation:"emoji",code:x.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="uuid"){if(!bb.test(e.data))n=this._getOrReturnCtx(e,n),w(n,{validation:"uuid",code:x.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="nanoid"){if(!$b.test(e.data))n=this._getOrReturnCtx(e,n),w(n,{validation:"nanoid",code:x.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="cuid"){if(!yb.test(e.data))n=this._getOrReturnCtx(e,n),w(n,{validation:"cuid",code:x.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="cuid2"){if(!vb.test(e.data))n=this._getOrReturnCtx(e,n),w(n,{validation:"cuid2",code:x.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="ulid"){if(!xb.test(e.data))n=this._getOrReturnCtx(e,n),w(n,{validation:"ulid",code:x.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),w(n,{validation:"url",code:x.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="regex"){if(o.regex.lastIndex=0,!o.regex.test(e.data))n=this._getOrReturnCtx(e,n),w(n,{validation:"regex",code:x.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="trim")e.data=e.data.trim();else if(o.kind==="includes"){if(!e.data.includes(o.value,o.position))n=this._getOrReturnCtx(e,n),w(n,{code:x.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),r.dirty()}else if(o.kind==="toLowerCase")e.data=e.data.toLowerCase();else if(o.kind==="toUpperCase")e.data=e.data.toUpperCase();else if(o.kind==="startsWith"){if(!e.data.startsWith(o.value))n=this._getOrReturnCtx(e,n),w(n,{code:x.invalid_string,validation:{startsWith:o.value},message:o.message}),r.dirty()}else if(o.kind==="endsWith"){if(!e.data.endsWith(o.value))n=this._getOrReturnCtx(e,n),w(n,{code:x.invalid_string,validation:{endsWith:o.value},message:o.message}),r.dirty()}else if(o.kind==="datetime"){if(!Nb(o).test(e.data))n=this._getOrReturnCtx(e,n),w(n,{code:x.invalid_string,validation:"datetime",message:o.message}),r.dirty()}else if(o.kind==="date"){if(!Cb.test(e.data))n=this._getOrReturnCtx(e,n),w(n,{code:x.invalid_string,validation:"date",message:o.message}),r.dirty()}else if(o.kind==="time"){if(!Ab(o).test(e.data))n=this._getOrReturnCtx(e,n),w(n,{code:x.invalid_string,validation:"time",message:o.message}),r.dirty()}else if(o.kind==="duration"){if(!kb.test(e.data))n=this._getOrReturnCtx(e,n),w(n,{validation:"duration",code:x.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="ip"){if(!jb(e.data,o.version))n=this._getOrReturnCtx(e,n),w(n,{validation:"ip",code:x.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="jwt"){if(!Zb(e.data,o.alg))n=this._getOrReturnCtx(e,n),w(n,{validation:"jwt",code:x.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="cidr"){if(!Mb(e.data,o.version))n=this._getOrReturnCtx(e,n),w(n,{validation:"cidr",code:x.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="base64"){if(!Rb.test(e.data))n=this._getOrReturnCtx(e,n),w(n,{validation:"base64",code:x.invalid_string,message:o.message}),r.dirty()}else if(o.kind==="base64url"){if(!Ib.test(e.data))n=this._getOrReturnCtx(e,n),w(n,{validation:"base64url",code:x.invalid_string,message:o.message}),r.dirty()}else H.assertNever(o);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement((n)=>e.test(n),{validation:t,code:x.invalid_string,...O.errToObj(r)})}_addCheck(e){return new bt({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...O.errToObj(e)})}url(e){return this._addCheck({kind:"url",...O.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...O.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...O.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...O.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...O.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...O.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...O.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...O.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...O.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...O.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...O.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...O.errToObj(e)})}datetime(e){if(typeof e==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e});return this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...O.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){if(typeof e==="string")return this._addCheck({kind:"time",precision:null,message:e});return this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...O.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...O.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...O.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...O.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...O.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...O.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...O.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...O.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...O.errToObj(t)})}nonempty(e){return this.min(1,O.errToObj(e))}trim(){return new bt({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new bt({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new bt({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e)=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find((e)=>e.kind==="date")}get isTime(){return!!this._def.checks.find((e)=>e.kind==="time")}get isDuration(){return!!this._def.checks.find((e)=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find((e)=>e.kind==="email")}get isURL(){return!!this._def.checks.find((e)=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find((e)=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find((e)=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((e)=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((e)=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((e)=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find((e)=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find((e)=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find((e)=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find((e)=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find((e)=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxLength(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}}bt.create=(e)=>new bt({checks:[],typeName:b.ZodString,coerce:e?.coerce??!1,...D(e)});function Db(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,s=Number.parseInt(e.toFixed(o).replace(".","")),i=Number.parseInt(t.toFixed(o).replace(".",""));return s%i/10**o}class _r extends F{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce)e.data=Number(e.data);if(this._getType(e)!==S.number){let o=this._getOrReturnCtx(e);return w(o,{code:x.invalid_type,expected:S.number,received:o.parsedType}),j}let r=void 0,n=new $e;for(let o of this._def.checks)if(o.kind==="int"){if(!H.isInteger(e.data))r=this._getOrReturnCtx(e,r),w(r,{code:x.invalid_type,expected:"integer",received:"float",message:o.message}),n.dirty()}else if(o.kind==="min"){if(o.inclusive?e.data<o.value:e.data<=o.value)r=this._getOrReturnCtx(e,r),w(r,{code:x.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),n.dirty()}else if(o.kind==="max"){if(o.inclusive?e.data>o.value:e.data>=o.value)r=this._getOrReturnCtx(e,r),w(r,{code:x.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),n.dirty()}else if(o.kind==="multipleOf"){if(Db(e.data,o.value)!==0)r=this._getOrReturnCtx(e,r),w(r,{code:x.not_multiple_of,multipleOf:o.value,message:o.message}),n.dirty()}else if(o.kind==="finite"){if(!Number.isFinite(e.data))r=this._getOrReturnCtx(e,r),w(r,{code:x.not_finite,message:o.message}),n.dirty()}else H.assertNever(o);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,O.toString(t))}gt(e,t){return this.setLimit("min",e,!1,O.toString(t))}lte(e,t){return this.setLimit("max",e,!0,O.toString(t))}lt(e,t){return this.setLimit("max",e,!1,O.toString(t))}setLimit(e,t,r,n){return new _r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:O.toString(n)}]})}_addCheck(e){return new _r({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:O.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:O.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:O.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:O.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:O.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:O.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:O.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:O.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:O.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxValue(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}get isInt(){return!!this._def.checks.find((e)=>e.kind==="int"||e.kind==="multipleOf"&&H.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks)if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;else if(r.kind==="min"){if(t===null||r.value>t)t=r.value}else if(r.kind==="max"){if(e===null||r.value<e)e=r.value}return Number.isFinite(t)&&Number.isFinite(e)}}_r.create=(e)=>new _r({checks:[],typeName:b.ZodNumber,coerce:e?.coerce||!1,...D(e)});class yr extends F{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==S.bigint)return this._getInvalidInput(e);let r=void 0,n=new $e;for(let o of this._def.checks)if(o.kind==="min"){if(o.inclusive?e.data<o.value:e.data<=o.value)r=this._getOrReturnCtx(e,r),w(r,{code:x.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),n.dirty()}else if(o.kind==="max"){if(o.inclusive?e.data>o.value:e.data>=o.value)r=this._getOrReturnCtx(e,r),w(r,{code:x.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),n.dirty()}else if(o.kind==="multipleOf"){if(e.data%o.value!==BigInt(0))r=this._getOrReturnCtx(e,r),w(r,{code:x.not_multiple_of,multipleOf:o.value,message:o.message}),n.dirty()}else H.assertNever(o);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return w(t,{code:x.invalid_type,expected:S.bigint,received:t.parsedType}),j}gte(e,t){return this.setLimit("min",e,!0,O.toString(t))}gt(e,t){return this.setLimit("min",e,!1,O.toString(t))}lte(e,t){return this.setLimit("max",e,!0,O.toString(t))}lt(e,t){return this.setLimit("max",e,!1,O.toString(t))}setLimit(e,t,r,n){return new yr({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:O.toString(n)}]})}_addCheck(e){return new yr({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:O.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:O.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:O.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:O.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:O.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxValue(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}}yr.create=(e)=>new yr({checks:[],typeName:b.ZodBigInt,coerce:e?.coerce??!1,...D(e)});class bo extends F{_parse(e){if(this._def.coerce)e.data=Boolean(e.data);if(this._getType(e)!==S.boolean){let r=this._getOrReturnCtx(e);return w(r,{code:x.invalid_type,expected:S.boolean,received:r.parsedType}),j}return Se(e.data)}}bo.create=(e)=>new bo({typeName:b.ZodBoolean,coerce:e?.coerce||!1,...D(e)});class Xr extends F{_parse(e){if(this._def.coerce)e.data=new Date(e.data);if(this._getType(e)!==S.date){let o=this._getOrReturnCtx(e);return w(o,{code:x.invalid_type,expected:S.date,received:o.parsedType}),j}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return w(o,{code:x.invalid_date}),j}let r=new $e,n=void 0;for(let o of this._def.checks)if(o.kind==="min"){if(e.data.getTime()<o.value)n=this._getOrReturnCtx(e,n),w(n,{code:x.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),r.dirty()}else if(o.kind==="max"){if(e.data.getTime()>o.value)n=this._getOrReturnCtx(e,n),w(n,{code:x.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()}else H.assertNever(o);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Xr({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:O.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:O.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e!=null?new Date(e):null}}Xr.create=(e)=>new Xr({checks:[],coerce:e?.coerce||!1,typeName:b.ZodDate,...D(e)});class $o extends F{_parse(e){if(this._getType(e)!==S.symbol){let r=this._getOrReturnCtx(e);return w(r,{code:x.invalid_type,expected:S.symbol,received:r.parsedType}),j}return Se(e.data)}}$o.create=(e)=>new $o({typeName:b.ZodSymbol,...D(e)});class Yr extends F{_parse(e){if(this._getType(e)!==S.undefined){let r=this._getOrReturnCtx(e);return w(r,{code:x.invalid_type,expected:S.undefined,received:r.parsedType}),j}return Se(e.data)}}Yr.create=(e)=>new Yr({typeName:b.ZodUndefined,...D(e)});class Qr extends F{_parse(e){if(this._getType(e)!==S.null){let r=this._getOrReturnCtx(e);return w(r,{code:x.invalid_type,expected:S.null,received:r.parsedType}),j}return Se(e.data)}}Qr.create=(e)=>new Qr({typeName:b.ZodNull,...D(e)});class wo extends F{constructor(){super(...arguments);this._any=!0}_parse(e){return Se(e.data)}}wo.create=(e)=>new wo({typeName:b.ZodAny,...D(e)});class Wt extends F{constructor(){super(...arguments);this._unknown=!0}_parse(e){return Se(e.data)}}Wt.create=(e)=>new Wt({typeName:b.ZodUnknown,...D(e)});class $t extends F{_parse(e){let t=this._getOrReturnCtx(e);return w(t,{code:x.invalid_type,expected:S.never,received:t.parsedType}),j}}$t.create=(e)=>new $t({typeName:b.ZodNever,...D(e)});class ko extends F{_parse(e){if(this._getType(e)!==S.undefined){let r=this._getOrReturnCtx(e);return w(r,{code:x.invalid_type,expected:S.void,received:r.parsedType}),j}return Se(e.data)}}ko.create=(e)=>new ko({typeName:b.ZodVoid,...D(e)});class ut extends F{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==S.array)return w(t,{code:x.invalid_type,expected:S.array,received:t.parsedType}),j;if(n.exactLength!==null){let s=t.data.length>n.exactLength.value,i=t.data.length<n.exactLength.value;if(s||i)w(t,{code:s?x.too_big:x.too_small,minimum:i?n.exactLength.value:void 0,maximum:s?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),r.dirty()}if(n.minLength!==null){if(t.data.length<n.minLength.value)w(t,{code:x.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),r.dirty()}if(n.maxLength!==null){if(t.data.length>n.maxLength.value)w(t,{code:x.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()}if(t.common.async)return Promise.all([...t.data].map((s,i)=>n.type._parseAsync(new Ye(t,s,t.path,i)))).then((s)=>$e.mergeArray(r,s));let o=[...t.data].map((s,i)=>n.type._parseSync(new Ye(t,s,t.path,i)));return $e.mergeArray(r,o)}get element(){return this._def.type}min(e,t){return new ut({...this._def,minLength:{value:e,message:O.toString(t)}})}max(e,t){return new ut({...this._def,maxLength:{value:e,message:O.toString(t)}})}length(e,t){return new ut({...this._def,exactLength:{value:e,message:O.toString(t)}})}nonempty(e){return this.min(1,e)}}ut.create=(e,t)=>new ut({type:e,minLength:null,maxLength:null,exactLength:null,typeName:b.ZodArray,...D(t)});function gr(e){if(e instanceof pe){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=lt.create(gr(n))}return new pe({...e._def,shape:()=>t})}else if(e instanceof ut)return new ut({...e._def,type:gr(e.element)});else if(e instanceof lt)return lt.create(gr(e.unwrap()));else if(e instanceof Ot)return Ot.create(gr(e.unwrap()));else if(e instanceof wt)return wt.create(e.items.map((t)=>gr(t)));else return e}class pe extends F{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=H.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==S.object){let c=this._getOrReturnCtx(e);return w(c,{code:x.invalid_type,expected:S.object,received:c.parsedType}),j}let{status:r,ctx:n}=this._processInputParams(e),{shape:o,keys:s}=this._getCached(),i=[];if(!(this._def.catchall instanceof $t&&this._def.unknownKeys==="strip")){for(let c in n.data)if(!s.includes(c))i.push(c)}let a=[];for(let c of s){let u=o[c],l=n.data[c];a.push({key:{status:"valid",value:c},value:u._parse(new Ye(n,l,n.path,c)),alwaysSet:c in n.data})}if(this._def.catchall instanceof $t){let c=this._def.unknownKeys;if(c==="passthrough")for(let u of i)a.push({key:{status:"valid",value:u},value:{status:"valid",value:n.data[u]}});else if(c==="strict"){if(i.length>0)w(n,{code:x.unrecognized_keys,keys:i}),r.dirty()}else if(c==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let u of i){let l=n.data[u];a.push({key:{status:"valid",value:u},value:c._parse(new Ye(n,l,n.path,u)),alwaysSet:u in n.data})}}if(n.common.async)return Promise.resolve().then(async()=>{let c=[];for(let u of a){let l=await u.key,d=await u.value;c.push({key:l,value:d,alwaysSet:u.alwaysSet})}return c}).then((c)=>$e.mergeObjectSync(r,c));else return $e.mergeObjectSync(r,a)}get shape(){return this._def.shape()}strict(e){return O.errToObj,new pe({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{let n=this._def.errorMap?.(t,r).message??r.defaultError;if(t.code==="unrecognized_keys")return{message:O.errToObj(e).message??n};return{message:n}}}:{}})}strip(){return new pe({...this._def,unknownKeys:"strip"})}passthrough(){return new pe({...this._def,unknownKeys:"passthrough"})}extend(e){return new pe({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new pe({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:b.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new pe({...this._def,catchall:e})}pick(e){let t={};for(let r of H.objectKeys(e))if(e[r]&&this.shape[r])t[r]=this.shape[r];return new pe({...this._def,shape:()=>t})}omit(e){let t={};for(let r of H.objectKeys(this.shape))if(!e[r])t[r]=this.shape[r];return new pe({...this._def,shape:()=>t})}deepPartial(){return gr(this)}partial(e){let t={};for(let r of H.objectKeys(this.shape)){let n=this.shape[r];if(e&&!e[r])t[r]=n;else t[r]=n.optional()}return new pe({...this._def,shape:()=>t})}required(e){let t={};for(let r of H.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let o=this.shape[r];while(o instanceof lt)o=o._def.innerType;t[r]=o}return new pe({...this._def,shape:()=>t})}keyof(){return Sd(H.objectKeys(this.shape))}}pe.create=(e,t)=>new pe({shape:()=>e,unknownKeys:"strip",catchall:$t.create(),typeName:b.ZodObject,...D(t)});pe.strictCreate=(e,t)=>new pe({shape:()=>e,unknownKeys:"strict",catchall:$t.create(),typeName:b.ZodObject,...D(t)});pe.lazycreate=(e,t)=>new pe({shape:e,unknownKeys:"strip",catchall:$t.create(),typeName:b.ZodObject,...D(t)});class en extends F{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;function n(o){for(let i of o)if(i.result.status==="valid")return i.result;for(let i of o)if(i.result.status==="dirty")return t.common.issues.push(...i.ctx.common.issues),i.result;let s=o.map((i)=>new qe(i.ctx.common.issues));return w(t,{code:x.invalid_union,unionErrors:s}),j}if(t.common.async)return Promise.all(r.map(async(o)=>{let s={...t,common:{...t.common,issues:[]},parent:null};return{result:await o._parseAsync({data:t.data,path:t.path,parent:s}),ctx:s}})).then(n);else{let o=void 0,s=[];for(let a of r){let c={...t,common:{...t.common,issues:[]},parent:null},u=a._parseSync({data:t.data,path:t.path,parent:c});if(u.status==="valid")return u;else if(u.status==="dirty"&&!o)o={result:u,ctx:c};if(c.common.issues.length)s.push(c.common.issues)}if(o)return t.common.issues.push(...o.ctx.common.issues),o.result;let i=s.map((a)=>new qe(a));return w(t,{code:x.invalid_union,unionErrors:i}),j}}get options(){return this._def.options}}en.create=(e,t)=>new en({options:e,typeName:b.ZodUnion,...D(t)});var xt=(e)=>{if(e instanceof rn)return xt(e.schema);else if(e instanceof dt)return xt(e.innerType());else if(e instanceof nn)return[e.value];else if(e instanceof Xt)return e.options;else if(e instanceof on)return H.objectValues(e.enum);else if(e instanceof sn)return xt(e._def.innerType);else if(e instanceof Yr)return[void 0];else if(e instanceof Qr)return[null];else if(e instanceof lt)return[void 0,...xt(e.unwrap())];else if(e instanceof Ot)return[null,...xt(e.unwrap())];else if(e instanceof Ei)return xt(e.unwrap());else if(e instanceof cn)return xt(e.unwrap());else if(e instanceof an)return xt(e._def.innerType);else return[]};class Ti extends F{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==S.object)return w(t,{code:x.invalid_type,expected:S.object,received:t.parsedType}),j;let r=this.discriminator,n=t.data[r],o=this.optionsMap.get(n);if(!o)return w(t,{code:x.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),j;if(t.common.async)return o._parseAsync({data:t.data,path:t.path,parent:t});else return o._parseSync({data:t.data,path:t.path,parent:t})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let n=new Map;for(let o of t){let s=xt(o.shape[e]);if(!s.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of s){if(n.has(i))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);n.set(i,o)}}return new Ti({typeName:b.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...D(r)})}}function Pi(e,t){let r=vt(e),n=vt(t);if(e===t)return{valid:!0,data:e};else if(r===S.object&&n===S.object){let o=H.objectKeys(t),s=H.objectKeys(e).filter((a)=>o.indexOf(a)!==-1),i={...e,...t};if(Object.prototype.hasOwnProperty.call(i,"__proto__"))delete i.__proto__;for(let a of s){if(a==="__proto__")continue;let c=Pi(e[a],t[a]);if(!c.valid)return{valid:!1};i[a]=c.data}return{valid:!0,data:i}}else if(r===S.array&&n===S.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let s=0;s<e.length;s++){let i=e[s],a=t[s],c=Pi(i,a);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else if(r===S.date&&n===S.date&&+e===+t)return{valid:!0,data:e};else return{valid:!1}}class tn extends F{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=(o,s)=>{if(ki(o)||ki(s))return j;let i=Pi(o.value,s.value);if(!i.valid)return w(r,{code:x.invalid_intersection_types}),j;if(Si(o)||Si(s))t.dirty();return{status:t.value,value:i.data}};if(r.common.async)return Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([o,s])=>n(o,s));else return n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}tn.create=(e,t,r)=>new tn({left:e,right:t,typeName:b.ZodIntersection,...D(r)});class wt extends F{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==S.array)return w(r,{code:x.invalid_type,expected:S.array,received:r.parsedType}),j;if(r.data.length<this._def.items.length)return w(r,{code:x.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),j;if(!this._def.rest&&r.data.length>this._def.items.length)w(r,{code:x.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty();let o=[...r.data].map((s,i)=>{let a=this._def.items[i]||this._def.rest;if(!a)return null;return a._parse(new Ye(r,s,r.path,i))}).filter((s)=>!!s);if(r.common.async)return Promise.all(o).then((s)=>$e.mergeArray(t,s));else return $e.mergeArray(t,o)}get items(){return this._def.items}rest(e){return new wt({...this._def,rest:e})}}wt.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new wt({items:e,typeName:b.ZodTuple,rest:null,...D(t)})};class So extends F{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==S.object)return w(r,{code:x.invalid_type,expected:S.object,received:r.parsedType}),j;let n=[],o=this._def.keyType,s=this._def.valueType;for(let i in r.data)n.push({key:o._parse(new Ye(r,i,r.path,i)),value:s._parse(new Ye(r,r.data[i],r.path,i)),alwaysSet:i in r.data});if(r.common.async)return $e.mergeObjectAsync(t,n);else return $e.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,r){if(t instanceof F)return new So({keyType:e,valueType:t,typeName:b.ZodRecord,...D(r)});return new So({keyType:bt.create(),valueType:e,typeName:b.ZodRecord,...D(t)})}}class zo extends F{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==S.map)return w(r,{code:x.invalid_type,expected:S.map,received:r.parsedType}),j;let n=this._def.keyType,o=this._def.valueType,s=[...r.data.entries()].map(([i,a],c)=>({key:n._parse(new Ye(r,i,r.path,[c,"key"])),value:o._parse(new Ye(r,a,r.path,[c,"value"]))}));if(r.common.async){let i=new Map;return Promise.resolve().then(async()=>{for(let a of s){let c=await a.key,u=await a.value;if(c.status==="aborted"||u.status==="aborted")return j;if(c.status==="dirty"||u.status==="dirty")t.dirty();i.set(c.value,u.value)}return{status:t.value,value:i}})}else{let i=new Map;for(let a of s){let{key:c,value:u}=a;if(c.status==="aborted"||u.status==="aborted")return j;if(c.status==="dirty"||u.status==="dirty")t.dirty();i.set(c.value,u.value)}return{status:t.value,value:i}}}}zo.create=(e,t,r)=>new zo({valueType:t,keyType:e,typeName:b.ZodMap,...D(r)});class vr extends F{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==S.set)return w(r,{code:x.invalid_type,expected:S.set,received:r.parsedType}),j;let n=this._def;if(n.minSize!==null){if(r.data.size<n.minSize.value)w(r,{code:x.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()}if(n.maxSize!==null){if(r.data.size>n.maxSize.value)w(r,{code:x.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty()}let o=this._def.valueType;function s(a){let c=new Set;for(let u of a){if(u.status==="aborted")return j;if(u.status==="dirty")t.dirty();c.add(u.value)}return{status:t.value,value:c}}let i=[...r.data.values()].map((a,c)=>o._parse(new Ye(r,a,r.path,c)));if(r.common.async)return Promise.all(i).then((a)=>s(a));else return s(i)}min(e,t){return new vr({...this._def,minSize:{value:e,message:O.toString(t)}})}max(e,t){return new vr({...this._def,maxSize:{value:e,message:O.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}vr.create=(e,t)=>new vr({valueType:e,minSize:null,maxSize:null,typeName:b.ZodSet,...D(t)});class Wr extends F{constructor(){super(...arguments);this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==S.function)return w(t,{code:x.invalid_type,expected:S.function,received:t.parsedType}),j;function r(i,a){return xo({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Kr(),Et].filter((c)=>!!c),issueData:{code:x.invalid_arguments,argumentsError:a}})}function n(i,a){return xo({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Kr(),Et].filter((c)=>!!c),issueData:{code:x.invalid_return_type,returnTypeError:a}})}let o={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof xr){let i=this;return Se(async function(...a){let c=new qe([]),u=await i._def.args.parseAsync(a,o).catch((f)=>{throw c.addIssue(r(a,f)),c}),l=await Reflect.apply(s,this,u);return await i._def.returns._def.type.parseAsync(l,o).catch((f)=>{throw c.addIssue(n(l,f)),c})})}else{let i=this;return Se(function(...a){let c=i._def.args.safeParse(a,o);if(!c.success)throw new qe([r(a,c.error)]);let u=Reflect.apply(s,this,c.data),l=i._def.returns.safeParse(u,o);if(!l.success)throw new qe([n(u,l.error)]);return l.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Wr({...this._def,args:wt.create(e).rest(Wt.create())})}returns(e){return new Wr({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new Wr({args:e?e:wt.create([]).rest(Wt.create()),returns:t||Wt.create(),typeName:b.ZodFunction,...D(r)})}}class rn extends F{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}rn.create=(e,t)=>new rn({getter:e,typeName:b.ZodLazy,...D(t)});class nn extends F{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return w(t,{received:t.data,code:x.invalid_literal,expected:this._def.value}),j}return{status:"valid",value:e.data}}get value(){return this._def.value}}nn.create=(e,t)=>new nn({value:e,typeName:b.ZodLiteral,...D(t)});function Sd(e,t){return new Xt({values:e,typeName:b.ZodEnum,...D(t)})}class Xt extends F{_parse(e){if(typeof e.data!=="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return w(t,{expected:H.joinValues(r),received:t.parsedType,code:x.invalid_type}),j}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return w(t,{received:t.data,code:x.invalid_enum_value,options:r}),j}return Se(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Xt.create(e,{...this._def,...t})}exclude(e,t=this._def){return Xt.create(this.options.filter((r)=>!e.includes(r)),{...this._def,...t})}}Xt.create=Sd;class on extends F{_parse(e){let t=H.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==S.string&&r.parsedType!==S.number){let n=H.objectValues(t);return w(r,{expected:H.joinValues(n),received:r.parsedType,code:x.invalid_type}),j}if(!this._cache)this._cache=new Set(H.getValidEnumValues(this._def.values));if(!this._cache.has(e.data)){let n=H.objectValues(t);return w(r,{received:r.data,code:x.invalid_enum_value,options:n}),j}return Se(e.data)}get enum(){return this._def.values}}on.create=(e,t)=>new on({values:e,typeName:b.ZodNativeEnum,...D(t)});class xr extends F{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==S.promise&&t.common.async===!1)return w(t,{code:x.invalid_type,expected:S.promise,received:t.parsedType}),j;let r=t.parsedType===S.promise?t.data:Promise.resolve(t.data);return Se(r.then((n)=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}}xr.create=(e,t)=>new xr({type:e,typeName:b.ZodPromise,...D(t)});class dt extends F{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===b.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null,o={addIssue:(s)=>{if(w(r,s),s.fatal)t.abort();else t.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),n.type==="preprocess"){let s=n.transform(r.data,o);if(r.common.async)return Promise.resolve(s).then(async(i)=>{if(t.value==="aborted")return j;let a=await this._def.schema._parseAsync({data:i,path:r.path,parent:r});if(a.status==="aborted")return j;if(a.status==="dirty")return hr(a.value);if(t.value==="dirty")return hr(a.value);return a});else{if(t.value==="aborted")return j;let i=this._def.schema._parseSync({data:s,path:r.path,parent:r});if(i.status==="aborted")return j;if(i.status==="dirty")return hr(i.value);if(t.value==="dirty")return hr(i.value);return i}}if(n.type==="refinement"){let s=(i)=>{let a=n.refinement(i,o);if(r.common.async)return Promise.resolve(a);if(a instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(r.common.async===!1){let i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(i.status==="aborted")return j;if(i.status==="dirty")t.dirty();return s(i.value),{status:t.value,value:i.value}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((i)=>{if(i.status==="aborted")return j;if(i.status==="dirty")t.dirty();return s(i.value).then(()=>({status:t.value,value:i.value}))})}if(n.type==="transform")if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Gt(s))return j;let i=n.transform(s.value,o);if(i instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((s)=>{if(!Gt(s))return j;return Promise.resolve(n.transform(s.value,o)).then((i)=>({status:t.value,value:i}))});H.assertNever(n)}}dt.create=(e,t,r)=>new dt({schema:e,typeName:b.ZodEffects,effect:t,...D(r)});dt.createWithPreprocess=(e,t,r)=>new dt({schema:t,effect:{type:"preprocess",transform:e},typeName:b.ZodEffects,...D(r)});class lt extends F{_parse(e){if(this._getType(e)===S.undefined)return Se(void 0);return this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}lt.create=(e,t)=>new lt({innerType:e,typeName:b.ZodOptional,...D(t)});class Ot extends F{_parse(e){if(this._getType(e)===S.null)return Se(null);return this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ot.create=(e,t)=>new Ot({innerType:e,typeName:b.ZodNullable,...D(t)});class sn extends F{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;if(t.parsedType===S.undefined)r=this._def.defaultValue();return this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}sn.create=(e,t)=>new sn({innerType:e,typeName:b.ZodDefault,defaultValue:typeof t.default==="function"?t.default:()=>t.default,...D(t)});class an extends F{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});if(Gr(n))return n.then((o)=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new qe(r.common.issues)},input:r.data})}));else return{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new qe(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}an.create=(e,t)=>new an({innerType:e,typeName:b.ZodCatch,catchValue:typeof t.catch==="function"?t.catch:()=>t.catch,...D(t)});class Po extends F{_parse(e){if(this._getType(e)!==S.nan){let r=this._getOrReturnCtx(e);return w(r,{code:x.invalid_type,expected:S.nan,received:r.parsedType}),j}return{status:"valid",value:e.data}}}Po.create=(e)=>new Po({typeName:b.ZodNaN,...D(e)});var jC=Symbol("zod_brand");class Ei extends F{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class To extends F{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});if(o.status==="aborted")return j;if(o.status==="dirty")return t.dirty(),hr(o.value);else return this._def.out._parseAsync({data:o.value,path:r.path,parent:r})})();else{let n=this._def.in._parseSync({data:r.data,path:r.path,parent:r});if(n.status==="aborted")return j;if(n.status==="dirty")return t.dirty(),{status:"dirty",value:n.value};else return this._def.out._parseSync({data:n.value,path:r.path,parent:r})}}static create(e,t){return new To({in:e,out:t,typeName:b.ZodPipeline})}}class cn extends F{_parse(e){let t=this._def.innerType._parse(e),r=(n)=>{if(Gt(n))n.value=Object.freeze(n.value);return n};return Gr(t)?t.then((n)=>r(n)):r(t)}unwrap(){return this._def.innerType}}cn.create=(e,t)=>new cn({innerType:e,typeName:b.ZodReadonly,...D(t)});var ZC={object:pe.lazycreate},b;(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"})(b||(b={}));var MC=bt.create,DC=_r.create,qC=Po.create,LC=yr.create,FC=bo.create,UC=Xr.create,VC=$o.create,HC=Yr.create,BC=Qr.create,JC=wo.create,KC=Wt.create,GC=$t.create,WC=ko.create,XC=ut.create,{create:zd,strictCreate:YC}=pe,QC=en.create,eA=Ti.create,tA=tn.create,rA=wt.create,nA=So.create,oA=zo.create,sA=vr.create,iA=Wr.create,aA=rn.create,cA=nn.create,uA=Xt.create,lA=on.create,dA=xr.create,pA=dt.create,fA=lt.create,mA=Ot.create,hA=dt.createWithPreprocess,gA=To.create;function ln(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 Ri(e,t="|"){return e.map((r)=>Ci(r)).join(t)}function dn(e,t){if(typeof t==="bigint")return t.toString();return t}class Pd{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;if(e!==void 0)this._value=e(),this._getter=void 0;return this._value}}function pn(e){return new Pd(e)}function Td(e){return e===null||e===void 0}function Eo(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Ed(e,t){let r=e/t,n=Math.round(r),o=4*Number.EPSILON*Math.max(Math.abs(r),1);if(Math.abs(r-n)<o)return 0;return r-n}function Le(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function fn(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function kt(e){return fn(e._zod.def)??e._zod.def.shape}function Od(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return Le(this,t,n),n},enumerable:!0,configurable:!0})}function Rd(e,t,r){if(t in e)Le(e,t,r);else e[t]=r}function Yt(e,t,r,n){let o=kt(t);for(let s of r){let i=Object.getOwnPropertyDescriptor(o,s);if(!i.enumerable)continue;if(i.get)Od(e,s,()=>{let a=t._zod.def.shape[s];return n?n(a,s):a});else Rd(e,s,n?n(i.value,s):i.value)}}function qb(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);if(!n.enumerable)continue;if(n.get)Od(e,r,()=>t[r]);else Rd(e,r,n.value)}}function Ie(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function Id(e){return JSON.stringify(e)}function Cd(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Ii="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function br(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var Ad=pn(()=>{if(Ce.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function Qt(e){if(br(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let r=t.prototype;if(br(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function Oo(e){if(Qt(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}var Nd=new Set(["string","number","symbol"]);function It(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Fe(e,t,r){let n=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)n._zod.parent=e;return n}function T(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 Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function Ci(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function jd(e){return Object.keys(e).filter((t)=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var Ro=(()=>({safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}))(),Ai={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Zd(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let s={};return Yt(s,e,Io(e,t)),Fe(e,Ie(r,{shape:s,checks:[]}))}function Io(e,t){let r=kt(e),n=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,o)?.enumerable)throw Error(`Unrecognized key: "${String(o)}"`);if(t[o])n.push(o)}return n}function Md(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let s=new Set(Io(e,t)),i={};return Yt(i,e,Reflect.ownKeys(kt(e)).filter((a)=>!s.has(a))),Fe(e,Ie(r,{shape:i,checks:[]}))}function Dd(e,t){if(!Qt(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=kt(e);for(let s of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,s)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return Fe(e,Ie(e._zod.def,{shape:qd(e,t)}))}function qd(e,t){let r={};return Yt(r,e,Reflect.ownKeys(kt(e))),qb(r,t),r}function Ld(e,t){if(!Qt(t))throw Error("Invalid input to safeExtend: expected a plain object");return Fe(e,Ie(e._zod.def,{shape:qd(e,t)}))}function Fd(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};Yt(r,e,Reflect.ownKeys(kt(e))),Yt(r,t,Reflect.ownKeys(kt(t)));let n=Ie(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Fe(e,n)}function Ni(e,t,r,n="partial"){let s=t._zod.def.checks;if(s&&s.length>0)throw Error(`.${n}() cannot be used on object schemas containing refinements`);let a=r?new Set(Io(t,r)):void 0,c={};return Yt(c,t,Reflect.ownKeys(kt(t)),e&&((u,l)=>a&&!a.has(l)?u:new e({type:"optional",innerType:u}))),Fe(t,Ie(t._zod.def,{shape:c,checks:[]}))}function Ud(e,t,r){let n=r?new Set(Io(t,r)):void 0,o={};return Yt(o,t,Reflect.ownKeys(kt(t)),(s,i)=>n&&!n.has(i)?s:new e({type:"nonoptional",innerType:s})),Fe(t,Ie(t._zod.def,{shape:o}))}function pt(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 Vd(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function Ct(e,t){return t.map((r)=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function un(e){return typeof e==="string"?e:e?.message}function ji(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}function ft(e,t,r){var n;let o=e.inst?._zod?.traits;if(o?.has("$ZodType"))if(o.has("$ZodCheck"))(n=e).schema??(n.schema=e.inst);else e.schema=e.inst;let s=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,i=e.message?e.message:un(e.inst?._zod.def?.error?.(e))??un(s?.(e))??un(t?.error?.(e))??un(r.customError?.(e))??un(r.localeError?.(e))??"Invalid input",a={};for(let c of Object.keys(e)){if(c==="inst"||c==="schema"||c==="continue"||c==="input"||c==="__proto__")continue;a[c]=e[c]}if(a.path??(a.path=[]),a.message=i,t?.reportInput)a.input=e.input;return a}var Lb=/[\uD800-\uDBFF]/;function Co(e){let t=e.length;if(!Lb.test(e))return t;let r=t;for(let n=0;n<t-1;n++)if((e.charCodeAt(n)&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320)r--,n++;return r}function Ao(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function Hd(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 er(...e){let[t,r,n]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:n};return{...t}}function Bd(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);if(n.get)Object.defineProperty(e,r,{...n,enumerable:!1});else Fb(e,r,n.value)}}function Qe(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function No(e,t,r){return Qe(e,t,r,!1)}function Jd(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return Qe(this,r,n(this))},set(o){Qe(this,r,o)}})}return t}function Fb(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:Qe(this,t,r.bind(this))},set(n){Qe(this,t,n)}})}function Ub(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var Oi,Rt=!1,Vb={configurable:!0,get(){Rt=!0;return}};function Y(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&Oi!==e._zod){Oi=void 0;return}Oi=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,Vb);let o=Rt;Rt=!1;try{let s=r(this);if(Rt)delete this[t];else Object.defineProperty(this,t,{configurable:!0,writable:!0,value:s});return Rt=Rt||o,s}catch(s){throw delete this[t],Rt=Rt||o,s}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function Zi(e,t,r,n){let o=Ub(e,t);if(!o)return;Object.defineProperty(o,t,{configurable:!0,get(){let s={configurable:!0,writable:!0,enumerable:n,value:void 0};return Object.defineProperty(this,t,s),s.value=r(this),Object.defineProperty(this,t,s),s.value},set(s){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:n,value:s})}})}var Hb="~constantCatch";function Kd(e){let t=()=>e;return t[Hb]=!0,t}var Gd;var Mi={value:void 0,enumerable:!1},Wd="captureStackTrace"in Error?Error:null;function Bb(e){let t=Wd;if(t){let r=t.stackTraceLimit;if(typeof r==="number"){try{t.stackTraceLimit=0}catch{return Wd=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function y(e,t,r,n){let o={};function s(f){this.def=f,this.constr=d,this.traits=new Set}s.prototype=o;let i=r,a=i&&new WeakSet;function c(f,p){if(!f._zod){Mi.value=new s(p);try{Object.defineProperty(f,"_zod",Mi)}finally{Mi.value=void 0}}else if(f._zod.traits.has(e))return;if(f._zod.traits.add(e),t(f,p),a){let h=Object.getPrototypeOf(f),_=f._zod.constr.prototype,v=h;while(v&&v!==_)v=Object.getPrototypeOf(v);let z=v??h;if(!a.has(z))a.add(z),Bd(z,i)}let m=d.prototype;for(let h in m){if(!Object.prototype.hasOwnProperty.call(m,h))continue;if(!(h in f))f[h]=m[h].bind(f)}}let u=n?.Parent??Object;class l extends u{}Object.defineProperty(l,"name",{value:e});function d(f){let p=n?.Parent?Bb(l):this;c(p,f);let m=p._zod.deferred;if(m){for(let _ of m)_();p._zod.deferred=void 0}let h=globalThis.__zod_globalConfig?.postProcessor;if(h)h(p);return p}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:(f)=>{if(n?.Parent&&f instanceof n.Parent)return!0;return f?._zod?.traits?.has(e)}}),Object.defineProperty(d,"name",{value:e}),d}class mt extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class mn extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(Gd=globalThis).__zod_globalConfig??(Gd.__zod_globalConfig={});var Ce=globalThis.__zod_globalConfig;function Ve(e){if(e)Object.assign(Ce,e);return Ce}function Jb(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,dn,2)),e.message}function Kb(e){this._zod.message=e}var Gb={get:Jb,set:Kb,enumerable:!0,configurable:!0},qi={value:void 0,enumerable:!1},Xd=new WeakSet([Object.prototype,Error.prototype]),Yd=(e,t)=>{e.name="$ZodError",qi.value=t,Object.defineProperty(e,"issues",qi),qi.value=void 0,Object.defineProperty(e,"message",Gb);let r=Object.getPrototypeOf(e);if(!Xd.has(r))Xd.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let n=()=>this.message;return Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0})}})},Qd=y("$ZodError",Yd),hn=y("$ZodError",Yd,void 0,{Parent:Error});function Wb(e,t,r){if(!Object.prototype.hasOwnProperty.call(e,t))if(t==="__proto__")Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0});else e[t]=r();return e[t]}function ep(e,t=(r)=>r.message){let r={},n=[];for(let o of e.issues)if(o.path.length>0)Wb(r,o.path[0],()=>[]).push(t(o));else n.push(t(o));return{formErrors:n,fieldErrors:r}}function tp(e,t=(r)=>r.message){let r={_errors:[]},n=(o,s=[])=>{for(let i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map((a)=>n({issues:a},[...s,...i.path]));else if(i.code==="invalid_key")n({issues:i.issues},[...s,...i.path]);else if(i.code==="invalid_element")n({issues:i.issues},[...s,...i.path]);else{let a=[...s,...i.path];if(a.length===0)r._errors.push(t(i));else{let c=r,u=0;while(u<a.length){let l=a[u],d=u===a.length-1;if(l==="_errors"){if(d)c._errors.push(t(i));u++;continue}if(!Object.prototype.hasOwnProperty.call(c,l))Object.defineProperty(c,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let f=c[l];if(d)f._errors.push(t(i));c=f,u++}}}};return n(e),r}function jo(e,t){return{callee:t?.callee??e,Err:t?.Err}}var gn=(e)=>{let t=(r,n,o,s)=>{let i=o?{...o,async:!1}:{async:!1},a=r._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new mt;if(a.issues.length){let c=new(s?.Err??e)(a.issues.map((u)=>ft(u,i,Ve())));throw Ii(c,s?.callee??t),c}return a.value};return t},Li=gn(hn),_n=(e)=>{let t=async(r,n,o,s)=>{let i=o?{...o,async:!0}:{async:!0},a=r._zod.run({value:n,issues:[]},i);if(a instanceof Promise)a=await a;if(a.issues.length){let c=new(s?.Err??e)(a.issues.map((u)=>ft(u,i,Ve())));throw Ii(c,s?.callee??t),c}return a.value};return t},Fi=_n(hn),yn=(e)=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new mt;return s.issues.length?rp(e,s.issues,o):{success:!0,data:s.value}},vn=yn(hn);function rp(e,t,r){let n;return{success:!1,get error(){if(!n)n=new e(t.map((o)=>ft(o,r,Ve()))),t=void 0,r=void 0;return n},set error(o){n=o,t=void 0,r=void 0}}}var xn=(e)=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)s=await s;return s.issues.length?rp(e,s.issues,o):{success:!0,data:s.value}},bn=xn(hn),Yb=Symbol.for("zod.compile.invalid"),Qb=Symbol.for("zod.compile.fallback"),Zo=(e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==Yb)return!0;if(n.definite===!0&&r===void 0)return!1}return e0(e,t,r)};function e0(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,s;if(o)n[Qb]=!0,s=o({value:t,issues:[]},n);else s=e._zod.run({value:t,issues:[]},n);if(s instanceof Promise)throw new mt;return s.issues.length===0}var Mo=async(e,t,r)=>{let n=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},n);if(o instanceof Promise)o=await o;return o.issues.length===0},np=(e)=>{let t=gn(e),r=(n,o,s,i)=>{let a=s?{...s,direction:"backward"}:{direction:"backward"};return t(n,o,a,jo(r,i))};return r};var op=(e)=>{let t=gn(e),r=(n,o,s,i)=>t(n,o,s,jo(r,i));return r};var sp=(e)=>{let t=_n(e),r=async(n,o,s,i)=>{let a=s?{...s,direction:"backward"}:{direction:"backward"};return await t(n,o,a,jo(r,i))};return r};var ip=(e)=>{let t=_n(e),r=async(n,o,s,i)=>await t(n,o,s,jo(r,i));return r};var ap=(e)=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return yn(e)(t,r,o)};var cp=(e)=>(t,r,n)=>yn(e)(t,r,n);var up=(e)=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return xn(e)(t,r,o)};var lp=(e)=>async(t,r,n)=>xn(e)(t,r,n);var dp=/^[cC][0-9a-z]{6,}$/,pp=/^[0-9a-z]+$/,fp=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,mp=/^[0-9a-vA-V]{20}$/,hp=/^[A-Za-z0-9]{27}$/,gp=/^[a-zA-Z0-9_-]{21}$/;function _p(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var yp=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var vp=/^([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})$/,Vi=(e)=>{if(!e)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var xp=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var t0="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function bp(){return new RegExp(t0,"u")}var $p=/^(?:(?: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])$/,wp=/^(([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}|:))$/;var kp=/^((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])$/,Sp=/^(([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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,zp=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Pp=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var Tp=/^https?$/,Ep=/^\+[1-9]\d{6,14}$/;var Op="(?:(?:\\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])))";function r0(e){return new RegExp(`^${e}$`)}var Rp=r0(Op);function Ui(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?":"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function Ip(e){return new RegExp(`^${Ui(e)}$`)}function Cp(e){let t=["Z"];if(e.offset)t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${Ui({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,n=e.local?`${r}|${Ui({precision:e.precision})}`:r;return new RegExp(`^${Op}T(?:${n})$`)}var Ap=/^[\s\S]{0,}$/;var Hi=/^-?\d+$/,$n=/^-?\d+(?:\.\d+)?$/,Np=/^(?:true|false)$/i,jp=/^null$/i;var Zp=/^[^A-Z]*$/,Mp=/^[^a-z]*$/;var _e=y("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var Bi=(e)=>{let t=e.value;return!Td(t)&&t.length!==void 0},Do={number:"number",bigint:"bigint",object:"date"},Ji=y("$ZodCheckLessThan",(e,t)=>{_e.init(e,t);let r=Do[typeof t.value];e._zod.check=(n)=>{if(t.inclusive?n.value<=t.value:n.value<t.value)return;n.issues.push({origin:Do[typeof n.value]??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})}}),Ki=y("$ZodCheckGreaterThan",(e,t)=>{_e.init(e,t);let r=Do[typeof t.value];e._zod.check=(n)=>{if(t.inclusive?n.value>=t.value:n.value>t.value)return;n.issues.push({origin:Do[typeof n.value]??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})}}),Dp=y("$ZodCheckMultipleOf",(e,t)=>{_e.init(e,t),e._zod.check=(r)=>{if(typeof r.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof r.value==="bigint"?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):Ed(r.value,t.value)===0)return;r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),qp=y("$ZodCheckNumberFormat",(e,t)=>{_e.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,s]=Ro[t.format];e._zod.check=(i)=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){if(a>0)i.issues.push({input:a,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});else i.issues.push({input:a,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}}if(a<o)i.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort});if(a>s)i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}});var Lp=y("$ZodCheckMaxLength",(e,t)=>{var r;_e.init(e,t),(r=e._zod.def).when??(r.when=Bi),e._zod.check=(n)=>{let o=n.value,s=o.length;if((typeof o==="string"&&s>t.maximum?Co(o):s)<=t.maximum)return;let a=Ao(o);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Fp=y("$ZodCheckMinLength",(e,t)=>{var r;_e.init(e,t),(r=e._zod.def).when??(r.when=Bi),e._zod.check=(n)=>{let o=n.value,s=o.length;if((typeof o==="string"&&s>=t.minimum&&s<t.minimum*2?Co(o):s)>=t.minimum)return;let a=Ao(o);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Up=y("$ZodCheckLengthEquals",(e,t)=>{var r;_e.init(e,t),(r=e._zod.def).when??(r.when=Bi),e._zod.check=(n)=>{let o=n.value,s=o.length,i=typeof o==="string"&&s>=t.length&&s<=t.length*2?Co(o):s;if(i===t.length)return;let a=Ao(o),c=i>t.length;n.issues.push({origin:a,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),wn=y("$ZodCheckStringFormat",(e,t)=>{var r,n;if(_e.init(e,t),t.pattern)(r=e._zod).check??(r.check=(o)=>{if(t.pattern.lastIndex=0,t.pattern.test(o.value))return;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})});else(n=e._zod).check??(n.check=()=>{})}),Vp=y("$ZodCheckRegex",(e,t)=>{wn.init(e,t),e._zod.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Hp=y("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Zp),wn.init(e,t)}),Bp=y("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Mp),wn.init(e,t)}),Jp=y("$ZodCheckIncludes",(e,t)=>{_e.init(e,t);let r=It(t.includes),n=new RegExp(typeof t.position==="number"?`^.{${t.position},}${r}`:r);t.pattern=n,e._zod.check=(o)=>{if(o.value.includes(t.includes,t.position))return;o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Kp=y("$ZodCheckStartsWith",(e,t)=>{_e.init(e,t);let r=new RegExp(`^${It(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=(n)=>{if(n.value.startsWith(t.prefix))return;n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Gp=y("$ZodCheckEndsWith",(e,t)=>{_e.init(e,t);let r=new RegExp(`.*${It(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=(n)=>{if(n.value.endsWith(t.suffix))return;n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});var Wp=y("$ZodCheckOverwrite",(e,t)=>{_e.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class Gi{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let r=e.split(`
13
13
  `).filter((s)=>s),n=Math.min(...r.map((s)=>s.length-s.trimStart().length)),o=r.map((s)=>s.slice(n)).map((s)=>" ".repeat(this.indent*2)+s);for(let s of o)this.content.push(s)}compile(){let e=Function,t=this?.content??[""];return new e(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
14
14
  ${t.join(`
15
15
  `)}
16
- };`)(...Object.values(this.closed))}}var Yp={major:4,minor:6,patch:5};var ee=y("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Yp;let n=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...n??[]]:n?.length?[...n]:[];for(let s of o)for(let i of s._zod.onattach)i(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let s=(a,c,u)=>{if(a.memo)return a;let l=pt(a),d;for(let f of c){if(f._zod.def.when){if(Vd(a))continue;if(!f._zod.def.when(a))continue}else if(l)continue;let p=a.issues.length,m=f._zod.check(a);if(m instanceof Promise&&u?.async===!1)throw new mt;if(d||m instanceof Promise)d=(d??Promise.resolve()).then(async()=>{if(await m,a.issues.length===p)return;if(ji(a.issues,p,e),!l)l=pt(a,p)});else{if(a.issues.length===p)continue;if(ji(a.issues,p,e),!l)l=pt(a,p)}}if(d)return d.then(()=>a);return a},i=(a,c,u)=>{if(pt(a))return a.aborted=!0,a;let l=s(c,o,u);if(l instanceof Promise){if(u.async===!1)throw new mt;return l.then((d)=>e._zod.parse(d,u))}return e._zod.parse(l,u)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){let l=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});if(l instanceof Promise)return l.then((d)=>i(d,a,c));return i(l,a,c)}let u=e._zod.parse(a,c);if(u instanceof Promise){if(c.async===!1)throw new mt;return u.then((l)=>s(l,o,c))}return s(u,o,c)}}},{get "~standard"(){return No(this,"~standard",Xi(this))},set "~standard"(e){Qe(this,"~standard",e)}}),lf=(e,t)=>e.issues.length?{issues:e.issues.map((r)=>ft(r,t,Ve()))}:{value:e.value};async function n0(e,t){let r={async:!0};return lf(await e._zod.run({value:t,issues:[]},r),r)}function Xi(e){return{validate:(t)=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return lf(n,r)}catch(n){}return n0(e,t)},vendor:"zod",version:1}}var kn=y("$ZodString",(e,t)=>{ee.init(e,t),e._zod.pattern=t.pattern??Ap,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(o){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),ne=y("$ZodStringFormat",(e,t)=>{wn.init(e,t),kn.init(e,t)}),Yi=y("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=vp),ne.init(e,t)}),Qi=y("$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 Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Vi(n))}else t.pattern??(t.pattern=Vi());ne.init(e,t)}),ea=y("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=xp),ne.init(e,t)}),df=1,Lo=2;function pf(e){try{if(typeof URL<"u"&&typeof URL.canParse==="function")return URL.canParse(e);return new URL(e),!0}catch{return!1}}function o0(e,t){if(!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t))return pf(e)||Lo;return s0(e,t)}function s0(e,t){if(!t.normalize&&t.protocol?.source===Tp.source&&!/^https?:\/\//i.test(e))return df;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse==="function")return r.parse(e)??Lo}return new URL(e)}catch{return Lo}}var i0=/[\t\n\r]/g;function Qp(e){return e.replace(i0,"")}function a0(e,t){return t.lastIndex=0,t.test(e.hostname)}function c0(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var ta=y("$ZodURL",(e,t)=>{ne.init(e,t),e._zod.check=(r)=>{try{let n=r.value.trim(),o=o0(n,t);if(o===df){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===Lo){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(o===!0){r.value=Qp(n);return}if(t.hostname&&!a0(o,t.hostname))r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort});if(t.protocol&&!c0(o,t.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort});r.value=t.normalize?o.href:Qp(n);return}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),ra=y("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=bp()),ne.init(e,t)}),na=y("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?gp:_p(t.length)),ne.init(e,t)}),oa=y("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=dp),ne.init(e,t)}),sa=y("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=pp),ne.init(e,t)}),ia=y("$ZodULID",(e,t)=>{t.pattern??(t.pattern=fp),ne.init(e,t)}),aa=y("$ZodXID",(e,t)=>{t.pattern??(t.pattern=mp),ne.init(e,t)}),ca=y("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=hp),ne.init(e,t)}),ff=y("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Cp(t)),ne.init(e,t)}),mf=y("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Rp),ne.init(e,t)}),hf=y("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Ip(t)),ne.init(e,t)}),gf=y("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=yp),ne.init(e,t)}),ua=y("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=$p),ne.init(e,t)}),u0=/^[0-9a-fA-F:.]+$/;function _f(e){if(!u0.test(e))return!1;return pf(`http://[${e}]`)}var la=y("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=wp),ne.init(e,t),e._zod.check=(r)=>{if(!_f(r.value))r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var da=y("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=kp),ne.init(e,t)});function l0(e){let t=e.split("/");if(t.length!==2)return!1;let[r,n]=t;if(!n)return!1;let o=Number(n);if(`${o}`!==n)return!1;if(o<0||o>128)return!1;return _f(r)}var pa=y("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Sp),ne.init(e,t),e._zod.check=(r)=>{if(!l0(r.value))r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function yf(e){if(e==="")return!0;if(/\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var fa=/^[0-9a-zA-Z+/]*={0,2}$/,ma=y("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=fa),ne.init(e,t),e._zod.check=(r)=>{if(yf(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),Uo=/^[A-Za-z0-9_-]*$/;function d0(e){if(!Uo.test(e))return!1;let t=e.replace(/[-_]/g,(n)=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return yf(r)}var ha=y("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Uo),ne.init(e,t),e._zod.check=(r)=>{if(d0(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),ga=y("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Ep),ne.init(e,t)});function p0(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));if("typ"in o&&o?.typ!=="JWT")return!1;if(!o.alg)return!1;if(t&&(!("alg"in o)||o.alg!==t))return!1;return!0}catch{return!1}}var _a=y("$ZodJWT",(e,t)=>{ne.init(e,t),e._zod.check=(r)=>{if(p0(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var Vo=y("$ZodNumber",(e,t)=>{ee.init(e,t),e._zod.pattern=$n,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch(i){}let o=r.value;if(typeof o==="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let s=typeof o==="number"?Number.isNaN(o)?"NaN":!Number.isFinite(o)?String(o):void 0:void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),r}}),ya=y("$ZodNumberFormat",(e,t)=>{qp.init(e,t),Vo.init(e,t)}),va=y("$ZodBoolean",(e,t)=>{ee.init(e,t),e._zod.pattern=Np,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(s){}let o=r.value;if(typeof o==="boolean")return r;return r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}});var xa=y("$ZodNull",(e,t)=>{ee.init(e,t),e._zod.pattern=jp,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let o=r.value;if(o===null)return r;return r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),r}});var ba=y("$ZodUnknown",(e,t)=>{ee.init(e,t),e._zod.parse=(r)=>r}),$a=y("$ZodNever",(e,t)=>{ee.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function ef(e,t,r){if(e.issues.length)t.issues.push(...Ct(r,e.issues));t.value[r]=e.value}var wa=y("$ZodArray",(e,t)=>{ee.init(e,t);let r=Ce.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let s=n.value;if(!Array.isArray(s))return n.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),n;n.value=r?r.alloc(e,n,Array(s.length),o):Array(s.length);let i=[],a=o?.abortEarly;for(let c=0;c<s.length;c++){let u=s[c],l=t.element._zod.run({value:u,issues:[]},o);if(l instanceof Promise)i.push(l.then((d)=>ef(d,n,c)));else if(ef(l,n,c),a&&l.issues.length!==0&&pt(l))break}if(i.length)return Promise.all(i).then(()=>n);return n}});function Fo(e,t,r,n,o,s){let i=r in n,a=s==="optional";if(!i&&a&&o==="optional")return;if(e.issues.length){if(o!==void 0&&a&&!i)return;t.issues.push(...Ct(r,e.issues))}if(!i&&o===void 0){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}if(e.value===void 0){if(i||o==="defaulted"&&!a)t.value[r]=void 0}else t.value[r]=e.value}var f0=[];function vf(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:f0,o=n.length?[...t,...n]:t;for(let i of o)if(!e.shape?.[i]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(i)}": expected a Zod schema`);let s=jd(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(s)}}function xf(e,t,r,n,o,s,i){let a=[],c=o.keySet,u=o.catchall._zod,l=u.def.type,{optin:d,optout:f}=u,p=0;for(let m in t){if(i&&r.issues.length!==p){if(pt(r,p))break;p=r.issues.length}if(c.has(m))continue;if(m==="__proto__"){if(l==="never")a.push(m);continue}if(l==="never"){a.push(m);continue}let h=u.run({value:t[m],issues:[]},n);if(h instanceof Promise)e.push(h.then((_)=>Fo(_,r,m,t,d,f)));else Fo(h,r,m,t,d,f)}if(a.length)r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:s,continue:!0});if(!e.length)return r;return Promise.all(e).then(()=>r)}var ka=y("$ZodObject",(e,t)=>{ee.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),n=r?.get?r.get.raw:t.shape??{};if(n){let u=()=>{let l={...n};return Object.defineProperty(t,"shape",{value:l}),u.raw=l,l};u.raw=n,Object.defineProperty(t,"shape",{get:u})}let o=pn(()=>vf(t));Y(e,"propValues",(u)=>{let l=u.def.shape,d={};for(let f in l){let p=l[f]._zod;if(p.values){if(!Object.prototype.hasOwnProperty.call(d,f))Le(d,f,new Set);for(let m of p.values)d[f].add(m);if(p.optin!==void 0)d[f].add(void 0)}}return d});let s=br,i=t.catchall,a,c=Ce.memoizer;c?.attach(e),e._zod.parse=(u,l)=>{a??(a=o.value);let d=u.value;if(!s(d))return u.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),u;u.value=c?c.alloc(e,u,{},l):{};let f=[],p=a.shape,m=l?.abortEarly,h=u.issues.length;for(let _ of a.allKeys){if(m&&u.issues.length!==h){if(pt(u,h))break;h=u.issues.length}if(_==="__proto__")continue;let v=p[_],z=v._zod.optin,A=v._zod.optout,K=v._zod.run({value:d[_],issues:[]},l);if(K instanceof Promise)f.push(K.then((E)=>Fo(E,u,_,d,z,A)));else Fo(K,u,_,d,z,A)}if(!i)return f.length?Promise.all(f).then(()=>u):u;return xf(f,d,u,l,o.value,e,m===!0)}}),bf=y("$ZodObjectJIT",(e,t)=>{ka.init(e,t);let r=e._zod.parse,n=pn(()=>vf(t)),o=Ce.memoizer,s=(p)=>{let m=n.value,h=m.symbolKeys,_=new Gi(["payload","ctx"],{shape:p,inst:e,memo:o,syms:h}),v=(E)=>`shape[${E}]._zod.run({ value: input[${E}], issues: [] }, ctx)`,z=(E,V)=>`
16
+ };`)(...Object.values(this.closed))}}var Yp={major:4,minor:6,patch:5};var ee=y("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Yp;let n=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...n??[]]:n?.length?[...n]:[];for(let s of o)for(let i of s._zod.onattach)i(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let s=(a,c,u)=>{if(a.memo)return a;let l=pt(a),d;for(let f of c){if(f._zod.def.when){if(Vd(a))continue;if(!f._zod.def.when(a))continue}else if(l)continue;let p=a.issues.length,m=f._zod.check(a);if(m instanceof Promise&&u?.async===!1)throw new mt;if(d||m instanceof Promise)d=(d??Promise.resolve()).then(async()=>{if(await m,a.issues.length===p)return;if(ji(a.issues,p,e),!l)l=pt(a,p)});else{if(a.issues.length===p)continue;if(ji(a.issues,p,e),!l)l=pt(a,p)}}if(d)return d.then(()=>a);return a},i=(a,c,u)=>{if(pt(a))return a.aborted=!0,a;let l=s(c,o,u);if(l instanceof Promise){if(u.async===!1)throw new mt;return l.then((d)=>e._zod.parse(d,u))}return e._zod.parse(l,u)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){let l=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});if(l instanceof Promise)return l.then((d)=>i(d,a,c));return i(l,a,c)}let u=e._zod.parse(a,c);if(u instanceof Promise){if(c.async===!1)throw new mt;return u.then((l)=>s(l,o,c))}return s(u,o,c)}}},{get "~standard"(){return No(this,"~standard",Xi(this))},set "~standard"(e){Qe(this,"~standard",e)}}),lf=(e,t)=>e.issues.length?{issues:e.issues.map((r)=>ft(r,t,Ve()))}:{value:e.value};async function n0(e,t){let r={async:!0};return lf(await e._zod.run({value:t,issues:[]},r),r)}function Xi(e){return{validate:(t)=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return lf(n,r)}catch(n){}return n0(e,t)},vendor:"zod",version:1}}var kn=y("$ZodString",(e,t)=>{ee.init(e,t),e._zod.pattern=t.pattern??Ap,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(o){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),ne=y("$ZodStringFormat",(e,t)=>{wn.init(e,t),kn.init(e,t)}),Yi=y("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=vp),ne.init(e,t)}),Qi=y("$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 Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Vi(n))}else t.pattern??(t.pattern=Vi());ne.init(e,t)}),ea=y("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=xp),ne.init(e,t)}),df=1,Lo=2;function pf(e){try{if(typeof URL<"u"&&typeof URL.canParse==="function")return URL.canParse(e);return new URL(e),!0}catch{return!1}}function o0(e,t){if(!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t))return pf(e)||Lo;return s0(e,t)}function s0(e,t){if(!t.normalize&&t.protocol?.source===Tp.source&&!/^https?:\/\//i.test(e))return df;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse==="function")return r.parse(e)??Lo}return new URL(e)}catch{return Lo}}var i0=/[\t\n\r]/g;function Qp(e){return e.replace(i0,"")}function a0(e,t){return t.lastIndex=0,t.test(e.hostname)}function c0(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var ta=y("$ZodURL",(e,t)=>{ne.init(e,t),e._zod.check=(r)=>{try{let n=r.value.trim(),o=o0(n,t);if(o===df){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===Lo){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(o===!0){r.value=Qp(n);return}if(t.hostname&&!a0(o,t.hostname))r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort});if(t.protocol&&!c0(o,t.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort});r.value=t.normalize?o.href:Qp(n);return}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),ra=y("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=bp()),ne.init(e,t)}),na=y("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?gp:_p(t.length)),ne.init(e,t)}),oa=y("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=dp),ne.init(e,t)}),sa=y("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=pp),ne.init(e,t)}),ia=y("$ZodULID",(e,t)=>{t.pattern??(t.pattern=fp),ne.init(e,t)}),aa=y("$ZodXID",(e,t)=>{t.pattern??(t.pattern=mp),ne.init(e,t)}),ca=y("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=hp),ne.init(e,t)}),ff=y("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Cp(t)),ne.init(e,t)}),mf=y("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Rp),ne.init(e,t)}),hf=y("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Ip(t)),ne.init(e,t)}),gf=y("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=yp),ne.init(e,t)}),ua=y("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=$p),ne.init(e,t)}),u0=/^[0-9a-fA-F:.]+$/;function _f(e){if(!u0.test(e))return!1;return pf(`http://[${e}]`)}var la=y("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=wp),ne.init(e,t),e._zod.check=(r)=>{if(!_f(r.value))r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var da=y("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=kp),ne.init(e,t)});function l0(e){let t=e.split("/");if(t.length!==2)return!1;let[r,n]=t;if(!n)return!1;let o=Number(n);if(`${o}`!==n)return!1;if(o<0||o>128)return!1;return _f(r)}var pa=y("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Sp),ne.init(e,t),e._zod.check=(r)=>{if(!l0(r.value))r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function yf(e){if(e==="")return!0;if(/\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var fa=/^[0-9a-zA-Z+/]*={0,2}$/,ma=y("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=fa),ne.init(e,t),e._zod.check=(r)=>{if(yf(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),Uo=/^[A-Za-z0-9_-]*$/;function d0(e){if(!Uo.test(e))return!1;let t=e.replace(/[-_]/g,(n)=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return yf(r)}var ha=y("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Uo),ne.init(e,t),e._zod.check=(r)=>{if(d0(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),ga=y("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Ep),ne.init(e,t)});function p0(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));if("typ"in o&&o?.typ!=="JWT")return!1;if(!o.alg)return!1;if(t&&(!("alg"in o)||o.alg!==t))return!1;return!0}catch{return!1}}var _a=y("$ZodJWT",(e,t)=>{ne.init(e,t),e._zod.check=(r)=>{if(p0(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var Vo=y("$ZodNumber",(e,t)=>{ee.init(e,t),e._zod.pattern=$n,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch(i){}let o=r.value;if(typeof o==="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let s=typeof o==="number"?Number.isNaN(o)?"NaN":!Number.isFinite(o)?String(o):void 0:void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),r}}),ya=y("$ZodNumberFormat",(e,t)=>{qp.init(e,t),Vo.init(e,t)}),va=y("$ZodBoolean",(e,t)=>{ee.init(e,t),e._zod.pattern=Np,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(s){}let o=r.value;if(typeof o==="boolean")return r;return r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}});var xa=y("$ZodNull",(e,t)=>{ee.init(e,t),e._zod.pattern=jp,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let o=r.value;if(o===null)return r;return r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),r}});var ba=y("$ZodUnknown",(e,t)=>{ee.init(e,t),e._zod.parse=(r)=>r}),$a=y("$ZodNever",(e,t)=>{ee.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function ef(e,t,r){if(e.issues.length)t.issues.push(...Ct(r,e.issues));t.value[r]=e.value}var wa=y("$ZodArray",(e,t)=>{ee.init(e,t);let r=Ce.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let s=n.value;if(!Array.isArray(s))return n.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),n;n.value=r?r.alloc(e,n,Array(s.length),o):Array(s.length);let i=[],a=o?.abortEarly;for(let c=0;c<s.length;c++){let u=s[c],l=t.element._zod.run({value:u,issues:[]},o);if(l instanceof Promise)i.push(l.then((d)=>ef(d,n,c)));else if(ef(l,n,c),a&&l.issues.length!==0&&pt(l))break}if(i.length)return Promise.all(i).then(()=>n);return n}});function Fo(e,t,r,n,o,s){let i=r in n,a=s==="optional";if(!i&&a&&o==="optional")return;if(e.issues.length){if(o!==void 0&&a&&!i)return;t.issues.push(...Ct(r,e.issues))}if(!i&&o===void 0){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}if(e.value===void 0){if(i||o==="defaulted"&&!a)t.value[r]=void 0}else t.value[r]=e.value}var f0=[];function vf(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:f0,o=n.length?[...t,...n]:t;for(let i of o)if(!e.shape?.[i]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(i)}": expected a Zod schema`);let s=jd(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(s)}}function xf(e,t,r,n,o,s,i){let a=[],c=o.keySet,u=o.catchall._zod,l=u.def.type,{optin:d,optout:f}=u,p=0;for(let m in t){if(i&&r.issues.length!==p){if(pt(r,p))break;p=r.issues.length}if(c.has(m))continue;if(m==="__proto__"){if(l==="never")a.push(m);continue}if(l==="never"){a.push(m);continue}let h=u.run({value:t[m],issues:[]},n);if(h instanceof Promise)e.push(h.then((_)=>Fo(_,r,m,t,d,f)));else Fo(h,r,m,t,d,f)}if(a.length)r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:s,continue:!0});if(!e.length)return r;return Promise.all(e).then(()=>r)}var ka=y("$ZodObject",(e,t)=>{ee.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),n=r?.get?r.get.raw:t.shape??{};if(n){let u=()=>{let l={...n};return Object.defineProperty(t,"shape",{value:l}),u.raw=l,l};u.raw=n,Object.defineProperty(t,"shape",{get:u})}let o=pn(()=>vf(t));Y(e,"propValues",(u)=>{let l=u.def.shape,d={};for(let f in l){let p=l[f]._zod;if(p.values){if(!Object.prototype.hasOwnProperty.call(d,f))Le(d,f,new Set);for(let m of p.values)d[f].add(m);if(p.optin!==void 0)d[f].add(void 0)}}return d});let s=br,i=t.catchall,a,c=Ce.memoizer;c?.attach(e),e._zod.parse=(u,l)=>{a??(a=o.value);let d=u.value;if(!s(d))return u.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),u;u.value=c?c.alloc(e,u,{},l):{};let f=[],p=a.shape,m=l?.abortEarly,h=u.issues.length;for(let _ of a.allKeys){if(m&&u.issues.length!==h){if(pt(u,h))break;h=u.issues.length}if(_==="__proto__")continue;let v=p[_],z=v._zod.optin,A=v._zod.optout,G=v._zod.run({value:d[_],issues:[]},l);if(G instanceof Promise)f.push(G.then((E)=>Fo(E,u,_,d,z,A)));else Fo(G,u,_,d,z,A)}if(!i)return f.length?Promise.all(f).then(()=>u):u;return xf(f,d,u,l,o.value,e,m===!0)}}),bf=y("$ZodObjectJIT",(e,t)=>{ka.init(e,t);let r=e._zod.parse,n=pn(()=>vf(t)),o=Ce.memoizer,s=(p)=>{let m=n.value,h=m.symbolKeys,_=new Gi(["payload","ctx"],{shape:p,inst:e,memo:o,syms:h}),v=(E)=>`shape[${E}]._zod.run({ value: input[${E}], issues: [] }, ctx)`,z=(E,V)=>`
17
17
  let ${E}_ab = false;
18
18
  for (let i = 0; i < ${E}.issues.length; i++) {
19
19
  const iss = ${E}.issues[i];
@@ -24,7 +24,7 @@ ${t.join(`
24
24
  if (${E}_ab && ctx && ctx.abortEarly) {
25
25
  payload.value = newResult;
26
26
  return payload;
27
- }`;_.write("const input = payload.value;");let A=Object.create(null),K=0;for(let E of m.allKeys)A[E]=`key_${K++}`;_.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let E of m.allKeys){if(E==="__proto__")continue;let V=A[E],me=typeof E==="symbol"?`syms[${h.indexOf(E)}]`:Id(E),Jt=`${me} in input`,fr=p[E],yt=fr?._zod?.optin,mr=yt!==void 0,yo=fr?._zod?.optout==="optional";if(_.write(`const ${V} = ${v(me)};`),mr&&yo){let vo=yt==="optional"?`${V}_present`:`${V}.value !== undefined || ${V}_present`;_.write(`
27
+ }`;_.write("const input = payload.value;");let A=Object.create(null),G=0;for(let E of m.allKeys)A[E]=`key_${G++}`;_.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let E of m.allKeys){if(E==="__proto__")continue;let V=A[E],me=typeof E==="symbol"?`syms[${h.indexOf(E)}]`:Id(E),Jt=`${me} in input`,fr=p[E],yt=fr?._zod?.optin,mr=yt!==void 0,yo=fr?._zod?.optout==="optional";if(_.write(`const ${V} = ${v(me)};`),mr&&yo){let vo=yt==="optional"?`${V}_present`:`${V}.value !== undefined || ${V}_present`;_.write(`
28
28
  const ${V}_present = ${Jt};
29
29
  if (!${V}.issues.length || ${V}_present) {
30
30
  if (${V}.issues.length) {${z(V,me)}
@@ -66,13 +66,13 @@ ${t.join(`
66
66
  `)}return _.write("payload.value = newResult;"),_.write("return payload;"),_.compile()},i,a=br,c=!Ce.jitless,l=c&&Ad.value,d=t.catchall,f;e._zod.parse=(p,m)=>{f??(f=n.value);let h=p.value;if(!a(h))return p.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),p;if(c&&l&&m?.async===!1&&m.jitless!==!0){if(!i)i=s(t.shape);if(p=i(p,m),!d)return p;return xf([],h,p,m,f,e,m?.abortEarly===!0)}return r(p,m)}});function tf(e,t,r,n){for(let s of e)if(s.issues.length===0)return t.value=s.value,t;let o=e.filter((s)=>!pt(s));if(o.length===1)return t.value=o[0].value,o[0];return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((s)=>s.issues.map((i)=>ft(i,n,Ve())))}),t}var Ho=y("$ZodUnion",(e,t)=>{ee.init(e,t),Y(e,"optin",(n)=>n.def.options.some((o)=>o._zod.optin==="defaulted")?"defaulted":n.def.options.some((o)=>o._zod.optin!==void 0)?"optional":void 0),Y(e,"optout",(n)=>n.def.options.some((o)=>o._zod.optout==="optional")?"optional":void 0),Y(e,"values",(n)=>{if(n.def.options.every((o)=>o._zod.values))return new Set(n.def.options.flatMap((o)=>Array.from(o._zod.values)));return}),Y(e,"pattern",(n)=>{if(n.def.options.every((o)=>o._zod.pattern)){let o=n.def.options.map((s)=>s._zod.pattern);return new RegExp(`^(${o.map((s)=>Eo(s.source)).join("|")})$`)}return});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let s=!1,i=[];for(let a of t.options){let c=a._zod.run({value:n.value,issues:[]},o);if(c instanceof Promise)i.push(c),s=!0;else{if(c.issues.length===0)return c;i.push(c)}}if(!s)return tf(i,n,e,o);return Promise.all(i).then((a)=>tf(a,n,e,o))}});function m0(e){let t=new Map;for(let r of e.options){let n=r._zod.propValues?.[e.discriminator];if(!n||n.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(r)}"`);for(let o of n)if(t.has(o)){if(o!==void 0)throw Error(`Duplicate discriminator value "${String(o)}"`);t.set(o,null)}else t.set(o,r)}return t}var Sa=y("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Ho.init(e,t);let r=e._zod.parse;Y(e,"propValues",(o)=>{let s={},i=0;for(let a of o.def.options){let c=a._zod.propValues;if(!c||Object.keys(c).length===0)throw Error(`Invalid discriminated union option at index "${o.def.options.indexOf(a)}"`);if(c[o.def.discriminator]?.has(void 0))i++;for(let[u,l]of Object.entries(c)){if(!Object.prototype.hasOwnProperty.call(s,u))Le(s,u,new Set);for(let d of l)s[u].add(d)}}if(!o.def.unionFallback&&i>1)s[o.def.discriminator]?.delete(void 0);return s}),t.options.forEach((o,s)=>{let i=fn(o._zod.def);if(i&&!Object.prototype.hasOwnProperty.call(i,t.discriminator))throw Error(`Invalid discriminated union option at index "${s}"`)});let n=pn(()=>m0(t));e._zod.parse=(o,s)=>{let i=o.value;if(!br(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),o;let a=i?.[t.discriminator],c=n.value.get(a);if(c&&(a!==void 0||s.direction!=="backward"))return c._zod.run(o,s);if(t.unionFallback||s.direction==="backward")return r(o,s);return o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(n.value.keys()).filter((u)=>n.value.get(u)!==null),input:i,path:[t.discriminator],inst:e}),o}}),za=y("$ZodIntersection",(e,t)=>{ee.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,s=t.left._zod.run({value:o,issues:[]},n),i=t.right._zod.run({value:o,issues:[]},n);if(s instanceof Promise||i instanceof Promise)return Promise.all([s,i]).then(([c,u])=>rf(r,c,u));return rf(r,s,i)}});function Wi(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(Qt(e)&&Qt(t)){let r=Object.keys(t),n=Object.keys(e).filter((s)=>r.indexOf(s)!==-1),o={...e,...t};if(Object.prototype.hasOwnProperty.call(o,"__proto__"))delete o.__proto__;for(let s of n){if(s==="__proto__")continue;let i=Wi(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.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],s=t[n],i=Wi(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function rf(e,t,r){let n=new Map,o,s=new Map,i=(u,l)=>{let d;if(u.code==="unrecognized_keys"&&!u.path?.length)o??(o=u),d=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&u.path?.length===1){let f=String(u.path[0]);if(!s.has(f))s.set(f,u);d=[f]}else return!1;for(let f of d){if(!n.has(f))n.set(f,{});n.get(f)[l]=!0}return!0};for(let u of t.issues)if(!i(u,"l"))e.issues.push(u);for(let u of r.issues)if(!i(u,"r"))e.issues.push(u);let a=[...n].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(a.length){let u=o?a.filter((l)=>o.keys.includes(l)):[];if(u.length)e.issues.push({...o,keys:u});for(let l of a)if(!u.includes(l)&&s.has(l))e.issues.push(s.get(l))}let c=Wi(t.value,r.value);if(!c.valid){if(pt(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var Pa=y("$ZodRecord",(e,t)=>{ee.init(e,t);let r=Ce.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let s=n.value;if(!Qt(s))return n.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),n;let i=[],a=t.keyType._zod.values;if(a&&!t.partial){n.value=r?r.alloc(e,n,{},o):{};let c=new Set;for(let l of a)if(typeof l==="string"||typeof l==="number"||typeof l==="symbol"){if(c.add(typeof l==="number"?l.toString():l),l==="__proto__")continue;let d=t.keyType._zod.run({value:l,issues:[]},o);if(d instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(d.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map((m)=>ft(m,o,Ve())),input:l,path:[l],inst:e});continue}let f=d.value;if(f==="__proto__")continue;let p=t.valueType._zod.run({value:s[l],issues:[]},o);if(p instanceof Promise)i.push(p.then((m)=>{if(m.issues.length)n.issues.push(...Ct(l,m.issues));n.value[f]=m.value}));else{if(p.issues.length)n.issues.push(...Ct(l,p.issues));n.value[f]=p.value}}let u;for(let l in s)if(!c.has(l))if(t.mode==="loose"){if(l==="__proto__")continue;n.value[l]=s[l]}else u=u??[],u.push(l);if(u&&u.length>0)n.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:u,continue:!0})}else{n.value=r?r.alloc(e,n,{},o):{};let c;for(let u of Reflect.ownKeys(s)){if(u==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(s,u))continue;let l=t.keyType._zod.run({value:u,issues:[]},o);if(l instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof u==="string"&&$n.test(u)&&l.issues.length){let m=t.keyType._zod.run({value:Number(u),issues:[]},o);if(m instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(m.issues.length===0)l=m}if(l.issues.length){if(t.mode==="loose")n.value[u]=s[u];else if(a)c=c??[],c.push(u);else n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map((m)=>ft(m,o,Ve())),input:u,path:[u],inst:e});continue}let f=l.value;if(f==="__proto__")continue;let p=t.valueType._zod.run({value:s[u],issues:[]},o);if(p instanceof Promise)i.push(p.then((m)=>{if(m.issues.length)n.issues.push(...Ct(u,m.issues));n.value[f]=m.value}));else{if(p.issues.length)n.issues.push(...Ct(u,p.issues));n.value[f]=p.value}}if(c&&c.length>0)n.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:c,continue:!0})}if(i.length)return Promise.all(i).then(()=>n);return n}});var Ta=y("$ZodEnum",(e,t)=>{ee.init(e,t);let r=ln(t.entries),n=new Set(r);e._zod.values=n,Y(e,"pattern",(o)=>{let s=ln(o.def.entries).filter((i)=>Nd.has(typeof i));return new RegExp(s.length?`^(${s.map((i)=>It(i.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,s)=>{let i=o.value;if(n.has(i))return o;return o.issues.push({code:"invalid_value",values:r,input:i,inst:e}),o}}),Ea=y("$ZodLiteral",(e,t)=>{ee.init(e,t);let r=new Set(t.values);e._zod.values=r,Y(e,"pattern",(n)=>{let o=n.def.values;return new RegExp(o.length?`^(${o.map((s)=>typeof s==="string"?It(s):s?It(s.toString()):String(s)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(n,o)=>{let s=n.value;if(r.has(s))return n;return n.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),n}});var Oa=y("$ZodTransform",(e,t)=>{ee.init(e,t),e._zod.optin="optional",Ce.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new mn(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then((i)=>(r.value=i,r));if(o instanceof Promise)throw new mt;return r.value=o,r}});function nf(e,t){return e.value=t.issues.length?void 0:t.value,e}var Bo=y("$ZodOptional",(e,t)=>{ee.init(e,t),Y(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",Y(e,"values",(r)=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),Y(e,"pattern",(r)=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Eo(n.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let o=t.innerType._zod.run({value:r.value,issues:[]},n);if(o instanceof Promise)return o.then((s)=>nf(r,s));return nf(r,o)}return t.innerType._zod.run(r,n)}}),Ra=y("$ZodExactOptional",(e,t)=>{Bo.init(e,t),Y(e,"values",(r)=>r.def.innerType._zod.values),Y(e,"pattern",(r)=>r.def.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),Ia=y("$ZodNullable",(e,t)=>{ee.init(e,t),Y(e,"optin",(r)=>r.def.innerType._zod.optin),Y(e,"optout",(r)=>r.def.innerType._zod.optout),Y(e,"pattern",(r)=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Eo(n.source)}|null)$`):void 0}),Y(e,"values",(r)=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>{if(r.value===null)return r;return t.innerType._zod.run(r,n)}}),Ca=y("$ZodDefault",(e,t)=>{ee.init(e,t),e._zod.optin="defaulted",Y(e,"values",(r)=>r.def.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);if(o instanceof Promise)return o.then((s)=>of(s,t));return of(o,t)}});function of(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var Aa=y("$ZodPrefault",(e,t)=>{ee.init(e,t),e._zod.optin="defaulted",Y(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)r.value=t.defaultValue;return t.innerType._zod.run(r,n)}}),Na=y("$ZodNonOptional",(e,t)=>{ee.init(e,t),Y(e,"values",(r)=>{let n=r.def.innerType._zod.values;return n?new Set([...n].filter((o)=>o!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((s)=>sf(s,e));return sf(o,e)}});function sf(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}function af(e,t,r,n){if(!t.issues.length){if(e.value=t.value,t.memo)e.memo=!0;return e}return e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map((o)=>ft(o,n,Ve()))},input:e.value}),e}var ja=y("$ZodCatch",(e,t)=>{ee.init(e,t),Y(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),Y(e,"optout",(r)=>r.def.innerType._zod.optout),Y(e,"values",(r)=>r.def.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({value:r.value,issues:[]},n);if(o instanceof Promise)return o.then((s)=>af(r,s,t,n));return af(r,o,t,n)}});var Jo=y("$ZodPipe",(e,t)=>{ee.init(e,t),Y(e,"values",(r)=>r.def.in._zod.values),Y(e,"optin",(r)=>r.def.in._zod.optin),Y(e,"optout",(r)=>r.def.out._zod.optout),Y(e,"propValues",(r)=>r.def.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let s=t.out._zod.run(r,n);if(s instanceof Promise)return s.then((i)=>qo(i,t.in,n));return qo(s,t.in,n)}let o=t.in._zod.run(r,n);if(o instanceof Promise)return o.then((s)=>qo(s,t.out,n));return qo(o,t.out,n)}});function qo(e,t,r){if(e.issues.some((n)=>n.code!=="unrecognized_keys"))return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues},r)}var $f=y("$ZodPreprocess",(e,t)=>{Jo.init(e,t)}),Za=y("$ZodReadonly",(e,t)=>{ee.init(e,t),Y(e,"propValues",(r)=>r.def.innerType._zod.propValues),Y(e,"values",(r)=>r.def.innerType._zod.values),Y(e,"optin",(r)=>r.def.innerType?._zod?.optin),Y(e,"optout",(r)=>r.def.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);if(o instanceof Promise)return o.then(cf);return cf(o)}});function cf(e){if(!e.memo)e.value=Object.freeze(e.value);return e}var Ma=y("$ZodCustom",(e,t)=>{_e.init(e,t),ee.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((s)=>uf(s,r,n,e));uf(o,r,n,e);return}});function uf(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};if(n._zod.def.params)o.params=n._zod.def.params;t.issues.push(er(o))}}class kf extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var qa="~memo",wf=[];function Sf(e){return e!==null&&typeof e==="object"}function Da(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}var zf=new WeakMap,Sn=0,Wo=1,zn=2;function Xo(e,t,r){let n=zf.get(e);if(n!==void 0)return n?zn:Sn;if(t.has(e))return zn;t.add(e);let o=Sn,s=(l)=>{if(o!==zn&&l?._zod){let d=Xo(l,t,r);if(d>o)o=d}},i=(l,d)=>{let f=Sn;for(let p of Reflect.ownKeys(l)){let m=Object.getOwnPropertyDescriptor(l,p);if(d&&!m.enumerable)continue;let h=m.get?Wo:m.value?._zod?Xo(m.value,t,r):Sn;if(h>f)f=h}return f},a=(l)=>{if(l>o)o=l},c=e._zod.def,u=c.type;switch(u){case"object":{let l=fn(c);a(l?i(l,!0):Wo),s(c.catchall);break}case"array":s(c.element);break;case"tuple":for(let l of c.items)s(l);s(c.rest);break;case"record":case"map":s(c.keyType),s(c.valueType);break;case"set":s(c.valueType);break;case"union":for(let l of c.options)s(l);break;case"intersection":s(c.left),s(c.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":s(c.innerType);break;case"pipe":s(c.in),s(c.out);break;case"function":s(c.input),s(c.output);break;case"lazy":{let l=c._cachedInner??(r?e._zod.innerType:void 0);a(l?Xo(l,t,!1):Wo);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let l in c){let d=Object.getOwnPropertyDescriptor(c,l);if(!d||d.get)continue;let f=d.value;if(!f||typeof f!=="object")continue;if(f._zod)s(f);else if(Array.isArray(f))for(let p of f)s(p)}}return t.delete(e),h0(e,o)}function h0(e,t){if(t!==Wo)zf.set(e,t===zn);return t}function g0(e,t){let r=e.buckets.get(t);if(!r)r=new WeakMap,e.buckets.set(t,r);return r}var Ko,Go=[],_0={alloc(e,t,r){let n=Ko;if(!n)return r;Ko=void 0;let o={value:r,issues:null};return n.set(t.value,o),Go.push(o),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,n=(o,s)=>{if(s.direction!=="backward"&&y0(s,o.value))throw new kf;return r(o,s)};if(e._zod.parse=n,e._zod.run===r)e._zod.run=n})},attach(e){var t;let r,n=!1,o,s;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let i=e._zod.parse,a=(c,u)=>{if(r===void 0){let v=Xo(e,new Set,!1);if(v===Sn){if(e._zod.parse=i,e._zod.run===a)e._zod.run=i;return i(c,u)}if(v===zn||n)r=!0;else n=!0}let l=c.value;if(!Sf(l))return i(c,u);let d=u[qa];if(!d)d={buckets:new WeakMap,backEdges:void 0},u[qa]=d;let f;if(o===u)f=s;else f=g0(d,e),o=u,s=f;let p=f.get(l);if(p){if(c.value=p.value,p.issues){if(p.issues.length)c.issues.push(...Da(p.issues))}else c.memo=!0,d.backEdges??(d.backEdges=new WeakSet),d.backEdges.add(p.value);return c}Ko=f;let m=Go.length,h=i(c,u);Ko=void 0;let _=Go.length>m?Go.pop():void 0;if(h instanceof Promise)return h.then((v)=>{if(_)_.issues=v.issues.length?Da(v.issues):wf;return v});if(_)_.issues=h.issues.length?Da(h.issues):wf;return h};if(e._zod.parse=a,e._zod.run===i)e._zod.run=a})}};function Pf(){return _0}function y0(e,t){let r=e[qa]?.backEdges;return r!==void 0&&Sf(t)&&r.has(t)}var v0=()=>{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(s){return e[s]??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",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};function o(s,i){if(s==="number"&&typeof i==="number"&&!Number.isFinite(i))return String(i);return n[s]??s}return(s)=>{switch(s.code){case"invalid_type":{let i=o(s.expected),a=Hd(s.input),c=o(a,s.input);return`Invalid input: expected ${i}, received ${c}`}case"invalid_value":if(s.values.length===1)return`Invalid input: expected ${Ci(s.values[0])}`;return`Invalid option: expected one of ${Ri(s.values,"|")}`;case"too_big":{let i=s.exact?"exactly ":s.inclusive?"<=":"<",a=t(s.origin);if(a)return`Too big: expected ${s.origin??"value"} to have ${i}${s.maximum.toString()} ${a.unit??"elements"}`;return`Too big: expected ${s.origin??"value"} to be ${i}${s.maximum.toString()}`}case"too_small":{let i=s.exact?"exactly ":s.inclusive?">=":">",a=t(s.origin);if(a)return`Too small: expected ${s.origin} to have ${i}${s.minimum.toString()} ${a.unit}`;return`Too small: expected ${s.origin} to be ${i}${s.minimum.toString()}`}case"invalid_format":{let i=s;if(i.format==="starts_with")return`Invalid string: must start with "${i.prefix}"`;if(i.format==="ends_with")return`Invalid string: must end with "${i.suffix}"`;if(i.format==="includes")return`Invalid string: must include "${i.includes}"`;if(i.format==="regex")return`Invalid string: must match pattern ${i.pattern}`;return`Invalid ${r[i.format]??s.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${s.divisor}`;case"unrecognized_keys":return`Unrecognized key${s.keys.length>1?"s":""}: ${Ri(s.keys,", ")}`;case"invalid_key":return`Invalid key in ${s.origin}`;case"invalid_union":if(s.options&&Array.isArray(s.options)&&s.options.length>0)return`Invalid discriminator value. Expected ${s.options.map((a)=>`'${a}'`).join(" | ")}`;if(s.inclusive===!1)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${s.origin}`;default:return"Invalid input"}}};function La(){return{localeError:v0()}}var Tf;class Ef{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&typeof r==="object"&&"id"in r)this._idmap.set(r.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let n={...r,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function x0(){return new Ef}(Tf=globalThis).__zod_globalRegistry??(Tf.__zod_globalRegistry=x0());var tr=globalThis.__zod_globalRegistry;function Of(e){if(e.checks)e.checks=[...e.checks];return e}function Fa(e,t){return new e(Of({type:"string",...T(t)}))}function Ua(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...T(t)})}function Va(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...T(t)})}function Ha(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...T(t)})}function Ba(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...T(t)})}function Ja(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...T(t)})}function Ka(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...T(t)})}function Ga(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...T(t)})}function Wa(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...T(t)})}function Xa(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...T(t)})}function Ya(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...T(t)})}function Qa(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...T(t)})}function ec(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...T(t)})}function tc(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...T(t)})}function rc(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...T(t)})}function nc(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...T(t)})}function oc(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...T(t)})}function sc(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...T(t)})}function ic(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...T(t)})}function ac(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...T(t)})}function cc(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...T(t)})}function uc(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...T(t)})}function lc(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...T(t)})}function Yo(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...T(t)})}function dc(e,t){return new e({type:"string",format:"date",check:"string_format",...T(t)})}function pc(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...T(t)})}function fc(e,t){return new e({type:"string",format:"duration",check:"string_format",...T(t)})}function mc(e,t){return new e(Of({type:"number",checks:[],...T(t)}))}function hc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...T(t)})}function gc(e,t){return new e({type:"boolean",...T(t)})}function _c(e,t){return new e({type:"null",...T(t)})}function yc(e){return new e({type:"unknown"})}function vc(e,t){return new e({type:"never",...T(t)})}function Qo(e,t){return new Ji({check:"less_than",...T(t),value:e,inclusive:!1})}function Pn(e,t){return new Ji({check:"less_than",...T(t),value:e,inclusive:!0})}function es(e,t){return new Ki({check:"greater_than",...T(t),value:e,inclusive:!1})}function Tn(e,t){return new Ki({check:"greater_than",...T(t),value:e,inclusive:!0})}function ts(e,t){return new Dp({check:"multiple_of",...T(t),value:e})}function rs(e,t){return new Lp({check:"max_length",...T(t),maximum:e})}function wr(e,t){return new Fp({check:"min_length",...T(t),minimum:e})}function ns(e,t){return new Up({check:"length_equals",...T(t),length:e})}function xc(e,t){return new Vp({check:"string_format",format:"regex",...T(t),pattern:e})}function bc(e){return new Hp({check:"string_format",format:"lowercase",...T(e)})}function $c(e){return new Bp({check:"string_format",format:"uppercase",...T(e)})}function wc(e,t){return new Jp({check:"string_format",format:"includes",...T(t),includes:e})}function kc(e,t){return new Kp({check:"string_format",format:"starts_with",...T(t),prefix:e})}function Sc(e,t){return new Gp({check:"string_format",format:"ends_with",...T(t),suffix:e})}function At(e){return new Wp({check:"overwrite",tx:e})}function zc(e){return At((t)=>t.normalize(e))}function Pc(){return At((e)=>e.trim())}function Tc(){return At((e)=>e.toLowerCase())}function Ec(){return At((e)=>e.toUpperCase())}function Oc(){return At((e)=>Cd(e))}function Rf(e,t,r){return new e({type:"array",element:t,...T(r)})}function Rc(e,t,r){let n=T(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function Ic(e,t,r){return new e({type:"custom",check:"custom",fn:t,...T(r)})}function Cc(e,t){let r=b0((n)=>(n.addIssue=(o)=>{if(typeof o==="string")n.issues.push(er(o,n.value,r._zod.def));else{let s=o;if(s.fatal)s.continue=!1;if(s.code??(s.code="custom"),!("input"in s))s.input=n.value;s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),n.issues.push(er(s))}},e(n.value,n)),t);return r}function b0(e,t){let r=new _e({check:"custom",...T(t)});return r._zod.check=e,r}function En(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))if(Object.prototype.propertyIsEnumerable.call(r,n))Le(e,n,r[n]);return e}function Rn(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??tr,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function ye(e,t,r,n,o){let s=typeof t.unrepresentable==="function"?t.unrepresentable({zodSchema:e,path:n.path,message:o}):t.unrepresentable;if(s==="any")return!1;if(s===void 0||s==="throw")throw Error(o);return Object.assign(r,s),!0}function te(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,s=t.seen.get(e);if(s){if(s.count++,r.schemaPath.includes(e))s.cycle=r.path;return s.schema}let i={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,i),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,l);else{let f=i.schema,p=t.processors[o.type];if(!p)throw Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);p(e,t,f,l)}let d=e._zod.parent;if(d){if(!i.ref)i.ref=d;te(d,t,l),t.seen.get(d).isParent=!0}}let c=t.metadataRegistry.get(e);if(c)En(i.schema,c);if(t.io==="input"&&ze(e))delete i.schema.examples,delete i.schema.default;if(t.io==="input"&&"_prefault"in i.schema)(n=i.schema).default??(n.default=i.schema._prefault);return delete i.schema._prefault,t.seen.get(e).schema}function If(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function In(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let n=new Map;for(let i of e.seen.entries()){let a=e.metadataRegistry.get(i[0])?.id;if(a){let c=n.get(a);if(c&&c!==i[0])throw Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(a,i[0])}}let o=(i)=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(i[0])?.id,f=e.external.uri??((m)=>m);if(d)return{ref:f(d)};let p=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=p,{defId:p,ref:`${f("__shared")}#/${a}/${If(p)}`}}let c="#",u=`${c}/${a}/`;if(i[1]===r&&!i[1].schema.id)return{ref:c};let l=i[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+If(l)}},s=(i)=>{if(i[1].schema.$ref)return;let a=i[1],{ref:c,defId:u}=o(i);if(a.def={...a.schema},u)a.defId=u;let l=a.schema;for(let d in l)delete l[d];l.$ref=c};if(e.cycles==="throw")for(let i of e.seen.entries()){let a=i[1];if(a.cycle)throw Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
67
67
 
68
68
  Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of e.seen.entries()){let a=i[1];if(t===i[0]){s(i);continue}if(e.external){let u=e.external.registry.get(i[0])?.id;if(t!==i[0]&&u){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(a.cycle){s(i);continue}if(a.count>1){if(e.reused==="ref")s(i)}}if(e.external)e.sharedDefsExtractedFor=e.external}function Nf(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let n of t){if(!n||typeof n!=="object")return;Nf(n);let o=Object.keys(n);if(o.length!==1||o[0]!=="type")return;let s=n.type;for(let i of Array.isArray(s)?s:[s]){if(typeof i!=="string")return;if(!r.includes(i))r.push(i)}}delete e.anyOf,e.type=r.length===1?r[0]:r}var jf=new Set(["type","properties","required","additionalProperties"]),Cf=["oneOf","anyOf"];function Af(e){let t=e.additionalProperties;if(t===void 0||t===!1||typeof t!=="object"||t===null)return null;return Object.keys(t).length?t:null}function Ac(e){let t=[];for(let s of e){if(typeof s!=="object"||s.type!=="object")return null;for(let i in s)if(!jf.has(i))return null;t.push(s)}let r={},n=new Set;for(let s of t){for(let i in s.properties){if(Object.prototype.hasOwnProperty.call(r,i))continue;let a=[];for(let u of t){let l=u.properties?.[i]??Af(u);if(l===null||l===void 0)continue;if(!a.some((d)=>JSON.stringify(d)===JSON.stringify(l)))a.push(l)}let c=a.length===1?a[0]:Ac(a)??{allOf:a};Le(r,i,c)}for(let i of s.required??[])n.add(i)}let o={type:"object",properties:r};if(n.size)o.required=[...n];if(t.every((s)=>s.additionalProperties===!1))o.additionalProperties=!1;else{let s=[];for(let i of t){let a=Af(i);if(a&&!s.some((c)=>JSON.stringify(c)===JSON.stringify(a)))s.push(a)}if(s.length===1)o.additionalProperties=s[0];else if(s.length>1)o.additionalProperties={allOf:s}}return o}function $0(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of jf)if(o in e)return;let r=t.filter((o)=>Cf.some((s)=>Array.isArray(o[s]))),n=null;if(!r.length)n=Ac(t);else{let o=r[0],s=Cf.find((c)=>Array.isArray(o[c]));if(Object.keys(o).length!==1)return;let i=t.filter((c)=>c!==o),a=o[s].map((c)=>Ac([...i,c]));if(a.some((c)=>!c))return;n={[s]:a}}if(!n)return;delete e.allOf,En(e,n)}function Cn(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=(a)=>{let c=e.seen.get(a);if(c.ref===null)return;let u=c.def??c.schema,l={...u},d=c.ref;if(c.ref=null,d){n(d);let p=e.seen.get(d),m=p.schema;if(m.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))u.allOf=u.allOf??[],u.allOf.push(m);else En(u,m);if(En(u,l),a._zod.parent===d)for(let _ in u){if(_==="$ref"||_==="allOf")continue;if(!(_ in l))delete u[_]}if(m.$ref&&p.def)for(let _ in u){if(_==="$ref"||_==="allOf")continue;if(_ in p.def&&JSON.stringify(u[_])===JSON.stringify(p.def[_]))delete u[_]}}let f=a._zod.parent;if(f&&f!==d){n(f);let p=e.seen.get(f);if(p?.schema.$ref){if(u.$ref=p.schema.$ref,p.def)for(let m in u){if(m==="$ref"||m==="allOf")continue;if(m in p.def&&JSON.stringify(u[m])===JSON.stringify(p.def[m]))delete u[m]}}}e.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())n(a[0]);if(e.target!=="openapi-3.0")for(let a of e.seen.entries())Nf(a[1].def??a[1].schema);for(let a of e.deferred)a();if(e.intersections.length){let a=new Map;for(let c of e.seen.values())for(let u of[c.schema,c.def]){let l=u?.allOf;if(!Array.isArray(l))continue;let d=a.get(l);if(d)d.push(u);else a.set(l,[u])}for(let c of e.intersections)for(let u of a.get(c)??[])$0(u)}}let o={};if(e.target==="draft-2020-12")o.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")o.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")o.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}En(o,r.defId?r.schema:r.def??r.schema);let s=e.metadataRegistry.get(t)?.id;if(s!==void 0&&o.id===s)delete o.id;let i=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let a of e.seen.entries()){let c=a[1];if(c.def&&c.defId){if(c.def.id===c.defId)delete c.def.id;Le(i,c.defId,c.def)}}if(e.external)e.sharedEmitDoneFor=e.external;if(e.external);else if(Object.keys(i).length>0)if(e.target==="draft-2020-12")o.$defs=i;else o.definitions=i;try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:On(t,"input",e.processors),output:On(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch(a){throw Error("Error converting schema to JSON.")}}function ze(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 ze(n.element,r);if(n.type==="set")return ze(n.valueType,r);if(n.type==="lazy")return ze(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"||n.type==="catch")return ze(n.innerType,r);if(n.type==="intersection")return ze(n.left,r)||ze(n.right,r);if(n.type==="record"||n.type==="map")return ze(n.keyType,r)||ze(n.valueType,r);if(n.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return ze(n.in,r)||ze(n.out,r)}if(n.type==="object"){for(let o in n.shape)if(ze(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(ze(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(ze(o,r))return!0;if(n.rest&&ze(n.rest,r))return!0;return!1}return!1}var Zf=(e,t={})=>(r)=>{let n=Rn({...r,processors:t});return te(e,n),In(n,e),Cn(n,e)},On=(e,t,r={})=>(n)=>{let{libraryOptions:o,target:s}=n??{},i=Rn({...o??{},target:s,io:t,processors:r});return te(e,i),In(i,e),Cn(i,e)};var kr=(e,t,r)=>{if(e[t]===void 0||r>e[t])e[t]=r},Sr=(e,t,r)=>{if(e[t]===void 0||r<e[t])e[t]=r},Mf=(e,t)=>{kr(e,"minimum",t),Sr(e,"maximum",t)},Uf=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},Vf=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},Hf=(e,t)=>{e.mime=e.mime?e.mime.filter((r)=>t.includes(r)):[...t]},Bf=(e,t)=>{if(e.format=t,t.includes("int"))e.isInt=!0},Df=(e,t)=>kr(e,"minimum",t.minimum),qf=(e,t)=>Sr(e,"maximum",t.maximum),Lf=(e)=>(t,r)=>{Bf(t,r.format);let[n,o]=e[r.format];kr(t,"minimum",n),Sr(t,"maximum",o)},w0={greater_than:(e,t)=>kr(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>Sr(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>Uf(e,t.value),number_format:Lf(Ro),bigint_format:Lf(Ai),min_length:Df,max_length:qf,length_equals:(e,t)=>Mf(e,t.length),min_size:Df,max_size:qf,size_equals:(e,t)=>Mf(e,t.size),string_format:(e,t)=>{if(Bf(e,t.format),t.pattern)Vf(e,t.pattern);if(t.format==="base64"||t.format==="base64url")e.contentEncoding=t.format;if(t.local||t.precision===-1)e.laxFormat=!0},mime_type:(e,t)=>Hf(e,t.mime)};function Ae(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let s of n)w0[s._zod.def.check]?.(t,s._zod.def);let o=e._zod.bag;if(o.minimum!==void 0)kr(t,"minimum",o.minimum);if(o.exclusiveMinimum!==void 0)kr(t,"exclusiveMinimum",o.exclusiveMinimum);if(o.maximum!==void 0)Sr(t,"maximum",o.maximum);if(o.exclusiveMaximum!==void 0)Sr(t,"exclusiveMaximum",o.exclusiveMaximum);if(o.multipleOf!==void 0)Uf(t,o.multipleOf);if(o.format!==void 0){if(t.format??(t.format=o.format),o.format.includes("int"))t.isInt=!0}if(o.mime)Hf(t,o.mime);for(let s of o.patterns??[])Vf(t,s);return t}var k0={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},S0=new Map([[fa,zp],[Uo,Pp]]),Jf=(e)=>S0.get(e)??e,Zc=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:s,maximum:i,format:a,patterns:c,contentEncoding:u,laxFormat:l}=Ae(e);if(typeof s==="number")o.minLength=s;if(typeof i==="number")o.maxLength=i;if(a){if(o.format=k0[a]??a,o.format==="")delete o.format;if(a==="time"||l)delete o.format}if(u)o.contentEncoding=u;if(c&&c.size>0){let d=[...c].map(Jf);if(d.length===1)o.pattern=d[0].source;else if(d.length>1)o.allOf=[...d.map((f)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))]}},Mc=(e,t,r,n)=>{let o=r,{minimum:s,maximum:i,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:u,isInt:l}=Ae(e);o.type=l?"integer":"number";let d=typeof u==="number"&&u>=(s??Number.NEGATIVE_INFINITY),f=typeof c==="number"&&c<=(i??Number.POSITIVE_INFINITY),p=t.target==="draft-04"||t.target==="openapi-3.0";if(d)if(p)o.minimum=u,o.exclusiveMinimum=!0;else o.exclusiveMinimum=u;else if(typeof s==="number")o.minimum=s;if(f)if(p)o.maximum=c,o.exclusiveMaximum=!0;else o.exclusiveMaximum=c;else if(typeof i==="number")o.maximum=i;if(a){let m=new Set;for(let v of a)if(Number.isFinite(v)&&v!==0)m.add(Math.abs(v));else ye(e,t,o,n,`A multipleOf divisor of ${v} cannot be represented in JSON Schema`);let[h,..._]=m;if(h!==void 0)o.multipleOf=h;if(_.length)o.allOf=[...o.allOf??[],..._.map((v)=>({multipleOf:v}))]}},Dc=(e,t,r,n)=>{r.type="boolean"},Kf=(e,t,r,n)=>{ye(e,t,r,n,"BigInt cannot be represented in JSON Schema")},Gf=(e,t,r,n)=>{ye(e,t,r,n,"Symbols cannot be represented in JSON Schema")},qc=(e,t,r,n)=>{if(t.target==="openapi-3.0")r.type="string",r.nullable=!0,r.enum=[null];else r.type="null"},Wf=(e,t,r,n)=>{ye(e,t,r,n,"Undefined cannot be represented in JSON Schema")},Xf=(e,t,r,n)=>{ye(e,t,r,n,"Void cannot be represented in JSON Schema")},Lc=(e,t,r,n)=>{r.not={}},Yf=(e,t,r,n)=>{},Fc=(e,t,r,n)=>{},Qf=(e,t,r,n)=>{ye(e,t,r,n,"Date cannot be represented in JSON Schema")},Uc=(e,t,r,n)=>{let o=e._zod.def,s=ln(o.entries);if(s.length===0){r.not={};return}if(s.every((i)=>typeof i==="number"))r.type="number";if(s.every((i)=>typeof i==="string"))r.type="string";r.enum=s},Vc=(e,t,r,n)=>{let o=e._zod.def;if(o.values.length===0){r.not={};return}let s=[];for(let i of o.values)if(i===void 0){if(ye(e,t,r,n,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof i==="bigint"){if(ye(e,t,r,n,"BigInt literals cannot be represented in JSON Schema"))return;s.push(Number(i))}else s.push(i);if(s.length===0);else if(s.length===1){let i=s[0];if(r.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0")r.enum=[i];else r.const=i}else{if(s.every((i)=>typeof i==="number"))r.type="number";if(s.every((i)=>typeof i==="string"))r.type="string";if(s.every((i)=>typeof i==="boolean"))r.type="boolean";if(s.every((i)=>i===null))r.type="null";r.enum=s}},em=(e,t,r,n)=>{ye(e,t,r,n,"NaN cannot be represented in JSON Schema")},tm=(e,t,r,n)=>{let o=r,s=e._zod.pattern;if(!s)throw Error("Pattern not found in template literal");o.type="string",o.pattern=s.source},rm=(e,t,r,n)=>{let o=r;o.type="string",o.format="binary",o.contentEncoding="binary";let{minimum:s,maximum:i,mime:a}=Ae(e);if(s!==void 0)o.minLength=s;if(i!==void 0)o.maxLength=i;if(!a)return;if(a.length===0)o.not={};else if(a.length===1)o.contentMediaType=a[0];else o.anyOf=a.map((c)=>({contentMediaType:c}))},nm=(e,t,r,n)=>{r.type="boolean"},Hc=(e,t,r,n)=>{ye(e,t,r,n,"Custom types cannot be represented in JSON Schema")},om=(e,t,r,n)=>{ye(e,t,r,n,"Function types cannot be represented in JSON Schema")},Bc=(e,t,r,n)=>{ye(e,t,r,n,"Transforms cannot be represented in JSON Schema")},sm=(e,t,r,n)=>{ye(e,t,r,n,"Map cannot be represented in JSON Schema")},im=(e,t,r,n)=>{ye(e,t,r,n,"Set cannot be represented in JSON Schema")},Jc=(e,t,r,n)=>{let o=r,s=e._zod.def,{minimum:i,maximum:a}=Ae(e);if(typeof i==="number")o.minItems=i;if(typeof a==="number")o.maxItems=a;o.type="array",o.items=te(s.element,t,{...n,path:[...n.path,"items"]})};function An(e){let t=e._zod.def;if(t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform"))return An(t.out);if(t.type==="catch")return An(t.innerType);return e._zod.optin}var Kc=(e,t,r,n)=>{let o=r,s=e._zod.def,i=s.shape;if(Object.getOwnPropertySymbols(i).length&&ye(e,t,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let u in i)Le(o.properties,u,te(i[u],t,{...n,path:[...n.path,"properties",u]}));let c=[];for(let u of Object.keys(i)){let l=s.shape[u];if(t.io==="input"?An(l)===void 0:l._zod.optout===void 0)c.push(u)}if(c.length>0)o.required=c;if(s.catchall?._zod.def.type==="never")o.additionalProperties=!1;else if(!s.catchall){if(t.io==="output")o.additionalProperties=!1}else if(s.catchall)o.additionalProperties=te(s.catchall,t,{...n,path:[...n.path,"additionalProperties"]})},Gc=(e,t,r,n)=>{let o=e._zod.def,s=o.inclusive===!1,i=o.options.map((a,c)=>te(a,t,{...n,path:[...n.path,s?"oneOf":"anyOf",c]}));if(s)r.oneOf=i;else r.anyOf=i},Wc=(e,t,r,n)=>{let o=e._zod.def,s=te(o.left,t,{...n,path:[...n.path,"allOf",0]}),i=te(o.right,t,{...n,path:[...n.path,"allOf",1]}),a=(u)=>("allOf"in u)&&Object.keys(u).length===1,c=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];r.allOf=c,t.intersections.push(c)},am=(e,t,r,n)=>{let o=r,s=e._zod.def;o.type="array";let i=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"?"items":t.target==="openapi-3.0"?"items":"additionalItems",c=s.items.map((h,_)=>te(h,t,{...n,path:[...n.path,i,_]})),u=s.rest?te(s.rest,t,{...n,path:[...n.path,a,...t.target==="openapi-3.0"?[s.items.length]:[]]}):null,l=s.items.length;while(l>0){let h=s.items[l-1];if(!(t.io==="input"?An(h)!==void 0:h._zod.optout==="optional"))break;l--}let d=s.items.length,f=!s.rest;if(t.target==="draft-2020-12"){if(o.prefixItems=c,f)o.items=!1;else if(u)o.items=u;if(l>0)o.minItems=l;if(f)o.maxItems=d}else if(t.target==="openapi-3.0"){if(o.items={anyOf:c},u)o.items.anyOf.push(u);if(l>0)o.minItems=l;if(f)o.maxItems=d}else{if(o.items=c,f)o.additionalItems=!1;else if(u)o.additionalItems=u;if(l>0)o.minItems=l;if(f)o.maxItems=d}let{minimum:p,maximum:m}=Ae(e);if(typeof p==="number")o.minItems=p;if(typeof m==="number")o.maxItems=m};function Nc(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let m=e.get(t)?.def;if(!m)return t;let h=Nc(e,m,r);return h===m?t:h}for(let m of["anyOf","oneOf"]){let h=t[m];if(!Array.isArray(h))continue;let _=h.map((v)=>Nc(e,v,r));if(_.some((v,z)=>v!==h[z]))t={...t,[m]:_}}let n=Array.isArray(t.type)?t.type:[t.type],o=!n.includes("string")&&n.some((m)=>m==="number"||m==="integer"),s=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!s?.some((m)=>typeof m==="number"))return t;let{minimum:i,maximum:a,exclusiveMinimum:c,exclusiveMaximum:u,multipleOf:l,format:d,id:f,...p}=t;if(p.enum)p.enum=p.enum.map((m)=>typeof m==="number"?String(m):m);else if(typeof p.const==="number")p.const=String(p.const);if(!o)return p;if(p.type="string",!s)p.pattern=(n.includes("number")?$n:Hi).source;return p}var jc=new WeakMap;function z0(e){let t=new Map;for(let n of e.seen.values())if(n.def&&!t.has(n.schema))t.set(n.schema,n);let r=new Map;for(let n of jc.get(e)??[]){let o=e.seen.get(n),s=(o?.def??o?.schema)?.propertyNames;if(!s||s===!0||r.has(s))continue;let i=Nc(t,s,new Set);if(i!==s)r.set(s,i)}if(!r.size)return;for(let n of e.seen.values())for(let o of[n.schema,n.def]){let s=o&&r.get(o.propertyNames);if(s)o.propertyNames=s}}var Xc=(e,t,r,n)=>{let o=r,s=e._zod.def;o.type="object";let i=s.keyType,a=Ae(i).patterns;if(s.mode==="loose"&&a&&a.size>0){let l=te(s.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let d of a)Le(o.patternProperties,Jf(d).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=te(s.keyType,t,{...n,path:[...n.path,"propertyNames"]});let l=jc.get(t);if(!l)l=[],jc.set(t,l),t.deferred.push(()=>z0(t));l.push(e)}o.additionalProperties=te(s.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let c=i._zod.values,u=t.io==="input"&&An(s.valueType)!==void 0;if(c&&!s.partial&&!u){let l=[...c].filter((d)=>typeof d==="string"||typeof d==="number");if(l.length>0)o.required=l.map(String)}},Yc=(e,t,r,n)=>{let o=e._zod.def,s=te(o.innerType,t,n),i=t.seen.get(e);if(t.target==="openapi-3.0")i.ref=o.innerType,r.nullable=!0;else r.anyOf=[s,{type:"null"}]},Qc=(e,t,r,n)=>{let o=e._zod.def;te(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType},eu=Symbol();function cm(e,t,r,n,o){let s=!1,i=JSON.stringify(e,(a,c)=>{if(typeof c!=="bigint")return c;return s=!0,null});if(!s)return JSON.parse(i);return ye(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),eu}var tu=(e,t,r,n)=>{let o=e._zod.def;te(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType;let i=cm(o.defaultValue,e,t,r,n);if(i!==eu)r.default=i},ru=(e,t,r,n)=>{let o=e._zod.def;te(o.innerType,t,n);let s=t.seen.get(e);if(s.ref=o.innerType,t.io!=="input")return;let i=cm(o.defaultValue,e,t,r,n);if(i!==eu)r._prefault=i},nu=(e,t,r,n)=>{let o=e._zod.def;te(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType;let i;try{i=o.catchValue(void 0)}catch{ye(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=i},ou=(e,t,r,n)=>{let o=e._zod.def,s=o.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?s?o.out:o.in:o.out;te(i,t,n);let a=t.seen.get(e);a.ref=i},su=(e,t,r,n)=>{let o=e._zod.def;te(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType,r.readOnly=!0},um=(e,t,r,n)=>{let o=e._zod.def;te(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType},os=(e,t,r,n)=>{let o=e._zod.def;te(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType},lm=(e,t,r,n)=>{let o=e._zod.innerType;te(o,t,n);let s=t.seen.get(e);s.ref=o},Ff={string:Zc,number:Mc,boolean:Dc,bigint:Kf,symbol:Gf,null:qc,undefined:Wf,void:Xf,never:Lc,any:Yf,unknown:Fc,date:Qf,enum:Uc,literal:Vc,nan:em,template_literal:tm,file:rm,success:nm,custom:Hc,function:om,transform:Bc,map:sm,set:im,array:Jc,object:Kc,union:Gc,intersection:Wc,tuple:am,record:Xc,nullable:Yc,nonoptional:Qc,default:tu,prefault:ru,catch:nu,pipe:ou,readonly:su,promise:um,optional:os,lazy:lm};function iu(e,t){if("_idmap"in e){let n=e,o=Rn({...t,processors:Ff}),s={};for(let c of n._idmap.entries()){let[u,l]=c;te(l,o)}let i={},a={registry:n,uri:t?.uri,defs:s};o.external=a;for(let c of n._idmap.entries()){let[u,l]=c;In(o,l),Le(i,u,Cn(o,l))}if(Object.keys(s).length>0){let c=o.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[c]:s}}return{schemas:i}}let r=Rn({...t,processors:Ff});return te(e,r),In(r,e),Cn(r,e)}var v$=y("ZodMiniType",(e,t)=>{if(!e._zod)throw Error("Uninitialized schema in ZodMiniType.");ee.init(e,t),e.def=t,e.type=t.type},{get with(){return this.check},set with(e){Qe(this,"with",e)},parse(e,t){return Li(this,e,t,{callee:this.parse})},parseAsync(e,t){return Fi(this,e,t,{callee:this.parseAsync})},safeParse(e,t){return vn(this,e,t)},safeParseAsync(e,t){return bn(this,e,t)},check(...e){let t=this.def;return this.clone({...t,checks:[...t.checks??[],...e.map((r)=>typeof r==="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]},{parent:!0})},clone(e,t){return Fe(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},apply(e,...t){return t.length===0?e(this):e(this,...t)}});var x$=y("ZodMiniObject",(e,t)=>{ka.init(e,t),v$.init(e,t),Zi(e,"shape",(r)=>r._zod.def.shape,!1)});function au(e,t){let r={type:"object",shape:e??{},...T(t)};return new x$(r)}function ht(e){return!!e._zod}function nr(e){let t=Object.values(e);if(t.length===0)return au({});let r=t.every(ht),n=t.every((o)=>!ht(o));if(r)return au(e);if(n)return zd(e);throw Error("Mixed Zod versions detected in object shape.")}function Nt(e,t){if(ht(e))return vn(e,t);return e.safeParse(t)}async function ss(e,t){if(ht(e))return await bn(e,t);return await e.safeParseAsync(t)}function jt(e){if(!e)return;let t;if(ht(e))t=e._zod?.def?.shape;else t=e.shape;if(!t)return;if(typeof t==="function")try{return t()}catch{return}return t}function zr(e){if(!e)return;if(typeof e==="object"){let t=e,r=e;if(!t._def&&!r._zod){let n=Object.values(e);if(n.length>0&&n.every((o)=>typeof o==="object"&&o!==null&&(o._def!==void 0||o._zod!==void 0||typeof o.parse==="function")))return nr(e)}}if(ht(e)){let r=e._zod?.def;if(r&&(r.type==="object"||r.shape!==void 0))return e}else if(e.shape!==void 0)return e;return}function $$(e){if(e.length===0)return"object root";return e.reduce((t,r,n)=>{if(n===0)return String(r);if(typeof r==="number")return`${t}[${r}]`;return`${t}.${r}`},"")}function is(e){if(e&&typeof e==="object"){if("issues"in e&&Array.isArray(e.issues)&&e.issues.length>0)return e.issues.map((t)=>{if(!t.path?.length)return t.message;return`${t.message} at ${$$(t.path)}`}).join(`
69
- `);if("message"in e&&typeof e.message==="string")return e.message;try{return JSON.stringify(e)}catch{return String(e)}}return String(e)}function pm(e){return e.description}function fm(e){if(ht(e))return e._zod?.def?.type==="optional";let t=e;if(typeof e.isOptional==="function")return e.isOptional();return t._def?.typeName==="ZodOptional"}function Pr(e){if(ht(e)){let s=e._zod?.def;if(s){if(s.value!==void 0)return s.value;if(Array.isArray(s.values)&&s.values.length>0)return s.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;return}var mm=new WeakSet([Object.prototype,Error.prototype]);function as(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let n=r(this);return Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0})}})}var E$=(e,t)=>{Qd.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);if(mm.has(r))return;mm.add(r),as(r,"format",(n)=>(o)=>tp(n,o)),as(r,"flatten",(n)=>(o)=>ep(n,o)),as(r,"addIssue",(n)=>(o)=>{n.issues.push(o),n.message=JSON.stringify(n.issues,dn,2)}),as(r,"addIssues",(n)=>(o)=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,dn,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})};var He=y("ZodError",E$,void 0,{Parent:Error});var hm=gn(He),gm=_n(He),_m=yn(He),ym=xn(He),vm=np(He),xm=op(He),bm=sp(He),$m=ip(He),wm=ap(He),km=cp(He),Sm=up(He),zm=lp(He);function R$(){if(!Ce.localeError)Ve(La())}function us(){if(!Ce.memoizer)Ve({memoizer:Pf()})}var ue=y("ZodType",(e,t)=>(R$(),ee.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(Ie(t,{checks:[...t.checks??[],...e.map((r)=>typeof r==="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Fe(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(xw(e,t))},superRefine(e,t){return this.check(bw(e,t))},overwrite(e){return this.check(At(e))},optional(){return ce(this)},exactOptional(){return cw(this)},nullable(){return Em(this)},nullish(){return ce(Em(this))},nonoptional(e){return mw(this,e)},array(){return U(this)},or(e){return se([this,e])},and(e){return ls(this,e)},transform(e){return Om(this,Dm(e))},default(e){return dw(this,e)},prefault(e){return fw(this,e)},catch(e){return gw(this,e)},pipe(e){return Om(this,e)},readonly(){return vw(this)},describe(e){let t=this.clone();return tr.add(t,{description:e}),t},meta(...e){if(e.length===0)return tr.get(this);let t=this.clone();return tr.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get "~standard"(){return No(this,"~standard",{...Xi(this),jsonSchema:{input:On(this,"input"),output:On(this,"output")}})},set "~standard"(e){Qe(this,"~standard",e)},parse:function e(t,r){return hm(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await gm(this,t,r,{callee:e})},safeParse(e,t){return _m(this,e,t)},async safeParseAsync(e,t){return ym(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Qe(this,"spa",e)},validate(e,t){return Zo(this,e,t)},validateAsync(e,t){return Mo(this,e,t)},encode:function e(t,r){return vm(this,t,r,{callee:e})},decode:function e(t,r){return xm(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await bm(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await $m(this,t,r,{callee:e})},safeEncode(e,t){return wm(this,e,t)},safeDecode(e,t){return km(this,e,t)},async safeEncodeAsync(e,t){return Sm(this,e,t)},async safeDecodeAsync(e,t){return zm(this,e,t)},toJSONSchema(e){return Zf(this,{})(e)},get description(){return tr.get(this)?.description},get _def(){return this._zod.def}}),Rm=y("_ZodString",(e,t)=>{kn.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zc(e,r,n,o)},Jd({format:(e)=>Ae(e).format??null,minLength:(e)=>Ae(e).minimum??null,maxLength:(e)=>Ae(e).maximum??null},{regex(...e){return this.check(xc(...e))},includes(...e){return this.check(wc(...e))},startsWith(...e){return this.check(kc(...e))},endsWith(...e){return this.check(Sc(...e))},min(...e){return this.check(wr(...e))},max(...e){return this.check(rs(...e))},length(...e){return this.check(ns(...e))},nonempty(...e){return this.check(wr(1,...e))},lowercase(e){return this.check(bc(e))},uppercase(e){return this.check($c(e))},trim(){return this.check(Pc())},normalize(...e){return this.check(zc(...e))},toLowerCase(){return this.check(Tc())},toUpperCase(){return this.check(Ec())},slugify(){return this.check(Oc())}})),I$=y("ZodString",(e,t)=>{kn.init(e,t),Rm.init(e,t)},{email(e){return this.check(Ua(C$,e))},url(e){return this.check(Ga(N$,e))},jwt(e){return this.check(lc(W$,e))},emoji(e){return this.check(Wa(j$,e))},guid(e){return this.check(Va(A$,e))},uuid(e){return this.check(Ha(cs,e))},uuidv4(e){return this.check(Ba(cs,e))},uuidv6(e){return this.check(Ja(cs,e))},uuidv7(e){return this.check(Ka(cs,e))},nanoid(e){return this.check(Xa(Z$,e))},cuid(e){return this.check(Ya(M$,e))},cuid2(e){return this.check(Qa(D$,e))},ulid(e){return this.check(ec(q$,e))},base64(e){return this.check(ac(J$,e))},base64url(e){return this.check(cc(K$,e))},xid(e){return this.check(tc(L$,e))},ksuid(e){return this.check(rc(F$,e))},ipv4(e){return this.check(nc(U$,e))},ipv6(e){return this.check(oc(V$,e))},cidrv4(e){return this.check(sc(H$,e))},cidrv6(e){return this.check(ic(B$,e))},e164(e){return this.check(uc(G$,e))},datetime(e){return this.check(Yo(uu,e))},date(e){return this.check(dc(Im,e))},time(e){return this.check(pc(Cm,e))},duration(e){return this.check(fc(Am,e))}});function g(e){return Fa(I$,e)}var de=y("ZodStringFormat",(e,t)=>{ne.init(e,t),Rm.init(e,t)}),uu=y("ZodISODateTime",(e,t)=>{ff.init(e,t),de.init(e,t)}),Im=y("ZodISODate",(e,t)=>{mf.init(e,t),de.init(e,t)}),Cm=y("ZodISOTime",(e,t)=>{hf.init(e,t),de.init(e,t)}),Am=y("ZodISODuration",(e,t)=>{gf.init(e,t),de.init(e,t)}),C$=y("ZodEmail",(e,t)=>{ea.init(e,t),de.init(e,t)});var A$=y("ZodGUID",(e,t)=>{Yi.init(e,t),de.init(e,t)});var cs=y("ZodUUID",(e,t)=>{Qi.init(e,t),de.init(e,t)});var N$=y("ZodURL",(e,t)=>{ta.init(e,t),de.init(e,t)});var j$=y("ZodEmoji",(e,t)=>{ra.init(e,t),de.init(e,t)});var Z$=y("ZodNanoID",(e,t)=>{na.init(e,t),de.init(e,t)});var M$=y("ZodCUID",(e,t)=>{oa.init(e,t),de.init(e,t)});var D$=y("ZodCUID2",(e,t)=>{sa.init(e,t),de.init(e,t)});var q$=y("ZodULID",(e,t)=>{ia.init(e,t),de.init(e,t)});var L$=y("ZodXID",(e,t)=>{aa.init(e,t),de.init(e,t)});var F$=y("ZodKSUID",(e,t)=>{ca.init(e,t),de.init(e,t)});var U$=y("ZodIPv4",(e,t)=>{ua.init(e,t),de.init(e,t)});var V$=y("ZodIPv6",(e,t)=>{la.init(e,t),de.init(e,t)});var H$=y("ZodCIDRv4",(e,t)=>{da.init(e,t),de.init(e,t)});var B$=y("ZodCIDRv6",(e,t)=>{pa.init(e,t),de.init(e,t)});var J$=y("ZodBase64",(e,t)=>{ma.init(e,t),de.init(e,t)});var K$=y("ZodBase64URL",(e,t)=>{ha.init(e,t),de.init(e,t)});var G$=y("ZodE164",(e,t)=>{ga.init(e,t),de.init(e,t)});var W$=y("ZodJWT",(e,t)=>{_a.init(e,t),de.init(e,t)});var Nm=y("ZodNumber",(e,t)=>{Vo.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Mc(e,r,n,o),e.isFinite=!0},Jd({minValue:(e)=>{let{minimum:t,exclusiveMinimum:r}=Ae(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:(e)=>{let{maximum:t,exclusiveMaximum:r}=Ae(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:(e)=>{let{isInt:t,multipleOf:r}=Ae(e);return!!t||!!r?.some(Number.isSafeInteger)},format:(e)=>Ae(e).format??null},{gt(e,t){return this.check(es(e,t))},gte(e,t){return this.check(Tn(e,t))},min(e,t){return this.check(Tn(e,t))},lt(e,t){return this.check(Qo(e,t))},lte(e,t){return this.check(Pn(e,t))},max(e,t){return this.check(Pn(e,t))},int(e){return this.check(Pm(e))},safe(e){return this.check(Pm(e))},positive(e){return this.check(es(0,e))},nonnegative(e){return this.check(Tn(0,e))},negative(e){return this.check(Qo(0,e))},nonpositive(e){return this.check(Pn(0,e))},multipleOf(e,t){return this.check(ts(e,t))},step(e,t){return this.check(ts(e,t))},finite(){return this}}));function Q(e){return mc(Nm,e)}var X$=y("ZodNumberFormat",(e,t)=>{ya.init(e,t),Nm.init(e,t)});function Pm(e){return hc(X$,e)}var Y$=y("ZodBoolean",(e,t)=>{va.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Dc(e,r,n,o)});function he(e){return gc(Y$,e)}var Q$=y("ZodNull",(e,t)=>{xa.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>qc(e,r,n,o)});function jm(e){return _c(Q$,e)}var ew=y("ZodUnknown",(e,t)=>{ba.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Fc(e,r,n,o)});function ae(){return yc(ew)}var tw=y("ZodNever",(e,t)=>{$a.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Lc(e,r,n,o)});function rw(e){return vc(tw,e)}var nw=y("ZodArray",(e,t)=>{us(),wa.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Jc(e,r,n,o),e.element=t.element},{min(e,t){return this.check(wr(e,t))},nonempty(e){return this.check(wr(1,e))},max(e,t){return this.check(rs(e,t))},length(e,t){return this.check(ns(e,t))},unwrap(){return this.element}});function U(e,t){return Rf(nw,e,t)}var Zm=y("ZodObject",(e,t)=>{us(),bf.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Kc(e,r,n,o),Zi(e,"shape",(r)=>r._zod.def.shape,!1)},{keyof(){return Te(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(Ie(this._zod.def,{catchall:e}))},passthrough(){return this.clone(Ie(this._zod.def,{catchall:ae()}))},loose(){return this.clone(Ie(this._zod.def,{catchall:ae()}))},strict(){return this.clone(Ie(this._zod.def,{catchall:rw()}))},strip(){return this.clone(Ie(this._zod.def,{catchall:void 0}))},extend(e){return Dd(this,e)},safeExtend(e){return Ld(this,e)},merge(e){return Fd(this,e)},pick(e){return Zd(this,e)},omit(e){return Md(this,e)},partial(...e){return Ni(ds,this,e[0])},exactPartial(...e){return Ni(qm,this,e[0],"exactPartial")},required(...e){return Ud(Lm,this,e[0])}});function P(e,t){let r={type:"object",shape:e??{},...T(t)};return new Zm(r)}function Pe(e,t){return new Zm({type:"object",shape:e,catchall:ae(),...T(t)})}var Mm=y("ZodUnion",(e,t)=>{Ho.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Gc(e,r,n,o),e.options=t.options});function se(e,t){return new Mm({type:"union",options:e,...T(t)})}var ow=y("ZodDiscriminatedUnion",(e,t)=>{Mm.init(e,t),Sa.init(e,t)});function lu(e,t,r){return new ow({type:"union",options:t,discriminator:e,...T(r)})}var sw=y("ZodIntersection",(e,t)=>{za.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wc(e,r,n,o)});function ls(e,t){return new sw({type:"intersection",left:e,right:t})}var Tm=y("ZodRecord",(e,t)=>{us(),Pa.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xc(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function oe(e,t,r){if(!t||!t._zod)return new Tm({type:"record",keyType:g(),valueType:e,...T(t)});return new Tm({type:"record",keyType:e,valueType:t,...T(r)})}var cu=y("ZodEnum",(e,t)=>{Ta.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(n,o,s)=>Uc(e,n,o,s),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let s={};for(let i of n)if(r.has(i))s[i]=t.entries[i];else throw Error(`Key ${i} not found in enum`);return new cu({...t,checks:[],...T(o),entries:s})},e.exclude=(n,o)=>{let s={...t.entries};for(let i of n)if(r.has(i))delete s[i];else throw Error(`Key ${i} not found in enum`);return new cu({...t,checks:[],...T(o),entries:s})}});function Te(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((n)=>[n,n])):e;return new cu({type:"enum",entries:r,...T(t)})}var iw=y("ZodLiteral",(e,t)=>{Ea.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Vc(e,r,n,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function I(e,t){return new iw({type:"literal",values:Array.isArray(e)?e:[e],...T(t)})}var aw=y("ZodTransform",(e,t)=>{us(),Oa.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Bc(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new mn(e.constructor.name);r.addIssue=(s)=>{if(typeof s==="string")r.issues.push(er(s,r.value,t));else{let i=s;if(i.fatal)i.continue=!1;if(i.code??(i.code="custom"),!("input"in i))i.input=r.value;i.inst??(i.inst=e),r.issues.push(er(i))}};let o=t.transform(r.value,r);if(o instanceof Promise)return o.then((s)=>(r.value=s,r));return r.value=o,r}});function Dm(e){return new aw({type:"transform",transform:e})}var ds=y("ZodOptional",(e,t)=>{Bo.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>os(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ce(e){return new ds({type:"optional",innerType:e})}var qm=y("ZodExactOptional",(e,t)=>{Ra.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>os(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function cw(e){return new qm({type:"optional",innerType:e})}var uw=y("ZodNullable",(e,t)=>{Ia.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Yc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Em(e){return new uw({type:"nullable",innerType:e})}var lw=y("ZodDefault",(e,t)=>{Ca.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>tu(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function dw(e,t){return new lw({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():Oo(t)}})}var pw=y("ZodPrefault",(e,t)=>{Aa.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ru(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function fw(e,t){return new pw({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():Oo(t)}})}var Lm=y("ZodNonOptional",(e,t)=>{Na.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function mw(e,t){return new Lm({type:"nonoptional",innerType:e,...T(t)})}var hw=y("ZodCatch",(e,t)=>{ja.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>nu(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function gw(e,t){return new hw({type:"catch",innerType:e,catchValue:typeof t==="function"?t:Kd(t)})}var Fm=y("ZodPipe",(e,t)=>{Jo.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ou(e,r,n,o),e.in=t.in,e.out=t.out});function Om(e,t){return new Fm({type:"pipe",in:e,out:t})}var _w=y("ZodPreprocess",(e,t)=>{Fm.init(e,t),$f.init(e,t)}),yw=y("ZodReadonly",(e,t)=>{Za.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>su(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function vw(e){return new yw({type:"readonly",innerType:e})}var Um=y("ZodCustom",(e,t)=>{Ma.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hc(e,r,n,o)});function Vm(e,t){return Rc(Um,e??(()=>!0),t)}function xw(e,t={}){return Ic(Um,e,t)}function bw(e,t){return Cc(e,t)}function du(e,t){return new _w({type:"pipe",in:Dm(e),out:t})}function $w(e){return Yo(uu,e)}var pu="2025-11-25";var Jm=[pu,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Zt="io.modelcontextprotocol/related-task",fs="2.0",ge=Vm((e)=>e!==null&&(typeof e==="object"||typeof e==="function")),Km=se([g(),Q().int()]),Gm=g(),ej=Pe({ttl:Q().optional(),pollInterval:Q().optional()}),ww=P({ttl:Q().optional()}),kw=P({taskId:g()}),fu=Pe({progressToken:Km.optional(),[Zt]:kw.optional()}),Be=P({_meta:fu.optional()}),Nn=Be.extend({task:ww.optional()}),Wm=(e)=>Nn.safeParse(e).success,ve=P({method:g(),params:Be.loose().optional()}),Je=P({_meta:fu.optional()}),Ke=P({method:g(),params:Je.loose().optional()}),xe=Pe({_meta:fu.optional()}),ms=se([g(),Q().int()]),Xm=P({jsonrpc:I(fs),id:ms,...ve.shape}).strict(),mu=(e)=>Xm.safeParse(e).success,Ym=P({jsonrpc:I(fs),...Ke.shape}).strict(),Qm=(e)=>Ym.safeParse(e).success,hu=P({jsonrpc:I(fs),id:ms,result:xe}).strict(),jn=(e)=>hu.safeParse(e).success;var N;(function(e){e[e.ConnectionClosed=-32000]="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"})(N||(N={}));var gu=P({jsonrpc:I(fs),id:ms.optional(),error:P({code:Q().int(),message:g(),data:ae().optional()})}).strict();var eh=(e)=>gu.safeParse(e).success;var th=se([Xm,Ym,hu,gu]),tj=se([hu,gu]),hs=xe.strict(),Sw=Je.extend({requestId:ms.optional(),reason:g().optional()}),gs=Ke.extend({method:I("notifications/cancelled"),params:Sw}),zw=P({src:g(),mimeType:g().optional(),sizes:U(g()).optional(),theme:Te(["light","dark"]).optional()}),Zn=P({icons:U(zw).optional()}),Tr=P({name:g(),title:g().optional()}),rh=Tr.extend({...Tr.shape,...Zn.shape,version:g(),websiteUrl:g().optional(),description:g().optional()}),Pw=ls(P({applyDefaults:he().optional()}),oe(g(),ae())),Tw=du((e)=>{if(e&&typeof e==="object"&&!Array.isArray(e)){if(Object.keys(e).length===0)return{form:{}}}return e},ls(P({form:Pw.optional(),url:ge.optional()}),oe(g(),ae()).optional())),Ew=Pe({list:ge.optional(),cancel:ge.optional(),requests:Pe({sampling:Pe({createMessage:ge.optional()}).optional(),elicitation:Pe({create:ge.optional()}).optional()}).optional()}),Ow=Pe({list:ge.optional(),cancel:ge.optional(),requests:Pe({tools:Pe({call:ge.optional()}).optional()}).optional()}),Rw=P({experimental:oe(g(),ge).optional(),sampling:P({context:ge.optional(),tools:ge.optional()}).optional(),elicitation:Tw.optional(),roots:P({listChanged:he().optional()}).optional(),tasks:Ew.optional(),extensions:oe(g(),ge).optional()}),Iw=Be.extend({protocolVersion:g(),capabilities:Rw,clientInfo:rh}),_u=ve.extend({method:I("initialize"),params:Iw});var Cw=P({experimental:oe(g(),ge).optional(),logging:ge.optional(),completions:ge.optional(),prompts:P({listChanged:he().optional()}).optional(),resources:P({subscribe:he().optional(),listChanged:he().optional()}).optional(),tools:P({listChanged:he().optional()}).optional(),tasks:Ow.optional(),extensions:oe(g(),ge).optional()}),Aw=xe.extend({protocolVersion:g(),capabilities:Cw,serverInfo:rh,instructions:g().optional()}),yu=Ke.extend({method:I("notifications/initialized"),params:Je.optional()});var _s=ve.extend({method:I("ping"),params:Be.optional()}),Nw=P({progress:Q(),total:ce(Q()),message:ce(g())}),jw=P({...Je.shape,...Nw.shape,progressToken:Km}),ys=Ke.extend({method:I("notifications/progress"),params:jw}),Zw=Be.extend({cursor:Gm.optional()}),Mn=ve.extend({params:Zw.optional()}),Dn=xe.extend({nextCursor:Gm.optional()}),Mw=Te(["working","input_required","completed","failed","cancelled"]),qn=P({taskId:g(),status:Mw,ttl:se([Q(),jm()]),createdAt:g(),lastUpdatedAt:g(),pollInterval:ce(Q()),statusMessage:ce(g())}),Er=xe.extend({task:qn}),Dw=Je.merge(qn),Ln=Ke.extend({method:I("notifications/tasks/status"),params:Dw}),vs=ve.extend({method:I("tasks/get"),params:Be.extend({taskId:g()})}),xs=xe.merge(qn),bs=ve.extend({method:I("tasks/result"),params:Be.extend({taskId:g()})}),rj=xe.loose(),$s=Mn.extend({method:I("tasks/list")}),ws=Dn.extend({tasks:U(qn)}),ks=ve.extend({method:I("tasks/cancel"),params:Be.extend({taskId:g()})}),nh=xe.merge(qn),oh=P({uri:g(),mimeType:ce(g()),_meta:oe(g(),ae()).optional()}),sh=oh.extend({text:g()}),vu=g().refine((e)=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),ih=oh.extend({blob:vu}),Fn=Te(["user","assistant"]),Or=P({audience:U(Fn).optional(),priority:Q().min(0).max(1).optional(),lastModified:$w({offset:!0}).optional()}),ah=P({...Tr.shape,...Zn.shape,uri:g(),description:ce(g()),mimeType:ce(g()),size:ce(Q()),annotations:Or.optional(),_meta:ce(Pe({}))}),qw=P({...Tr.shape,...Zn.shape,uriTemplate:g(),description:ce(g()),mimeType:ce(g()),annotations:Or.optional(),_meta:ce(Pe({}))}),Ss=Mn.extend({method:I("resources/list")}),Lw=Dn.extend({resources:U(ah)}),zs=Mn.extend({method:I("resources/templates/list")}),Fw=Dn.extend({resourceTemplates:U(qw)}),xu=Be.extend({uri:g()}),Uw=xu,Ps=ve.extend({method:I("resources/read"),params:Uw}),Vw=xe.extend({contents:U(se([sh,ih]))}),Hw=Ke.extend({method:I("notifications/resources/list_changed"),params:Je.optional()}),Bw=xu,Jw=ve.extend({method:I("resources/subscribe"),params:Bw}),Kw=xu,Gw=ve.extend({method:I("resources/unsubscribe"),params:Kw}),Ww=Je.extend({uri:g()}),Xw=Ke.extend({method:I("notifications/resources/updated"),params:Ww}),Yw=P({name:g(),description:ce(g()),required:ce(he())}),Qw=P({...Tr.shape,...Zn.shape,description:ce(g()),arguments:ce(U(Yw)),_meta:ce(Pe({}))}),Ts=Mn.extend({method:I("prompts/list")}),ek=Dn.extend({prompts:U(Qw)}),tk=Be.extend({name:g(),arguments:oe(g(),g()).optional()}),Es=ve.extend({method:I("prompts/get"),params:tk}),bu=P({type:I("text"),text:g(),annotations:Or.optional(),_meta:oe(g(),ae()).optional()}),$u=P({type:I("image"),data:vu,mimeType:g(),annotations:Or.optional(),_meta:oe(g(),ae()).optional()}),wu=P({type:I("audio"),data:vu,mimeType:g(),annotations:Or.optional(),_meta:oe(g(),ae()).optional()}),rk=P({type:I("tool_use"),name:g(),id:g(),input:oe(g(),ae()),_meta:oe(g(),ae()).optional()}),nk=P({type:I("resource"),resource:se([sh,ih]),annotations:Or.optional(),_meta:oe(g(),ae()).optional()}),ok=ah.extend({type:I("resource_link")}),ku=se([bu,$u,wu,ok,nk]),sk=P({role:Fn,content:ku}),ik=xe.extend({description:g().optional(),messages:U(sk)}),ak=Ke.extend({method:I("notifications/prompts/list_changed"),params:Je.optional()}),ck=P({title:g().optional(),readOnlyHint:he().optional(),destructiveHint:he().optional(),idempotentHint:he().optional(),openWorldHint:he().optional()}),uk=P({taskSupport:Te(["required","optional","forbidden"]).optional()}),ch=P({...Tr.shape,...Zn.shape,description:g().optional(),inputSchema:P({type:I("object"),properties:oe(g(),ge).optional(),required:U(g()).optional()}).catchall(ae()),outputSchema:P({type:I("object"),properties:oe(g(),ge).optional(),required:U(g()).optional()}).catchall(ae()).optional(),annotations:ck.optional(),execution:uk.optional(),_meta:oe(g(),ae()).optional()}),Os=Mn.extend({method:I("tools/list")}),lk=Dn.extend({tools:U(ch)}),Rs=xe.extend({content:U(ku).default([]),structuredContent:oe(g(),ae()).optional(),isError:he().optional()}),nj=Rs.or(xe.extend({toolResult:ae()})),dk=Nn.extend({name:g(),arguments:oe(g(),ae()).optional()}),Rr=ve.extend({method:I("tools/call"),params:dk}),pk=Ke.extend({method:I("notifications/tools/list_changed"),params:Je.optional()}),oj=P({autoRefresh:he().default(!0),debounceMs:Q().int().nonnegative().default(300)}),Un=Te(["debug","info","notice","warning","error","critical","alert","emergency"]),fk=Be.extend({level:Un}),Su=ve.extend({method:I("logging/setLevel"),params:fk}),mk=Je.extend({level:Un,logger:g().optional(),data:ae()}),hk=Ke.extend({method:I("notifications/message"),params:mk}),gk=P({name:g().optional()}),_k=P({hints:U(gk).optional(),costPriority:Q().min(0).max(1).optional(),speedPriority:Q().min(0).max(1).optional(),intelligencePriority:Q().min(0).max(1).optional()}),yk=P({mode:Te(["auto","required","none"]).optional()}),vk=P({type:I("tool_result"),toolUseId:g().describe("The unique identifier for the corresponding tool call."),content:U(ku).default([]),structuredContent:P({}).loose().optional(),isError:he().optional(),_meta:oe(g(),ae()).optional()}),xk=lu("type",[bu,$u,wu]),ps=lu("type",[bu,$u,wu,rk,vk]),bk=P({role:Fn,content:se([ps,U(ps)]),_meta:oe(g(),ae()).optional()}),$k=Nn.extend({messages:U(bk),modelPreferences:_k.optional(),systemPrompt:g().optional(),includeContext:Te(["none","thisServer","allServers"]).optional(),temperature:Q().optional(),maxTokens:Q().int(),stopSequences:U(g()).optional(),metadata:ge.optional(),tools:U(ch).optional(),toolChoice:yk.optional()}),wk=ve.extend({method:I("sampling/createMessage"),params:$k}),Vn=xe.extend({model:g(),stopReason:ce(Te(["endTurn","stopSequence","maxTokens"]).or(g())),role:Fn,content:xk}),zu=xe.extend({model:g(),stopReason:ce(Te(["endTurn","stopSequence","maxTokens","toolUse"]).or(g())),role:Fn,content:se([ps,U(ps)])}),kk=P({type:I("boolean"),title:g().optional(),description:g().optional(),default:he().optional()}),Sk=P({type:I("string"),title:g().optional(),description:g().optional(),minLength:Q().optional(),maxLength:Q().optional(),format:Te(["email","uri","date","date-time"]).optional(),default:g().optional()}),zk=P({type:Te(["number","integer"]),title:g().optional(),description:g().optional(),minimum:Q().optional(),maximum:Q().optional(),default:Q().optional()}),Pk=P({type:I("string"),title:g().optional(),description:g().optional(),enum:U(g()),default:g().optional()}),Tk=P({type:I("string"),title:g().optional(),description:g().optional(),oneOf:U(P({const:g(),title:g()})),default:g().optional()}),Ek=P({type:I("string"),title:g().optional(),description:g().optional(),enum:U(g()),enumNames:U(g()).optional(),default:g().optional()}),Ok=se([Pk,Tk]),Rk=P({type:I("array"),title:g().optional(),description:g().optional(),minItems:Q().optional(),maxItems:Q().optional(),items:P({type:I("string"),enum:U(g())}),default:U(g()).optional()}),Ik=P({type:I("array"),title:g().optional(),description:g().optional(),minItems:Q().optional(),maxItems:Q().optional(),items:P({anyOf:U(P({const:g(),title:g()}))}),default:U(g()).optional()}),Ck=se([Rk,Ik]),Ak=se([Ek,Ok,Ck]),Nk=se([Ak,kk,Sk,zk]),jk=Nn.extend({mode:I("form").optional(),message:g(),requestedSchema:P({type:I("object"),properties:oe(g(),Nk),required:U(g()).optional()})}),Zk=Nn.extend({mode:I("url"),message:g(),elicitationId:g(),url:g().url()}),Mk=se([jk,Zk]),Dk=ve.extend({method:I("elicitation/create"),params:Mk}),qk=Je.extend({elicitationId:g()}),Lk=Ke.extend({method:I("notifications/elicitation/complete"),params:qk}),Ir=xe.extend({action:Te(["accept","decline","cancel"]),content:du((e)=>e===null?void 0:e,oe(g(),se([g(),Q(),he(),U(g())])).optional())}),Fk=P({type:I("ref/resource"),uri:g()});var Uk=P({type:I("ref/prompt"),name:g()}),Vk=Be.extend({ref:se([Uk,Fk]),argument:P({name:g(),value:g()}),context:P({arguments:oe(g(),g()).optional()}).optional()}),Is=ve.extend({method:I("completion/complete"),params:Vk});function uh(e){if(e.params.ref.type!=="ref/prompt")throw TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`)}function lh(e){if(e.params.ref.type!=="ref/resource")throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`)}var Hk=xe.extend({completion:Pe({values:U(g()).max(100),total:ce(Q().int()),hasMore:ce(he())})}),Bk=P({uri:g().startsWith("file://"),name:g().optional(),_meta:oe(g(),ae()).optional()}),Jk=ve.extend({method:I("roots/list"),params:Be.optional()}),Pu=xe.extend({roots:U(Bk)}),Kk=Ke.extend({method:I("notifications/roots/list_changed"),params:Je.optional()}),sj=se([_s,_u,Is,Su,Es,Ts,Ss,zs,Ps,Jw,Gw,Rr,Os,vs,bs,$s,ks]),ij=se([gs,ys,yu,Kk,Ln]),aj=se([hs,Vn,zu,Ir,Pu,xs,ws,Er]),cj=se([_s,wk,Dk,Jk,vs,bs,$s,ks]),uj=se([gs,ys,hk,Xw,Hw,pk,ak,Ln,Lk]),lj=se([hs,Aw,Hk,ik,ek,Lw,Fw,Vw,Rs,lk,xs,ws,Er]);class R extends Error{constructor(e,t,r){super(`MCP error ${e}: ${t}`);this.code=e,this.data=r,this.name="McpError"}static fromError(e,t,r){if(e===N.UrlElicitationRequired&&r){let n=r;if(n.elicitations)return new dh(n.elicitations,t)}return new R(e,t,r)}}class dh extends R{constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(N.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}}function Mt(e){return e==="completed"||e==="failed"||e==="cancelled"}var fh=Symbol("Let zodToJsonSchema decide on which parser to use");var ph={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},mh=(e)=>typeof e==="string"?{...ph,name:e}:{...ph,...e};var hh=(e)=>{let t=mh(e),r=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([n,o])=>[o._def,{def:o._def,path:[...t.basePath,t.definitionPath,n],jsonSchema:void 0}]))}};function Tu(e,t,r,n){if(!n?.errorMessages)return;if(r)e.errorMessage={...e.errorMessage,[t]:r}}function B(e,t,r,n,o){e[t]=r,Tu(e,t,n,o)}var Cs=(e,t)=>{let r=0;for(;r<e.length&&r<t.length;r++)if(e[r]!==t[r])break;return[(e.length-r).toString(),...t.slice(r)].join("/")};function le(e){if(e.target!=="openAi")return{};let t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:e.$refStrategy==="relative"?Cs(t,e.currentPath):t.join("/")}}function gh(e,t){let r={type:"array"};if(e.type?._def&&e.type?._def?.typeName!==b.ZodAny)r.items=Z(e.type._def,{...t,currentPath:[...t.currentPath,"items"]});if(e.minLength)B(r,"minItems",e.minLength.value,e.minLength.message,t);if(e.maxLength)B(r,"maxItems",e.maxLength.value,e.maxLength.message,t);if(e.exactLength)B(r,"minItems",e.exactLength.value,e.exactLength.message,t),B(r,"maxItems",e.exactLength.value,e.exactLength.message,t);return r}function _h(e,t){let r={type:"integer",format:"int64"};if(!e.checks)return r;for(let n of e.checks)switch(n.kind){case"min":if(t.target==="jsonSchema7")if(n.inclusive)B(r,"minimum",n.value,n.message,t);else B(r,"exclusiveMinimum",n.value,n.message,t);else{if(!n.inclusive)r.exclusiveMinimum=!0;B(r,"minimum",n.value,n.message,t)}break;case"max":if(t.target==="jsonSchema7")if(n.inclusive)B(r,"maximum",n.value,n.message,t);else B(r,"exclusiveMaximum",n.value,n.message,t);else{if(!n.inclusive)r.exclusiveMaximum=!0;B(r,"maximum",n.value,n.message,t)}break;case"multipleOf":B(r,"multipleOf",n.value,n.message,t);break}return r}function yh(){return{type:"boolean"}}function As(e,t){return Z(e.type._def,t)}var vh=(e,t)=>Z(e.innerType._def,t);function Eu(e,t,r){let n=r??t.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,s)=>Eu(e,t,o))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return Gk(e,t)}}var Gk=(e,t)=>{let r={type:"integer",format:"unix-time"};if(t.target==="openApi3")return r;for(let n of e.checks)switch(n.kind){case"min":B(r,"minimum",n.value,n.message,t);break;case"max":B(r,"maximum",n.value,n.message,t);break}return r};function xh(e,t){return{...Z(e.innerType._def,t),default:e.defaultValue()}}function bh(e,t){return t.effectStrategy==="input"?Z(e.schema._def,t):le(t)}function $h(e){return{type:"string",enum:Array.from(e.values)}}var Wk=(e)=>{if("type"in e&&e.type==="string")return!1;return"allOf"in e};function wh(e,t){let r=[Z(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),Z(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter((s)=>!!s),n=t.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,o=[];return r.forEach((s)=>{if(Wk(s)){if(o.push(...s.allOf),s.unevaluatedProperties===void 0)n=void 0}else{let i=s;if("additionalProperties"in s&&s.additionalProperties===!1){let{additionalProperties:a,...c}=s;i=c}else n=void 0;o.push(i)}}),o.length?{allOf:o,...n}:void 0}function kh(e,t){let r=typeof e.value;if(r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string")return{type:Array.isArray(e.value)?"array":"object"};if(t.target==="openApi3")return{type:r==="bigint"?"integer":r,enum:[e.value]};return{type:r==="bigint"?"integer":r,const:e.value}}var Ou=void 0,et={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>{if(Ou===void 0)Ou=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u");return Ou},uuid:/^[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}$/,ipv4:/^(?:(?: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])$/,ipv4Cidr:/^(?:(?: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])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([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])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function Ns(e,t){let r={type:"string"};if(e.checks)for(let n of e.checks)switch(n.kind){case"min":B(r,"minLength",typeof r.minLength==="number"?Math.max(r.minLength,n.value):n.value,n.message,t);break;case"max":B(r,"maxLength",typeof r.maxLength==="number"?Math.min(r.maxLength,n.value):n.value,n.message,t);break;case"email":switch(t.emailStrategy){case"format:email":tt(r,"email",n.message,t);break;case"format:idn-email":tt(r,"idn-email",n.message,t);break;case"pattern:zod":Ee(r,et.email,n.message,t);break}break;case"url":tt(r,"uri",n.message,t);break;case"uuid":tt(r,"uuid",n.message,t);break;case"regex":Ee(r,n.regex,n.message,t);break;case"cuid":Ee(r,et.cuid,n.message,t);break;case"cuid2":Ee(r,et.cuid2,n.message,t);break;case"startsWith":Ee(r,RegExp(`^${Ru(n.value,t)}`),n.message,t);break;case"endsWith":Ee(r,RegExp(`${Ru(n.value,t)}$`),n.message,t);break;case"datetime":tt(r,"date-time",n.message,t);break;case"date":tt(r,"date",n.message,t);break;case"time":tt(r,"time",n.message,t);break;case"duration":tt(r,"duration",n.message,t);break;case"length":B(r,"minLength",typeof r.minLength==="number"?Math.max(r.minLength,n.value):n.value,n.message,t),B(r,"maxLength",typeof r.maxLength==="number"?Math.min(r.maxLength,n.value):n.value,n.message,t);break;case"includes":{Ee(r,RegExp(Ru(n.value,t)),n.message,t);break}case"ip":{if(n.version!=="v6")tt(r,"ipv4",n.message,t);if(n.version!=="v4")tt(r,"ipv6",n.message,t);break}case"base64url":Ee(r,et.base64url,n.message,t);break;case"jwt":Ee(r,et.jwt,n.message,t);break;case"cidr":{if(n.version!=="v6")Ee(r,et.ipv4Cidr,n.message,t);if(n.version!=="v4")Ee(r,et.ipv6Cidr,n.message,t);break}case"emoji":Ee(r,et.emoji(),n.message,t);break;case"ulid":{Ee(r,et.ulid,n.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{tt(r,"binary",n.message,t);break}case"contentEncoding:base64":{B(r,"contentEncoding","base64",n.message,t);break}case"pattern:zod":{Ee(r,et.base64,n.message,t);break}}break}case"nanoid":Ee(r,et.nanoid,n.message,t);case"toLowerCase":case"toUpperCase":case"trim":break;default:((o)=>{})(n)}return r}function Ru(e,t){return t.patternStrategy==="escape"?Yk(e):e}var Xk=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Yk(e){let t="";for(let r=0;r<e.length;r++){if(!Xk.has(e[r]))t+="\\";t+=e[r]}return t}function tt(e,t,r,n){if(e.format||e.anyOf?.some((o)=>o.format)){if(!e.anyOf)e.anyOf=[];if(e.format){if(e.anyOf.push({format:e.format,...e.errorMessage&&n.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage){if(delete e.errorMessage.format,Object.keys(e.errorMessage).length===0)delete e.errorMessage}}e.anyOf.push({format:t,...r&&n.errorMessages&&{errorMessage:{format:r}}})}else B(e,"format",t,r,n)}function Ee(e,t,r,n){if(e.pattern||e.allOf?.some((o)=>o.pattern)){if(!e.allOf)e.allOf=[];if(e.pattern){if(e.allOf.push({pattern:e.pattern,...e.errorMessage&&n.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage){if(delete e.errorMessage.pattern,Object.keys(e.errorMessage).length===0)delete e.errorMessage}}e.allOf.push({pattern:Sh(t,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})}else B(e,"pattern",Sh(t,n),r,n)}function Sh(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let r={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},n=r.i?e.source.toLowerCase():e.source,o="",s=!1,i=!1,a=!1;for(let c=0;c<n.length;c++){if(s){o+=n[c],s=!1;continue}if(r.i){if(i){if(n[c].match(/[a-z]/)){if(a)o+=n[c],o+=`${n[c-2]}-${n[c]}`.toUpperCase(),a=!1;else if(n[c+1]==="-"&&n[c+2]?.match(/[a-z]/))o+=n[c],a=!0;else o+=`${n[c]}${n[c].toUpperCase()}`;continue}}else if(n[c].match(/[a-z]/)){o+=`[${n[c]}${n[c].toUpperCase()}]`;continue}}if(r.m){if(n[c]==="^"){o+=`(^|(?<=[\r
69
+ `);if("message"in e&&typeof e.message==="string")return e.message;try{return JSON.stringify(e)}catch{return String(e)}}return String(e)}function pm(e){return e.description}function fm(e){if(ht(e))return e._zod?.def?.type==="optional";let t=e;if(typeof e.isOptional==="function")return e.isOptional();return t._def?.typeName==="ZodOptional"}function Pr(e){if(ht(e)){let s=e._zod?.def;if(s){if(s.value!==void 0)return s.value;if(Array.isArray(s.values)&&s.values.length>0)return s.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;return}var mm=new WeakSet([Object.prototype,Error.prototype]);function as(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let n=r(this);return Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0})}})}var E$=(e,t)=>{Qd.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);if(mm.has(r))return;mm.add(r),as(r,"format",(n)=>(o)=>tp(n,o)),as(r,"flatten",(n)=>(o)=>ep(n,o)),as(r,"addIssue",(n)=>(o)=>{n.issues.push(o),n.message=JSON.stringify(n.issues,dn,2)}),as(r,"addIssues",(n)=>(o)=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,dn,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})};var He=y("ZodError",E$,void 0,{Parent:Error});var hm=gn(He),gm=_n(He),_m=yn(He),ym=xn(He),vm=np(He),xm=op(He),bm=sp(He),$m=ip(He),wm=ap(He),km=cp(He),Sm=up(He),zm=lp(He);function R$(){if(!Ce.localeError)Ve(La())}function us(){if(!Ce.memoizer)Ve({memoizer:Pf()})}var ue=y("ZodType",(e,t)=>(R$(),ee.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(Ie(t,{checks:[...t.checks??[],...e.map((r)=>typeof r==="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Fe(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(xw(e,t))},superRefine(e,t){return this.check(bw(e,t))},overwrite(e){return this.check(At(e))},optional(){return ce(this)},exactOptional(){return cw(this)},nullable(){return Em(this)},nullish(){return ce(Em(this))},nonoptional(e){return mw(this,e)},array(){return U(this)},or(e){return se([this,e])},and(e){return ls(this,e)},transform(e){return Om(this,Dm(e))},default(e){return dw(this,e)},prefault(e){return fw(this,e)},catch(e){return gw(this,e)},pipe(e){return Om(this,e)},readonly(){return vw(this)},describe(e){let t=this.clone();return tr.add(t,{description:e}),t},meta(...e){if(e.length===0)return tr.get(this);let t=this.clone();return tr.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get "~standard"(){return No(this,"~standard",{...Xi(this),jsonSchema:{input:On(this,"input"),output:On(this,"output")}})},set "~standard"(e){Qe(this,"~standard",e)},parse:function e(t,r){return hm(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await gm(this,t,r,{callee:e})},safeParse(e,t){return _m(this,e,t)},async safeParseAsync(e,t){return ym(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Qe(this,"spa",e)},validate(e,t){return Zo(this,e,t)},validateAsync(e,t){return Mo(this,e,t)},encode:function e(t,r){return vm(this,t,r,{callee:e})},decode:function e(t,r){return xm(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await bm(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await $m(this,t,r,{callee:e})},safeEncode(e,t){return wm(this,e,t)},safeDecode(e,t){return km(this,e,t)},async safeEncodeAsync(e,t){return Sm(this,e,t)},async safeDecodeAsync(e,t){return zm(this,e,t)},toJSONSchema(e){return Zf(this,{})(e)},get description(){return tr.get(this)?.description},get _def(){return this._zod.def}}),Rm=y("_ZodString",(e,t)=>{kn.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zc(e,r,n,o)},Jd({format:(e)=>Ae(e).format??null,minLength:(e)=>Ae(e).minimum??null,maxLength:(e)=>Ae(e).maximum??null},{regex(...e){return this.check(xc(...e))},includes(...e){return this.check(wc(...e))},startsWith(...e){return this.check(kc(...e))},endsWith(...e){return this.check(Sc(...e))},min(...e){return this.check(wr(...e))},max(...e){return this.check(rs(...e))},length(...e){return this.check(ns(...e))},nonempty(...e){return this.check(wr(1,...e))},lowercase(e){return this.check(bc(e))},uppercase(e){return this.check($c(e))},trim(){return this.check(Pc())},normalize(...e){return this.check(zc(...e))},toLowerCase(){return this.check(Tc())},toUpperCase(){return this.check(Ec())},slugify(){return this.check(Oc())}})),I$=y("ZodString",(e,t)=>{kn.init(e,t),Rm.init(e,t)},{email(e){return this.check(Ua(C$,e))},url(e){return this.check(Ga(N$,e))},jwt(e){return this.check(lc(W$,e))},emoji(e){return this.check(Wa(j$,e))},guid(e){return this.check(Va(A$,e))},uuid(e){return this.check(Ha(cs,e))},uuidv4(e){return this.check(Ba(cs,e))},uuidv6(e){return this.check(Ja(cs,e))},uuidv7(e){return this.check(Ka(cs,e))},nanoid(e){return this.check(Xa(Z$,e))},cuid(e){return this.check(Ya(M$,e))},cuid2(e){return this.check(Qa(D$,e))},ulid(e){return this.check(ec(q$,e))},base64(e){return this.check(ac(J$,e))},base64url(e){return this.check(cc(K$,e))},xid(e){return this.check(tc(L$,e))},ksuid(e){return this.check(rc(F$,e))},ipv4(e){return this.check(nc(U$,e))},ipv6(e){return this.check(oc(V$,e))},cidrv4(e){return this.check(sc(H$,e))},cidrv6(e){return this.check(ic(B$,e))},e164(e){return this.check(uc(G$,e))},datetime(e){return this.check(Yo(uu,e))},date(e){return this.check(dc(Im,e))},time(e){return this.check(pc(Cm,e))},duration(e){return this.check(fc(Am,e))}});function g(e){return Fa(I$,e)}var de=y("ZodStringFormat",(e,t)=>{ne.init(e,t),Rm.init(e,t)}),uu=y("ZodISODateTime",(e,t)=>{ff.init(e,t),de.init(e,t)}),Im=y("ZodISODate",(e,t)=>{mf.init(e,t),de.init(e,t)}),Cm=y("ZodISOTime",(e,t)=>{hf.init(e,t),de.init(e,t)}),Am=y("ZodISODuration",(e,t)=>{gf.init(e,t),de.init(e,t)}),C$=y("ZodEmail",(e,t)=>{ea.init(e,t),de.init(e,t)});var A$=y("ZodGUID",(e,t)=>{Yi.init(e,t),de.init(e,t)});var cs=y("ZodUUID",(e,t)=>{Qi.init(e,t),de.init(e,t)});var N$=y("ZodURL",(e,t)=>{ta.init(e,t),de.init(e,t)});var j$=y("ZodEmoji",(e,t)=>{ra.init(e,t),de.init(e,t)});var Z$=y("ZodNanoID",(e,t)=>{na.init(e,t),de.init(e,t)});var M$=y("ZodCUID",(e,t)=>{oa.init(e,t),de.init(e,t)});var D$=y("ZodCUID2",(e,t)=>{sa.init(e,t),de.init(e,t)});var q$=y("ZodULID",(e,t)=>{ia.init(e,t),de.init(e,t)});var L$=y("ZodXID",(e,t)=>{aa.init(e,t),de.init(e,t)});var F$=y("ZodKSUID",(e,t)=>{ca.init(e,t),de.init(e,t)});var U$=y("ZodIPv4",(e,t)=>{ua.init(e,t),de.init(e,t)});var V$=y("ZodIPv6",(e,t)=>{la.init(e,t),de.init(e,t)});var H$=y("ZodCIDRv4",(e,t)=>{da.init(e,t),de.init(e,t)});var B$=y("ZodCIDRv6",(e,t)=>{pa.init(e,t),de.init(e,t)});var J$=y("ZodBase64",(e,t)=>{ma.init(e,t),de.init(e,t)});var K$=y("ZodBase64URL",(e,t)=>{ha.init(e,t),de.init(e,t)});var G$=y("ZodE164",(e,t)=>{ga.init(e,t),de.init(e,t)});var W$=y("ZodJWT",(e,t)=>{_a.init(e,t),de.init(e,t)});var Nm=y("ZodNumber",(e,t)=>{Vo.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Mc(e,r,n,o),e.isFinite=!0},Jd({minValue:(e)=>{let{minimum:t,exclusiveMinimum:r}=Ae(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:(e)=>{let{maximum:t,exclusiveMaximum:r}=Ae(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:(e)=>{let{isInt:t,multipleOf:r}=Ae(e);return!!t||!!r?.some(Number.isSafeInteger)},format:(e)=>Ae(e).format??null},{gt(e,t){return this.check(es(e,t))},gte(e,t){return this.check(Tn(e,t))},min(e,t){return this.check(Tn(e,t))},lt(e,t){return this.check(Qo(e,t))},lte(e,t){return this.check(Pn(e,t))},max(e,t){return this.check(Pn(e,t))},int(e){return this.check(Pm(e))},safe(e){return this.check(Pm(e))},positive(e){return this.check(es(0,e))},nonnegative(e){return this.check(Tn(0,e))},negative(e){return this.check(Qo(0,e))},nonpositive(e){return this.check(Pn(0,e))},multipleOf(e,t){return this.check(ts(e,t))},step(e,t){return this.check(ts(e,t))},finite(){return this}}));function Q(e){return mc(Nm,e)}var X$=y("ZodNumberFormat",(e,t)=>{ya.init(e,t),Nm.init(e,t)});function Pm(e){return hc(X$,e)}var Y$=y("ZodBoolean",(e,t)=>{va.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Dc(e,r,n,o)});function he(e){return gc(Y$,e)}var Q$=y("ZodNull",(e,t)=>{xa.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>qc(e,r,n,o)});function jm(e){return _c(Q$,e)}var ew=y("ZodUnknown",(e,t)=>{ba.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Fc(e,r,n,o)});function ae(){return yc(ew)}var tw=y("ZodNever",(e,t)=>{$a.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Lc(e,r,n,o)});function rw(e){return vc(tw,e)}var nw=y("ZodArray",(e,t)=>{us(),wa.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Jc(e,r,n,o),e.element=t.element},{min(e,t){return this.check(wr(e,t))},nonempty(e){return this.check(wr(1,e))},max(e,t){return this.check(rs(e,t))},length(e,t){return this.check(ns(e,t))},unwrap(){return this.element}});function U(e,t){return Rf(nw,e,t)}var Zm=y("ZodObject",(e,t)=>{us(),bf.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Kc(e,r,n,o),Zi(e,"shape",(r)=>r._zod.def.shape,!1)},{keyof(){return Te(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(Ie(this._zod.def,{catchall:e}))},passthrough(){return this.clone(Ie(this._zod.def,{catchall:ae()}))},loose(){return this.clone(Ie(this._zod.def,{catchall:ae()}))},strict(){return this.clone(Ie(this._zod.def,{catchall:rw()}))},strip(){return this.clone(Ie(this._zod.def,{catchall:void 0}))},extend(e){return Dd(this,e)},safeExtend(e){return Ld(this,e)},merge(e){return Fd(this,e)},pick(e){return Zd(this,e)},omit(e){return Md(this,e)},partial(...e){return Ni(ds,this,e[0])},exactPartial(...e){return Ni(qm,this,e[0],"exactPartial")},required(...e){return Ud(Lm,this,e[0])}});function P(e,t){let r={type:"object",shape:e??{},...T(t)};return new Zm(r)}function Pe(e,t){return new Zm({type:"object",shape:e,catchall:ae(),...T(t)})}var Mm=y("ZodUnion",(e,t)=>{Ho.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Gc(e,r,n,o),e.options=t.options});function se(e,t){return new Mm({type:"union",options:e,...T(t)})}var ow=y("ZodDiscriminatedUnion",(e,t)=>{Mm.init(e,t),Sa.init(e,t)});function lu(e,t,r){return new ow({type:"union",options:t,discriminator:e,...T(r)})}var sw=y("ZodIntersection",(e,t)=>{za.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wc(e,r,n,o)});function ls(e,t){return new sw({type:"intersection",left:e,right:t})}var Tm=y("ZodRecord",(e,t)=>{us(),Pa.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xc(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function oe(e,t,r){if(!t||!t._zod)return new Tm({type:"record",keyType:g(),valueType:e,...T(t)});return new Tm({type:"record",keyType:e,valueType:t,...T(r)})}var cu=y("ZodEnum",(e,t)=>{Ta.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(n,o,s)=>Uc(e,n,o,s),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let s={};for(let i of n)if(r.has(i))s[i]=t.entries[i];else throw Error(`Key ${i} not found in enum`);return new cu({...t,checks:[],...T(o),entries:s})},e.exclude=(n,o)=>{let s={...t.entries};for(let i of n)if(r.has(i))delete s[i];else throw Error(`Key ${i} not found in enum`);return new cu({...t,checks:[],...T(o),entries:s})}});function Te(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((n)=>[n,n])):e;return new cu({type:"enum",entries:r,...T(t)})}var iw=y("ZodLiteral",(e,t)=>{Ea.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Vc(e,r,n,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function I(e,t){return new iw({type:"literal",values:Array.isArray(e)?e:[e],...T(t)})}var aw=y("ZodTransform",(e,t)=>{us(),Oa.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Bc(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new mn(e.constructor.name);r.addIssue=(s)=>{if(typeof s==="string")r.issues.push(er(s,r.value,t));else{let i=s;if(i.fatal)i.continue=!1;if(i.code??(i.code="custom"),!("input"in i))i.input=r.value;i.inst??(i.inst=e),r.issues.push(er(i))}};let o=t.transform(r.value,r);if(o instanceof Promise)return o.then((s)=>(r.value=s,r));return r.value=o,r}});function Dm(e){return new aw({type:"transform",transform:e})}var ds=y("ZodOptional",(e,t)=>{Bo.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>os(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ce(e){return new ds({type:"optional",innerType:e})}var qm=y("ZodExactOptional",(e,t)=>{Ra.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>os(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function cw(e){return new qm({type:"optional",innerType:e})}var uw=y("ZodNullable",(e,t)=>{Ia.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Yc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Em(e){return new uw({type:"nullable",innerType:e})}var lw=y("ZodDefault",(e,t)=>{Ca.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>tu(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function dw(e,t){return new lw({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():Oo(t)}})}var pw=y("ZodPrefault",(e,t)=>{Aa.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ru(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function fw(e,t){return new pw({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():Oo(t)}})}var Lm=y("ZodNonOptional",(e,t)=>{Na.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function mw(e,t){return new Lm({type:"nonoptional",innerType:e,...T(t)})}var hw=y("ZodCatch",(e,t)=>{ja.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>nu(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function gw(e,t){return new hw({type:"catch",innerType:e,catchValue:typeof t==="function"?t:Kd(t)})}var Fm=y("ZodPipe",(e,t)=>{Jo.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ou(e,r,n,o),e.in=t.in,e.out=t.out});function Om(e,t){return new Fm({type:"pipe",in:e,out:t})}var _w=y("ZodPreprocess",(e,t)=>{Fm.init(e,t),$f.init(e,t)}),yw=y("ZodReadonly",(e,t)=>{Za.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>su(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function vw(e){return new yw({type:"readonly",innerType:e})}var Um=y("ZodCustom",(e,t)=>{Ma.init(e,t),ue.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hc(e,r,n,o)});function Vm(e,t){return Rc(Um,e??(()=>!0),t)}function xw(e,t={}){return Ic(Um,e,t)}function bw(e,t){return Cc(e,t)}function du(e,t){return new _w({type:"pipe",in:Dm(e),out:t})}function $w(e){return Yo(uu,e)}var pu="2025-11-25";var Jm=[pu,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Zt="io.modelcontextprotocol/related-task",fs="2.0",ge=Vm((e)=>e!==null&&(typeof e==="object"||typeof e==="function")),Km=se([g(),Q().int()]),Gm=g(),ej=Pe({ttl:Q().optional(),pollInterval:Q().optional()}),ww=P({ttl:Q().optional()}),kw=P({taskId:g()}),fu=Pe({progressToken:Km.optional(),[Zt]:kw.optional()}),Be=P({_meta:fu.optional()}),Nn=Be.extend({task:ww.optional()}),Wm=(e)=>Nn.safeParse(e).success,ve=P({method:g(),params:Be.loose().optional()}),Je=P({_meta:fu.optional()}),Ke=P({method:g(),params:Je.loose().optional()}),xe=Pe({_meta:fu.optional()}),ms=se([g(),Q().int()]),Xm=P({jsonrpc:I(fs),id:ms,...ve.shape}).strict(),mu=(e)=>Xm.safeParse(e).success,Ym=P({jsonrpc:I(fs),...Ke.shape}).strict(),Qm=(e)=>Ym.safeParse(e).success,hu=P({jsonrpc:I(fs),id:ms,result:xe}).strict(),jn=(e)=>hu.safeParse(e).success;var N;(function(e){e[e.ConnectionClosed=-32000]="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"})(N||(N={}));var gu=P({jsonrpc:I(fs),id:ms.optional(),error:P({code:Q().int(),message:g(),data:ae().optional()})}).strict();var eh=(e)=>gu.safeParse(e).success;var th=se([Xm,Ym,hu,gu]),tj=se([hu,gu]),hs=xe.strict(),Sw=Je.extend({requestId:ms.optional(),reason:g().optional()}),gs=Ke.extend({method:I("notifications/cancelled"),params:Sw}),zw=P({src:g(),mimeType:g().optional(),sizes:U(g()).optional(),theme:Te(["light","dark"]).optional()}),Zn=P({icons:U(zw).optional()}),Tr=P({name:g(),title:g().optional()}),rh=Tr.extend({...Tr.shape,...Zn.shape,version:g(),websiteUrl:g().optional(),description:g().optional()}),Pw=ls(P({applyDefaults:he().optional()}),oe(g(),ae())),Tw=du((e)=>{if(e&&typeof e==="object"&&!Array.isArray(e)){if(Object.keys(e).length===0)return{form:{}}}return e},ls(P({form:Pw.optional(),url:ge.optional()}),oe(g(),ae()).optional())),Ew=Pe({list:ge.optional(),cancel:ge.optional(),requests:Pe({sampling:Pe({createMessage:ge.optional()}).optional(),elicitation:Pe({create:ge.optional()}).optional()}).optional()}),Ow=Pe({list:ge.optional(),cancel:ge.optional(),requests:Pe({tools:Pe({call:ge.optional()}).optional()}).optional()}),Rw=P({experimental:oe(g(),ge).optional(),sampling:P({context:ge.optional(),tools:ge.optional()}).optional(),elicitation:Tw.optional(),roots:P({listChanged:he().optional()}).optional(),tasks:Ew.optional(),extensions:oe(g(),ge).optional()}),Iw=Be.extend({protocolVersion:g(),capabilities:Rw,clientInfo:rh}),_u=ve.extend({method:I("initialize"),params:Iw});var Cw=P({experimental:oe(g(),ge).optional(),logging:ge.optional(),completions:ge.optional(),prompts:P({listChanged:he().optional()}).optional(),resources:P({subscribe:he().optional(),listChanged:he().optional()}).optional(),tools:P({listChanged:he().optional()}).optional(),tasks:Ow.optional(),extensions:oe(g(),ge).optional()}),Aw=xe.extend({protocolVersion:g(),capabilities:Cw,serverInfo:rh,instructions:g().optional()}),yu=Ke.extend({method:I("notifications/initialized"),params:Je.optional()});var _s=ve.extend({method:I("ping"),params:Be.optional()}),Nw=P({progress:Q(),total:ce(Q()),message:ce(g())}),jw=P({...Je.shape,...Nw.shape,progressToken:Km}),ys=Ke.extend({method:I("notifications/progress"),params:jw}),Zw=Be.extend({cursor:Gm.optional()}),Mn=ve.extend({params:Zw.optional()}),Dn=xe.extend({nextCursor:Gm.optional()}),Mw=Te(["working","input_required","completed","failed","cancelled"]),qn=P({taskId:g(),status:Mw,ttl:se([Q(),jm()]),createdAt:g(),lastUpdatedAt:g(),pollInterval:ce(Q()),statusMessage:ce(g())}),Er=xe.extend({task:qn}),Dw=Je.merge(qn),Ln=Ke.extend({method:I("notifications/tasks/status"),params:Dw}),vs=ve.extend({method:I("tasks/get"),params:Be.extend({taskId:g()})}),xs=xe.merge(qn),bs=ve.extend({method:I("tasks/result"),params:Be.extend({taskId:g()})}),rj=xe.loose(),$s=Mn.extend({method:I("tasks/list")}),ws=Dn.extend({tasks:U(qn)}),ks=ve.extend({method:I("tasks/cancel"),params:Be.extend({taskId:g()})}),nh=xe.merge(qn),oh=P({uri:g(),mimeType:ce(g()),_meta:oe(g(),ae()).optional()}),sh=oh.extend({text:g()}),vu=g().refine((e)=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),ih=oh.extend({blob:vu}),Fn=Te(["user","assistant"]),Or=P({audience:U(Fn).optional(),priority:Q().min(0).max(1).optional(),lastModified:$w({offset:!0}).optional()}),ah=P({...Tr.shape,...Zn.shape,uri:g(),description:ce(g()),mimeType:ce(g()),size:ce(Q()),annotations:Or.optional(),_meta:ce(Pe({}))}),qw=P({...Tr.shape,...Zn.shape,uriTemplate:g(),description:ce(g()),mimeType:ce(g()),annotations:Or.optional(),_meta:ce(Pe({}))}),Ss=Mn.extend({method:I("resources/list")}),Lw=Dn.extend({resources:U(ah)}),zs=Mn.extend({method:I("resources/templates/list")}),Fw=Dn.extend({resourceTemplates:U(qw)}),xu=Be.extend({uri:g()}),Uw=xu,Ps=ve.extend({method:I("resources/read"),params:Uw}),Vw=xe.extend({contents:U(se([sh,ih]))}),Hw=Ke.extend({method:I("notifications/resources/list_changed"),params:Je.optional()}),Bw=xu,Jw=ve.extend({method:I("resources/subscribe"),params:Bw}),Kw=xu,Gw=ve.extend({method:I("resources/unsubscribe"),params:Kw}),Ww=Je.extend({uri:g()}),Xw=Ke.extend({method:I("notifications/resources/updated"),params:Ww}),Yw=P({name:g(),description:ce(g()),required:ce(he())}),Qw=P({...Tr.shape,...Zn.shape,description:ce(g()),arguments:ce(U(Yw)),_meta:ce(Pe({}))}),Ts=Mn.extend({method:I("prompts/list")}),ek=Dn.extend({prompts:U(Qw)}),tk=Be.extend({name:g(),arguments:oe(g(),g()).optional()}),Es=ve.extend({method:I("prompts/get"),params:tk}),bu=P({type:I("text"),text:g(),annotations:Or.optional(),_meta:oe(g(),ae()).optional()}),$u=P({type:I("image"),data:vu,mimeType:g(),annotations:Or.optional(),_meta:oe(g(),ae()).optional()}),wu=P({type:I("audio"),data:vu,mimeType:g(),annotations:Or.optional(),_meta:oe(g(),ae()).optional()}),rk=P({type:I("tool_use"),name:g(),id:g(),input:oe(g(),ae()),_meta:oe(g(),ae()).optional()}),nk=P({type:I("resource"),resource:se([sh,ih]),annotations:Or.optional(),_meta:oe(g(),ae()).optional()}),ok=ah.extend({type:I("resource_link")}),ku=se([bu,$u,wu,ok,nk]),sk=P({role:Fn,content:ku}),ik=xe.extend({description:g().optional(),messages:U(sk)}),ak=Ke.extend({method:I("notifications/prompts/list_changed"),params:Je.optional()}),ck=P({title:g().optional(),readOnlyHint:he().optional(),destructiveHint:he().optional(),idempotentHint:he().optional(),openWorldHint:he().optional()}),uk=P({taskSupport:Te(["required","optional","forbidden"]).optional()}),ch=P({...Tr.shape,...Zn.shape,description:g().optional(),inputSchema:P({type:I("object"),properties:oe(g(),ge).optional(),required:U(g()).optional()}).catchall(ae()),outputSchema:P({type:I("object"),properties:oe(g(),ge).optional(),required:U(g()).optional()}).catchall(ae()).optional(),annotations:ck.optional(),execution:uk.optional(),_meta:oe(g(),ae()).optional()}),Os=Mn.extend({method:I("tools/list")}),lk=Dn.extend({tools:U(ch)}),Rs=xe.extend({content:U(ku).default([]),structuredContent:oe(g(),ae()).optional(),isError:he().optional()}),nj=Rs.or(xe.extend({toolResult:ae()})),dk=Nn.extend({name:g(),arguments:oe(g(),ae()).optional()}),Rr=ve.extend({method:I("tools/call"),params:dk}),pk=Ke.extend({method:I("notifications/tools/list_changed"),params:Je.optional()}),oj=P({autoRefresh:he().default(!0),debounceMs:Q().int().nonnegative().default(300)}),Un=Te(["debug","info","notice","warning","error","critical","alert","emergency"]),fk=Be.extend({level:Un}),Su=ve.extend({method:I("logging/setLevel"),params:fk}),mk=Je.extend({level:Un,logger:g().optional(),data:ae()}),hk=Ke.extend({method:I("notifications/message"),params:mk}),gk=P({name:g().optional()}),_k=P({hints:U(gk).optional(),costPriority:Q().min(0).max(1).optional(),speedPriority:Q().min(0).max(1).optional(),intelligencePriority:Q().min(0).max(1).optional()}),yk=P({mode:Te(["auto","required","none"]).optional()}),vk=P({type:I("tool_result"),toolUseId:g().describe("The unique identifier for the corresponding tool call."),content:U(ku).default([]),structuredContent:P({}).loose().optional(),isError:he().optional(),_meta:oe(g(),ae()).optional()}),xk=lu("type",[bu,$u,wu]),ps=lu("type",[bu,$u,wu,rk,vk]),bk=P({role:Fn,content:se([ps,U(ps)]),_meta:oe(g(),ae()).optional()}),$k=Nn.extend({messages:U(bk),modelPreferences:_k.optional(),systemPrompt:g().optional(),includeContext:Te(["none","thisServer","allServers"]).optional(),temperature:Q().optional(),maxTokens:Q().int(),stopSequences:U(g()).optional(),metadata:ge.optional(),tools:U(ch).optional(),toolChoice:yk.optional()}),wk=ve.extend({method:I("sampling/createMessage"),params:$k}),Vn=xe.extend({model:g(),stopReason:ce(Te(["endTurn","stopSequence","maxTokens"]).or(g())),role:Fn,content:xk}),zu=xe.extend({model:g(),stopReason:ce(Te(["endTurn","stopSequence","maxTokens","toolUse"]).or(g())),role:Fn,content:se([ps,U(ps)])}),kk=P({type:I("boolean"),title:g().optional(),description:g().optional(),default:he().optional()}),Sk=P({type:I("string"),title:g().optional(),description:g().optional(),minLength:Q().optional(),maxLength:Q().optional(),format:Te(["email","uri","date","date-time"]).optional(),default:g().optional()}),zk=P({type:Te(["number","integer"]),title:g().optional(),description:g().optional(),minimum:Q().optional(),maximum:Q().optional(),default:Q().optional()}),Pk=P({type:I("string"),title:g().optional(),description:g().optional(),enum:U(g()),default:g().optional()}),Tk=P({type:I("string"),title:g().optional(),description:g().optional(),oneOf:U(P({const:g(),title:g()})),default:g().optional()}),Ek=P({type:I("string"),title:g().optional(),description:g().optional(),enum:U(g()),enumNames:U(g()).optional(),default:g().optional()}),Ok=se([Pk,Tk]),Rk=P({type:I("array"),title:g().optional(),description:g().optional(),minItems:Q().optional(),maxItems:Q().optional(),items:P({type:I("string"),enum:U(g())}),default:U(g()).optional()}),Ik=P({type:I("array"),title:g().optional(),description:g().optional(),minItems:Q().optional(),maxItems:Q().optional(),items:P({anyOf:U(P({const:g(),title:g()}))}),default:U(g()).optional()}),Ck=se([Rk,Ik]),Ak=se([Ek,Ok,Ck]),Nk=se([Ak,kk,Sk,zk]),jk=Nn.extend({mode:I("form").optional(),message:g(),requestedSchema:P({type:I("object"),properties:oe(g(),Nk),required:U(g()).optional()})}),Zk=Nn.extend({mode:I("url"),message:g(),elicitationId:g(),url:g().url()}),Mk=se([jk,Zk]),Dk=ve.extend({method:I("elicitation/create"),params:Mk}),qk=Je.extend({elicitationId:g()}),Lk=Ke.extend({method:I("notifications/elicitation/complete"),params:qk}),Ir=xe.extend({action:Te(["accept","decline","cancel"]),content:du((e)=>e===null?void 0:e,oe(g(),se([g(),Q(),he(),U(g())])).optional())}),Fk=P({type:I("ref/resource"),uri:g()});var Uk=P({type:I("ref/prompt"),name:g()}),Vk=Be.extend({ref:se([Uk,Fk]),argument:P({name:g(),value:g()}),context:P({arguments:oe(g(),g()).optional()}).optional()}),Is=ve.extend({method:I("completion/complete"),params:Vk});function uh(e){if(e.params.ref.type!=="ref/prompt")throw TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`)}function lh(e){if(e.params.ref.type!=="ref/resource")throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`)}var Hk=xe.extend({completion:Pe({values:U(g()).max(100),total:ce(Q().int()),hasMore:ce(he())})}),Bk=P({uri:g().startsWith("file://"),name:g().optional(),_meta:oe(g(),ae()).optional()}),Jk=ve.extend({method:I("roots/list"),params:Be.optional()}),Pu=xe.extend({roots:U(Bk)}),Kk=Ke.extend({method:I("notifications/roots/list_changed"),params:Je.optional()}),sj=se([_s,_u,Is,Su,Es,Ts,Ss,zs,Ps,Jw,Gw,Rr,Os,vs,bs,$s,ks]),ij=se([gs,ys,yu,Kk,Ln]),aj=se([hs,Vn,zu,Ir,Pu,xs,ws,Er]),cj=se([_s,wk,Dk,Jk,vs,bs,$s,ks]),uj=se([gs,ys,hk,Xw,Hw,pk,ak,Ln,Lk]),lj=se([hs,Aw,Hk,ik,ek,Lw,Fw,Vw,Rs,lk,xs,ws,Er]);class R extends Error{constructor(e,t,r){super(`MCP error ${e}: ${t}`);this.code=e,this.data=r,this.name="McpError"}static fromError(e,t,r){if(e===N.UrlElicitationRequired&&r){let n=r;if(n.elicitations)return new dh(n.elicitations,t)}return new R(e,t,r)}}class dh extends R{constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(N.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}}function Mt(e){return e==="completed"||e==="failed"||e==="cancelled"}var fh=Symbol("Let zodToJsonSchema decide on which parser to use");var ph={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},mh=(e)=>typeof e==="string"?{...ph,name:e}:{...ph,...e};var hh=(e)=>{let t=mh(e),r=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([n,o])=>[o._def,{def:o._def,path:[...t.basePath,t.definitionPath,n],jsonSchema:void 0}]))}};function Tu(e,t,r,n){if(!n?.errorMessages)return;if(r)e.errorMessage={...e.errorMessage,[t]:r}}function J(e,t,r,n,o){e[t]=r,Tu(e,t,n,o)}var Cs=(e,t)=>{let r=0;for(;r<e.length&&r<t.length;r++)if(e[r]!==t[r])break;return[(e.length-r).toString(),...t.slice(r)].join("/")};function le(e){if(e.target!=="openAi")return{};let t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:e.$refStrategy==="relative"?Cs(t,e.currentPath):t.join("/")}}function gh(e,t){let r={type:"array"};if(e.type?._def&&e.type?._def?.typeName!==b.ZodAny)r.items=Z(e.type._def,{...t,currentPath:[...t.currentPath,"items"]});if(e.minLength)J(r,"minItems",e.minLength.value,e.minLength.message,t);if(e.maxLength)J(r,"maxItems",e.maxLength.value,e.maxLength.message,t);if(e.exactLength)J(r,"minItems",e.exactLength.value,e.exactLength.message,t),J(r,"maxItems",e.exactLength.value,e.exactLength.message,t);return r}function _h(e,t){let r={type:"integer",format:"int64"};if(!e.checks)return r;for(let n of e.checks)switch(n.kind){case"min":if(t.target==="jsonSchema7")if(n.inclusive)J(r,"minimum",n.value,n.message,t);else J(r,"exclusiveMinimum",n.value,n.message,t);else{if(!n.inclusive)r.exclusiveMinimum=!0;J(r,"minimum",n.value,n.message,t)}break;case"max":if(t.target==="jsonSchema7")if(n.inclusive)J(r,"maximum",n.value,n.message,t);else J(r,"exclusiveMaximum",n.value,n.message,t);else{if(!n.inclusive)r.exclusiveMaximum=!0;J(r,"maximum",n.value,n.message,t)}break;case"multipleOf":J(r,"multipleOf",n.value,n.message,t);break}return r}function yh(){return{type:"boolean"}}function As(e,t){return Z(e.type._def,t)}var vh=(e,t)=>Z(e.innerType._def,t);function Eu(e,t,r){let n=r??t.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,s)=>Eu(e,t,o))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return Gk(e,t)}}var Gk=(e,t)=>{let r={type:"integer",format:"unix-time"};if(t.target==="openApi3")return r;for(let n of e.checks)switch(n.kind){case"min":J(r,"minimum",n.value,n.message,t);break;case"max":J(r,"maximum",n.value,n.message,t);break}return r};function xh(e,t){return{...Z(e.innerType._def,t),default:e.defaultValue()}}function bh(e,t){return t.effectStrategy==="input"?Z(e.schema._def,t):le(t)}function $h(e){return{type:"string",enum:Array.from(e.values)}}var Wk=(e)=>{if("type"in e&&e.type==="string")return!1;return"allOf"in e};function wh(e,t){let r=[Z(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),Z(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter((s)=>!!s),n=t.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,o=[];return r.forEach((s)=>{if(Wk(s)){if(o.push(...s.allOf),s.unevaluatedProperties===void 0)n=void 0}else{let i=s;if("additionalProperties"in s&&s.additionalProperties===!1){let{additionalProperties:a,...c}=s;i=c}else n=void 0;o.push(i)}}),o.length?{allOf:o,...n}:void 0}function kh(e,t){let r=typeof e.value;if(r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string")return{type:Array.isArray(e.value)?"array":"object"};if(t.target==="openApi3")return{type:r==="bigint"?"integer":r,enum:[e.value]};return{type:r==="bigint"?"integer":r,const:e.value}}var Ou=void 0,et={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>{if(Ou===void 0)Ou=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u");return Ou},uuid:/^[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}$/,ipv4:/^(?:(?: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])$/,ipv4Cidr:/^(?:(?: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])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([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])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function Ns(e,t){let r={type:"string"};if(e.checks)for(let n of e.checks)switch(n.kind){case"min":J(r,"minLength",typeof r.minLength==="number"?Math.max(r.minLength,n.value):n.value,n.message,t);break;case"max":J(r,"maxLength",typeof r.maxLength==="number"?Math.min(r.maxLength,n.value):n.value,n.message,t);break;case"email":switch(t.emailStrategy){case"format:email":tt(r,"email",n.message,t);break;case"format:idn-email":tt(r,"idn-email",n.message,t);break;case"pattern:zod":Ee(r,et.email,n.message,t);break}break;case"url":tt(r,"uri",n.message,t);break;case"uuid":tt(r,"uuid",n.message,t);break;case"regex":Ee(r,n.regex,n.message,t);break;case"cuid":Ee(r,et.cuid,n.message,t);break;case"cuid2":Ee(r,et.cuid2,n.message,t);break;case"startsWith":Ee(r,RegExp(`^${Ru(n.value,t)}`),n.message,t);break;case"endsWith":Ee(r,RegExp(`${Ru(n.value,t)}$`),n.message,t);break;case"datetime":tt(r,"date-time",n.message,t);break;case"date":tt(r,"date",n.message,t);break;case"time":tt(r,"time",n.message,t);break;case"duration":tt(r,"duration",n.message,t);break;case"length":J(r,"minLength",typeof r.minLength==="number"?Math.max(r.minLength,n.value):n.value,n.message,t),J(r,"maxLength",typeof r.maxLength==="number"?Math.min(r.maxLength,n.value):n.value,n.message,t);break;case"includes":{Ee(r,RegExp(Ru(n.value,t)),n.message,t);break}case"ip":{if(n.version!=="v6")tt(r,"ipv4",n.message,t);if(n.version!=="v4")tt(r,"ipv6",n.message,t);break}case"base64url":Ee(r,et.base64url,n.message,t);break;case"jwt":Ee(r,et.jwt,n.message,t);break;case"cidr":{if(n.version!=="v6")Ee(r,et.ipv4Cidr,n.message,t);if(n.version!=="v4")Ee(r,et.ipv6Cidr,n.message,t);break}case"emoji":Ee(r,et.emoji(),n.message,t);break;case"ulid":{Ee(r,et.ulid,n.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{tt(r,"binary",n.message,t);break}case"contentEncoding:base64":{J(r,"contentEncoding","base64",n.message,t);break}case"pattern:zod":{Ee(r,et.base64,n.message,t);break}}break}case"nanoid":Ee(r,et.nanoid,n.message,t);case"toLowerCase":case"toUpperCase":case"trim":break;default:((o)=>{})(n)}return r}function Ru(e,t){return t.patternStrategy==="escape"?Yk(e):e}var Xk=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Yk(e){let t="";for(let r=0;r<e.length;r++){if(!Xk.has(e[r]))t+="\\";t+=e[r]}return t}function tt(e,t,r,n){if(e.format||e.anyOf?.some((o)=>o.format)){if(!e.anyOf)e.anyOf=[];if(e.format){if(e.anyOf.push({format:e.format,...e.errorMessage&&n.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage){if(delete e.errorMessage.format,Object.keys(e.errorMessage).length===0)delete e.errorMessage}}e.anyOf.push({format:t,...r&&n.errorMessages&&{errorMessage:{format:r}}})}else J(e,"format",t,r,n)}function Ee(e,t,r,n){if(e.pattern||e.allOf?.some((o)=>o.pattern)){if(!e.allOf)e.allOf=[];if(e.pattern){if(e.allOf.push({pattern:e.pattern,...e.errorMessage&&n.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage){if(delete e.errorMessage.pattern,Object.keys(e.errorMessage).length===0)delete e.errorMessage}}e.allOf.push({pattern:Sh(t,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})}else J(e,"pattern",Sh(t,n),r,n)}function Sh(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let r={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},n=r.i?e.source.toLowerCase():e.source,o="",s=!1,i=!1,a=!1;for(let c=0;c<n.length;c++){if(s){o+=n[c],s=!1;continue}if(r.i){if(i){if(n[c].match(/[a-z]/)){if(a)o+=n[c],o+=`${n[c-2]}-${n[c]}`.toUpperCase(),a=!1;else if(n[c+1]==="-"&&n[c+2]?.match(/[a-z]/))o+=n[c],a=!0;else o+=`${n[c]}${n[c].toUpperCase()}`;continue}}else if(n[c].match(/[a-z]/)){o+=`[${n[c]}${n[c].toUpperCase()}]`;continue}}if(r.m){if(n[c]==="^"){o+=`(^|(?<=[\r
70
70
  ]))`;continue}else if(n[c]==="$"){o+=`($|(?=[\r
71
71
  ]))`;continue}}if(r.s&&n[c]==="."){o+=i?`${n[c]}\r
72
72
  `:`[${n[c]}\r
73
- ]`;continue}if(o+=n[c],n[c]==="\\")s=!0;else if(i&&n[c]==="]")i=!1;else if(!i&&n[c]==="[")i=!0}try{new RegExp(o)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return o}function js(e,t){if(t.target==="openAi")console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");if(t.target==="openApi3"&&e.keyType?._def.typeName===b.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((n,o)=>({...n,[o]:Z(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",o]})??le(t)}),{}),additionalProperties:t.rejectedAdditionalProperties};let r={type:"object",additionalProperties:Z(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??t.allowedAdditionalProperties};if(t.target==="openApi3")return r;if(e.keyType?._def.typeName===b.ZodString&&e.keyType._def.checks?.length){let{type:n,...o}=Ns(e.keyType._def,t);return{...r,propertyNames:o}}else if(e.keyType?._def.typeName===b.ZodEnum)return{...r,propertyNames:{enum:e.keyType._def.values}};else if(e.keyType?._def.typeName===b.ZodBranded&&e.keyType._def.type._def.typeName===b.ZodString&&e.keyType._def.type._def.checks?.length){let{type:n,...o}=As(e.keyType._def,t);return{...r,propertyNames:o}}return r}function zh(e,t){if(t.mapStrategy==="record")return js(e,t);let r=Z(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||le(t),n=Z(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||le(t);return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}function Ph(e){let t=e.values,n=Object.keys(e.values).filter((s)=>typeof t[t[s]]!=="number").map((s)=>t[s]),o=Array.from(new Set(n.map((s)=>typeof s)));return{type:o.length===1?o[0]==="string"?"string":"number":["string","number"],enum:n}}function Th(e){return e.target==="openAi"?void 0:{not:le({...e,currentPath:[...e.currentPath,"not"]})}}function Eh(e){return e.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var Hn={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Rh(e,t){if(t.target==="openApi3")return Oh(e,t);let r=e.options instanceof Map?Array.from(e.options.values()):e.options;if(r.every((n)=>(n._def.typeName in Hn)&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,s)=>{let i=Hn[s._def.typeName];return i&&!o.includes(i)?[...o,i]:o},[]);return{type:n.length>1?n:n[0]}}else if(r.every((n)=>n._def.typeName==="ZodLiteral"&&!n.description)){let n=r.reduce((o,s)=>{let i=typeof s._def.value;switch(i){case"string":case"number":case"boolean":return[...o,i];case"bigint":return[...o,"integer"];case"object":if(s._def.value===null)return[...o,"null"];case"symbol":case"undefined":case"function":default:return o}},[]);if(n.length===r.length){let o=n.filter((s,i,a)=>a.indexOf(s)===i);return{type:o.length>1?o:o[0],enum:r.reduce((s,i)=>s.includes(i._def.value)?s:[...s,i._def.value],[])}}}else if(r.every((n)=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,o)=>[...n,...o._def.values.filter((s)=>!n.includes(s))],[])};return Oh(e,t)}var Oh=(e,t)=>{let r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((n,o)=>Z(n._def,{...t,currentPath:[...t.currentPath,"anyOf",`${o}`]})).filter((n)=>!!n&&(!t.strictUnions||typeof n==="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0};function Ih(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length)){if(t.target==="openApi3")return{type:Hn[e.innerType._def.typeName],nullable:!0};return{type:[Hn[e.innerType._def.typeName],"null"]}}if(t.target==="openApi3"){let n=Z(e.innerType._def,{...t,currentPath:[...t.currentPath]});if(n&&"$ref"in n)return{allOf:[n],nullable:!0};return n&&{...n,nullable:!0}}let r=Z(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function Ch(e,t){let r={type:"number"};if(!e.checks)return r;for(let n of e.checks)switch(n.kind){case"int":r.type="integer",Tu(r,"type",n.message,t);break;case"min":if(t.target==="jsonSchema7")if(n.inclusive)B(r,"minimum",n.value,n.message,t);else B(r,"exclusiveMinimum",n.value,n.message,t);else{if(!n.inclusive)r.exclusiveMinimum=!0;B(r,"minimum",n.value,n.message,t)}break;case"max":if(t.target==="jsonSchema7")if(n.inclusive)B(r,"maximum",n.value,n.message,t);else B(r,"exclusiveMaximum",n.value,n.message,t);else{if(!n.inclusive)r.exclusiveMaximum=!0;B(r,"maximum",n.value,n.message,t)}break;case"multipleOf":B(r,"multipleOf",n.value,n.message,t);break}return r}function Ah(e,t){let r=t.target==="openAi",n={type:"object",properties:{}},o=[],s=e.shape();for(let a in s){let c=s[a];if(c===void 0||c._def===void 0)continue;let u=eS(c);if(u&&r){if(c._def.typeName==="ZodOptional")c=c._def.innerType;if(!c.isNullable())c=c.nullable();u=!1}let l=Z(c._def,{...t,currentPath:[...t.currentPath,"properties",a],propertyPath:[...t.currentPath,"properties",a]});if(l===void 0)continue;if(n.properties[a]=l,!u)o.push(a)}if(o.length)n.required=o;let i=Qk(e,t);if(i!==void 0)n.additionalProperties=i;return n}function Qk(e,t){if(e.catchall._def.typeName!=="ZodNever")return Z(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return t.removeAdditionalStrategy==="strict"?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function eS(e){try{return e.isOptional()}catch{return!0}}var Nh=(e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return Z(e.innerType._def,t);let r=Z(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return r?{anyOf:[{not:le(t)},r]}:le(t)};var jh=(e,t)=>{if(t.pipeStrategy==="input")return Z(e.in._def,t);else if(t.pipeStrategy==="output")return Z(e.out._def,t);let r=Z(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),n=Z(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter((o)=>o!==void 0)}};function Zh(e,t){return Z(e.type._def,t)}function Mh(e,t){let n={type:"array",uniqueItems:!0,items:Z(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};if(e.minSize)B(n,"minItems",e.minSize.value,e.minSize.message,t);if(e.maxSize)B(n,"maxItems",e.maxSize.value,e.maxSize.message,t);return n}function Dh(e,t){if(e.rest)return{type:"array",minItems:e.items.length,items:e.items.map((r,n)=>Z(r._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:Z(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})};else return{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((r,n)=>Z(r._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}function qh(e){return{not:le(e)}}function Lh(e){return le(e)}var Fh=(e,t)=>Z(e.innerType._def,t);var Uh=(e,t,r)=>{switch(t){case b.ZodString:return Ns(e,r);case b.ZodNumber:return Ch(e,r);case b.ZodObject:return Ah(e,r);case b.ZodBigInt:return _h(e,r);case b.ZodBoolean:return yh();case b.ZodDate:return Eu(e,r);case b.ZodUndefined:return qh(r);case b.ZodNull:return Eh(r);case b.ZodArray:return gh(e,r);case b.ZodUnion:case b.ZodDiscriminatedUnion:return Rh(e,r);case b.ZodIntersection:return wh(e,r);case b.ZodTuple:return Dh(e,r);case b.ZodRecord:return js(e,r);case b.ZodLiteral:return kh(e,r);case b.ZodEnum:return $h(e);case b.ZodNativeEnum:return Ph(e);case b.ZodNullable:return Ih(e,r);case b.ZodOptional:return Nh(e,r);case b.ZodMap:return zh(e,r);case b.ZodSet:return Mh(e,r);case b.ZodLazy:return()=>e.getter()._def;case b.ZodPromise:return Zh(e,r);case b.ZodNaN:case b.ZodNever:return Th(r);case b.ZodEffects:return bh(e,r);case b.ZodAny:return le(r);case b.ZodUnknown:return Lh(r);case b.ZodDefault:return xh(e,r);case b.ZodBranded:return As(e,r);case b.ZodReadonly:return Fh(e,r);case b.ZodCatch:return vh(e,r);case b.ZodPipeline:return jh(e,r);case b.ZodFunction:case b.ZodVoid:case b.ZodSymbol:return;default:return((n)=>{return})(t)}};function Z(e,t,r=!1){let n=t.seen.get(e);if(t.override){let a=t.override?.(e,t,n,r);if(a!==fh)return a}if(n&&!r){let a=tS(n,t);if(a!==void 0)return a}let o={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,o);let s=Uh(e,e.typeName,t),i=typeof s==="function"?Z(s(),t):s;if(i)rS(e,t,i);if(t.postProcess){let a=t.postProcess(i,e,t);return o.jsonSchema=i,a}return o.jsonSchema=i,i}var tS=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:Cs(t.currentPath,e.path)};case"none":case"seen":{if(e.path.length<t.currentPath.length&&e.path.every((r,n)=>t.currentPath[n]===r))return console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),le(t);return t.$refStrategy==="seen"?le(t):void 0}}},rS=(e,t,r)=>{if(e.description){if(r.description=e.description,t.markdownDescription)r.markdownDescription=e.description}return r};var Iu=(e,t)=>{let r=hh(t),n=typeof t==="object"&&t.definitions?Object.entries(t.definitions).reduce((c,[u,l])=>({...c,[u]:Z(l._def,{...r,currentPath:[...r.basePath,r.definitionPath,u]},!0)??le(r)}),{}):void 0,o=typeof t==="string"?t:t?.nameStrategy==="title"?void 0:t?.name,s=Z(e._def,o===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,o]},!1)??le(r),i=typeof t==="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;if(i!==void 0)s.title=i;if(r.flags.hasReferencedOpenAiAnyType){if(!n)n={};if(!n[r.openAiAnyTypeName])n[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:r.$refStrategy==="relative"?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}}let a=o===void 0?n?{...s,[r.definitionPath]:n}:s:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,o].join("/"),[r.definitionPath]:{...n,[o]:s}};if(r.target==="jsonSchema7")a.$schema="http://json-schema.org/draft-07/schema#";else if(r.target==="jsonSchema2019-09"||r.target==="openAi")a.$schema="https://json-schema.org/draft/2019-09/schema#";if(r.target==="openAi"&&(("anyOf"in a)||("oneOf"in a)||("allOf"in a)||("type"in a)&&Array.isArray(a.type)))console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.");return a};function nS(e){if(!e)return"draft-7";if(e==="jsonSchema7"||e==="draft-7")return"draft-7";if(e==="jsonSchema2019-09"||e==="draft-2020-12")return"draft-2020-12";return"draft-7"}function Cu(e,t){if(ht(e))return iu(e,{target:nS(t?.target),io:t?.pipeStrategy??"input"});return Iu(e,{strictUnions:t?.strictUnions??!0,pipeStrategy:t?.pipeStrategy??"input"})}function Au(e){let r=jt(e)?.method;if(!r)throw Error("Schema is missing a method literal");let n=Pr(r);if(typeof n!=="string")throw Error("Schema method literal must be a string");return n}function Nu(e,t){let r=Nt(e,t);if(!r.success)throw r.error;return r.data}var oS=60000;class ju{constructor(e){if(this._options=e,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(gs,(t)=>{this._oncancel(t)}),this.setNotificationHandler(ys,(t)=>{this._onprogress(t)}),this.setRequestHandler(_s,(t)=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore)this.setRequestHandler(vs,async(t,r)=>{let n=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!n)throw new R(N.InvalidParams,"Failed to retrieve task: Task not found");return{...n}}),this.setRequestHandler(bs,async(t,r)=>{let n=async()=>{let o=t.params.taskId;if(this._taskMessageQueue){let i;while(i=await this._taskMessageQueue.dequeue(o,r.sessionId)){if(i.type==="response"||i.type==="error"){let a=i.message,c=a.id,u=this._requestResolvers.get(c);if(u)if(this._requestResolvers.delete(c),i.type==="response")u(a);else{let l=a,d=new R(l.error.code,l.error.message,l.error.data);u(d)}else{let l=i.type==="response"?"Response":"Error";this._onerror(Error(`${l} handler missing for request ${c}`))}continue}await this._transport?.send(i.message,{relatedRequestId:r.requestId})}}let s=await this._taskStore.getTask(o,r.sessionId);if(!s)throw new R(N.InvalidParams,`Task not found: ${o}`);if(!Mt(s.status))return await this._waitForTaskUpdate(o,r.signal),await n();if(Mt(s.status)){let i=await this._taskStore.getTaskResult(o,r.sessionId);return this._clearTaskQueue(o),{...i,_meta:{...i._meta,[Zt]:{taskId:o}}}}return await n()};return await n()}),this.setRequestHandler($s,async(t,r)=>{try{let{tasks:n,nextCursor:o}=await this._taskStore.listTasks(t.params?.cursor,r.sessionId);return{tasks:n,nextCursor:o,_meta:{}}}catch(n){throw new R(N.InvalidParams,`Failed to list tasks: ${n instanceof Error?n.message:String(n)}`)}}),this.setRequestHandler(ks,async(t,r)=>{try{let n=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!n)throw new R(N.InvalidParams,`Task not found: ${t.params.taskId}`);if(Mt(n.status))throw new R(N.InvalidParams,`Cannot cancel task in terminal status: ${n.status}`);await this._taskStore.updateTaskStatus(t.params.taskId,"cancelled","Client cancelled task execution.",r.sessionId),this._clearTaskQueue(t.params.taskId);let o=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!o)throw new R(N.InvalidParams,`Task not found after cancellation: ${t.params.taskId}`);return{_meta:{},...o}}catch(n){if(n instanceof R)throw n;throw new R(N.InvalidRequest,`Failed to cancel task: ${n instanceof Error?n.message:String(n)}`)}})}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,r,n,o=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(n,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:o,onTimeout:n})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let r=Date.now()-t.startTime;if(t.maxTotalTimeout&&r>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),R.fromError(N.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);if(t)clearTimeout(t.timeoutId),this._timeoutInfo.delete(e)}async connect(e){if(this._transport)throw Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{t?.(),this._onclose()};let r=this.transport?.onerror;this._transport.onerror=(o)=>{r?.(o),this._onerror(o)};let n=this._transport?.onmessage;this._transport.onmessage=(o,s)=>{if(n?.(o,s),jn(o)||eh(o))this._onresponse(o);else if(mu(o))this._onrequest(o,s);else if(Qm(o))this._onnotification(o);else this._onerror(Error(`Unknown message type: ${JSON.stringify(o)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let r of this._timeoutInfo.values())clearTimeout(r.timeoutId);this._timeoutInfo.clear();for(let r of this._requestHandlerAbortControllers.values())r.abort();this._requestHandlerAbortControllers.clear();let t=R.fromError(N.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let r of e.values())r(t)}_onerror(e){this.onerror?.(e)}_onnotification(e){let t=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;if(t===void 0)return;Promise.resolve().then(()=>t(e)).catch((r)=>this._onerror(Error(`Uncaught error in notification handler: ${r}`)))}_onrequest(e,t){let r=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,n=this._transport,o=e.params?._meta?.[Zt]?.taskId;if(r===void 0){let u={jsonrpc:"2.0",id:e.id,error:{code:N.MethodNotFound,message:"Method not found"}};if(o&&this._taskMessageQueue)this._enqueueTaskMessage(o,{type:"error",message:u,timestamp:Date.now()},n?.sessionId).catch((l)=>this._onerror(Error(`Failed to enqueue error response: ${l}`)));else n?.send(u).catch((l)=>this._onerror(Error(`Failed to send an error response: ${l}`)));return}let s=new AbortController;this._requestHandlerAbortControllers.set(e.id,s);let i=Wm(e.params)?e.params.task:void 0,a=this._taskStore?this.requestTaskStore(e,n?.sessionId):void 0,c={signal:s.signal,sessionId:n?.sessionId,_meta:e.params?._meta,sendNotification:async(u)=>{if(s.signal.aborted)return;let l={relatedRequestId:e.id};if(o)l.relatedTask={taskId:o};await this.notification(u,l)},sendRequest:async(u,l,d)=>{if(s.signal.aborted)throw new R(N.ConnectionClosed,"Request was cancelled");let f={...d,relatedRequestId:e.id};if(o&&!f.relatedTask)f.relatedTask={taskId:o};let p=f.relatedTask?.taskId??o;if(p&&a)await a.updateTaskStatus(p,"input_required");return await this.request(u,l,f)},authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo,taskId:o,taskStore:a,taskRequestedTtl:i?.ttl,closeSSEStream:t?.closeSSEStream,closeStandaloneSSEStream:t?.closeStandaloneSSEStream};Promise.resolve().then(()=>{if(i)this.assertTaskHandlerCapability(e.method)}).then(()=>r(e,c)).then(async(u)=>{if(s.signal.aborted)return;let l={result:u,jsonrpc:"2.0",id:e.id};if(o&&this._taskMessageQueue)await this._enqueueTaskMessage(o,{type:"response",message:l,timestamp:Date.now()},n?.sessionId);else await n?.send(l)},async(u)=>{if(s.signal.aborted)return;let l={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(u.code)?u.code:N.InternalError,message:u.message??"Internal error",...u.data!==void 0&&{data:u.data}}};if(o&&this._taskMessageQueue)await this._enqueueTaskMessage(o,{type:"error",message:l,timestamp:Date.now()},n?.sessionId);else await n?.send(l)}).catch((u)=>this._onerror(Error(`Failed to send response: ${u}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(e.id)===s)this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...r}=e.params,n=Number(t),o=this._progressHandlers.get(n);if(!o){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let s=this._responseHandlers.get(n),i=this._timeoutInfo.get(n);if(i&&s&&i.resetTimeoutOnProgress)try{this._resetTimeout(n)}catch(a){this._responseHandlers.delete(n),this._progressHandlers.delete(n),this._cleanupTimeout(n),s(a);return}o(r)}_onresponse(e){let t=Number(e.id),r=this._requestResolvers.get(t);if(r){if(this._requestResolvers.delete(t),jn(e))r(e);else{let s=new R(e.error.code,e.error.message,e.error.data);r(s)}return}let n=this._responseHandlers.get(t);if(n===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t);let o=!1;if(jn(e)&&e.result&&typeof e.result==="object"){let s=e.result;if(s.task&&typeof s.task==="object"){let i=s.task;if(typeof i.taskId==="string")o=!0,this._taskProgressTokens.set(i.taskId,t)}}if(!o)this._progressHandlers.delete(t);if(jn(e))n(e);else{let s=R.fromError(e.error.code,e.error.message,e.error.data);n(s)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,t,r){let{task:n}=r??{};if(!n){try{yield{type:"result",result:await this.request(e,t,r)}}catch(s){yield{type:"error",error:s instanceof R?s:new R(N.InternalError,String(s))}}return}let o;try{let s=await this.request(e,Er,r);if(s.task)o=s.task.taskId,yield{type:"taskCreated",task:s.task};else throw new R(N.InternalError,"Task creation did not return a task");while(!0){let i=await this.getTask({taskId:o},r);if(yield{type:"taskStatus",task:i},Mt(i.status)){if(i.status==="completed")yield{type:"result",result:await this.getTaskResult({taskId:o},t,r)};else if(i.status==="failed")yield{type:"error",error:new R(N.InternalError,`Task ${o} failed`)};else if(i.status==="cancelled")yield{type:"error",error:new R(N.InternalError,`Task ${o} was cancelled`)};return}if(i.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:o},t,r)};return}let a=i.pollInterval??this._options?.defaultTaskPollInterval??1000;await new Promise((c)=>setTimeout(c,a)),r?.signal?.throwIfAborted()}}catch(s){yield{type:"error",error:s instanceof R?s:new R(N.InternalError,String(s))}}}request(e,t,r){let{relatedRequestId:n,resumptionToken:o,onresumptiontoken:s,task:i,relatedTask:a}=r??{};return new Promise((c,u)=>{let l=(v)=>{u(v)};if(!this._transport){l(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod(e.method),i)this.assertTaskCapability(e.method)}catch(v){l(v);return}r?.signal?.throwIfAborted();let d=this._requestMessageId++,f={...e,jsonrpc:"2.0",id:d};if(r?.onprogress)this._progressHandlers.set(d,r.onprogress),f.params={...e.params,_meta:{...e.params?._meta||{},progressToken:d}};if(i)f.params={...f.params,task:i};if(a)f.params={...f.params,_meta:{...f.params?._meta||{},[Zt]:a}};let p=(v)=>{this._responseHandlers.delete(d),this._progressHandlers.delete(d),this._cleanupTimeout(d),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:d,reason:String(v)}},{relatedRequestId:n,resumptionToken:o,onresumptiontoken:s}).catch((A)=>this._onerror(Error(`Failed to send cancellation: ${A}`)));let z=v instanceof R?v:new R(N.RequestTimeout,String(v));u(z)};this._responseHandlers.set(d,(v)=>{if(r?.signal?.aborted)return;if(v instanceof Error)return u(v);try{let z=Nt(t,v.result);if(!z.success)u(z.error);else c(z.data)}catch(z){u(z)}}),r?.signal?.addEventListener("abort",()=>{p(r?.signal?.reason)});let m=r?.timeout??oS,h=()=>p(R.fromError(N.RequestTimeout,"Request timed out",{timeout:m}));this._setupTimeout(d,m,r?.maxTotalTimeout,h,r?.resetTimeoutOnProgress??!1);let _=a?.taskId;if(_){let v=(z)=>{let A=this._responseHandlers.get(d);if(A)A(z);else this._onerror(Error(`Response handler missing for side-channeled request ${d}`))};this._requestResolvers.set(d,v),this._enqueueTaskMessage(_,{type:"request",message:f,timestamp:Date.now()}).catch((z)=>{this._cleanupTimeout(d),u(z)})}else this._transport.send(f,{relatedRequestId:n,resumptionToken:o,onresumptiontoken:s}).catch((v)=>{this._cleanupTimeout(d),u(v)})})}async getTask(e,t){return this.request({method:"tasks/get",params:e},xs,t)}async getTaskResult(e,t,r){return this.request({method:"tasks/result",params:e},t,r)}async listTasks(e,t){return this.request({method:"tasks/list",params:e},ws,t)}async cancelTask(e,t){return this.request({method:"tasks/cancel",params:e},nh,t)}async notification(e,t){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(e.method);let r=t?.relatedTask?.taskId;if(r){let i={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[Zt]:t.relatedTask}}};await this._enqueueTaskMessage(r,{type:"notification",message:i,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!t?.relatedRequestId&&!t?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let i={...e,jsonrpc:"2.0"};if(t?.relatedTask)i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[Zt]:t.relatedTask}}};this._transport?.send(i,t).catch((a)=>this._onerror(a))});return}let s={...e,jsonrpc:"2.0"};if(t?.relatedTask)s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[Zt]:t.relatedTask}}};await this._transport.send(s,t)}setRequestHandler(e,t){let r=Au(e);this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(n,o)=>{let s=Nu(e,n);return Promise.resolve(t(s,o))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){let r=Au(e);this._notificationHandlers.set(r,(n)=>{let o=Nu(e,n);return Promise.resolve(t(o))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let t=this._taskProgressTokens.get(e);if(t!==void 0)this._progressHandlers.delete(t),this._taskProgressTokens.delete(e)}async _enqueueTaskMessage(e,t,r){if(!this._taskStore||!this._taskMessageQueue)throw Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let n=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,t,r,n)}async _clearTaskQueue(e,t){if(this._taskMessageQueue){let r=await this._taskMessageQueue.dequeueAll(e,t);for(let n of r)if(n.type==="request"&&mu(n.message)){let o=n.message.id,s=this._requestResolvers.get(o);if(s)s(new R(N.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(o);else this._onerror(Error(`Resolver missing for request ${o} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,t){let r=this._options?.defaultTaskPollInterval??1000;try{let n=await this._taskStore?.getTask(e);if(n?.pollInterval)r=n.pollInterval}catch{}return new Promise((n,o)=>{if(t.aborted){o(new R(N.InvalidRequest,"Request cancelled"));return}let s=setTimeout(n,r);t.addEventListener("abort",()=>{clearTimeout(s),o(new R(N.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,t){let r=this._taskStore;if(!r)throw Error("No task store configured");return{createTask:async(n)=>{if(!e)throw Error("No request provided");return await r.createTask(n,e.id,{method:e.method,params:e.params},t)},getTask:async(n)=>{let o=await r.getTask(n,t);if(!o)throw new R(N.InvalidParams,"Failed to retrieve task: Task not found");return o},storeTaskResult:async(n,o,s)=>{await r.storeTaskResult(n,o,s,t);let i=await r.getTask(n,t);if(i){let a=Ln.parse({method:"notifications/tasks/status",params:i});if(await this.notification(a),Mt(i.status))this._cleanupTaskProgressHandler(n)}},getTaskResult:(n)=>r.getTaskResult(n,t),updateTaskStatus:async(n,o,s)=>{let i=await r.getTask(n,t);if(!i)throw new R(N.InvalidParams,`Task "${n}" not found - it may have been cleaned up`);if(Mt(i.status))throw new R(N.InvalidParams,`Cannot update task "${n}" from terminal status "${i.status}" to "${o}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await r.updateTaskStatus(n,o,s,t);let a=await r.getTask(n,t);if(a){let c=Ln.parse({method:"notifications/tasks/status",params:a});if(await this.notification(c),Mt(a.status))this._cleanupTaskProgressHandler(n)}},listTasks:(n)=>r.listTasks(n,t)}}}function Vh(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function Hh(e,t){let r={...e};for(let n in t){let o=n,s=t[o];if(s===void 0)continue;let i=r[o];if(Vh(i)&&Vh(s))r[o]={...i,...s};else r[o]=s}return r}var Ax=sd(Zl(),1),Nx=sd(Cx(),1);function AI(){let e=new Ax.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return Nx.default(e),e}class Jl{constructor(e){this._ajv=e??AI()}getValidator(e){let t="$id"in e&&typeof e.$id==="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return(r)=>{if(t(r))return{valid:!0,data:r,errorMessage:void 0};else return{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(t.errors)}}}}class Kl{constructor(e){this._server=e}requestStream(e,t,r){return this._server.requestStream(e,t,r)}createMessageStream(e,t){let r=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!r?.sampling?.tools)throw Error("Client does not support sampling tools capability.");if(e.messages.length>0){let n=e.messages[e.messages.length-1],o=Array.isArray(n.content)?n.content:[n.content],s=o.some((u)=>u.type==="tool_result"),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],c=a.some((u)=>u.type==="tool_use");if(s){if(o.some((u)=>u.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!c)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let u=new Set(a.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 Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:e},Vn,t)}elicitInputStream(e,t){let r=this._server.getClientCapabilities(),n=e.mode??"form";switch(n){case"url":{if(!r?.elicitation?.url)throw Error("Client does not support url elicitation.");break}case"form":{if(!r?.elicitation?.form)throw Error("Client does not support form elicitation.");break}}let o=n==="form"&&e.mode===void 0?{...e,mode:"form"}:e;return this.requestStream({method:"elicitation/create",params:o},Ir,t)}async getTask(e,t){return this._server.getTask({taskId:e},t)}async getTaskResult(e,t,r){return this._server.getTaskResult({taskId:e},t,r)}async listTasks(e,t){return this._server.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._server.cancelTask({taskId:e},t)}}function jx(e,t,r){if(!e)throw Error(`${r} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!e.tools?.call)throw Error(`${r} does not support task creation for tools/call (required for ${t})`);break;default:break}}function Zx(e,t,r){if(!e)throw Error(`${r} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!e.sampling?.createMessage)throw Error(`${r} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!e.elicitation?.create)throw Error(`${r} does not support task creation for elicitation/create (required for ${t})`);break;default:break}}class Gl extends ju{constructor(e,t){super(t);if(this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Un.options.map((r,n)=>[r,n])),this.isMessageIgnored=(r,n)=>{let o=this._loggingLevels.get(n);return o?this.LOG_LEVEL_SEVERITY.get(r)<this.LOG_LEVEL_SEVERITY.get(o):!1},this._capabilities=t?.capabilities??{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new Jl,this.setRequestHandler(_u,(r)=>this._oninitialize(r)),this.setNotificationHandler(yu,()=>this.oninitialized?.()),this._capabilities.logging)this.setRequestHandler(Su,async(r,n)=>{let o=n.sessionId||n.requestInfo?.headers["mcp-session-id"]||void 0,{level:s}=r.params,i=Un.safeParse(s);if(i.success)this._loggingLevels.set(o,i.data);return{}})}get experimental(){if(!this._experimental)this._experimental={tasks:new Kl(this)};return this._experimental}registerCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=Hh(this._capabilities,e)}setRequestHandler(e,t){let n=jt(e)?.method;if(!n)throw Error("Schema is missing a method literal");let o=Pr(n);if(typeof o!=="string")throw Error("Schema method literal must be a string");if(o==="tools/call"){let i=async(a,c)=>{let u=Nt(Rr,a);if(!u.success){let p=u.error instanceof Error?u.error.message:String(u.error);throw new R(N.InvalidParams,`Invalid tools/call request: ${p}`)}let{params:l}=u.data,d=await Promise.resolve(t(a,c));if(l.task){let p=Nt(Er,d);if(!p.success){let m=p.error instanceof Error?p.error.message:String(p.error);throw new R(N.InvalidParams,`Invalid task creation result: ${m}`)}return p.data}let f=Nt(Rs,d);if(!f.success){let p=f.error instanceof Error?f.error.message:String(f.error);throw new R(N.InvalidParams,`Invalid tools/call result: ${p}`)}return f.data};return super.setRequestHandler(e,i)}return super.setRequestHandler(e,t)}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(!this._capabilities)return;switch(e){case"completion/complete":if(!this._capabilities.completions)throw Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Server does not support tools (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw Error(`Server does not support tasks capability (required for ${e})`);break;case"ping":case"initialize":break}}assertTaskCapability(e){Zx(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){if(!this._capabilities)return;jx(this._capabilities.tasks?.requests,e,"Server")}async _oninitialize(e){let t=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:Jm.includes(t)?t:pu,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"},hs)}async createMessage(e,t){if(e.tools||e.toolChoice){if(!this._clientCapabilities?.sampling?.tools)throw Error("Client does not support sampling tools capability.")}if(e.messages.length>0){let r=e.messages[e.messages.length-1],n=Array.isArray(r.content)?r.content:[r.content],o=n.some((c)=>c.type==="tool_result"),s=e.messages.length>1?e.messages[e.messages.length-2]:void 0,i=s?Array.isArray(s.content)?s.content:[s.content]:[],a=i.some((c)=>c.type==="tool_use");if(o){if(n.some((c)=>c.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!a)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(a){let c=new Set(i.filter((l)=>l.type==="tool_use").map((l)=>l.id)),u=new Set(n.filter((l)=>l.type==="tool_result").map((l)=>l.toolUseId));if(c.size!==u.size||![...c].every((l)=>u.has(l)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}if(e.tools)return this.request({method:"sampling/createMessage",params:e},zu,t);return this.request({method:"sampling/createMessage",params:e},Vn,t)}async elicitInput(e,t){switch(e.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support url elicitation.");let n=e;return this.request({method:"elicitation/create",params:n},Ir,t)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw Error("Client does not support form elicitation.");let n=e.mode==="form"?e:{...e,mode:"form"},o=await this.request({method:"elicitation/create",params:n},Ir,t);if(o.action==="accept"&&o.content&&n.requestedSchema)try{let i=this._jsonSchemaValidator.getValidator(n.requestedSchema)(o.content);if(!i.valid)throw new R(N.InvalidParams,`Elicitation response content does not match requested schema: ${i.errorMessage}`)}catch(s){if(s instanceof R)throw s;throw new R(N.InternalError,`Error validating elicitation response: ${s instanceof Error?s.message:String(s)}`)}return o}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},t)}async listRoots(e,t){return this.request({method:"roots/list",params:e},Pu,t)}async sendLoggingMessage(e,t){if(this._capabilities.logging){if(!this.isMessageIgnored(e.level,t))return this.notification({method:"notifications/message",params:e})}}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}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 Dx=Symbol.for("mcp.completable");function Wl(e){return!!e&&typeof e==="object"&&Dx in e}function qx(e){return e[Dx]?.complete}var Mx;(function(e){e.Completable="McpCompletable"})(Mx||(Mx={}));var NI=/^[A-Za-z0-9._-]{1,128}$/;function jI(e){let t=[];if(e.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(e.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${e.length})`]};if(e.includes(" "))t.push("Tool name contains spaces, which may cause parsing issues");if(e.includes(","))t.push("Tool name contains commas, which may cause parsing issues");if(e.startsWith("-")||e.endsWith("-"))t.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts");if(e.startsWith(".")||e.endsWith("."))t.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts");if(!NI.test(e)){let r=e.split("").filter((n)=>!/[A-Za-z0-9._-]/.test(n)).filter((n,o,s)=>s.indexOf(n)===o);return t.push(`Tool name contains invalid characters: ${r.map((n)=>`"${n}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:t}}return{isValid:!0,warnings:t}}function ZI(e,t){if(t.length>0){console.warn(`Tool name validation warning for "${e}":`);for(let r of t)console.warn(` - ${r}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function Xl(e){let t=jI(e);return ZI(e,t.warnings),t.isValid}class Yl{constructor(e){this._mcpServer=e}registerToolTask(e,t,r){let n={taskSupport:"required",...t.execution};if(n.taskSupport==="forbidden")throw Error(`Cannot register task-based tool '${e}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(e,t.title,t.description,t.inputSchema,t.outputSchema,t.annotations,n,t._meta,r)}}class ed{constructor(e,t){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new Gl(e,t)}get experimental(){if(!this._experimental)this._experimental={tasks:new Yl(this)};return this._experimental}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){if(this._toolHandlersInitialized)return;this.server.assertCanSetRequestHandler(Bt(Os)),this.server.assertCanSetRequestHandler(Bt(Rr)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(Os,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,t])=>{let r={name:e,title:t.title,description:t.description,inputSchema:(()=>{let n=zr(t.inputSchema);return n?Cu(n,{strictUnions:!0,pipeStrategy:"input"}):MI})(),annotations:t.annotations,execution:t.execution,_meta:t._meta};if(t.outputSchema){let n=zr(t.outputSchema);if(n)r.outputSchema=Cu(n,{strictUnions:!0,pipeStrategy:"output"})}return r})})),this.server.setRequestHandler(Rr,async(e,t)=>{try{let r=this._registeredTools[e.params.name];if(!r)throw new R(N.InvalidParams,`Tool ${e.params.name} not found`);if(!r.enabled)throw new R(N.InvalidParams,`Tool ${e.params.name} disabled`);let n=!!e.params.task,o=r.execution?.taskSupport,s="createTask"in r.handler;if((o==="required"||o==="optional")&&!s)throw new R(N.InternalError,`Tool ${e.params.name} has taskSupport '${o}' but was not registered with registerToolTask`);if(o==="required"&&!n)throw new R(N.MethodNotFound,`Tool ${e.params.name} requires task augmentation (taskSupport: 'required')`);if(o==="optional"&&!n&&s)return await this.handleAutomaticTaskPolling(r,e,t);let i=await this.validateToolInput(r,e.params.arguments,e.params.name),a=await this.executeToolHandler(r,i,t);if(n)return a;return await this.validateToolOutput(r,a,e.params.name),a}catch(r){if(r instanceof R){if(r.code===N.UrlElicitationRequired)throw r}return this.createToolError(r instanceof Error?r.message:String(r))}}),this._toolHandlersInitialized=!0}createToolError(e){return{content:[{type:"text",text:e}],isError:!0}}async validateToolInput(e,t,r){if(!e.inputSchema)return;let o=zr(e.inputSchema)??e.inputSchema,s=await ss(o,t);if(!s.success){let i="error"in s?s.error:"Unknown error",a=is(i);throw new R(N.InvalidParams,`Input validation error: Invalid arguments for tool ${r}: ${a}`)}return s.data}async validateToolOutput(e,t,r){if(!e.outputSchema)return;if(!("content"in t))return;if(t.isError)return;if(!t.structuredContent)throw new R(N.InvalidParams,`Output validation error: Tool ${r} has an output schema but no structured content was provided`);let n=zr(e.outputSchema),o=await ss(n,t.structuredContent);if(!o.success){let s="error"in o?o.error:"Unknown error",i=is(s);throw new R(N.InvalidParams,`Output validation error: Invalid structured content for tool ${r}: ${i}`)}}async executeToolHandler(e,t,r){let n=e.handler;if("createTask"in n){if(!r.taskStore)throw Error("No task store provided.");let s={...r,taskStore:r.taskStore};if(e.inputSchema)return await Promise.resolve(n.createTask(t,s));else return await Promise.resolve(n.createTask(s))}if(e.inputSchema)return await Promise.resolve(n(t,r));else return await Promise.resolve(n(r))}async handleAutomaticTaskPolling(e,t,r){if(!r.taskStore)throw Error("No task store provided for task-capable tool.");let n=await this.validateToolInput(e,t.params.arguments,t.params.name),o=e.handler,s={...r,taskStore:r.taskStore},i=n?await Promise.resolve(o.createTask(n,s)):await Promise.resolve(o.createTask(s)),a=i.task.taskId,c=i.task,u=c.pollInterval??5000;while(c.status!=="completed"&&c.status!=="failed"&&c.status!=="cancelled"){await new Promise((d)=>setTimeout(d,u));let l=await r.taskStore.getTask(a);if(!l)throw new R(N.InternalError,`Task ${a} not found during polling`);c=l}return await r.taskStore.getTaskResult(a)}setCompletionRequestHandler(){if(this._completionHandlerInitialized)return;this.server.assertCanSetRequestHandler(Bt(Is)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(Is,async(e)=>{switch(e.params.ref.type){case"ref/prompt":return uh(e),this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return lh(e),this.handleResourceCompletion(e,e.params.ref);default:throw new R(N.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0}async handlePromptCompletion(e,t){let r=this._registeredPrompts[t.name];if(!r)throw new R(N.InvalidParams,`Prompt ${t.name} not found`);if(!r.enabled)throw new R(N.InvalidParams,`Prompt ${t.name} disabled`);if(!r.argsSchema)return _o;let o=jt(r.argsSchema)?.[e.params.argument.name];if(!Wl(o))return _o;let s=qx(o);if(!s)return _o;let i=await s(e.params.argument.value,e.params.context);return Fx(i)}async handleResourceCompletion(e,t){let r=Object.values(this._registeredResourceTemplates).find((s)=>s.resourceTemplate.uriTemplate.toString()===t.uri);if(!r){if(this._registeredResources[t.uri])return _o;throw new R(N.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let n=r.resourceTemplate.completeCallback(e.params.argument.name);if(!n)return _o;let o=await n(e.params.argument.value,e.params.context);return Fx(o)}setResourceRequestHandlers(){if(this._resourceHandlersInitialized)return;this.server.assertCanSetRequestHandler(Bt(Ss)),this.server.assertCanSetRequestHandler(Bt(zs)),this.server.assertCanSetRequestHandler(Bt(Ps)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(Ss,async(e,t)=>{let r=Object.entries(this._registeredResources).filter(([o,s])=>s.enabled).map(([o,s])=>({uri:o,name:s.name,...s.metadata})),n=[];for(let o of Object.values(this._registeredResourceTemplates)){if(!o.resourceTemplate.listCallback)continue;let s=await o.resourceTemplate.listCallback(t);for(let i of s.resources)n.push({...o.metadata,...i})}return{resources:[...r,...n]}}),this.server.setRequestHandler(zs,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([t,r])=>({name:t,uriTemplate:r.resourceTemplate.uriTemplate.toString(),...r.metadata}))})),this.server.setRequestHandler(Ps,async(e,t)=>{let r=new URL(e.params.uri),n=this._registeredResources[r.toString()];if(n){if(!n.enabled)throw new R(N.InvalidParams,`Resource ${r} disabled`);return n.readCallback(r,t)}for(let o of Object.values(this._registeredResourceTemplates)){let s=o.resourceTemplate.uriTemplate.match(r.toString());if(s)return o.readCallback(r,s,t)}throw new R(N.InvalidParams,`Resource ${r} not found`)}),this._resourceHandlersInitialized=!0}setPromptRequestHandlers(){if(this._promptHandlersInitialized)return;this.server.assertCanSetRequestHandler(Bt(Ts)),this.server.assertCanSetRequestHandler(Bt(Es)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(Ts,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,t])=>({name:e,title:t.title,description:t.description,arguments:t.argsSchema?DI(t.argsSchema):void 0}))})),this.server.setRequestHandler(Es,async(e,t)=>{let r=this._registeredPrompts[e.params.name];if(!r)throw new R(N.InvalidParams,`Prompt ${e.params.name} not found`);if(!r.enabled)throw new R(N.InvalidParams,`Prompt ${e.params.name} disabled`);if(r.argsSchema){let n=zr(r.argsSchema),o=await ss(n,e.params.arguments);if(!o.success){let a="error"in o?o.error:"Unknown error",c=is(a);throw new R(N.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${c}`)}let s=o.data,i=r.callback;return await Promise.resolve(i(s,t))}else{let n=r.callback;return await Promise.resolve(n(t))}}),this._promptHandlersInitialized=!0}resource(e,t,...r){let n;if(typeof r[0]==="object")n=r.shift();let o=r[0];if(typeof t==="string"){if(this._registeredResources[t])throw Error(`Resource ${t} is already registered`);let s=this._createRegisteredResource(e,void 0,t,n,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}else{if(this._registeredResourceTemplates[e])throw Error(`Resource template ${e} is already registered`);let s=this._createRegisteredResourceTemplate(e,void 0,t,n,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}}registerResource(e,t,r,n){if(typeof t==="string"){if(this._registeredResources[t])throw Error(`Resource ${t} is already registered`);let o=this._createRegisteredResource(e,r.title,t,r,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}else{if(this._registeredResourceTemplates[e])throw Error(`Resource template ${e} is already registered`);let o=this._createRegisteredResourceTemplate(e,r.title,t,r,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}}_createRegisteredResource(e,t,r,n,o){let s={name:e,title:t,metadata:n,readCallback:o,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({uri:null}),update:(i)=>{if(typeof i.uri<"u"&&i.uri!==r){if(delete this._registeredResources[r],i.uri)this._registeredResources[i.uri]=s}if(typeof i.name<"u")s.name=i.name;if(typeof i.title<"u")s.title=i.title;if(typeof i.metadata<"u")s.metadata=i.metadata;if(typeof i.callback<"u")s.readCallback=i.callback;if(typeof i.enabled<"u")s.enabled=i.enabled;this.sendResourceListChanged()}};return this._registeredResources[r]=s,s}_createRegisteredResourceTemplate(e,t,r,n,o){let s={resourceTemplate:r,title:t,metadata:n,readCallback:o,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({name:null}),update:(c)=>{if(typeof c.name<"u"&&c.name!==e){if(delete this._registeredResourceTemplates[e],c.name)this._registeredResourceTemplates[c.name]=s}if(typeof c.title<"u")s.title=c.title;if(typeof c.template<"u")s.resourceTemplate=c.template;if(typeof c.metadata<"u")s.metadata=c.metadata;if(typeof c.callback<"u")s.readCallback=c.callback;if(typeof c.enabled<"u")s.enabled=c.enabled;this.sendResourceListChanged()}};this._registeredResourceTemplates[e]=s;let i=r.uriTemplate.variableNames;if(Array.isArray(i)&&i.some((c)=>!!r.completeCallback(c)))this.setCompletionRequestHandler();return s}_createRegisteredPrompt(e,t,r,n,o){let s={title:t,description:r,argsSchema:n===void 0?void 0:nr(n),callback:o,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({name:null}),update:(i)=>{if(typeof i.name<"u"&&i.name!==e){if(delete this._registeredPrompts[e],i.name)this._registeredPrompts[i.name]=s}if(typeof i.title<"u")s.title=i.title;if(typeof i.description<"u")s.description=i.description;if(typeof i.argsSchema<"u")s.argsSchema=nr(i.argsSchema);if(typeof i.callback<"u")s.callback=i.callback;if(typeof i.enabled<"u")s.enabled=i.enabled;this.sendPromptListChanged()}};if(this._registeredPrompts[e]=s,n){if(Object.values(n).some((a)=>{let c=a instanceof ds?a._def?.innerType:a;return Wl(c)}))this.setCompletionRequestHandler()}return s}_createRegisteredTool(e,t,r,n,o,s,i,a,c){Xl(e);let u={title:t,description:r,inputSchema:Lx(n),outputSchema:Lx(o),annotations:s,execution:i,_meta:a,handler:c,enabled:!0,disable:()=>u.update({enabled:!1}),enable:()=>u.update({enabled:!0}),remove:()=>u.update({name:null}),update:(l)=>{if(typeof l.name<"u"&&l.name!==e){if(typeof l.name==="string")Xl(l.name);if(delete this._registeredTools[e],l.name)this._registeredTools[l.name]=u}if(typeof l.title<"u")u.title=l.title;if(typeof l.description<"u")u.description=l.description;if(typeof l.paramsSchema<"u")u.inputSchema=nr(l.paramsSchema);if(typeof l.outputSchema<"u")u.outputSchema=nr(l.outputSchema);if(typeof l.callback<"u")u.handler=l.callback;if(typeof l.annotations<"u")u.annotations=l.annotations;if(typeof l._meta<"u")u._meta=l._meta;if(typeof l.enabled<"u")u.enabled=l.enabled;this.sendToolListChanged()}};return this._registeredTools[e]=u,this.setToolRequestHandlers(),this.sendToolListChanged(),u}tool(e,...t){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let r,n,o,s;if(typeof t[0]==="string")r=t.shift();if(t.length>1){let a=t[0];if(Ql(a)){if(n=t.shift(),t.length>1&&typeof t[0]==="object"&&t[0]!==null&&!Ql(t[0]))s=t.shift()}else if(typeof a==="object"&&a!==null){if(Object.values(a).some((c)=>typeof c==="object"&&c!==null))throw Error(`Tool ${e} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);s=t.shift()}}let i=t[0];return this._createRegisteredTool(e,void 0,r,n,o,s,{taskSupport:"forbidden"},void 0,i)}registerTool(e,t,r){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let{title:n,description:o,inputSchema:s,outputSchema:i,annotations:a,_meta:c}=t;return this._createRegisteredTool(e,n,o,s,i,a,{taskSupport:"forbidden"},c,r)}prompt(e,...t){if(this._registeredPrompts[e])throw Error(`Prompt ${e} is already registered`);let r;if(typeof t[0]==="string")r=t.shift();let n;if(t.length>1)n=t.shift();let o=t[0],s=this._createRegisteredPrompt(e,void 0,r,n,o);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),s}registerPrompt(e,t,r){if(this._registeredPrompts[e])throw Error(`Prompt ${e} is already registered`);let{title:n,description:o,argsSchema:s}=t,i=this._createRegisteredPrompt(e,n,o,s,r);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),i}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(e,t){return this.server.sendLoggingMessage(e,t)}sendResourceListChanged(){if(this.isConnected())this.server.sendResourceListChanged()}sendToolListChanged(){if(this.isConnected())this.server.sendToolListChanged()}sendPromptListChanged(){if(this.isConnected())this.server.sendPromptListChanged()}}var MI={type:"object",properties:{}};function Ux(e){return e!==null&&typeof e==="object"&&"parse"in e&&typeof e.parse==="function"&&"safeParse"in e&&typeof e.safeParse==="function"}function Vx(e){return"_def"in e||"_zod"in e||Ux(e)}function Ql(e){if(typeof e!=="object"||e===null)return!1;if(Vx(e))return!1;if(Object.keys(e).length===0)return!0;return Object.values(e).some(Ux)}function Lx(e){if(!e)return;if(Ql(e))return nr(e);if(!Vx(e))throw Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");return e}function DI(e){let t=jt(e);if(!t)return[];return Object.entries(t).map(([r,n])=>{let o=pm(n),s=fm(n);return{name:r,description:o,required:!s}})}function Bt(e){let r=jt(e)?.method;if(!r)throw Error("Schema is missing a method literal");let n=Pr(r);if(typeof n==="string")return n;throw Error("Schema method literal must be a string")}function Fx(e){return{completion:{values:e.slice(0,100),total:e.length,hasMore:e.length>100}}}var _o={completion:{values:[],hasMore:!1}};import Bx from"node:process";var qI=10485760;class td{constructor(e){this._maxBufferSize=e?.maxBufferSize??qI}append(e){if((this._buffer?.length??0)+e.length>this._maxBufferSize)throw this.clear(),Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
73
+ ]`;continue}if(o+=n[c],n[c]==="\\")s=!0;else if(i&&n[c]==="]")i=!1;else if(!i&&n[c]==="[")i=!0}try{new RegExp(o)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return o}function js(e,t){if(t.target==="openAi")console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");if(t.target==="openApi3"&&e.keyType?._def.typeName===b.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((n,o)=>({...n,[o]:Z(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",o]})??le(t)}),{}),additionalProperties:t.rejectedAdditionalProperties};let r={type:"object",additionalProperties:Z(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??t.allowedAdditionalProperties};if(t.target==="openApi3")return r;if(e.keyType?._def.typeName===b.ZodString&&e.keyType._def.checks?.length){let{type:n,...o}=Ns(e.keyType._def,t);return{...r,propertyNames:o}}else if(e.keyType?._def.typeName===b.ZodEnum)return{...r,propertyNames:{enum:e.keyType._def.values}};else if(e.keyType?._def.typeName===b.ZodBranded&&e.keyType._def.type._def.typeName===b.ZodString&&e.keyType._def.type._def.checks?.length){let{type:n,...o}=As(e.keyType._def,t);return{...r,propertyNames:o}}return r}function zh(e,t){if(t.mapStrategy==="record")return js(e,t);let r=Z(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||le(t),n=Z(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||le(t);return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}function Ph(e){let t=e.values,n=Object.keys(e.values).filter((s)=>typeof t[t[s]]!=="number").map((s)=>t[s]),o=Array.from(new Set(n.map((s)=>typeof s)));return{type:o.length===1?o[0]==="string"?"string":"number":["string","number"],enum:n}}function Th(e){return e.target==="openAi"?void 0:{not:le({...e,currentPath:[...e.currentPath,"not"]})}}function Eh(e){return e.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var Hn={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Rh(e,t){if(t.target==="openApi3")return Oh(e,t);let r=e.options instanceof Map?Array.from(e.options.values()):e.options;if(r.every((n)=>(n._def.typeName in Hn)&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,s)=>{let i=Hn[s._def.typeName];return i&&!o.includes(i)?[...o,i]:o},[]);return{type:n.length>1?n:n[0]}}else if(r.every((n)=>n._def.typeName==="ZodLiteral"&&!n.description)){let n=r.reduce((o,s)=>{let i=typeof s._def.value;switch(i){case"string":case"number":case"boolean":return[...o,i];case"bigint":return[...o,"integer"];case"object":if(s._def.value===null)return[...o,"null"];case"symbol":case"undefined":case"function":default:return o}},[]);if(n.length===r.length){let o=n.filter((s,i,a)=>a.indexOf(s)===i);return{type:o.length>1?o:o[0],enum:r.reduce((s,i)=>s.includes(i._def.value)?s:[...s,i._def.value],[])}}}else if(r.every((n)=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,o)=>[...n,...o._def.values.filter((s)=>!n.includes(s))],[])};return Oh(e,t)}var Oh=(e,t)=>{let r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((n,o)=>Z(n._def,{...t,currentPath:[...t.currentPath,"anyOf",`${o}`]})).filter((n)=>!!n&&(!t.strictUnions||typeof n==="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0};function Ih(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length)){if(t.target==="openApi3")return{type:Hn[e.innerType._def.typeName],nullable:!0};return{type:[Hn[e.innerType._def.typeName],"null"]}}if(t.target==="openApi3"){let n=Z(e.innerType._def,{...t,currentPath:[...t.currentPath]});if(n&&"$ref"in n)return{allOf:[n],nullable:!0};return n&&{...n,nullable:!0}}let r=Z(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function Ch(e,t){let r={type:"number"};if(!e.checks)return r;for(let n of e.checks)switch(n.kind){case"int":r.type="integer",Tu(r,"type",n.message,t);break;case"min":if(t.target==="jsonSchema7")if(n.inclusive)J(r,"minimum",n.value,n.message,t);else J(r,"exclusiveMinimum",n.value,n.message,t);else{if(!n.inclusive)r.exclusiveMinimum=!0;J(r,"minimum",n.value,n.message,t)}break;case"max":if(t.target==="jsonSchema7")if(n.inclusive)J(r,"maximum",n.value,n.message,t);else J(r,"exclusiveMaximum",n.value,n.message,t);else{if(!n.inclusive)r.exclusiveMaximum=!0;J(r,"maximum",n.value,n.message,t)}break;case"multipleOf":J(r,"multipleOf",n.value,n.message,t);break}return r}function Ah(e,t){let r=t.target==="openAi",n={type:"object",properties:{}},o=[],s=e.shape();for(let a in s){let c=s[a];if(c===void 0||c._def===void 0)continue;let u=eS(c);if(u&&r){if(c._def.typeName==="ZodOptional")c=c._def.innerType;if(!c.isNullable())c=c.nullable();u=!1}let l=Z(c._def,{...t,currentPath:[...t.currentPath,"properties",a],propertyPath:[...t.currentPath,"properties",a]});if(l===void 0)continue;if(n.properties[a]=l,!u)o.push(a)}if(o.length)n.required=o;let i=Qk(e,t);if(i!==void 0)n.additionalProperties=i;return n}function Qk(e,t){if(e.catchall._def.typeName!=="ZodNever")return Z(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return t.removeAdditionalStrategy==="strict"?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function eS(e){try{return e.isOptional()}catch{return!0}}var Nh=(e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return Z(e.innerType._def,t);let r=Z(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return r?{anyOf:[{not:le(t)},r]}:le(t)};var jh=(e,t)=>{if(t.pipeStrategy==="input")return Z(e.in._def,t);else if(t.pipeStrategy==="output")return Z(e.out._def,t);let r=Z(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),n=Z(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter((o)=>o!==void 0)}};function Zh(e,t){return Z(e.type._def,t)}function Mh(e,t){let n={type:"array",uniqueItems:!0,items:Z(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};if(e.minSize)J(n,"minItems",e.minSize.value,e.minSize.message,t);if(e.maxSize)J(n,"maxItems",e.maxSize.value,e.maxSize.message,t);return n}function Dh(e,t){if(e.rest)return{type:"array",minItems:e.items.length,items:e.items.map((r,n)=>Z(r._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:Z(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})};else return{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((r,n)=>Z(r._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}function qh(e){return{not:le(e)}}function Lh(e){return le(e)}var Fh=(e,t)=>Z(e.innerType._def,t);var Uh=(e,t,r)=>{switch(t){case b.ZodString:return Ns(e,r);case b.ZodNumber:return Ch(e,r);case b.ZodObject:return Ah(e,r);case b.ZodBigInt:return _h(e,r);case b.ZodBoolean:return yh();case b.ZodDate:return Eu(e,r);case b.ZodUndefined:return qh(r);case b.ZodNull:return Eh(r);case b.ZodArray:return gh(e,r);case b.ZodUnion:case b.ZodDiscriminatedUnion:return Rh(e,r);case b.ZodIntersection:return wh(e,r);case b.ZodTuple:return Dh(e,r);case b.ZodRecord:return js(e,r);case b.ZodLiteral:return kh(e,r);case b.ZodEnum:return $h(e);case b.ZodNativeEnum:return Ph(e);case b.ZodNullable:return Ih(e,r);case b.ZodOptional:return Nh(e,r);case b.ZodMap:return zh(e,r);case b.ZodSet:return Mh(e,r);case b.ZodLazy:return()=>e.getter()._def;case b.ZodPromise:return Zh(e,r);case b.ZodNaN:case b.ZodNever:return Th(r);case b.ZodEffects:return bh(e,r);case b.ZodAny:return le(r);case b.ZodUnknown:return Lh(r);case b.ZodDefault:return xh(e,r);case b.ZodBranded:return As(e,r);case b.ZodReadonly:return Fh(e,r);case b.ZodCatch:return vh(e,r);case b.ZodPipeline:return jh(e,r);case b.ZodFunction:case b.ZodVoid:case b.ZodSymbol:return;default:return((n)=>{return})(t)}};function Z(e,t,r=!1){let n=t.seen.get(e);if(t.override){let a=t.override?.(e,t,n,r);if(a!==fh)return a}if(n&&!r){let a=tS(n,t);if(a!==void 0)return a}let o={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,o);let s=Uh(e,e.typeName,t),i=typeof s==="function"?Z(s(),t):s;if(i)rS(e,t,i);if(t.postProcess){let a=t.postProcess(i,e,t);return o.jsonSchema=i,a}return o.jsonSchema=i,i}var tS=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:Cs(t.currentPath,e.path)};case"none":case"seen":{if(e.path.length<t.currentPath.length&&e.path.every((r,n)=>t.currentPath[n]===r))return console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),le(t);return t.$refStrategy==="seen"?le(t):void 0}}},rS=(e,t,r)=>{if(e.description){if(r.description=e.description,t.markdownDescription)r.markdownDescription=e.description}return r};var Iu=(e,t)=>{let r=hh(t),n=typeof t==="object"&&t.definitions?Object.entries(t.definitions).reduce((c,[u,l])=>({...c,[u]:Z(l._def,{...r,currentPath:[...r.basePath,r.definitionPath,u]},!0)??le(r)}),{}):void 0,o=typeof t==="string"?t:t?.nameStrategy==="title"?void 0:t?.name,s=Z(e._def,o===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,o]},!1)??le(r),i=typeof t==="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;if(i!==void 0)s.title=i;if(r.flags.hasReferencedOpenAiAnyType){if(!n)n={};if(!n[r.openAiAnyTypeName])n[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:r.$refStrategy==="relative"?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}}let a=o===void 0?n?{...s,[r.definitionPath]:n}:s:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,o].join("/"),[r.definitionPath]:{...n,[o]:s}};if(r.target==="jsonSchema7")a.$schema="http://json-schema.org/draft-07/schema#";else if(r.target==="jsonSchema2019-09"||r.target==="openAi")a.$schema="https://json-schema.org/draft/2019-09/schema#";if(r.target==="openAi"&&(("anyOf"in a)||("oneOf"in a)||("allOf"in a)||("type"in a)&&Array.isArray(a.type)))console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.");return a};function nS(e){if(!e)return"draft-7";if(e==="jsonSchema7"||e==="draft-7")return"draft-7";if(e==="jsonSchema2019-09"||e==="draft-2020-12")return"draft-2020-12";return"draft-7"}function Cu(e,t){if(ht(e))return iu(e,{target:nS(t?.target),io:t?.pipeStrategy??"input"});return Iu(e,{strictUnions:t?.strictUnions??!0,pipeStrategy:t?.pipeStrategy??"input"})}function Au(e){let r=jt(e)?.method;if(!r)throw Error("Schema is missing a method literal");let n=Pr(r);if(typeof n!=="string")throw Error("Schema method literal must be a string");return n}function Nu(e,t){let r=Nt(e,t);if(!r.success)throw r.error;return r.data}var oS=60000;class ju{constructor(e){if(this._options=e,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(gs,(t)=>{this._oncancel(t)}),this.setNotificationHandler(ys,(t)=>{this._onprogress(t)}),this.setRequestHandler(_s,(t)=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore)this.setRequestHandler(vs,async(t,r)=>{let n=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!n)throw new R(N.InvalidParams,"Failed to retrieve task: Task not found");return{...n}}),this.setRequestHandler(bs,async(t,r)=>{let n=async()=>{let o=t.params.taskId;if(this._taskMessageQueue){let i;while(i=await this._taskMessageQueue.dequeue(o,r.sessionId)){if(i.type==="response"||i.type==="error"){let a=i.message,c=a.id,u=this._requestResolvers.get(c);if(u)if(this._requestResolvers.delete(c),i.type==="response")u(a);else{let l=a,d=new R(l.error.code,l.error.message,l.error.data);u(d)}else{let l=i.type==="response"?"Response":"Error";this._onerror(Error(`${l} handler missing for request ${c}`))}continue}await this._transport?.send(i.message,{relatedRequestId:r.requestId})}}let s=await this._taskStore.getTask(o,r.sessionId);if(!s)throw new R(N.InvalidParams,`Task not found: ${o}`);if(!Mt(s.status))return await this._waitForTaskUpdate(o,r.signal),await n();if(Mt(s.status)){let i=await this._taskStore.getTaskResult(o,r.sessionId);return this._clearTaskQueue(o),{...i,_meta:{...i._meta,[Zt]:{taskId:o}}}}return await n()};return await n()}),this.setRequestHandler($s,async(t,r)=>{try{let{tasks:n,nextCursor:o}=await this._taskStore.listTasks(t.params?.cursor,r.sessionId);return{tasks:n,nextCursor:o,_meta:{}}}catch(n){throw new R(N.InvalidParams,`Failed to list tasks: ${n instanceof Error?n.message:String(n)}`)}}),this.setRequestHandler(ks,async(t,r)=>{try{let n=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!n)throw new R(N.InvalidParams,`Task not found: ${t.params.taskId}`);if(Mt(n.status))throw new R(N.InvalidParams,`Cannot cancel task in terminal status: ${n.status}`);await this._taskStore.updateTaskStatus(t.params.taskId,"cancelled","Client cancelled task execution.",r.sessionId),this._clearTaskQueue(t.params.taskId);let o=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!o)throw new R(N.InvalidParams,`Task not found after cancellation: ${t.params.taskId}`);return{_meta:{},...o}}catch(n){if(n instanceof R)throw n;throw new R(N.InvalidRequest,`Failed to cancel task: ${n instanceof Error?n.message:String(n)}`)}})}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,r,n,o=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(n,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:o,onTimeout:n})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let r=Date.now()-t.startTime;if(t.maxTotalTimeout&&r>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),R.fromError(N.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);if(t)clearTimeout(t.timeoutId),this._timeoutInfo.delete(e)}async connect(e){if(this._transport)throw Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{t?.(),this._onclose()};let r=this.transport?.onerror;this._transport.onerror=(o)=>{r?.(o),this._onerror(o)};let n=this._transport?.onmessage;this._transport.onmessage=(o,s)=>{if(n?.(o,s),jn(o)||eh(o))this._onresponse(o);else if(mu(o))this._onrequest(o,s);else if(Qm(o))this._onnotification(o);else this._onerror(Error(`Unknown message type: ${JSON.stringify(o)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let r of this._timeoutInfo.values())clearTimeout(r.timeoutId);this._timeoutInfo.clear();for(let r of this._requestHandlerAbortControllers.values())r.abort();this._requestHandlerAbortControllers.clear();let t=R.fromError(N.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let r of e.values())r(t)}_onerror(e){this.onerror?.(e)}_onnotification(e){let t=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;if(t===void 0)return;Promise.resolve().then(()=>t(e)).catch((r)=>this._onerror(Error(`Uncaught error in notification handler: ${r}`)))}_onrequest(e,t){let r=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,n=this._transport,o=e.params?._meta?.[Zt]?.taskId;if(r===void 0){let u={jsonrpc:"2.0",id:e.id,error:{code:N.MethodNotFound,message:"Method not found"}};if(o&&this._taskMessageQueue)this._enqueueTaskMessage(o,{type:"error",message:u,timestamp:Date.now()},n?.sessionId).catch((l)=>this._onerror(Error(`Failed to enqueue error response: ${l}`)));else n?.send(u).catch((l)=>this._onerror(Error(`Failed to send an error response: ${l}`)));return}let s=new AbortController;this._requestHandlerAbortControllers.set(e.id,s);let i=Wm(e.params)?e.params.task:void 0,a=this._taskStore?this.requestTaskStore(e,n?.sessionId):void 0,c={signal:s.signal,sessionId:n?.sessionId,_meta:e.params?._meta,sendNotification:async(u)=>{if(s.signal.aborted)return;let l={relatedRequestId:e.id};if(o)l.relatedTask={taskId:o};await this.notification(u,l)},sendRequest:async(u,l,d)=>{if(s.signal.aborted)throw new R(N.ConnectionClosed,"Request was cancelled");let f={...d,relatedRequestId:e.id};if(o&&!f.relatedTask)f.relatedTask={taskId:o};let p=f.relatedTask?.taskId??o;if(p&&a)await a.updateTaskStatus(p,"input_required");return await this.request(u,l,f)},authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo,taskId:o,taskStore:a,taskRequestedTtl:i?.ttl,closeSSEStream:t?.closeSSEStream,closeStandaloneSSEStream:t?.closeStandaloneSSEStream};Promise.resolve().then(()=>{if(i)this.assertTaskHandlerCapability(e.method)}).then(()=>r(e,c)).then(async(u)=>{if(s.signal.aborted)return;let l={result:u,jsonrpc:"2.0",id:e.id};if(o&&this._taskMessageQueue)await this._enqueueTaskMessage(o,{type:"response",message:l,timestamp:Date.now()},n?.sessionId);else await n?.send(l)},async(u)=>{if(s.signal.aborted)return;let l={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(u.code)?u.code:N.InternalError,message:u.message??"Internal error",...u.data!==void 0&&{data:u.data}}};if(o&&this._taskMessageQueue)await this._enqueueTaskMessage(o,{type:"error",message:l,timestamp:Date.now()},n?.sessionId);else await n?.send(l)}).catch((u)=>this._onerror(Error(`Failed to send response: ${u}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(e.id)===s)this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...r}=e.params,n=Number(t),o=this._progressHandlers.get(n);if(!o){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let s=this._responseHandlers.get(n),i=this._timeoutInfo.get(n);if(i&&s&&i.resetTimeoutOnProgress)try{this._resetTimeout(n)}catch(a){this._responseHandlers.delete(n),this._progressHandlers.delete(n),this._cleanupTimeout(n),s(a);return}o(r)}_onresponse(e){let t=Number(e.id),r=this._requestResolvers.get(t);if(r){if(this._requestResolvers.delete(t),jn(e))r(e);else{let s=new R(e.error.code,e.error.message,e.error.data);r(s)}return}let n=this._responseHandlers.get(t);if(n===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t);let o=!1;if(jn(e)&&e.result&&typeof e.result==="object"){let s=e.result;if(s.task&&typeof s.task==="object"){let i=s.task;if(typeof i.taskId==="string")o=!0,this._taskProgressTokens.set(i.taskId,t)}}if(!o)this._progressHandlers.delete(t);if(jn(e))n(e);else{let s=R.fromError(e.error.code,e.error.message,e.error.data);n(s)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,t,r){let{task:n}=r??{};if(!n){try{yield{type:"result",result:await this.request(e,t,r)}}catch(s){yield{type:"error",error:s instanceof R?s:new R(N.InternalError,String(s))}}return}let o;try{let s=await this.request(e,Er,r);if(s.task)o=s.task.taskId,yield{type:"taskCreated",task:s.task};else throw new R(N.InternalError,"Task creation did not return a task");while(!0){let i=await this.getTask({taskId:o},r);if(yield{type:"taskStatus",task:i},Mt(i.status)){if(i.status==="completed")yield{type:"result",result:await this.getTaskResult({taskId:o},t,r)};else if(i.status==="failed")yield{type:"error",error:new R(N.InternalError,`Task ${o} failed`)};else if(i.status==="cancelled")yield{type:"error",error:new R(N.InternalError,`Task ${o} was cancelled`)};return}if(i.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:o},t,r)};return}let a=i.pollInterval??this._options?.defaultTaskPollInterval??1000;await new Promise((c)=>setTimeout(c,a)),r?.signal?.throwIfAborted()}}catch(s){yield{type:"error",error:s instanceof R?s:new R(N.InternalError,String(s))}}}request(e,t,r){let{relatedRequestId:n,resumptionToken:o,onresumptiontoken:s,task:i,relatedTask:a}=r??{};return new Promise((c,u)=>{let l=(v)=>{u(v)};if(!this._transport){l(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod(e.method),i)this.assertTaskCapability(e.method)}catch(v){l(v);return}r?.signal?.throwIfAborted();let d=this._requestMessageId++,f={...e,jsonrpc:"2.0",id:d};if(r?.onprogress)this._progressHandlers.set(d,r.onprogress),f.params={...e.params,_meta:{...e.params?._meta||{},progressToken:d}};if(i)f.params={...f.params,task:i};if(a)f.params={...f.params,_meta:{...f.params?._meta||{},[Zt]:a}};let p=(v)=>{this._responseHandlers.delete(d),this._progressHandlers.delete(d),this._cleanupTimeout(d),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:d,reason:String(v)}},{relatedRequestId:n,resumptionToken:o,onresumptiontoken:s}).catch((A)=>this._onerror(Error(`Failed to send cancellation: ${A}`)));let z=v instanceof R?v:new R(N.RequestTimeout,String(v));u(z)};this._responseHandlers.set(d,(v)=>{if(r?.signal?.aborted)return;if(v instanceof Error)return u(v);try{let z=Nt(t,v.result);if(!z.success)u(z.error);else c(z.data)}catch(z){u(z)}}),r?.signal?.addEventListener("abort",()=>{p(r?.signal?.reason)});let m=r?.timeout??oS,h=()=>p(R.fromError(N.RequestTimeout,"Request timed out",{timeout:m}));this._setupTimeout(d,m,r?.maxTotalTimeout,h,r?.resetTimeoutOnProgress??!1);let _=a?.taskId;if(_){let v=(z)=>{let A=this._responseHandlers.get(d);if(A)A(z);else this._onerror(Error(`Response handler missing for side-channeled request ${d}`))};this._requestResolvers.set(d,v),this._enqueueTaskMessage(_,{type:"request",message:f,timestamp:Date.now()}).catch((z)=>{this._cleanupTimeout(d),u(z)})}else this._transport.send(f,{relatedRequestId:n,resumptionToken:o,onresumptiontoken:s}).catch((v)=>{this._cleanupTimeout(d),u(v)})})}async getTask(e,t){return this.request({method:"tasks/get",params:e},xs,t)}async getTaskResult(e,t,r){return this.request({method:"tasks/result",params:e},t,r)}async listTasks(e,t){return this.request({method:"tasks/list",params:e},ws,t)}async cancelTask(e,t){return this.request({method:"tasks/cancel",params:e},nh,t)}async notification(e,t){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(e.method);let r=t?.relatedTask?.taskId;if(r){let i={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[Zt]:t.relatedTask}}};await this._enqueueTaskMessage(r,{type:"notification",message:i,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!t?.relatedRequestId&&!t?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let i={...e,jsonrpc:"2.0"};if(t?.relatedTask)i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[Zt]:t.relatedTask}}};this._transport?.send(i,t).catch((a)=>this._onerror(a))});return}let s={...e,jsonrpc:"2.0"};if(t?.relatedTask)s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[Zt]:t.relatedTask}}};await this._transport.send(s,t)}setRequestHandler(e,t){let r=Au(e);this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(n,o)=>{let s=Nu(e,n);return Promise.resolve(t(s,o))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){let r=Au(e);this._notificationHandlers.set(r,(n)=>{let o=Nu(e,n);return Promise.resolve(t(o))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let t=this._taskProgressTokens.get(e);if(t!==void 0)this._progressHandlers.delete(t),this._taskProgressTokens.delete(e)}async _enqueueTaskMessage(e,t,r){if(!this._taskStore||!this._taskMessageQueue)throw Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let n=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,t,r,n)}async _clearTaskQueue(e,t){if(this._taskMessageQueue){let r=await this._taskMessageQueue.dequeueAll(e,t);for(let n of r)if(n.type==="request"&&mu(n.message)){let o=n.message.id,s=this._requestResolvers.get(o);if(s)s(new R(N.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(o);else this._onerror(Error(`Resolver missing for request ${o} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,t){let r=this._options?.defaultTaskPollInterval??1000;try{let n=await this._taskStore?.getTask(e);if(n?.pollInterval)r=n.pollInterval}catch{}return new Promise((n,o)=>{if(t.aborted){o(new R(N.InvalidRequest,"Request cancelled"));return}let s=setTimeout(n,r);t.addEventListener("abort",()=>{clearTimeout(s),o(new R(N.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,t){let r=this._taskStore;if(!r)throw Error("No task store configured");return{createTask:async(n)=>{if(!e)throw Error("No request provided");return await r.createTask(n,e.id,{method:e.method,params:e.params},t)},getTask:async(n)=>{let o=await r.getTask(n,t);if(!o)throw new R(N.InvalidParams,"Failed to retrieve task: Task not found");return o},storeTaskResult:async(n,o,s)=>{await r.storeTaskResult(n,o,s,t);let i=await r.getTask(n,t);if(i){let a=Ln.parse({method:"notifications/tasks/status",params:i});if(await this.notification(a),Mt(i.status))this._cleanupTaskProgressHandler(n)}},getTaskResult:(n)=>r.getTaskResult(n,t),updateTaskStatus:async(n,o,s)=>{let i=await r.getTask(n,t);if(!i)throw new R(N.InvalidParams,`Task "${n}" not found - it may have been cleaned up`);if(Mt(i.status))throw new R(N.InvalidParams,`Cannot update task "${n}" from terminal status "${i.status}" to "${o}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await r.updateTaskStatus(n,o,s,t);let a=await r.getTask(n,t);if(a){let c=Ln.parse({method:"notifications/tasks/status",params:a});if(await this.notification(c),Mt(a.status))this._cleanupTaskProgressHandler(n)}},listTasks:(n)=>r.listTasks(n,t)}}}function Vh(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function Hh(e,t){let r={...e};for(let n in t){let o=n,s=t[o];if(s===void 0)continue;let i=r[o];if(Vh(i)&&Vh(s))r[o]={...i,...s};else r[o]=s}return r}var Ax=sd(Zl(),1),Nx=sd(Cx(),1);function AI(){let e=new Ax.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return Nx.default(e),e}class Jl{constructor(e){this._ajv=e??AI()}getValidator(e){let t="$id"in e&&typeof e.$id==="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return(r)=>{if(t(r))return{valid:!0,data:r,errorMessage:void 0};else return{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(t.errors)}}}}class Kl{constructor(e){this._server=e}requestStream(e,t,r){return this._server.requestStream(e,t,r)}createMessageStream(e,t){let r=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!r?.sampling?.tools)throw Error("Client does not support sampling tools capability.");if(e.messages.length>0){let n=e.messages[e.messages.length-1],o=Array.isArray(n.content)?n.content:[n.content],s=o.some((u)=>u.type==="tool_result"),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],c=a.some((u)=>u.type==="tool_use");if(s){if(o.some((u)=>u.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!c)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let u=new Set(a.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 Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:e},Vn,t)}elicitInputStream(e,t){let r=this._server.getClientCapabilities(),n=e.mode??"form";switch(n){case"url":{if(!r?.elicitation?.url)throw Error("Client does not support url elicitation.");break}case"form":{if(!r?.elicitation?.form)throw Error("Client does not support form elicitation.");break}}let o=n==="form"&&e.mode===void 0?{...e,mode:"form"}:e;return this.requestStream({method:"elicitation/create",params:o},Ir,t)}async getTask(e,t){return this._server.getTask({taskId:e},t)}async getTaskResult(e,t,r){return this._server.getTaskResult({taskId:e},t,r)}async listTasks(e,t){return this._server.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._server.cancelTask({taskId:e},t)}}function jx(e,t,r){if(!e)throw Error(`${r} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!e.tools?.call)throw Error(`${r} does not support task creation for tools/call (required for ${t})`);break;default:break}}function Zx(e,t,r){if(!e)throw Error(`${r} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!e.sampling?.createMessage)throw Error(`${r} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!e.elicitation?.create)throw Error(`${r} does not support task creation for elicitation/create (required for ${t})`);break;default:break}}class Gl extends ju{constructor(e,t){super(t);if(this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Un.options.map((r,n)=>[r,n])),this.isMessageIgnored=(r,n)=>{let o=this._loggingLevels.get(n);return o?this.LOG_LEVEL_SEVERITY.get(r)<this.LOG_LEVEL_SEVERITY.get(o):!1},this._capabilities=t?.capabilities??{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new Jl,this.setRequestHandler(_u,(r)=>this._oninitialize(r)),this.setNotificationHandler(yu,()=>this.oninitialized?.()),this._capabilities.logging)this.setRequestHandler(Su,async(r,n)=>{let o=n.sessionId||n.requestInfo?.headers["mcp-session-id"]||void 0,{level:s}=r.params,i=Un.safeParse(s);if(i.success)this._loggingLevels.set(o,i.data);return{}})}get experimental(){if(!this._experimental)this._experimental={tasks:new Kl(this)};return this._experimental}registerCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=Hh(this._capabilities,e)}setRequestHandler(e,t){let n=jt(e)?.method;if(!n)throw Error("Schema is missing a method literal");let o=Pr(n);if(typeof o!=="string")throw Error("Schema method literal must be a string");if(o==="tools/call"){let i=async(a,c)=>{let u=Nt(Rr,a);if(!u.success){let p=u.error instanceof Error?u.error.message:String(u.error);throw new R(N.InvalidParams,`Invalid tools/call request: ${p}`)}let{params:l}=u.data,d=await Promise.resolve(t(a,c));if(l.task){let p=Nt(Er,d);if(!p.success){let m=p.error instanceof Error?p.error.message:String(p.error);throw new R(N.InvalidParams,`Invalid task creation result: ${m}`)}return p.data}let f=Nt(Rs,d);if(!f.success){let p=f.error instanceof Error?f.error.message:String(f.error);throw new R(N.InvalidParams,`Invalid tools/call result: ${p}`)}return f.data};return super.setRequestHandler(e,i)}return super.setRequestHandler(e,t)}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(!this._capabilities)return;switch(e){case"completion/complete":if(!this._capabilities.completions)throw Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Server does not support tools (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw Error(`Server does not support tasks capability (required for ${e})`);break;case"ping":case"initialize":break}}assertTaskCapability(e){Zx(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){if(!this._capabilities)return;jx(this._capabilities.tasks?.requests,e,"Server")}async _oninitialize(e){let t=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:Jm.includes(t)?t:pu,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"},hs)}async createMessage(e,t){if(e.tools||e.toolChoice){if(!this._clientCapabilities?.sampling?.tools)throw Error("Client does not support sampling tools capability.")}if(e.messages.length>0){let r=e.messages[e.messages.length-1],n=Array.isArray(r.content)?r.content:[r.content],o=n.some((c)=>c.type==="tool_result"),s=e.messages.length>1?e.messages[e.messages.length-2]:void 0,i=s?Array.isArray(s.content)?s.content:[s.content]:[],a=i.some((c)=>c.type==="tool_use");if(o){if(n.some((c)=>c.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!a)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(a){let c=new Set(i.filter((l)=>l.type==="tool_use").map((l)=>l.id)),u=new Set(n.filter((l)=>l.type==="tool_result").map((l)=>l.toolUseId));if(c.size!==u.size||![...c].every((l)=>u.has(l)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}if(e.tools)return this.request({method:"sampling/createMessage",params:e},zu,t);return this.request({method:"sampling/createMessage",params:e},Vn,t)}async elicitInput(e,t){switch(e.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support url elicitation.");let n=e;return this.request({method:"elicitation/create",params:n},Ir,t)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw Error("Client does not support form elicitation.");let n=e.mode==="form"?e:{...e,mode:"form"},o=await this.request({method:"elicitation/create",params:n},Ir,t);if(o.action==="accept"&&o.content&&n.requestedSchema)try{let i=this._jsonSchemaValidator.getValidator(n.requestedSchema)(o.content);if(!i.valid)throw new R(N.InvalidParams,`Elicitation response content does not match requested schema: ${i.errorMessage}`)}catch(s){if(s instanceof R)throw s;throw new R(N.InternalError,`Error validating elicitation response: ${s instanceof Error?s.message:String(s)}`)}return o}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},t)}async listRoots(e,t){return this.request({method:"roots/list",params:e},Pu,t)}async sendLoggingMessage(e,t){if(this._capabilities.logging){if(!this.isMessageIgnored(e.level,t))return this.notification({method:"notifications/message",params:e})}}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}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 Dx=Symbol.for("mcp.completable");function Wl(e){return!!e&&typeof e==="object"&&Dx in e}function qx(e){return e[Dx]?.complete}var Mx;(function(e){e.Completable="McpCompletable"})(Mx||(Mx={}));var NI=/^[A-Za-z0-9._-]{1,128}$/;function jI(e){let t=[];if(e.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(e.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${e.length})`]};if(e.includes(" "))t.push("Tool name contains spaces, which may cause parsing issues");if(e.includes(","))t.push("Tool name contains commas, which may cause parsing issues");if(e.startsWith("-")||e.endsWith("-"))t.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts");if(e.startsWith(".")||e.endsWith("."))t.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts");if(!NI.test(e)){let r=e.split("").filter((n)=>!/[A-Za-z0-9._-]/.test(n)).filter((n,o,s)=>s.indexOf(n)===o);return t.push(`Tool name contains invalid characters: ${r.map((n)=>`"${n}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:t}}return{isValid:!0,warnings:t}}function ZI(e,t){if(t.length>0){console.warn(`Tool name validation warning for "${e}":`);for(let r of t)console.warn(` - ${r}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function Xl(e){let t=jI(e);return ZI(e,t.warnings),t.isValid}class Yl{constructor(e){this._mcpServer=e}registerToolTask(e,t,r){let n={taskSupport:"required",...t.execution};if(n.taskSupport==="forbidden")throw Error(`Cannot register task-based tool '${e}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(e,t.title,t.description,t.inputSchema,t.outputSchema,t.annotations,n,t._meta,r)}}class ed{constructor(e,t){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new Gl(e,t)}get experimental(){if(!this._experimental)this._experimental={tasks:new Yl(this)};return this._experimental}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){if(this._toolHandlersInitialized)return;this.server.assertCanSetRequestHandler(Bt(Os)),this.server.assertCanSetRequestHandler(Bt(Rr)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(Os,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,t])=>{let r={name:e,title:t.title,description:t.description,inputSchema:(()=>{let n=zr(t.inputSchema);return n?Cu(n,{strictUnions:!0,pipeStrategy:"input"}):MI})(),annotations:t.annotations,execution:t.execution,_meta:t._meta};if(t.outputSchema){let n=zr(t.outputSchema);if(n)r.outputSchema=Cu(n,{strictUnions:!0,pipeStrategy:"output"})}return r})})),this.server.setRequestHandler(Rr,async(e,t)=>{try{let r=this._registeredTools[e.params.name];if(!r)throw new R(N.InvalidParams,`Tool ${e.params.name} not found`);if(!r.enabled)throw new R(N.InvalidParams,`Tool ${e.params.name} disabled`);let n=!!e.params.task,o=r.execution?.taskSupport,s="createTask"in r.handler;if((o==="required"||o==="optional")&&!s)throw new R(N.InternalError,`Tool ${e.params.name} has taskSupport '${o}' but was not registered with registerToolTask`);if(o==="required"&&!n)throw new R(N.MethodNotFound,`Tool ${e.params.name} requires task augmentation (taskSupport: 'required')`);if(o==="optional"&&!n&&s)return await this.handleAutomaticTaskPolling(r,e,t);let i=await this.validateToolInput(r,e.params.arguments,e.params.name),a=await this.executeToolHandler(r,i,t);if(n)return a;return await this.validateToolOutput(r,a,e.params.name),a}catch(r){if(r instanceof R){if(r.code===N.UrlElicitationRequired)throw r}return this.createToolError(r instanceof Error?r.message:String(r))}}),this._toolHandlersInitialized=!0}createToolError(e){return{content:[{type:"text",text:e}],isError:!0}}async validateToolInput(e,t,r){if(!e.inputSchema)return;let o=zr(e.inputSchema)??e.inputSchema,s=await ss(o,t);if(!s.success){let i="error"in s?s.error:"Unknown error",a=is(i);throw new R(N.InvalidParams,`Input validation error: Invalid arguments for tool ${r}: ${a}`)}return s.data}async validateToolOutput(e,t,r){if(!e.outputSchema)return;if(!("content"in t))return;if(t.isError)return;if(!t.structuredContent)throw new R(N.InvalidParams,`Output validation error: Tool ${r} has an output schema but no structured content was provided`);let n=zr(e.outputSchema),o=await ss(n,t.structuredContent);if(!o.success){let s="error"in o?o.error:"Unknown error",i=is(s);throw new R(N.InvalidParams,`Output validation error: Invalid structured content for tool ${r}: ${i}`)}}async executeToolHandler(e,t,r){let n=e.handler;if("createTask"in n){if(!r.taskStore)throw Error("No task store provided.");let s={...r,taskStore:r.taskStore};if(e.inputSchema)return await Promise.resolve(n.createTask(t,s));else return await Promise.resolve(n.createTask(s))}if(e.inputSchema)return await Promise.resolve(n(t,r));else return await Promise.resolve(n(r))}async handleAutomaticTaskPolling(e,t,r){if(!r.taskStore)throw Error("No task store provided for task-capable tool.");let n=await this.validateToolInput(e,t.params.arguments,t.params.name),o=e.handler,s={...r,taskStore:r.taskStore},i=n?await Promise.resolve(o.createTask(n,s)):await Promise.resolve(o.createTask(s)),a=i.task.taskId,c=i.task,u=c.pollInterval??5000;while(c.status!=="completed"&&c.status!=="failed"&&c.status!=="cancelled"){await new Promise((d)=>setTimeout(d,u));let l=await r.taskStore.getTask(a);if(!l)throw new R(N.InternalError,`Task ${a} not found during polling`);c=l}return await r.taskStore.getTaskResult(a)}setCompletionRequestHandler(){if(this._completionHandlerInitialized)return;this.server.assertCanSetRequestHandler(Bt(Is)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(Is,async(e)=>{switch(e.params.ref.type){case"ref/prompt":return uh(e),this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return lh(e),this.handleResourceCompletion(e,e.params.ref);default:throw new R(N.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0}async handlePromptCompletion(e,t){let r=this._registeredPrompts[t.name];if(!r)throw new R(N.InvalidParams,`Prompt ${t.name} not found`);if(!r.enabled)throw new R(N.InvalidParams,`Prompt ${t.name} disabled`);if(!r.argsSchema)return _o;let o=jt(r.argsSchema)?.[e.params.argument.name];if(!Wl(o))return _o;let s=qx(o);if(!s)return _o;let i=await s(e.params.argument.value,e.params.context);return Fx(i)}async handleResourceCompletion(e,t){let r=Object.values(this._registeredResourceTemplates).find((s)=>s.resourceTemplate.uriTemplate.toString()===t.uri);if(!r){if(this._registeredResources[t.uri])return _o;throw new R(N.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let n=r.resourceTemplate.completeCallback(e.params.argument.name);if(!n)return _o;let o=await n(e.params.argument.value,e.params.context);return Fx(o)}setResourceRequestHandlers(){if(this._resourceHandlersInitialized)return;this.server.assertCanSetRequestHandler(Bt(Ss)),this.server.assertCanSetRequestHandler(Bt(zs)),this.server.assertCanSetRequestHandler(Bt(Ps)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(Ss,async(e,t)=>{let r=Object.entries(this._registeredResources).filter(([o,s])=>s.enabled).map(([o,s])=>({uri:o,name:s.name,...s.metadata})),n=[];for(let o of Object.values(this._registeredResourceTemplates)){if(!o.resourceTemplate.listCallback)continue;let s=await o.resourceTemplate.listCallback(t);for(let i of s.resources)n.push({...o.metadata,...i})}return{resources:[...r,...n]}}),this.server.setRequestHandler(zs,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([t,r])=>({name:t,uriTemplate:r.resourceTemplate.uriTemplate.toString(),...r.metadata}))})),this.server.setRequestHandler(Ps,async(e,t)=>{let r=new URL(e.params.uri),n=this._registeredResources[r.toString()];if(n){if(!n.enabled)throw new R(N.InvalidParams,`Resource ${r} disabled`);return n.readCallback(r,t)}for(let o of Object.values(this._registeredResourceTemplates)){let s=o.resourceTemplate.uriTemplate.match(r.toString());if(s)return o.readCallback(r,s,t)}throw new R(N.InvalidParams,`Resource ${r} not found`)}),this._resourceHandlersInitialized=!0}setPromptRequestHandlers(){if(this._promptHandlersInitialized)return;this.server.assertCanSetRequestHandler(Bt(Ts)),this.server.assertCanSetRequestHandler(Bt(Es)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(Ts,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,t])=>({name:e,title:t.title,description:t.description,arguments:t.argsSchema?DI(t.argsSchema):void 0}))})),this.server.setRequestHandler(Es,async(e,t)=>{let r=this._registeredPrompts[e.params.name];if(!r)throw new R(N.InvalidParams,`Prompt ${e.params.name} not found`);if(!r.enabled)throw new R(N.InvalidParams,`Prompt ${e.params.name} disabled`);if(r.argsSchema){let n=zr(r.argsSchema),o=await ss(n,e.params.arguments);if(!o.success){let a="error"in o?o.error:"Unknown error",c=is(a);throw new R(N.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${c}`)}let s=o.data,i=r.callback;return await Promise.resolve(i(s,t))}else{let n=r.callback;return await Promise.resolve(n(t))}}),this._promptHandlersInitialized=!0}resource(e,t,...r){let n;if(typeof r[0]==="object")n=r.shift();let o=r[0];if(typeof t==="string"){if(this._registeredResources[t])throw Error(`Resource ${t} is already registered`);let s=this._createRegisteredResource(e,void 0,t,n,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}else{if(this._registeredResourceTemplates[e])throw Error(`Resource template ${e} is already registered`);let s=this._createRegisteredResourceTemplate(e,void 0,t,n,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}}registerResource(e,t,r,n){if(typeof t==="string"){if(this._registeredResources[t])throw Error(`Resource ${t} is already registered`);let o=this._createRegisteredResource(e,r.title,t,r,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}else{if(this._registeredResourceTemplates[e])throw Error(`Resource template ${e} is already registered`);let o=this._createRegisteredResourceTemplate(e,r.title,t,r,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}}_createRegisteredResource(e,t,r,n,o){let s={name:e,title:t,metadata:n,readCallback:o,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({uri:null}),update:(i)=>{if(typeof i.uri<"u"&&i.uri!==r){if(delete this._registeredResources[r],i.uri)this._registeredResources[i.uri]=s}if(typeof i.name<"u")s.name=i.name;if(typeof i.title<"u")s.title=i.title;if(typeof i.metadata<"u")s.metadata=i.metadata;if(typeof i.callback<"u")s.readCallback=i.callback;if(typeof i.enabled<"u")s.enabled=i.enabled;this.sendResourceListChanged()}};return this._registeredResources[r]=s,s}_createRegisteredResourceTemplate(e,t,r,n,o){let s={resourceTemplate:r,title:t,metadata:n,readCallback:o,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({name:null}),update:(c)=>{if(typeof c.name<"u"&&c.name!==e){if(delete this._registeredResourceTemplates[e],c.name)this._registeredResourceTemplates[c.name]=s}if(typeof c.title<"u")s.title=c.title;if(typeof c.template<"u")s.resourceTemplate=c.template;if(typeof c.metadata<"u")s.metadata=c.metadata;if(typeof c.callback<"u")s.readCallback=c.callback;if(typeof c.enabled<"u")s.enabled=c.enabled;this.sendResourceListChanged()}};this._registeredResourceTemplates[e]=s;let i=r.uriTemplate.variableNames;if(Array.isArray(i)&&i.some((c)=>!!r.completeCallback(c)))this.setCompletionRequestHandler();return s}_createRegisteredPrompt(e,t,r,n,o){let s={title:t,description:r,argsSchema:n===void 0?void 0:nr(n),callback:o,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({name:null}),update:(i)=>{if(typeof i.name<"u"&&i.name!==e){if(delete this._registeredPrompts[e],i.name)this._registeredPrompts[i.name]=s}if(typeof i.title<"u")s.title=i.title;if(typeof i.description<"u")s.description=i.description;if(typeof i.argsSchema<"u")s.argsSchema=nr(i.argsSchema);if(typeof i.callback<"u")s.callback=i.callback;if(typeof i.enabled<"u")s.enabled=i.enabled;this.sendPromptListChanged()}};if(this._registeredPrompts[e]=s,n){if(Object.values(n).some((a)=>{let c=a instanceof ds?a._def?.innerType:a;return Wl(c)}))this.setCompletionRequestHandler()}return s}_createRegisteredTool(e,t,r,n,o,s,i,a,c){Xl(e);let u={title:t,description:r,inputSchema:Lx(n),outputSchema:Lx(o),annotations:s,execution:i,_meta:a,handler:c,enabled:!0,disable:()=>u.update({enabled:!1}),enable:()=>u.update({enabled:!0}),remove:()=>u.update({name:null}),update:(l)=>{if(typeof l.name<"u"&&l.name!==e){if(typeof l.name==="string")Xl(l.name);if(delete this._registeredTools[e],l.name)this._registeredTools[l.name]=u}if(typeof l.title<"u")u.title=l.title;if(typeof l.description<"u")u.description=l.description;if(typeof l.paramsSchema<"u")u.inputSchema=nr(l.paramsSchema);if(typeof l.outputSchema<"u")u.outputSchema=nr(l.outputSchema);if(typeof l.callback<"u")u.handler=l.callback;if(typeof l.annotations<"u")u.annotations=l.annotations;if(typeof l._meta<"u")u._meta=l._meta;if(typeof l.enabled<"u")u.enabled=l.enabled;this.sendToolListChanged()}};return this._registeredTools[e]=u,this.setToolRequestHandlers(),this.sendToolListChanged(),u}tool(e,...t){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let r,n,o,s;if(typeof t[0]==="string")r=t.shift();if(t.length>1){let a=t[0];if(Ql(a)){if(n=t.shift(),t.length>1&&typeof t[0]==="object"&&t[0]!==null&&!Ql(t[0]))s=t.shift()}else if(typeof a==="object"&&a!==null){if(Object.values(a).some((c)=>typeof c==="object"&&c!==null))throw Error(`Tool ${e} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);s=t.shift()}}let i=t[0];return this._createRegisteredTool(e,void 0,r,n,o,s,{taskSupport:"forbidden"},void 0,i)}registerTool(e,t,r){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let{title:n,description:o,inputSchema:s,outputSchema:i,annotations:a,_meta:c}=t;return this._createRegisteredTool(e,n,o,s,i,a,{taskSupport:"forbidden"},c,r)}prompt(e,...t){if(this._registeredPrompts[e])throw Error(`Prompt ${e} is already registered`);let r;if(typeof t[0]==="string")r=t.shift();let n;if(t.length>1)n=t.shift();let o=t[0],s=this._createRegisteredPrompt(e,void 0,r,n,o);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),s}registerPrompt(e,t,r){if(this._registeredPrompts[e])throw Error(`Prompt ${e} is already registered`);let{title:n,description:o,argsSchema:s}=t,i=this._createRegisteredPrompt(e,n,o,s,r);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),i}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(e,t){return this.server.sendLoggingMessage(e,t)}sendResourceListChanged(){if(this.isConnected())this.server.sendResourceListChanged()}sendToolListChanged(){if(this.isConnected())this.server.sendToolListChanged()}sendPromptListChanged(){if(this.isConnected())this.server.sendPromptListChanged()}}var MI={type:"object",properties:{}};function Ux(e){return e!==null&&typeof e==="object"&&"parse"in e&&typeof e.parse==="function"&&"safeParse"in e&&typeof e.safeParse==="function"}function Vx(e){return"_def"in e||"_zod"in e||Ux(e)}function Ql(e){if(typeof e!=="object"||e===null)return!1;if(Vx(e))return!1;if(Object.keys(e).length===0)return!0;return Object.values(e).some(Ux)}function Lx(e){if(!e)return;if(Ql(e))return nr(e);if(!Vx(e))throw Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");return e}function DI(e){let t=jt(e);if(!t)return[];return Object.entries(t).map(([r,n])=>{let o=pm(n),s=fm(n);return{name:r,description:o,required:!s}})}function Bt(e){let r=jt(e)?.method;if(!r)throw Error("Schema is missing a method literal");let n=Pr(r);if(typeof n==="string")return n;throw Error("Schema method literal must be a string")}function Fx(e){return{completion:{values:e.slice(0,100),total:e.length,hasMore:e.length>100}}}var _o={completion:{values:[],hasMore:!1}};import Bx from"node:process";var qI=10485760;class td{constructor(e){this._maxBufferSize=e?.maxBufferSize??qI}append(e){if((this._buffer?.length??0)+e.length>this._maxBufferSize)throw this.clear(),Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
74
74
  `);if(e===-1)return null;let t=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),LI(t)}clear(){this._buffer=void 0}}function LI(e){return th.parse(JSON.parse(e))}function Hx(e){return JSON.stringify(e)+`
75
- `}class rd{constructor(e=Bx.stdin,t=Bx.stdout,r){this._stdin=e,this._stdout=t,this._started=!1,this._ondata=(n)=>{try{this._readBuffer.append(n),this.processReadBuffer()}catch(o){this.onerror?.(o),this.close().catch(()=>{})}},this._onerror=(n)=>{this.onerror?.(n)},this._readBuffer=new td({maxBufferSize:r?.maxBufferSize})}async start(){if(this._started)throw Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){while(!0)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){if(this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),this.onclose?.()}send(e){return new Promise((t)=>{let r=Hx(e);if(this._stdout.write(r))t();else this._stdout.once("drain",t)})}}var Jx=Te(["public","link","people"]),FI=(e)=>({content:[{type:"text",text:typeof e==="string"?e:JSON.stringify(e,null,2)}]}),UI=(e)=>({isError:!0,content:[{type:"text",text:`error: ${e instanceof Error?e.message:String(e)}`}]}),pr=async(e)=>{try{return FI(await e())}catch(t){return UI(t)}};async function Kx(){let e=new ed({name:"handout",version:"0.1.0"});e.registerTool("publish",{description:"Publish one HTML document as a new handout and get a shareable, versioned URL. Inline all CSS and JS; no relative paths. Returns { slug, url, version }. Show the person the url.",inputSchema:{html:g().describe("Complete HTML document"),slug:g().optional().describe("Optional readable slug, lowercase letters, digits and dashes. Generated when omitted."),title:g().optional().describe("Title shown in the viewer top bar. Defaults to <title>."),visibility:Jx.optional().describe("public (indexable), link (default, unguessable URL) or people (named viewers log in)")}},({html:t,slug:r,title:n,visibility:o})=>pr(()=>G("/api/artifacts",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({html:t,slug:r,title:n,visibility:o})}))),e.registerTool("update",{description:"Publish a new version of an existing handout. Old versions stay reachable at /<slug>/v/<n>. Returns the same url plus versionUrl.",inputSchema:{slug:g(),html:g().describe("Complete HTML document"),title:g().optional()}},({slug:t,html:r,title:n})=>pr(()=>G(`/api/artifacts/${encodeURIComponent(t)}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({html:r,title:n})}))),e.registerTool("list",{description:"List the handouts in the current account.",inputSchema:{}},()=>pr(()=>G("/api/artifacts"))),e.registerTool("get",{description:"Details of one handout: title, visibility, url, people and every version.",inputSchema:{slug:g()}},({slug:t})=>pr(()=>G(`/api/artifacts/${encodeURIComponent(t)}`))),e.registerTool("share",{description:"Change who can view a handout. Set visibility, and/or add or remove people (GitHub logins or emails). Adding people switches visibility to people. rotateLink issues a fresh unguessable link.",inputSchema:{slug:g(),visibility:Jx.optional(),add:U(g()).optional(),remove:U(g()).optional(),rotateLink:he().optional()}},({slug:t,visibility:r,add:n,remove:o,rotateLink:s})=>pr(async()=>{let i=`/api/artifacts/${encodeURIComponent(t)}`,a=r??(n?.length?"people":void 0);if(a||s)await G(i,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({visibility:a,rotateLink:s})});if(n?.length||o?.length)await G(`${i}/people`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({add:n,remove:o})});return G(i)})),e.registerTool("delete",{description:"Delete a handout and every version. The slug becomes free again.",inputSchema:{slug:g()}},({slug:t})=>pr(()=>G(`/api/artifacts/${encodeURIComponent(t)}`,{method:"DELETE"}))),e.registerTool("whoami",{description:"Who the token belongs to, which account it publishes into, and which host links use.",inputSchema:{}},()=>pr(()=>G("/api/me"))),e.registerResource("instructions",`${ct().origin}/for-agents.md`,{description:"Current handout instructions for agents",mimeType:"text/markdown"},async(t)=>({contents:[{uri:t.href,mimeType:"text/markdown",text:await Gx()}]})),await e.connect(new rd)}async function Gx(){let e=await fetch(`${ct().origin}/for-agents.md`);if(!e.ok)throw Error(`could not fetch instructions: ${e.status}`);return e.text()}async function Wx(){console.log(await Gx())}var Xx=`handout ${Hr.version} — publish one HTML file, get a shareable versioned link
75
+ `}class rd{constructor(e=Bx.stdin,t=Bx.stdout,r){this._stdin=e,this._stdout=t,this._started=!1,this._ondata=(n)=>{try{this._readBuffer.append(n),this.processReadBuffer()}catch(o){this.onerror?.(o),this.close().catch(()=>{})}},this._onerror=(n)=>{this.onerror?.(n)},this._readBuffer=new td({maxBufferSize:r?.maxBufferSize})}async start(){if(this._started)throw Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){while(!0)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){if(this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),this.onclose?.()}send(e){return new Promise((t)=>{let r=Hx(e);if(this._stdout.write(r))t();else this._stdout.once("drain",t)})}}var Jx=Te(["public","link","people"]),FI=(e)=>({content:[{type:"text",text:typeof e==="string"?e:JSON.stringify(e,null,2)}]}),UI=(e)=>({isError:!0,content:[{type:"text",text:`error: ${e instanceof Error?e.message:String(e)}`}]}),pr=async(e)=>{try{return FI(await e())}catch(t){return UI(t)}};async function Kx(){let e=new ed({name:"handout",version:"0.1.0"});e.registerTool("publish",{description:"Publish one HTML document as a new handout and get a shareable, versioned URL. Inline all CSS and JS; no relative paths. Returns { slug, url, version }. Show the person the url.",inputSchema:{html:g().describe("Complete HTML document"),slug:g().optional().describe("Optional readable slug, lowercase letters, digits and dashes. Generated when omitted."),title:g().optional().describe("Title shown in the viewer top bar. Defaults to <title>."),visibility:Jx.optional().describe("public (indexable), link (default, unguessable URL) or people (named viewers log in)")}},({html:t,slug:r,title:n,visibility:o})=>pr(()=>B("/api/artifacts",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({html:t,slug:r,title:n,visibility:o})}))),e.registerTool("update",{description:"Publish a new version of an existing handout. Old versions stay reachable at /<slug>/v/<n>. Returns the same url plus versionUrl.",inputSchema:{slug:g(),html:g().describe("Complete HTML document"),title:g().optional()}},({slug:t,html:r,title:n})=>pr(()=>B(`/api/artifacts/${encodeURIComponent(t)}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({html:r,title:n})}))),e.registerTool("list",{description:"List the handouts in the current account.",inputSchema:{}},()=>pr(()=>B("/api/artifacts"))),e.registerTool("get",{description:"Details of one handout: title, visibility, url, people and every version.",inputSchema:{slug:g()}},({slug:t})=>pr(()=>B(`/api/artifacts/${encodeURIComponent(t)}`))),e.registerTool("share",{description:"Change who can view a handout. Set visibility, and/or add or remove people (GitHub logins or verified emails). Adding people switches visibility to people. rotateLink issues a fresh unguessable link.",inputSchema:{slug:g(),visibility:Jx.optional(),add:U(g()).optional(),remove:U(g()).optional(),rotateLink:he().optional()}},({slug:t,visibility:r,add:n,remove:o,rotateLink:s})=>pr(async()=>{let i=`/api/artifacts/${encodeURIComponent(t)}`,a=r??(n?.length?"people":void 0);if(a||s)await B(i,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({visibility:a,rotateLink:s})});if(n?.length||o?.length)await B(`${i}/people`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({add:n,remove:o})});return B(i)})),e.registerTool("delete",{description:"Delete a handout and every version. The slug becomes free again.",inputSchema:{slug:g()}},({slug:t})=>pr(()=>B(`/api/artifacts/${encodeURIComponent(t)}`,{method:"DELETE"}))),e.registerTool("whoami",{description:"Who the token belongs to, which account it publishes into, and which host links use.",inputSchema:{}},()=>pr(()=>B("/api/me"))),e.registerResource("instructions",`${ct().origin}/for-agents.md`,{description:"Current handout instructions for agents",mimeType:"text/markdown"},async(t)=>({contents:[{uri:t.href,mimeType:"text/markdown",text:await Gx()}]})),await e.connect(new rd)}async function Gx(){let e=await fetch(`${ct().origin}/for-agents.md`);if(!e.ok)throw Error(`could not fetch instructions: ${e.status}`);return e.text()}async function Wx(){console.log(await Gx())}var Xx=`handout ${Hr.version} — publish one HTML file, get a shareable versioned link
76
76
 
77
77
  usage:
78
78
  handout login [--origin https://handout.yosept.me] [--token ho_...] [--no-browser]
@@ -88,7 +88,7 @@ usage:
88
88
  handout share <slug> add <login|email>... share with named people (switches to people)
89
89
  handout share <slug> remove <login|email>...
90
90
  handout delete <slug>
91
- handout members [add|remove <login|email>] who may publish into this account (owner only)
91
+ handout members [add|remove <login|email>|invite] who may publish into this account (owner only); invite prints a link
92
92
  handout domain list your custom domains and their state
93
93
  handout domain add <hostname> connect pages.example.com, prints the DNS records
94
94
  handout domain verify [hostname] [--wait] check; exit code 3 while not active