@stophy/mcp 1.3.0 → 1.3.1

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 (3) hide show
  1. package/README.md +24 -11
  2. package/dist/index.js +10 -10
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,16 +1,16 @@
1
1
  #!/usr/bin/env node
2
- var Bv=Object.create;var{getPrototypeOf:Jv,defineProperty:Wc,getOwnPropertyNames:Kv}=Object;var Gc=Object.prototype.hasOwnProperty;function Wv(e){return this[e]}var Gv,Xv,Xc=(e,t,r)=>{var n=e!=null&&typeof e==="object";if(n){var o=t?Gv??=new WeakMap:Xv??=new WeakMap,s=o.get(e);if(s)return s}r=e!=null?Bv(Jv(e)):{};let i=t||!e||!e.__esModule||!Gc.call(e,"default")?Wc(r,"default",{value:e,enumerable:!0}):r;if(e&&typeof e==="object"||typeof e==="function"){for(let a of Kv(e))if(!Gc.call(i,a))Wc(i,a,{get:Wv.bind(e,a),enumerable:!0})}if(n)o.set(e,i);return i};var E=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Rn=E(function(im){Object.defineProperty(im,"__esModule",{value:!0});im.regexpCode=im.getEsmExportName=im.getProperty=im.safeStringify=im.stringify=im.strConcat=im.addCodeArg=im.str=im._=im.nil=im._Code=im.Name=im.IDENTIFIER=im._CodeOrName=void 0;class Uo{}im._CodeOrName=Uo;im.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class Tr extends Uo{constructor(e){super();if(!im.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}}}im.Name=Tr;class Ye extends Uo{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 Tr)t[r.str]=(t[r.str]||0)+1;return t},{})}}im._Code=Ye;im.nil=new Ye("");function om(e,...t){let r=[e[0]],n=0;while(n<t.length)Oa(r,t[n]),r.push(e[++n]);return new Ye(r)}im._=om;var Ra=new Ye("+");function sm(e,...t){let r=[Tn(e[0])],n=0;while(n<t.length)r.push(Ra),Oa(r,t[n]),r.push(Ra,Tn(e[++n]));return zx(r),new Ye(r)}im.str=sm;function Oa(e,t){if(t instanceof Ye)e.push(...t._items);else if(t instanceof Tr)e.push(t);else e.push(Px(t))}im.addCodeArg=Oa;function zx(e){let t=1;while(t<e.length-1){if(e[t]===Ra){let r=Sx(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function Sx(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string"){if(t instanceof Tr||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 Tr))return`"${e}${t.slice(1)}`;return}function kx(e,t){return t.emptyStr()?e:e.emptyStr()?t:sm`${e}${t}`}im.strConcat=kx;function Px(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:Tn(Array.isArray(e)?e.join(","):e)}function Ex(e){return new Ye(Tn(e))}im.stringify=Ex;function Tn(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}im.safeStringify=Tn;function Tx(e){return typeof e=="string"&&im.IDENTIFIER.test(e)?new Ye(`.${e}`):om`[${e}]`}im.getProperty=Tx;function Rx(e){if(typeof e=="string"&&im.IDENTIFIER.test(e))return new Ye(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}im.getEsmExportName=Rx;function Ox(e){return new Ye(e.toString())}im.regexpCode=Ox});var Na=E(function(lm){Object.defineProperty(lm,"__esModule",{value:!0});lm.ValueScope=lm.ValueScopeName=lm.Scope=lm.varKinds=lm.UsedValueState=void 0;var G=Rn();class cm extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`);this.value=e.value}}var Vo;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(Vo||(lm.UsedValueState=Vo={}));lm.varKinds={const:new G.Name("const"),let:new G.Name("let"),var:new G.Name("var")};class Ca{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof G.Name?e:this.name(e)}name(e){return new G.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}}}lm.Scope=Ca;class Aa extends G.Name{constructor(e,t){super(t);this.prefix=e}setValue(e,{property:t,itemIndex:r}){this.value=e,this.scopePath=G._`.${new G.Name(t)}[${r}]`}}lm.ValueScopeName=Aa;var Vx=G._`\n`;class um extends Ca{constructor(e){super(e);this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?Vx:G.nil}}get(){return this._scope}name(e){return new Aa(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 c=i.get(s);if(c)return c}else i=this._values[o]=new Map;i.set(s,n);let a=this._scope[o]||(this._scope[o]=[]),u=a.length;return a[u]=t.ref,n.setValue(t,{property:o,itemIndex:u}),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 G._`${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=G.nil;for(let s in e){let i=e[s];if(!i)continue;let a=r[s]=r[s]||new Map;i.forEach((u)=>{if(a.has(u))return;a.set(u,Vo.Started);let c=t(u);if(c){let l=this.opts.es5?lm.varKinds.var:lm.varKinds.const;o=G._`${o}${l} ${u} = ${c};${this.opts._n}`}else if(c=n===null||n===void 0?void 0:n(u))o=G._`${o}${c}${this.opts._n}`;else throw new cm(u);a.set(u,Vo.Completed)})}return o}}lm.ValueScope=um});var L=E(function(Ce){Object.defineProperty(Ce,"__esModule",{value:!0});Ce.or=Ce.and=Ce.not=Ce.CodeGen=Ce.operators=Ce.varKinds=Ce.ValueScopeName=Ce.ValueScope=Ce.Scope=Ce.Name=Ce.regexpCode=Ce.stringify=Ce.getProperty=Ce.nil=Ce.strConcat=Ce.str=Ce._=void 0;var T=Rn(),le=Na(),Nt=Rn();Object.defineProperty(Ce,"_",{enumerable:!0,get:function(){return Nt._}});Object.defineProperty(Ce,"str",{enumerable:!0,get:function(){return Nt.str}});Object.defineProperty(Ce,"strConcat",{enumerable:!0,get:function(){return Nt.strConcat}});Object.defineProperty(Ce,"nil",{enumerable:!0,get:function(){return Nt.nil}});Object.defineProperty(Ce,"getProperty",{enumerable:!0,get:function(){return Nt.getProperty}});Object.defineProperty(Ce,"stringify",{enumerable:!0,get:function(){return Nt.stringify}});Object.defineProperty(Ce,"regexpCode",{enumerable:!0,get:function(){return Nt.regexpCode}});Object.defineProperty(Ce,"Name",{enumerable:!0,get:function(){return Nt.Name}});var Go=Na();Object.defineProperty(Ce,"Scope",{enumerable:!0,get:function(){return Go.Scope}});Object.defineProperty(Ce,"ValueScope",{enumerable:!0,get:function(){return Go.ValueScope}});Object.defineProperty(Ce,"ValueScopeName",{enumerable:!0,get:function(){return Go.ValueScopeName}});Object.defineProperty(Ce,"varKinds",{enumerable:!0,get:function(){return Go.varKinds}});Ce.operators={GT:new T._Code(">"),GTE:new T._Code(">="),LT:new T._Code("<"),LTE:new T._Code("<="),EQ:new T._Code("==="),NEQ:new T._Code("!=="),NOT:new T._Code("!"),OR:new T._Code("||"),AND:new T._Code("&&"),ADD:new T._Code("+")};class jt{optimizeNodes(){return this}optimizeNames(e,t){return this}}class fm extends jt{constructor(e,t,r){super();this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){let r=e?le.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=Or(this.rhs,e,t);return this}get names(){return this.rhs instanceof T._CodeOrName?this.rhs.names:{}}}class Da extends jt{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 T.Name&&!e[this.lhs.str]&&!this.sideEffects)return;return this.rhs=Or(this.rhs,e,t),this}get names(){let e=this.lhs instanceof T.Name?{}:{...this.lhs.names};return Wo(e,this.rhs)}}class pm extends Da{constructor(e,t,r,n){super(e,r,n);this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class mm extends jt{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class hm extends jt{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class gm extends jt{constructor(e){super();this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class _m extends jt{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=Or(this.code,e,t),this}get names(){return this.code instanceof T._CodeOrName?this.code.names:{}}}class Xo extends jt{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;Kx(e,o.names),r.splice(n,1)}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>cr(e,t.names),{})}}class Zt extends Xo{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class ym extends Xo{}class On extends Zt{}On.kind="else";class wt extends Zt{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 On(r):r}if(t){if(e===!1)return t instanceof wt?t:t.nodes;if(this.nodes.length)return this;return new wt($m(e),t instanceof wt?[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=Or(this.condition,e,t),this}get names(){let e=super.names;if(Wo(e,this.condition),this.else)cr(e,this.else.names);return e}}wt.kind="if";class Rr extends Zt{}Rr.kind="for";class vm extends Rr{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=Or(this.iteration,e,t),this}get names(){return cr(super.names,this.iteration.names)}}class bm extends Rr{constructor(e,t,r,n){super();this.varKind=e,this.name=t,this.from=r,this.to=n}render(e){let t=e.es5?le.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=Wo(super.names,this.from);return Wo(e,this.to)}}class ja extends Rr{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=Or(this.iterable,e,t),this}get names(){return cr(super.names,this.iterable.names)}}class Ho extends Zt{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)}}Ho.kind="func";class Bo extends Xo{render(e){return"return "+super.render(e)}}Bo.kind="return";class wm extends Zt{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)cr(e,this.catch.names);if(this.finally)cr(e,this.finally.names);return e}}class Jo extends Zt{constructor(e){super();this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}Jo.kind="catch";class Ko extends Zt{render(e){return"finally"+super.render(e)}}Ko.kind="finally";class xm{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
3
- `:""},this._extScope=e,this._scope=new le.Scope({parent:e}),this._nodes=[new ym]}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 fm(e,o,r)),o}const(e,t,r){return this._def(le.varKinds.const,e,t,r)}let(e,t,r){return this._def(le.varKinds.let,e,t,r)}var(e,t,r){return this._def(le.varKinds.var,e,t,r)}assign(e,t,r){return this._leafNode(new Da(e,t,r))}add(e,t){return this._leafNode(new pm(e,Ce.operators.ADD,t))}code(e){if(typeof e=="function")e();else if(e!==T.nil)this._leafNode(new _m(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(":"),T.addCodeArg(t,n)}return t.push("}"),new T._Code(t)}if(e,t,r){if(this._blockNode(new wt(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 wt(e))}else(){return this._elseNode(new On)}endIf(){return this._endBlockNode(wt,On)}_for(e,t){if(this._blockNode(e),t)this.code(t).endFor();return this}for(e,t){return this._for(new vm(e),t)}forRange(e,t,r,n,o=this.opts.es5?le.varKinds.var:le.varKinds.let){let s=this._scope.toName(e);return this._for(new bm(o,s,t,r),()=>n(s))}forOf(e,t,r,n=le.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let s=t instanceof T.Name?t:this.var("_arr",t);return this.forRange("_i",0,T._`${s}.length`,(i)=>{this.var(o,T._`${s}[${i}]`),r(o)})}return this._for(new ja("of",n,o,t),()=>r(o))}forIn(e,t,r,n=this.opts.es5?le.varKinds.var:le.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,T._`Object.keys(${t})`,r);let o=this._scope.toName(e);return this._for(new ja("in",n,o,t),()=>r(o))}endFor(){return this._endBlockNode(Rr)}label(e){return this._leafNode(new mm(e))}break(e){return this._leafNode(new hm(e))}return(e){let t=new Bo;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(Bo)}try(e,t,r){if(!t&&!r)throw Error('CodeGen: "try" without "catch" and "finally"');let n=new wm;if(this._blockNode(n),this.code(e),t){let o=this.name("e");this._currNode=n.catch=new Jo(o),t(o)}if(r)this._currNode=n.finally=new Ko,this.code(r);return this._endBlockNode(Jo,Ko)}throw(e){return this._leafNode(new gm(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=T.nil,r,n){if(this._blockNode(new Ho(e,t,r)),n)this.code(n).endFunc();return this}endFunc(){return this._endBlockNode(Ho)}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 wt))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}}Ce.CodeGen=xm;function cr(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function Wo(e,t){return t instanceof T._CodeOrName?cr(e,t.names):e}function Or(e,t,r){if(e instanceof T.Name)return n(e);if(!o(e))return e;return new T._Code(e._items.reduce((s,i)=>{if(i instanceof T.Name)i=n(i);if(i instanceof T._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 T._Code&&s._items.some((i)=>i instanceof T.Name&&t[i.str]===1&&r[i.str]!==void 0)}}function Kx(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function $m(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:T._`!${Za(e)}`}Ce.not=$m;var Wx=zm(Ce.operators.AND);function Gx(...e){return e.reduce(Wx)}Ce.and=Gx;var Xx=zm(Ce.operators.OR);function Yx(...e){return e.reduce(Xx)}Ce.or=Yx;function zm(e){return(t,r)=>t===T.nil?r:r===T.nil?t:T._`${Za(t)} ${e} ${Za(r)}`}function Za(e){return e instanceof T.Name?e:T._`(${e})`}});var V=E(function(Am){Object.defineProperty(Am,"__esModule",{value:!0});Am.checkStrictMode=Am.getErrorPath=Am.Type=Am.useFunc=Am.setEvaluated=Am.evaluatedPropsToName=Am.mergeEvaluated=Am.eachItem=Am.unescapeJsonPointer=Am.escapeJsonPointer=Am.escapeFragment=Am.unescapeFragment=Am.schemaRefOrVal=Am.schemaHasRulesButRef=Am.schemaHasRules=Am.checkUnknownRules=Am.alwaysValidSchema=Am.toHash=void 0;var Z=L(),Em=Rn();function r$(e){let t={};for(let r of e)t[r]=!0;return t}Am.toHash=r$;function n$(e,t){if(typeof t=="boolean")return t;if(Object.keys(t).length===0)return!0;return Tm(e,t),!Rm(t,e.self.RULES.all)}Am.alwaysValidSchema=n$;function Tm(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])Cm(e,`unknown keyword: "${s}"`)}Am.checkUnknownRules=Tm;function Rm(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}Am.schemaHasRules=Rm;function o$(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}Am.schemaHasRulesButRef=o$;function s$({topSchemaRef:e,schemaPath:t},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return Z._`${r}`}return Z._`${e}${t}${Z.getProperty(n)}`}Am.schemaRefOrVal=s$;function i$(e){return Om(decodeURIComponent(e))}Am.unescapeFragment=i$;function a$(e){return encodeURIComponent(qa(e))}Am.escapeFragment=a$;function qa(e){if(typeof e=="number")return`${e}`;return e.replace(/~/g,"~0").replace(/\//g,"~1")}Am.escapeJsonPointer=qa;function Om(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}Am.unescapeJsonPointer=Om;function c$(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}Am.eachItem=c$;function km({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(o,s,i,a)=>{let u=i===void 0?s:i instanceof Z.Name?(s instanceof Z.Name?e(o,s,i):t(o,s,i),i):s instanceof Z.Name?(t(o,i,s),s):r(s,i);return a===Z.Name&&!(u instanceof Z.Name)?n(o,u):u}}Am.mergeEvaluated={props:km({mergeNames:(e,t,r)=>e.if(Z._`${r} !== true && ${t} !== undefined`,()=>{e.if(Z._`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,Z._`${r} || {}`).code(Z._`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if(Z._`${r} !== true`,()=>{if(t===!0)e.assign(r,!0);else e.assign(r,Z._`${r} || {}`),La(e,r,t)}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:Im}),items:km({mergeNames:(e,t,r)=>e.if(Z._`${r} !== true && ${t} !== undefined`,()=>e.assign(r,Z._`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if(Z._`${r} !== true`,()=>e.assign(r,t===!0?!0:Z._`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function Im(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",Z._`{}`);if(t!==void 0)La(e,r,t);return r}Am.evaluatedPropsToName=Im;function La(e,t,r){Object.keys(r).forEach((n)=>e.assign(Z._`${t}${Z.getProperty(n)}`,!0))}Am.setEvaluated=La;var Pm={};function u$(e,t){return e.scopeValue("func",{ref:t,code:Pm[t.code]||(Pm[t.code]=new Em._Code(t.code))})}Am.useFunc=u$;var Ma;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Ma||(Am.Type=Ma={}));function l$(e,t,r){if(e instanceof Z.Name){let n=t===Ma.Num;return r?n?Z._`"[" + ${e} + "]"`:Z._`"['" + ${e} + "']"`:n?Z._`"/" + ${e}`:Z._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?Z.getProperty(e).toString():"/"+qa(e)}Am.getErrorPath=l$;function Cm(e,t,r=e.opts.strictSchema){if(!r)return;if(t=`strict mode: ${t}`,r===!0)throw Error(t);e.self.logger.warn(t)}Am.checkStrictMode=Cm});var xt=E(function(jm){Object.defineProperty(jm,"__esModule",{value:!0});var K=L(),E$={data:new K.Name("data"),valCxt:new K.Name("valCxt"),instancePath:new K.Name("instancePath"),parentData:new K.Name("parentData"),parentDataProperty:new K.Name("parentDataProperty"),rootData:new K.Name("rootData"),dynamicAnchors:new K.Name("dynamicAnchors"),vErrors:new K.Name("vErrors"),errors:new K.Name("errors"),this:new K.Name("this"),self:new K.Name("self"),scope:new K.Name("scope"),json:new K.Name("json"),jsonPos:new K.Name("jsonPos"),jsonLen:new K.Name("jsonLen"),jsonPart:new K.Name("jsonPart")};jm.default=E$});var In=E(function(qm){Object.defineProperty(qm,"__esModule",{value:!0});qm.extendErrors=qm.resetErrorsCount=qm.reportExtraError=qm.reportError=qm.keyword$DataError=qm.keywordError=void 0;var R=L(),Dt=V(),Te=xt();qm.keywordError={message:({keyword:e})=>R.str`must pass "${e}" keyword validation`};qm.keyword$DataError={message:({keyword:e,schemaType:t})=>t?R.str`"${e}" keyword must be ${t} ($data)`:R.str`"${e}" keyword is invalid ($data)`};function R$(e,t=qm.keywordError,r,n){let{it:o}=e,{gen:s,compositeRule:i,allErrors:a}=o,u=Mm(e,t,r);if(n!==null&&n!==void 0?n:i||a)Zm(s,u);else Dm(o,R._`[${u}]`)}qm.reportError=R$;function O$(e,t=qm.keywordError,r){let{it:n}=e,{gen:o,compositeRule:s,allErrors:i}=n,a=Mm(e,t,r);if(Zm(o,a),!(s||i))Dm(n,Te.default.vErrors)}qm.reportExtraError=O$;function I$(e,t){e.assign(Te.default.errors,t),e.if(R._`${Te.default.vErrors} !== null`,()=>e.if(t,()=>e.assign(R._`${Te.default.vErrors}.length`,t),()=>e.assign(Te.default.vErrors,null)))}qm.resetErrorsCount=I$;function C$({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,Te.default.errors,(a)=>{if(e.const(i,R._`${Te.default.vErrors}[${a}]`),e.if(R._`${i}.instancePath === undefined`,()=>e.assign(R._`${i}.instancePath`,R.strConcat(Te.default.instancePath,s.errorPath))),e.assign(R._`${i}.schemaPath`,R.str`${s.errSchemaPath}/${t}`),s.opts.verbose)e.assign(R._`${i}.schema`,r),e.assign(R._`${i}.data`,n)})}qm.extendErrors=C$;function Zm(e,t){let r=e.const("err",t);e.if(R._`${Te.default.vErrors} === null`,()=>e.assign(Te.default.vErrors,R._`[${r}]`),R._`${Te.default.vErrors}.push(${r})`),e.code(R._`${Te.default.errors}++`)}function Dm(e,t){let{gen:r,validateName:n,schemaEnv:o}=e;if(o.$async)r.throw(R._`new ${e.ValidationError}(${t})`);else r.assign(R._`${n}.errors`,t),r.return(!1)}var ur={keyword:new R.Name("keyword"),schemaPath:new R.Name("schemaPath"),params:new R.Name("params"),propertyName:new R.Name("propertyName"),message:new R.Name("message"),schema:new R.Name("schema"),parentSchema:new R.Name("parentSchema")};function Mm(e,t,r){let{createErrors:n}=e.it;if(n===!1)return R._`{}`;return A$(e,t,r)}function A$(e,t,r={}){let{gen:n,it:o}=e,s=[N$(o,r),j$(e,r)];return Z$(e,t,s),n.object(...s)}function N$({errorPath:e},{instancePath:t}){let r=t?R.str`${e}${Dt.getErrorPath(t,Dt.Type.Str)}`:e;return[Te.default.instancePath,R.strConcat(Te.default.instancePath,r)]}function j$({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let o=n?t:R.str`${t}/${e}`;if(r)o=R.str`${o}${Dt.getErrorPath(r,Dt.Type.Str)}`;return[ur.schemaPath,o]}function Z$(e,{params:t,message:r},n){let{keyword:o,data:s,schemaValue:i,it:a}=e,{opts:u,propertyName:c,topSchemaRef:l,schemaPath:d}=a;if(n.push([ur.keyword,o],[ur.params,typeof t=="function"?t(e):t||R._`{}`]),u.messages)n.push([ur.message,typeof r=="function"?r(e):r]);if(u.verbose)n.push([ur.schema,i],[ur.parentSchema,R._`${l}${d}`],[Te.default.data,s]);if(c)n.push([ur.propertyName,c])}});var Jm=E(function(Hm){Object.defineProperty(Hm,"__esModule",{value:!0});Hm.boolOrEmptySchema=Hm.topBoolOrEmptySchema=void 0;var Um=In(),Fm=L(),U$=xt(),F$={message:"boolean schema is false"};function V$(e){let{gen:t,schema:r,validateName:n}=e;if(r===!1)Vm(e,!1);else if(typeof r=="object"&&r.$async===!0)t.return(U$.default.data);else t.assign(Fm._`${n}.errors`,null),t.return(!0)}Hm.topBoolOrEmptySchema=V$;function H$(e,t){let{gen:r,schema:n}=e;if(n===!1)r.var(t,!1),Vm(e);else r.var(t,!0)}Hm.boolOrEmptySchema=H$;function Vm(e,t){let{gen:r,data:n}=e;Um.reportError({gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e},F$,void 0,t)}});var Fa=E(function(Km){Object.defineProperty(Km,"__esModule",{value:!0});Km.getRules=Km.isJSONType=void 0;var J$=["string","number","integer","boolean","null","object","array"],K$=new Set(J$);function W$(e){return typeof e=="string"&&K$.has(e)}Km.isJSONType=W$;function G$(){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:{}}}Km.getRules=G$});var Va=E(function(Ym){Object.defineProperty(Ym,"__esModule",{value:!0});Ym.shouldUseRule=Ym.shouldUseGroup=Ym.schemaHasRulesForType=void 0;function Y$({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&Gm(e,n)}Ym.schemaHasRulesForType=Y$;function Gm(e,t){return t.rules.some((r)=>Xm(e,r))}Ym.shouldUseGroup=Gm;function Xm(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))}Ym.shouldUseRule=Xm});var Cn=E(function(sh){Object.defineProperty(sh,"__esModule",{value:!0});sh.reportTypeError=sh.checkDataTypes=sh.checkDataType=sh.coerceAndCheckDataType=sh.getJSONTypes=sh.getSchemaTypes=sh.DataType=void 0;var eh=Fa(),th=Va(),rh=In(),z=L(),Qo=V(),Ir;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(Ir||(sh.DataType=Ir={}));function tz(e){let t=nh(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}sh.getSchemaTypes=tz;function nh(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(eh.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}sh.getJSONTypes=nh;function rz(e,t){let{gen:r,data:n,opts:o}=e,s=nz(t,o.coerceTypes),i=t.length>0&&!(s.length===0&&t.length===1&&th.schemaHasRulesForType(e,t[0]));if(i){let a=Ba(t,n,o.strictNumbers,Ir.Wrong);r.if(a,()=>{if(s.length)oz(e,t,s);else Ja(e)})}return i}sh.coerceAndCheckDataType=rz;var oh=new Set(["string","number","integer","boolean","null"]);function nz(e,t){return t?e.filter((r)=>oh.has(r)||t==="array"&&r==="array"):[]}function oz(e,t,r){let{gen:n,data:o,opts:s}=e,i=n.let("dataType",z._`typeof ${o}`),a=n.let("coerced",z._`undefined`);if(s.coerceTypes==="array")n.if(z._`${i} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,z._`${o}[0]`).assign(i,z._`typeof ${o}`).if(Ba(t,o,s.strictNumbers),()=>n.assign(a,o)));n.if(z._`${a} !== undefined`);for(let c of r)if(oh.has(c)||c==="array"&&s.coerceTypes==="array")u(c);n.else(),Ja(e),n.endIf(),n.if(z._`${a} !== undefined`,()=>{n.assign(o,a),sz(e,a)});function u(c){switch(c){case"string":n.elseIf(z._`${i} == "number" || ${i} == "boolean"`).assign(a,z._`"" + ${o}`).elseIf(z._`${o} === null`).assign(a,z._`""`);return;case"number":n.elseIf(z._`${i} == "boolean" || ${o} === null
2
+ var Bv=Object.create;var{getPrototypeOf:Jv,defineProperty:Wc,getOwnPropertyNames:Kv}=Object;var Gc=Object.prototype.hasOwnProperty;function Wv(e){return this[e]}var Gv,Xv,Xc=(e,t,r)=>{var n=e!=null&&typeof e==="object";if(n){var o=t?Gv??=new WeakMap:Xv??=new WeakMap,s=o.get(e);if(s)return s}r=e!=null?Bv(Jv(e)):{};let i=t||!e||!e.__esModule||!Gc.call(e,"default")?Wc(r,"default",{value:e,enumerable:!0}):r;if(e&&typeof e==="object"||typeof e==="function"){for(let a of Kv(e))if(!Gc.call(i,a))Wc(i,a,{get:Wv.bind(e,a),enumerable:!0})}if(n)o.set(e,i);return i};var E=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Rn=E(function(im){Object.defineProperty(im,"__esModule",{value:!0});im.regexpCode=im.getEsmExportName=im.getProperty=im.safeStringify=im.stringify=im.strConcat=im.addCodeArg=im.str=im._=im.nil=im._Code=im.Name=im.IDENTIFIER=im._CodeOrName=void 0;class Uo{}im._CodeOrName=Uo;im.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class Tr extends Uo{constructor(e){super();if(!im.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}}}im.Name=Tr;class Ye extends Uo{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 Tr)t[r.str]=(t[r.str]||0)+1;return t},{})}}im._Code=Ye;im.nil=new Ye("");function om(e,...t){let r=[e[0]],n=0;while(n<t.length)Ia(r,t[n]),r.push(e[++n]);return new Ye(r)}im._=om;var Oa=new Ye("+");function sm(e,...t){let r=[Tn(e[0])],n=0;while(n<t.length)r.push(Oa),Ia(r,t[n]),r.push(Oa,Tn(e[++n]));return zx(r),new Ye(r)}im.str=sm;function Ia(e,t){if(t instanceof Ye)e.push(...t._items);else if(t instanceof Tr)e.push(t);else e.push(Px(t))}im.addCodeArg=Ia;function zx(e){let t=1;while(t<e.length-1){if(e[t]===Oa){let r=Sx(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function Sx(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string"){if(t instanceof Tr||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 Tr))return`"${e}${t.slice(1)}`;return}function kx(e,t){return t.emptyStr()?e:e.emptyStr()?t:sm`${e}${t}`}im.strConcat=kx;function Px(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:Tn(Array.isArray(e)?e.join(","):e)}function Ex(e){return new Ye(Tn(e))}im.stringify=Ex;function Tn(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}im.safeStringify=Tn;function Tx(e){return typeof e=="string"&&im.IDENTIFIER.test(e)?new Ye(`.${e}`):om`[${e}]`}im.getProperty=Tx;function Rx(e){if(typeof e=="string"&&im.IDENTIFIER.test(e))return new Ye(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}im.getEsmExportName=Rx;function Ox(e){return new Ye(e.toString())}im.regexpCode=Ox});var ja=E(function(lm){Object.defineProperty(lm,"__esModule",{value:!0});lm.ValueScope=lm.ValueScopeName=lm.Scope=lm.varKinds=lm.UsedValueState=void 0;var G=Rn();class cm extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`);this.value=e.value}}var Vo;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(Vo||(lm.UsedValueState=Vo={}));lm.varKinds={const:new G.Name("const"),let:new G.Name("let"),var:new G.Name("var")};class Aa{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof G.Name?e:this.name(e)}name(e){return new G.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}}}lm.Scope=Aa;class Na extends G.Name{constructor(e,t){super(t);this.prefix=e}setValue(e,{property:t,itemIndex:r}){this.value=e,this.scopePath=G._`.${new G.Name(t)}[${r}]`}}lm.ValueScopeName=Na;var Vx=G._`\n`;class um extends Aa{constructor(e){super(e);this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?Vx:G.nil}}get(){return this._scope}name(e){return new Na(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 c=i.get(s);if(c)return c}else i=this._values[o]=new Map;i.set(s,n);let a=this._scope[o]||(this._scope[o]=[]),u=a.length;return a[u]=t.ref,n.setValue(t,{property:o,itemIndex:u}),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 G._`${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=G.nil;for(let s in e){let i=e[s];if(!i)continue;let a=r[s]=r[s]||new Map;i.forEach((u)=>{if(a.has(u))return;a.set(u,Vo.Started);let c=t(u);if(c){let l=this.opts.es5?lm.varKinds.var:lm.varKinds.const;o=G._`${o}${l} ${u} = ${c};${this.opts._n}`}else if(c=n===null||n===void 0?void 0:n(u))o=G._`${o}${c}${this.opts._n}`;else throw new cm(u);a.set(u,Vo.Completed)})}return o}}lm.ValueScope=um});var L=E(function(Ce){Object.defineProperty(Ce,"__esModule",{value:!0});Ce.or=Ce.and=Ce.not=Ce.CodeGen=Ce.operators=Ce.varKinds=Ce.ValueScopeName=Ce.ValueScope=Ce.Scope=Ce.Name=Ce.regexpCode=Ce.stringify=Ce.getProperty=Ce.nil=Ce.strConcat=Ce.str=Ce._=void 0;var T=Rn(),le=ja(),Nt=Rn();Object.defineProperty(Ce,"_",{enumerable:!0,get:function(){return Nt._}});Object.defineProperty(Ce,"str",{enumerable:!0,get:function(){return Nt.str}});Object.defineProperty(Ce,"strConcat",{enumerable:!0,get:function(){return Nt.strConcat}});Object.defineProperty(Ce,"nil",{enumerable:!0,get:function(){return Nt.nil}});Object.defineProperty(Ce,"getProperty",{enumerable:!0,get:function(){return Nt.getProperty}});Object.defineProperty(Ce,"stringify",{enumerable:!0,get:function(){return Nt.stringify}});Object.defineProperty(Ce,"regexpCode",{enumerable:!0,get:function(){return Nt.regexpCode}});Object.defineProperty(Ce,"Name",{enumerable:!0,get:function(){return Nt.Name}});var Go=ja();Object.defineProperty(Ce,"Scope",{enumerable:!0,get:function(){return Go.Scope}});Object.defineProperty(Ce,"ValueScope",{enumerable:!0,get:function(){return Go.ValueScope}});Object.defineProperty(Ce,"ValueScopeName",{enumerable:!0,get:function(){return Go.ValueScopeName}});Object.defineProperty(Ce,"varKinds",{enumerable:!0,get:function(){return Go.varKinds}});Ce.operators={GT:new T._Code(">"),GTE:new T._Code(">="),LT:new T._Code("<"),LTE:new T._Code("<="),EQ:new T._Code("==="),NEQ:new T._Code("!=="),NOT:new T._Code("!"),OR:new T._Code("||"),AND:new T._Code("&&"),ADD:new T._Code("+")};class jt{optimizeNodes(){return this}optimizeNames(e,t){return this}}class fm extends jt{constructor(e,t,r){super();this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){let r=e?le.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=Or(this.rhs,e,t);return this}get names(){return this.rhs instanceof T._CodeOrName?this.rhs.names:{}}}class Ma extends jt{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 T.Name&&!e[this.lhs.str]&&!this.sideEffects)return;return this.rhs=Or(this.rhs,e,t),this}get names(){let e=this.lhs instanceof T.Name?{}:{...this.lhs.names};return Wo(e,this.rhs)}}class pm extends Ma{constructor(e,t,r,n){super(e,r,n);this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class mm extends jt{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class hm extends jt{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class gm extends jt{constructor(e){super();this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class _m extends jt{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=Or(this.code,e,t),this}get names(){return this.code instanceof T._CodeOrName?this.code.names:{}}}class Xo extends jt{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;Kx(e,o.names),r.splice(n,1)}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>cr(e,t.names),{})}}class Zt extends Xo{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class ym extends Xo{}class On extends Zt{}On.kind="else";class wt extends Zt{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 On(r):r}if(t){if(e===!1)return t instanceof wt?t:t.nodes;if(this.nodes.length)return this;return new wt($m(e),t instanceof wt?[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=Or(this.condition,e,t),this}get names(){let e=super.names;if(Wo(e,this.condition),this.else)cr(e,this.else.names);return e}}wt.kind="if";class Rr extends Zt{}Rr.kind="for";class vm extends Rr{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=Or(this.iteration,e,t),this}get names(){return cr(super.names,this.iteration.names)}}class bm extends Rr{constructor(e,t,r,n){super();this.varKind=e,this.name=t,this.from=r,this.to=n}render(e){let t=e.es5?le.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=Wo(super.names,this.from);return Wo(e,this.to)}}class Za extends Rr{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=Or(this.iterable,e,t),this}get names(){return cr(super.names,this.iterable.names)}}class Ho extends Zt{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)}}Ho.kind="func";class Bo extends Xo{render(e){return"return "+super.render(e)}}Bo.kind="return";class wm extends Zt{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)cr(e,this.catch.names);if(this.finally)cr(e,this.finally.names);return e}}class Jo extends Zt{constructor(e){super();this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}Jo.kind="catch";class Ko extends Zt{render(e){return"finally"+super.render(e)}}Ko.kind="finally";class xm{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
3
+ `:""},this._extScope=e,this._scope=new le.Scope({parent:e}),this._nodes=[new ym]}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 fm(e,o,r)),o}const(e,t,r){return this._def(le.varKinds.const,e,t,r)}let(e,t,r){return this._def(le.varKinds.let,e,t,r)}var(e,t,r){return this._def(le.varKinds.var,e,t,r)}assign(e,t,r){return this._leafNode(new Ma(e,t,r))}add(e,t){return this._leafNode(new pm(e,Ce.operators.ADD,t))}code(e){if(typeof e=="function")e();else if(e!==T.nil)this._leafNode(new _m(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(":"),T.addCodeArg(t,n)}return t.push("}"),new T._Code(t)}if(e,t,r){if(this._blockNode(new wt(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 wt(e))}else(){return this._elseNode(new On)}endIf(){return this._endBlockNode(wt,On)}_for(e,t){if(this._blockNode(e),t)this.code(t).endFor();return this}for(e,t){return this._for(new vm(e),t)}forRange(e,t,r,n,o=this.opts.es5?le.varKinds.var:le.varKinds.let){let s=this._scope.toName(e);return this._for(new bm(o,s,t,r),()=>n(s))}forOf(e,t,r,n=le.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let s=t instanceof T.Name?t:this.var("_arr",t);return this.forRange("_i",0,T._`${s}.length`,(i)=>{this.var(o,T._`${s}[${i}]`),r(o)})}return this._for(new Za("of",n,o,t),()=>r(o))}forIn(e,t,r,n=this.opts.es5?le.varKinds.var:le.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,T._`Object.keys(${t})`,r);let o=this._scope.toName(e);return this._for(new Za("in",n,o,t),()=>r(o))}endFor(){return this._endBlockNode(Rr)}label(e){return this._leafNode(new mm(e))}break(e){return this._leafNode(new hm(e))}return(e){let t=new Bo;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(Bo)}try(e,t,r){if(!t&&!r)throw Error('CodeGen: "try" without "catch" and "finally"');let n=new wm;if(this._blockNode(n),this.code(e),t){let o=this.name("e");this._currNode=n.catch=new Jo(o),t(o)}if(r)this._currNode=n.finally=new Ko,this.code(r);return this._endBlockNode(Jo,Ko)}throw(e){return this._leafNode(new gm(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=T.nil,r,n){if(this._blockNode(new Ho(e,t,r)),n)this.code(n).endFunc();return this}endFunc(){return this._endBlockNode(Ho)}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 wt))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}}Ce.CodeGen=xm;function cr(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function Wo(e,t){return t instanceof T._CodeOrName?cr(e,t.names):e}function Or(e,t,r){if(e instanceof T.Name)return n(e);if(!o(e))return e;return new T._Code(e._items.reduce((s,i)=>{if(i instanceof T.Name)i=n(i);if(i instanceof T._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 T._Code&&s._items.some((i)=>i instanceof T.Name&&t[i.str]===1&&r[i.str]!==void 0)}}function Kx(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function $m(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:T._`!${Da(e)}`}Ce.not=$m;var Wx=zm(Ce.operators.AND);function Gx(...e){return e.reduce(Wx)}Ce.and=Gx;var Xx=zm(Ce.operators.OR);function Yx(...e){return e.reduce(Xx)}Ce.or=Yx;function zm(e){return(t,r)=>t===T.nil?r:r===T.nil?t:T._`${Da(t)} ${e} ${Da(r)}`}function Da(e){return e instanceof T.Name?e:T._`(${e})`}});var V=E(function(Am){Object.defineProperty(Am,"__esModule",{value:!0});Am.checkStrictMode=Am.getErrorPath=Am.Type=Am.useFunc=Am.setEvaluated=Am.evaluatedPropsToName=Am.mergeEvaluated=Am.eachItem=Am.unescapeJsonPointer=Am.escapeJsonPointer=Am.escapeFragment=Am.unescapeFragment=Am.schemaRefOrVal=Am.schemaHasRulesButRef=Am.schemaHasRules=Am.checkUnknownRules=Am.alwaysValidSchema=Am.toHash=void 0;var Z=L(),Em=Rn();function r$(e){let t={};for(let r of e)t[r]=!0;return t}Am.toHash=r$;function n$(e,t){if(typeof t=="boolean")return t;if(Object.keys(t).length===0)return!0;return Tm(e,t),!Rm(t,e.self.RULES.all)}Am.alwaysValidSchema=n$;function Tm(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])Cm(e,`unknown keyword: "${s}"`)}Am.checkUnknownRules=Tm;function Rm(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}Am.schemaHasRules=Rm;function o$(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}Am.schemaHasRulesButRef=o$;function s$({topSchemaRef:e,schemaPath:t},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return Z._`${r}`}return Z._`${e}${t}${Z.getProperty(n)}`}Am.schemaRefOrVal=s$;function i$(e){return Om(decodeURIComponent(e))}Am.unescapeFragment=i$;function a$(e){return encodeURIComponent(La(e))}Am.escapeFragment=a$;function La(e){if(typeof e=="number")return`${e}`;return e.replace(/~/g,"~0").replace(/\//g,"~1")}Am.escapeJsonPointer=La;function Om(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}Am.unescapeJsonPointer=Om;function c$(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}Am.eachItem=c$;function km({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(o,s,i,a)=>{let u=i===void 0?s:i instanceof Z.Name?(s instanceof Z.Name?e(o,s,i):t(o,s,i),i):s instanceof Z.Name?(t(o,i,s),s):r(s,i);return a===Z.Name&&!(u instanceof Z.Name)?n(o,u):u}}Am.mergeEvaluated={props:km({mergeNames:(e,t,r)=>e.if(Z._`${r} !== true && ${t} !== undefined`,()=>{e.if(Z._`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,Z._`${r} || {}`).code(Z._`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if(Z._`${r} !== true`,()=>{if(t===!0)e.assign(r,!0);else e.assign(r,Z._`${r} || {}`),Ua(e,r,t)}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:Im}),items:km({mergeNames:(e,t,r)=>e.if(Z._`${r} !== true && ${t} !== undefined`,()=>e.assign(r,Z._`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if(Z._`${r} !== true`,()=>e.assign(r,t===!0?!0:Z._`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function Im(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",Z._`{}`);if(t!==void 0)Ua(e,r,t);return r}Am.evaluatedPropsToName=Im;function Ua(e,t,r){Object.keys(r).forEach((n)=>e.assign(Z._`${t}${Z.getProperty(n)}`,!0))}Am.setEvaluated=Ua;var Pm={};function u$(e,t){return e.scopeValue("func",{ref:t,code:Pm[t.code]||(Pm[t.code]=new Em._Code(t.code))})}Am.useFunc=u$;var qa;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(qa||(Am.Type=qa={}));function l$(e,t,r){if(e instanceof Z.Name){let n=t===qa.Num;return r?n?Z._`"[" + ${e} + "]"`:Z._`"['" + ${e} + "']"`:n?Z._`"/" + ${e}`:Z._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?Z.getProperty(e).toString():"/"+La(e)}Am.getErrorPath=l$;function Cm(e,t,r=e.opts.strictSchema){if(!r)return;if(t=`strict mode: ${t}`,r===!0)throw Error(t);e.self.logger.warn(t)}Am.checkStrictMode=Cm});var xt=E(function(jm){Object.defineProperty(jm,"__esModule",{value:!0});var K=L(),E$={data:new K.Name("data"),valCxt:new K.Name("valCxt"),instancePath:new K.Name("instancePath"),parentData:new K.Name("parentData"),parentDataProperty:new K.Name("parentDataProperty"),rootData:new K.Name("rootData"),dynamicAnchors:new K.Name("dynamicAnchors"),vErrors:new K.Name("vErrors"),errors:new K.Name("errors"),this:new K.Name("this"),self:new K.Name("self"),scope:new K.Name("scope"),json:new K.Name("json"),jsonPos:new K.Name("jsonPos"),jsonLen:new K.Name("jsonLen"),jsonPart:new K.Name("jsonPart")};jm.default=E$});var In=E(function(qm){Object.defineProperty(qm,"__esModule",{value:!0});qm.extendErrors=qm.resetErrorsCount=qm.reportExtraError=qm.reportError=qm.keyword$DataError=qm.keywordError=void 0;var R=L(),Dt=V(),Te=xt();qm.keywordError={message:({keyword:e})=>R.str`must pass "${e}" keyword validation`};qm.keyword$DataError={message:({keyword:e,schemaType:t})=>t?R.str`"${e}" keyword must be ${t} ($data)`:R.str`"${e}" keyword is invalid ($data)`};function R$(e,t=qm.keywordError,r,n){let{it:o}=e,{gen:s,compositeRule:i,allErrors:a}=o,u=Mm(e,t,r);if(n!==null&&n!==void 0?n:i||a)Zm(s,u);else Dm(o,R._`[${u}]`)}qm.reportError=R$;function O$(e,t=qm.keywordError,r){let{it:n}=e,{gen:o,compositeRule:s,allErrors:i}=n,a=Mm(e,t,r);if(Zm(o,a),!(s||i))Dm(n,Te.default.vErrors)}qm.reportExtraError=O$;function I$(e,t){e.assign(Te.default.errors,t),e.if(R._`${Te.default.vErrors} !== null`,()=>e.if(t,()=>e.assign(R._`${Te.default.vErrors}.length`,t),()=>e.assign(Te.default.vErrors,null)))}qm.resetErrorsCount=I$;function C$({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,Te.default.errors,(a)=>{if(e.const(i,R._`${Te.default.vErrors}[${a}]`),e.if(R._`${i}.instancePath === undefined`,()=>e.assign(R._`${i}.instancePath`,R.strConcat(Te.default.instancePath,s.errorPath))),e.assign(R._`${i}.schemaPath`,R.str`${s.errSchemaPath}/${t}`),s.opts.verbose)e.assign(R._`${i}.schema`,r),e.assign(R._`${i}.data`,n)})}qm.extendErrors=C$;function Zm(e,t){let r=e.const("err",t);e.if(R._`${Te.default.vErrors} === null`,()=>e.assign(Te.default.vErrors,R._`[${r}]`),R._`${Te.default.vErrors}.push(${r})`),e.code(R._`${Te.default.errors}++`)}function Dm(e,t){let{gen:r,validateName:n,schemaEnv:o}=e;if(o.$async)r.throw(R._`new ${e.ValidationError}(${t})`);else r.assign(R._`${n}.errors`,t),r.return(!1)}var ur={keyword:new R.Name("keyword"),schemaPath:new R.Name("schemaPath"),params:new R.Name("params"),propertyName:new R.Name("propertyName"),message:new R.Name("message"),schema:new R.Name("schema"),parentSchema:new R.Name("parentSchema")};function Mm(e,t,r){let{createErrors:n}=e.it;if(n===!1)return R._`{}`;return A$(e,t,r)}function A$(e,t,r={}){let{gen:n,it:o}=e,s=[N$(o,r),j$(e,r)];return Z$(e,t,s),n.object(...s)}function N$({errorPath:e},{instancePath:t}){let r=t?R.str`${e}${Dt.getErrorPath(t,Dt.Type.Str)}`:e;return[Te.default.instancePath,R.strConcat(Te.default.instancePath,r)]}function j$({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let o=n?t:R.str`${t}/${e}`;if(r)o=R.str`${o}${Dt.getErrorPath(r,Dt.Type.Str)}`;return[ur.schemaPath,o]}function Z$(e,{params:t,message:r},n){let{keyword:o,data:s,schemaValue:i,it:a}=e,{opts:u,propertyName:c,topSchemaRef:l,schemaPath:d}=a;if(n.push([ur.keyword,o],[ur.params,typeof t=="function"?t(e):t||R._`{}`]),u.messages)n.push([ur.message,typeof r=="function"?r(e):r]);if(u.verbose)n.push([ur.schema,i],[ur.parentSchema,R._`${l}${d}`],[Te.default.data,s]);if(c)n.push([ur.propertyName,c])}});var Jm=E(function(Hm){Object.defineProperty(Hm,"__esModule",{value:!0});Hm.boolOrEmptySchema=Hm.topBoolOrEmptySchema=void 0;var Um=In(),Fm=L(),U$=xt(),F$={message:"boolean schema is false"};function V$(e){let{gen:t,schema:r,validateName:n}=e;if(r===!1)Vm(e,!1);else if(typeof r=="object"&&r.$async===!0)t.return(U$.default.data);else t.assign(Fm._`${n}.errors`,null),t.return(!0)}Hm.topBoolOrEmptySchema=V$;function H$(e,t){let{gen:r,schema:n}=e;if(n===!1)r.var(t,!1),Vm(e);else r.var(t,!0)}Hm.boolOrEmptySchema=H$;function Vm(e,t){let{gen:r,data:n}=e;Um.reportError({gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e},F$,void 0,t)}});var Va=E(function(Km){Object.defineProperty(Km,"__esModule",{value:!0});Km.getRules=Km.isJSONType=void 0;var J$=["string","number","integer","boolean","null","object","array"],K$=new Set(J$);function W$(e){return typeof e=="string"&&K$.has(e)}Km.isJSONType=W$;function G$(){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:{}}}Km.getRules=G$});var Ha=E(function(Ym){Object.defineProperty(Ym,"__esModule",{value:!0});Ym.shouldUseRule=Ym.shouldUseGroup=Ym.schemaHasRulesForType=void 0;function Y$({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&Gm(e,n)}Ym.schemaHasRulesForType=Y$;function Gm(e,t){return t.rules.some((r)=>Xm(e,r))}Ym.shouldUseGroup=Gm;function Xm(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))}Ym.shouldUseRule=Xm});var Cn=E(function(sh){Object.defineProperty(sh,"__esModule",{value:!0});sh.reportTypeError=sh.checkDataTypes=sh.checkDataType=sh.coerceAndCheckDataType=sh.getJSONTypes=sh.getSchemaTypes=sh.DataType=void 0;var eh=Va(),th=Ha(),rh=In(),z=L(),Qo=V(),Ir;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(Ir||(sh.DataType=Ir={}));function tz(e){let t=nh(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}sh.getSchemaTypes=tz;function nh(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(eh.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}sh.getJSONTypes=nh;function rz(e,t){let{gen:r,data:n,opts:o}=e,s=nz(t,o.coerceTypes),i=t.length>0&&!(s.length===0&&t.length===1&&th.schemaHasRulesForType(e,t[0]));if(i){let a=Ja(t,n,o.strictNumbers,Ir.Wrong);r.if(a,()=>{if(s.length)oz(e,t,s);else Ka(e)})}return i}sh.coerceAndCheckDataType=rz;var oh=new Set(["string","number","integer","boolean","null"]);function nz(e,t){return t?e.filter((r)=>oh.has(r)||t==="array"&&r==="array"):[]}function oz(e,t,r){let{gen:n,data:o,opts:s}=e,i=n.let("dataType",z._`typeof ${o}`),a=n.let("coerced",z._`undefined`);if(s.coerceTypes==="array")n.if(z._`${i} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,z._`${o}[0]`).assign(i,z._`typeof ${o}`).if(Ja(t,o,s.strictNumbers),()=>n.assign(a,o)));n.if(z._`${a} !== undefined`);for(let c of r)if(oh.has(c)||c==="array"&&s.coerceTypes==="array")u(c);n.else(),Ka(e),n.endIf(),n.if(z._`${a} !== undefined`,()=>{n.assign(o,a),sz(e,a)});function u(c){switch(c){case"string":n.elseIf(z._`${i} == "number" || ${i} == "boolean"`).assign(a,z._`"" + ${o}`).elseIf(z._`${o} === null`).assign(a,z._`""`);return;case"number":n.elseIf(z._`${i} == "boolean" || ${o} === null
4
4
  || (${i} == "string" && ${o} && ${o} == +${o})`).assign(a,z._`+${o}`);return;case"integer":n.elseIf(z._`${i} === "boolean" || ${o} === null
5
5
  || (${i} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(a,z._`+${o}`);return;case"boolean":n.elseIf(z._`${o} === "false" || ${o} === 0 || ${o} === null`).assign(a,!1).elseIf(z._`${o} === "true" || ${o} === 1`).assign(a,!0);return;case"null":n.elseIf(z._`${o} === "" || ${o} === 0 || ${o} === false`),n.assign(a,null);return;case"array":n.elseIf(z._`${i} === "string" || ${i} === "number"
6
- || ${i} === "boolean" || ${o} === null`).assign(a,z._`[${o}]`)}}}function sz({gen:e,parentData:t,parentDataProperty:r},n){e.if(z._`${t} !== undefined`,()=>e.assign(z._`${t}[${r}]`,n))}function Ha(e,t,r,n=Ir.Correct){let o=n===Ir.Correct?z.operators.EQ:z.operators.NEQ,s;switch(e){case"null":return z._`${t} ${o} null`;case"array":s=z._`Array.isArray(${t})`;break;case"object":s=z._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":s=i(z._`!(${t} % 1) && !isNaN(${t})`);break;case"number":s=i();break;default:return z._`typeof ${t} ${o} ${e}`}return n===Ir.Correct?s:z.not(s);function i(a=z.nil){return z.and(z._`typeof ${t} == "number"`,a,r?z._`isFinite(${t})`:z.nil)}}sh.checkDataType=Ha;function Ba(e,t,r,n){if(e.length===1)return Ha(e[0],t,r,n);let o,s=Qo.toHash(e);if(s.array&&s.object){let i=z._`typeof ${t} != "object"`;o=s.null?i:z._`!${t} || ${i}`,delete s.null,delete s.array,delete s.object}else o=z.nil;if(s.number)delete s.integer;for(let i in s)o=z.and(o,Ha(i,t,r,n));return o}sh.checkDataTypes=Ba;var iz={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?z._`{type: ${e}}`:z._`{type: ${t}}`};function Ja(e){let t=az(e);rh.reportError(t,iz)}sh.reportTypeError=Ja;function az(e){let{gen:t,data:r,schema:n}=e,o=Qo.schemaRefOrVal(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:e}}});var dh=E(function(uh){Object.defineProperty(uh,"__esModule",{value:!0});uh.assignDefaults=void 0;var Be=L(),ch=V();function mz(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let o in r)ah(e,o,r[o].default);else if(t==="array"&&Array.isArray(n))n.forEach((o,s)=>ah(e,s,o.default))}uh.assignDefaults=mz;function ah(e,t,r){let{gen:n,compositeRule:o,data:s,opts:i}=e;if(r===void 0)return;let a=Be._`${s}${Be.getProperty(t)}`;if(o){ch.checkStrictMode(e,`default is ignored for: ${a}`);return}let u=Be._`${a} === undefined`;if(i.useDefaults==="empty")u=Be._`${u} || ${a} === null || ${a} === ""`;n.if(u,Be._`${a} = ${Be.stringify(r)}`)}});var Je=E(function(hh){Object.defineProperty(hh,"__esModule",{value:!0});hh.validateUnion=hh.validateArray=hh.usePattern=hh.callValidateCode=hh.schemaProperties=hh.allSchemaProperties=hh.noPropertyInData=hh.propertyInData=hh.isOwnProperty=hh.hasPropFunc=hh.reportMissingProp=hh.checkMissingProp=hh.checkReportMissingProp=void 0;var D=L(),Cr=V(),Mt=xt(),fh=V();function hz(e,t){let{gen:r,data:n,it:o}=e;r.if(Wa(r,n,t,o.opts.ownProperties),()=>{e.setParams({missingProperty:D._`${t}`},!0),e.error()})}hh.checkReportMissingProp=hz;function gz({gen:e,data:t,it:{opts:r}},n,o){return D.or(...n.map((s)=>D.and(Wa(e,t,s,r.ownProperties),D._`${o} = ${s}`)))}hh.checkMissingProp=gz;function _z(e,t){e.setParams({missingProperty:t},!0),e.error()}hh.reportMissingProp=_z;function ph(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:D._`Object.prototype.hasOwnProperty`})}hh.hasPropFunc=ph;function Ka(e,t,r){return D._`${ph(e)}.call(${t}, ${r})`}hh.isOwnProperty=Ka;function yz(e,t,r,n){let o=D._`${t}${D.getProperty(r)} !== undefined`;return n?D._`${o} && ${Ka(e,t,r)}`:o}hh.propertyInData=yz;function Wa(e,t,r,n){let o=D._`${t}${D.getProperty(r)} === undefined`;return n?D.or(o,D.not(Ka(e,t,r))):o}hh.noPropertyInData=Wa;function mh(e){return e?Object.keys(e).filter((t)=>t!=="__proto__"):[]}hh.allSchemaProperties=mh;function vz(e,t){return mh(t).filter((r)=>!Cr.alwaysValidSchema(e,t[r]))}hh.schemaProperties=vz;function bz({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:s},it:i},a,u,c){let l=c?D._`${e}, ${t}, ${n}${o}`:t,d=[[Mt.default.instancePath,D.strConcat(Mt.default.instancePath,s)],[Mt.default.parentData,i.parentData],[Mt.default.parentDataProperty,i.parentDataProperty],[Mt.default.rootData,Mt.default.rootData]];if(i.opts.dynamicRef)d.push([Mt.default.dynamicAnchors,Mt.default.dynamicAnchors]);let m=D._`${l}, ${r.object(...d)}`;return u!==D.nil?D._`${a}.call(${u}, ${m})`:D._`${a}(${m})`}hh.callValidateCode=bz;var wz=D._`new RegExp`;function xz({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:D._`${o.code==="new RegExp"?wz:fh.useFunc(e,o)}(${r}, ${n})`})}hh.usePattern=xz;function $z(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 u=t.const("len",D._`${r}.length`);t.forRange("i",0,u,(c)=>{e.subschema({keyword:n,dataProp:c,dataPropType:Cr.Type.Num},s),t.if(D.not(s),a)})}}hh.validateArray=$z;function zz(e){let{gen:t,schema:r,keyword:n,it:o}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(r.some((u)=>Cr.alwaysValidSchema(o,u))&&!o.opts.unevaluated)return;let i=t.let("valid",!1),a=t.name("_valid");t.block(()=>r.forEach((u,c)=>{let l=e.subschema({keyword:n,schemaProp:c,compositeRule:!0},a);if(t.assign(i,D._`${i} || ${a}`),!e.mergeValidEvaluated(l,a))t.if(D.not(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}hh.validateUnion=zz});var $h=E(function(wh){Object.defineProperty(wh,"__esModule",{value:!0});wh.validateKeywordUsage=wh.validSchemaType=wh.funcKeywordCode=wh.macroKeywordCode=void 0;var W=L(),lr=xt(),yh=Je(),vh=In();function Zz(e,t){let{gen:r,keyword:n,schema:o,parentSchema:s,it:i}=e,a=t.macro.call(i.self,o,s,i),u=bh(r,n,a);if(i.opts.validateSchema!==!1)i.self.validateSchema(a,!0);let c=r.name("valid");e.subschema({schema:a,schemaPath:W.nil,errSchemaPath:`${i.errSchemaPath}/${n}`,topSchemaRef:u,compositeRule:!0},c),e.pass(c,()=>e.error(!0))}wh.macroKeywordCode=Zz;function Dz(e,t){var r;let{gen:n,keyword:o,schema:s,parentSchema:i,$data:a,it:u}=e;qz(u,t);let c=!a&&t.compile?t.compile.call(u.self,s,i,u):t.validate,l=bh(n,o,c),d=n.let("valid");e.block$data(d,m),e.ok((r=t.valid)!==null&&r!==void 0?r:d);function m(){if(t.errors===!1){if(g(),t.modifying)_h(e);_(()=>e.error())}else{let y=t.async?f():p();if(t.modifying)_h(e);_(()=>Mz(e,y))}}function f(){let y=n.let("ruleErrs",null);return n.try(()=>g(W._`await `),(k)=>n.assign(d,!1).if(W._`${k} instanceof ${u.ValidationError}`,()=>n.assign(y,W._`${k}.errors`),()=>n.throw(k))),y}function p(){let y=W._`${l}.errors`;return n.assign(y,null),g(W.nil),y}function g(y=t.async?W._`await `:W.nil){let k=u.opts.passContext?lr.default.this:lr.default.self,C=!(("compile"in t)&&!a||t.schema===!1);n.assign(d,W._`${y}${yh.callValidateCode(e,l,k,C)}`,t.modifying)}function _(y){var k;n.if(W.not((k=t.valid)!==null&&k!==void 0?k:d),y)}}wh.funcKeywordCode=Dz;function _h(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,W._`${n.parentData}[${n.parentDataProperty}]`))}function Mz(e,t){let{gen:r}=e;r.if(W._`Array.isArray(${t})`,()=>{r.assign(lr.default.vErrors,W._`${lr.default.vErrors} === null ? ${t} : ${lr.default.vErrors}.concat(${t})`).assign(lr.default.errors,W._`${lr.default.vErrors}.length`),vh.extendErrors(e)},()=>e.error())}function qz({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}function bh(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:W.stringify(r)})}function Lz(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")}wh.validSchemaType=Lz;function Uz({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 u=`keyword "${s}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(u);else throw Error(u)}}}wh.validateKeywordUsage=Uz});var kh=E(function(zh){Object.defineProperty(zh,"__esModule",{value:!0});zh.extendSubschemaMode=zh.extendSubschemaData=zh.getSubschema=void 0;var ge=L(),es=V();function Bz(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:ge._`${e.schemaPath}${ge.getProperty(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:ge._`${e.schemaPath}${ge.getProperty(t)}${ge.getProperty(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${es.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')}zh.getSubschema=Bz;function Jz(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:c,dataPathArr:l,opts:d}=t,m=a.let("data",ge._`${t.data}${ge.getProperty(r)}`,!0);u(m),e.errorPath=ge.str`${c}${es.getErrorPath(r,n,d.jsPropertySyntax)}`,e.parentDataProperty=ge._`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(o!==void 0){let c=o instanceof ge.Name?o:a.let("data",o,!0);if(u(c),i!==void 0)e.propertyName=i}if(s)e.dataTypes=s;function u(c){e.data=c,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,c]}}zh.extendSubschemaData=Jz;function Kz(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}zh.extendSubschemaMode=Kz});var Ga=E(function(SZ,Ph){Ph.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 Th=E(function(kZ,Eh){var qt=Eh.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(){};ts(t,n,o,e,"",e)};qt.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};qt.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};qt.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};qt.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 ts(e,t,r,n,o,s,i,a,u,c){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,o,s,i,a,u,c);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in qt.arrayKeywords)for(var m=0;m<d.length;m++)ts(e,t,r,d[m],o+"/"+l+"/"+m,s,o,l,n,m)}else if(l in qt.propsKeywords){if(d&&typeof d=="object")for(var f in d)ts(e,t,r,d[f],o+"/"+l+"/"+Xz(f),s,o,l,n,f)}else if(l in qt.keywords||e.allKeys&&!(l in qt.skipKeywords))ts(e,t,r,d,o+"/"+l,s,o,l,n)}r(n,o,s,i,a,u,c)}}function Xz(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var An=E(function(Ah){Object.defineProperty(Ah,"__esModule",{value:!0});Ah.getSchemaRefs=Ah.resolveUrl=Ah.normalizeId=Ah._getFullPath=Ah.getFullPath=Ah.inlineRef=void 0;var Rh=V(),Yz=Ga(),Qz=Th(),eS=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function tS(e,t=!0){if(typeof e=="boolean")return!0;if(t===!0)return!Xa(e);if(!t)return!1;return Oh(e)<=t}Ah.inlineRef=tS;var rS=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Xa(e){for(let t in e){if(rS.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(Xa))return!0;if(typeof r=="object"&&Xa(r))return!0}return!1}function Oh(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,eS.has(r))continue;if(typeof e[r]=="object")Rh.eachItem(e[r],(n)=>t+=Oh(n));if(t===1/0)return 1/0}return t}function Ih(e,t="",r){if(r!==!1)t=Ar(t);let n=e.parse(t);return Ch(e,n)}Ah.getFullPath=Ih;function Ch(e,t){return e.serialize(t).split("#")[0]+"#"}Ah._getFullPath=Ch;var nS=/#\/?$/;function Ar(e){return e?e.replace(nS,""):""}Ah.normalizeId=Ar;function oS(e,t,r){return r=Ar(r),e.resolve(t,r)}Ah.resolveUrl=oS;var sS=/^[a-z_][-a-z0-9._]*$/i;function iS(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=Ar(e[r]||t),s={"":o},i=Ih(n,o,!1),a={},u=new Set;return Qz(e,{allKeys:!0},(d,m,f,p)=>{if(p===void 0)return;let g=i+m,_=s[p];if(typeof d[r]=="string")_=y.call(this,d[r]);k.call(this,d.$anchor),k.call(this,d.$dynamicAnchor),s[m]=_;function y(C){let U=this.opts.uriResolver.resolve;if(C=Ar(_?U(_,C):C),u.has(C))throw l(C);u.add(C);let b=this.refs[C];if(typeof b=="string")b=this.refs[b];if(typeof b=="object")c(d,b.schema,C);else if(C!==Ar(g))if(C[0]==="#")c(d,a[C],C),a[C]=d;else this.refs[C]=g;return C}function k(C){if(typeof C=="string"){if(!sS.test(C))throw Error(`invalid anchor "${C}"`);y.call(this,`#${C}`)}}}),a;function c(d,m,f){if(m!==void 0&&!Yz(d,m))throw l(f)}function l(d){return Error(`reference "${d}" resolves to more than one schema`)}}Ah.getSchemaRefs=iS});var Nn=E(function(Gh){Object.defineProperty(Gh,"__esModule",{value:!0});Gh.getData=Gh.KeywordCxt=Gh.validateFunctionCode=void 0;var ns=Jm(),rs=Cn(),jr=Va(),Lt=Cn(),Mh=dh(),nt=$h(),Nr=kh(),w=L(),M=xt(),qh=An(),be=V(),rt=In();function fS(e){if(Fh(e)){if(Vh(e),Uh(e)){hS(e);return}}Lh(e,()=>ns.topBoolOrEmptySchema(e))}Gh.validateFunctionCode=fS;function Lh({gen:e,validateName:t,schema:r,schemaEnv:n,opts:o},s){if(o.code.es5)e.func(t,w._`${M.default.data}, ${M.default.valCxt}`,n.$async,()=>{e.code(w._`"use strict"; ${jh(r,o)}`),mS(e,o),e.code(s)});else e.func(t,w._`${M.default.data}, ${pS(o)}`,n.$async,()=>e.code(jh(r,o)).code(s))}function pS(e){return w._`{${M.default.instancePath}="", ${M.default.parentData}, ${M.default.parentDataProperty}, ${M.default.rootData}=${M.default.data}${e.dynamicRef?w._`, ${M.default.dynamicAnchors}={}`:w.nil}}={}`}function mS(e,t){e.if(M.default.valCxt,()=>{if(e.var(M.default.instancePath,w._`${M.default.valCxt}.${M.default.instancePath}`),e.var(M.default.parentData,w._`${M.default.valCxt}.${M.default.parentData}`),e.var(M.default.parentDataProperty,w._`${M.default.valCxt}.${M.default.parentDataProperty}`),e.var(M.default.rootData,w._`${M.default.valCxt}.${M.default.rootData}`),t.dynamicRef)e.var(M.default.dynamicAnchors,w._`${M.default.valCxt}.${M.default.dynamicAnchors}`)},()=>{if(e.var(M.default.instancePath,w._`""`),e.var(M.default.parentData,w._`undefined`),e.var(M.default.parentDataProperty,w._`undefined`),e.var(M.default.rootData,M.default.data),t.dynamicRef)e.var(M.default.dynamicAnchors,w._`{}`)})}function hS(e){let{schema:t,opts:r,gen:n}=e;Lh(e,()=>{if(r.$comment&&t.$comment)Bh(e);if(bS(e),n.let(M.default.vErrors,null),n.let(M.default.errors,0),r.unevaluated)gS(e);Hh(e),$S(e)});return}function gS(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",w._`${r}.evaluated`),t.if(w._`${e.evaluated}.dynamicProps`,()=>t.assign(w._`${e.evaluated}.props`,w._`undefined`)),t.if(w._`${e.evaluated}.dynamicItems`,()=>t.assign(w._`${e.evaluated}.items`,w._`undefined`))}function jh(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?w._`/*# sourceURL=${r} */`:w.nil}function _S(e,t){if(Fh(e)){if(Vh(e),Uh(e)){yS(e,t);return}}ns.boolOrEmptySchema(e,t)}function Uh({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 Fh(e){return typeof e.schema!="boolean"}function yS(e,t){let{schema:r,gen:n,opts:o}=e;if(o.$comment&&r.$comment)Bh(e);wS(e),xS(e);let s=n.const("_errs",M.default.errors);Hh(e,s),n.var(t,w._`${s} === ${M.default.errors}`)}function Vh(e){be.checkUnknownRules(e),vS(e)}function Hh(e,t){if(e.opts.jtd)return Zh(e,[],!1,t);let r=rs.getSchemaTypes(e.schema),n=rs.coerceAndCheckDataType(e,r);Zh(e,r,!n,t)}function vS(e){let{schema:t,errSchemaPath:r,opts:n,self:o}=e;if(t.$ref&&n.ignoreKeywordsWithRef&&be.schemaHasRulesButRef(t,o.RULES))o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function bS(e){let{schema:t,opts:r}=e;if(t.default!==void 0&&r.useDefaults&&r.strictSchema)be.checkStrictMode(e,"default is ignored in the schema root")}function wS(e){let t=e.schema[e.opts.schemaId];if(t)e.baseId=qh.resolveUrl(e.opts.uriResolver,e.baseId,t)}function xS(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}function Bh({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:o}){let s=r.$comment;if(o.$comment===!0)e.code(w._`${M.default.self}.logger.log(${s})`);else if(typeof o.$comment=="function"){let i=w.str`${n}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code(w._`${M.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function $S(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:o,opts:s}=e;if(r.$async)t.if(w._`${M.default.errors} === 0`,()=>t.return(M.default.data),()=>t.throw(w._`new ${o}(${M.default.vErrors})`));else{if(t.assign(w._`${n}.errors`,M.default.vErrors),s.unevaluated)zS(e);t.return(w._`${M.default.errors} === 0`)}}function zS({gen:e,evaluated:t,props:r,items:n}){if(r instanceof w.Name)e.assign(w._`${t}.props`,r);if(n instanceof w.Name)e.assign(w._`${t}.items`,n)}function Zh(e,t,r,n){let{gen:o,schema:s,data:i,allErrors:a,opts:u,self:c}=e,{RULES:l}=c;if(s.$ref&&(u.ignoreKeywordsWithRef||!be.schemaHasRulesButRef(s,l))){o.block(()=>Kh(e,"$ref",l.all.$ref.definition));return}if(!u.jtd)SS(e,t);o.block(()=>{for(let m of l.rules)d(m);d(l.post)});function d(m){if(!jr.shouldUseGroup(s,m))return;if(m.type){if(o.if(Lt.checkDataType(m.type,i,u.strictNumbers)),Dh(e,m),t.length===1&&t[0]===m.type&&r)o.else(),Lt.reportTypeError(e);o.endIf()}else Dh(e,m);if(!a)o.if(w._`${M.default.errors} === ${n||0}`)}}function Dh(e,t){let{gen:r,schema:n,opts:{useDefaults:o}}=e;if(o)Mh.assignDefaults(e,t.type);r.block(()=>{for(let s of t.rules)if(jr.shouldUseRule(n,s))Kh(e,s.keyword,s.definition,t.type)})}function SS(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;if(kS(e,t),!e.opts.allowUnionTypes)PS(e,t);ES(e,e.dataTypes)}function kS(e,t){if(!t.length)return;if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach((r)=>{if(!Jh(e.dataTypes,r))Ya(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),RS(e,t)}function PS(e,t){if(t.length>1&&!(t.length===2&&t.includes("null")))Ya(e,"use allowUnionTypes to allow union type keyword")}function ES(e,t){let r=e.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&jr.shouldUseRule(e.schema,o)){let{type:s}=o.definition;if(s.length&&!s.some((i)=>TS(t,i)))Ya(e,`missing type "${s.join(",")}" for keyword "${n}"`)}}}function TS(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function Jh(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function RS(e,t){let r=[];for(let n of e.dataTypes)if(Jh(t,n))r.push(n);else if(t.includes("integer")&&n==="number")r.push("integer");e.dataTypes=r}function Ya(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,be.checkStrictMode(e,t,e.opts.strictTypes)}class Qa{constructor(e,t,r){if(nt.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=be.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",Wh(this.$data,e));else if(this.schemaCode=this.schemaValue,!nt.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(w.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(w.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(w._`${t} !== undefined && (${w.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?rt.reportExtraError:rt.reportError)(this,this.def.error,t)}$dataError(){rt.reportError(this,this.def.$dataError||rt.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');rt.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=w.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=w.nil,t=w.nil){if(!this.$data)return;let{gen:r,schemaCode:n,schemaType:o,def:s}=this;if(r.if(w.or(w._`${n} === undefined`,t)),e!==w.nil)r.assign(e,!0);if(o.length||s.validateSchema){if(r.elseIf(this.invalid$data()),this.$dataError(),e!==w.nil)r.assign(e,!1)}r.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:r,def:n,it:o}=this;return w.or(s(),i());function s(){if(r.length){if(!(t instanceof w.Name))throw Error("ajv implementation error");let a=Array.isArray(r)?r:[r];return w._`${Lt.checkDataTypes(a,t,o.opts.strictNumbers,Lt.DataType.Wrong)}`}return w.nil}function i(){if(n.validateSchema){let a=e.scopeValue("validate$data",{ref:n.validateSchema});return w._`!${a}(${t})`}return w.nil}}subschema(e,t){let r=Nr.getSubschema(this.it,e);Nr.extendSubschemaData(r,this.it,e),Nr.extendSubschemaMode(r,e);let n={...this.it,...r,items:void 0,props:void 0};return _S(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=be.mergeEvaluated.props(n,e.props,r.props,t);if(r.items!==!0&&e.items!==void 0)r.items=be.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,w.Name)),!0}}Gh.KeywordCxt=Qa;function Kh(e,t,r,n){let o=new Qa(e,r,t);if("code"in r)r.code(o,n);else if(o.$data&&r.validate)nt.funcKeywordCode(o,r);else if("macro"in r)nt.macroKeywordCode(o,r);else if(r.compile||r.validate)nt.funcKeywordCode(o,r)}var OS=/^\/(?:[^~]|~0|~1)*$/,IS=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Wh(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let o,s;if(e==="")return M.default.rootData;if(e[0]==="/"){if(!OS.test(e))throw Error(`Invalid JSON-pointer: ${e}`);o=e,s=M.default.rootData}else{let c=IS.exec(e);if(!c)throw Error(`Invalid JSON-pointer: ${e}`);let l=+c[1];if(o=c[2],o==="#"){if(l>=t)throw Error(u("property/index",l));return n[t-l]}if(l>t)throw Error(u("data",l));if(s=r[t-l],!o)return s}let i=s,a=o.split("/");for(let c of a)if(c)s=w._`${s}${w.getProperty(be.unescapeJsonPointer(c))}`,i=w._`${i} && ${s}`;return i;function u(c,l){return`Cannot access ${c} ${l} levels up, current level is ${t}`}}Gh.getData=Wh});var os=E(function(Qh){Object.defineProperty(Qh,"__esModule",{value:!0});class Yh extends Error{constructor(e){super("validation failed");this.errors=e,this.ajv=this.validation=!0}}Qh.default=Yh});var jn=E(function(tg){Object.defineProperty(tg,"__esModule",{value:!0});var Zr=An();class eg extends Error{constructor(e,t,r,n){super(n||`can't resolve reference ${r} from id ${t}`);this.missingRef=Zr.resolveUrl(e,t,r),this.missingSchema=Zr.normalizeId(Zr.getFullPath(e,this.missingRef))}}tg.default=eg});var as=E(function(og){Object.defineProperty(og,"__esModule",{value:!0});og.resolveSchema=og.getCompilingSchema=og.resolveRef=og.compileSchema=og.SchemaEnv=void 0;var de=L(),ZS=os(),dr=xt(),fe=An(),ss=V(),rg=Nn();class Zn{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:fe.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={}}}og.SchemaEnv=Zn;function tc(e){let t=ng.call(this,e);if(t)return t;let r=fe.getFullPath(this.opts.uriResolver,e.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:s}=this.opts,i=new de.CodeGen(this.scope,{es5:n,lines:o,ownProperties:s}),a;if(e.$async)a=i.scopeValue("Error",{ref:ZS.default,code:de._`require("ajv/dist/runtime/validation_error").default`});let u=i.scopeName("validate");e.validateName=u;let c={gen:i,allErrors:this.opts.allErrors,data:dr.default.data,parentData:dr.default.parentData,parentDataProperty:dr.default.parentDataProperty,dataNames:[dr.default.data],dataPathArr:[de.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:de.stringify(e.schema)}:{ref:e.schema}),validateName:u,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:de.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:de._`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),rg.validateFunctionCode(c),i.optimize(this.opts.code.optimize);let d=i.toString();if(l=`${i.scopeRefs(dr.default.scope)}return ${d}`,this.opts.code.process)l=this.opts.code.process(l,e);let f=Function(`${dr.default.self}`,`${dr.default.scope}`,l)(this,this.scope.get());if(this.scope.value(u,{ref:f}),f.errors=null,f.schema=e.schema,f.schemaEnv=e,e.$async)f.$async=!0;if(this.opts.code.source===!0)f.source={validateName:u,validateCode:d,scopeValues:i._values};if(this.opts.unevaluated){let{props:p,items:g}=c;if(f.evaluated={props:p instanceof de.Name?void 0:p,items:g instanceof de.Name?void 0:g,dynamicProps:p instanceof de.Name,dynamicItems:g instanceof de.Name},f.source)f.source.evaluated=de.stringify(f.evaluated)}return e.validate=f,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)}}og.compileSchema=tc;function DS(e,t,r){var n;r=fe.resolveUrl(this.opts.uriResolver,t,r);let o=e.refs[r];if(o)return o;let s=LS.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 Zn({schema:i,schemaId:a,root:e,baseId:t})}if(s===void 0)return;return e.refs[r]=MS.call(this,s)}og.resolveRef=DS;function MS(e){if(fe.inlineRef(e.schema,this.opts.inlineRefs))return e.schema;return e.validate?e:tc.call(this,e)}function ng(e){for(let t of this._compilations)if(qS(t,e))return t}og.getCompilingSchema=ng;function qS(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function LS(e,t){let r;while(typeof(r=this.refs[t])=="string")t=r;return r||this.schemas[t]||is.call(this,e,t)}function is(e,t){let r=this.opts.uriResolver.parse(t),n=fe._getFullPath(this.opts.uriResolver,r),o=fe.getFullPath(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===o)return ec.call(this,r,e);let s=fe.normalizeId(n),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=is.call(this,e,i);if(typeof(a===null||a===void 0?void 0:a.schema)!=="object")return;return ec.call(this,r,a)}if(typeof(i===null||i===void 0?void 0:i.schema)!=="object")return;if(!i.validate)tc.call(this,i);if(s===fe.normalizeId(t)){let{schema:a}=i,{schemaId:u}=this.opts,c=a[u];if(c)o=fe.resolveUrl(this.opts.uriResolver,o,c);return new Zn({schema:a,schemaId:u,root:e,baseId:o})}return ec.call(this,r,i)}og.resolveSchema=is;var US=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function ec(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 u=r[ss.unescapeFragment(a)];if(u===void 0)return;r=u;let c=typeof r==="object"&&r[this.opts.schemaId];if(!US.has(a)&&c)t=fe.resolveUrl(this.opts.uriResolver,t,c)}let s;if(typeof r!="boolean"&&r.$ref&&!ss.schemaHasRulesButRef(r,this.RULES)){let a=fe.resolveUrl(this.opts.uriResolver,t,r.$ref);s=is.call(this,n,a)}let{schemaId:i}=this.opts;if(s=s||new Zn({schema:r,schemaId:i,root:n,baseId:t}),s.schema!==s.root.schema)return s;return}});var ig=E(function(IZ,JS){JS.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 ac=E(function(CZ,mg){var KS=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),nc=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),WS=RegExp.prototype.test.bind(/^\d*$/u),fr=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),oc=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),cg=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),sc=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),GS=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),Ae=Array(256);for(let t=0;t<256;t++)Ae[t]="%"+"0123456789ABCDEF"[t>>4]+"0123456789ABCDEF"[t&15];function ke(e){if(e<2048)return Ae[192|e>>6]+Ae[128|e&63];if(e<65536)return Ae[224|e>>12]+Ae[128|e>>6&63]+Ae[128|e&63];return Ae[240|e>>18]+Ae[128|e>>12&63]+Ae[128|e>>6&63]+Ae[128|e&63]}function XS(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 YS=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),QS=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),ek=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),tk=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function rk(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++){if(ek(e[t]))continue;if(e[t]==="%"&&t+2<e.length&&fr(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function ag(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 nk(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 u=o[a];if(u==="")return;if(u.indexOf(".")!==-1){if(a!==o.length-1||t!==-1&&n.length===0||!nc(u))return;s+=2;continue}if(!YS(u))return;o[a]=parseInt(u,16).toString(16),s++}if(t===-1){if(s!==8)return;return ag(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 ag(i)}function rc(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&&QS(n))return n=n.toLowerCase(),{host:`[${n}]`,escapedHost:n,isIPV6:!1,isIPVFuture:!0};if(ok(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),!rk(o))return{host:e,isIPV6:!1,error:!0};n=n.slice(0,s)}let i=nk(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 ok(e,t){let r=0;for(let n=0;n<e.length;n++)if(e[n]===t)r++;return r}function ug(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("")}function sk(e){if(e===""||e[0]==="/")return ug(e);let t=e.split("/"),r=t.length-1,n=[],o=!1;for(let s=0;s<=r;s++){let i=t[s];if(i==="."||i===".."){if(i==="..")if(n.length!==0&&n[n.length-1]!=="..")n.pop();else n.push("..");o=s===r}else n.push(i)}if(o&&n[n.length-1]!=="..")n.push("");if(n.length===0||n[0]===""||n[0].includes(":"))n.unshift(".");return n.join("/")}var ik={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},ak=/[@/?#:]/g,ck=/[@/?#]/g;function lg(e,t){let r=t?ck:ak;return r.lastIndex=0,e.replace(r,(n)=>ik[n])}function dg(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(fr(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));if(t&&oc(i))r+=i;else r+="%"+s;n+=2;continue}}r+=e[n]}return r}function uk(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(fr(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));if(i!=="."&&oc(i))t+=i;else t+="%"+s;r+=2;continue}}if(cg(n))t+=n;else{let o=e.charCodeAt(r);if(o<128)t+=pg(o)?n:Ae[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 lk(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(fr(i)){r+="%"+i.toUpperCase(),o+=2;continue}}if(s==="/")n=!1;if(cg(s)&&(s!==":"||!n))r+=s;else{let i=e.charCodeAt(o);if(i<128)r+=Ae[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 ic(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(fr(s)){r+="%"+s.toUpperCase(),n+=2;continue}}if(t(o))r+=o;else{let s=e.charCodeAt(n);if(s<128)r+=Ae[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 fg(e){return ic(e,GS)}function dk(e){return ic(e,sc)}function fk(e){return ic(e,sc)}function pg(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 pk(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(fr(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));if(oc(i))t+=i;else t+="%"+s;r+=2;continue}}if(sc(n))t+=n;else{let o=e.charCodeAt(r);if(o<128)t+=pg(o)?n:Ae[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 mk(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(fr(n)){t+="%"+n.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function hk(e){let t=[];if(e.userinfo!==void 0)t.push(fg(e.userinfo)),t.push("@");if(e.host!==void 0){let r=e.host;if(!nc(r)){let n=rc(r);if(n.isIPV6!==!0&&n.isIPVFuture!==!0)r=dg(r,!0),n=rc(r);if(n.isIPV6===!0||n.isIPVFuture===!0)r=`[${n.escapedHost}]`;else r=lg(r,!1)}t.push(r)}if(typeof e.port==="number"||typeof e.port==="string"){let r=String(e.port);if(!WS(r))throw TypeError("URI port is malformed.");t.push(":"),t.push(r)}return t.length?t.join(""):void 0}mg.exports={nonSimpleDomain:tk,recomposeAuthority:hk,reescapeHostDelimiters:lg,normalizePercentEncoding:dg,normalizePathEncoding:uk,serializePathEncoding:lk,normalizeQueryFragmentEncoding:pk,encodeUserinfo:fg,encodeQuery:dk,encodeFragment:fk,escapePreservingEscapes:mk,removeDotSegments:ug,removeDotSegmentsRelative:sk,isIPv4:nc,isUUID:KS,normalizeIPv6:rc,stringArrayToHexStripped:XS}});var vg=E(function(AZ,yg){var{isUUID:gk}=ac(),_k=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,yk=["http","https","ws","wss","urn","urn:uuid"];function vk(e){return yk.indexOf(e)!==-1}function cc(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 hg(e){if(!e.host)e.error=e.error||"HTTP URIs must have a host.";return e}function gg(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 bk(e){return e.secure=cc(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function wk(e){if(e.port===(cc(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 xk(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(_k);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=uc(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 $k(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=uc(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 zk(e,t){let r=e;if(r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!gk(r.uuid)))r.error=r.error||"UUID is not valid.";return r}function Sk(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var _g={scheme:"http",domainHost:!0,parse:hg,serialize:gg},kk={scheme:"https",domainHost:_g.domainHost,parse:hg,serialize:gg},cs={scheme:"ws",domainHost:!0,parse:bk,serialize:wk},Pk={scheme:"wss",domainHost:cs.domainHost,parse:cs.parse,serialize:cs.serialize},Ek={scheme:"urn",parse:xk,serialize:$k,skipNormalize:!0},Tk={scheme:"urn:uuid",parse:zk,serialize:Sk,skipNormalize:!0},us={http:_g,https:kk,ws:cs,wss:Pk,urn:Ek,"urn:uuid":Tk};Object.setPrototypeOf(us,null);function uc(e){return e&&(us[e]||us[e.toLowerCase()])||void 0}yg.exports={wsIsSecure:cc,SCHEMES:us,isValidSchemeName:vk,getSchemeHandler:uc}});var Cg=E(function(NZ,ps){var{normalizeIPv6:zg,removeDotSegments:Mn,removeDotSegmentsRelative:Sg,recomposeAuthority:Rk,normalizePercentEncoding:lc,normalizePathEncoding:Ok,serializePathEncoding:bg,normalizeQueryFragmentEncoding:wg,encodeQuery:Ik,encodeFragment:Ck,reescapeHostDelimiters:Ak,isIPv4:kg,nonSimpleDomain:Nk}=ac(),{SCHEMES:Pg,getSchemeHandler:dc}=vg(),Eg=/^[A-Za-z][A-Za-z0-9+.-]*$/u,jk=/[\0-\x20"#/:<>?@[\\\]^`{|}\x7F]/u;function xg(e){let t=String(e);if(!Eg.test(t))throw TypeError("URI scheme is malformed.");return t}function Zk(e,t){if(typeof e==="string")e=Bk(e,t);else if(typeof e==="object")e=ds(pr(e,t),t);return e}function Dk(e,t,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},{parsed:o,malformedAuthorityOrPort:s,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:u,malformedScheme:c}=ls(e,n),{parsed:l,malformedAuthorityOrPort:d,malformedPercentEncoding:m,malformedSchemeSpecific:f,malformedHost:p,malformedScheme:g}=ls(t,n);if(s||d||i||m||a||f||u||p||c||g)throw Error(o.error||l.error||"URI is malformed.");let _=Tg(o,l,n,!0),y=dc(r&&r.scheme||_.scheme),k=_.host,C=k!==void 0&&k!==""&&(kg(k)||zg(k).isIPV6);if(Og(_,r||{},y,C))throw Error("URI host is malformed.");Rg(_,r||{},y,C);let U=k&&k.indexOf("%")!==-1&&!/\P{ASCII}/u.test(k);if(_.error&&!U)throw Error(_.error);return n.skipEscape=!0,pr(_,n)}function Tg(e,t,r,n){let o={};if(!n)e=ds(pr(e,r),r),t=ds(pr(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=Mn(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=Mn(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=Mn(t.path);else{let s=e.userinfo!==void 0||e.host!==void 0||e.port!==void 0;if(s&&!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=e.scheme===void 0&&!s&&o.path[0]!=="/"?Sg(o.path):Mn(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 Mk(e,t,r){let n=$g(e,r),o=$g(t,r);return n!==void 0&&o!==void 0&&n===o}function pr(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=xg(r.scheme);let s=dc(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=(r.scheme===void 0||n.reference==="suffix")&&!i,u=!n.skipEscape&&a;if(r.path!==void 0)if(!n.skipEscape)r.path=bg(r.path,u);else r.path=lc(r.path);if(n.reference!=="suffix"&&r.scheme)r.scheme=xg(r.scheme),o.push(r.scheme,":");let c=Rk(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 l=r.path;if(!n.absolutePath&&(!s||!s.absolutePath))l=a&&l[0]!=="/"?Sg(l):Mn(l);if(a)l=bg(l,!0);if(c===void 0&&l[0]==="/"&&l[1]==="/")l="/%2F"+l.slice(2);o.push(l)}if(r.query!==void 0)o.push("?",Ik(r.query));if(r.fragment!==void 0)o.push("#",Ck(r.fragment));return o.join("")}var qk=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,Lk=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,Uk=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function Fk(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 Dn(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 fs(e){return e[0]==="["&&e[e.length-1]==="]"}function Vk(e){let t=e[4];return Dn(e[3])||t!==void 0&&!fs(t)&&Dn(t)||Dn(e[6])||Dn(e[7])||Dn(e[8])}function Rg(e,t,r,n){if(Og(e,t,r,n))return e.error=e.error||"URI host is malformed.",!0;if(!t.unicodeSupport&&(!r||!r.unicodeSupport)&&e.host&&!fs(e.host)&&(t.domainHost||r&&r.domainHost)&&n===!1&&Nk(e.host)){let o;try{o=new URL("http://"+e.host)}catch(s){return e.error=e.error||"Host's domain name can not be converted to ASCII: "+s,!0}if(!Hk(o))return e.error=e.error||"URI host is malformed.",!0;e.host=o.hostname}return!1}function Og(e,t,r,n){return Boolean(e.host&&n===!1&&!fs(e.host)&&(t.domainHost||r&&r.domainHost)&&jk.test(e.host))}function Hk(e){return e.username===""&&e.password===""&&e.port===""&&e.pathname==="/"&&e.search===""&&e.hash===""&&e.hostname!==""}function ls(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,u=!1,c=!1,l=!1;if(r.reference==="suffix")if(r.scheme)e=r.scheme+":"+e;else e="//"+e;let d=e.match(Lk);if(d!==null&&d[1].indexOf("\\")!==-1)n.error="URI authority must not contain a literal backslash.",o=!0;let m=e.match(Uk);if(m!==null){let p=m[1],g=p.replace(/[\t\n\r]/g,"");if(g.length>=2){if(g.slice(0,2)!=="//")n.error=n.error||"URI authority must not contain a literal backslash.",o=!0;else if(p.length!==g.length)n.error=n.error||"URI authority introducer must not contain whitespace.",o=!0}}let f=e.match(qk);if(f){if(n.scheme=f[1],n.userinfo=f[3],n.host=f[4],n.port=parseInt(f[5],10),n.path=f[6]||"",n.query=f[7],n.fragment=f[8],n.scheme!==void 0)if(Eg.test(n.scheme))n.scheme=n.scheme.toLowerCase();else n.error=n.error||"URI scheme is malformed.",c=!0;if(s=Vk(f),s)n.error=n.error||"URI contains malformed percent-encoding.";if(isNaN(n.port))n.port=f[5];let p=Fk(n,f);if(p!==void 0)n.error=n.error||p,o=!0;if(n.host)if(kg(n.host)===!1){let y=fs(n.host),k=n.host.indexOf("[")!==-1||n.host.indexOf("]")!==-1,C=zg(n.host);if(l=C.isIPV6||C.isIPVFuture===!0,u=k&&(!y||C.error===!0),n.host=l?C.host:C.host.toLowerCase(),u)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 g=dc(r.scheme||n.scheme);if(!u)a=Rg(n,r,g,l);if(e.indexOf("%")!==-1&&n.host!==void 0&&!u){let _=l?n.host:lc(n.host,!0);if(!l)_=lc(_.toLowerCase());n.host=l||r.scheme!=="null"?Ak(_,l):_}if(!g||g&&!g.skipNormalize){if(n.path)n.path=Ok(n.path);if(n.query)n.query=wg(n.query);if(n.fragment)n.fragment=wg(n.fragment)}if(g&&g.parse){if(g.parse(n,r),g===Pg.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:c}}function ds(e,t){return ls(e,t).parsed}function Bk(e,t){return Ig(e,t).normalized}function Ig(e,t){let{parsed:r,malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:s,malformedHost:i,malformedScheme:a}=ls(e,t);return{normalized:n||o||s||i||a?e:pr(r,t),malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:s,malformedHost:i,malformedScheme:a}}function $g(e,t){if(typeof e!=="string"&&typeof e!=="object")return;let r;try{r=typeof e==="string"?e:pr(e,t)}catch{return}let{normalized:n,malformedAuthorityOrPort:o,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:u}=Ig(r,t);return o||s||i||a||u?void 0:n}var fc={SCHEMES:Pg,normalize:Zk,resolve:Dk,resolveComponent:Tg,equal:Mk,serialize:pr,parse:ds};ps.exports=fc;ps.exports.default=fc;ps.exports.fastUri=fc});var jg=E(function(Ng){Object.defineProperty(Ng,"__esModule",{value:!0});var Ag=Cg();Ag.code='require("ajv/dist/runtime/uri").default';Ng.default=Ag});var Bg=E(function($t){Object.defineProperty($t,"__esModule",{value:!0});$t.CodeGen=$t.Name=$t.nil=$t.stringify=$t.str=$t._=$t.KeywordCxt=void 0;var Kk=Nn();Object.defineProperty($t,"KeywordCxt",{enumerable:!0,get:function(){return Kk.KeywordCxt}});var Mr=L();Object.defineProperty($t,"_",{enumerable:!0,get:function(){return Mr._}});Object.defineProperty($t,"str",{enumerable:!0,get:function(){return Mr.str}});Object.defineProperty($t,"stringify",{enumerable:!0,get:function(){return Mr.stringify}});Object.defineProperty($t,"nil",{enumerable:!0,get:function(){return Mr.nil}});Object.defineProperty($t,"Name",{enumerable:!0,get:function(){return Mr.Name}});Object.defineProperty($t,"CodeGen",{enumerable:!0,get:function(){return Mr.CodeGen}});var Wk=os(),Lg=jn(),Ug=Fa(),ot=as(),Fg=L(),st=An(),Ut=Cn(),Dr=V(),Zg=ig(),Gk=jg(),Vg=(e,t)=>new RegExp(e,t);Vg.code="new RegExp";var Xk=["removeAdditional","useDefaults","coerceTypes"],Yk=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),Qk={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."},eP={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},Dg=200;function tP(e){var t,r,n,o,s,i,a,u,c,l,d,m,f,p,g,_,y,k,C,U,b,x,N,Y,F;let se=e.strict,mt=(t=e.code)===null||t===void 0?void 0:t.optimize,rr=mt===!0||mt===void 0?1:mt||0,_r=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:Vg,zt=(o=e.uriResolver)!==null&&o!==void 0?o:Gk.default;return{strictSchema:(i=(s=e.strictSchema)!==null&&s!==void 0?s:se)!==null&&i!==void 0?i:!0,strictNumbers:(u=(a=e.strictNumbers)!==null&&a!==void 0?a:se)!==null&&u!==void 0?u:!0,strictTypes:(l=(c=e.strictTypes)!==null&&c!==void 0?c:se)!==null&&l!==void 0?l:"log",strictTuples:(m=(d=e.strictTuples)!==null&&d!==void 0?d:se)!==null&&m!==void 0?m:"log",strictRequired:(p=(f=e.strictRequired)!==null&&f!==void 0?f:se)!==null&&p!==void 0?p:!1,code:e.code?{...e.code,optimize:rr,regExp:_r}:{optimize:rr,regExp:_r},loopRequired:(g=e.loopRequired)!==null&&g!==void 0?g:Dg,loopEnum:(_=e.loopEnum)!==null&&_!==void 0?_:Dg,meta:(y=e.meta)!==null&&y!==void 0?y:!0,messages:(k=e.messages)!==null&&k!==void 0?k:!0,inlineRefs:(C=e.inlineRefs)!==null&&C!==void 0?C:!0,schemaId:(U=e.schemaId)!==null&&U!==void 0?U:"$id",addUsedSchema:(b=e.addUsedSchema)!==null&&b!==void 0?b:!0,validateSchema:(x=e.validateSchema)!==null&&x!==void 0?x:!0,validateFormats:(N=e.validateFormats)!==null&&N!==void 0?N:!0,unicodeRegExp:(Y=e.unicodeRegExp)!==null&&Y!==void 0?Y:!0,int32range:(F=e.int32range)!==null&&F!==void 0?F:!0,uriResolver:zt}}class ms{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,...tP(e)};let{es5:t,lines:r}=this.opts.code;this.scope=new Fg.ValueScope({scope:{},prefixes:Yk,es5:t,lines:r}),this.logger=aP(e.logger);let n=e.validateFormats;if(e.validateFormats=!1,this.RULES=Ug.getRules(),Mg.call(this,Qk,e,"NOT SUPPORTED"),Mg.call(this,eP,e,"DEPRECATED","warn"),this._metaOpts=sP.call(this),e.formats)nP.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords)oP.call(this,e.keywords);if(typeof e.meta=="object")this.addMetaSchema(e.meta);rP.call(this),e.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:r}=this.opts,n=Zg;if(r==="id")n={...Zg},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(c,l){await o.call(this,c.$schema);let d=this._addSchema(c,l);return d.validate||s.call(this,d)}async function o(c){if(c&&!this.getSchema(c))await n.call(this,{$ref:c},!0)}async function s(c){try{return this._compileSchemaEnv(c)}catch(l){if(!(l instanceof Lg.default))throw l;return i.call(this,l),await a.call(this,l.missingSchema),s.call(this,c)}}function i({missingSchema:c,missingRef:l}){if(this.refs[c])throw Error(`AnySchema ${c} is loaded but ${l} cannot be resolved`)}async function a(c){let l=await u.call(this,c);if(!this.refs[c])await o.call(this,l.$schema);if(!this.refs[c])this.addSchema(l,c,t)}async function u(c){let l=this._loading[c];if(l)return l;try{return await(this._loading[c]=r(c))}finally{delete this._loading[c]}}}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=st.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=qg.call(this,e))=="string")e=t;if(t===void 0){let{schemaId:r}=this.opts,n=new ot.SchemaEnv({schema:{},schemaId:r});if(t=ot.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=qg.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=st.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(uP.call(this,r,t),!t)return Dr.eachItem(r,(o)=>pc.call(this,o)),this;dP.call(this,t);let n={...t,type:Ut.getJSONTypes(t.type),schemaType:Ut.getJSONTypes(t.schemaType)};return Dr.eachItem(r,n.type.length===0?(o)=>pc.call(this,o,n):(o)=>n.type.forEach((s)=>pc.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:u}=a.definition,c=s[i];if(u&&c)s[i]=Hg(c)}}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=st.normalizeId(s||r);let u=st.getSchemaRefs.call(this,e,r);if(a=new ot.SchemaEnv({schema:e,schemaId:i,meta:t,baseId:r,localRefs:u}),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 ot.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{ot.compileSchema.call(this,e)}finally{this.opts=t}}}ms.ValidationError=Wk.default;ms.MissingRefError=Lg.default;$t.default=ms;function Mg(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 qg(e){return e=st.normalizeId(e),this.schemas[e]||this.refs[e]}function rP(){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 nP(){for(let e in this.opts.formats){let t=this.opts.formats[e];if(t)this.addFormat(e,t)}}function oP(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 sP(){let e={...this.opts};for(let t of Xk)delete e[t];return e}var iP={log(){},warn(){},error(){}};function aP(e){if(e===!1)return iP;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 cP=/^[a-z_$][a-z0-9_$:-]*$/i;function uP(e,t){let{RULES:r}=this;if(Dr.eachItem(e,(n)=>{if(r.keywords[n])throw Error(`Keyword ${n} is already defined`);if(!cP.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 pc(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:u})=>u===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:Ut.getJSONTypes(t.type),schemaType:Ut.getJSONTypes(t.schemaType)}};if(t.before)lP.call(this,i,a,t.before);else i.rules.push(a);s.all[e]=a,(n=t.implements)===null||n===void 0||n.forEach((u)=>this.addKeyword(u))}function lP(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 dP(e){let{metaSchema:t}=e;if(t===void 0)return;if(e.$data&&this.opts.$data)t=Hg(t);e.validateSchema=this.compile(t,!0)}var fP={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Hg(e){return{anyOf:[e,fP]}}});var Kg=E(function(Jg){Object.defineProperty(Jg,"__esModule",{value:!0});var hP={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Jg.default=hP});var Yg=E(function(Gg){Object.defineProperty(Gg,"__esModule",{value:!0});Gg.callRef=Gg.getValidate=void 0;var _P=jn(),gs=Je(),X=L(),qr=xt(),_s=as(),Ft=V(),yP={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:n}=e,{baseId:o,schemaEnv:s,validateName:i,opts:a,self:u}=n,{root:c}=s;if((r==="#"||r==="#/")&&o===c.baseId)return d();let l=_s.resolveRef.call(u,c,o,r);if(l===void 0)throw new _P.default(n.opts.uriResolver,o,r);if(l instanceof _s.SchemaEnv)return m(l);return f(l);function d(){if(s===c)return hs(e,i,s,s.$async);let p=t.scopeValue("root",{ref:c});return hs(e,X._`${p}.validate`,c,c.$async)}function m(p){let g=Wg(e,p);hs(e,g,p,p.$async)}function f(p){let g=t.scopeValue("schema",a.code.source===!0?{ref:p,code:X.stringify(p)}:{ref:p}),_=t.name("valid"),y=e.subschema({schema:p,dataTypes:[],schemaPath:X.nil,topSchemaRef:g,errSchemaPath:r},_);e.mergeEvaluated(y),e.ok(_)}}};function Wg(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):X._`${r.scopeValue("wrapper",{ref:t})}.validate`}Gg.getValidate=Wg;function hs(e,t,r,n){let{gen:o,it:s}=e,{allErrors:i,schemaEnv:a,opts:u}=s,c=u.passContext?qr.default.this:X.nil;if(n)l();else d();function l(){if(!a.$async)throw Error("async schema referenced by sync schema");let p=o.let("valid");o.try(()=>{if(o.code(X._`await ${gs.callValidateCode(e,t,c)}`),f(t),!i)o.assign(p,!0)},(g)=>{if(o.if(X._`!(${g} instanceof ${s.ValidationError})`,()=>o.throw(g)),m(g),!i)o.assign(p,!1)}),e.ok(p)}function d(){e.result(gs.callValidateCode(e,t,c),()=>f(t),()=>m(t))}function m(p){let g=X._`${p}.errors`;o.assign(qr.default.vErrors,X._`${qr.default.vErrors} === null ? ${g} : ${qr.default.vErrors}.concat(${g})`),o.assign(qr.default.errors,X._`${qr.default.vErrors}.length`)}function f(p){var g;if(!s.opts.unevaluated)return;let _=(g=r===null||r===void 0?void 0:r.validate)===null||g===void 0?void 0:g.evaluated;if(s.props!==!0)if(_&&!_.dynamicProps){if(_.props!==void 0)s.props=Ft.mergeEvaluated.props(o,_.props,s.props)}else{let y=o.var("props",X._`${p}.evaluated.props`);s.props=Ft.mergeEvaluated.props(o,y,s.props,X.Name)}if(s.items!==!0)if(_&&!_.dynamicItems){if(_.items!==void 0)s.items=Ft.mergeEvaluated.items(o,_.items,s.items)}else{let y=o.var("items",X._`${p}.evaluated.items`);s.items=Ft.mergeEvaluated.items(o,y,s.items,X.Name)}}}Gg.callRef=hs;Gg.default=yP});var e_=E(function(Qg){Object.defineProperty(Qg,"__esModule",{value:!0});var wP=Kg(),xP=Yg(),$P=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",wP.default,xP.default];Qg.default=$P});var r_=E(function(t_){Object.defineProperty(t_,"__esModule",{value:!0});var Ht=L(),Vt=Ht.operators,ys={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}},SP={message:({keyword:e,schemaCode:t})=>Ht.str`must be ${ys[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>Ht._`{comparison: ${ys[e].okStr}, limit: ${t}}`},kP={keyword:Object.keys(ys),type:"number",schemaType:"number",$data:!0,error:SP,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data(Ht._`${r} ${ys[t].fail} ${n} || isNaN(${r})`)}};t_.default=kP});var o_=E(function(n_){Object.defineProperty(n_,"__esModule",{value:!0});var it=L(),EP={message:({schemaCode:e})=>it.str`must be multiple of ${e}`,params:({schemaCode:e})=>it._`{multipleOf: ${e}}`},TP={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:EP,code(e){let{gen:t,data:r,schemaCode:n,it:o}=e,s=o.opts.multipleOfPrecision,i=t.let("res"),a=s?it._`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:it._`${i} !== parseInt(${i})`;e.fail$data(it._`(${n} === 0 || (${i} = ${r}/${n}, ${a}))`)}};n_.default=TP});var a_=E(function(i_){Object.defineProperty(i_,"__esModule",{value:!0});function s_(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}i_.default=s_;s_.code='require("ajv/dist/runtime/ucs2length").default'});var l_=E(function(u_){Object.defineProperty(u_,"__esModule",{value:!0});var Ne=L(),c_=V(),IP=a_(),CP={message({keyword:e,schemaCode:t}){return Ne.str`must NOT have ${e==="maxLength"?"more":"fewer"} than ${t} characters`},params:({schemaCode:e})=>Ne._`{limit: ${e}}`},AP={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:CP,code(e){let{keyword:t,data:r,schemaCode:n,it:o}=e,s=t==="maxLength"?Ne.operators.GT:Ne.operators.LT,i=o.opts.unicode===!1?Ne._`${r}.length`:Ne._`${c_.useFunc(e.gen,IP.default)}(${r})`;e.fail$data(Ne._`${i} ${s} ${n}`)}};u_.default=AP});var m_=E(function(p_){Object.defineProperty(p_,"__esModule",{value:!0});var d_=Je(),f_=V(),Ke=L(),jP={message:({schemaCode:e})=>Ke.str`must match pattern "${e}"`,params:({schemaCode:e})=>Ke._`{pattern: ${e}}`},ZP={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:jP,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:u}=i.opts.code,c=u.code==="new RegExp"?Ke._`new RegExp`:f_.useFunc(t,u),l=t.let("valid");t.try(()=>t.assign(l,Ke._`${c}(${s}, ${a}).test(${r})`),()=>t.assign(l,!1)),e.fail$data(Ke._`!${l}`)}else{let u=d_.usePattern(e,o);e.fail$data(Ke._`!${u}.test(${r})`)}}};p_.default=ZP});var g_=E(function(h_){Object.defineProperty(h_,"__esModule",{value:!0});var at=L(),MP={message({keyword:e,schemaCode:t}){return at.str`must NOT have ${e==="maxProperties"?"more":"fewer"} than ${t} properties`},params:({schemaCode:e})=>at._`{limit: ${e}}`},qP={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:MP,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxProperties"?at.operators.GT:at.operators.LT;e.fail$data(at._`Object.keys(${r}).length ${o} ${n}`)}};h_.default=qP});var v_=E(function(y_){Object.defineProperty(y_,"__esModule",{value:!0});var ct=Je(),ut=L(),__=V(),UP={message:({params:{missingProperty:e}})=>ut.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>ut._`{missingProperty: ${e}}`},FP={keyword:"required",type:"object",schemaType:"array",$data:!0,error:UP,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 u=r.length>=a.loopRequired;if(i.allErrors)c();else l();if(a.strictRequired){let f=e.parentSchema.properties,{definedProperties:p}=e.it;for(let g of r)if((f===null||f===void 0?void 0:f[g])===void 0&&!p.has(g)){let _=i.schemaEnv.baseId+i.errSchemaPath,y=`required property "${g}" is not defined at "${_}" (strictRequired)`;__.checkStrictMode(i,y,i.opts.strictRequired)}}function c(){if(u||s)e.block$data(ut.nil,d);else for(let f of r)ct.checkReportMissingProp(e,f)}function l(){let f=t.let("missing");if(u||s){let p=t.let("valid",!0);e.block$data(p,()=>m(f,p)),e.ok(p)}else t.if(ct.checkMissingProp(e,r,f)),ct.reportMissingProp(e,f),t.else()}function d(){t.forOf("prop",n,(f)=>{e.setParams({missingProperty:f}),t.if(ct.noPropertyInData(t,o,f,a.ownProperties),()=>e.error())})}function m(f,p){e.setParams({missingProperty:f}),t.forOf(f,n,()=>{t.assign(p,ct.propertyInData(t,o,f,a.ownProperties)),t.if(ut.not(p),()=>{e.error(),t.break()})},ut.nil)}}};y_.default=FP});var w_=E(function(b_){Object.defineProperty(b_,"__esModule",{value:!0});var lt=L(),HP={message({keyword:e,schemaCode:t}){return lt.str`must NOT have ${e==="maxItems"?"more":"fewer"} than ${t} items`},params:({schemaCode:e})=>lt._`{limit: ${e}}`},BP={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:HP,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxItems"?lt.operators.GT:lt.operators.LT;e.fail$data(lt._`${r}.length ${o} ${n}`)}};b_.default=BP});var vs=E(function($_){Object.defineProperty($_,"__esModule",{value:!0});var x_=Ga();x_.code='require("ajv/dist/runtime/equal").default';$_.default=x_});var k_=E(function(S_){Object.defineProperty(S_,"__esModule",{value:!0});var Lr=Cn(),H=L(),z_=V(),WP=vs(),GP={message:({params:{i:e,j:t}})=>H.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>H._`{i: ${e}, j: ${t}}`},XP={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:GP,code(e){let{gen:t,data:r,$data:n,schema:o,parentSchema:s,schemaCode:i,it:a}=e;if(!n&&!o)return;let u=t.let("valid"),c=s.items?Lr.getSchemaTypes(s.items):[];e.block$data(u,l,H._`${i} === false`),e.ok(u);function l(){let p=t.let("i",H._`${r}.length`),g=t.let("j");e.setParams({i:p,j:g}),t.assign(u,!0),t.if(H._`${p} > 1`,()=>(d()?m:f)(p,g))}function d(){return c.length>0&&!c.some((p)=>p==="object"||p==="array")}function m(p,g){let _=t.name("item"),y=Lr.checkDataTypes(c,_,a.opts.strictNumbers,Lr.DataType.Wrong),k=t.const("indices",H._`{}`);t.for(H._`;${p}--;`,()=>{if(t.let(_,H._`${r}[${p}]`),t.if(y,H._`continue`),c.length>1)t.if(H._`typeof ${_} == "string"`,H._`${_} += "_"`);t.if(H._`typeof ${k}[${_}] == "number"`,()=>{t.assign(g,H._`${k}[${_}]`),e.error(),t.assign(u,!1).break()}).code(H._`${k}[${_}] = ${p}`)})}function f(p,g){let _=z_.useFunc(t,WP.default),y=t.name("outer");t.label(y).for(H._`;${p}--;`,()=>t.for(H._`${g} = ${p}; ${g}--;`,()=>t.if(H._`${_}(${r}[${p}], ${r}[${g}])`,()=>{e.error(),t.assign(u,!1).break(y)})))}}};S_.default=XP});var T_=E(function(E_){Object.defineProperty(E_,"__esModule",{value:!0});var Ur=L(),P_=V(),QP=vs(),eE={message:"must be equal to constant",params:({schemaCode:e})=>Ur._`{allowedValue: ${e}}`},tE={keyword:"const",$data:!0,error:eE,code(e){let{gen:t,data:r,$data:n,schemaCode:o,schema:s}=e;if(n||s&&typeof s=="object")e.fail$data(Ur._`!${P_.useFunc(t,QP.default)}(${r}, ${o})`);else e.fail(Ur._`${s} !== ${r}`)}};E_.default=tE});var I_=E(function(O_){Object.defineProperty(O_,"__esModule",{value:!0});var dt=L(),R_=V(),nE=vs(),oE={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>dt._`{allowedValues: ${e}}`},sE={keyword:"enum",schemaType:"array",$data:!0,error:oE,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,u,c=()=>u!==null&&u!==void 0?u:u=R_.useFunc(t,nE.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 f=t.const("vSchema",s);l=dt.or(...o.map((p,g)=>m(f,g)))}e.pass(l);function d(){t.assign(l,!1),t.forOf("v",s,(f)=>t.if(dt._`${c()}(${r}, ${f})`,()=>t.assign(l,!0).break()))}function m(f,p){let g=o[p];return typeof g==="object"&&g!==null?dt._`${c()}(${r}, ${f}[${p}])`:dt._`${r} === ${g}`}}};O_.default=sE});var A_=E(function(C_){Object.defineProperty(C_,"__esModule",{value:!0});var aE=r_(),cE=o_(),uE=l_(),lE=m_(),dE=g_(),fE=v_(),pE=w_(),mE=k_(),hE=T_(),gE=I_(),_E=[aE.default,cE.default,uE.default,lE.default,dE.default,fE.default,pE.default,mE.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},hE.default,gE.default];C_.default=_E});var mc=E(function(j_){Object.defineProperty(j_,"__esModule",{value:!0});j_.validateAdditionalItems=void 0;var je=L(),Fr=V(),vE={message:({params:{len:e}})=>je.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>je._`{limit: ${e}}`},bE={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:vE,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){Fr.checkStrictMode(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}N_(e,n)}};function N_(e,t){let{gen:r,schema:n,data:o,keyword:s,it:i}=e;i.items=!0;let a=r.const("len",je._`${o}.length`);if(n===!1)e.setParams({len:t.length}),e.pass(je._`${a} <= ${t.length}`);else if(typeof n=="object"&&!Fr.alwaysValidSchema(i,n)){let c=r.var("valid",je._`${a} <= ${t.length}`);r.if(je.not(c),()=>u(c)),e.ok(c)}function u(c){r.forRange("i",t.length,a,(l)=>{if(e.subschema({keyword:s,dataProp:l,dataPropType:Fr.Type.Num},c),!i.allErrors)r.if(je.not(c),()=>r.break())})}}j_.validateAdditionalItems=N_;j_.default=bE});var hc=E(function(q_){Object.defineProperty(q_,"__esModule",{value:!0});q_.validateTuple=void 0;var bs=L(),Bt=V(),D_=Je(),xE={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return M_(e,"additionalItems",t);if(r.items=!0,Bt.alwaysValidSchema(r,t))return;e.ok(D_.validateArray(e))}};function M_(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=Bt.mergeEvaluated.items(n,r.length,a.items);let u=n.name("valid"),c=n.const("len",bs._`${s}.length`);r.forEach((d,m)=>{if(Bt.alwaysValidSchema(a,d))return;n.if(bs._`${c} > ${m}`,()=>e.subschema({keyword:i,schemaProp:m,dataProp:m},u)),e.ok(u)});function l(d){let{opts:m,errSchemaPath:f}=a,p=r.length,g=p===d.minItems&&(p===d.maxItems||d[t]===!1);if(m.strictTuples&&!g){let _=`"${i}" is ${p}-tuple, but minItems or maxItems/${t} are not specified or different at path "${f}"`;Bt.checkStrictMode(a,_,m.strictTuples)}}}q_.validateTuple=M_;q_.default=xE});var V_=E(function(F_){Object.defineProperty(F_,"__esModule",{value:!0});var U_=hc(),zE={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(e)=>U_.validateTuple(e,"items")};F_.default=zE});var W_=E(function(K_){Object.defineProperty(K_,"__esModule",{value:!0});var ws=L(),H_=V(),B_=Je(),J_=mc(),kE={message:({params:{len:e}})=>ws.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>ws._`{limit: ${e}}`},PE={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:kE,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:o}=r;if(n.items=!0,H_.alwaysValidSchema(n,t))return;if(o)J_.validateAdditionalItems(e,o);else e.ok(B_.validateArray(e))}};K_.default=PE});var X_=E(function(G_){Object.defineProperty(G_,"__esModule",{value:!0});var ce=L(),Jt=V(),TE={message:({params:{min:e,max:t}})=>t===void 0?ce.str`must contain at least ${e} valid item(s)`:ce.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?ce._`{minContains: ${e}}`:ce._`{minContains: ${e}, maxContains: ${t}}`},RE={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:TE,code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:s}=e,i,a,{minContains:u,maxContains:c}=n;if(s.opts.next)i=u===void 0?1:u,a=c;else i=1;let l=t.const("len",ce._`${o}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){Jt.checkStrictMode(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){Jt.checkStrictMode(s,'"minContains" > "maxContains" is always invalid'),e.fail();return}if(Jt.alwaysValidSchema(s,r)){let g=ce._`${l} >= ${i}`;if(a!==void 0)g=ce._`${g} && ${l} <= ${a}`;e.pass(g);return}s.items=!0;let d=t.name("valid");if(a===void 0&&i===1)f(d,()=>t.if(d,()=>t.break()));else if(i===0){if(t.let(d,!0),a!==void 0)t.if(ce._`${o}.length > 0`,m)}else t.let(d,!1),m();e.result(d,()=>e.reset());function m(){let g=t.name("_valid"),_=t.let("count",0);f(g,()=>t.if(g,()=>p(_)))}function f(g,_){t.forRange("i",0,l,(y)=>{e.subschema({keyword:"contains",dataProp:y,dataPropType:Jt.Type.Num,compositeRule:!0},g),_()})}function p(g){if(t.code(ce._`${g}++`),a===void 0)t.if(ce._`${g} >= ${i}`,()=>t.assign(d,!0).break());else if(t.if(ce._`${g} > ${a}`,()=>t.assign(d,!1).break()),i===1)t.assign(d,!0);else t.if(ce._`${g} >= ${i}`,()=>t.assign(d,!0))}}};G_.default=RE});var oy=E(function(ty){Object.defineProperty(ty,"__esModule",{value:!0});ty.validateSchemaDeps=ty.validatePropertyDeps=ty.error=void 0;var Vr=L(),Y_=V(),ft=Je();ty.error={message:({params:{property:e,depsCount:t,deps:r}})=>Vr.str`must have ${t===1?"property":"properties"} ${r} when property ${e} is present`,params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>Vr._`{property: ${e},
6
+ || ${i} === "boolean" || ${o} === null`).assign(a,z._`[${o}]`)}}}function sz({gen:e,parentData:t,parentDataProperty:r},n){e.if(z._`${t} !== undefined`,()=>e.assign(z._`${t}[${r}]`,n))}function Ba(e,t,r,n=Ir.Correct){let o=n===Ir.Correct?z.operators.EQ:z.operators.NEQ,s;switch(e){case"null":return z._`${t} ${o} null`;case"array":s=z._`Array.isArray(${t})`;break;case"object":s=z._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":s=i(z._`!(${t} % 1) && !isNaN(${t})`);break;case"number":s=i();break;default:return z._`typeof ${t} ${o} ${e}`}return n===Ir.Correct?s:z.not(s);function i(a=z.nil){return z.and(z._`typeof ${t} == "number"`,a,r?z._`isFinite(${t})`:z.nil)}}sh.checkDataType=Ba;function Ja(e,t,r,n){if(e.length===1)return Ba(e[0],t,r,n);let o,s=Qo.toHash(e);if(s.array&&s.object){let i=z._`typeof ${t} != "object"`;o=s.null?i:z._`!${t} || ${i}`,delete s.null,delete s.array,delete s.object}else o=z.nil;if(s.number)delete s.integer;for(let i in s)o=z.and(o,Ba(i,t,r,n));return o}sh.checkDataTypes=Ja;var iz={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?z._`{type: ${e}}`:z._`{type: ${t}}`};function Ka(e){let t=az(e);rh.reportError(t,iz)}sh.reportTypeError=Ka;function az(e){let{gen:t,data:r,schema:n}=e,o=Qo.schemaRefOrVal(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:e}}});var dh=E(function(uh){Object.defineProperty(uh,"__esModule",{value:!0});uh.assignDefaults=void 0;var Be=L(),ch=V();function mz(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let o in r)ah(e,o,r[o].default);else if(t==="array"&&Array.isArray(n))n.forEach((o,s)=>ah(e,s,o.default))}uh.assignDefaults=mz;function ah(e,t,r){let{gen:n,compositeRule:o,data:s,opts:i}=e;if(r===void 0)return;let a=Be._`${s}${Be.getProperty(t)}`;if(o){ch.checkStrictMode(e,`default is ignored for: ${a}`);return}let u=Be._`${a} === undefined`;if(i.useDefaults==="empty")u=Be._`${u} || ${a} === null || ${a} === ""`;n.if(u,Be._`${a} = ${Be.stringify(r)}`)}});var Je=E(function(hh){Object.defineProperty(hh,"__esModule",{value:!0});hh.validateUnion=hh.validateArray=hh.usePattern=hh.callValidateCode=hh.schemaProperties=hh.allSchemaProperties=hh.noPropertyInData=hh.propertyInData=hh.isOwnProperty=hh.hasPropFunc=hh.reportMissingProp=hh.checkMissingProp=hh.checkReportMissingProp=void 0;var D=L(),Cr=V(),Mt=xt(),fh=V();function hz(e,t){let{gen:r,data:n,it:o}=e;r.if(Ga(r,n,t,o.opts.ownProperties),()=>{e.setParams({missingProperty:D._`${t}`},!0),e.error()})}hh.checkReportMissingProp=hz;function gz({gen:e,data:t,it:{opts:r}},n,o){return D.or(...n.map((s)=>D.and(Ga(e,t,s,r.ownProperties),D._`${o} = ${s}`)))}hh.checkMissingProp=gz;function _z(e,t){e.setParams({missingProperty:t},!0),e.error()}hh.reportMissingProp=_z;function ph(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:D._`Object.prototype.hasOwnProperty`})}hh.hasPropFunc=ph;function Wa(e,t,r){return D._`${ph(e)}.call(${t}, ${r})`}hh.isOwnProperty=Wa;function yz(e,t,r,n){let o=D._`${t}${D.getProperty(r)} !== undefined`;return n?D._`${o} && ${Wa(e,t,r)}`:o}hh.propertyInData=yz;function Ga(e,t,r,n){let o=D._`${t}${D.getProperty(r)} === undefined`;return n?D.or(o,D.not(Wa(e,t,r))):o}hh.noPropertyInData=Ga;function mh(e){return e?Object.keys(e).filter((t)=>t!=="__proto__"):[]}hh.allSchemaProperties=mh;function vz(e,t){return mh(t).filter((r)=>!Cr.alwaysValidSchema(e,t[r]))}hh.schemaProperties=vz;function bz({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:s},it:i},a,u,c){let l=c?D._`${e}, ${t}, ${n}${o}`:t,d=[[Mt.default.instancePath,D.strConcat(Mt.default.instancePath,s)],[Mt.default.parentData,i.parentData],[Mt.default.parentDataProperty,i.parentDataProperty],[Mt.default.rootData,Mt.default.rootData]];if(i.opts.dynamicRef)d.push([Mt.default.dynamicAnchors,Mt.default.dynamicAnchors]);let m=D._`${l}, ${r.object(...d)}`;return u!==D.nil?D._`${a}.call(${u}, ${m})`:D._`${a}(${m})`}hh.callValidateCode=bz;var wz=D._`new RegExp`;function xz({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:D._`${o.code==="new RegExp"?wz:fh.useFunc(e,o)}(${r}, ${n})`})}hh.usePattern=xz;function $z(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 u=t.const("len",D._`${r}.length`);t.forRange("i",0,u,(c)=>{e.subschema({keyword:n,dataProp:c,dataPropType:Cr.Type.Num},s),t.if(D.not(s),a)})}}hh.validateArray=$z;function zz(e){let{gen:t,schema:r,keyword:n,it:o}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(r.some((u)=>Cr.alwaysValidSchema(o,u))&&!o.opts.unevaluated)return;let i=t.let("valid",!1),a=t.name("_valid");t.block(()=>r.forEach((u,c)=>{let l=e.subschema({keyword:n,schemaProp:c,compositeRule:!0},a);if(t.assign(i,D._`${i} || ${a}`),!e.mergeValidEvaluated(l,a))t.if(D.not(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}hh.validateUnion=zz});var $h=E(function(wh){Object.defineProperty(wh,"__esModule",{value:!0});wh.validateKeywordUsage=wh.validSchemaType=wh.funcKeywordCode=wh.macroKeywordCode=void 0;var W=L(),lr=xt(),yh=Je(),vh=In();function Zz(e,t){let{gen:r,keyword:n,schema:o,parentSchema:s,it:i}=e,a=t.macro.call(i.self,o,s,i),u=bh(r,n,a);if(i.opts.validateSchema!==!1)i.self.validateSchema(a,!0);let c=r.name("valid");e.subschema({schema:a,schemaPath:W.nil,errSchemaPath:`${i.errSchemaPath}/${n}`,topSchemaRef:u,compositeRule:!0},c),e.pass(c,()=>e.error(!0))}wh.macroKeywordCode=Zz;function Dz(e,t){var r;let{gen:n,keyword:o,schema:s,parentSchema:i,$data:a,it:u}=e;qz(u,t);let c=!a&&t.compile?t.compile.call(u.self,s,i,u):t.validate,l=bh(n,o,c),d=n.let("valid");e.block$data(d,m),e.ok((r=t.valid)!==null&&r!==void 0?r:d);function m(){if(t.errors===!1){if(g(),t.modifying)_h(e);_(()=>e.error())}else{let y=t.async?f():p();if(t.modifying)_h(e);_(()=>Mz(e,y))}}function f(){let y=n.let("ruleErrs",null);return n.try(()=>g(W._`await `),(k)=>n.assign(d,!1).if(W._`${k} instanceof ${u.ValidationError}`,()=>n.assign(y,W._`${k}.errors`),()=>n.throw(k))),y}function p(){let y=W._`${l}.errors`;return n.assign(y,null),g(W.nil),y}function g(y=t.async?W._`await `:W.nil){let k=u.opts.passContext?lr.default.this:lr.default.self,C=!(("compile"in t)&&!a||t.schema===!1);n.assign(d,W._`${y}${yh.callValidateCode(e,l,k,C)}`,t.modifying)}function _(y){var k;n.if(W.not((k=t.valid)!==null&&k!==void 0?k:d),y)}}wh.funcKeywordCode=Dz;function _h(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,W._`${n.parentData}[${n.parentDataProperty}]`))}function Mz(e,t){let{gen:r}=e;r.if(W._`Array.isArray(${t})`,()=>{r.assign(lr.default.vErrors,W._`${lr.default.vErrors} === null ? ${t} : ${lr.default.vErrors}.concat(${t})`).assign(lr.default.errors,W._`${lr.default.vErrors}.length`),vh.extendErrors(e)},()=>e.error())}function qz({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}function bh(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:W.stringify(r)})}function Lz(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")}wh.validSchemaType=Lz;function Uz({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 u=`keyword "${s}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(u);else throw Error(u)}}}wh.validateKeywordUsage=Uz});var kh=E(function(zh){Object.defineProperty(zh,"__esModule",{value:!0});zh.extendSubschemaMode=zh.extendSubschemaData=zh.getSubschema=void 0;var ge=L(),es=V();function Bz(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:ge._`${e.schemaPath}${ge.getProperty(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:ge._`${e.schemaPath}${ge.getProperty(t)}${ge.getProperty(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${es.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')}zh.getSubschema=Bz;function Jz(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:c,dataPathArr:l,opts:d}=t,m=a.let("data",ge._`${t.data}${ge.getProperty(r)}`,!0);u(m),e.errorPath=ge.str`${c}${es.getErrorPath(r,n,d.jsPropertySyntax)}`,e.parentDataProperty=ge._`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(o!==void 0){let c=o instanceof ge.Name?o:a.let("data",o,!0);if(u(c),i!==void 0)e.propertyName=i}if(s)e.dataTypes=s;function u(c){e.data=c,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,c]}}zh.extendSubschemaData=Jz;function Kz(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}zh.extendSubschemaMode=Kz});var Xa=E(function(SZ,Ph){Ph.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 Th=E(function(kZ,Eh){var qt=Eh.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(){};ts(t,n,o,e,"",e)};qt.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};qt.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};qt.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};qt.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 ts(e,t,r,n,o,s,i,a,u,c){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,o,s,i,a,u,c);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in qt.arrayKeywords)for(var m=0;m<d.length;m++)ts(e,t,r,d[m],o+"/"+l+"/"+m,s,o,l,n,m)}else if(l in qt.propsKeywords){if(d&&typeof d=="object")for(var f in d)ts(e,t,r,d[f],o+"/"+l+"/"+Xz(f),s,o,l,n,f)}else if(l in qt.keywords||e.allKeys&&!(l in qt.skipKeywords))ts(e,t,r,d,o+"/"+l,s,o,l,n)}r(n,o,s,i,a,u,c)}}function Xz(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var An=E(function(Ah){Object.defineProperty(Ah,"__esModule",{value:!0});Ah.getSchemaRefs=Ah.resolveUrl=Ah.normalizeId=Ah._getFullPath=Ah.getFullPath=Ah.inlineRef=void 0;var Rh=V(),Yz=Xa(),Qz=Th(),eS=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function tS(e,t=!0){if(typeof e=="boolean")return!0;if(t===!0)return!Ya(e);if(!t)return!1;return Oh(e)<=t}Ah.inlineRef=tS;var rS=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Ya(e){for(let t in e){if(rS.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(Ya))return!0;if(typeof r=="object"&&Ya(r))return!0}return!1}function Oh(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,eS.has(r))continue;if(typeof e[r]=="object")Rh.eachItem(e[r],(n)=>t+=Oh(n));if(t===1/0)return 1/0}return t}function Ih(e,t="",r){if(r!==!1)t=Ar(t);let n=e.parse(t);return Ch(e,n)}Ah.getFullPath=Ih;function Ch(e,t){return e.serialize(t).split("#")[0]+"#"}Ah._getFullPath=Ch;var nS=/#\/?$/;function Ar(e){return e?e.replace(nS,""):""}Ah.normalizeId=Ar;function oS(e,t,r){return r=Ar(r),e.resolve(t,r)}Ah.resolveUrl=oS;var sS=/^[a-z_][-a-z0-9._]*$/i;function iS(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=Ar(e[r]||t),s={"":o},i=Ih(n,o,!1),a={},u=new Set;return Qz(e,{allKeys:!0},(d,m,f,p)=>{if(p===void 0)return;let g=i+m,_=s[p];if(typeof d[r]=="string")_=y.call(this,d[r]);k.call(this,d.$anchor),k.call(this,d.$dynamicAnchor),s[m]=_;function y(C){let U=this.opts.uriResolver.resolve;if(C=Ar(_?U(_,C):C),u.has(C))throw l(C);u.add(C);let b=this.refs[C];if(typeof b=="string")b=this.refs[b];if(typeof b=="object")c(d,b.schema,C);else if(C!==Ar(g))if(C[0]==="#")c(d,a[C],C),a[C]=d;else this.refs[C]=g;return C}function k(C){if(typeof C=="string"){if(!sS.test(C))throw Error(`invalid anchor "${C}"`);y.call(this,`#${C}`)}}}),a;function c(d,m,f){if(m!==void 0&&!Yz(d,m))throw l(f)}function l(d){return Error(`reference "${d}" resolves to more than one schema`)}}Ah.getSchemaRefs=iS});var Nn=E(function(Gh){Object.defineProperty(Gh,"__esModule",{value:!0});Gh.getData=Gh.KeywordCxt=Gh.validateFunctionCode=void 0;var ns=Jm(),rs=Cn(),jr=Ha(),Lt=Cn(),Mh=dh(),nt=$h(),Nr=kh(),w=L(),M=xt(),qh=An(),be=V(),rt=In();function fS(e){if(Fh(e)){if(Vh(e),Uh(e)){hS(e);return}}Lh(e,()=>ns.topBoolOrEmptySchema(e))}Gh.validateFunctionCode=fS;function Lh({gen:e,validateName:t,schema:r,schemaEnv:n,opts:o},s){if(o.code.es5)e.func(t,w._`${M.default.data}, ${M.default.valCxt}`,n.$async,()=>{e.code(w._`"use strict"; ${jh(r,o)}`),mS(e,o),e.code(s)});else e.func(t,w._`${M.default.data}, ${pS(o)}`,n.$async,()=>e.code(jh(r,o)).code(s))}function pS(e){return w._`{${M.default.instancePath}="", ${M.default.parentData}, ${M.default.parentDataProperty}, ${M.default.rootData}=${M.default.data}${e.dynamicRef?w._`, ${M.default.dynamicAnchors}={}`:w.nil}}={}`}function mS(e,t){e.if(M.default.valCxt,()=>{if(e.var(M.default.instancePath,w._`${M.default.valCxt}.${M.default.instancePath}`),e.var(M.default.parentData,w._`${M.default.valCxt}.${M.default.parentData}`),e.var(M.default.parentDataProperty,w._`${M.default.valCxt}.${M.default.parentDataProperty}`),e.var(M.default.rootData,w._`${M.default.valCxt}.${M.default.rootData}`),t.dynamicRef)e.var(M.default.dynamicAnchors,w._`${M.default.valCxt}.${M.default.dynamicAnchors}`)},()=>{if(e.var(M.default.instancePath,w._`""`),e.var(M.default.parentData,w._`undefined`),e.var(M.default.parentDataProperty,w._`undefined`),e.var(M.default.rootData,M.default.data),t.dynamicRef)e.var(M.default.dynamicAnchors,w._`{}`)})}function hS(e){let{schema:t,opts:r,gen:n}=e;Lh(e,()=>{if(r.$comment&&t.$comment)Bh(e);if(bS(e),n.let(M.default.vErrors,null),n.let(M.default.errors,0),r.unevaluated)gS(e);Hh(e),$S(e)});return}function gS(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",w._`${r}.evaluated`),t.if(w._`${e.evaluated}.dynamicProps`,()=>t.assign(w._`${e.evaluated}.props`,w._`undefined`)),t.if(w._`${e.evaluated}.dynamicItems`,()=>t.assign(w._`${e.evaluated}.items`,w._`undefined`))}function jh(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?w._`/*# sourceURL=${r} */`:w.nil}function _S(e,t){if(Fh(e)){if(Vh(e),Uh(e)){yS(e,t);return}}ns.boolOrEmptySchema(e,t)}function Uh({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 Fh(e){return typeof e.schema!="boolean"}function yS(e,t){let{schema:r,gen:n,opts:o}=e;if(o.$comment&&r.$comment)Bh(e);wS(e),xS(e);let s=n.const("_errs",M.default.errors);Hh(e,s),n.var(t,w._`${s} === ${M.default.errors}`)}function Vh(e){be.checkUnknownRules(e),vS(e)}function Hh(e,t){if(e.opts.jtd)return Zh(e,[],!1,t);let r=rs.getSchemaTypes(e.schema),n=rs.coerceAndCheckDataType(e,r);Zh(e,r,!n,t)}function vS(e){let{schema:t,errSchemaPath:r,opts:n,self:o}=e;if(t.$ref&&n.ignoreKeywordsWithRef&&be.schemaHasRulesButRef(t,o.RULES))o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function bS(e){let{schema:t,opts:r}=e;if(t.default!==void 0&&r.useDefaults&&r.strictSchema)be.checkStrictMode(e,"default is ignored in the schema root")}function wS(e){let t=e.schema[e.opts.schemaId];if(t)e.baseId=qh.resolveUrl(e.opts.uriResolver,e.baseId,t)}function xS(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}function Bh({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:o}){let s=r.$comment;if(o.$comment===!0)e.code(w._`${M.default.self}.logger.log(${s})`);else if(typeof o.$comment=="function"){let i=w.str`${n}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code(w._`${M.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function $S(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:o,opts:s}=e;if(r.$async)t.if(w._`${M.default.errors} === 0`,()=>t.return(M.default.data),()=>t.throw(w._`new ${o}(${M.default.vErrors})`));else{if(t.assign(w._`${n}.errors`,M.default.vErrors),s.unevaluated)zS(e);t.return(w._`${M.default.errors} === 0`)}}function zS({gen:e,evaluated:t,props:r,items:n}){if(r instanceof w.Name)e.assign(w._`${t}.props`,r);if(n instanceof w.Name)e.assign(w._`${t}.items`,n)}function Zh(e,t,r,n){let{gen:o,schema:s,data:i,allErrors:a,opts:u,self:c}=e,{RULES:l}=c;if(s.$ref&&(u.ignoreKeywordsWithRef||!be.schemaHasRulesButRef(s,l))){o.block(()=>Kh(e,"$ref",l.all.$ref.definition));return}if(!u.jtd)SS(e,t);o.block(()=>{for(let m of l.rules)d(m);d(l.post)});function d(m){if(!jr.shouldUseGroup(s,m))return;if(m.type){if(o.if(Lt.checkDataType(m.type,i,u.strictNumbers)),Dh(e,m),t.length===1&&t[0]===m.type&&r)o.else(),Lt.reportTypeError(e);o.endIf()}else Dh(e,m);if(!a)o.if(w._`${M.default.errors} === ${n||0}`)}}function Dh(e,t){let{gen:r,schema:n,opts:{useDefaults:o}}=e;if(o)Mh.assignDefaults(e,t.type);r.block(()=>{for(let s of t.rules)if(jr.shouldUseRule(n,s))Kh(e,s.keyword,s.definition,t.type)})}function SS(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;if(kS(e,t),!e.opts.allowUnionTypes)PS(e,t);ES(e,e.dataTypes)}function kS(e,t){if(!t.length)return;if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach((r)=>{if(!Jh(e.dataTypes,r))Qa(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),RS(e,t)}function PS(e,t){if(t.length>1&&!(t.length===2&&t.includes("null")))Qa(e,"use allowUnionTypes to allow union type keyword")}function ES(e,t){let r=e.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&jr.shouldUseRule(e.schema,o)){let{type:s}=o.definition;if(s.length&&!s.some((i)=>TS(t,i)))Qa(e,`missing type "${s.join(",")}" for keyword "${n}"`)}}}function TS(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function Jh(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function RS(e,t){let r=[];for(let n of e.dataTypes)if(Jh(t,n))r.push(n);else if(t.includes("integer")&&n==="number")r.push("integer");e.dataTypes=r}function Qa(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,be.checkStrictMode(e,t,e.opts.strictTypes)}class ec{constructor(e,t,r){if(nt.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=be.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",Wh(this.$data,e));else if(this.schemaCode=this.schemaValue,!nt.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(w.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(w.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(w._`${t} !== undefined && (${w.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?rt.reportExtraError:rt.reportError)(this,this.def.error,t)}$dataError(){rt.reportError(this,this.def.$dataError||rt.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');rt.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=w.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=w.nil,t=w.nil){if(!this.$data)return;let{gen:r,schemaCode:n,schemaType:o,def:s}=this;if(r.if(w.or(w._`${n} === undefined`,t)),e!==w.nil)r.assign(e,!0);if(o.length||s.validateSchema){if(r.elseIf(this.invalid$data()),this.$dataError(),e!==w.nil)r.assign(e,!1)}r.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:r,def:n,it:o}=this;return w.or(s(),i());function s(){if(r.length){if(!(t instanceof w.Name))throw Error("ajv implementation error");let a=Array.isArray(r)?r:[r];return w._`${Lt.checkDataTypes(a,t,o.opts.strictNumbers,Lt.DataType.Wrong)}`}return w.nil}function i(){if(n.validateSchema){let a=e.scopeValue("validate$data",{ref:n.validateSchema});return w._`!${a}(${t})`}return w.nil}}subschema(e,t){let r=Nr.getSubschema(this.it,e);Nr.extendSubschemaData(r,this.it,e),Nr.extendSubschemaMode(r,e);let n={...this.it,...r,items:void 0,props:void 0};return _S(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=be.mergeEvaluated.props(n,e.props,r.props,t);if(r.items!==!0&&e.items!==void 0)r.items=be.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,w.Name)),!0}}Gh.KeywordCxt=ec;function Kh(e,t,r,n){let o=new ec(e,r,t);if("code"in r)r.code(o,n);else if(o.$data&&r.validate)nt.funcKeywordCode(o,r);else if("macro"in r)nt.macroKeywordCode(o,r);else if(r.compile||r.validate)nt.funcKeywordCode(o,r)}var OS=/^\/(?:[^~]|~0|~1)*$/,IS=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Wh(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let o,s;if(e==="")return M.default.rootData;if(e[0]==="/"){if(!OS.test(e))throw Error(`Invalid JSON-pointer: ${e}`);o=e,s=M.default.rootData}else{let c=IS.exec(e);if(!c)throw Error(`Invalid JSON-pointer: ${e}`);let l=+c[1];if(o=c[2],o==="#"){if(l>=t)throw Error(u("property/index",l));return n[t-l]}if(l>t)throw Error(u("data",l));if(s=r[t-l],!o)return s}let i=s,a=o.split("/");for(let c of a)if(c)s=w._`${s}${w.getProperty(be.unescapeJsonPointer(c))}`,i=w._`${i} && ${s}`;return i;function u(c,l){return`Cannot access ${c} ${l} levels up, current level is ${t}`}}Gh.getData=Wh});var os=E(function(Qh){Object.defineProperty(Qh,"__esModule",{value:!0});class Yh extends Error{constructor(e){super("validation failed");this.errors=e,this.ajv=this.validation=!0}}Qh.default=Yh});var jn=E(function(tg){Object.defineProperty(tg,"__esModule",{value:!0});var Zr=An();class eg extends Error{constructor(e,t,r,n){super(n||`can't resolve reference ${r} from id ${t}`);this.missingRef=Zr.resolveUrl(e,t,r),this.missingSchema=Zr.normalizeId(Zr.getFullPath(e,this.missingRef))}}tg.default=eg});var as=E(function(og){Object.defineProperty(og,"__esModule",{value:!0});og.resolveSchema=og.getCompilingSchema=og.resolveRef=og.compileSchema=og.SchemaEnv=void 0;var de=L(),ZS=os(),dr=xt(),fe=An(),ss=V(),rg=Nn();class Zn{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:fe.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={}}}og.SchemaEnv=Zn;function rc(e){let t=ng.call(this,e);if(t)return t;let r=fe.getFullPath(this.opts.uriResolver,e.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:s}=this.opts,i=new de.CodeGen(this.scope,{es5:n,lines:o,ownProperties:s}),a;if(e.$async)a=i.scopeValue("Error",{ref:ZS.default,code:de._`require("ajv/dist/runtime/validation_error").default`});let u=i.scopeName("validate");e.validateName=u;let c={gen:i,allErrors:this.opts.allErrors,data:dr.default.data,parentData:dr.default.parentData,parentDataProperty:dr.default.parentDataProperty,dataNames:[dr.default.data],dataPathArr:[de.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:de.stringify(e.schema)}:{ref:e.schema}),validateName:u,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:de.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:de._`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),rg.validateFunctionCode(c),i.optimize(this.opts.code.optimize);let d=i.toString();if(l=`${i.scopeRefs(dr.default.scope)}return ${d}`,this.opts.code.process)l=this.opts.code.process(l,e);let f=Function(`${dr.default.self}`,`${dr.default.scope}`,l)(this,this.scope.get());if(this.scope.value(u,{ref:f}),f.errors=null,f.schema=e.schema,f.schemaEnv=e,e.$async)f.$async=!0;if(this.opts.code.source===!0)f.source={validateName:u,validateCode:d,scopeValues:i._values};if(this.opts.unevaluated){let{props:p,items:g}=c;if(f.evaluated={props:p instanceof de.Name?void 0:p,items:g instanceof de.Name?void 0:g,dynamicProps:p instanceof de.Name,dynamicItems:g instanceof de.Name},f.source)f.source.evaluated=de.stringify(f.evaluated)}return e.validate=f,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)}}og.compileSchema=rc;function DS(e,t,r){var n;r=fe.resolveUrl(this.opts.uriResolver,t,r);let o=e.refs[r];if(o)return o;let s=LS.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 Zn({schema:i,schemaId:a,root:e,baseId:t})}if(s===void 0)return;return e.refs[r]=MS.call(this,s)}og.resolveRef=DS;function MS(e){if(fe.inlineRef(e.schema,this.opts.inlineRefs))return e.schema;return e.validate?e:rc.call(this,e)}function ng(e){for(let t of this._compilations)if(qS(t,e))return t}og.getCompilingSchema=ng;function qS(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function LS(e,t){let r;while(typeof(r=this.refs[t])=="string")t=r;return r||this.schemas[t]||is.call(this,e,t)}function is(e,t){let r=this.opts.uriResolver.parse(t),n=fe._getFullPath(this.opts.uriResolver,r),o=fe.getFullPath(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===o)return tc.call(this,r,e);let s=fe.normalizeId(n),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=is.call(this,e,i);if(typeof(a===null||a===void 0?void 0:a.schema)!=="object")return;return tc.call(this,r,a)}if(typeof(i===null||i===void 0?void 0:i.schema)!=="object")return;if(!i.validate)rc.call(this,i);if(s===fe.normalizeId(t)){let{schema:a}=i,{schemaId:u}=this.opts,c=a[u];if(c)o=fe.resolveUrl(this.opts.uriResolver,o,c);return new Zn({schema:a,schemaId:u,root:e,baseId:o})}return tc.call(this,r,i)}og.resolveSchema=is;var US=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function tc(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 u=r[ss.unescapeFragment(a)];if(u===void 0)return;r=u;let c=typeof r==="object"&&r[this.opts.schemaId];if(!US.has(a)&&c)t=fe.resolveUrl(this.opts.uriResolver,t,c)}let s;if(typeof r!="boolean"&&r.$ref&&!ss.schemaHasRulesButRef(r,this.RULES)){let a=fe.resolveUrl(this.opts.uriResolver,t,r.$ref);s=is.call(this,n,a)}let{schemaId:i}=this.opts;if(s=s||new Zn({schema:r,schemaId:i,root:n,baseId:t}),s.schema!==s.root.schema)return s;return}});var ig=E(function(IZ,JS){JS.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 cc=E(function(CZ,mg){var KS=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),oc=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),WS=RegExp.prototype.test.bind(/^\d*$/u),fr=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),sc=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),cg=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),ic=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),GS=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),Ae=Array(256);for(let t=0;t<256;t++)Ae[t]="%"+"0123456789ABCDEF"[t>>4]+"0123456789ABCDEF"[t&15];function ke(e){if(e<2048)return Ae[192|e>>6]+Ae[128|e&63];if(e<65536)return Ae[224|e>>12]+Ae[128|e>>6&63]+Ae[128|e&63];return Ae[240|e>>18]+Ae[128|e>>12&63]+Ae[128|e>>6&63]+Ae[128|e&63]}function XS(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 YS=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),QS=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),ek=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),tk=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function rk(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++){if(ek(e[t]))continue;if(e[t]==="%"&&t+2<e.length&&fr(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function ag(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 nk(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 u=o[a];if(u==="")return;if(u.indexOf(".")!==-1){if(a!==o.length-1||t!==-1&&n.length===0||!oc(u))return;s+=2;continue}if(!YS(u))return;o[a]=parseInt(u,16).toString(16),s++}if(t===-1){if(s!==8)return;return ag(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 ag(i)}function nc(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&&QS(n))return n=n.toLowerCase(),{host:`[${n}]`,escapedHost:n,isIPV6:!1,isIPVFuture:!0};if(ok(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),!rk(o))return{host:e,isIPV6:!1,error:!0};n=n.slice(0,s)}let i=nk(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 ok(e,t){let r=0;for(let n=0;n<e.length;n++)if(e[n]===t)r++;return r}function ug(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("")}function sk(e){if(e===""||e[0]==="/")return ug(e);let t=e.split("/"),r=t.length-1,n=[],o=!1;for(let s=0;s<=r;s++){let i=t[s];if(i==="."||i===".."){if(i==="..")if(n.length!==0&&n[n.length-1]!=="..")n.pop();else n.push("..");o=s===r}else n.push(i)}if(o&&n[n.length-1]!=="..")n.push("");if(n.length===0||n[0]===""||n[0].includes(":"))n.unshift(".");return n.join("/")}var ik={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},ak=/[@/?#:]/g,ck=/[@/?#]/g;function lg(e,t){let r=t?ck:ak;return r.lastIndex=0,e.replace(r,(n)=>ik[n])}function dg(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(fr(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));if(t&&sc(i))r+=i;else r+="%"+s;n+=2;continue}}r+=e[n]}return r}function uk(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(fr(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));if(i!=="."&&sc(i))t+=i;else t+="%"+s;r+=2;continue}}if(cg(n))t+=n;else{let o=e.charCodeAt(r);if(o<128)t+=pg(o)?n:Ae[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 lk(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(fr(i)){r+="%"+i.toUpperCase(),o+=2;continue}}if(s==="/")n=!1;if(cg(s)&&(s!==":"||!n))r+=s;else{let i=e.charCodeAt(o);if(i<128)r+=Ae[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 ac(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(fr(s)){r+="%"+s.toUpperCase(),n+=2;continue}}if(t(o))r+=o;else{let s=e.charCodeAt(n);if(s<128)r+=Ae[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 fg(e){return ac(e,GS)}function dk(e){return ac(e,ic)}function fk(e){return ac(e,ic)}function pg(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 pk(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(fr(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));if(sc(i))t+=i;else t+="%"+s;r+=2;continue}}if(ic(n))t+=n;else{let o=e.charCodeAt(r);if(o<128)t+=pg(o)?n:Ae[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 mk(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(fr(n)){t+="%"+n.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function hk(e){let t=[];if(e.userinfo!==void 0)t.push(fg(e.userinfo)),t.push("@");if(e.host!==void 0){let r=e.host;if(!oc(r)){let n=nc(r);if(n.isIPV6!==!0&&n.isIPVFuture!==!0)r=dg(r,!0),n=nc(r);if(n.isIPV6===!0||n.isIPVFuture===!0)r=`[${n.escapedHost}]`;else r=lg(r,!1)}t.push(r)}if(typeof e.port==="number"||typeof e.port==="string"){let r=String(e.port);if(!WS(r))throw TypeError("URI port is malformed.");t.push(":"),t.push(r)}return t.length?t.join(""):void 0}mg.exports={nonSimpleDomain:tk,recomposeAuthority:hk,reescapeHostDelimiters:lg,normalizePercentEncoding:dg,normalizePathEncoding:uk,serializePathEncoding:lk,normalizeQueryFragmentEncoding:pk,encodeUserinfo:fg,encodeQuery:dk,encodeFragment:fk,escapePreservingEscapes:mk,removeDotSegments:ug,removeDotSegmentsRelative:sk,isIPv4:oc,isUUID:KS,normalizeIPv6:nc,stringArrayToHexStripped:XS}});var vg=E(function(AZ,yg){var{isUUID:gk}=cc(),_k=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,yk=["http","https","ws","wss","urn","urn:uuid"];function vk(e){return yk.indexOf(e)!==-1}function uc(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 hg(e){if(!e.host)e.error=e.error||"HTTP URIs must have a host.";return e}function gg(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 bk(e){return e.secure=uc(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function wk(e){if(e.port===(uc(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 xk(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(_k);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=lc(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 $k(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=lc(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 zk(e,t){let r=e;if(r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!gk(r.uuid)))r.error=r.error||"UUID is not valid.";return r}function Sk(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var _g={scheme:"http",domainHost:!0,parse:hg,serialize:gg},kk={scheme:"https",domainHost:_g.domainHost,parse:hg,serialize:gg},cs={scheme:"ws",domainHost:!0,parse:bk,serialize:wk},Pk={scheme:"wss",domainHost:cs.domainHost,parse:cs.parse,serialize:cs.serialize},Ek={scheme:"urn",parse:xk,serialize:$k,skipNormalize:!0},Tk={scheme:"urn:uuid",parse:zk,serialize:Sk,skipNormalize:!0},us={http:_g,https:kk,ws:cs,wss:Pk,urn:Ek,"urn:uuid":Tk};Object.setPrototypeOf(us,null);function lc(e){return e&&(us[e]||us[e.toLowerCase()])||void 0}yg.exports={wsIsSecure:uc,SCHEMES:us,isValidSchemeName:vk,getSchemeHandler:lc}});var Cg=E(function(NZ,ps){var{normalizeIPv6:zg,removeDotSegments:Mn,removeDotSegmentsRelative:Sg,recomposeAuthority:Rk,normalizePercentEncoding:dc,normalizePathEncoding:Ok,serializePathEncoding:bg,normalizeQueryFragmentEncoding:wg,encodeQuery:Ik,encodeFragment:Ck,reescapeHostDelimiters:Ak,isIPv4:kg,nonSimpleDomain:Nk}=cc(),{SCHEMES:Pg,getSchemeHandler:fc}=vg(),Eg=/^[A-Za-z][A-Za-z0-9+.-]*$/u,jk=/[\0-\x20"#/:<>?@[\\\]^`{|}\x7F]/u;function xg(e){let t=String(e);if(!Eg.test(t))throw TypeError("URI scheme is malformed.");return t}function Zk(e,t){if(typeof e==="string")e=Bk(e,t);else if(typeof e==="object")e=ds(pr(e,t),t);return e}function Dk(e,t,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},{parsed:o,malformedAuthorityOrPort:s,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:u,malformedScheme:c}=ls(e,n),{parsed:l,malformedAuthorityOrPort:d,malformedPercentEncoding:m,malformedSchemeSpecific:f,malformedHost:p,malformedScheme:g}=ls(t,n);if(s||d||i||m||a||f||u||p||c||g)throw Error(o.error||l.error||"URI is malformed.");let _=Tg(o,l,n,!0),y=fc(r&&r.scheme||_.scheme),k=_.host,C=k!==void 0&&k!==""&&(kg(k)||zg(k).isIPV6);if(Og(_,r||{},y,C))throw Error("URI host is malformed.");Rg(_,r||{},y,C);let U=k&&k.indexOf("%")!==-1&&!/\P{ASCII}/u.test(k);if(_.error&&!U)throw Error(_.error);return n.skipEscape=!0,pr(_,n)}function Tg(e,t,r,n){let o={};if(!n)e=ds(pr(e,r),r),t=ds(pr(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=Mn(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=Mn(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=Mn(t.path);else{let s=e.userinfo!==void 0||e.host!==void 0||e.port!==void 0;if(s&&!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=e.scheme===void 0&&!s&&o.path[0]!=="/"?Sg(o.path):Mn(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 Mk(e,t,r){let n=$g(e,r),o=$g(t,r);return n!==void 0&&o!==void 0&&n===o}function pr(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=xg(r.scheme);let s=fc(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=(r.scheme===void 0||n.reference==="suffix")&&!i,u=!n.skipEscape&&a;if(r.path!==void 0)if(!n.skipEscape)r.path=bg(r.path,u);else r.path=dc(r.path);if(n.reference!=="suffix"&&r.scheme)r.scheme=xg(r.scheme),o.push(r.scheme,":");let c=Rk(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 l=r.path;if(!n.absolutePath&&(!s||!s.absolutePath))l=a&&l[0]!=="/"?Sg(l):Mn(l);if(a)l=bg(l,!0);if(c===void 0&&l[0]==="/"&&l[1]==="/")l="/%2F"+l.slice(2);o.push(l)}if(r.query!==void 0)o.push("?",Ik(r.query));if(r.fragment!==void 0)o.push("#",Ck(r.fragment));return o.join("")}var qk=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,Lk=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,Uk=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function Fk(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 Dn(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 fs(e){return e[0]==="["&&e[e.length-1]==="]"}function Vk(e){let t=e[4];return Dn(e[3])||t!==void 0&&!fs(t)&&Dn(t)||Dn(e[6])||Dn(e[7])||Dn(e[8])}function Rg(e,t,r,n){if(Og(e,t,r,n))return e.error=e.error||"URI host is malformed.",!0;if(!t.unicodeSupport&&(!r||!r.unicodeSupport)&&e.host&&!fs(e.host)&&(t.domainHost||r&&r.domainHost)&&n===!1&&Nk(e.host)){let o;try{o=new URL("http://"+e.host)}catch(s){return e.error=e.error||"Host's domain name can not be converted to ASCII: "+s,!0}if(!Hk(o))return e.error=e.error||"URI host is malformed.",!0;e.host=o.hostname}return!1}function Og(e,t,r,n){return Boolean(e.host&&n===!1&&!fs(e.host)&&(t.domainHost||r&&r.domainHost)&&jk.test(e.host))}function Hk(e){return e.username===""&&e.password===""&&e.port===""&&e.pathname==="/"&&e.search===""&&e.hash===""&&e.hostname!==""}function ls(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,u=!1,c=!1,l=!1;if(r.reference==="suffix")if(r.scheme)e=r.scheme+":"+e;else e="//"+e;let d=e.match(Lk);if(d!==null&&d[1].indexOf("\\")!==-1)n.error="URI authority must not contain a literal backslash.",o=!0;let m=e.match(Uk);if(m!==null){let p=m[1],g=p.replace(/[\t\n\r]/g,"");if(g.length>=2){if(g.slice(0,2)!=="//")n.error=n.error||"URI authority must not contain a literal backslash.",o=!0;else if(p.length!==g.length)n.error=n.error||"URI authority introducer must not contain whitespace.",o=!0}}let f=e.match(qk);if(f){if(n.scheme=f[1],n.userinfo=f[3],n.host=f[4],n.port=parseInt(f[5],10),n.path=f[6]||"",n.query=f[7],n.fragment=f[8],n.scheme!==void 0)if(Eg.test(n.scheme))n.scheme=n.scheme.toLowerCase();else n.error=n.error||"URI scheme is malformed.",c=!0;if(s=Vk(f),s)n.error=n.error||"URI contains malformed percent-encoding.";if(isNaN(n.port))n.port=f[5];let p=Fk(n,f);if(p!==void 0)n.error=n.error||p,o=!0;if(n.host)if(kg(n.host)===!1){let y=fs(n.host),k=n.host.indexOf("[")!==-1||n.host.indexOf("]")!==-1,C=zg(n.host);if(l=C.isIPV6||C.isIPVFuture===!0,u=k&&(!y||C.error===!0),n.host=l?C.host:C.host.toLowerCase(),u)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 g=fc(r.scheme||n.scheme);if(!u)a=Rg(n,r,g,l);if(e.indexOf("%")!==-1&&n.host!==void 0&&!u){let _=l?n.host:dc(n.host,!0);if(!l)_=dc(_.toLowerCase());n.host=l||r.scheme!=="null"?Ak(_,l):_}if(!g||g&&!g.skipNormalize){if(n.path)n.path=Ok(n.path);if(n.query)n.query=wg(n.query);if(n.fragment)n.fragment=wg(n.fragment)}if(g&&g.parse){if(g.parse(n,r),g===Pg.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:c}}function ds(e,t){return ls(e,t).parsed}function Bk(e,t){return Ig(e,t).normalized}function Ig(e,t){let{parsed:r,malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:s,malformedHost:i,malformedScheme:a}=ls(e,t);return{normalized:n||o||s||i||a?e:pr(r,t),malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:s,malformedHost:i,malformedScheme:a}}function $g(e,t){if(typeof e!=="string"&&typeof e!=="object")return;let r;try{r=typeof e==="string"?e:pr(e,t)}catch{return}let{normalized:n,malformedAuthorityOrPort:o,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:u}=Ig(r,t);return o||s||i||a||u?void 0:n}var pc={SCHEMES:Pg,normalize:Zk,resolve:Dk,resolveComponent:Tg,equal:Mk,serialize:pr,parse:ds};ps.exports=pc;ps.exports.default=pc;ps.exports.fastUri=pc});var jg=E(function(Ng){Object.defineProperty(Ng,"__esModule",{value:!0});var Ag=Cg();Ag.code='require("ajv/dist/runtime/uri").default';Ng.default=Ag});var Bg=E(function($t){Object.defineProperty($t,"__esModule",{value:!0});$t.CodeGen=$t.Name=$t.nil=$t.stringify=$t.str=$t._=$t.KeywordCxt=void 0;var Kk=Nn();Object.defineProperty($t,"KeywordCxt",{enumerable:!0,get:function(){return Kk.KeywordCxt}});var Mr=L();Object.defineProperty($t,"_",{enumerable:!0,get:function(){return Mr._}});Object.defineProperty($t,"str",{enumerable:!0,get:function(){return Mr.str}});Object.defineProperty($t,"stringify",{enumerable:!0,get:function(){return Mr.stringify}});Object.defineProperty($t,"nil",{enumerable:!0,get:function(){return Mr.nil}});Object.defineProperty($t,"Name",{enumerable:!0,get:function(){return Mr.Name}});Object.defineProperty($t,"CodeGen",{enumerable:!0,get:function(){return Mr.CodeGen}});var Wk=os(),Lg=jn(),Ug=Va(),ot=as(),Fg=L(),st=An(),Ut=Cn(),Dr=V(),Zg=ig(),Gk=jg(),Vg=(e,t)=>new RegExp(e,t);Vg.code="new RegExp";var Xk=["removeAdditional","useDefaults","coerceTypes"],Yk=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),Qk={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."},eP={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},Dg=200;function tP(e){var t,r,n,o,s,i,a,u,c,l,d,m,f,p,g,_,y,k,C,U,b,x,N,Y,F;let se=e.strict,mt=(t=e.code)===null||t===void 0?void 0:t.optimize,rr=mt===!0||mt===void 0?1:mt||0,_r=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:Vg,zt=(o=e.uriResolver)!==null&&o!==void 0?o:Gk.default;return{strictSchema:(i=(s=e.strictSchema)!==null&&s!==void 0?s:se)!==null&&i!==void 0?i:!0,strictNumbers:(u=(a=e.strictNumbers)!==null&&a!==void 0?a:se)!==null&&u!==void 0?u:!0,strictTypes:(l=(c=e.strictTypes)!==null&&c!==void 0?c:se)!==null&&l!==void 0?l:"log",strictTuples:(m=(d=e.strictTuples)!==null&&d!==void 0?d:se)!==null&&m!==void 0?m:"log",strictRequired:(p=(f=e.strictRequired)!==null&&f!==void 0?f:se)!==null&&p!==void 0?p:!1,code:e.code?{...e.code,optimize:rr,regExp:_r}:{optimize:rr,regExp:_r},loopRequired:(g=e.loopRequired)!==null&&g!==void 0?g:Dg,loopEnum:(_=e.loopEnum)!==null&&_!==void 0?_:Dg,meta:(y=e.meta)!==null&&y!==void 0?y:!0,messages:(k=e.messages)!==null&&k!==void 0?k:!0,inlineRefs:(C=e.inlineRefs)!==null&&C!==void 0?C:!0,schemaId:(U=e.schemaId)!==null&&U!==void 0?U:"$id",addUsedSchema:(b=e.addUsedSchema)!==null&&b!==void 0?b:!0,validateSchema:(x=e.validateSchema)!==null&&x!==void 0?x:!0,validateFormats:(N=e.validateFormats)!==null&&N!==void 0?N:!0,unicodeRegExp:(Y=e.unicodeRegExp)!==null&&Y!==void 0?Y:!0,int32range:(F=e.int32range)!==null&&F!==void 0?F:!0,uriResolver:zt}}class ms{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,...tP(e)};let{es5:t,lines:r}=this.opts.code;this.scope=new Fg.ValueScope({scope:{},prefixes:Yk,es5:t,lines:r}),this.logger=aP(e.logger);let n=e.validateFormats;if(e.validateFormats=!1,this.RULES=Ug.getRules(),Mg.call(this,Qk,e,"NOT SUPPORTED"),Mg.call(this,eP,e,"DEPRECATED","warn"),this._metaOpts=sP.call(this),e.formats)nP.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords)oP.call(this,e.keywords);if(typeof e.meta=="object")this.addMetaSchema(e.meta);rP.call(this),e.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:r}=this.opts,n=Zg;if(r==="id")n={...Zg},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(c,l){await o.call(this,c.$schema);let d=this._addSchema(c,l);return d.validate||s.call(this,d)}async function o(c){if(c&&!this.getSchema(c))await n.call(this,{$ref:c},!0)}async function s(c){try{return this._compileSchemaEnv(c)}catch(l){if(!(l instanceof Lg.default))throw l;return i.call(this,l),await a.call(this,l.missingSchema),s.call(this,c)}}function i({missingSchema:c,missingRef:l}){if(this.refs[c])throw Error(`AnySchema ${c} is loaded but ${l} cannot be resolved`)}async function a(c){let l=await u.call(this,c);if(!this.refs[c])await o.call(this,l.$schema);if(!this.refs[c])this.addSchema(l,c,t)}async function u(c){let l=this._loading[c];if(l)return l;try{return await(this._loading[c]=r(c))}finally{delete this._loading[c]}}}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=st.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=qg.call(this,e))=="string")e=t;if(t===void 0){let{schemaId:r}=this.opts,n=new ot.SchemaEnv({schema:{},schemaId:r});if(t=ot.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=qg.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=st.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(uP.call(this,r,t),!t)return Dr.eachItem(r,(o)=>mc.call(this,o)),this;dP.call(this,t);let n={...t,type:Ut.getJSONTypes(t.type),schemaType:Ut.getJSONTypes(t.schemaType)};return Dr.eachItem(r,n.type.length===0?(o)=>mc.call(this,o,n):(o)=>n.type.forEach((s)=>mc.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:u}=a.definition,c=s[i];if(u&&c)s[i]=Hg(c)}}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=st.normalizeId(s||r);let u=st.getSchemaRefs.call(this,e,r);if(a=new ot.SchemaEnv({schema:e,schemaId:i,meta:t,baseId:r,localRefs:u}),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 ot.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{ot.compileSchema.call(this,e)}finally{this.opts=t}}}ms.ValidationError=Wk.default;ms.MissingRefError=Lg.default;$t.default=ms;function Mg(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 qg(e){return e=st.normalizeId(e),this.schemas[e]||this.refs[e]}function rP(){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 nP(){for(let e in this.opts.formats){let t=this.opts.formats[e];if(t)this.addFormat(e,t)}}function oP(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 sP(){let e={...this.opts};for(let t of Xk)delete e[t];return e}var iP={log(){},warn(){},error(){}};function aP(e){if(e===!1)return iP;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 cP=/^[a-z_$][a-z0-9_$:-]*$/i;function uP(e,t){let{RULES:r}=this;if(Dr.eachItem(e,(n)=>{if(r.keywords[n])throw Error(`Keyword ${n} is already defined`);if(!cP.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 mc(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:u})=>u===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:Ut.getJSONTypes(t.type),schemaType:Ut.getJSONTypes(t.schemaType)}};if(t.before)lP.call(this,i,a,t.before);else i.rules.push(a);s.all[e]=a,(n=t.implements)===null||n===void 0||n.forEach((u)=>this.addKeyword(u))}function lP(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 dP(e){let{metaSchema:t}=e;if(t===void 0)return;if(e.$data&&this.opts.$data)t=Hg(t);e.validateSchema=this.compile(t,!0)}var fP={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Hg(e){return{anyOf:[e,fP]}}});var Kg=E(function(Jg){Object.defineProperty(Jg,"__esModule",{value:!0});var hP={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Jg.default=hP});var Yg=E(function(Gg){Object.defineProperty(Gg,"__esModule",{value:!0});Gg.callRef=Gg.getValidate=void 0;var _P=jn(),gs=Je(),X=L(),qr=xt(),_s=as(),Ft=V(),yP={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:n}=e,{baseId:o,schemaEnv:s,validateName:i,opts:a,self:u}=n,{root:c}=s;if((r==="#"||r==="#/")&&o===c.baseId)return d();let l=_s.resolveRef.call(u,c,o,r);if(l===void 0)throw new _P.default(n.opts.uriResolver,o,r);if(l instanceof _s.SchemaEnv)return m(l);return f(l);function d(){if(s===c)return hs(e,i,s,s.$async);let p=t.scopeValue("root",{ref:c});return hs(e,X._`${p}.validate`,c,c.$async)}function m(p){let g=Wg(e,p);hs(e,g,p,p.$async)}function f(p){let g=t.scopeValue("schema",a.code.source===!0?{ref:p,code:X.stringify(p)}:{ref:p}),_=t.name("valid"),y=e.subschema({schema:p,dataTypes:[],schemaPath:X.nil,topSchemaRef:g,errSchemaPath:r},_);e.mergeEvaluated(y),e.ok(_)}}};function Wg(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):X._`${r.scopeValue("wrapper",{ref:t})}.validate`}Gg.getValidate=Wg;function hs(e,t,r,n){let{gen:o,it:s}=e,{allErrors:i,schemaEnv:a,opts:u}=s,c=u.passContext?qr.default.this:X.nil;if(n)l();else d();function l(){if(!a.$async)throw Error("async schema referenced by sync schema");let p=o.let("valid");o.try(()=>{if(o.code(X._`await ${gs.callValidateCode(e,t,c)}`),f(t),!i)o.assign(p,!0)},(g)=>{if(o.if(X._`!(${g} instanceof ${s.ValidationError})`,()=>o.throw(g)),m(g),!i)o.assign(p,!1)}),e.ok(p)}function d(){e.result(gs.callValidateCode(e,t,c),()=>f(t),()=>m(t))}function m(p){let g=X._`${p}.errors`;o.assign(qr.default.vErrors,X._`${qr.default.vErrors} === null ? ${g} : ${qr.default.vErrors}.concat(${g})`),o.assign(qr.default.errors,X._`${qr.default.vErrors}.length`)}function f(p){var g;if(!s.opts.unevaluated)return;let _=(g=r===null||r===void 0?void 0:r.validate)===null||g===void 0?void 0:g.evaluated;if(s.props!==!0)if(_&&!_.dynamicProps){if(_.props!==void 0)s.props=Ft.mergeEvaluated.props(o,_.props,s.props)}else{let y=o.var("props",X._`${p}.evaluated.props`);s.props=Ft.mergeEvaluated.props(o,y,s.props,X.Name)}if(s.items!==!0)if(_&&!_.dynamicItems){if(_.items!==void 0)s.items=Ft.mergeEvaluated.items(o,_.items,s.items)}else{let y=o.var("items",X._`${p}.evaluated.items`);s.items=Ft.mergeEvaluated.items(o,y,s.items,X.Name)}}}Gg.callRef=hs;Gg.default=yP});var e_=E(function(Qg){Object.defineProperty(Qg,"__esModule",{value:!0});var wP=Kg(),xP=Yg(),$P=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",wP.default,xP.default];Qg.default=$P});var r_=E(function(t_){Object.defineProperty(t_,"__esModule",{value:!0});var Ht=L(),Vt=Ht.operators,ys={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}},SP={message:({keyword:e,schemaCode:t})=>Ht.str`must be ${ys[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>Ht._`{comparison: ${ys[e].okStr}, limit: ${t}}`},kP={keyword:Object.keys(ys),type:"number",schemaType:"number",$data:!0,error:SP,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data(Ht._`${r} ${ys[t].fail} ${n} || isNaN(${r})`)}};t_.default=kP});var o_=E(function(n_){Object.defineProperty(n_,"__esModule",{value:!0});var it=L(),EP={message:({schemaCode:e})=>it.str`must be multiple of ${e}`,params:({schemaCode:e})=>it._`{multipleOf: ${e}}`},TP={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:EP,code(e){let{gen:t,data:r,schemaCode:n,it:o}=e,s=o.opts.multipleOfPrecision,i=t.let("res"),a=s?it._`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:it._`${i} !== parseInt(${i})`;e.fail$data(it._`(${n} === 0 || (${i} = ${r}/${n}, ${a}))`)}};n_.default=TP});var a_=E(function(i_){Object.defineProperty(i_,"__esModule",{value:!0});function s_(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}i_.default=s_;s_.code='require("ajv/dist/runtime/ucs2length").default'});var l_=E(function(u_){Object.defineProperty(u_,"__esModule",{value:!0});var Ne=L(),c_=V(),IP=a_(),CP={message({keyword:e,schemaCode:t}){return Ne.str`must NOT have ${e==="maxLength"?"more":"fewer"} than ${t} characters`},params:({schemaCode:e})=>Ne._`{limit: ${e}}`},AP={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:CP,code(e){let{keyword:t,data:r,schemaCode:n,it:o}=e,s=t==="maxLength"?Ne.operators.GT:Ne.operators.LT,i=o.opts.unicode===!1?Ne._`${r}.length`:Ne._`${c_.useFunc(e.gen,IP.default)}(${r})`;e.fail$data(Ne._`${i} ${s} ${n}`)}};u_.default=AP});var m_=E(function(p_){Object.defineProperty(p_,"__esModule",{value:!0});var d_=Je(),f_=V(),Ke=L(),jP={message:({schemaCode:e})=>Ke.str`must match pattern "${e}"`,params:({schemaCode:e})=>Ke._`{pattern: ${e}}`},ZP={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:jP,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:u}=i.opts.code,c=u.code==="new RegExp"?Ke._`new RegExp`:f_.useFunc(t,u),l=t.let("valid");t.try(()=>t.assign(l,Ke._`${c}(${s}, ${a}).test(${r})`),()=>t.assign(l,!1)),e.fail$data(Ke._`!${l}`)}else{let u=d_.usePattern(e,o);e.fail$data(Ke._`!${u}.test(${r})`)}}};p_.default=ZP});var g_=E(function(h_){Object.defineProperty(h_,"__esModule",{value:!0});var at=L(),MP={message({keyword:e,schemaCode:t}){return at.str`must NOT have ${e==="maxProperties"?"more":"fewer"} than ${t} properties`},params:({schemaCode:e})=>at._`{limit: ${e}}`},qP={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:MP,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxProperties"?at.operators.GT:at.operators.LT;e.fail$data(at._`Object.keys(${r}).length ${o} ${n}`)}};h_.default=qP});var v_=E(function(y_){Object.defineProperty(y_,"__esModule",{value:!0});var ct=Je(),ut=L(),__=V(),UP={message:({params:{missingProperty:e}})=>ut.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>ut._`{missingProperty: ${e}}`},FP={keyword:"required",type:"object",schemaType:"array",$data:!0,error:UP,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 u=r.length>=a.loopRequired;if(i.allErrors)c();else l();if(a.strictRequired){let f=e.parentSchema.properties,{definedProperties:p}=e.it;for(let g of r)if((f===null||f===void 0?void 0:f[g])===void 0&&!p.has(g)){let _=i.schemaEnv.baseId+i.errSchemaPath,y=`required property "${g}" is not defined at "${_}" (strictRequired)`;__.checkStrictMode(i,y,i.opts.strictRequired)}}function c(){if(u||s)e.block$data(ut.nil,d);else for(let f of r)ct.checkReportMissingProp(e,f)}function l(){let f=t.let("missing");if(u||s){let p=t.let("valid",!0);e.block$data(p,()=>m(f,p)),e.ok(p)}else t.if(ct.checkMissingProp(e,r,f)),ct.reportMissingProp(e,f),t.else()}function d(){t.forOf("prop",n,(f)=>{e.setParams({missingProperty:f}),t.if(ct.noPropertyInData(t,o,f,a.ownProperties),()=>e.error())})}function m(f,p){e.setParams({missingProperty:f}),t.forOf(f,n,()=>{t.assign(p,ct.propertyInData(t,o,f,a.ownProperties)),t.if(ut.not(p),()=>{e.error(),t.break()})},ut.nil)}}};y_.default=FP});var w_=E(function(b_){Object.defineProperty(b_,"__esModule",{value:!0});var lt=L(),HP={message({keyword:e,schemaCode:t}){return lt.str`must NOT have ${e==="maxItems"?"more":"fewer"} than ${t} items`},params:({schemaCode:e})=>lt._`{limit: ${e}}`},BP={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:HP,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxItems"?lt.operators.GT:lt.operators.LT;e.fail$data(lt._`${r}.length ${o} ${n}`)}};b_.default=BP});var vs=E(function($_){Object.defineProperty($_,"__esModule",{value:!0});var x_=Xa();x_.code='require("ajv/dist/runtime/equal").default';$_.default=x_});var k_=E(function(S_){Object.defineProperty(S_,"__esModule",{value:!0});var Lr=Cn(),H=L(),z_=V(),WP=vs(),GP={message:({params:{i:e,j:t}})=>H.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>H._`{i: ${e}, j: ${t}}`},XP={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:GP,code(e){let{gen:t,data:r,$data:n,schema:o,parentSchema:s,schemaCode:i,it:a}=e;if(!n&&!o)return;let u=t.let("valid"),c=s.items?Lr.getSchemaTypes(s.items):[];e.block$data(u,l,H._`${i} === false`),e.ok(u);function l(){let p=t.let("i",H._`${r}.length`),g=t.let("j");e.setParams({i:p,j:g}),t.assign(u,!0),t.if(H._`${p} > 1`,()=>(d()?m:f)(p,g))}function d(){return c.length>0&&!c.some((p)=>p==="object"||p==="array")}function m(p,g){let _=t.name("item"),y=Lr.checkDataTypes(c,_,a.opts.strictNumbers,Lr.DataType.Wrong),k=t.const("indices",H._`{}`);t.for(H._`;${p}--;`,()=>{if(t.let(_,H._`${r}[${p}]`),t.if(y,H._`continue`),c.length>1)t.if(H._`typeof ${_} == "string"`,H._`${_} += "_"`);t.if(H._`typeof ${k}[${_}] == "number"`,()=>{t.assign(g,H._`${k}[${_}]`),e.error(),t.assign(u,!1).break()}).code(H._`${k}[${_}] = ${p}`)})}function f(p,g){let _=z_.useFunc(t,WP.default),y=t.name("outer");t.label(y).for(H._`;${p}--;`,()=>t.for(H._`${g} = ${p}; ${g}--;`,()=>t.if(H._`${_}(${r}[${p}], ${r}[${g}])`,()=>{e.error(),t.assign(u,!1).break(y)})))}}};S_.default=XP});var T_=E(function(E_){Object.defineProperty(E_,"__esModule",{value:!0});var Ur=L(),P_=V(),QP=vs(),eE={message:"must be equal to constant",params:({schemaCode:e})=>Ur._`{allowedValue: ${e}}`},tE={keyword:"const",$data:!0,error:eE,code(e){let{gen:t,data:r,$data:n,schemaCode:o,schema:s}=e;if(n||s&&typeof s=="object")e.fail$data(Ur._`!${P_.useFunc(t,QP.default)}(${r}, ${o})`);else e.fail(Ur._`${s} !== ${r}`)}};E_.default=tE});var I_=E(function(O_){Object.defineProperty(O_,"__esModule",{value:!0});var dt=L(),R_=V(),nE=vs(),oE={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>dt._`{allowedValues: ${e}}`},sE={keyword:"enum",schemaType:"array",$data:!0,error:oE,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,u,c=()=>u!==null&&u!==void 0?u:u=R_.useFunc(t,nE.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 f=t.const("vSchema",s);l=dt.or(...o.map((p,g)=>m(f,g)))}e.pass(l);function d(){t.assign(l,!1),t.forOf("v",s,(f)=>t.if(dt._`${c()}(${r}, ${f})`,()=>t.assign(l,!0).break()))}function m(f,p){let g=o[p];return typeof g==="object"&&g!==null?dt._`${c()}(${r}, ${f}[${p}])`:dt._`${r} === ${g}`}}};O_.default=sE});var A_=E(function(C_){Object.defineProperty(C_,"__esModule",{value:!0});var aE=r_(),cE=o_(),uE=l_(),lE=m_(),dE=g_(),fE=v_(),pE=w_(),mE=k_(),hE=T_(),gE=I_(),_E=[aE.default,cE.default,uE.default,lE.default,dE.default,fE.default,pE.default,mE.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},hE.default,gE.default];C_.default=_E});var hc=E(function(j_){Object.defineProperty(j_,"__esModule",{value:!0});j_.validateAdditionalItems=void 0;var je=L(),Fr=V(),vE={message:({params:{len:e}})=>je.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>je._`{limit: ${e}}`},bE={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:vE,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){Fr.checkStrictMode(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}N_(e,n)}};function N_(e,t){let{gen:r,schema:n,data:o,keyword:s,it:i}=e;i.items=!0;let a=r.const("len",je._`${o}.length`);if(n===!1)e.setParams({len:t.length}),e.pass(je._`${a} <= ${t.length}`);else if(typeof n=="object"&&!Fr.alwaysValidSchema(i,n)){let c=r.var("valid",je._`${a} <= ${t.length}`);r.if(je.not(c),()=>u(c)),e.ok(c)}function u(c){r.forRange("i",t.length,a,(l)=>{if(e.subschema({keyword:s,dataProp:l,dataPropType:Fr.Type.Num},c),!i.allErrors)r.if(je.not(c),()=>r.break())})}}j_.validateAdditionalItems=N_;j_.default=bE});var gc=E(function(q_){Object.defineProperty(q_,"__esModule",{value:!0});q_.validateTuple=void 0;var bs=L(),Bt=V(),D_=Je(),xE={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return M_(e,"additionalItems",t);if(r.items=!0,Bt.alwaysValidSchema(r,t))return;e.ok(D_.validateArray(e))}};function M_(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=Bt.mergeEvaluated.items(n,r.length,a.items);let u=n.name("valid"),c=n.const("len",bs._`${s}.length`);r.forEach((d,m)=>{if(Bt.alwaysValidSchema(a,d))return;n.if(bs._`${c} > ${m}`,()=>e.subschema({keyword:i,schemaProp:m,dataProp:m},u)),e.ok(u)});function l(d){let{opts:m,errSchemaPath:f}=a,p=r.length,g=p===d.minItems&&(p===d.maxItems||d[t]===!1);if(m.strictTuples&&!g){let _=`"${i}" is ${p}-tuple, but minItems or maxItems/${t} are not specified or different at path "${f}"`;Bt.checkStrictMode(a,_,m.strictTuples)}}}q_.validateTuple=M_;q_.default=xE});var V_=E(function(F_){Object.defineProperty(F_,"__esModule",{value:!0});var U_=gc(),zE={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(e)=>U_.validateTuple(e,"items")};F_.default=zE});var W_=E(function(K_){Object.defineProperty(K_,"__esModule",{value:!0});var ws=L(),H_=V(),B_=Je(),J_=hc(),kE={message:({params:{len:e}})=>ws.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>ws._`{limit: ${e}}`},PE={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:kE,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:o}=r;if(n.items=!0,H_.alwaysValidSchema(n,t))return;if(o)J_.validateAdditionalItems(e,o);else e.ok(B_.validateArray(e))}};K_.default=PE});var X_=E(function(G_){Object.defineProperty(G_,"__esModule",{value:!0});var ce=L(),Jt=V(),TE={message:({params:{min:e,max:t}})=>t===void 0?ce.str`must contain at least ${e} valid item(s)`:ce.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?ce._`{minContains: ${e}}`:ce._`{minContains: ${e}, maxContains: ${t}}`},RE={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:TE,code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:s}=e,i,a,{minContains:u,maxContains:c}=n;if(s.opts.next)i=u===void 0?1:u,a=c;else i=1;let l=t.const("len",ce._`${o}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){Jt.checkStrictMode(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){Jt.checkStrictMode(s,'"minContains" > "maxContains" is always invalid'),e.fail();return}if(Jt.alwaysValidSchema(s,r)){let g=ce._`${l} >= ${i}`;if(a!==void 0)g=ce._`${g} && ${l} <= ${a}`;e.pass(g);return}s.items=!0;let d=t.name("valid");if(a===void 0&&i===1)f(d,()=>t.if(d,()=>t.break()));else if(i===0){if(t.let(d,!0),a!==void 0)t.if(ce._`${o}.length > 0`,m)}else t.let(d,!1),m();e.result(d,()=>e.reset());function m(){let g=t.name("_valid"),_=t.let("count",0);f(g,()=>t.if(g,()=>p(_)))}function f(g,_){t.forRange("i",0,l,(y)=>{e.subschema({keyword:"contains",dataProp:y,dataPropType:Jt.Type.Num,compositeRule:!0},g),_()})}function p(g){if(t.code(ce._`${g}++`),a===void 0)t.if(ce._`${g} >= ${i}`,()=>t.assign(d,!0).break());else if(t.if(ce._`${g} > ${a}`,()=>t.assign(d,!1).break()),i===1)t.assign(d,!0);else t.if(ce._`${g} >= ${i}`,()=>t.assign(d,!0))}}};G_.default=RE});var oy=E(function(ty){Object.defineProperty(ty,"__esModule",{value:!0});ty.validateSchemaDeps=ty.validatePropertyDeps=ty.error=void 0;var Vr=L(),Y_=V(),ft=Je();ty.error={message:({params:{property:e,depsCount:t,deps:r}})=>Vr.str`must have ${t===1?"property":"properties"} ${r} when property ${e} is present`,params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>Vr._`{property: ${e},
7
7
  missingProperty: ${n},
8
8
  depsCount: ${t},
9
- deps: ${r}}`};var IE={keyword:"dependencies",type:"object",schemaType:"object",error:ty.error,code(e){let[t,r]=CE(e);Q_(e,t),ey(e,r)}};function CE({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 Q_(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 u=ft.propertyInData(r,n,i,o.opts.ownProperties);if(e.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),o.allErrors)r.if(u,()=>{for(let c of a)ft.checkReportMissingProp(e,c)});else r.if(Vr._`${u} && (${ft.checkMissingProp(e,a,s)})`),ft.reportMissingProp(e,s),r.else()}}ty.validatePropertyDeps=Q_;function ey(e,t=e.schema){let{gen:r,data:n,keyword:o,it:s}=e,i=r.name("valid");for(let a in t){if(Y_.alwaysValidSchema(s,t[a]))continue;r.if(ft.propertyInData(r,n,a,s.opts.ownProperties),()=>{let u=e.subschema({keyword:o,schemaProp:a},i);e.mergeValidEvaluated(u,i)},()=>r.var(i,!0)),e.ok(i)}}ty.validateSchemaDeps=ey;ty.default=IE});var ay=E(function(iy){Object.defineProperty(iy,"__esModule",{value:!0});var xs=L(),sy=V(),jE={message:"property name must be valid",params:({params:e})=>xs._`{propertyName: ${e.propertyName}}`},ZE={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:jE,code(e){let{gen:t,schema:r,data:n,it:o}=e;if(sy.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(xs.not(s),()=>{if(e.error(!0),!o.allErrors)t.break()})}),e.ok(s)}};iy.default=ZE});var gc=E(function(cy){Object.defineProperty(cy,"__esModule",{value:!0});var Kt=Je(),pe=L(),ME=xt(),Wt=V(),qE={message:"must NOT have additional properties",params:({params:e})=>pe._`{additionalProperty: ${e.additionalProperty}}`},LE={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:qE,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:u}=i;if(i.props=!0,u.removeAdditional!=="all"&&Wt.alwaysValidSchema(i,r))return;let c=Kt.allSchemaProperties(n.properties),l=Kt.allSchemaProperties(n.patternProperties);d(),e.ok(pe._`${s} === ${ME.default.errors}`);function d(){t.forIn("key",o,(_)=>{if(!c.length&&!l.length)p(_);else t.if(m(_),()=>p(_))})}function m(_){let y;if(c.length>8){let k=Wt.schemaRefOrVal(i,n.properties,"properties");y=Kt.isOwnProperty(t,k,_)}else if(c.length)y=pe.or(...c.map((k)=>pe._`${_} === ${k}`));else y=pe.nil;if(l.length)y=pe.or(y,...l.map((k)=>pe._`${Kt.usePattern(e,k)}.test(${_})`));return pe.not(y)}function f(_){t.code(pe._`delete ${o}[${_}]`)}function p(_){if(u.removeAdditional==="all"||u.removeAdditional&&r===!1){f(_);return}if(r===!1){if(e.setParams({additionalProperty:_}),e.error(),!a)t.break();return}if(typeof r=="object"&&!Wt.alwaysValidSchema(i,r)){let y=t.name("valid");if(u.removeAdditional==="failing")g(_,y,!1),t.if(pe.not(y),()=>{e.reset(),f(_)});else if(g(_,y),!a)t.if(pe.not(y),()=>t.break())}}function g(_,y,k){let C={keyword:"additionalProperties",dataProp:_,dataPropType:Wt.Type.Str};if(k===!1)Object.assign(C,{compositeRule:!0,createErrors:!1,allErrors:!1});e.subschema(C,y)}}};cy.default=LE});var fy=E(function(dy){Object.defineProperty(dy,"__esModule",{value:!0});var ly=Nn(),$s=Je(),Hr=V(),uy=gc(),FE={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)uy.default.code(new ly.KeywordCxt(s,uy.default,"additionalProperties"));let i=$s.allSchemaProperties(r);for(let d of i)s.definedProperties.add(d);if(s.opts.unevaluated&&i.length&&s.props!==!0)s.props=Hr.mergeEvaluated.props(t,Hr.toHash(i),s.props);let a=i.filter((d)=>!Hr.alwaysValidSchema(s,r[d]));if(a.length===0)return;let u=t.name("valid");for(let d of a){if(c(d))l(d);else{if(t.if($s.propertyInData(t,o,d,s.opts.ownProperties)),l(d),!s.allErrors)t.else().var(u,!0);t.endIf()}e.it.definedProperties.add(d),e.ok(u)}function c(d){return s.opts.useDefaults&&!s.compositeRule&&r[d].default!==void 0}function l(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},u)}}};dy.default=FE});var my=E(function(py){Object.defineProperty(py,"__esModule",{value:!0});var zs=Je(),Gt=L(),Ss=V(),ks=V(),HE={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:o,it:s}=e,{opts:i}=s,a=zs.allSchemaProperties(r),u=a.filter((g)=>Ss.alwaysValidSchema(s,r[g]));if(a.length===0||u.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let c=i.strictSchema&&!i.allowMatchingProperties&&o.properties,l=t.name("valid");if(s.props!==!0&&!(s.props instanceof Gt.Name))s.props=ks.evaluatedPropsToName(t,s.props);let{props:d}=s;m();function m(){for(let g of a){if(c)f(g);if(s.allErrors)p(g);else t.var(l,!0),p(g),t.if(l)}}function f(g){for(let _ in c)if(new RegExp(g).test(_))Ss.checkStrictMode(s,`property ${_} matches pattern ${g} (use allowMatchingProperties)`)}function p(g){t.forIn("key",n,(_)=>{t.if(Gt._`${zs.usePattern(e,g)}.test(${_})`,()=>{let y=u.includes(g);if(!y)e.subschema({keyword:"patternProperties",schemaProp:g,dataProp:_,dataPropType:ks.Type.Str},l);if(s.opts.unevaluated&&d!==!0)t.assign(Gt._`${d}[${_}]`,!0);else if(!y&&!s.allErrors)t.if(Gt.not(l),()=>t.break())})})}}};py.default=HE});var _y=E(function(gy){Object.defineProperty(gy,"__esModule",{value:!0});var hy=V(),JE={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if(hy.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"}};gy.default=JE});var by=E(function(vy){Object.defineProperty(vy,"__esModule",{value:!0});var yy=Je(),WE={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:yy.validateUnion,error:{message:"must match a schema in anyOf"}};vy.default=WE});var $y=E(function(xy){Object.defineProperty(xy,"__esModule",{value:!0});var Xt=L(),wy=V(),XE={message:"must match exactly one schema in oneOf",params:({params:e})=>Xt._`{passingSchemas: ${e.passing}}`},YE={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:XE,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),u=t.name("_valid");e.setParams({passing:a}),t.block(c),e.result(i,()=>e.reset(),()=>e.error(!0));function c(){s.forEach((l,d)=>{let m;if(wy.alwaysValidSchema(o,l))t.var(u,!0);else m=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},u);if(d>0)t.if(Xt._`${u} && ${i}`).assign(i,!1).assign(a,Xt._`[${a}, ${d}]`).else();t.if(u,()=>{if(t.assign(i,!0),t.assign(a,d),m)e.mergeEvaluated(m,Xt.Name)})})}}};xy.default=YE});var ky=E(function(Sy){Object.defineProperty(Sy,"__esModule",{value:!0});var zy=V(),eT={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(zy.alwaysValidSchema(n,s))return;let a=e.subschema({keyword:"allOf",schemaProp:i},o);e.ok(o),e.mergeEvaluated(a)})}};Sy.default=eT});var Ty=E(function(Ey){Object.defineProperty(Ey,"__esModule",{value:!0});var Yt=L(),Ps=V(),rT={message:({params:e})=>Yt.str`must match "${e.ifClause}" schema`,params:({params:e})=>Yt._`{failingKeyword: ${e.ifClause}}`},nT={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:rT,code(e){let{gen:t,parentSchema:r,it:n}=e;if(r.then===void 0&&r.else===void 0)Ps.checkStrictMode(n,'"if" without "then" and "else" is ignored');let o=Py(n,"then"),s=Py(n,"else");if(!o&&!s)return;let i=t.let("valid",!0),a=t.name("_valid");if(u(),e.reset(),o&&s){let l=t.let("ifClause");e.setParams({ifClause:l}),t.if(a,c("then",l),c("else",l))}else if(o)t.if(a,c("then"));else t.if(Yt.not(a),c("else"));e.pass(i,()=>e.error(!0));function u(){let l=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(l)}function c(l,d){return()=>{let m=e.subschema({keyword:l},a);if(t.assign(i,a),e.mergeValidEvaluated(m,i),d)t.assign(d,Yt._`${l}`);else e.setParams({ifClause:l})}}}};function Py(e,t){let r=e.schema[t];return r!==void 0&&!Ps.alwaysValidSchema(e,r)}Ey.default=nT});var Iy=E(function(Oy){Object.defineProperty(Oy,"__esModule",{value:!0});var Ry=V(),sT={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){if(t.if===void 0)Ry.checkStrictMode(r,`"${e}" without "if" is ignored`)}};Oy.default=sT});var Ay=E(function(Cy){Object.defineProperty(Cy,"__esModule",{value:!0});var aT=mc(),cT=V_(),uT=hc(),lT=W_(),dT=X_(),fT=oy(),pT=ay(),mT=gc(),hT=fy(),gT=my(),_T=_y(),yT=by(),vT=$y(),bT=ky(),wT=Ty(),xT=Iy();function $T(e=!1){let t=[_T.default,yT.default,vT.default,bT.default,wT.default,xT.default,pT.default,mT.default,fT.default,hT.default,gT.default];if(e)t.push(cT.default,lT.default);else t.push(aT.default,uT.default);return t.push(dT.default),t}Cy.default=$T});var jy=E(function(Ny){Object.defineProperty(Ny,"__esModule",{value:!0});var q=L(),ST={message:({schemaCode:e})=>q.str`must match format "${e}"`,params:({schemaCode:e})=>q._`{format: ${e}}`},kT={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:ST,code(e,t){let{gen:r,data:n,$data:o,schema:s,schemaCode:i,it:a}=e,{opts:u,errSchemaPath:c,schemaEnv:l,self:d}=a;if(!u.validateFormats)return;if(o)m();else f();function m(){let p=r.scopeValue("formats",{ref:d.formats,code:u.code.formats}),g=r.const("fDef",q._`${p}[${i}]`),_=r.let("fType"),y=r.let("format");r.if(q._`typeof ${g} == "object" && !(${g} instanceof RegExp)`,()=>r.assign(_,q._`${g}.type || "string"`).assign(y,q._`${g}.validate`),()=>r.assign(_,q._`"string"`).assign(y,g)),e.fail$data(q.or(k(),C()));function k(){if(u.strictSchema===!1)return q.nil;return q._`${i} && !${y}`}function C(){let U=l.$async?q._`(${g}.async ? await ${y}(${n}) : ${y}(${n}))`:q._`${y}(${n})`,b=q._`(typeof ${y} == "function" ? ${U} : ${y}.test(${n}))`;return q._`${y} && ${y} !== true && ${_} === ${t} && !${b}`}}function f(){let p=d.formats[s];if(!p){k();return}if(p===!0)return;let[g,_,y]=C(p);if(g===t)e.pass(U());function k(){if(u.strictSchema===!1){d.logger.warn(b());return}throw Error(b());function b(){return`unknown format "${s}" ignored in schema at path "${c}"`}}function C(b){let x=b instanceof RegExp?q.regexpCode(b):u.code.formats?q._`${u.code.formats}${q.getProperty(s)}`:void 0,N=r.scopeValue("formats",{key:s,ref:b,code:x});if(typeof b=="object"&&!(b instanceof RegExp))return[b.type||"string",b.validate,q._`${N}.validate`];return["string",b,N]}function U(){if(typeof p=="object"&&!(p instanceof RegExp)&&p.async){if(!l.$async)throw Error("async format in sync schema");return q._`await ${y}(${n})`}return typeof _=="function"?q._`${y}(${n})`:q._`${y}.test(${n})`}}}};Ny.default=kT});var Dy=E(function(Zy){Object.defineProperty(Zy,"__esModule",{value:!0});var ET=jy(),TT=[ET.default];Zy.default=TT});var Ly=E(function(My){Object.defineProperty(My,"__esModule",{value:!0});My.contentVocabulary=My.metadataVocabulary=void 0;My.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];My.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var Fy=E(function(Uy){Object.defineProperty(Uy,"__esModule",{value:!0});var IT=e_(),CT=A_(),AT=Ay(),NT=Dy(),Es=Ly(),jT=[IT.default,CT.default,(0,AT.default)(),NT.default,Es.metadataVocabulary,Es.contentVocabulary];Uy.default=jT});var Jy=E(function(Hy){Object.defineProperty(Hy,"__esModule",{value:!0});Hy.DiscrError=void 0;var Vy;(function(e){e.Tag="tag",e.Mapping="mapping"})(Vy||(Hy.DiscrError=Vy={}))});var Gy=E(function(Wy){Object.defineProperty(Wy,"__esModule",{value:!0});var We=L(),Br=Jy(),Ts=as(),DT=jn(),Ky=V(),MT={message:({params:{discrError:e,tagName:t}})=>e===Br.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>We._`{error: ${e}, tag: ${r}, tagValue: ${t}}`},qT={keyword:"discriminator",type:"object",schemaType:"object",error:MT,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 u=t.let("valid",!1),c=t.const("tag",We._`${r}${We.getProperty(a)}`);t.if(We._`typeof ${c} == "string"`,()=>l(),()=>e.error(!1,{discrError:Br.DiscrError.Tag,tag:c,tagName:a})),e.ok(u);function l(){let f=m();t.if(!1);for(let p in f)t.elseIf(We._`${c} === ${p}`),t.assign(u,d(f[p]));t.else(),e.error(!1,{discrError:Br.DiscrError.Mapping,tag:c,tagName:a}),t.endIf()}function d(f){let p=t.name("valid"),g=e.subschema({keyword:"oneOf",schemaProp:f},p);return e.mergeEvaluated(g,We.Name),p}function m(){var f;let p={},g=y(o),_=!0;for(let U=0;U<i.length;U++){let b=i[U];if((b===null||b===void 0?void 0:b.$ref)&&!Ky.schemaHasRulesButRef(b,s.self.RULES)){let N=b.$ref;if(b=Ts.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,N),b instanceof Ts.SchemaEnv)b=b.schema;if(b===void 0)throw new DT.default(s.opts.uriResolver,s.baseId,N)}let x=(f=b===null||b===void 0?void 0:b.properties)===null||f===void 0?void 0:f[a];if(typeof x!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);_=_&&(g||y(b)),k(x,U)}if(!_)throw Error(`discriminator: "${a}" must be required`);return p;function y({required:U}){return Array.isArray(U)&&U.includes(a)}function k(U,b){if(U.const)C(U.const,b);else if(U.enum)for(let x of U.enum)C(x,b);else throw Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function C(U,b){if(typeof U!="string"||U in p)throw Error(`discriminator: "${a}" values must be unique strings`);p[U]=b}}}};Wy.default=qT});var Xy=E(function(TD,UT){UT.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 yc=E(function(Ze,_c){Object.defineProperty(Ze,"__esModule",{value:!0});Ze.MissingRefError=Ze.ValidationError=Ze.CodeGen=Ze.Name=Ze.nil=Ze.stringify=Ze.str=Ze._=Ze.KeywordCxt=Ze.Ajv=void 0;var FT=Bg(),VT=Fy(),HT=Gy(),Yy=Xy(),BT=["/properties"],Rs="http://json-schema.org/draft-07/schema";class qn extends FT.default{_addVocabularies(){if(super._addVocabularies(),VT.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(HT.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(Yy,BT):Yy;this.addMetaSchema(e,Rs,!1),this.refs["http://json-schema.org/schema"]=Rs}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Rs)?Rs:void 0)}}Ze.Ajv=qn;_c.exports=Ze=qn;_c.exports.Ajv=qn;Object.defineProperty(Ze,"__esModule",{value:!0});Ze.default=qn;var JT=Nn();Object.defineProperty(Ze,"KeywordCxt",{enumerable:!0,get:function(){return JT.KeywordCxt}});var Jr=L();Object.defineProperty(Ze,"_",{enumerable:!0,get:function(){return Jr._}});Object.defineProperty(Ze,"str",{enumerable:!0,get:function(){return Jr.str}});Object.defineProperty(Ze,"stringify",{enumerable:!0,get:function(){return Jr.stringify}});Object.defineProperty(Ze,"nil",{enumerable:!0,get:function(){return Jr.nil}});Object.defineProperty(Ze,"Name",{enumerable:!0,get:function(){return Jr.Name}});Object.defineProperty(Ze,"CodeGen",{enumerable:!0,get:function(){return Jr.CodeGen}});var KT=os();Object.defineProperty(Ze,"ValidationError",{enumerable:!0,get:function(){return KT.default}});var WT=jn();Object.defineProperty(Ze,"MissingRefError",{enumerable:!0,get:function(){return WT.default}})});var cv=E(function(iv){Object.defineProperty(iv,"__esModule",{value:!0});iv.formatNames=iv.fastFormats=iv.fullFormats=void 0;function pt(e,t){return{validate:e,compare:t}}iv.fullFormats={date:pt(rv,xc),time:pt(bc(!0),$c),"date-time":pt(Qy(!0),ov),"iso-time":pt(bc(),nv),"iso-date-time":pt(Qy(),sv),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:nR,"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:lR,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:oR,int32:{type:"number",validate:aR},int64:{type:"number",validate:cR},float:{type:"number",validate:tv},double:{type:"number",validate:tv},password:!0,binary:!0};iv.fastFormats={...iv.fullFormats,date:pt(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,xc),time:pt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,$c),"date-time":pt(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,ov),"iso-time":pt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,nv),"iso-date-time":pt(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,sv),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};iv.formatNames=Object.keys(iv.fullFormats);function YT(e){return e%4===0&&(e%100!==0||e%400===0)}var QT=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,eR=[0,31,28,31,30,31,30,31,31,30,31,30,31];function rv(e){let t=QT.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&&YT(r)?29:eR[n])}function xc(e,t){if(!(e&&t))return;if(e>t)return 1;if(e<t)return-1;return 0}var vc=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function bc(e){return function(r){let n=vc.exec(r);if(!n)return!1;let o=+n[1],s=+n[2],i=+n[3],a=n[4],u=n[5]==="-"?-1:1,c=+(n[6]||0),l=+(n[7]||0);if(c>23||l>59||e&&!a)return!1;if(o<=23&&s<=59&&i<60)return!0;let d=s-l*u,m=o-c*u-(d<0?1:0);return(m===23||m===-1)&&(d===59||d===-1)&&i<61}}function $c(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 nv(e,t){if(!(e&&t))return;let r=vc.exec(e),n=vc.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 wc=/t|\s/i;function Qy(e){let t=bc(e);return function(n){let o=n.split(wc);return o.length===2&&rv(o[0])&&t(o[1])}}function ov(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 sv(e,t){if(!(e&&t))return;let[r,n]=e.split(wc),[o,s]=t.split(wc),i=xc(r,o);if(i===void 0)return;return i||$c(n,s)}var tR=/\/|:/,rR=/^(?:[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 nR(e){return tR.test(e)&&rR.test(e)}var ev=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function oR(e){return ev.lastIndex=0,ev.test(e)}var sR=-2147483648,iR=2147483647;function aR(e){return Number.isInteger(e)&&e<=iR&&e>=sR}function cR(e){return Number.isInteger(e)}function tv(){return!0}var uR=/[^\\]\\Z/;function lR(e){if(uR.test(e))return!1;try{return new RegExp(e),!0}catch(t){return!1}}});var dv=E(function(lv){Object.defineProperty(lv,"__esModule",{value:!0});lv.formatLimitDefinition=void 0;var uv=yc(),me=L(),Qt=me.operators,Os={formatMaximum:{okStr:"<=",ok:Qt.LTE,fail:Qt.GT},formatMinimum:{okStr:">=",ok:Qt.GTE,fail:Qt.LT},formatExclusiveMaximum:{okStr:"<",ok:Qt.LT,fail:Qt.GTE},formatExclusiveMinimum:{okStr:">",ok:Qt.GT,fail:Qt.LTE}},fR={message:({keyword:e,schemaCode:t})=>me.str`should be ${Os[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>me._`{comparison: ${Os[e].okStr}, limit: ${t}}`};lv.formatLimitDefinition={keyword:Object.keys(Os),type:"string",schemaType:"string",$data:!0,error:fR,code(e){let{gen:t,data:r,schemaCode:n,keyword:o,it:s}=e,{opts:i,self:a}=s;if(!i.validateFormats)return;let u=new uv.KeywordCxt(s,a.RULES.all.format.definition,"format");if(u.$data)c();else l();function c(){let m=t.scopeValue("formats",{ref:a.formats,code:i.code.formats}),f=t.const("fmt",me._`${m}[${u.schemaCode}]`);e.fail$data(me.or(me._`typeof ${f} != "object"`,me._`${f} instanceof RegExp`,me._`typeof ${f}.compare != "function"`,d(f)))}function l(){let m=u.schema,f=a.formats[m];if(!f||f===!0)return;if(typeof f!="object"||f instanceof RegExp||typeof f.compare!="function")throw Error(`"${o}": format "${m}" does not define "compare" function`);let p=t.scopeValue("formats",{key:m,ref:f,code:i.code.formats?me._`${i.code.formats}${me.getProperty(m)}`:void 0});e.fail$data(d(p))}function d(m){return me._`${m}.compare(${r}, ${n}) ${Os[o].fail} 0`}},dependencies:["format"]};var pR=(e)=>(e.addKeyword(lv.formatLimitDefinition),e);lv.default=pR});var hv=E(function(Ln,mv){Object.defineProperty(Ln,"__esModule",{value:!0});var Ge=cv(),hR=dv(),Kr=L(),fv=new Kr.Name("fullFormats"),gR=new Kr.Name("fastFormats"),kc=(e,t={keywords:!0})=>{if(Array.isArray(t))return pv(e,t,Ge.fullFormats,fv),e;let[r,n]=t.mode==="fast"?[Ge.fastFormats,gR]:[Ge.fullFormats,fv],o=t.formats||Ge.formatNames;if(pv(e,o,r,n),t.keywords)(0,hR.default)(e);return e};kc.get=(e,t="full")=>{let n=(t==="fast"?Ge.fastFormats:Ge.fullFormats)[e];if(!n)throw Error(`Unknown format "${e}"`);return n};function pv(e,t,r,n){var o,s;(o=(s=e.opts.code).formats)!==null&&o!==void 0||(s.formats=Kr._`require("ajv-formats/dist/formats").${n}`);for(let i of t)e.addFormat(i,r[i])}mv.exports=Ln=kc;Object.defineProperty(Ln,"__esModule",{value:!0});Ln.default=kc});function en(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 Ys(e,t="|"){return e.map((r)=>ti(r)).join(t)}function tn(e,t){if(typeof t==="bigint")return t.toString();return t}class Yc{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 rn(e){return new Yc(e)}function Qc(e){return e===null||e===void 0}function Vn(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function eu(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 nn(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function ht(e){return nn(e._zod.def)??e._zod.def.shape}function tu(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return Le(this,t,n),n},enumerable:!0,configurable:!0})}function ru(e,t,r){if(t in e)Le(e,t,r);else e[t]=r}function nr(e,t,r,n){let o=ht(t);for(let s of r){let i=Object.getOwnPropertyDescriptor(o,s);if(!i.enumerable)continue;if(i.get)tu(e,s,()=>{let a=t._zod.def.shape[s];return n?n(a,s):a});else ru(e,s,n?n(i.value,s):i.value)}}function Yv(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);if(!n.enumerable)continue;if(n.get)tu(e,r,()=>t[r]);else ru(e,r,n.value)}}function De(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function nu(e){return JSON.stringify(e)}function ou(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Qs="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function yr(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var su=rn(()=>{if(Re.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function or(e){if(yr(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(yr(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function ei(e){if(or(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 iu=new Set(["string","number","symbol"]);function kt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Xe(e,t,r){let n=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)n._zod.parent=e;return n}function O(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 ti(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function au(e){return Object.keys(e).filter((t)=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var Hn=(()=>({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]}))(),ri={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Qv(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 nr(s,e,Bn(e,t)),Xe(e,De(r,{shape:s,checks:[]}))}function Bn(e,t){let r=ht(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 eb(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(Bn(e,t)),i={};return nr(i,e,Reflect.ownKeys(ht(e)).filter((a)=>!s.has(a))),Xe(e,De(r,{shape:i,checks:[]}))}function tb(e,t){if(!or(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=ht(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 Xe(e,De(e._zod.def,{shape:cu(e,t)}))}function cu(e,t){let r={};return nr(r,e,Reflect.ownKeys(ht(e))),Yv(r,t),r}function rb(e,t){if(!or(t))throw Error("Invalid input to safeExtend: expected a plain object");return Xe(e,De(e._zod.def,{shape:cu(e,t)}))}function nb(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={};nr(r,e,Reflect.ownKeys(ht(e))),nr(r,t,Reflect.ownKeys(ht(t)));let n=De(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Xe(e,n)}function uu(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(Bn(t,r)):void 0,u={};return nr(u,t,Reflect.ownKeys(ht(t)),e&&((c,l)=>a&&!a.has(l)?c:new e({type:"optional",innerType:c}))),Xe(t,De(t._zod.def,{shape:u,checks:[]}))}function ob(e,t,r){let n=r?new Set(Bn(t,r)):void 0,o={};return nr(o,t,Reflect.ownKeys(ht(t)),(s,i)=>n&&!n.has(i)?s:new e({type:"nonoptional",innerType:s})),Xe(t,De(t._zod.def,{shape:o}))}function Qe(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 lu(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 Pt(e,t){return t.map((r)=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Qr(e){return typeof e==="string"?e:e?.message}function ni(e){let t=[];for(let r of e??[]){let n=r._zod.def;if(!/_(length|size)$|_equals$/.test(n.check))break;let o=n.maximum??n.length??n.size;if(o>=0)t.push([o,r])}return t}function Jn(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}function et(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:Qr(e.inst?._zod.def?.error?.(e))??Qr(s?.(e))??Qr(t?.error?.(e))??Qr(r.customError?.(e))??Qr(r.localeError?.(e))??"Invalid input",a={};for(let u of Object.keys(e)){if(u==="inst"||u==="schema"||u==="continue"||u==="input"||u==="__proto__")continue;a[u]=e[u]}if(a.path??(a.path=[]),a.message=i,t?.reportInput)a.input=e.input;return a}var sb=/[\uD800-\uDBFF]/;function Kn(e){let t=e.length;if(!sb.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 Wn(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function du(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 sr(...e){let[t,r,n]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:n};return{...t}}function fu(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);if(n.get)Object.defineProperty(e,r,{...n,enumerable:!1});else ib(e,r,n.value)}}function gt(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function Gn(e,t,r){return gt(e,t,r,!1)}function pu(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return gt(this,r,n(this))},set(o){gt(this,r,o)}})}return t}function ib(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:gt(this,t,r.bind(this))},set(n){gt(this,t,n)}})}function ab(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var Xs,St=!1,cb={configurable:!0,get(){St=!0;return}};function J(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&Xs!==e._zod){Xs=void 0;return}Xs=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,cb);let o=St;St=!1;try{let s=r(this);if(St)delete this[t];else Object.defineProperty(this,t,{configurable:!0,writable:!0,value:s});return St=St||o,s}catch(s){throw delete this[t],St=St||o,s}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function ub(e,t,r,n){let o=ab(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 lb="~constantCatch";function mu(e){let t=()=>e;return t[lb]=!0,t}var hu,si=Object.freeze({status:"aborted"}),oi={value:void 0,enumerable:!1},gu="captureStackTrace"in Error?Error:null;function db(e){let t=gu;if(t){let r=t.stackTraceLimit;if(typeof r==="number"){try{t.stackTraceLimit=0}catch{return gu=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function v(e,t,r,n){let o={};function s(m){this.def=m,this.constr=d,this.traits=new Set}s.prototype=o;let i=r,a=i&&new WeakSet;function u(m,f){if(!m._zod){oi.value=new s(f);try{Object.defineProperty(m,"_zod",oi)}finally{oi.value=void 0}}else if(m._zod.traits.has(e))return;if(m._zod.traits.add(e),t(m,f),a){let g=Object.getPrototypeOf(m),_=m._zod.constr.prototype,y=g;while(y&&y!==_)y=Object.getPrototypeOf(y);let k=y??g;if(!a.has(k))a.add(k),fu(k,i)}let p=d.prototype;for(let g in p){if(!Object.prototype.hasOwnProperty.call(p,g))continue;if(!(g in m))m[g]=p[g].bind(m)}}let c=n?.Parent??Object;class l extends c{}Object.defineProperty(l,"name",{value:e});function d(m){let f=n?.Parent?db(l):this;u(f,m);let p=f._zod.deferred;if(p){for(let _ of p)_();f._zod.deferred=void 0}let g=globalThis.__zod_globalConfig?.postProcessor;if(g)g(f);return f}return Object.defineProperty(d,"init",{value:u}),Object.defineProperty(d,Symbol.hasInstance,{value:(m)=>{if(n?.Parent&&m instanceof n.Parent)return!0;return m?._zod?.traits?.has(e)}}),Object.defineProperty(d,"name",{value:e}),d}class tt extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class on extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(hu=globalThis).__zod_globalConfig??(hu.__zod_globalConfig={});var Re=globalThis.__zod_globalConfig;function Oe(e){if(e)Object.assign(Re,e);return Re}function fb(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,tn,2)),e.message}function pb(e){this._zod.message=e}var mb={get:fb,set:pb,enumerable:!0,configurable:!0},ai={value:void 0,enumerable:!1},_u=new WeakSet([Object.prototype,Error.prototype]),yu=(e,t)=>{e.name="$ZodError",ai.value=t,Object.defineProperty(e,"issues",ai),ai.value=void 0,Object.defineProperty(e,"message",mb);let r=Object.getPrototypeOf(e);if(!_u.has(r))_u.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})}})},vu=v("$ZodError",yu),bu=v("$ZodError",yu,void 0,{Parent:Error});function hb(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 ci(e,t=(r)=>r.message){let r={},n=[];for(let o of e.issues)if(o.path.length>0)hb(r,o.path[0],()=>[]).push(t(o));else n.push(t(o));return{formErrors:n,fieldErrors:r}}function ui(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 u=r,c=0;while(c<a.length){let l=a[c],d=c===a.length-1;if(l==="_errors"){if(d)u._errors.push(t(i));c++;continue}if(!Object.prototype.hasOwnProperty.call(u,l))Object.defineProperty(u,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let m=u[l];if(d)m._errors.push(t(i));u=m,c++}}}};return n(e),r}function Xn(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Yn=(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 tt;if(a.issues.length){let u=new(s?.Err??e)(a.issues.map((c)=>et(c,i,Oe())));throw Qs(u,s?.callee??t),u}return a.value};return t};var Qn=(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 u=new(s?.Err??e)(a.issues.map((c)=>et(c,i,Oe())));throw Qs(u,s?.callee??t),u}return a.value};return t};var sn=(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 tt;return s.issues.length?wu(e,s.issues,o):{success:!0,data:s.value}},li=sn(bu);function wu(e,t,r){let n;return{success:!1,get error(){if(!n)n=new e(t.map((o)=>et(o,r,Oe()))),t=void 0,r=void 0;return n},set error(o){n=o,t=void 0,r=void 0}}}var eo=(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?wu(e,s.issues,o):{success:!0,data:s.value}};var _b=Symbol.for("zod.compile.invalid"),yb=Symbol.for("zod.compile.fallback"),to=(e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==_b)return!0;if(n.definite===!0&&r===void 0)return!1}return vb(e,t,r)};function vb(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,s;if(o)n[yb]=!0,s=o({value:t,issues:[]},n);else s=e._zod.run({value:t,issues:[]},n);if(s instanceof Promise)throw new tt;return s.issues.length===0}var ro=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},xu=(e)=>{let t=Yn(e),r=(n,o,s,i)=>{let a=s?{...s,direction:"backward"}:{direction:"backward"};return t(n,o,a,Xn(r,i))};return r};var $u=(e)=>{let t=Yn(e),r=(n,o,s,i)=>t(n,o,s,Xn(r,i));return r};var zu=(e)=>{let t=Qn(e),r=async(n,o,s,i)=>{let a=s?{...s,direction:"backward"}:{direction:"backward"};return await t(n,o,a,Xn(r,i))};return r};var Su=(e)=>{let t=Qn(e),r=async(n,o,s,i)=>await t(n,o,s,Xn(r,i));return r};var ku=(e)=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return sn(e)(t,r,o)};var Pu=(e)=>(t,r,n)=>sn(e)(t,r,n);var Eu=(e)=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return eo(e)(t,r,o)};var Tu=(e)=>async(t,r,n)=>eo(e)(t,r,n);var Ru=/^[cC][0-9a-z]{6,}$/,Ou=/^[0-9a-z]+$/,Iu=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Cu=/^[0-9a-vA-V]{20}$/,Au=/^[A-Za-z0-9]{27}$/,Nu=/^[a-zA-Z0-9_-]{21}$/;function ju(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Zu=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Du=/^([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})$/,fi=(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 Mu=/^(?:[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 bb="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function qu(){return new RegExp(bb,"u")}var Lu=/^(?:(?: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])$/,Uu=/^(([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 Fu=/^((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])$/,Vu=/^(([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])$/,Hu=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Bu=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var Ju=/^https?$/,Ku=/^\+[1-9]\d{6,14}$/;var Wu="(?:(?:\\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 wb(e){return new RegExp(`^${e}$`)}var Gu=wb(Wu);function di(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 Xu(e){return new RegExp(`^${di(e)}$`)}function Yu(e){let t=["Z"];if(e.offset)t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${di({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,n=e.local?`${r}|${di({precision:e.precision})}`:r;return new RegExp(`^${Wu}T(?:${n})$`)}var Qu=/^[\s\S]{0,}$/;var pi=/^-?\d+$/,an=/^-?\d+(?:\.\d+)?$/,el=/^(?:true|false)$/i,tl=/^null$/i;var rl=/^[^A-Z]*$/,nl=/^[^a-z]*$/;var we=v("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var mi=(e)=>{let t=e.value;return!Qc(t)&&t.length!==void 0},no={number:"number",bigint:"bigint",object:"date"},hi=v("$ZodCheckLessThan",(e,t)=>{we.init(e,t);let r=no[typeof t.value];e._zod.check=(n)=>{if(t.inclusive?n.value<=t.value:n.value<t.value)return;n.issues.push({origin:no[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})}}),gi=v("$ZodCheckGreaterThan",(e,t)=>{we.init(e,t);let r=no[typeof t.value];e._zod.check=(n)=>{if(t.inclusive?n.value>=t.value:n.value>t.value)return;n.issues.push({origin:no[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})}}),ol=v("$ZodCheckMultipleOf",(e,t)=>{we.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):eu(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})}}),sl=v("$ZodCheckNumberFormat",(e,t)=>{we.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,s]=Hn[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 il=v("$ZodCheckMaxLength",(e,t)=>{var r;we.init(e,t),(r=e._zod.def).when??(r.when=mi),e._zod.check=(n)=>{let o=n.value,s=o.length;if((typeof o==="string"&&s>t.maximum?Kn(o):s)<=t.maximum)return;let a=Wn(o);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),al=v("$ZodCheckMinLength",(e,t)=>{var r;we.init(e,t),(r=e._zod.def).when??(r.when=mi),e._zod.check=(n)=>{let o=n.value,s=o.length;if((typeof o==="string"&&s>=t.minimum&&s<t.minimum*2?Kn(o):s)>=t.minimum)return;let a=Wn(o);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),cl=v("$ZodCheckLengthEquals",(e,t)=>{var r;we.init(e,t),(r=e._zod.def).when??(r.when=mi),e._zod.check=(n)=>{let o=n.value,s=o.length,i=typeof o==="string"&&s>=t.length&&s<=t.length*2?Kn(o):s;if(i===t.length)return;let a=Wn(o),u=i>t.length;n.issues.push({origin:a,...u?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),cn=v("$ZodCheckStringFormat",(e,t)=>{var r,n;if(we.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=()=>{})}),ul=v("$ZodCheckRegex",(e,t)=>{cn.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})}}),ll=v("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=rl),cn.init(e,t)}),dl=v("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=nl),cn.init(e,t)}),fl=v("$ZodCheckIncludes",(e,t)=>{we.init(e,t);let r=kt(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})}}),pl=v("$ZodCheckStartsWith",(e,t)=>{we.init(e,t);let r=new RegExp(`^${kt(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})}}),ml=v("$ZodCheckEndsWith",(e,t)=>{we.init(e,t);let r=new RegExp(`.*${kt(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 hl=v("$ZodCheckOverwrite",(e,t)=>{we.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class _i{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 IE={keyword:"dependencies",type:"object",schemaType:"object",error:ty.error,code(e){let[t,r]=CE(e);Q_(e,t),ey(e,r)}};function CE({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 Q_(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 u=ft.propertyInData(r,n,i,o.opts.ownProperties);if(e.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),o.allErrors)r.if(u,()=>{for(let c of a)ft.checkReportMissingProp(e,c)});else r.if(Vr._`${u} && (${ft.checkMissingProp(e,a,s)})`),ft.reportMissingProp(e,s),r.else()}}ty.validatePropertyDeps=Q_;function ey(e,t=e.schema){let{gen:r,data:n,keyword:o,it:s}=e,i=r.name("valid");for(let a in t){if(Y_.alwaysValidSchema(s,t[a]))continue;r.if(ft.propertyInData(r,n,a,s.opts.ownProperties),()=>{let u=e.subschema({keyword:o,schemaProp:a},i);e.mergeValidEvaluated(u,i)},()=>r.var(i,!0)),e.ok(i)}}ty.validateSchemaDeps=ey;ty.default=IE});var ay=E(function(iy){Object.defineProperty(iy,"__esModule",{value:!0});var xs=L(),sy=V(),jE={message:"property name must be valid",params:({params:e})=>xs._`{propertyName: ${e.propertyName}}`},ZE={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:jE,code(e){let{gen:t,schema:r,data:n,it:o}=e;if(sy.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(xs.not(s),()=>{if(e.error(!0),!o.allErrors)t.break()})}),e.ok(s)}};iy.default=ZE});var _c=E(function(cy){Object.defineProperty(cy,"__esModule",{value:!0});var Kt=Je(),pe=L(),ME=xt(),Wt=V(),qE={message:"must NOT have additional properties",params:({params:e})=>pe._`{additionalProperty: ${e.additionalProperty}}`},LE={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:qE,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:u}=i;if(i.props=!0,u.removeAdditional!=="all"&&Wt.alwaysValidSchema(i,r))return;let c=Kt.allSchemaProperties(n.properties),l=Kt.allSchemaProperties(n.patternProperties);d(),e.ok(pe._`${s} === ${ME.default.errors}`);function d(){t.forIn("key",o,(_)=>{if(!c.length&&!l.length)p(_);else t.if(m(_),()=>p(_))})}function m(_){let y;if(c.length>8){let k=Wt.schemaRefOrVal(i,n.properties,"properties");y=Kt.isOwnProperty(t,k,_)}else if(c.length)y=pe.or(...c.map((k)=>pe._`${_} === ${k}`));else y=pe.nil;if(l.length)y=pe.or(y,...l.map((k)=>pe._`${Kt.usePattern(e,k)}.test(${_})`));return pe.not(y)}function f(_){t.code(pe._`delete ${o}[${_}]`)}function p(_){if(u.removeAdditional==="all"||u.removeAdditional&&r===!1){f(_);return}if(r===!1){if(e.setParams({additionalProperty:_}),e.error(),!a)t.break();return}if(typeof r=="object"&&!Wt.alwaysValidSchema(i,r)){let y=t.name("valid");if(u.removeAdditional==="failing")g(_,y,!1),t.if(pe.not(y),()=>{e.reset(),f(_)});else if(g(_,y),!a)t.if(pe.not(y),()=>t.break())}}function g(_,y,k){let C={keyword:"additionalProperties",dataProp:_,dataPropType:Wt.Type.Str};if(k===!1)Object.assign(C,{compositeRule:!0,createErrors:!1,allErrors:!1});e.subschema(C,y)}}};cy.default=LE});var fy=E(function(dy){Object.defineProperty(dy,"__esModule",{value:!0});var ly=Nn(),$s=Je(),Hr=V(),uy=_c(),FE={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)uy.default.code(new ly.KeywordCxt(s,uy.default,"additionalProperties"));let i=$s.allSchemaProperties(r);for(let d of i)s.definedProperties.add(d);if(s.opts.unevaluated&&i.length&&s.props!==!0)s.props=Hr.mergeEvaluated.props(t,Hr.toHash(i),s.props);let a=i.filter((d)=>!Hr.alwaysValidSchema(s,r[d]));if(a.length===0)return;let u=t.name("valid");for(let d of a){if(c(d))l(d);else{if(t.if($s.propertyInData(t,o,d,s.opts.ownProperties)),l(d),!s.allErrors)t.else().var(u,!0);t.endIf()}e.it.definedProperties.add(d),e.ok(u)}function c(d){return s.opts.useDefaults&&!s.compositeRule&&r[d].default!==void 0}function l(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},u)}}};dy.default=FE});var my=E(function(py){Object.defineProperty(py,"__esModule",{value:!0});var zs=Je(),Gt=L(),Ss=V(),ks=V(),HE={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:o,it:s}=e,{opts:i}=s,a=zs.allSchemaProperties(r),u=a.filter((g)=>Ss.alwaysValidSchema(s,r[g]));if(a.length===0||u.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let c=i.strictSchema&&!i.allowMatchingProperties&&o.properties,l=t.name("valid");if(s.props!==!0&&!(s.props instanceof Gt.Name))s.props=ks.evaluatedPropsToName(t,s.props);let{props:d}=s;m();function m(){for(let g of a){if(c)f(g);if(s.allErrors)p(g);else t.var(l,!0),p(g),t.if(l)}}function f(g){for(let _ in c)if(new RegExp(g).test(_))Ss.checkStrictMode(s,`property ${_} matches pattern ${g} (use allowMatchingProperties)`)}function p(g){t.forIn("key",n,(_)=>{t.if(Gt._`${zs.usePattern(e,g)}.test(${_})`,()=>{let y=u.includes(g);if(!y)e.subschema({keyword:"patternProperties",schemaProp:g,dataProp:_,dataPropType:ks.Type.Str},l);if(s.opts.unevaluated&&d!==!0)t.assign(Gt._`${d}[${_}]`,!0);else if(!y&&!s.allErrors)t.if(Gt.not(l),()=>t.break())})})}}};py.default=HE});var _y=E(function(gy){Object.defineProperty(gy,"__esModule",{value:!0});var hy=V(),JE={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if(hy.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"}};gy.default=JE});var by=E(function(vy){Object.defineProperty(vy,"__esModule",{value:!0});var yy=Je(),WE={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:yy.validateUnion,error:{message:"must match a schema in anyOf"}};vy.default=WE});var $y=E(function(xy){Object.defineProperty(xy,"__esModule",{value:!0});var Xt=L(),wy=V(),XE={message:"must match exactly one schema in oneOf",params:({params:e})=>Xt._`{passingSchemas: ${e.passing}}`},YE={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:XE,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),u=t.name("_valid");e.setParams({passing:a}),t.block(c),e.result(i,()=>e.reset(),()=>e.error(!0));function c(){s.forEach((l,d)=>{let m;if(wy.alwaysValidSchema(o,l))t.var(u,!0);else m=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},u);if(d>0)t.if(Xt._`${u} && ${i}`).assign(i,!1).assign(a,Xt._`[${a}, ${d}]`).else();t.if(u,()=>{if(t.assign(i,!0),t.assign(a,d),m)e.mergeEvaluated(m,Xt.Name)})})}}};xy.default=YE});var ky=E(function(Sy){Object.defineProperty(Sy,"__esModule",{value:!0});var zy=V(),eT={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(zy.alwaysValidSchema(n,s))return;let a=e.subschema({keyword:"allOf",schemaProp:i},o);e.ok(o),e.mergeEvaluated(a)})}};Sy.default=eT});var Ty=E(function(Ey){Object.defineProperty(Ey,"__esModule",{value:!0});var Yt=L(),Ps=V(),rT={message:({params:e})=>Yt.str`must match "${e.ifClause}" schema`,params:({params:e})=>Yt._`{failingKeyword: ${e.ifClause}}`},nT={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:rT,code(e){let{gen:t,parentSchema:r,it:n}=e;if(r.then===void 0&&r.else===void 0)Ps.checkStrictMode(n,'"if" without "then" and "else" is ignored');let o=Py(n,"then"),s=Py(n,"else");if(!o&&!s)return;let i=t.let("valid",!0),a=t.name("_valid");if(u(),e.reset(),o&&s){let l=t.let("ifClause");e.setParams({ifClause:l}),t.if(a,c("then",l),c("else",l))}else if(o)t.if(a,c("then"));else t.if(Yt.not(a),c("else"));e.pass(i,()=>e.error(!0));function u(){let l=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(l)}function c(l,d){return()=>{let m=e.subschema({keyword:l},a);if(t.assign(i,a),e.mergeValidEvaluated(m,i),d)t.assign(d,Yt._`${l}`);else e.setParams({ifClause:l})}}}};function Py(e,t){let r=e.schema[t];return r!==void 0&&!Ps.alwaysValidSchema(e,r)}Ey.default=nT});var Iy=E(function(Oy){Object.defineProperty(Oy,"__esModule",{value:!0});var Ry=V(),sT={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){if(t.if===void 0)Ry.checkStrictMode(r,`"${e}" without "if" is ignored`)}};Oy.default=sT});var Ay=E(function(Cy){Object.defineProperty(Cy,"__esModule",{value:!0});var aT=hc(),cT=V_(),uT=gc(),lT=W_(),dT=X_(),fT=oy(),pT=ay(),mT=_c(),hT=fy(),gT=my(),_T=_y(),yT=by(),vT=$y(),bT=ky(),wT=Ty(),xT=Iy();function $T(e=!1){let t=[_T.default,yT.default,vT.default,bT.default,wT.default,xT.default,pT.default,mT.default,fT.default,hT.default,gT.default];if(e)t.push(cT.default,lT.default);else t.push(aT.default,uT.default);return t.push(dT.default),t}Cy.default=$T});var jy=E(function(Ny){Object.defineProperty(Ny,"__esModule",{value:!0});var q=L(),ST={message:({schemaCode:e})=>q.str`must match format "${e}"`,params:({schemaCode:e})=>q._`{format: ${e}}`},kT={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:ST,code(e,t){let{gen:r,data:n,$data:o,schema:s,schemaCode:i,it:a}=e,{opts:u,errSchemaPath:c,schemaEnv:l,self:d}=a;if(!u.validateFormats)return;if(o)m();else f();function m(){let p=r.scopeValue("formats",{ref:d.formats,code:u.code.formats}),g=r.const("fDef",q._`${p}[${i}]`),_=r.let("fType"),y=r.let("format");r.if(q._`typeof ${g} == "object" && !(${g} instanceof RegExp)`,()=>r.assign(_,q._`${g}.type || "string"`).assign(y,q._`${g}.validate`),()=>r.assign(_,q._`"string"`).assign(y,g)),e.fail$data(q.or(k(),C()));function k(){if(u.strictSchema===!1)return q.nil;return q._`${i} && !${y}`}function C(){let U=l.$async?q._`(${g}.async ? await ${y}(${n}) : ${y}(${n}))`:q._`${y}(${n})`,b=q._`(typeof ${y} == "function" ? ${U} : ${y}.test(${n}))`;return q._`${y} && ${y} !== true && ${_} === ${t} && !${b}`}}function f(){let p=d.formats[s];if(!p){k();return}if(p===!0)return;let[g,_,y]=C(p);if(g===t)e.pass(U());function k(){if(u.strictSchema===!1){d.logger.warn(b());return}throw Error(b());function b(){return`unknown format "${s}" ignored in schema at path "${c}"`}}function C(b){let x=b instanceof RegExp?q.regexpCode(b):u.code.formats?q._`${u.code.formats}${q.getProperty(s)}`:void 0,N=r.scopeValue("formats",{key:s,ref:b,code:x});if(typeof b=="object"&&!(b instanceof RegExp))return[b.type||"string",b.validate,q._`${N}.validate`];return["string",b,N]}function U(){if(typeof p=="object"&&!(p instanceof RegExp)&&p.async){if(!l.$async)throw Error("async format in sync schema");return q._`await ${y}(${n})`}return typeof _=="function"?q._`${y}(${n})`:q._`${y}.test(${n})`}}}};Ny.default=kT});var Dy=E(function(Zy){Object.defineProperty(Zy,"__esModule",{value:!0});var ET=jy(),TT=[ET.default];Zy.default=TT});var Ly=E(function(My){Object.defineProperty(My,"__esModule",{value:!0});My.contentVocabulary=My.metadataVocabulary=void 0;My.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];My.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var Fy=E(function(Uy){Object.defineProperty(Uy,"__esModule",{value:!0});var IT=e_(),CT=A_(),AT=Ay(),NT=Dy(),Es=Ly(),jT=[IT.default,CT.default,(0,AT.default)(),NT.default,Es.metadataVocabulary,Es.contentVocabulary];Uy.default=jT});var Jy=E(function(Hy){Object.defineProperty(Hy,"__esModule",{value:!0});Hy.DiscrError=void 0;var Vy;(function(e){e.Tag="tag",e.Mapping="mapping"})(Vy||(Hy.DiscrError=Vy={}))});var Gy=E(function(Wy){Object.defineProperty(Wy,"__esModule",{value:!0});var We=L(),Br=Jy(),Ts=as(),DT=jn(),Ky=V(),MT={message:({params:{discrError:e,tagName:t}})=>e===Br.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>We._`{error: ${e}, tag: ${r}, tagValue: ${t}}`},qT={keyword:"discriminator",type:"object",schemaType:"object",error:MT,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 u=t.let("valid",!1),c=t.const("tag",We._`${r}${We.getProperty(a)}`);t.if(We._`typeof ${c} == "string"`,()=>l(),()=>e.error(!1,{discrError:Br.DiscrError.Tag,tag:c,tagName:a})),e.ok(u);function l(){let f=m();t.if(!1);for(let p in f)t.elseIf(We._`${c} === ${p}`),t.assign(u,d(f[p]));t.else(),e.error(!1,{discrError:Br.DiscrError.Mapping,tag:c,tagName:a}),t.endIf()}function d(f){let p=t.name("valid"),g=e.subschema({keyword:"oneOf",schemaProp:f},p);return e.mergeEvaluated(g,We.Name),p}function m(){var f;let p={},g=y(o),_=!0;for(let U=0;U<i.length;U++){let b=i[U];if((b===null||b===void 0?void 0:b.$ref)&&!Ky.schemaHasRulesButRef(b,s.self.RULES)){let N=b.$ref;if(b=Ts.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,N),b instanceof Ts.SchemaEnv)b=b.schema;if(b===void 0)throw new DT.default(s.opts.uriResolver,s.baseId,N)}let x=(f=b===null||b===void 0?void 0:b.properties)===null||f===void 0?void 0:f[a];if(typeof x!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);_=_&&(g||y(b)),k(x,U)}if(!_)throw Error(`discriminator: "${a}" must be required`);return p;function y({required:U}){return Array.isArray(U)&&U.includes(a)}function k(U,b){if(U.const)C(U.const,b);else if(U.enum)for(let x of U.enum)C(x,b);else throw Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function C(U,b){if(typeof U!="string"||U in p)throw Error(`discriminator: "${a}" values must be unique strings`);p[U]=b}}}};Wy.default=qT});var Xy=E(function(TD,UT){UT.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 vc=E(function(Ze,yc){Object.defineProperty(Ze,"__esModule",{value:!0});Ze.MissingRefError=Ze.ValidationError=Ze.CodeGen=Ze.Name=Ze.nil=Ze.stringify=Ze.str=Ze._=Ze.KeywordCxt=Ze.Ajv=void 0;var FT=Bg(),VT=Fy(),HT=Gy(),Yy=Xy(),BT=["/properties"],Rs="http://json-schema.org/draft-07/schema";class qn extends FT.default{_addVocabularies(){if(super._addVocabularies(),VT.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(HT.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(Yy,BT):Yy;this.addMetaSchema(e,Rs,!1),this.refs["http://json-schema.org/schema"]=Rs}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Rs)?Rs:void 0)}}Ze.Ajv=qn;yc.exports=Ze=qn;yc.exports.Ajv=qn;Object.defineProperty(Ze,"__esModule",{value:!0});Ze.default=qn;var JT=Nn();Object.defineProperty(Ze,"KeywordCxt",{enumerable:!0,get:function(){return JT.KeywordCxt}});var Jr=L();Object.defineProperty(Ze,"_",{enumerable:!0,get:function(){return Jr._}});Object.defineProperty(Ze,"str",{enumerable:!0,get:function(){return Jr.str}});Object.defineProperty(Ze,"stringify",{enumerable:!0,get:function(){return Jr.stringify}});Object.defineProperty(Ze,"nil",{enumerable:!0,get:function(){return Jr.nil}});Object.defineProperty(Ze,"Name",{enumerable:!0,get:function(){return Jr.Name}});Object.defineProperty(Ze,"CodeGen",{enumerable:!0,get:function(){return Jr.CodeGen}});var KT=os();Object.defineProperty(Ze,"ValidationError",{enumerable:!0,get:function(){return KT.default}});var WT=jn();Object.defineProperty(Ze,"MissingRefError",{enumerable:!0,get:function(){return WT.default}})});var cv=E(function(iv){Object.defineProperty(iv,"__esModule",{value:!0});iv.formatNames=iv.fastFormats=iv.fullFormats=void 0;function pt(e,t){return{validate:e,compare:t}}iv.fullFormats={date:pt(rv,$c),time:pt(wc(!0),zc),"date-time":pt(Qy(!0),ov),"iso-time":pt(wc(),nv),"iso-date-time":pt(Qy(),sv),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:nR,"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:lR,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:oR,int32:{type:"number",validate:aR},int64:{type:"number",validate:cR},float:{type:"number",validate:tv},double:{type:"number",validate:tv},password:!0,binary:!0};iv.fastFormats={...iv.fullFormats,date:pt(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,$c),time:pt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,zc),"date-time":pt(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,ov),"iso-time":pt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,nv),"iso-date-time":pt(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,sv),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};iv.formatNames=Object.keys(iv.fullFormats);function YT(e){return e%4===0&&(e%100!==0||e%400===0)}var QT=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,eR=[0,31,28,31,30,31,30,31,31,30,31,30,31];function rv(e){let t=QT.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&&YT(r)?29:eR[n])}function $c(e,t){if(!(e&&t))return;if(e>t)return 1;if(e<t)return-1;return 0}var bc=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function wc(e){return function(r){let n=bc.exec(r);if(!n)return!1;let o=+n[1],s=+n[2],i=+n[3],a=n[4],u=n[5]==="-"?-1:1,c=+(n[6]||0),l=+(n[7]||0);if(c>23||l>59||e&&!a)return!1;if(o<=23&&s<=59&&i<60)return!0;let d=s-l*u,m=o-c*u-(d<0?1:0);return(m===23||m===-1)&&(d===59||d===-1)&&i<61}}function zc(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 nv(e,t){if(!(e&&t))return;let r=bc.exec(e),n=bc.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 xc=/t|\s/i;function Qy(e){let t=wc(e);return function(n){let o=n.split(xc);return o.length===2&&rv(o[0])&&t(o[1])}}function ov(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 sv(e,t){if(!(e&&t))return;let[r,n]=e.split(xc),[o,s]=t.split(xc),i=$c(r,o);if(i===void 0)return;return i||zc(n,s)}var tR=/\/|:/,rR=/^(?:[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 nR(e){return tR.test(e)&&rR.test(e)}var ev=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function oR(e){return ev.lastIndex=0,ev.test(e)}var sR=-2147483648,iR=2147483647;function aR(e){return Number.isInteger(e)&&e<=iR&&e>=sR}function cR(e){return Number.isInteger(e)}function tv(){return!0}var uR=/[^\\]\\Z/;function lR(e){if(uR.test(e))return!1;try{return new RegExp(e),!0}catch(t){return!1}}});var dv=E(function(lv){Object.defineProperty(lv,"__esModule",{value:!0});lv.formatLimitDefinition=void 0;var uv=vc(),me=L(),Qt=me.operators,Os={formatMaximum:{okStr:"<=",ok:Qt.LTE,fail:Qt.GT},formatMinimum:{okStr:">=",ok:Qt.GTE,fail:Qt.LT},formatExclusiveMaximum:{okStr:"<",ok:Qt.LT,fail:Qt.GTE},formatExclusiveMinimum:{okStr:">",ok:Qt.GT,fail:Qt.LTE}},fR={message:({keyword:e,schemaCode:t})=>me.str`should be ${Os[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>me._`{comparison: ${Os[e].okStr}, limit: ${t}}`};lv.formatLimitDefinition={keyword:Object.keys(Os),type:"string",schemaType:"string",$data:!0,error:fR,code(e){let{gen:t,data:r,schemaCode:n,keyword:o,it:s}=e,{opts:i,self:a}=s;if(!i.validateFormats)return;let u=new uv.KeywordCxt(s,a.RULES.all.format.definition,"format");if(u.$data)c();else l();function c(){let m=t.scopeValue("formats",{ref:a.formats,code:i.code.formats}),f=t.const("fmt",me._`${m}[${u.schemaCode}]`);e.fail$data(me.or(me._`typeof ${f} != "object"`,me._`${f} instanceof RegExp`,me._`typeof ${f}.compare != "function"`,d(f)))}function l(){let m=u.schema,f=a.formats[m];if(!f||f===!0)return;if(typeof f!="object"||f instanceof RegExp||typeof f.compare!="function")throw Error(`"${o}": format "${m}" does not define "compare" function`);let p=t.scopeValue("formats",{key:m,ref:f,code:i.code.formats?me._`${i.code.formats}${me.getProperty(m)}`:void 0});e.fail$data(d(p))}function d(m){return me._`${m}.compare(${r}, ${n}) ${Os[o].fail} 0`}},dependencies:["format"]};var pR=(e)=>(e.addKeyword(lv.formatLimitDefinition),e);lv.default=pR});var hv=E(function(Ln,mv){Object.defineProperty(Ln,"__esModule",{value:!0});var Ge=cv(),hR=dv(),Kr=L(),fv=new Kr.Name("fullFormats"),gR=new Kr.Name("fastFormats"),Pc=(e,t={keywords:!0})=>{if(Array.isArray(t))return pv(e,t,Ge.fullFormats,fv),e;let[r,n]=t.mode==="fast"?[Ge.fastFormats,gR]:[Ge.fullFormats,fv],o=t.formats||Ge.formatNames;if(pv(e,o,r,n),t.keywords)(0,hR.default)(e);return e};Pc.get=(e,t="full")=>{let n=(t==="fast"?Ge.fastFormats:Ge.fullFormats)[e];if(!n)throw Error(`Unknown format "${e}"`);return n};function pv(e,t,r,n){var o,s;(o=(s=e.opts.code).formats)!==null&&o!==void 0||(s.formats=Kr._`require("ajv-formats/dist/formats").${n}`);for(let i of t)e.addFormat(i,r[i])}mv.exports=Ln=Pc;Object.defineProperty(Ln,"__esModule",{value:!0});Ln.default=Pc});function en(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 Qs(e,t="|"){return e.map((r)=>ri(r)).join(t)}function tn(e,t){if(typeof t==="bigint")return t.toString();return t}class Yc{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 rn(e){return new Yc(e)}function Qc(e){return e===null||e===void 0}function Vn(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function eu(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 nn(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function ht(e){return nn(e._zod.def)??e._zod.def.shape}function tu(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return Le(this,t,n),n},enumerable:!0,configurable:!0})}function ru(e,t,r){if(t in e)Le(e,t,r);else e[t]=r}function nr(e,t,r,n){let o=ht(t);for(let s of r){let i=Object.getOwnPropertyDescriptor(o,s);if(!i.enumerable)continue;if(i.get)tu(e,s,()=>{let a=t._zod.def.shape[s];return n?n(a,s):a});else ru(e,s,n?n(i.value,s):i.value)}}function Yv(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);if(!n.enumerable)continue;if(n.get)tu(e,r,()=>t[r]);else ru(e,r,n.value)}}function De(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function nu(e){return JSON.stringify(e)}function ou(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var ei="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function yr(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var su=rn(()=>{if(Re.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function or(e){if(yr(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(yr(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function ti(e){if(or(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 iu=new Set(["string","number","symbol"]);function kt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Xe(e,t,r){let n=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)n._zod.parent=e;return n}function O(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 ri(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function au(e){return Object.keys(e).filter((t)=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var Hn=(()=>({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]}))(),ni={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Qv(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 nr(s,e,Bn(e,t)),Xe(e,De(r,{shape:s,checks:[]}))}function Bn(e,t){let r=ht(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 eb(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(Bn(e,t)),i={};return nr(i,e,Reflect.ownKeys(ht(e)).filter((a)=>!s.has(a))),Xe(e,De(r,{shape:i,checks:[]}))}function tb(e,t){if(!or(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=ht(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 Xe(e,De(e._zod.def,{shape:cu(e,t)}))}function cu(e,t){let r={};return nr(r,e,Reflect.ownKeys(ht(e))),Yv(r,t),r}function rb(e,t){if(!or(t))throw Error("Invalid input to safeExtend: expected a plain object");return Xe(e,De(e._zod.def,{shape:cu(e,t)}))}function nb(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={};nr(r,e,Reflect.ownKeys(ht(e))),nr(r,t,Reflect.ownKeys(ht(t)));let n=De(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Xe(e,n)}function uu(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(Bn(t,r)):void 0,u={};return nr(u,t,Reflect.ownKeys(ht(t)),e&&((c,l)=>a&&!a.has(l)?c:new e({type:"optional",innerType:c}))),Xe(t,De(t._zod.def,{shape:u,checks:[]}))}function ob(e,t,r){let n=r?new Set(Bn(t,r)):void 0,o={};return nr(o,t,Reflect.ownKeys(ht(t)),(s,i)=>n&&!n.has(i)?s:new e({type:"nonoptional",innerType:s})),Xe(t,De(t._zod.def,{shape:o}))}function Qe(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 lu(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 Pt(e,t){return t.map((r)=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Qr(e){return typeof e==="string"?e:e?.message}function oi(e){let t=[];for(let r of e??[]){let n=r._zod.def;if(!/_(length|size)$|_equals$/.test(n.check))break;let o=n.maximum??n.length??n.size;if(o>=0)t.push([o,r])}return t}function Jn(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}function et(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:Qr(e.inst?._zod.def?.error?.(e))??Qr(s?.(e))??Qr(t?.error?.(e))??Qr(r.customError?.(e))??Qr(r.localeError?.(e))??"Invalid input",a={};for(let u of Object.keys(e)){if(u==="inst"||u==="schema"||u==="continue"||u==="input"||u==="__proto__")continue;a[u]=e[u]}if(a.path??(a.path=[]),a.message=i,t?.reportInput)a.input=e.input;return a}var sb=/[\uD800-\uDBFF]/;function Kn(e){let t=e.length;if(!sb.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 Wn(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function du(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 sr(...e){let[t,r,n]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:n};return{...t}}function fu(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);if(n.get)Object.defineProperty(e,r,{...n,enumerable:!1});else ib(e,r,n.value)}}function gt(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function Gn(e,t,r){return gt(e,t,r,!1)}function pu(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return gt(this,r,n(this))},set(o){gt(this,r,o)}})}return t}function ib(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:gt(this,t,r.bind(this))},set(n){gt(this,t,n)}})}function ab(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var Ys,St=!1,cb={configurable:!0,get(){St=!0;return}};function J(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&Ys!==e._zod){Ys=void 0;return}Ys=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,cb);let o=St;St=!1;try{let s=r(this);if(St)delete this[t];else Object.defineProperty(this,t,{configurable:!0,writable:!0,value:s});return St=St||o,s}catch(s){throw delete this[t],St=St||o,s}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function ub(e,t,r,n){let o=ab(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 lb="~constantCatch";function mu(e){let t=()=>e;return t[lb]=!0,t}var hu,ii=Object.freeze({status:"aborted"}),si={value:void 0,enumerable:!1},gu="captureStackTrace"in Error?Error:null;function db(e){let t=gu;if(t){let r=t.stackTraceLimit;if(typeof r==="number"){try{t.stackTraceLimit=0}catch{return gu=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function v(e,t,r,n){let o={};function s(m){this.def=m,this.constr=d,this.traits=new Set}s.prototype=o;let i=r,a=i&&new WeakSet;function u(m,f){if(!m._zod){si.value=new s(f);try{Object.defineProperty(m,"_zod",si)}finally{si.value=void 0}}else if(m._zod.traits.has(e))return;if(m._zod.traits.add(e),t(m,f),a){let g=Object.getPrototypeOf(m),_=m._zod.constr.prototype,y=g;while(y&&y!==_)y=Object.getPrototypeOf(y);let k=y??g;if(!a.has(k))a.add(k),fu(k,i)}let p=d.prototype;for(let g in p){if(!Object.prototype.hasOwnProperty.call(p,g))continue;if(!(g in m))m[g]=p[g].bind(m)}}let c=n?.Parent??Object;class l extends c{}Object.defineProperty(l,"name",{value:e});function d(m){let f=n?.Parent?db(l):this;u(f,m);let p=f._zod.deferred;if(p){for(let _ of p)_();f._zod.deferred=void 0}let g=globalThis.__zod_globalConfig?.postProcessor;if(g)g(f);return f}return Object.defineProperty(d,"init",{value:u}),Object.defineProperty(d,Symbol.hasInstance,{value:(m)=>{if(n?.Parent&&m instanceof n.Parent)return!0;return m?._zod?.traits?.has(e)}}),Object.defineProperty(d,"name",{value:e}),d}class tt extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class on extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(hu=globalThis).__zod_globalConfig??(hu.__zod_globalConfig={});var Re=globalThis.__zod_globalConfig;function Oe(e){if(e)Object.assign(Re,e);return Re}function fb(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,tn,2)),e.message}function pb(e){this._zod.message=e}var mb={get:fb,set:pb,enumerable:!0,configurable:!0},ci={value:void 0,enumerable:!1},_u=new WeakSet([Object.prototype,Error.prototype]),yu=(e,t)=>{e.name="$ZodError",ci.value=t,Object.defineProperty(e,"issues",ci),ci.value=void 0,Object.defineProperty(e,"message",mb);let r=Object.getPrototypeOf(e);if(!_u.has(r))_u.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})}})},vu=v("$ZodError",yu),bu=v("$ZodError",yu,void 0,{Parent:Error});function hb(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 ui(e,t=(r)=>r.message){let r={},n=[];for(let o of e.issues)if(o.path.length>0)hb(r,o.path[0],()=>[]).push(t(o));else n.push(t(o));return{formErrors:n,fieldErrors:r}}function li(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 u=r,c=0;while(c<a.length){let l=a[c],d=c===a.length-1;if(l==="_errors"){if(d)u._errors.push(t(i));c++;continue}if(!Object.prototype.hasOwnProperty.call(u,l))Object.defineProperty(u,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let m=u[l];if(d)m._errors.push(t(i));u=m,c++}}}};return n(e),r}function Xn(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Yn=(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 tt;if(a.issues.length){let u=new(s?.Err??e)(a.issues.map((c)=>et(c,i,Oe())));throw ei(u,s?.callee??t),u}return a.value};return t};var Qn=(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 u=new(s?.Err??e)(a.issues.map((c)=>et(c,i,Oe())));throw ei(u,s?.callee??t),u}return a.value};return t};var sn=(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 tt;return s.issues.length?wu(e,s.issues,o):{success:!0,data:s.value}},di=sn(bu);function wu(e,t,r){let n;return{success:!1,get error(){if(!n)n=new e(t.map((o)=>et(o,r,Oe()))),t=void 0,r=void 0;return n},set error(o){n=o,t=void 0,r=void 0}}}var eo=(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?wu(e,s.issues,o):{success:!0,data:s.value}};var _b=Symbol.for("zod.compile.invalid"),yb=Symbol.for("zod.compile.fallback"),to=(e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==_b)return!0;if(n.definite===!0&&r===void 0)return!1}return vb(e,t,r)};function vb(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,s;if(o)n[yb]=!0,s=o({value:t,issues:[]},n);else s=e._zod.run({value:t,issues:[]},n);if(s instanceof Promise)throw new tt;return s.issues.length===0}var ro=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},xu=(e)=>{let t=Yn(e),r=(n,o,s,i)=>{let a=s?{...s,direction:"backward"}:{direction:"backward"};return t(n,o,a,Xn(r,i))};return r};var $u=(e)=>{let t=Yn(e),r=(n,o,s,i)=>t(n,o,s,Xn(r,i));return r};var zu=(e)=>{let t=Qn(e),r=async(n,o,s,i)=>{let a=s?{...s,direction:"backward"}:{direction:"backward"};return await t(n,o,a,Xn(r,i))};return r};var Su=(e)=>{let t=Qn(e),r=async(n,o,s,i)=>await t(n,o,s,Xn(r,i));return r};var ku=(e)=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return sn(e)(t,r,o)};var Pu=(e)=>(t,r,n)=>sn(e)(t,r,n);var Eu=(e)=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return eo(e)(t,r,o)};var Tu=(e)=>async(t,r,n)=>eo(e)(t,r,n);var Ru=/^[cC][0-9a-z]{6,}$/,Ou=/^[0-9a-z]+$/,Iu=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Cu=/^[0-9a-vA-V]{20}$/,Au=/^[A-Za-z0-9]{27}$/,Nu=/^[a-zA-Z0-9_-]{21}$/;function ju(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Zu=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Du=/^([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})$/,pi=(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 Mu=/^(?:[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 bb="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function qu(){return new RegExp(bb,"u")}var Lu=/^(?:(?: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])$/,Uu=/^(([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 Fu=/^((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])$/,Vu=/^(([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])$/,Hu=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Bu=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var Ju=/^https?$/,Ku=/^\+[1-9]\d{6,14}$/;var Wu="(?:(?:\\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 wb(e){return new RegExp(`^${e}$`)}var Gu=wb(Wu);function fi(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 Xu(e){return new RegExp(`^${fi(e)}$`)}function Yu(e){let t=["Z"];if(e.offset)t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${fi({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,n=e.local?`${r}|${fi({precision:e.precision})}`:r;return new RegExp(`^${Wu}T(?:${n})$`)}var Qu=/^[\s\S]{0,}$/;var mi=/^-?\d+$/,an=/^-?\d+(?:\.\d+)?$/,el=/^(?:true|false)$/i,tl=/^null$/i;var rl=/^[^A-Z]*$/,nl=/^[^a-z]*$/;var we=v("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var hi=(e)=>{let t=e.value;return!Qc(t)&&t.length!==void 0},no={number:"number",bigint:"bigint",object:"date"},gi=v("$ZodCheckLessThan",(e,t)=>{we.init(e,t);let r=no[typeof t.value];e._zod.check=(n)=>{if(t.inclusive?n.value<=t.value:n.value<t.value)return;n.issues.push({origin:no[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})}}),_i=v("$ZodCheckGreaterThan",(e,t)=>{we.init(e,t);let r=no[typeof t.value];e._zod.check=(n)=>{if(t.inclusive?n.value>=t.value:n.value>t.value)return;n.issues.push({origin:no[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})}}),ol=v("$ZodCheckMultipleOf",(e,t)=>{we.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):eu(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})}}),sl=v("$ZodCheckNumberFormat",(e,t)=>{we.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,s]=Hn[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 il=v("$ZodCheckMaxLength",(e,t)=>{var r;we.init(e,t),(r=e._zod.def).when??(r.when=hi),e._zod.check=(n)=>{let o=n.value,s=o.length;if((typeof o==="string"&&s>t.maximum?Kn(o):s)<=t.maximum)return;let a=Wn(o);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),al=v("$ZodCheckMinLength",(e,t)=>{var r;we.init(e,t),(r=e._zod.def).when??(r.when=hi),e._zod.check=(n)=>{let o=n.value,s=o.length;if((typeof o==="string"&&s>=t.minimum&&s<t.minimum*2?Kn(o):s)>=t.minimum)return;let a=Wn(o);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),cl=v("$ZodCheckLengthEquals",(e,t)=>{var r;we.init(e,t),(r=e._zod.def).when??(r.when=hi),e._zod.check=(n)=>{let o=n.value,s=o.length,i=typeof o==="string"&&s>=t.length&&s<=t.length*2?Kn(o):s;if(i===t.length)return;let a=Wn(o),u=i>t.length;n.issues.push({origin:a,...u?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),cn=v("$ZodCheckStringFormat",(e,t)=>{var r,n;if(we.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=()=>{})}),ul=v("$ZodCheckRegex",(e,t)=>{cn.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})}}),ll=v("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=rl),cn.init(e,t)}),dl=v("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=nl),cn.init(e,t)}),fl=v("$ZodCheckIncludes",(e,t)=>{we.init(e,t);let r=kt(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})}}),pl=v("$ZodCheckStartsWith",(e,t)=>{we.init(e,t);let r=new RegExp(`^${kt(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})}}),ml=v("$ZodCheckEndsWith",(e,t)=>{we.init(e,t);let r=new RegExp(`.*${kt(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 hl=v("$ZodCheckOverwrite",(e,t)=>{we.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class yi{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(`
10
10
  `).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(", ")}) {
11
11
  ${t.join(`
12
12
  `)}
13
- };`)(...Object.values(this.closed))}}var _l={major:4,minor:6,patch:7};var ee=v("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=_l;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,u,c)=>{if(a.memo)return a;let l=Qe(a),d;for(let m of u){if(m._zod.def.when){if(lu(a))continue;if(!m._zod.def.when(a))continue}else if(l)continue;let f=a.issues.length,p=m._zod.check(a);if(p instanceof Promise&&c?.async===!1)throw new tt;if(d||p instanceof Promise)d=(d??Promise.resolve()).then(async()=>{if(await p,a.issues.length===f)return;if(Jn(a.issues,f,e),!l)l=Qe(a,f)});else{if(a.issues.length===f)continue;if(Jn(a.issues,f,e),!l)l=Qe(a,f)}}if(d)return d.then(()=>a);return a},i=(a,u,c)=>{if(Qe(a))return a.aborted=!0,a;let l=s(u,o,c);if(l instanceof Promise){if(c.async===!1)throw new tt;return l.then((d)=>e._zod.parse(d,c))}return e._zod.parse(l,c)};e._zod.run=(a,u)=>{if(u.skipChecks)return e._zod.parse(a,u);if(u.direction==="backward"){let l=e._zod.parse({value:a.value,issues:[]},{...u,skipChecks:!0});if(l instanceof Promise)return l.then((d)=>i(d,a,u));return i(l,a,u)}let c=e._zod.parse(a,u);if(c instanceof Promise){if(u.async===!1)throw new tt;return c.then((l)=>s(l,o,u))}return s(c,o,u)}}},{get "~standard"(){return Gn(this,"~standard",vi(this))},set "~standard"(e){gt(this,"~standard",e)}}),El=(e,t)=>e.issues.length?{issues:e.issues.map((r)=>et(r,t,Oe()))}:{value:e.value};async function xb(e,t){let r={async:!0};return El(await e._zod.run({value:t,issues:[]},r),r)}function vi(e){return{validate:(t)=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return El(n,r)}catch(n){}return xb(e,t)},vendor:"zod",version:1}}var ao=v("$ZodString",(e,t)=>{ee.init(e,t),e._zod.pattern=t.pattern??Qu,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}}),re=v("$ZodStringFormat",(e,t)=>{cn.init(e,t),ao.init(e,t)}),Tl=v("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Du),re.init(e,t)}),Rl=v("$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=fi(n))}else t.pattern??(t.pattern=fi());re.init(e,t)}),Ol=v("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Mu),re.init(e,t)}),Il=1,so=2;function Cl(e){try{if(typeof URL<"u"&&typeof URL.canParse==="function")return URL.canParse(e);return new URL(e),!0}catch{return!1}}function $b(e,t){if(!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t))return Cl(e)||so;return zb(e,t)}function zb(e,t){if(!t.normalize&&t.protocol?.source===Ju.source&&!/^https?:\/\//i.test(e))return Il;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse==="function")return r.parse(e)??so}return new URL(e)}catch{return so}}var Sb=/[\t\n\r]/g;function yl(e){return e.replace(Sb,"")}function kb(e,t){return t.lastIndex=0,t.test(e.hostname)}function Pb(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var Al=v("$ZodURL",(e,t)=>{re.init(e,t),e._zod.check=(r)=>{try{let n=r.value.trim(),o=$b(n,t);if(o===Il){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===so){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(o===!0){r.value=yl(n);return}if(t.hostname&&!kb(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&&!Pb(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:yl(n);return}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Nl=v("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=qu()),re.init(e,t)}),jl=v("$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?Nu:ju(t.length)),re.init(e,t)}),Zl=v("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Ru),re.init(e,t)}),Dl=v("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Ou),re.init(e,t)}),Ml=v("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Iu),re.init(e,t)}),ql=v("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Cu),re.init(e,t)}),Ll=v("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Au),re.init(e,t)}),Ul=v("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Yu(t)),re.init(e,t)}),Fl=v("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Gu),re.init(e,t)}),Vl=v("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Xu(t)),re.init(e,t)}),Hl=v("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Zu),re.init(e,t)}),Bl=v("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Lu),re.init(e,t)}),Eb=/^[0-9a-fA-F:.]+$/;function Jl(e){if(!Eb.test(e))return!1;return Cl(`http://[${e}]`)}var Kl=v("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Uu),re.init(e,t),e._zod.check=(r)=>{if(!Jl(r.value))r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var Wl=v("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Fu),re.init(e,t)});function Tb(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 Jl(r)}var Gl=v("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Vu),re.init(e,t),e._zod.check=(r)=>{if(!Tb(r.value))r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function Xl(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 bi=/^[0-9a-zA-Z+/]*={0,2}$/,Yl=v("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=bi),re.init(e,t),e._zod.check=(r)=>{if(Xl(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),co=/^[A-Za-z0-9_-]*$/;function Rb(e){if(!co.test(e))return!1;let t=e.replace(/[-_]/g,(n)=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Xl(r)}var Ql=v("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=co),re.init(e,t),e._zod.check=(r)=>{if(Rb(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),ed=v("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Ku),re.init(e,t)});function Ob(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 td=v("$ZodJWT",(e,t)=>{re.init(e,t),e._zod.check=(r)=>{if(Ob(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var wi=v("$ZodNumber",(e,t)=>{ee.init(e,t),e._zod.pattern=an,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}}),rd=v("$ZodNumberFormat",(e,t)=>{sl.init(e,t),wi.init(e,t)}),nd=v("$ZodBoolean",(e,t)=>{ee.init(e,t),e._zod.pattern=el,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 od=v("$ZodNull",(e,t)=>{ee.init(e,t),e._zod.pattern=tl,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}}),sd=v("$ZodAny",(e,t)=>{ee.init(e,t),e._zod.parse=(r)=>r}),id=v("$ZodUnknown",(e,t)=>{ee.init(e,t),e._zod.parse=(r)=>r}),ad=v("$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 Ib(e,t){let r=ni(e._zod.def.checks);if(!r.length)return;let n=Math.min(...r.map((s)=>s[0])),o=e._zod.parse;e._zod.parse=(s,i)=>{let a=t(s.value);if(a>n&&!i?.skipChecks&&i?.direction!=="backward"){for(let[u,c]of ni(e._zod.def.checks))if(a>u&&c._zod.def.when(s)){let l=s.issues.length;return c._zod.check(s),s.issues[l].continue=!1,Jn(s.issues,l,e),s}}return o(s,i)}}var Cb=(e)=>Array.isArray(e)?e.length:-1;function vl(e,t,r){if(e.issues.length)t.issues.push(...Pt(r,e.issues));t.value[r]=e.value}var cd=v("$ZodArray",(e,t)=>{ee.init(e,t);let r=Re.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 u=0;u<s.length;u++){let c=s[u],l=t.element._zod.run({value:c,issues:[]},o);if(l instanceof Promise)i.push(l.then((d)=>vl(d,n,u)));else if(vl(l,n,u),a&&l.issues.length!==0&&Qe(l))break}if(i.length)return Promise.all(i).then(()=>n);return n},Ib(e,Cb)});function io(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(...Pt(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 Ab=[];function ud(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:Ab,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=au(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(s)}}function ld(e,t,r,n,o,s,i){let a=[],u=o.keySet,c=o.catchall._zod,l=c.def.type,{optin:d,optout:m}=c,f=0;for(let p in t){if(i&&r.issues.length!==f){if(Qe(r,f))break;f=r.issues.length}if(u.has(p))continue;if(p==="__proto__"){if(l==="never")a.push(p);continue}if(l==="never"){a.push(p);continue}let g=c.run({value:t[p],issues:[]},n);if(g instanceof Promise)e.push(g.then((_)=>io(_,r,p,t,d,m)));else io(g,r,p,t,d,m)}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 Nb=v("$ZodObject",(e,t)=>{ee.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),n=r?.get?r.get.raw:t.shape??{};if(n){let c=()=>{let l={...n};return Object.defineProperty(t,"shape",{value:l}),c.raw=l,l};c.raw=n,Object.defineProperty(t,"shape",{get:c})}let o=rn(()=>ud(t));J(e,"propValues",(c)=>{let l=c.def.shape,d={};for(let m in l){let f=l[m]._zod;if(f.values){if(!Object.prototype.hasOwnProperty.call(d,m))Le(d,m,new Set);for(let p of f.values)d[m].add(p);if(f.optin!==void 0)d[m].add(void 0)}}return d});let s=yr,i=t.catchall,a,u=Re.memoizer;u?.attach(e),e._zod.parse=(c,l)=>{a??(a=o.value);let d=c.value;if(!s(d))return c.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),c;c.value=u?u.alloc(e,c,{},l):{};let m=[],f=a.shape,p=l?.abortEarly,g=c.issues.length;for(let _ of a.allKeys){if(p&&c.issues.length!==g){if(Qe(c,g))break;g=c.issues.length}if(_==="__proto__")continue;let y=f[_],k=y._zod.optin,C=y._zod.optout,U=y._zod.run({value:d[_],issues:[]},l);if(U instanceof Promise)m.push(U.then((b)=>io(b,c,_,d,k,C)));else io(U,c,_,d,k,C)}if(!i)return m.length?Promise.all(m).then(()=>c):c;return ld(m,d,c,l,o.value,e,p===!0)}}),dd=v("$ZodObjectJIT",(e,t)=>{Nb.init(e,t);let r=e._zod.parse,n=rn(()=>ud(t)),o=Re.memoizer,s=(f)=>{let p=n.value,g=p.symbolKeys,_=new _i(["payload","ctx"],{shape:f,inst:e,memo:o,syms:g}),y=(b)=>`shape[${b}]._zod.run({ value: input[${b}], issues: [] }, ctx)`,k=(b,x)=>`
13
+ };`)(...Object.values(this.closed))}}var _l={major:4,minor:6,patch:7};var ee=v("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=_l;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,u,c)=>{if(a.memo)return a;let l=Qe(a),d;for(let m of u){if(m._zod.def.when){if(lu(a))continue;if(!m._zod.def.when(a))continue}else if(l)continue;let f=a.issues.length,p=m._zod.check(a);if(p instanceof Promise&&c?.async===!1)throw new tt;if(d||p instanceof Promise)d=(d??Promise.resolve()).then(async()=>{if(await p,a.issues.length===f)return;if(Jn(a.issues,f,e),!l)l=Qe(a,f)});else{if(a.issues.length===f)continue;if(Jn(a.issues,f,e),!l)l=Qe(a,f)}}if(d)return d.then(()=>a);return a},i=(a,u,c)=>{if(Qe(a))return a.aborted=!0,a;let l=s(u,o,c);if(l instanceof Promise){if(c.async===!1)throw new tt;return l.then((d)=>e._zod.parse(d,c))}return e._zod.parse(l,c)};e._zod.run=(a,u)=>{if(u.skipChecks)return e._zod.parse(a,u);if(u.direction==="backward"){let l=e._zod.parse({value:a.value,issues:[]},{...u,skipChecks:!0});if(l instanceof Promise)return l.then((d)=>i(d,a,u));return i(l,a,u)}let c=e._zod.parse(a,u);if(c instanceof Promise){if(u.async===!1)throw new tt;return c.then((l)=>s(l,o,u))}return s(c,o,u)}}},{get "~standard"(){return Gn(this,"~standard",bi(this))},set "~standard"(e){gt(this,"~standard",e)}}),El=(e,t)=>e.issues.length?{issues:e.issues.map((r)=>et(r,t,Oe()))}:{value:e.value};async function xb(e,t){let r={async:!0};return El(await e._zod.run({value:t,issues:[]},r),r)}function bi(e){return{validate:(t)=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return El(n,r)}catch(n){}return xb(e,t)},vendor:"zod",version:1}}var ao=v("$ZodString",(e,t)=>{ee.init(e,t),e._zod.pattern=t.pattern??Qu,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}}),re=v("$ZodStringFormat",(e,t)=>{cn.init(e,t),ao.init(e,t)}),Tl=v("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Du),re.init(e,t)}),Rl=v("$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=pi(n))}else t.pattern??(t.pattern=pi());re.init(e,t)}),Ol=v("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Mu),re.init(e,t)}),Il=1,so=2;function Cl(e){try{if(typeof URL<"u"&&typeof URL.canParse==="function")return URL.canParse(e);return new URL(e),!0}catch{return!1}}function $b(e,t){if(!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t))return Cl(e)||so;return zb(e,t)}function zb(e,t){if(!t.normalize&&t.protocol?.source===Ju.source&&!/^https?:\/\//i.test(e))return Il;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse==="function")return r.parse(e)??so}return new URL(e)}catch{return so}}var Sb=/[\t\n\r]/g;function yl(e){return e.replace(Sb,"")}function kb(e,t){return t.lastIndex=0,t.test(e.hostname)}function Pb(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var Al=v("$ZodURL",(e,t)=>{re.init(e,t),e._zod.check=(r)=>{try{let n=r.value.trim(),o=$b(n,t);if(o===Il){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===so){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(o===!0){r.value=yl(n);return}if(t.hostname&&!kb(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&&!Pb(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:yl(n);return}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Nl=v("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=qu()),re.init(e,t)}),jl=v("$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?Nu:ju(t.length)),re.init(e,t)}),Zl=v("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Ru),re.init(e,t)}),Dl=v("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Ou),re.init(e,t)}),Ml=v("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Iu),re.init(e,t)}),ql=v("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Cu),re.init(e,t)}),Ll=v("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Au),re.init(e,t)}),Ul=v("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Yu(t)),re.init(e,t)}),Fl=v("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Gu),re.init(e,t)}),Vl=v("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Xu(t)),re.init(e,t)}),Hl=v("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Zu),re.init(e,t)}),Bl=v("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Lu),re.init(e,t)}),Eb=/^[0-9a-fA-F:.]+$/;function Jl(e){if(!Eb.test(e))return!1;return Cl(`http://[${e}]`)}var Kl=v("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Uu),re.init(e,t),e._zod.check=(r)=>{if(!Jl(r.value))r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var Wl=v("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Fu),re.init(e,t)});function Tb(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 Jl(r)}var Gl=v("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Vu),re.init(e,t),e._zod.check=(r)=>{if(!Tb(r.value))r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function Xl(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 wi=/^[0-9a-zA-Z+/]*={0,2}$/,Yl=v("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=wi),re.init(e,t),e._zod.check=(r)=>{if(Xl(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),co=/^[A-Za-z0-9_-]*$/;function Rb(e){if(!co.test(e))return!1;let t=e.replace(/[-_]/g,(n)=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Xl(r)}var Ql=v("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=co),re.init(e,t),e._zod.check=(r)=>{if(Rb(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),ed=v("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Ku),re.init(e,t)});function Ob(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 td=v("$ZodJWT",(e,t)=>{re.init(e,t),e._zod.check=(r)=>{if(Ob(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var xi=v("$ZodNumber",(e,t)=>{ee.init(e,t),e._zod.pattern=an,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}}),rd=v("$ZodNumberFormat",(e,t)=>{sl.init(e,t),xi.init(e,t)}),nd=v("$ZodBoolean",(e,t)=>{ee.init(e,t),e._zod.pattern=el,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 od=v("$ZodNull",(e,t)=>{ee.init(e,t),e._zod.pattern=tl,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}}),sd=v("$ZodAny",(e,t)=>{ee.init(e,t),e._zod.parse=(r)=>r}),id=v("$ZodUnknown",(e,t)=>{ee.init(e,t),e._zod.parse=(r)=>r}),ad=v("$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 Ib(e,t){let r=oi(e._zod.def.checks);if(!r.length)return;let n=Math.min(...r.map((s)=>s[0])),o=e._zod.parse;e._zod.parse=(s,i)=>{let a=t(s.value);if(a>n&&!i?.skipChecks&&i?.direction!=="backward"){for(let[u,c]of oi(e._zod.def.checks))if(a>u&&c._zod.def.when(s)){let l=s.issues.length;return c._zod.check(s),s.issues[l].continue=!1,Jn(s.issues,l,e),s}}return o(s,i)}}var Cb=(e)=>Array.isArray(e)?e.length:-1;function vl(e,t,r){if(e.issues.length)t.issues.push(...Pt(r,e.issues));t.value[r]=e.value}var cd=v("$ZodArray",(e,t)=>{ee.init(e,t);let r=Re.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 u=0;u<s.length;u++){let c=s[u],l=t.element._zod.run({value:c,issues:[]},o);if(l instanceof Promise)i.push(l.then((d)=>vl(d,n,u)));else if(vl(l,n,u),a&&l.issues.length!==0&&Qe(l))break}if(i.length)return Promise.all(i).then(()=>n);return n},Ib(e,Cb)});function io(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(...Pt(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 Ab=[];function ud(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:Ab,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=au(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(s)}}function ld(e,t,r,n,o,s,i){let a=[],u=o.keySet,c=o.catchall._zod,l=c.def.type,{optin:d,optout:m}=c,f=0;for(let p in t){if(i&&r.issues.length!==f){if(Qe(r,f))break;f=r.issues.length}if(u.has(p))continue;if(p==="__proto__"){if(l==="never")a.push(p);continue}if(l==="never"){a.push(p);continue}let g=c.run({value:t[p],issues:[]},n);if(g instanceof Promise)e.push(g.then((_)=>io(_,r,p,t,d,m)));else io(g,r,p,t,d,m)}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 Nb=v("$ZodObject",(e,t)=>{ee.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),n=r?.get?r.get.raw:t.shape??{};if(n){let c=()=>{let l={...n};return Object.defineProperty(t,"shape",{value:l}),c.raw=l,l};c.raw=n,Object.defineProperty(t,"shape",{get:c})}let o=rn(()=>ud(t));J(e,"propValues",(c)=>{let l=c.def.shape,d={};for(let m in l){let f=l[m]._zod;if(f.values){if(!Object.prototype.hasOwnProperty.call(d,m))Le(d,m,new Set);for(let p of f.values)d[m].add(p);if(f.optin!==void 0)d[m].add(void 0)}}return d});let s=yr,i=t.catchall,a,u=Re.memoizer;u?.attach(e),e._zod.parse=(c,l)=>{a??(a=o.value);let d=c.value;if(!s(d))return c.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),c;c.value=u?u.alloc(e,c,{},l):{};let m=[],f=a.shape,p=l?.abortEarly,g=c.issues.length;for(let _ of a.allKeys){if(p&&c.issues.length!==g){if(Qe(c,g))break;g=c.issues.length}if(_==="__proto__")continue;let y=f[_],k=y._zod.optin,C=y._zod.optout,U=y._zod.run({value:d[_],issues:[]},l);if(U instanceof Promise)m.push(U.then((b)=>io(b,c,_,d,k,C)));else io(U,c,_,d,k,C)}if(!i)return m.length?Promise.all(m).then(()=>c):c;return ld(m,d,c,l,o.value,e,p===!0)}}),dd=v("$ZodObjectJIT",(e,t)=>{Nb.init(e,t);let r=e._zod.parse,n=rn(()=>ud(t)),o=Re.memoizer,s=(f)=>{let p=n.value,g=p.symbolKeys,_=new yi(["payload","ctx"],{shape:f,inst:e,memo:o,syms:g}),y=(b)=>`shape[${b}]._zod.run({ value: input[${b}], issues: [] }, ctx)`,k=(b,x)=>`
14
14
  let ${b}_ab = false;
15
15
  for (let i = 0; i < ${b}.issues.length; i++) {
16
16
  const iss = ${b}.issues[i];
@@ -60,13 +60,13 @@ ${t.join(`
60
60
  if (${x}.value !== undefined || ${Y}) {
61
61
  newResult[${N}] = ${x}.value;
62
62
  }
63
- `)}return _.write("payload.value = newResult;"),_.write("return payload;"),_.compile()},i,a=yr,u=!Re.jitless,l=u&&su.value,d=t.catchall,m;e._zod.parse=(f,p)=>{m??(m=n.value);let g=f.value;if(!a(g))return f.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),f;if(u&&l&&p?.async===!1&&p.jitless!==!0){if(!i)i=s(t.shape);if(f=i(f,p),!d)return f;return ld([],g,f,p,m,e,p?.abortEarly===!0)}return r(f,p)}});function bl(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)=>!Qe(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)=>et(i,n,Oe())))}),t}var xi=v("$ZodUnion",(e,t)=>{ee.init(e,t),J(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),J(e,"optout",(n)=>n.def.options.some((o)=>o._zod.optout==="optional")?"optional":void 0),J(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}),J(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)=>Vn(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 u=a._zod.run({value:n.value,issues:[]},o);if(u instanceof Promise)i.push(u),s=!0;else{if(u.issues.length===0)return u;i.push(u)}}if(!s)return bl(i,n,e,o);return Promise.all(i).then((a)=>bl(a,n,e,o))}});function jb(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 fd=v("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,xi.init(e,t);let r=e._zod.parse;J(e,"propValues",(o)=>{let s={},i=0;for(let a of o.def.options){let u=a._zod.propValues;if(!u||Object.keys(u).length===0)throw Error(`Invalid discriminated union option at index "${o.def.options.indexOf(a)}"`);if(u[o.def.discriminator]?.has(void 0))i++;for(let[c,l]of Object.entries(u)){if(!Object.prototype.hasOwnProperty.call(s,c))Le(s,c,new Set);for(let d of l)s[c].add(d)}}if(!o.def.unionFallback&&i>1)s[o.def.discriminator]?.delete(void 0);return s}),t.options.forEach((o,s)=>{let i=nn(o._zod.def);if(i&&!Object.prototype.hasOwnProperty.call(i,t.discriminator))throw Error(`Invalid discriminated union option at index "${s}"`)});let n=rn(()=>jb(t));e._zod.parse=(o,s)=>{let i=o.value;if(!yr(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),o;let a=i?.[t.discriminator],u=n.value.get(a);if(u&&(a!==void 0||s.direction!=="backward"))return u._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((c)=>n.value.get(c)!==null),input:i,path:[t.discriminator],inst:e}),o}}),pd=v("$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(([u,c])=>wl(r,u,c));return wl(r,s,i)}});function yi(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(or(e)&&or(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=yi(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=yi(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 wl(e,t,r){let n=new Map,o,s=new Map,i=(c,l)=>{let d;if(c.code==="unrecognized_keys"&&!c.path?.length)o??(o=c),d=c.keys;else if(c.code==="invalid_key"&&c.origin==="record"&&c.path?.length===1){let m=String(c.path[0]);if(!s.has(m))s.set(m,c);d=[m]}else return!1;for(let m of d){if(!n.has(m))n.set(m,{});n.get(m)[l]=!0}return!0};for(let c of t.issues)if(!i(c,"l"))e.issues.push(c);for(let c of r.issues)if(!i(c,"r"))e.issues.push(c);let a=[...n].filter(([,c])=>c.l&&c.r).map(([c])=>c);if(a.length){let c=o?a.filter((l)=>o.keys.includes(l)):[];if(c.length)e.issues.push({...o,keys:c});for(let l of a)if(!c.includes(l)&&s.has(l))e.issues.push(s.get(l))}let u=yi(t.value,r.value);if(!u.valid){if(Qe(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(u.mergeErrorPath)}`)}return e.value=u.data,e}var md=v("$ZodRecord",(e,t)=>{ee.init(e,t);let r=Re.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let s=n.value;if(!or(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 u=new Set;for(let l of a)if(typeof l==="string"||typeof l==="number"||typeof l==="symbol"){if(u.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((p)=>et(p,o,Oe())),input:l,path:[l],inst:e});continue}let m=d.value;if(m==="__proto__")continue;let f=t.valueType._zod.run({value:s[l],issues:[]},o);if(f instanceof Promise)i.push(f.then((p)=>{if(p.issues.length)n.issues.push(...Pt(l,p.issues));n.value[m]=p.value}));else{if(f.issues.length)n.issues.push(...Pt(l,f.issues));n.value[m]=f.value}}let c;for(let l in s)if(!u.has(l))if(t.mode==="loose"){if(l==="__proto__")continue;n.value[l]=s[l]}else c=c??[],c.push(l);if(c&&c.length>0)n.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:c,continue:!0})}else{n.value=r?r.alloc(e,n,{},o):{};let u;for(let c of Reflect.ownKeys(s)){if(c==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(s,c))continue;let l=t.keyType._zod.run({value:c,issues:[]},o);if(l instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof c==="string"&&an.test(c)&&l.issues.length){let p=t.keyType._zod.run({value:Number(c),issues:[]},o);if(p instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(p.issues.length===0)l=p}if(l.issues.length){if(t.mode==="loose")n.value[c]=s[c];else if(a)u=u??[],u.push(c);else n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map((p)=>et(p,o,Oe())),input:c,path:[c],inst:e});continue}let m=l.value;if(m==="__proto__")continue;let f=t.valueType._zod.run({value:s[c],issues:[]},o);if(f instanceof Promise)i.push(f.then((p)=>{if(p.issues.length)n.issues.push(...Pt(c,p.issues));n.value[m]=p.value}));else{if(f.issues.length)n.issues.push(...Pt(c,f.issues));n.value[m]=f.value}}if(u&&u.length>0)n.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:u,continue:!0})}if(i.length)return Promise.all(i).then(()=>n);return n}});var hd=v("$ZodEnum",(e,t)=>{ee.init(e,t);let r=en(t.entries),n=new Set(r);e._zod.values=n,J(e,"pattern",(o)=>{let s=en(o.def.entries).filter((i)=>iu.has(typeof i));return new RegExp(s.length?`^(${s.map((i)=>kt(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}}),gd=v("$ZodLiteral",(e,t)=>{ee.init(e,t);let r=new Set(t.values);e._zod.values=r,J(e,"pattern",(n)=>{let o=n.def.values;return new RegExp(o.length?`^(${o.map((s)=>typeof s==="string"?kt(s):s?kt(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 _d=v("$ZodTransform",(e,t)=>{ee.init(e,t),e._zod.optin="optional",Re.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new on(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 tt;return r.value=o,r}});function xl(e,t){return e.value=t.issues.length?void 0:t.value,e}var $i=v("$ZodOptional",(e,t)=>{ee.init(e,t),J(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",J(e,"values",(r)=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),J(e,"pattern",(r)=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Vn(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)=>xl(r,s));return xl(r,o)}return t.innerType._zod.run(r,n)}}),yd=v("$ZodExactOptional",(e,t)=>{$i.init(e,t),J(e,"values",(r)=>r.def.innerType._zod.values),J(e,"pattern",(r)=>r.def.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),vd=v("$ZodNullable",(e,t)=>{ee.init(e,t),J(e,"optin",(r)=>r.def.innerType._zod.optin),J(e,"optout",(r)=>r.def.innerType._zod.optout),J(e,"pattern",(r)=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Vn(n.source)}|null)$`):void 0}),J(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)}}),bd=v("$ZodDefault",(e,t)=>{ee.init(e,t),e._zod.optin="defaulted",J(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)=>$l(s,t));return $l(o,t)}});function $l(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var wd=v("$ZodPrefault",(e,t)=>{ee.init(e,t),e._zod.optin="defaulted",J(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)}}),xd=v("$ZodNonOptional",(e,t)=>{ee.init(e,t),J(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)=>zl(s,e));return zl(o,e)}});function zl(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 Sl(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)=>et(o,n,Oe()))},input:e.value}),e}var $d=v("$ZodCatch",(e,t)=>{ee.init(e,t),J(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),J(e,"optout",(r)=>r.def.innerType._zod.optout),J(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)=>Sl(r,s,t,n));return Sl(r,o,t,n)}});var zi=v("$ZodPipe",(e,t)=>{ee.init(e,t),J(e,"values",(r)=>r.def.in._zod.values),J(e,"optin",(r)=>r.def.in._zod.optin),J(e,"optout",(r)=>r.def.out._zod.optout),J(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)=>oo(i,t.in,n));return oo(s,t.in,n)}let o=t.in._zod.run(r,n);if(o instanceof Promise)return o.then((s)=>oo(s,t.out,n));return oo(o,t.out,n)}});function oo(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 zd=v("$ZodPreprocess",(e,t)=>{zi.init(e,t)}),Sd=v("$ZodReadonly",(e,t)=>{ee.init(e,t),J(e,"propValues",(r)=>r.def.innerType._zod.propValues),J(e,"values",(r)=>r.def.innerType._zod.values),J(e,"optin",(r)=>r.def.innerType?._zod?.optin),J(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(kl);return kl(o)}});function kl(e){if(!e.memo)e.value=Object.freeze(e.value);return e}var kd=v("$ZodCustom",(e,t)=>{we.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)=>Pl(s,r,n,e));Pl(o,r,n,e);return}});function Pl(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(sr(o))}}class Ed extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var ki="~memo",Pd=[];function Td(e){return e!==null&&typeof e==="object"}function Si(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}var Rd=new WeakMap,un=0,fo=1,ln=2;function po(e,t,r){let n=Rd.get(e);if(n!==void 0)return n?ln:un;if(t.has(e))return ln;t.add(e);let o=un,s=(l)=>{if(o!==ln&&l?._zod){let d=po(l,t,r);if(d>o)o=d}},i=(l,d)=>{let m=un;for(let f of Reflect.ownKeys(l)){let p=Object.getOwnPropertyDescriptor(l,f);if(d&&!p.enumerable)continue;let g=p.get?fo:p.value?._zod?po(p.value,t,r):un;if(g>m)m=g}return m},a=(l)=>{if(l>o)o=l},u=e._zod.def,c=u.type;switch(c){case"object":{let l=nn(u);a(l?i(l,!0):fo),s(u.catchall);break}case"array":s(u.element);break;case"tuple":for(let l of u.items)s(l);s(u.rest);break;case"record":case"map":s(u.keyType),s(u.valueType);break;case"set":s(u.valueType);break;case"union":for(let l of u.options)s(l);break;case"intersection":s(u.left),s(u.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":s(u.innerType);break;case"pipe":s(u.in),s(u.out);break;case"function":s(u.input),s(u.output);break;case"lazy":{let l=u._cachedInner??(r?e._zod.innerType:void 0);a(l?po(l,t,!1):fo);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 u){let d=Object.getOwnPropertyDescriptor(u,l);if(!d||d.get)continue;let m=d.value;if(!m||typeof m!=="object")continue;if(m._zod)s(m);else if(Array.isArray(m))for(let f of m)s(f)}}return t.delete(e),Zb(e,o)}function Zb(e,t){if(t!==fo)Rd.set(e,t===ln);return t}function Db(e,t){let r=e.buckets.get(t);if(!r)r=new WeakMap,e.buckets.set(t,r);return r}var uo,lo=[],Mb={alloc(e,t,r){let n=uo;if(!n)return r;uo=void 0;let o={value:r,issues:null};return n.set(t.value,o),lo.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"&&qb(s,o.value))throw new Ed;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=(u,c)=>{if(r===void 0){let y=po(e,new Set,!1);if(y===un){if(e._zod.parse=i,e._zod.run===a)e._zod.run=i;return i(u,c)}if(y===ln||n)r=!0;else n=!0}let l=u.value;if(!Td(l))return i(u,c);let d=c[ki];if(!d)d={buckets:new WeakMap,backEdges:void 0},c[ki]=d;let m;if(o===c)m=s;else m=Db(d,e),o=c,s=m;let f=m.get(l);if(f){if(u.value=f.value,f.issues){if(f.issues.length)u.issues.push(...Si(f.issues))}else u.memo=!0,d.backEdges??(d.backEdges=new WeakSet),d.backEdges.add(f.value);return u}uo=m;let p=lo.length,g=i(u,c);uo=void 0;let _=lo.length>p?lo.pop():void 0;if(g instanceof Promise)return g.then((y)=>{if(_)_.issues=y.issues.length?Si(y.issues):Pd;return y});if(_)_.issues=g.issues.length?Si(g.issues):Pd;return g};if(e._zod.parse=a,e._zod.run===i)e._zod.run=a})}};function Pi(){return Mb}function qb(e,t){let r=e[ki]?.backEdges;return r!==void 0&&Td(t)&&r.has(t)}var Lb=()=>{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=du(s.input),u=o(a,s.input);return`Invalid input: expected ${i}, received ${u}`}case"invalid_value":if(s.values.length===1)return`Invalid input: expected ${ti(s.values[0])}`;return`Invalid option: expected one of ${Ys(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":""}: ${Ys(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 Ei(){return{localeError:Lb()}}var Od;class Id{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 Cd(){return new Id}(Od=globalThis).__zod_globalRegistry??(Od.__zod_globalRegistry=Cd());var Et=globalThis.__zod_globalRegistry;function Ti(e){if(e.checks)e.checks=[...e.checks];return e}function Ad(e,t){return new e(Ti({type:"string",...O(t)}))}function Nd(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...O(t)})}function jd(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...O(t)})}function Zd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...O(t)})}function Dd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...O(t)})}function Md(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...O(t)})}function qd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...O(t)})}function Ri(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...O(t)})}function Ld(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...O(t)})}function Ud(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...O(t)})}function Fd(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...O(t)})}function Vd(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...O(t)})}function Hd(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...O(t)})}function Bd(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...O(t)})}function Jd(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...O(t)})}function Kd(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...O(t)})}function Wd(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...O(t)})}function Gd(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...O(t)})}function Xd(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...O(t)})}function Yd(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...O(t)})}function Qd(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...O(t)})}function ef(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...O(t)})}function tf(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...O(t)})}function mo(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...O(t)})}function Oi(e,t){return new e({type:"string",format:"date",check:"string_format",...O(t)})}function Ii(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...O(t)})}function Ci(e,t){return new e({type:"string",format:"duration",check:"string_format",...O(t)})}function rf(e,t){return new e(Ti({type:"number",checks:[],...O(t)}))}function nf(e,t){return new e(Ti({type:"number",coerce:!0,checks:[],...O(t)}))}function of(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...O(t)})}function sf(e,t){return new e({type:"boolean",...O(t)})}function af(e,t){return new e({type:"null",...O(t)})}function cf(e){return new e({type:"any"})}function uf(e){return new e({type:"unknown"})}function lf(e,t){return new e({type:"never",...O(t)})}function ho(e,t){return new hi({check:"less_than",...O(t),value:e,inclusive:!1})}function dn(e,t){return new hi({check:"less_than",...O(t),value:e,inclusive:!0})}function go(e,t){return new gi({check:"greater_than",...O(t),value:e,inclusive:!1})}function fn(e,t){return new gi({check:"greater_than",...O(t),value:e,inclusive:!0})}function _o(e,t){return new ol({check:"multiple_of",...O(t),value:e})}function yo(e,t){return new il({check:"max_length",...O(t),maximum:e})}function br(e,t){return new al({check:"min_length",...O(t),minimum:e})}function vo(e,t){return new cl({check:"length_equals",...O(t),length:e})}function Ai(e,t){return new ul({check:"string_format",format:"regex",...O(t),pattern:e})}function Ni(e){return new ll({check:"string_format",format:"lowercase",...O(e)})}function ji(e){return new dl({check:"string_format",format:"uppercase",...O(e)})}function Zi(e,t){return new fl({check:"string_format",format:"includes",...O(t),includes:e})}function Di(e,t){return new pl({check:"string_format",format:"starts_with",...O(t),prefix:e})}function Mi(e,t){return new ml({check:"string_format",format:"ends_with",...O(t),suffix:e})}function Tt(e){return new hl({check:"overwrite",tx:e})}function qi(e){return Tt((t)=>t.normalize(e))}function Li(){return Tt((e)=>e.trim())}function Ui(){return Tt((e)=>e.toLowerCase())}function Fi(){return Tt((e)=>e.toUpperCase())}function Vi(){return Tt((e)=>ou(e))}function df(e,t,r){return new e({type:"array",element:t,...O(r)})}function ff(e,t,r){let n=O(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function pf(e,t,r){return new e({type:"custom",check:"custom",fn:t,...O(r)})}function mf(e,t){let r=Ub((n)=>(n.addIssue=(o)=>{if(typeof o==="string")n.issues.push(sr(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(sr(s))}},e(n.value,n)),t);return r}function Ub(e,t){let r=new we({check:"custom",...O(t)});return r._zod.check=e,r}function pn(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 Bi(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??Et,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 _t(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 he(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 m=i.schema,f=t.processors[o.type];if(!f)throw Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);f(e,t,m,l)}let d=e._zod.parent;if(d){if(!i.ref)i.ref=d;he(d,t,l),t.seen.get(d).isParent=!0}}let u=t.metadataRegistry.get(e);if(u)pn(i.schema,u);if(t.io==="input"&&Pe(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 hf(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Ji(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 u=n.get(a);if(u&&u!==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,m=e.external.uri??((p)=>p);if(d)return{ref:m(d)};let f=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=f,{defId:f,ref:`${m("__shared")}#/${a}/${hf(f)}`}}let u="#",c=`${u}/${a}/`;if(i[1]===r&&!i[1].schema.id)return{ref:u};let l=i[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:c+hf(l)}},s=(i)=>{if(i[1].schema.$ref)return;let a=i[1],{ref:u,defId:c}=o(i);if(a.def={...a.schema},c)a.defId=c;let l=a.schema;for(let d in l)delete l[d];l.$ref=u};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>
63
+ `)}return _.write("payload.value = newResult;"),_.write("return payload;"),_.compile()},i,a=yr,u=!Re.jitless,l=u&&su.value,d=t.catchall,m;e._zod.parse=(f,p)=>{m??(m=n.value);let g=f.value;if(!a(g))return f.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),f;if(u&&l&&p?.async===!1&&p.jitless!==!0){if(!i)i=s(t.shape);if(f=i(f,p),!d)return f;return ld([],g,f,p,m,e,p?.abortEarly===!0)}return r(f,p)}});function bl(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)=>!Qe(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)=>et(i,n,Oe())))}),t}var $i=v("$ZodUnion",(e,t)=>{ee.init(e,t),J(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),J(e,"optout",(n)=>n.def.options.some((o)=>o._zod.optout==="optional")?"optional":void 0),J(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}),J(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)=>Vn(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 u=a._zod.run({value:n.value,issues:[]},o);if(u instanceof Promise)i.push(u),s=!0;else{if(u.issues.length===0)return u;i.push(u)}}if(!s)return bl(i,n,e,o);return Promise.all(i).then((a)=>bl(a,n,e,o))}});function jb(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 fd=v("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,$i.init(e,t);let r=e._zod.parse;J(e,"propValues",(o)=>{let s={},i=0;for(let a of o.def.options){let u=a._zod.propValues;if(!u||Object.keys(u).length===0)throw Error(`Invalid discriminated union option at index "${o.def.options.indexOf(a)}"`);if(u[o.def.discriminator]?.has(void 0))i++;for(let[c,l]of Object.entries(u)){if(!Object.prototype.hasOwnProperty.call(s,c))Le(s,c,new Set);for(let d of l)s[c].add(d)}}if(!o.def.unionFallback&&i>1)s[o.def.discriminator]?.delete(void 0);return s}),t.options.forEach((o,s)=>{let i=nn(o._zod.def);if(i&&!Object.prototype.hasOwnProperty.call(i,t.discriminator))throw Error(`Invalid discriminated union option at index "${s}"`)});let n=rn(()=>jb(t));e._zod.parse=(o,s)=>{let i=o.value;if(!yr(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),o;let a=i?.[t.discriminator],u=n.value.get(a);if(u&&(a!==void 0||s.direction!=="backward"))return u._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((c)=>n.value.get(c)!==null),input:i,path:[t.discriminator],inst:e}),o}}),pd=v("$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(([u,c])=>wl(r,u,c));return wl(r,s,i)}});function vi(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(or(e)&&or(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=vi(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=vi(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 wl(e,t,r){let n=new Map,o,s=new Map,i=(c,l)=>{let d;if(c.code==="unrecognized_keys"&&!c.path?.length)o??(o=c),d=c.keys;else if(c.code==="invalid_key"&&c.origin==="record"&&c.path?.length===1){let m=String(c.path[0]);if(!s.has(m))s.set(m,c);d=[m]}else return!1;for(let m of d){if(!n.has(m))n.set(m,{});n.get(m)[l]=!0}return!0};for(let c of t.issues)if(!i(c,"l"))e.issues.push(c);for(let c of r.issues)if(!i(c,"r"))e.issues.push(c);let a=[...n].filter(([,c])=>c.l&&c.r).map(([c])=>c);if(a.length){let c=o?a.filter((l)=>o.keys.includes(l)):[];if(c.length)e.issues.push({...o,keys:c});for(let l of a)if(!c.includes(l)&&s.has(l))e.issues.push(s.get(l))}let u=vi(t.value,r.value);if(!u.valid){if(Qe(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(u.mergeErrorPath)}`)}return e.value=u.data,e}var md=v("$ZodRecord",(e,t)=>{ee.init(e,t);let r=Re.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let s=n.value;if(!or(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 u=new Set;for(let l of a)if(typeof l==="string"||typeof l==="number"||typeof l==="symbol"){if(u.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((p)=>et(p,o,Oe())),input:l,path:[l],inst:e});continue}let m=d.value;if(m==="__proto__")continue;let f=t.valueType._zod.run({value:s[l],issues:[]},o);if(f instanceof Promise)i.push(f.then((p)=>{if(p.issues.length)n.issues.push(...Pt(l,p.issues));n.value[m]=p.value}));else{if(f.issues.length)n.issues.push(...Pt(l,f.issues));n.value[m]=f.value}}let c;for(let l in s)if(!u.has(l))if(t.mode==="loose"){if(l==="__proto__")continue;n.value[l]=s[l]}else c=c??[],c.push(l);if(c&&c.length>0)n.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:c,continue:!0})}else{n.value=r?r.alloc(e,n,{},o):{};let u;for(let c of Reflect.ownKeys(s)){if(c==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(s,c))continue;let l=t.keyType._zod.run({value:c,issues:[]},o);if(l instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof c==="string"&&an.test(c)&&l.issues.length){let p=t.keyType._zod.run({value:Number(c),issues:[]},o);if(p instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(p.issues.length===0)l=p}if(l.issues.length){if(t.mode==="loose")n.value[c]=s[c];else if(a)u=u??[],u.push(c);else n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map((p)=>et(p,o,Oe())),input:c,path:[c],inst:e});continue}let m=l.value;if(m==="__proto__")continue;let f=t.valueType._zod.run({value:s[c],issues:[]},o);if(f instanceof Promise)i.push(f.then((p)=>{if(p.issues.length)n.issues.push(...Pt(c,p.issues));n.value[m]=p.value}));else{if(f.issues.length)n.issues.push(...Pt(c,f.issues));n.value[m]=f.value}}if(u&&u.length>0)n.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:u,continue:!0})}if(i.length)return Promise.all(i).then(()=>n);return n}});var hd=v("$ZodEnum",(e,t)=>{ee.init(e,t);let r=en(t.entries),n=new Set(r);e._zod.values=n,J(e,"pattern",(o)=>{let s=en(o.def.entries).filter((i)=>iu.has(typeof i));return new RegExp(s.length?`^(${s.map((i)=>kt(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}}),gd=v("$ZodLiteral",(e,t)=>{ee.init(e,t);let r=new Set(t.values);e._zod.values=r,J(e,"pattern",(n)=>{let o=n.def.values;return new RegExp(o.length?`^(${o.map((s)=>typeof s==="string"?kt(s):s?kt(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 _d=v("$ZodTransform",(e,t)=>{ee.init(e,t),e._zod.optin="optional",Re.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new on(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 tt;return r.value=o,r}});function xl(e,t){return e.value=t.issues.length?void 0:t.value,e}var zi=v("$ZodOptional",(e,t)=>{ee.init(e,t),J(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",J(e,"values",(r)=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),J(e,"pattern",(r)=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Vn(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)=>xl(r,s));return xl(r,o)}return t.innerType._zod.run(r,n)}}),yd=v("$ZodExactOptional",(e,t)=>{zi.init(e,t),J(e,"values",(r)=>r.def.innerType._zod.values),J(e,"pattern",(r)=>r.def.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),vd=v("$ZodNullable",(e,t)=>{ee.init(e,t),J(e,"optin",(r)=>r.def.innerType._zod.optin),J(e,"optout",(r)=>r.def.innerType._zod.optout),J(e,"pattern",(r)=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Vn(n.source)}|null)$`):void 0}),J(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)}}),bd=v("$ZodDefault",(e,t)=>{ee.init(e,t),e._zod.optin="defaulted",J(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)=>$l(s,t));return $l(o,t)}});function $l(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var wd=v("$ZodPrefault",(e,t)=>{ee.init(e,t),e._zod.optin="defaulted",J(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)}}),xd=v("$ZodNonOptional",(e,t)=>{ee.init(e,t),J(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)=>zl(s,e));return zl(o,e)}});function zl(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 Sl(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)=>et(o,n,Oe()))},input:e.value}),e}var $d=v("$ZodCatch",(e,t)=>{ee.init(e,t),J(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),J(e,"optout",(r)=>r.def.innerType._zod.optout),J(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)=>Sl(r,s,t,n));return Sl(r,o,t,n)}});var Si=v("$ZodPipe",(e,t)=>{ee.init(e,t),J(e,"values",(r)=>r.def.in._zod.values),J(e,"optin",(r)=>r.def.in._zod.optin),J(e,"optout",(r)=>r.def.out._zod.optout),J(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)=>oo(i,t.in,n));return oo(s,t.in,n)}let o=t.in._zod.run(r,n);if(o instanceof Promise)return o.then((s)=>oo(s,t.out,n));return oo(o,t.out,n)}});function oo(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 zd=v("$ZodPreprocess",(e,t)=>{Si.init(e,t)}),Sd=v("$ZodReadonly",(e,t)=>{ee.init(e,t),J(e,"propValues",(r)=>r.def.innerType._zod.propValues),J(e,"values",(r)=>r.def.innerType._zod.values),J(e,"optin",(r)=>r.def.innerType?._zod?.optin),J(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(kl);return kl(o)}});function kl(e){if(!e.memo)e.value=Object.freeze(e.value);return e}var kd=v("$ZodCustom",(e,t)=>{we.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)=>Pl(s,r,n,e));Pl(o,r,n,e);return}});function Pl(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(sr(o))}}class Ed extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var Pi="~memo",Pd=[];function Td(e){return e!==null&&typeof e==="object"}function ki(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}var Rd=new WeakMap,un=0,fo=1,ln=2;function po(e,t,r){let n=Rd.get(e);if(n!==void 0)return n?ln:un;if(t.has(e))return ln;t.add(e);let o=un,s=(l)=>{if(o!==ln&&l?._zod){let d=po(l,t,r);if(d>o)o=d}},i=(l,d)=>{let m=un;for(let f of Reflect.ownKeys(l)){let p=Object.getOwnPropertyDescriptor(l,f);if(d&&!p.enumerable)continue;let g=p.get?fo:p.value?._zod?po(p.value,t,r):un;if(g>m)m=g}return m},a=(l)=>{if(l>o)o=l},u=e._zod.def,c=u.type;switch(c){case"object":{let l=nn(u);a(l?i(l,!0):fo),s(u.catchall);break}case"array":s(u.element);break;case"tuple":for(let l of u.items)s(l);s(u.rest);break;case"record":case"map":s(u.keyType),s(u.valueType);break;case"set":s(u.valueType);break;case"union":for(let l of u.options)s(l);break;case"intersection":s(u.left),s(u.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":s(u.innerType);break;case"pipe":s(u.in),s(u.out);break;case"function":s(u.input),s(u.output);break;case"lazy":{let l=u._cachedInner??(r?e._zod.innerType:void 0);a(l?po(l,t,!1):fo);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 u){let d=Object.getOwnPropertyDescriptor(u,l);if(!d||d.get)continue;let m=d.value;if(!m||typeof m!=="object")continue;if(m._zod)s(m);else if(Array.isArray(m))for(let f of m)s(f)}}return t.delete(e),Zb(e,o)}function Zb(e,t){if(t!==fo)Rd.set(e,t===ln);return t}function Db(e,t){let r=e.buckets.get(t);if(!r)r=new WeakMap,e.buckets.set(t,r);return r}var uo,lo=[],Mb={alloc(e,t,r){let n=uo;if(!n)return r;uo=void 0;let o={value:r,issues:null};return n.set(t.value,o),lo.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"&&qb(s,o.value))throw new Ed;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=(u,c)=>{if(r===void 0){let y=po(e,new Set,!1);if(y===un){if(e._zod.parse=i,e._zod.run===a)e._zod.run=i;return i(u,c)}if(y===ln||n)r=!0;else n=!0}let l=u.value;if(!Td(l))return i(u,c);let d=c[Pi];if(!d)d={buckets:new WeakMap,backEdges:void 0},c[Pi]=d;let m;if(o===c)m=s;else m=Db(d,e),o=c,s=m;let f=m.get(l);if(f){if(u.value=f.value,f.issues){if(f.issues.length)u.issues.push(...ki(f.issues))}else u.memo=!0,d.backEdges??(d.backEdges=new WeakSet),d.backEdges.add(f.value);return u}uo=m;let p=lo.length,g=i(u,c);uo=void 0;let _=lo.length>p?lo.pop():void 0;if(g instanceof Promise)return g.then((y)=>{if(_)_.issues=y.issues.length?ki(y.issues):Pd;return y});if(_)_.issues=g.issues.length?ki(g.issues):Pd;return g};if(e._zod.parse=a,e._zod.run===i)e._zod.run=a})}};function Ei(){return Mb}function qb(e,t){let r=e[Pi]?.backEdges;return r!==void 0&&Td(t)&&r.has(t)}var Lb=()=>{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=du(s.input),u=o(a,s.input);return`Invalid input: expected ${i}, received ${u}`}case"invalid_value":if(s.values.length===1)return`Invalid input: expected ${ri(s.values[0])}`;return`Invalid option: expected one of ${Qs(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":""}: ${Qs(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 Ti(){return{localeError:Lb()}}var Od;class Id{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 Cd(){return new Id}(Od=globalThis).__zod_globalRegistry??(Od.__zod_globalRegistry=Cd());var Et=globalThis.__zod_globalRegistry;function Ri(e){if(e.checks)e.checks=[...e.checks];return e}function Ad(e,t){return new e(Ri({type:"string",...O(t)}))}function Nd(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...O(t)})}function jd(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...O(t)})}function Zd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...O(t)})}function Dd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...O(t)})}function Md(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...O(t)})}function qd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...O(t)})}function Oi(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...O(t)})}function Ld(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...O(t)})}function Ud(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...O(t)})}function Fd(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...O(t)})}function Vd(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...O(t)})}function Hd(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...O(t)})}function Bd(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...O(t)})}function Jd(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...O(t)})}function Kd(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...O(t)})}function Wd(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...O(t)})}function Gd(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...O(t)})}function Xd(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...O(t)})}function Yd(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...O(t)})}function Qd(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...O(t)})}function ef(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...O(t)})}function tf(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...O(t)})}function mo(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...O(t)})}function Ii(e,t){return new e({type:"string",format:"date",check:"string_format",...O(t)})}function Ci(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...O(t)})}function Ai(e,t){return new e({type:"string",format:"duration",check:"string_format",...O(t)})}function rf(e,t){return new e(Ri({type:"number",checks:[],...O(t)}))}function nf(e,t){return new e(Ri({type:"number",coerce:!0,checks:[],...O(t)}))}function of(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...O(t)})}function sf(e,t){return new e({type:"boolean",...O(t)})}function af(e,t){return new e({type:"null",...O(t)})}function cf(e){return new e({type:"any"})}function uf(e){return new e({type:"unknown"})}function lf(e,t){return new e({type:"never",...O(t)})}function ho(e,t){return new gi({check:"less_than",...O(t),value:e,inclusive:!1})}function dn(e,t){return new gi({check:"less_than",...O(t),value:e,inclusive:!0})}function go(e,t){return new _i({check:"greater_than",...O(t),value:e,inclusive:!1})}function fn(e,t){return new _i({check:"greater_than",...O(t),value:e,inclusive:!0})}function _o(e,t){return new ol({check:"multiple_of",...O(t),value:e})}function yo(e,t){return new il({check:"max_length",...O(t),maximum:e})}function br(e,t){return new al({check:"min_length",...O(t),minimum:e})}function vo(e,t){return new cl({check:"length_equals",...O(t),length:e})}function Ni(e,t){return new ul({check:"string_format",format:"regex",...O(t),pattern:e})}function ji(e){return new ll({check:"string_format",format:"lowercase",...O(e)})}function Zi(e){return new dl({check:"string_format",format:"uppercase",...O(e)})}function Di(e,t){return new fl({check:"string_format",format:"includes",...O(t),includes:e})}function Mi(e,t){return new pl({check:"string_format",format:"starts_with",...O(t),prefix:e})}function qi(e,t){return new ml({check:"string_format",format:"ends_with",...O(t),suffix:e})}function Tt(e){return new hl({check:"overwrite",tx:e})}function Li(e){return Tt((t)=>t.normalize(e))}function Ui(){return Tt((e)=>e.trim())}function Fi(){return Tt((e)=>e.toLowerCase())}function Vi(){return Tt((e)=>e.toUpperCase())}function Hi(){return Tt((e)=>ou(e))}function df(e,t,r){return new e({type:"array",element:t,...O(r)})}function ff(e,t,r){let n=O(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function pf(e,t,r){return new e({type:"custom",check:"custom",fn:t,...O(r)})}function mf(e,t){let r=Ub((n)=>(n.addIssue=(o)=>{if(typeof o==="string")n.issues.push(sr(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(sr(s))}},e(n.value,n)),t);return r}function Ub(e,t){let r=new we({check:"custom",...O(t)});return r._zod.check=e,r}function pn(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 Ji(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??Et,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 _t(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 he(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 m=i.schema,f=t.processors[o.type];if(!f)throw Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);f(e,t,m,l)}let d=e._zod.parent;if(d){if(!i.ref)i.ref=d;he(d,t,l),t.seen.get(d).isParent=!0}}let u=t.metadataRegistry.get(e);if(u)pn(i.schema,u);if(t.io==="input"&&Pe(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 hf(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Ki(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 u=n.get(a);if(u&&u!==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,m=e.external.uri??((p)=>p);if(d)return{ref:m(d)};let f=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=f,{defId:f,ref:`${m("__shared")}#/${a}/${hf(f)}`}}let u="#",c=`${u}/${a}/`;if(i[1]===r&&!i[1].schema.id)return{ref:u};let l=i[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:c+hf(l)}},s=(i)=>{if(i[1].schema.$ref)return;let a=i[1],{ref:u,defId:c}=o(i);if(a.def={...a.schema},c)a.defId=c;let l=a.schema;for(let d in l)delete l[d];l.$ref=u};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>
64
64
 
65
- 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 c=e.external.registry.get(i[0])?.id;if(t!==i[0]&&c){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 yf(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;yf(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 vf=new Set(["type","properties","required","additionalProperties"]),gf=["oneOf","anyOf"];function _f(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 Hi(e){let t=[];for(let s of e){if(typeof s!=="object"||s.type!=="object")return null;for(let i in s)if(!vf.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 c of t){let l=c.properties?.[i]??_f(c);if(l===null||l===void 0)continue;if(!a.some((d)=>JSON.stringify(d)===JSON.stringify(l)))a.push(l)}let u=a.length===1?a[0]:Hi(a)??{allOf:a};Le(r,i,u)}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=_f(i);if(a&&!s.some((u)=>JSON.stringify(u)===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 Fb(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of vf)if(o in e)return;let r=t.filter((o)=>gf.some((s)=>Array.isArray(o[s]))),n=null;if(!r.length)n=Hi(t);else{let o=r[0],s=gf.find((u)=>Array.isArray(o[u]));if(Object.keys(o).length!==1)return;let i=t.filter((u)=>u!==o),a=o[s].map((u)=>Hi([...i,u]));if(a.some((u)=>!u))return;n={[s]:a}}if(!n)return;delete e.allOf,pn(e,n)}function Ki(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=(a)=>{let u=e.seen.get(a);if(u.ref===null)return;let c=u.def??u.schema,l={...c},d=u.ref;if(u.ref=null,d){n(d);let f=e.seen.get(d),p=f.schema;if(p.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))c.allOf=c.allOf??[],c.allOf.push(p);else pn(c,p);if(pn(c,l),a._zod.parent===d)for(let _ in c){if(_==="$ref"||_==="allOf")continue;if(!(_ in l))delete c[_]}if(p.$ref&&f.def)for(let _ in c){if(_==="$ref"||_==="allOf")continue;if(_ in f.def&&JSON.stringify(c[_])===JSON.stringify(f.def[_]))delete c[_]}}let m=a._zod.parent;if(m&&m!==d){n(m);let f=e.seen.get(m);if(f?.schema.$ref){if(c.$ref=f.schema.$ref,f.def)for(let p in c){if(p==="$ref"||p==="allOf")continue;if(p in f.def&&JSON.stringify(c[p])===JSON.stringify(f.def[p]))delete c[p]}}}e.override({zodSchema:a,jsonSchema:c,path:u.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())yf(a[1].def??a[1].schema);for(let a of e.deferred)a();if(e.intersections.length){let a=new Map;for(let u of e.seen.values())for(let c of[u.schema,u.def]){let l=c?.allOf;if(!Array.isArray(l))continue;let d=a.get(l);if(d)d.push(c);else a.set(l,[c])}for(let u of e.intersections)for(let c of a.get(u)??[])Fb(c)}}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)}pn(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 u=a[1];if(u.def&&u.defId){if(u.def.id===u.defId)delete u.def.id;Le(i,u.defId,u.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:mn(t,"input",e.processors),output:mn(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch(a){throw Error("Error converting schema to JSON.")}}function Pe(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 Pe(n.element,r);if(n.type==="set")return Pe(n.valueType,r);if(n.type==="lazy")return Pe(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 Pe(n.innerType,r);if(n.type==="intersection")return Pe(n.left,r)||Pe(n.right,r);if(n.type==="record"||n.type==="map")return Pe(n.keyType,r)||Pe(n.valueType,r);if(n.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return Pe(n.in,r)||Pe(n.out,r)}if(n.type==="object"){for(let o in n.shape)if(Pe(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(Pe(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(Pe(o,r))return!0;if(n.rest&&Pe(n.rest,r))return!0;return!1}return!1}var bf=(e,t={})=>(r)=>{let n=Bi({...r,processors:t});return he(e,n),Ji(n,e),Ki(n,e)},mn=(e,t,r={})=>(n)=>{let{libraryOptions:o,target:s}=n??{},i=Bi({...o??{},target:s,io:t,processors:r});return he(e,i),Ji(i,e),Ki(i,e)};var wr=(e,t,r)=>{if(e[t]===void 0||r>e[t])e[t]=r},xr=(e,t,r)=>{if(e[t]===void 0||r<e[t])e[t]=r},wf=(e,t)=>{wr(e,"minimum",t),xr(e,"maximum",t)},Sf=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},kf=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},Pf=(e,t)=>{e.mime=e.mime?e.mime.filter((r)=>t.includes(r)):[...t]},Ef=(e,t)=>{if(e.format=t,t.includes("int"))e.isInt=!0},xf=(e,t)=>wr(e,"minimum",t.minimum),$f=(e,t)=>xr(e,"maximum",t.maximum),zf=(e)=>(t,r)=>{Ef(t,r.format);let[n,o]=e[r.format];wr(t,"minimum",n),xr(t,"maximum",o)},Vb={greater_than:(e,t)=>wr(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>xr(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>Sf(e,t.value),number_format:zf(Hn),bigint_format:zf(ri),min_length:xf,max_length:$f,length_equals:(e,t)=>wf(e,t.length),min_size:xf,max_size:$f,size_equals:(e,t)=>wf(e,t.size),string_format:(e,t)=>{if(Ef(e,t.format),t.pattern)kf(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)=>Pf(e,t.mime)};function Fe(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let s of n)Vb[s._zod.def.check]?.(t,s._zod.def);let o=e._zod.bag;if(o.minimum!==void 0)wr(t,"minimum",o.minimum);if(o.exclusiveMinimum!==void 0)wr(t,"exclusiveMinimum",o.exclusiveMinimum);if(o.maximum!==void 0)xr(t,"maximum",o.maximum);if(o.exclusiveMaximum!==void 0)xr(t,"exclusiveMaximum",o.exclusiveMaximum);if(o.multipleOf!==void 0)Sf(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)Pf(t,o.mime);for(let s of o.patterns??[])kf(t,s);return t}var Hb={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Bb=new Map([[bi,Hu],[co,Bu]]),Tf=(e)=>Bb.get(e)??e,Rf=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:s,maximum:i,format:a,patterns:u,contentEncoding:c,laxFormat:l}=Fe(e);if(typeof s==="number")o.minLength=s;if(typeof i==="number")o.maxLength=i;if(a){if(o.format=Hb[a]??a,o.format==="")delete o.format;if(a==="time"||l)delete o.format}if(c)o.contentEncoding=c;if(u&&u.size>0){let d=[...u].map(Tf);if(d.length===1)o.pattern=d[0].source;else if(d.length>1)o.allOf=[...d.map((m)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))]}},Of=(e,t,r,n)=>{let o=r,{minimum:s,maximum:i,multipleOf:a,exclusiveMaximum:u,exclusiveMinimum:c,isInt:l}=Fe(e);o.type=l?"integer":"number";let d=typeof c==="number"&&c>=(s??Number.NEGATIVE_INFINITY),m=typeof u==="number"&&u<=(i??Number.POSITIVE_INFINITY),f=t.target==="draft-04"||t.target==="openapi-3.0";if(d)if(f)o.minimum=c,o.exclusiveMinimum=!0;else o.exclusiveMinimum=c;else if(typeof s==="number")o.minimum=s;if(m)if(f)o.maximum=u,o.exclusiveMaximum=!0;else o.exclusiveMaximum=u;else if(typeof i==="number")o.maximum=i;if(a){let p=new Set;for(let y of a)if(Number.isFinite(y)&&y!==0)p.add(Math.abs(y));else _t(e,t,o,n,`A multipleOf divisor of ${y} cannot be represented in JSON Schema`);let[g,..._]=p;if(g!==void 0)o.multipleOf=g;if(_.length)o.allOf=[...o.allOf??[],..._.map((y)=>({multipleOf:y}))]}},If=(e,t,r,n)=>{r.type="boolean"};var Cf=(e,t,r,n)=>{if(t.target==="openapi-3.0")r.type="string",r.nullable=!0,r.enum=[null];else r.type="null"};var Af=(e,t,r,n)=>{r.not={}},Nf=(e,t,r,n)=>{},jf=(e,t,r,n)=>{};var Zf=(e,t,r,n)=>{let o=e._zod.def,s=en(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},Df=(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(_t(e,t,r,n,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof i==="bigint"){if(_t(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}};var Mf=(e,t,r,n)=>{_t(e,t,r,n,"Custom types cannot be represented in JSON Schema")};var qf=(e,t,r,n)=>{_t(e,t,r,n,"Transforms cannot be represented in JSON Schema")};var Lf=(e,t,r,n)=>{let o=r,s=e._zod.def,{minimum:i,maximum:a}=Fe(e);if(typeof i==="number")o.minItems=i;if(typeof a==="number")o.maxItems=a;o.type="array",o.items=he(s.element,t,{...n,path:[...n.path,"items"]})};function bo(e){let t=e._zod.def;if(t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform"))return bo(t.out);if(t.type==="catch")return bo(t.innerType);return e._zod.optin}var Uf=(e,t,r,n)=>{let o=r,s=e._zod.def,i=s.shape;if(Object.getOwnPropertySymbols(i).length&&_t(e,t,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let c in i)Le(o.properties,c,he(i[c],t,{...n,path:[...n.path,"properties",c]}));let u=[];for(let c of Object.keys(i)){let l=s.shape[c];if(t.io==="input"?bo(l)===void 0:l._zod.optout===void 0)u.push(c)}if(u.length>0)o.required=u;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=he(s.catchall,t,{...n,path:[...n.path,"additionalProperties"]})},Ff=(e,t,r,n)=>{let o=e._zod.def,s=o.inclusive===!1,i=o.options.map((a,u)=>he(a,t,{...n,path:[...n.path,s?"oneOf":"anyOf",u]}));if(s)r.oneOf=i;else r.anyOf=i},Vf=(e,t,r,n)=>{let o=e._zod.def,s=he(o.left,t,{...n,path:[...n.path,"allOf",0]}),i=he(o.right,t,{...n,path:[...n.path,"allOf",1]}),a=(c)=>("allOf"in c)&&Object.keys(c).length===1,u=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];r.allOf=u,t.intersections.push(u)};function Wi(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let p=e.get(t)?.def;if(!p)return t;let g=Wi(e,p,r);return g===p?t:g}for(let p of["anyOf","oneOf"]){let g=t[p];if(!Array.isArray(g))continue;let _=g.map((y)=>Wi(e,y,r));if(_.some((y,k)=>y!==g[k]))t={...t,[p]:_}}let n=Array.isArray(t.type)?t.type:[t.type],o=!n.includes("string")&&n.some((p)=>p==="number"||p==="integer"),s=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!s?.some((p)=>typeof p==="number"))return t;let{minimum:i,maximum:a,exclusiveMinimum:u,exclusiveMaximum:c,multipleOf:l,format:d,id:m,...f}=t;if(f.enum)f.enum=f.enum.map((p)=>typeof p==="number"?String(p):p);else if(typeof f.const==="number")f.const=String(f.const);if(!o)return f;if(f.type="string",!s)f.pattern=(n.includes("number")?an:pi).source;return f}var Gi=new WeakMap;function Jb(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 Gi.get(e)??[]){let o=e.seen.get(n),s=(o?.def??o?.schema)?.propertyNames;if(!s||s===!0||r.has(s))continue;let i=Wi(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 Hf=(e,t,r,n)=>{let o=r,s=e._zod.def;o.type="object";let i=s.keyType,a=Fe(i).patterns;if(s.mode==="loose"&&a&&a.size>0){let l=he(s.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let d of a)Le(o.patternProperties,Tf(d).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=he(s.keyType,t,{...n,path:[...n.path,"propertyNames"]});let l=Gi.get(t);if(!l)l=[],Gi.set(t,l),t.deferred.push(()=>Jb(t));l.push(e)}o.additionalProperties=he(s.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let u=i._zod.values,c=t.io==="input"&&bo(s.valueType)!==void 0;if(u&&!s.partial&&!c){let l=[...u].filter((d)=>typeof d==="string"||typeof d==="number");if(l.length>0)o.required=l.map(String)}},Bf=(e,t,r,n)=>{let o=e._zod.def,s=he(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"}]},Jf=(e,t,r,n)=>{let o=e._zod.def;he(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType},Xi=Symbol();function Kf(e,t,r,n,o){let s=!1,i=JSON.stringify(e,(a,u)=>{if(typeof u!=="bigint")return u;return s=!0,null});if(!s)return JSON.parse(i);return _t(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),Xi}var Wf=(e,t,r,n)=>{let o=e._zod.def;he(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType;let i=Kf(o.defaultValue,e,t,r,n);if(i!==Xi)r.default=i},Gf=(e,t,r,n)=>{let o=e._zod.def;he(o.innerType,t,n);let s=t.seen.get(e);if(s.ref=o.innerType,t.io!=="input")return;let i=Kf(o.defaultValue,e,t,r,n);if(i!==Xi)r._prefault=i},Xf=(e,t,r,n)=>{let o=e._zod.def;he(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType;let i;try{i=o.catchValue(void 0)}catch{_t(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=i},Yf=(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;he(i,t,n);let a=t.seen.get(e);a.ref=i},Qf=(e,t,r,n)=>{let o=e._zod.def;he(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType,r.readOnly=!0};var Yi=(e,t,r,n)=>{let o=e._zod.def;he(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType};function wo(e){return!!e._zod}function Ee(e,t){if(wo(e))return li(e,t);return e.safeParse(t)}function zr(e){if(!e)return;let t;if(wo(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 Sr(e){if(wo(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 ep=new WeakSet([Object.prototype,Error.prototype]);function xo(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 n0=(e,t)=>{vu.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);if(ep.has(r))return;ep.add(r),xo(r,"format",(n)=>(o)=>ui(n,o)),xo(r,"flatten",(n)=>(o)=>ci(n,o)),xo(r,"addIssue",(n)=>(o)=>{n.issues.push(o),n.message=JSON.stringify(n.issues,tn,2)}),xo(r,"addIssues",(n)=>(o)=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,tn,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})};var Me=v("ZodError",n0,void 0,{Parent:Error});var tp=Yn(Me),rp=Qn(Me),np=sn(Me),op=eo(Me),sp=xu(Me),ip=$u(Me),ap=zu(Me),cp=Su(Me),up=ku(Me),lp=Pu(Me),dp=Eu(Me),fp=Tu(Me);function s0(){if(!Re.localeError)Oe(Ei())}function zo(){if(!Re.memoizer)Oe({memoizer:Pi()})}var ne=v("ZodType",(e,t)=>(s0(),ee.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(De(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 Xe(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(B0(e,t))},superRefine(e,t){return this.check(J0(e,t))},overwrite(e){return this.check(Tt(e))},optional(){return ae(this)},exactOptional(){return A0(this)},nullable(){return hp(this)},nullish(){return ae(hp(this))},nonoptional(e){return q0(this,e)},array(){return S(this)},or(e){return oe([this,e])},and(e){return ko(this,e)},transform(e){return gp(this,Tp(e))},default(e){return Z0(this,e)},prefault(e){return M0(this,e)},catch(e){return U0(this,e)},pipe(e){return gp(this,e)},readonly(){return H0(this)},describe(e){let t=this.clone();return Et.add(t,{description:e}),t},meta(...e){if(e.length===0)return Et.get(this);let t=this.clone();return Et.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 Gn(this,"~standard",{...vi(this),jsonSchema:{input:mn(this,"input"),output:mn(this,"output")}})},set "~standard"(e){gt(this,"~standard",e)},parse:function e(t,r){return tp(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await rp(this,t,r,{callee:e})},safeParse(e,t){return np(this,e,t)},async safeParseAsync(e,t){return op(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){gt(this,"spa",e)},validate(e,t){return to(this,e,t)},validateAsync(e,t){return ro(this,e,t)},encode:function e(t,r){return sp(this,t,r,{callee:e})},decode:function e(t,r){return ip(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await ap(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await cp(this,t,r,{callee:e})},safeEncode(e,t){return up(this,e,t)},safeDecode(e,t){return lp(this,e,t)},async safeEncodeAsync(e,t){return dp(this,e,t)},async safeDecodeAsync(e,t){return fp(this,e,t)},toJSONSchema(e){return bf(this,{})(e)},get description(){return Et.get(this)?.description},get _def(){return this._zod.def}}),_p=v("_ZodString",(e,t)=>{ao.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Rf(e,r,n,o)},pu({format:(e)=>Fe(e).format??null,minLength:(e)=>Fe(e).minimum??null,maxLength:(e)=>Fe(e).maximum??null},{regex(...e){return this.check(Ai(...e))},includes(...e){return this.check(Zi(...e))},startsWith(...e){return this.check(Di(...e))},endsWith(...e){return this.check(Mi(...e))},min(...e){return this.check(br(...e))},max(...e){return this.check(yo(...e))},length(...e){return this.check(vo(...e))},nonempty(...e){return this.check(br(1,...e))},lowercase(e){return this.check(Ni(e))},uppercase(e){return this.check(ji(e))},trim(){return this.check(Li())},normalize(...e){return this.check(qi(...e))},toLowerCase(){return this.check(Ui())},toUpperCase(){return this.check(Fi())},slugify(){return this.check(Vi())}})),yp=v("ZodString",(e,t)=>{ao.init(e,t),_p.init(e,t)},{email(e){return this.check(Nd(i0,e))},url(e){return this.check(Ri(xp,e))},jwt(e){return this.check(tf(x0,e))},emoji(e){return this.check(Ld(c0,e))},guid(e){return this.check(jd(a0,e))},uuid(e){return this.check(Zd($o,e))},uuidv4(e){return this.check(Dd($o,e))},uuidv6(e){return this.check(Md($o,e))},uuidv7(e){return this.check(qd($o,e))},nanoid(e){return this.check(Ud(u0,e))},cuid(e){return this.check(Fd(l0,e))},cuid2(e){return this.check(Vd(d0,e))},ulid(e){return this.check(Hd(f0,e))},base64(e){return this.check(Yd(v0,e))},base64url(e){return this.check(Qd(b0,e))},xid(e){return this.check(Bd(p0,e))},ksuid(e){return this.check(Jd(m0,e))},ipv4(e){return this.check(Kd(h0,e))},ipv6(e){return this.check(Wd(g0,e))},cidrv4(e){return this.check(Gd(_0,e))},cidrv6(e){return this.check(Xd(y0,e))},e164(e){return this.check(ef(w0,e))},datetime(e){return this.check(mo(ea,e))},date(e){return this.check(Oi(vp,e))},time(e){return this.check(Ii(bp,e))},duration(e){return this.check(Ci(wp,e))}});function h(e){return Ad(yp,e)}var ue=v("ZodStringFormat",(e,t)=>{re.init(e,t),_p.init(e,t)}),ea=v("ZodISODateTime",(e,t)=>{Ul.init(e,t),ue.init(e,t)}),vp=v("ZodISODate",(e,t)=>{Fl.init(e,t),ue.init(e,t)}),bp=v("ZodISOTime",(e,t)=>{Vl.init(e,t),ue.init(e,t)}),wp=v("ZodISODuration",(e,t)=>{Hl.init(e,t),ue.init(e,t)}),i0=v("ZodEmail",(e,t)=>{Ol.init(e,t),ue.init(e,t)});var a0=v("ZodGUID",(e,t)=>{Tl.init(e,t),ue.init(e,t)});var $o=v("ZodUUID",(e,t)=>{Rl.init(e,t),ue.init(e,t)});var xp=v("ZodURL",(e,t)=>{Al.init(e,t),ue.init(e,t)});function $p(e){return Ri(xp,e)}var c0=v("ZodEmoji",(e,t)=>{Nl.init(e,t),ue.init(e,t)});var u0=v("ZodNanoID",(e,t)=>{jl.init(e,t),ue.init(e,t)});var l0=v("ZodCUID",(e,t)=>{Zl.init(e,t),ue.init(e,t)});var d0=v("ZodCUID2",(e,t)=>{Dl.init(e,t),ue.init(e,t)});var f0=v("ZodULID",(e,t)=>{Ml.init(e,t),ue.init(e,t)});var p0=v("ZodXID",(e,t)=>{ql.init(e,t),ue.init(e,t)});var m0=v("ZodKSUID",(e,t)=>{Ll.init(e,t),ue.init(e,t)});var h0=v("ZodIPv4",(e,t)=>{Bl.init(e,t),ue.init(e,t)});var g0=v("ZodIPv6",(e,t)=>{Kl.init(e,t),ue.init(e,t)});var _0=v("ZodCIDRv4",(e,t)=>{Wl.init(e,t),ue.init(e,t)});var y0=v("ZodCIDRv6",(e,t)=>{Gl.init(e,t),ue.init(e,t)});var v0=v("ZodBase64",(e,t)=>{Yl.init(e,t),ue.init(e,t)});var b0=v("ZodBase64URL",(e,t)=>{Ql.init(e,t),ue.init(e,t)});var w0=v("ZodE164",(e,t)=>{ed.init(e,t),ue.init(e,t)});var x0=v("ZodJWT",(e,t)=>{td.init(e,t),ue.init(e,t)});var So=v("ZodNumber",(e,t)=>{wi.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Of(e,r,n,o),e.isFinite=!0},pu({minValue:(e)=>{let{minimum:t,exclusiveMinimum:r}=Fe(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:(e)=>{let{maximum:t,exclusiveMaximum:r}=Fe(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:(e)=>{let{isInt:t,multipleOf:r}=Fe(e);return!!t||!!r?.some(Number.isSafeInteger)},format:(e)=>Fe(e).format??null},{gt(e,t){return this.check(go(e,t))},gte(e,t){return this.check(fn(e,t))},min(e,t){return this.check(fn(e,t))},lt(e,t){return this.check(ho(e,t))},lte(e,t){return this.check(dn(e,t))},max(e,t){return this.check(dn(e,t))},int(e){return this.check(pp(e))},safe(e){return this.check(pp(e))},positive(e){return this.check(go(0,e))},nonnegative(e){return this.check(fn(0,e))},negative(e){return this.check(ho(0,e))},nonpositive(e){return this.check(dn(0,e))},multipleOf(e,t){return this.check(_o(e,t))},step(e,t){return this.check(_o(e,t))},finite(){return this}}));function B(e){return rf(So,e)}var $0=v("ZodNumberFormat",(e,t)=>{rd.init(e,t),So.init(e,t)});function pp(e){return of($0,e)}var zp=v("ZodBoolean",(e,t)=>{nd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>If(e,r,n,o)});function Q(e){return sf(zp,e)}var z0=v("ZodNull",(e,t)=>{od.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Cf(e,r,n,o)});function Sp(e){return af(z0,e)}var S0=v("ZodAny",(e,t)=>{sd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Nf(e,r,n,o)});function kp(){return cf(S0)}var k0=v("ZodUnknown",(e,t)=>{id.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>jf(e,r,n,o)});function ie(){return uf(k0)}var P0=v("ZodNever",(e,t)=>{ad.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Af(e,r,n,o)});function E0(e){return lf(P0,e)}var T0=v("ZodArray",(e,t)=>{zo(),cd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Lf(e,r,n,o),e.element=t.element},{min(e,t){return this.check(br(e,t))},nonempty(e){return this.check(br(1,e))},max(e,t){return this.check(yo(e,t))},length(e,t){return this.check(vo(e,t))},unwrap(){return this.element}});function S(e,t){return df(T0,e,t)}var Pp=v("ZodObject",(e,t)=>{zo(),dd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Uf(e,r,n,o),ub(e,"shape",(r)=>r._zod.def.shape,!1)},{keyof(){return Ie(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(De(this._zod.def,{catchall:e}))},passthrough(){return this.clone(De(this._zod.def,{catchall:ie()}))},loose(){return this.clone(De(this._zod.def,{catchall:ie()}))},strict(){return this.clone(De(this._zod.def,{catchall:E0()}))},strip(){return this.clone(De(this._zod.def,{catchall:void 0}))},extend(e){return tb(this,e)},safeExtend(e){return rb(this,e)},merge(e){return nb(this,e)},pick(e){return Qv(this,e)},omit(e){return eb(this,e)},partial(...e){return uu(Rp,this,e[0])},exactPartial(...e){return uu(Op,this,e[0],"exactPartial")},required(...e){return ob(Ip,this,e[0])}});function P(e,t){let r={type:"object",shape:e??{},...O(t)};return new Pp(r)}function ye(e,t){return new Pp({type:"object",shape:e,catchall:ie(),...O(t)})}var Ep=v("ZodUnion",(e,t)=>{xi.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ff(e,r,n,o),e.options=t.options});function oe(e,t){return new Ep({type:"union",options:e,...O(t)})}var R0=v("ZodDiscriminatedUnion",(e,t)=>{Ep.init(e,t),fd.init(e,t)});function ta(e,t,r){return new R0({type:"union",options:t,discriminator:e,...O(r)})}var O0=v("ZodIntersection",(e,t)=>{pd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Vf(e,r,n,o)});function ko(e,t){return new O0({type:"intersection",left:e,right:t})}var mp=v("ZodRecord",(e,t)=>{zo(),md.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hf(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function te(e,t,r){if(!t||!t._zod)return new mp({type:"record",keyType:h(),valueType:e,...O(t)});return new mp({type:"record",keyType:e,valueType:t,...O(r)})}var Qi=v("ZodEnum",(e,t)=>{hd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(n,o,s)=>Zf(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 Qi({...t,checks:[],...O(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 Qi({...t,checks:[],...O(o),entries:s})}});function Ie(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((n)=>[n,n])):e;return new Qi({type:"enum",entries:r,...O(t)})}var I0=v("ZodLiteral",(e,t)=>{gd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Df(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 A(e,t){return new I0({type:"literal",values:Array.isArray(e)?e:[e],...O(t)})}var C0=v("ZodTransform",(e,t)=>{zo(),_d.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>qf(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new on(e.constructor.name);r.addIssue=(s)=>{if(typeof s==="string")r.issues.push(sr(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(sr(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 Tp(e){return new C0({type:"transform",transform:e})}var Rp=v("ZodOptional",(e,t)=>{$i.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Yi(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ae(e){return new Rp({type:"optional",innerType:e})}var Op=v("ZodExactOptional",(e,t)=>{yd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Yi(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function A0(e){return new Op({type:"optional",innerType:e})}var N0=v("ZodNullable",(e,t)=>{vd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Bf(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function hp(e){return new N0({type:"nullable",innerType:e})}var j0=v("ZodDefault",(e,t)=>{bd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wf(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Z0(e,t){return new j0({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():ei(t)}})}var D0=v("ZodPrefault",(e,t)=>{wd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Gf(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function M0(e,t){return new D0({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():ei(t)}})}var Ip=v("ZodNonOptional",(e,t)=>{xd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Jf(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function q0(e,t){return new Ip({type:"nonoptional",innerType:e,...O(t)})}var L0=v("ZodCatch",(e,t)=>{$d.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xf(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function U0(e,t){return new L0({type:"catch",innerType:e,catchValue:typeof t==="function"?t:mu(t)})}var Cp=v("ZodPipe",(e,t)=>{zi.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Yf(e,r,n,o),e.in=t.in,e.out=t.out});function gp(e,t){return new Cp({type:"pipe",in:e,out:t})}var F0=v("ZodPreprocess",(e,t)=>{Cp.init(e,t),zd.init(e,t)}),V0=v("ZodReadonly",(e,t)=>{Sd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qf(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function H0(e){return new V0({type:"readonly",innerType:e})}var Ap=v("ZodCustom",(e,t)=>{kd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Mf(e,r,n,o)});function Np(e,t){return ff(Ap,e??(()=>!0),t)}function B0(e,t={}){return pf(Ap,e,t)}function J0(e,t){return mf(e,t)}function ra(e,t){return new F0({type:"pipe",in:Tp(e),out:t})}var Zp={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};var jp;(function(e){})(jp||(jp={}));function W0(e){return mo(ea,e)}function G0(e){return nf(So,e)}var Rt="2025-11-25";var Eo=[Rt,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Ot="io.modelcontextprotocol/related-task",To="2.0",ve=Np((e)=>e!==null&&(typeof e==="object"||typeof e==="function")),qp=oe([h(),B().int()]),Lp=h(),p1=ye({ttl:B().optional(),pollInterval:B().optional()}),Y0=P({ttl:B().optional()}),Q0=P({taskId:h()}),na=ye({progressToken:qp.optional(),[Ot]:Q0.optional()}),qe=P({_meta:na.optional()}),hn=qe.extend({task:Y0.optional()}),Up=(e)=>hn.safeParse(e).success,xe=P({method:h(),params:qe.loose().optional()}),Ve=P({_meta:na.optional()}),He=P({method:h(),params:Ve.loose().optional()}),$e=ye({_meta:na.optional()}),Ro=oe([h(),B().int()]),Fp=P({jsonrpc:A(To),id:Ro,...xe.shape}).strict(),gn=(e)=>Fp.safeParse(e).success,Vp=P({jsonrpc:A(To),...He.shape}).strict(),Hp=(e)=>Vp.safeParse(e).success,oa=P({jsonrpc:A(To),id:Ro,result:$e}).strict(),ir=(e)=>oa.safeParse(e).success;var j;(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"})(j||(j={}));var sa=P({jsonrpc:A(To),id:Ro.optional(),error:P({code:B().int(),message:h(),data:ie().optional()})}).strict();var Bp=(e)=>sa.safeParse(e).success;var Pr=oe([Fp,Vp,oa,sa]),m1=oe([oa,sa]),yt=$e.strict(),ew=Ve.extend({requestId:Ro.optional(),reason:h().optional()}),Oo=He.extend({method:A("notifications/cancelled"),params:ew}),tw=P({src:h(),mimeType:h().optional(),sizes:S(h()).optional(),theme:Ie(["light","dark"]).optional()}),_n=P({icons:S(tw).optional()}),kr=P({name:h(),title:h().optional()}),Jp=kr.extend({...kr.shape,..._n.shape,version:h(),websiteUrl:h().optional(),description:h().optional()}),rw=ko(P({applyDefaults:Q().optional()}),te(h(),ie())),nw=ra((e)=>{if(e&&typeof e==="object"&&!Array.isArray(e)){if(Object.keys(e).length===0)return{form:{}}}return e},ko(P({form:rw.optional(),url:ve.optional()}),te(h(),ie()).optional())),ow=ye({list:ve.optional(),cancel:ve.optional(),requests:ye({sampling:ye({createMessage:ve.optional()}).optional(),elicitation:ye({create:ve.optional()}).optional()}).optional()}),sw=ye({list:ve.optional(),cancel:ve.optional(),requests:ye({tools:ye({call:ve.optional()}).optional()}).optional()}),iw=P({experimental:te(h(),ve).optional(),sampling:P({context:ve.optional(),tools:ve.optional()}).optional(),elicitation:nw.optional(),roots:P({listChanged:Q().optional()}).optional(),tasks:ow.optional(),extensions:te(h(),ve).optional()}),aw=qe.extend({protocolVersion:h(),capabilities:iw,clientInfo:Jp}),ia=xe.extend({method:A("initialize"),params:aw});var cw=P({experimental:te(h(),ve).optional(),logging:ve.optional(),completions:ve.optional(),prompts:P({listChanged:Q().optional()}).optional(),resources:P({subscribe:Q().optional(),listChanged:Q().optional()}).optional(),tools:P({listChanged:Q().optional()}).optional(),tasks:sw.optional(),extensions:te(h(),ve).optional()}),aa=$e.extend({protocolVersion:h(),capabilities:cw,serverInfo:Jp,instructions:h().optional()}),Io=He.extend({method:A("notifications/initialized"),params:Ve.optional()}),Kp=(e)=>Io.safeParse(e).success,Co=xe.extend({method:A("ping"),params:qe.optional()}),uw=P({progress:B(),total:ae(B()),message:ae(h())}),lw=P({...Ve.shape,...uw.shape,progressToken:qp}),Ao=He.extend({method:A("notifications/progress"),params:lw}),dw=qe.extend({cursor:Lp.optional()}),yn=xe.extend({params:dw.optional()}),vn=$e.extend({nextCursor:Lp.optional()}),fw=Ie(["working","input_required","completed","failed","cancelled"]),bn=P({taskId:h(),status:fw,ttl:oe([B(),Sp()]),createdAt:h(),lastUpdatedAt:h(),pollInterval:ae(B()),statusMessage:ae(h())}),vt=$e.extend({task:bn}),pw=Ve.merge(bn),wn=He.extend({method:A("notifications/tasks/status"),params:pw}),No=xe.extend({method:A("tasks/get"),params:qe.extend({taskId:h()})}),jo=$e.merge(bn),Zo=xe.extend({method:A("tasks/result"),params:qe.extend({taskId:h()})}),h1=$e.loose(),Do=yn.extend({method:A("tasks/list")}),Mo=vn.extend({tasks:S(bn)}),qo=xe.extend({method:A("tasks/cancel"),params:qe.extend({taskId:h()})}),Wp=$e.merge(bn),Gp=P({uri:h(),mimeType:ae(h()),_meta:te(h(),ie()).optional()}),Xp=Gp.extend({text:h()}),ca=h().refine((e)=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Yp=Gp.extend({blob:ca}),xn=Ie(["user","assistant"]),Er=P({audience:S(xn).optional(),priority:B().min(0).max(1).optional(),lastModified:W0({offset:!0}).optional()}),Qp=P({...kr.shape,..._n.shape,uri:h(),description:ae(h()),mimeType:ae(h()),size:ae(B()),annotations:Er.optional(),_meta:ae(ye({}))}),mw=P({...kr.shape,..._n.shape,uriTemplate:h(),description:ae(h()),mimeType:ae(h()),annotations:Er.optional(),_meta:ae(ye({}))}),hw=yn.extend({method:A("resources/list")}),ua=vn.extend({resources:S(Qp)}),gw=yn.extend({method:A("resources/templates/list")}),la=vn.extend({resourceTemplates:S(mw)}),da=qe.extend({uri:h()}),_w=da,yw=xe.extend({method:A("resources/read"),params:_w}),fa=$e.extend({contents:S(oe([Xp,Yp]))}),pa=He.extend({method:A("notifications/resources/list_changed"),params:Ve.optional()}),vw=da,bw=xe.extend({method:A("resources/subscribe"),params:vw}),ww=da,xw=xe.extend({method:A("resources/unsubscribe"),params:ww}),$w=Ve.extend({uri:h()}),zw=He.extend({method:A("notifications/resources/updated"),params:$w}),Sw=P({name:h(),description:ae(h()),required:ae(Q())}),kw=P({...kr.shape,..._n.shape,description:ae(h()),arguments:ae(S(Sw)),_meta:ae(ye({}))}),Pw=yn.extend({method:A("prompts/list")}),ma=vn.extend({prompts:S(kw)}),Ew=qe.extend({name:h(),arguments:te(h(),h()).optional()}),Tw=xe.extend({method:A("prompts/get"),params:Ew}),ha=P({type:A("text"),text:h(),annotations:Er.optional(),_meta:te(h(),ie()).optional()}),ga=P({type:A("image"),data:ca,mimeType:h(),annotations:Er.optional(),_meta:te(h(),ie()).optional()}),_a=P({type:A("audio"),data:ca,mimeType:h(),annotations:Er.optional(),_meta:te(h(),ie()).optional()}),Rw=P({type:A("tool_use"),name:h(),id:h(),input:te(h(),ie()),_meta:te(h(),ie()).optional()}),Ow=P({type:A("resource"),resource:oe([Xp,Yp]),annotations:Er.optional(),_meta:te(h(),ie()).optional()}),Iw=Qp.extend({type:A("resource_link")}),ya=oe([ha,ga,_a,Iw,Ow]),Cw=P({role:xn,content:ya}),va=$e.extend({description:h().optional(),messages:S(Cw)}),ba=He.extend({method:A("notifications/prompts/list_changed"),params:Ve.optional()}),Aw=P({title:h().optional(),readOnlyHint:Q().optional(),destructiveHint:Q().optional(),idempotentHint:Q().optional(),openWorldHint:Q().optional()}),Nw=P({taskSupport:Ie(["required","optional","forbidden"]).optional()}),em=P({...kr.shape,..._n.shape,description:h().optional(),inputSchema:P({type:A("object"),properties:te(h(),ve).optional(),required:S(h()).optional()}).catchall(ie()),outputSchema:P({type:A("object"),properties:te(h(),ve).optional(),required:S(h()).optional()}).catchall(ie()).optional(),annotations:Aw.optional(),execution:Nw.optional(),_meta:te(h(),ie()).optional()}),wa=yn.extend({method:A("tools/list")}),xa=vn.extend({tools:S(em)}),It=$e.extend({content:S(ya).default([]),structuredContent:te(h(),ie()).optional(),isError:Q().optional()}),g1=It.or($e.extend({toolResult:ie()})),jw=hn.extend({name:h(),arguments:te(h(),ie()).optional()}),$n=xe.extend({method:A("tools/call"),params:jw}),zn=He.extend({method:A("notifications/tools/list_changed"),params:Ve.optional()}),tm=P({autoRefresh:Q().default(!0),debounceMs:B().int().nonnegative().default(300)}),Sn=Ie(["debug","info","notice","warning","error","critical","alert","emergency"]),Zw=qe.extend({level:Sn}),$a=xe.extend({method:A("logging/setLevel"),params:Zw}),Dw=Ve.extend({level:Sn,logger:h().optional(),data:ie()}),Mw=He.extend({method:A("notifications/message"),params:Dw}),qw=P({name:h().optional()}),Lw=P({hints:S(qw).optional(),costPriority:B().min(0).max(1).optional(),speedPriority:B().min(0).max(1).optional(),intelligencePriority:B().min(0).max(1).optional()}),Uw=P({mode:Ie(["auto","required","none"]).optional()}),Fw=P({type:A("tool_result"),toolUseId:h().describe("The unique identifier for the corresponding tool call."),content:S(ya).default([]),structuredContent:P({}).loose().optional(),isError:Q().optional(),_meta:te(h(),ie()).optional()}),Vw=ta("type",[ha,ga,_a]),Po=ta("type",[ha,ga,_a,Rw,Fw]),Hw=P({role:xn,content:oe([Po,S(Po)]),_meta:te(h(),ie()).optional()}),Bw=hn.extend({messages:S(Hw),modelPreferences:Lw.optional(),systemPrompt:h().optional(),includeContext:Ie(["none","thisServer","allServers"]).optional(),temperature:B().optional(),maxTokens:B().int(),stopSequences:S(h()).optional(),metadata:ve.optional(),tools:S(em).optional(),toolChoice:Uw.optional()}),za=xe.extend({method:A("sampling/createMessage"),params:Bw}),ar=$e.extend({model:h(),stopReason:ae(Ie(["endTurn","stopSequence","maxTokens"]).or(h())),role:xn,content:Vw}),kn=$e.extend({model:h(),stopReason:ae(Ie(["endTurn","stopSequence","maxTokens","toolUse"]).or(h())),role:xn,content:oe([Po,S(Po)])}),Jw=P({type:A("boolean"),title:h().optional(),description:h().optional(),default:Q().optional()}),Kw=P({type:A("string"),title:h().optional(),description:h().optional(),minLength:B().optional(),maxLength:B().optional(),format:Ie(["email","uri","date","date-time"]).optional(),default:h().optional()}),Ww=P({type:Ie(["number","integer"]),title:h().optional(),description:h().optional(),minimum:B().optional(),maximum:B().optional(),default:B().optional()}),Gw=P({type:A("string"),title:h().optional(),description:h().optional(),enum:S(h()),default:h().optional()}),Xw=P({type:A("string"),title:h().optional(),description:h().optional(),oneOf:S(P({const:h(),title:h()})),default:h().optional()}),Yw=P({type:A("string"),title:h().optional(),description:h().optional(),enum:S(h()),enumNames:S(h()).optional(),default:h().optional()}),Qw=oe([Gw,Xw]),ex=P({type:A("array"),title:h().optional(),description:h().optional(),minItems:B().optional(),maxItems:B().optional(),items:P({type:A("string"),enum:S(h())}),default:S(h()).optional()}),tx=P({type:A("array"),title:h().optional(),description:h().optional(),minItems:B().optional(),maxItems:B().optional(),items:P({anyOf:S(P({const:h(),title:h()}))}),default:S(h()).optional()}),rx=oe([ex,tx]),nx=oe([Yw,Qw,rx]),ox=oe([nx,Jw,Kw,Ww]),sx=hn.extend({mode:A("form").optional(),message:h(),requestedSchema:P({type:A("object"),properties:te(h(),ox),required:S(h()).optional()})}),ix=hn.extend({mode:A("url"),message:h(),elicitationId:h(),url:h().url()}),ax=oe([sx,ix]),Sa=xe.extend({method:A("elicitation/create"),params:ax}),cx=Ve.extend({elicitationId:h()}),ux=He.extend({method:A("notifications/elicitation/complete"),params:cx}),Ct=$e.extend({action:Ie(["accept","decline","cancel"]),content:ra((e)=>e===null?void 0:e,te(h(),oe([h(),B(),Q(),S(h())])).optional())}),lx=P({type:A("ref/resource"),uri:h()});var dx=P({type:A("ref/prompt"),name:h()}),fx=qe.extend({ref:oe([dx,lx]),argument:P({name:h(),value:h()}),context:P({arguments:te(h(),h()).optional()}).optional()}),px=xe.extend({method:A("completion/complete"),params:fx});var ka=$e.extend({completion:ye({values:S(h()).max(100),total:ae(B().int()),hasMore:ae(Q())})}),mx=P({uri:h().startsWith("file://"),name:h().optional(),_meta:te(h(),ie()).optional()}),hx=xe.extend({method:A("roots/list"),params:qe.optional()}),Pa=$e.extend({roots:S(mx)}),gx=He.extend({method:A("notifications/roots/list_changed"),params:Ve.optional()}),_1=oe([Co,ia,px,$a,Tw,Pw,hw,gw,yw,bw,xw,$n,wa,No,Zo,Do,qo]),y1=oe([Oo,Ao,Io,gx,wn]),v1=oe([yt,ar,kn,Ct,Pa,jo,Mo,vt]),b1=oe([Co,za,Sa,hx,No,Zo,Do,qo]),w1=oe([Oo,Ao,Mw,zw,pa,zn,ba,wn,ux]),x1=oe([yt,aa,ka,va,ma,ua,la,fa,It,xa,jo,Mo,vt]);class I 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===j.UrlElicitationRequired&&r){let n=r;if(n.elicitations)return new rm(n.elicitations,t)}return new I(e,t,r)}}class rm extends I{constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(j.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}}function At(e){return e==="completed"||e==="failed"||e==="cancelled"}var _x=Symbol("Let zodToJsonSchema decide on which parser to use");var tA=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Ea(e){let r=zr(e)?.method;if(!r)throw Error("Schema is missing a method literal");let n=Sr(r);if(typeof n!=="string")throw Error("Schema method literal must be a string");return n}function Ta(e,t){let r=Ee(e,t);if(!r.success)throw r.error;return r.data}var $x=60000;class En{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(Oo,(t)=>{this._oncancel(t)}),this.setNotificationHandler(Ao,(t)=>{this._onprogress(t)}),this.setRequestHandler(Co,(t)=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore)this.setRequestHandler(No,async(t,r)=>{let n=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!n)throw new I(j.InvalidParams,"Failed to retrieve task: Task not found");return{...n}}),this.setRequestHandler(Zo,async(t,r)=>{let n=async()=>{let o=t.params.taskId;if(!await this._taskStore.getTask(o,r.sessionId))throw new I(j.InvalidParams,`Task not found: ${o}`);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,u=a.id,c=this._requestResolvers.get(u);if(c)if(this._requestResolvers.delete(u),i.type==="response")c(a);else{let l=a,d=new I(l.error.code,l.error.message,l.error.data);c(d)}else{let l=i.type==="response"?"Response":"Error";this._onerror(Error(`${l} handler missing for request ${u}`))}continue}await this._transport?.send(i.message,{relatedRequestId:r.requestId})}}let s=await this._taskStore.getTask(o,r.sessionId);if(!s)throw new I(j.InvalidParams,`Task not found: ${o}`);if(!At(s.status))return await this._waitForTaskUpdate(o,r.signal,r.sessionId),await n();if(At(s.status)){let i=await this._taskStore.getTaskResult(o,r.sessionId);return this._clearTaskQueue(o,r.sessionId),{...i,_meta:{...i._meta,[Ot]:{taskId:o}}}}return await n()};return await n()}),this.setRequestHandler(Do,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 I(j.InvalidParams,`Failed to list tasks: ${n instanceof Error?n.message:String(n)}`)}}),this.setRequestHandler(qo,async(t,r)=>{try{let n=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!n)throw new I(j.InvalidParams,`Task not found: ${t.params.taskId}`);if(At(n.status))throw new I(j.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,r.sessionId);let o=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!o)throw new I(j.InvalidParams,`Task not found after cancellation: ${t.params.taskId}`);return{_meta:{},...o}}catch(n){if(n instanceof I)throw n;throw new I(j.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),I.fromError(j.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),ir(o)||Bp(o))this._onresponse(o);else if(gn(o))this._onrequest(o,s);else if(Hp(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=I.fromError(j.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?.[Ot]?.taskId,s=n?.sessionId,i=this._taskStore,a=!0,u;if(o&&i&&this._taskMessageQueue&&s!==void 0)a=!1,u=(async()=>{if(!await i.getTask(o,s))throw new I(j.InvalidParams,`Task not found: ${o}`);a=!0})();if(r===void 0){let f={jsonrpc:"2.0",id:e.id,error:{code:j.MethodNotFound,message:"Method not found"}};if(o&&u){let p={type:"error",message:f,timestamp:Date.now()};u.then(()=>this._enqueueTaskMessage(o,p,s),()=>n?.send(f)).catch((g)=>this._onerror(Error(`Failed to send an error response: ${g}`)))}else if(o&&this._taskMessageQueue)this._enqueueTaskMessage(o,{type:"error",message:f,timestamp:Date.now()},n?.sessionId).catch((p)=>this._onerror(Error(`Failed to enqueue error response: ${p}`)));else n?.send(f).catch((p)=>this._onerror(Error(`Failed to send an error response: ${p}`)));return}let c=new AbortController;this._requestHandlerAbortControllers.set(e.id,c);let l=Up(e.params)?e.params.task:void 0,d=this._taskStore?this.requestTaskStore(e,n?.sessionId):void 0,m={signal:c.signal,sessionId:n?.sessionId,_meta:e.params?._meta,sendNotification:async(f)=>{if(c.signal.aborted)return;let p={relatedRequestId:e.id};if(o)p.relatedTask={taskId:o};await this.notification(f,p)},sendRequest:async(f,p,g)=>{if(c.signal.aborted)throw new I(j.ConnectionClosed,"Request was cancelled");let _={...g,relatedRequestId:e.id};if(o&&!_.relatedTask)_.relatedTask={taskId:o};let y=_.relatedTask?.taskId??o;if(y&&d)await d.updateTaskStatus(y,"input_required");return await this.request(f,p,_)},authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo,taskId:o,taskStore:d,taskRequestedTtl:l?.ttl,closeSSEStream:t?.closeSSEStream,closeStandaloneSSEStream:t?.closeStandaloneSSEStream};(u??Promise.resolve()).then(()=>{if(u&&c.signal.aborted)throw new I(j.ConnectionClosed,"Request was cancelled");if(l)this.assertTaskHandlerCapability(e.method)}).then(()=>r(e,m)).then(async(f)=>{if(c.signal.aborted)return;let p={result:f,jsonrpc:"2.0",id:e.id};if(o&&this._taskMessageQueue)await this._enqueueTaskMessage(o,{type:"response",message:p,timestamp:Date.now()},n?.sessionId);else await n?.send(p)},async(f)=>{if(c.signal.aborted)return;let p={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(f.code)?f.code:j.InternalError,message:f.message??"Internal error",...f.data!==void 0&&{data:f.data}}};if(o&&this._taskMessageQueue&&a)await this._enqueueTaskMessage(o,{type:"error",message:p,timestamp:Date.now()},n?.sessionId);else await n?.send(p)}).catch((f)=>this._onerror(Error(`Failed to send response: ${f}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(e.id)===c)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),ir(e))r(e);else{let s=new I(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(ir(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(ir(e))n(e);else{let s=I.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 I?s:new I(j.InternalError,String(s))}}return}let o;try{let s=await this.request(e,vt,r);if(s.task)o=s.task.taskId,yield{type:"taskCreated",task:s.task};else throw new I(j.InternalError,"Task creation did not return a task");while(!0){let i=await this.getTask({taskId:o},r);if(yield{type:"taskStatus",task:i},At(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 I(j.InternalError,`Task ${o} failed`)};else if(i.status==="cancelled")yield{type:"error",error:new I(j.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((u)=>setTimeout(u,a)),r?.signal?.throwIfAborted()}}catch(s){yield{type:"error",error:s instanceof I?s:new I(j.InternalError,String(s))}}}request(e,t,r){let{relatedRequestId:n,resumptionToken:o,onresumptiontoken:s,task:i,relatedTask:a}=r??{};return new Promise((u,c)=>{let l=(y)=>{c(y)};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(y){l(y);return}r?.signal?.throwIfAborted();let d=this._requestMessageId++,m={...e,jsonrpc:"2.0",id:d};if(r?.onprogress)this._progressHandlers.set(d,r.onprogress),m.params={...e.params,_meta:{...e.params?._meta||{},progressToken:d}};if(i)m.params={...m.params,task:i};if(a)m.params={...m.params,_meta:{...m.params?._meta||{},[Ot]:a}};let f=(y)=>{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(y)}},{relatedRequestId:n,resumptionToken:o,onresumptiontoken:s}).catch((C)=>this._onerror(Error(`Failed to send cancellation: ${C}`)));let k=y instanceof I?y:new I(j.RequestTimeout,String(y));c(k)};this._responseHandlers.set(d,(y)=>{if(r?.signal?.aborted)return;if(y instanceof Error)return c(y);try{let k=Ee(t,y.result);if(!k.success)c(k.error);else u(k.data)}catch(k){c(k)}}),r?.signal?.addEventListener("abort",()=>{f(r?.signal?.reason)});let p=r?.timeout??$x,g=()=>f(I.fromError(j.RequestTimeout,"Request timed out",{timeout:p}));this._setupTimeout(d,p,r?.maxTotalTimeout,g,r?.resetTimeoutOnProgress??!1);let _=a?.taskId;if(_){let y=(k)=>{let C=this._responseHandlers.get(d);if(C)C(k);else this._onerror(Error(`Response handler missing for side-channeled request ${d}`))};this._requestResolvers.set(d,y),this._enqueueTaskMessage(_,{type:"request",message:m,timestamp:Date.now()}).catch((k)=>{this._cleanupTimeout(d),c(k)})}else this._transport.send(m,{relatedRequestId:n,resumptionToken:o,onresumptiontoken:s}).catch((y)=>{this._cleanupTimeout(d),c(y)})})}async getTask(e,t){return this.request({method:"tasks/get",params:e},jo,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},Mo,t)}async cancelTask(e,t){return this.request({method:"tasks/cancel",params:e},Wp,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||{},[Ot]: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||{},[Ot]: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||{},[Ot]:t.relatedTask}}};await this._transport.send(s,t)}setRequestHandler(e,t){let r=Ea(e);this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(n,o)=>{let s=Ta(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=Ea(e);this._notificationHandlers.set(r,(n)=>{let o=Ta(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??this._transport?.sessionId,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"&&gn(n.message)){let o=n.message.id,s=this._requestResolvers.get(o);if(s)s(new I(j.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,r){let n=this._options?.defaultTaskPollInterval??1000;try{let o=await this._taskStore?.getTask(e,r);if(o?.pollInterval)n=o.pollInterval}catch{}return new Promise((o,s)=>{if(t.aborted){s(new I(j.InvalidRequest,"Request cancelled"));return}let i=setTimeout(o,n);t.addEventListener("abort",()=>{clearTimeout(i),s(new I(j.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 I(j.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=wn.parse({method:"notifications/tasks/status",params:i});if(await this.notification(a),At(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 I(j.InvalidParams,`Task "${n}" not found - it may have been cleaned up`);if(At(i.status))throw new I(j.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 u=wn.parse({method:"notifications/tasks/status",params:a});if(await this.notification(u),At(a.status))this._cleanupTaskProgressHandler(n)}},listTasks:(n)=>r.listTasks(n,t)}}}function nm(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function Lo(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(nm(i)&&nm(s))r[o]={...i,...s};else r[o]=s}return r}var gv=Xc(yc(),1),_v=Xc(hv(),1);function _R(){let e=new gv.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return _v.default(e),e}class Un{constructor(e){this._ajv=e??_R()}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 Pc{constructor(e){this._client=e}async*callToolStream(e,t=It,r){let n=this._client,o={...r,task:r?.task??(n.isToolTask(e.name)?{}:void 0)},s=n.requestStream({method:"tools/call",params:e},t,o),i=n.getToolOutputValidator(e.name);for await(let a of s){if(a.type==="result"&&i){let u=a.result;if(!u.structuredContent&&!u.isError){yield{type:"error",error:new I(j.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`)};return}if(u.structuredContent)try{let c=i(u.structuredContent);if(!c.valid){yield{type:"error",error:new I(j.InvalidParams,`Structured content does not match the tool's output schema: ${c.errorMessage}`)};return}}catch(c){if(c instanceof I){yield{type:"error",error:c};return}yield{type:"error",error:new I(j.InvalidParams,`Failed to validate structured content: ${c instanceof Error?c.message:String(c)}`)};return}}yield a}}async getTask(e,t){return this._client.getTask({taskId:e},t)}async getTaskResult(e,t,r){return this._client.getTaskResult({taskId:e},t,r)}async listTasks(e,t){return this._client.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._client.cancelTask({taskId:e},t)}requestStream(e,t,r){return this._client.requestStream(e,t,r)}}function Is(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 Cs(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}}function As(e,t){if(!e||t===null||typeof t!=="object")return;if(e.type==="object"&&e.properties&&typeof e.properties==="object"){let r=t,n=e.properties;for(let o of Object.keys(n)){let s=n[o];if(r[o]===void 0&&Object.prototype.hasOwnProperty.call(s,"default"))r[o]=s.default;if(r[o]!==void 0)As(s,r[o])}}if(Array.isArray(e.anyOf)){for(let r of e.anyOf)if(typeof r!=="boolean")As(r,t)}if(Array.isArray(e.oneOf)){for(let r of e.oneOf)if(typeof r!=="boolean")As(r,t)}}function yR(e){if(!e)return{supportsFormMode:!1,supportsUrlMode:!1};let t=e.form!==void 0,r=e.url!==void 0;return{supportsFormMode:t||!t&&!r,supportsUrlMode:r}}class Ec extends En{constructor(e,t){super(t);if(this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._listChangedDebounceTimers=new Map,this._capabilities=t?.capabilities??{},this._jsonSchemaValidator=t?.jsonSchemaValidator??new Un,t?.listChanged)this._pendingListChangedConfig=t.listChanged}_setupListChangedHandlers(e){if(e.tools&&this._serverCapabilities?.tools?.listChanged)this._setupListChangedHandler("tools",zn,e.tools,async()=>(await this.listTools()).tools);if(e.prompts&&this._serverCapabilities?.prompts?.listChanged)this._setupListChangedHandler("prompts",ba,e.prompts,async()=>(await this.listPrompts()).prompts);if(e.resources&&this._serverCapabilities?.resources?.listChanged)this._setupListChangedHandler("resources",pa,e.resources,async()=>(await this.listResources()).resources)}get experimental(){if(!this._experimental)this._experimental={tasks:new Pc(this)};return this._experimental}registerCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=Lo(this._capabilities,e)}setRequestHandler(e,t){let n=zr(e)?.method;if(!n)throw Error("Schema is missing a method literal");let o=Sr(n);if(typeof o!=="string")throw Error("Schema method literal must be a string");let s=o;if(s==="elicitation/create"){let i=async(a,u)=>{let c=Ee(Sa,a);if(!c.success){let y=c.error instanceof Error?c.error.message:String(c.error);throw new I(j.InvalidParams,`Invalid elicitation request: ${y}`)}let{params:l}=c.data;l.mode=l.mode??"form";let{supportsFormMode:d,supportsUrlMode:m}=yR(this._capabilities.elicitation);if(l.mode==="form"&&!d)throw new I(j.InvalidParams,"Client does not support form-mode elicitation requests");if(l.mode==="url"&&!m)throw new I(j.InvalidParams,"Client does not support URL-mode elicitation requests");let f=await Promise.resolve(t(a,u));if(l.task){let y=Ee(vt,f);if(!y.success){let k=y.error instanceof Error?y.error.message:String(y.error);throw new I(j.InvalidParams,`Invalid task creation result: ${k}`)}return y.data}let p=Ee(Ct,f);if(!p.success){let y=p.error instanceof Error?p.error.message:String(p.error);throw new I(j.InvalidParams,`Invalid elicitation result: ${y}`)}let g=p.data,_=l.mode==="form"?l.requestedSchema:void 0;if(l.mode==="form"&&g.action==="accept"&&g.content&&_){if(this._capabilities.elicitation?.form?.applyDefaults)try{As(_,g.content)}catch{}}return g};return super.setRequestHandler(e,i)}if(s==="sampling/createMessage"){let i=async(a,u)=>{let c=Ee(za,a);if(!c.success){let g=c.error instanceof Error?c.error.message:String(c.error);throw new I(j.InvalidParams,`Invalid sampling request: ${g}`)}let{params:l}=c.data,d=await Promise.resolve(t(a,u));if(l.task){let g=Ee(vt,d);if(!g.success){let _=g.error instanceof Error?g.error.message:String(g.error);throw new I(j.InvalidParams,`Invalid task creation result: ${_}`)}return g.data}let f=l.tools||l.toolChoice?kn:ar,p=Ee(f,d);if(!p.success){let g=p.error instanceof Error?p.error.message:String(p.error);throw new I(j.InvalidParams,`Invalid sampling result: ${g}`)}return p.data};return super.setRequestHandler(e,i)}return super.setRequestHandler(e,t)}assertCapability(e,t){if(!this._serverCapabilities?.[e])throw Error(`Server does not support ${e} (required for ${t})`)}async connect(e,t){if(await super.connect(e),e.sessionId!==void 0)return;try{let r=await this.request({method:"initialize",params:{protocolVersion:Rt,capabilities:this._capabilities,clientInfo:this._clientInfo}},aa,t);if(r===void 0)throw Error(`Server sent invalid initialize result: ${r}`);if(!Eo.includes(r.protocolVersion))throw Error(`Server's protocol version is not supported: ${r.protocolVersion}`);if(this._serverCapabilities=r.capabilities,this._serverVersion=r.serverInfo,e.setProtocolVersion)e.setProtocolVersion(r.protocolVersion);if(this._instructions=r.instructions,await this.notification({method:"notifications/initialized"}),this._pendingListChangedConfig)this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0}catch(r){throw this.close(),r}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){switch(e){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!this._serverCapabilities?.resources)throw Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw Error(`Server does not support completions (required for ${e})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/roots/list_changed":if(!this._capabilities.roots?.listChanged)throw Error(`Client does not support roots list changed notifications (required for ${e})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(!this._capabilities)return;switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw Error(`Client does not support roots capability (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw Error(`Client does not support tasks capability (required for ${e})`);break;case"ping":break}}assertTaskCapability(e){Is(this._serverCapabilities?.tasks?.requests,e,"Server")}assertTaskHandlerCapability(e){if(!this._capabilities)return;Cs(this._capabilities.tasks?.requests,e,"Client")}async ping(e){return this.request({method:"ping"},yt,e)}async complete(e,t){return this.request({method:"completion/complete",params:e},ka,t)}async setLoggingLevel(e,t){return this.request({method:"logging/setLevel",params:{level:e}},yt,t)}async getPrompt(e,t){return this.request({method:"prompts/get",params:e},va,t)}async listPrompts(e,t){return this.request({method:"prompts/list",params:e},ma,t)}async listResources(e,t){return this.request({method:"resources/list",params:e},ua,t)}async listResourceTemplates(e,t){return this.request({method:"resources/templates/list",params:e},la,t)}async readResource(e,t){return this.request({method:"resources/read",params:e},fa,t)}async subscribeResource(e,t){return this.request({method:"resources/subscribe",params:e},yt,t)}async unsubscribeResource(e,t){return this.request({method:"resources/unsubscribe",params:e},yt,t)}async callTool(e,t=It,r){if(this.isToolTaskRequired(e.name))throw new I(j.InvalidRequest,`Tool "${e.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);let n=await this.request({method:"tools/call",params:e},t,r),o=this.getToolOutputValidator(e.name);if(o){if(!n.structuredContent&&!n.isError)throw new I(j.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(n.structuredContent)try{let s=o(n.structuredContent);if(!s.valid)throw new I(j.InvalidParams,`Structured content does not match the tool's output schema: ${s.errorMessage}`)}catch(s){if(s instanceof I)throw s;throw new I(j.InvalidParams,`Failed to validate structured content: ${s instanceof Error?s.message:String(s)}`)}}return n}isToolTask(e){if(!this._serverCapabilities?.tasks?.requests?.tools?.call)return!1;return this._cachedKnownTaskTools.has(e)}isToolTaskRequired(e){return this._cachedRequiredTaskTools.has(e)}cacheToolMetadata(e){this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(let t of e){if(t.outputSchema){let n=this._jsonSchemaValidator.getValidator(t.outputSchema);this._cachedToolOutputValidators.set(t.name,n)}let r=t.execution?.taskSupport;if(r==="required"||r==="optional")this._cachedKnownTaskTools.add(t.name);if(r==="required")this._cachedRequiredTaskTools.add(t.name)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,t){let r=await this.request({method:"tools/list",params:e},xa,t);return this.cacheToolMetadata(r.tools),r}_setupListChangedHandler(e,t,r,n){let o=tm.safeParse(r);if(!o.success)throw Error(`Invalid ${e} listChanged options: ${o.error.message}`);if(typeof r.onChanged!=="function")throw Error(`Invalid ${e} listChanged options: onChanged must be a function`);let{autoRefresh:s,debounceMs:i}=o.data,{onChanged:a}=r,u=async()=>{if(!s){a(null,null);return}try{let l=await n();a(null,l)}catch(l){let d=l instanceof Error?l:Error(String(l));a(d,null)}},c=()=>{if(i){let l=this._listChangedDebounceTimers.get(e);if(l)clearTimeout(l);let d=setTimeout(u,i);this._listChangedDebounceTimers.set(e,d)}else u()};this.setNotificationHandler(t,c)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}/*!
65
+ 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 c=e.external.registry.get(i[0])?.id;if(t!==i[0]&&c){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 yf(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;yf(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 vf=new Set(["type","properties","required","additionalProperties"]),gf=["oneOf","anyOf"];function _f(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 Bi(e){let t=[];for(let s of e){if(typeof s!=="object"||s.type!=="object")return null;for(let i in s)if(!vf.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 c of t){let l=c.properties?.[i]??_f(c);if(l===null||l===void 0)continue;if(!a.some((d)=>JSON.stringify(d)===JSON.stringify(l)))a.push(l)}let u=a.length===1?a[0]:Bi(a)??{allOf:a};Le(r,i,u)}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=_f(i);if(a&&!s.some((u)=>JSON.stringify(u)===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 Fb(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of vf)if(o in e)return;let r=t.filter((o)=>gf.some((s)=>Array.isArray(o[s]))),n=null;if(!r.length)n=Bi(t);else{let o=r[0],s=gf.find((u)=>Array.isArray(o[u]));if(Object.keys(o).length!==1)return;let i=t.filter((u)=>u!==o),a=o[s].map((u)=>Bi([...i,u]));if(a.some((u)=>!u))return;n={[s]:a}}if(!n)return;delete e.allOf,pn(e,n)}function Wi(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=(a)=>{let u=e.seen.get(a);if(u.ref===null)return;let c=u.def??u.schema,l={...c},d=u.ref;if(u.ref=null,d){n(d);let f=e.seen.get(d),p=f.schema;if(p.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))c.allOf=c.allOf??[],c.allOf.push(p);else pn(c,p);if(pn(c,l),a._zod.parent===d)for(let _ in c){if(_==="$ref"||_==="allOf")continue;if(!(_ in l))delete c[_]}if(p.$ref&&f.def)for(let _ in c){if(_==="$ref"||_==="allOf")continue;if(_ in f.def&&JSON.stringify(c[_])===JSON.stringify(f.def[_]))delete c[_]}}let m=a._zod.parent;if(m&&m!==d){n(m);let f=e.seen.get(m);if(f?.schema.$ref){if(c.$ref=f.schema.$ref,f.def)for(let p in c){if(p==="$ref"||p==="allOf")continue;if(p in f.def&&JSON.stringify(c[p])===JSON.stringify(f.def[p]))delete c[p]}}}e.override({zodSchema:a,jsonSchema:c,path:u.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())yf(a[1].def??a[1].schema);for(let a of e.deferred)a();if(e.intersections.length){let a=new Map;for(let u of e.seen.values())for(let c of[u.schema,u.def]){let l=c?.allOf;if(!Array.isArray(l))continue;let d=a.get(l);if(d)d.push(c);else a.set(l,[c])}for(let u of e.intersections)for(let c of a.get(u)??[])Fb(c)}}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)}pn(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 u=a[1];if(u.def&&u.defId){if(u.def.id===u.defId)delete u.def.id;Le(i,u.defId,u.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:mn(t,"input",e.processors),output:mn(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch(a){throw Error("Error converting schema to JSON.")}}function Pe(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 Pe(n.element,r);if(n.type==="set")return Pe(n.valueType,r);if(n.type==="lazy")return Pe(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 Pe(n.innerType,r);if(n.type==="intersection")return Pe(n.left,r)||Pe(n.right,r);if(n.type==="record"||n.type==="map")return Pe(n.keyType,r)||Pe(n.valueType,r);if(n.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return Pe(n.in,r)||Pe(n.out,r)}if(n.type==="object"){for(let o in n.shape)if(Pe(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(Pe(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(Pe(o,r))return!0;if(n.rest&&Pe(n.rest,r))return!0;return!1}return!1}var bf=(e,t={})=>(r)=>{let n=Ji({...r,processors:t});return he(e,n),Ki(n,e),Wi(n,e)},mn=(e,t,r={})=>(n)=>{let{libraryOptions:o,target:s}=n??{},i=Ji({...o??{},target:s,io:t,processors:r});return he(e,i),Ki(i,e),Wi(i,e)};var wr=(e,t,r)=>{if(e[t]===void 0||r>e[t])e[t]=r},xr=(e,t,r)=>{if(e[t]===void 0||r<e[t])e[t]=r},wf=(e,t)=>{wr(e,"minimum",t),xr(e,"maximum",t)},Sf=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},kf=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},Pf=(e,t)=>{e.mime=e.mime?e.mime.filter((r)=>t.includes(r)):[...t]},Ef=(e,t)=>{if(e.format=t,t.includes("int"))e.isInt=!0},xf=(e,t)=>wr(e,"minimum",t.minimum),$f=(e,t)=>xr(e,"maximum",t.maximum),zf=(e)=>(t,r)=>{Ef(t,r.format);let[n,o]=e[r.format];wr(t,"minimum",n),xr(t,"maximum",o)},Vb={greater_than:(e,t)=>wr(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>xr(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>Sf(e,t.value),number_format:zf(Hn),bigint_format:zf(ni),min_length:xf,max_length:$f,length_equals:(e,t)=>wf(e,t.length),min_size:xf,max_size:$f,size_equals:(e,t)=>wf(e,t.size),string_format:(e,t)=>{if(Ef(e,t.format),t.pattern)kf(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)=>Pf(e,t.mime)};function Fe(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let s of n)Vb[s._zod.def.check]?.(t,s._zod.def);let o=e._zod.bag;if(o.minimum!==void 0)wr(t,"minimum",o.minimum);if(o.exclusiveMinimum!==void 0)wr(t,"exclusiveMinimum",o.exclusiveMinimum);if(o.maximum!==void 0)xr(t,"maximum",o.maximum);if(o.exclusiveMaximum!==void 0)xr(t,"exclusiveMaximum",o.exclusiveMaximum);if(o.multipleOf!==void 0)Sf(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)Pf(t,o.mime);for(let s of o.patterns??[])kf(t,s);return t}var Hb={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Bb=new Map([[wi,Hu],[co,Bu]]),Tf=(e)=>Bb.get(e)??e,Rf=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:s,maximum:i,format:a,patterns:u,contentEncoding:c,laxFormat:l}=Fe(e);if(typeof s==="number")o.minLength=s;if(typeof i==="number")o.maxLength=i;if(a){if(o.format=Hb[a]??a,o.format==="")delete o.format;if(a==="time"||l)delete o.format}if(c)o.contentEncoding=c;if(u&&u.size>0){let d=[...u].map(Tf);if(d.length===1)o.pattern=d[0].source;else if(d.length>1)o.allOf=[...d.map((m)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))]}},Of=(e,t,r,n)=>{let o=r,{minimum:s,maximum:i,multipleOf:a,exclusiveMaximum:u,exclusiveMinimum:c,isInt:l}=Fe(e);o.type=l?"integer":"number";let d=typeof c==="number"&&c>=(s??Number.NEGATIVE_INFINITY),m=typeof u==="number"&&u<=(i??Number.POSITIVE_INFINITY),f=t.target==="draft-04"||t.target==="openapi-3.0";if(d)if(f)o.minimum=c,o.exclusiveMinimum=!0;else o.exclusiveMinimum=c;else if(typeof s==="number")o.minimum=s;if(m)if(f)o.maximum=u,o.exclusiveMaximum=!0;else o.exclusiveMaximum=u;else if(typeof i==="number")o.maximum=i;if(a){let p=new Set;for(let y of a)if(Number.isFinite(y)&&y!==0)p.add(Math.abs(y));else _t(e,t,o,n,`A multipleOf divisor of ${y} cannot be represented in JSON Schema`);let[g,..._]=p;if(g!==void 0)o.multipleOf=g;if(_.length)o.allOf=[...o.allOf??[],..._.map((y)=>({multipleOf:y}))]}},If=(e,t,r,n)=>{r.type="boolean"};var Cf=(e,t,r,n)=>{if(t.target==="openapi-3.0")r.type="string",r.nullable=!0,r.enum=[null];else r.type="null"};var Af=(e,t,r,n)=>{r.not={}},Nf=(e,t,r,n)=>{},jf=(e,t,r,n)=>{};var Zf=(e,t,r,n)=>{let o=e._zod.def,s=en(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},Df=(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(_t(e,t,r,n,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof i==="bigint"){if(_t(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}};var Mf=(e,t,r,n)=>{_t(e,t,r,n,"Custom types cannot be represented in JSON Schema")};var qf=(e,t,r,n)=>{_t(e,t,r,n,"Transforms cannot be represented in JSON Schema")};var Lf=(e,t,r,n)=>{let o=r,s=e._zod.def,{minimum:i,maximum:a}=Fe(e);if(typeof i==="number")o.minItems=i;if(typeof a==="number")o.maxItems=a;o.type="array",o.items=he(s.element,t,{...n,path:[...n.path,"items"]})};function bo(e){let t=e._zod.def;if(t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform"))return bo(t.out);if(t.type==="catch")return bo(t.innerType);return e._zod.optin}var Uf=(e,t,r,n)=>{let o=r,s=e._zod.def,i=s.shape;if(Object.getOwnPropertySymbols(i).length&&_t(e,t,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let c in i)Le(o.properties,c,he(i[c],t,{...n,path:[...n.path,"properties",c]}));let u=[];for(let c of Object.keys(i)){let l=s.shape[c];if(t.io==="input"?bo(l)===void 0:l._zod.optout===void 0)u.push(c)}if(u.length>0)o.required=u;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=he(s.catchall,t,{...n,path:[...n.path,"additionalProperties"]})},Ff=(e,t,r,n)=>{let o=e._zod.def,s=o.inclusive===!1,i=o.options.map((a,u)=>he(a,t,{...n,path:[...n.path,s?"oneOf":"anyOf",u]}));if(s)r.oneOf=i;else r.anyOf=i},Vf=(e,t,r,n)=>{let o=e._zod.def,s=he(o.left,t,{...n,path:[...n.path,"allOf",0]}),i=he(o.right,t,{...n,path:[...n.path,"allOf",1]}),a=(c)=>("allOf"in c)&&Object.keys(c).length===1,u=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];r.allOf=u,t.intersections.push(u)};function Gi(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let p=e.get(t)?.def;if(!p)return t;let g=Gi(e,p,r);return g===p?t:g}for(let p of["anyOf","oneOf"]){let g=t[p];if(!Array.isArray(g))continue;let _=g.map((y)=>Gi(e,y,r));if(_.some((y,k)=>y!==g[k]))t={...t,[p]:_}}let n=Array.isArray(t.type)?t.type:[t.type],o=!n.includes("string")&&n.some((p)=>p==="number"||p==="integer"),s=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!s?.some((p)=>typeof p==="number"))return t;let{minimum:i,maximum:a,exclusiveMinimum:u,exclusiveMaximum:c,multipleOf:l,format:d,id:m,...f}=t;if(f.enum)f.enum=f.enum.map((p)=>typeof p==="number"?String(p):p);else if(typeof f.const==="number")f.const=String(f.const);if(!o)return f;if(f.type="string",!s)f.pattern=(n.includes("number")?an:mi).source;return f}var Xi=new WeakMap;function Jb(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 Xi.get(e)??[]){let o=e.seen.get(n),s=(o?.def??o?.schema)?.propertyNames;if(!s||s===!0||r.has(s))continue;let i=Gi(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 Hf=(e,t,r,n)=>{let o=r,s=e._zod.def;o.type="object";let i=s.keyType,a=Fe(i).patterns;if(s.mode==="loose"&&a&&a.size>0){let l=he(s.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let d of a)Le(o.patternProperties,Tf(d).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=he(s.keyType,t,{...n,path:[...n.path,"propertyNames"]});let l=Xi.get(t);if(!l)l=[],Xi.set(t,l),t.deferred.push(()=>Jb(t));l.push(e)}o.additionalProperties=he(s.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let u=i._zod.values,c=t.io==="input"&&bo(s.valueType)!==void 0;if(u&&!s.partial&&!c){let l=[...u].filter((d)=>typeof d==="string"||typeof d==="number");if(l.length>0)o.required=l.map(String)}},Bf=(e,t,r,n)=>{let o=e._zod.def,s=he(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"}]},Jf=(e,t,r,n)=>{let o=e._zod.def;he(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType},Yi=Symbol();function Kf(e,t,r,n,o){let s=!1,i=JSON.stringify(e,(a,u)=>{if(typeof u!=="bigint")return u;return s=!0,null});if(!s)return JSON.parse(i);return _t(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),Yi}var Wf=(e,t,r,n)=>{let o=e._zod.def;he(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType;let i=Kf(o.defaultValue,e,t,r,n);if(i!==Yi)r.default=i},Gf=(e,t,r,n)=>{let o=e._zod.def;he(o.innerType,t,n);let s=t.seen.get(e);if(s.ref=o.innerType,t.io!=="input")return;let i=Kf(o.defaultValue,e,t,r,n);if(i!==Yi)r._prefault=i},Xf=(e,t,r,n)=>{let o=e._zod.def;he(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType;let i;try{i=o.catchValue(void 0)}catch{_t(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=i},Yf=(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;he(i,t,n);let a=t.seen.get(e);a.ref=i},Qf=(e,t,r,n)=>{let o=e._zod.def;he(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType,r.readOnly=!0};var Qi=(e,t,r,n)=>{let o=e._zod.def;he(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType};function wo(e){return!!e._zod}function Ee(e,t){if(wo(e))return di(e,t);return e.safeParse(t)}function zr(e){if(!e)return;let t;if(wo(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 Sr(e){if(wo(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 ep=new WeakSet([Object.prototype,Error.prototype]);function xo(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 n0=(e,t)=>{vu.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);if(ep.has(r))return;ep.add(r),xo(r,"format",(n)=>(o)=>li(n,o)),xo(r,"flatten",(n)=>(o)=>ui(n,o)),xo(r,"addIssue",(n)=>(o)=>{n.issues.push(o),n.message=JSON.stringify(n.issues,tn,2)}),xo(r,"addIssues",(n)=>(o)=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,tn,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})};var Me=v("ZodError",n0,void 0,{Parent:Error});var tp=Yn(Me),rp=Qn(Me),np=sn(Me),op=eo(Me),sp=xu(Me),ip=$u(Me),ap=zu(Me),cp=Su(Me),up=ku(Me),lp=Pu(Me),dp=Eu(Me),fp=Tu(Me);function s0(){if(!Re.localeError)Oe(Ti())}function zo(){if(!Re.memoizer)Oe({memoizer:Ei()})}var ne=v("ZodType",(e,t)=>(s0(),ee.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(De(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 Xe(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(B0(e,t))},superRefine(e,t){return this.check(J0(e,t))},overwrite(e){return this.check(Tt(e))},optional(){return ae(this)},exactOptional(){return A0(this)},nullable(){return hp(this)},nullish(){return ae(hp(this))},nonoptional(e){return q0(this,e)},array(){return S(this)},or(e){return oe([this,e])},and(e){return ko(this,e)},transform(e){return gp(this,Tp(e))},default(e){return Z0(this,e)},prefault(e){return M0(this,e)},catch(e){return U0(this,e)},pipe(e){return gp(this,e)},readonly(){return H0(this)},describe(e){let t=this.clone();return Et.add(t,{description:e}),t},meta(...e){if(e.length===0)return Et.get(this);let t=this.clone();return Et.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 Gn(this,"~standard",{...bi(this),jsonSchema:{input:mn(this,"input"),output:mn(this,"output")}})},set "~standard"(e){gt(this,"~standard",e)},parse:function e(t,r){return tp(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await rp(this,t,r,{callee:e})},safeParse(e,t){return np(this,e,t)},async safeParseAsync(e,t){return op(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){gt(this,"spa",e)},validate(e,t){return to(this,e,t)},validateAsync(e,t){return ro(this,e,t)},encode:function e(t,r){return sp(this,t,r,{callee:e})},decode:function e(t,r){return ip(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await ap(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await cp(this,t,r,{callee:e})},safeEncode(e,t){return up(this,e,t)},safeDecode(e,t){return lp(this,e,t)},async safeEncodeAsync(e,t){return dp(this,e,t)},async safeDecodeAsync(e,t){return fp(this,e,t)},toJSONSchema(e){return bf(this,{})(e)},get description(){return Et.get(this)?.description},get _def(){return this._zod.def}}),_p=v("_ZodString",(e,t)=>{ao.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Rf(e,r,n,o)},pu({format:(e)=>Fe(e).format??null,minLength:(e)=>Fe(e).minimum??null,maxLength:(e)=>Fe(e).maximum??null},{regex(...e){return this.check(Ni(...e))},includes(...e){return this.check(Di(...e))},startsWith(...e){return this.check(Mi(...e))},endsWith(...e){return this.check(qi(...e))},min(...e){return this.check(br(...e))},max(...e){return this.check(yo(...e))},length(...e){return this.check(vo(...e))},nonempty(...e){return this.check(br(1,...e))},lowercase(e){return this.check(ji(e))},uppercase(e){return this.check(Zi(e))},trim(){return this.check(Ui())},normalize(...e){return this.check(Li(...e))},toLowerCase(){return this.check(Fi())},toUpperCase(){return this.check(Vi())},slugify(){return this.check(Hi())}})),yp=v("ZodString",(e,t)=>{ao.init(e,t),_p.init(e,t)},{email(e){return this.check(Nd(i0,e))},url(e){return this.check(Oi(xp,e))},jwt(e){return this.check(tf(x0,e))},emoji(e){return this.check(Ld(c0,e))},guid(e){return this.check(jd(a0,e))},uuid(e){return this.check(Zd($o,e))},uuidv4(e){return this.check(Dd($o,e))},uuidv6(e){return this.check(Md($o,e))},uuidv7(e){return this.check(qd($o,e))},nanoid(e){return this.check(Ud(u0,e))},cuid(e){return this.check(Fd(l0,e))},cuid2(e){return this.check(Vd(d0,e))},ulid(e){return this.check(Hd(f0,e))},base64(e){return this.check(Yd(v0,e))},base64url(e){return this.check(Qd(b0,e))},xid(e){return this.check(Bd(p0,e))},ksuid(e){return this.check(Jd(m0,e))},ipv4(e){return this.check(Kd(h0,e))},ipv6(e){return this.check(Wd(g0,e))},cidrv4(e){return this.check(Gd(_0,e))},cidrv6(e){return this.check(Xd(y0,e))},e164(e){return this.check(ef(w0,e))},datetime(e){return this.check(mo(ta,e))},date(e){return this.check(Ii(vp,e))},time(e){return this.check(Ci(bp,e))},duration(e){return this.check(Ai(wp,e))}});function h(e){return Ad(yp,e)}var ue=v("ZodStringFormat",(e,t)=>{re.init(e,t),_p.init(e,t)}),ta=v("ZodISODateTime",(e,t)=>{Ul.init(e,t),ue.init(e,t)}),vp=v("ZodISODate",(e,t)=>{Fl.init(e,t),ue.init(e,t)}),bp=v("ZodISOTime",(e,t)=>{Vl.init(e,t),ue.init(e,t)}),wp=v("ZodISODuration",(e,t)=>{Hl.init(e,t),ue.init(e,t)}),i0=v("ZodEmail",(e,t)=>{Ol.init(e,t),ue.init(e,t)});var a0=v("ZodGUID",(e,t)=>{Tl.init(e,t),ue.init(e,t)});var $o=v("ZodUUID",(e,t)=>{Rl.init(e,t),ue.init(e,t)});var xp=v("ZodURL",(e,t)=>{Al.init(e,t),ue.init(e,t)});function $p(e){return Oi(xp,e)}var c0=v("ZodEmoji",(e,t)=>{Nl.init(e,t),ue.init(e,t)});var u0=v("ZodNanoID",(e,t)=>{jl.init(e,t),ue.init(e,t)});var l0=v("ZodCUID",(e,t)=>{Zl.init(e,t),ue.init(e,t)});var d0=v("ZodCUID2",(e,t)=>{Dl.init(e,t),ue.init(e,t)});var f0=v("ZodULID",(e,t)=>{Ml.init(e,t),ue.init(e,t)});var p0=v("ZodXID",(e,t)=>{ql.init(e,t),ue.init(e,t)});var m0=v("ZodKSUID",(e,t)=>{Ll.init(e,t),ue.init(e,t)});var h0=v("ZodIPv4",(e,t)=>{Bl.init(e,t),ue.init(e,t)});var g0=v("ZodIPv6",(e,t)=>{Kl.init(e,t),ue.init(e,t)});var _0=v("ZodCIDRv4",(e,t)=>{Wl.init(e,t),ue.init(e,t)});var y0=v("ZodCIDRv6",(e,t)=>{Gl.init(e,t),ue.init(e,t)});var v0=v("ZodBase64",(e,t)=>{Yl.init(e,t),ue.init(e,t)});var b0=v("ZodBase64URL",(e,t)=>{Ql.init(e,t),ue.init(e,t)});var w0=v("ZodE164",(e,t)=>{ed.init(e,t),ue.init(e,t)});var x0=v("ZodJWT",(e,t)=>{td.init(e,t),ue.init(e,t)});var So=v("ZodNumber",(e,t)=>{xi.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Of(e,r,n,o),e.isFinite=!0},pu({minValue:(e)=>{let{minimum:t,exclusiveMinimum:r}=Fe(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:(e)=>{let{maximum:t,exclusiveMaximum:r}=Fe(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:(e)=>{let{isInt:t,multipleOf:r}=Fe(e);return!!t||!!r?.some(Number.isSafeInteger)},format:(e)=>Fe(e).format??null},{gt(e,t){return this.check(go(e,t))},gte(e,t){return this.check(fn(e,t))},min(e,t){return this.check(fn(e,t))},lt(e,t){return this.check(ho(e,t))},lte(e,t){return this.check(dn(e,t))},max(e,t){return this.check(dn(e,t))},int(e){return this.check(pp(e))},safe(e){return this.check(pp(e))},positive(e){return this.check(go(0,e))},nonnegative(e){return this.check(fn(0,e))},negative(e){return this.check(ho(0,e))},nonpositive(e){return this.check(dn(0,e))},multipleOf(e,t){return this.check(_o(e,t))},step(e,t){return this.check(_o(e,t))},finite(){return this}}));function B(e){return rf(So,e)}var $0=v("ZodNumberFormat",(e,t)=>{rd.init(e,t),So.init(e,t)});function pp(e){return of($0,e)}var zp=v("ZodBoolean",(e,t)=>{nd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>If(e,r,n,o)});function Q(e){return sf(zp,e)}var z0=v("ZodNull",(e,t)=>{od.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Cf(e,r,n,o)});function Sp(e){return af(z0,e)}var S0=v("ZodAny",(e,t)=>{sd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Nf(e,r,n,o)});function kp(){return cf(S0)}var k0=v("ZodUnknown",(e,t)=>{id.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>jf(e,r,n,o)});function ie(){return uf(k0)}var P0=v("ZodNever",(e,t)=>{ad.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Af(e,r,n,o)});function E0(e){return lf(P0,e)}var T0=v("ZodArray",(e,t)=>{zo(),cd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Lf(e,r,n,o),e.element=t.element},{min(e,t){return this.check(br(e,t))},nonempty(e){return this.check(br(1,e))},max(e,t){return this.check(yo(e,t))},length(e,t){return this.check(vo(e,t))},unwrap(){return this.element}});function S(e,t){return df(T0,e,t)}var Pp=v("ZodObject",(e,t)=>{zo(),dd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Uf(e,r,n,o),ub(e,"shape",(r)=>r._zod.def.shape,!1)},{keyof(){return Ie(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(De(this._zod.def,{catchall:e}))},passthrough(){return this.clone(De(this._zod.def,{catchall:ie()}))},loose(){return this.clone(De(this._zod.def,{catchall:ie()}))},strict(){return this.clone(De(this._zod.def,{catchall:E0()}))},strip(){return this.clone(De(this._zod.def,{catchall:void 0}))},extend(e){return tb(this,e)},safeExtend(e){return rb(this,e)},merge(e){return nb(this,e)},pick(e){return Qv(this,e)},omit(e){return eb(this,e)},partial(...e){return uu(Rp,this,e[0])},exactPartial(...e){return uu(Op,this,e[0],"exactPartial")},required(...e){return ob(Ip,this,e[0])}});function P(e,t){let r={type:"object",shape:e??{},...O(t)};return new Pp(r)}function ye(e,t){return new Pp({type:"object",shape:e,catchall:ie(),...O(t)})}var Ep=v("ZodUnion",(e,t)=>{$i.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ff(e,r,n,o),e.options=t.options});function oe(e,t){return new Ep({type:"union",options:e,...O(t)})}var R0=v("ZodDiscriminatedUnion",(e,t)=>{Ep.init(e,t),fd.init(e,t)});function ra(e,t,r){return new R0({type:"union",options:t,discriminator:e,...O(r)})}var O0=v("ZodIntersection",(e,t)=>{pd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Vf(e,r,n,o)});function ko(e,t){return new O0({type:"intersection",left:e,right:t})}var mp=v("ZodRecord",(e,t)=>{zo(),md.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hf(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function te(e,t,r){if(!t||!t._zod)return new mp({type:"record",keyType:h(),valueType:e,...O(t)});return new mp({type:"record",keyType:e,valueType:t,...O(r)})}var ea=v("ZodEnum",(e,t)=>{hd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(n,o,s)=>Zf(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 ea({...t,checks:[],...O(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 ea({...t,checks:[],...O(o),entries:s})}});function Ie(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((n)=>[n,n])):e;return new ea({type:"enum",entries:r,...O(t)})}var I0=v("ZodLiteral",(e,t)=>{gd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Df(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 A(e,t){return new I0({type:"literal",values:Array.isArray(e)?e:[e],...O(t)})}var C0=v("ZodTransform",(e,t)=>{zo(),_d.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>qf(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new on(e.constructor.name);r.addIssue=(s)=>{if(typeof s==="string")r.issues.push(sr(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(sr(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 Tp(e){return new C0({type:"transform",transform:e})}var Rp=v("ZodOptional",(e,t)=>{zi.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qi(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ae(e){return new Rp({type:"optional",innerType:e})}var Op=v("ZodExactOptional",(e,t)=>{yd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qi(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function A0(e){return new Op({type:"optional",innerType:e})}var N0=v("ZodNullable",(e,t)=>{vd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Bf(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function hp(e){return new N0({type:"nullable",innerType:e})}var j0=v("ZodDefault",(e,t)=>{bd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wf(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Z0(e,t){return new j0({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():ti(t)}})}var D0=v("ZodPrefault",(e,t)=>{wd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Gf(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function M0(e,t){return new D0({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():ti(t)}})}var Ip=v("ZodNonOptional",(e,t)=>{xd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Jf(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function q0(e,t){return new Ip({type:"nonoptional",innerType:e,...O(t)})}var L0=v("ZodCatch",(e,t)=>{$d.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xf(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function U0(e,t){return new L0({type:"catch",innerType:e,catchValue:typeof t==="function"?t:mu(t)})}var Cp=v("ZodPipe",(e,t)=>{Si.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Yf(e,r,n,o),e.in=t.in,e.out=t.out});function gp(e,t){return new Cp({type:"pipe",in:e,out:t})}var F0=v("ZodPreprocess",(e,t)=>{Cp.init(e,t),zd.init(e,t)}),V0=v("ZodReadonly",(e,t)=>{Sd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qf(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function H0(e){return new V0({type:"readonly",innerType:e})}var Ap=v("ZodCustom",(e,t)=>{kd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Mf(e,r,n,o)});function Np(e,t){return ff(Ap,e??(()=>!0),t)}function B0(e,t={}){return pf(Ap,e,t)}function J0(e,t){return mf(e,t)}function na(e,t){return new F0({type:"pipe",in:Tp(e),out:t})}var Zp={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};var jp;(function(e){})(jp||(jp={}));function W0(e){return mo(ta,e)}function G0(e){return nf(So,e)}var Rt="2025-11-25";var Eo=[Rt,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Ot="io.modelcontextprotocol/related-task",To="2.0",ve=Np((e)=>e!==null&&(typeof e==="object"||typeof e==="function")),qp=oe([h(),B().int()]),Lp=h(),p1=ye({ttl:B().optional(),pollInterval:B().optional()}),Y0=P({ttl:B().optional()}),Q0=P({taskId:h()}),oa=ye({progressToken:qp.optional(),[Ot]:Q0.optional()}),qe=P({_meta:oa.optional()}),hn=qe.extend({task:Y0.optional()}),Up=(e)=>hn.safeParse(e).success,xe=P({method:h(),params:qe.loose().optional()}),Ve=P({_meta:oa.optional()}),He=P({method:h(),params:Ve.loose().optional()}),$e=ye({_meta:oa.optional()}),Ro=oe([h(),B().int()]),Fp=P({jsonrpc:A(To),id:Ro,...xe.shape}).strict(),gn=(e)=>Fp.safeParse(e).success,Vp=P({jsonrpc:A(To),...He.shape}).strict(),Hp=(e)=>Vp.safeParse(e).success,sa=P({jsonrpc:A(To),id:Ro,result:$e}).strict(),ir=(e)=>sa.safeParse(e).success;var j;(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"})(j||(j={}));var ia=P({jsonrpc:A(To),id:Ro.optional(),error:P({code:B().int(),message:h(),data:ie().optional()})}).strict();var Bp=(e)=>ia.safeParse(e).success;var Pr=oe([Fp,Vp,sa,ia]),m1=oe([sa,ia]),yt=$e.strict(),ew=Ve.extend({requestId:Ro.optional(),reason:h().optional()}),Oo=He.extend({method:A("notifications/cancelled"),params:ew}),tw=P({src:h(),mimeType:h().optional(),sizes:S(h()).optional(),theme:Ie(["light","dark"]).optional()}),_n=P({icons:S(tw).optional()}),kr=P({name:h(),title:h().optional()}),Jp=kr.extend({...kr.shape,..._n.shape,version:h(),websiteUrl:h().optional(),description:h().optional()}),rw=ko(P({applyDefaults:Q().optional()}),te(h(),ie())),nw=na((e)=>{if(e&&typeof e==="object"&&!Array.isArray(e)){if(Object.keys(e).length===0)return{form:{}}}return e},ko(P({form:rw.optional(),url:ve.optional()}),te(h(),ie()).optional())),ow=ye({list:ve.optional(),cancel:ve.optional(),requests:ye({sampling:ye({createMessage:ve.optional()}).optional(),elicitation:ye({create:ve.optional()}).optional()}).optional()}),sw=ye({list:ve.optional(),cancel:ve.optional(),requests:ye({tools:ye({call:ve.optional()}).optional()}).optional()}),iw=P({experimental:te(h(),ve).optional(),sampling:P({context:ve.optional(),tools:ve.optional()}).optional(),elicitation:nw.optional(),roots:P({listChanged:Q().optional()}).optional(),tasks:ow.optional(),extensions:te(h(),ve).optional()}),aw=qe.extend({protocolVersion:h(),capabilities:iw,clientInfo:Jp}),aa=xe.extend({method:A("initialize"),params:aw});var cw=P({experimental:te(h(),ve).optional(),logging:ve.optional(),completions:ve.optional(),prompts:P({listChanged:Q().optional()}).optional(),resources:P({subscribe:Q().optional(),listChanged:Q().optional()}).optional(),tools:P({listChanged:Q().optional()}).optional(),tasks:sw.optional(),extensions:te(h(),ve).optional()}),ca=$e.extend({protocolVersion:h(),capabilities:cw,serverInfo:Jp,instructions:h().optional()}),Io=He.extend({method:A("notifications/initialized"),params:Ve.optional()}),Kp=(e)=>Io.safeParse(e).success,Co=xe.extend({method:A("ping"),params:qe.optional()}),uw=P({progress:B(),total:ae(B()),message:ae(h())}),lw=P({...Ve.shape,...uw.shape,progressToken:qp}),Ao=He.extend({method:A("notifications/progress"),params:lw}),dw=qe.extend({cursor:Lp.optional()}),yn=xe.extend({params:dw.optional()}),vn=$e.extend({nextCursor:Lp.optional()}),fw=Ie(["working","input_required","completed","failed","cancelled"]),bn=P({taskId:h(),status:fw,ttl:oe([B(),Sp()]),createdAt:h(),lastUpdatedAt:h(),pollInterval:ae(B()),statusMessage:ae(h())}),vt=$e.extend({task:bn}),pw=Ve.merge(bn),wn=He.extend({method:A("notifications/tasks/status"),params:pw}),No=xe.extend({method:A("tasks/get"),params:qe.extend({taskId:h()})}),jo=$e.merge(bn),Zo=xe.extend({method:A("tasks/result"),params:qe.extend({taskId:h()})}),h1=$e.loose(),Do=yn.extend({method:A("tasks/list")}),Mo=vn.extend({tasks:S(bn)}),qo=xe.extend({method:A("tasks/cancel"),params:qe.extend({taskId:h()})}),Wp=$e.merge(bn),Gp=P({uri:h(),mimeType:ae(h()),_meta:te(h(),ie()).optional()}),Xp=Gp.extend({text:h()}),ua=h().refine((e)=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Yp=Gp.extend({blob:ua}),xn=Ie(["user","assistant"]),Er=P({audience:S(xn).optional(),priority:B().min(0).max(1).optional(),lastModified:W0({offset:!0}).optional()}),Qp=P({...kr.shape,..._n.shape,uri:h(),description:ae(h()),mimeType:ae(h()),size:ae(B()),annotations:Er.optional(),_meta:ae(ye({}))}),mw=P({...kr.shape,..._n.shape,uriTemplate:h(),description:ae(h()),mimeType:ae(h()),annotations:Er.optional(),_meta:ae(ye({}))}),hw=yn.extend({method:A("resources/list")}),la=vn.extend({resources:S(Qp)}),gw=yn.extend({method:A("resources/templates/list")}),da=vn.extend({resourceTemplates:S(mw)}),fa=qe.extend({uri:h()}),_w=fa,yw=xe.extend({method:A("resources/read"),params:_w}),pa=$e.extend({contents:S(oe([Xp,Yp]))}),ma=He.extend({method:A("notifications/resources/list_changed"),params:Ve.optional()}),vw=fa,bw=xe.extend({method:A("resources/subscribe"),params:vw}),ww=fa,xw=xe.extend({method:A("resources/unsubscribe"),params:ww}),$w=Ve.extend({uri:h()}),zw=He.extend({method:A("notifications/resources/updated"),params:$w}),Sw=P({name:h(),description:ae(h()),required:ae(Q())}),kw=P({...kr.shape,..._n.shape,description:ae(h()),arguments:ae(S(Sw)),_meta:ae(ye({}))}),Pw=yn.extend({method:A("prompts/list")}),ha=vn.extend({prompts:S(kw)}),Ew=qe.extend({name:h(),arguments:te(h(),h()).optional()}),Tw=xe.extend({method:A("prompts/get"),params:Ew}),ga=P({type:A("text"),text:h(),annotations:Er.optional(),_meta:te(h(),ie()).optional()}),_a=P({type:A("image"),data:ua,mimeType:h(),annotations:Er.optional(),_meta:te(h(),ie()).optional()}),ya=P({type:A("audio"),data:ua,mimeType:h(),annotations:Er.optional(),_meta:te(h(),ie()).optional()}),Rw=P({type:A("tool_use"),name:h(),id:h(),input:te(h(),ie()),_meta:te(h(),ie()).optional()}),Ow=P({type:A("resource"),resource:oe([Xp,Yp]),annotations:Er.optional(),_meta:te(h(),ie()).optional()}),Iw=Qp.extend({type:A("resource_link")}),va=oe([ga,_a,ya,Iw,Ow]),Cw=P({role:xn,content:va}),ba=$e.extend({description:h().optional(),messages:S(Cw)}),wa=He.extend({method:A("notifications/prompts/list_changed"),params:Ve.optional()}),Aw=P({title:h().optional(),readOnlyHint:Q().optional(),destructiveHint:Q().optional(),idempotentHint:Q().optional(),openWorldHint:Q().optional()}),Nw=P({taskSupport:Ie(["required","optional","forbidden"]).optional()}),em=P({...kr.shape,..._n.shape,description:h().optional(),inputSchema:P({type:A("object"),properties:te(h(),ve).optional(),required:S(h()).optional()}).catchall(ie()),outputSchema:P({type:A("object"),properties:te(h(),ve).optional(),required:S(h()).optional()}).catchall(ie()).optional(),annotations:Aw.optional(),execution:Nw.optional(),_meta:te(h(),ie()).optional()}),xa=yn.extend({method:A("tools/list")}),$a=vn.extend({tools:S(em)}),It=$e.extend({content:S(va).default([]),structuredContent:te(h(),ie()).optional(),isError:Q().optional()}),g1=It.or($e.extend({toolResult:ie()})),jw=hn.extend({name:h(),arguments:te(h(),ie()).optional()}),$n=xe.extend({method:A("tools/call"),params:jw}),zn=He.extend({method:A("notifications/tools/list_changed"),params:Ve.optional()}),tm=P({autoRefresh:Q().default(!0),debounceMs:B().int().nonnegative().default(300)}),Sn=Ie(["debug","info","notice","warning","error","critical","alert","emergency"]),Zw=qe.extend({level:Sn}),za=xe.extend({method:A("logging/setLevel"),params:Zw}),Dw=Ve.extend({level:Sn,logger:h().optional(),data:ie()}),Mw=He.extend({method:A("notifications/message"),params:Dw}),qw=P({name:h().optional()}),Lw=P({hints:S(qw).optional(),costPriority:B().min(0).max(1).optional(),speedPriority:B().min(0).max(1).optional(),intelligencePriority:B().min(0).max(1).optional()}),Uw=P({mode:Ie(["auto","required","none"]).optional()}),Fw=P({type:A("tool_result"),toolUseId:h().describe("The unique identifier for the corresponding tool call."),content:S(va).default([]),structuredContent:P({}).loose().optional(),isError:Q().optional(),_meta:te(h(),ie()).optional()}),Vw=ra("type",[ga,_a,ya]),Po=ra("type",[ga,_a,ya,Rw,Fw]),Hw=P({role:xn,content:oe([Po,S(Po)]),_meta:te(h(),ie()).optional()}),Bw=hn.extend({messages:S(Hw),modelPreferences:Lw.optional(),systemPrompt:h().optional(),includeContext:Ie(["none","thisServer","allServers"]).optional(),temperature:B().optional(),maxTokens:B().int(),stopSequences:S(h()).optional(),metadata:ve.optional(),tools:S(em).optional(),toolChoice:Uw.optional()}),Sa=xe.extend({method:A("sampling/createMessage"),params:Bw}),ar=$e.extend({model:h(),stopReason:ae(Ie(["endTurn","stopSequence","maxTokens"]).or(h())),role:xn,content:Vw}),kn=$e.extend({model:h(),stopReason:ae(Ie(["endTurn","stopSequence","maxTokens","toolUse"]).or(h())),role:xn,content:oe([Po,S(Po)])}),Jw=P({type:A("boolean"),title:h().optional(),description:h().optional(),default:Q().optional()}),Kw=P({type:A("string"),title:h().optional(),description:h().optional(),minLength:B().optional(),maxLength:B().optional(),format:Ie(["email","uri","date","date-time"]).optional(),default:h().optional()}),Ww=P({type:Ie(["number","integer"]),title:h().optional(),description:h().optional(),minimum:B().optional(),maximum:B().optional(),default:B().optional()}),Gw=P({type:A("string"),title:h().optional(),description:h().optional(),enum:S(h()),default:h().optional()}),Xw=P({type:A("string"),title:h().optional(),description:h().optional(),oneOf:S(P({const:h(),title:h()})),default:h().optional()}),Yw=P({type:A("string"),title:h().optional(),description:h().optional(),enum:S(h()),enumNames:S(h()).optional(),default:h().optional()}),Qw=oe([Gw,Xw]),ex=P({type:A("array"),title:h().optional(),description:h().optional(),minItems:B().optional(),maxItems:B().optional(),items:P({type:A("string"),enum:S(h())}),default:S(h()).optional()}),tx=P({type:A("array"),title:h().optional(),description:h().optional(),minItems:B().optional(),maxItems:B().optional(),items:P({anyOf:S(P({const:h(),title:h()}))}),default:S(h()).optional()}),rx=oe([ex,tx]),nx=oe([Yw,Qw,rx]),ox=oe([nx,Jw,Kw,Ww]),sx=hn.extend({mode:A("form").optional(),message:h(),requestedSchema:P({type:A("object"),properties:te(h(),ox),required:S(h()).optional()})}),ix=hn.extend({mode:A("url"),message:h(),elicitationId:h(),url:h().url()}),ax=oe([sx,ix]),ka=xe.extend({method:A("elicitation/create"),params:ax}),cx=Ve.extend({elicitationId:h()}),ux=He.extend({method:A("notifications/elicitation/complete"),params:cx}),Ct=$e.extend({action:Ie(["accept","decline","cancel"]),content:na((e)=>e===null?void 0:e,te(h(),oe([h(),B(),Q(),S(h())])).optional())}),lx=P({type:A("ref/resource"),uri:h()});var dx=P({type:A("ref/prompt"),name:h()}),fx=qe.extend({ref:oe([dx,lx]),argument:P({name:h(),value:h()}),context:P({arguments:te(h(),h()).optional()}).optional()}),px=xe.extend({method:A("completion/complete"),params:fx});var Pa=$e.extend({completion:ye({values:S(h()).max(100),total:ae(B().int()),hasMore:ae(Q())})}),mx=P({uri:h().startsWith("file://"),name:h().optional(),_meta:te(h(),ie()).optional()}),hx=xe.extend({method:A("roots/list"),params:qe.optional()}),Ea=$e.extend({roots:S(mx)}),gx=He.extend({method:A("notifications/roots/list_changed"),params:Ve.optional()}),_1=oe([Co,aa,px,za,Tw,Pw,hw,gw,yw,bw,xw,$n,xa,No,Zo,Do,qo]),y1=oe([Oo,Ao,Io,gx,wn]),v1=oe([yt,ar,kn,Ct,Ea,jo,Mo,vt]),b1=oe([Co,Sa,ka,hx,No,Zo,Do,qo]),w1=oe([Oo,Ao,Mw,zw,ma,zn,wa,wn,ux]),x1=oe([yt,ca,Pa,ba,ha,la,da,pa,It,$a,jo,Mo,vt]);class I 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===j.UrlElicitationRequired&&r){let n=r;if(n.elicitations)return new rm(n.elicitations,t)}return new I(e,t,r)}}class rm extends I{constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(j.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}}function At(e){return e==="completed"||e==="failed"||e==="cancelled"}var _x=Symbol("Let zodToJsonSchema decide on which parser to use");var tA=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Ta(e){let r=zr(e)?.method;if(!r)throw Error("Schema is missing a method literal");let n=Sr(r);if(typeof n!=="string")throw Error("Schema method literal must be a string");return n}function Ra(e,t){let r=Ee(e,t);if(!r.success)throw r.error;return r.data}var $x=60000;class En{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(Oo,(t)=>{this._oncancel(t)}),this.setNotificationHandler(Ao,(t)=>{this._onprogress(t)}),this.setRequestHandler(Co,(t)=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore)this.setRequestHandler(No,async(t,r)=>{let n=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!n)throw new I(j.InvalidParams,"Failed to retrieve task: Task not found");return{...n}}),this.setRequestHandler(Zo,async(t,r)=>{let n=async()=>{let o=t.params.taskId;if(!await this._taskStore.getTask(o,r.sessionId))throw new I(j.InvalidParams,`Task not found: ${o}`);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,u=a.id,c=this._requestResolvers.get(u);if(c)if(this._requestResolvers.delete(u),i.type==="response")c(a);else{let l=a,d=new I(l.error.code,l.error.message,l.error.data);c(d)}else{let l=i.type==="response"?"Response":"Error";this._onerror(Error(`${l} handler missing for request ${u}`))}continue}await this._transport?.send(i.message,{relatedRequestId:r.requestId})}}let s=await this._taskStore.getTask(o,r.sessionId);if(!s)throw new I(j.InvalidParams,`Task not found: ${o}`);if(!At(s.status))return await this._waitForTaskUpdate(o,r.signal,r.sessionId),await n();if(At(s.status)){let i=await this._taskStore.getTaskResult(o,r.sessionId);return this._clearTaskQueue(o,r.sessionId),{...i,_meta:{...i._meta,[Ot]:{taskId:o}}}}return await n()};return await n()}),this.setRequestHandler(Do,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 I(j.InvalidParams,`Failed to list tasks: ${n instanceof Error?n.message:String(n)}`)}}),this.setRequestHandler(qo,async(t,r)=>{try{let n=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!n)throw new I(j.InvalidParams,`Task not found: ${t.params.taskId}`);if(At(n.status))throw new I(j.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,r.sessionId);let o=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!o)throw new I(j.InvalidParams,`Task not found after cancellation: ${t.params.taskId}`);return{_meta:{},...o}}catch(n){if(n instanceof I)throw n;throw new I(j.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),I.fromError(j.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),ir(o)||Bp(o))this._onresponse(o);else if(gn(o))this._onrequest(o,s);else if(Hp(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=I.fromError(j.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?.[Ot]?.taskId,s=n?.sessionId,i=this._taskStore,a=!0,u;if(o&&i&&this._taskMessageQueue&&s!==void 0)a=!1,u=(async()=>{if(!await i.getTask(o,s))throw new I(j.InvalidParams,`Task not found: ${o}`);a=!0})();if(r===void 0){let f={jsonrpc:"2.0",id:e.id,error:{code:j.MethodNotFound,message:"Method not found"}};if(o&&u){let p={type:"error",message:f,timestamp:Date.now()};u.then(()=>this._enqueueTaskMessage(o,p,s),()=>n?.send(f)).catch((g)=>this._onerror(Error(`Failed to send an error response: ${g}`)))}else if(o&&this._taskMessageQueue)this._enqueueTaskMessage(o,{type:"error",message:f,timestamp:Date.now()},n?.sessionId).catch((p)=>this._onerror(Error(`Failed to enqueue error response: ${p}`)));else n?.send(f).catch((p)=>this._onerror(Error(`Failed to send an error response: ${p}`)));return}let c=new AbortController;this._requestHandlerAbortControllers.set(e.id,c);let l=Up(e.params)?e.params.task:void 0,d=this._taskStore?this.requestTaskStore(e,n?.sessionId):void 0,m={signal:c.signal,sessionId:n?.sessionId,_meta:e.params?._meta,sendNotification:async(f)=>{if(c.signal.aborted)return;let p={relatedRequestId:e.id};if(o)p.relatedTask={taskId:o};await this.notification(f,p)},sendRequest:async(f,p,g)=>{if(c.signal.aborted)throw new I(j.ConnectionClosed,"Request was cancelled");let _={...g,relatedRequestId:e.id};if(o&&!_.relatedTask)_.relatedTask={taskId:o};let y=_.relatedTask?.taskId??o;if(y&&d)await d.updateTaskStatus(y,"input_required");return await this.request(f,p,_)},authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo,taskId:o,taskStore:d,taskRequestedTtl:l?.ttl,closeSSEStream:t?.closeSSEStream,closeStandaloneSSEStream:t?.closeStandaloneSSEStream};(u??Promise.resolve()).then(()=>{if(u&&c.signal.aborted)throw new I(j.ConnectionClosed,"Request was cancelled");if(l)this.assertTaskHandlerCapability(e.method)}).then(()=>r(e,m)).then(async(f)=>{if(c.signal.aborted)return;let p={result:f,jsonrpc:"2.0",id:e.id};if(o&&this._taskMessageQueue)await this._enqueueTaskMessage(o,{type:"response",message:p,timestamp:Date.now()},n?.sessionId);else await n?.send(p)},async(f)=>{if(c.signal.aborted)return;let p={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(f.code)?f.code:j.InternalError,message:f.message??"Internal error",...f.data!==void 0&&{data:f.data}}};if(o&&this._taskMessageQueue&&a)await this._enqueueTaskMessage(o,{type:"error",message:p,timestamp:Date.now()},n?.sessionId);else await n?.send(p)}).catch((f)=>this._onerror(Error(`Failed to send response: ${f}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(e.id)===c)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),ir(e))r(e);else{let s=new I(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(ir(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(ir(e))n(e);else{let s=I.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 I?s:new I(j.InternalError,String(s))}}return}let o;try{let s=await this.request(e,vt,r);if(s.task)o=s.task.taskId,yield{type:"taskCreated",task:s.task};else throw new I(j.InternalError,"Task creation did not return a task");while(!0){let i=await this.getTask({taskId:o},r);if(yield{type:"taskStatus",task:i},At(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 I(j.InternalError,`Task ${o} failed`)};else if(i.status==="cancelled")yield{type:"error",error:new I(j.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((u)=>setTimeout(u,a)),r?.signal?.throwIfAborted()}}catch(s){yield{type:"error",error:s instanceof I?s:new I(j.InternalError,String(s))}}}request(e,t,r){let{relatedRequestId:n,resumptionToken:o,onresumptiontoken:s,task:i,relatedTask:a}=r??{};return new Promise((u,c)=>{let l=(y)=>{c(y)};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(y){l(y);return}r?.signal?.throwIfAborted();let d=this._requestMessageId++,m={...e,jsonrpc:"2.0",id:d};if(r?.onprogress)this._progressHandlers.set(d,r.onprogress),m.params={...e.params,_meta:{...e.params?._meta||{},progressToken:d}};if(i)m.params={...m.params,task:i};if(a)m.params={...m.params,_meta:{...m.params?._meta||{},[Ot]:a}};let f=(y)=>{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(y)}},{relatedRequestId:n,resumptionToken:o,onresumptiontoken:s}).catch((C)=>this._onerror(Error(`Failed to send cancellation: ${C}`)));let k=y instanceof I?y:new I(j.RequestTimeout,String(y));c(k)};this._responseHandlers.set(d,(y)=>{if(r?.signal?.aborted)return;if(y instanceof Error)return c(y);try{let k=Ee(t,y.result);if(!k.success)c(k.error);else u(k.data)}catch(k){c(k)}}),r?.signal?.addEventListener("abort",()=>{f(r?.signal?.reason)});let p=r?.timeout??$x,g=()=>f(I.fromError(j.RequestTimeout,"Request timed out",{timeout:p}));this._setupTimeout(d,p,r?.maxTotalTimeout,g,r?.resetTimeoutOnProgress??!1);let _=a?.taskId;if(_){let y=(k)=>{let C=this._responseHandlers.get(d);if(C)C(k);else this._onerror(Error(`Response handler missing for side-channeled request ${d}`))};this._requestResolvers.set(d,y),this._enqueueTaskMessage(_,{type:"request",message:m,timestamp:Date.now()}).catch((k)=>{this._cleanupTimeout(d),c(k)})}else this._transport.send(m,{relatedRequestId:n,resumptionToken:o,onresumptiontoken:s}).catch((y)=>{this._cleanupTimeout(d),c(y)})})}async getTask(e,t){return this.request({method:"tasks/get",params:e},jo,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},Mo,t)}async cancelTask(e,t){return this.request({method:"tasks/cancel",params:e},Wp,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||{},[Ot]: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||{},[Ot]: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||{},[Ot]:t.relatedTask}}};await this._transport.send(s,t)}setRequestHandler(e,t){let r=Ta(e);this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(n,o)=>{let s=Ra(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=Ta(e);this._notificationHandlers.set(r,(n)=>{let o=Ra(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??this._transport?.sessionId,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"&&gn(n.message)){let o=n.message.id,s=this._requestResolvers.get(o);if(s)s(new I(j.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,r){let n=this._options?.defaultTaskPollInterval??1000;try{let o=await this._taskStore?.getTask(e,r);if(o?.pollInterval)n=o.pollInterval}catch{}return new Promise((o,s)=>{if(t.aborted){s(new I(j.InvalidRequest,"Request cancelled"));return}let i=setTimeout(o,n);t.addEventListener("abort",()=>{clearTimeout(i),s(new I(j.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 I(j.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=wn.parse({method:"notifications/tasks/status",params:i});if(await this.notification(a),At(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 I(j.InvalidParams,`Task "${n}" not found - it may have been cleaned up`);if(At(i.status))throw new I(j.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 u=wn.parse({method:"notifications/tasks/status",params:a});if(await this.notification(u),At(a.status))this._cleanupTaskProgressHandler(n)}},listTasks:(n)=>r.listTasks(n,t)}}}function nm(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function Lo(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(nm(i)&&nm(s))r[o]={...i,...s};else r[o]=s}return r}var gv=Xc(vc(),1),_v=Xc(hv(),1);function _R(){let e=new gv.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return _v.default(e),e}class Un{constructor(e){this._ajv=e??_R()}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 Ec{constructor(e){this._client=e}async*callToolStream(e,t=It,r){let n=this._client,o={...r,task:r?.task??(n.isToolTask(e.name)?{}:void 0)},s=n.requestStream({method:"tools/call",params:e},t,o),i=n.getToolOutputValidator(e.name);for await(let a of s){if(a.type==="result"&&i){let u=a.result;if(!u.structuredContent&&!u.isError){yield{type:"error",error:new I(j.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`)};return}if(u.structuredContent)try{let c=i(u.structuredContent);if(!c.valid){yield{type:"error",error:new I(j.InvalidParams,`Structured content does not match the tool's output schema: ${c.errorMessage}`)};return}}catch(c){if(c instanceof I){yield{type:"error",error:c};return}yield{type:"error",error:new I(j.InvalidParams,`Failed to validate structured content: ${c instanceof Error?c.message:String(c)}`)};return}}yield a}}async getTask(e,t){return this._client.getTask({taskId:e},t)}async getTaskResult(e,t,r){return this._client.getTaskResult({taskId:e},t,r)}async listTasks(e,t){return this._client.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._client.cancelTask({taskId:e},t)}requestStream(e,t,r){return this._client.requestStream(e,t,r)}}function Is(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 Cs(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}}function As(e,t){if(!e||t===null||typeof t!=="object")return;if(e.type==="object"&&e.properties&&typeof e.properties==="object"){let r=t,n=e.properties;for(let o of Object.keys(n)){let s=n[o];if(r[o]===void 0&&Object.prototype.hasOwnProperty.call(s,"default"))r[o]=s.default;if(r[o]!==void 0)As(s,r[o])}}if(Array.isArray(e.anyOf)){for(let r of e.anyOf)if(typeof r!=="boolean")As(r,t)}if(Array.isArray(e.oneOf)){for(let r of e.oneOf)if(typeof r!=="boolean")As(r,t)}}function yR(e){if(!e)return{supportsFormMode:!1,supportsUrlMode:!1};let t=e.form!==void 0,r=e.url!==void 0;return{supportsFormMode:t||!t&&!r,supportsUrlMode:r}}class Tc extends En{constructor(e,t){super(t);if(this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._listChangedDebounceTimers=new Map,this._capabilities=t?.capabilities??{},this._jsonSchemaValidator=t?.jsonSchemaValidator??new Un,t?.listChanged)this._pendingListChangedConfig=t.listChanged}_setupListChangedHandlers(e){if(e.tools&&this._serverCapabilities?.tools?.listChanged)this._setupListChangedHandler("tools",zn,e.tools,async()=>(await this.listTools()).tools);if(e.prompts&&this._serverCapabilities?.prompts?.listChanged)this._setupListChangedHandler("prompts",wa,e.prompts,async()=>(await this.listPrompts()).prompts);if(e.resources&&this._serverCapabilities?.resources?.listChanged)this._setupListChangedHandler("resources",ma,e.resources,async()=>(await this.listResources()).resources)}get experimental(){if(!this._experimental)this._experimental={tasks:new Ec(this)};return this._experimental}registerCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=Lo(this._capabilities,e)}setRequestHandler(e,t){let n=zr(e)?.method;if(!n)throw Error("Schema is missing a method literal");let o=Sr(n);if(typeof o!=="string")throw Error("Schema method literal must be a string");let s=o;if(s==="elicitation/create"){let i=async(a,u)=>{let c=Ee(ka,a);if(!c.success){let y=c.error instanceof Error?c.error.message:String(c.error);throw new I(j.InvalidParams,`Invalid elicitation request: ${y}`)}let{params:l}=c.data;l.mode=l.mode??"form";let{supportsFormMode:d,supportsUrlMode:m}=yR(this._capabilities.elicitation);if(l.mode==="form"&&!d)throw new I(j.InvalidParams,"Client does not support form-mode elicitation requests");if(l.mode==="url"&&!m)throw new I(j.InvalidParams,"Client does not support URL-mode elicitation requests");let f=await Promise.resolve(t(a,u));if(l.task){let y=Ee(vt,f);if(!y.success){let k=y.error instanceof Error?y.error.message:String(y.error);throw new I(j.InvalidParams,`Invalid task creation result: ${k}`)}return y.data}let p=Ee(Ct,f);if(!p.success){let y=p.error instanceof Error?p.error.message:String(p.error);throw new I(j.InvalidParams,`Invalid elicitation result: ${y}`)}let g=p.data,_=l.mode==="form"?l.requestedSchema:void 0;if(l.mode==="form"&&g.action==="accept"&&g.content&&_){if(this._capabilities.elicitation?.form?.applyDefaults)try{As(_,g.content)}catch{}}return g};return super.setRequestHandler(e,i)}if(s==="sampling/createMessage"){let i=async(a,u)=>{let c=Ee(Sa,a);if(!c.success){let g=c.error instanceof Error?c.error.message:String(c.error);throw new I(j.InvalidParams,`Invalid sampling request: ${g}`)}let{params:l}=c.data,d=await Promise.resolve(t(a,u));if(l.task){let g=Ee(vt,d);if(!g.success){let _=g.error instanceof Error?g.error.message:String(g.error);throw new I(j.InvalidParams,`Invalid task creation result: ${_}`)}return g.data}let f=l.tools||l.toolChoice?kn:ar,p=Ee(f,d);if(!p.success){let g=p.error instanceof Error?p.error.message:String(p.error);throw new I(j.InvalidParams,`Invalid sampling result: ${g}`)}return p.data};return super.setRequestHandler(e,i)}return super.setRequestHandler(e,t)}assertCapability(e,t){if(!this._serverCapabilities?.[e])throw Error(`Server does not support ${e} (required for ${t})`)}async connect(e,t){if(await super.connect(e),e.sessionId!==void 0)return;try{let r=await this.request({method:"initialize",params:{protocolVersion:Rt,capabilities:this._capabilities,clientInfo:this._clientInfo}},ca,t);if(r===void 0)throw Error(`Server sent invalid initialize result: ${r}`);if(!Eo.includes(r.protocolVersion))throw Error(`Server's protocol version is not supported: ${r.protocolVersion}`);if(this._serverCapabilities=r.capabilities,this._serverVersion=r.serverInfo,e.setProtocolVersion)e.setProtocolVersion(r.protocolVersion);if(this._instructions=r.instructions,await this.notification({method:"notifications/initialized"}),this._pendingListChangedConfig)this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0}catch(r){throw this.close(),r}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){switch(e){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!this._serverCapabilities?.resources)throw Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw Error(`Server does not support completions (required for ${e})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/roots/list_changed":if(!this._capabilities.roots?.listChanged)throw Error(`Client does not support roots list changed notifications (required for ${e})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(!this._capabilities)return;switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw Error(`Client does not support roots capability (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw Error(`Client does not support tasks capability (required for ${e})`);break;case"ping":break}}assertTaskCapability(e){Is(this._serverCapabilities?.tasks?.requests,e,"Server")}assertTaskHandlerCapability(e){if(!this._capabilities)return;Cs(this._capabilities.tasks?.requests,e,"Client")}async ping(e){return this.request({method:"ping"},yt,e)}async complete(e,t){return this.request({method:"completion/complete",params:e},Pa,t)}async setLoggingLevel(e,t){return this.request({method:"logging/setLevel",params:{level:e}},yt,t)}async getPrompt(e,t){return this.request({method:"prompts/get",params:e},ba,t)}async listPrompts(e,t){return this.request({method:"prompts/list",params:e},ha,t)}async listResources(e,t){return this.request({method:"resources/list",params:e},la,t)}async listResourceTemplates(e,t){return this.request({method:"resources/templates/list",params:e},da,t)}async readResource(e,t){return this.request({method:"resources/read",params:e},pa,t)}async subscribeResource(e,t){return this.request({method:"resources/subscribe",params:e},yt,t)}async unsubscribeResource(e,t){return this.request({method:"resources/unsubscribe",params:e},yt,t)}async callTool(e,t=It,r){if(this.isToolTaskRequired(e.name))throw new I(j.InvalidRequest,`Tool "${e.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);let n=await this.request({method:"tools/call",params:e},t,r),o=this.getToolOutputValidator(e.name);if(o){if(!n.structuredContent&&!n.isError)throw new I(j.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(n.structuredContent)try{let s=o(n.structuredContent);if(!s.valid)throw new I(j.InvalidParams,`Structured content does not match the tool's output schema: ${s.errorMessage}`)}catch(s){if(s instanceof I)throw s;throw new I(j.InvalidParams,`Failed to validate structured content: ${s instanceof Error?s.message:String(s)}`)}}return n}isToolTask(e){if(!this._serverCapabilities?.tasks?.requests?.tools?.call)return!1;return this._cachedKnownTaskTools.has(e)}isToolTaskRequired(e){return this._cachedRequiredTaskTools.has(e)}cacheToolMetadata(e){this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(let t of e){if(t.outputSchema){let n=this._jsonSchemaValidator.getValidator(t.outputSchema);this._cachedToolOutputValidators.set(t.name,n)}let r=t.execution?.taskSupport;if(r==="required"||r==="optional")this._cachedKnownTaskTools.add(t.name);if(r==="required")this._cachedRequiredTaskTools.add(t.name)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,t){let r=await this.request({method:"tools/list",params:e},$a,t);return this.cacheToolMetadata(r.tools),r}_setupListChangedHandler(e,t,r,n){let o=tm.safeParse(r);if(!o.success)throw Error(`Invalid ${e} listChanged options: ${o.error.message}`);if(typeof r.onChanged!=="function")throw Error(`Invalid ${e} listChanged options: onChanged must be a function`);let{autoRefresh:s,debounceMs:i}=o.data,{onChanged:a}=r,u=async()=>{if(!s){a(null,null);return}try{let l=await n();a(null,l)}catch(l){let d=l instanceof Error?l:Error(String(l));a(d,null)}},c=()=>{if(i){let l=this._listChangedDebounceTimers.get(e);if(l)clearTimeout(l);let d=setTimeout(u,i);this._listChangedDebounceTimers.set(e,d)}else u()};this.setNotificationHandler(t,c)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}/*!
66
66
  * content-type
67
67
  * Copyright(c) 2015 Douglas Christopher Wilson
68
68
  * MIT Licensed
69
- */var yv=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g;var vR=/\\([\u000b\u0020-\u00ff])/g;var bR=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;var vv=wR;function wR(e){if(!e)throw TypeError("argument string is required");var t=typeof e==="object"?xR(e):e;if(typeof t!=="string")throw TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=r!==-1?t.slice(0,r).trim():t.trim();if(!bR.test(n))throw TypeError("invalid media type");var o=new $R(n.toLowerCase());if(r!==-1){var s,i,a;yv.lastIndex=r;while(i=yv.exec(t)){if(i.index!==r)throw TypeError("invalid parameter format");if(r+=i[0].length,s=i[1].toLowerCase(),a=i[2],a.charCodeAt(0)===34){if(a=a.slice(1,-1),a.indexOf("\\")!==-1)a=a.replace(vR,"$1")}o.parameters[s]=a}if(r!==t.length)throw TypeError("invalid parameter format")}return o}function xR(e){var t;if(typeof e.getHeader==="function")t=e.getHeader("content-type");else if(typeof e.headers==="object")t=e.headers&&e.headers["content-type"];if(typeof t!=="string")throw TypeError("content-type header is missing from object");return t}function $R(e){this.parameters=Object.create(null),this.type=e}function bv(e){if(!e)return;try{return vv(e).type}catch{let t=(e.split(";",1)[0]??"").trim().toLowerCase();if(t===""||e.slice(t.length).includes(","))return;return t}}function Ns(e){if(!e)return{};if(e instanceof Headers)return Object.fromEntries(e.entries());if(Array.isArray(e))return Object.fromEntries(e);return{...e}}function wv(e=fetch,t){if(!t)return e;return async(r,n)=>{let o={...t,...n,headers:n?.headers?{...Ns(t.headers),...Ns(n.headers)}:t.headers};return e(r,o)}}var SR=5,kR=[301,302,303,307,308];function PR(e,t){if(e.protocol===t.protocol&&e.hostname===t.hostname&&e.port===t.port)return!0;return e.hostname===t.hostname&&e.protocol==="http:"&&e.port===""&&t.protocol==="https:"&&t.port===""}function xv(e,t){let r=kR.includes(e.status)?e.headers.get("location"):null;try{return r?new URL(r,t):void 0}catch{return}}function js(e,t,r,n,o=0){let s=xv(n,t),i=n.status===307||n.status===308||(r?.method??"GET").toUpperCase()==="GET";if(!s||o===SR||!i)return;let a=new URL(t);if((s.username||s.password)&&(s.username!==a.username||s.password!==a.password)||!PR(a,s))return;return Promise.resolve(n.body?.cancel()).then(()=>e(s,{...r,redirect:"manual"})).then((c)=>js(e,s,r,c,o+1)??c)}var $v=new WeakSet;function Tc(e){let t=(r,n)=>(e??fetch)(r,n);return $v.add(t),t}function mr(e=fetch){if($v.has(e))return e;return(t,r)=>{if(r?.redirect==="error"||r?.redirect==="manual")return e(t,r);return Promise.resolve(e(t,{...r,redirect:"manual"})).then((n)=>js(e,t,r,n)??n)}}function Zs(e,t){if(e.type==="opaqueredirect")return"Redirect not followed: this runtime does not expose the redirect target";let r=e.url||t,n=xv(e,r);if(!n)return;if(n.username=n.password=n.search=n.hash="",n.protocol==="http:"&&new URL(r).protocol==="https:")return n.protocol="https:",`Redirect to plain http not followed; try ${n.href} instead`;return`Redirect to ${n.href} not followed`}var Rc;Rc=globalThis.crypto?.webcrypto??globalThis.crypto??import("node:crypto").then((e)=>e.webcrypto);async function ER(e){return(await Rc).getRandomValues(new Uint8Array(e))}async function TR(e){let r=Math.pow(2,8)-Math.pow(2,8)%66,n="";while(n.length<e){let o=await ER(e-n.length);for(let s of o)if(s<r)n+="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~"[s%66]}return n}async function RR(e){return await TR(e)}async function OR(e){let t=await(await Rc).subtle.digest("SHA-256",new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function Oc(e){if(!e)e=43;if(e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;let t=await RR(e),r=await OR(t);return{code_verifier:t,code_challenge:r}}var Se=$p().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:Zp.custom,message:"URL must be parseable",fatal:!0}),si}).refine((e)=>{let t=new URL(e);return t.protocol!=="javascript:"&&t.protocol!=="data:"&&t.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),Sv=ye({resource:h().url(),authorization_servers:S(Se).optional(),jwks_uri:h().url().optional(),scopes_supported:S(h()).optional(),bearer_methods_supported:S(h()).optional(),resource_signing_alg_values_supported:S(h()).optional(),resource_name:h().optional(),resource_documentation:h().optional(),resource_policy_uri:h().url().optional(),resource_tos_uri:h().url().optional(),tls_client_certificate_bound_access_tokens:Q().optional(),authorization_details_types_supported:S(h()).optional(),dpop_signing_alg_values_supported:S(h()).optional(),dpop_bound_access_tokens_required:Q().optional()}),Ic=ye({issuer:h(),authorization_endpoint:Se,token_endpoint:Se,registration_endpoint:Se.optional(),scopes_supported:S(h()).optional(),response_types_supported:S(h()),response_modes_supported:S(h()).optional(),grant_types_supported:S(h()).optional(),token_endpoint_auth_methods_supported:S(h()).optional(),token_endpoint_auth_signing_alg_values_supported:S(h()).optional(),service_documentation:Se.optional(),revocation_endpoint:Se.optional(),revocation_endpoint_auth_methods_supported:S(h()).optional(),revocation_endpoint_auth_signing_alg_values_supported:S(h()).optional(),introspection_endpoint:h().optional(),introspection_endpoint_auth_methods_supported:S(h()).optional(),introspection_endpoint_auth_signing_alg_values_supported:S(h()).optional(),code_challenge_methods_supported:S(h()).optional(),client_id_metadata_document_supported:Q().optional()}),IR=ye({issuer:h(),authorization_endpoint:Se,token_endpoint:Se,userinfo_endpoint:Se.optional(),jwks_uri:Se,registration_endpoint:Se.optional(),scopes_supported:S(h()).optional(),response_types_supported:S(h()),response_modes_supported:S(h()).optional(),grant_types_supported:S(h()).optional(),acr_values_supported:S(h()).optional(),subject_types_supported:S(h()),id_token_signing_alg_values_supported:S(h()),id_token_encryption_alg_values_supported:S(h()).optional(),id_token_encryption_enc_values_supported:S(h()).optional(),userinfo_signing_alg_values_supported:S(h()).optional(),userinfo_encryption_alg_values_supported:S(h()).optional(),userinfo_encryption_enc_values_supported:S(h()).optional(),request_object_signing_alg_values_supported:S(h()).optional(),request_object_encryption_alg_values_supported:S(h()).optional(),request_object_encryption_enc_values_supported:S(h()).optional(),token_endpoint_auth_methods_supported:S(h()).optional(),token_endpoint_auth_signing_alg_values_supported:S(h()).optional(),display_values_supported:S(h()).optional(),claim_types_supported:S(h()).optional(),claims_supported:S(h()).optional(),service_documentation:h().optional(),claims_locales_supported:S(h()).optional(),ui_locales_supported:S(h()).optional(),claims_parameter_supported:Q().optional(),request_parameter_supported:Q().optional(),request_uri_parameter_supported:Q().optional(),require_request_uri_registration:Q().optional(),op_policy_uri:Se.optional(),op_tos_uri:Se.optional(),client_id_metadata_document_supported:Q().optional()}),kv=P({...IR.shape,...Ic.pick({code_challenge_methods_supported:!0}).shape}),Pv=P({access_token:h(),id_token:h().optional(),token_type:h(),expires_in:G0().optional(),scope:h().optional(),refresh_token:h().optional(),issuer:h().optional().catch(void 0)}).strip(),Ev=P({error:h(),error_description:h().optional(),error_uri:h().optional()}),zv=Se.optional().or(A("").transform(()=>{return})),CR=P({redirect_uris:S(Se),token_endpoint_auth_method:h().optional(),grant_types:S(h()).optional(),response_types:S(h()).optional(),client_name:h().optional(),client_uri:Se.optional(),logo_uri:zv,scope:h().optional(),contacts:S(h()).optional(),tos_uri:zv,policy_uri:h().optional(),jwks_uri:Se.optional(),jwks:kp().optional(),software_id:h().optional(),software_version:h().optional(),software_statement:h().optional()}).strip(),AR=P({client_id:h(),client_secret:h().optional(),client_id_issued_at:B().optional(),client_secret_expires_at:B().optional(),issuer:h().optional().catch(void 0)}).strip(),Tv=CR.merge(AR),tM=P({error:h(),error_description:h().optional()}).strip(),rM=P({token:h(),token_type_hint:h().optional()}).strip();function Rv(e){let t=typeof e==="string"?new URL(e):new URL(e.href);return t.hash="",t}function Ov({requestedResource:e,configuredResource:t}){let r=typeof e==="string"?new URL(e):new URL(e.href),n=typeof t==="string"?new URL(t):new URL(t.href);if(r.origin!==n.origin)return!1;if(r.pathname.length<n.pathname.length)return!1;let o=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",s=n.pathname.endsWith("/")?n.pathname:n.pathname+"/";return o.startsWith(s)}class _e extends Error{constructor(e,t){super(e);this.errorUri=t,this.name=this.constructor.name}toResponseObject(){let e={error:this.errorCode,error_description:this.message};if(this.errorUri)e.error_uri=this.errorUri;return e}get errorCode(){return this.constructor.errorCode}}class Ds extends _e{}Ds.errorCode="invalid_request";class Wr extends _e{}Wr.errorCode="invalid_client";class Gr extends _e{}Gr.errorCode="invalid_grant";class Xr extends _e{}Xr.errorCode="unauthorized_client";class Ms extends _e{}Ms.errorCode="unsupported_grant_type";class qs extends _e{}qs.errorCode="invalid_scope";class Ls extends _e{}Ls.errorCode="access_denied";class er extends _e{}er.errorCode="server_error";class Us extends _e{}Us.errorCode="temporarily_unavailable";class Fs extends _e{}Fs.errorCode="unsupported_response_type";class Vs extends _e{}Vs.errorCode="unsupported_token_type";class Hs extends _e{}Hs.errorCode="invalid_token";class Bs extends _e{}Bs.errorCode="method_not_allowed";class Js extends _e{}Js.errorCode="too_many_requests";class Yr extends _e{}Yr.errorCode="invalid_client_metadata";class Ks extends _e{}Ks.errorCode="insufficient_scope";class Ws extends _e{}Ws.errorCode="invalid_target";var Iv={[Ds.errorCode]:Ds,[Wr.errorCode]:Wr,[Gr.errorCode]:Gr,[Xr.errorCode]:Xr,[Ms.errorCode]:Ms,[qs.errorCode]:qs,[Ls.errorCode]:Ls,[er.errorCode]:er,[Us.errorCode]:Us,[Fs.errorCode]:Fs,[Vs.errorCode]:Vs,[Hs.errorCode]:Hs,[Bs.errorCode]:Bs,[Js.errorCode]:Js,[Yr.errorCode]:Yr,[Ks.errorCode]:Ks,[Ws.errorCode]:Ws};class tr extends Error{constructor(e){super(e??"Unauthorized")}}function NR(e){return["client_secret_basic","client_secret_post","none"].includes(e)}var Cc="code",Ac="S256";function jR(e,t){let r=e.client_secret!==void 0;if("token_endpoint_auth_method"in e&&e.token_endpoint_auth_method&&NR(e.token_endpoint_auth_method)&&(t.length===0||t.includes(e.token_endpoint_auth_method)))return e.token_endpoint_auth_method;if(t.length===0)return r?"client_secret_basic":"none";if(r&&t.includes("client_secret_basic"))return"client_secret_basic";if(r&&t.includes("client_secret_post"))return"client_secret_post";if(t.includes("none"))return"none";return r?"client_secret_post":"none"}function ZR(e,t,r,n){let{client_id:o,client_secret:s}=t;switch(e){case"client_secret_basic":DR(o,s,r);return;case"client_secret_post":MR(o,s,n);return;case"none":qR(o,n);return;default:throw Error(`Unsupported client authentication method: ${e}`)}}function DR(e,t,r){if(!t)throw Error("client_secret_basic authentication requires a client_secret");let n=btoa(`${e}:${t}`);r.set("Authorization",`Basic ${n}`)}function MR(e,t,r){if(r.set("client_id",e),t)r.set("client_secret",t)}function qR(e,t){t.set("client_id",e)}async function Av(e){let t=e instanceof Response?e.status:void 0,r=e instanceof Response?await e.text():e;try{let n=Ev.parse(JSON.parse(r)),{error:o,error_description:s,error_uri:i}=n;return new(Iv[o]||er)(s||"",i)}catch(n){let o=e instanceof Response?Zs(e,e.url):void 0,s=`${t?`HTTP ${t}: `:""}${o??`Invalid OAuth error response: ${n}. Raw body: ${r}`}`;return new er(s)}}function LR(e,t){let[r,n]=[e,t];try{[r,n]=[new URL(e).href,new URL(t).href]}catch{}return r===n||r.endsWith("/")&&r.slice(0,-1)===n||n.endsWith("/")&&n.slice(0,-1)===r}function Zc(e,t){if(!e)return;if(typeof e.issuer!=="string")return e.issuer==null?e:{...e,issuer:void 0};return LR(e.issuer,t)?e:void 0}var UR=Pv.omit({issuer:!0}),FR=Tv.omit({issuer:!0});function Nv(e,t){return Error(`OAuth client information is bound to authorization server ${e.issuer} and is not presented to ${t}. Clear the stored client information, or correct \`expectedIssuer\`, if the authorization server has moved.`)}async function Fn(e,t){try{return await Nc(e,t)}catch(r){if(r instanceof Wr||r instanceof Xr)return await e.invalidateCredentials?.("all"),await Nc(e,t);else if(r instanceof Gr)return await e.invalidateCredentials?.("tokens"),await Nc(e,t);throw r}}async function Nc(e,{serverUrl:t,authorizationCode:r,scope:n,resourceMetadataUrl:o,fetchFn:s}){let i=await e.discoveryState?.(),a,u,c,l=o;if(!l&&i?.resourceMetadataUrl)l=new URL(i.resourceMetadataUrl);if(i?.authorizationServerUrl){if(u=i.authorizationServerUrl,a=i.resourceMetadata,c=i.authorizationServerMetadata??await Zv(u,{fetchFn:s}),!a)try{a=await jv(t,{resourceMetadataUrl:l},s)}catch{}if(c!==i.authorizationServerMetadata||a!==i.resourceMetadata)await e.saveDiscoveryState?.({authorizationServerUrl:String(u),resourceMetadataUrl:l?.toString(),resourceMetadata:a,authorizationServerMetadata:c})}else{let F=await GR(t,{resourceMetadataUrl:l,fetchFn:s});u=F.authorizationServerUrl,c=F.authorizationServerMetadata,a=F.resourceMetadata,await e.saveDiscoveryState?.({authorizationServerUrl:String(u),resourceMetadataUrl:l?.toString(),resourceMetadata:a,authorizationServerMetadata:c})}let d=String(u),m=await HR(t,e,a),f=m&&a&&!e.validateResourceURL?a.resource:m,p=n||a?.scopes_supported?.join(" ")||e.clientMetadata.scope,g=await Promise.resolve(e.clientInformation()),_=Zc(g,d),y=e.saveClientInformation!==void 0&&!!e.redirectUrl;if(g&&!_&&!y)throw Nv(g,d);let k=_?.issuer==null?_:void 0,C=async()=>{try{if(k)await e.saveClientInformation?.({...k,issuer:d})}catch{}};if(!_){if(r!==void 0)throw Error("Existing OAuth client information is required when exchanging an authorization code");let F=c?.client_id_metadata_document_supported===!0,se=e.clientMetadataUrl;if(se&&!VR(se))throw new Yr(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${se}`);if(F&&se)_={client_id:se,issuer:d},await e.saveClientInformation?.(_);else{if(!e.saveClientInformation)throw Error("OAuth client information must be saveable for dynamic registration");_={...await tO(u,{metadata:c,clientMetadata:e.clientMetadata,scope:p,fetchFn:s}),issuer:d},await e.saveClientInformation(_)}}let U=!e.redirectUrl;if(r!==void 0||U){let F=await eO(e,u,{metadata:c,resource:f,authorizationCode:r,fetchFn:s});return await C(),await e.saveTokens({...F,issuer:d}),"AUTHORIZED"}let b=Zc(await e.tokens(),d);if(b?.refresh_token&&b.issuer==null)console.warn("[mcp-sdk] stored OAuth tokens have no 'issuer' property (saved by an earlier version, or by a provider that does not keep it) and are used as-is; make sure your OAuthClientProvider stores what saveTokens() and saveClientInformation() receive unchanged.");if(b?.refresh_token)try{let F=await QR(u,{metadata:c,clientInformation:_,refreshToken:b.refresh_token,resource:f,addClientAuthentication:e.addClientAuthentication,fetchFn:s});return await C(),await e.saveTokens({...F,issuer:d}),"AUTHORIZED"}catch(F){if(!(F instanceof _e)||F instanceof er);else throw F}let x=e.state?await e.state():void 0,{authorizationUrl:N,codeVerifier:Y}=await XR(u,{metadata:c,clientInformation:_,state:x,redirectUrl:e.redirectUrl,scope:p,resource:f});return await e.saveCodeVerifier(Y),await e.redirectToAuthorization(N),"REDIRECT"}function VR(e){if(!e)return!1;try{let t=new URL(e);return t.protocol==="https:"&&t.pathname!=="/"}catch{return!1}}async function HR(e,t,r){let n=Rv(e);if(t.validateResourceURL)return await t.validateResourceURL(n,r?.resource);if(!r)return;if(!Ov({requestedResource:n,configuredResource:r.resource}))throw Error(`Protected resource ${r.resource} does not match expected ${n} (or origin)`);return new URL(r.resource)}function Dc(e){let t=e.headers.get("WWW-Authenticate");if(!t)return{};let[r,n]=t.split(" ");if(r.toLowerCase()!=="bearer"||!n)return{};let o=jc(e,"resource_metadata")||void 0,s;if(o)try{s=new URL(o)}catch{}let i=jc(e,"scope")||void 0,a=jc(e,"error")||void 0;return{resourceMetadataUrl:s,scope:i,error:a}}function jc(e,t){let r=e.headers.get("WWW-Authenticate");if(!r)return null;let n=new RegExp(`${t}=(?:"([^"]+)"|([^\\s,]+))`),o=r.match(n);if(o)return o[1]||o[2];return null}async function jv(e,t,r=fetch){let n=await KR(e,"oauth-protected-resource",r,{protocolVersion:t?.protocolVersion,metadataUrl:t?.resourceMetadataUrl});if(!n||n.status===404)throw await n?.body?.cancel(),Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!n.ok)throw await n.body?.cancel(),Error(`HTTP ${n.status} trying to load well-known OAuth protected resource metadata.`);return Sv.parse(await n.json())}async function Mc(e,t,r=fetch){try{return await mr(r)(e,{headers:t})}catch(n){if(n instanceof TypeError)if(t)return Mc(e,void 0,r);else return;throw n}}function BR(e,t="",r={}){if(t.endsWith("/"))t=t.slice(0,-1);return r.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}async function Cv(e,t,r=fetch){return await Mc(e,{"MCP-Protocol-Version":t},r)}function JR(e,t){return!e||!e.ok&&e.status<500&&t!=="/"}async function KR(e,t,r,n){let o=new URL(e),s=n?.protocolVersion??Rt,i;if(n?.metadataUrl)i=new URL(n.metadataUrl);else{let u=BR(t,o.pathname);i=new URL(u,n?.metadataServerUrl??o),i.search=o.search}let a=await Cv(i,s,r);if(!n?.metadataUrl&&JR(a,o.pathname)){let u=new URL(`/.well-known/${t}`,o);a=await Cv(u,s,r)}return a}function WR(e){let t=typeof e==="string"?new URL(e):e,r=t.pathname!=="/",n=[];if(!r)return n.push({url:new URL("/.well-known/oauth-authorization-server",t.origin),type:"oauth"}),n.push({url:new URL("/.well-known/openid-configuration",t.origin),type:"oidc"}),n;let o=t.pathname;if(o.endsWith("/"))o=o.slice(0,-1);return n.push({url:new URL(`/.well-known/oauth-authorization-server${o}`,t.origin),type:"oauth"}),n.push({url:new URL(`/.well-known/openid-configuration${o}`,t.origin),type:"oidc"}),n.push({url:new URL(`${o}/.well-known/openid-configuration`,t.origin),type:"oidc"}),n}async function Zv(e,{fetchFn:t=fetch,protocolVersion:r=Rt}={}){let n={"MCP-Protocol-Version":r,Accept:"application/json"},o=WR(e);for(let{url:s,type:i}of o){let a=await Mc(s,n,t);if(!a)continue;if(!a.ok){if(await a.body?.cancel(),a.status<500)continue;throw Error(`HTTP ${a.status} trying to load ${i==="oauth"?"OAuth":"OpenID provider"} metadata from ${s}`)}if(i==="oauth")return Ic.parse(await a.json());else return kv.parse(await a.json())}return}async function GR(e,t){let r,n;try{if(r=await jv(e,{resourceMetadataUrl:t?.resourceMetadataUrl},t?.fetchFn),r.authorization_servers&&r.authorization_servers.length>0)n=r.authorization_servers[0]}catch{}if(!n)n=String(new URL("/",e));let o=await Zv(n,{fetchFn:t?.fetchFn});return{authorizationServerUrl:n,authorizationServerMetadata:o,resourceMetadata:r}}function Dv(e){return typeof e==="string"?e:e.href}async function XR(e,{metadata:t,clientInformation:r,redirectUrl:n,scope:o,state:s,resource:i}){let a;if(t){if(a=new URL(t.authorization_endpoint),!t.response_types_supported.includes(Cc))throw Error(`Incompatible auth server: does not support response type ${Cc}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(Ac))throw Error(`Incompatible auth server: does not support code challenge method ${Ac}`)}else a=new URL("/authorize",e);let u=await Oc(),{code_verifier:c,code_challenge:l}=u;if(a.searchParams.set("response_type",Cc),a.searchParams.set("client_id",r.client_id),a.searchParams.set("code_challenge",l),a.searchParams.set("code_challenge_method",Ac),a.searchParams.set("redirect_uri",String(n)),s)a.searchParams.set("state",s);if(o)a.searchParams.set("scope",o);if(o?.includes("offline_access"))a.searchParams.append("prompt","consent");if(i)a.searchParams.set("resource",Dv(i));return{authorizationUrl:a,codeVerifier:c}}function YR(e,t,r){return new URLSearchParams({grant_type:"authorization_code",code:e,code_verifier:t,redirect_uri:String(r)})}async function Mv(e,{metadata:t,tokenRequestParams:r,clientInformation:n,addClientAuthentication:o,resource:s,fetchFn:i}){let a=t?.token_endpoint?new URL(t.token_endpoint):new URL("/token",e),u=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});if(s)r.set("resource",Dv(s));if(o)await o(u,r,a,t);else if(n){let l=t?.token_endpoint_auth_methods_supported??[],d=jR(n,l);ZR(d,n,u,r)}let c=await mr(i??fetch)(a,{method:"POST",headers:u,body:r});if(!c.ok)throw await Av(c);return UR.parse(await c.json())}async function QR(e,{metadata:t,clientInformation:r,refreshToken:n,resource:o,addClientAuthentication:s,fetchFn:i}){let a=new URLSearchParams({grant_type:"refresh_token",refresh_token:n}),u=await Mv(e,{metadata:t,tokenRequestParams:a,clientInformation:r,addClientAuthentication:s,resource:o,fetchFn:i});return{refresh_token:n,...u}}async function eO(e,t,{metadata:r,resource:n,authorizationCode:o,fetchFn:s}={}){let i=async()=>{let l=await e.clientInformation(),d=Zc(l,String(t));if(l&&!d)throw Nv(l,String(t));return d},a=await i(),u=e.clientMetadata.scope,c;if(e.prepareTokenRequest)c=await e.prepareTokenRequest(u);if(!c){if(!o)throw Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!e.redirectUrl)throw Error("redirectUrl is required for authorization_code flow");let l=await e.codeVerifier();c=YR(o,l,e.redirectUrl)}return a??(a=await i()),Mv(t,{metadata:r,tokenRequestParams:c,clientInformation:a,addClientAuthentication:e.addClientAuthentication,resource:n,fetchFn:s})}async function tO(e,{metadata:t,clientMetadata:r,scope:n,fetchFn:o}){let s;if(t){if(!t.registration_endpoint)throw Error("Incompatible auth server: does not support dynamic client registration");s=new URL(t.registration_endpoint)}else s=new URL("/register",e);let i=await mr(o??fetch)(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...r,...n!==void 0?{scope:n}:{}})});if(!i.ok)throw await Av(i);return FR.parse(await i.json())}class Gs extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}}var qv=10,rO=13,hr=32;function qc(e){}function Fv(e){if(typeof e=="function")throw TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");let{onEvent:t=qc,onError:r=qc,onRetry:n=qc,onComment:o,maxBufferSize:s}=e,i=[],a=0,u=!0,c,l="",d=0,m,f=!1;function p(b){if(f)throw Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(u&&(u=!1,b.charCodeAt(0)===239&&b.charCodeAt(1)===187&&b.charCodeAt(2)===191&&(b=b.slice(3))),i.length===0){let Y=_(b);Y!==""&&(i.push(Y),a=Y.length),g();return}if(b.indexOf(`
69
+ */var yv=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g;var vR=/\\([\u000b\u0020-\u00ff])/g;var bR=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;var vv=wR;function wR(e){if(!e)throw TypeError("argument string is required");var t=typeof e==="object"?xR(e):e;if(typeof t!=="string")throw TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=r!==-1?t.slice(0,r).trim():t.trim();if(!bR.test(n))throw TypeError("invalid media type");var o=new $R(n.toLowerCase());if(r!==-1){var s,i,a;yv.lastIndex=r;while(i=yv.exec(t)){if(i.index!==r)throw TypeError("invalid parameter format");if(r+=i[0].length,s=i[1].toLowerCase(),a=i[2],a.charCodeAt(0)===34){if(a=a.slice(1,-1),a.indexOf("\\")!==-1)a=a.replace(vR,"$1")}o.parameters[s]=a}if(r!==t.length)throw TypeError("invalid parameter format")}return o}function xR(e){var t;if(typeof e.getHeader==="function")t=e.getHeader("content-type");else if(typeof e.headers==="object")t=e.headers&&e.headers["content-type"];if(typeof t!=="string")throw TypeError("content-type header is missing from object");return t}function $R(e){this.parameters=Object.create(null),this.type=e}function bv(e){if(!e)return;try{return vv(e).type}catch{let t=(e.split(";",1)[0]??"").trim().toLowerCase();if(t===""||e.slice(t.length).includes(","))return;return t}}function Ns(e){if(!e)return{};if(e instanceof Headers)return Object.fromEntries(e.entries());if(Array.isArray(e))return Object.fromEntries(e);return{...e}}function wv(e=fetch,t){if(!t)return e;return async(r,n)=>{let o={...t,...n,headers:n?.headers?{...Ns(t.headers),...Ns(n.headers)}:t.headers};return e(r,o)}}var SR=5,kR=[301,302,303,307,308];function PR(e,t){if(e.protocol===t.protocol&&e.hostname===t.hostname&&e.port===t.port)return!0;return e.hostname===t.hostname&&e.protocol==="http:"&&e.port===""&&t.protocol==="https:"&&t.port===""}function xv(e,t){let r=kR.includes(e.status)?e.headers.get("location"):null;try{return r?new URL(r,t):void 0}catch{return}}function js(e,t,r,n,o=0){let s=xv(n,t),i=n.status===307||n.status===308||(r?.method??"GET").toUpperCase()==="GET";if(!s||o===SR||!i)return;let a=new URL(t);if((s.username||s.password)&&(s.username!==a.username||s.password!==a.password)||!PR(a,s))return;return Promise.resolve(n.body?.cancel()).then(()=>e(s,{...r,redirect:"manual"})).then((c)=>js(e,s,r,c,o+1)??c)}var $v=new WeakSet;function Rc(e){let t=(r,n)=>(e??fetch)(r,n);return $v.add(t),t}function mr(e=fetch){if($v.has(e))return e;return(t,r)=>{if(r?.redirect==="error"||r?.redirect==="manual")return e(t,r);return Promise.resolve(e(t,{...r,redirect:"manual"})).then((n)=>js(e,t,r,n)??n)}}function Zs(e,t){if(e.type==="opaqueredirect")return"Redirect not followed: this runtime does not expose the redirect target";let r=e.url||t,n=xv(e,r);if(!n)return;if(n.username=n.password=n.search=n.hash="",n.protocol==="http:"&&new URL(r).protocol==="https:")return n.protocol="https:",`Redirect to plain http not followed; try ${n.href} instead`;return`Redirect to ${n.href} not followed`}var Oc;Oc=globalThis.crypto?.webcrypto??globalThis.crypto??import("node:crypto").then((e)=>e.webcrypto);async function ER(e){return(await Oc).getRandomValues(new Uint8Array(e))}async function TR(e){let r=Math.pow(2,8)-Math.pow(2,8)%66,n="";while(n.length<e){let o=await ER(e-n.length);for(let s of o)if(s<r)n+="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~"[s%66]}return n}async function RR(e){return await TR(e)}async function OR(e){let t=await(await Oc).subtle.digest("SHA-256",new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function Ic(e){if(!e)e=43;if(e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;let t=await RR(e),r=await OR(t);return{code_verifier:t,code_challenge:r}}var Se=$p().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:Zp.custom,message:"URL must be parseable",fatal:!0}),ii}).refine((e)=>{let t=new URL(e);return t.protocol!=="javascript:"&&t.protocol!=="data:"&&t.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),Sv=ye({resource:h().url(),authorization_servers:S(Se).optional(),jwks_uri:h().url().optional(),scopes_supported:S(h()).optional(),bearer_methods_supported:S(h()).optional(),resource_signing_alg_values_supported:S(h()).optional(),resource_name:h().optional(),resource_documentation:h().optional(),resource_policy_uri:h().url().optional(),resource_tos_uri:h().url().optional(),tls_client_certificate_bound_access_tokens:Q().optional(),authorization_details_types_supported:S(h()).optional(),dpop_signing_alg_values_supported:S(h()).optional(),dpop_bound_access_tokens_required:Q().optional()}),Cc=ye({issuer:h(),authorization_endpoint:Se,token_endpoint:Se,registration_endpoint:Se.optional(),scopes_supported:S(h()).optional(),response_types_supported:S(h()),response_modes_supported:S(h()).optional(),grant_types_supported:S(h()).optional(),token_endpoint_auth_methods_supported:S(h()).optional(),token_endpoint_auth_signing_alg_values_supported:S(h()).optional(),service_documentation:Se.optional(),revocation_endpoint:Se.optional(),revocation_endpoint_auth_methods_supported:S(h()).optional(),revocation_endpoint_auth_signing_alg_values_supported:S(h()).optional(),introspection_endpoint:h().optional(),introspection_endpoint_auth_methods_supported:S(h()).optional(),introspection_endpoint_auth_signing_alg_values_supported:S(h()).optional(),code_challenge_methods_supported:S(h()).optional(),client_id_metadata_document_supported:Q().optional()}),IR=ye({issuer:h(),authorization_endpoint:Se,token_endpoint:Se,userinfo_endpoint:Se.optional(),jwks_uri:Se,registration_endpoint:Se.optional(),scopes_supported:S(h()).optional(),response_types_supported:S(h()),response_modes_supported:S(h()).optional(),grant_types_supported:S(h()).optional(),acr_values_supported:S(h()).optional(),subject_types_supported:S(h()),id_token_signing_alg_values_supported:S(h()),id_token_encryption_alg_values_supported:S(h()).optional(),id_token_encryption_enc_values_supported:S(h()).optional(),userinfo_signing_alg_values_supported:S(h()).optional(),userinfo_encryption_alg_values_supported:S(h()).optional(),userinfo_encryption_enc_values_supported:S(h()).optional(),request_object_signing_alg_values_supported:S(h()).optional(),request_object_encryption_alg_values_supported:S(h()).optional(),request_object_encryption_enc_values_supported:S(h()).optional(),token_endpoint_auth_methods_supported:S(h()).optional(),token_endpoint_auth_signing_alg_values_supported:S(h()).optional(),display_values_supported:S(h()).optional(),claim_types_supported:S(h()).optional(),claims_supported:S(h()).optional(),service_documentation:h().optional(),claims_locales_supported:S(h()).optional(),ui_locales_supported:S(h()).optional(),claims_parameter_supported:Q().optional(),request_parameter_supported:Q().optional(),request_uri_parameter_supported:Q().optional(),require_request_uri_registration:Q().optional(),op_policy_uri:Se.optional(),op_tos_uri:Se.optional(),client_id_metadata_document_supported:Q().optional()}),kv=P({...IR.shape,...Cc.pick({code_challenge_methods_supported:!0}).shape}),Pv=P({access_token:h(),id_token:h().optional(),token_type:h(),expires_in:G0().optional(),scope:h().optional(),refresh_token:h().optional(),issuer:h().optional().catch(void 0)}).strip(),Ev=P({error:h(),error_description:h().optional(),error_uri:h().optional()}),zv=Se.optional().or(A("").transform(()=>{return})),CR=P({redirect_uris:S(Se),token_endpoint_auth_method:h().optional(),grant_types:S(h()).optional(),response_types:S(h()).optional(),client_name:h().optional(),client_uri:Se.optional(),logo_uri:zv,scope:h().optional(),contacts:S(h()).optional(),tos_uri:zv,policy_uri:h().optional(),jwks_uri:Se.optional(),jwks:kp().optional(),software_id:h().optional(),software_version:h().optional(),software_statement:h().optional()}).strip(),AR=P({client_id:h(),client_secret:h().optional(),client_id_issued_at:B().optional(),client_secret_expires_at:B().optional(),issuer:h().optional().catch(void 0)}).strip(),Tv=CR.merge(AR),tM=P({error:h(),error_description:h().optional()}).strip(),rM=P({token:h(),token_type_hint:h().optional()}).strip();function Rv(e){let t=typeof e==="string"?new URL(e):new URL(e.href);return t.hash="",t}function Ov({requestedResource:e,configuredResource:t}){let r=typeof e==="string"?new URL(e):new URL(e.href),n=typeof t==="string"?new URL(t):new URL(t.href);if(r.origin!==n.origin)return!1;if(r.pathname.length<n.pathname.length)return!1;let o=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",s=n.pathname.endsWith("/")?n.pathname:n.pathname+"/";return o.startsWith(s)}class _e extends Error{constructor(e,t){super(e);this.errorUri=t,this.name=this.constructor.name}toResponseObject(){let e={error:this.errorCode,error_description:this.message};if(this.errorUri)e.error_uri=this.errorUri;return e}get errorCode(){return this.constructor.errorCode}}class Ds extends _e{}Ds.errorCode="invalid_request";class Wr extends _e{}Wr.errorCode="invalid_client";class Gr extends _e{}Gr.errorCode="invalid_grant";class Xr extends _e{}Xr.errorCode="unauthorized_client";class Ms extends _e{}Ms.errorCode="unsupported_grant_type";class qs extends _e{}qs.errorCode="invalid_scope";class Ls extends _e{}Ls.errorCode="access_denied";class er extends _e{}er.errorCode="server_error";class Us extends _e{}Us.errorCode="temporarily_unavailable";class Fs extends _e{}Fs.errorCode="unsupported_response_type";class Vs extends _e{}Vs.errorCode="unsupported_token_type";class Hs extends _e{}Hs.errorCode="invalid_token";class Bs extends _e{}Bs.errorCode="method_not_allowed";class Js extends _e{}Js.errorCode="too_many_requests";class Yr extends _e{}Yr.errorCode="invalid_client_metadata";class Ks extends _e{}Ks.errorCode="insufficient_scope";class Ws extends _e{}Ws.errorCode="invalid_target";var Iv={[Ds.errorCode]:Ds,[Wr.errorCode]:Wr,[Gr.errorCode]:Gr,[Xr.errorCode]:Xr,[Ms.errorCode]:Ms,[qs.errorCode]:qs,[Ls.errorCode]:Ls,[er.errorCode]:er,[Us.errorCode]:Us,[Fs.errorCode]:Fs,[Vs.errorCode]:Vs,[Hs.errorCode]:Hs,[Bs.errorCode]:Bs,[Js.errorCode]:Js,[Yr.errorCode]:Yr,[Ks.errorCode]:Ks,[Ws.errorCode]:Ws};class tr extends Error{constructor(e){super(e??"Unauthorized")}}function NR(e){return["client_secret_basic","client_secret_post","none"].includes(e)}var Ac="code",Nc="S256";function jR(e,t){let r=e.client_secret!==void 0;if("token_endpoint_auth_method"in e&&e.token_endpoint_auth_method&&NR(e.token_endpoint_auth_method)&&(t.length===0||t.includes(e.token_endpoint_auth_method)))return e.token_endpoint_auth_method;if(t.length===0)return r?"client_secret_basic":"none";if(r&&t.includes("client_secret_basic"))return"client_secret_basic";if(r&&t.includes("client_secret_post"))return"client_secret_post";if(t.includes("none"))return"none";return r?"client_secret_post":"none"}function ZR(e,t,r,n){let{client_id:o,client_secret:s}=t;switch(e){case"client_secret_basic":DR(o,s,r);return;case"client_secret_post":MR(o,s,n);return;case"none":qR(o,n);return;default:throw Error(`Unsupported client authentication method: ${e}`)}}function DR(e,t,r){if(!t)throw Error("client_secret_basic authentication requires a client_secret");let n=btoa(`${e}:${t}`);r.set("Authorization",`Basic ${n}`)}function MR(e,t,r){if(r.set("client_id",e),t)r.set("client_secret",t)}function qR(e,t){t.set("client_id",e)}async function Av(e){let t=e instanceof Response?e.status:void 0,r=e instanceof Response?await e.text():e;try{let n=Ev.parse(JSON.parse(r)),{error:o,error_description:s,error_uri:i}=n;return new(Iv[o]||er)(s||"",i)}catch(n){let o=e instanceof Response?Zs(e,e.url):void 0,s=`${t?`HTTP ${t}: `:""}${o??`Invalid OAuth error response: ${n}. Raw body: ${r}`}`;return new er(s)}}function LR(e,t){let[r,n]=[e,t];try{[r,n]=[new URL(e).href,new URL(t).href]}catch{}return r===n||r.endsWith("/")&&r.slice(0,-1)===n||n.endsWith("/")&&n.slice(0,-1)===r}function Dc(e,t){if(!e)return;if(typeof e.issuer!=="string")return e.issuer==null?e:{...e,issuer:void 0};return LR(e.issuer,t)?e:void 0}var UR=Pv.omit({issuer:!0}),FR=Tv.omit({issuer:!0});function Nv(e,t){return Error(`OAuth client information is bound to authorization server ${e.issuer} and is not presented to ${t}. Clear the stored client information, or correct \`expectedIssuer\`, if the authorization server has moved.`)}async function Fn(e,t){try{return await jc(e,t)}catch(r){if(r instanceof Wr||r instanceof Xr)return await e.invalidateCredentials?.("all"),await jc(e,t);else if(r instanceof Gr)return await e.invalidateCredentials?.("tokens"),await jc(e,t);throw r}}async function jc(e,{serverUrl:t,authorizationCode:r,scope:n,resourceMetadataUrl:o,fetchFn:s}){let i=await e.discoveryState?.(),a,u,c,l=o;if(!l&&i?.resourceMetadataUrl)l=new URL(i.resourceMetadataUrl);if(i?.authorizationServerUrl){if(u=i.authorizationServerUrl,a=i.resourceMetadata,c=i.authorizationServerMetadata??await Zv(u,{fetchFn:s}),!a)try{a=await jv(t,{resourceMetadataUrl:l},s)}catch{}if(c!==i.authorizationServerMetadata||a!==i.resourceMetadata)await e.saveDiscoveryState?.({authorizationServerUrl:String(u),resourceMetadataUrl:l?.toString(),resourceMetadata:a,authorizationServerMetadata:c})}else{let F=await GR(t,{resourceMetadataUrl:l,fetchFn:s});u=F.authorizationServerUrl,c=F.authorizationServerMetadata,a=F.resourceMetadata,await e.saveDiscoveryState?.({authorizationServerUrl:String(u),resourceMetadataUrl:l?.toString(),resourceMetadata:a,authorizationServerMetadata:c})}let d=String(u),m=await HR(t,e,a),f=m&&a&&!e.validateResourceURL?a.resource:m,p=n||a?.scopes_supported?.join(" ")||e.clientMetadata.scope,g=await Promise.resolve(e.clientInformation()),_=Dc(g,d),y=e.saveClientInformation!==void 0&&!!e.redirectUrl;if(g&&!_&&!y)throw Nv(g,d);let k=_?.issuer==null?_:void 0,C=async()=>{try{if(k)await e.saveClientInformation?.({...k,issuer:d})}catch{}};if(!_){if(r!==void 0)throw Error("Existing OAuth client information is required when exchanging an authorization code");let F=c?.client_id_metadata_document_supported===!0,se=e.clientMetadataUrl;if(se&&!VR(se))throw new Yr(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${se}`);if(F&&se)_={client_id:se,issuer:d},await e.saveClientInformation?.(_);else{if(!e.saveClientInformation)throw Error("OAuth client information must be saveable for dynamic registration");_={...await tO(u,{metadata:c,clientMetadata:e.clientMetadata,scope:p,fetchFn:s}),issuer:d},await e.saveClientInformation(_)}}let U=!e.redirectUrl;if(r!==void 0||U){let F=await eO(e,u,{metadata:c,resource:f,authorizationCode:r,fetchFn:s});return await C(),await e.saveTokens({...F,issuer:d}),"AUTHORIZED"}let b=Dc(await e.tokens(),d);if(b?.refresh_token&&b.issuer==null)console.warn("[mcp-sdk] stored OAuth tokens have no 'issuer' property (saved by an earlier version, or by a provider that does not keep it) and are used as-is; make sure your OAuthClientProvider stores what saveTokens() and saveClientInformation() receive unchanged.");if(b?.refresh_token)try{let F=await QR(u,{metadata:c,clientInformation:_,refreshToken:b.refresh_token,resource:f,addClientAuthentication:e.addClientAuthentication,fetchFn:s});return await C(),await e.saveTokens({...F,issuer:d}),"AUTHORIZED"}catch(F){if(!(F instanceof _e)||F instanceof er);else throw F}let x=e.state?await e.state():void 0,{authorizationUrl:N,codeVerifier:Y}=await XR(u,{metadata:c,clientInformation:_,state:x,redirectUrl:e.redirectUrl,scope:p,resource:f});return await e.saveCodeVerifier(Y),await e.redirectToAuthorization(N),"REDIRECT"}function VR(e){if(!e)return!1;try{let t=new URL(e);return t.protocol==="https:"&&t.pathname!=="/"}catch{return!1}}async function HR(e,t,r){let n=Rv(e);if(t.validateResourceURL)return await t.validateResourceURL(n,r?.resource);if(!r)return;if(!Ov({requestedResource:n,configuredResource:r.resource}))throw Error(`Protected resource ${r.resource} does not match expected ${n} (or origin)`);return new URL(r.resource)}function Mc(e){let t=e.headers.get("WWW-Authenticate");if(!t)return{};let[r,n]=t.split(" ");if(r.toLowerCase()!=="bearer"||!n)return{};let o=Zc(e,"resource_metadata")||void 0,s;if(o)try{s=new URL(o)}catch{}let i=Zc(e,"scope")||void 0,a=Zc(e,"error")||void 0;return{resourceMetadataUrl:s,scope:i,error:a}}function Zc(e,t){let r=e.headers.get("WWW-Authenticate");if(!r)return null;let n=new RegExp(`${t}=(?:"([^"]+)"|([^\\s,]+))`),o=r.match(n);if(o)return o[1]||o[2];return null}async function jv(e,t,r=fetch){let n=await KR(e,"oauth-protected-resource",r,{protocolVersion:t?.protocolVersion,metadataUrl:t?.resourceMetadataUrl});if(!n||n.status===404)throw await n?.body?.cancel(),Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!n.ok)throw await n.body?.cancel(),Error(`HTTP ${n.status} trying to load well-known OAuth protected resource metadata.`);return Sv.parse(await n.json())}async function qc(e,t,r=fetch){try{return await mr(r)(e,{headers:t})}catch(n){if(n instanceof TypeError)if(t)return qc(e,void 0,r);else return;throw n}}function BR(e,t="",r={}){if(t.endsWith("/"))t=t.slice(0,-1);return r.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}async function Cv(e,t,r=fetch){return await qc(e,{"MCP-Protocol-Version":t},r)}function JR(e,t){return!e||!e.ok&&e.status<500&&t!=="/"}async function KR(e,t,r,n){let o=new URL(e),s=n?.protocolVersion??Rt,i;if(n?.metadataUrl)i=new URL(n.metadataUrl);else{let u=BR(t,o.pathname);i=new URL(u,n?.metadataServerUrl??o),i.search=o.search}let a=await Cv(i,s,r);if(!n?.metadataUrl&&JR(a,o.pathname)){let u=new URL(`/.well-known/${t}`,o);a=await Cv(u,s,r)}return a}function WR(e){let t=typeof e==="string"?new URL(e):e,r=t.pathname!=="/",n=[];if(!r)return n.push({url:new URL("/.well-known/oauth-authorization-server",t.origin),type:"oauth"}),n.push({url:new URL("/.well-known/openid-configuration",t.origin),type:"oidc"}),n;let o=t.pathname;if(o.endsWith("/"))o=o.slice(0,-1);return n.push({url:new URL(`/.well-known/oauth-authorization-server${o}`,t.origin),type:"oauth"}),n.push({url:new URL(`/.well-known/openid-configuration${o}`,t.origin),type:"oidc"}),n.push({url:new URL(`${o}/.well-known/openid-configuration`,t.origin),type:"oidc"}),n}async function Zv(e,{fetchFn:t=fetch,protocolVersion:r=Rt}={}){let n={"MCP-Protocol-Version":r,Accept:"application/json"},o=WR(e);for(let{url:s,type:i}of o){let a=await qc(s,n,t);if(!a)continue;if(!a.ok){if(await a.body?.cancel(),a.status<500)continue;throw Error(`HTTP ${a.status} trying to load ${i==="oauth"?"OAuth":"OpenID provider"} metadata from ${s}`)}if(i==="oauth")return Cc.parse(await a.json());else return kv.parse(await a.json())}return}async function GR(e,t){let r,n;try{if(r=await jv(e,{resourceMetadataUrl:t?.resourceMetadataUrl},t?.fetchFn),r.authorization_servers&&r.authorization_servers.length>0)n=r.authorization_servers[0]}catch{}if(!n)n=String(new URL("/",e));let o=await Zv(n,{fetchFn:t?.fetchFn});return{authorizationServerUrl:n,authorizationServerMetadata:o,resourceMetadata:r}}function Dv(e){return typeof e==="string"?e:e.href}async function XR(e,{metadata:t,clientInformation:r,redirectUrl:n,scope:o,state:s,resource:i}){let a;if(t){if(a=new URL(t.authorization_endpoint),!t.response_types_supported.includes(Ac))throw Error(`Incompatible auth server: does not support response type ${Ac}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(Nc))throw Error(`Incompatible auth server: does not support code challenge method ${Nc}`)}else a=new URL("/authorize",e);let u=await Ic(),{code_verifier:c,code_challenge:l}=u;if(a.searchParams.set("response_type",Ac),a.searchParams.set("client_id",r.client_id),a.searchParams.set("code_challenge",l),a.searchParams.set("code_challenge_method",Nc),a.searchParams.set("redirect_uri",String(n)),s)a.searchParams.set("state",s);if(o)a.searchParams.set("scope",o);if(o?.includes("offline_access"))a.searchParams.append("prompt","consent");if(i)a.searchParams.set("resource",Dv(i));return{authorizationUrl:a,codeVerifier:c}}function YR(e,t,r){return new URLSearchParams({grant_type:"authorization_code",code:e,code_verifier:t,redirect_uri:String(r)})}async function Mv(e,{metadata:t,tokenRequestParams:r,clientInformation:n,addClientAuthentication:o,resource:s,fetchFn:i}){let a=t?.token_endpoint?new URL(t.token_endpoint):new URL("/token",e),u=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});if(s)r.set("resource",Dv(s));if(o)await o(u,r,a,t);else if(n){let l=t?.token_endpoint_auth_methods_supported??[],d=jR(n,l);ZR(d,n,u,r)}let c=await mr(i??fetch)(a,{method:"POST",headers:u,body:r});if(!c.ok)throw await Av(c);return UR.parse(await c.json())}async function QR(e,{metadata:t,clientInformation:r,refreshToken:n,resource:o,addClientAuthentication:s,fetchFn:i}){let a=new URLSearchParams({grant_type:"refresh_token",refresh_token:n}),u=await Mv(e,{metadata:t,tokenRequestParams:a,clientInformation:r,addClientAuthentication:s,resource:o,fetchFn:i});return{refresh_token:n,...u}}async function eO(e,t,{metadata:r,resource:n,authorizationCode:o,fetchFn:s}={}){let i=async()=>{let l=await e.clientInformation(),d=Dc(l,String(t));if(l&&!d)throw Nv(l,String(t));return d},a=await i(),u=e.clientMetadata.scope,c;if(e.prepareTokenRequest)c=await e.prepareTokenRequest(u);if(!c){if(!o)throw Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!e.redirectUrl)throw Error("redirectUrl is required for authorization_code flow");let l=await e.codeVerifier();c=YR(o,l,e.redirectUrl)}return a??(a=await i()),Mv(t,{metadata:r,tokenRequestParams:c,clientInformation:a,addClientAuthentication:e.addClientAuthentication,resource:n,fetchFn:s})}async function tO(e,{metadata:t,clientMetadata:r,scope:n,fetchFn:o}){let s;if(t){if(!t.registration_endpoint)throw Error("Incompatible auth server: does not support dynamic client registration");s=new URL(t.registration_endpoint)}else s=new URL("/register",e);let i=await mr(o??fetch)(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...r,...n!==void 0?{scope:n}:{}})});if(!i.ok)throw await Av(i);return FR.parse(await i.json())}class Gs extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}}var qv=10,rO=13,hr=32;function Lc(e){}function Fv(e){if(typeof e=="function")throw TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");let{onEvent:t=Lc,onError:r=Lc,onRetry:n=Lc,onComment:o,maxBufferSize:s}=e,i=[],a=0,u=!0,c,l="",d=0,m,f=!1;function p(b){if(f)throw Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(u&&(u=!1,b.charCodeAt(0)===239&&b.charCodeAt(1)===187&&b.charCodeAt(2)===191&&(b=b.slice(3))),i.length===0){let Y=_(b);Y!==""&&(i.push(Y),a=Y.length),g();return}if(b.indexOf(`
70
70
  `)===-1&&b.indexOf("\r")===-1){i.push(b),a+=b.length,g();return}i.push(b);let x=i.join("");i.length=0,a=0;let N=_(x);N!==""&&(i.push(N),a=N.length),g()}function g(){s!==void 0&&(a+l.length<=s||(f=!0,i.length=0,a=0,c=void 0,l="",d=0,m=void 0,r(new Gs(`Buffered data exceeded max buffer size of ${s} characters`,{type:"max-buffer-size-exceeded"}))))}function _(b){let x=0;if(b.indexOf("\r")===-1){let N=b.indexOf(`
71
71
  `,x);for(;N!==-1;){if(x===N){d>0&&t({id:c,event:m,data:l}),c=void 0,l="",d=0,m=void 0,x=N+1,N=b.indexOf(`
72
72
  `,x);continue}let Y=b.charCodeAt(x);if(Lv(b,x,Y)){let F=b.charCodeAt(x+5)===hr?x+6:x+5,se=b.slice(F,N);if(d===0&&b.charCodeAt(N+1)===qv){t({id:c,event:m,data:se}),c=void 0,l="",m=void 0,x=N+2,N=b.indexOf(`
@@ -75,7 +75,7 @@ ${se}`,d++}else Uv(b,x,Y)?m=b.slice(b.charCodeAt(x+6)===hr?x+7:x+6,N)||void 0:y(
75
75
  `,x)}return b.slice(x)}for(;x<b.length;){let N=b.indexOf("\r",x),Y=b.indexOf(`
76
76
  `,x),F=-1;if(N!==-1&&Y!==-1?F=N<Y?N:Y:N!==-1?N===b.length-1?F=-1:F=N:Y!==-1&&(F=Y),F===-1)break;y(b,x,F),x=F+1,b.charCodeAt(x-1)===rO&&b.charCodeAt(x)===qv&&x++}return b.slice(x)}function y(b,x,N){if(x===N){C();return}let Y=b.charCodeAt(x);if(Lv(b,x,Y)){let zt=b.charCodeAt(x+5)===hr?x+6:x+5,Kc=b.slice(zt,N);l=d===0?Kc:`${l}
77
77
  ${Kc}`,d++;return}if(Uv(b,x,Y)){m=b.slice(b.charCodeAt(x+6)===hr?x+7:x+6,N)||void 0;return}if(Y===105&&b.charCodeAt(x+1)===100&&b.charCodeAt(x+2)===58){let zt=b.slice(b.charCodeAt(x+3)===hr?x+4:x+3,N);zt.includes("\x00")||(c=zt);return}if(Y===58){if(o){let zt=b.slice(x,N);o(zt.slice(b.charCodeAt(x+1)===hr?2:1))}return}let F=b.slice(x,N),se=F.indexOf(":");if(se===-1){k(F,"",F);return}let mt=F.slice(0,se),rr=F.charCodeAt(se+1)===hr?2:1,_r=F.slice(se+rr);k(mt,_r,F)}function k(b,x,N){switch(b){case"event":m=x||void 0;break;case"data":l=d===0?x:`${l}
78
- ${x}`,d++;break;case"id":x.includes("\x00")||(c=x);break;case"retry":/^\d+$/.test(x)?n(parseInt(x,10)):r(new Gs(`Invalid \`retry\` value: "${x}"`,{type:"invalid-retry",value:x,line:N}));break;default:r(new Gs(`Unknown field "${b.length>20?`${b.slice(0,20)}…`:b}"`,{type:"unknown-field",field:b,value:x,line:N}));break}}function C(){d>0&&t({id:c,event:m,data:l}),c=void 0,l="",d=0,m=void 0}function U(b={}){if(b.consume&&i.length>0){let x=i.join("");y(x,0,x.length)}u=!0,c=void 0,l="",d=0,m=void 0,i.length=0,a=0,f=!1}return{feed:p,reset:U}}function Lv(e,t,r){return r===100&&e.charCodeAt(t+1)===97&&e.charCodeAt(t+2)===116&&e.charCodeAt(t+3)===97&&e.charCodeAt(t+4)===58}function Uv(e,t,r){return r===101&&e.charCodeAt(t+1)===118&&e.charCodeAt(t+2)===101&&e.charCodeAt(t+3)===110&&e.charCodeAt(t+4)===116&&e.charCodeAt(t+5)===58}class Lc extends TransformStream{constructor({onError:e,onRetry:t,onComment:r,maxBufferSize:n}={}){let o;super({start(s){o=Fv({onEvent:(i)=>{s.enqueue(i)},onError(i){typeof e=="function"&&e(i),(e==="terminate"||i.type==="max-buffer-size-exceeded")&&s.error(i)},onRetry:t,onComment:r,maxBufferSize:n})},transform(s){o.feed(s)}})}}var nO={initialReconnectionDelay:1000,maxReconnectionDelay:30000,reconnectionDelayGrowFactor:1.5,maxRetries:2};class gr extends Error{constructor(e,t){super(`Streamable HTTP error: ${t}`);this.code=e}}class Uc{constructor(e,t){if(this._hasCompletedAuthFlow=!1,this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=t?.requestInit,this._authProvider=t?.authProvider,this._fetch=t?.fetch,this._fetchWithInit=wv(t?.fetch,t?.requestInit),this._followRedirects=t?.redirectPolicy==="follow",this._followRedirects)this._fetch=Tc(this._fetch),this._fetchWithInit=Tc(this._fetchWithInit);this._sessionId=t?.sessionId,this._reconnectionOptions=t?.reconnectionOptions??nO}_unfollowedRedirect(e,t){let r=Zs(e,t);return r&&!this._followRedirects?`${r} (redirectPolicy: 'same-origin')`:r}async _authThenStart(){if(!this._authProvider)throw new tr("No auth provider");let e;try{e=await Fn(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(t){throw this.onerror?.(t),t}if(e!=="AUTHORIZED")throw new tr;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){let e={};if(this._authProvider){let r=await this._authProvider.tokens();if(r)e.Authorization=`Bearer ${r.access_token}`}if(this._sessionId)e["mcp-session-id"]=this._sessionId;if(this._protocolVersion)e["mcp-protocol-version"]=this._protocolVersion;let t=Ns(this._requestInit?.headers);return new Headers({...e,...t})}async _startOrAuthSse(e){let{resumptionToken:t}=e;try{let r=await this._commonHeaders();if(r.set("Accept","text/event-stream"),t)r.set("last-event-id",t);let n=this._fetch??fetch,o={method:"GET",headers:r,signal:this._abortController?.signal},s=await n(this._url,this._followRedirects?o:{...o,redirect:"manual"}),i=this._followRedirects?void 0:js(n,this._url,o,s);if(i)s=await i;if(!s.ok){if(await s.body?.cancel(),s.status===401&&this._authProvider)return await this._authThenStart();if(s.status===405)return;throw new gr(s.status,`Failed to open SSE stream: ${this._unfollowedRedirect(s,this._url)??s.statusText}`)}this._handleSseStream(s.body,e,!0)}catch(r){throw this.onerror?.(r),r}}_getNextReconnectionDelay(e){if(this._serverRetryMs!==void 0)return this._serverRetryMs;let t=this._reconnectionOptions.initialReconnectionDelay,r=this._reconnectionOptions.reconnectionDelayGrowFactor,n=this._reconnectionOptions.maxReconnectionDelay;return Math.min(t*Math.pow(r,e),n)}_scheduleReconnection(e,t=0){let r=this._reconnectionOptions.maxRetries;if(t>=r){this.onerror?.(Error(`Maximum reconnection attempts (${r}) exceeded.`));return}let n=this._getNextReconnectionDelay(t);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(e).catch((o)=>{this.onerror?.(Error(`Failed to reconnect SSE stream: ${o instanceof Error?o.message:String(o)}`)),this._scheduleReconnection(e,t+1)})},n)}_handleSseStream(e,t,r){if(!e)return;let{onresumptiontoken:n,replayMessageId:o}=t,s,i=!1,a=!1;(async()=>{try{let c=e.pipeThrough(new TextDecoderStream).pipeThrough(new Lc({onRetry:(m)=>{this._serverRetryMs=m}})).getReader();while(!0){let{value:m,done:f}=await c.read();if(f)break;if(m.id)s=m.id,i=!0,n?.(m.id);if(!m.data)continue;if(!m.event||m.event==="message")try{let p=Pr.parse(JSON.parse(m.data));if(ir(p)){if(a=!0,o!==void 0)p.id=o}this.onmessage?.(p)}catch(p){this.onerror?.(p)}}if((r||i)&&!a&&this._abortController&&!this._abortController.signal.aborted)this._scheduleReconnection({resumptionToken:s,onresumptiontoken:n,replayMessageId:o},0)}catch(c){if(this.onerror?.(Error(`SSE stream disconnected: ${c}`)),(r||i)&&!a&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:s,onresumptiontoken:n,replayMessageId:o},0)}catch(m){this.onerror?.(Error(`Failed to reconnect: ${m instanceof Error?m.message:String(m)}`))}}})()}async start(){if(this._abortController)throw Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new tr("No auth provider");if(await Fn(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new tr("Failed to authorize")}async close(){if(this._reconnectionTimeout)clearTimeout(this._reconnectionTimeout),this._reconnectionTimeout=void 0;this._abortController?.abort(),this.onclose?.()}async send(e,t){try{let{resumptionToken:r,onresumptiontoken:n}=t||{};if(r){this._startOrAuthSse({resumptionToken:r,replayMessageId:gn(e)?e.id:void 0}).catch((m)=>this.onerror?.(m));return}let o=await this._commonHeaders();o.set("content-type","application/json"),o.set("accept","application/json, text/event-stream");let s={...this._requestInit,method:"POST",headers:o,body:JSON.stringify(e),signal:this._abortController?.signal},i=await mr(this._fetch??fetch)(this._url,s),a=i.headers.get("mcp-session-id");if(a)this._sessionId=a;if(!i.ok){let m=await i.text().catch(()=>null);if(i.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new gr(401,"Server returned 401 after successful authentication");let{resourceMetadataUrl:f,scope:p}=Dc(i);if(this._resourceMetadataUrl=f,this._scope=p,await Fn(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new tr;return this._hasCompletedAuthFlow=!0,this.send(e)}if(i.status===403&&this._authProvider){let{resourceMetadataUrl:f,scope:p,error:g}=Dc(i);if(g==="insufficient_scope"){let _=i.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===_)throw new gr(403,"Server returned 403 after trying upscoping");if(p)this._scope=p;if(f)this._resourceMetadataUrl=f;if(this._lastUpscopingHeader=_??void 0,await Fn(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new tr;return this.send(e)}}throw new gr(i.status,`Error POSTing to endpoint: ${this._unfollowedRedirect(i,this._url)??m}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,i.status===202){if(await i.body?.cancel(),Kp(e))this._startOrAuthSse({resumptionToken:void 0}).catch((m)=>this.onerror?.(m));return}let c=(Array.isArray(e)?e:[e]).filter((m)=>("method"in m)&&("id"in m)&&m.id!==void 0).length>0,l=i.headers.get("content-type"),d=bv(l);if(c)if(d==="text/event-stream")this._handleSseStream(i.body,{onresumptiontoken:n},!1);else if(d==="application/json"){let m=await i.json(),f=Array.isArray(m)?m.map((p)=>Pr.parse(p)):[Pr.parse(m)];for(let p of f)this.onmessage?.(p)}else throw await i.body?.cancel(),new gr(-1,`Unexpected content type: ${l}`);else await i.body?.cancel()}catch(r){throw this.onerror?.(r),r}}get sessionId(){return this._sessionId}async terminateSession(){if(!this._sessionId)return;try{let e=await this._commonHeaders(),t={...this._requestInit,method:"DELETE",headers:e,signal:this._abortController?.signal},r=await mr(this._fetch??fetch)(this._url,t);if(await r.body?.cancel(),!r.ok&&r.status!==405)throw new gr(r.status,`Failed to terminate session: ${this._unfollowedRedirect(r,this._url)??r.statusText}`);this._sessionId=void 0}catch(e){throw this.onerror?.(e),e}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}async resumeStream(e,t){await this._startOrAuthSse({resumptionToken:e,onresumptiontoken:t?.onresumptiontoken})}}class Fc{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((c)=>c.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]:[],u=a.some((c)=>c.type==="tool_use");if(s){if(o.some((c)=>c.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!u)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(u){let c=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(c.size!==l.size||![...c].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},ar,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},Ct,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)}}class Vc extends En{constructor(e,t){super(t);if(this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Sn.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 Un,this.setRequestHandler(ia,(r)=>this._oninitialize(r)),this.setNotificationHandler(Io,()=>this.oninitialized?.()),this._capabilities.logging)this.setRequestHandler($a,async(r,n)=>{let o=n.sessionId||n.requestInfo?.headers["mcp-session-id"]||void 0,{level:s}=r.params,i=Sn.safeParse(s);if(i.success)this._loggingLevels.set(o,i.data);return{}})}get experimental(){if(!this._experimental)this._experimental={tasks:new Fc(this)};return this._experimental}registerCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=Lo(this._capabilities,e)}setRequestHandler(e,t){let n=zr(e)?.method;if(!n)throw Error("Schema is missing a method literal");let o=Sr(n);if(typeof o!=="string")throw Error("Schema method literal must be a string");if(o==="tools/call"){let i=async(a,u)=>{let c=Ee($n,a);if(!c.success){let f=c.error instanceof Error?c.error.message:String(c.error);throw new I(j.InvalidParams,`Invalid tools/call request: ${f}`)}let{params:l}=c.data,d=await Promise.resolve(t(a,u));if(l.task){let f=Ee(vt,d);if(!f.success){let p=f.error instanceof Error?f.error.message:String(f.error);throw new I(j.InvalidParams,`Invalid task creation result: ${p}`)}return f.data}let m=Ee(It,d);if(!m.success){let f=m.error instanceof Error?m.error.message:String(m.error);throw new I(j.InvalidParams,`Invalid tools/call result: ${f}`)}return m.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){Cs(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){if(!this._capabilities)return;Is(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:Eo.includes(t)?t:Rt,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"},yt)}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((u)=>u.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((u)=>u.type==="tool_use");if(o){if(n.some((u)=>u.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 u=new Set(i.filter((l)=>l.type==="tool_use").map((l)=>l.id)),c=new Set(n.filter((l)=>l.type==="tool_result").map((l)=>l.toolUseId));if(u.size!==c.size||![...u].every((l)=>c.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},kn,t);return this.request({method:"sampling/createMessage",params:e},ar,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},Ct,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},Ct,t);if(o.action==="accept"&&o.content&&n.requestedSchema)try{let i=this._jsonSchemaValidator.getValidator(n.requestedSchema)(o.content);if(!i.valid)throw new I(j.InvalidParams,`Elicitation response content does not match requested schema: ${i.errorMessage}`)}catch(s){if(s instanceof I)throw s;throw new I(j.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},Pa,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"})}}import Hv from"node:process";var oO=10485760;class Hc{constructor(e){this._maxBufferSize=e?.maxBufferSize??oO}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(`
78
+ ${x}`,d++;break;case"id":x.includes("\x00")||(c=x);break;case"retry":/^\d+$/.test(x)?n(parseInt(x,10)):r(new Gs(`Invalid \`retry\` value: "${x}"`,{type:"invalid-retry",value:x,line:N}));break;default:r(new Gs(`Unknown field "${b.length>20?`${b.slice(0,20)}…`:b}"`,{type:"unknown-field",field:b,value:x,line:N}));break}}function C(){d>0&&t({id:c,event:m,data:l}),c=void 0,l="",d=0,m=void 0}function U(b={}){if(b.consume&&i.length>0){let x=i.join("");y(x,0,x.length)}u=!0,c=void 0,l="",d=0,m=void 0,i.length=0,a=0,f=!1}return{feed:p,reset:U}}function Lv(e,t,r){return r===100&&e.charCodeAt(t+1)===97&&e.charCodeAt(t+2)===116&&e.charCodeAt(t+3)===97&&e.charCodeAt(t+4)===58}function Uv(e,t,r){return r===101&&e.charCodeAt(t+1)===118&&e.charCodeAt(t+2)===101&&e.charCodeAt(t+3)===110&&e.charCodeAt(t+4)===116&&e.charCodeAt(t+5)===58}class Uc extends TransformStream{constructor({onError:e,onRetry:t,onComment:r,maxBufferSize:n}={}){let o;super({start(s){o=Fv({onEvent:(i)=>{s.enqueue(i)},onError(i){typeof e=="function"&&e(i),(e==="terminate"||i.type==="max-buffer-size-exceeded")&&s.error(i)},onRetry:t,onComment:r,maxBufferSize:n})},transform(s){o.feed(s)}})}}var nO={initialReconnectionDelay:1000,maxReconnectionDelay:30000,reconnectionDelayGrowFactor:1.5,maxRetries:2};class gr extends Error{constructor(e,t){super(`Streamable HTTP error: ${t}`);this.code=e}}class Fc{constructor(e,t){if(this._hasCompletedAuthFlow=!1,this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=t?.requestInit,this._authProvider=t?.authProvider,this._fetch=t?.fetch,this._fetchWithInit=wv(t?.fetch,t?.requestInit),this._followRedirects=t?.redirectPolicy==="follow",this._followRedirects)this._fetch=Rc(this._fetch),this._fetchWithInit=Rc(this._fetchWithInit);this._sessionId=t?.sessionId,this._reconnectionOptions=t?.reconnectionOptions??nO}_unfollowedRedirect(e,t){let r=Zs(e,t);return r&&!this._followRedirects?`${r} (redirectPolicy: 'same-origin')`:r}async _authThenStart(){if(!this._authProvider)throw new tr("No auth provider");let e;try{e=await Fn(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(t){throw this.onerror?.(t),t}if(e!=="AUTHORIZED")throw new tr;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){let e={};if(this._authProvider){let r=await this._authProvider.tokens();if(r)e.Authorization=`Bearer ${r.access_token}`}if(this._sessionId)e["mcp-session-id"]=this._sessionId;if(this._protocolVersion)e["mcp-protocol-version"]=this._protocolVersion;let t=Ns(this._requestInit?.headers);return new Headers({...e,...t})}async _startOrAuthSse(e){let{resumptionToken:t}=e;try{let r=await this._commonHeaders();if(r.set("Accept","text/event-stream"),t)r.set("last-event-id",t);let n=this._fetch??fetch,o={method:"GET",headers:r,signal:this._abortController?.signal},s=await n(this._url,this._followRedirects?o:{...o,redirect:"manual"}),i=this._followRedirects?void 0:js(n,this._url,o,s);if(i)s=await i;if(!s.ok){if(await s.body?.cancel(),s.status===401&&this._authProvider)return await this._authThenStart();if(s.status===405)return;throw new gr(s.status,`Failed to open SSE stream: ${this._unfollowedRedirect(s,this._url)??s.statusText}`)}this._handleSseStream(s.body,e,!0)}catch(r){throw this.onerror?.(r),r}}_getNextReconnectionDelay(e){if(this._serverRetryMs!==void 0)return this._serverRetryMs;let t=this._reconnectionOptions.initialReconnectionDelay,r=this._reconnectionOptions.reconnectionDelayGrowFactor,n=this._reconnectionOptions.maxReconnectionDelay;return Math.min(t*Math.pow(r,e),n)}_scheduleReconnection(e,t=0){let r=this._reconnectionOptions.maxRetries;if(t>=r){this.onerror?.(Error(`Maximum reconnection attempts (${r}) exceeded.`));return}let n=this._getNextReconnectionDelay(t);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(e).catch((o)=>{this.onerror?.(Error(`Failed to reconnect SSE stream: ${o instanceof Error?o.message:String(o)}`)),this._scheduleReconnection(e,t+1)})},n)}_handleSseStream(e,t,r){if(!e)return;let{onresumptiontoken:n,replayMessageId:o}=t,s,i=!1,a=!1;(async()=>{try{let c=e.pipeThrough(new TextDecoderStream).pipeThrough(new Uc({onRetry:(m)=>{this._serverRetryMs=m}})).getReader();while(!0){let{value:m,done:f}=await c.read();if(f)break;if(m.id)s=m.id,i=!0,n?.(m.id);if(!m.data)continue;if(!m.event||m.event==="message")try{let p=Pr.parse(JSON.parse(m.data));if(ir(p)){if(a=!0,o!==void 0)p.id=o}this.onmessage?.(p)}catch(p){this.onerror?.(p)}}if((r||i)&&!a&&this._abortController&&!this._abortController.signal.aborted)this._scheduleReconnection({resumptionToken:s,onresumptiontoken:n,replayMessageId:o},0)}catch(c){if(this.onerror?.(Error(`SSE stream disconnected: ${c}`)),(r||i)&&!a&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:s,onresumptiontoken:n,replayMessageId:o},0)}catch(m){this.onerror?.(Error(`Failed to reconnect: ${m instanceof Error?m.message:String(m)}`))}}})()}async start(){if(this._abortController)throw Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new tr("No auth provider");if(await Fn(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new tr("Failed to authorize")}async close(){if(this._reconnectionTimeout)clearTimeout(this._reconnectionTimeout),this._reconnectionTimeout=void 0;this._abortController?.abort(),this.onclose?.()}async send(e,t){try{let{resumptionToken:r,onresumptiontoken:n}=t||{};if(r){this._startOrAuthSse({resumptionToken:r,replayMessageId:gn(e)?e.id:void 0}).catch((m)=>this.onerror?.(m));return}let o=await this._commonHeaders();o.set("content-type","application/json"),o.set("accept","application/json, text/event-stream");let s={...this._requestInit,method:"POST",headers:o,body:JSON.stringify(e),signal:this._abortController?.signal},i=await mr(this._fetch??fetch)(this._url,s),a=i.headers.get("mcp-session-id");if(a)this._sessionId=a;if(!i.ok){let m=await i.text().catch(()=>null);if(i.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new gr(401,"Server returned 401 after successful authentication");let{resourceMetadataUrl:f,scope:p}=Mc(i);if(this._resourceMetadataUrl=f,this._scope=p,await Fn(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new tr;return this._hasCompletedAuthFlow=!0,this.send(e)}if(i.status===403&&this._authProvider){let{resourceMetadataUrl:f,scope:p,error:g}=Mc(i);if(g==="insufficient_scope"){let _=i.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===_)throw new gr(403,"Server returned 403 after trying upscoping");if(p)this._scope=p;if(f)this._resourceMetadataUrl=f;if(this._lastUpscopingHeader=_??void 0,await Fn(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new tr;return this.send(e)}}throw new gr(i.status,`Error POSTing to endpoint: ${this._unfollowedRedirect(i,this._url)??m}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,i.status===202){if(await i.body?.cancel(),Kp(e))this._startOrAuthSse({resumptionToken:void 0}).catch((m)=>this.onerror?.(m));return}let c=(Array.isArray(e)?e:[e]).filter((m)=>("method"in m)&&("id"in m)&&m.id!==void 0).length>0,l=i.headers.get("content-type"),d=bv(l);if(c)if(d==="text/event-stream")this._handleSseStream(i.body,{onresumptiontoken:n},!1);else if(d==="application/json"){let m=await i.json(),f=Array.isArray(m)?m.map((p)=>Pr.parse(p)):[Pr.parse(m)];for(let p of f)this.onmessage?.(p)}else throw await i.body?.cancel(),new gr(-1,`Unexpected content type: ${l}`);else await i.body?.cancel()}catch(r){throw this.onerror?.(r),r}}get sessionId(){return this._sessionId}async terminateSession(){if(!this._sessionId)return;try{let e=await this._commonHeaders(),t={...this._requestInit,method:"DELETE",headers:e,signal:this._abortController?.signal},r=await mr(this._fetch??fetch)(this._url,t);if(await r.body?.cancel(),!r.ok&&r.status!==405)throw new gr(r.status,`Failed to terminate session: ${this._unfollowedRedirect(r,this._url)??r.statusText}`);this._sessionId=void 0}catch(e){throw this.onerror?.(e),e}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}async resumeStream(e,t){await this._startOrAuthSse({resumptionToken:e,onresumptiontoken:t?.onresumptiontoken})}}class Vc{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((c)=>c.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]:[],u=a.some((c)=>c.type==="tool_use");if(s){if(o.some((c)=>c.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!u)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(u){let c=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(c.size!==l.size||![...c].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},ar,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},Ct,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)}}class Hc extends En{constructor(e,t){super(t);if(this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Sn.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 Un,this.setRequestHandler(aa,(r)=>this._oninitialize(r)),this.setNotificationHandler(Io,()=>this.oninitialized?.()),this._capabilities.logging)this.setRequestHandler(za,async(r,n)=>{let o=n.sessionId||n.requestInfo?.headers["mcp-session-id"]||void 0,{level:s}=r.params,i=Sn.safeParse(s);if(i.success)this._loggingLevels.set(o,i.data);return{}})}get experimental(){if(!this._experimental)this._experimental={tasks:new Vc(this)};return this._experimental}registerCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=Lo(this._capabilities,e)}setRequestHandler(e,t){let n=zr(e)?.method;if(!n)throw Error("Schema is missing a method literal");let o=Sr(n);if(typeof o!=="string")throw Error("Schema method literal must be a string");if(o==="tools/call"){let i=async(a,u)=>{let c=Ee($n,a);if(!c.success){let f=c.error instanceof Error?c.error.message:String(c.error);throw new I(j.InvalidParams,`Invalid tools/call request: ${f}`)}let{params:l}=c.data,d=await Promise.resolve(t(a,u));if(l.task){let f=Ee(vt,d);if(!f.success){let p=f.error instanceof Error?f.error.message:String(f.error);throw new I(j.InvalidParams,`Invalid task creation result: ${p}`)}return f.data}let m=Ee(It,d);if(!m.success){let f=m.error instanceof Error?m.error.message:String(m.error);throw new I(j.InvalidParams,`Invalid tools/call result: ${f}`)}return m.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){Cs(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){if(!this._capabilities)return;Is(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:Eo.includes(t)?t:Rt,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"},yt)}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((u)=>u.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((u)=>u.type==="tool_use");if(o){if(n.some((u)=>u.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 u=new Set(i.filter((l)=>l.type==="tool_use").map((l)=>l.id)),c=new Set(n.filter((l)=>l.type==="tool_result").map((l)=>l.toolUseId));if(u.size!==c.size||![...u].every((l)=>c.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},kn,t);return this.request({method:"sampling/createMessage",params:e},ar,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},Ct,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},Ct,t);if(o.action==="accept"&&o.content&&n.requestedSchema)try{let i=this._jsonSchemaValidator.getValidator(n.requestedSchema)(o.content);if(!i.valid)throw new I(j.InvalidParams,`Elicitation response content does not match requested schema: ${i.errorMessage}`)}catch(s){if(s instanceof I)throw s;throw new I(j.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},Ea,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"})}}import Hv from"node:process";var oO=10485760;class Bc{constructor(e){this._maxBufferSize=e?.maxBufferSize??oO}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(`
79
79
  `);if(e===-1)return null;let t=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),sO(t)}clear(){this._buffer=void 0}}function sO(e){return Pr.parse(JSON.parse(e))}function Vv(e){return JSON.stringify(e)+`
80
- `}class Bc{constructor(e=Hv.stdin,t=Hv.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 Hc({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=Vv(e);if(this._stdout.write(r))t();else this._stdout.once("drain",t)})}}var Jc={name:"@stophy/mcp",version:"1.3.0",description:"Give your agents the live web. One API to search the web, read what people say, and look up products, places, jobs and homes.",keywords:["ads","ai-agent","ai-agents","google-maps","google-search","linkedin","llm","mcp","mcp-server","reddit","stophy","transcripts","web-data","web-search","youtube"],homepage:"https://stophy.dev",bugs:{url:"https://github.com/stophydotdev/stophy/issues"},license:"MIT",repository:{type:"git",url:"git+https://github.com/stophydotdev/stophy.git",directory:"mcp"},bin:{"stophy-mcp":"dist/index.js"},files:["dist"],type:"module",publishConfig:{access:"public"},scripts:{build:"bun build ./src/index.ts --outfile ./dist/index.js --target node --minify --banner '#!/usr/bin/env node' && chmod +x ./dist/index.js",prepare:"bun run build",start:"node ./dist/index.js",dev:"bun run ./src/index.ts","check-types":"tsc --noEmit"},dependencies:{"@modelcontextprotocol/sdk":"^1.29.0"},devDependencies:{"@types/node":"^22.0.0",typescript:"^5.8.3"},engines:{node:">=18"},mcpName:"io.github.stophydotdev/mcp"};var aO="https://api.stophy.dev/mcp",cO=()=>{let e=process.env.STOPHY_MCP_URL??aO;try{return new URL(e)}catch{throw Error(`STOPHY_MCP_URL is not a valid URL: ${e}`)}},uO=()=>{let e=process.env.STOPHY_API_KEY?.trim();return e?{Authorization:`Bearer ${e}`}:{}},lO=async(e)=>{let t=new Ec({name:"stophy-mcp",version:Jc.version}),r=new Uc(e,{requestInit:{headers:uO()}});return await t.connect(r),t},dO=async()=>{let e=cO(),t;try{t=await lO(e)}catch(n){let o=n instanceof Error?n.message:String(n),s=/401|unauthorized/iu.test(o)?" Check STOPHY_API_KEY, or unset it to use the free endpoints only.":"";throw Error(`Could not connect to Stophy at ${e.origin}: ${o}.${s}`,{cause:n})}let r=new Vc({name:"stophy",version:Jc.version},{capabilities:{tools:{listChanged:!0}},instructions:t.getInstructions()});r.setRequestHandler(wa,(n)=>t.listTools(n.params)),r.setRequestHandler($n,(n)=>t.callTool(n.params)),t.setNotificationHandler(zn,()=>r.sendToolListChanged()),r.onclose=()=>{t.close()},await r.connect(new Bc)};dO().catch((e)=>{process.stderr.write(`${e instanceof Error?e.message:String(e)}
80
+ `}class Jc{constructor(e=Hv.stdin,t=Hv.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 Bc({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=Vv(e);if(this._stdout.write(r))t();else this._stdout.once("drain",t)})}}var Xs={name:"@stophy/mcp",version:"1.3.1",description:"Give your agents the live web. One API to search the web, read what people say, and look up products, places, jobs and homes.",keywords:["ads","ai-agent","ai-agents","google-maps","google-search","linkedin","llm","mcp","mcp-server","reddit","stophy","transcripts","web-data","web-search","youtube"],homepage:"https://stophy.dev",bugs:{url:"https://github.com/stophydotdev/stophy/issues"},license:"MIT",repository:{type:"git",url:"git+https://github.com/stophydotdev/stophy.git",directory:"mcp"},bin:{"stophy-mcp":"dist/index.js"},files:["dist"],type:"module",publishConfig:{access:"public"},scripts:{build:"bun build ./src/index.ts --outfile ./dist/index.js --target node --minify --banner '#!/usr/bin/env node' && chmod +x ./dist/index.js",prepare:"bun run build",start:"node ./dist/index.js",dev:"bun run ./src/index.ts","check-types":"tsc --noEmit"},dependencies:{"@modelcontextprotocol/sdk":"^1.29.0"},devDependencies:{"@types/node":"^22.0.0",typescript:"^5.8.3"},engines:{node:">=18"},mcpName:"io.github.stophydotdev/mcp"};var aO="https://api.stophy.dev/mcp",cO=()=>{let e=process.env.STOPHY_MCP_URL??aO;try{return new URL(e)}catch{throw Error(`STOPHY_MCP_URL is not a valid URL: ${e}`)}},uO=()=>{let e=process.env.STOPHY_API_KEY?.trim(),t={"User-Agent":`stophy-mcp/${Xs.version}`};return e?{...t,Authorization:`Bearer ${e}`}:t},lO=async(e)=>{let t=new Tc({name:"stophy-mcp",version:Xs.version}),r=new Fc(e,{requestInit:{headers:uO()}});return await t.connect(r),t},dO=async()=>{let e=cO(),t;try{t=await lO(e)}catch(n){let o=n instanceof Error?n.message:String(n),s=/401|unauthorized/iu.test(o)?" Check STOPHY_API_KEY, or unset it to use the free endpoints only.":"";throw Error(`Could not connect to Stophy at ${e.origin}: ${o}.${s}`,{cause:n})}let r=new Hc({name:"stophy",version:Xs.version},{capabilities:{tools:{listChanged:!0}},instructions:t.getInstructions()});r.setRequestHandler(xa,(n)=>t.listTools(n.params)),r.setRequestHandler($n,(n)=>t.callTool(n.params)),t.setNotificationHandler(zn,()=>r.sendToolListChanged()),r.onclose=()=>{t.close()},await r.connect(new Jc)};dO().catch((e)=>{process.stderr.write(`${e instanceof Error?e.message:String(e)}
81
81
  `),process.exit(1)});