@iistools/grove-mcp 0.2.2 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/grove-mcp.js CHANGED
@@ -1,14 +1,14 @@
1
1
  #!/usr/bin/env node
2
- var iO=Object.create;var{getPrototypeOf:aO,defineProperty:Hg,getOwnPropertyNames:cO}=Object;var Gg=Object.prototype.hasOwnProperty;function uO(e){return this[e]}var lO,dO,dp=(e,t,r)=>{var o=e!=null&&typeof e==="object";if(o){var n=t?lO??=new WeakMap:dO??=new WeakMap,s=n.get(e);if(s)return s}r=e!=null?iO(aO(e)):{};let i=t||!e||!e.__esModule||!Gg.call(e,"default")?Hg(r,"default",{value:e,enumerable:!0}):r;if(e&&typeof e==="object"||typeof e==="function"){for(let a of cO(e))if(!Gg.call(i,a))Hg(i,a,{get:uO.bind(e,a),enumerable:!0})}if(o)n.set(e,i);return i};var D=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var ma=D(function(Kb){Object.defineProperty(Kb,"__esModule",{value:!0});Kb.regexpCode=Kb.getEsmExportName=Kb.getProperty=Kb.safeStringify=Kb.stringify=Kb.strConcat=Kb.addCodeArg=Kb.str=Kb._=Kb.nil=Kb._Code=Kb.Name=Kb.IDENTIFIER=Kb._CodeOrName=void 0;class Vl{}Kb._CodeOrName=Vl;Kb.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class us extends Vl{constructor(e){super();if(!Kb.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}}}Kb.Name=us;class gr extends Vl{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 us)t[r.str]=(t[r.str]||0)+1;return t},{})}}Kb._Code=gr;Kb.nil=new gr("");function Gb(e,...t){let r=[e[0]],o=0;while(o<t.length)Xm(r,t[o]),r.push(e[++o]);return new gr(r)}Kb._=Gb;var Ym=new gr("+");function Jb(e,...t){let r=[fa(e[0])],o=0;while(o<t.length)r.push(Ym),Xm(r,t[o]),r.push(Ym,fa(e[++o]));return aA(r),new gr(r)}Kb.str=Jb;function Xm(e,t){if(t instanceof gr)e.push(...t._items);else if(t instanceof us)e.push(t);else e.push(lA(t))}Kb.addCodeArg=Xm;function aA(e){let t=1;while(t<e.length-1){if(e[t]===Ym){let r=cA(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function cA(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string"){if(t instanceof us||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 us))return`"${e}${t.slice(1)}`;return}function uA(e,t){return t.emptyStr()?e:e.emptyStr()?t:Jb`${e}${t}`}Kb.strConcat=uA;function lA(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:fa(Array.isArray(e)?e.join(","):e)}function dA(e){return new gr(fa(e))}Kb.stringify=dA;function fa(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}Kb.safeStringify=fa;function pA(e){return typeof e=="string"&&Kb.IDENTIFIER.test(e)?new gr(`.${e}`):Gb`[${e}]`}Kb.getProperty=pA;function fA(e){if(typeof e=="string"&&Kb.IDENTIFIER.test(e))return new gr(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}Kb.getEsmExportName=fA;function mA(e){return new gr(e.toString())}Kb.regexpCode=mA});var rh=D(function(Xb){Object.defineProperty(Xb,"__esModule",{value:!0});Xb.ValueScope=Xb.ValueScopeName=Xb.Scope=Xb.varKinds=Xb.UsedValueState=void 0;var Me=ma();class Wb extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`);this.value=e.value}}var Hl;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(Hl||(Xb.UsedValueState=Hl={}));Xb.varKinds={const:new Me.Name("const"),let:new Me.Name("let"),var:new Me.Name("var")};class eh{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof Me.Name?e:this.name(e)}name(e){return new Me.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}}}Xb.Scope=eh;class th extends Me.Name{constructor(e,t){super(t);this.prefix=e}setValue(e,{property:t,itemIndex:r}){this.value=e,this.scopePath=Me._`.${new Me.Name(t)}[${r}]`}}Xb.ValueScopeName=th;var PA=Me._`\n`;class Yb extends eh{constructor(e){super(e);this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?PA:Me.nil}}get(){return this._scope}name(e){return new th(e,this._newName(e))}value(e,t){var r;if(t.ref===void 0)throw Error("CodeGen: ref must be passed in value");let o=this.toName(e),{prefix:n}=o,s=(r=t.key)!==null&&r!==void 0?r:t.ref,i=this._values[n];if(i){let u=i.get(s);if(u)return u}else i=this._values[n]=new Map;i.set(s,o);let a=this._scope[n]||(this._scope[n]=[]),c=a.length;return a[c]=t.ref,o.setValue(t,{property:n,itemIndex:c}),o}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 Me._`${e}${r.scopePath}`})}scopeCode(e=this._values,t,r){return this._reduceValues(e,(o)=>{if(o.value===void 0)throw Error(`CodeGen: name "${o}" has no value`);return o.value.code},t,r)}_reduceValues(e,t,r={},o){let n=Me.nil;for(let s in e){let i=e[s];if(!i)continue;let a=r[s]=r[s]||new Map;i.forEach((c)=>{if(a.has(c))return;a.set(c,Hl.Started);let u=t(c);if(u){let l=this.opts.es5?Xb.varKinds.var:Xb.varKinds.const;n=Me._`${n}${l} ${c} = ${u};${this.opts._n}`}else if(u=o===null||o===void 0?void 0:o(c))n=Me._`${n}${u}${this.opts._n}`;else throw new Wb(c);a.set(c,Hl.Completed)})}return n}}Xb.ValueScope=Yb});var $e=D(function(Lt){Object.defineProperty(Lt,"__esModule",{value:!0});Lt.or=Lt.and=Lt.not=Lt.CodeGen=Lt.operators=Lt.varKinds=Lt.ValueScopeName=Lt.ValueScope=Lt.Scope=Lt.Name=Lt.regexpCode=Lt.stringify=Lt.getProperty=Lt.nil=Lt.strConcat=Lt.str=Lt._=void 0;var re=ma(),tt=rh(),$o=ma();Object.defineProperty(Lt,"_",{enumerable:!0,get:function(){return $o._}});Object.defineProperty(Lt,"str",{enumerable:!0,get:function(){return $o.str}});Object.defineProperty(Lt,"strConcat",{enumerable:!0,get:function(){return $o.strConcat}});Object.defineProperty(Lt,"nil",{enumerable:!0,get:function(){return $o.nil}});Object.defineProperty(Lt,"getProperty",{enumerable:!0,get:function(){return $o.getProperty}});Object.defineProperty(Lt,"stringify",{enumerable:!0,get:function(){return $o.stringify}});Object.defineProperty(Lt,"regexpCode",{enumerable:!0,get:function(){return $o.regexpCode}});Object.defineProperty(Lt,"Name",{enumerable:!0,get:function(){return $o.Name}});var Yl=rh();Object.defineProperty(Lt,"Scope",{enumerable:!0,get:function(){return Yl.Scope}});Object.defineProperty(Lt,"ValueScope",{enumerable:!0,get:function(){return Yl.ValueScope}});Object.defineProperty(Lt,"ValueScopeName",{enumerable:!0,get:function(){return Yl.ValueScopeName}});Object.defineProperty(Lt,"varKinds",{enumerable:!0,get:function(){return Yl.varKinds}});Lt.operators={GT:new re._Code(">"),GTE:new re._Code(">="),LT:new re._Code("<"),LTE:new re._Code("<="),EQ:new re._Code("==="),NEQ:new re._Code("!=="),NOT:new re._Code("!"),OR:new re._Code("||"),AND:new re._Code("&&"),ADD:new re._Code("+")};class wo{optimizeNodes(){return this}optimizeNames(e,t){return this}}class e$ extends wo{constructor(e,t,r){super();this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){let r=e?tt.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${r} ${this.name}${o};`+t}optimizeNames(e,t){if(!e[this.name.str])return;if(this.rhs)this.rhs=ds(this.rhs,e,t);return this}get names(){return this.rhs instanceof re._CodeOrName?this.rhs.names:{}}}class sh extends wo{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 re.Name&&!e[this.lhs.str]&&!this.sideEffects)return;return this.rhs=ds(this.rhs,e,t),this}get names(){let e=this.lhs instanceof re.Name?{}:{...this.lhs.names};return Wl(e,this.rhs)}}class t$ extends sh{constructor(e,t,r,o){super(e,r,o);this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class r$ extends wo{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class o$ extends wo{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class n$ extends wo{constructor(e){super();this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class s$ extends wo{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=ds(this.code,e,t),this}get names(){return this.code instanceof re._CodeOrName?this.code.names:{}}}class Xl extends wo{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,o=r.length;while(o--){let n=r[o];if(n.optimizeNames(e,t))continue;OA(e,n.names),r.splice(o,1)}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>yn(e,t.names),{})}}class Ro extends Xl{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class i$ extends Xl{}class ha extends Ro{}ha.kind="else";class Jr extends Ro{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 ha(r):r}if(t){if(e===!1)return t instanceof Jr?t:t.nodes;if(this.nodes.length)return this;return new Jr(d$(e),t instanceof Jr?[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=ds(this.condition,e,t),this}get names(){let e=super.names;if(Wl(e,this.condition),this.else)yn(e,this.else.names);return e}}Jr.kind="if";class ls extends Ro{}ls.kind="for";class a$ extends ls{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=ds(this.iteration,e,t),this}get names(){return yn(super.names,this.iteration.names)}}class c$ extends ls{constructor(e,t,r,o){super();this.varKind=e,this.name=t,this.from=r,this.to=o}render(e){let t=e.es5?tt.varKinds.var:this.varKind,{name:r,from:o,to:n}=this;return`for(${t} ${r}=${o}; ${r}<${n}; ${r}++)`+super.render(e)}get names(){let e=Wl(super.names,this.from);return Wl(e,this.to)}}class oh extends ls{constructor(e,t,r,o){super();this.loop=e,this.varKind=t,this.name=r,this.iterable=o}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=ds(this.iterable,e,t),this}get names(){return yn(super.names,this.iterable.names)}}class Gl extends Ro{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)}}Gl.kind="func";class Jl extends Xl{render(e){return"return "+super.render(e)}}Jl.kind="return";class u$ extends Ro{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,o;return super.optimizeNames(e,t),(r=this.catch)===null||r===void 0||r.optimizeNames(e,t),(o=this.finally)===null||o===void 0||o.optimizeNames(e,t),this}get names(){let e=super.names;if(this.catch)yn(e,this.catch.names);if(this.finally)yn(e,this.finally.names);return e}}class Kl extends Ro{constructor(e){super();this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}Kl.kind="catch";class Bl extends Ro{render(e){return"finally"+super.render(e)}}Bl.kind="finally";class l${constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
3
- `:""},this._extScope=e,this._scope=new tt.Scope({parent:e}),this._nodes=[new i$]}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,o){let n=this._scope.toName(t);if(r!==void 0&&o)this._constants[n.str]=r;return this._leafNode(new e$(e,n,r)),n}const(e,t,r){return this._def(tt.varKinds.const,e,t,r)}let(e,t,r){return this._def(tt.varKinds.let,e,t,r)}var(e,t,r){return this._def(tt.varKinds.var,e,t,r)}assign(e,t,r){return this._leafNode(new sh(e,t,r))}add(e,t){return this._leafNode(new t$(e,Lt.operators.ADD,t))}code(e){if(typeof e=="function")e();else if(e!==re.nil)this._leafNode(new s$(e));return this}object(...e){let t=["{"];for(let[r,o]of e){if(t.length>1)t.push(",");if(t.push(r),r!==o||this.opts.es5)t.push(":"),re.addCodeArg(t,o)}return t.push("}"),new re._Code(t)}if(e,t,r){if(this._blockNode(new Jr(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 Jr(e))}else(){return this._elseNode(new ha)}endIf(){return this._endBlockNode(Jr,ha)}_for(e,t){if(this._blockNode(e),t)this.code(t).endFor();return this}for(e,t){return this._for(new a$(e),t)}forRange(e,t,r,o,n=this.opts.es5?tt.varKinds.var:tt.varKinds.let){let s=this._scope.toName(e);return this._for(new c$(n,s,t,r),()=>o(s))}forOf(e,t,r,o=tt.varKinds.const){let n=this._scope.toName(e);if(this.opts.es5){let s=t instanceof re.Name?t:this.var("_arr",t);return this.forRange("_i",0,re._`${s}.length`,(i)=>{this.var(n,re._`${s}[${i}]`),r(n)})}return this._for(new oh("of",o,n,t),()=>r(n))}forIn(e,t,r,o=this.opts.es5?tt.varKinds.var:tt.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,re._`Object.keys(${t})`,r);let n=this._scope.toName(e);return this._for(new oh("in",o,n,t),()=>r(n))}endFor(){return this._endBlockNode(ls)}label(e){return this._leafNode(new r$(e))}break(e){return this._leafNode(new o$(e))}return(e){let t=new Jl;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(Jl)}try(e,t,r){if(!t&&!r)throw Error('CodeGen: "try" without "catch" and "finally"');let o=new u$;if(this._blockNode(o),this.code(e),t){let n=this.name("e");this._currNode=o.catch=new Kl(n),t(n)}if(r)this._currNode=o.finally=new Bl,this.code(r);return this._endBlockNode(Kl,Bl)}throw(e){return this._leafNode(new n$(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=re.nil,r,o){if(this._blockNode(new Gl(e,t,r)),o)this.code(o).endFunc();return this}endFunc(){return this._endBlockNode(Gl)}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 Jr))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}}Lt.CodeGen=l$;function yn(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function Wl(e,t){return t instanceof re._CodeOrName?yn(e,t.names):e}function ds(e,t,r){if(e instanceof re.Name)return o(e);if(!n(e))return e;return new re._Code(e._items.reduce((s,i)=>{if(i instanceof re.Name)i=o(i);if(i instanceof re._Code)s.push(...i._items);else s.push(i);return s},[]));function o(s){let i=r[s.str];if(i===void 0||t[s.str]!==1)return s;return delete t[s.str],i}function n(s){return s instanceof re._Code&&s._items.some((i)=>i instanceof re.Name&&t[i.str]===1&&r[i.str]!==void 0)}}function OA(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function d$(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:re._`!${nh(e)}`}Lt.not=d$;var CA=p$(Lt.operators.AND);function xA(...e){return e.reduce(CA)}Lt.and=xA;var NA=p$(Lt.operators.OR);function AA(...e){return e.reduce(NA)}Lt.or=AA;function p$(e){return(t,r)=>t===re.nil?r:r===re.nil?t:re._`${nh(t)} ${e} ${nh(r)}`}function nh(e){return e instanceof re.Name?e:re._`(${e})`}});var ke=D(function($$){Object.defineProperty($$,"__esModule",{value:!0});$$.checkStrictMode=$$.getErrorPath=$$.Type=$$.useFunc=$$.setEvaluated=$$.evaluatedPropsToName=$$.mergeEvaluated=$$.eachItem=$$.unescapeJsonPointer=$$.escapeJsonPointer=$$.escapeFragment=$$.unescapeFragment=$$.schemaRefOrVal=$$.schemaHasRulesButRef=$$.schemaHasRules=$$.checkUnknownRules=$$.alwaysValidSchema=$$.toHash=void 0;var he=$e(),g$=ma();function LA(e){let t={};for(let r of e)t[r]=!0;return t}$$.toHash=LA;function DA(e,t){if(typeof t=="boolean")return t;if(Object.keys(t).length===0)return!0;return y$(e,t),!_$(t,e.self.RULES.all)}$$.alwaysValidSchema=DA;function y$(e,t=e.schema){let{opts:r,self:o}=e;if(!r.strictSchema)return;if(typeof t==="boolean")return;let n=o.RULES.keywords;for(let s in t)if(!n[s])b$(e,`unknown keyword: "${s}"`)}$$.checkUnknownRules=y$;function _$(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}$$.schemaHasRules=_$;function UA(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}$$.schemaHasRulesButRef=UA;function FA({topSchemaRef:e,schemaPath:t},r,o,n){if(!n){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return he._`${r}`}return he._`${e}${t}${he.getProperty(o)}`}$$.schemaRefOrVal=FA;function VA(e){return v$(decodeURIComponent(e))}$$.unescapeFragment=VA;function ZA(e){return encodeURIComponent(ah(e))}$$.escapeFragment=ZA;function ah(e){if(typeof e=="number")return`${e}`;return e.replace(/~/g,"~0").replace(/\//g,"~1")}$$.escapeJsonPointer=ah;function v$(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}$$.unescapeJsonPointer=v$;function HA(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}$$.eachItem=HA;function m$({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:o}){return(n,s,i,a)=>{let c=i===void 0?s:i instanceof he.Name?(s instanceof he.Name?e(n,s,i):t(n,s,i),i):s instanceof he.Name?(t(n,i,s),s):r(s,i);return a===he.Name&&!(c instanceof he.Name)?o(n,c):c}}$$.mergeEvaluated={props:m$({mergeNames:(e,t,r)=>e.if(he._`${r} !== true && ${t} !== undefined`,()=>{e.if(he._`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,he._`${r} || {}`).code(he._`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if(he._`${r} !== true`,()=>{if(t===!0)e.assign(r,!0);else e.assign(r,he._`${r} || {}`),ch(e,r,t)}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:S$}),items:m$({mergeNames:(e,t,r)=>e.if(he._`${r} !== true && ${t} !== undefined`,()=>e.assign(r,he._`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if(he._`${r} !== true`,()=>e.assign(r,t===!0?!0:he._`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function S$(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",he._`{}`);if(t!==void 0)ch(e,r,t);return r}$$.evaluatedPropsToName=S$;function ch(e,t,r){Object.keys(r).forEach((o)=>e.assign(he._`${t}${he.getProperty(o)}`,!0))}$$.setEvaluated=ch;var h$={};function GA(e,t){return e.scopeValue("func",{ref:t,code:h$[t.code]||(h$[t.code]=new g$._Code(t.code))})}$$.useFunc=GA;var ih;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(ih||($$.Type=ih={}));function JA(e,t,r){if(e instanceof he.Name){let o=t===ih.Num;return r?o?he._`"[" + ${e} + "]"`:he._`"['" + ${e} + "']"`:o?he._`"/" + ${e}`:he._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?he.getProperty(e).toString():"/"+ah(e)}$$.getErrorPath=JA;function b$(e,t,r=e.opts.strictSchema){if(!r)return;if(t=`strict mode: ${t}`,r===!0)throw Error(t);e.self.logger.warn(t)}$$.checkStrictMode=b$});var tr=D(function(R$){Object.defineProperty(R$,"__esModule",{value:!0});var je=$e(),dj={data:new je.Name("data"),valCxt:new je.Name("valCxt"),instancePath:new je.Name("instancePath"),parentData:new je.Name("parentData"),parentDataProperty:new je.Name("parentDataProperty"),rootData:new je.Name("rootData"),dynamicAnchors:new je.Name("dynamicAnchors"),vErrors:new je.Name("vErrors"),errors:new je.Name("errors"),this:new je.Name("this"),self:new je.Name("self"),scope:new je.Name("scope"),json:new je.Name("json"),jsonPos:new je.Name("jsonPos"),jsonLen:new je.Name("jsonLen"),jsonPart:new je.Name("jsonPart")};R$.default=dj});var ga=D(function(T$){Object.defineProperty(T$,"__esModule",{value:!0});T$.extendErrors=T$.resetErrorsCount=T$.reportExtraError=T$.reportError=T$.keyword$DataError=T$.keywordError=void 0;var oe=$e(),Eo=ke(),Nt=tr();T$.keywordError={message:({keyword:e})=>oe.str`must pass "${e}" keyword validation`};T$.keyword$DataError={message:({keyword:e,schemaType:t})=>t?oe.str`"${e}" keyword must be ${t} ($data)`:oe.str`"${e}" keyword is invalid ($data)`};function fj(e,t=T$.keywordError,r,o){let{it:n}=e,{gen:s,compositeRule:i,allErrors:a}=n,c=P$(e,t,r);if(o!==null&&o!==void 0?o:i||a)E$(s,c);else z$(n,oe._`[${c}]`)}T$.reportError=fj;function mj(e,t=T$.keywordError,r){let{it:o}=e,{gen:n,compositeRule:s,allErrors:i}=o,a=P$(e,t,r);if(E$(n,a),!(s||i))z$(o,Nt.default.vErrors)}T$.reportExtraError=mj;function hj(e,t){e.assign(Nt.default.errors,t),e.if(oe._`${Nt.default.vErrors} !== null`,()=>e.if(t,()=>e.assign(oe._`${Nt.default.vErrors}.length`,t),()=>e.assign(Nt.default.vErrors,null)))}T$.resetErrorsCount=hj;function gj({gen:e,keyword:t,schemaValue:r,data:o,errsCount:n,it:s}){if(n===void 0)throw Error("ajv implementation error");let i=e.name("err");e.forRange("i",n,Nt.default.errors,(a)=>{if(e.const(i,oe._`${Nt.default.vErrors}[${a}]`),e.if(oe._`${i}.instancePath === undefined`,()=>e.assign(oe._`${i}.instancePath`,oe.strConcat(Nt.default.instancePath,s.errorPath))),e.assign(oe._`${i}.schemaPath`,oe.str`${s.errSchemaPath}/${t}`),s.opts.verbose)e.assign(oe._`${i}.schema`,r),e.assign(oe._`${i}.data`,o)})}T$.extendErrors=gj;function E$(e,t){let r=e.const("err",t);e.if(oe._`${Nt.default.vErrors} === null`,()=>e.assign(Nt.default.vErrors,oe._`[${r}]`),oe._`${Nt.default.vErrors}.push(${r})`),e.code(oe._`${Nt.default.errors}++`)}function z$(e,t){let{gen:r,validateName:o,schemaEnv:n}=e;if(n.$async)r.throw(oe._`new ${e.ValidationError}(${t})`);else r.assign(oe._`${o}.errors`,t),r.return(!1)}var _n={keyword:new oe.Name("keyword"),schemaPath:new oe.Name("schemaPath"),params:new oe.Name("params"),propertyName:new oe.Name("propertyName"),message:new oe.Name("message"),schema:new oe.Name("schema"),parentSchema:new oe.Name("parentSchema")};function P$(e,t,r){let{createErrors:o}=e.it;if(o===!1)return oe._`{}`;return yj(e,t,r)}function yj(e,t,r={}){let{gen:o,it:n}=e,s=[_j(n,r),vj(e,r)];return Sj(e,t,s),o.object(...s)}function _j({errorPath:e},{instancePath:t}){let r=t?oe.str`${e}${Eo.getErrorPath(t,Eo.Type.Str)}`:e;return[Nt.default.instancePath,oe.strConcat(Nt.default.instancePath,r)]}function vj({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:o}){let n=o?t:oe.str`${t}/${e}`;if(r)n=oe.str`${n}${Eo.getErrorPath(r,Eo.Type.Str)}`;return[_n.schemaPath,n]}function Sj(e,{params:t,message:r},o){let{keyword:n,data:s,schemaValue:i,it:a}=e,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;if(o.push([_n.keyword,n],[_n.params,typeof t=="function"?t(e):t||oe._`{}`]),c.messages)o.push([_n.message,typeof r=="function"?r(e):r]);if(c.verbose)o.push([_n.schema,i],[_n.parentSchema,oe._`${l}${d}`],[Nt.default.data,s]);if(u)o.push([_n.propertyName,u])}});var A$=D(function(x$){Object.defineProperty(x$,"__esModule",{value:!0});x$.boolOrEmptySchema=x$.topBoolOrEmptySchema=void 0;var k$=ga(),O$=$e(),Ej=tr(),zj={message:"boolean schema is false"};function Pj(e){let{gen:t,schema:r,validateName:o}=e;if(r===!1)C$(e,!1);else if(typeof r=="object"&&r.$async===!0)t.return(Ej.default.data);else t.assign(O$._`${o}.errors`,null),t.return(!0)}x$.topBoolOrEmptySchema=Pj;function Tj(e,t){let{gen:r,schema:o}=e;if(o===!1)r.var(t,!1),C$(e);else r.var(t,!0)}x$.boolOrEmptySchema=Tj;function C$(e,t){let{gen:r,data:o}=e;k$.reportError({gen:r,keyword:"false schema",data:o,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e},zj,void 0,t)}});var lh=D(function(j$){Object.defineProperty(j$,"__esModule",{value:!0});j$.getRules=j$.isJSONType=void 0;var kj=["string","number","integer","boolean","null","object","array"],Oj=new Set(kj);function Cj(e){return typeof e=="string"&&Oj.has(e)}j$.isJSONType=Cj;function xj(){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:{}}}j$.getRules=xj});var dh=D(function(D$){Object.defineProperty(D$,"__esModule",{value:!0});D$.shouldUseRule=D$.shouldUseGroup=D$.schemaHasRulesForType=void 0;function Aj({schema:e,self:t},r){let o=t.RULES.types[r];return o&&o!==!0&&M$(e,o)}D$.schemaHasRulesForType=Aj;function M$(e,t){return t.rules.some((r)=>L$(e,r))}D$.shouldUseGroup=M$;function L$(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some((o)=>e[o]!==void 0))}D$.shouldUseRule=L$});var ya=D(function(J$){Object.defineProperty(J$,"__esModule",{value:!0});J$.reportTypeError=J$.checkDataTypes=J$.checkDataType=J$.coerceAndCheckDataType=J$.getJSONTypes=J$.getSchemaTypes=J$.DataType=void 0;var F$=lh(),V$=dh(),Z$=ga(),X=$e(),ed=ke(),ps;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(ps||(J$.DataType=ps={}));function Mj(e){let t=H$(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}J$.getSchemaTypes=Mj;function H$(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(F$.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}J$.getJSONTypes=H$;function Lj(e,t){let{gen:r,data:o,opts:n}=e,s=Dj(t,n.coerceTypes),i=t.length>0&&!(s.length===0&&t.length===1&&V$.schemaHasRulesForType(e,t[0]));if(i){let a=fh(t,o,n.strictNumbers,ps.Wrong);r.if(a,()=>{if(s.length)Uj(e,t,s);else mh(e)})}return i}J$.coerceAndCheckDataType=Lj;var G$=new Set(["string","number","integer","boolean","null"]);function Dj(e,t){return t?e.filter((r)=>G$.has(r)||t==="array"&&r==="array"):[]}function Uj(e,t,r){let{gen:o,data:n,opts:s}=e,i=o.let("dataType",X._`typeof ${n}`),a=o.let("coerced",X._`undefined`);if(s.coerceTypes==="array")o.if(X._`${i} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>o.assign(n,X._`${n}[0]`).assign(i,X._`typeof ${n}`).if(fh(t,n,s.strictNumbers),()=>o.assign(a,n)));o.if(X._`${a} !== undefined`);for(let u of r)if(G$.has(u)||u==="array"&&s.coerceTypes==="array")c(u);o.else(),mh(e),o.endIf(),o.if(X._`${a} !== undefined`,()=>{o.assign(n,a),Fj(e,a)});function c(u){switch(u){case"string":o.elseIf(X._`${i} == "number" || ${i} == "boolean"`).assign(a,X._`"" + ${n}`).elseIf(X._`${n} === null`).assign(a,X._`""`);return;case"number":o.elseIf(X._`${i} == "boolean" || ${n} === null
4
- || (${i} == "string" && ${n} && ${n} == +${n})`).assign(a,X._`+${n}`);return;case"integer":o.elseIf(X._`${i} === "boolean" || ${n} === null
5
- || (${i} === "string" && ${n} && ${n} == +${n} && !(${n} % 1))`).assign(a,X._`+${n}`);return;case"boolean":o.elseIf(X._`${n} === "false" || ${n} === 0 || ${n} === null`).assign(a,!1).elseIf(X._`${n} === "true" || ${n} === 1`).assign(a,!0);return;case"null":o.elseIf(X._`${n} === "" || ${n} === 0 || ${n} === false`),o.assign(a,null);return;case"array":o.elseIf(X._`${i} === "string" || ${i} === "number"
6
- || ${i} === "boolean" || ${n} === null`).assign(a,X._`[${n}]`)}}}function Fj({gen:e,parentData:t,parentDataProperty:r},o){e.if(X._`${t} !== undefined`,()=>e.assign(X._`${t}[${r}]`,o))}function ph(e,t,r,o=ps.Correct){let n=o===ps.Correct?X.operators.EQ:X.operators.NEQ,s;switch(e){case"null":return X._`${t} ${n} null`;case"array":s=X._`Array.isArray(${t})`;break;case"object":s=X._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":s=i(X._`!(${t} % 1) && !isNaN(${t})`);break;case"number":s=i();break;default:return X._`typeof ${t} ${n} ${e}`}return o===ps.Correct?s:X.not(s);function i(a=X.nil){return X.and(X._`typeof ${t} == "number"`,a,r?X._`isFinite(${t})`:X.nil)}}J$.checkDataType=ph;function fh(e,t,r,o){if(e.length===1)return ph(e[0],t,r,o);let n,s=ed.toHash(e);if(s.array&&s.object){let i=X._`typeof ${t} != "object"`;n=s.null?i:X._`!${t} || ${i}`,delete s.null,delete s.array,delete s.object}else n=X.nil;if(s.number)delete s.integer;for(let i in s)n=X.and(n,ph(i,t,r,o));return n}J$.checkDataTypes=fh;var Vj={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?X._`{type: ${e}}`:X._`{type: ${t}}`};function mh(e){let t=Zj(e);Z$.reportError(t,Vj)}J$.reportTypeError=mh;function Zj(e){let{gen:t,data:r,schema:o}=e,n=ed.schemaRefOrVal(e,o,"type");return{gen:t,keyword:"type",data:r,schema:o.type,schemaCode:n,schemaValue:n,parentSchema:o,params:{},it:e}}});var Q$=D(function(Y$){Object.defineProperty(Y$,"__esModule",{value:!0});Y$.assignDefaults=void 0;var rr=$e(),W$=ke();function Yj(e,t){let{properties:r,items:o}=e.schema;if(t==="object"&&r)for(let n in r)B$(e,n,r[n].default);else if(t==="array"&&Array.isArray(o))o.forEach((n,s)=>B$(e,s,n.default))}Y$.assignDefaults=Yj;function B$(e,t,r){let{gen:o,compositeRule:n,data:s,opts:i}=e;if(r===void 0)return;let a=rr._`${s}${rr.getProperty(t)}`;if(n){W$.checkStrictMode(e,`default is ignored for: ${a}`);return}let c=rr._`${a} === undefined`;if(i.useDefaults==="empty")c=rr._`${c} || ${a} === null || ${a} === ""`;o.if(c,rr._`${a} = ${rr.stringify(r)}`)}});var or=D(function(ow){Object.defineProperty(ow,"__esModule",{value:!0});ow.validateUnion=ow.validateArray=ow.usePattern=ow.callValidateCode=ow.schemaProperties=ow.allSchemaProperties=ow.noPropertyInData=ow.propertyInData=ow.isOwnProperty=ow.hasPropFunc=ow.reportMissingProp=ow.checkMissingProp=ow.checkReportMissingProp=void 0;var _e=$e(),fs=ke(),zo=tr(),ew=ke();function Xj(e,t){let{gen:r,data:o,it:n}=e;r.if(gh(r,o,t,n.opts.ownProperties),()=>{e.setParams({missingProperty:_e._`${t}`},!0),e.error()})}ow.checkReportMissingProp=Xj;function Qj({gen:e,data:t,it:{opts:r}},o,n){return _e.or(...o.map((s)=>_e.and(gh(e,t,s,r.ownProperties),_e._`${n} = ${s}`)))}ow.checkMissingProp=Qj;function eq(e,t){e.setParams({missingProperty:t},!0),e.error()}ow.reportMissingProp=eq;function tw(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:_e._`Object.prototype.hasOwnProperty`})}ow.hasPropFunc=tw;function hh(e,t,r){return _e._`${tw(e)}.call(${t}, ${r})`}ow.isOwnProperty=hh;function tq(e,t,r,o){let n=_e._`${t}${_e.getProperty(r)} !== undefined`;return o?_e._`${n} && ${hh(e,t,r)}`:n}ow.propertyInData=tq;function gh(e,t,r,o){let n=_e._`${t}${_e.getProperty(r)} === undefined`;return o?_e.or(n,_e.not(hh(e,t,r))):n}ow.noPropertyInData=gh;function rw(e){return e?Object.keys(e).filter((t)=>t!=="__proto__"):[]}ow.allSchemaProperties=rw;function rq(e,t){return rw(t).filter((r)=>!fs.alwaysValidSchema(e,t[r]))}ow.schemaProperties=rq;function oq({schemaCode:e,data:t,it:{gen:r,topSchemaRef:o,schemaPath:n,errorPath:s},it:i},a,c,u){let l=u?_e._`${e}, ${t}, ${o}${n}`:t,d=[[zo.default.instancePath,_e.strConcat(zo.default.instancePath,s)],[zo.default.parentData,i.parentData],[zo.default.parentDataProperty,i.parentDataProperty],[zo.default.rootData,zo.default.rootData]];if(i.opts.dynamicRef)d.push([zo.default.dynamicAnchors,zo.default.dynamicAnchors]);let f=_e._`${l}, ${r.object(...d)}`;return c!==_e.nil?_e._`${a}.call(${c}, ${f})`:_e._`${a}(${f})`}ow.callValidateCode=oq;var nq=_e._`new RegExp`;function sq({gen:e,it:{opts:t}},r){let o=t.unicodeRegExp?"u":"",{regExp:n}=t.code,s=n(r,o);return e.scopeValue("pattern",{key:s.toString(),ref:s,code:_e._`${n.code==="new RegExp"?nq:ew.useFunc(e,n)}(${r}, ${o})`})}ow.usePattern=sq;function iq(e){let{gen:t,data:r,keyword:o,it:n}=e,s=t.name("valid");if(n.allErrors){let a=t.let("valid",!0);return i(()=>t.assign(a,!1)),a}return t.var(s,!0),i(()=>t.break()),s;function i(a){let c=t.const("len",_e._`${r}.length`);t.forRange("i",0,c,(u)=>{e.subschema({keyword:o,dataProp:u,dataPropType:fs.Type.Num},s),t.if(_e.not(s),a)})}}ow.validateArray=iq;function aq(e){let{gen:t,schema:r,keyword:o,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(r.some((c)=>fs.alwaysValidSchema(n,c))&&!n.opts.unevaluated)return;let i=t.let("valid",!1),a=t.name("_valid");t.block(()=>r.forEach((c,u)=>{let l=e.subschema({keyword:o,schemaProp:u,compositeRule:!0},a);if(t.assign(i,_e._`${i} || ${a}`),!e.mergeValidEvaluated(l,a))t.if(_e.not(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}ow.validateUnion=aq});var dw=D(function(uw){Object.defineProperty(uw,"__esModule",{value:!0});uw.validateKeywordUsage=uw.validSchemaType=uw.funcKeywordCode=uw.macroKeywordCode=void 0;var qe=$e(),vn=tr(),iw=or(),aw=ga();function Sq(e,t){let{gen:r,keyword:o,schema:n,parentSchema:s,it:i}=e,a=t.macro.call(i.self,n,s,i),c=cw(r,o,a);if(i.opts.validateSchema!==!1)i.self.validateSchema(a,!0);let u=r.name("valid");e.subschema({schema:a,schemaPath:qe.nil,errSchemaPath:`${i.errSchemaPath}/${o}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}uw.macroKeywordCode=Sq;function bq(e,t){var r;let{gen:o,keyword:n,schema:s,parentSchema:i,$data:a,it:c}=e;wq(c,t);let u=!a&&t.compile?t.compile.call(c.self,s,i,c):t.validate,l=cw(o,n,u),d=o.let("valid");e.block$data(d,f),e.ok((r=t.valid)!==null&&r!==void 0?r:d);function f(){if(t.errors===!1){if(g(),t.modifying)sw(e);_(()=>e.error())}else{let y=t.async?m():h();if(t.modifying)sw(e);_(()=>$q(e,y))}}function m(){let y=o.let("ruleErrs",null);return o.try(()=>g(qe._`await `),(S)=>o.assign(d,!1).if(qe._`${S} instanceof ${c.ValidationError}`,()=>o.assign(y,qe._`${S}.errors`),()=>o.throw(S))),y}function h(){let y=qe._`${l}.errors`;return o.assign(y,null),g(qe.nil),y}function g(y=t.async?qe._`await `:qe.nil){let S=c.opts.passContext?vn.default.this:vn.default.self,v=!(("compile"in t)&&!a||t.schema===!1);o.assign(d,qe._`${y}${iw.callValidateCode(e,l,S,v)}`,t.modifying)}function _(y){var S;o.if(qe.not((S=t.valid)!==null&&S!==void 0?S:d),y)}}uw.funcKeywordCode=bq;function sw(e){let{gen:t,data:r,it:o}=e;t.if(o.parentData,()=>t.assign(r,qe._`${o.parentData}[${o.parentDataProperty}]`))}function $q(e,t){let{gen:r}=e;r.if(qe._`Array.isArray(${t})`,()=>{r.assign(vn.default.vErrors,qe._`${vn.default.vErrors} === null ? ${t} : ${vn.default.vErrors}.concat(${t})`).assign(vn.default.errors,qe._`${vn.default.vErrors}.length`),aw.extendErrors(e)},()=>e.error())}function wq({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}function cw(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:qe.stringify(r)})}function Rq(e,t,r=!1){return!t.length||t.some((o)=>o==="array"?Array.isArray(e):o==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==o||r&&typeof e>"u")}uw.validSchemaType=Rq;function Eq({schema:e,opts:t,self:r,errSchemaPath:o},n,s){if(Array.isArray(n.keyword)?!n.keyword.includes(s):n.keyword!==s)throw Error("ajv implementation error");let i=n.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(n.validateSchema){if(!n.validateSchema(e[s])){let c=`keyword "${s}" value is invalid at path "${o}": `+r.errorsText(n.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw Error(c)}}}uw.validateKeywordUsage=Eq});var mw=D(function(pw){Object.defineProperty(pw,"__esModule",{value:!0});pw.extendSubschemaMode=pw.extendSubschemaData=pw.getSubschema=void 0;var ut=$e(),td=ke();function Iq(e,{keyword:t,schemaProp:r,schema:o,schemaPath:n,errSchemaPath:s,topSchemaRef:i}){if(t!==void 0&&o!==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:ut._`${e.schemaPath}${ut.getProperty(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:ut._`${e.schemaPath}${ut.getProperty(t)}${ut.getProperty(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${td.escapeFragment(r)}`}}if(o!==void 0){if(n===void 0||s===void 0||i===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:o,schemaPath:n,topSchemaRef:i,errSchemaPath:s}}throw Error('either "keyword" or "schema" must be passed')}pw.getSubschema=Iq;function kq(e,t,{dataProp:r,dataPropType:o,data:n,dataTypes:s,propertyName:i}){if(n!==void 0&&r!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=t;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=t,f=a.let("data",ut._`${t.data}${ut.getProperty(r)}`,!0);c(f),e.errorPath=ut.str`${u}${td.getErrorPath(r,o,d.jsPropertySyntax)}`,e.parentDataProperty=ut._`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(n!==void 0){let u=n instanceof ut.Name?n:a.let("data",n,!0);if(c(u),i!==void 0)e.propertyName=i}if(s)e.dataTypes=s;function c(u){e.data=u,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,u]}}pw.extendSubschemaData=kq;function Oq(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:o,createErrors:n,allErrors:s}){if(o!==void 0)e.compositeRule=o;if(n!==void 0)e.createErrors=n;if(s!==void 0)e.allErrors=s;e.jtdDiscriminator=t,e.jtdMetadata=r}pw.extendSubschemaMode=Oq});var yh=D(function(YB,hw){hw.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 o,n,s;if(Array.isArray(t)){if(o=t.length,o!=r.length)return!1;for(n=o;n--!==0;)if(!e(t[n],r[n]))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),o=s.length,o!==Object.keys(r).length)return!1;for(n=o;n--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[n]))return!1;for(n=o;n--!==0;){var i=s[n];if(!e(t[i],r[i]))return!1}return!0}return t!==t&&r!==r}});var yw=D(function(XB,gw){var Po=gw.exports=function(e,t,r){if(typeof t=="function")r=t,t={};r=t.cb||r;var o=typeof r=="function"?r:r.pre||function(){},n=r.post||function(){};rd(t,o,n,e,"",e)};Po.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Po.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Po.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Po.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 rd(e,t,r,o,n,s,i,a,c,u){if(o&&typeof o=="object"&&!Array.isArray(o)){t(o,n,s,i,a,c,u);for(var l in o){var d=o[l];if(Array.isArray(d)){if(l in Po.arrayKeywords)for(var f=0;f<d.length;f++)rd(e,t,r,d[f],n+"/"+l+"/"+f,s,n,l,o,f)}else if(l in Po.propsKeywords){if(d&&typeof d=="object")for(var m in d)rd(e,t,r,d[m],n+"/"+l+"/"+Nq(m),s,n,l,o,m)}else if(l in Po.keywords||e.allKeys&&!(l in Po.skipKeywords))rd(e,t,r,d,n+"/"+l,s,n,l,o)}r(o,n,s,i,a,c,u)}}function Nq(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var _a=D(function($w){Object.defineProperty($w,"__esModule",{value:!0});$w.getSchemaRefs=$w.resolveUrl=$w.normalizeId=$w._getFullPath=$w.getFullPath=$w.inlineRef=void 0;var _w=ke(),Aq=yh(),jq=yw(),qq=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function Mq(e,t=!0){if(typeof e=="boolean")return!0;if(t===!0)return!_h(e);if(!t)return!1;return vw(e)<=t}$w.inlineRef=Mq;var Lq=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function _h(e){for(let t in e){if(Lq.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(_h))return!0;if(typeof r=="object"&&_h(r))return!0}return!1}function vw(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,qq.has(r))continue;if(typeof e[r]=="object")_w.eachItem(e[r],(o)=>t+=vw(o));if(t===1/0)return 1/0}return t}function Sw(e,t="",r){if(r!==!1)t=ms(t);let o=e.parse(t);return bw(e,o)}$w.getFullPath=Sw;function bw(e,t){return e.serialize(t).split("#")[0]+"#"}$w._getFullPath=bw;var Dq=/#\/?$/;function ms(e){return e?e.replace(Dq,""):""}$w.normalizeId=ms;function Uq(e,t,r){return r=ms(r),e.resolve(t,r)}$w.resolveUrl=Uq;var Fq=/^[a-z_][-a-z0-9._]*$/i;function Vq(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:o}=this.opts,n=ms(e[r]||t),s={"":n},i=Sw(o,n,!1),a={},c=new Set;return jq(e,{allKeys:!0},(d,f,m,h)=>{if(h===void 0)return;let g=i+f,_=s[h];if(typeof d[r]=="string")_=y.call(this,d[r]);S.call(this,d.$anchor),S.call(this,d.$dynamicAnchor),s[f]=_;function y(v){let w=this.opts.uriResolver.resolve;if(v=ms(_?w(_,v):v),c.has(v))throw l(v);c.add(v);let z=this.refs[v];if(typeof z=="string")z=this.refs[z];if(typeof z=="object")u(d,z.schema,v);else if(v!==ms(g))if(v[0]==="#")u(d,a[v],v),a[v]=d;else this.refs[v]=g;return v}function S(v){if(typeof v=="string"){if(!Fq.test(v))throw Error(`invalid anchor "${v}"`);y.call(this,`#${v}`)}}}),a;function u(d,f,m){if(f!==void 0&&!Aq(d,f))throw l(m)}function l(d){return Error(`reference "${d}" resolves to more than one schema`)}}$w.getSchemaRefs=Vq});var ys=D(function(Mw){Object.defineProperty(Mw,"__esModule",{value:!0});Mw.getData=Mw.KeywordCxt=Mw.validateFunctionCode=void 0;var nd=A$(),od=ya(),gs=dh(),To=ya(),Pw=Q$(),zr=dw(),hs=mw(),V=$e(),ve=tr(),Tw=_a(),vt=ke(),Er=ga();function Bq(e){if(Ow(e)){if(Cw(e),kw(e)){Xq(e);return}}Iw(e,()=>nd.topBoolOrEmptySchema(e))}Mw.validateFunctionCode=Bq;function Iw({gen:e,validateName:t,schema:r,schemaEnv:o,opts:n},s){if(n.code.es5)e.func(t,V._`${ve.default.data}, ${ve.default.valCxt}`,o.$async,()=>{e.code(V._`"use strict"; ${Rw(r,n)}`),Yq(e,n),e.code(s)});else e.func(t,V._`${ve.default.data}, ${Wq(n)}`,o.$async,()=>e.code(Rw(r,n)).code(s))}function Wq(e){return V._`{${ve.default.instancePath}="", ${ve.default.parentData}, ${ve.default.parentDataProperty}, ${ve.default.rootData}=${ve.default.data}${e.dynamicRef?V._`, ${ve.default.dynamicAnchors}={}`:V.nil}}={}`}function Yq(e,t){e.if(ve.default.valCxt,()=>{if(e.var(ve.default.instancePath,V._`${ve.default.valCxt}.${ve.default.instancePath}`),e.var(ve.default.parentData,V._`${ve.default.valCxt}.${ve.default.parentData}`),e.var(ve.default.parentDataProperty,V._`${ve.default.valCxt}.${ve.default.parentDataProperty}`),e.var(ve.default.rootData,V._`${ve.default.valCxt}.${ve.default.rootData}`),t.dynamicRef)e.var(ve.default.dynamicAnchors,V._`${ve.default.valCxt}.${ve.default.dynamicAnchors}`)},()=>{if(e.var(ve.default.instancePath,V._`""`),e.var(ve.default.parentData,V._`undefined`),e.var(ve.default.parentDataProperty,V._`undefined`),e.var(ve.default.rootData,ve.default.data),t.dynamicRef)e.var(ve.default.dynamicAnchors,V._`{}`)})}function Xq(e){let{schema:t,opts:r,gen:o}=e;Iw(e,()=>{if(r.$comment&&t.$comment)Nw(e);if(oM(e),o.let(ve.default.vErrors,null),o.let(ve.default.errors,0),r.unevaluated)Qq(e);xw(e),iM(e)});return}function Qq(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",V._`${r}.evaluated`),t.if(V._`${e.evaluated}.dynamicProps`,()=>t.assign(V._`${e.evaluated}.props`,V._`undefined`)),t.if(V._`${e.evaluated}.dynamicItems`,()=>t.assign(V._`${e.evaluated}.items`,V._`undefined`))}function Rw(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?V._`/*# sourceURL=${r} */`:V.nil}function eM(e,t){if(Ow(e)){if(Cw(e),kw(e)){tM(e,t);return}}nd.boolOrEmptySchema(e,t)}function kw({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 Ow(e){return typeof e.schema!="boolean"}function tM(e,t){let{schema:r,gen:o,opts:n}=e;if(n.$comment&&r.$comment)Nw(e);nM(e),sM(e);let s=o.const("_errs",ve.default.errors);xw(e,s),o.var(t,V._`${s} === ${ve.default.errors}`)}function Cw(e){vt.checkUnknownRules(e),rM(e)}function xw(e,t){if(e.opts.jtd)return Ew(e,[],!1,t);let r=od.getSchemaTypes(e.schema),o=od.coerceAndCheckDataType(e,r);Ew(e,r,!o,t)}function rM(e){let{schema:t,errSchemaPath:r,opts:o,self:n}=e;if(t.$ref&&o.ignoreKeywordsWithRef&&vt.schemaHasRulesButRef(t,n.RULES))n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function oM(e){let{schema:t,opts:r}=e;if(t.default!==void 0&&r.useDefaults&&r.strictSchema)vt.checkStrictMode(e,"default is ignored in the schema root")}function nM(e){let t=e.schema[e.opts.schemaId];if(t)e.baseId=Tw.resolveUrl(e.opts.uriResolver,e.baseId,t)}function sM(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}function Nw({gen:e,schemaEnv:t,schema:r,errSchemaPath:o,opts:n}){let s=r.$comment;if(n.$comment===!0)e.code(V._`${ve.default.self}.logger.log(${s})`);else if(typeof n.$comment=="function"){let i=V.str`${o}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code(V._`${ve.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function iM(e){let{gen:t,schemaEnv:r,validateName:o,ValidationError:n,opts:s}=e;if(r.$async)t.if(V._`${ve.default.errors} === 0`,()=>t.return(ve.default.data),()=>t.throw(V._`new ${n}(${ve.default.vErrors})`));else{if(t.assign(V._`${o}.errors`,ve.default.vErrors),s.unevaluated)aM(e);t.return(V._`${ve.default.errors} === 0`)}}function aM({gen:e,evaluated:t,props:r,items:o}){if(r instanceof V.Name)e.assign(V._`${t}.props`,r);if(o instanceof V.Name)e.assign(V._`${t}.items`,o)}function Ew(e,t,r,o){let{gen:n,schema:s,data:i,allErrors:a,opts:c,self:u}=e,{RULES:l}=u;if(s.$ref&&(c.ignoreKeywordsWithRef||!vt.schemaHasRulesButRef(s,l))){n.block(()=>jw(e,"$ref",l.all.$ref.definition));return}if(!c.jtd)cM(e,t);n.block(()=>{for(let f of l.rules)d(f);d(l.post)});function d(f){if(!gs.shouldUseGroup(s,f))return;if(f.type){if(n.if(To.checkDataType(f.type,i,c.strictNumbers)),zw(e,f),t.length===1&&t[0]===f.type&&r)n.else(),To.reportTypeError(e);n.endIf()}else zw(e,f);if(!a)n.if(V._`${ve.default.errors} === ${o||0}`)}}function zw(e,t){let{gen:r,schema:o,opts:{useDefaults:n}}=e;if(n)Pw.assignDefaults(e,t.type);r.block(()=>{for(let s of t.rules)if(gs.shouldUseRule(o,s))jw(e,s.keyword,s.definition,t.type)})}function cM(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;if(uM(e,t),!e.opts.allowUnionTypes)lM(e,t);dM(e,e.dataTypes)}function uM(e,t){if(!t.length)return;if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach((r)=>{if(!Aw(e.dataTypes,r))vh(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),fM(e,t)}function lM(e,t){if(t.length>1&&!(t.length===2&&t.includes("null")))vh(e,"use allowUnionTypes to allow union type keyword")}function dM(e,t){let r=e.self.RULES.all;for(let o in r){let n=r[o];if(typeof n=="object"&&gs.shouldUseRule(e.schema,n)){let{type:s}=n.definition;if(s.length&&!s.some((i)=>pM(t,i)))vh(e,`missing type "${s.join(",")}" for keyword "${o}"`)}}}function pM(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function Aw(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function fM(e,t){let r=[];for(let o of e.dataTypes)if(Aw(t,o))r.push(o);else if(t.includes("integer")&&o==="number")r.push("integer");e.dataTypes=r}function vh(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,vt.checkStrictMode(e,t,e.opts.strictTypes)}class Sh{constructor(e,t,r){if(zr.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=vt.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",qw(this.$data,e));else if(this.schemaCode=this.schemaValue,!zr.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",ve.default.errors)}result(e,t,r){this.failResult(V.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(V.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(V._`${t} !== undefined && (${V.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?Er.reportExtraError:Er.reportError)(this,this.def.error,t)}$dataError(){Er.reportError(this,this.def.$dataError||Er.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');Er.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=V.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=V.nil,t=V.nil){if(!this.$data)return;let{gen:r,schemaCode:o,schemaType:n,def:s}=this;if(r.if(V.or(V._`${o} === undefined`,t)),e!==V.nil)r.assign(e,!0);if(n.length||s.validateSchema){if(r.elseIf(this.invalid$data()),this.$dataError(),e!==V.nil)r.assign(e,!1)}r.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:r,def:o,it:n}=this;return V.or(s(),i());function s(){if(r.length){if(!(t instanceof V.Name))throw Error("ajv implementation error");let a=Array.isArray(r)?r:[r];return V._`${To.checkDataTypes(a,t,n.opts.strictNumbers,To.DataType.Wrong)}`}return V.nil}function i(){if(o.validateSchema){let a=e.scopeValue("validate$data",{ref:o.validateSchema});return V._`!${a}(${t})`}return V.nil}}subschema(e,t){let r=hs.getSubschema(this.it,e);hs.extendSubschemaData(r,this.it,e),hs.extendSubschemaMode(r,e);let o={...this.it,...r,items:void 0,props:void 0};return eM(o,t),o}mergeEvaluated(e,t){let{it:r,gen:o}=this;if(!r.opts.unevaluated)return;if(r.props!==!0&&e.props!==void 0)r.props=vt.mergeEvaluated.props(o,e.props,r.props,t);if(r.items!==!0&&e.items!==void 0)r.items=vt.mergeEvaluated.items(o,e.items,r.items,t)}mergeValidEvaluated(e,t){let{it:r,gen:o}=this;if(r.opts.unevaluated&&(r.props!==!0||r.items!==!0))return o.if(t,()=>this.mergeEvaluated(e,V.Name)),!0}}Mw.KeywordCxt=Sh;function jw(e,t,r,o){let n=new Sh(e,r,t);if("code"in r)r.code(n,o);else if(n.$data&&r.validate)zr.funcKeywordCode(n,r);else if("macro"in r)zr.macroKeywordCode(n,r);else if(r.compile||r.validate)zr.funcKeywordCode(n,r)}var mM=/^\/(?:[^~]|~0|~1)*$/,hM=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function qw(e,{dataLevel:t,dataNames:r,dataPathArr:o}){let n,s;if(e==="")return ve.default.rootData;if(e[0]==="/"){if(!mM.test(e))throw Error(`Invalid JSON-pointer: ${e}`);n=e,s=ve.default.rootData}else{let u=hM.exec(e);if(!u)throw Error(`Invalid JSON-pointer: ${e}`);let l=+u[1];if(n=u[2],n==="#"){if(l>=t)throw Error(c("property/index",l));return o[t-l]}if(l>t)throw Error(c("data",l));if(s=r[t-l],!n)return s}let i=s,a=n.split("/");for(let u of a)if(u)s=V._`${s}${V.getProperty(vt.unescapeJsonPointer(u))}`,i=V._`${i} && ${s}`;return i;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${t}`}}Mw.getData=qw});var va=D(function(Uw){Object.defineProperty(Uw,"__esModule",{value:!0});class Dw extends Error{constructor(e){super("validation failed");this.errors=e,this.ajv=this.validation=!0}}Uw.default=Dw});var vs=D(function(Vw){Object.defineProperty(Vw,"__esModule",{value:!0});var _s=_a();class Fw extends Error{constructor(e,t,r,o){super(o||`can't resolve reference ${r} from id ${t}`);this.missingRef=_s.resolveUrl(e,t,r),this.missingSchema=_s.normalizeId(_s.getFullPath(e,this.missingRef))}}Vw.default=Fw});var ba=D(function(Gw){Object.defineProperty(Gw,"__esModule",{value:!0});Gw.resolveSchema=Gw.getCompilingSchema=Gw.resolveRef=Gw.compileSchema=Gw.SchemaEnv=void 0;var rt=$e(),SM=va(),Sn=tr(),ot=_a(),sd=ke(),Zw=ys();class Sa{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:ot.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={}}}Gw.SchemaEnv=Sa;function $h(e){let t=Hw.call(this,e);if(t)return t;let r=ot.getFullPath(this.opts.uriResolver,e.root.baseId),{es5:o,lines:n}=this.opts.code,{ownProperties:s}=this.opts,i=new rt.CodeGen(this.scope,{es5:o,lines:n,ownProperties:s}),a;if(e.$async)a=i.scopeValue("Error",{ref:SM.default,code:rt._`require("ajv/dist/runtime/validation_error").default`});let c=i.scopeName("validate");e.validateName=c;let u={gen:i,allErrors:this.opts.allErrors,data:Sn.default.data,parentData:Sn.default.parentData,parentDataProperty:Sn.default.parentDataProperty,dataNames:[Sn.default.data],dataPathArr:[rt.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:rt.stringify(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:rt.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:rt._`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),Zw.validateFunctionCode(u),i.optimize(this.opts.code.optimize);let d=i.toString();if(l=`${i.scopeRefs(Sn.default.scope)}return ${d}`,this.opts.code.process)l=this.opts.code.process(l,e);let m=Function(`${Sn.default.self}`,`${Sn.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:m}),m.errors=null,m.schema=e.schema,m.schemaEnv=e,e.$async)m.$async=!0;if(this.opts.code.source===!0)m.source={validateName:c,validateCode:d,scopeValues:i._values};if(this.opts.unevaluated){let{props:h,items:g}=u;if(m.evaluated={props:h instanceof rt.Name?void 0:h,items:g instanceof rt.Name?void 0:g,dynamicProps:h instanceof rt.Name,dynamicItems:g instanceof rt.Name},m.source)m.source.evaluated=rt.stringify(m.evaluated)}return e.validate=m,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)}}Gw.compileSchema=$h;function bM(e,t,r){var o;r=ot.resolveUrl(this.opts.uriResolver,t,r);let n=e.refs[r];if(n)return n;let s=RM.call(this,e,r);if(s===void 0){let i=(o=e.localRefs)===null||o===void 0?void 0:o[r],{schemaId:a}=this.opts;if(i)s=new Sa({schema:i,schemaId:a,root:e,baseId:t})}if(s===void 0)return;return e.refs[r]=$M.call(this,s)}Gw.resolveRef=bM;function $M(e){if(ot.inlineRef(e.schema,this.opts.inlineRefs))return e.schema;return e.validate?e:$h.call(this,e)}function Hw(e){for(let t of this._compilations)if(wM(t,e))return t}Gw.getCompilingSchema=Hw;function wM(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function RM(e,t){let r;while(typeof(r=this.refs[t])=="string")t=r;return r||this.schemas[t]||id.call(this,e,t)}function id(e,t){let r=this.opts.uriResolver.parse(t),o=ot._getFullPath(this.opts.uriResolver,r),n=ot.getFullPath(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&o===n)return bh.call(this,r,e);let s=ot.normalizeId(o),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=id.call(this,e,i);if(typeof(a===null||a===void 0?void 0:a.schema)!=="object")return;return bh.call(this,r,a)}if(typeof(i===null||i===void 0?void 0:i.schema)!=="object")return;if(!i.validate)$h.call(this,i);if(s===ot.normalizeId(t)){let{schema:a}=i,{schemaId:c}=this.opts,u=a[c];if(u)n=ot.resolveUrl(this.opts.uriResolver,n,u);return new Sa({schema:a,schemaId:c,root:e,baseId:n})}return bh.call(this,r,i)}Gw.resolveSchema=id;var EM=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function bh(e,{baseId:t,schema:r,root:o}){var n;if(((n=e.fragment)===null||n===void 0?void 0:n[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if(typeof r==="boolean")return;let c=r[sd.unescapeFragment(a)];if(c===void 0)return;r=c;let u=typeof r==="object"&&r[this.opts.schemaId];if(!EM.has(a)&&u)t=ot.resolveUrl(this.opts.uriResolver,t,u)}let s;if(typeof r!="boolean"&&r.$ref&&!sd.schemaHasRulesButRef(r,this.RULES)){let a=ot.resolveUrl(this.opts.uriResolver,t,r.$ref);s=id.call(this,o,a)}let{schemaId:i}=this.opts;if(s=s||new Sa({schema:r,schemaId:i,root:o,baseId:t}),s.schema!==s.root.schema)return s;return}});var Kw=D(function(n5,kM){kM.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 Th=D(function(s5,tR){var OM=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Rh=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),CM=RegExp.prototype.test.bind(/^\d*$/u),bn=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),Eh=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),Ww=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),zh=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),xM=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),Dt=Array(256);for(let t=0;t<256;t++)Dt[t]="%"+"0123456789ABCDEF"[t>>4]+"0123456789ABCDEF"[t&15];function kt(e){if(e<2048)return Dt[192|e>>6]+Dt[128|e&63];if(e<65536)return Dt[224|e>>12]+Dt[128|e>>6&63]+Dt[128|e&63];return Dt[240|e>>18]+Dt[128|e>>12&63]+Dt[128|e>>6&63]+Dt[128|e&63]}function NM(e){let t="",r=0,o=0;for(o=0;o<e.length;o++){if(r=e[o].charCodeAt(0),r===48)continue;if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[o];break}for(o+=1;o<e.length;o++){if(r=e[o].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[o]}return t}var AM=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),jM=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),qM=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),MM=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function LM(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++){if(qM(e[t]))continue;if(e[t]==="%"&&t+2<e.length&&bn(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function Bw(e){let t=-1,r=0,o=-1,n=0;for(let a=0;a<e.length;a++)if(e[a]==="0"){if(o===-1)o=a;if(n++,n>r)r=n,t=o}else o=-1,n=0;if(r<2)return e.join(":");let s=e.slice(0,t).join(":"),i=e.slice(t+r).join(":");return s+"::"+i}function DM(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(":"),o=t===-1?[]:e.slice(t+2).split(":");if(t!==-1){if(r.length===1&&r[0]==="")r.length=0;if(o.length===1&&o[0]==="")o.length=0}let n=r.concat(o),s=0;for(let a=0;a<n.length;a++){let c=n[a];if(c==="")return;if(c.indexOf(".")!==-1){if(a!==n.length-1||t!==-1&&o.length===0||!Rh(c))return;s+=2;continue}if(!AM(c))return;n[a]=parseInt(c,16).toString(16),s++}if(t===-1){if(s!==8)return;return Bw(n)}if(s>=8)return;let i=n.slice(0,r.length);for(let a=s;a<8;a++)i.push("0");for(let a=r.length;a<n.length;a++)i.push(n[a]);return Bw(i)}function wh(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 o=t?e.slice(1,-1):e;if(t&&jM(o))return o=o.toLowerCase(),{host:`[${o}]`,escapedHost:o,isIPV6:!1,isIPVFuture:!0};if(UM(o,":")<2)return{host:e,isIPV6:!1,error:t};let n="",s=o.indexOf("%");if(s!==-1){let a=o.slice(s,s+3).toLowerCase()==="%25"?3:1;if(n=o.slice(s+a),!LM(n))return{host:e,isIPV6:!1,error:!0};o=o.slice(0,s)}let i=DM(o);if(i===void 0)return{host:e,isIPV6:!1,error:!0};return{host:i+(n?"%"+n:""),escapedHost:i+(n?"%25"+n:""),isIPV6:!0}}function UM(e,t){let r=0;for(let o=0;o<e.length;o++)if(e[o]===t)r++;return r}function FM(e){let t=e,r=[],o=-1,n=0;while(n=t.length){if(n===1)if(t===".")break;else if(t==="/"){r.push("/");break}else{r.push(t);break}else if(n===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(n===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((o=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,o)),t=t.slice(o)}return r.join("")}var VM={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},ZM=/[@/?#:]/g,HM=/[@/?#]/g;function Yw(e,t){let r=t?HM:ZM;return r.lastIndex=0,e.replace(r,(o)=>VM[o])}function Xw(e,t=!1){if(e.indexOf("%")===-1)return e;let r="";for(let o=0;o<e.length;o++){if(e[o]==="%"&&o+2<e.length){let n=e.slice(o+1,o+3);if(bn(n)){let s=n.toUpperCase(),i=String.fromCharCode(parseInt(s,16));if(t&&Eh(i))r+=i;else r+="%"+s;o+=2;continue}}r+=e[o]}return r}function GM(e){let t="";for(let r=0;r<e.length;r++){let o=e[r];if(o==="%"&&r+2<e.length){let n=e.slice(r+1,r+3);if(bn(n)){let s=n.toUpperCase(),i=String.fromCharCode(parseInt(s,16));if(i!=="."&&Eh(i))t+=i;else t+="%"+s;r+=2;continue}}if(Ww(o))t+=o;else{let n=e.charCodeAt(r);if(n<128)t+=eR(n)?o:Dt[n];else if(n<55296||n>57343)t+=kt(n);else if(n<=56319&&r+1<e.length){let s=e.charCodeAt(r+1);if(s>=56320&&s<=57343)t+=kt(65536+(n-55296<<10)+(s-56320)),r++;else t+=kt(65533)}else t+=kt(65533)}}return t}function JM(e,t=!1){let r="",o=t&&e[0]!=="/";for(let n=0;n<e.length;n++){let s=e[n];if(s==="%"&&n+2<e.length){let i=e.slice(n+1,n+3);if(bn(i)){r+="%"+i.toUpperCase(),n+=2;continue}}if(s==="/")o=!1;if(Ww(s)&&(s!==":"||!o))r+=s;else{let i=e.charCodeAt(n);if(i<128)r+=Dt[i];else if(i<55296||i>57343)r+=kt(i);else if(i<=56319&&n+1<e.length){let a=e.charCodeAt(n+1);if(a>=56320&&a<=57343)r+=kt(65536+(i-55296<<10)+(a-56320)),n++;else r+=kt(65533)}else r+=kt(65533)}}return r}function Ph(e,t){let r="";for(let o=0;o<e.length;o++){let n=e[o];if(n==="%"&&o+2<e.length){let s=e.slice(o+1,o+3);if(bn(s)){r+="%"+s.toUpperCase(),o+=2;continue}}if(t(n))r+=n;else{let s=e.charCodeAt(o);if(s<128)r+=Dt[s];else if(s<55296||s>57343)r+=kt(s);else if(s<=56319&&o+1<e.length){let i=e.charCodeAt(o+1);if(i>=56320&&i<=57343)r+=kt(65536+(s-55296<<10)+(i-56320)),o++;else r+=kt(65533)}else r+=kt(65533)}}return r}function Qw(e){return Ph(e,xM)}function KM(e){return Ph(e,zh)}function BM(e){return Ph(e,zh)}function eR(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 WM(e){let t="";for(let r=0;r<e.length;r++){let o=e[r];if(o==="%"&&r+2<e.length){let n=e.slice(r+1,r+3);if(bn(n)){let s=n.toUpperCase(),i=String.fromCharCode(parseInt(s,16));if(Eh(i))t+=i;else t+="%"+s;r+=2;continue}}if(zh(o))t+=o;else{let n=e.charCodeAt(r);if(n<128)t+=eR(n)?o:Dt[n];else if(n<55296||n>57343)t+=kt(n);else if(n<=56319&&r+1<e.length){let s=e.charCodeAt(r+1);if(s>=56320&&s<=57343)t+=kt(65536+(n-55296<<10)+(s-56320)),r++;else t+=kt(65533)}else t+=kt(65533)}}return t}function YM(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(bn(o)){t+="%"+o.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function XM(e){let t=[];if(e.userinfo!==void 0)t.push(Qw(e.userinfo)),t.push("@");if(e.host!==void 0){let r=e.host;if(!Rh(r)){let o=wh(r);if(o.isIPV6!==!0&&o.isIPVFuture!==!0)r=Xw(r,!0),o=wh(r);if(o.isIPV6===!0||o.isIPVFuture===!0)r=`[${o.escapedHost}]`;else r=Yw(r,!1)}t.push(r)}if(typeof e.port==="number"||typeof e.port==="string"){let r=String(e.port);if(!CM(r))throw TypeError("URI port is malformed.");t.push(":"),t.push(r)}return t.length?t.join(""):void 0}tR.exports={nonSimpleDomain:MM,recomposeAuthority:XM,reescapeHostDelimiters:Yw,normalizePercentEncoding:Xw,normalizePathEncoding:GM,serializePathEncoding:JM,normalizeQueryFragmentEncoding:WM,encodeUserinfo:Qw,encodeQuery:KM,encodeFragment:BM,escapePreservingEscapes:YM,removeDotSegments:FM,isIPv4:Rh,isUUID:OM,normalizeIPv6:wh,stringArrayToHexStripped:NM}});var iR=D(function(i5,sR){var{isUUID:QM}=Th(),eL=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,tL=["http","https","ws","wss","urn","urn:uuid"];function rL(e){return tL.indexOf(e)!==-1}function Ih(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 rR(e){if(!e.host)e.error=e.error||"HTTP URIs must have a host.";return e}function oR(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 oL(e){return e.secure=Ih(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function nL(e){if(e.port===(Ih(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 sL(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(eL);if(r&&r[0]===e.path){let o=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let n=`${o}:${t.nid||e.nid}`,s=kh(n);if(e.path=void 0,s)e=s.parse(e,t)}else e.error=e.error||"URN can not be parsed.";return e}function iL(e,t){if(e.nid===void 0)throw Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",o=e.nid.toLowerCase(),n=`${r}:${t.nid||o}`,s=kh(n);if(s)e=s.serialize(e,t);let i=e,a=e.nss;return i.path=`${o||t.nid}:${a}`,t.skipEscape=!0,i}function aL(e,t){let r=e;if(r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!QM(r.uuid)))r.error=r.error||"UUID is not valid.";return r}function cL(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var nR={scheme:"http",domainHost:!0,parse:rR,serialize:oR},uL={scheme:"https",domainHost:nR.domainHost,parse:rR,serialize:oR},ad={scheme:"ws",domainHost:!0,parse:oL,serialize:nL},lL={scheme:"wss",domainHost:ad.domainHost,parse:ad.parse,serialize:ad.serialize},dL={scheme:"urn",parse:sL,serialize:iL,skipNormalize:!0},pL={scheme:"urn:uuid",parse:aL,serialize:cL,skipNormalize:!0},cd={http:nR,https:uL,ws:ad,wss:lL,urn:dL,"urn:uuid":pL};Object.setPrototypeOf(cd,null);function kh(e){return e&&(cd[e]||cd[e.toLowerCase()])||void 0}sR.exports={wsIsSecure:Ih,SCHEMES:cd,isValidSchemeName:rL,getSchemeHandler:kh}});var _R=D(function(a5,dd){var{normalizeIPv6:dR,removeDotSegments:wa,recomposeAuthority:fL,normalizePercentEncoding:Oh,normalizePathEncoding:mL,serializePathEncoding:aR,normalizeQueryFragmentEncoding:cR,encodeQuery:hL,encodeFragment:gL,reescapeHostDelimiters:yL,isIPv4:pR,nonSimpleDomain:_L}=Th(),{SCHEMES:fR,getSchemeHandler:Ch}=iR(),mR=/^[A-Za-z][A-Za-z0-9+.-]*$/u;function uR(e){let t=unescape(String(e));if(!mR.test(t))throw TypeError("URI scheme is malformed.");return t}function vL(e,t){if(typeof e==="string")e=PL(e,t);else if(typeof e==="object")e=ld($n(e,t),t);return e}function SL(e,t,r){let o=r?Object.assign({scheme:"null"},r):{scheme:"null"},{parsed:n,malformedAuthorityOrPort:s,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:c,malformedScheme:u}=ud(e,o),{parsed:l,malformedAuthorityOrPort:d,malformedPercentEncoding:f,malformedSchemeSpecific:m,malformedHost:h,malformedScheme:g}=ud(t,o);if(s||d||i||f||a||m||c||h||u||g)throw Error(n.error||l.error||"URI is malformed.");let _=hR(n,l,o,!0),y=Ch(r&&r.scheme||_.scheme),S=_.host,v=S!==void 0&&S!==""&&(pR(S)||dR(S).isIPV6);gR(_,r||{},y,v);let w=S&&S.indexOf("%")!==-1&&!/\P{ASCII}/u.test(S);if(_.error&&!w)throw Error(_.error);return o.skipEscape=!0,$n(_,o)}function hR(e,t,r,o){let n={};if(!o)e=ld($n(e,r),r),t=ld($n(t,r),r);if(r=r||{},!r.tolerant&&t.scheme)n.scheme=t.scheme,n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=wa(t.path||""),n.query=t.query;else{if(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=wa(t.path||""),n.query=t.query;else{if(!t.path)if(n.path=e.path,t.query!==void 0)n.query=t.query;else n.query=e.query;else{if(t.path[0]==="/")n.path=wa(t.path);else{if((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path)n.path="/"+t.path;else if(!e.path)n.path=t.path;else n.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path;n.path=wa(n.path)}n.query=t.query}n.userinfo=e.userinfo,n.host=e.host,n.port=e.port}n.scheme=e.scheme}return n.fragment=t.fragment,n}function bL(e,t,r){let o=lR(e,r),n=lR(t,r);return o!==void 0&&n!==void 0&&o===n}function $n(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:""},o=Object.assign({},t),n=[];if(r.scheme)r.scheme=uR(r.scheme);let s=Ch(o.scheme||r.scheme);if(s&&s.serialize)s.serialize(r,o);let i=r.userinfo!==void 0||r.host!==void 0||r.port!==void 0,a=!o.skipEscape&&r.scheme===void 0&&!i;if(r.path!==void 0)if(!o.skipEscape)r.path=aR(r.path,a);else r.path=Oh(r.path);if(o.reference!=="suffix"&&r.scheme)r.scheme=uR(r.scheme),n.push(r.scheme,":");let c=fL(r);if(c!==void 0){if(o.reference!=="suffix")n.push("//");if(n.push(c),r.path&&r.path[0]!=="/")n.push("/")}if(r.path!==void 0){let u=r.path;if(!o.absolutePath&&(!s||!s.absolutePath))u=wa(u);if(a)u=aR(u,!0);if(c===void 0&&u[0]==="/"&&u[1]==="/")u="/%2F"+u.slice(2);n.push(u)}if(r.query!==void 0)n.push("?",hL(r.query));if(r.fragment!==void 0)n.push("#",gL(r.fragment));return n.join("")}var $L=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,wL=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,RL=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function EL(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 $a(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 xh(e){return e[0]==="["&&e[e.length-1]==="]"}function zL(e){let t=e[4];return $a(e[3])||t!==void 0&&!xh(t)&&$a(t)||$a(e[6])||$a(e[7])||$a(e[8])}function gR(e,t,r,o){if(!t.unicodeSupport&&(!r||!r.unicodeSupport)&&e.host&&!xh(e.host)&&(t.domainHost||r&&r.domainHost)&&o===!1&&_L(e.host))try{e.host=new URL("http://"+e.host).hostname}catch(n){return e.error=e.error||"Host's domain name can not be converted to ASCII: "+n,!0}return!1}function ud(e,t){let r=Object.assign({},t),o={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},n=!1,s=!1,i=!1,a=!1,c=!1,u=!1,l=!1;if(r.reference==="suffix")if(r.scheme)e=r.scheme+":"+e;else e="//"+e;let d=e.match(wL);if(d!==null&&d[1].indexOf("\\")!==-1)o.error="URI authority must not contain a literal backslash.",n=!0;let f=e.match(RL);if(f!==null){let h=f[1],g=h.replace(/[\t\n\r]/g,"");if(g.length>=2){if(g.slice(0,2)!=="//")o.error=o.error||"URI authority must not contain a literal backslash.",n=!0;else if(h.length!==g.length)o.error=o.error||"URI authority introducer must not contain whitespace.",n=!0}}let m=e.match($L);if(m){if(o.scheme=m[1],o.userinfo=m[3],o.host=m[4],o.port=parseInt(m[5],10),o.path=m[6]||"",o.query=m[7],o.fragment=m[8],o.scheme!==void 0){let _=unescape(o.scheme);if(mR.test(_))o.scheme=_.toLowerCase();else o.error=o.error||"URI scheme is malformed.",u=!0}if(s=zL(m),s)o.error=o.error||"URI contains malformed percent-encoding.";if(isNaN(o.port))o.port=m[5];let h=EL(o,m);if(h!==void 0)o.error=o.error||h,n=!0;if(o.host)if(pR(o.host)===!1){let y=xh(o.host),S=o.host.indexOf("[")!==-1||o.host.indexOf("]")!==-1,v=dR(o.host);if(l=v.isIPV6||v.isIPVFuture===!0,c=S&&(!y||v.error===!0),o.host=l?v.host:v.host.toLowerCase(),c)o.error=o.error||"URI host is malformed.",n=!0}else l=!0;if(o.scheme===void 0&&o.userinfo===void 0&&o.host===void 0&&o.port===void 0&&o.query===void 0&&!o.path)o.reference="same-document";else if(o.scheme===void 0)o.reference="relative";else if(o.fragment===void 0)o.reference="absolute";else o.reference="uri";if(r.reference&&r.reference!=="suffix"&&r.reference!==o.reference)o.error=o.error||"URI is not a "+r.reference+" reference.";let g=Ch(r.scheme||o.scheme);if(!c)a=gR(o,r,g,l);if(e.indexOf("%")!==-1&&o.host!==void 0&&!c){let _=l?o.host:Oh(o.host,!0);if(!l)_=Oh(_.toLowerCase());o.host=yL(_,l)}if(!g||g&&!g.skipNormalize){if(o.path)o.path=mL(o.path);if(o.query)o.query=cR(o.query);if(o.fragment)o.fragment=cR(o.fragment)}if(g&&g.parse){if(g.parse(o,r),g===fR.urn&&o.nid===void 0)i=!0}}else o.error=o.error||"URI can not be parsed.";return{parsed:o,malformedAuthorityOrPort:n,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:u}}function ld(e,t){return ud(e,t).parsed}function PL(e,t){return yR(e,t).normalized}function yR(e,t){let{parsed:r,malformedAuthorityOrPort:o,malformedPercentEncoding:n,malformedSchemeSpecific:s,malformedHost:i,malformedScheme:a}=ud(e,t);return{normalized:o||n||s||i||a?e:$n(r,t),malformedAuthorityOrPort:o,malformedPercentEncoding:n,malformedSchemeSpecific:s,malformedHost:i,malformedScheme:a}}function lR(e,t){if(typeof e!=="string"&&typeof e!=="object")return;let r;try{r=typeof e==="string"?e:$n(e,t)}catch{return}let{normalized:o,malformedAuthorityOrPort:n,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:c}=yR(r,t);return n||s||i||a||c?void 0:o}var Nh={SCHEMES:fR,normalize:vL,resolve:SL,resolveComponent:hR,equal:bL,serialize:$n,parse:ld};dd.exports=Nh;dd.exports.default=Nh;dd.exports.fastUri=Nh});var bR=D(function(SR){Object.defineProperty(SR,"__esModule",{value:!0});var vR=_R();vR.code='require("ajv/dist/runtime/uri").default';SR.default=vR});var jh=D(function(Kr){Object.defineProperty(Kr,"__esModule",{value:!0});Kr.CodeGen=Kr.Name=Kr.nil=Kr.stringify=Kr.str=Kr._=Kr.KeywordCxt=void 0;var IL=ys();Object.defineProperty(Kr,"KeywordCxt",{enumerable:!0,get:function(){return IL.KeywordCxt}});var bs=$e();Object.defineProperty(Kr,"_",{enumerable:!0,get:function(){return bs._}});Object.defineProperty(Kr,"str",{enumerable:!0,get:function(){return bs.str}});Object.defineProperty(Kr,"stringify",{enumerable:!0,get:function(){return bs.stringify}});Object.defineProperty(Kr,"nil",{enumerable:!0,get:function(){return bs.nil}});Object.defineProperty(Kr,"Name",{enumerable:!0,get:function(){return bs.Name}});Object.defineProperty(Kr,"CodeGen",{enumerable:!0,get:function(){return bs.CodeGen}});var kL=va(),zR=vs(),PR=lh(),Pr=ba(),TR=$e(),Tr=_a(),Io=ya(),Ss=ke(),$R=Kw(),OL=bR(),IR=(e,t)=>new RegExp(e,t);IR.code="new RegExp";var CL=["removeAdditional","useDefaults","coerceTypes"],xL=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),NL={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."},AL={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},wR=200;function jL(e){var t,r,o,n,s,i,a,c,u,l,d,f,m,h,g,_,y,S,v,w,z,R,b,E,C;let q=e.strict,x=(t=e.code)===null||t===void 0?void 0:t.optimize,F=x===!0||x===void 0?1:x||0,B=(o=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&o!==void 0?o:IR,H=(n=e.uriResolver)!==null&&n!==void 0?n:OL.default;return{strictSchema:(i=(s=e.strictSchema)!==null&&s!==void 0?s:q)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=e.strictNumbers)!==null&&a!==void 0?a:q)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=e.strictTypes)!==null&&u!==void 0?u:q)!==null&&l!==void 0?l:"log",strictTuples:(f=(d=e.strictTuples)!==null&&d!==void 0?d:q)!==null&&f!==void 0?f:"log",strictRequired:(h=(m=e.strictRequired)!==null&&m!==void 0?m:q)!==null&&h!==void 0?h:!1,code:e.code?{...e.code,optimize:F,regExp:B}:{optimize:F,regExp:B},loopRequired:(g=e.loopRequired)!==null&&g!==void 0?g:wR,loopEnum:(_=e.loopEnum)!==null&&_!==void 0?_:wR,meta:(y=e.meta)!==null&&y!==void 0?y:!0,messages:(S=e.messages)!==null&&S!==void 0?S:!0,inlineRefs:(v=e.inlineRefs)!==null&&v!==void 0?v:!0,schemaId:(w=e.schemaId)!==null&&w!==void 0?w:"$id",addUsedSchema:(z=e.addUsedSchema)!==null&&z!==void 0?z:!0,validateSchema:(R=e.validateSchema)!==null&&R!==void 0?R:!0,validateFormats:(b=e.validateFormats)!==null&&b!==void 0?b:!0,unicodeRegExp:(E=e.unicodeRegExp)!==null&&E!==void 0?E:!0,int32range:(C=e.int32range)!==null&&C!==void 0?C:!0,uriResolver:H}}class pd{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...jL(e)};let{es5:t,lines:r}=this.opts.code;this.scope=new TR.ValueScope({scope:{},prefixes:xL,es5:t,lines:r}),this.logger=FL(e.logger);let o=e.validateFormats;if(e.validateFormats=!1,this.RULES=PR.getRules(),RR.call(this,NL,e,"NOT SUPPORTED"),RR.call(this,AL,e,"DEPRECATED","warn"),this._metaOpts=DL.call(this),e.formats)ML.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords)LL.call(this,e.keywords);if(typeof e.meta=="object")this.addMetaSchema(e.meta);qL.call(this),e.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:r}=this.opts,o=$R;if(r==="id")o={...$R},o.id=o.$id,delete o.$id;if(t&&e)this.addMetaSchema(o,o[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 o=r(t);if(!("$async"in r))this.errors=r.errors;return o}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 o.call(this,e,t);async function o(u,l){await n.call(this,u.$schema);let d=this._addSchema(u,l);return d.validate||s.call(this,d)}async function n(u){if(u&&!this.getSchema(u))await o.call(this,{$ref:u},!0)}async function s(u){try{return this._compileSchemaEnv(u)}catch(l){if(!(l instanceof zR.default))throw l;return i.call(this,l),await a.call(this,l.missingSchema),s.call(this,u)}}function i({missingSchema:u,missingRef:l}){if(this.refs[u])throw Error(`AnySchema ${u} is loaded but ${l} cannot be resolved`)}async function a(u){let l=await c.call(this,u);if(!this.refs[u])await n.call(this,l.$schema);if(!this.refs[u])this.addSchema(l,u,t)}async function c(u){let l=this._loading[u];if(l)return l;try{return await(this._loading[u]=r(u))}finally{delete this._loading[u]}}}addSchema(e,t,r,o=this.opts.validateSchema){if(Array.isArray(e)){for(let s of e)this.addSchema(s,void 0,r,o);return this}let n;if(typeof e==="object"){let{schemaId:s}=this.opts;if(n=e[s],n!==void 0&&typeof n!="string")throw Error(`schema ${s} must be string`)}return t=Tr.normalizeId(t||n),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,o,!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 o=this.validate(r,e);if(!o&&t){let n="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(n);else throw Error(n)}return o}getSchema(e){let t;while(typeof(t=ER.call(this,e))=="string")e=t;if(t===void 0){let{schemaId:r}=this.opts,o=new Pr.SchemaEnv({schema:{},schemaId:r});if(t=Pr.resolveSchema.call(this,o,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=ER.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=Tr.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(ZL.call(this,r,t),!t)return Ss.eachItem(r,(n)=>Ah.call(this,n)),this;GL.call(this,t);let o={...t,type:Io.getJSONTypes(t.type),schemaType:Io.getJSONTypes(t.schemaType)};return Ss.eachItem(r,o.type.length===0?(n)=>Ah.call(this,n,o):(n)=>o.type.forEach((s)=>Ah.call(this,n,o,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 o=r.rules.findIndex((n)=>n.keyword===e);if(o>=0)r.rules.splice(o,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((o)=>`${r}${o.instancePath} ${o.message}`).reduce((o,n)=>o+t+n)}$dataMetaSchema(e,t){let r=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let o of t){let n=o.split("/").slice(1),s=e;for(let i of n)s=s[i];for(let i in r){let a=r[i];if(typeof a!="object")continue;let{$data:c}=a.definition,u=s[i];if(c&&u)s[i]=kR(u)}}return e}_removeAllSchemas(e,t){for(let r in e){let o=e[r];if(!t||t.test(r)){if(typeof o=="string")delete e[r];else if(o&&!o.meta)this._cache.delete(o.schema),delete e[r]}}}_addSchema(e,t,r,o=this.opts.validateSchema,n=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=Tr.normalizeId(s||r);let c=Tr.getSchemaRefs.call(this,e,r);if(a=new Pr.SchemaEnv({schema:e,schemaId:i,meta:t,baseId:r,localRefs:c}),this._cache.set(a.schema,a),n&&!r.startsWith("#")){if(r)this._checkUnique(r);this.refs[r]=a}if(o)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 Pr.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{Pr.compileSchema.call(this,e)}finally{this.opts=t}}}pd.ValidationError=kL.default;pd.MissingRefError=zR.default;Kr.default=pd;function RR(e,t,r,o="error"){for(let n in e){let s=n;if(s in t)this.logger[o](`${r}: option ${n}. ${e[s]}`)}}function ER(e){return e=Tr.normalizeId(e),this.schemas[e]||this.refs[e]}function qL(){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 ML(){for(let e in this.opts.formats){let t=this.opts.formats[e];if(t)this.addFormat(e,t)}}function LL(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 DL(){let e={...this.opts};for(let t of CL)delete e[t];return e}var UL={log(){},warn(){},error(){}};function FL(e){if(e===!1)return UL;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 VL=/^[a-z_$][a-z0-9_$:-]*$/i;function ZL(e,t){let{RULES:r}=this;if(Ss.eachItem(e,(o)=>{if(r.keywords[o])throw Error(`Keyword ${o} is already defined`);if(!VL.test(o))throw Error(`Keyword ${o} 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 Ah(e,t,r){var o;let n=t===null||t===void 0?void 0:t.post;if(r&&n)throw Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,i=n?s.post:s.rules.find(({type:c})=>c===r);if(!i)i={type:r,rules:[]},s.rules.push(i);if(s.keywords[e]=!0,!t)return;let a={keyword:e,definition:{...t,type:Io.getJSONTypes(t.type),schemaType:Io.getJSONTypes(t.schemaType)}};if(t.before)HL.call(this,i,a,t.before);else i.rules.push(a);s.all[e]=a,(o=t.implements)===null||o===void 0||o.forEach((c)=>this.addKeyword(c))}function HL(e,t,r){let o=e.rules.findIndex((n)=>n.keyword===r);if(o>=0)e.rules.splice(o,0,t);else e.rules.push(t),this.logger.warn(`rule ${r} is not defined`)}function GL(e){let{metaSchema:t}=e;if(t===void 0)return;if(e.$data&&this.opts.$data)t=kR(t);e.validateSchema=this.compile(t,!0)}var JL={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function kR(e){return{anyOf:[e,JL]}}});var CR=D(function(OR){Object.defineProperty(OR,"__esModule",{value:!0});var WL={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};OR.default=WL});var gd=D(function(NR){Object.defineProperty(NR,"__esModule",{value:!0});NR.callRef=NR.getValidate=void 0;var XL=vs(),md=or(),Le=$e(),$s=tr(),hd=ba(),ko=ke(),QL={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:o}=e,{baseId:n,schemaEnv:s,validateName:i,opts:a,self:c}=o,{root:u}=s;if((r==="#"||r==="#/")&&n===u.baseId)return d();let l=hd.resolveRef.call(c,u,n,r);if(l===void 0)throw new XL.default(o.opts.uriResolver,n,r);if(l instanceof hd.SchemaEnv)return f(l);return m(l);function d(){if(s===u)return fd(e,i,s,s.$async);let h=t.scopeValue("root",{ref:u});return fd(e,Le._`${h}.validate`,u,u.$async)}function f(h){let g=xR(e,h);fd(e,g,h,h.$async)}function m(h){let g=t.scopeValue("schema",a.code.source===!0?{ref:h,code:Le.stringify(h)}:{ref:h}),_=t.name("valid"),y=e.subschema({schema:h,dataTypes:[],schemaPath:Le.nil,topSchemaRef:g,errSchemaPath:r},_);e.mergeEvaluated(y),e.ok(_)}}};function xR(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):Le._`${r.scopeValue("wrapper",{ref:t})}.validate`}NR.getValidate=xR;function fd(e,t,r,o){let{gen:n,it:s}=e,{allErrors:i,schemaEnv:a,opts:c}=s,u=c.passContext?$s.default.this:Le.nil;if(o)l();else d();function l(){if(!a.$async)throw Error("async schema referenced by sync schema");let h=n.let("valid");n.try(()=>{if(n.code(Le._`await ${md.callValidateCode(e,t,u)}`),m(t),!i)n.assign(h,!0)},(g)=>{if(n.if(Le._`!(${g} instanceof ${s.ValidationError})`,()=>n.throw(g)),f(g),!i)n.assign(h,!1)}),e.ok(h)}function d(){e.result(md.callValidateCode(e,t,u),()=>m(t),()=>f(t))}function f(h){let g=Le._`${h}.errors`;n.assign($s.default.vErrors,Le._`${$s.default.vErrors} === null ? ${g} : ${$s.default.vErrors}.concat(${g})`),n.assign($s.default.errors,Le._`${$s.default.vErrors}.length`)}function m(h){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=ko.mergeEvaluated.props(n,_.props,s.props)}else{let y=n.var("props",Le._`${h}.evaluated.props`);s.props=ko.mergeEvaluated.props(n,y,s.props,Le.Name)}if(s.items!==!0)if(_&&!_.dynamicItems){if(_.items!==void 0)s.items=ko.mergeEvaluated.items(n,_.items,s.items)}else{let y=n.var("items",Le._`${h}.evaluated.items`);s.items=ko.mergeEvaluated.items(n,y,s.items,Le.Name)}}}NR.callRef=fd;NR.default=QL});var qh=D(function(jR){Object.defineProperty(jR,"__esModule",{value:!0});var r2=CR(),o2=gd(),n2=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",r2.default,o2.default];jR.default=n2});var MR=D(function(qR){Object.defineProperty(qR,"__esModule",{value:!0});var Co=$e(),Oo=Co.operators,yd={maximum:{okStr:"<=",ok:Oo.LTE,fail:Oo.GT},minimum:{okStr:">=",ok:Oo.GTE,fail:Oo.LT},exclusiveMaximum:{okStr:"<",ok:Oo.LT,fail:Oo.GTE},exclusiveMinimum:{okStr:">",ok:Oo.GT,fail:Oo.LTE}},i2={message:({keyword:e,schemaCode:t})=>Co.str`must be ${yd[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>Co._`{comparison: ${yd[e].okStr}, limit: ${t}}`},a2={keyword:Object.keys(yd),type:"number",schemaType:"number",$data:!0,error:i2,code(e){let{keyword:t,data:r,schemaCode:o}=e;e.fail$data(Co._`${r} ${yd[t].fail} ${o} || isNaN(${r})`)}};qR.default=a2});var DR=D(function(LR){Object.defineProperty(LR,"__esModule",{value:!0});var Ir=$e(),u2={message:({schemaCode:e})=>Ir.str`must be multiple of ${e}`,params:({schemaCode:e})=>Ir._`{multipleOf: ${e}}`},l2={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:u2,code(e){let{gen:t,data:r,schemaCode:o,it:n}=e,s=n.opts.multipleOfPrecision,i=t.let("res"),a=s?Ir._`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:Ir._`${i} !== parseInt(${i})`;e.fail$data(Ir._`(${o} === 0 || (${i} = ${r}/${o}, ${a}))`)}};LR.default=l2});var VR=D(function(FR){Object.defineProperty(FR,"__esModule",{value:!0});function UR(e){let t=e.length,r=0,o=0,n;while(o<t)if(r++,n=e.charCodeAt(o++),n>=55296&&n<=56319&&o<t){if(n=e.charCodeAt(o),(n&64512)===56320)o++}return r}FR.default=UR;UR.code='require("ajv/dist/runtime/ucs2length").default'});var GR=D(function(HR){Object.defineProperty(HR,"__esModule",{value:!0});var Ut=$e(),ZR=ke(),f2=VR(),m2={message({keyword:e,schemaCode:t}){return Ut.str`must NOT have ${e==="maxLength"?"more":"fewer"} than ${t} characters`},params:({schemaCode:e})=>Ut._`{limit: ${e}}`},h2={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:m2,code(e){let{keyword:t,data:r,schemaCode:o,it:n}=e,s=t==="maxLength"?Ut.operators.GT:Ut.operators.LT,i=n.opts.unicode===!1?Ut._`${r}.length`:Ut._`${ZR.useFunc(e.gen,f2.default)}(${r})`;e.fail$data(Ut._`${i} ${s} ${o}`)}};HR.default=h2});var WR=D(function(BR){Object.defineProperty(BR,"__esModule",{value:!0});var JR=or(),KR=ke(),nr=$e(),y2={message:({schemaCode:e})=>nr.str`must match pattern "${e}"`,params:({schemaCode:e})=>nr._`{pattern: ${e}}`},_2={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:y2,code(e){let{gen:t,data:r,$data:o,schema:n,schemaCode:s,it:i}=e,a=i.opts.unicodeRegExp?"u":"";if(o){let{regExp:c}=i.opts.code,u=c.code==="new RegExp"?nr._`new RegExp`:KR.useFunc(t,c),l=t.let("valid");t.try(()=>t.assign(l,nr._`${u}(${s}, ${a}).test(${r})`),()=>t.assign(l,!1)),e.fail$data(nr._`!${l}`)}else{let c=JR.usePattern(e,n);e.fail$data(nr._`!${c}.test(${r})`)}}};BR.default=_2});var XR=D(function(YR){Object.defineProperty(YR,"__esModule",{value:!0});var kr=$e(),S2={message({keyword:e,schemaCode:t}){return kr.str`must NOT have ${e==="maxProperties"?"more":"fewer"} than ${t} properties`},params:({schemaCode:e})=>kr._`{limit: ${e}}`},b2={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:S2,code(e){let{keyword:t,data:r,schemaCode:o}=e,n=t==="maxProperties"?kr.operators.GT:kr.operators.LT;e.fail$data(kr._`Object.keys(${r}).length ${n} ${o}`)}};YR.default=b2});var tE=D(function(eE){Object.defineProperty(eE,"__esModule",{value:!0});var Or=or(),Cr=$e(),QR=ke(),w2={message:({params:{missingProperty:e}})=>Cr.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>Cr._`{missingProperty: ${e}}`},R2={keyword:"required",type:"object",schemaType:"array",$data:!0,error:w2,code(e){let{gen:t,schema:r,schemaCode:o,data:n,$data:s,it:i}=e,{opts:a}=i;if(!s&&r.length===0)return;let c=r.length>=a.loopRequired;if(i.allErrors)u();else l();if(a.strictRequired){let m=e.parentSchema.properties,{definedProperties:h}=e.it;for(let g of r)if((m===null||m===void 0?void 0:m[g])===void 0&&!h.has(g)){let _=i.schemaEnv.baseId+i.errSchemaPath,y=`required property "${g}" is not defined at "${_}" (strictRequired)`;QR.checkStrictMode(i,y,i.opts.strictRequired)}}function u(){if(c||s)e.block$data(Cr.nil,d);else for(let m of r)Or.checkReportMissingProp(e,m)}function l(){let m=t.let("missing");if(c||s){let h=t.let("valid",!0);e.block$data(h,()=>f(m,h)),e.ok(h)}else t.if(Or.checkMissingProp(e,r,m)),Or.reportMissingProp(e,m),t.else()}function d(){t.forOf("prop",o,(m)=>{e.setParams({missingProperty:m}),t.if(Or.noPropertyInData(t,n,m,a.ownProperties),()=>e.error())})}function f(m,h){e.setParams({missingProperty:m}),t.forOf(m,o,()=>{t.assign(h,Or.propertyInData(t,n,m,a.ownProperties)),t.if(Cr.not(h),()=>{e.error(),t.break()})},Cr.nil)}}};eE.default=R2});var oE=D(function(rE){Object.defineProperty(rE,"__esModule",{value:!0});var xr=$e(),z2={message({keyword:e,schemaCode:t}){return xr.str`must NOT have ${e==="maxItems"?"more":"fewer"} than ${t} items`},params:({schemaCode:e})=>xr._`{limit: ${e}}`},P2={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:z2,code(e){let{keyword:t,data:r,schemaCode:o}=e,n=t==="maxItems"?xr.operators.GT:xr.operators.LT;e.fail$data(xr._`${r}.length ${n} ${o}`)}};rE.default=P2});var _d=D(function(sE){Object.defineProperty(sE,"__esModule",{value:!0});var nE=yh();nE.code='require("ajv/dist/runtime/equal").default';sE.default=nE});var cE=D(function(aE){Object.defineProperty(aE,"__esModule",{value:!0});var ws=ya(),xe=$e(),iE=ke(),k2=_d(),O2={message:({params:{i:e,j:t}})=>xe.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>xe._`{i: ${e}, j: ${t}}`},C2={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:O2,code(e){let{gen:t,data:r,$data:o,schema:n,parentSchema:s,schemaCode:i,it:a}=e;if(!o&&!n)return;let c=t.let("valid"),u=s.items?ws.getSchemaTypes(s.items):[];e.block$data(c,l,xe._`${i} === false`),e.ok(c);function l(){let h=t.let("i",xe._`${r}.length`),g=t.let("j");e.setParams({i:h,j:g}),t.assign(c,!0),t.if(xe._`${h} > 1`,()=>(d()?f:m)(h,g))}function d(){return u.length>0&&!u.some((h)=>h==="object"||h==="array")}function f(h,g){let _=t.name("item"),y=ws.checkDataTypes(u,_,a.opts.strictNumbers,ws.DataType.Wrong),S=t.const("indices",xe._`{}`);t.for(xe._`;${h}--;`,()=>{if(t.let(_,xe._`${r}[${h}]`),t.if(y,xe._`continue`),u.length>1)t.if(xe._`typeof ${_} == "string"`,xe._`${_} += "_"`);t.if(xe._`typeof ${S}[${_}] == "number"`,()=>{t.assign(g,xe._`${S}[${_}]`),e.error(),t.assign(c,!1).break()}).code(xe._`${S}[${_}] = ${h}`)})}function m(h,g){let _=iE.useFunc(t,k2.default),y=t.name("outer");t.label(y).for(xe._`;${h}--;`,()=>t.for(xe._`${g} = ${h}; ${g}--;`,()=>t.if(xe._`${_}(${r}[${h}], ${r}[${g}])`,()=>{e.error(),t.assign(c,!1).break(y)})))}}};aE.default=C2});var dE=D(function(lE){Object.defineProperty(lE,"__esModule",{value:!0});var Rs=$e(),uE=ke(),N2=_d(),A2={message:"must be equal to constant",params:({schemaCode:e})=>Rs._`{allowedValue: ${e}}`},j2={keyword:"const",$data:!0,error:A2,code(e){let{gen:t,data:r,$data:o,schemaCode:n,schema:s}=e;if(o||s&&typeof s=="object")e.fail$data(Rs._`!${uE.useFunc(t,N2.default)}(${r}, ${n})`);else e.fail(Rs._`${s} !== ${r}`)}};lE.default=j2});var mE=D(function(fE){Object.defineProperty(fE,"__esModule",{value:!0});var Nr=$e(),pE=ke(),M2=_d(),L2={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>Nr._`{allowedValues: ${e}}`},D2={keyword:"enum",schemaType:"array",$data:!0,error:L2,code(e){let{gen:t,data:r,$data:o,schema:n,schemaCode:s,it:i}=e;if(!o&&n.length===0)throw Error("enum must have non-empty array");let a=n.length>=i.opts.loopEnum,c,u=()=>c!==null&&c!==void 0?c:c=pE.useFunc(t,M2.default),l;if(a||o)l=t.let("valid"),e.block$data(l,d);else{if(!Array.isArray(n))throw Error("ajv implementation error");let m=t.const("vSchema",s);l=Nr.or(...n.map((h,g)=>f(m,g)))}e.pass(l);function d(){t.assign(l,!1),t.forOf("v",s,(m)=>t.if(Nr._`${u()}(${r}, ${m})`,()=>t.assign(l,!0).break()))}function f(m,h){let g=n[h];return typeof g==="object"&&g!==null?Nr._`${u()}(${r}, ${m}[${h}])`:Nr._`${r} === ${g}`}}};fE.default=D2});var Mh=D(function(hE){Object.defineProperty(hE,"__esModule",{value:!0});var F2=MR(),V2=DR(),Z2=GR(),H2=WR(),G2=XR(),J2=tE(),K2=oE(),B2=cE(),W2=dE(),Y2=mE(),X2=[F2.default,V2.default,Z2.default,H2.default,G2.default,J2.default,K2.default,B2.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},W2.default,Y2.default];hE.default=X2});var Lh=D(function(yE){Object.defineProperty(yE,"__esModule",{value:!0});yE.validateAdditionalItems=void 0;var Ft=$e(),Es=ke(),eD={message:({params:{len:e}})=>Ft.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Ft._`{limit: ${e}}`},tD={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:eD,code(e){let{parentSchema:t,it:r}=e,{items:o}=t;if(!Array.isArray(o)){Es.checkStrictMode(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}gE(e,o)}};function gE(e,t){let{gen:r,schema:o,data:n,keyword:s,it:i}=e;i.items=!0;let a=r.const("len",Ft._`${n}.length`);if(o===!1)e.setParams({len:t.length}),e.pass(Ft._`${a} <= ${t.length}`);else if(typeof o=="object"&&!Es.alwaysValidSchema(i,o)){let u=r.var("valid",Ft._`${a} <= ${t.length}`);r.if(Ft.not(u),()=>c(u)),e.ok(u)}function c(u){r.forRange("i",t.length,a,(l)=>{if(e.subschema({keyword:s,dataProp:l,dataPropType:Es.Type.Num},u),!i.allErrors)r.if(Ft.not(u),()=>r.break())})}}yE.validateAdditionalItems=gE;yE.default=tD});var Dh=D(function(bE){Object.defineProperty(bE,"__esModule",{value:!0});bE.validateTuple=void 0;var vd=$e(),xo=ke(),vE=or(),oD={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return SE(e,"additionalItems",t);if(r.items=!0,xo.alwaysValidSchema(r,t))return;e.ok(vE.validateArray(e))}};function SE(e,t,r=e.schema){let{gen:o,parentSchema:n,data:s,keyword:i,it:a}=e;if(l(n),a.opts.unevaluated&&r.length&&a.items!==!0)a.items=xo.mergeEvaluated.items(o,r.length,a.items);let c=o.name("valid"),u=o.const("len",vd._`${s}.length`);r.forEach((d,f)=>{if(xo.alwaysValidSchema(a,d))return;o.if(vd._`${u} > ${f}`,()=>e.subschema({keyword:i,schemaProp:f,dataProp:f},c)),e.ok(c)});function l(d){let{opts:f,errSchemaPath:m}=a,h=r.length,g=h===d.minItems&&(h===d.maxItems||d[t]===!1);if(f.strictTuples&&!g){let _=`"${i}" is ${h}-tuple, but minItems or maxItems/${t} are not specified or different at path "${m}"`;xo.checkStrictMode(a,_,f.strictTuples)}}}bE.validateTuple=SE;bE.default=oD});var EE=D(function(RE){Object.defineProperty(RE,"__esModule",{value:!0});var wE=Dh(),sD={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(e)=>wE.validateTuple(e,"items")};RE.default=sD});var kE=D(function(IE){Object.defineProperty(IE,"__esModule",{value:!0});var Sd=$e(),zE=ke(),PE=or(),TE=Lh(),aD={message:({params:{len:e}})=>Sd.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Sd._`{limit: ${e}}`},cD={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:aD,code(e){let{schema:t,parentSchema:r,it:o}=e,{prefixItems:n}=r;if(o.items=!0,zE.alwaysValidSchema(o,t))return;if(n)TE.validateAdditionalItems(e,n);else e.ok(PE.validateArray(e))}};IE.default=cD});var CE=D(function(OE){Object.defineProperty(OE,"__esModule",{value:!0});var Be=$e(),No=ke(),lD={message:({params:{min:e,max:t}})=>t===void 0?Be.str`must contain at least ${e} valid item(s)`:Be.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?Be._`{minContains: ${e}}`:Be._`{minContains: ${e}, maxContains: ${t}}`},dD={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:lD,code(e){let{gen:t,schema:r,parentSchema:o,data:n,it:s}=e,i,a,{minContains:c,maxContains:u}=o;if(s.opts.next)i=c===void 0?1:c,a=u;else i=1;let l=t.const("len",Be._`${n}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){No.checkStrictMode(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){No.checkStrictMode(s,'"minContains" > "maxContains" is always invalid'),e.fail();return}if(No.alwaysValidSchema(s,r)){let g=Be._`${l} >= ${i}`;if(a!==void 0)g=Be._`${g} && ${l} <= ${a}`;e.pass(g);return}s.items=!0;let d=t.name("valid");if(a===void 0&&i===1)m(d,()=>t.if(d,()=>t.break()));else if(i===0){if(t.let(d,!0),a!==void 0)t.if(Be._`${n}.length > 0`,f)}else t.let(d,!1),f();e.result(d,()=>e.reset());function f(){let g=t.name("_valid"),_=t.let("count",0);m(g,()=>t.if(g,()=>h(_)))}function m(g,_){t.forRange("i",0,l,(y)=>{e.subschema({keyword:"contains",dataProp:y,dataPropType:No.Type.Num,compositeRule:!0},g),_()})}function h(g){if(t.code(Be._`${g}++`),a===void 0)t.if(Be._`${g} >= ${i}`,()=>t.assign(d,!0).break());else if(t.if(Be._`${g} > ${a}`,()=>t.assign(d,!1).break()),i===1)t.assign(d,!0);else t.if(Be._`${g} >= ${i}`,()=>t.assign(d,!0))}}};OE.default=dD});var bd=D(function(jE){Object.defineProperty(jE,"__esModule",{value:!0});jE.validateSchemaDeps=jE.validatePropertyDeps=jE.error=void 0;var zs=$e(),xE=ke(),Ar=or();jE.error={message:({params:{property:e,depsCount:t,deps:r}})=>zs.str`must have ${t===1?"property":"properties"} ${r} when property ${e} is present`,params:({params:{property:e,depsCount:t,deps:r,missingProperty:o}})=>zs._`{property: ${e},
7
- missingProperty: ${o},
2
+ var ux=Object.create;var{getPrototypeOf:lx,defineProperty:$y,getOwnPropertyNames:dx}=Object;var wy=Object.prototype.hasOwnProperty;function px(e){return this[e]}var fx,mx,Op=(e,t,r)=>{var n=e!=null&&typeof e==="object";if(n){var o=t?fx??=new WeakMap:mx??=new WeakMap,s=o.get(e);if(s)return s}r=e!=null?ux(lx(e)):{};let i=t||!e||!e.__esModule||!wy.call(e,"default")?$y(r,"default",{value:e,enumerable:!0}):r;if(e&&typeof e==="object"||typeof e==="function"){for(let a of dx(e))if(!wy.call(i,a))$y(i,a,{get:px.bind(e,a),enumerable:!0})}if(n)o.set(e,i);return i};var D=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var ba=D(function(P$){Object.defineProperty(P$,"__esModule",{value:!0});P$.regexpCode=P$.getEsmExportName=P$.getProperty=P$.safeStringify=P$.stringify=P$.strConcat=P$.addCodeArg=P$.str=P$._=P$.nil=P$._Code=P$.Name=P$.IDENTIFIER=P$._CodeOrName=void 0;class ed{}P$._CodeOrName=ed;P$.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class hs extends ed{constructor(e){super();if(!P$.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}}}P$.Name=hs;class vr extends ed{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 hs)t[r.str]=(t[r.str]||0)+1;return t},{})}}P$._Code=vr;P$.nil=new vr("");function E$(e,...t){let r=[e[0]],n=0;while(n<t.length)_h(r,t[n]),r.push(e[++n]);return new vr(r)}P$._=E$;var yh=new vr("+");function z$(e,...t){let r=[Sa(e[0])],n=0;while(n<t.length)r.push(yh),_h(r,t[n]),r.push(yh,Sa(e[++n]));return lj(r),new vr(r)}P$.str=z$;function _h(e,t){if(t instanceof vr)e.push(...t._items);else if(t instanceof hs)e.push(t);else e.push(fj(t))}P$.addCodeArg=_h;function lj(e){let t=1;while(t<e.length-1){if(e[t]===yh){let r=dj(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function dj(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string"){if(t instanceof hs||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 hs))return`"${e}${t.slice(1)}`;return}function pj(e,t){return t.emptyStr()?e:e.emptyStr()?t:z$`${e}${t}`}P$.strConcat=pj;function fj(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:Sa(Array.isArray(e)?e.join(","):e)}function mj(e){return new vr(Sa(e))}P$.stringify=mj;function Sa(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}P$.safeStringify=Sa;function hj(e){return typeof e=="string"&&P$.IDENTIFIER.test(e)?new vr(`.${e}`):E$`[${e}]`}P$.getProperty=hj;function gj(e){if(typeof e=="string"&&P$.IDENTIFIER.test(e))return new vr(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}P$.getEsmExportName=gj;function yj(e){return new vr(e.toString())}P$.regexpCode=yj});var $h=D(function(O$){Object.defineProperty(O$,"__esModule",{value:!0});O$.ValueScope=O$.ValueScopeName=O$.Scope=O$.varKinds=O$.UsedValueState=void 0;var Le=ba();class I$ extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`);this.value=e.value}}var rd;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(rd||(O$.UsedValueState=rd={}));O$.varKinds={const:new Le.Name("const"),let:new Le.Name("let"),var:new Le.Name("var")};class Sh{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof Le.Name?e:this.name(e)}name(e){return new Le.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}}}O$.Scope=Sh;class bh extends Le.Name{constructor(e,t){super(t);this.prefix=e}setValue(e,{property:t,itemIndex:r}){this.value=e,this.scopePath=Le._`.${new Le.Name(t)}[${r}]`}}O$.ValueScopeName=bh;var kj=Le._`\n`;class k$ extends Sh{constructor(e){super(e);this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?kj:Le.nil}}get(){return this._scope}name(e){return new bh(e,this._newName(e))}value(e,t){var r;if(t.ref===void 0)throw Error("CodeGen: ref must be passed in value");let n=this.toName(e),{prefix:o}=n,s=(r=t.key)!==null&&r!==void 0?r:t.ref,i=this._values[o];if(i){let u=i.get(s);if(u)return u}else i=this._values[o]=new Map;i.set(s,n);let a=this._scope[o]||(this._scope[o]=[]),c=a.length;return a[c]=t.ref,n.setValue(t,{property:o,itemIndex:c}),n}getValue(e,t){let r=this._values[e];if(!r)return;return r.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,(r)=>{if(r.scopePath===void 0)throw Error(`CodeGen: name "${r}" has no value`);return Le._`${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=Le.nil;for(let s in e){let i=e[s];if(!i)continue;let a=r[s]=r[s]||new Map;i.forEach((c)=>{if(a.has(c))return;a.set(c,rd.Started);let u=t(c);if(u){let l=this.opts.es5?O$.varKinds.var:O$.varKinds.const;o=Le._`${o}${l} ${c} = ${u};${this.opts._n}`}else if(u=n===null||n===void 0?void 0:n(c))o=Le._`${o}${u}${this.opts._n}`;else throw new I$(c);a.set(c,rd.Completed)})}return o}}O$.ValueScope=k$});var $e=D(function(Ft){Object.defineProperty(Ft,"__esModule",{value:!0});Ft.or=Ft.and=Ft.not=Ft.CodeGen=Ft.operators=Ft.varKinds=Ft.ValueScopeName=Ft.ValueScope=Ft.Scope=Ft.Name=Ft.regexpCode=Ft.stringify=Ft.getProperty=Ft.nil=Ft.strConcat=Ft.str=Ft._=void 0;var re=ba(),tt=$h(),En=ba();Object.defineProperty(Ft,"_",{enumerable:!0,get:function(){return En._}});Object.defineProperty(Ft,"str",{enumerable:!0,get:function(){return En.str}});Object.defineProperty(Ft,"strConcat",{enumerable:!0,get:function(){return En.strConcat}});Object.defineProperty(Ft,"nil",{enumerable:!0,get:function(){return En.nil}});Object.defineProperty(Ft,"getProperty",{enumerable:!0,get:function(){return En.getProperty}});Object.defineProperty(Ft,"stringify",{enumerable:!0,get:function(){return En.stringify}});Object.defineProperty(Ft,"regexpCode",{enumerable:!0,get:function(){return En.regexpCode}});Object.defineProperty(Ft,"Name",{enumerable:!0,get:function(){return En.Name}});var cd=$h();Object.defineProperty(Ft,"Scope",{enumerable:!0,get:function(){return cd.Scope}});Object.defineProperty(Ft,"ValueScope",{enumerable:!0,get:function(){return cd.ValueScope}});Object.defineProperty(Ft,"ValueScopeName",{enumerable:!0,get:function(){return cd.ValueScopeName}});Object.defineProperty(Ft,"varKinds",{enumerable:!0,get:function(){return cd.varKinds}});Ft.operators={GT:new re._Code(">"),GTE:new re._Code(">="),LT:new re._Code("<"),LTE:new re._Code("<="),EQ:new re._Code("==="),NEQ:new re._Code("!=="),NOT:new re._Code("!"),OR:new re._Code("||"),AND:new re._Code("&&"),ADD:new re._Code("+")};class zn{optimizeNodes(){return this}optimizeNames(e,t){return this}}class C$ extends zn{constructor(e,t,r){super();this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){let r=e?tt.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=ys(this.rhs,e,t);return this}get names(){return this.rhs instanceof re._CodeOrName?this.rhs.names:{}}}class Eh extends zn{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 re.Name&&!e[this.lhs.str]&&!this.sideEffects)return;return this.rhs=ys(this.rhs,e,t),this}get names(){let e=this.lhs instanceof re.Name?{}:{...this.lhs.names};return ad(e,this.rhs)}}class A$ extends Eh{constructor(e,t,r,n){super(e,r,n);this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class N$ extends zn{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class j$ extends zn{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class q$ extends zn{constructor(e){super();this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class M$ extends zn{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=ys(this.code,e,t),this}get names(){return this.code instanceof re._CodeOrName?this.code.names:{}}}class ud extends zn{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;Aj(e,o.names),r.splice(n,1)}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>$o(e,t.names),{})}}class Pn extends ud{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class L$ extends ud{}class $a extends Pn{}$a.kind="else";class Yr extends Pn{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 $a(r):r}if(t){if(e===!1)return t instanceof Yr?t:t.nodes;if(this.nodes.length)return this;return new Yr(H$(e),t instanceof Yr?[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=ys(this.condition,e,t),this}get names(){let e=super.names;if(ad(e,this.condition),this.else)$o(e,this.else.names);return e}}Yr.kind="if";class gs extends Pn{}gs.kind="for";class D$ extends gs{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=ys(this.iteration,e,t),this}get names(){return $o(super.names,this.iteration.names)}}class U$ extends gs{constructor(e,t,r,n){super();this.varKind=e,this.name=t,this.from=r,this.to=n}render(e){let t=e.es5?tt.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=ad(super.names,this.from);return ad(e,this.to)}}class wh extends gs{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=ys(this.iterable,e,t),this}get names(){return $o(super.names,this.iterable.names)}}class nd extends Pn{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)}}nd.kind="func";class od extends ud{render(e){return"return "+super.render(e)}}od.kind="return";class F$ extends Pn{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)$o(e,this.catch.names);if(this.finally)$o(e,this.finally.names);return e}}class sd extends Pn{constructor(e){super();this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}sd.kind="catch";class id extends Pn{render(e){return"finally"+super.render(e)}}id.kind="finally";class V${constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
3
+ `:""},this._extScope=e,this._scope=new tt.Scope({parent:e}),this._nodes=[new L$]}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 C$(e,o,r)),o}const(e,t,r){return this._def(tt.varKinds.const,e,t,r)}let(e,t,r){return this._def(tt.varKinds.let,e,t,r)}var(e,t,r){return this._def(tt.varKinds.var,e,t,r)}assign(e,t,r){return this._leafNode(new Eh(e,t,r))}add(e,t){return this._leafNode(new A$(e,Ft.operators.ADD,t))}code(e){if(typeof e=="function")e();else if(e!==re.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(":"),re.addCodeArg(t,n)}return t.push("}"),new re._Code(t)}if(e,t,r){if(this._blockNode(new Yr(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 Yr(e))}else(){return this._elseNode(new $a)}endIf(){return this._endBlockNode(Yr,$a)}_for(e,t){if(this._blockNode(e),t)this.code(t).endFor();return this}for(e,t){return this._for(new D$(e),t)}forRange(e,t,r,n,o=this.opts.es5?tt.varKinds.var:tt.varKinds.let){let s=this._scope.toName(e);return this._for(new U$(o,s,t,r),()=>n(s))}forOf(e,t,r,n=tt.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let s=t instanceof re.Name?t:this.var("_arr",t);return this.forRange("_i",0,re._`${s}.length`,(i)=>{this.var(o,re._`${s}[${i}]`),r(o)})}return this._for(new wh("of",n,o,t),()=>r(o))}forIn(e,t,r,n=this.opts.es5?tt.varKinds.var:tt.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,re._`Object.keys(${t})`,r);let o=this._scope.toName(e);return this._for(new wh("in",n,o,t),()=>r(o))}endFor(){return this._endBlockNode(gs)}label(e){return this._leafNode(new N$(e))}break(e){return this._leafNode(new j$(e))}return(e){let t=new od;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(od)}try(e,t,r){if(!t&&!r)throw Error('CodeGen: "try" without "catch" and "finally"');let n=new F$;if(this._blockNode(n),this.code(e),t){let o=this.name("e");this._currNode=n.catch=new sd(o),t(o)}if(r)this._currNode=n.finally=new id,this.code(r);return this._endBlockNode(sd,id)}throw(e){return this._leafNode(new q$(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=re.nil,r,n){if(this._blockNode(new nd(e,t,r)),n)this.code(n).endFunc();return this}endFunc(){return this._endBlockNode(nd)}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 Yr))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}}Ft.CodeGen=V$;function $o(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function ad(e,t){return t instanceof re._CodeOrName?$o(e,t.names):e}function ys(e,t,r){if(e instanceof re.Name)return n(e);if(!o(e))return e;return new re._Code(e._items.reduce((s,i)=>{if(i instanceof re.Name)i=n(i);if(i instanceof re._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 re._Code&&s._items.some((i)=>i instanceof re.Name&&t[i.str]===1&&r[i.str]!==void 0)}}function Aj(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function H$(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:re._`!${Rh(e)}`}Ft.not=H$;var Nj=Z$(Ft.operators.AND);function jj(...e){return e.reduce(Nj)}Ft.and=jj;var qj=Z$(Ft.operators.OR);function Mj(...e){return e.reduce(qj)}Ft.or=Mj;function Z$(e){return(t,r)=>t===re.nil?r:r===re.nil?t:re._`${Rh(t)} ${e} ${Rh(r)}`}function Rh(e){return e instanceof re.Name?e:re._`(${e})`}});var ke=D(function(tw){Object.defineProperty(tw,"__esModule",{value:!0});tw.checkStrictMode=tw.getErrorPath=tw.Type=tw.useFunc=tw.setEvaluated=tw.evaluatedPropsToName=tw.mergeEvaluated=tw.eachItem=tw.unescapeJsonPointer=tw.escapeJsonPointer=tw.escapeFragment=tw.unescapeFragment=tw.schemaRefOrVal=tw.schemaHasRulesButRef=tw.schemaHasRules=tw.checkUnknownRules=tw.alwaysValidSchema=tw.toHash=void 0;var he=$e(),B$=ba();function Fj(e){let t={};for(let r of e)t[r]=!0;return t}tw.toHash=Fj;function Vj(e,t){if(typeof t=="boolean")return t;if(Object.keys(t).length===0)return!0;return W$(e,t),!Y$(t,e.self.RULES.all)}tw.alwaysValidSchema=Vj;function W$(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])ew(e,`unknown keyword: "${s}"`)}tw.checkUnknownRules=W$;function Y$(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}tw.schemaHasRules=Y$;function Hj(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}tw.schemaHasRulesButRef=Hj;function Zj({topSchemaRef:e,schemaPath:t},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return he._`${r}`}return he._`${e}${t}${he.getProperty(n)}`}tw.schemaRefOrVal=Zj;function Gj(e){return X$(decodeURIComponent(e))}tw.unescapeFragment=Gj;function Jj(e){return encodeURIComponent(Ph(e))}tw.escapeFragment=Jj;function Ph(e){if(typeof e=="number")return`${e}`;return e.replace(/~/g,"~0").replace(/\//g,"~1")}tw.escapeJsonPointer=Ph;function X$(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}tw.unescapeJsonPointer=X$;function Kj(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}tw.eachItem=Kj;function J$({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(o,s,i,a)=>{let c=i===void 0?s:i instanceof he.Name?(s instanceof he.Name?e(o,s,i):t(o,s,i),i):s instanceof he.Name?(t(o,i,s),s):r(s,i);return a===he.Name&&!(c instanceof he.Name)?n(o,c):c}}tw.mergeEvaluated={props:J$({mergeNames:(e,t,r)=>e.if(he._`${r} !== true && ${t} !== undefined`,()=>{e.if(he._`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,he._`${r} || {}`).code(he._`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if(he._`${r} !== true`,()=>{if(t===!0)e.assign(r,!0);else e.assign(r,he._`${r} || {}`),Th(e,r,t)}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:Q$}),items:J$({mergeNames:(e,t,r)=>e.if(he._`${r} !== true && ${t} !== undefined`,()=>e.assign(r,he._`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if(he._`${r} !== true`,()=>e.assign(r,t===!0?!0:he._`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function Q$(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",he._`{}`);if(t!==void 0)Th(e,r,t);return r}tw.evaluatedPropsToName=Q$;function Th(e,t,r){Object.keys(r).forEach((n)=>e.assign(he._`${t}${he.getProperty(n)}`,!0))}tw.setEvaluated=Th;var K$={};function Bj(e,t){return e.scopeValue("func",{ref:t,code:K$[t.code]||(K$[t.code]=new B$._Code(t.code))})}tw.useFunc=Bj;var zh;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(zh||(tw.Type=zh={}));function Wj(e,t,r){if(e instanceof he.Name){let n=t===zh.Num;return r?n?he._`"[" + ${e} + "]"`:he._`"['" + ${e} + "']"`:n?he._`"/" + ${e}`:he._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?he.getProperty(e).toString():"/"+Ph(e)}tw.getErrorPath=Wj;function ew(e,t,r=e.opts.strictSchema){if(!r)return;if(t=`strict mode: ${t}`,r===!0)throw Error(t);e.self.logger.warn(t)}tw.checkStrictMode=ew});var nr=D(function(nw){Object.defineProperty(nw,"__esModule",{value:!0});var je=$e(),mq={data:new je.Name("data"),valCxt:new je.Name("valCxt"),instancePath:new je.Name("instancePath"),parentData:new je.Name("parentData"),parentDataProperty:new je.Name("parentDataProperty"),rootData:new je.Name("rootData"),dynamicAnchors:new je.Name("dynamicAnchors"),vErrors:new je.Name("vErrors"),errors:new je.Name("errors"),this:new je.Name("this"),self:new je.Name("self"),scope:new je.Name("scope"),json:new je.Name("json"),jsonPos:new je.Name("jsonPos"),jsonLen:new je.Name("jsonLen"),jsonPart:new je.Name("jsonPart")};nw.default=mq});var wa=D(function(aw){Object.defineProperty(aw,"__esModule",{value:!0});aw.extendErrors=aw.resetErrorsCount=aw.reportExtraError=aw.reportError=aw.keyword$DataError=aw.keywordError=void 0;var ne=$e(),Tn=ke(),jt=nr();aw.keywordError={message:({keyword:e})=>ne.str`must pass "${e}" keyword validation`};aw.keyword$DataError={message:({keyword:e,schemaType:t})=>t?ne.str`"${e}" keyword must be ${t} ($data)`:ne.str`"${e}" keyword is invalid ($data)`};function gq(e,t=aw.keywordError,r,n){let{it:o}=e,{gen:s,compositeRule:i,allErrors:a}=o,c=iw(e,t,r);if(n!==null&&n!==void 0?n:i||a)ow(s,c);else sw(o,ne._`[${c}]`)}aw.reportError=gq;function yq(e,t=aw.keywordError,r){let{it:n}=e,{gen:o,compositeRule:s,allErrors:i}=n,a=iw(e,t,r);if(ow(o,a),!(s||i))sw(n,jt.default.vErrors)}aw.reportExtraError=yq;function _q(e,t){e.assign(jt.default.errors,t),e.if(ne._`${jt.default.vErrors} !== null`,()=>e.if(t,()=>e.assign(ne._`${jt.default.vErrors}.length`,t),()=>e.assign(jt.default.vErrors,null)))}aw.resetErrorsCount=_q;function vq({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,jt.default.errors,(a)=>{if(e.const(i,ne._`${jt.default.vErrors}[${a}]`),e.if(ne._`${i}.instancePath === undefined`,()=>e.assign(ne._`${i}.instancePath`,ne.strConcat(jt.default.instancePath,s.errorPath))),e.assign(ne._`${i}.schemaPath`,ne.str`${s.errSchemaPath}/${t}`),s.opts.verbose)e.assign(ne._`${i}.schema`,r),e.assign(ne._`${i}.data`,n)})}aw.extendErrors=vq;function ow(e,t){let r=e.const("err",t);e.if(ne._`${jt.default.vErrors} === null`,()=>e.assign(jt.default.vErrors,ne._`[${r}]`),ne._`${jt.default.vErrors}.push(${r})`),e.code(ne._`${jt.default.errors}++`)}function sw(e,t){let{gen:r,validateName:n,schemaEnv:o}=e;if(o.$async)r.throw(ne._`new ${e.ValidationError}(${t})`);else r.assign(ne._`${n}.errors`,t),r.return(!1)}var wo={keyword:new ne.Name("keyword"),schemaPath:new ne.Name("schemaPath"),params:new ne.Name("params"),propertyName:new ne.Name("propertyName"),message:new ne.Name("message"),schema:new ne.Name("schema"),parentSchema:new ne.Name("parentSchema")};function iw(e,t,r){let{createErrors:n}=e.it;if(n===!1)return ne._`{}`;return Sq(e,t,r)}function Sq(e,t,r={}){let{gen:n,it:o}=e,s=[bq(o,r),$q(e,r)];return wq(e,t,s),n.object(...s)}function bq({errorPath:e},{instancePath:t}){let r=t?ne.str`${e}${Tn.getErrorPath(t,Tn.Type.Str)}`:e;return[jt.default.instancePath,ne.strConcat(jt.default.instancePath,r)]}function $q({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let o=n?t:ne.str`${t}/${e}`;if(r)o=ne.str`${o}${Tn.getErrorPath(r,Tn.Type.Str)}`;return[wo.schemaPath,o]}function wq(e,{params:t,message:r},n){let{keyword:o,data:s,schemaValue:i,it:a}=e,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;if(n.push([wo.keyword,o],[wo.params,typeof t=="function"?t(e):t||ne._`{}`]),c.messages)n.push([wo.message,typeof r=="function"?r(e):r]);if(c.verbose)n.push([wo.schema,i],[wo.parentSchema,ne._`${l}${d}`],[jt.default.data,s]);if(u)n.push([wo.propertyName,u])}});var mw=D(function(pw){Object.defineProperty(pw,"__esModule",{value:!0});pw.boolOrEmptySchema=pw.topBoolOrEmptySchema=void 0;var uw=wa(),lw=$e(),Tq=nr(),Iq={message:"boolean schema is false"};function kq(e){let{gen:t,schema:r,validateName:n}=e;if(r===!1)dw(e,!1);else if(typeof r=="object"&&r.$async===!0)t.return(Tq.default.data);else t.assign(lw._`${n}.errors`,null),t.return(!0)}pw.topBoolOrEmptySchema=kq;function Oq(e,t){let{gen:r,schema:n}=e;if(n===!1)r.var(t,!1),dw(e);else r.var(t,!0)}pw.boolOrEmptySchema=Oq;function dw(e,t){let{gen:r,data:n}=e;uw.reportError({gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e},Iq,void 0,t)}});var kh=D(function(hw){Object.defineProperty(hw,"__esModule",{value:!0});hw.getRules=hw.isJSONType=void 0;var Cq=["string","number","integer","boolean","null","object","array"],Aq=new Set(Cq);function Nq(e){return typeof e=="string"&&Aq.has(e)}hw.isJSONType=Nq;function jq(){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:{}}}hw.getRules=jq});var Oh=D(function(vw){Object.defineProperty(vw,"__esModule",{value:!0});vw.shouldUseRule=vw.shouldUseGroup=vw.schemaHasRulesForType=void 0;function Mq({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&yw(e,n)}vw.schemaHasRulesForType=Mq;function yw(e,t){return t.rules.some((r)=>_w(e,r))}vw.shouldUseGroup=yw;function _w(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))}vw.shouldUseRule=_w});var Ra=D(function(zw){Object.defineProperty(zw,"__esModule",{value:!0});zw.reportTypeError=zw.checkDataTypes=zw.checkDataType=zw.coerceAndCheckDataType=zw.getJSONTypes=zw.getSchemaTypes=zw.DataType=void 0;var bw=kh(),$w=Oh(),ww=wa(),X=$e(),dd=ke(),_s;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(_s||(zw.DataType=_s={}));function Uq(e){let t=Rw(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}zw.getSchemaTypes=Uq;function Rw(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(bw.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}zw.getJSONTypes=Rw;function Fq(e,t){let{gen:r,data:n,opts:o}=e,s=Vq(t,o.coerceTypes),i=t.length>0&&!(s.length===0&&t.length===1&&$w.schemaHasRulesForType(e,t[0]));if(i){let a=Ch(t,n,o.strictNumbers,_s.Wrong);r.if(a,()=>{if(s.length)Hq(e,t,s);else Ah(e)})}return i}zw.coerceAndCheckDataType=Fq;var Ew=new Set(["string","number","integer","boolean","null"]);function Vq(e,t){return t?e.filter((r)=>Ew.has(r)||t==="array"&&r==="array"):[]}function Hq(e,t,r){let{gen:n,data:o,opts:s}=e,i=n.let("dataType",X._`typeof ${o}`),a=n.let("coerced",X._`undefined`);if(s.coerceTypes==="array")n.if(X._`${i} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,X._`${o}[0]`).assign(i,X._`typeof ${o}`).if(Ch(t,o,s.strictNumbers),()=>n.assign(a,o)));n.if(X._`${a} !== undefined`);for(let u of r)if(Ew.has(u)||u==="array"&&s.coerceTypes==="array")c(u);n.else(),Ah(e),n.endIf(),n.if(X._`${a} !== undefined`,()=>{n.assign(o,a),Zq(e,a)});function c(u){switch(u){case"string":n.elseIf(X._`${i} == "number" || ${i} == "boolean"`).assign(a,X._`"" + ${o}`).elseIf(X._`${o} === null`).assign(a,X._`""`);return;case"number":n.elseIf(X._`${i} == "boolean" || ${o} === null
4
+ || (${i} == "string" && ${o} && ${o} == +${o})`).assign(a,X._`+${o}`);return;case"integer":n.elseIf(X._`${i} === "boolean" || ${o} === null
5
+ || (${i} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(a,X._`+${o}`);return;case"boolean":n.elseIf(X._`${o} === "false" || ${o} === 0 || ${o} === null`).assign(a,!1).elseIf(X._`${o} === "true" || ${o} === 1`).assign(a,!0);return;case"null":n.elseIf(X._`${o} === "" || ${o} === 0 || ${o} === false`),n.assign(a,null);return;case"array":n.elseIf(X._`${i} === "string" || ${i} === "number"
6
+ || ${i} === "boolean" || ${o} === null`).assign(a,X._`[${o}]`)}}}function Zq({gen:e,parentData:t,parentDataProperty:r},n){e.if(X._`${t} !== undefined`,()=>e.assign(X._`${t}[${r}]`,n))}function xh(e,t,r,n=_s.Correct){let o=n===_s.Correct?X.operators.EQ:X.operators.NEQ,s;switch(e){case"null":return X._`${t} ${o} null`;case"array":s=X._`Array.isArray(${t})`;break;case"object":s=X._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":s=i(X._`!(${t} % 1) && !isNaN(${t})`);break;case"number":s=i();break;default:return X._`typeof ${t} ${o} ${e}`}return n===_s.Correct?s:X.not(s);function i(a=X.nil){return X.and(X._`typeof ${t} == "number"`,a,r?X._`isFinite(${t})`:X.nil)}}zw.checkDataType=xh;function Ch(e,t,r,n){if(e.length===1)return xh(e[0],t,r,n);let o,s=dd.toHash(e);if(s.array&&s.object){let i=X._`typeof ${t} != "object"`;o=s.null?i:X._`!${t} || ${i}`,delete s.null,delete s.array,delete s.object}else o=X.nil;if(s.number)delete s.integer;for(let i in s)o=X.and(o,xh(i,t,r,n));return o}zw.checkDataTypes=Ch;var Gq={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?X._`{type: ${e}}`:X._`{type: ${t}}`};function Ah(e){let t=Jq(e);ww.reportError(t,Gq)}zw.reportTypeError=Ah;function Jq(e){let{gen:t,data:r,schema:n}=e,o=dd.schemaRefOrVal(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:e}}});var xw=D(function(kw){Object.defineProperty(kw,"__esModule",{value:!0});kw.assignDefaults=void 0;var or=$e(),Iw=ke();function eM(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let o in r)Tw(e,o,r[o].default);else if(t==="array"&&Array.isArray(n))n.forEach((o,s)=>Tw(e,s,o.default))}kw.assignDefaults=eM;function Tw(e,t,r){let{gen:n,compositeRule:o,data:s,opts:i}=e;if(r===void 0)return;let a=or._`${s}${or.getProperty(t)}`;if(o){Iw.checkStrictMode(e,`default is ignored for: ${a}`);return}let c=or._`${a} === undefined`;if(i.useDefaults==="empty")c=or._`${c} || ${a} === null || ${a} === ""`;n.if(c,or._`${a} = ${or.stringify(r)}`)}});var sr=D(function(jw){Object.defineProperty(jw,"__esModule",{value:!0});jw.validateUnion=jw.validateArray=jw.usePattern=jw.callValidateCode=jw.schemaProperties=jw.allSchemaProperties=jw.noPropertyInData=jw.propertyInData=jw.isOwnProperty=jw.hasPropFunc=jw.reportMissingProp=jw.checkMissingProp=jw.checkReportMissingProp=void 0;var _e=$e(),vs=ke(),In=nr(),Cw=ke();function tM(e,t){let{gen:r,data:n,it:o}=e;r.if(jh(r,n,t,o.opts.ownProperties),()=>{e.setParams({missingProperty:_e._`${t}`},!0),e.error()})}jw.checkReportMissingProp=tM;function rM({gen:e,data:t,it:{opts:r}},n,o){return _e.or(...n.map((s)=>_e.and(jh(e,t,s,r.ownProperties),_e._`${o} = ${s}`)))}jw.checkMissingProp=rM;function nM(e,t){e.setParams({missingProperty:t},!0),e.error()}jw.reportMissingProp=nM;function Aw(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:_e._`Object.prototype.hasOwnProperty`})}jw.hasPropFunc=Aw;function Nh(e,t,r){return _e._`${Aw(e)}.call(${t}, ${r})`}jw.isOwnProperty=Nh;function oM(e,t,r,n){let o=_e._`${t}${_e.getProperty(r)} !== undefined`;return n?_e._`${o} && ${Nh(e,t,r)}`:o}jw.propertyInData=oM;function jh(e,t,r,n){let o=_e._`${t}${_e.getProperty(r)} === undefined`;return n?_e.or(o,_e.not(Nh(e,t,r))):o}jw.noPropertyInData=jh;function Nw(e){return e?Object.keys(e).filter((t)=>t!=="__proto__"):[]}jw.allSchemaProperties=Nw;function sM(e,t){return Nw(t).filter((r)=>!vs.alwaysValidSchema(e,t[r]))}jw.schemaProperties=sM;function iM({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:s},it:i},a,c,u){let l=u?_e._`${e}, ${t}, ${n}${o}`:t,d=[[In.default.instancePath,_e.strConcat(In.default.instancePath,s)],[In.default.parentData,i.parentData],[In.default.parentDataProperty,i.parentDataProperty],[In.default.rootData,In.default.rootData]];if(i.opts.dynamicRef)d.push([In.default.dynamicAnchors,In.default.dynamicAnchors]);let p=_e._`${l}, ${r.object(...d)}`;return c!==_e.nil?_e._`${a}.call(${c}, ${p})`:_e._`${a}(${p})`}jw.callValidateCode=iM;var aM=_e._`new RegExp`;function cM({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:_e._`${o.code==="new RegExp"?aM:Cw.useFunc(e,o)}(${r}, ${n})`})}jw.usePattern=cM;function uM(e){let{gen:t,data:r,keyword:n,it:o}=e,s=t.name("valid");if(o.allErrors){let a=t.let("valid",!0);return i(()=>t.assign(a,!1)),a}return t.var(s,!0),i(()=>t.break()),s;function i(a){let c=t.const("len",_e._`${r}.length`);t.forRange("i",0,c,(u)=>{e.subschema({keyword:n,dataProp:u,dataPropType:vs.Type.Num},s),t.if(_e.not(s),a)})}}jw.validateArray=uM;function lM(e){let{gen:t,schema:r,keyword:n,it:o}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(r.some((c)=>vs.alwaysValidSchema(o,c))&&!o.opts.unevaluated)return;let i=t.let("valid",!1),a=t.name("_valid");t.block(()=>r.forEach((c,u)=>{let l=e.subschema({keyword:n,schemaProp:u,compositeRule:!0},a);if(t.assign(i,_e._`${i} || ${a}`),!e.mergeValidEvaluated(l,a))t.if(_e.not(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}jw.validateUnion=lM});var Hw=D(function(Fw){Object.defineProperty(Fw,"__esModule",{value:!0});Fw.validateKeywordUsage=Fw.validSchemaType=Fw.funcKeywordCode=Fw.macroKeywordCode=void 0;var qe=$e(),Ro=nr(),Lw=sr(),Dw=wa();function wM(e,t){let{gen:r,keyword:n,schema:o,parentSchema:s,it:i}=e,a=t.macro.call(i.self,o,s,i),c=Uw(r,n,a);if(i.opts.validateSchema!==!1)i.self.validateSchema(a,!0);let u=r.name("valid");e.subschema({schema:a,schemaPath:qe.nil,errSchemaPath:`${i.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}Fw.macroKeywordCode=wM;function RM(e,t){var r;let{gen:n,keyword:o,schema:s,parentSchema:i,$data:a,it:c}=e;zM(c,t);let u=!a&&t.compile?t.compile.call(c.self,s,i,c):t.validate,l=Uw(n,o,u),d=n.let("valid");e.block$data(d,p),e.ok((r=t.valid)!==null&&r!==void 0?r:d);function p(){if(t.errors===!1){if(g(),t.modifying)Mw(e);_(()=>e.error())}else{let y=t.async?m():h();if(t.modifying)Mw(e);_(()=>EM(e,y))}}function m(){let y=n.let("ruleErrs",null);return n.try(()=>g(qe._`await `),(S)=>n.assign(d,!1).if(qe._`${S} instanceof ${c.ValidationError}`,()=>n.assign(y,qe._`${S}.errors`),()=>n.throw(S))),y}function h(){let y=qe._`${l}.errors`;return n.assign(y,null),g(qe.nil),y}function g(y=t.async?qe._`await `:qe.nil){let S=c.opts.passContext?Ro.default.this:Ro.default.self,v=!(("compile"in t)&&!a||t.schema===!1);n.assign(d,qe._`${y}${Lw.callValidateCode(e,l,S,v)}`,t.modifying)}function _(y){var S;n.if(qe.not((S=t.valid)!==null&&S!==void 0?S:d),y)}}Fw.funcKeywordCode=RM;function Mw(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,qe._`${n.parentData}[${n.parentDataProperty}]`))}function EM(e,t){let{gen:r}=e;r.if(qe._`Array.isArray(${t})`,()=>{r.assign(Ro.default.vErrors,qe._`${Ro.default.vErrors} === null ? ${t} : ${Ro.default.vErrors}.concat(${t})`).assign(Ro.default.errors,qe._`${Ro.default.vErrors}.length`),Dw.extendErrors(e)},()=>e.error())}function zM({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}function Uw(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:qe.stringify(r)})}function PM(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")}Fw.validSchemaType=PM;function TM({schema:e,opts:t,self:r,errSchemaPath:n},o,s){if(Array.isArray(o.keyword)?!o.keyword.includes(s):o.keyword!==s)throw Error("ajv implementation error");let i=o.dependencies;if(i===null||i===void 0?void 0:i.some((a)=>!Object.prototype.hasOwnProperty.call(e,a)))throw Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(o.validateSchema){if(!o.validateSchema(e[s])){let c=`keyword "${s}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw Error(c)}}}Fw.validateKeywordUsage=TM});var Jw=D(function(Zw){Object.defineProperty(Zw,"__esModule",{value:!0});Zw.extendSubschemaMode=Zw.extendSubschemaData=Zw.getSubschema=void 0;var dt=$e(),pd=ke();function xM(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:dt._`${e.schemaPath}${dt.getProperty(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:dt._`${e.schemaPath}${dt.getProperty(t)}${dt.getProperty(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${pd.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')}Zw.getSubschema=xM;function CM(e,t,{dataProp:r,dataPropType:n,data:o,dataTypes:s,propertyName:i}){if(o!==void 0&&r!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=t;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=t,p=a.let("data",dt._`${t.data}${dt.getProperty(r)}`,!0);c(p),e.errorPath=dt.str`${u}${pd.getErrorPath(r,n,d.jsPropertySyntax)}`,e.parentDataProperty=dt._`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(o!==void 0){let u=o instanceof dt.Name?o:a.let("data",o,!0);if(c(u),i!==void 0)e.propertyName=i}if(s)e.dataTypes=s;function c(u){e.data=u,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,u]}}Zw.extendSubschemaData=CM;function AM(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}Zw.extendSubschemaMode=AM});var qh=D(function(MW,Kw){Kw.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 Ww=D(function(LW,Bw){var kn=Bw.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(){};fd(t,n,o,e,"",e)};kn.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};kn.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};kn.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};kn.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 fd(e,t,r,n,o,s,i,a,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,o,s,i,a,c,u);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in kn.arrayKeywords)for(var p=0;p<d.length;p++)fd(e,t,r,d[p],o+"/"+l+"/"+p,s,o,l,n,p)}else if(l in kn.propsKeywords){if(d&&typeof d=="object")for(var m in d)fd(e,t,r,d[m],o+"/"+l+"/"+qM(m),s,o,l,n,m)}else if(l in kn.keywords||e.allKeys&&!(l in kn.skipKeywords))fd(e,t,r,d,o+"/"+l,s,o,l,n)}r(n,o,s,i,a,c,u)}}function qM(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var Ea=D(function(tR){Object.defineProperty(tR,"__esModule",{value:!0});tR.getSchemaRefs=tR.resolveUrl=tR.normalizeId=tR._getFullPath=tR.getFullPath=tR.inlineRef=void 0;var Yw=ke(),MM=qh(),LM=Ww(),DM=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function UM(e,t=!0){if(typeof e=="boolean")return!0;if(t===!0)return!Mh(e);if(!t)return!1;return Xw(e)<=t}tR.inlineRef=UM;var FM=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Mh(e){for(let t in e){if(FM.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(Mh))return!0;if(typeof r=="object"&&Mh(r))return!0}return!1}function Xw(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,DM.has(r))continue;if(typeof e[r]=="object")Yw.eachItem(e[r],(n)=>t+=Xw(n));if(t===1/0)return 1/0}return t}function Qw(e,t="",r){if(r!==!1)t=Ss(t);let n=e.parse(t);return eR(e,n)}tR.getFullPath=Qw;function eR(e,t){return e.serialize(t).split("#")[0]+"#"}tR._getFullPath=eR;var VM=/#\/?$/;function Ss(e){return e?e.replace(VM,""):""}tR.normalizeId=Ss;function HM(e,t,r){return r=Ss(r),e.resolve(t,r)}tR.resolveUrl=HM;var ZM=/^[a-z_][-a-z0-9._]*$/i;function GM(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=Ss(e[r]||t),s={"":o},i=Qw(n,o,!1),a={},c=new Set;return LM(e,{allKeys:!0},(d,p,m,h)=>{if(h===void 0)return;let g=i+p,_=s[h];if(typeof d[r]=="string")_=y.call(this,d[r]);S.call(this,d.$anchor),S.call(this,d.$dynamicAnchor),s[p]=_;function y(v){let w=this.opts.uriResolver.resolve;if(v=Ss(_?w(_,v):v),c.has(v))throw l(v);c.add(v);let z=this.refs[v];if(typeof z=="string")z=this.refs[z];if(typeof z=="object")u(d,z.schema,v);else if(v!==Ss(g))if(v[0]==="#")u(d,a[v],v),a[v]=d;else this.refs[v]=g;return v}function S(v){if(typeof v=="string"){if(!ZM.test(v))throw Error(`invalid anchor "${v}"`);y.call(this,`#${v}`)}}}),a;function u(d,p,m){if(p!==void 0&&!MM(d,p))throw l(m)}function l(d){return Error(`reference "${d}" resolves to more than one schema`)}}tR.getSchemaRefs=GM});var ws=D(function(yR){Object.defineProperty(yR,"__esModule",{value:!0});yR.getData=yR.KeywordCxt=yR.validateFunctionCode=void 0;var hd=mw(),md=Ra(),$s=Oh(),On=Ra(),iR=xw(),kr=Hw(),bs=Jw(),V=$e(),ve=nr(),aR=Ea(),St=ke(),Ir=wa();function XM(e){if(lR(e)){if(dR(e),uR(e)){tL(e);return}}cR(e,()=>hd.topBoolOrEmptySchema(e))}yR.validateFunctionCode=XM;function cR({gen:e,validateName:t,schema:r,schemaEnv:n,opts:o},s){if(o.code.es5)e.func(t,V._`${ve.default.data}, ${ve.default.valCxt}`,n.$async,()=>{e.code(V._`"use strict"; ${nR(r,o)}`),eL(e,o),e.code(s)});else e.func(t,V._`${ve.default.data}, ${QM(o)}`,n.$async,()=>e.code(nR(r,o)).code(s))}function QM(e){return V._`{${ve.default.instancePath}="", ${ve.default.parentData}, ${ve.default.parentDataProperty}, ${ve.default.rootData}=${ve.default.data}${e.dynamicRef?V._`, ${ve.default.dynamicAnchors}={}`:V.nil}}={}`}function eL(e,t){e.if(ve.default.valCxt,()=>{if(e.var(ve.default.instancePath,V._`${ve.default.valCxt}.${ve.default.instancePath}`),e.var(ve.default.parentData,V._`${ve.default.valCxt}.${ve.default.parentData}`),e.var(ve.default.parentDataProperty,V._`${ve.default.valCxt}.${ve.default.parentDataProperty}`),e.var(ve.default.rootData,V._`${ve.default.valCxt}.${ve.default.rootData}`),t.dynamicRef)e.var(ve.default.dynamicAnchors,V._`${ve.default.valCxt}.${ve.default.dynamicAnchors}`)},()=>{if(e.var(ve.default.instancePath,V._`""`),e.var(ve.default.parentData,V._`undefined`),e.var(ve.default.parentDataProperty,V._`undefined`),e.var(ve.default.rootData,ve.default.data),t.dynamicRef)e.var(ve.default.dynamicAnchors,V._`{}`)})}function tL(e){let{schema:t,opts:r,gen:n}=e;cR(e,()=>{if(r.$comment&&t.$comment)fR(e);if(iL(e),n.let(ve.default.vErrors,null),n.let(ve.default.errors,0),r.unevaluated)rL(e);pR(e),uL(e)});return}function rL(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",V._`${r}.evaluated`),t.if(V._`${e.evaluated}.dynamicProps`,()=>t.assign(V._`${e.evaluated}.props`,V._`undefined`)),t.if(V._`${e.evaluated}.dynamicItems`,()=>t.assign(V._`${e.evaluated}.items`,V._`undefined`))}function nR(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?V._`/*# sourceURL=${r} */`:V.nil}function nL(e,t){if(lR(e)){if(dR(e),uR(e)){oL(e,t);return}}hd.boolOrEmptySchema(e,t)}function uR({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 lR(e){return typeof e.schema!="boolean"}function oL(e,t){let{schema:r,gen:n,opts:o}=e;if(o.$comment&&r.$comment)fR(e);aL(e),cL(e);let s=n.const("_errs",ve.default.errors);pR(e,s),n.var(t,V._`${s} === ${ve.default.errors}`)}function dR(e){St.checkUnknownRules(e),sL(e)}function pR(e,t){if(e.opts.jtd)return oR(e,[],!1,t);let r=md.getSchemaTypes(e.schema),n=md.coerceAndCheckDataType(e,r);oR(e,r,!n,t)}function sL(e){let{schema:t,errSchemaPath:r,opts:n,self:o}=e;if(t.$ref&&n.ignoreKeywordsWithRef&&St.schemaHasRulesButRef(t,o.RULES))o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function iL(e){let{schema:t,opts:r}=e;if(t.default!==void 0&&r.useDefaults&&r.strictSchema)St.checkStrictMode(e,"default is ignored in the schema root")}function aL(e){let t=e.schema[e.opts.schemaId];if(t)e.baseId=aR.resolveUrl(e.opts.uriResolver,e.baseId,t)}function cL(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}function fR({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:o}){let s=r.$comment;if(o.$comment===!0)e.code(V._`${ve.default.self}.logger.log(${s})`);else if(typeof o.$comment=="function"){let i=V.str`${n}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code(V._`${ve.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function uL(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:o,opts:s}=e;if(r.$async)t.if(V._`${ve.default.errors} === 0`,()=>t.return(ve.default.data),()=>t.throw(V._`new ${o}(${ve.default.vErrors})`));else{if(t.assign(V._`${n}.errors`,ve.default.vErrors),s.unevaluated)lL(e);t.return(V._`${ve.default.errors} === 0`)}}function lL({gen:e,evaluated:t,props:r,items:n}){if(r instanceof V.Name)e.assign(V._`${t}.props`,r);if(n instanceof V.Name)e.assign(V._`${t}.items`,n)}function oR(e,t,r,n){let{gen:o,schema:s,data:i,allErrors:a,opts:c,self:u}=e,{RULES:l}=u;if(s.$ref&&(c.ignoreKeywordsWithRef||!St.schemaHasRulesButRef(s,l))){o.block(()=>hR(e,"$ref",l.all.$ref.definition));return}if(!c.jtd)dL(e,t);o.block(()=>{for(let p of l.rules)d(p);d(l.post)});function d(p){if(!$s.shouldUseGroup(s,p))return;if(p.type){if(o.if(On.checkDataType(p.type,i,c.strictNumbers)),sR(e,p),t.length===1&&t[0]===p.type&&r)o.else(),On.reportTypeError(e);o.endIf()}else sR(e,p);if(!a)o.if(V._`${ve.default.errors} === ${n||0}`)}}function sR(e,t){let{gen:r,schema:n,opts:{useDefaults:o}}=e;if(o)iR.assignDefaults(e,t.type);r.block(()=>{for(let s of t.rules)if($s.shouldUseRule(n,s))hR(e,s.keyword,s.definition,t.type)})}function dL(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;if(pL(e,t),!e.opts.allowUnionTypes)fL(e,t);mL(e,e.dataTypes)}function pL(e,t){if(!t.length)return;if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach((r)=>{if(!mR(e.dataTypes,r))Lh(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),gL(e,t)}function fL(e,t){if(t.length>1&&!(t.length===2&&t.includes("null")))Lh(e,"use allowUnionTypes to allow union type keyword")}function mL(e,t){let r=e.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&$s.shouldUseRule(e.schema,o)){let{type:s}=o.definition;if(s.length&&!s.some((i)=>hL(t,i)))Lh(e,`missing type "${s.join(",")}" for keyword "${n}"`)}}}function hL(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function mR(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function gL(e,t){let r=[];for(let n of e.dataTypes)if(mR(t,n))r.push(n);else if(t.includes("integer")&&n==="number")r.push("integer");e.dataTypes=r}function Lh(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,St.checkStrictMode(e,t,e.opts.strictTypes)}class Dh{constructor(e,t,r){if(kr.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=St.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",gR(this.$data,e));else if(this.schemaCode=this.schemaValue,!kr.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",ve.default.errors)}result(e,t,r){this.failResult(V.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(V.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(V._`${t} !== undefined && (${V.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?Ir.reportExtraError:Ir.reportError)(this,this.def.error,t)}$dataError(){Ir.reportError(this,this.def.$dataError||Ir.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');Ir.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=V.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=V.nil,t=V.nil){if(!this.$data)return;let{gen:r,schemaCode:n,schemaType:o,def:s}=this;if(r.if(V.or(V._`${n} === undefined`,t)),e!==V.nil)r.assign(e,!0);if(o.length||s.validateSchema){if(r.elseIf(this.invalid$data()),this.$dataError(),e!==V.nil)r.assign(e,!1)}r.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:r,def:n,it:o}=this;return V.or(s(),i());function s(){if(r.length){if(!(t instanceof V.Name))throw Error("ajv implementation error");let a=Array.isArray(r)?r:[r];return V._`${On.checkDataTypes(a,t,o.opts.strictNumbers,On.DataType.Wrong)}`}return V.nil}function i(){if(n.validateSchema){let a=e.scopeValue("validate$data",{ref:n.validateSchema});return V._`!${a}(${t})`}return V.nil}}subschema(e,t){let r=bs.getSubschema(this.it,e);bs.extendSubschemaData(r,this.it,e),bs.extendSubschemaMode(r,e);let n={...this.it,...r,items:void 0,props:void 0};return nL(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=St.mergeEvaluated.props(n,e.props,r.props,t);if(r.items!==!0&&e.items!==void 0)r.items=St.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,V.Name)),!0}}yR.KeywordCxt=Dh;function hR(e,t,r,n){let o=new Dh(e,r,t);if("code"in r)r.code(o,n);else if(o.$data&&r.validate)kr.funcKeywordCode(o,r);else if("macro"in r)kr.macroKeywordCode(o,r);else if(r.compile||r.validate)kr.funcKeywordCode(o,r)}var yL=/^\/(?:[^~]|~0|~1)*$/,_L=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function gR(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let o,s;if(e==="")return ve.default.rootData;if(e[0]==="/"){if(!yL.test(e))throw Error(`Invalid JSON-pointer: ${e}`);o=e,s=ve.default.rootData}else{let u=_L.exec(e);if(!u)throw Error(`Invalid JSON-pointer: ${e}`);let l=+u[1];if(o=u[2],o==="#"){if(l>=t)throw Error(c("property/index",l));return n[t-l]}if(l>t)throw Error(c("data",l));if(s=r[t-l],!o)return s}let i=s,a=o.split("/");for(let u of a)if(u)s=V._`${s}${V.getProperty(St.unescapeJsonPointer(u))}`,i=V._`${i} && ${s}`;return i;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${t}`}}yR.getData=gR});var za=D(function(SR){Object.defineProperty(SR,"__esModule",{value:!0});class vR extends Error{constructor(e){super("validation failed");this.errors=e,this.ajv=this.validation=!0}}SR.default=vR});var Es=D(function($R){Object.defineProperty($R,"__esModule",{value:!0});var Rs=Ea();class bR extends Error{constructor(e,t,r,n){super(n||`can't resolve reference ${r} from id ${t}`);this.missingRef=Rs.resolveUrl(e,t,r),this.missingSchema=Rs.normalizeId(Rs.getFullPath(e,this.missingRef))}}$R.default=bR});var Ta=D(function(ER){Object.defineProperty(ER,"__esModule",{value:!0});ER.resolveSchema=ER.getCompilingSchema=ER.resolveRef=ER.compileSchema=ER.SchemaEnv=void 0;var rt=$e(),wL=za(),Eo=nr(),nt=Ea(),gd=ke(),wR=ws();class Pa{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:nt.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={}}}ER.SchemaEnv=Pa;function Fh(e){let t=RR.call(this,e);if(t)return t;let r=nt.getFullPath(this.opts.uriResolver,e.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:s}=this.opts,i=new rt.CodeGen(this.scope,{es5:n,lines:o,ownProperties:s}),a;if(e.$async)a=i.scopeValue("Error",{ref:wL.default,code:rt._`require("ajv/dist/runtime/validation_error").default`});let c=i.scopeName("validate");e.validateName=c;let u={gen:i,allErrors:this.opts.allErrors,data:Eo.default.data,parentData:Eo.default.parentData,parentDataProperty:Eo.default.parentDataProperty,dataNames:[Eo.default.data],dataPathArr:[rt.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:rt.stringify(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:rt.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:rt._`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),wR.validateFunctionCode(u),i.optimize(this.opts.code.optimize);let d=i.toString();if(l=`${i.scopeRefs(Eo.default.scope)}return ${d}`,this.opts.code.process)l=this.opts.code.process(l,e);let m=Function(`${Eo.default.self}`,`${Eo.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:m}),m.errors=null,m.schema=e.schema,m.schemaEnv=e,e.$async)m.$async=!0;if(this.opts.code.source===!0)m.source={validateName:c,validateCode:d,scopeValues:i._values};if(this.opts.unevaluated){let{props:h,items:g}=u;if(m.evaluated={props:h instanceof rt.Name?void 0:h,items:g instanceof rt.Name?void 0:g,dynamicProps:h instanceof rt.Name,dynamicItems:g instanceof rt.Name},m.source)m.source.evaluated=rt.stringify(m.evaluated)}return e.validate=m,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)}}ER.compileSchema=Fh;function RL(e,t,r){var n;r=nt.resolveUrl(this.opts.uriResolver,t,r);let o=e.refs[r];if(o)return o;let s=PL.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 Pa({schema:i,schemaId:a,root:e,baseId:t})}if(s===void 0)return;return e.refs[r]=EL.call(this,s)}ER.resolveRef=RL;function EL(e){if(nt.inlineRef(e.schema,this.opts.inlineRefs))return e.schema;return e.validate?e:Fh.call(this,e)}function RR(e){for(let t of this._compilations)if(zL(t,e))return t}ER.getCompilingSchema=RR;function zL(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function PL(e,t){let r;while(typeof(r=this.refs[t])=="string")t=r;return r||this.schemas[t]||yd.call(this,e,t)}function yd(e,t){let r=this.opts.uriResolver.parse(t),n=nt._getFullPath(this.opts.uriResolver,r),o=nt.getFullPath(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===o)return Uh.call(this,r,e);let s=nt.normalizeId(n),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=yd.call(this,e,i);if(typeof(a===null||a===void 0?void 0:a.schema)!=="object")return;return Uh.call(this,r,a)}if(typeof(i===null||i===void 0?void 0:i.schema)!=="object")return;if(!i.validate)Fh.call(this,i);if(s===nt.normalizeId(t)){let{schema:a}=i,{schemaId:c}=this.opts,u=a[c];if(u)o=nt.resolveUrl(this.opts.uriResolver,o,u);return new Pa({schema:a,schemaId:c,root:e,baseId:o})}return Uh.call(this,r,i)}ER.resolveSchema=yd;var TL=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Uh(e,{baseId:t,schema:r,root:n}){var o;if(((o=e.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if(typeof r==="boolean")return;let c=r[gd.unescapeFragment(a)];if(c===void 0)return;r=c;let u=typeof r==="object"&&r[this.opts.schemaId];if(!TL.has(a)&&u)t=nt.resolveUrl(this.opts.uriResolver,t,u)}let s;if(typeof r!="boolean"&&r.$ref&&!gd.schemaHasRulesButRef(r,this.RULES)){let a=nt.resolveUrl(this.opts.uriResolver,t,r.$ref);s=yd.call(this,n,a)}let{schemaId:i}=this.opts;if(s=s||new Pa({schema:r,schemaId:i,root:n,baseId:t}),s.schema!==s.root.schema)return s;return}});var PR=D(function(ZW,CL){CL.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 Kh=D(function(GW,AR){var AL=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Hh=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),NL=RegExp.prototype.test.bind(/^\d*$/u),zo=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),Zh=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),IR=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),Gh=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),jL=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),Vt=Array(256);for(let t=0;t<256;t++)Vt[t]="%"+"0123456789ABCDEF"[t>>4]+"0123456789ABCDEF"[t&15];function Ot(e){if(e<2048)return Vt[192|e>>6]+Vt[128|e&63];if(e<65536)return Vt[224|e>>12]+Vt[128|e>>6&63]+Vt[128|e&63];return Vt[240|e>>18]+Vt[128|e>>12&63]+Vt[128|e>>6&63]+Vt[128|e&63]}function qL(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 ML=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),LL=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),DL=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),UL=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function FL(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++){if(DL(e[t]))continue;if(e[t]==="%"&&t+2<e.length&&zo(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function TR(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 VL(e){let t=e.indexOf("::");if(t!==-1&&e.indexOf("::",t+1)!==-1)return;let r=t===-1?e.split(":"):e.slice(0,t).split(":"),n=t===-1?[]:e.slice(t+2).split(":");if(t!==-1){if(r.length===1&&r[0]==="")r.length=0;if(n.length===1&&n[0]==="")n.length=0}let o=r.concat(n),s=0;for(let a=0;a<o.length;a++){let c=o[a];if(c==="")return;if(c.indexOf(".")!==-1){if(a!==o.length-1||t!==-1&&n.length===0||!Hh(c))return;s+=2;continue}if(!ML(c))return;o[a]=parseInt(c,16).toString(16),s++}if(t===-1){if(s!==8)return;return TR(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 TR(i)}function Vh(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&&LL(n))return n=n.toLowerCase(),{host:`[${n}]`,escapedHost:n,isIPV6:!1,isIPVFuture:!0};if(HL(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),!FL(o))return{host:e,isIPV6:!1,error:!0};n=n.slice(0,s)}let i=VL(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 HL(e,t){let r=0;for(let n=0;n<e.length;n++)if(e[n]===t)r++;return r}function ZL(e){let t=e,r=[],n=-1,o=0;while(o=t.length){if(o===1)if(t===".")break;else if(t==="/"){r.push("/");break}else{r.push(t);break}else if(o===2){if(t[0]==="."){if(t[1]===".")break;else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."||t[1]==="/"){r.push("/");break}}}else if(o===3){if(t==="/.."){if(r.length!==0)r.pop();r.push("/");break}}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."){if(t[3]==="/"){if(t=t.slice(3),r.length!==0)r.pop();continue}}}}if((n=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,n)),t=t.slice(n)}return r.join("")}var GL={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},JL=/[@/?#:]/g,KL=/[@/?#]/g;function kR(e,t){let r=t?KL:JL;return r.lastIndex=0,e.replace(r,(n)=>GL[n])}function OR(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(zo(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));if(t&&Zh(i))r+=i;else r+="%"+s;n+=2;continue}}r+=e[n]}return r}function BL(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(zo(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));if(i!=="."&&Zh(i))t+=i;else t+="%"+s;r+=2;continue}}if(IR(n))t+=n;else{let o=e.charCodeAt(r);if(o<128)t+=CR(o)?n:Vt[o];else if(o<55296||o>57343)t+=Ot(o);else if(o<=56319&&r+1<e.length){let s=e.charCodeAt(r+1);if(s>=56320&&s<=57343)t+=Ot(65536+(o-55296<<10)+(s-56320)),r++;else t+=Ot(65533)}else t+=Ot(65533)}}return t}function WL(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(zo(i)){r+="%"+i.toUpperCase(),o+=2;continue}}if(s==="/")n=!1;if(IR(s)&&(s!==":"||!n))r+=s;else{let i=e.charCodeAt(o);if(i<128)r+=Vt[i];else if(i<55296||i>57343)r+=Ot(i);else if(i<=56319&&o+1<e.length){let a=e.charCodeAt(o+1);if(a>=56320&&a<=57343)r+=Ot(65536+(i-55296<<10)+(a-56320)),o++;else r+=Ot(65533)}else r+=Ot(65533)}}return r}function Jh(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(zo(s)){r+="%"+s.toUpperCase(),n+=2;continue}}if(t(o))r+=o;else{let s=e.charCodeAt(n);if(s<128)r+=Vt[s];else if(s<55296||s>57343)r+=Ot(s);else if(s<=56319&&n+1<e.length){let i=e.charCodeAt(n+1);if(i>=56320&&i<=57343)r+=Ot(65536+(s-55296<<10)+(i-56320)),n++;else r+=Ot(65533)}else r+=Ot(65533)}}return r}function xR(e){return Jh(e,jL)}function YL(e){return Jh(e,Gh)}function XL(e){return Jh(e,Gh)}function CR(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 QL(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(zo(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));if(Zh(i))t+=i;else t+="%"+s;r+=2;continue}}if(Gh(n))t+=n;else{let o=e.charCodeAt(r);if(o<128)t+=CR(o)?n:Vt[o];else if(o<55296||o>57343)t+=Ot(o);else if(o<=56319&&r+1<e.length){let s=e.charCodeAt(r+1);if(s>=56320&&s<=57343)t+=Ot(65536+(o-55296<<10)+(s-56320)),r++;else t+=Ot(65533)}else t+=Ot(65533)}}return t}function e2(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(zo(n)){t+="%"+n.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function t2(e){let t=[];if(e.userinfo!==void 0)t.push(xR(e.userinfo)),t.push("@");if(e.host!==void 0){let r=e.host;if(!Hh(r)){let n=Vh(r);if(n.isIPV6!==!0&&n.isIPVFuture!==!0)r=OR(r,!0),n=Vh(r);if(n.isIPV6===!0||n.isIPVFuture===!0)r=`[${n.escapedHost}]`;else r=kR(r,!1)}t.push(r)}if(typeof e.port==="number"||typeof e.port==="string"){let r=String(e.port);if(!NL(r))throw TypeError("URI port is malformed.");t.push(":"),t.push(r)}return t.length?t.join(""):void 0}AR.exports={nonSimpleDomain:UL,recomposeAuthority:t2,reescapeHostDelimiters:kR,normalizePercentEncoding:OR,normalizePathEncoding:BL,serializePathEncoding:WL,normalizeQueryFragmentEncoding:QL,encodeUserinfo:xR,encodeQuery:YL,encodeFragment:XL,escapePreservingEscapes:e2,removeDotSegments:ZL,isIPv4:Hh,isUUID:AL,normalizeIPv6:Vh,stringArrayToHexStripped:qL}});var LR=D(function(JW,MR){var{isUUID:r2}=Kh(),n2=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,o2=["http","https","ws","wss","urn","urn:uuid"];function s2(e){return o2.indexOf(e)!==-1}function Bh(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 NR(e){if(!e.host)e.error=e.error||"HTTP URIs must have a host.";return e}function jR(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 i2(e){return e.secure=Bh(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function a2(e){if(e.port===(Bh(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 c2(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(n2);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=Wh(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 u2(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=Wh(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 l2(e,t){let r=e;if(r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!r2(r.uuid)))r.error=r.error||"UUID is not valid.";return r}function d2(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var qR={scheme:"http",domainHost:!0,parse:NR,serialize:jR},p2={scheme:"https",domainHost:qR.domainHost,parse:NR,serialize:jR},_d={scheme:"ws",domainHost:!0,parse:i2,serialize:a2},f2={scheme:"wss",domainHost:_d.domainHost,parse:_d.parse,serialize:_d.serialize},m2={scheme:"urn",parse:c2,serialize:u2,skipNormalize:!0},h2={scheme:"urn:uuid",parse:l2,serialize:d2,skipNormalize:!0},vd={http:qR,https:p2,ws:_d,wss:f2,urn:m2,"urn:uuid":h2};Object.setPrototypeOf(vd,null);function Wh(e){return e&&(vd[e]||vd[e.toLowerCase()])||void 0}MR.exports={wsIsSecure:Bh,SCHEMES:vd,isValidSchemeName:s2,getSchemeHandler:Wh}});var YR=D(function(KW,$d){var{normalizeIPv6:HR,removeDotSegments:ka,recomposeAuthority:g2,normalizePercentEncoding:Yh,normalizePathEncoding:y2,serializePathEncoding:DR,normalizeQueryFragmentEncoding:UR,encodeQuery:_2,encodeFragment:v2,reescapeHostDelimiters:S2,isIPv4:ZR,nonSimpleDomain:b2}=Kh(),{SCHEMES:GR,getSchemeHandler:Xh}=LR(),JR=/^[A-Za-z][A-Za-z0-9+.-]*$/u;function FR(e){let t=unescape(String(e));if(!JR.test(t))throw TypeError("URI scheme is malformed.");return t}function $2(e,t){if(typeof e==="string")e=k2(e,t);else if(typeof e==="object")e=bd(Po(e,t),t);return e}function w2(e,t,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},{parsed:o,malformedAuthorityOrPort:s,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:c,malformedScheme:u}=Sd(e,n),{parsed:l,malformedAuthorityOrPort:d,malformedPercentEncoding:p,malformedSchemeSpecific:m,malformedHost:h,malformedScheme:g}=Sd(t,n);if(s||d||i||p||a||m||c||h||u||g)throw Error(o.error||l.error||"URI is malformed.");let _=KR(o,l,n,!0),y=Xh(r&&r.scheme||_.scheme),S=_.host,v=S!==void 0&&S!==""&&(ZR(S)||HR(S).isIPV6);BR(_,r||{},y,v);let w=S&&S.indexOf("%")!==-1&&!/\P{ASCII}/u.test(S);if(_.error&&!w)throw Error(_.error);return n.skipEscape=!0,Po(_,n)}function KR(e,t,r,n){let o={};if(!n)e=bd(Po(e,r),r),t=bd(Po(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=ka(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=ka(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=ka(t.path);else{if((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path)o.path="/"+t.path;else if(!e.path)o.path=t.path;else o.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path;o.path=ka(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 R2(e,t,r){let n=VR(e,r),o=VR(t,r);return n!==void 0&&o!==void 0&&n===o}function Po(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=FR(r.scheme);let s=Xh(n.scheme||r.scheme);if(s&&s.serialize)s.serialize(r,n);let i=r.userinfo!==void 0||r.host!==void 0||r.port!==void 0,a=!n.skipEscape&&r.scheme===void 0&&!i;if(r.path!==void 0)if(!n.skipEscape)r.path=DR(r.path,a);else r.path=Yh(r.path);if(n.reference!=="suffix"&&r.scheme)r.scheme=FR(r.scheme),o.push(r.scheme,":");let c=g2(r);if(c!==void 0){if(n.reference!=="suffix")o.push("//");if(o.push(c),r.path&&r.path[0]!=="/")o.push("/")}if(r.path!==void 0){let u=r.path;if(!n.absolutePath&&(!s||!s.absolutePath))u=ka(u);if(a)u=DR(u,!0);if(c===void 0&&u[0]==="/"&&u[1]==="/")u="/%2F"+u.slice(2);o.push(u)}if(r.query!==void 0)o.push("?",_2(r.query));if(r.fragment!==void 0)o.push("#",v2(r.fragment));return o.join("")}var E2=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,z2=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,P2=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function T2(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 Ia(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 Qh(e){return e[0]==="["&&e[e.length-1]==="]"}function I2(e){let t=e[4];return Ia(e[3])||t!==void 0&&!Qh(t)&&Ia(t)||Ia(e[6])||Ia(e[7])||Ia(e[8])}function BR(e,t,r,n){if(!t.unicodeSupport&&(!r||!r.unicodeSupport)&&e.host&&!Qh(e.host)&&(t.domainHost||r&&r.domainHost)&&n===!1&&b2(e.host))try{e.host=new URL("http://"+e.host).hostname}catch(o){return e.error=e.error||"Host's domain name can not be converted to ASCII: "+o,!0}return!1}function Sd(e,t){let r=Object.assign({},t),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=!1,s=!1,i=!1,a=!1,c=!1,u=!1,l=!1;if(r.reference==="suffix")if(r.scheme)e=r.scheme+":"+e;else e="//"+e;let d=e.match(z2);if(d!==null&&d[1].indexOf("\\")!==-1)n.error="URI authority must not contain a literal backslash.",o=!0;let p=e.match(P2);if(p!==null){let h=p[1],g=h.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(h.length!==g.length)n.error=n.error||"URI authority introducer must not contain whitespace.",o=!0}}let m=e.match(E2);if(m){if(n.scheme=m[1],n.userinfo=m[3],n.host=m[4],n.port=parseInt(m[5],10),n.path=m[6]||"",n.query=m[7],n.fragment=m[8],n.scheme!==void 0){let _=unescape(n.scheme);if(JR.test(_))n.scheme=_.toLowerCase();else n.error=n.error||"URI scheme is malformed.",u=!0}if(s=I2(m),s)n.error=n.error||"URI contains malformed percent-encoding.";if(isNaN(n.port))n.port=m[5];let h=T2(n,m);if(h!==void 0)n.error=n.error||h,o=!0;if(n.host)if(ZR(n.host)===!1){let y=Qh(n.host),S=n.host.indexOf("[")!==-1||n.host.indexOf("]")!==-1,v=HR(n.host);if(l=v.isIPV6||v.isIPVFuture===!0,c=S&&(!y||v.error===!0),n.host=l?v.host:v.host.toLowerCase(),c)n.error=n.error||"URI host is malformed.",o=!0}else l=!0;if(n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path)n.reference="same-document";else if(n.scheme===void 0)n.reference="relative";else if(n.fragment===void 0)n.reference="absolute";else n.reference="uri";if(r.reference&&r.reference!=="suffix"&&r.reference!==n.reference)n.error=n.error||"URI is not a "+r.reference+" reference.";let g=Xh(r.scheme||n.scheme);if(!c)a=BR(n,r,g,l);if(e.indexOf("%")!==-1&&n.host!==void 0&&!c){let _=l?n.host:Yh(n.host,!0);if(!l)_=Yh(_.toLowerCase());n.host=S2(_,l)}if(!g||g&&!g.skipNormalize){if(n.path)n.path=y2(n.path);if(n.query)n.query=UR(n.query);if(n.fragment)n.fragment=UR(n.fragment)}if(g&&g.parse){if(g.parse(n,r),g===GR.urn&&n.nid===void 0)i=!0}}else n.error=n.error||"URI can not be parsed.";return{parsed:n,malformedAuthorityOrPort:o,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:u}}function bd(e,t){return Sd(e,t).parsed}function k2(e,t){return WR(e,t).normalized}function WR(e,t){let{parsed:r,malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:s,malformedHost:i,malformedScheme:a}=Sd(e,t);return{normalized:n||o||s||i||a?e:Po(r,t),malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:s,malformedHost:i,malformedScheme:a}}function VR(e,t){if(typeof e!=="string"&&typeof e!=="object")return;let r;try{r=typeof e==="string"?e:Po(e,t)}catch{return}let{normalized:n,malformedAuthorityOrPort:o,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:c}=WR(r,t);return o||s||i||a||c?void 0:n}var eg={SCHEMES:GR,normalize:$2,resolve:w2,resolveComponent:KR,equal:R2,serialize:Po,parse:bd};$d.exports=eg;$d.exports.default=eg;$d.exports.fastUri=eg});var eE=D(function(QR){Object.defineProperty(QR,"__esModule",{value:!0});var XR=YR();XR.code='require("ajv/dist/runtime/uri").default';QR.default=XR});var rg=D(function(Xr){Object.defineProperty(Xr,"__esModule",{value:!0});Xr.CodeGen=Xr.Name=Xr.nil=Xr.stringify=Xr.str=Xr._=Xr.KeywordCxt=void 0;var x2=ws();Object.defineProperty(Xr,"KeywordCxt",{enumerable:!0,get:function(){return x2.KeywordCxt}});var Ps=$e();Object.defineProperty(Xr,"_",{enumerable:!0,get:function(){return Ps._}});Object.defineProperty(Xr,"str",{enumerable:!0,get:function(){return Ps.str}});Object.defineProperty(Xr,"stringify",{enumerable:!0,get:function(){return Ps.stringify}});Object.defineProperty(Xr,"nil",{enumerable:!0,get:function(){return Ps.nil}});Object.defineProperty(Xr,"Name",{enumerable:!0,get:function(){return Ps.Name}});Object.defineProperty(Xr,"CodeGen",{enumerable:!0,get:function(){return Ps.CodeGen}});var C2=za(),sE=Es(),iE=kh(),Or=Ta(),aE=$e(),xr=Ea(),xn=Ra(),zs=ke(),tE=PR(),A2=eE(),cE=(e,t)=>new RegExp(e,t);cE.code="new RegExp";var N2=["removeAdditional","useDefaults","coerceTypes"],j2=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),q2={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."},M2={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},rE=200;function L2(e){var t,r,n,o,s,i,a,c,u,l,d,p,m,h,g,_,y,S,v,w,z,R,b,E,x;let q=e.strict,C=(t=e.code)===null||t===void 0?void 0:t.optimize,F=C===!0||C===void 0?1:C||0,B=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:cE,Z=(o=e.uriResolver)!==null&&o!==void 0?o:A2.default;return{strictSchema:(i=(s=e.strictSchema)!==null&&s!==void 0?s:q)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=e.strictNumbers)!==null&&a!==void 0?a:q)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=e.strictTypes)!==null&&u!==void 0?u:q)!==null&&l!==void 0?l:"log",strictTuples:(p=(d=e.strictTuples)!==null&&d!==void 0?d:q)!==null&&p!==void 0?p:"log",strictRequired:(h=(m=e.strictRequired)!==null&&m!==void 0?m:q)!==null&&h!==void 0?h:!1,code:e.code?{...e.code,optimize:F,regExp:B}:{optimize:F,regExp:B},loopRequired:(g=e.loopRequired)!==null&&g!==void 0?g:rE,loopEnum:(_=e.loopEnum)!==null&&_!==void 0?_:rE,meta:(y=e.meta)!==null&&y!==void 0?y:!0,messages:(S=e.messages)!==null&&S!==void 0?S:!0,inlineRefs:(v=e.inlineRefs)!==null&&v!==void 0?v:!0,schemaId:(w=e.schemaId)!==null&&w!==void 0?w:"$id",addUsedSchema:(z=e.addUsedSchema)!==null&&z!==void 0?z:!0,validateSchema:(R=e.validateSchema)!==null&&R!==void 0?R:!0,validateFormats:(b=e.validateFormats)!==null&&b!==void 0?b:!0,unicodeRegExp:(E=e.unicodeRegExp)!==null&&E!==void 0?E:!0,int32range:(x=e.int32range)!==null&&x!==void 0?x:!0,uriResolver:Z}}class wd{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...L2(e)};let{es5:t,lines:r}=this.opts.code;this.scope=new aE.ValueScope({scope:{},prefixes:j2,es5:t,lines:r}),this.logger=Z2(e.logger);let n=e.validateFormats;if(e.validateFormats=!1,this.RULES=iE.getRules(),nE.call(this,q2,e,"NOT SUPPORTED"),nE.call(this,M2,e,"DEPRECATED","warn"),this._metaOpts=V2.call(this),e.formats)U2.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords)F2.call(this,e.keywords);if(typeof e.meta=="object")this.addMetaSchema(e.meta);D2.call(this),e.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:r}=this.opts,n=tE;if(r==="id")n={...tE},n.id=n.$id,delete n.$id;if(t&&e)this.addMetaSchema(n,n[r],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[t]||e:void 0}validate(e,t){let r;if(typeof e=="string"){if(r=this.getSchema(e),!r)throw Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);let n=r(t);if(!("$async"in r))this.errors=r.errors;return n}compile(e,t){let r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:r}=this.opts;return n.call(this,e,t);async function n(u,l){await o.call(this,u.$schema);let d=this._addSchema(u,l);return d.validate||s.call(this,d)}async function o(u){if(u&&!this.getSchema(u))await n.call(this,{$ref:u},!0)}async function s(u){try{return this._compileSchemaEnv(u)}catch(l){if(!(l instanceof sE.default))throw l;return i.call(this,l),await a.call(this,l.missingSchema),s.call(this,u)}}function i({missingSchema:u,missingRef:l}){if(this.refs[u])throw Error(`AnySchema ${u} is loaded but ${l} cannot be resolved`)}async function a(u){let l=await c.call(this,u);if(!this.refs[u])await o.call(this,l.$schema);if(!this.refs[u])this.addSchema(l,u,t)}async function c(u){let l=this._loading[u];if(l)return l;try{return await(this._loading[u]=r(u))}finally{delete this._loading[u]}}}addSchema(e,t,r,n=this.opts.validateSchema){if(Array.isArray(e)){for(let s of e)this.addSchema(s,void 0,r,n);return this}let o;if(typeof e==="object"){let{schemaId:s}=this.opts;if(o=e[s],o!==void 0&&typeof o!="string")throw Error(`schema ${s} must be string`)}return t=xr.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=oE.call(this,e))=="string")e=t;if(t===void 0){let{schemaId:r}=this.opts,n=new Or.SchemaEnv({schema:{},schemaId:r});if(t=Or.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=oE.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=xr.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(J2.call(this,r,t),!t)return zs.eachItem(r,(o)=>tg.call(this,o)),this;B2.call(this,t);let n={...t,type:xn.getJSONTypes(t.type),schemaType:xn.getJSONTypes(t.schemaType)};return zs.eachItem(r,n.type.length===0?(o)=>tg.call(this,o,n):(o)=>n.type.forEach((s)=>tg.call(this,o,n,s))),this}getKeyword(e){let t=this.RULES.all[e];return typeof t=="object"?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(let r of t.rules){let n=r.rules.findIndex((o)=>o.keyword===e);if(n>=0)r.rules.splice(n,1)}return this}addFormat(e,t){if(typeof t=="string")t=new RegExp(t);return this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){if(!e||e.length===0)return"No errors";return e.map((n)=>`${r}${n.instancePath} ${n.message}`).reduce((n,o)=>n+t+o)}$dataMetaSchema(e,t){let r=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let n of t){let o=n.split("/").slice(1),s=e;for(let i of o)s=s[i];for(let i in r){let a=r[i];if(typeof a!="object")continue;let{$data:c}=a.definition,u=s[i];if(c&&u)s[i]=uE(u)}}return e}_removeAllSchemas(e,t){for(let r in e){let n=e[r];if(!t||t.test(r)){if(typeof n=="string")delete e[r];else if(n&&!n.meta)this._cache.delete(n.schema),delete e[r]}}}_addSchema(e,t,r,n=this.opts.validateSchema,o=this.opts.addUsedSchema){let s,{schemaId:i}=this.opts;if(typeof e=="object")s=e[i];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof e!="boolean")throw Error("schema must be object or boolean");let a=this._cache.get(e);if(a!==void 0)return a;r=xr.normalizeId(s||r);let c=xr.getSchemaRefs.call(this,e,r);if(a=new Or.SchemaEnv({schema:e,schemaId:i,meta:t,baseId:r,localRefs:c}),this._cache.set(a.schema,a),o&&!r.startsWith("#")){if(r)this._checkUnique(r);this.refs[r]=a}if(n)this.validateSchema(e,!0);return a}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta)this._compileMetaSchema(e);else Or.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{Or.compileSchema.call(this,e)}finally{this.opts=t}}}wd.ValidationError=C2.default;wd.MissingRefError=sE.default;Xr.default=wd;function nE(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 oE(e){return e=xr.normalizeId(e),this.schemas[e]||this.refs[e]}function D2(){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 U2(){for(let e in this.opts.formats){let t=this.opts.formats[e];if(t)this.addFormat(e,t)}}function F2(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 V2(){let e={...this.opts};for(let t of N2)delete e[t];return e}var H2={log(){},warn(){},error(){}};function Z2(e){if(e===!1)return H2;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 G2=/^[a-z_$][a-z0-9_$:-]*$/i;function J2(e,t){let{RULES:r}=this;if(zs.eachItem(e,(n)=>{if(r.keywords[n])throw Error(`Keyword ${n} is already defined`);if(!G2.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 tg(e,t,r){var n;let o=t===null||t===void 0?void 0:t.post;if(r&&o)throw Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,i=o?s.post:s.rules.find(({type:c})=>c===r);if(!i)i={type:r,rules:[]},s.rules.push(i);if(s.keywords[e]=!0,!t)return;let a={keyword:e,definition:{...t,type:xn.getJSONTypes(t.type),schemaType:xn.getJSONTypes(t.schemaType)}};if(t.before)K2.call(this,i,a,t.before);else i.rules.push(a);s.all[e]=a,(n=t.implements)===null||n===void 0||n.forEach((c)=>this.addKeyword(c))}function K2(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 B2(e){let{metaSchema:t}=e;if(t===void 0)return;if(e.$data&&this.opts.$data)t=uE(t);e.validateSchema=this.compile(t,!0)}var W2={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function uE(e){return{anyOf:[e,W2]}}});var dE=D(function(lE){Object.defineProperty(lE,"__esModule",{value:!0});var Q2={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};lE.default=Q2});var Pd=D(function(fE){Object.defineProperty(fE,"__esModule",{value:!0});fE.callRef=fE.getValidate=void 0;var tD=Es(),Ed=sr(),De=$e(),Ts=nr(),zd=Ta(),Cn=ke(),rD={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:n}=e,{baseId:o,schemaEnv:s,validateName:i,opts:a,self:c}=n,{root:u}=s;if((r==="#"||r==="#/")&&o===u.baseId)return d();let l=zd.resolveRef.call(c,u,o,r);if(l===void 0)throw new tD.default(n.opts.uriResolver,o,r);if(l instanceof zd.SchemaEnv)return p(l);return m(l);function d(){if(s===u)return Rd(e,i,s,s.$async);let h=t.scopeValue("root",{ref:u});return Rd(e,De._`${h}.validate`,u,u.$async)}function p(h){let g=pE(e,h);Rd(e,g,h,h.$async)}function m(h){let g=t.scopeValue("schema",a.code.source===!0?{ref:h,code:De.stringify(h)}:{ref:h}),_=t.name("valid"),y=e.subschema({schema:h,dataTypes:[],schemaPath:De.nil,topSchemaRef:g,errSchemaPath:r},_);e.mergeEvaluated(y),e.ok(_)}}};function pE(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):De._`${r.scopeValue("wrapper",{ref:t})}.validate`}fE.getValidate=pE;function Rd(e,t,r,n){let{gen:o,it:s}=e,{allErrors:i,schemaEnv:a,opts:c}=s,u=c.passContext?Ts.default.this:De.nil;if(n)l();else d();function l(){if(!a.$async)throw Error("async schema referenced by sync schema");let h=o.let("valid");o.try(()=>{if(o.code(De._`await ${Ed.callValidateCode(e,t,u)}`),m(t),!i)o.assign(h,!0)},(g)=>{if(o.if(De._`!(${g} instanceof ${s.ValidationError})`,()=>o.throw(g)),p(g),!i)o.assign(h,!1)}),e.ok(h)}function d(){e.result(Ed.callValidateCode(e,t,u),()=>m(t),()=>p(t))}function p(h){let g=De._`${h}.errors`;o.assign(Ts.default.vErrors,De._`${Ts.default.vErrors} === null ? ${g} : ${Ts.default.vErrors}.concat(${g})`),o.assign(Ts.default.errors,De._`${Ts.default.vErrors}.length`)}function m(h){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=Cn.mergeEvaluated.props(o,_.props,s.props)}else{let y=o.var("props",De._`${h}.evaluated.props`);s.props=Cn.mergeEvaluated.props(o,y,s.props,De.Name)}if(s.items!==!0)if(_&&!_.dynamicItems){if(_.items!==void 0)s.items=Cn.mergeEvaluated.items(o,_.items,s.items)}else{let y=o.var("items",De._`${h}.evaluated.items`);s.items=Cn.mergeEvaluated.items(o,y,s.items,De.Name)}}}fE.callRef=Rd;fE.default=rD});var ng=D(function(hE){Object.defineProperty(hE,"__esModule",{value:!0});var sD=dE(),iD=Pd(),aD=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",sD.default,iD.default];hE.default=aD});var yE=D(function(gE){Object.defineProperty(gE,"__esModule",{value:!0});var Nn=$e(),An=Nn.operators,Td={maximum:{okStr:"<=",ok:An.LTE,fail:An.GT},minimum:{okStr:">=",ok:An.GTE,fail:An.LT},exclusiveMaximum:{okStr:"<",ok:An.LT,fail:An.GTE},exclusiveMinimum:{okStr:">",ok:An.GT,fail:An.LTE}},uD={message:({keyword:e,schemaCode:t})=>Nn.str`must be ${Td[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>Nn._`{comparison: ${Td[e].okStr}, limit: ${t}}`},lD={keyword:Object.keys(Td),type:"number",schemaType:"number",$data:!0,error:uD,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data(Nn._`${r} ${Td[t].fail} ${n} || isNaN(${r})`)}};gE.default=lD});var vE=D(function(_E){Object.defineProperty(_E,"__esModule",{value:!0});var Cr=$e(),pD={message:({schemaCode:e})=>Cr.str`must be multiple of ${e}`,params:({schemaCode:e})=>Cr._`{multipleOf: ${e}}`},fD={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:pD,code(e){let{gen:t,data:r,schemaCode:n,it:o}=e,s=o.opts.multipleOfPrecision,i=t.let("res"),a=s?Cr._`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:Cr._`${i} !== parseInt(${i})`;e.fail$data(Cr._`(${n} === 0 || (${i} = ${r}/${n}, ${a}))`)}};_E.default=fD});var $E=D(function(bE){Object.defineProperty(bE,"__esModule",{value:!0});function SE(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}bE.default=SE;SE.code='require("ajv/dist/runtime/ucs2length").default'});var EE=D(function(RE){Object.defineProperty(RE,"__esModule",{value:!0});var Ht=$e(),wE=ke(),gD=$E(),yD={message({keyword:e,schemaCode:t}){return Ht.str`must NOT have ${e==="maxLength"?"more":"fewer"} than ${t} characters`},params:({schemaCode:e})=>Ht._`{limit: ${e}}`},_D={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:yD,code(e){let{keyword:t,data:r,schemaCode:n,it:o}=e,s=t==="maxLength"?Ht.operators.GT:Ht.operators.LT,i=o.opts.unicode===!1?Ht._`${r}.length`:Ht._`${wE.useFunc(e.gen,gD.default)}(${r})`;e.fail$data(Ht._`${i} ${s} ${n}`)}};RE.default=_D});var IE=D(function(TE){Object.defineProperty(TE,"__esModule",{value:!0});var zE=sr(),PE=ke(),ir=$e(),SD={message:({schemaCode:e})=>ir.str`must match pattern "${e}"`,params:({schemaCode:e})=>ir._`{pattern: ${e}}`},bD={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:SD,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:s,it:i}=e,a=i.opts.unicodeRegExp?"u":"";if(n){let{regExp:c}=i.opts.code,u=c.code==="new RegExp"?ir._`new RegExp`:PE.useFunc(t,c),l=t.let("valid");t.try(()=>t.assign(l,ir._`${u}(${s}, ${a}).test(${r})`),()=>t.assign(l,!1)),e.fail$data(ir._`!${l}`)}else{let c=zE.usePattern(e,o);e.fail$data(ir._`!${c}.test(${r})`)}}};TE.default=bD});var OE=D(function(kE){Object.defineProperty(kE,"__esModule",{value:!0});var Ar=$e(),wD={message({keyword:e,schemaCode:t}){return Ar.str`must NOT have ${e==="maxProperties"?"more":"fewer"} than ${t} properties`},params:({schemaCode:e})=>Ar._`{limit: ${e}}`},RD={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:wD,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxProperties"?Ar.operators.GT:Ar.operators.LT;e.fail$data(Ar._`Object.keys(${r}).length ${o} ${n}`)}};kE.default=RD});var AE=D(function(CE){Object.defineProperty(CE,"__esModule",{value:!0});var Nr=sr(),jr=$e(),xE=ke(),zD={message:({params:{missingProperty:e}})=>jr.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>jr._`{missingProperty: ${e}}`},PD={keyword:"required",type:"object",schemaType:"array",$data:!0,error:zD,code(e){let{gen:t,schema:r,schemaCode:n,data:o,$data:s,it:i}=e,{opts:a}=i;if(!s&&r.length===0)return;let c=r.length>=a.loopRequired;if(i.allErrors)u();else l();if(a.strictRequired){let m=e.parentSchema.properties,{definedProperties:h}=e.it;for(let g of r)if((m===null||m===void 0?void 0:m[g])===void 0&&!h.has(g)){let _=i.schemaEnv.baseId+i.errSchemaPath,y=`required property "${g}" is not defined at "${_}" (strictRequired)`;xE.checkStrictMode(i,y,i.opts.strictRequired)}}function u(){if(c||s)e.block$data(jr.nil,d);else for(let m of r)Nr.checkReportMissingProp(e,m)}function l(){let m=t.let("missing");if(c||s){let h=t.let("valid",!0);e.block$data(h,()=>p(m,h)),e.ok(h)}else t.if(Nr.checkMissingProp(e,r,m)),Nr.reportMissingProp(e,m),t.else()}function d(){t.forOf("prop",n,(m)=>{e.setParams({missingProperty:m}),t.if(Nr.noPropertyInData(t,o,m,a.ownProperties),()=>e.error())})}function p(m,h){e.setParams({missingProperty:m}),t.forOf(m,n,()=>{t.assign(h,Nr.propertyInData(t,o,m,a.ownProperties)),t.if(jr.not(h),()=>{e.error(),t.break()})},jr.nil)}}};CE.default=PD});var jE=D(function(NE){Object.defineProperty(NE,"__esModule",{value:!0});var qr=$e(),ID={message({keyword:e,schemaCode:t}){return qr.str`must NOT have ${e==="maxItems"?"more":"fewer"} than ${t} items`},params:({schemaCode:e})=>qr._`{limit: ${e}}`},kD={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:ID,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxItems"?qr.operators.GT:qr.operators.LT;e.fail$data(qr._`${r}.length ${o} ${n}`)}};NE.default=kD});var Id=D(function(ME){Object.defineProperty(ME,"__esModule",{value:!0});var qE=qh();qE.code='require("ajv/dist/runtime/equal").default';ME.default=qE});var UE=D(function(DE){Object.defineProperty(DE,"__esModule",{value:!0});var Is=Ra(),Ce=$e(),LE=ke(),CD=Id(),AD={message:({params:{i:e,j:t}})=>Ce.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>Ce._`{i: ${e}, j: ${t}}`},ND={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:AD,code(e){let{gen:t,data:r,$data:n,schema:o,parentSchema:s,schemaCode:i,it:a}=e;if(!n&&!o)return;let c=t.let("valid"),u=s.items?Is.getSchemaTypes(s.items):[];e.block$data(c,l,Ce._`${i} === false`),e.ok(c);function l(){let h=t.let("i",Ce._`${r}.length`),g=t.let("j");e.setParams({i:h,j:g}),t.assign(c,!0),t.if(Ce._`${h} > 1`,()=>(d()?p:m)(h,g))}function d(){return u.length>0&&!u.some((h)=>h==="object"||h==="array")}function p(h,g){let _=t.name("item"),y=Is.checkDataTypes(u,_,a.opts.strictNumbers,Is.DataType.Wrong),S=t.const("indices",Ce._`{}`);t.for(Ce._`;${h}--;`,()=>{if(t.let(_,Ce._`${r}[${h}]`),t.if(y,Ce._`continue`),u.length>1)t.if(Ce._`typeof ${_} == "string"`,Ce._`${_} += "_"`);t.if(Ce._`typeof ${S}[${_}] == "number"`,()=>{t.assign(g,Ce._`${S}[${_}]`),e.error(),t.assign(c,!1).break()}).code(Ce._`${S}[${_}] = ${h}`)})}function m(h,g){let _=LE.useFunc(t,CD.default),y=t.name("outer");t.label(y).for(Ce._`;${h}--;`,()=>t.for(Ce._`${g} = ${h}; ${g}--;`,()=>t.if(Ce._`${_}(${r}[${h}], ${r}[${g}])`,()=>{e.error(),t.assign(c,!1).break(y)})))}}};DE.default=ND});var HE=D(function(VE){Object.defineProperty(VE,"__esModule",{value:!0});var ks=$e(),FE=ke(),qD=Id(),MD={message:"must be equal to constant",params:({schemaCode:e})=>ks._`{allowedValue: ${e}}`},LD={keyword:"const",$data:!0,error:MD,code(e){let{gen:t,data:r,$data:n,schemaCode:o,schema:s}=e;if(n||s&&typeof s=="object")e.fail$data(ks._`!${FE.useFunc(t,qD.default)}(${r}, ${o})`);else e.fail(ks._`${s} !== ${r}`)}};VE.default=LD});var JE=D(function(GE){Object.defineProperty(GE,"__esModule",{value:!0});var Mr=$e(),ZE=ke(),UD=Id(),FD={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>Mr._`{allowedValues: ${e}}`},VD={keyword:"enum",schemaType:"array",$data:!0,error:FD,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:s,it:i}=e;if(!n&&o.length===0)throw Error("enum must have non-empty array");let a=o.length>=i.opts.loopEnum,c,u=()=>c!==null&&c!==void 0?c:c=ZE.useFunc(t,UD.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 m=t.const("vSchema",s);l=Mr.or(...o.map((h,g)=>p(m,g)))}e.pass(l);function d(){t.assign(l,!1),t.forOf("v",s,(m)=>t.if(Mr._`${u()}(${r}, ${m})`,()=>t.assign(l,!0).break()))}function p(m,h){let g=o[h];return typeof g==="object"&&g!==null?Mr._`${u()}(${r}, ${m}[${h}])`:Mr._`${r} === ${g}`}}};GE.default=VD});var og=D(function(KE){Object.defineProperty(KE,"__esModule",{value:!0});var ZD=yE(),GD=vE(),JD=EE(),KD=IE(),BD=OE(),WD=AE(),YD=jE(),XD=UE(),QD=HE(),eU=JE(),tU=[ZD.default,GD.default,JD.default,KD.default,BD.default,WD.default,YD.default,XD.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},QD.default,eU.default];KE.default=tU});var sg=D(function(WE){Object.defineProperty(WE,"__esModule",{value:!0});WE.validateAdditionalItems=void 0;var Zt=$e(),Os=ke(),nU={message:({params:{len:e}})=>Zt.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Zt._`{limit: ${e}}`},oU={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:nU,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){Os.checkStrictMode(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}BE(e,n)}};function BE(e,t){let{gen:r,schema:n,data:o,keyword:s,it:i}=e;i.items=!0;let a=r.const("len",Zt._`${o}.length`);if(n===!1)e.setParams({len:t.length}),e.pass(Zt._`${a} <= ${t.length}`);else if(typeof n=="object"&&!Os.alwaysValidSchema(i,n)){let u=r.var("valid",Zt._`${a} <= ${t.length}`);r.if(Zt.not(u),()=>c(u)),e.ok(u)}function c(u){r.forRange("i",t.length,a,(l)=>{if(e.subschema({keyword:s,dataProp:l,dataPropType:Os.Type.Num},u),!i.allErrors)r.if(Zt.not(u),()=>r.break())})}}WE.validateAdditionalItems=BE;WE.default=oU});var ig=D(function(ez){Object.defineProperty(ez,"__esModule",{value:!0});ez.validateTuple=void 0;var kd=$e(),jn=ke(),XE=sr(),iU={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return QE(e,"additionalItems",t);if(r.items=!0,jn.alwaysValidSchema(r,t))return;e.ok(XE.validateArray(e))}};function QE(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=jn.mergeEvaluated.items(n,r.length,a.items);let c=n.name("valid"),u=n.const("len",kd._`${s}.length`);r.forEach((d,p)=>{if(jn.alwaysValidSchema(a,d))return;n.if(kd._`${u} > ${p}`,()=>e.subschema({keyword:i,schemaProp:p,dataProp:p},c)),e.ok(c)});function l(d){let{opts:p,errSchemaPath:m}=a,h=r.length,g=h===d.minItems&&(h===d.maxItems||d[t]===!1);if(p.strictTuples&&!g){let _=`"${i}" is ${h}-tuple, but minItems or maxItems/${t} are not specified or different at path "${m}"`;jn.checkStrictMode(a,_,p.strictTuples)}}}ez.validateTuple=QE;ez.default=iU});var oz=D(function(nz){Object.defineProperty(nz,"__esModule",{value:!0});var rz=ig(),cU={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(e)=>rz.validateTuple(e,"items")};nz.default=cU});var uz=D(function(cz){Object.defineProperty(cz,"__esModule",{value:!0});var Od=$e(),sz=ke(),iz=sr(),az=sg(),lU={message:({params:{len:e}})=>Od.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Od._`{limit: ${e}}`},dU={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:lU,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:o}=r;if(n.items=!0,sz.alwaysValidSchema(n,t))return;if(o)az.validateAdditionalItems(e,o);else e.ok(iz.validateArray(e))}};cz.default=dU});var dz=D(function(lz){Object.defineProperty(lz,"__esModule",{value:!0});var Be=$e(),qn=ke(),fU={message:({params:{min:e,max:t}})=>t===void 0?Be.str`must contain at least ${e} valid item(s)`:Be.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?Be._`{minContains: ${e}}`:Be._`{minContains: ${e}, maxContains: ${t}}`},mU={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:fU,code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:s}=e,i,a,{minContains:c,maxContains:u}=n;if(s.opts.next)i=c===void 0?1:c,a=u;else i=1;let l=t.const("len",Be._`${o}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){qn.checkStrictMode(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){qn.checkStrictMode(s,'"minContains" > "maxContains" is always invalid'),e.fail();return}if(qn.alwaysValidSchema(s,r)){let g=Be._`${l} >= ${i}`;if(a!==void 0)g=Be._`${g} && ${l} <= ${a}`;e.pass(g);return}s.items=!0;let d=t.name("valid");if(a===void 0&&i===1)m(d,()=>t.if(d,()=>t.break()));else if(i===0){if(t.let(d,!0),a!==void 0)t.if(Be._`${o}.length > 0`,p)}else t.let(d,!1),p();e.result(d,()=>e.reset());function p(){let g=t.name("_valid"),_=t.let("count",0);m(g,()=>t.if(g,()=>h(_)))}function m(g,_){t.forRange("i",0,l,(y)=>{e.subschema({keyword:"contains",dataProp:y,dataPropType:qn.Type.Num,compositeRule:!0},g),_()})}function h(g){if(t.code(Be._`${g}++`),a===void 0)t.if(Be._`${g} >= ${i}`,()=>t.assign(d,!0).break());else if(t.if(Be._`${g} > ${a}`,()=>t.assign(d,!1).break()),i===1)t.assign(d,!0);else t.if(Be._`${g} >= ${i}`,()=>t.assign(d,!0))}}};lz.default=mU});var xd=D(function(hz){Object.defineProperty(hz,"__esModule",{value:!0});hz.validateSchemaDeps=hz.validatePropertyDeps=hz.error=void 0;var xs=$e(),pz=ke(),Lr=sr();hz.error={message:({params:{property:e,depsCount:t,deps:r}})=>xs.str`must have ${t===1?"property":"properties"} ${r} when property ${e} is present`,params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>xs._`{property: ${e},
7
+ missingProperty: ${n},
8
8
  depsCount: ${t},
9
- deps: ${r}}`};var fD={keyword:"dependencies",type:"object",schemaType:"object",error:jE.error,code(e){let[t,r]=mD(e);NE(e,t),AE(e,r)}};function mD({schema:e}){let t={},r={};for(let o in e){if(o==="__proto__")continue;let n=Array.isArray(e[o])?t:r;n[o]=e[o]}return[t,r]}function NE(e,t=e.schema){let{gen:r,data:o,it:n}=e;if(Object.keys(t).length===0)return;let s=r.let("missing");for(let i in t){let a=t[i];if(a.length===0)continue;let c=Ar.propertyInData(r,o,i,n.opts.ownProperties);if(e.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),n.allErrors)r.if(c,()=>{for(let u of a)Ar.checkReportMissingProp(e,u)});else r.if(zs._`${c} && (${Ar.checkMissingProp(e,a,s)})`),Ar.reportMissingProp(e,s),r.else()}}jE.validatePropertyDeps=NE;function AE(e,t=e.schema){let{gen:r,data:o,keyword:n,it:s}=e,i=r.name("valid");for(let a in t){if(xE.alwaysValidSchema(s,t[a]))continue;r.if(Ar.propertyInData(r,o,a,s.opts.ownProperties),()=>{let c=e.subschema({keyword:n,schemaProp:a},i);e.mergeValidEvaluated(c,i)},()=>r.var(i,!0)),e.ok(i)}}jE.validateSchemaDeps=AE;jE.default=fD});var UE=D(function(DE){Object.defineProperty(DE,"__esModule",{value:!0});var $d=$e(),LE=ke(),yD={message:"property name must be valid",params:({params:e})=>$d._`{propertyName: ${e.propertyName}}`},_D={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:yD,code(e){let{gen:t,schema:r,data:o,it:n}=e;if(LE.alwaysValidSchema(n,r))return;let s=t.name("valid");t.forIn("key",o,(i)=>{e.setParams({propertyName:i}),e.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},s),t.if($d.not(s),()=>{if(e.error(!0),!n.allErrors)t.break()})}),e.ok(s)}};DE.default=_D});var Uh=D(function(FE){Object.defineProperty(FE,"__esModule",{value:!0});var Ao=or(),nt=$e(),SD=tr(),jo=ke(),bD={message:"must NOT have additional properties",params:({params:e})=>nt._`{additionalProperty: ${e.additionalProperty}}`},$D={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:bD,code(e){let{gen:t,schema:r,parentSchema:o,data:n,errsCount:s,it:i}=e;if(!s)throw Error("ajv implementation error");let{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&jo.alwaysValidSchema(i,r))return;let u=Ao.allSchemaProperties(o.properties),l=Ao.allSchemaProperties(o.patternProperties);d(),e.ok(nt._`${s} === ${SD.default.errors}`);function d(){t.forIn("key",n,(_)=>{if(!u.length&&!l.length)h(_);else t.if(f(_),()=>h(_))})}function f(_){let y;if(u.length>8){let S=jo.schemaRefOrVal(i,o.properties,"properties");y=Ao.isOwnProperty(t,S,_)}else if(u.length)y=nt.or(...u.map((S)=>nt._`${_} === ${S}`));else y=nt.nil;if(l.length)y=nt.or(y,...l.map((S)=>nt._`${Ao.usePattern(e,S)}.test(${_})`));return nt.not(y)}function m(_){t.code(nt._`delete ${n}[${_}]`)}function h(_){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){m(_);return}if(r===!1){if(e.setParams({additionalProperty:_}),e.error(),!a)t.break();return}if(typeof r=="object"&&!jo.alwaysValidSchema(i,r)){let y=t.name("valid");if(c.removeAdditional==="failing")g(_,y,!1),t.if(nt.not(y),()=>{e.reset(),m(_)});else if(g(_,y),!a)t.if(nt.not(y),()=>t.break())}}function g(_,y,S){let v={keyword:"additionalProperties",dataProp:_,dataPropType:jo.Type.Str};if(S===!1)Object.assign(v,{compositeRule:!0,createErrors:!1,allErrors:!1});e.subschema(v,y)}}};FE.default=$D});var GE=D(function(HE){Object.defineProperty(HE,"__esModule",{value:!0});var ZE=ys(),wd=or(),Ps=ke(),VE=Uh(),RD={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:o,data:n,it:s}=e;if(s.opts.removeAdditional==="all"&&o.additionalProperties===void 0)VE.default.code(new ZE.KeywordCxt(s,VE.default,"additionalProperties"));let i=wd.allSchemaProperties(r);for(let d of i)s.definedProperties.add(d);if(s.opts.unevaluated&&i.length&&s.props!==!0)s.props=Ps.mergeEvaluated.props(t,Ps.toHash(i),s.props);let a=i.filter((d)=>!Ps.alwaysValidSchema(s,r[d]));if(a.length===0)return;let c=t.name("valid");for(let d of a){if(u(d))l(d);else{if(t.if(wd.propertyInData(t,n,d,s.opts.ownProperties)),l(d),!s.allErrors)t.else().var(c,!0);t.endIf()}e.it.definedProperties.add(d),e.ok(c)}function u(d){return s.opts.useDefaults&&!s.compositeRule&&r[d].default!==void 0}function l(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};HE.default=RD});var KE=D(function(JE){Object.defineProperty(JE,"__esModule",{value:!0});var Rd=or(),qo=$e(),Ed=ke(),zd=ke(),zD={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:o,parentSchema:n,it:s}=e,{opts:i}=s,a=Rd.allSchemaProperties(r),c=a.filter((g)=>Ed.alwaysValidSchema(s,r[g]));if(a.length===0||c.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let u=i.strictSchema&&!i.allowMatchingProperties&&n.properties,l=t.name("valid");if(s.props!==!0&&!(s.props instanceof qo.Name))s.props=zd.evaluatedPropsToName(t,s.props);let{props:d}=s;f();function f(){for(let g of a){if(u)m(g);if(s.allErrors)h(g);else t.var(l,!0),h(g),t.if(l)}}function m(g){for(let _ in u)if(new RegExp(g).test(_))Ed.checkStrictMode(s,`property ${_} matches pattern ${g} (use allowMatchingProperties)`)}function h(g){t.forIn("key",o,(_)=>{t.if(qo._`${Rd.usePattern(e,g)}.test(${_})`,()=>{let y=c.includes(g);if(!y)e.subschema({keyword:"patternProperties",schemaProp:g,dataProp:_,dataPropType:zd.Type.Str},l);if(s.opts.unevaluated&&d!==!0)t.assign(qo._`${d}[${_}]`,!0);else if(!y&&!s.allErrors)t.if(qo.not(l),()=>t.break())})})}}};JE.default=zD});var YE=D(function(WE){Object.defineProperty(WE,"__esModule",{value:!0});var BE=ke(),TD={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:o}=e;if(BE.alwaysValidSchema(o,r)){e.fail();return}let n=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),e.failResult(n,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};WE.default=TD});var ez=D(function(QE){Object.defineProperty(QE,"__esModule",{value:!0});var XE=or(),kD={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:XE.validateUnion,error:{message:"must match a schema in anyOf"}};QE.default=kD});var oz=D(function(rz){Object.defineProperty(rz,"__esModule",{value:!0});var Mo=$e(),tz=ke(),CD={message:"must match exactly one schema in oneOf",params:({params:e})=>Mo._`{passingSchemas: ${e.passing}}`},xD={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:CD,code(e){let{gen:t,schema:r,parentSchema:o,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(n.opts.discriminator&&o.discriminator)return;let s=r,i=t.let("valid",!1),a=t.let("passing",null),c=t.name("_valid");e.setParams({passing:a}),t.block(u),e.result(i,()=>e.reset(),()=>e.error(!0));function u(){s.forEach((l,d)=>{let f;if(tz.alwaysValidSchema(n,l))t.var(c,!0);else f=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c);if(d>0)t.if(Mo._`${c} && ${i}`).assign(i,!1).assign(a,Mo._`[${a}, ${d}]`).else();t.if(c,()=>{if(t.assign(i,!0),t.assign(a,d),f)e.mergeEvaluated(f,Mo.Name)})})}}};rz.default=xD});var iz=D(function(sz){Object.defineProperty(sz,"__esModule",{value:!0});var nz=ke(),AD={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:o}=e;if(!Array.isArray(r))throw Error("ajv implementation error");let n=t.name("valid");r.forEach((s,i)=>{if(nz.alwaysValidSchema(o,s))return;let a=e.subschema({keyword:"allOf",schemaProp:i},n);e.ok(n),e.mergeEvaluated(a)})}};sz.default=AD});var uz=D(function(cz){Object.defineProperty(cz,"__esModule",{value:!0});var Lo=$e(),Pd=ke(),qD={message:({params:e})=>Lo.str`must match "${e.ifClause}" schema`,params:({params:e})=>Lo._`{failingKeyword: ${e.ifClause}}`},MD={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:qD,code(e){let{gen:t,parentSchema:r,it:o}=e;if(r.then===void 0&&r.else===void 0)Pd.checkStrictMode(o,'"if" without "then" and "else" is ignored');let n=az(o,"then"),s=az(o,"else");if(!n&&!s)return;let i=t.let("valid",!0),a=t.name("_valid");if(c(),e.reset(),n&&s){let l=t.let("ifClause");e.setParams({ifClause:l}),t.if(a,u("then",l),u("else",l))}else if(n)t.if(a,u("then"));else t.if(Lo.not(a),u("else"));e.pass(i,()=>e.error(!0));function c(){let l=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(l)}function u(l,d){return()=>{let f=e.subschema({keyword:l},a);if(t.assign(i,a),e.mergeValidEvaluated(f,i),d)t.assign(d,Lo._`${l}`);else e.setParams({ifClause:l})}}}};function az(e,t){let r=e.schema[t];return r!==void 0&&!Pd.alwaysValidSchema(e,r)}cz.default=MD});var pz=D(function(dz){Object.defineProperty(dz,"__esModule",{value:!0});var lz=ke(),DD={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){if(t.if===void 0)lz.checkStrictMode(r,`"${e}" without "if" is ignored`)}};dz.default=DD});var Fh=D(function(fz){Object.defineProperty(fz,"__esModule",{value:!0});var FD=Lh(),VD=EE(),ZD=Dh(),HD=kE(),GD=CE(),JD=bd(),KD=UE(),BD=Uh(),WD=GE(),YD=KE(),XD=YE(),QD=ez(),eU=oz(),tU=iz(),rU=uz(),oU=pz();function nU(e=!1){let t=[XD.default,QD.default,eU.default,tU.default,rU.default,oU.default,KD.default,BD.default,JD.default,WD.default,YD.default];if(e)t.push(VD.default,HD.default);else t.push(FD.default,ZD.default);return t.push(GD.default),t}fz.default=nU});var Vh=D(function(gz){Object.defineProperty(gz,"__esModule",{value:!0});gz.dynamicAnchor=void 0;var Ts=$e(),iU=tr(),Td=ba(),mz=gd(),aU={keyword:"$dynamicAnchor",schemaType:"string",code:(e)=>hz(e,e.schema)};function hz(e,t){let{gen:r,it:o}=e;o.schemaEnv.root.dynamicAnchors[t]=!0;let n=Ts._`${iU.default.dynamicAnchors}${Ts.getProperty(t)}`,s=o.errSchemaPath==="#"?o.validateName:cU(e);r.if(Ts._`!${n}`,()=>r.assign(n,s))}gz.dynamicAnchor=hz;function cU(e){let{schemaEnv:t,schema:r,self:o}=e.it,{root:n,baseId:s,localRefs:i,meta:a}=t.root,{schemaId:c}=o.opts,u=new Td.SchemaEnv({schema:r,schemaId:c,root:n,baseId:s,localRefs:i,meta:a});return Td.compileSchema.call(o,u),mz.getValidate(e,u)}gz.default=aU});var Zh=D(function(vz){Object.defineProperty(vz,"__esModule",{value:!0});vz.dynamicRef=void 0;var Id=$e(),lU=tr(),kd=gd(),dU={keyword:"$dynamicRef",schemaType:"string",code:(e)=>_z(e,e.schema)};function _z(e,t){let{gen:r,keyword:o,it:n}=e;if(t[0]!=="#")throw Error(`"${o}" only supports hash fragment reference`);let s=t.slice(1);if(n.allErrors)i();else{let c=r.let("valid",!1);i(c),e.ok(c)}function i(c){if(n.schemaEnv.root.dynamicAnchors[s]){let u=r.let("_v",Id._`${lU.default.dynamicAnchors}${Id.getProperty(s)}`);r.if(u,a(u,c),a(n.validateName,c))}else a(n.validateName,c)()}function a(c,u){return u?()=>r.block(()=>{kd.callRef(e,c),r.let(u,!0)}):()=>kd.callRef(e,c)}}vz.dynamicRef=_z;vz.default=dU});var Rz=D(function(wz){Object.defineProperty(wz,"__esModule",{value:!0});var bz=Vh(),$z=ke(),fU={keyword:"$recursiveAnchor",schemaType:"boolean",code(e){if(e.schema)bz.dynamicAnchor(e,"");else $z.checkStrictMode(e.it,"$recursiveAnchor: false is ignored")}};wz.default=fU});var Pz=D(function(zz){Object.defineProperty(zz,"__esModule",{value:!0});var Ez=Zh(),hU={keyword:"$recursiveRef",schemaType:"string",code:(e)=>Ez.dynamicRef(e,e.schema)};zz.default=hU});var Iz=D(function(Tz){Object.defineProperty(Tz,"__esModule",{value:!0});var yU=Vh(),_U=Zh(),vU=Rz(),SU=Pz(),bU=[yU.default,_U.default,vU.default,SU.default];Tz.default=bU});var Oz=D(function(kz){Object.defineProperty(kz,"__esModule",{value:!0});var Od=bd(),wU={keyword:"dependentRequired",type:"object",schemaType:"object",error:Od.error,code:(e)=>Od.validatePropertyDeps(e)};kz.default=wU});var Nz=D(function(xz){Object.defineProperty(xz,"__esModule",{value:!0});var Cz=bd(),EU={keyword:"dependentSchemas",type:"object",schemaType:"object",code:(e)=>Cz.validateSchemaDeps(e)};xz.default=EU});var qz=D(function(jz){Object.defineProperty(jz,"__esModule",{value:!0});var Az=ke(),PU={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:e,parentSchema:t,it:r}){if(t.contains===void 0)Az.checkStrictMode(r,`"${e}" without "contains" is ignored`)}};jz.default=PU});var Lz=D(function(Mz){Object.defineProperty(Mz,"__esModule",{value:!0});var IU=Oz(),kU=Nz(),OU=qz(),CU=[IU.default,kU.default,OU.default];Mz.default=CU});var Uz=D(function(Dz){Object.defineProperty(Dz,"__esModule",{value:!0});var Ot=$e(),Cd=ke(),NU=tr(),AU={message:"must NOT have unevaluated properties",params:({params:e})=>Ot._`{unevaluatedProperty: ${e.unevaluatedProperty}}`},jU={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:AU,code(e){let{gen:t,schema:r,data:o,errsCount:n,it:s}=e;if(!n)throw Error("ajv implementation error");let{allErrors:i,props:a}=s;if(a instanceof Ot.Name)t.if(Ot._`${a} !== true`,()=>t.forIn("key",o,(d)=>t.if(u(a,d),()=>c(d))));else if(a!==!0)t.forIn("key",o,(d)=>a===void 0?c(d):t.if(l(a,d),()=>c(d)));s.props=!0,e.ok(Ot._`${n} === ${NU.default.errors}`);function c(d){if(r===!1){if(e.setParams({unevaluatedProperty:d}),e.error(),!i)t.break();return}if(!Cd.alwaysValidSchema(s,r)){let f=t.name("valid");if(e.subschema({keyword:"unevaluatedProperties",dataProp:d,dataPropType:Cd.Type.Str},f),!i)t.if(Ot.not(f),()=>t.break())}}function u(d,f){return Ot._`!${d} || !${d}[${f}]`}function l(d,f){let m=[];for(let h in d)if(d[h]===!0)m.push(Ot._`${f} !== ${h}`);return Ot.and(...m)}}};Dz.default=jU});var Vz=D(function(Fz){Object.defineProperty(Fz,"__esModule",{value:!0});var Vt=$e(),xd=ke(),MU={message:({params:{len:e}})=>Vt.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Vt._`{limit: ${e}}`},LU={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:MU,code(e){let{gen:t,schema:r,data:o,it:n}=e,s=n.items||0;if(s===!0)return;let i=t.const("len",Vt._`${o}.length`);if(r===!1)e.setParams({len:s}),e.fail(Vt._`${i} > ${s}`);else if(typeof r=="object"&&!xd.alwaysValidSchema(n,r)){let c=t.var("valid",Vt._`${i} <= ${s}`);t.if(Vt.not(c),()=>a(c,s)),e.ok(c)}n.items=!0;function a(c,u){t.forRange("i",u,i,(l)=>{if(e.subschema({keyword:"unevaluatedItems",dataProp:l,dataPropType:xd.Type.Num},c),!n.allErrors)t.if(Vt.not(c),()=>t.break())})}}};Fz.default=LU});var Hz=D(function(Zz){Object.defineProperty(Zz,"__esModule",{value:!0});var UU=Uz(),FU=Vz(),VU=[UU.default,FU.default];Zz.default=VU});var Jz=D(function(Gz){Object.defineProperty(Gz,"__esModule",{value:!0});var ze=$e(),HU={message:({schemaCode:e})=>ze.str`must match format "${e}"`,params:({schemaCode:e})=>ze._`{format: ${e}}`},GU={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:HU,code(e,t){let{gen:r,data:o,$data:n,schema:s,schemaCode:i,it:a}=e,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=a;if(!c.validateFormats)return;if(n)f();else m();function f(){let h=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),g=r.const("fDef",ze._`${h}[${i}]`),_=r.let("fType"),y=r.let("format");r.if(ze._`typeof ${g} == "object" && !(${g} instanceof RegExp)`,()=>r.assign(_,ze._`${g}.type || "string"`).assign(y,ze._`${g}.validate`),()=>r.assign(_,ze._`"string"`).assign(y,g)),e.fail$data(ze.or(S(),v()));function S(){if(c.strictSchema===!1)return ze.nil;return ze._`${i} && !${y}`}function v(){let w=l.$async?ze._`(${g}.async ? await ${y}(${o}) : ${y}(${o}))`:ze._`${y}(${o})`,z=ze._`(typeof ${y} == "function" ? ${w} : ${y}.test(${o}))`;return ze._`${y} && ${y} !== true && ${_} === ${t} && !${z}`}}function m(){let h=d.formats[s];if(!h){S();return}if(h===!0)return;let[g,_,y]=v(h);if(g===t)e.pass(w());function S(){if(c.strictSchema===!1){d.logger.warn(z());return}throw Error(z());function z(){return`unknown format "${s}" ignored in schema at path "${u}"`}}function v(z){let R=z instanceof RegExp?ze.regexpCode(z):c.code.formats?ze._`${c.code.formats}${ze.getProperty(s)}`:void 0,b=r.scopeValue("formats",{key:s,ref:z,code:R});if(typeof z=="object"&&!(z instanceof RegExp))return[z.type||"string",z.validate,ze._`${b}.validate`];return["string",z,b]}function w(){if(typeof h=="object"&&!(h instanceof RegExp)&&h.async){if(!l.$async)throw Error("async format in sync schema");return ze._`await ${y}(${o})`}return typeof _=="function"?ze._`${y}(${o})`:ze._`${y}.test(${o})`}}}};Gz.default=GU});var Hh=D(function(Kz){Object.defineProperty(Kz,"__esModule",{value:!0});var KU=Jz(),BU=[KU.default];Kz.default=BU});var Gh=D(function(Bz){Object.defineProperty(Bz,"__esModule",{value:!0});Bz.contentVocabulary=Bz.metadataVocabulary=void 0;Bz.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Bz.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var Xz=D(function(Yz){Object.defineProperty(Yz,"__esModule",{value:!0});var XU=qh(),QU=Mh(),eF=Fh(),tF=Iz(),rF=Lz(),oF=Hz(),nF=Hh(),Nd=Gh(),sF=[tF.default,XU.default,QU.default,(0,eF.default)(!0),nF.default,Nd.metadataVocabulary,Nd.contentVocabulary,rF.default,oF.default];Yz.default=sF});var rP=D(function(eP){Object.defineProperty(eP,"__esModule",{value:!0});eP.DiscrError=void 0;var Qz;(function(e){e.Tag="tag",e.Mapping="mapping"})(Qz||(eP.DiscrError=Qz={}))});var Jh=D(function(nP){Object.defineProperty(nP,"__esModule",{value:!0});var sr=$e(),Is=rP(),Ad=ba(),aF=vs(),oP=ke(),cF={message:({params:{discrError:e,tagName:t}})=>e===Is.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>sr._`{error: ${e}, tag: ${r}, tagValue: ${t}}`},uF={keyword:"discriminator",type:"object",schemaType:"object",error:cF,code(e){let{gen:t,data:r,schema:o,parentSchema:n,it:s}=e,{oneOf:i}=n;if(!s.opts.discriminator)throw Error("discriminator: requires discriminator option");let a=o.propertyName;if(typeof a!="string")throw Error("discriminator: requires propertyName");if(o.mapping)throw Error("discriminator: mapping is not supported");if(!i)throw Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),u=t.const("tag",sr._`${r}${sr.getProperty(a)}`);t.if(sr._`typeof ${u} == "string"`,()=>l(),()=>e.error(!1,{discrError:Is.DiscrError.Tag,tag:u,tagName:a})),e.ok(c);function l(){let m=f();t.if(!1);for(let h in m)t.elseIf(sr._`${u} === ${h}`),t.assign(c,d(m[h]));t.else(),e.error(!1,{discrError:Is.DiscrError.Mapping,tag:u,tagName:a}),t.endIf()}function d(m){let h=t.name("valid"),g=e.subschema({keyword:"oneOf",schemaProp:m},h);return e.mergeEvaluated(g,sr.Name),h}function f(){var m;let h={},g=y(n),_=!0;for(let w=0;w<i.length;w++){let z=i[w];if((z===null||z===void 0?void 0:z.$ref)&&!oP.schemaHasRulesButRef(z,s.self.RULES)){let b=z.$ref;if(z=Ad.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,b),z instanceof Ad.SchemaEnv)z=z.schema;if(z===void 0)throw new aF.default(s.opts.uriResolver,s.baseId,b)}let R=(m=z===null||z===void 0?void 0:z.properties)===null||m===void 0?void 0:m[a];if(typeof R!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);_=_&&(g||y(z)),S(R,w)}if(!_)throw Error(`discriminator: "${a}" must be required`);return h;function y({required:w}){return Array.isArray(w)&&w.includes(a)}function S(w,z){if(w.const)v(w.const,z);else if(w.enum)for(let R of w.enum)v(R,z);else throw Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function v(w,z){if(typeof w!="string"||w in h)throw Error(`discriminator: "${a}" values must be unique strings`);h[w]=z}}}};nP.default=uF});var sP=D(function(fW,dF){dF.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/schema",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/unevaluated"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format-annotation"},{$ref:"meta/content"}],type:["object","boolean"],$comment:"This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",properties:{definitions:{$comment:'"definitions" has been replaced by "$defs".',type:"object",additionalProperties:{$dynamicRef:"#meta"},deprecated:!0,default:{}},dependencies:{$comment:'"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',type:"object",additionalProperties:{anyOf:[{$dynamicRef:"#meta"},{$ref:"meta/validation#/$defs/stringArray"}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:'"$recursiveAnchor" has been replaced by "$dynamicAnchor".',$ref:"meta/core#/$defs/anchorString",deprecated:!0},$recursiveRef:{$comment:'"$recursiveRef" has been replaced by "$dynamicRef".',$ref:"meta/core#/$defs/uriReferenceString",deprecated:!0}}}});var iP=D(function(mW,pF){pF.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/applicator":!0},$dynamicAnchor:"meta",title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{prefixItems:{$ref:"#/$defs/schemaArray"},items:{$dynamicRef:"#meta"},contains:{$dynamicRef:"#meta"},additionalProperties:{$dynamicRef:"#meta"},properties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},patternProperties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},propertyNames:{$dynamicRef:"#meta"},if:{$dynamicRef:"#meta"},then:{$dynamicRef:"#meta"},else:{$dynamicRef:"#meta"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$dynamicRef:"#meta"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$dynamicRef:"#meta"}}}}});var aP=D(function(hW,fF){fF.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/unevaluated",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},$dynamicAnchor:"meta",title:"Unevaluated applicator vocabulary meta-schema",type:["object","boolean"],properties:{unevaluatedItems:{$dynamicRef:"#meta"},unevaluatedProperties:{$dynamicRef:"#meta"}}}});var cP=D(function(gW,mF){mF.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/content",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentEncoding:{type:"string"},contentMediaType:{type:"string"},contentSchema:{$dynamicRef:"#meta"}}}});var uP=D(function(yW,hF){hF.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/core",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0},$dynamicAnchor:"meta",title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{$ref:"#/$defs/uriReferenceString",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{$ref:"#/$defs/uriString"},$ref:{$ref:"#/$defs/uriReferenceString"},$anchor:{$ref:"#/$defs/anchorString"},$dynamicRef:{$ref:"#/$defs/uriReferenceString"},$dynamicAnchor:{$ref:"#/$defs/anchorString"},$vocabulary:{type:"object",propertyNames:{$ref:"#/$defs/uriString"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$dynamicRef:"#meta"}}},$defs:{anchorString:{type:"string",pattern:"^[A-Za-z_][-A-Za-z0-9._]*$"},uriString:{type:"string",format:"uri"},uriReferenceString:{type:"string",format:"uri-reference"}}}});var lP=D(function(_W,gF){gF.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/format-annotation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},$dynamicAnchor:"meta",title:"Format vocabulary meta-schema for annotation results",type:["object","boolean"],properties:{format:{type:"string"}}}});var dP=D(function(vW,yF){yF.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},$dynamicAnchor:"meta",title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}});var pP=D(function(SW,_F){_F.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/validation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/validation":!0},$dynamicAnchor:"meta",title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}});var mP=D(function(fP){Object.defineProperty(fP,"__esModule",{value:!0});var vF=sP(),SF=iP(),bF=aP(),$F=cP(),wF=uP(),RF=lP(),EF=dP(),zF=pP(),PF=["/properties"];function TF(e){return[vF,SF,bF,$F,wF,t(this,RF),EF,t(this,zF)].forEach((r)=>this.addMetaSchema(r,void 0,!1)),this;function t(r,o){return e?r.$dataMetaSchema(o,PF):o}}fP.default=TF});var hP=D(function(Zt,Bh){Object.defineProperty(Zt,"__esModule",{value:!0});Zt.MissingRefError=Zt.ValidationError=Zt.CodeGen=Zt.Name=Zt.nil=Zt.stringify=Zt.str=Zt._=Zt.KeywordCxt=Zt.Ajv2020=void 0;var kF=jh(),OF=Xz(),CF=Jh(),xF=mP(),Kh="https://json-schema.org/draft/2020-12/schema";class Ra extends kF.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){if(super._addVocabularies(),OF.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(CF.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:e,meta:t}=this.opts;if(!t)return;xF.default.call(this,e),this.refs["http://json-schema.org/schema"]=Kh}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Kh)?Kh:void 0)}}Zt.Ajv2020=Ra;Bh.exports=Zt=Ra;Bh.exports.Ajv2020=Ra;Object.defineProperty(Zt,"__esModule",{value:!0});Zt.default=Ra;var NF=ys();Object.defineProperty(Zt,"KeywordCxt",{enumerable:!0,get:function(){return NF.KeywordCxt}});var ks=$e();Object.defineProperty(Zt,"_",{enumerable:!0,get:function(){return ks._}});Object.defineProperty(Zt,"str",{enumerable:!0,get:function(){return ks.str}});Object.defineProperty(Zt,"stringify",{enumerable:!0,get:function(){return ks.stringify}});Object.defineProperty(Zt,"nil",{enumerable:!0,get:function(){return ks.nil}});Object.defineProperty(Zt,"Name",{enumerable:!0,get:function(){return ks.Name}});Object.defineProperty(Zt,"CodeGen",{enumerable:!0,get:function(){return ks.CodeGen}});var AF=va();Object.defineProperty(Zt,"ValidationError",{enumerable:!0,get:function(){return AF.default}});var jF=vs();Object.defineProperty(Zt,"MissingRefError",{enumerable:!0,get:function(){return jF.default}})});var EP=D(function(wP){Object.defineProperty(wP,"__esModule",{value:!0});wP.formatNames=wP.fastFormats=wP.fullFormats=void 0;function jr(e,t){return{validate:e,compare:t}}wP.fullFormats={date:jr(vP,Qh),time:jr(Yh(!0),eg),"date-time":jr(gP(!0),bP),"iso-time":jr(Yh(),SP),"iso-date-time":jr(gP(),$P),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:ZF,"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:YF,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:HF,int32:{type:"number",validate:KF},int64:{type:"number",validate:BF},float:{type:"number",validate:_P},double:{type:"number",validate:_P},password:!0,binary:!0};wP.fastFormats={...wP.fullFormats,date:jr(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Qh),time:jr(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,eg),"date-time":jr(/^\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,bP),"iso-time":jr(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,SP),"iso-date-time":jr(/^\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,$P),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};wP.formatNames=Object.keys(wP.fullFormats);function LF(e){return e%4===0&&(e%100!==0||e%400===0)}var DF=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,UF=[0,31,28,31,30,31,30,31,31,30,31,30,31];function vP(e){let t=DF.exec(e);if(!t)return!1;let r=+t[1],o=+t[2],n=+t[3];return o>=1&&o<=12&&n>=1&&n<=(o===2&&LF(r)?29:UF[o])}function Qh(e,t){if(!(e&&t))return;if(e>t)return 1;if(e<t)return-1;return 0}var Wh=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Yh(e){return function(r){let o=Wh.exec(r);if(!o)return!1;let n=+o[1],s=+o[2],i=+o[3],a=o[4],c=o[5]==="-"?-1:1,u=+(o[6]||0),l=+(o[7]||0);if(u>23||l>59||e&&!a)return!1;if(n<=23&&s<=59&&i<60)return!0;let d=s-l*c,f=n-u*c-(d<0?1:0);return(f===23||f===-1)&&(d===59||d===-1)&&i<61}}function eg(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),o=new Date("2020-01-01T"+t).valueOf();if(!(r&&o))return;return r-o}function SP(e,t){if(!(e&&t))return;let r=Wh.exec(e),o=Wh.exec(t);if(!(r&&o))return;if(e=r[1]+r[2]+r[3],t=o[1]+o[2]+o[3],e>t)return 1;if(e<t)return-1;return 0}var Xh=/t|\s/i;function gP(e){let t=Yh(e);return function(o){let n=o.split(Xh);return n.length===2&&vP(n[0])&&t(n[1])}}function bP(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),o=new Date(t).valueOf();if(!(r&&o))return;return r-o}function $P(e,t){if(!(e&&t))return;let[r,o]=e.split(Xh),[n,s]=t.split(Xh),i=Qh(r,n);if(i===void 0)return;return i||eg(o,s)}var FF=/\/|:/,VF=/^(?:[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 ZF(e){return FF.test(e)&&VF.test(e)}var yP=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function HF(e){return yP.lastIndex=0,yP.test(e)}var GF=-2147483648,JF=2147483647;function KF(e){return Number.isInteger(e)&&e<=JF&&e>=GF}function BF(e){return Number.isInteger(e)}function _P(){return!0}var WF=/[^\\]\\Z/;function YF(e){if(WF.test(e))return!1;try{return new RegExp(e),!0}catch(t){return!1}}});var PP=D(function(zP){Object.defineProperty(zP,"__esModule",{value:!0});var QF=qh(),eV=Mh(),tV=Fh(),rV=Hh(),jd=Gh(),oV=[QF.default,eV.default,(0,tV.default)(),rV.default,jd.metadataVocabulary,jd.contentVocabulary];zP.default=oV});var TP=D(function(CW,sV){sV.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 kP=D(function(Ht,rg){Object.defineProperty(Ht,"__esModule",{value:!0});Ht.MissingRefError=Ht.ValidationError=Ht.CodeGen=Ht.Name=Ht.nil=Ht.stringify=Ht.str=Ht._=Ht.KeywordCxt=Ht.Ajv=void 0;var iV=jh(),aV=PP(),cV=Jh(),IP=TP(),uV=["/properties"],qd="http://json-schema.org/draft-07/schema";class Ea extends iV.default{_addVocabularies(){if(super._addVocabularies(),aV.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(cV.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(IP,uV):IP;this.addMetaSchema(e,qd,!1),this.refs["http://json-schema.org/schema"]=qd}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(qd)?qd:void 0)}}Ht.Ajv=Ea;rg.exports=Ht=Ea;rg.exports.Ajv=Ea;Object.defineProperty(Ht,"__esModule",{value:!0});Ht.default=Ea;var lV=ys();Object.defineProperty(Ht,"KeywordCxt",{enumerable:!0,get:function(){return lV.KeywordCxt}});var Os=$e();Object.defineProperty(Ht,"_",{enumerable:!0,get:function(){return Os._}});Object.defineProperty(Ht,"str",{enumerable:!0,get:function(){return Os.str}});Object.defineProperty(Ht,"stringify",{enumerable:!0,get:function(){return Os.stringify}});Object.defineProperty(Ht,"nil",{enumerable:!0,get:function(){return Os.nil}});Object.defineProperty(Ht,"Name",{enumerable:!0,get:function(){return Os.Name}});Object.defineProperty(Ht,"CodeGen",{enumerable:!0,get:function(){return Os.CodeGen}});var dV=va();Object.defineProperty(Ht,"ValidationError",{enumerable:!0,get:function(){return dV.default}});var pV=vs();Object.defineProperty(Ht,"MissingRefError",{enumerable:!0,get:function(){return pV.default}})});var xP=D(function(CP){Object.defineProperty(CP,"__esModule",{value:!0});CP.formatLimitDefinition=void 0;var OP=kP(),st=$e(),Do=st.operators,Md={formatMaximum:{okStr:"<=",ok:Do.LTE,fail:Do.GT},formatMinimum:{okStr:">=",ok:Do.GTE,fail:Do.LT},formatExclusiveMaximum:{okStr:"<",ok:Do.LT,fail:Do.GTE},formatExclusiveMinimum:{okStr:">",ok:Do.GT,fail:Do.LTE}},hV={message:({keyword:e,schemaCode:t})=>st.str`should be ${Md[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>st._`{comparison: ${Md[e].okStr}, limit: ${t}}`};CP.formatLimitDefinition={keyword:Object.keys(Md),type:"string",schemaType:"string",$data:!0,error:hV,code(e){let{gen:t,data:r,schemaCode:o,keyword:n,it:s}=e,{opts:i,self:a}=s;if(!i.validateFormats)return;let c=new OP.KeywordCxt(s,a.RULES.all.format.definition,"format");if(c.$data)u();else l();function u(){let f=t.scopeValue("formats",{ref:a.formats,code:i.code.formats}),m=t.const("fmt",st._`${f}[${c.schemaCode}]`);e.fail$data(st.or(st._`typeof ${m} != "object"`,st._`${m} instanceof RegExp`,st._`typeof ${m}.compare != "function"`,d(m)))}function l(){let f=c.schema,m=a.formats[f];if(!m||m===!0)return;if(typeof m!="object"||m instanceof RegExp||typeof m.compare!="function")throw Error(`"${n}": format "${f}" does not define "compare" function`);let h=t.scopeValue("formats",{key:f,ref:m,code:i.code.formats?st._`${i.code.formats}${st.getProperty(f)}`:void 0});e.fail$data(d(h))}function d(f){return st._`${f}.compare(${r}, ${o}) ${Md[n].fail} 0`}},dependencies:["format"]};var gV=(e)=>(e.addKeyword(CP.formatLimitDefinition),e);CP.default=gV});var qP=D(function(za,jP){Object.defineProperty(za,"__esModule",{value:!0});var ir=EP(),_V=xP(),Cs=$e(),NP=new Cs.Name("fullFormats"),vV=new Cs.Name("fastFormats"),ng=(e,t={keywords:!0})=>{if(Array.isArray(t))return AP(e,t,ir.fullFormats,NP),e;let[r,o]=t.mode==="fast"?[ir.fastFormats,vV]:[ir.fullFormats,NP],n=t.formats||ir.formatNames;if(AP(e,n,r,o),t.keywords)(0,_V.default)(e);return e};ng.get=(e,t="full")=>{let o=(t==="fast"?ir.fastFormats:ir.fullFormats)[e];if(!o)throw Error(`Unknown format "${e}"`);return o};function AP(e,t,r,o){var n,s;(n=(s=e.opts.code).formats)!==null&&n!==void 0||(s.formats=Cs._`require("ajv-formats/dist/formats").${o}`);for(let i of t)e.addFormat(i,r[i])}jP.exports=za=ng;Object.defineProperty(za,"__esModule",{value:!0});za.default=ng});var xs=D(function(HW,MP){var TV=Number.MAX_SAFE_INTEGER||9007199254740991,IV=["major","premajor","minor","preminor","patch","prepatch","prerelease"];MP.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:TV,RELEASE_TYPES:IV,SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var Pa=D(function(GW,LP){var kV=typeof process==="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};LP.exports=kV});var Ns=D(function(qr,DP){var{MAX_SAFE_COMPONENT_LENGTH:ag,MAX_SAFE_BUILD_LENGTH:OV,MAX_LENGTH:CV}=xs(),xV=Pa();qr=DP.exports={};var NV=qr.re=[],AV=qr.safeRe=[],ne=qr.src=[],jV=qr.safeSrc=[],se=qr.t={},qV=0,cg="[a-zA-Z0-9-]",MV=[["\\s",1],["\\d",CV],[cg,OV]],LV=(e)=>{for(let[t,r]of MV)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e},Re=(e,t,r)=>{let o=LV(t),n=qV++;xV(e,n,t),se[e]=n,ne[n]=t,jV[n]=o,NV[n]=new RegExp(t,r?"g":void 0),AV[n]=new RegExp(o,r?"g":void 0)};Re("NUMERICIDENTIFIER","0|[1-9]\\d*");Re("NUMERICIDENTIFIERLOOSE","\\d+");Re("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${cg}*`);Re("MAINVERSION",`(${ne[se.NUMERICIDENTIFIER]})\\.(${ne[se.NUMERICIDENTIFIER]})\\.(${ne[se.NUMERICIDENTIFIER]})`);Re("MAINVERSIONLOOSE",`(${ne[se.NUMERICIDENTIFIERLOOSE]})\\.(${ne[se.NUMERICIDENTIFIERLOOSE]})\\.(${ne[se.NUMERICIDENTIFIERLOOSE]})`);Re("PRERELEASEIDENTIFIER",`(?:${ne[se.NONNUMERICIDENTIFIER]}|${ne[se.NUMERICIDENTIFIER]})`);Re("PRERELEASEIDENTIFIERLOOSE",`(?:${ne[se.NONNUMERICIDENTIFIER]}|${ne[se.NUMERICIDENTIFIERLOOSE]})`);Re("PRERELEASE",`(?:-(${ne[se.PRERELEASEIDENTIFIER]}(?:\\.${ne[se.PRERELEASEIDENTIFIER]})*))`);Re("PRERELEASELOOSE",`(?:-?(${ne[se.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${ne[se.PRERELEASEIDENTIFIERLOOSE]})*))`);Re("BUILDIDENTIFIER",`${cg}+`);Re("BUILD",`(?:\\+(${ne[se.BUILDIDENTIFIER]}(?:\\.${ne[se.BUILDIDENTIFIER]})*))`);Re("FULLPLAIN",`v?${ne[se.MAINVERSION]}${ne[se.PRERELEASE]}?${ne[se.BUILD]}?`);Re("FULL",`^${ne[se.FULLPLAIN]}$`);Re("LOOSEPLAIN",`[v=\\s]*${ne[se.MAINVERSIONLOOSE]}${ne[se.PRERELEASELOOSE]}?${ne[se.BUILD]}?`);Re("LOOSE",`^${ne[se.LOOSEPLAIN]}$`);Re("GTLT","((?:<|>)?=?)");Re("XRANGEIDENTIFIERLOOSE",`${ne[se.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);Re("XRANGEIDENTIFIER",`${ne[se.NUMERICIDENTIFIER]}|x|X|\\*`);Re("XRANGEPLAIN",`[v=\\s]*(${ne[se.XRANGEIDENTIFIER]})(?:\\.(${ne[se.XRANGEIDENTIFIER]})(?:\\.(${ne[se.XRANGEIDENTIFIER]})(?:${ne[se.PRERELEASE]})?${ne[se.BUILD]}?)?)?`);Re("XRANGEPLAINLOOSE",`[v=\\s]*(${ne[se.XRANGEIDENTIFIERLOOSE]})(?:\\.(${ne[se.XRANGEIDENTIFIERLOOSE]})(?:\\.(${ne[se.XRANGEIDENTIFIERLOOSE]})(?:${ne[se.PRERELEASELOOSE]})?${ne[se.BUILD]}?)?)?`);Re("XRANGE",`^${ne[se.GTLT]}\\s*${ne[se.XRANGEPLAIN]}$`);Re("XRANGELOOSE",`^${ne[se.GTLT]}\\s*${ne[se.XRANGEPLAINLOOSE]}$`);Re("COERCEPLAIN",`(^|[^\\d])(\\d{1,${ag}})(?:\\.(\\d{1,${ag}}))?(?:\\.(\\d{1,${ag}}))?`);Re("COERCE",`${ne[se.COERCEPLAIN]}(?:$|[^\\d])`);Re("COERCEFULL",ne[se.COERCEPLAIN]+`(?:${ne[se.PRERELEASE]})?(?:${ne[se.BUILD]})?(?:$|[^\\d])`);Re("COERCERTL",ne[se.COERCE],!0);Re("COERCERTLFULL",ne[se.COERCEFULL],!0);Re("LONETILDE","(?:~>?)");Re("TILDETRIM",`(\\s*)${ne[se.LONETILDE]}\\s+`,!0);qr.tildeTrimReplace="$1~";Re("TILDE",`^${ne[se.LONETILDE]}${ne[se.XRANGEPLAIN]}$`);Re("TILDELOOSE",`^${ne[se.LONETILDE]}${ne[se.XRANGEPLAINLOOSE]}$`);Re("LONECARET","(?:\\^)");Re("CARETTRIM",`(\\s*)${ne[se.LONECARET]}\\s+`,!0);qr.caretTrimReplace="$1^";Re("CARET",`^${ne[se.LONECARET]}${ne[se.XRANGEPLAIN]}$`);Re("CARETLOOSE",`^${ne[se.LONECARET]}${ne[se.XRANGEPLAINLOOSE]}$`);Re("COMPARATORLOOSE",`^${ne[se.GTLT]}\\s*(${ne[se.LOOSEPLAIN]})$|^$`);Re("COMPARATOR",`^${ne[se.GTLT]}\\s*(${ne[se.FULLPLAIN]})$|^$`);Re("COMPARATORTRIM",`(\\s*)${ne[se.GTLT]}\\s*(${ne[se.LOOSEPLAIN]}|${ne[se.XRANGEPLAIN]})`,!0);qr.comparatorTrimReplace="$1$2$3";Re("HYPHENRANGE",`^\\s*(${ne[se.XRANGEPLAIN]})\\s+-\\s+(${ne[se.XRANGEPLAIN]})\\s*$`);Re("HYPHENRANGELOOSE",`^\\s*(${ne[se.XRANGEPLAINLOOSE]})\\s+-\\s+(${ne[se.XRANGEPLAINLOOSE]})\\s*$`);Re("STAR","(<|>)?=?\\s*\\*");Re("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");Re("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var Ld=D(function(JW,UP){var DV=Object.freeze({loose:!0}),UV=Object.freeze({}),FV=(e)=>{if(!e)return UV;if(typeof e!=="object")return DV;return e};UP.exports=FV});var ug=D(function(KW,ZP){var FP=/^[0-9]+$/,VP=(e,t)=>{if(typeof e==="number"&&typeof t==="number")return e===t?0:e<t?-1:1;let r=FP.test(e),o=FP.test(t);if(r&&o)e=+e,t=+t;return e===t?0:r&&!o?-1:o&&!r?1:e<t?-1:1},VV=(e,t)=>VP(t,e);ZP.exports={compareIdentifiers:VP,rcompareIdentifiers:VV}});var $t=D(function(BW,GP){var Dd=Pa(),{MAX_LENGTH:HP,MAX_SAFE_INTEGER:Ud}=xs(),{safeRe:Fd,t:Vd}=Ns(),ZV=Ld(),{compareIdentifiers:lg}=ug(),HV=(e,t)=>{let r=t.split(".");if(r.length>e.length)return!1;for(let o=0;o<r.length;o++)if(lg(e[o],r[o])!==0)return!1;return!0};class yr{constructor(e,t){if(t=ZV(t),e instanceof yr)if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;else e=e.version;else if(typeof e!=="string")throw TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>HP)throw TypeError(`version is longer than ${HP} characters`);Dd("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let r=e.trim().match(t.loose?Fd[Vd.LOOSE]:Fd[Vd.FULL]);if(!r)throw TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>Ud||this.major<0)throw TypeError("Invalid major version");if(this.minor>Ud||this.minor<0)throw TypeError("Invalid minor version");if(this.patch>Ud||this.patch<0)throw TypeError("Invalid patch version");if(!r[4])this.prerelease=[];else this.prerelease=r[4].split(".").map((o)=>{if(/^[0-9]+$/.test(o)){let n=+o;if(n>=0&&n<Ud)return n}return o});this.build=r[5]?r[5].split("."):[],this.format()}format(){if(this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length)this.version+=`-${this.prerelease.join(".")}`;return this.version}toString(){return this.version}compare(e){if(Dd("SemVer.compare",this.version,this.options,e),!(e instanceof yr)){if(typeof e==="string"&&e===this.version)return 0;e=new yr(e,this.options)}if(e.version===this.version)return 0;return this.compareMain(e)||this.comparePre(e)}compareMain(e){if(!(e instanceof yr))e=new yr(e,this.options);if(this.major<e.major)return-1;if(this.major>e.major)return 1;if(this.minor<e.minor)return-1;if(this.minor>e.minor)return 1;if(this.patch<e.patch)return-1;if(this.patch>e.patch)return 1;return 0}comparePre(e){if(!(e instanceof yr))e=new yr(e,this.options);if(this.prerelease.length&&!e.prerelease.length)return-1;else if(!this.prerelease.length&&e.prerelease.length)return 1;else if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{let r=this.prerelease[t],o=e.prerelease[t];if(Dd("prerelease compare",t,r,o),r===void 0&&o===void 0)return 0;else if(o===void 0)return 1;else if(r===void 0)return-1;else if(r===o)continue;else return lg(r,o)}while(++t)}compareBuild(e){if(!(e instanceof yr))e=new yr(e,this.options);let t=0;do{let r=this.build[t],o=e.build[t];if(Dd("build compare",t,r,o),r===void 0&&o===void 0)return 0;else if(o===void 0)return 1;else if(r===void 0)return-1;else if(r===o)continue;else return lg(r,o)}while(++t)}inc(e,t,r){if(e.startsWith("pre")){if(!t&&r===!1)throw Error("invalid increment argument: identifier is empty");if(t){let o=`-${t}`.match(this.options.loose?Fd[Vd.PRERELEASELOOSE]:Fd[Vd.PRERELEASE]);if(!o||o[1]!==t)throw Error(`invalid identifier: ${t}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,r),this.inc("pre",t,r);break;case"prerelease":if(this.prerelease.length===0)this.inc("patch",t,r);this.inc("pre",t,r);break;case"release":if(this.prerelease.length===0)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":if(this.minor!==0||this.patch!==0||this.prerelease.length===0)this.major++;this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":if(this.patch!==0||this.prerelease.length===0)this.minor++;this.patch=0,this.prerelease=[];break;case"patch":if(this.prerelease.length===0)this.patch++;this.prerelease=[];break;case"pre":{let o=Number(r)?1:0;if(this.prerelease.length===0)this.prerelease=[o];else{let n=this.prerelease.length;while(--n>=0)if(typeof this.prerelease[n]==="number")this.prerelease[n]++,n=-2;if(n===-1){if(t===this.prerelease.join(".")&&r===!1)throw Error("invalid increment argument: identifier already exists");this.prerelease.push(o)}}if(t){let n=[t,o];if(r===!1)n=[t];if(HV(this.prerelease,t)){let s=this.prerelease[t.split(".").length];if(isNaN(s))this.prerelease=n}else this.prerelease=n}break}default:throw Error(`invalid increment argument: ${e}`)}if(this.raw=this.format(),this.build.length)this.raw+=`+${this.build.join(".")}`;return this}}GP.exports=yr});var Uo=D(function(WW,KP){var JP=$t(),GV=(e,t,r=!1)=>{if(e instanceof JP)return e;try{return new JP(e,t)}catch(o){if(!r)return null;throw o}};KP.exports=GV});var WP=D(function(YW,BP){var JV=Uo(),KV=(e,t)=>{let r=JV(e,t);return r?r.version:null};BP.exports=KV});var XP=D(function(XW,YP){var BV=Uo(),WV=(e,t)=>{let r=BV(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};YP.exports=WV});var tT=D(function(QW,eT){var QP=$t(),YV=(e,t,r,o,n)=>{if(typeof r==="string")n=o,o=r,r=void 0;try{return new QP(e instanceof QP?e.version:e,r).inc(t,o,n).version}catch(s){return null}};eT.exports=YV});var nT=D(function(e8,oT){var rT=Uo(),XV=(e,t)=>{let r=rT(e,null,!0),o=rT(t,null,!0),n=r.compare(o);if(n===0)return null;let s=n>0,i=s?r:o,a=s?o:r,c=!!i.prerelease.length;if(!!a.prerelease.length&&!c){if(!a.patch&&!a.minor)return"major";if(a.compareMain(i)===0){if(a.minor&&!a.patch)return"minor";return"patch"}}let l=c?"pre":"";if(r.major!==o.major)return l+"major";if(r.minor!==o.minor)return l+"minor";if(r.patch!==o.patch)return l+"patch";return"prerelease"};oT.exports=XV});var iT=D(function(t8,sT){var QV=$t(),e9=(e,t)=>new QV(e,t).major;sT.exports=e9});var cT=D(function(r8,aT){var t9=$t(),r9=(e,t)=>new t9(e,t).minor;aT.exports=r9});var lT=D(function(o8,uT){var o9=$t(),n9=(e,t)=>new o9(e,t).patch;uT.exports=n9});var pT=D(function(n8,dT){var s9=Uo(),i9=(e,t)=>{let r=s9(e,t);return r&&r.prerelease.length?r.prerelease:null};dT.exports=i9});var ar=D(function(s8,mT){var fT=$t(),a9=(e,t,r)=>new fT(e,r).compare(new fT(t,r));mT.exports=a9});var gT=D(function(i8,hT){var c9=ar(),u9=(e,t,r)=>c9(t,e,r);hT.exports=u9});var _T=D(function(a8,yT){var l9=ar(),d9=(e,t)=>l9(e,t,!0);yT.exports=d9});var Zd=D(function(c8,ST){var vT=$t(),p9=(e,t,r)=>{let o=new vT(e,r),n=new vT(t,r);return o.compare(n)||o.compareBuild(n)};ST.exports=p9});var $T=D(function(u8,bT){var f9=Zd(),m9=(e,t)=>e.sort((r,o)=>f9(r,o,t));bT.exports=m9});var RT=D(function(l8,wT){var h9=Zd(),g9=(e,t)=>e.sort((r,o)=>h9(o,r,t));wT.exports=g9});var Ta=D(function(d8,ET){var y9=ar(),_9=(e,t,r)=>y9(e,t,r)>0;ET.exports=_9});var Hd=D(function(p8,zT){var v9=ar(),S9=(e,t,r)=>v9(e,t,r)<0;zT.exports=S9});var dg=D(function(f8,PT){var b9=ar(),$9=(e,t,r)=>b9(e,t,r)===0;PT.exports=$9});var pg=D(function(m8,TT){var w9=ar(),R9=(e,t,r)=>w9(e,t,r)!==0;TT.exports=R9});var Gd=D(function(h8,IT){var E9=ar(),z9=(e,t,r)=>E9(e,t,r)>=0;IT.exports=z9});var Jd=D(function(g8,kT){var P9=ar(),T9=(e,t,r)=>P9(e,t,r)<=0;kT.exports=T9});var fg=D(function(y8,OT){var I9=dg(),k9=pg(),O9=Ta(),C9=Gd(),x9=Hd(),N9=Jd(),A9=(e,t,r,o)=>{switch(t){case"===":if(typeof e==="object")e=e.version;if(typeof r==="object")r=r.version;return e===r;case"!==":if(typeof e==="object")e=e.version;if(typeof r==="object")r=r.version;return e!==r;case"":case"=":case"==":return I9(e,r,o);case"!=":return k9(e,r,o);case">":return O9(e,r,o);case">=":return C9(e,r,o);case"<":return x9(e,r,o);case"<=":return N9(e,r,o);default:throw TypeError(`Invalid operator: ${t}`)}};OT.exports=A9});var xT=D(function(_8,CT){var j9=$t(),q9=Uo(),{safeRe:Kd,t:Bd}=Ns(),M9=(e,t)=>{if(e instanceof j9)return e;if(typeof e==="number")e=String(e);if(typeof e!=="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?Kd[Bd.COERCEFULL]:Kd[Bd.COERCE]);else{let c=t.includePrerelease?Kd[Bd.COERCERTLFULL]:Kd[Bd.COERCERTL],u;while((u=c.exec(e))&&(!r||r.index+r[0].length!==e.length)){if(!r||u.index+u[0].length!==r.index+r[0].length)r=u;c.lastIndex=u.index+u[1].length+u[2].length}c.lastIndex=-1}if(r===null)return null;let o=r[2],n=r[3]||"0",s=r[4]||"0",i=t.includePrerelease&&r[5]?`-${r[5]}`:"",a=t.includePrerelease&&r[6]?`+${r[6]}`:"";return q9(`${o}.${n}.${s}${i}${a}`,t)};CT.exports=M9});var jT=D(function(v8,AT){var L9=Uo(),NT=xs(),D9=$t(),U9=(e,t,r)=>{if(!NT.RELEASE_TYPES.includes(t))return null;let o=F9(e,r);return o&&V9(o,t)},F9=(e,t)=>{let r=e instanceof D9?e.version:e;return L9(r,t)},V9=(e,t)=>{if(Z9(t))return e.version;switch(e.prerelease=[],t){case"major":e.minor=0,e.patch=0;break;case"minor":e.patch=0;break}return e.format()},Z9=(e)=>e.startsWith("pre");AT.exports=U9});var LT=D(function(S8,MT){class qT{constructor(){this.max=1000,this.map=new Map}get(e){let t=this.map.get(e);if(t===void 0)return;else return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&t!==void 0){if(this.map.size>=this.max){let o=this.map.keys().next().value;this.delete(o)}this.map.set(e,t)}return this}}MT.exports=qT});var cr=D(function(b8,VT){var H9=/\s+/g;class Ia{constructor(e,t){if(t=J9(t),e instanceof Ia)if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;else return new Ia(e.raw,t);if(e instanceof Wd)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e.trim().replace(H9," "),this.set=this.raw.split("||").map((r)=>this.parseRange(r.trim())).filter((r)=>r.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let r=this.set[0];if(this.set=this.set.filter((o)=>!UT(o[0])),this.set.length===0)this.set=[r];else if(this.set.length>1){for(let o of this.set)if(o.length===1&&r4(o[0])){this.set=[o];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e<this.set.length;e++){if(e>0)this.formatted+="||";let t=this.set[e];for(let r=0;r<t.length;r++){if(r>0)this.formatted+=" ";this.formatted+=t[r].toString().trim()}}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){e=e.replace(t4,"");let r=((this.options.includePrerelease&&Q9)|(this.options.loose&&e4))+":"+e,o=DT.get(r);if(o)return o;let n=this.options.loose,s=n?At[wt.HYPHENRANGELOOSE]:At[wt.HYPHENRANGE];e=e.replace(s,f4(this.options.includePrerelease)),Ge("hyphen replace",e),e=e.replace(At[wt.COMPARATORTRIM],W9),Ge("comparator trim",e),e=e.replace(At[wt.TILDETRIM],Y9),Ge("tilde trim",e),e=e.replace(At[wt.CARETTRIM],X9),Ge("caret trim",e);let i=e.split(" ").map((l)=>o4(l,this.options)).join(" ").split(/\s+/).map((l)=>p4(l,this.options));if(n)i=i.filter((l)=>(Ge("loose invalid filter",l,this.options),!!l.match(At[wt.COMPARATORLOOSE])));Ge("range list",i);let a=new Map,c=i.map((l)=>new Wd(l,this.options));for(let l of c){if(UT(l))return[l];a.set(l.value,l)}if(a.size>1&&a.has(""))a.delete("");let u=[...a.values()];return DT.set(r,u),u}intersects(e,t){if(!(e instanceof Ia))throw TypeError("a Range is required");return this.set.some((r)=>FT(r,t)&&e.set.some((o)=>FT(o,t)&&r.every((n)=>o.every((s)=>n.intersects(s,t)))))}test(e){if(!e)return!1;if(typeof e==="string")try{e=new K9(e,this.options)}catch(t){return!1}for(let t=0;t<this.set.length;t++)if(m4(this.set[t],e,this.options))return!0;return!1}}VT.exports=Ia;var G9=LT(),DT=new G9,J9=Ld(),Wd=ka(),Ge=Pa(),K9=$t(),{safeRe:At,src:B9,t:wt,comparatorTrimReplace:W9,tildeTrimReplace:Y9,caretTrimReplace:X9}=Ns(),{FLAG_INCLUDE_PRERELEASE:Q9,FLAG_LOOSE:e4}=xs(),t4=new RegExp(B9[wt.BUILD],"g"),UT=(e)=>e.value==="<0.0.0-0",r4=(e)=>e.value==="",FT=(e,t)=>{let r=!0,o=e.slice(),n=o.pop();while(r&&o.length)r=o.every((s)=>n.intersects(s,t)),n=o.pop();return r},o4=(e,t)=>(e=e.replace(At[wt.BUILD],""),Ge("comp",e,t),e=a4(e,t),Ge("caret",e),e=s4(e,t),Ge("tildes",e),e=u4(e,t),Ge("xrange",e),e=d4(e,t),Ge("stars",e),e),ft=(e)=>!e||e.toLowerCase()==="x"||e==="*",n4=(e,t,r)=>ft(e)&&!ft(t)||ft(t)&&r&&!ft(r),s4=(e,t)=>e.trim().split(/\s+/).map((r)=>i4(r,t)).join(" "),i4=(e,t)=>{let r=t.loose?At[wt.TILDELOOSE]:At[wt.TILDE],o=t.includePrerelease?"-0":"";return e.replace(r,(n,s,i,a,c)=>{Ge("tilde",e,n,s,i,a,c);let u;if(ft(s))u="";else if(ft(i))u=`>=${s}.0.0${o} <${+s+1}.0.0-0`;else if(ft(a))u=`>=${s}.${i}.0${o} <${s}.${+i+1}.0-0`;else if(c)Ge("replaceTilde pr",c),u=`>=${s}.${i}.${a}-${c} <${s}.${+i+1}.0-0`;else u=`>=${s}.${i}.${a} <${s}.${+i+1}.0-0`;return Ge("tilde return",u),u})},a4=(e,t)=>e.trim().split(/\s+/).map((r)=>c4(r,t)).join(" "),c4=(e,t)=>{Ge("caret",e,t);let r=t.loose?At[wt.CARETLOOSE]:At[wt.CARET],o=t.includePrerelease?"-0":"";return e.replace(r,(n,s,i,a,c)=>{Ge("caret",e,n,s,i,a,c);let u;if(ft(s))u="";else if(ft(i))u=`>=${s}.0.0${o} <${+s+1}.0.0-0`;else if(ft(a))if(s==="0")u=`>=${s}.${i}.0${o} <${s}.${+i+1}.0-0`;else u=`>=${s}.${i}.0${o} <${+s+1}.0.0-0`;else if(c)if(Ge("replaceCaret pr",c),s==="0")if(i==="0")u=`>=${s}.${i}.${a}-${c} <${s}.${i}.${+a+1}-0`;else u=`>=${s}.${i}.${a}-${c} <${s}.${+i+1}.0-0`;else u=`>=${s}.${i}.${a}-${c} <${+s+1}.0.0-0`;else if(Ge("no pr"),s==="0")if(i==="0")u=`>=${s}.${i}.${a} <${s}.${i}.${+a+1}-0`;else u=`>=${s}.${i}.${a} <${s}.${+i+1}.0-0`;else u=`>=${s}.${i}.${a} <${+s+1}.0.0-0`;return Ge("caret return",u),u})},u4=(e,t)=>(Ge("replaceXRanges",e,t),e.split(/\s+/).map((r)=>l4(r,t)).join(" ")),l4=(e,t)=>{e=e.trim();let r=t.loose?At[wt.XRANGELOOSE]:At[wt.XRANGE];return e.replace(r,(o,n,s,i,a,c)=>{if(Ge("xRange",e,o,n,s,i,a,c),n4(s,i,a))return e;let u=ft(s),l=u||ft(i),d=l||ft(a),f=d;if(n==="="&&f)n="";if(c=t.includePrerelease?"-0":"",u)if(n===">"||n==="<")o="<0.0.0-0";else o="*";else if(n&&f){if(l)i=0;if(a=0,n===">")if(n=">=",l)s=+s+1,i=0,a=0;else i=+i+1,a=0;else if(n==="<=")if(n="<",l)s=+s+1;else i=+i+1;if(n==="<")c="-0";o=`${n+s}.${i}.${a}${c}`}else if(l)o=`>=${s}.0.0${c} <${+s+1}.0.0-0`;else if(d)o=`>=${s}.${i}.0${c} <${s}.${+i+1}.0-0`;return Ge("xRange return",o),o})},d4=(e,t)=>(Ge("replaceStars",e,t),e.trim().replace(At[wt.STAR],"")),p4=(e,t)=>(Ge("replaceGTE0",e,t),e.trim().replace(At[t.includePrerelease?wt.GTE0PRE:wt.GTE0],"")),f4=(e)=>(t,r,o,n,s,i,a,c,u,l,d,f)=>{if(ft(o))r="";else if(ft(n))r=`>=${o}.0.0${e?"-0":""}`;else if(ft(s))r=`>=${o}.${n}.0${e?"-0":""}`;else if(i)r=`>=${r}`;else r=`>=${r}${e?"-0":""}`;if(ft(u))c="";else if(ft(l))c=`<${+u+1}.0.0-0`;else if(ft(d))c=`<${u}.${+l+1}.0-0`;else if(f)c=`<=${u}.${l}.${d}-${f}`;else if(e)c=`<${u}.${l}.${+d+1}-0`;else c=`<=${c}`;return`${r} ${c}`.trim()},m4=(e,t,r)=>{for(let o=0;o<e.length;o++)if(!e[o].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let o=0;o<e.length;o++){if(Ge(e[o].semver),e[o].semver===Wd.ANY)continue;if(e[o].semver.prerelease.length>0){let n=e[o].semver;if(n.major===t.major&&n.minor===t.minor&&n.patch===t.patch)return!0}}return!1}return!0}});var ka=D(function($8,BT){var Oa=Symbol("SemVer ANY");class Yd{static get ANY(){return Oa}constructor(e,t){if(t=ZT(t),e instanceof Yd)if(e.loose===!!t.loose)return e;else e=e.value;if(e=e.trim().split(/\s+/).join(" "),hg("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===Oa)this.value="";else this.value=this.operator+this.semver.version;hg("comp",this)}parse(e){let t=this.options.loose?HT[GT.COMPARATORLOOSE]:HT[GT.COMPARATOR],r=e.match(t);if(!r)throw TypeError(`Invalid comparator: ${e}`);if(this.operator=r[1]!==void 0?r[1]:"",this.operator==="=")this.operator="";if(!r[2])this.semver=Oa;else this.semver=new JT(r[2],this.options.loose)}toString(){return this.value}test(e){if(hg("Comparator.test",e,this.options.loose),this.semver===Oa||e===Oa)return!0;if(typeof e==="string")try{e=new JT(e,this.options)}catch(t){return!1}return mg(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof Yd))throw TypeError("a Comparator is required");if(this.operator===""){if(this.value==="")return!0;return new KT(e.value,t).test(this.value)}else if(e.operator===""){if(e.value==="")return!0;return new KT(this.value,t).test(e.semver)}if(t=ZT(t),t.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0"))return!1;if(!t.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0")))return!1;if(this.operator.startsWith(">")&&e.operator.startsWith(">"))return!0;if(this.operator.startsWith("<")&&e.operator.startsWith("<"))return!0;if(this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("="))return!0;if(mg(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))return!0;if(mg(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">"))return!0;return!1}}BT.exports=Yd;var ZT=Ld(),{safeRe:HT,t:GT}=Ns(),mg=fg(),hg=Pa(),JT=$t(),KT=cr()});var Ca=D(function(w8,WT){var h4=cr(),g4=(e,t,r)=>{try{t=new h4(t,r)}catch(o){return!1}return t.test(e)};WT.exports=g4});var XT=D(function(R8,YT){var y4=cr(),_4=(e,t)=>new y4(e,t).set.map((r)=>r.map((o)=>o.value).join(" ").trim().split(" "));YT.exports=_4});var eI=D(function(E8,QT){var v4=$t(),S4=cr(),b4=(e,t,r)=>{let o=null,n=null,s=null;try{s=new S4(t,r)}catch(i){return null}return e.forEach((i)=>{if(s.test(i)){if(!o||n.compare(i)===-1)o=i,n=new v4(o,r)}}),o};QT.exports=b4});var rI=D(function(z8,tI){var $4=$t(),w4=cr(),R4=(e,t,r)=>{let o=null,n=null,s=null;try{s=new w4(t,r)}catch(i){return null}return e.forEach((i)=>{if(s.test(i)){if(!o||n.compare(i)===1)o=i,n=new $4(o,r)}}),o};tI.exports=R4});var sI=D(function(P8,nI){var gg=$t(),E4=cr(),oI=Ta(),z4=(e,t)=>{e=new E4(e,t);let r=new gg("0.0.0");if(e.test(r))return r;if(r=new gg("0.0.0-0"),e.test(r))return r;r=null;for(let o=0;o<e.set.length;++o){let n=e.set[o],s=null;if(n.forEach((i)=>{let a=new gg(i.semver.version);switch(i.operator){case">":if(a.prerelease.length===0)a.patch++;else a.prerelease.push(0);a.raw=a.format();case"":case">=":if(!s||oI(a,s))s=a;break;case"<":case"<=":break;default:throw Error(`Unexpected operation: ${i.operator}`)}}),s&&(!r||oI(r,s)))r=s}if(r&&e.test(r))return r;return null};nI.exports=z4});var aI=D(function(T8,iI){var P4=cr(),T4=(e,t)=>{try{return new P4(e,t).range||"*"}catch(r){return null}};iI.exports=T4});var Xd=D(function(I8,dI){var I4=$t(),lI=ka(),{ANY:k4}=lI,O4=cr(),C4=Ca(),cI=Ta(),uI=Hd(),x4=Jd(),N4=Gd(),A4=(e,t,r,o)=>{e=new I4(e,o),t=new O4(t,o);let n,s,i,a,c;switch(r){case">":n=cI,s=x4,i=uI,a=">",c=">=";break;case"<":n=uI,s=N4,i=cI,a="<",c="<=";break;default:throw TypeError('Must provide a hilo val of "<" or ">"')}if(C4(e,t,o))return!1;for(let u=0;u<t.set.length;++u){let l=t.set[u],d=null,f=null;if(l.forEach((m)=>{if(m.semver===k4)m=new lI(">=0.0.0");if(d=d||m,f=f||m,n(m.semver,d.semver,o))d=m;else if(i(m.semver,f.semver,o))f=m}),d.operator===a||d.operator===c)return!1;if((!f.operator||f.operator===a)&&s(e,f.semver))return!1;else if(f.operator===c&&i(e,f.semver))return!1}return!0};dI.exports=A4});var fI=D(function(k8,pI){var j4=Xd(),q4=(e,t,r)=>j4(e,t,">",r);pI.exports=q4});var hI=D(function(O8,mI){var M4=Xd(),L4=(e,t,r)=>M4(e,t,"<",r);mI.exports=L4});var _I=D(function(C8,yI){var gI=cr(),D4=(e,t,r)=>(e=new gI(e,r),t=new gI(t,r),e.intersects(t,r));yI.exports=D4});var SI=D(function(x8,vI){var U4=Ca(),F4=ar();vI.exports=(e,t,r)=>{let o=[],n=null,s=null,i=e.sort((l,d)=>F4(l,d,r));for(let l of i)if(U4(l,t,r)){if(s=l,!n)n=l}else{if(s)o.push([n,s]);s=null,n=null}if(n)o.push([n,null]);let a=[];for(let[l,d]of o)if(l===d)a.push(l);else if(!d&&l===i[0])a.push("*");else if(!d)a.push(`>=${l}`);else if(l===i[0])a.push(`<=${d}`);else a.push(`${l} - ${d}`);let c=a.join(" || "),u=typeof t.raw==="string"?t.raw:String(t);return c.length<u.length?c:t}});var zI=D(function(N8,EI){var bI=cr(),vg=ka(),{ANY:yg}=vg,_g=Ca(),Sg=ar(),V4=(e,t,r={})=>{if(e===t)return!0;e=new bI(e,r),t=new bI(t,r);let o=!1;e:for(let n of e.set){for(let s of t.set){let i=H4(n,s,r);if(o=o||i!==null,i)continue e}if(o)return!1}return!0},Z4=[new vg(">=0.0.0-0")],$I=[new vg(">=0.0.0")],H4=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===yg)if(t.length===1&&t[0].semver===yg)return!0;else if(r.includePrerelease)e=Z4;else e=$I;if(t.length===1&&t[0].semver===yg)if(r.includePrerelease)return!0;else t=$I;let o=new Set,n,s;for(let m of e)if(m.operator===">"||m.operator===">=")n=wI(n,m,r);else if(m.operator==="<"||m.operator==="<=")s=RI(s,m,r);else o.add(m.semver);if(o.size>1)return null;let i;if(n&&s){if(i=Sg(n.semver,s.semver,r),i>0)return null;else if(i===0&&(n.operator!==">="||s.operator!=="<="))return null}for(let m of o){if(n&&!_g(m,String(n),r))return null;if(s&&!_g(m,String(s),r))return null;for(let h of t)if(!_g(m,String(h),r))return!1;return!0}let a,c,u,l,d=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1,f=n&&!r.includePrerelease&&n.semver.prerelease.length?n.semver:!1;if(d&&d.prerelease.length===1&&s.operator==="<"&&d.prerelease[0]===0)d=!1;for(let m of t){if(l=l||m.operator===">"||m.operator===">=",u=u||m.operator==="<"||m.operator==="<=",n){if(f){if(m.semver.prerelease&&m.semver.prerelease.length&&m.semver.major===f.major&&m.semver.minor===f.minor&&m.semver.patch===f.patch)f=!1}if(m.operator===">"||m.operator===">="){if(a=wI(n,m,r),a===m&&a!==n)return!1}else if(n.operator===">="&&!m.test(n.semver))return!1}if(s){if(d){if(m.semver.prerelease&&m.semver.prerelease.length&&m.semver.major===d.major&&m.semver.minor===d.minor&&m.semver.patch===d.patch)d=!1}if(m.operator==="<"||m.operator==="<="){if(c=RI(s,m,r),c===m&&c!==s)return!1}else if(s.operator==="<="&&!m.test(s.semver))return!1}if(!m.operator&&(s||n)&&i!==0)return!1}if(n&&u&&!s&&i!==0)return!1;if(s&&l&&!n&&i!==0)return!1;if(f||d)return!1;return!0},wI=(e,t,r)=>{if(!e)return t;let o=Sg(e.semver,t.semver,r);return o>0?e:o<0?t:t.operator===">"&&e.operator===">="?t:e},RI=(e,t,r)=>{if(!e)return t;let o=Sg(e.semver,t.semver,r);return o<0?e:o>0?t:t.operator==="<"&&e.operator==="<="?t:e};EI.exports=V4});var TI=D(function(A8,PI){var As=Ns(),Qd=xs(),G4=$t(),ep=ug(),J4=Uo(),K4=WP(),B4=XP(),W4=tT(),Y4=nT(),X4=iT(),Q4=cT(),eZ=lT(),tZ=pT(),rZ=ar(),oZ=gT(),nZ=_T(),sZ=Zd(),iZ=$T(),aZ=RT(),cZ=Ta(),uZ=Hd(),lZ=dg(),dZ=pg(),pZ=Gd(),fZ=Jd(),mZ=fg(),hZ=xT(),gZ=jT(),yZ=ka(),_Z=cr(),vZ=Ca(),SZ=XT(),bZ=eI(),$Z=rI(),wZ=sI(),RZ=aI(),EZ=Xd(),zZ=fI(),PZ=hI(),TZ=_I(),IZ=SI(),kZ=zI();PI.exports={parse:J4,valid:K4,clean:B4,inc:W4,diff:Y4,major:X4,minor:Q4,patch:eZ,prerelease:tZ,compare:rZ,rcompare:oZ,compareLoose:nZ,compareBuild:sZ,sort:iZ,rsort:aZ,gt:cZ,lt:uZ,eq:lZ,neq:dZ,gte:pZ,lte:fZ,cmp:mZ,coerce:hZ,truncate:gZ,Comparator:yZ,Range:_Z,satisfies:vZ,toComparators:SZ,maxSatisfying:bZ,minSatisfying:$Z,minVersion:wZ,validRange:RZ,outside:EZ,gtr:zZ,ltr:PZ,intersects:TZ,simplifyRange:IZ,subset:kZ,SemVer:G4,re:As.re,src:As.src,tokens:As.t,SEMVER_SPEC_VERSION:Qd.SEMVER_SPEC_VERSION,RELEASE_TYPES:Qd.RELEASE_TYPES,compareIdentifiers:ep.compareIdentifiers,rcompareIdentifiers:ep.rcompareIdentifiers}});var{create:pO,defineProperty:rc,getOwnPropertyDescriptor:fO,getOwnPropertyNames:mO,getPrototypeOf:hO}=Object,gO=Object.prototype.hasOwnProperty,G=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Jg=(e,t)=>{let r={};for(var o in e)rc(r,o,{get:e[o],enumerable:!0});if(t)rc(r,Symbol.toStringTag,{value:"Module"});return r},yO=(e,t,r,o)=>{if(t&&typeof t==="object"||typeof t==="function"){for(var n=mO(t),s=0,i=n.length,a;s<i;s++)if(a=n[s],!gO.call(e,a)&&a!==r)rc(e,a,{get:((c)=>t[c]).bind(null,a),enumerable:!(o=fO(t,a))||o.enumerable})}return e},oc=(e,t,r)=>(r=e!=null?pO(hO(e)):{},yO(t||!e||!e.__esModule?rc(r,"default",{value:e,enumerable:!0}):r,e));var _O=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),Kg=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),vO=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),SO=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"]);function Bg(e){return typeof e==="string"&&Kg.has(e.replace(/#$/,""))}function Wg(e,t){if(!("$schema"in e)||typeof e.$schema!=="string")return"2020-12";let r=e.$schema.replace(/#$/,"");if(_O.has(r))return"2020-12";if(Kg.has(r))return"2019-09";if(vO.has(r)||SO.has(r))return"draft-7";throw Error(`JSON Schema declares an unsupported dialect ("$schema": "${e.$schema.slice(0,200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${t}`)}var pp=Object.freeze({status:"aborted"});function U(e,t,r){function o(a,c){if(!a._zod)Object.defineProperty(a,"_zod",{value:{def:c,constr:i,traits:new Set},enumerable:!1});if(a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,c);let u=i.prototype,l=Object.keys(u);for(let d=0;d<l.length;d++){let f=l[d];if(!(f in a))a[f]=u[f].bind(a)}}let n=r?.Parent??Object;class s extends n{}Object.defineProperty(s,"name",{value:e});function i(a){var c;let u=r?.Parent?new s:this;o(u,a),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(i,"init",{value:o}),Object.defineProperty(i,Symbol.hasInstance,{value:(a)=>{if(r?.Parent&&a instanceof r.Parent)return!0;return a?._zod?.traits?.has(e)}}),Object.defineProperty(i,"name",{value:e}),i}var bO=Symbol("zod_brand");class Dr extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class fi extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}var nc={};function Kt(e){if(e)Object.assign(nc,e);return nc}function ic(e){let t=Object.values(e).filter((o)=>typeof o==="number");return Object.entries(e).filter(([o,n])=>t.indexOf(+o)===-1).map(([o,n])=>n)}function mp(e,t="|"){return e.map((r)=>_p(r)).join(t)}function mi(e,t){if(typeof t==="bigint")return t.toString();return t}function hi(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw Error("cached value already set")}}}function ac(e){return e===null||e===void 0}function cc(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Xg(e,t){let r=(e.toString().split(".")[1]||"").length,o=t.toString(),n=(o.split(".")[1]||"").length;if(n===0&&/\d?e-\d?/.test(o)){let c=o.match(/\d?e-(\d?)/);if(c?.[1])n=Number.parseInt(c[1])}let s=r>n?r:n,i=Number.parseInt(e.toFixed(s).replace(".","")),a=Number.parseInt(t.toFixed(s).replace(".",""));return i%a/10**s}var Yg=Symbol("evaluating");function Ce(e,t,r){let o=void 0;Object.defineProperty(e,t,{get(){if(o===Yg)return;if(o===void 0)o=Yg,o=r();return o},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Qo(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function to(...e){let t={};for(let r of e){let o=Object.getOwnPropertyDescriptors(r);Object.assign(t,o)}return Object.defineProperties({},t)}function hp(e){return JSON.stringify(e)}function Qg(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var gp="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function qn(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var ey=hi(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function en(e){if(qn(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(qn(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function yp(e){if(en(e))return{...e};if(Array.isArray(e))return[...e];return e}var ty=new Set(["string","number","symbol"]);function ro(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function dr(e,t,r){let o=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)o._zod.parent=e;return o}function ie(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 _p(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function ry(e){return Object.keys(e).filter((t)=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var oy={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]};function $O(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let s=to(e._zod.def,{get shape(){let i={};for(let a in t){if(!(a in r.shape))throw Error(`Unrecognized key: "${a}"`);if(!t[a])continue;i[a]=r.shape[a]}return Qo(this,"shape",i),i},checks:[]});return dr(e,s)}function wO(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let s=to(e._zod.def,{get shape(){let i={...e._zod.def.shape};for(let a in t){if(!(a in r.shape))throw Error(`Unrecognized key: "${a}"`);if(!t[a])continue;delete i[a]}return Qo(this,"shape",i),i},checks:[]});return dr(e,s)}function RO(e,t){if(!en(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let s=e._zod.def.shape;for(let i in t)if(Object.getOwnPropertyDescriptor(s,i)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=to(e._zod.def,{get shape(){let s={...e._zod.def.shape,...t};return Qo(this,"shape",s),s}});return dr(e,n)}function EO(e,t){if(!en(t))throw Error("Invalid input to safeExtend: expected a plain object");let r=to(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return Qo(this,"shape",o),o}});return dr(e,r)}function zO(e,t){let r=to(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t._zod.def.shape};return Qo(this,"shape",o),o},get catchall(){return t._zod.def.catchall},checks:[]});return dr(e,r)}function PO(e,t,r){let n=t._zod.def.checks;if(n&&n.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let i=to(t._zod.def,{get shape(){let a=t._zod.def.shape,c={...a};if(r)for(let u in r){if(!(u in a))throw Error(`Unrecognized key: "${u}"`);if(!r[u])continue;c[u]=e?new e({type:"optional",innerType:a[u]}):a[u]}else for(let u in a)c[u]=e?new e({type:"optional",innerType:a[u]}):a[u];return Qo(this,"shape",c),c},checks:[]});return dr(t,i)}function TO(e,t,r){let o=to(t._zod.def,{get shape(){let n=t._zod.def.shape,s={...n};if(r)for(let i in r){if(!(i in s))throw Error(`Unrecognized key: "${i}"`);if(!r[i])continue;s[i]=new e({type:"nonoptional",innerType:n[i]})}else for(let i in n)s[i]=new e({type:"nonoptional",innerType:n[i]});return Qo(this,"shape",s),s}});return dr(t,o)}function tn(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 oo(e,t){return t.map((r)=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function sc(e){return typeof e==="string"?e:e?.message}function _r(e,t,r){let o={...e,path:e.path??[]};if(!e.message){let n=sc(e.inst?._zod.def?.error?.(e))??sc(t?.error?.(e))??sc(r.customError?.(e))??sc(r.localeError?.(e))??"Invalid input";o.message=n}if(delete o.inst,delete o.continue,!t?.reportInput)delete o.input;return o}function uc(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function ny(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 rn(...e){let[t,r,o]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:o};return{...t}}var sy=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,mi,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},lc=U("$ZodError",sy),vp=U("$ZodError",sy,{Parent:Error});function Sp(e,t=(r)=>r.message){let r={},o=[];for(let n of e.issues)if(n.path.length>0)r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(t(n));else o.push(t(n));return{formErrors:o,fieldErrors:r}}function bp(e,t=(r)=>r.message){let r={_errors:[]},o=(n)=>{for(let s of n.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map((i)=>o({issues:i}));else if(s.code==="invalid_key")o({issues:s.issues});else if(s.code==="invalid_element")o({issues:s.issues});else if(s.path.length===0)r._errors.push(t(s));else{let i=r,a=0;while(a<s.path.length){let c=s.path[a];if(a!==s.path.length-1)i[c]=i[c]||{_errors:[]};else i[c]=i[c]||{_errors:[]},i[c]._errors.push(t(s));i=i[c],a++}}};return o(e),r}var dc=(e)=>(t,r,o,n)=>{let s=o?Object.assign(o,{async:!1}):{async:!1},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new Dr;if(i.issues.length){let a=new(n?.Err??e)(i.issues.map((c)=>_r(c,s,Kt())));throw gp(a,n?.callee),a}return i.value};var pc=(e)=>async(t,r,o,n)=>{let s=o?Object.assign(o,{async:!0}):{async:!0},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)i=await i;if(i.issues.length){let a=new(n?.Err??e)(i.issues.map((c)=>_r(c,s,Kt())));throw gp(a,n?.callee),a}return i.value};var gi=(e)=>(t,r,o)=>{let n=o?{...o,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},n);if(s instanceof Promise)throw new Dr;return s.issues.length?{success:!1,error:new(e??lc)(s.issues.map((i)=>_r(i,n,Kt())))}:{success:!0,data:s.value}},iy=gi(vp),yi=(e)=>async(t,r,o)=>{let n=o?Object.assign(o,{async:!0}):{async:!0},s=t._zod.run({value:r,issues:[]},n);if(s instanceof Promise)s=await s;return s.issues.length?{success:!1,error:new e(s.issues.map((i)=>_r(i,n,Kt())))}:{success:!0,data:s.value}},ay=yi(vp),cy=(e)=>(t,r,o)=>{let n=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return dc(e)(t,r,n)};var uy=(e)=>(t,r,o)=>dc(e)(t,r,o);var ly=(e)=>async(t,r,o)=>{let n=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return pc(e)(t,r,n)};var dy=(e)=>async(t,r,o)=>pc(e)(t,r,o);var py=(e)=>(t,r,o)=>{let n=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return gi(e)(t,r,n)};var fy=(e)=>(t,r,o)=>gi(e)(t,r,o);var my=(e)=>async(t,r,o)=>{let n=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return yi(e)(t,r,n)};var hy=(e)=>async(t,r,o)=>yi(e)(t,r,o);var gy=/^[cC][^\s-]{8,}$/,yy=/^[0-9a-z]+$/,_y=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,vy=/^[0-9a-vA-V]{20}$/,Sy=/^[A-Za-z0-9]{27}$/,by=/^[a-zA-Z0-9_-]{21}$/,$y=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var wy=/^([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})$/,$p=(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 Ry=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var kO="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Ey(){return new RegExp(kO,"u")}var zy=/^(?:(?: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])$/,Py=/^(([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 Ty=/^((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])$/,Iy=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ky=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,wp=/^[A-Za-z0-9_-]*$/;var Oy=/^\+[1-9]\d{6,14}$/,Cy="(?:(?:\\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])))",xy=new RegExp(`^${Cy}$`);function Ny(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}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function Ay(e){return new RegExp(`^${Ny(e)}$`)}function jy(e){let t=Ny({precision:e.precision}),r=["Z"];if(e.local)r.push("");if(e.offset)r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let o=`${t}(?:${r.join("|")})`;return new RegExp(`^${Cy}T(?:${o})$`)}var qy=(e)=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var My=/^-?\d+$/,Rp=/^-?\d+(?:\.\d+)?$/,Ly=/^(?:true|false)$/i,Dy=/^null$/i;var Uy=/^[^A-Z]*$/,Fy=/^[^a-z]*$/;var St=U("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Vy={number:"number",bigint:"bigint",object:"date"},Ep=U("$ZodCheckLessThan",(e,t)=>{St.init(e,t);let r=Vy[typeof t.value];e._zod.onattach.push((o)=>{let n=o._zod.bag,s=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(t.value<s)if(t.inclusive)n.maximum=t.value;else n.exclusiveMaximum=t.value}),e._zod.check=(o)=>{if(t.inclusive?o.value<=t.value:o.value<t.value)return;o.issues.push({origin:r,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),zp=U("$ZodCheckGreaterThan",(e,t)=>{St.init(e,t);let r=Vy[typeof t.value];e._zod.onattach.push((o)=>{let n=o._zod.bag,s=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(t.value>s)if(t.inclusive)n.minimum=t.value;else n.exclusiveMinimum=t.value}),e._zod.check=(o)=>{if(t.inclusive?o.value>=t.value:o.value>t.value)return;o.issues.push({origin:r,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Zy=U("$ZodCheckMultipleOf",(e,t)=>{St.init(e,t),e._zod.onattach.push((r)=>{var o;(o=r._zod.bag).multipleOf??(o.multipleOf=t.value)}),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"?r.value%t.value===BigInt(0):Xg(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})}}),Hy=U("$ZodCheckNumberFormat",(e,t)=>{St.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),o=r?"int":"number",[n,s]=oy[t.format];e._zod.onattach.push((i)=>{let a=i._zod.bag;if(a.format=t.format,a.minimum=n,a.maximum=s,r)a.pattern=My}),e._zod.check=(i)=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:o,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:o,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:o,inclusive:!0,continue:!t.abort});return}}if(a<n)i.issues.push({origin:"number",input:a,code:"too_small",minimum:n,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 Gy=U("$ZodCheckMaxLength",(e,t)=>{var r;St.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let n=o.value;return!ac(n)&&n.length!==void 0}),e._zod.onattach.push((o)=>{let n=o._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<n)o._zod.bag.maximum=t.maximum}),e._zod.check=(o)=>{let n=o.value;if(n.length<=t.maximum)return;let i=uc(n);o.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Jy=U("$ZodCheckMinLength",(e,t)=>{var r;St.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let n=o.value;return!ac(n)&&n.length!==void 0}),e._zod.onattach.push((o)=>{let n=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>n)o._zod.bag.minimum=t.minimum}),e._zod.check=(o)=>{let n=o.value;if(n.length>=t.minimum)return;let i=uc(n);o.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Ky=U("$ZodCheckLengthEquals",(e,t)=>{var r;St.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let n=o.value;return!ac(n)&&n.length!==void 0}),e._zod.onattach.push((o)=>{let n=o._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=(o)=>{let n=o.value,s=n.length;if(s===t.length)return;let i=uc(n),a=s>t.length;o.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),vi=U("$ZodCheckStringFormat",(e,t)=>{var r,o;if(St.init(e,t),e._zod.onattach.push((n)=>{let s=n._zod.bag;if(s.format=t.format,t.pattern)s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern)}),t.pattern)(r=e._zod).check??(r.check=(n)=>{if(t.pattern.lastIndex=0,t.pattern.test(n.value))return;n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(o=e._zod).check??(o.check=()=>{})}),By=U("$ZodCheckRegex",(e,t)=>{vi.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})}}),Wy=U("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Uy),vi.init(e,t)}),Yy=U("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Fy),vi.init(e,t)}),Xy=U("$ZodCheckIncludes",(e,t)=>{St.init(e,t);let r=ro(t.includes),o=new RegExp(typeof t.position==="number"?`^.{${t.position}}${r}`:r);t.pattern=o,e._zod.onattach.push((n)=>{let s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(o)}),e._zod.check=(n)=>{if(n.value.includes(t.includes,t.position))return;n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Qy=U("$ZodCheckStartsWith",(e,t)=>{St.init(e,t);let r=new RegExp(`^${ro(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push((o)=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=(o)=>{if(o.value.startsWith(t.prefix))return;o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),e_=U("$ZodCheckEndsWith",(e,t)=>{St.init(e,t);let r=new RegExp(`.*${ro(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push((o)=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=(o)=>{if(o.value.endsWith(t.suffix))return;o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});var t_=U("$ZodCheckOverwrite",(e,t)=>{St.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class Pp{constructor(e=[]){if(this.content=[],this.indent=0,this)this.args=e}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let r=e.split(`
10
- `).filter((s)=>s),o=Math.min(...r.map((s)=>s.length-s.trimStart().length)),n=r.map((s)=>s.slice(o)).map((s)=>" ".repeat(this.indent*2)+s);for(let s of n)this.content.push(s)}compile(){let e=Function,t=this?.args,o=[...(this?.content??[""]).map((n)=>` ${n}`)];return new e(...t,o.join(`
11
- `))}}var o_={major:4,minor:3,patch:6};var Ue=U("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=o_;let o=[...e._zod.def.checks??[]];if(e._zod.traits.has("$ZodCheck"))o.unshift(e);for(let n of o)for(let s of n._zod.onattach)s(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let n=(i,a,c)=>{let u=tn(i),l;for(let d of a){if(d._zod.def.when){if(!d._zod.def.when(i))continue}else if(u)continue;let f=i.issues.length,m=d._zod.check(i);if(m instanceof Promise&&c?.async===!1)throw new Dr;if(l||m instanceof Promise)l=(l??Promise.resolve()).then(async()=>{if(await m,i.issues.length===f)return;if(!u)u=tn(i,f)});else{if(i.issues.length===f)continue;if(!u)u=tn(i,f)}}if(l)return l.then(()=>i);return i},s=(i,a,c)=>{if(tn(i))return i.aborted=!0,i;let u=n(a,o,c);if(u instanceof Promise){if(c.async===!1)throw new Dr;return u.then((l)=>e._zod.parse(l,c))}return e._zod.parse(u,c)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction==="backward"){let u=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});if(u instanceof Promise)return u.then((l)=>s(l,i,a));return s(u,i,a)}let c=e._zod.parse(i,a);if(c instanceof Promise){if(a.async===!1)throw new Dr;return c.then((u)=>n(u,o,a))}return n(c,o,a)}}Ce(e,"~standard",()=>({validate:(n)=>{try{let s=iy(e,n);return s.success?{value:s.data}:{issues:s.error?.issues}}catch(s){return ay(e,n).then((i)=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),hc=U("$ZodString",(e,t)=>{Ue.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??qy(e._zod.bag),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch(n){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),He=U("$ZodStringFormat",(e,t)=>{vi.init(e,t),hc.init(e,t)}),p_=U("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=wy),He.init(e,t)}),f_=U("$ZodUUID",(e,t)=>{if(t.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=$p(o))}else t.pattern??(t.pattern=$p());He.init(e,t)}),m_=U("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Ry),He.init(e,t)}),h_=U("$ZodURL",(e,t)=>{He.init(e,t),e._zod.check=(r)=>{try{let o=r.value.trim(),n=new URL(o);if(t.hostname){if(t.hostname.lastIndex=0,!t.hostname.test(n.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){if(t.protocol.lastIndex=0,!t.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})}if(t.normalize)r.value=n.href;else r.value=o;return}catch(o){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),g_=U("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Ey()),He.init(e,t)}),y_=U("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=by),He.init(e,t)}),__=U("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=gy),He.init(e,t)}),v_=U("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=yy),He.init(e,t)}),S_=U("$ZodULID",(e,t)=>{t.pattern??(t.pattern=_y),He.init(e,t)}),b_=U("$ZodXID",(e,t)=>{t.pattern??(t.pattern=vy),He.init(e,t)}),$_=U("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Sy),He.init(e,t)}),w_=U("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=jy(t)),He.init(e,t)}),R_=U("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=xy),He.init(e,t)}),E_=U("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Ay(t)),He.init(e,t)}),z_=U("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=$y),He.init(e,t)}),P_=U("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=zy),He.init(e,t),e._zod.bag.format="ipv4"}),T_=U("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Py),He.init(e,t),e._zod.bag.format="ipv6",e._zod.check=(r)=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}});var I_=U("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Ty),He.init(e,t)}),k_=U("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Iy),He.init(e,t),e._zod.check=(r)=>{let o=r.value.split("/");try{if(o.length!==2)throw Error();let[n,s]=o;if(!s)throw Error();let i=Number(s);if(`${i}`!==s)throw Error();if(i<0||i>128)throw Error();new URL(`http://[${n}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function O_(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var C_=U("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=ky),He.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=(r)=>{if(O_(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function OO(e){if(!wp.test(e))return!1;let t=e.replace(/[-_]/g,(o)=>o==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return O_(r)}var x_=U("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=wp),He.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=(r)=>{if(OO(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),N_=U("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Oy),He.init(e,t)});function CO(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[o]=r;if(!o)return!1;let n=JSON.parse(atob(o));if("typ"in n&&n?.typ!=="JWT")return!1;if(!n.alg)return!1;if(t&&(!("alg"in n)||n.alg!==t))return!1;return!0}catch{return!1}}var A_=U("$ZodJWT",(e,t)=>{He.init(e,t),e._zod.check=(r)=>{if(CO(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var Ip=U("$ZodNumber",(e,t)=>{Ue.init(e,t),e._zod.pattern=e._zod.bag.pattern??Rp,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch(i){}let n=r.value;if(typeof n==="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let s=typeof n==="number"?Number.isNaN(n)?"NaN":!Number.isFinite(n)?"Infinity":void 0:void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...s?{received:s}:{}}),r}}),j_=U("$ZodNumberFormat",(e,t)=>{Hy.init(e,t),Ip.init(e,t)}),q_=U("$ZodBoolean",(e,t)=>{Ue.init(e,t),e._zod.pattern=Ly,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(s){}let n=r.value;if(typeof n==="boolean")return r;return r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),r}});var M_=U("$ZodNull",(e,t)=>{Ue.init(e,t),e._zod.pattern=Dy,e._zod.values=new Set([null]),e._zod.parse=(r,o)=>{let n=r.value;if(n===null)return r;return r.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),r}}),L_=U("$ZodAny",(e,t)=>{Ue.init(e,t),e._zod.parse=(r)=>r}),D_=U("$ZodUnknown",(e,t)=>{Ue.init(e,t),e._zod.parse=(r)=>r}),U_=U("$ZodNever",(e,t)=>{Ue.init(e,t),e._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function n_(e,t,r){if(e.issues.length)t.issues.push(...oo(r,e.issues));t.value[r]=e.value}var F_=U("$ZodArray",(e,t)=>{Ue.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:e}),r;r.value=Array(n.length);let s=[];for(let i=0;i<n.length;i++){let a=n[i],c=t.element._zod.run({value:a,issues:[]},o);if(c instanceof Promise)s.push(c.then((u)=>n_(u,r,i)));else n_(c,r,i)}if(s.length)return Promise.all(s).then(()=>r);return r}});function mc(e,t,r,o,n){if(e.issues.length){if(n&&!(r in o))return;t.issues.push(...oo(r,e.issues))}if(e.value===void 0){if(r in o)t.value[r]=void 0}else t.value[r]=e.value}function V_(e){let t=Object.keys(e.shape);for(let o of t)if(!e.shape?.[o]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${o}": expected a Zod schema`);let r=ry(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Z_(e,t,r,o,n,s){let i=[],a=n.keySet,c=n.catchall._zod,u=c.def.type,l=c.optout==="optional";for(let d in t){if(a.has(d))continue;if(u==="never"){i.push(d);continue}let f=c.run({value:t[d],issues:[]},o);if(f instanceof Promise)e.push(f.then((m)=>mc(m,r,d,t,l)));else mc(f,r,d,t,l)}if(i.length)r.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s});if(!e.length)return r;return Promise.all(e).then(()=>r)}var xO=U("$ZodObject",(e,t)=>{if(Ue.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let a=t.shape;Object.defineProperty(t,"shape",{get:()=>{let c={...a};return Object.defineProperty(t,"shape",{value:c}),c}})}let o=hi(()=>V_(t));Ce(e._zod,"propValues",()=>{let a=t.shape,c={};for(let u in a){let l=a[u]._zod;if(l.values){c[u]??(c[u]=new Set);for(let d of l.values)c[u].add(d)}}return c});let n=qn,s=t.catchall,i;e._zod.parse=(a,c)=>{i??(i=o.value);let u=a.value;if(!n(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),a;a.value={};let l=[],d=i.shape;for(let f of i.keys){let m=d[f],h=m._zod.optout==="optional",g=m._zod.run({value:u[f],issues:[]},c);if(g instanceof Promise)l.push(g.then((_)=>mc(_,a,f,u,h)));else mc(g,a,f,u,h)}if(!s)return l.length?Promise.all(l).then(()=>a):a;return Z_(l,u,a,c,o.value,e)}}),H_=U("$ZodObjectJIT",(e,t)=>{xO.init(e,t);let r=e._zod.parse,o=hi(()=>V_(t)),n=(f)=>{let m=new Pp(["shape","payload","ctx"]),h=o.value,g=(v)=>{let w=hp(v);return`shape[${w}]._zod.run({ value: input[${w}], issues: [] }, ctx)`};m.write("const input = payload.value;");let _=Object.create(null),y=0;for(let v of h.keys)_[v]=`key_${y++}`;m.write("const newResult = {};");for(let v of h.keys){let w=_[v],z=hp(v),b=f[v]?._zod?.optout==="optional";if(m.write(`const ${w} = ${g(v)};`),b)m.write(`
9
+ deps: ${r}}`};var gU={keyword:"dependencies",type:"object",schemaType:"object",error:hz.error,code(e){let[t,r]=yU(e);fz(e,t),mz(e,r)}};function yU({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 fz(e,t=e.schema){let{gen:r,data:n,it:o}=e;if(Object.keys(t).length===0)return;let s=r.let("missing");for(let i in t){let a=t[i];if(a.length===0)continue;let c=Lr.propertyInData(r,n,i,o.opts.ownProperties);if(e.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),o.allErrors)r.if(c,()=>{for(let u of a)Lr.checkReportMissingProp(e,u)});else r.if(xs._`${c} && (${Lr.checkMissingProp(e,a,s)})`),Lr.reportMissingProp(e,s),r.else()}}hz.validatePropertyDeps=fz;function mz(e,t=e.schema){let{gen:r,data:n,keyword:o,it:s}=e,i=r.name("valid");for(let a in t){if(pz.alwaysValidSchema(s,t[a]))continue;r.if(Lr.propertyInData(r,n,a,s.opts.ownProperties),()=>{let c=e.subschema({keyword:o,schemaProp:a},i);e.mergeValidEvaluated(c,i)},()=>r.var(i,!0)),e.ok(i)}}hz.validateSchemaDeps=mz;hz.default=gU});var Sz=D(function(vz){Object.defineProperty(vz,"__esModule",{value:!0});var Cd=$e(),_z=ke(),SU={message:"property name must be valid",params:({params:e})=>Cd._`{propertyName: ${e.propertyName}}`},bU={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:SU,code(e){let{gen:t,schema:r,data:n,it:o}=e;if(_z.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(Cd.not(s),()=>{if(e.error(!0),!o.allErrors)t.break()})}),e.ok(s)}};vz.default=bU});var ag=D(function(bz){Object.defineProperty(bz,"__esModule",{value:!0});var Mn=sr(),ot=$e(),wU=nr(),Ln=ke(),RU={message:"must NOT have additional properties",params:({params:e})=>ot._`{additionalProperty: ${e.additionalProperty}}`},EU={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:RU,code(e){let{gen:t,schema:r,parentSchema:n,data:o,errsCount:s,it:i}=e;if(!s)throw Error("ajv implementation error");let{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&Ln.alwaysValidSchema(i,r))return;let u=Mn.allSchemaProperties(n.properties),l=Mn.allSchemaProperties(n.patternProperties);d(),e.ok(ot._`${s} === ${wU.default.errors}`);function d(){t.forIn("key",o,(_)=>{if(!u.length&&!l.length)h(_);else t.if(p(_),()=>h(_))})}function p(_){let y;if(u.length>8){let S=Ln.schemaRefOrVal(i,n.properties,"properties");y=Mn.isOwnProperty(t,S,_)}else if(u.length)y=ot.or(...u.map((S)=>ot._`${_} === ${S}`));else y=ot.nil;if(l.length)y=ot.or(y,...l.map((S)=>ot._`${Mn.usePattern(e,S)}.test(${_})`));return ot.not(y)}function m(_){t.code(ot._`delete ${o}[${_}]`)}function h(_){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){m(_);return}if(r===!1){if(e.setParams({additionalProperty:_}),e.error(),!a)t.break();return}if(typeof r=="object"&&!Ln.alwaysValidSchema(i,r)){let y=t.name("valid");if(c.removeAdditional==="failing")g(_,y,!1),t.if(ot.not(y),()=>{e.reset(),m(_)});else if(g(_,y),!a)t.if(ot.not(y),()=>t.break())}}function g(_,y,S){let v={keyword:"additionalProperties",dataProp:_,dataPropType:Ln.Type.Str};if(S===!1)Object.assign(v,{compositeRule:!0,createErrors:!1,allErrors:!1});e.subschema(v,y)}}};bz.default=EU});var Ez=D(function(Rz){Object.defineProperty(Rz,"__esModule",{value:!0});var wz=ws(),Ad=sr(),Cs=ke(),$z=ag(),PU={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)$z.default.code(new wz.KeywordCxt(s,$z.default,"additionalProperties"));let i=Ad.allSchemaProperties(r);for(let d of i)s.definedProperties.add(d);if(s.opts.unevaluated&&i.length&&s.props!==!0)s.props=Cs.mergeEvaluated.props(t,Cs.toHash(i),s.props);let a=i.filter((d)=>!Cs.alwaysValidSchema(s,r[d]));if(a.length===0)return;let c=t.name("valid");for(let d of a){if(u(d))l(d);else{if(t.if(Ad.propertyInData(t,o,d,s.opts.ownProperties)),l(d),!s.allErrors)t.else().var(c,!0);t.endIf()}e.it.definedProperties.add(d),e.ok(c)}function u(d){return s.opts.useDefaults&&!s.compositeRule&&r[d].default!==void 0}function l(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};Rz.default=PU});var Pz=D(function(zz){Object.defineProperty(zz,"__esModule",{value:!0});var Nd=sr(),Dn=$e(),jd=ke(),qd=ke(),IU={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:o,it:s}=e,{opts:i}=s,a=Nd.allSchemaProperties(r),c=a.filter((g)=>jd.alwaysValidSchema(s,r[g]));if(a.length===0||c.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let u=i.strictSchema&&!i.allowMatchingProperties&&o.properties,l=t.name("valid");if(s.props!==!0&&!(s.props instanceof Dn.Name))s.props=qd.evaluatedPropsToName(t,s.props);let{props:d}=s;p();function p(){for(let g of a){if(u)m(g);if(s.allErrors)h(g);else t.var(l,!0),h(g),t.if(l)}}function m(g){for(let _ in u)if(new RegExp(g).test(_))jd.checkStrictMode(s,`property ${_} matches pattern ${g} (use allowMatchingProperties)`)}function h(g){t.forIn("key",n,(_)=>{t.if(Dn._`${Nd.usePattern(e,g)}.test(${_})`,()=>{let y=c.includes(g);if(!y)e.subschema({keyword:"patternProperties",schemaProp:g,dataProp:_,dataPropType:qd.Type.Str},l);if(s.opts.unevaluated&&d!==!0)t.assign(Dn._`${d}[${_}]`,!0);else if(!y&&!s.allErrors)t.if(Dn.not(l),()=>t.break())})})}}};zz.default=IU});var kz=D(function(Iz){Object.defineProperty(Iz,"__esModule",{value:!0});var Tz=ke(),OU={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if(Tz.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"}};Iz.default=OU});var Cz=D(function(xz){Object.defineProperty(xz,"__esModule",{value:!0});var Oz=sr(),CU={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Oz.validateUnion,error:{message:"must match a schema in anyOf"}};xz.default=CU});var jz=D(function(Nz){Object.defineProperty(Nz,"__esModule",{value:!0});var Un=$e(),Az=ke(),NU={message:"must match exactly one schema in oneOf",params:({params:e})=>Un._`{passingSchemas: ${e.passing}}`},jU={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:NU,code(e){let{gen:t,schema:r,parentSchema:n,it:o}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;let s=r,i=t.let("valid",!1),a=t.let("passing",null),c=t.name("_valid");e.setParams({passing:a}),t.block(u),e.result(i,()=>e.reset(),()=>e.error(!0));function u(){s.forEach((l,d)=>{let p;if(Az.alwaysValidSchema(o,l))t.var(c,!0);else p=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c);if(d>0)t.if(Un._`${c} && ${i}`).assign(i,!1).assign(a,Un._`[${a}, ${d}]`).else();t.if(c,()=>{if(t.assign(i,!0),t.assign(a,d),p)e.mergeEvaluated(p,Un.Name)})})}}};Nz.default=jU});var Lz=D(function(Mz){Object.defineProperty(Mz,"__esModule",{value:!0});var qz=ke(),MU={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(qz.alwaysValidSchema(n,s))return;let a=e.subschema({keyword:"allOf",schemaProp:i},o);e.ok(o),e.mergeEvaluated(a)})}};Mz.default=MU});var Fz=D(function(Uz){Object.defineProperty(Uz,"__esModule",{value:!0});var Fn=$e(),Md=ke(),DU={message:({params:e})=>Fn.str`must match "${e.ifClause}" schema`,params:({params:e})=>Fn._`{failingKeyword: ${e.ifClause}}`},UU={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:DU,code(e){let{gen:t,parentSchema:r,it:n}=e;if(r.then===void 0&&r.else===void 0)Md.checkStrictMode(n,'"if" without "then" and "else" is ignored');let o=Dz(n,"then"),s=Dz(n,"else");if(!o&&!s)return;let i=t.let("valid",!0),a=t.name("_valid");if(c(),e.reset(),o&&s){let l=t.let("ifClause");e.setParams({ifClause:l}),t.if(a,u("then",l),u("else",l))}else if(o)t.if(a,u("then"));else t.if(Fn.not(a),u("else"));e.pass(i,()=>e.error(!0));function c(){let l=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(l)}function u(l,d){return()=>{let p=e.subschema({keyword:l},a);if(t.assign(i,a),e.mergeValidEvaluated(p,i),d)t.assign(d,Fn._`${l}`);else e.setParams({ifClause:l})}}}};function Dz(e,t){let r=e.schema[t];return r!==void 0&&!Md.alwaysValidSchema(e,r)}Uz.default=UU});var Zz=D(function(Hz){Object.defineProperty(Hz,"__esModule",{value:!0});var Vz=ke(),VU={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){if(t.if===void 0)Vz.checkStrictMode(r,`"${e}" without "if" is ignored`)}};Hz.default=VU});var cg=D(function(Gz){Object.defineProperty(Gz,"__esModule",{value:!0});var ZU=sg(),GU=oz(),JU=ig(),KU=uz(),BU=dz(),WU=xd(),YU=Sz(),XU=ag(),QU=Ez(),eF=Pz(),tF=kz(),rF=Cz(),nF=jz(),oF=Lz(),sF=Fz(),iF=Zz();function aF(e=!1){let t=[tF.default,rF.default,nF.default,oF.default,sF.default,iF.default,YU.default,XU.default,WU.default,QU.default,eF.default];if(e)t.push(GU.default,KU.default);else t.push(ZU.default,JU.default);return t.push(BU.default),t}Gz.default=aF});var ug=D(function(Bz){Object.defineProperty(Bz,"__esModule",{value:!0});Bz.dynamicAnchor=void 0;var As=$e(),uF=nr(),Ld=Ta(),Jz=Pd(),lF={keyword:"$dynamicAnchor",schemaType:"string",code:(e)=>Kz(e,e.schema)};function Kz(e,t){let{gen:r,it:n}=e;n.schemaEnv.root.dynamicAnchors[t]=!0;let o=As._`${uF.default.dynamicAnchors}${As.getProperty(t)}`,s=n.errSchemaPath==="#"?n.validateName:dF(e);r.if(As._`!${o}`,()=>r.assign(o,s))}Bz.dynamicAnchor=Kz;function dF(e){let{schemaEnv:t,schema:r,self:n}=e.it,{root:o,baseId:s,localRefs:i,meta:a}=t.root,{schemaId:c}=n.opts,u=new Ld.SchemaEnv({schema:r,schemaId:c,root:o,baseId:s,localRefs:i,meta:a});return Ld.compileSchema.call(n,u),Jz.getValidate(e,u)}Bz.default=lF});var lg=D(function(Xz){Object.defineProperty(Xz,"__esModule",{value:!0});Xz.dynamicRef=void 0;var Dd=$e(),fF=nr(),Ud=Pd(),mF={keyword:"$dynamicRef",schemaType:"string",code:(e)=>Yz(e,e.schema)};function Yz(e,t){let{gen:r,keyword:n,it:o}=e;if(t[0]!=="#")throw Error(`"${n}" only supports hash fragment reference`);let s=t.slice(1);if(o.allErrors)i();else{let c=r.let("valid",!1);i(c),e.ok(c)}function i(c){if(o.schemaEnv.root.dynamicAnchors[s]){let u=r.let("_v",Dd._`${fF.default.dynamicAnchors}${Dd.getProperty(s)}`);r.if(u,a(u,c),a(o.validateName,c))}else a(o.validateName,c)()}function a(c,u){return u?()=>r.block(()=>{Ud.callRef(e,c),r.let(u,!0)}):()=>Ud.callRef(e,c)}}Xz.dynamicRef=Yz;Xz.default=mF});var nP=D(function(rP){Object.defineProperty(rP,"__esModule",{value:!0});var eP=ug(),tP=ke(),gF={keyword:"$recursiveAnchor",schemaType:"boolean",code(e){if(e.schema)eP.dynamicAnchor(e,"");else tP.checkStrictMode(e.it,"$recursiveAnchor: false is ignored")}};rP.default=gF});var iP=D(function(sP){Object.defineProperty(sP,"__esModule",{value:!0});var oP=lg(),_F={keyword:"$recursiveRef",schemaType:"string",code:(e)=>oP.dynamicRef(e,e.schema)};sP.default=_F});var cP=D(function(aP){Object.defineProperty(aP,"__esModule",{value:!0});var SF=ug(),bF=lg(),$F=nP(),wF=iP(),RF=[SF.default,bF.default,$F.default,wF.default];aP.default=RF});var lP=D(function(uP){Object.defineProperty(uP,"__esModule",{value:!0});var Fd=xd(),zF={keyword:"dependentRequired",type:"object",schemaType:"object",error:Fd.error,code:(e)=>Fd.validatePropertyDeps(e)};uP.default=zF});var fP=D(function(pP){Object.defineProperty(pP,"__esModule",{value:!0});var dP=xd(),TF={keyword:"dependentSchemas",type:"object",schemaType:"object",code:(e)=>dP.validateSchemaDeps(e)};pP.default=TF});var gP=D(function(hP){Object.defineProperty(hP,"__esModule",{value:!0});var mP=ke(),kF={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:e,parentSchema:t,it:r}){if(t.contains===void 0)mP.checkStrictMode(r,`"${e}" without "contains" is ignored`)}};hP.default=kF});var _P=D(function(yP){Object.defineProperty(yP,"__esModule",{value:!0});var xF=lP(),CF=fP(),AF=gP(),NF=[xF.default,CF.default,AF.default];yP.default=NF});var SP=D(function(vP){Object.defineProperty(vP,"__esModule",{value:!0});var xt=$e(),Vd=ke(),qF=nr(),MF={message:"must NOT have unevaluated properties",params:({params:e})=>xt._`{unevaluatedProperty: ${e.unevaluatedProperty}}`},LF={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:MF,code(e){let{gen:t,schema:r,data:n,errsCount:o,it:s}=e;if(!o)throw Error("ajv implementation error");let{allErrors:i,props:a}=s;if(a instanceof xt.Name)t.if(xt._`${a} !== true`,()=>t.forIn("key",n,(d)=>t.if(u(a,d),()=>c(d))));else if(a!==!0)t.forIn("key",n,(d)=>a===void 0?c(d):t.if(l(a,d),()=>c(d)));s.props=!0,e.ok(xt._`${o} === ${qF.default.errors}`);function c(d){if(r===!1){if(e.setParams({unevaluatedProperty:d}),e.error(),!i)t.break();return}if(!Vd.alwaysValidSchema(s,r)){let p=t.name("valid");if(e.subschema({keyword:"unevaluatedProperties",dataProp:d,dataPropType:Vd.Type.Str},p),!i)t.if(xt.not(p),()=>t.break())}}function u(d,p){return xt._`!${d} || !${d}[${p}]`}function l(d,p){let m=[];for(let h in d)if(d[h]===!0)m.push(xt._`${p} !== ${h}`);return xt.and(...m)}}};vP.default=LF});var $P=D(function(bP){Object.defineProperty(bP,"__esModule",{value:!0});var Gt=$e(),Hd=ke(),UF={message:({params:{len:e}})=>Gt.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Gt._`{limit: ${e}}`},FF={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:UF,code(e){let{gen:t,schema:r,data:n,it:o}=e,s=o.items||0;if(s===!0)return;let i=t.const("len",Gt._`${n}.length`);if(r===!1)e.setParams({len:s}),e.fail(Gt._`${i} > ${s}`);else if(typeof r=="object"&&!Hd.alwaysValidSchema(o,r)){let c=t.var("valid",Gt._`${i} <= ${s}`);t.if(Gt.not(c),()=>a(c,s)),e.ok(c)}o.items=!0;function a(c,u){t.forRange("i",u,i,(l)=>{if(e.subschema({keyword:"unevaluatedItems",dataProp:l,dataPropType:Hd.Type.Num},c),!o.allErrors)t.if(Gt.not(c),()=>t.break())})}}};bP.default=FF});var RP=D(function(wP){Object.defineProperty(wP,"__esModule",{value:!0});var HF=SP(),ZF=$P(),GF=[HF.default,ZF.default];wP.default=GF});var zP=D(function(EP){Object.defineProperty(EP,"__esModule",{value:!0});var ze=$e(),KF={message:({schemaCode:e})=>ze.str`must match format "${e}"`,params:({schemaCode:e})=>ze._`{format: ${e}}`},BF={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:KF,code(e,t){let{gen:r,data:n,$data:o,schema:s,schemaCode:i,it:a}=e,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=a;if(!c.validateFormats)return;if(o)p();else m();function p(){let h=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),g=r.const("fDef",ze._`${h}[${i}]`),_=r.let("fType"),y=r.let("format");r.if(ze._`typeof ${g} == "object" && !(${g} instanceof RegExp)`,()=>r.assign(_,ze._`${g}.type || "string"`).assign(y,ze._`${g}.validate`),()=>r.assign(_,ze._`"string"`).assign(y,g)),e.fail$data(ze.or(S(),v()));function S(){if(c.strictSchema===!1)return ze.nil;return ze._`${i} && !${y}`}function v(){let w=l.$async?ze._`(${g}.async ? await ${y}(${n}) : ${y}(${n}))`:ze._`${y}(${n})`,z=ze._`(typeof ${y} == "function" ? ${w} : ${y}.test(${n}))`;return ze._`${y} && ${y} !== true && ${_} === ${t} && !${z}`}}function m(){let h=d.formats[s];if(!h){S();return}if(h===!0)return;let[g,_,y]=v(h);if(g===t)e.pass(w());function S(){if(c.strictSchema===!1){d.logger.warn(z());return}throw Error(z());function z(){return`unknown format "${s}" ignored in schema at path "${u}"`}}function v(z){let R=z instanceof RegExp?ze.regexpCode(z):c.code.formats?ze._`${c.code.formats}${ze.getProperty(s)}`:void 0,b=r.scopeValue("formats",{key:s,ref:z,code:R});if(typeof z=="object"&&!(z instanceof RegExp))return[z.type||"string",z.validate,ze._`${b}.validate`];return["string",z,b]}function w(){if(typeof h=="object"&&!(h instanceof RegExp)&&h.async){if(!l.$async)throw Error("async format in sync schema");return ze._`await ${y}(${n})`}return typeof _=="function"?ze._`${y}(${n})`:ze._`${y}.test(${n})`}}}};EP.default=BF});var dg=D(function(PP){Object.defineProperty(PP,"__esModule",{value:!0});var YF=zP(),XF=[YF.default];PP.default=XF});var pg=D(function(TP){Object.defineProperty(TP,"__esModule",{value:!0});TP.contentVocabulary=TP.metadataVocabulary=void 0;TP.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];TP.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var OP=D(function(kP){Object.defineProperty(kP,"__esModule",{value:!0});var tV=ng(),rV=og(),nV=cg(),oV=cP(),sV=_P(),iV=RP(),aV=dg(),Zd=pg(),cV=[oV.default,tV.default,rV.default,(0,nV.default)(!0),aV.default,Zd.metadataVocabulary,Zd.contentVocabulary,sV.default,iV.default];kP.default=cV});var NP=D(function(CP){Object.defineProperty(CP,"__esModule",{value:!0});CP.DiscrError=void 0;var xP;(function(e){e.Tag="tag",e.Mapping="mapping"})(xP||(CP.DiscrError=xP={}))});var fg=D(function(qP){Object.defineProperty(qP,"__esModule",{value:!0});var ar=$e(),Ns=NP(),Gd=Ta(),lV=Es(),jP=ke(),dV={message:({params:{discrError:e,tagName:t}})=>e===Ns.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>ar._`{error: ${e}, tag: ${r}, tagValue: ${t}}`},pV={keyword:"discriminator",type:"object",schemaType:"object",error:dV,code(e){let{gen:t,data:r,schema:n,parentSchema:o,it:s}=e,{oneOf:i}=o;if(!s.opts.discriminator)throw Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw Error("discriminator: requires propertyName");if(n.mapping)throw Error("discriminator: mapping is not supported");if(!i)throw Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),u=t.const("tag",ar._`${r}${ar.getProperty(a)}`);t.if(ar._`typeof ${u} == "string"`,()=>l(),()=>e.error(!1,{discrError:Ns.DiscrError.Tag,tag:u,tagName:a})),e.ok(c);function l(){let m=p();t.if(!1);for(let h in m)t.elseIf(ar._`${u} === ${h}`),t.assign(c,d(m[h]));t.else(),e.error(!1,{discrError:Ns.DiscrError.Mapping,tag:u,tagName:a}),t.endIf()}function d(m){let h=t.name("valid"),g=e.subschema({keyword:"oneOf",schemaProp:m},h);return e.mergeEvaluated(g,ar.Name),h}function p(){var m;let h={},g=y(o),_=!0;for(let w=0;w<i.length;w++){let z=i[w];if((z===null||z===void 0?void 0:z.$ref)&&!jP.schemaHasRulesButRef(z,s.self.RULES)){let b=z.$ref;if(z=Gd.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,b),z instanceof Gd.SchemaEnv)z=z.schema;if(z===void 0)throw new lV.default(s.opts.uriResolver,s.baseId,b)}let R=(m=z===null||z===void 0?void 0:z.properties)===null||m===void 0?void 0:m[a];if(typeof R!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);_=_&&(g||y(z)),S(R,w)}if(!_)throw Error(`discriminator: "${a}" must be required`);return h;function y({required:w}){return Array.isArray(w)&&w.includes(a)}function S(w,z){if(w.const)v(w.const,z);else if(w.enum)for(let R of w.enum)v(R,z);else throw Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function v(w,z){if(typeof w!="string"||w in h)throw Error(`discriminator: "${a}" values must be unique strings`);h[w]=z}}}};qP.default=pV});var MP=D(function(eY,mV){mV.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/schema",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/unevaluated"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format-annotation"},{$ref:"meta/content"}],type:["object","boolean"],$comment:"This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",properties:{definitions:{$comment:'"definitions" has been replaced by "$defs".',type:"object",additionalProperties:{$dynamicRef:"#meta"},deprecated:!0,default:{}},dependencies:{$comment:'"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',type:"object",additionalProperties:{anyOf:[{$dynamicRef:"#meta"},{$ref:"meta/validation#/$defs/stringArray"}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:'"$recursiveAnchor" has been replaced by "$dynamicAnchor".',$ref:"meta/core#/$defs/anchorString",deprecated:!0},$recursiveRef:{$comment:'"$recursiveRef" has been replaced by "$dynamicRef".',$ref:"meta/core#/$defs/uriReferenceString",deprecated:!0}}}});var LP=D(function(tY,hV){hV.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/applicator":!0},$dynamicAnchor:"meta",title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{prefixItems:{$ref:"#/$defs/schemaArray"},items:{$dynamicRef:"#meta"},contains:{$dynamicRef:"#meta"},additionalProperties:{$dynamicRef:"#meta"},properties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},patternProperties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},propertyNames:{$dynamicRef:"#meta"},if:{$dynamicRef:"#meta"},then:{$dynamicRef:"#meta"},else:{$dynamicRef:"#meta"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$dynamicRef:"#meta"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$dynamicRef:"#meta"}}}}});var DP=D(function(rY,gV){gV.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/unevaluated",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},$dynamicAnchor:"meta",title:"Unevaluated applicator vocabulary meta-schema",type:["object","boolean"],properties:{unevaluatedItems:{$dynamicRef:"#meta"},unevaluatedProperties:{$dynamicRef:"#meta"}}}});var UP=D(function(nY,yV){yV.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/content",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentEncoding:{type:"string"},contentMediaType:{type:"string"},contentSchema:{$dynamicRef:"#meta"}}}});var FP=D(function(oY,_V){_V.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/core",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0},$dynamicAnchor:"meta",title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{$ref:"#/$defs/uriReferenceString",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{$ref:"#/$defs/uriString"},$ref:{$ref:"#/$defs/uriReferenceString"},$anchor:{$ref:"#/$defs/anchorString"},$dynamicRef:{$ref:"#/$defs/uriReferenceString"},$dynamicAnchor:{$ref:"#/$defs/anchorString"},$vocabulary:{type:"object",propertyNames:{$ref:"#/$defs/uriString"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$dynamicRef:"#meta"}}},$defs:{anchorString:{type:"string",pattern:"^[A-Za-z_][-A-Za-z0-9._]*$"},uriString:{type:"string",format:"uri"},uriReferenceString:{type:"string",format:"uri-reference"}}}});var VP=D(function(sY,vV){vV.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/format-annotation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},$dynamicAnchor:"meta",title:"Format vocabulary meta-schema for annotation results",type:["object","boolean"],properties:{format:{type:"string"}}}});var HP=D(function(iY,SV){SV.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},$dynamicAnchor:"meta",title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}});var ZP=D(function(aY,bV){bV.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/validation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/validation":!0},$dynamicAnchor:"meta",title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}});var JP=D(function(GP){Object.defineProperty(GP,"__esModule",{value:!0});var $V=MP(),wV=LP(),RV=DP(),EV=UP(),zV=FP(),PV=VP(),TV=HP(),IV=ZP(),kV=["/properties"];function OV(e){return[$V,wV,RV,EV,zV,t(this,PV),TV,t(this,IV)].forEach((r)=>this.addMetaSchema(r,void 0,!1)),this;function t(r,n){return e?r.$dataMetaSchema(n,kV):n}}GP.default=OV});var KP=D(function(Jt,hg){Object.defineProperty(Jt,"__esModule",{value:!0});Jt.MissingRefError=Jt.ValidationError=Jt.CodeGen=Jt.Name=Jt.nil=Jt.stringify=Jt.str=Jt._=Jt.KeywordCxt=Jt.Ajv2020=void 0;var CV=rg(),AV=OP(),NV=fg(),jV=JP(),mg="https://json-schema.org/draft/2020-12/schema";class Oa extends CV.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){if(super._addVocabularies(),AV.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(NV.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:e,meta:t}=this.opts;if(!t)return;jV.default.call(this,e),this.refs["http://json-schema.org/schema"]=mg}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(mg)?mg:void 0)}}Jt.Ajv2020=Oa;hg.exports=Jt=Oa;hg.exports.Ajv2020=Oa;Object.defineProperty(Jt,"__esModule",{value:!0});Jt.default=Oa;var qV=ws();Object.defineProperty(Jt,"KeywordCxt",{enumerable:!0,get:function(){return qV.KeywordCxt}});var js=$e();Object.defineProperty(Jt,"_",{enumerable:!0,get:function(){return js._}});Object.defineProperty(Jt,"str",{enumerable:!0,get:function(){return js.str}});Object.defineProperty(Jt,"stringify",{enumerable:!0,get:function(){return js.stringify}});Object.defineProperty(Jt,"nil",{enumerable:!0,get:function(){return js.nil}});Object.defineProperty(Jt,"Name",{enumerable:!0,get:function(){return js.Name}});Object.defineProperty(Jt,"CodeGen",{enumerable:!0,get:function(){return js.CodeGen}});var MV=za();Object.defineProperty(Jt,"ValidationError",{enumerable:!0,get:function(){return MV.default}});var LV=Es();Object.defineProperty(Jt,"MissingRefError",{enumerable:!0,get:function(){return LV.default}})});var oT=D(function(rT){Object.defineProperty(rT,"__esModule",{value:!0});rT.formatNames=rT.fastFormats=rT.fullFormats=void 0;function Dr(e,t){return{validate:e,compare:t}}rT.fullFormats={date:Dr(XP,vg),time:Dr(yg(!0),Sg),"date-time":Dr(BP(!0),eT),"iso-time":Dr(yg(),QP),"iso-date-time":Dr(BP(),tT),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:JV,"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:e9,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:KV,int32:{type:"number",validate:YV},int64:{type:"number",validate:XV},float:{type:"number",validate:YP},double:{type:"number",validate:YP},password:!0,binary:!0};rT.fastFormats={...rT.fullFormats,date:Dr(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,vg),time:Dr(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Sg),"date-time":Dr(/^\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,eT),"iso-time":Dr(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,QP),"iso-date-time":Dr(/^\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,tT),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};rT.formatNames=Object.keys(rT.fullFormats);function FV(e){return e%4===0&&(e%100!==0||e%400===0)}var VV=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,HV=[0,31,28,31,30,31,30,31,31,30,31,30,31];function XP(e){let t=VV.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&&FV(r)?29:HV[n])}function vg(e,t){if(!(e&&t))return;if(e>t)return 1;if(e<t)return-1;return 0}var gg=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function yg(e){return function(r){let n=gg.exec(r);if(!n)return!1;let o=+n[1],s=+n[2],i=+n[3],a=n[4],c=n[5]==="-"?-1:1,u=+(n[6]||0),l=+(n[7]||0);if(u>23||l>59||e&&!a)return!1;if(o<=23&&s<=59&&i<60)return!0;let d=s-l*c,p=o-u*c-(d<0?1:0);return(p===23||p===-1)&&(d===59||d===-1)&&i<61}}function Sg(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 QP(e,t){if(!(e&&t))return;let r=gg.exec(e),n=gg.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 _g=/t|\s/i;function BP(e){let t=yg(e);return function(n){let o=n.split(_g);return o.length===2&&XP(o[0])&&t(o[1])}}function eT(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 tT(e,t){if(!(e&&t))return;let[r,n]=e.split(_g),[o,s]=t.split(_g),i=vg(r,o);if(i===void 0)return;return i||Sg(n,s)}var ZV=/\/|:/,GV=/^(?:[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 JV(e){return ZV.test(e)&&GV.test(e)}var WP=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function KV(e){return WP.lastIndex=0,WP.test(e)}var BV=-2147483648,WV=2147483647;function YV(e){return Number.isInteger(e)&&e<=WV&&e>=BV}function XV(e){return Number.isInteger(e)}function YP(){return!0}var QV=/[^\\]\\Z/;function e9(e){if(QV.test(e))return!1;try{return new RegExp(e),!0}catch(t){return!1}}});var iT=D(function(sT){Object.defineProperty(sT,"__esModule",{value:!0});var r9=ng(),n9=og(),o9=cg(),s9=dg(),Jd=pg(),i9=[r9.default,n9.default,(0,o9.default)(),s9.default,Jd.metadataVocabulary,Jd.contentVocabulary];sT.default=i9});var aT=D(function(vY,c9){c9.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 uT=D(function(Kt,$g){Object.defineProperty(Kt,"__esModule",{value:!0});Kt.MissingRefError=Kt.ValidationError=Kt.CodeGen=Kt.Name=Kt.nil=Kt.stringify=Kt.str=Kt._=Kt.KeywordCxt=Kt.Ajv=void 0;var u9=rg(),l9=iT(),d9=fg(),cT=aT(),p9=["/properties"],Kd="http://json-schema.org/draft-07/schema";class xa extends u9.default{_addVocabularies(){if(super._addVocabularies(),l9.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(d9.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(cT,p9):cT;this.addMetaSchema(e,Kd,!1),this.refs["http://json-schema.org/schema"]=Kd}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Kd)?Kd:void 0)}}Kt.Ajv=xa;$g.exports=Kt=xa;$g.exports.Ajv=xa;Object.defineProperty(Kt,"__esModule",{value:!0});Kt.default=xa;var f9=ws();Object.defineProperty(Kt,"KeywordCxt",{enumerable:!0,get:function(){return f9.KeywordCxt}});var qs=$e();Object.defineProperty(Kt,"_",{enumerable:!0,get:function(){return qs._}});Object.defineProperty(Kt,"str",{enumerable:!0,get:function(){return qs.str}});Object.defineProperty(Kt,"stringify",{enumerable:!0,get:function(){return qs.stringify}});Object.defineProperty(Kt,"nil",{enumerable:!0,get:function(){return qs.nil}});Object.defineProperty(Kt,"Name",{enumerable:!0,get:function(){return qs.Name}});Object.defineProperty(Kt,"CodeGen",{enumerable:!0,get:function(){return qs.CodeGen}});var m9=za();Object.defineProperty(Kt,"ValidationError",{enumerable:!0,get:function(){return m9.default}});var h9=Es();Object.defineProperty(Kt,"MissingRefError",{enumerable:!0,get:function(){return h9.default}})});var pT=D(function(dT){Object.defineProperty(dT,"__esModule",{value:!0});dT.formatLimitDefinition=void 0;var lT=uT(),st=$e(),Vn=st.operators,Bd={formatMaximum:{okStr:"<=",ok:Vn.LTE,fail:Vn.GT},formatMinimum:{okStr:">=",ok:Vn.GTE,fail:Vn.LT},formatExclusiveMaximum:{okStr:"<",ok:Vn.LT,fail:Vn.GTE},formatExclusiveMinimum:{okStr:">",ok:Vn.GT,fail:Vn.LTE}},_9={message:({keyword:e,schemaCode:t})=>st.str`should be ${Bd[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>st._`{comparison: ${Bd[e].okStr}, limit: ${t}}`};dT.formatLimitDefinition={keyword:Object.keys(Bd),type:"string",schemaType:"string",$data:!0,error:_9,code(e){let{gen:t,data:r,schemaCode:n,keyword:o,it:s}=e,{opts:i,self:a}=s;if(!i.validateFormats)return;let c=new lT.KeywordCxt(s,a.RULES.all.format.definition,"format");if(c.$data)u();else l();function u(){let p=t.scopeValue("formats",{ref:a.formats,code:i.code.formats}),m=t.const("fmt",st._`${p}[${c.schemaCode}]`);e.fail$data(st.or(st._`typeof ${m} != "object"`,st._`${m} instanceof RegExp`,st._`typeof ${m}.compare != "function"`,d(m)))}function l(){let p=c.schema,m=a.formats[p];if(!m||m===!0)return;if(typeof m!="object"||m instanceof RegExp||typeof m.compare!="function")throw Error(`"${o}": format "${p}" does not define "compare" function`);let h=t.scopeValue("formats",{key:p,ref:m,code:i.code.formats?st._`${i.code.formats}${st.getProperty(p)}`:void 0});e.fail$data(d(h))}function d(p){return st._`${p}.compare(${r}, ${n}) ${Bd[o].fail} 0`}},dependencies:["format"]};var v9=(e)=>(e.addKeyword(dT.formatLimitDefinition),e);dT.default=v9});var gT=D(function(Ca,hT){Object.defineProperty(Ca,"__esModule",{value:!0});var cr=oT(),b9=pT(),Ms=$e(),fT=new Ms.Name("fullFormats"),$9=new Ms.Name("fastFormats"),Rg=(e,t={keywords:!0})=>{if(Array.isArray(t))return mT(e,t,cr.fullFormats,fT),e;let[r,n]=t.mode==="fast"?[cr.fastFormats,$9]:[cr.fullFormats,fT],o=t.formats||cr.formatNames;if(mT(e,o,r,n),t.keywords)(0,b9.default)(e);return e};Rg.get=(e,t="full")=>{let n=(t==="fast"?cr.fastFormats:cr.fullFormats)[e];if(!n)throw Error(`Unknown format "${e}"`);return n};function mT(e,t,r,n){var o,s;(o=(s=e.opts.code).formats)!==null&&o!==void 0||(s.formats=Ms._`require("ajv-formats/dist/formats").${n}`);for(let i of t)e.addFormat(i,r[i])}hT.exports=Ca=Rg;Object.defineProperty(Ca,"__esModule",{value:!0});Ca.default=Rg});var Ls=D(function(xY,yT){var O9=Number.MAX_SAFE_INTEGER||9007199254740991,x9=["major","premajor","minor","preminor","patch","prepatch","prerelease"];yT.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:O9,RELEASE_TYPES:x9,SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var Aa=D(function(CY,_T){var C9=typeof process==="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};_T.exports=C9});var Ds=D(function(Ur,vT){var{MAX_SAFE_COMPONENT_LENGTH:Pg,MAX_SAFE_BUILD_LENGTH:A9,MAX_LENGTH:N9}=Ls(),j9=Aa();Ur=vT.exports={};var q9=Ur.re=[],M9=Ur.safeRe=[],oe=Ur.src=[],L9=Ur.safeSrc=[],se=Ur.t={},D9=0,Tg="[a-zA-Z0-9-]",U9=[["\\s",1],["\\d",N9],[Tg,A9]],F9=(e)=>{for(let[t,r]of U9)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e},Re=(e,t,r)=>{let n=F9(t),o=D9++;j9(e,o,t),se[e]=o,oe[o]=t,L9[o]=n,q9[o]=new RegExp(t,r?"g":void 0),M9[o]=new RegExp(n,r?"g":void 0)};Re("NUMERICIDENTIFIER","0|[1-9]\\d*");Re("NUMERICIDENTIFIERLOOSE","\\d+");Re("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${Tg}*`);Re("MAINVERSION",`(${oe[se.NUMERICIDENTIFIER]})\\.(${oe[se.NUMERICIDENTIFIER]})\\.(${oe[se.NUMERICIDENTIFIER]})`);Re("MAINVERSIONLOOSE",`(${oe[se.NUMERICIDENTIFIERLOOSE]})\\.(${oe[se.NUMERICIDENTIFIERLOOSE]})\\.(${oe[se.NUMERICIDENTIFIERLOOSE]})`);Re("PRERELEASEIDENTIFIER",`(?:${oe[se.NONNUMERICIDENTIFIER]}|${oe[se.NUMERICIDENTIFIER]})`);Re("PRERELEASEIDENTIFIERLOOSE",`(?:${oe[se.NONNUMERICIDENTIFIER]}|${oe[se.NUMERICIDENTIFIERLOOSE]})`);Re("PRERELEASE",`(?:-(${oe[se.PRERELEASEIDENTIFIER]}(?:\\.${oe[se.PRERELEASEIDENTIFIER]})*))`);Re("PRERELEASELOOSE",`(?:-?(${oe[se.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${oe[se.PRERELEASEIDENTIFIERLOOSE]})*))`);Re("BUILDIDENTIFIER",`${Tg}+`);Re("BUILD",`(?:\\+(${oe[se.BUILDIDENTIFIER]}(?:\\.${oe[se.BUILDIDENTIFIER]})*))`);Re("FULLPLAIN",`v?${oe[se.MAINVERSION]}${oe[se.PRERELEASE]}?${oe[se.BUILD]}?`);Re("FULL",`^${oe[se.FULLPLAIN]}$`);Re("LOOSEPLAIN",`[v=\\s]*${oe[se.MAINVERSIONLOOSE]}${oe[se.PRERELEASELOOSE]}?${oe[se.BUILD]}?`);Re("LOOSE",`^${oe[se.LOOSEPLAIN]}$`);Re("GTLT","((?:<|>)?=?)");Re("XRANGEIDENTIFIERLOOSE",`${oe[se.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);Re("XRANGEIDENTIFIER",`${oe[se.NUMERICIDENTIFIER]}|x|X|\\*`);Re("XRANGEPLAIN",`[v=\\s]*(${oe[se.XRANGEIDENTIFIER]})(?:\\.(${oe[se.XRANGEIDENTIFIER]})(?:\\.(${oe[se.XRANGEIDENTIFIER]})(?:${oe[se.PRERELEASE]})?${oe[se.BUILD]}?)?)?`);Re("XRANGEPLAINLOOSE",`[v=\\s]*(${oe[se.XRANGEIDENTIFIERLOOSE]})(?:\\.(${oe[se.XRANGEIDENTIFIERLOOSE]})(?:\\.(${oe[se.XRANGEIDENTIFIERLOOSE]})(?:${oe[se.PRERELEASELOOSE]})?${oe[se.BUILD]}?)?)?`);Re("XRANGE",`^${oe[se.GTLT]}\\s*${oe[se.XRANGEPLAIN]}$`);Re("XRANGELOOSE",`^${oe[se.GTLT]}\\s*${oe[se.XRANGEPLAINLOOSE]}$`);Re("COERCEPLAIN",`(^|[^\\d])(\\d{1,${Pg}})(?:\\.(\\d{1,${Pg}}))?(?:\\.(\\d{1,${Pg}}))?`);Re("COERCE",`${oe[se.COERCEPLAIN]}(?:$|[^\\d])`);Re("COERCEFULL",oe[se.COERCEPLAIN]+`(?:${oe[se.PRERELEASE]})?(?:${oe[se.BUILD]})?(?:$|[^\\d])`);Re("COERCERTL",oe[se.COERCE],!0);Re("COERCERTLFULL",oe[se.COERCEFULL],!0);Re("LONETILDE","(?:~>?)");Re("TILDETRIM",`(\\s*)${oe[se.LONETILDE]}\\s+`,!0);Ur.tildeTrimReplace="$1~";Re("TILDE",`^${oe[se.LONETILDE]}${oe[se.XRANGEPLAIN]}$`);Re("TILDELOOSE",`^${oe[se.LONETILDE]}${oe[se.XRANGEPLAINLOOSE]}$`);Re("LONECARET","(?:\\^)");Re("CARETTRIM",`(\\s*)${oe[se.LONECARET]}\\s+`,!0);Ur.caretTrimReplace="$1^";Re("CARET",`^${oe[se.LONECARET]}${oe[se.XRANGEPLAIN]}$`);Re("CARETLOOSE",`^${oe[se.LONECARET]}${oe[se.XRANGEPLAINLOOSE]}$`);Re("COMPARATORLOOSE",`^${oe[se.GTLT]}\\s*(${oe[se.LOOSEPLAIN]})$|^$`);Re("COMPARATOR",`^${oe[se.GTLT]}\\s*(${oe[se.FULLPLAIN]})$|^$`);Re("COMPARATORTRIM",`(\\s*)${oe[se.GTLT]}\\s*(${oe[se.LOOSEPLAIN]}|${oe[se.XRANGEPLAIN]})`,!0);Ur.comparatorTrimReplace="$1$2$3";Re("HYPHENRANGE",`^\\s*(${oe[se.XRANGEPLAIN]})\\s+-\\s+(${oe[se.XRANGEPLAIN]})\\s*$`);Re("HYPHENRANGELOOSE",`^\\s*(${oe[se.XRANGEPLAINLOOSE]})\\s+-\\s+(${oe[se.XRANGEPLAINLOOSE]})\\s*$`);Re("STAR","(<|>)?=?\\s*\\*");Re("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");Re("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var Wd=D(function(AY,ST){var V9=Object.freeze({loose:!0}),H9=Object.freeze({}),Z9=(e)=>{if(!e)return H9;if(typeof e!=="object")return V9;return e};ST.exports=Z9});var Ig=D(function(NY,wT){var bT=/^[0-9]+$/,$T=(e,t)=>{if(typeof e==="number"&&typeof t==="number")return e===t?0:e<t?-1:1;let r=bT.test(e),n=bT.test(t);if(r&&n)e=+e,t=+t;return e===t?0:r&&!n?-1:n&&!r?1:e<t?-1:1},G9=(e,t)=>$T(t,e);wT.exports={compareIdentifiers:$T,rcompareIdentifiers:G9}});var wt=D(function(jY,ET){var Yd=Aa(),{MAX_LENGTH:RT,MAX_SAFE_INTEGER:Xd}=Ls(),{safeRe:Qd,t:ep}=Ds(),J9=Wd(),{compareIdentifiers:kg}=Ig(),K9=(e,t)=>{let r=t.split(".");if(r.length>e.length)return!1;for(let n=0;n<r.length;n++)if(kg(e[n],r[n])!==0)return!1;return!0};class Sr{constructor(e,t){if(t=J9(t),e instanceof Sr)if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;else e=e.version;else if(typeof e!=="string")throw TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>RT)throw TypeError(`version is longer than ${RT} characters`);Yd("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let r=e.trim().match(t.loose?Qd[ep.LOOSE]:Qd[ep.FULL]);if(!r)throw TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>Xd||this.major<0)throw TypeError("Invalid major version");if(this.minor>Xd||this.minor<0)throw TypeError("Invalid minor version");if(this.patch>Xd||this.patch<0)throw TypeError("Invalid patch version");if(!r[4])this.prerelease=[];else this.prerelease=r[4].split(".").map((n)=>{if(/^[0-9]+$/.test(n)){let o=+n;if(o>=0&&o<Xd)return o}return n});this.build=r[5]?r[5].split("."):[],this.format()}format(){if(this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length)this.version+=`-${this.prerelease.join(".")}`;return this.version}toString(){return this.version}compare(e){if(Yd("SemVer.compare",this.version,this.options,e),!(e instanceof Sr)){if(typeof e==="string"&&e===this.version)return 0;e=new Sr(e,this.options)}if(e.version===this.version)return 0;return this.compareMain(e)||this.comparePre(e)}compareMain(e){if(!(e instanceof Sr))e=new Sr(e,this.options);if(this.major<e.major)return-1;if(this.major>e.major)return 1;if(this.minor<e.minor)return-1;if(this.minor>e.minor)return 1;if(this.patch<e.patch)return-1;if(this.patch>e.patch)return 1;return 0}comparePre(e){if(!(e instanceof Sr))e=new Sr(e,this.options);if(this.prerelease.length&&!e.prerelease.length)return-1;else if(!this.prerelease.length&&e.prerelease.length)return 1;else if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{let r=this.prerelease[t],n=e.prerelease[t];if(Yd("prerelease compare",t,r,n),r===void 0&&n===void 0)return 0;else if(n===void 0)return 1;else if(r===void 0)return-1;else if(r===n)continue;else return kg(r,n)}while(++t)}compareBuild(e){if(!(e instanceof Sr))e=new Sr(e,this.options);let t=0;do{let r=this.build[t],n=e.build[t];if(Yd("build compare",t,r,n),r===void 0&&n===void 0)return 0;else if(n===void 0)return 1;else if(r===void 0)return-1;else if(r===n)continue;else return kg(r,n)}while(++t)}inc(e,t,r){if(e.startsWith("pre")){if(!t&&r===!1)throw Error("invalid increment argument: identifier is empty");if(t){let n=`-${t}`.match(this.options.loose?Qd[ep.PRERELEASELOOSE]:Qd[ep.PRERELEASE]);if(!n||n[1]!==t)throw Error(`invalid identifier: ${t}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,r),this.inc("pre",t,r);break;case"prerelease":if(this.prerelease.length===0)this.inc("patch",t,r);this.inc("pre",t,r);break;case"release":if(this.prerelease.length===0)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":if(this.minor!==0||this.patch!==0||this.prerelease.length===0)this.major++;this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":if(this.patch!==0||this.prerelease.length===0)this.minor++;this.patch=0,this.prerelease=[];break;case"patch":if(this.prerelease.length===0)this.patch++;this.prerelease=[];break;case"pre":{let n=Number(r)?1:0;if(this.prerelease.length===0)this.prerelease=[n];else{let o=this.prerelease.length;while(--o>=0)if(typeof this.prerelease[o]==="number")this.prerelease[o]++,o=-2;if(o===-1){if(t===this.prerelease.join(".")&&r===!1)throw Error("invalid increment argument: identifier already exists");this.prerelease.push(n)}}if(t){let o=[t,n];if(r===!1)o=[t];if(K9(this.prerelease,t)){let s=this.prerelease[t.split(".").length];if(isNaN(s))this.prerelease=o}else this.prerelease=o}break}default:throw Error(`invalid increment argument: ${e}`)}if(this.raw=this.format(),this.build.length)this.raw+=`+${this.build.join(".")}`;return this}}ET.exports=Sr});var Hn=D(function(qY,PT){var zT=wt(),B9=(e,t,r=!1)=>{if(e instanceof zT)return e;try{return new zT(e,t)}catch(n){if(!r)return null;throw n}};PT.exports=B9});var IT=D(function(MY,TT){var W9=Hn(),Y9=(e,t)=>{let r=W9(e,t);return r?r.version:null};TT.exports=Y9});var OT=D(function(LY,kT){var X9=Hn(),Q9=(e,t)=>{let r=X9(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};kT.exports=Q9});var AT=D(function(DY,CT){var xT=wt(),e4=(e,t,r,n,o)=>{if(typeof r==="string")o=n,n=r,r=void 0;try{return new xT(e instanceof xT?e.version:e,r).inc(t,n,o).version}catch(s){return null}};CT.exports=e4});var qT=D(function(UY,jT){var NT=Hn(),t4=(e,t)=>{let r=NT(e,null,!0),n=NT(t,null,!0),o=r.compare(n);if(o===0)return null;let s=o>0,i=s?r:n,a=s?n:r,c=!!i.prerelease.length;if(!!a.prerelease.length&&!c){if(!a.patch&&!a.minor)return"major";if(a.compareMain(i)===0){if(a.minor&&!a.patch)return"minor";return"patch"}}let l=c?"pre":"";if(r.major!==n.major)return l+"major";if(r.minor!==n.minor)return l+"minor";if(r.patch!==n.patch)return l+"patch";return"prerelease"};jT.exports=t4});var LT=D(function(FY,MT){var r4=wt(),n4=(e,t)=>new r4(e,t).major;MT.exports=n4});var UT=D(function(VY,DT){var o4=wt(),s4=(e,t)=>new o4(e,t).minor;DT.exports=s4});var VT=D(function(HY,FT){var i4=wt(),a4=(e,t)=>new i4(e,t).patch;FT.exports=a4});var ZT=D(function(ZY,HT){var c4=Hn(),u4=(e,t)=>{let r=c4(e,t);return r&&r.prerelease.length?r.prerelease:null};HT.exports=u4});var ur=D(function(GY,JT){var GT=wt(),l4=(e,t,r)=>new GT(e,r).compare(new GT(t,r));JT.exports=l4});var BT=D(function(JY,KT){var d4=ur(),p4=(e,t,r)=>d4(t,e,r);KT.exports=p4});var YT=D(function(KY,WT){var f4=ur(),m4=(e,t)=>f4(e,t,!0);WT.exports=m4});var tp=D(function(BY,QT){var XT=wt(),h4=(e,t,r)=>{let n=new XT(e,r),o=new XT(t,r);return n.compare(o)||n.compareBuild(o)};QT.exports=h4});var tI=D(function(WY,eI){var g4=tp(),y4=(e,t)=>e.sort((r,n)=>g4(r,n,t));eI.exports=y4});var nI=D(function(YY,rI){var _4=tp(),v4=(e,t)=>e.sort((r,n)=>_4(n,r,t));rI.exports=v4});var Na=D(function(XY,oI){var S4=ur(),b4=(e,t,r)=>S4(e,t,r)>0;oI.exports=b4});var rp=D(function(QY,sI){var $4=ur(),w4=(e,t,r)=>$4(e,t,r)<0;sI.exports=w4});var Og=D(function(eX,iI){var R4=ur(),E4=(e,t,r)=>R4(e,t,r)===0;iI.exports=E4});var xg=D(function(tX,aI){var z4=ur(),P4=(e,t,r)=>z4(e,t,r)!==0;aI.exports=P4});var np=D(function(rX,cI){var T4=ur(),I4=(e,t,r)=>T4(e,t,r)>=0;cI.exports=I4});var op=D(function(nX,uI){var k4=ur(),O4=(e,t,r)=>k4(e,t,r)<=0;uI.exports=O4});var Cg=D(function(oX,lI){var x4=Og(),C4=xg(),A4=Na(),N4=np(),j4=rp(),q4=op(),M4=(e,t,r,n)=>{switch(t){case"===":if(typeof e==="object")e=e.version;if(typeof r==="object")r=r.version;return e===r;case"!==":if(typeof e==="object")e=e.version;if(typeof r==="object")r=r.version;return e!==r;case"":case"=":case"==":return x4(e,r,n);case"!=":return C4(e,r,n);case">":return A4(e,r,n);case">=":return N4(e,r,n);case"<":return j4(e,r,n);case"<=":return q4(e,r,n);default:throw TypeError(`Invalid operator: ${t}`)}};lI.exports=M4});var pI=D(function(sX,dI){var L4=wt(),D4=Hn(),{safeRe:sp,t:ip}=Ds(),U4=(e,t)=>{if(e instanceof L4)return e;if(typeof e==="number")e=String(e);if(typeof e!=="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?sp[ip.COERCEFULL]:sp[ip.COERCE]);else{let c=t.includePrerelease?sp[ip.COERCERTLFULL]:sp[ip.COERCERTL],u;while((u=c.exec(e))&&(!r||r.index+r[0].length!==e.length)){if(!r||u.index+u[0].length!==r.index+r[0].length)r=u;c.lastIndex=u.index+u[1].length+u[2].length}c.lastIndex=-1}if(r===null)return null;let n=r[2],o=r[3]||"0",s=r[4]||"0",i=t.includePrerelease&&r[5]?`-${r[5]}`:"",a=t.includePrerelease&&r[6]?`+${r[6]}`:"";return D4(`${n}.${o}.${s}${i}${a}`,t)};dI.exports=U4});var hI=D(function(iX,mI){var F4=Hn(),fI=Ls(),V4=wt(),H4=(e,t,r)=>{if(!fI.RELEASE_TYPES.includes(t))return null;let n=Z4(e,r);return n&&G4(n,t)},Z4=(e,t)=>{let r=e instanceof V4?e.version:e;return F4(r,t)},G4=(e,t)=>{if(J4(t))return e.version;switch(e.prerelease=[],t){case"major":e.minor=0,e.patch=0;break;case"minor":e.patch=0;break}return e.format()},J4=(e)=>e.startsWith("pre");mI.exports=H4});var _I=D(function(aX,yI){class gI{constructor(){this.max=1000,this.map=new Map}get(e){let t=this.map.get(e);if(t===void 0)return;else return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&t!==void 0){if(this.map.size>=this.max){let n=this.map.keys().next().value;this.delete(n)}this.map.set(e,t)}return this}}yI.exports=gI});var lr=D(function(cX,$I){var K4=/\s+/g;class ja{constructor(e,t){if(t=W4(t),e instanceof ja)if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;else return new ja(e.raw,t);if(e instanceof ap)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e.trim().replace(K4," "),this.set=this.raw.split("||").map((r)=>this.parseRange(r.trim())).filter((r)=>r.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let r=this.set[0];if(this.set=this.set.filter((n)=>!SI(n[0])),this.set.length===0)this.set=[r];else if(this.set.length>1){for(let n of this.set)if(n.length===1&&sH(n[0])){this.set=[n];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e<this.set.length;e++){if(e>0)this.formatted+="||";let t=this.set[e];for(let r=0;r<t.length;r++){if(r>0)this.formatted+=" ";this.formatted+=t[r].toString().trim()}}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){e=e.replace(oH,"");let r=((this.options.includePrerelease&&rH)|(this.options.loose&&nH))+":"+e,n=vI.get(r);if(n)return n;let o=this.options.loose,s=o?qt[Rt.HYPHENRANGELOOSE]:qt[Rt.HYPHENRANGE];e=e.replace(s,gH(this.options.includePrerelease)),Je("hyphen replace",e),e=e.replace(qt[Rt.COMPARATORTRIM],Q4),Je("comparator trim",e),e=e.replace(qt[Rt.TILDETRIM],eH),Je("tilde trim",e),e=e.replace(qt[Rt.CARETTRIM],tH),Je("caret trim",e);let i=e.split(" ").map((l)=>iH(l,this.options)).join(" ").split(/\s+/).map((l)=>hH(l,this.options));if(o)i=i.filter((l)=>(Je("loose invalid filter",l,this.options),!!l.match(qt[Rt.COMPARATORLOOSE])));Je("range list",i);let a=new Map,c=i.map((l)=>new ap(l,this.options));for(let l of c){if(SI(l))return[l];a.set(l.value,l)}if(a.size>1&&a.has(""))a.delete("");let u=[...a.values()];return vI.set(r,u),u}intersects(e,t){if(!(e instanceof ja))throw TypeError("a Range is required");return this.set.some((r)=>bI(r,t)&&e.set.some((n)=>bI(n,t)&&r.every((o)=>n.every((s)=>o.intersects(s,t)))))}test(e){if(!e)return!1;if(typeof e==="string")try{e=new Y4(e,this.options)}catch(t){return!1}for(let t=0;t<this.set.length;t++)if(yH(this.set[t],e,this.options))return!0;return!1}}$I.exports=ja;var B4=_I(),vI=new B4,W4=Wd(),ap=qa(),Je=Aa(),Y4=wt(),{safeRe:qt,src:X4,t:Rt,comparatorTrimReplace:Q4,tildeTrimReplace:eH,caretTrimReplace:tH}=Ds(),{FLAG_INCLUDE_PRERELEASE:rH,FLAG_LOOSE:nH}=Ls(),oH=new RegExp(X4[Rt.BUILD],"g"),SI=(e)=>e.value==="<0.0.0-0",sH=(e)=>e.value==="",bI=(e,t)=>{let r=!0,n=e.slice(),o=n.pop();while(r&&n.length)r=n.every((s)=>o.intersects(s,t)),o=n.pop();return r},iH=(e,t)=>(e=e.replace(qt[Rt.BUILD],""),Je("comp",e,t),e=lH(e,t),Je("caret",e),e=cH(e,t),Je("tildes",e),e=pH(e,t),Je("xrange",e),e=mH(e,t),Je("stars",e),e),mt=(e)=>!e||e.toLowerCase()==="x"||e==="*",aH=(e,t,r)=>mt(e)&&!mt(t)||mt(t)&&r&&!mt(r),cH=(e,t)=>e.trim().split(/\s+/).map((r)=>uH(r,t)).join(" "),uH=(e,t)=>{let r=t.loose?qt[Rt.TILDELOOSE]:qt[Rt.TILDE],n=t.includePrerelease?"-0":"";return e.replace(r,(o,s,i,a,c)=>{Je("tilde",e,o,s,i,a,c);let u;if(mt(s))u="";else if(mt(i))u=`>=${s}.0.0${n} <${+s+1}.0.0-0`;else if(mt(a))u=`>=${s}.${i}.0${n} <${s}.${+i+1}.0-0`;else if(c)Je("replaceTilde pr",c),u=`>=${s}.${i}.${a}-${c} <${s}.${+i+1}.0-0`;else u=`>=${s}.${i}.${a} <${s}.${+i+1}.0-0`;return Je("tilde return",u),u})},lH=(e,t)=>e.trim().split(/\s+/).map((r)=>dH(r,t)).join(" "),dH=(e,t)=>{Je("caret",e,t);let r=t.loose?qt[Rt.CARETLOOSE]:qt[Rt.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,(o,s,i,a,c)=>{Je("caret",e,o,s,i,a,c);let u;if(mt(s))u="";else if(mt(i))u=`>=${s}.0.0${n} <${+s+1}.0.0-0`;else if(mt(a))if(s==="0")u=`>=${s}.${i}.0${n} <${s}.${+i+1}.0-0`;else u=`>=${s}.${i}.0${n} <${+s+1}.0.0-0`;else if(c)if(Je("replaceCaret pr",c),s==="0")if(i==="0")u=`>=${s}.${i}.${a}-${c} <${s}.${i}.${+a+1}-0`;else u=`>=${s}.${i}.${a}-${c} <${s}.${+i+1}.0-0`;else u=`>=${s}.${i}.${a}-${c} <${+s+1}.0.0-0`;else if(Je("no pr"),s==="0")if(i==="0")u=`>=${s}.${i}.${a} <${s}.${i}.${+a+1}-0`;else u=`>=${s}.${i}.${a} <${s}.${+i+1}.0-0`;else u=`>=${s}.${i}.${a} <${+s+1}.0.0-0`;return Je("caret return",u),u})},pH=(e,t)=>(Je("replaceXRanges",e,t),e.split(/\s+/).map((r)=>fH(r,t)).join(" ")),fH=(e,t)=>{e=e.trim();let r=t.loose?qt[Rt.XRANGELOOSE]:qt[Rt.XRANGE];return e.replace(r,(n,o,s,i,a,c)=>{if(Je("xRange",e,n,o,s,i,a,c),aH(s,i,a))return e;let u=mt(s),l=u||mt(i),d=l||mt(a),p=d;if(o==="="&&p)o="";if(c=t.includePrerelease?"-0":"",u)if(o===">"||o==="<")n="<0.0.0-0";else n="*";else if(o&&p){if(l)i=0;if(a=0,o===">")if(o=">=",l)s=+s+1,i=0,a=0;else i=+i+1,a=0;else if(o==="<=")if(o="<",l)s=+s+1;else i=+i+1;if(o==="<")c="-0";n=`${o+s}.${i}.${a}${c}`}else if(l)n=`>=${s}.0.0${c} <${+s+1}.0.0-0`;else if(d)n=`>=${s}.${i}.0${c} <${s}.${+i+1}.0-0`;return Je("xRange return",n),n})},mH=(e,t)=>(Je("replaceStars",e,t),e.trim().replace(qt[Rt.STAR],"")),hH=(e,t)=>(Je("replaceGTE0",e,t),e.trim().replace(qt[t.includePrerelease?Rt.GTE0PRE:Rt.GTE0],"")),gH=(e)=>(t,r,n,o,s,i,a,c,u,l,d,p)=>{if(mt(n))r="";else if(mt(o))r=`>=${n}.0.0${e?"-0":""}`;else if(mt(s))r=`>=${n}.${o}.0${e?"-0":""}`;else if(i)r=`>=${r}`;else r=`>=${r}${e?"-0":""}`;if(mt(u))c="";else if(mt(l))c=`<${+u+1}.0.0-0`;else if(mt(d))c=`<${u}.${+l+1}.0-0`;else if(p)c=`<=${u}.${l}.${d}-${p}`;else if(e)c=`<${u}.${l}.${+d+1}-0`;else c=`<=${c}`;return`${r} ${c}`.trim()},yH=(e,t,r)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let n=0;n<e.length;n++){if(Je(e[n].semver),e[n].semver===ap.ANY)continue;if(e[n].semver.prerelease.length>0){let o=e[n].semver;if(o.major===t.major&&o.minor===t.minor&&o.patch===t.patch)return!0}}return!1}return!0}});var qa=D(function(uX,TI){var Ma=Symbol("SemVer ANY");class cp{static get ANY(){return Ma}constructor(e,t){if(t=wI(t),e instanceof cp)if(e.loose===!!t.loose)return e;else e=e.value;if(e=e.trim().split(/\s+/).join(" "),Ng("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===Ma)this.value="";else this.value=this.operator+this.semver.version;Ng("comp",this)}parse(e){let t=this.options.loose?RI[EI.COMPARATORLOOSE]:RI[EI.COMPARATOR],r=e.match(t);if(!r)throw TypeError(`Invalid comparator: ${e}`);if(this.operator=r[1]!==void 0?r[1]:"",this.operator==="=")this.operator="";if(!r[2])this.semver=Ma;else this.semver=new zI(r[2],this.options.loose)}toString(){return this.value}test(e){if(Ng("Comparator.test",e,this.options.loose),this.semver===Ma||e===Ma)return!0;if(typeof e==="string")try{e=new zI(e,this.options)}catch(t){return!1}return Ag(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof cp))throw TypeError("a Comparator is required");if(this.operator===""){if(this.value==="")return!0;return new PI(e.value,t).test(this.value)}else if(e.operator===""){if(e.value==="")return!0;return new PI(this.value,t).test(e.semver)}if(t=wI(t),t.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0"))return!1;if(!t.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0")))return!1;if(this.operator.startsWith(">")&&e.operator.startsWith(">"))return!0;if(this.operator.startsWith("<")&&e.operator.startsWith("<"))return!0;if(this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("="))return!0;if(Ag(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))return!0;if(Ag(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">"))return!0;return!1}}TI.exports=cp;var wI=Wd(),{safeRe:RI,t:EI}=Ds(),Ag=Cg(),Ng=Aa(),zI=wt(),PI=lr()});var La=D(function(lX,II){var _H=lr(),vH=(e,t,r)=>{try{t=new _H(t,r)}catch(n){return!1}return t.test(e)};II.exports=vH});var OI=D(function(dX,kI){var SH=lr(),bH=(e,t)=>new SH(e,t).set.map((r)=>r.map((n)=>n.value).join(" ").trim().split(" "));kI.exports=bH});var CI=D(function(pX,xI){var $H=wt(),wH=lr(),RH=(e,t,r)=>{let n=null,o=null,s=null;try{s=new wH(t,r)}catch(i){return null}return e.forEach((i)=>{if(s.test(i)){if(!n||o.compare(i)===-1)n=i,o=new $H(n,r)}}),n};xI.exports=RH});var NI=D(function(fX,AI){var EH=wt(),zH=lr(),PH=(e,t,r)=>{let n=null,o=null,s=null;try{s=new zH(t,r)}catch(i){return null}return e.forEach((i)=>{if(s.test(i)){if(!n||o.compare(i)===1)n=i,o=new EH(n,r)}}),n};AI.exports=PH});var MI=D(function(mX,qI){var jg=wt(),TH=lr(),jI=Na(),IH=(e,t)=>{e=new TH(e,t);let r=new jg("0.0.0");if(e.test(r))return r;if(r=new jg("0.0.0-0"),e.test(r))return r;r=null;for(let n=0;n<e.set.length;++n){let o=e.set[n],s=null;if(o.forEach((i)=>{let a=new jg(i.semver.version);switch(i.operator){case">":if(a.prerelease.length===0)a.patch++;else a.prerelease.push(0);a.raw=a.format();case"":case">=":if(!s||jI(a,s))s=a;break;case"<":case"<=":break;default:throw Error(`Unexpected operation: ${i.operator}`)}}),s&&(!r||jI(r,s)))r=s}if(r&&e.test(r))return r;return null};qI.exports=IH});var DI=D(function(hX,LI){var kH=lr(),OH=(e,t)=>{try{return new kH(e,t).range||"*"}catch(r){return null}};LI.exports=OH});var up=D(function(gX,HI){var xH=wt(),VI=qa(),{ANY:CH}=VI,AH=lr(),NH=La(),UI=Na(),FI=rp(),jH=op(),qH=np(),MH=(e,t,r,n)=>{e=new xH(e,n),t=new AH(t,n);let o,s,i,a,c;switch(r){case">":o=UI,s=jH,i=FI,a=">",c=">=";break;case"<":o=FI,s=qH,i=UI,a="<",c="<=";break;default:throw TypeError('Must provide a hilo val of "<" or ">"')}if(NH(e,t,n))return!1;for(let u=0;u<t.set.length;++u){let l=t.set[u],d=null,p=null;if(l.forEach((m)=>{if(m.semver===CH)m=new VI(">=0.0.0");if(d=d||m,p=p||m,o(m.semver,d.semver,n))d=m;else if(i(m.semver,p.semver,n))p=m}),d.operator===a||d.operator===c)return!1;if((!p.operator||p.operator===a)&&s(e,p.semver))return!1;else if(p.operator===c&&i(e,p.semver))return!1}return!0};HI.exports=MH});var GI=D(function(yX,ZI){var LH=up(),DH=(e,t,r)=>LH(e,t,">",r);ZI.exports=DH});var KI=D(function(_X,JI){var UH=up(),FH=(e,t,r)=>UH(e,t,"<",r);JI.exports=FH});var YI=D(function(vX,WI){var BI=lr(),VH=(e,t,r)=>(e=new BI(e,r),t=new BI(t,r),e.intersects(t,r));WI.exports=VH});var QI=D(function(SX,XI){var HH=La(),ZH=ur();XI.exports=(e,t,r)=>{let n=[],o=null,s=null,i=e.sort((l,d)=>ZH(l,d,r));for(let l of i)if(HH(l,t,r)){if(s=l,!o)o=l}else{if(s)n.push([o,s]);s=null,o=null}if(o)n.push([o,null]);let a=[];for(let[l,d]of n)if(l===d)a.push(l);else if(!d&&l===i[0])a.push("*");else if(!d)a.push(`>=${l}`);else if(l===i[0])a.push(`<=${d}`);else a.push(`${l} - ${d}`);let c=a.join(" || "),u=typeof t.raw==="string"?t.raw:String(t);return c.length<u.length?c:t}});var sk=D(function(bX,ok){var ek=lr(),Lg=qa(),{ANY:qg}=Lg,Mg=La(),Dg=ur(),GH=(e,t,r={})=>{if(e===t)return!0;e=new ek(e,r),t=new ek(t,r);let n=!1;e:for(let o of e.set){for(let s of t.set){let i=KH(o,s,r);if(n=n||i!==null,i)continue e}if(n)return!1}return!0},JH=[new Lg(">=0.0.0-0")],tk=[new Lg(">=0.0.0")],KH=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===qg)if(t.length===1&&t[0].semver===qg)return!0;else if(r.includePrerelease)e=JH;else e=tk;if(t.length===1&&t[0].semver===qg)if(r.includePrerelease)return!0;else t=tk;let n=new Set,o,s;for(let m of e)if(m.operator===">"||m.operator===">=")o=rk(o,m,r);else if(m.operator==="<"||m.operator==="<=")s=nk(s,m,r);else n.add(m.semver);if(n.size>1)return null;let i;if(o&&s){if(i=Dg(o.semver,s.semver,r),i>0)return null;else if(i===0&&(o.operator!==">="||s.operator!=="<="))return null}for(let m of n){if(o&&!Mg(m,String(o),r))return null;if(s&&!Mg(m,String(s),r))return null;for(let h of t)if(!Mg(m,String(h),r))return!1;return!0}let a,c,u,l,d=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1,p=o&&!r.includePrerelease&&o.semver.prerelease.length?o.semver:!1;if(d&&d.prerelease.length===1&&s.operator==="<"&&d.prerelease[0]===0)d=!1;for(let m of t){if(l=l||m.operator===">"||m.operator===">=",u=u||m.operator==="<"||m.operator==="<=",o){if(p){if(m.semver.prerelease&&m.semver.prerelease.length&&m.semver.major===p.major&&m.semver.minor===p.minor&&m.semver.patch===p.patch)p=!1}if(m.operator===">"||m.operator===">="){if(a=rk(o,m,r),a===m&&a!==o)return!1}else if(o.operator===">="&&!m.test(o.semver))return!1}if(s){if(d){if(m.semver.prerelease&&m.semver.prerelease.length&&m.semver.major===d.major&&m.semver.minor===d.minor&&m.semver.patch===d.patch)d=!1}if(m.operator==="<"||m.operator==="<="){if(c=nk(s,m,r),c===m&&c!==s)return!1}else if(s.operator==="<="&&!m.test(s.semver))return!1}if(!m.operator&&(s||o)&&i!==0)return!1}if(o&&u&&!s&&i!==0)return!1;if(s&&l&&!o&&i!==0)return!1;if(p||d)return!1;return!0},rk=(e,t,r)=>{if(!e)return t;let n=Dg(e.semver,t.semver,r);return n>0?e:n<0?t:t.operator===">"&&e.operator===">="?t:e},nk=(e,t,r)=>{if(!e)return t;let n=Dg(e.semver,t.semver,r);return n<0?e:n>0?t:t.operator==="<"&&e.operator==="<="?t:e};ok.exports=GH});var ak=D(function($X,ik){var Us=Ds(),lp=Ls(),BH=wt(),dp=Ig(),WH=Hn(),YH=IT(),XH=OT(),QH=AT(),eZ=qT(),tZ=LT(),rZ=UT(),nZ=VT(),oZ=ZT(),sZ=ur(),iZ=BT(),aZ=YT(),cZ=tp(),uZ=tI(),lZ=nI(),dZ=Na(),pZ=rp(),fZ=Og(),mZ=xg(),hZ=np(),gZ=op(),yZ=Cg(),_Z=pI(),vZ=hI(),SZ=qa(),bZ=lr(),$Z=La(),wZ=OI(),RZ=CI(),EZ=NI(),zZ=MI(),PZ=DI(),TZ=up(),IZ=GI(),kZ=KI(),OZ=YI(),xZ=QI(),CZ=sk();ik.exports={parse:WH,valid:YH,clean:XH,inc:QH,diff:eZ,major:tZ,minor:rZ,patch:nZ,prerelease:oZ,compare:sZ,rcompare:iZ,compareLoose:aZ,compareBuild:cZ,sort:uZ,rsort:lZ,gt:dZ,lt:pZ,eq:fZ,neq:mZ,gte:hZ,lte:gZ,cmp:yZ,coerce:_Z,truncate:vZ,Comparator:SZ,Range:bZ,satisfies:$Z,toComparators:wZ,maxSatisfying:RZ,minSatisfying:EZ,minVersion:zZ,validRange:PZ,outside:TZ,gtr:IZ,ltr:kZ,intersects:OZ,simplifyRange:xZ,subset:CZ,SemVer:BH,re:Us.re,src:Us.src,tokens:Us.t,SEMVER_SPEC_VERSION:lp.SEMVER_SPEC_VERSION,RELEASE_TYPES:lp.RELEASE_TYPES,compareIdentifiers:dp.compareIdentifiers,rcompareIdentifiers:dp.rcompareIdentifiers}});var{create:hx,defineProperty:fc,getOwnPropertyDescriptor:gx,getOwnPropertyNames:yx,getPrototypeOf:_x}=Object,vx=Object.prototype.hasOwnProperty,J=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ry=(e,t)=>{let r={};for(var n in e)fc(r,n,{get:e[n],enumerable:!0});if(t)fc(r,Symbol.toStringTag,{value:"Module"});return r},Sx=(e,t,r,n)=>{if(t&&typeof t==="object"||typeof t==="function"){for(var o=yx(t),s=0,i=o.length,a;s<i;s++)if(a=o[s],!vx.call(e,a)&&a!==r)fc(e,a,{get:((c)=>t[c]).bind(null,a),enumerable:!(n=gx(t,a))||n.enumerable})}return e},mc=(e,t,r)=>(r=e!=null?hx(_x(e)):{},Sx(t||!e||!e.__esModule?fc(r,"default",{value:e,enumerable:!0}):r,e));var bx=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),Ey=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),$x=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),wx=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"]);function zy(e){return typeof e==="string"&&Ey.has(e.replace(/#$/,""))}function Py(e,t){if(!("$schema"in e)||typeof e.$schema!=="string")return"2020-12";let r=e.$schema.replace(/#$/,"");if(bx.has(r))return"2020-12";if(Ey.has(r))return"2019-09";if($x.has(r)||wx.has(r))return"draft-7";throw Error(`JSON Schema declares an unsupported dialect ("$schema": "${e.$schema.slice(0,200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${t}`)}var xp=Object.freeze({status:"aborted"});function U(e,t,r){function n(a,c){if(!a._zod)Object.defineProperty(a,"_zod",{value:{def:c,constr:i,traits:new Set},enumerable:!1});if(a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,c);let u=i.prototype,l=Object.keys(u);for(let d=0;d<l.length;d++){let p=l[d];if(!(p in a))a[p]=u[p].bind(a)}}let o=r?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function i(a){var c;let u=r?.Parent?new s:this;n(u,a),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:(a)=>{if(r?.Parent&&a instanceof r.Parent)return!0;return a?._zod?.traits?.has(e)}}),Object.defineProperty(i,"name",{value:e}),i}var Rx=Symbol("zod_brand");class Hr extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Si extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}var hc={};function Yt(e){if(e)Object.assign(hc,e);return hc}function yc(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 Ap(e,t="|"){return e.map((r)=>Mp(r)).join(t)}function bi(e,t){if(typeof t==="bigint")return t.toString();return t}function $i(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw Error("cached value already set")}}}function _c(e){return e===null||e===void 0}function vc(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Iy(e,t){let r=(e.toString().split(".")[1]||"").length,n=t.toString(),o=(n.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(n)){let c=n.match(/\d?e-(\d?)/);if(c?.[1])o=Number.parseInt(c[1])}let s=r>o?r:o,i=Number.parseInt(e.toFixed(s).replace(".","")),a=Number.parseInt(t.toFixed(s).replace(".",""));return i%a/10**s}var Ty=Symbol("evaluating");function xe(e,t,r){let n=void 0;Object.defineProperty(e,t,{get(){if(n===Ty)return;if(n===void 0)n=Ty,n=r();return n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function oo(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function on(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function Np(e){return JSON.stringify(e)}function ky(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var jp="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Vo(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var Oy=$i(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function so(e){if(Vo(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(Vo(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function qp(e){if(so(e))return{...e};if(Array.isArray(e))return[...e];return e}var xy=new Set(["string","number","symbol"]);function sn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function mr(e,t,r){let n=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)n._zod.parent=e;return n}function ie(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 Mp(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function Cy(e){return Object.keys(e).filter((t)=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Ay={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]};function Ex(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=on(e._zod.def,{get shape(){let i={};for(let a in t){if(!(a in r.shape))throw Error(`Unrecognized key: "${a}"`);if(!t[a])continue;i[a]=r.shape[a]}return oo(this,"shape",i),i},checks:[]});return mr(e,s)}function zx(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=on(e._zod.def,{get shape(){let i={...e._zod.def.shape};for(let a in t){if(!(a in r.shape))throw Error(`Unrecognized key: "${a}"`);if(!t[a])continue;delete i[a]}return oo(this,"shape",i),i},checks:[]});return mr(e,s)}function Px(e,t){if(!so(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let s=e._zod.def.shape;for(let i in t)if(Object.getOwnPropertyDescriptor(s,i)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let o=on(e._zod.def,{get shape(){let s={...e._zod.def.shape,...t};return oo(this,"shape",s),s}});return mr(e,o)}function Tx(e,t){if(!so(t))throw Error("Invalid input to safeExtend: expected a plain object");let r=on(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return oo(this,"shape",n),n}});return mr(e,r)}function Ix(e,t){let r=on(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return oo(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return mr(e,r)}function kx(e,t,r){let o=t._zod.def.checks;if(o&&o.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let i=on(t._zod.def,{get shape(){let a=t._zod.def.shape,c={...a};if(r)for(let u in r){if(!(u in a))throw Error(`Unrecognized key: "${u}"`);if(!r[u])continue;c[u]=e?new e({type:"optional",innerType:a[u]}):a[u]}else for(let u in a)c[u]=e?new e({type:"optional",innerType:a[u]}):a[u];return oo(this,"shape",c),c},checks:[]});return mr(t,i)}function Ox(e,t,r){let n=on(t._zod.def,{get shape(){let o=t._zod.def.shape,s={...o};if(r)for(let i in r){if(!(i in s))throw Error(`Unrecognized key: "${i}"`);if(!r[i])continue;s[i]=new e({type:"nonoptional",innerType:o[i]})}else for(let i in o)s[i]=new e({type:"nonoptional",innerType:o[i]});return oo(this,"shape",s),s}});return mr(t,n)}function io(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 an(e,t){return t.map((r)=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function gc(e){return typeof e==="string"?e:e?.message}function $r(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let o=gc(e.inst?._zod.def?.error?.(e))??gc(t?.error?.(e))??gc(r.customError?.(e))??gc(r.localeError?.(e))??"Invalid input";n.message=o}if(delete n.inst,delete n.continue,!t?.reportInput)delete n.input;return n}function Sc(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function Ny(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 ao(...e){let[t,r,n]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:n};return{...t}}var jy=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,bi,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},bc=U("$ZodError",jy),Lp=U("$ZodError",jy,{Parent:Error});function Dp(e,t=(r)=>r.message){let r={},n=[];for(let o of e.issues)if(o.path.length>0)r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o));else n.push(t(o));return{formErrors:n,fieldErrors:r}}function Up(e,t=(r)=>r.message){let r={_errors:[]},n=(o)=>{for(let s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map((i)=>n({issues:i}));else if(s.code==="invalid_key")n({issues:s.issues});else if(s.code==="invalid_element")n({issues:s.issues});else if(s.path.length===0)r._errors.push(t(s));else{let i=r,a=0;while(a<s.path.length){let c=s.path[a];if(a!==s.path.length-1)i[c]=i[c]||{_errors:[]};else i[c]=i[c]||{_errors:[]},i[c]._errors.push(t(s));i=i[c],a++}}};return n(e),r}var $c=(e)=>(t,r,n,o)=>{let s=n?Object.assign(n,{async:!1}):{async:!1},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new Hr;if(i.issues.length){let a=new(o?.Err??e)(i.issues.map((c)=>$r(c,s,Yt())));throw jp(a,o?.callee),a}return i.value};var wc=(e)=>async(t,r,n,o)=>{let s=n?Object.assign(n,{async:!0}):{async:!0},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)i=await i;if(i.issues.length){let a=new(o?.Err??e)(i.issues.map((c)=>$r(c,s,Yt())));throw jp(a,o?.callee),a}return i.value};var wi=(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 Hr;return s.issues.length?{success:!1,error:new(e??bc)(s.issues.map((i)=>$r(i,o,Yt())))}:{success:!0,data:s.value}},qy=wi(Lp),Ri=(e)=>async(t,r,n)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)s=await s;return s.issues.length?{success:!1,error:new e(s.issues.map((i)=>$r(i,o,Yt())))}:{success:!0,data:s.value}},My=Ri(Lp),Ly=(e)=>(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return $c(e)(t,r,o)};var Dy=(e)=>(t,r,n)=>$c(e)(t,r,n);var Uy=(e)=>async(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return wc(e)(t,r,o)};var Fy=(e)=>async(t,r,n)=>wc(e)(t,r,n);var Vy=(e)=>(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return wi(e)(t,r,o)};var Hy=(e)=>(t,r,n)=>wi(e)(t,r,n);var Zy=(e)=>async(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Ri(e)(t,r,o)};var Gy=(e)=>async(t,r,n)=>Ri(e)(t,r,n);var Jy=/^[cC][^\s-]{8,}$/,Ky=/^[0-9a-z]+$/,By=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Wy=/^[0-9a-vA-V]{20}$/,Yy=/^[A-Za-z0-9]{27}$/,Xy=/^[a-zA-Z0-9_-]{21}$/,Qy=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var e_=/^([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})$/,Fp=(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 t_=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Cx="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function r_(){return new RegExp(Cx,"u")}var n_=/^(?:(?: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])$/,o_=/^(([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 s_=/^((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])$/,i_=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,a_=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Vp=/^[A-Za-z0-9_-]*$/;var c_=/^\+[1-9]\d{6,14}$/,u_="(?:(?:\\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])))",l_=new RegExp(`^${u_}$`);function d_(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}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function p_(e){return new RegExp(`^${d_(e)}$`)}function f_(e){let t=d_({precision:e.precision}),r=["Z"];if(e.local)r.push("");if(e.offset)r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${t}(?:${r.join("|")})`;return new RegExp(`^${u_}T(?:${n})$`)}var m_=(e)=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var h_=/^-?\d+$/,Hp=/^-?\d+(?:\.\d+)?$/,g_=/^(?:true|false)$/i,y_=/^null$/i;var __=/^[^A-Z]*$/,v_=/^[^a-z]*$/;var bt=U("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),S_={number:"number",bigint:"bigint",object:"date"},Zp=U("$ZodCheckLessThan",(e,t)=>{bt.init(e,t);let r=S_[typeof t.value];e._zod.onattach.push((n)=>{let o=n._zod.bag,s=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(t.value<s)if(t.inclusive)o.maximum=t.value;else o.exclusiveMaximum=t.value}),e._zod.check=(n)=>{if(t.inclusive?n.value<=t.value:n.value<t.value)return;n.issues.push({origin:r,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Gp=U("$ZodCheckGreaterThan",(e,t)=>{bt.init(e,t);let r=S_[typeof t.value];e._zod.onattach.push((n)=>{let o=n._zod.bag,s=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(t.value>s)if(t.inclusive)o.minimum=t.value;else o.exclusiveMinimum=t.value}),e._zod.check=(n)=>{if(t.inclusive?n.value>=t.value:n.value>t.value)return;n.issues.push({origin:r,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),b_=U("$ZodCheckMultipleOf",(e,t)=>{bt.init(e,t),e._zod.onattach.push((r)=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=(r)=>{if(typeof r.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof r.value==="bigint"?r.value%t.value===BigInt(0):Iy(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})}}),$_=U("$ZodCheckNumberFormat",(e,t)=>{bt.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,s]=Ay[t.format];e._zod.onattach.push((i)=>{let a=i._zod.bag;if(a.format=t.format,a.minimum=o,a.maximum=s,r)a.pattern=h_}),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 w_=U("$ZodCheckMaxLength",(e,t)=>{var r;bt.init(e,t),(r=e._zod.def).when??(r.when=(n)=>{let o=n.value;return!_c(o)&&o.length!==void 0}),e._zod.onattach.push((n)=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<o)n._zod.bag.maximum=t.maximum}),e._zod.check=(n)=>{let o=n.value;if(o.length<=t.maximum)return;let i=Sc(o);n.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),R_=U("$ZodCheckMinLength",(e,t)=>{var r;bt.init(e,t),(r=e._zod.def).when??(r.when=(n)=>{let o=n.value;return!_c(o)&&o.length!==void 0}),e._zod.onattach.push((n)=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>o)n._zod.bag.minimum=t.minimum}),e._zod.check=(n)=>{let o=n.value;if(o.length>=t.minimum)return;let i=Sc(o);n.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),E_=U("$ZodCheckLengthEquals",(e,t)=>{var r;bt.init(e,t),(r=e._zod.def).when??(r.when=(n)=>{let o=n.value;return!_c(o)&&o.length!==void 0}),e._zod.onattach.push((n)=>{let o=n._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=(n)=>{let o=n.value,s=o.length;if(s===t.length)return;let i=Sc(o),a=s>t.length;n.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),zi=U("$ZodCheckStringFormat",(e,t)=>{var r,n;if(bt.init(e,t),e._zod.onattach.push((o)=>{let s=o._zod.bag;if(s.format=t.format,t.pattern)s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern)}),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=()=>{})}),z_=U("$ZodCheckRegex",(e,t)=>{zi.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})}}),P_=U("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=__),zi.init(e,t)}),T_=U("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=v_),zi.init(e,t)}),I_=U("$ZodCheckIncludes",(e,t)=>{bt.init(e,t);let r=sn(t.includes),n=new RegExp(typeof t.position==="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push((o)=>{let s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(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})}}),k_=U("$ZodCheckStartsWith",(e,t)=>{bt.init(e,t);let r=new RegExp(`^${sn(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push((n)=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=(n)=>{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})}}),O_=U("$ZodCheckEndsWith",(e,t)=>{bt.init(e,t);let r=new RegExp(`.*${sn(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push((n)=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=(n)=>{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 x_=U("$ZodCheckOverwrite",(e,t)=>{bt.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class Jp{constructor(e=[]){if(this.content=[],this.indent=0,this)this.args=e}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let r=e.split(`
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?.args,n=[...(this?.content??[""]).map((o)=>` ${o}`)];return new e(...t,n.join(`
11
+ `))}}var A_={major:4,minor:3,patch:6};var Fe=U("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=A_;let n=[...e._zod.def.checks??[]];if(e._zod.traits.has("$ZodCheck"))n.unshift(e);for(let o of n)for(let s of o._zod.onattach)s(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let o=(i,a,c)=>{let u=io(i),l;for(let d of a){if(d._zod.def.when){if(!d._zod.def.when(i))continue}else if(u)continue;let p=i.issues.length,m=d._zod.check(i);if(m instanceof Promise&&c?.async===!1)throw new Hr;if(l||m instanceof Promise)l=(l??Promise.resolve()).then(async()=>{if(await m,i.issues.length===p)return;if(!u)u=io(i,p)});else{if(i.issues.length===p)continue;if(!u)u=io(i,p)}}if(l)return l.then(()=>i);return i},s=(i,a,c)=>{if(io(i))return i.aborted=!0,i;let u=o(a,n,c);if(u instanceof Promise){if(c.async===!1)throw new Hr;return u.then((l)=>e._zod.parse(l,c))}return e._zod.parse(u,c)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction==="backward"){let u=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});if(u instanceof Promise)return u.then((l)=>s(l,i,a));return s(u,i,a)}let c=e._zod.parse(i,a);if(c instanceof Promise){if(a.async===!1)throw new Hr;return c.then((u)=>o(u,n,a))}return o(c,n,a)}}xe(e,"~standard",()=>({validate:(o)=>{try{let s=qy(e,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch(s){return My(e,o).then((i)=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),zc=U("$ZodString",(e,t)=>{Fe.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??m_(e._zod.bag),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}}),Ge=U("$ZodStringFormat",(e,t)=>{zi.init(e,t),zc.init(e,t)}),V_=U("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=e_),Ge.init(e,t)}),H_=U("$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=Fp(n))}else t.pattern??(t.pattern=Fp());Ge.init(e,t)}),Z_=U("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=t_),Ge.init(e,t)}),G_=U("$ZodURL",(e,t)=>{Ge.init(e,t),e._zod.check=(r)=>{try{let n=r.value.trim(),o=new URL(n);if(t.hostname){if(t.hostname.lastIndex=0,!t.hostname.test(o.hostname))r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})}if(t.protocol){if(t.protocol.lastIndex=0,!t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})}if(t.normalize)r.value=o.href;else r.value=n;return}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),J_=U("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=r_()),Ge.init(e,t)}),K_=U("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Xy),Ge.init(e,t)}),B_=U("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Jy),Ge.init(e,t)}),W_=U("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Ky),Ge.init(e,t)}),Y_=U("$ZodULID",(e,t)=>{t.pattern??(t.pattern=By),Ge.init(e,t)}),X_=U("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Wy),Ge.init(e,t)}),Q_=U("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Yy),Ge.init(e,t)}),ev=U("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=f_(t)),Ge.init(e,t)}),tv=U("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=l_),Ge.init(e,t)}),rv=U("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=p_(t)),Ge.init(e,t)}),nv=U("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Qy),Ge.init(e,t)}),ov=U("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=n_),Ge.init(e,t),e._zod.bag.format="ipv4"}),sv=U("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=o_),Ge.init(e,t),e._zod.bag.format="ipv6",e._zod.check=(r)=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}});var iv=U("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=s_),Ge.init(e,t)}),av=U("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=i_),Ge.init(e,t),e._zod.check=(r)=>{let n=r.value.split("/");try{if(n.length!==2)throw Error();let[o,s]=n;if(!s)throw Error();let i=Number(s);if(`${i}`!==s)throw Error();if(i<0||i>128)throw Error();new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function cv(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var uv=U("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=a_),Ge.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=(r)=>{if(cv(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function Ax(e){if(!Vp.test(e))return!1;let t=e.replace(/[-_]/g,(n)=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return cv(r)}var lv=U("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Vp),Ge.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=(r)=>{if(Ax(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),dv=U("$ZodE164",(e,t)=>{t.pattern??(t.pattern=c_),Ge.init(e,t)});function Nx(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 pv=U("$ZodJWT",(e,t)=>{Ge.init(e,t),e._zod.check=(r)=>{if(Nx(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var Bp=U("$ZodNumber",(e,t)=>{Fe.init(e,t),e._zod.pattern=e._zod.bag.pattern??Hp,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)?"Infinity":void 0:void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),r}}),fv=U("$ZodNumberFormat",(e,t)=>{$_.init(e,t),Bp.init(e,t)}),mv=U("$ZodBoolean",(e,t)=>{Fe.init(e,t),e._zod.pattern=g_,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 hv=U("$ZodNull",(e,t)=>{Fe.init(e,t),e._zod.pattern=y_,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}}),gv=U("$ZodAny",(e,t)=>{Fe.init(e,t),e._zod.parse=(r)=>r}),yv=U("$ZodUnknown",(e,t)=>{Fe.init(e,t),e._zod.parse=(r)=>r}),_v=U("$ZodNever",(e,t)=>{Fe.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function N_(e,t,r){if(e.issues.length)t.issues.push(...an(r,e.issues));t.value[r]=e.value}var vv=U("$ZodArray",(e,t)=>{Fe.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=Array(o.length);let s=[];for(let i=0;i<o.length;i++){let a=o[i],c=t.element._zod.run({value:a,issues:[]},n);if(c instanceof Promise)s.push(c.then((u)=>N_(u,r,i)));else N_(c,r,i)}if(s.length)return Promise.all(s).then(()=>r);return r}});function Ec(e,t,r,n,o){if(e.issues.length){if(o&&!(r in n))return;t.issues.push(...an(r,e.issues))}if(e.value===void 0){if(r in n)t.value[r]=void 0}else t.value[r]=e.value}function Sv(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let r=Cy(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function bv(e,t,r,n,o,s){let i=[],a=o.keySet,c=o.catchall._zod,u=c.def.type,l=c.optout==="optional";for(let d in t){if(a.has(d))continue;if(u==="never"){i.push(d);continue}let p=c.run({value:t[d],issues:[]},n);if(p instanceof Promise)e.push(p.then((m)=>Ec(m,r,d,t,l)));else Ec(p,r,d,t,l)}if(i.length)r.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s});if(!e.length)return r;return Promise.all(e).then(()=>r)}var jx=U("$ZodObject",(e,t)=>{if(Fe.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let a=t.shape;Object.defineProperty(t,"shape",{get:()=>{let c={...a};return Object.defineProperty(t,"shape",{value:c}),c}})}let n=$i(()=>Sv(t));xe(e._zod,"propValues",()=>{let a=t.shape,c={};for(let u in a){let l=a[u]._zod;if(l.values){c[u]??(c[u]=new Set);for(let d of l.values)c[u].add(d)}}return c});let o=Vo,s=t.catchall,i;e._zod.parse=(a,c)=>{i??(i=n.value);let u=a.value;if(!o(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),a;a.value={};let l=[],d=i.shape;for(let p of i.keys){let m=d[p],h=m._zod.optout==="optional",g=m._zod.run({value:u[p],issues:[]},c);if(g instanceof Promise)l.push(g.then((_)=>Ec(_,a,p,u,h)));else Ec(g,a,p,u,h)}if(!s)return l.length?Promise.all(l).then(()=>a):a;return bv(l,u,a,c,n.value,e)}}),$v=U("$ZodObjectJIT",(e,t)=>{jx.init(e,t);let r=e._zod.parse,n=$i(()=>Sv(t)),o=(p)=>{let m=new Jp(["shape","payload","ctx"]),h=n.value,g=(v)=>{let w=Np(v);return`shape[${w}]._zod.run({ value: input[${w}], issues: [] }, ctx)`};m.write("const input = payload.value;");let _=Object.create(null),y=0;for(let v of h.keys)_[v]=`key_${y++}`;m.write("const newResult = {};");for(let v of h.keys){let w=_[v],z=Np(v),b=p[v]?._zod?.optout==="optional";if(m.write(`const ${w} = ${g(v)};`),b)m.write(`
12
12
  if (${w}.issues.length) {
13
13
  if (${z} in input) {
14
14
  payload.issues = payload.issues.concat(${w}.issues.map(iss => ({
@@ -42,29 +42,29 @@ var iO=Object.create;var{getPrototypeOf:aO,defineProperty:Hg,getOwnPropertyNames
42
42
  newResult[${z}] = ${w}.value;
43
43
  }
44
44
 
45
- `)}m.write("payload.value = newResult;"),m.write("return payload;");let S=m.compile();return(v,w)=>S(f,v,w)},s,i=qn,a=!nc.jitless,u=a&&ey.value,l=t.catchall,d;e._zod.parse=(f,m)=>{d??(d=o.value);let h=f.value;if(!i(h))return f.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),f;if(a&&u&&m?.async===!1&&m.jitless!==!0){if(!s)s=n(t.shape);if(f=s(f,m),!l)return f;return Z_([],h,f,m,d,e)}return r(f,m)}});function s_(e,t,r,o){for(let s of e)if(s.issues.length===0)return t.value=s.value,t;let n=e.filter((s)=>!tn(s));if(n.length===1)return t.value=n[0].value,n[0];return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((s)=>s.issues.map((i)=>_r(i,o,Kt())))}),t}var kp=U("$ZodUnion",(e,t)=>{Ue.init(e,t),Ce(e._zod,"optin",()=>t.options.some((n)=>n._zod.optin==="optional")?"optional":void 0),Ce(e._zod,"optout",()=>t.options.some((n)=>n._zod.optout==="optional")?"optional":void 0),Ce(e._zod,"values",()=>{if(t.options.every((n)=>n._zod.values))return new Set(t.options.flatMap((n)=>Array.from(n._zod.values)));return}),Ce(e._zod,"pattern",()=>{if(t.options.every((n)=>n._zod.pattern)){let n=t.options.map((s)=>s._zod.pattern);return new RegExp(`^(${n.map((s)=>cc(s.source)).join("|")})$`)}return});let r=t.options.length===1,o=t.options[0]._zod.run;e._zod.parse=(n,s)=>{if(r)return o(n,s);let i=!1,a=[];for(let c of t.options){let u=c._zod.run({value:n.value,issues:[]},s);if(u instanceof Promise)a.push(u),i=!0;else{if(u.issues.length===0)return u;a.push(u)}}if(!i)return s_(a,n,e,s);return Promise.all(a).then((c)=>s_(c,n,e,s))}});var G_=U("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,kp.init(e,t);let r=e._zod.parse;Ce(e._zod,"propValues",()=>{let n={};for(let s of t.options){let i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let[a,c]of Object.entries(i)){if(!n[a])n[a]=new Set;for(let u of c)n[a].add(u)}}return n});let o=hi(()=>{let n=t.options,s=new Map;for(let i of n){let a=i._zod.propValues?.[t.discriminator];if(!a||a.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let c of a){if(s.has(c))throw Error(`Duplicate discriminator value "${String(c)}"`);s.set(c,i)}}return s});e._zod.parse=(n,s)=>{let i=n.value;if(!qn(i))return n.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),n;let a=o.value.get(i?.[t.discriminator]);if(a)return a._zod.run(n,s);if(t.unionFallback)return r(n,s);return n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:i,path:[t.discriminator],inst:e}),n}}),J_=U("$ZodIntersection",(e,t)=>{Ue.init(e,t),e._zod.parse=(r,o)=>{let n=r.value,s=t.left._zod.run({value:n,issues:[]},o),i=t.right._zod.run({value:n,issues:[]},o);if(s instanceof Promise||i instanceof Promise)return Promise.all([s,i]).then(([c,u])=>i_(r,c,u));return i_(r,s,i)}});function Tp(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(en(e)&&en(t)){let r=Object.keys(t),o=Object.keys(e).filter((s)=>r.indexOf(s)!==-1),n={...e,...t};for(let s of o){let i=Tp(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};n[s]=i.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<e.length;o++){let n=e[o],s=t[o],i=Tp(n,s);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function i_(e,t,r){let o=new Map,n;for(let a of t.issues)if(a.code==="unrecognized_keys"){n??(n=a);for(let c of a.keys){if(!o.has(c))o.set(c,{});o.get(c).l=!0}}else e.issues.push(a);for(let a of r.issues)if(a.code==="unrecognized_keys")for(let c of a.keys){if(!o.has(c))o.set(c,{});o.get(c).r=!0}else e.issues.push(a);let s=[...o].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(s.length&&n)e.issues.push({...n,keys:s});if(tn(e))return e;let i=Tp(t.value,r.value);if(!i.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}var K_=U("$ZodRecord",(e,t)=>{Ue.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!en(n))return r.issues.push({expected:"record",code:"invalid_type",input:n,inst:e}),r;let s=[],i=t.keyType._zod.values;if(i){r.value={};let a=new Set;for(let u of i)if(typeof u==="string"||typeof u==="number"||typeof u==="symbol"){a.add(typeof u==="number"?u.toString():u);let l=t.valueType._zod.run({value:n[u],issues:[]},o);if(l instanceof Promise)s.push(l.then((d)=>{if(d.issues.length)r.issues.push(...oo(u,d.issues));r.value[u]=d.value}));else{if(l.issues.length)r.issues.push(...oo(u,l.issues));r.value[u]=l.value}}let c;for(let u in n)if(!a.has(u))c=c??[],c.push(u);if(c&&c.length>0)r.issues.push({code:"unrecognized_keys",input:n,inst:e,keys:c})}else{r.value={};for(let a of Reflect.ownKeys(n)){if(a==="__proto__")continue;let c=t.keyType._zod.run({value:a,issues:[]},o);if(c instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof a==="string"&&Rp.test(a)&&c.issues.length){let d=t.keyType._zod.run({value:Number(a),issues:[]},o);if(d instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(d.issues.length===0)c=d}if(c.issues.length){if(t.mode==="loose")r.value[a]=n[a];else r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map((d)=>_r(d,o,Kt())),input:a,path:[a],inst:e});continue}let l=t.valueType._zod.run({value:n[a],issues:[]},o);if(l instanceof Promise)s.push(l.then((d)=>{if(d.issues.length)r.issues.push(...oo(a,d.issues));r.value[c.value]=d.value}));else{if(l.issues.length)r.issues.push(...oo(a,l.issues));r.value[c.value]=l.value}}}if(s.length)return Promise.all(s).then(()=>r);return r}});var B_=U("$ZodEnum",(e,t)=>{Ue.init(e,t);let r=ic(t.entries),o=new Set(r);e._zod.values=o,e._zod.pattern=new RegExp(`^(${r.filter((n)=>ty.has(typeof n)).map((n)=>typeof n==="string"?ro(n):n.toString()).join("|")})$`),e._zod.parse=(n,s)=>{let i=n.value;if(o.has(i))return n;return n.issues.push({code:"invalid_value",values:r,input:i,inst:e}),n}}),W_=U("$ZodLiteral",(e,t)=>{if(Ue.init(e,t),t.values.length===0)throw Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map((o)=>typeof o==="string"?ro(o):o?ro(o.toString()):String(o)).join("|")})$`),e._zod.parse=(o,n)=>{let s=o.value;if(r.has(s))return o;return o.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),o}});var Y_=U("$ZodTransform",(e,t)=>{Ue.init(e,t),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new fi(e.constructor.name);let n=t.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then((i)=>(r.value=i,r));if(n instanceof Promise)throw new Dr;return r.value=n,r}});function a_(e,t){if(e.issues.length&&t===void 0)return{issues:[],value:void 0};return e}var Op=U("$ZodOptional",(e,t)=>{Ue.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Ce(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Ce(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${cc(r.source)})?$`):void 0}),e._zod.parse=(r,o)=>{if(t.innerType._zod.optin==="optional"){let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((s)=>a_(s,r.value));return a_(n,r.value)}if(r.value===void 0)return r;return t.innerType._zod.run(r,o)}}),X_=U("$ZodExactOptional",(e,t)=>{Op.init(e,t),Ce(e._zod,"values",()=>t.innerType._zod.values),Ce(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,o)=>t.innerType._zod.run(r,o)}),Q_=U("$ZodNullable",(e,t)=>{Ue.init(e,t),Ce(e._zod,"optin",()=>t.innerType._zod.optin),Ce(e._zod,"optout",()=>t.innerType._zod.optout),Ce(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${cc(r.source)}|null)$`):void 0}),Ce(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,o)=>{if(r.value===null)return r;return t.innerType._zod.run(r,o)}}),ev=U("$ZodDefault",(e,t)=>{Ue.init(e,t),e._zod.optin="optional",Ce(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)return r.value=t.defaultValue,r;let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((s)=>c_(s,t));return c_(n,t)}});function c_(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var tv=U("$ZodPrefault",(e,t)=>{Ue.init(e,t),e._zod.optin="optional",Ce(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)r.value=t.defaultValue;return t.innerType._zod.run(r,o)}}),rv=U("$ZodNonOptional",(e,t)=>{Ue.init(e,t),Ce(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter((o)=>o!==void 0)):void 0}),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((s)=>u_(s,e));return u_(n,e)}});function u_(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}var ov=U("$ZodCatch",(e,t)=>{Ue.init(e,t),Ce(e._zod,"optin",()=>t.innerType._zod.optin),Ce(e._zod,"optout",()=>t.innerType._zod.optout),Ce(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((s)=>{if(r.value=s.value,s.issues.length)r.value=t.catchValue({...r,error:{issues:s.issues.map((i)=>_r(i,o,Kt()))},input:r.value}),r.issues=[];return r});if(r.value=n.value,n.issues.length)r.value=t.catchValue({...r,error:{issues:n.issues.map((s)=>_r(s,o,Kt()))},input:r.value}),r.issues=[];return r}});var nv=U("$ZodPipe",(e,t)=>{Ue.init(e,t),Ce(e._zod,"values",()=>t.in._zod.values),Ce(e._zod,"optin",()=>t.in._zod.optin),Ce(e._zod,"optout",()=>t.out._zod.optout),Ce(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,o)=>{if(o.direction==="backward"){let s=t.out._zod.run(r,o);if(s instanceof Promise)return s.then((i)=>fc(i,t.in,o));return fc(s,t.in,o)}let n=t.in._zod.run(r,o);if(n instanceof Promise)return n.then((s)=>fc(s,t.out,o));return fc(n,t.out,o)}});function fc(e,t,r){if(e.issues.length)return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues},r)}var sv=U("$ZodReadonly",(e,t)=>{Ue.init(e,t),Ce(e._zod,"propValues",()=>t.innerType._zod.propValues),Ce(e._zod,"values",()=>t.innerType._zod.values),Ce(e._zod,"optin",()=>t.innerType?._zod?.optin),Ce(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then(l_);return l_(n)}});function l_(e){return e.value=Object.freeze(e.value),e}var iv=U("$ZodLazy",(e,t)=>{Ue.init(e,t),Ce(e._zod,"innerType",()=>t.getter()),Ce(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),Ce(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),Ce(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),Ce(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(r,o)=>e._zod.innerType._zod.run(r,o)}),av=U("$ZodCustom",(e,t)=>{St.init(e,t),Ue.init(e,t),e._zod.parse=(r,o)=>r,e._zod.check=(r)=>{let o=r.value,n=t.fn(o);if(n instanceof Promise)return n.then((s)=>d_(s,r,o,e));d_(n,r,o,e);return}});function d_(e,t,r,o){if(!e){let n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};if(o._zod.def.params)n.params=o._zod.def.params;t.issues.push(rn(n))}}var NO=()=>{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(n){return e[n]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};return(n)=>{switch(n.code){case"invalid_type":{let s=o[n.expected]??n.expected,i=ny(n.input),a=o[i]??i;return`Invalid input: expected ${s}, received ${a}`}case"invalid_value":if(n.values.length===1)return`Invalid input: expected ${_p(n.values[0])}`;return`Invalid option: expected one of ${mp(n.values,"|")}`;case"too_big":{let s=n.inclusive?"<=":"<",i=t(n.origin);if(i)return`Too big: expected ${n.origin??"value"} to have ${s}${n.maximum.toString()} ${i.unit??"elements"}`;return`Too big: expected ${n.origin??"value"} to be ${s}${n.maximum.toString()}`}case"too_small":{let s=n.inclusive?">=":">",i=t(n.origin);if(i)return`Too small: expected ${n.origin} to have ${s}${n.minimum.toString()} ${i.unit}`;return`Too small: expected ${n.origin} to be ${s}${n.minimum.toString()}`}case"invalid_format":{let s=n;if(s.format==="starts_with")return`Invalid string: must start with "${s.prefix}"`;if(s.format==="ends_with")return`Invalid string: must end with "${s.suffix}"`;if(s.format==="includes")return`Invalid string: must include "${s.includes}"`;if(s.format==="regex")return`Invalid string: must match pattern ${s.pattern}`;return`Invalid ${r[s.format]??n.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${mp(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};function Cp(){return{localeError:NO()}}var cv,AO=Symbol("ZodOutput"),jO=Symbol("ZodInput");class uv{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 o={...r,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function lv(){return new uv}(cv=globalThis).__zod_globalRegistry??(cv.__zod_globalRegistry=lv());var no=globalThis.__zod_globalRegistry;function dv(e,t){return new e({type:"string",...ie(t)})}function xp(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...ie(t)})}function Np(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...ie(t)})}function pv(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...ie(t)})}function fv(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ie(t)})}function mv(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ie(t)})}function hv(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ie(t)})}function Ap(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...ie(t)})}function gv(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...ie(t)})}function yv(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...ie(t)})}function _v(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...ie(t)})}function vv(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...ie(t)})}function Sv(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...ie(t)})}function bv(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...ie(t)})}function $v(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...ie(t)})}function wv(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...ie(t)})}function Rv(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...ie(t)})}function Ev(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ie(t)})}function zv(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ie(t)})}function Pv(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...ie(t)})}function Tv(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...ie(t)})}function Iv(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...ie(t)})}function kv(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...ie(t)})}function Ov(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ie(t)})}function Cv(e,t){return new e({type:"string",format:"date",check:"string_format",...ie(t)})}function xv(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...ie(t)})}function Nv(e,t){return new e({type:"string",format:"duration",check:"string_format",...ie(t)})}function Av(e,t){return new e({type:"number",checks:[],...ie(t)})}function jv(e,t){return new e({type:"number",coerce:!0,checks:[],...ie(t)})}function qv(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...ie(t)})}function Mv(e,t){return new e({type:"boolean",...ie(t)})}function Lv(e,t){return new e({type:"null",...ie(t)})}function Dv(e){return new e({type:"any"})}function Uv(e){return new e({type:"unknown"})}function Fv(e,t){return new e({type:"never",...ie(t)})}function gc(e,t){return new Ep({check:"less_than",...ie(t),value:e,inclusive:!1})}function Si(e,t){return new Ep({check:"less_than",...ie(t),value:e,inclusive:!0})}function yc(e,t){return new zp({check:"greater_than",...ie(t),value:e,inclusive:!1})}function bi(e,t){return new zp({check:"greater_than",...ie(t),value:e,inclusive:!0})}function _c(e,t){return new Zy({check:"multiple_of",...ie(t),value:e})}function vc(e,t){return new Gy({check:"max_length",...ie(t),maximum:e})}function Mn(e,t){return new Jy({check:"min_length",...ie(t),minimum:e})}function Sc(e,t){return new Ky({check:"length_equals",...ie(t),length:e})}function jp(e,t){return new By({check:"string_format",format:"regex",...ie(t),pattern:e})}function qp(e){return new Wy({check:"string_format",format:"lowercase",...ie(e)})}function Mp(e){return new Yy({check:"string_format",format:"uppercase",...ie(e)})}function Lp(e,t){return new Xy({check:"string_format",format:"includes",...ie(t),includes:e})}function Dp(e,t){return new Qy({check:"string_format",format:"starts_with",...ie(t),prefix:e})}function Up(e,t){return new e_({check:"string_format",format:"ends_with",...ie(t),suffix:e})}function so(e){return new t_({check:"overwrite",tx:e})}function Fp(e){return so((t)=>t.normalize(e))}function Vp(){return so((e)=>e.trim())}function Zp(){return so((e)=>e.toLowerCase())}function Hp(){return so((e)=>e.toUpperCase())}function Gp(){return so((e)=>Qg(e))}function Vv(e,t,r){return new e({type:"array",element:t,...ie(r)})}function Zv(e,t,r){return new e({type:"custom",check:"custom",fn:t,...ie(r)})}function Hv(e){let t=qO((r)=>(r.addIssue=(o)=>{if(typeof o==="string")r.issues.push(rn(o,r.value,t._zod.def));else{let n=o;if(n.fatal)n.continue=!1;n.code??(n.code="custom"),n.input??(n.input=r.value),n.inst??(n.inst=t),n.continue??(n.continue=!t._zod.def.abort),r.issues.push(rn(n))}},e(r.value,r)));return t}function qO(e,t){let r=new St({check:"custom",...ie(t)});return r._zod.check=e,r}function wi(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??no,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function Fe(e,t,r={path:[],schemaPath:[]}){var o;let n=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);let a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,l);else{let f=i.schema,m=t.processors[n.type];if(!m)throw Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);m(e,t,f,l)}let d=e._zod.parent;if(d){if(!i.ref)i.ref=d;Fe(d,t,l),t.seen.get(d).isParent=!0}}let c=t.metadataRegistry.get(e);if(c)Object.assign(i.schema,c);if(t.io==="input"&&xt(e))delete i.schema.examples,delete i.schema.default;if(t.io==="input"&&i.schema._prefault)(o=i.schema).default??(o.default=i.schema._prefault);return delete i.schema._prefault,t.seen.get(e).schema}function Ri(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let o=new Map;for(let i of e.seen.entries()){let a=e.metadataRegistry.get(i[0])?.id;if(a){let c=o.get(a);if(c&&c!==i[0])throw Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(a,i[0])}}let n=(i)=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(i[0])?.id,f=e.external.uri??((h)=>h);if(d)return{ref:f(d)};let m=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=m,{defId:m,ref:`${f("__shared")}#/${a}/${m}`}}if(i[1]===r)return{ref:"#"};let u=`${"#"}/${a}/`,l=i[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+l}},s=(i)=>{if(i[1].schema.$ref)return;let a=i[1],{ref:c,defId:u}=n(i);if(a.def={...a.schema},u)a.defId=u;let l=a.schema;for(let d in l)delete l[d];l.$ref=c};if(e.cycles==="throw")for(let i of e.seen.entries()){let a=i[1];if(a.cycle)throw Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
45
+ `)}m.write("payload.value = newResult;"),m.write("return payload;");let S=m.compile();return(v,w)=>S(p,v,w)},s,i=Vo,a=!hc.jitless,u=a&&Oy.value,l=t.catchall,d;e._zod.parse=(p,m)=>{d??(d=n.value);let h=p.value;if(!i(h))return p.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),p;if(a&&u&&m?.async===!1&&m.jitless!==!0){if(!s)s=o(t.shape);if(p=s(p,m),!l)return p;return bv([],h,p,m,d,e)}return r(p,m)}});function j_(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)=>!io(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)=>$r(i,n,Yt())))}),t}var Wp=U("$ZodUnion",(e,t)=>{Fe.init(e,t),xe(e._zod,"optin",()=>t.options.some((o)=>o._zod.optin==="optional")?"optional":void 0),xe(e._zod,"optout",()=>t.options.some((o)=>o._zod.optout==="optional")?"optional":void 0),xe(e._zod,"values",()=>{if(t.options.every((o)=>o._zod.values))return new Set(t.options.flatMap((o)=>Array.from(o._zod.values)));return}),xe(e._zod,"pattern",()=>{if(t.options.every((o)=>o._zod.pattern)){let o=t.options.map((s)=>s._zod.pattern);return new RegExp(`^(${o.map((s)=>vc(s.source)).join("|")})$`)}return});let r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(o,s)=>{if(r)return n(o,s);let i=!1,a=[];for(let c of t.options){let u=c._zod.run({value:o.value,issues:[]},s);if(u instanceof Promise)a.push(u),i=!0;else{if(u.issues.length===0)return u;a.push(u)}}if(!i)return j_(a,o,e,s);return Promise.all(a).then((c)=>j_(c,o,e,s))}});var wv=U("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Wp.init(e,t);let r=e._zod.parse;xe(e._zod,"propValues",()=>{let o={};for(let s of t.options){let i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let[a,c]of Object.entries(i)){if(!o[a])o[a]=new Set;for(let u of c)o[a].add(u)}}return o});let n=$i(()=>{let o=t.options,s=new Map;for(let i of o){let a=i._zod.propValues?.[t.discriminator];if(!a||a.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let c of a){if(s.has(c))throw Error(`Duplicate discriminator value "${String(c)}"`);s.set(c,i)}}return s});e._zod.parse=(o,s)=>{let i=o.value;if(!Vo(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),o;let a=n.value.get(i?.[t.discriminator]);if(a)return a._zod.run(o,s);if(t.unionFallback)return r(o,s);return o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:i,path:[t.discriminator],inst:e}),o}}),Rv=U("$ZodIntersection",(e,t)=>{Fe.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,s=t.left._zod.run({value:o,issues:[]},n),i=t.right._zod.run({value:o,issues:[]},n);if(s instanceof Promise||i instanceof Promise)return Promise.all([s,i]).then(([c,u])=>q_(r,c,u));return q_(r,s,i)}});function Kp(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(so(e)&&so(t)){let r=Object.keys(t),n=Object.keys(e).filter((s)=>r.indexOf(s)!==-1),o={...e,...t};for(let s of n){let i=Kp(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=Kp(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 q_(e,t,r){let n=new Map,o;for(let a of t.issues)if(a.code==="unrecognized_keys"){o??(o=a);for(let c of a.keys){if(!n.has(c))n.set(c,{});n.get(c).l=!0}}else e.issues.push(a);for(let a of r.issues)if(a.code==="unrecognized_keys")for(let c of a.keys){if(!n.has(c))n.set(c,{});n.get(c).r=!0}else e.issues.push(a);let s=[...n].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(s.length&&o)e.issues.push({...o,keys:s});if(io(e))return e;let i=Kp(t.value,r.value);if(!i.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}var Ev=U("$ZodRecord",(e,t)=>{Fe.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!so(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),r;let s=[],i=t.keyType._zod.values;if(i){r.value={};let a=new Set;for(let u of i)if(typeof u==="string"||typeof u==="number"||typeof u==="symbol"){a.add(typeof u==="number"?u.toString():u);let l=t.valueType._zod.run({value:o[u],issues:[]},n);if(l instanceof Promise)s.push(l.then((d)=>{if(d.issues.length)r.issues.push(...an(u,d.issues));r.value[u]=d.value}));else{if(l.issues.length)r.issues.push(...an(u,l.issues));r.value[u]=l.value}}let c;for(let u in o)if(!a.has(u))c=c??[],c.push(u);if(c&&c.length>0)r.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:c})}else{r.value={};for(let a of Reflect.ownKeys(o)){if(a==="__proto__")continue;let c=t.keyType._zod.run({value:a,issues:[]},n);if(c instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof a==="string"&&Hp.test(a)&&c.issues.length){let d=t.keyType._zod.run({value:Number(a),issues:[]},n);if(d instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(d.issues.length===0)c=d}if(c.issues.length){if(t.mode==="loose")r.value[a]=o[a];else r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map((d)=>$r(d,n,Yt())),input:a,path:[a],inst:e});continue}let l=t.valueType._zod.run({value:o[a],issues:[]},n);if(l instanceof Promise)s.push(l.then((d)=>{if(d.issues.length)r.issues.push(...an(a,d.issues));r.value[c.value]=d.value}));else{if(l.issues.length)r.issues.push(...an(a,l.issues));r.value[c.value]=l.value}}}if(s.length)return Promise.all(s).then(()=>r);return r}});var zv=U("$ZodEnum",(e,t)=>{Fe.init(e,t);let r=yc(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter((o)=>xy.has(typeof o)).map((o)=>typeof o==="string"?sn(o):o.toString()).join("|")})$`),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}}),Pv=U("$ZodLiteral",(e,t)=>{if(Fe.init(e,t),t.values.length===0)throw Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map((n)=>typeof n==="string"?sn(n):n?sn(n.toString()):String(n)).join("|")})$`),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 Tv=U("$ZodTransform",(e,t)=>{Fe.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Si(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 Hr;return r.value=o,r}});function M_(e,t){if(e.issues.length&&t===void 0)return{issues:[],value:void 0};return e}var Yp=U("$ZodOptional",(e,t)=>{Fe.init(e,t),e._zod.optin="optional",e._zod.optout="optional",xe(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),xe(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${vc(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((s)=>M_(s,r.value));return M_(o,r.value)}if(r.value===void 0)return r;return t.innerType._zod.run(r,n)}}),Iv=U("$ZodExactOptional",(e,t)=>{Yp.init(e,t),xe(e._zod,"values",()=>t.innerType._zod.values),xe(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),kv=U("$ZodNullable",(e,t)=>{Fe.init(e,t),xe(e._zod,"optin",()=>t.innerType._zod.optin),xe(e._zod,"optout",()=>t.innerType._zod.optout),xe(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${vc(r.source)}|null)$`):void 0}),xe(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>{if(r.value===null)return r;return t.innerType._zod.run(r,n)}}),Ov=U("$ZodDefault",(e,t)=>{Fe.init(e,t),e._zod.optin="optional",xe(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);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 xv=U("$ZodPrefault",(e,t)=>{Fe.init(e,t),e._zod.optin="optional",xe(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)r.value=t.defaultValue;return t.innerType._zod.run(r,n)}}),Cv=U("$ZodNonOptional",(e,t)=>{Fe.init(e,t),xe(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter((n)=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((s)=>D_(s,e));return D_(o,e)}});function D_(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}var Av=U("$ZodCatch",(e,t)=>{Fe.init(e,t),xe(e._zod,"optin",()=>t.innerType._zod.optin),xe(e._zod,"optout",()=>t.innerType._zod.optout),xe(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((s)=>{if(r.value=s.value,s.issues.length)r.value=t.catchValue({...r,error:{issues:s.issues.map((i)=>$r(i,n,Yt()))},input:r.value}),r.issues=[];return r});if(r.value=o.value,o.issues.length)r.value=t.catchValue({...r,error:{issues:o.issues.map((s)=>$r(s,n,Yt()))},input:r.value}),r.issues=[];return r}});var Nv=U("$ZodPipe",(e,t)=>{Fe.init(e,t),xe(e._zod,"values",()=>t.in._zod.values),xe(e._zod,"optin",()=>t.in._zod.optin),xe(e._zod,"optout",()=>t.out._zod.optout),xe(e._zod,"propValues",()=>t.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)=>Rc(i,t.in,n));return Rc(s,t.in,n)}let o=t.in._zod.run(r,n);if(o instanceof Promise)return o.then((s)=>Rc(s,t.out,n));return Rc(o,t.out,n)}});function Rc(e,t,r){if(e.issues.length)return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues},r)}var jv=U("$ZodReadonly",(e,t)=>{Fe.init(e,t),xe(e._zod,"propValues",()=>t.innerType._zod.propValues),xe(e._zod,"values",()=>t.innerType._zod.values),xe(e._zod,"optin",()=>t.innerType?._zod?.optin),xe(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then(U_);return U_(o)}});function U_(e){return e.value=Object.freeze(e.value),e}var qv=U("$ZodLazy",(e,t)=>{Fe.init(e,t),xe(e._zod,"innerType",()=>t.getter()),xe(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),xe(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),xe(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),xe(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(r,n)=>e._zod.innerType._zod.run(r,n)}),Mv=U("$ZodCustom",(e,t)=>{bt.init(e,t),Fe.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)=>F_(s,r,n,e));F_(o,r,n,e);return}});function F_(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(ao(o))}}var qx=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(o){return e[o]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};return(o)=>{switch(o.code){case"invalid_type":{let s=n[o.expected]??o.expected,i=Ny(o.input),a=n[i]??i;return`Invalid input: expected ${s}, received ${a}`}case"invalid_value":if(o.values.length===1)return`Invalid input: expected ${Mp(o.values[0])}`;return`Invalid option: expected one of ${Ap(o.values,"|")}`;case"too_big":{let s=o.inclusive?"<=":"<",i=t(o.origin);if(i)return`Too big: expected ${o.origin??"value"} to have ${s}${o.maximum.toString()} ${i.unit??"elements"}`;return`Too big: expected ${o.origin??"value"} to be ${s}${o.maximum.toString()}`}case"too_small":{let s=o.inclusive?">=":">",i=t(o.origin);if(i)return`Too small: expected ${o.origin} to have ${s}${o.minimum.toString()} ${i.unit}`;return`Too small: expected ${o.origin} to be ${s}${o.minimum.toString()}`}case"invalid_format":{let s=o;if(s.format==="starts_with")return`Invalid string: must start with "${s.prefix}"`;if(s.format==="ends_with")return`Invalid string: must end with "${s.suffix}"`;if(s.format==="includes")return`Invalid string: must include "${s.includes}"`;if(s.format==="regex")return`Invalid string: must match pattern ${s.pattern}`;return`Invalid ${r[s.format]??o.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${o.divisor}`;case"unrecognized_keys":return`Unrecognized key${o.keys.length>1?"s":""}: ${Ap(o.keys,", ")}`;case"invalid_key":return`Invalid key in ${o.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${o.origin}`;default:return"Invalid input"}}};function Xp(){return{localeError:qx()}}var Lv,Mx=Symbol("ZodOutput"),Lx=Symbol("ZodInput");class Dv{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 Uv(){return new Dv}(Lv=globalThis).__zod_globalRegistry??(Lv.__zod_globalRegistry=Uv());var cn=globalThis.__zod_globalRegistry;function Fv(e,t){return new e({type:"string",...ie(t)})}function Qp(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...ie(t)})}function ef(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...ie(t)})}function Vv(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...ie(t)})}function Hv(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ie(t)})}function Zv(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ie(t)})}function Gv(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ie(t)})}function tf(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...ie(t)})}function Jv(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...ie(t)})}function Kv(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...ie(t)})}function Bv(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...ie(t)})}function Wv(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...ie(t)})}function Yv(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...ie(t)})}function Xv(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...ie(t)})}function Qv(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...ie(t)})}function eS(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...ie(t)})}function tS(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...ie(t)})}function rS(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ie(t)})}function nS(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ie(t)})}function oS(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...ie(t)})}function sS(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...ie(t)})}function iS(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...ie(t)})}function aS(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...ie(t)})}function cS(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ie(t)})}function uS(e,t){return new e({type:"string",format:"date",check:"string_format",...ie(t)})}function lS(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...ie(t)})}function dS(e,t){return new e({type:"string",format:"duration",check:"string_format",...ie(t)})}function pS(e,t){return new e({type:"number",checks:[],...ie(t)})}function fS(e,t){return new e({type:"number",coerce:!0,checks:[],...ie(t)})}function mS(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...ie(t)})}function hS(e,t){return new e({type:"boolean",...ie(t)})}function gS(e,t){return new e({type:"null",...ie(t)})}function yS(e){return new e({type:"any"})}function _S(e){return new e({type:"unknown"})}function vS(e,t){return new e({type:"never",...ie(t)})}function Pc(e,t){return new Zp({check:"less_than",...ie(t),value:e,inclusive:!1})}function Pi(e,t){return new Zp({check:"less_than",...ie(t),value:e,inclusive:!0})}function Tc(e,t){return new Gp({check:"greater_than",...ie(t),value:e,inclusive:!1})}function Ti(e,t){return new Gp({check:"greater_than",...ie(t),value:e,inclusive:!0})}function Ic(e,t){return new b_({check:"multiple_of",...ie(t),value:e})}function kc(e,t){return new w_({check:"max_length",...ie(t),maximum:e})}function Ho(e,t){return new R_({check:"min_length",...ie(t),minimum:e})}function Oc(e,t){return new E_({check:"length_equals",...ie(t),length:e})}function rf(e,t){return new z_({check:"string_format",format:"regex",...ie(t),pattern:e})}function nf(e){return new P_({check:"string_format",format:"lowercase",...ie(e)})}function of(e){return new T_({check:"string_format",format:"uppercase",...ie(e)})}function sf(e,t){return new I_({check:"string_format",format:"includes",...ie(t),includes:e})}function af(e,t){return new k_({check:"string_format",format:"starts_with",...ie(t),prefix:e})}function cf(e,t){return new O_({check:"string_format",format:"ends_with",...ie(t),suffix:e})}function un(e){return new x_({check:"overwrite",tx:e})}function uf(e){return un((t)=>t.normalize(e))}function lf(){return un((e)=>e.trim())}function df(){return un((e)=>e.toLowerCase())}function pf(){return un((e)=>e.toUpperCase())}function ff(){return un((e)=>ky(e))}function SS(e,t,r){return new e({type:"array",element:t,...ie(r)})}function bS(e,t,r){return new e({type:"custom",check:"custom",fn:t,...ie(r)})}function $S(e){let t=Dx((r)=>(r.addIssue=(n)=>{if(typeof n==="string")r.issues.push(ao(n,r.value,t._zod.def));else{let o=n;if(o.fatal)o.continue=!1;o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),r.issues.push(ao(o))}},e(r.value,r)));return t}function Dx(e,t){let r=new bt({check:"custom",...ie(t)});return r._zod.check=e,r}function ki(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??cn,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function Ve(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);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 p=i.schema,m=t.processors[o.type];if(!m)throw Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);m(e,t,p,l)}let d=e._zod.parent;if(d){if(!i.ref)i.ref=d;Ve(d,t,l),t.seen.get(d).isParent=!0}}let c=t.metadataRegistry.get(e);if(c)Object.assign(i.schema,c);if(t.io==="input"&&Nt(e))delete i.schema.examples,delete i.schema.default;if(t.io==="input"&&i.schema._prefault)(n=i.schema).default??(n.default=i.schema._prefault);return delete i.schema._prefault,t.seen.get(e).schema}function Oi(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=new Map;for(let i of e.seen.entries()){let a=e.metadataRegistry.get(i[0])?.id;if(a){let c=n.get(a);if(c&&c!==i[0])throw Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(a,i[0])}}let o=(i)=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(i[0])?.id,p=e.external.uri??((h)=>h);if(d)return{ref:p(d)};let m=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=m,{defId:m,ref:`${p("__shared")}#/${a}/${m}`}}if(i[1]===r)return{ref:"#"};let u=`${"#"}/${a}/`,l=i[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+l}},s=(i)=>{if(i[1].schema.$ref)return;let a=i[1],{ref:c,defId:u}=o(i);if(a.def={...a.schema},u)a.defId=u;let l=a.schema;for(let d in l)delete l[d];l.$ref=c};if(e.cycles==="throw")for(let i of e.seen.entries()){let a=i[1];if(a.cycle)throw Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
46
46
 
47
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of e.seen.entries()){let a=i[1];if(t===i[0]){s(i);continue}if(e.external){let u=e.external.registry.get(i[0])?.id;if(t!==i[0]&&u){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(a.cycle){s(i);continue}if(a.count>1){if(e.reused==="ref"){s(i);continue}}}}function Ei(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let o=(i)=>{let a=e.seen.get(i);if(a.ref===null)return;let c=a.def??a.schema,u={...c},l=a.ref;if(a.ref=null,l){o(l);let f=e.seen.get(l),m=f.schema;if(m.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))c.allOf=c.allOf??[],c.allOf.push(m);else Object.assign(c,m);if(Object.assign(c,u),i._zod.parent===l)for(let g in c){if(g==="$ref"||g==="allOf")continue;if(!(g in u))delete c[g]}if(m.$ref&&f.def)for(let g in c){if(g==="$ref"||g==="allOf")continue;if(g in f.def&&JSON.stringify(c[g])===JSON.stringify(f.def[g]))delete c[g]}}let d=i._zod.parent;if(d&&d!==l){o(d);let f=e.seen.get(d);if(f?.schema.$ref){if(c.$ref=f.schema.$ref,f.def)for(let m in c){if(m==="$ref"||m==="allOf")continue;if(m in f.def&&JSON.stringify(c[m])===JSON.stringify(f.def[m]))delete c[m]}}}e.override({zodSchema:i,jsonSchema:c,path:a.path??[]})};for(let i of[...e.seen.entries()].reverse())o(i[0]);let n={};if(e.target==="draft-2020-12")n.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")n.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")n.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let i=e.external.registry.get(t)?.id;if(!i)throw Error("Schema is missing an `id` property");n.$id=e.external.uri(i)}Object.assign(n,r.def??r.schema);let s=e.external?.defs??{};for(let i of e.seen.entries()){let a=i[1];if(a.def&&a.defId)s[a.defId]=a.def}if(e.external);else if(Object.keys(s).length>0)if(e.target==="draft-2020-12")n.$defs=s;else n.definitions=s;try{let i=JSON.parse(JSON.stringify(n));return Object.defineProperty(i,"~standard",{value:{...t["~standard"],jsonSchema:{input:$i(t,"input",e.processors),output:$i(t,"output",e.processors)}},enumerable:!1,writable:!1}),i}catch(i){throw Error("Error converting schema to JSON.")}}function xt(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return xt(o.element,r);if(o.type==="set")return xt(o.valueType,r);if(o.type==="lazy")return xt(o.getter(),r);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault")return xt(o.innerType,r);if(o.type==="intersection")return xt(o.left,r)||xt(o.right,r);if(o.type==="record"||o.type==="map")return xt(o.keyType,r)||xt(o.valueType,r);if(o.type==="pipe")return xt(o.in,r)||xt(o.out,r);if(o.type==="object"){for(let n in o.shape)if(xt(o.shape[n],r))return!0;return!1}if(o.type==="union"){for(let n of o.options)if(xt(n,r))return!0;return!1}if(o.type==="tuple"){for(let n of o.items)if(xt(n,r))return!0;if(o.rest&&xt(o.rest,r))return!0;return!1}return!1}var Gv=(e,t={})=>(r)=>{let o=wi({...r,processors:t});return Fe(e,o),Ri(o,e),Ei(o,e)},$i=(e,t,r={})=>(o)=>{let{libraryOptions:n,target:s}=o??{},i=wi({...n??{},target:s,io:t,processors:r});return Fe(e,i),Ri(i,e),Ei(i,e)};var MO={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Jp=(e,t,r,o)=>{let n=r;n.type="string";let{minimum:s,maximum:i,format:a,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof s==="number")n.minLength=s;if(typeof i==="number")n.maxLength=i;if(a){if(n.format=MO[a]??a,n.format==="")delete n.format;if(a==="time")delete n.format}if(u)n.contentEncoding=u;if(c&&c.size>0){let l=[...c];if(l.length===1)n.pattern=l[0].source;else if(l.length>1)n.allOf=[...l.map((d)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))]}},Kp=(e,t,r,o)=>{let n=r,{minimum:s,maximum:i,format:a,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=e._zod.bag;if(typeof a==="string"&&a.includes("int"))n.type="integer";else n.type="number";if(typeof l==="number")if(t.target==="draft-04"||t.target==="openapi-3.0")n.minimum=l,n.exclusiveMinimum=!0;else n.exclusiveMinimum=l;if(typeof s==="number"){if(n.minimum=s,typeof l==="number"&&t.target!=="draft-04")if(l>=s)delete n.minimum;else delete n.exclusiveMinimum}if(typeof u==="number")if(t.target==="draft-04"||t.target==="openapi-3.0")n.maximum=u,n.exclusiveMaximum=!0;else n.exclusiveMaximum=u;if(typeof i==="number"){if(n.maximum=i,typeof u==="number"&&t.target!=="draft-04")if(u<=i)delete n.maximum;else delete n.exclusiveMaximum}if(typeof c==="number")n.multipleOf=c},Bp=(e,t,r,o)=>{r.type="boolean"},Kv=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},Bv=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema")},Wp=(e,t,r,o)=>{if(t.target==="openapi-3.0")r.type="string",r.nullable=!0,r.enum=[null];else r.type="null"},Wv=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema")},Yv=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema")},Yp=(e,t,r,o)=>{r.not={}},Xp=(e,t,r,o)=>{},Qp=(e,t,r,o)=>{},Xv=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema")},ef=(e,t,r,o)=>{let n=e._zod.def,s=ic(n.entries);if(s.every((i)=>typeof i==="number"))r.type="number";if(s.every((i)=>typeof i==="string"))r.type="string";r.enum=s},tf=(e,t,r,o)=>{let n=e._zod.def,s=[];for(let i of n.values)if(i===void 0){if(t.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof i==="bigint")if(t.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else 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}},Qv=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema")},eS=(e,t,r,o)=>{let n=r,s=e._zod.pattern;if(!s)throw Error("Pattern not found in template literal");n.type="string",n.pattern=s.source},tS=(e,t,r,o)=>{let n=r,s={type:"string",format:"binary",contentEncoding:"binary"},{minimum:i,maximum:a,mime:c}=e._zod.bag;if(i!==void 0)s.minLength=i;if(a!==void 0)s.maxLength=a;if(c)if(c.length===1)s.contentMediaType=c[0],Object.assign(n,s);else Object.assign(n,s),n.anyOf=c.map((u)=>({contentMediaType:u}));else Object.assign(n,s)},rS=(e,t,r,o)=>{r.type="boolean"},rf=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")},oS=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Function types cannot be represented in JSON Schema")},of=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")},nS=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema")},sS=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema")},nf=(e,t,r,o)=>{let n=r,s=e._zod.def,{minimum:i,maximum:a}=e._zod.bag;if(typeof i==="number")n.minItems=i;if(typeof a==="number")n.maxItems=a;n.type="array",n.items=Fe(s.element,t,{...o,path:[...o.path,"items"]})},sf=(e,t,r,o)=>{let n=r,s=e._zod.def;n.type="object",n.properties={};let i=s.shape;for(let u in i)n.properties[u]=Fe(i[u],t,{...o,path:[...o.path,"properties",u]});let a=new Set(Object.keys(i)),c=new Set([...a].filter((u)=>{let l=s.shape[u]._zod;if(t.io==="input")return l.optin===void 0;else return l.optout===void 0}));if(c.size>0)n.required=Array.from(c);if(s.catchall?._zod.def.type==="never")n.additionalProperties=!1;else if(!s.catchall){if(t.io==="output")n.additionalProperties=!1}else if(s.catchall)n.additionalProperties=Fe(s.catchall,t,{...o,path:[...o.path,"additionalProperties"]})},af=(e,t,r,o)=>{let n=e._zod.def,s=n.inclusive===!1,i=n.options.map((a,c)=>Fe(a,t,{...o,path:[...o.path,s?"oneOf":"anyOf",c]}));if(s)r.oneOf=i;else r.anyOf=i},cf=(e,t,r,o)=>{let n=e._zod.def,s=Fe(n.left,t,{...o,path:[...o.path,"allOf",0]}),i=Fe(n.right,t,{...o,path:[...o.path,"allOf",1]}),a=(u)=>("allOf"in u)&&Object.keys(u).length===1,c=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];r.allOf=c},iS=(e,t,r,o)=>{let n=r,s=e._zod.def;n.type="array";let i=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"?"items":t.target==="openapi-3.0"?"items":"additionalItems",c=s.items.map((f,m)=>Fe(f,t,{...o,path:[...o.path,i,m]})),u=s.rest?Fe(s.rest,t,{...o,path:[...o.path,a,...t.target==="openapi-3.0"?[s.items.length]:[]]}):null;if(t.target==="draft-2020-12"){if(n.prefixItems=c,u)n.items=u}else if(t.target==="openapi-3.0"){if(n.items={anyOf:c},u)n.items.anyOf.push(u);if(n.minItems=c.length,!u)n.maxItems=c.length}else if(n.items=c,u)n.additionalItems=u;let{minimum:l,maximum:d}=e._zod.bag;if(typeof l==="number")n.minItems=l;if(typeof d==="number")n.maxItems=d},uf=(e,t,r,o)=>{let n=r,s=e._zod.def;n.type="object";let i=s.keyType,c=i._zod.bag?.patterns;if(s.mode==="loose"&&c&&c.size>0){let l=Fe(s.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});n.patternProperties={};for(let d of c)n.patternProperties[d.source]=l}else{if(t.target==="draft-07"||t.target==="draft-2020-12")n.propertyNames=Fe(s.keyType,t,{...o,path:[...o.path,"propertyNames"]});n.additionalProperties=Fe(s.valueType,t,{...o,path:[...o.path,"additionalProperties"]})}let u=i._zod.values;if(u){let l=[...u].filter((d)=>typeof d==="string"||typeof d==="number");if(l.length>0)n.required=l}},lf=(e,t,r,o)=>{let n=e._zod.def,s=Fe(n.innerType,t,o),i=t.seen.get(e);if(t.target==="openapi-3.0")i.ref=n.innerType,r.nullable=!0;else r.anyOf=[s,{type:"null"}]},df=(e,t,r,o)=>{let n=e._zod.def;Fe(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType},pf=(e,t,r,o)=>{let n=e._zod.def;Fe(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType,r.default=JSON.parse(JSON.stringify(n.defaultValue))},ff=(e,t,r,o)=>{let n=e._zod.def;Fe(n.innerType,t,o);let s=t.seen.get(e);if(s.ref=n.innerType,t.io==="input")r._prefault=JSON.parse(JSON.stringify(n.defaultValue))},mf=(e,t,r,o)=>{let n=e._zod.def;Fe(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType;let i;try{i=n.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}r.default=i},hf=(e,t,r,o)=>{let n=e._zod.def,s=t.io==="input"?n.in._zod.def.type==="transform"?n.out:n.in:n.out;Fe(s,t,o);let i=t.seen.get(e);i.ref=s},gf=(e,t,r,o)=>{let n=e._zod.def;Fe(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType,r.readOnly=!0},aS=(e,t,r,o)=>{let n=e._zod.def;Fe(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType},bc=(e,t,r,o)=>{let n=e._zod.def;Fe(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType},yf=(e,t,r,o)=>{let n=e._zod.innerType;Fe(n,t,o);let s=t.seen.get(e);s.ref=n},Jv={string:Jp,number:Kp,boolean:Bp,bigint:Kv,symbol:Bv,null:Wp,undefined:Wv,void:Yv,never:Yp,any:Xp,unknown:Qp,date:Xv,enum:ef,literal:tf,nan:Qv,template_literal:eS,file:tS,success:rS,custom:rf,function:oS,transform:of,map:nS,set:sS,array:nf,object:sf,union:af,intersection:cf,tuple:iS,record:uf,nullable:lf,nonoptional:df,default:pf,prefault:ff,catch:mf,pipe:hf,readonly:gf,promise:aS,optional:bc,lazy:yf};function $c(e,t){if("_idmap"in e){let o=e,n=wi({...t,processors:Jv}),s={};for(let c of o._idmap.entries()){let[u,l]=c;Fe(l,n)}let i={},a={registry:o,uri:t?.uri,defs:s};n.external=a;for(let c of o._idmap.entries()){let[u,l]=c;Ri(n,l),i[u]=Ei(n,l)}if(Object.keys(s).length>0){let c=n.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[c]:s}}return{schemas:i}}let r=wi({...t,processors:Jv});return Fe(e,r),Ri(r,e),Ei(r,e)}var GO=U("ZodISODateTime",(e,t)=>{w_.init(e,t),Je.init(e,t)});function Dn(e){return Ov(GO,e)}var JO=U("ZodISODate",(e,t)=>{R_.init(e,t),Je.init(e,t)});function _f(e){return Cv(JO,e)}var KO=U("ZodISOTime",(e,t)=>{E_.init(e,t),Je.init(e,t)});function cS(e){return xv(KO,e)}var BO=U("ZodISODuration",(e,t)=>{z_.init(e,t),Je.init(e,t)});function uS(e){return Nv(BO,e)}var dS=(e,t)=>{lc.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:(r)=>bp(e,r)},flatten:{value:(r)=>Sp(e,r)},addIssue:{value:(r)=>{e.issues.push(r),e.message=JSON.stringify(e.issues,mi,2)}},addIssues:{value:(r)=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,mi,2)}},isEmpty:{get(){return e.issues.length===0}}})},j6=U("ZodError",dS),Bt=U("ZodError",dS,{Parent:Error});var pS=dc(Bt),fS=pc(Bt),Rc=gi(Bt),mS=yi(Bt),hS=cy(Bt),gS=uy(Bt),yS=ly(Bt),_S=dy(Bt),vS=py(Bt),SS=fy(Bt),bS=my(Bt),$S=hy(Bt);var Ze=U("ZodType",(e,t)=>(Ue.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:$i(e,"input"),output:$i(e,"output")}}),e.toJSONSchema=Gv(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(to(t,{checks:[...t.checks??[],...r.map((o)=>typeof o==="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0}),e.with=e.check,e.clone=(r,o)=>dr(e,r,o),e.brand=()=>e,e.register=(r,o)=>(r.add(e,o),e),e.parse=(r,o)=>pS(e,r,o,{callee:e.parse}),e.safeParse=(r,o)=>Rc(e,r,o),e.parseAsync=async(r,o)=>fS(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>mS(e,r,o),e.spa=e.safeParseAsync,e.encode=(r,o)=>hS(e,r,o),e.decode=(r,o)=>gS(e,r,o),e.encodeAsync=async(r,o)=>yS(e,r,o),e.decodeAsync=async(r,o)=>_S(e,r,o),e.safeEncode=(r,o)=>vS(e,r,o),e.safeDecode=(r,o)=>SS(e,r,o),e.safeEncodeAsync=async(r,o)=>bS(e,r,o),e.safeDecodeAsync=async(r,o)=>$S(e,r,o),e.refine=(r,o)=>e.check(LC(r,o)),e.superRefine=(r)=>e.check(DC(r)),e.overwrite=(r)=>e.check(so(r)),e.optional=()=>ae(e),e.exactOptional=()=>EC(e),e.nullable=()=>ES(e),e.nullish=()=>ae(ES(e)),e.nonoptional=(r)=>OC(e,r),e.array=()=>N(e),e.or=(r)=>te([e,r]),e.and=(r)=>Ur(e,r),e.transform=(r)=>Sf(e,AS(r)),e.default=(r)=>TC(e,r),e.prefault=(r)=>kC(e,r),e.catch=(r)=>xC(e,r),e.pipe=(r)=>Sf(e,r),e.readonly=()=>jC(e),e.describe=(r)=>{let o=e.clone();return no.add(o,{description:r}),o},Object.defineProperty(e,"description",{get(){return no.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return no.get(e);let o=e.clone();return no.add(o,r[0]),o},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=(r)=>r(e),e)),zS=U("_ZodString",(e,t)=>{hc.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(o,n,s)=>Jp(e,o,n,s);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...o)=>e.check(jp(...o)),e.includes=(...o)=>e.check(Lp(...o)),e.startsWith=(...o)=>e.check(Dp(...o)),e.endsWith=(...o)=>e.check(Up(...o)),e.min=(...o)=>e.check(Mn(...o)),e.max=(...o)=>e.check(vc(...o)),e.length=(...o)=>e.check(Sc(...o)),e.nonempty=(...o)=>e.check(Mn(1,...o)),e.lowercase=(o)=>e.check(qp(o)),e.uppercase=(o)=>e.check(Mp(o)),e.trim=()=>e.check(Vp()),e.normalize=(...o)=>e.check(Fp(...o)),e.toLowerCase=()=>e.check(Zp()),e.toUpperCase=()=>e.check(Hp()),e.slugify=()=>e.check(Gp())}),PS=U("ZodString",(e,t)=>{hc.init(e,t),zS.init(e,t),e.email=(r)=>e.check(xp(TS,r)),e.url=(r)=>e.check(Ap(kS,r)),e.jwt=(r)=>e.check(kv(dC,r)),e.emoji=(r)=>e.check(gv(YO,r)),e.guid=(r)=>e.check(Np(wS,r)),e.uuid=(r)=>e.check(pv(Ec,r)),e.uuidv4=(r)=>e.check(fv(Ec,r)),e.uuidv6=(r)=>e.check(mv(Ec,r)),e.uuidv7=(r)=>e.check(hv(Ec,r)),e.nanoid=(r)=>e.check(yv(XO,r)),e.guid=(r)=>e.check(Np(wS,r)),e.cuid=(r)=>e.check(_v(QO,r)),e.cuid2=(r)=>e.check(vv(eC,r)),e.ulid=(r)=>e.check(Sv(tC,r)),e.base64=(r)=>e.check(Pv(cC,r)),e.base64url=(r)=>e.check(Tv(uC,r)),e.xid=(r)=>e.check(bv(rC,r)),e.ksuid=(r)=>e.check($v(oC,r)),e.ipv4=(r)=>e.check(wv(nC,r)),e.ipv6=(r)=>e.check(Rv(sC,r)),e.cidrv4=(r)=>e.check(Ev(iC,r)),e.cidrv6=(r)=>e.check(zv(aC,r)),e.e164=(r)=>e.check(Iv(lC,r)),e.datetime=(r)=>e.check(Dn(r)),e.date=(r)=>e.check(_f(r)),e.time=(r)=>e.check(cS(r)),e.duration=(r)=>e.check(uS(r))});function p(e){return dv(PS,e)}var Je=U("ZodStringFormat",(e,t)=>{He.init(e,t),zS.init(e,t)}),TS=U("ZodEmail",(e,t)=>{m_.init(e,t),Je.init(e,t)});function IS(e){return xp(TS,e)}var wS=U("ZodGUID",(e,t)=>{p_.init(e,t),Je.init(e,t)});var Ec=U("ZodUUID",(e,t)=>{f_.init(e,t),Je.init(e,t)});var kS=U("ZodURL",(e,t)=>{h_.init(e,t),Je.init(e,t)});function zc(e){return Ap(kS,e)}var YO=U("ZodEmoji",(e,t)=>{g_.init(e,t),Je.init(e,t)});var XO=U("ZodNanoID",(e,t)=>{y_.init(e,t),Je.init(e,t)});var QO=U("ZodCUID",(e,t)=>{__.init(e,t),Je.init(e,t)});var eC=U("ZodCUID2",(e,t)=>{v_.init(e,t),Je.init(e,t)});var tC=U("ZodULID",(e,t)=>{S_.init(e,t),Je.init(e,t)});var rC=U("ZodXID",(e,t)=>{b_.init(e,t),Je.init(e,t)});var oC=U("ZodKSUID",(e,t)=>{$_.init(e,t),Je.init(e,t)});var nC=U("ZodIPv4",(e,t)=>{P_.init(e,t),Je.init(e,t)});var sC=U("ZodIPv6",(e,t)=>{T_.init(e,t),Je.init(e,t)});var iC=U("ZodCIDRv4",(e,t)=>{I_.init(e,t),Je.init(e,t)});var aC=U("ZodCIDRv6",(e,t)=>{k_.init(e,t),Je.init(e,t)});var cC=U("ZodBase64",(e,t)=>{C_.init(e,t),Je.init(e,t)});var uC=U("ZodBase64URL",(e,t)=>{x_.init(e,t),Je.init(e,t)});var lC=U("ZodE164",(e,t)=>{N_.init(e,t),Je.init(e,t)});var dC=U("ZodJWT",(e,t)=>{A_.init(e,t),Je.init(e,t)});var Pc=U("ZodNumber",(e,t)=>{Ip.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(o,n,s)=>Kp(e,o,n,s),e.gt=(o,n)=>e.check(yc(o,n)),e.gte=(o,n)=>e.check(bi(o,n)),e.min=(o,n)=>e.check(bi(o,n)),e.lt=(o,n)=>e.check(gc(o,n)),e.lte=(o,n)=>e.check(Si(o,n)),e.max=(o,n)=>e.check(Si(o,n)),e.int=(o)=>e.check(RS(o)),e.safe=(o)=>e.check(RS(o)),e.positive=(o)=>e.check(yc(0,o)),e.nonnegative=(o)=>e.check(bi(0,o)),e.negative=(o)=>e.check(gc(0,o)),e.nonpositive=(o)=>e.check(Si(0,o)),e.multipleOf=(o,n)=>e.check(_c(o,n)),e.step=(o,n)=>e.check(_c(o,n)),e.finite=()=>e;let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??0.5),e.isFinite=!0,e.format=r.format??null});function J(e){return Av(Pc,e)}var pC=U("ZodNumberFormat",(e,t)=>{j_.init(e,t),Pc.init(e,t)});function RS(e){return qv(pC,e)}var OS=U("ZodBoolean",(e,t)=>{q_.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Bp(e,r,o,n)});function Q(e){return Mv(OS,e)}var fC=U("ZodNull",(e,t)=>{M_.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Wp(e,r,o,n)});function on(e){return Lv(fC,e)}var mC=U("ZodAny",(e,t)=>{L_.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Xp(e,r,o,n)});function CS(){return Dv(mC)}var hC=U("ZodUnknown",(e,t)=>{D_.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Qp(e,r,o,n)});function ce(){return Uv(hC)}var gC=U("ZodNever",(e,t)=>{U_.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Yp(e,r,o,n)});function yC(e){return Fv(gC,e)}var _C=U("ZodArray",(e,t)=>{F_.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>nf(e,r,o,n),e.element=t.element,e.min=(r,o)=>e.check(Mn(r,o)),e.nonempty=(r)=>e.check(Mn(1,r)),e.max=(r,o)=>e.check(vc(r,o)),e.length=(r,o)=>e.check(Sc(r,o)),e.unwrap=()=>e.element});function N(e,t){return Vv(_C,e,t)}var xS=U("ZodObject",(e,t)=>{H_.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>sf(e,r,o,n),Ce(e,"shape",()=>t.shape),e.keyof=()=>pe(Object.keys(e._zod.def.shape)),e.catchall=(r)=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ce()}),e.loose=()=>e.clone({...e._zod.def,catchall:ce()}),e.strict=()=>e.clone({...e._zod.def,catchall:yC()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=(r)=>RO(e,r),e.safeExtend=(r)=>EO(e,r),e.merge=(r)=>zO(e,r),e.pick=(r)=>$O(e,r),e.omit=(r)=>wO(e,r),e.partial=(...r)=>PO(jS,e,r[0]),e.required=(...r)=>TO(qS,e,r[0])});function T(e,t){let r={type:"object",shape:e??{},...ie(t)};return new xS(r)}function de(e,t){return new xS({type:"object",shape:e,catchall:ce(),...ie(t)})}var NS=U("ZodUnion",(e,t)=>{kp.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>af(e,r,o,n),e.options=t.options});function te(e,t){return new NS({type:"union",options:e,...ie(t)})}var vC=U("ZodDiscriminatedUnion",(e,t)=>{NS.init(e,t),G_.init(e,t)});function Un(e,t,r){return new vC({type:"union",options:t,discriminator:e,...ie(r)})}var SC=U("ZodIntersection",(e,t)=>{J_.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>cf(e,r,o,n)});function Ur(e,t){return new SC({type:"intersection",left:e,right:t})}var bC=U("ZodRecord",(e,t)=>{K_.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>uf(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType});function ee(e,t,r){return new bC({type:"record",keyType:e,valueType:t,...ie(r)})}var vf=U("ZodEnum",(e,t)=>{B_.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(o,n,s)=>ef(e,o,n,s),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(o,n)=>{let s={};for(let i of o)if(r.has(i))s[i]=t.entries[i];else throw Error(`Key ${i} not found in enum`);return new vf({...t,checks:[],...ie(n),entries:s})},e.exclude=(o,n)=>{let s={...t.entries};for(let i of o)if(r.has(i))delete s[i];else throw Error(`Key ${i} not found in enum`);return new vf({...t,checks:[],...ie(n),entries:s})}});function pe(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((o)=>[o,o])):e;return new vf({type:"enum",entries:r,...ie(t)})}var $C=U("ZodLiteral",(e,t)=>{W_.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>tf(e,r,o,n),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 $C({type:"literal",values:Array.isArray(e)?e:[e],...ie(t)})}var wC=U("ZodTransform",(e,t)=>{Y_.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>of(e,r,o,n),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new fi(e.constructor.name);r.addIssue=(s)=>{if(typeof s==="string")r.issues.push(rn(s,r.value,t));else{let i=s;if(i.fatal)i.continue=!1;i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),r.issues.push(rn(i))}};let n=t.transform(r.value,r);if(n instanceof Promise)return n.then((s)=>(r.value=s,r));return r.value=n,r}});function AS(e){return new wC({type:"transform",transform:e})}var jS=U("ZodOptional",(e,t)=>{Op.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>bc(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function ae(e){return new jS({type:"optional",innerType:e})}var RC=U("ZodExactOptional",(e,t)=>{X_.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>bc(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function EC(e){return new RC({type:"optional",innerType:e})}var zC=U("ZodNullable",(e,t)=>{Q_.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>lf(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function ES(e){return new zC({type:"nullable",innerType:e})}var PC=U("ZodDefault",(e,t)=>{ev.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>pf(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function TC(e,t){return new PC({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():yp(t)}})}var IC=U("ZodPrefault",(e,t)=>{tv.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ff(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function kC(e,t){return new IC({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():yp(t)}})}var qS=U("ZodNonOptional",(e,t)=>{rv.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>df(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function OC(e,t){return new qS({type:"nonoptional",innerType:e,...ie(t)})}var CC=U("ZodCatch",(e,t)=>{ov.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>mf(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function xC(e,t){return new CC({type:"catch",innerType:e,catchValue:typeof t==="function"?t:()=>t})}var NC=U("ZodPipe",(e,t)=>{nv.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>hf(e,r,o,n),e.in=t.in,e.out=t.out});function Sf(e,t){return new NC({type:"pipe",in:e,out:t})}var AC=U("ZodReadonly",(e,t)=>{sv.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>gf(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function jC(e){return new AC({type:"readonly",innerType:e})}var qC=U("ZodLazy",(e,t)=>{iv.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>yf(e,r,o,n),e.unwrap=()=>e._zod.def.getter()});function zi(e){return new qC({type:"lazy",getter:e})}var MC=U("ZodCustom",(e,t)=>{av.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,n)=>rf(e,r,o,n)});function LC(e,t={}){return Zv(MC,e,t)}function DC(e){return Hv(e)}function nn(e,t){return Sf(AS(e),t)}var LS={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 MS;(function(e){})(MS||(MS={}));function UC(e){return jv(Pc,e)}Kt(Cp());var an="2025-11-25";var Tc=[an,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Ic="io.modelcontextprotocol/related-task",Vr="io.modelcontextprotocol/protocolVersion",Fn="io.modelcontextprotocol/clientInfo",br="io.modelcontextprotocol/serverInfo",Zr="io.modelcontextprotocol/clientCapabilities",cn="io.modelcontextprotocol/subscriptionId",ao="io.modelcontextprotocol/logLevel";var un="2.0";var io=zi(()=>te([p(),J(),Q(),on(),ee(p(),io),N(io)])),Xe=ee(p(),io),$f=N(io),Pi=te([p(),J().int()]),Ti=p(),kc=T({ttl:J().optional()}),Oc=T({taskId:p()}),Ii=de({progressToken:Pi.optional(),[Ic]:Oc.optional()}),yt=T({_meta:Ii.optional()}),ln=yt.extend({task:kc.optional()}),Qe=T({method:p(),params:yt.loose().optional()}),Pt=T({_meta:Ii.optional()}),Tt=T({method:p(),params:Pt.loose().optional()}),ki=de({get[br](){return Hn.optional().catch(void 0)}}),et=de({_meta:ki.optional()}),co=te([p(),J().int()]),Oi=T({jsonrpc:A(un),id:co,...Qe.shape}).strict(),Ci=T({jsonrpc:A(un),...Tt.shape}).strict(),Vn=T({jsonrpc:A(un),id:co,result:et}).strict(),Zn=T({jsonrpc:A(un),id:co.optional(),error:T({code:J().int(),message:p(),data:ce().optional()})}).strict(),xi=te([Oi,Ci,Vn,Zn]),wf=te([Vn,Zn]),Ni=et.strict(),Cc=Pt.extend({requestId:co.optional(),reason:p().optional()}),Ai=Tt.extend({method:A("notifications/cancelled"),params:Cc}),xc=T({src:p(),mimeType:p().optional(),sizes:N(p()).optional(),theme:pe(["light","dark"]).optional()}),uo=T({icons:N(xc).optional()}),Fr=T({name:p(),title:p().optional()}),Hn=Fr.extend({...Fr.shape,...uo.shape,version:p(),websiteUrl:p().optional(),description:p().optional()}),VC=Ur(T({applyDefaults:Q().optional()}),Xe),ZC=nn((e)=>{if(e&&typeof e==="object"&&!Array.isArray(e)&&Object.keys(e).length===0)return{form:{}};return e},Ur(T({form:VC.optional(),url:Xe.optional()}),Xe.optional())),Nc=de({list:Xe.optional(),cancel:Xe.optional(),requests:de({sampling:de({createMessage:Xe.optional()}).optional(),elicitation:de({create:Xe.optional()}).optional()}).optional()}),Ac=de({list:Xe.optional(),cancel:Xe.optional(),requests:de({tools:de({call:Xe.optional()}).optional()}).optional()}),jc=T({experimental:ee(p(),Xe).optional(),sampling:T({context:Xe.optional(),tools:Xe.optional()}).optional(),elicitation:ZC.optional(),roots:T({listChanged:Q().optional()}).optional(),tasks:Nc.optional(),extensions:ee(p(),Xe).optional()}),qc=yt.extend({protocolVersion:p(),capabilities:jc,clientInfo:Hn}),Mc=Qe.extend({method:A("initialize"),params:qc}),ji=T({experimental:ee(p(),Xe).optional(),logging:Xe.optional(),completions:Xe.optional(),prompts:T({listChanged:Q().optional()}).optional(),resources:T({subscribe:Q().optional(),listChanged:Q().optional()}).optional(),tools:T({listChanged:Q().optional()}).optional(),tasks:Ac.optional(),extensions:ee(p(),Xe).optional()}),Lc=et.extend({protocolVersion:p(),capabilities:ji,serverInfo:Hn,instructions:p().optional()}),Dc=Tt.extend({method:A("notifications/initialized"),params:Pt.optional()}),Uc=Qe.extend({method:A("server/discover"),params:yt.optional()}),Fc=et.extend({supportedVersions:N(p()),capabilities:ji,instructions:p().optional()}),qi=Qe.extend({method:A("ping"),params:yt.optional()}),Vc=T({progress:J(),total:ae(J()),message:ae(p())}),Zc=T({...Pt.shape,...Vc.shape,progressToken:Pi}),Mi=Tt.extend({method:A("notifications/progress"),params:Zc}),Hc=yt.extend({cursor:Ti.optional()}),lo=Qe.extend({params:Hc.optional()}),po=et.extend({nextCursor:Ti.optional()}),Li=T({uri:p(),mimeType:ae(p()),_meta:ee(p(),ce()).optional()}),Di=Li.extend({text:p()}),Rf=p().refine((e)=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Ui=Li.extend({blob:Rf}),fo=pe(["user","assistant"]),Hr=T({audience:N(fo).optional(),priority:J().min(0).max(1).optional(),lastModified:Dn({offset:!0}).optional()}),Fi=T({...Fr.shape,...uo.shape,uri:p(),description:ae(p()),mimeType:ae(p()),size:ae(J()),annotations:Hr.optional(),_meta:ae(de({}))}),Gc=T({...Fr.shape,...uo.shape,uriTemplate:p(),description:ae(p()),mimeType:ae(p()),annotations:Hr.optional(),_meta:ae(de({}))}),Jc=lo.extend({method:A("resources/list")}),Kc=po.extend({resources:N(Fi)}),Bc=lo.extend({method:A("resources/templates/list")}),Wc=po.extend({resourceTemplates:N(Gc)}),Gn=yt.extend({uri:p()}),Yc=Gn,Xc=Qe.extend({method:A("resources/read"),params:Yc}),Qc=et.extend({contents:N(te([Di,Ui]))}),eu=Tt.extend({method:A("notifications/resources/list_changed"),params:Pt.optional()}),tu=Gn,ru=Qe.extend({method:A("resources/subscribe"),params:tu}),ou=Gn,nu=Qe.extend({method:A("resources/unsubscribe"),params:ou}),Vi=T({toolsListChanged:Q().optional(),promptsListChanged:Q().optional(),resourcesListChanged:Q().optional(),resourceSubscriptions:N(p()).optional()}),su=yt.extend({notifications:Vi}),iu=Qe.extend({method:A("subscriptions/listen"),params:su}),au=Pt.extend({notifications:Vi}),cu=Tt.extend({method:A("notifications/subscriptions/acknowledged"),params:au}),uu=ki.extend({[cn]:co}),lu=et.extend({_meta:uu}),du=Pt.extend({uri:p()}),pu=Tt.extend({method:A("notifications/resources/updated"),params:du}),fu=T({name:p(),description:ae(p()),required:ae(Q())}),mu=T({...Fr.shape,...uo.shape,description:ae(p()),arguments:ae(N(fu)),_meta:ae(de({}))}),hu=lo.extend({method:A("prompts/list")}),gu=po.extend({prompts:N(mu)}),yu=yt.extend({name:p(),arguments:ee(p(),p()).optional()}),_u=Qe.extend({method:A("prompts/get"),params:yu}),Jn=T({type:A("text"),text:p(),annotations:Hr.optional(),_meta:ee(p(),ce()).optional()}),Kn=T({type:A("image"),data:Rf,mimeType:p(),annotations:Hr.optional(),_meta:ee(p(),ce()).optional()}),Bn=T({type:A("audio"),data:Rf,mimeType:p(),annotations:Hr.optional(),_meta:ee(p(),ce()).optional()}),vu=T({type:A("tool_use"),name:p(),id:p(),input:ee(p(),ce()),_meta:ee(p(),ce()).optional()}),Su=T({type:A("resource"),resource:te([Di,Ui]),annotations:Hr.optional(),_meta:ee(p(),ce()).optional()}),bu=Fi.extend({type:A("resource_link")}),Wn=te([Jn,Kn,Bn,bu,Su]),$u=T({role:fo,content:Wn}),wu=et.extend({description:p().optional(),messages:N($u)}),Ru=Tt.extend({method:A("notifications/prompts/list_changed"),params:Pt.optional()}),Eu=T({title:p().optional(),readOnlyHint:Q().optional(),destructiveHint:Q().optional(),idempotentHint:Q().optional(),openWorldHint:Q().optional()}),zu=T({taskSupport:pe(["required","optional","forbidden"]).optional()}),Zi=T({...Fr.shape,...uo.shape,description:p().optional(),inputSchema:T({type:A("object"),properties:ee(p(),io).optional(),required:N(p()).optional()}).catchall(ce()),outputSchema:de({$schema:p().optional()}).optional(),annotations:Eu.optional(),execution:zu.optional(),_meta:ee(p(),ce()).optional()}),Pu=lo.extend({method:A("tools/list")}),Tu=po.extend({tools:N(Zi)}),Hi=et.extend({content:N(Wn).default([]),structuredContent:ce().optional(),isError:Q().optional()}),Ef=Hi.or(et.extend({toolResult:ce()})),Iu=ln.extend({name:p(),arguments:ee(p(),ce()).optional()}),ku=Qe.extend({method:A("tools/call"),params:Iu}),Ou=Tt.extend({method:A("notifications/tools/list_changed"),params:Pt.optional()}),zf=T({autoRefresh:Q().default(!0),debounceMs:J().int().nonnegative().default(300)}),mo=pe(["debug","info","notice","warning","error","critical","alert","emergency"]),Cu=yt.extend({level:mo}),xu=Qe.extend({method:A("logging/setLevel"),params:Cu}),Nu=Pt.extend({level:mo,logger:p().optional(),data:ce()}),Au=Tt.extend({method:A("notifications/message"),params:Nu}),ju=T({name:p().optional()}),qu=T({hints:N(ju).optional(),costPriority:J().min(0).max(1).optional(),speedPriority:J().min(0).max(1).optional(),intelligencePriority:J().min(0).max(1).optional()}),Mu=T({mode:pe(["auto","required","none"]).optional()}),Lu=T({type:A("tool_result"),toolUseId:p().describe("The unique identifier for the corresponding tool call."),content:N(Wn),structuredContent:ce().optional(),isError:Q().optional(),_meta:ee(p(),ce()).optional()}),Du=Un("type",[Jn,Kn,Bn]),sn=Un("type",[Jn,Kn,Bn,vu,Lu]),Uu=T({role:fo,content:te([sn,N(sn)]),_meta:ee(p(),ce()).optional()}),Fu=ln.extend({messages:N(Uu),modelPreferences:qu.optional(),systemPrompt:p().optional(),includeContext:pe(["none","thisServer","allServers"]).optional(),temperature:J().optional(),maxTokens:J().int(),stopSequences:N(p()).optional(),metadata:Xe.optional(),tools:N(Zi).optional(),toolChoice:Mu.optional()}),Vu=Qe.extend({method:A("sampling/createMessage"),params:Fu}),Zu=et.extend({model:p(),stopReason:ae(pe(["endTurn","stopSequence","maxTokens"]).or(p())),role:fo,content:Du}),Hu=et.extend({model:p(),stopReason:ae(pe(["endTurn","stopSequence","maxTokens","toolUse"]).or(p())),role:fo,content:te([sn,N(sn)])}),Gi=T({type:A("boolean"),title:p().optional(),description:p().optional(),default:Q().optional()}),Yn=T({type:A("string"),title:p().optional(),description:p().optional(),minLength:J().optional(),maxLength:J().optional(),format:pe(["email","uri","date","date-time"]).optional(),default:p().optional()}),Xn=T({type:pe(["number","integer"]),title:p().optional(),description:p().optional(),minimum:J().optional(),maximum:J().optional(),default:J().optional()}),Ji=T({type:A("string"),title:p().optional(),description:p().optional(),enum:N(p()),default:p().optional()}),Ki=T({type:A("string"),title:p().optional(),description:p().optional(),oneOf:N(T({const:p(),title:p()})),default:p().optional()}),Bi=T({type:A("string"),title:p().optional(),description:p().optional(),enum:N(p()),enumNames:N(p()).optional(),default:p().optional()}),Gu=te([Ji,Ki]),Wi=T({type:A("array"),title:p().optional(),description:p().optional(),minItems:J().optional(),maxItems:J().optional(),items:T({type:A("string"),enum:N(p())}),default:N(p()).optional()}),Yi=T({type:A("array"),title:p().optional(),description:p().optional(),minItems:J().optional(),maxItems:J().optional(),items:T({anyOf:N(T({const:p(),title:p()}))}),default:N(p()).optional()}),Ju=te([Wi,Yi]),Ku=te([Bi,Gu,Ju]),Xi=te([Ku,Gi,Yn,Xn]),Qn=ln.extend({mode:A("form").optional(),message:p(),requestedSchema:T({type:A("object"),properties:ee(p(),Xi),required:N(p()).optional()}).catchall(ce())}),Bu=ln.extend({mode:A("url"),message:p(),elicitationId:p(),url:p().url()}),Wu=te([Qn,Bu]),Yu=Qe.extend({method:A("elicitation/create"),params:Wu}),Xu=Pt.extend({elicitationId:p()}),Qu=Tt.extend({method:A("notifications/elicitation/complete"),params:Xu}),el=et.extend({action:pe(["accept","decline","cancel"]),content:nn((e)=>e===null?void 0:e,ee(p(),te([p(),J(),Q(),N(p())])).optional())}),tl=T({type:A("ref/resource"),uri:p()}),rl=T({type:A("ref/prompt"),name:p()}),ol=yt.extend({ref:te([rl,tl]),argument:T({name:p(),value:p()}),context:T({arguments:ee(p(),p()).optional()}).optional()}),nl=Qe.extend({method:A("completion/complete"),params:ol}),sl=et.extend({completion:de({values:N(p()).max(100),total:ae(J().int()),hasMore:ae(Q())})}),il=T({uri:p().startsWith("file://"),name:p().optional(),_meta:ee(p(),ce()).optional()}),al=Qe.extend({method:A("roots/list"),params:yt.optional()}),cl=et.extend({roots:N(il)}),ul=Tt.extend({method:A("notifications/roots/list_changed"),params:Pt.optional()}),Pf=de({ttl:J().optional(),pollInterval:J().optional()}),ll=pe(["working","input_required","completed","failed","cancelled"]),ho=T({taskId:p(),status:ll,ttl:te([J(),on()]),createdAt:p(),lastUpdatedAt:p(),pollInterval:ae(J()),statusMessage:ae(p())}),Tf=et.extend({task:ho}),dl=Pt.merge(ho),If=Tt.extend({method:A("notifications/tasks/status"),params:dl}),kf=Qe.extend({method:A("tasks/get"),params:yt.extend({taskId:p()})}),Of=et.merge(ho),Cf=Qe.extend({method:A("tasks/result"),params:yt.extend({taskId:p()})}),xf=et.loose(),Nf=lo.extend({method:A("tasks/list")}),Af=po.extend({tasks:N(ho)}),jf=Qe.extend({method:A("tasks/cancel"),params:yt.extend({taskId:p()})}),qf=et.merge(ho),Mf=te([qi,Mc,Uc,nl,xu,_u,hu,Jc,Bc,Xc,ru,nu,iu,ku,Pu]),Lf=te([Ai,Mi,Dc,ul]),Df=te([Ni,Zu,Hu,el,cl]),Uf=te([qi,Vu,Yu,al]),Ff=te([Ai,Mi,Au,pu,eu,Ou,Ru,cu,Qu]),Vf=te([Ni,Lc,Fc,sl,wu,gu,Kc,Wc,Qc,Hi,Tu,lu]),gt=zc().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:LS.custom,message:"URL must be parseable",fatal:!0}),pp}).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"}),Zf=de({resource:p().url(),authorization_servers:N(gt).optional(),jwks_uri:p().url().optional(),scopes_supported:N(p()).optional(),bearer_methods_supported:N(p()).optional(),resource_signing_alg_values_supported:N(p()).optional(),resource_name:p().optional(),resource_documentation:p().optional(),resource_policy_uri:p().url().optional(),resource_tos_uri:p().url().optional(),tls_client_certificate_bound_access_tokens:Q().optional(),authorization_details_types_supported:N(p()).optional(),dpop_signing_alg_values_supported:N(p()).optional(),dpop_bound_access_tokens_required:Q().optional()}),pl=de({issuer:p(),authorization_endpoint:gt,token_endpoint:gt,registration_endpoint:gt.optional(),scopes_supported:N(p()).optional(),response_types_supported:N(p()),response_modes_supported:N(p()).optional(),grant_types_supported:N(p()).optional(),token_endpoint_auth_methods_supported:N(p()).optional(),token_endpoint_auth_signing_alg_values_supported:N(p()).optional(),service_documentation:gt.optional(),revocation_endpoint:gt.optional(),revocation_endpoint_auth_methods_supported:N(p()).optional(),revocation_endpoint_auth_signing_alg_values_supported:N(p()).optional(),introspection_endpoint:p().optional(),introspection_endpoint_auth_methods_supported:N(p()).optional(),introspection_endpoint_auth_signing_alg_values_supported:N(p()).optional(),code_challenge_methods_supported:N(p()).optional(),client_id_metadata_document_supported:Q().optional(),authorization_response_iss_parameter_supported:Q().optional().catch(void 0)}),fl=de({issuer:p(),authorization_endpoint:gt,token_endpoint:gt,userinfo_endpoint:gt.optional(),jwks_uri:gt,registration_endpoint:gt.optional(),scopes_supported:N(p()).optional(),response_types_supported:N(p()),response_modes_supported:N(p()).optional(),grant_types_supported:N(p()).optional(),acr_values_supported:N(p()).optional(),subject_types_supported:N(p()),id_token_signing_alg_values_supported:N(p()),id_token_encryption_alg_values_supported:N(p()).optional(),id_token_encryption_enc_values_supported:N(p()).optional(),userinfo_signing_alg_values_supported:N(p()).optional(),userinfo_encryption_alg_values_supported:N(p()).optional(),userinfo_encryption_enc_values_supported:N(p()).optional(),request_object_signing_alg_values_supported:N(p()).optional(),request_object_encryption_alg_values_supported:N(p()).optional(),request_object_encryption_enc_values_supported:N(p()).optional(),token_endpoint_auth_methods_supported:N(p()).optional(),token_endpoint_auth_signing_alg_values_supported:N(p()).optional(),display_values_supported:N(p()).optional(),claim_types_supported:N(p()).optional(),claims_supported:N(p()).optional(),service_documentation:p().optional(),claims_locales_supported:N(p()).optional(),ui_locales_supported:N(p()).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:gt.optional(),op_tos_uri:gt.optional(),client_id_metadata_document_supported:Q().optional(),authorization_response_iss_parameter_supported:Q().optional().catch(void 0)}),Hf=T({...fl.shape,...pl.pick({code_challenge_methods_supported:!0}).shape}),Gf=T({access_token:p(),id_token:p().optional(),token_type:p(),expires_in:UC().optional(),scope:p().optional(),refresh_token:p().optional()}).strip(),Jf=T({issued_token_type:A("urn:ietf:params:oauth:token-type:id-jag"),access_token:p(),token_type:p().optional(),expires_in:J().optional(),scope:p().optional()}).strip(),Kf=T({error:p(),error_description:p().optional(),error_uri:p().optional()}),bf=gt.optional().or(A("").transform(()=>{return})),ml=T({redirect_uris:N(gt),token_endpoint_auth_method:p().optional(),grant_types:N(p()).optional(),response_types:N(p()).optional(),application_type:p().optional(),client_name:p().optional(),client_uri:gt.optional(),logo_uri:bf,scope:p().optional(),contacts:N(p()).optional(),tos_uri:bf,policy_uri:p().optional(),jwks_uri:gt.optional(),jwks:CS().optional(),software_id:p().optional(),software_version:p().optional(),software_statement:p().optional()}).strip(),hl=T({client_id:p(),client_secret:p().optional(),client_id_issued_at:J().optional(),client_secret_expires_at:J().optional()}).strip(),Bf=ml.merge(hl),Wf=T({error:p(),error_description:p().optional()}).strip(),Yf=T({token:p(),token_type_hint:p().optional()}).strip();var tm=Symbol.for("mcp.sdk.errorBrands");function sm(e,t){let r=new Set,o=t;while(typeof o==="function"){let n=o.mcpBrand;if(Object.prototype.hasOwnProperty.call(o,"mcpBrand")&&typeof n==="string")r.add(n);o=Object.getPrototypeOf(o)}if(r.size===0)return;Object.defineProperty(e,tm,{value:r,enumerable:!1,configurable:!0})}function ts(e,t){try{if(typeof t==="object"&&t!==null&&Object.prototype.hasOwnProperty.call(e,"mcpBrand")&&typeof e.mcpBrand==="string"&&Object.prototype.hasOwnProperty.call(t,tm)){let r=t[tm];if(r&&typeof r.has==="function"&&r.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}var HC=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](t){return ts(this,t)}static isInstance(t){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return ts(this,t)}constructor(t,r,o){super(r);this.code=t,this.errorUri=o,this.name="OAuthError",sm(this,new.target)}toResponseObject(){let t={error:this.code,error_description:this.message};if(this.errorUri)t.error_uri=this.errorUri;return t}static fromResponse(t){return new e(t.error,t.error_description??t.error,t.error_uri)}},Te=function(e){return e.NotConnected="NOT_CONNECTED",e.AlreadyConnected="ALREADY_CONNECTED",e.NotInitialized="NOT_INITIALIZED",e.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",e.RequestTimeout="REQUEST_TIMEOUT",e.ConnectionClosed="CONNECTION_CLOSED",e.SendFailed="SEND_FAILED",e.InvalidResult="INVALID_RESULT",e.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",e.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",e.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",e.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",e.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",e.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",e.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",e.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",e.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",e.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",e.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",e}({}),Se=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](e){return ts(this,e)}static isInstance(e){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return ts(this,e)}constructor(e,t,r){super(t);this.code=e,this.data=r,this.name="SdkError",sm(this,new.target)}},GC=class extends Se{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor(e,t,r){super(e,t,r);this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};function WS(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function JC(e,t,r){return e==="elicitation"&&t==="form"&&r.form===void 0&&r.url===void 0}function u0(e){switch(e.method){case"elicitation/create":if(e.params?.mode==="url")return{elicitation:{url:{}}};return{elicitation:{form:{}}};case"sampling/createMessage":{let t=e.params;if(t!==void 0&&(t.tools!==void 0||t.toolChoice!==void 0))return{sampling:{tools:{}}};return{sampling:{}}}case"roots/list":return{roots:{}};default:return}}function wl(e,t){let r={};for(let[o,n]of Object.entries(e)){if(n===void 0)continue;let s=t===void 0?void 0:t[o];if(s===void 0){r[o]=n;continue}if(WS(n)&&WS(s)){let i={};for(let[a,c]of Object.entries(n))if(c!==void 0&&s[a]===void 0&&!JC(o,a,s))i[a]=c;if(Object.keys(i).length>0)r[o]=i}}return Object.keys(r).length>0?r:void 0}var l0="2026-07-28",yo=[l0];function os(e){return e>=l0}function d0(e){return e.filter((t)=>!os(t))}function im(e){return e.filter((t)=>os(t))}function p0(e){let t=e.structuredContent;if(t===void 0)return e;if(!(typeof t!=="object"||t===null||Array.isArray(t)))return e;if(e.content?.some((r)=>r.type==="text")??!1)return e;return{...e,content:[...e.content??[],{type:"text",text:JSON.stringify(t)}]}}var f0=["task","inputRequests","requestState"];function am(e){if(e===null||typeof e!=="object"||Array.isArray(e)||e.content!==void 0||f0.some((t)=>(t in e)))return e;return{...e,content:[]}}function KC(){let e=zi(()=>te([p(),J(),Q(),on(),ee(p(),e),N(e)])),t=ee(p(),e),r=te([p(),J().int()]),o=p(),n=T({ttl:J().optional()}),s=T({taskId:p()}),i=de({progressToken:r.optional(),"io.modelcontextprotocol/related-task":s.optional()}),a=T({_meta:i.optional()}),c=a.extend({task:n.optional()}),u=T({method:p(),params:a.loose().optional()}),l=T({_meta:i.optional()}),d=T({method:p(),params:l.loose().optional()}),f=de({_meta:i.optional()}),m=te([p(),J().int()]),h=f.strict(),g=l.extend({requestId:m.optional(),reason:p().optional()}),_=d.extend({method:A("notifications/cancelled"),params:g}),y=T({src:p(),mimeType:p().optional(),sizes:N(p()).optional(),theme:pe(["light","dark"]).optional()}),S=T({icons:N(y).optional()}),v=T({name:p(),title:p().optional()}),w=v.extend({...v.shape,...S.shape,version:p(),websiteUrl:p().optional(),description:p().optional()}),z=Ur(T({applyDefaults:Q().optional()}),t),R=nn((zt)=>{if(zt&&typeof zt==="object"&&!Array.isArray(zt)&&Object.keys(zt).length===0)return{form:{}};return zt},Ur(T({form:z.optional(),url:t.optional()}),t.optional())),b=de({list:t.optional(),cancel:t.optional(),requests:de({sampling:de({createMessage:t.optional()}).optional(),elicitation:de({create:t.optional()}).optional()}).optional()}),E=de({list:t.optional(),cancel:t.optional(),requests:de({tools:de({call:t.optional()}).optional()}).optional()}),C=T({experimental:ee(p(),t).optional(),sampling:T({context:t.optional(),tools:t.optional()}).optional(),elicitation:R.optional(),roots:T({listChanged:Q().optional()}).optional(),tasks:b.optional(),extensions:ee(p(),t).optional()}),q=a.extend({protocolVersion:p(),capabilities:C,clientInfo:w}),x=u.extend({method:A("initialize"),params:q}),F=T({experimental:ee(p(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:T({listChanged:Q().optional()}).optional(),resources:T({subscribe:Q().optional(),listChanged:Q().optional()}).optional(),tools:T({listChanged:Q().optional()}).optional(),tasks:E.optional(),extensions:ee(p(),t).optional()}),B=f.extend({protocolVersion:p(),capabilities:F,serverInfo:w,instructions:p().optional()}),H=d.extend({method:A("notifications/initialized"),params:l.optional()}),ge=u.extend({method:A("ping"),params:a.optional()}),Ie=T({progress:J(),total:ae(J()),message:ae(p())}),Ne=T({...l.shape,...Ie.shape,progressToken:r}),De=d.extend({method:A("notifications/progress"),params:Ne}),Pe=a.extend({cursor:o.optional()}),O=u.extend({params:Pe.optional()}),M=f.extend({nextCursor:o.optional()}),K=T({uri:p(),mimeType:ae(p()),_meta:ee(p(),ce()).optional()}),P=K.extend({text:p()}),k=p().refine((zt)=>{try{return atob(zt),!0}catch{return!1}},{message:"Invalid Base64 string"}),j=K.extend({blob:k}),W=pe(["user","assistant"]),ue=T({audience:N(W).optional(),priority:J().min(0).max(1).optional(),lastModified:Dn({offset:!0}).optional()}),Ee=T({...v.shape,...S.shape,uri:p(),description:ae(p()),mimeType:ae(p()),size:ae(J()),annotations:ue.optional(),_meta:ae(de({}))}),ye=T({...v.shape,...S.shape,uriTemplate:p(),description:ae(p()),mimeType:ae(p()),annotations:ue.optional(),_meta:ae(de({}))}),Ve=O.extend({method:A("resources/list")}),Ct=M.extend({resources:N(Ee)}),I=O.extend({method:A("resources/templates/list")}),L=M.extend({resourceTemplates:N(ye)}),Z=a.extend({uri:p()}),fe=Z,me=u.extend({method:A("resources/read"),params:fe}),we=f.extend({contents:N(te([P,j]))}),it=d.extend({method:A("notifications/resources/list_changed"),params:l.optional()}),pt=Z,Rt=u.extend({method:A("resources/subscribe"),params:pt}),ct=Z,We=u.extend({method:A("resources/unsubscribe"),params:ct}),Xt=l.extend({uri:p()}),ht=d.extend({method:A("notifications/resources/updated"),params:Xt}),Mr=T({name:p(),description:ae(p()),required:ae(Q())}),ur=T({...v.shape,...S.shape,description:ae(p()),arguments:ae(N(Mr)),_meta:ae(de({}))}),Lr=O.extend({method:A("prompts/list")}),Wr=M.extend({prompts:N(ur)}),Yr=a.extend({name:p(),arguments:ee(p(),p()).optional()}),Vo=u.extend({method:A("prompts/get"),params:Yr}),Zo=T({type:A("text"),text:p(),annotations:ue.optional(),_meta:ee(p(),ce()).optional()}),Ho=T({type:A("image"),data:k,mimeType:p(),annotations:ue.optional(),_meta:ee(p(),ce()).optional()}),Go=T({type:A("audio"),data:k,mimeType:p(),annotations:ue.optional(),_meta:ee(p(),ce()).optional()}),Ds=T({type:A("tool_use"),name:p(),id:p(),input:ee(p(),ce()),_meta:ee(p(),ce()).optional()}),Xr=T({type:A("resource"),resource:te([P,j]),annotations:ue.optional(),_meta:ee(p(),ce()).optional()}),Us=Ee.extend({type:A("resource_link")}),Qt=te([Zo,Ho,Go,Us,Xr]),zn=T({role:W,content:Qt}),Pn=f.extend({description:p().optional(),messages:N(zn)}),Jo=d.extend({method:A("notifications/prompts/list_changed"),params:l.optional()}),Fs=T({title:p().optional(),readOnlyHint:Q().optional(),destructiveHint:Q().optional(),idempotentHint:Q().optional(),openWorldHint:Q().optional()}),Tn=T({taskSupport:pe(["required","optional","forbidden"]).optional()}),Ko=T({...v.shape,...S.shape,description:p().optional(),inputSchema:T({type:A("object"),properties:ee(p(),e).optional(),required:N(p()).optional()}).catchall(ce()),outputSchema:T({type:A("object"),properties:ee(p(),e).optional(),required:N(p()).optional()}).catchall(ce()).optional(),annotations:Fs.optional(),execution:Tn.optional(),_meta:ee(p(),ce()).optional()}),In=O.extend({method:A("tools/list")}),kn=M.extend({tools:N(Ko)}),On=f.extend({content:N(Qt),structuredContent:ee(p(),ce()).optional(),isError:Q().optional()}),Et=c.extend({name:p(),arguments:ee(p(),ce()).optional()}),Vs=u.extend({method:A("tools/call"),params:Et}),La=d.extend({method:A("notifications/tools/list_changed"),params:l.optional()}),Cn=pe(["debug","info","notice","warning","error","critical","alert","emergency"]),Zs=a.extend({level:Cn}),Hs=u.extend({method:A("logging/setLevel"),params:Zs}),Gs=l.extend({level:Cn,logger:p().optional(),data:ce()}),Js=d.extend({method:A("notifications/message"),params:Gs}),Ks=T({name:p().optional()}),Bs=T({hints:N(Ks).optional(),costPriority:J().min(0).max(1).optional(),speedPriority:J().min(0).max(1).optional(),intelligencePriority:J().min(0).max(1).optional()}),Ws=T({mode:pe(["auto","required","none"]).optional()}),Da=T({type:A("tool_result"),toolUseId:p().describe("The unique identifier for the corresponding tool call."),content:N(Qt),structuredContent:T({}).loose().optional(),isError:Q().optional(),_meta:ee(p(),ce()).optional()}),Ys=Un("type",[Zo,Ho,Go]),Qr=Un("type",[Zo,Ho,Go,Ds,Da]),Xs=T({role:W,content:te([Qr,N(Qr)]),_meta:ee(p(),ce()).optional()}),Qs=c.extend({messages:N(Xs),modelPreferences:Bs.optional(),systemPrompt:p().optional(),includeContext:pe(["none","thisServer","allServers"]).optional(),temperature:J().optional(),maxTokens:J().int(),stopSequences:N(p()).optional(),metadata:t.optional(),tools:N(Ko).optional(),toolChoice:Ws.optional()}),ei=u.extend({method:A("sampling/createMessage"),params:Qs}),ti=f.extend({model:p(),stopReason:ae(pe(["endTurn","stopSequence","maxTokens"]).or(p())),role:W,content:Ys}),ri=f.extend({model:p(),stopReason:ae(pe(["endTurn","stopSequence","maxTokens","toolUse"]).or(p())),role:W,content:te([Qr,N(Qr)])}),oi=T({type:A("boolean"),title:p().optional(),description:p().optional(),default:Q().optional()}),ni=T({type:A("string"),title:p().optional(),description:p().optional(),minLength:J().optional(),maxLength:J().optional(),format:pe(["email","uri","date","date-time"]).optional(),default:p().optional()}),si=T({type:pe(["number","integer"]),title:p().optional(),description:p().optional(),minimum:J().optional(),maximum:J().optional(),default:J().optional()}),ii=T({type:A("string"),title:p().optional(),description:p().optional(),enum:N(p()),default:p().optional()}),ai=T({type:A("string"),title:p().optional(),description:p().optional(),oneOf:N(T({const:p(),title:p()})),default:p().optional()}),ci=T({type:A("string"),title:p().optional(),description:p().optional(),enum:N(p()),enumNames:N(p()).optional(),default:p().optional()}),ui=te([ii,ai]),Bo=T({type:A("array"),title:p().optional(),description:p().optional(),minItems:J().optional(),maxItems:J().optional(),items:T({type:A("string"),enum:N(p())}),default:N(p()).optional()}),Wo=T({type:A("array"),title:p().optional(),description:p().optional(),minItems:J().optional(),maxItems:J().optional(),items:T({anyOf:N(T({const:p(),title:p()}))}),default:N(p()).optional()}),Ua=te([Bo,Wo]),Fa=te([ci,ui,Ua]),Gt=te([Fa,oi,ni,si]),Jt=c.extend({mode:A("form").optional(),message:p(),requestedSchema:T({type:A("object"),properties:ee(p(),Gt),required:N(p()).optional()}).catchall(ce())}),li=c.extend({mode:A("url"),message:p(),elicitationId:p(),url:p().url()}),lr=te([Jt,li]),Va=u.extend({method:A("elicitation/create"),params:lr}),Za=l.extend({elicitationId:p()}),Ha=d.extend({method:A("notifications/elicitation/complete"),params:Za}),Ga=f.extend({action:pe(["accept","decline","cancel"]),content:nn((zt)=>zt===null?void 0:zt,ee(p(),te([p(),J(),Q(),N(p())])).optional())}),Ja=T({type:A("ref/resource"),uri:p()}),Ka=T({type:A("ref/prompt"),name:p()}),Ba=a.extend({ref:te([Ka,Ja]),argument:T({name:p(),value:p()}),context:T({arguments:ee(p(),p()).optional()}).optional()}),di=u.extend({method:A("completion/complete"),params:Ba}),Wa=f.extend({completion:de({values:N(p()).max(100),total:ae(J().int()),hasMore:ae(Q())})}),Ya=T({uri:p().startsWith("file://"),name:p().optional(),_meta:ee(p(),ce()).optional()}),xn=u.extend({method:A("roots/list"),params:a.optional()}),pi=f.extend({roots:N(Ya)}),Xa=d.extend({method:A("notifications/roots/list_changed"),params:l.optional()}),Qa=de({ttl:J().optional(),pollInterval:J().optional()}),ec=pe(["working","input_required","completed","failed","cancelled"]),eo=T({taskId:p(),status:ec,ttl:te([J(),on()]),createdAt:p(),lastUpdatedAt:p(),pollInterval:ae(J()),statusMessage:ae(p())}),jt=f.extend({task:eo}),tc=l.merge(eo),Yo=d.extend({method:A("notifications/tasks/status"),params:tc}),Nn=u.extend({method:A("tasks/get"),params:a.extend({taskId:p()})}),An=f.merge(eo),jn=u.extend({method:A("tasks/result"),params:a.extend({taskId:p()})}),lp=f.loose(),qt=O.extend({method:A("tasks/list")}),at=M.extend({tasks:N(eo)}),Xo=u.extend({method:A("tasks/cancel"),params:a.extend({taskId:p()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:r,CursorSchema:o,TaskMetadataSchema:n,RelatedTaskMetadataSchema:s,RequestMetaSchema:i,BaseRequestParamsSchema:a,TaskAugmentedRequestParamsSchema:c,RequestSchema:u,NotificationsParamsSchema:l,NotificationSchema:d,ResultSchema:f,RequestIdSchema:m,EmptyResultSchema:h,CancelledNotificationParamsSchema:g,CancelledNotificationSchema:_,IconSchema:y,IconsSchema:S,BaseMetadataSchema:v,ImplementationSchema:w,ClientTasksCapabilitySchema:b,ServerTasksCapabilitySchema:E,ClientCapabilitiesSchema:C,InitializeRequestParamsSchema:q,InitializeRequestSchema:x,ServerCapabilitiesSchema:F,InitializeResultSchema:B,InitializedNotificationSchema:H,PingRequestSchema:ge,ProgressSchema:Ie,ProgressNotificationParamsSchema:Ne,ProgressNotificationSchema:De,PaginatedRequestParamsSchema:Pe,PaginatedRequestSchema:O,PaginatedResultSchema:M,ResourceContentsSchema:K,TextResourceContentsSchema:P,BlobResourceContentsSchema:j,RoleSchema:W,AnnotationsSchema:ue,ResourceSchema:Ee,ResourceTemplateSchema:ye,ListResourcesRequestSchema:Ve,ListResourcesResultSchema:Ct,ListResourceTemplatesRequestSchema:I,ListResourceTemplatesResultSchema:L,ResourceRequestParamsSchema:Z,ReadResourceRequestParamsSchema:fe,ReadResourceRequestSchema:me,ReadResourceResultSchema:we,ResourceListChangedNotificationSchema:it,SubscribeRequestParamsSchema:pt,SubscribeRequestSchema:Rt,UnsubscribeRequestParamsSchema:ct,UnsubscribeRequestSchema:We,ResourceUpdatedNotificationParamsSchema:Xt,ResourceUpdatedNotificationSchema:ht,PromptArgumentSchema:Mr,PromptSchema:ur,ListPromptsRequestSchema:Lr,ListPromptsResultSchema:Wr,GetPromptRequestParamsSchema:Yr,GetPromptRequestSchema:Vo,TextContentSchema:Zo,ImageContentSchema:Ho,AudioContentSchema:Go,ToolUseContentSchema:Ds,EmbeddedResourceSchema:Xr,ResourceLinkSchema:Us,ContentBlockSchema:Qt,PromptMessageSchema:zn,GetPromptResultSchema:Pn,PromptListChangedNotificationSchema:Jo,ToolAnnotationsSchema:Fs,ToolExecutionSchema:Tn,ToolSchema:Ko,ListToolsRequestSchema:In,ListToolsResultSchema:kn,CallToolResultSchema:On,CallToolRequestParamsSchema:Et,CallToolRequestSchema:Vs,ToolListChangedNotificationSchema:La,LoggingLevelSchema:Cn,SetLevelRequestParamsSchema:Zs,SetLevelRequestSchema:Hs,LoggingMessageNotificationParamsSchema:Gs,LoggingMessageNotificationSchema:Js,ModelHintSchema:Ks,ModelPreferencesSchema:Bs,ToolChoiceSchema:Ws,ToolResultContentSchema:Da,SamplingContentSchema:Ys,SamplingMessageContentBlockSchema:Qr,SamplingMessageSchema:Xs,CreateMessageRequestParamsSchema:Qs,CreateMessageRequestSchema:ei,CreateMessageResultSchema:ti,CreateMessageResultWithToolsSchema:ri,BooleanSchemaSchema:oi,StringSchemaSchema:ni,NumberSchemaSchema:si,UntitledSingleSelectEnumSchemaSchema:ii,TitledSingleSelectEnumSchemaSchema:ai,LegacyTitledEnumSchemaSchema:ci,SingleSelectEnumSchemaSchema:ui,UntitledMultiSelectEnumSchemaSchema:Bo,TitledMultiSelectEnumSchemaSchema:Wo,MultiSelectEnumSchemaSchema:Ua,EnumSchemaSchema:Fa,PrimitiveSchemaDefinitionSchema:Gt,ElicitRequestFormParamsSchema:Jt,ElicitRequestURLParamsSchema:li,ElicitRequestParamsSchema:lr,ElicitRequestSchema:Va,ElicitationCompleteNotificationParamsSchema:Za,ElicitationCompleteNotificationSchema:Ha,ElicitResultSchema:Ga,ResourceTemplateReferenceSchema:Ja,PromptReferenceSchema:Ka,CompleteRequestParamsSchema:Ba,CompleteRequestSchema:di,CompleteResultSchema:Wa,RootSchema:Ya,ListRootsRequestSchema:xn,ListRootsResultSchema:pi,RootsListChangedNotificationSchema:Xa,TaskCreationParamsSchema:Qa,TaskStatusSchema:ec,TaskSchema:eo,CreateTaskResultSchema:jt,TaskStatusNotificationParamsSchema:tc,TaskStatusNotificationSchema:Yo,GetTaskRequestSchema:Nn,GetTaskResultSchema:An,GetTaskPayloadRequestSchema:jn,GetTaskPayloadResultSchema:lp,ListTasksRequestSchema:qt,ListTasksResultSchema:at,CancelTaskRequestSchema:Xo,CancelTaskResultSchema:f.merge(eo),ClientRequestSchema:te([ge,x,di,Hs,Vo,Lr,Ve,I,me,Rt,We,Vs,In,Nn,jn,qt,Xo]),ClientNotificationSchema:te([_,De,H,Xa,Yo]),ClientResultSchema:te([h,ti,ri,Ga,pi,An,at,jt]),ServerRequestSchema:te([ge,ei,Va,xn,Nn,jn,qt,Xo]),ServerNotificationSchema:te([_,De,Js,ht,it,La,Jo,Yo,Ha]),ServerResultSchema:te([h,B,Wa,Pn,Wr,Ct,L,we,On,kn,An,at,jt]),CallToolResultWireSchema:ce().superRefine((zt,sO)=>{if(typeof zt!=="object"||zt===null||Array.isArray(zt)||zt.content!==void 0)return;for(let Zg of f0)if(Zg in zt){sO.addIssue({code:"custom",message:`content is required when the body carries '${Zg}' — another result family cannot default into an empty tools/call success`});return}}).transform(am).pipe(On)}}var BC;function m0(){return BC??=KC()}function h0(e){return e.type!=="object"}var WC=new Set(["const","enum","default","examples"]),YC=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function YS(e){return e!==void 0&&!(typeof e==="string"&&e.startsWith("#"))}function XC(e){let t=typeof e.$schema==="string"?e.$schema:void 0;if(YS(e.$id))return{...t!==void 0&&{$schema:t},type:"object",properties:{result:e},required:["result"]};let r=Bg(e.$schema)&&e.$recursiveAnchor!==!0,o=(n,s)=>{if(Array.isArray(n))return n.map((c)=>o(c,!1));if(n===null||typeof n!=="object")return n;if(!s&&YS(n.$id))return n;let i={},a=!1;for(let[c,u]of Object.entries(n))if(s)i[c]=o(u,!1);else if((c==="$ref"||c==="$dynamicRef")&&typeof u==="string")i[c]=u==="#"?"#/properties/result":u.startsWith("#/")?`#/properties/result${u.slice(1)}`:u;else if(c==="$recursiveRef"&&u==="#"&&r)a=!0;else if(WC.has(c))i[c]=u;else if(YC.has(c))i[c]=o(u,!0);else i[c]=o(u,!1);if(a)if("$ref"in i)i.allOf=[...Array.isArray(i.allOf)?i.allOf:[],{$ref:"#/properties/result"}];else i.$ref="#/properties/result";return i};return{...t!==void 0&&{$schema:t},type:"object",properties:{result:o(e,!1)},required:["result"]}}var g0={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},y0={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},QC={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},gl;function cm(){if(gl)return gl;let e=m0();return gl={requestSchemas:{ping:e.PingRequestSchema,initialize:e.InitializeRequestSchema,"completion/complete":e.CompleteRequestSchema,"logging/setLevel":e.SetLevelRequestSchema,"prompts/get":e.GetPromptRequestSchema,"prompts/list":e.ListPromptsRequestSchema,"resources/list":e.ListResourcesRequestSchema,"resources/templates/list":e.ListResourceTemplatesRequestSchema,"resources/read":e.ReadResourceRequestSchema,"resources/subscribe":e.SubscribeRequestSchema,"resources/unsubscribe":e.UnsubscribeRequestSchema,"tools/call":e.CallToolRequestSchema,"tools/list":e.ListToolsRequestSchema,"tasks/get":e.GetTaskRequestSchema,"tasks/result":e.GetTaskPayloadRequestSchema,"tasks/list":e.ListTasksRequestSchema,"tasks/cancel":e.CancelTaskRequestSchema,"sampling/createMessage":e.CreateMessageRequestSchema,"elicitation/create":e.ElicitRequestSchema,"roots/list":e.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":e.CancelledNotificationSchema,"notifications/progress":e.ProgressNotificationSchema,"notifications/initialized":e.InitializedNotificationSchema,"notifications/roots/list_changed":e.RootsListChangedNotificationSchema,"notifications/tasks/status":e.TaskStatusNotificationSchema,"notifications/message":e.LoggingMessageNotificationSchema,"notifications/resources/updated":e.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":e.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":e.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":e.PromptListChangedNotificationSchema,"notifications/elicitation/complete":e.ElicitationCompleteNotificationSchema},resultSchemas:{ping:e.EmptyResultSchema,initialize:e.InitializeResultSchema,"completion/complete":e.CompleteResultSchema,"logging/setLevel":e.EmptyResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"resources/subscribe":e.EmptyResultSchema,"resources/unsubscribe":e.EmptyResultSchema,"tools/call":e.CallToolResultWireSchema,"tools/list":e.ListToolsResultSchema,"sampling/createMessage":e.CreateMessageResultWithToolsSchema,"elicitation/create":e.ElicitResultSchema,"roots/list":e.ListRootsResultSchema}},gl}function _0(e){return Object.prototype.hasOwnProperty.call(g0,e)}function v0(e){return Object.prototype.hasOwnProperty.call(y0,e)}function ex(e){return Object.prototype.hasOwnProperty.call(QC,e)}function tx(e){return ex(e)?cm().resultSchemas[e]:void 0}function rx(e){return _0(e)?cm().requestSchemas[e]:void 0}function ox(e){return v0(e)?cm().notificationSchemas[e]:void 0}var WJ=Object.keys(g0),YJ=Object.keys(y0);function rm(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function yl(e,t){if(e===void 0)return{ok:!1,reason:"not-in-era"};let r=e.safeParse(t);return r.success?{ok:!0,value:r.data}:{ok:!1,reason:"invalid",message:String(r.error)}}var XS={ok:!1,reason:"not-in-era"};function QS(e){return rm(e)&&rm(e.outputSchema)&&h0(e.outputSchema)}function e0(e){return e}var um={era:"2025-11-25",hasRequestMethod:_0,hasNotificationMethod:v0,validateRequest:(e,t)=>yl(rx(e),t),validateResult:(e,t)=>yl(tx(e),t),validateNotification:(e,t)=>yl(ox(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>XS,validateInputResponse:()=>XS,samplingResultVariant:(e,t)=>{let r=m0();return yl(e?r.CreateMessageResultWithToolsSchema:r.CreateMessageResultSchema,t)},outboundEnvelope:(e)=>{return},validateEnvelopeMeta:(e)=>[],projectCallToolResult(e,t){let r=p0(e),o=r.structuredContent;if(o===void 0)return r;let n=typeof o!=="object"||o===null||Array.isArray(o),s=t!==void 0&&h0(t);if(!n&&!s)return r;return{...r,structuredContent:{result:o}}},decodeResult(e,t){if(rm(t)&&"resultType"in t){let r={...t};return delete r.resultType,{kind:"complete",result:e0(r)}}return{kind:"complete",result:e0(t)}},encodeResult(e,t){if(e!=="tools/list")return t;let r=t.tools;if(!Array.isArray(r)||!r.some((o)=>QS(o)))return t;return{...t,tools:r.map((o)=>QS(o)?{...o,outputSchema:XC(o.outputSchema)}:o)}},encodeErrorCode:(e)=>e===-32002?-32602:e,checkInboundEnvelope:(e)=>{return}};function nx(){let e=zi(()=>te([p(),J(),Q(),on(),ee(p(),e),N(e)])),t=ee(p(),e),r=te([p(),J().int()]),o=p(),n=te([p(),J().int()]),s=pe(["user","assistant"]),i=pe(["debug","info","notice","warning","error","critical","alert","emergency"]),a=p().refine((at)=>{try{return atob(at),!0}catch{return!1}},{message:"Invalid Base64 string"}),c=T({ttl:J().optional()}),u=T({taskId:p()}),l=de({progressToken:r.optional(),"io.modelcontextprotocol/related-task":u.optional()}),d=T({_meta:l.optional()}),f=d.extend({task:c.optional()}),m=T({_meta:l.optional()}),h=T({method:p(),params:m.loose().optional()}),g=T({src:p(),mimeType:p().optional(),sizes:N(p()).optional(),theme:pe(["light","dark"]).optional()}),_=T({icons:N(g).optional()}),y=T({name:p(),title:p().optional()}),S=y.extend({...y.shape,..._.shape,version:p(),websiteUrl:p().optional(),description:p().optional()}),v=Ur(T({applyDefaults:Q().optional()}),t),w=nn((at)=>{if(at&&typeof at==="object"&&!Array.isArray(at)&&Object.keys(at).length===0)return{form:{}};return at},Ur(T({form:v.optional(),url:t.optional()}),t.optional())),z=de({list:t.optional(),cancel:t.optional(),requests:de({sampling:de({createMessage:t.optional()}).optional(),elicitation:de({create:t.optional()}).optional()}).optional()}),R=de({list:t.optional(),cancel:t.optional(),requests:de({tools:de({call:t.optional()}).optional()}).optional()}),b=T({experimental:ee(p(),t).optional(),sampling:T({context:t.optional(),tools:t.optional()}).optional(),elicitation:w.optional(),roots:T({listChanged:Q().optional()}).optional(),tasks:z.optional(),extensions:ee(p(),t).optional()}),E=T({experimental:ee(p(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:T({listChanged:Q().optional()}).optional(),resources:T({subscribe:Q().optional(),listChanged:Q().optional()}).optional(),tools:T({listChanged:Q().optional()}).optional(),tasks:R.optional(),extensions:ee(p(),t).optional()}),C=T({progress:J(),total:ae(J()),message:ae(p())}),q=T({...m.shape,...C.shape,progressToken:r}),x=h.extend({method:A("notifications/progress"),params:q}),F=m.extend({level:i,logger:p().optional(),data:ce()}),B=h.extend({method:A("notifications/message"),params:F}),H=T({uri:p(),mimeType:ae(p()),_meta:ee(p(),ce()).optional()}),ge=H.extend({text:p()}),Ie=H.extend({blob:a}),Ne=T({audience:N(s).optional(),priority:J().min(0).max(1).optional(),lastModified:Dn({offset:!0}).optional()}),De=T({...y.shape,..._.shape,uri:p(),description:ae(p()),mimeType:ae(p()),size:ae(J()),annotations:Ne.optional(),_meta:ae(de({}))}),Pe=T({...y.shape,..._.shape,uriTemplate:p(),description:ae(p()),mimeType:ae(p()),annotations:Ne.optional(),_meta:ae(de({}))}),O=h.extend({method:A("notifications/resources/list_changed"),params:m.optional()}),M=m.extend({uri:p()}),K=h.extend({method:A("notifications/resources/updated"),params:M}),P=T({name:p(),description:ae(p()),required:ae(Q())}),k=T({...y.shape,..._.shape,description:ae(p()),arguments:ae(N(P)),_meta:ae(de({}))}),j=h.extend({method:A("notifications/prompts/list_changed"),params:m.optional()}),W=T({type:A("text"),text:p(),annotations:Ne.optional(),_meta:ee(p(),ce()).optional()}),ue=T({type:A("image"),data:a,mimeType:p(),annotations:Ne.optional(),_meta:ee(p(),ce()).optional()}),Ee=T({type:A("audio"),data:a,mimeType:p(),annotations:Ne.optional(),_meta:ee(p(),ce()).optional()}),ye=T({type:A("tool_use"),name:p(),id:p(),input:ee(p(),ce()),_meta:ee(p(),ce()).optional()}),Ve=T({type:A("resource"),resource:te([ge,Ie]),annotations:Ne.optional(),_meta:ee(p(),ce()).optional()}),Ct=De.extend({type:A("resource_link")}),I=te([W,ue,Ee,Ct,Ve]),L=T({role:s,content:I}),Z=T({title:p().optional(),readOnlyHint:Q().optional(),destructiveHint:Q().optional(),idempotentHint:Q().optional(),openWorldHint:Q().optional()}),fe=h.extend({method:A("notifications/tools/list_changed"),params:m.optional()}),me=T({name:p().optional()}),we=T({hints:N(me).optional(),costPriority:J().min(0).max(1).optional(),speedPriority:J().min(0).max(1).optional(),intelligencePriority:J().min(0).max(1).optional()}),it=T({mode:pe(["auto","required","none"]).optional()}),pt=T({type:A("boolean"),title:p().optional(),description:p().optional(),default:Q().optional()}),Rt=T({type:A("string"),title:p().optional(),description:p().optional(),minLength:J().optional(),maxLength:J().optional(),format:pe(["email","uri","date","date-time"]).optional(),default:p().optional()}),ct=T({type:pe(["number","integer"]),title:p().optional(),description:p().optional(),minimum:J().optional(),maximum:J().optional(),default:J().optional()}),We=T({type:A("string"),title:p().optional(),description:p().optional(),enum:N(p()),default:p().optional()}),Xt=T({type:A("string"),title:p().optional(),description:p().optional(),oneOf:N(T({const:p(),title:p()})),default:p().optional()}),ht=T({type:A("string"),title:p().optional(),description:p().optional(),enum:N(p()),enumNames:N(p()).optional(),default:p().optional()}),Mr=te([We,Xt]),ur=T({type:A("array"),title:p().optional(),description:p().optional(),minItems:J().optional(),maxItems:J().optional(),items:T({type:A("string"),enum:N(p())}),default:N(p()).optional()}),Lr=T({type:A("array"),title:p().optional(),description:p().optional(),minItems:J().optional(),maxItems:J().optional(),items:T({anyOf:N(T({const:p(),title:p()}))}),default:N(p()).optional()}),Wr=te([ur,Lr]),Yr=te([ht,Mr,Wr]),Vo=te([Yr,pt,Rt,ct]),Zo=f.extend({mode:A("form").optional(),message:p(),requestedSchema:T({type:A("object"),properties:ee(p(),Vo),required:N(p()).optional()}).catchall(ce())}),Ho=T({type:A("ref/resource"),uri:p()}),Go=T({type:A("ref/prompt"),name:p()}),Ds=T({uri:p().startsWith("file://"),name:p().optional(),_meta:ee(p(),ce()).optional()}),Xr=b.shape,Us=T({experimental:Xr.experimental,sampling:Xr.sampling,elicitation:Xr.elicitation,roots:Xr.roots,extensions:Xr.extensions}),Qt=E.shape,zn=T({experimental:Qt.experimental,logging:Qt.logging,completions:Qt.completions,prompts:Qt.prompts,resources:Qt.resources,tools:Qt.tools,extensions:Qt.extensions}),Pn=de({progressToken:r.optional(),[Vr]:p(),[Fn]:S.optional(),[Zr]:Us,[ao]:i.optional()}),Jo=T({...y.shape,..._.shape,description:p().optional(),inputSchema:de({$schema:p().optional(),type:A("object")}),outputSchema:de({$schema:p().optional()}).optional(),annotations:Z.optional(),_meta:ee(p(),ce()).optional()}),Fs=T({type:A("tool_result"),toolUseId:p(),content:N(I),structuredContent:ce().optional(),isError:Q().optional(),_meta:ee(p(),ce()).optional()}),Tn=te([W,ue,Ee,ye,Fs]),Ko=T({role:s,content:te([Tn,N(Tn)]),_meta:ee(p(),ce()).optional()}),In=p(),kn=de({[br]:S.optional().catch(void 0)}),On=kn.optional();function Et(at){return de({_meta:On,resultType:In.default("complete"),...at})}let Vs=Et({}),La=Et({nextCursor:o.optional()}),Cn=Et({content:N(I),structuredContent:ce().optional(),isError:Q().optional()}),Zs=Et({ttlMs:J().int().min(0),cacheScope:pe(["public","private"]),tools:N(Jo),nextCursor:o.optional()}),Hs=Et({ttlMs:J().int().min(0),cacheScope:pe(["public","private"]),prompts:N(k),nextCursor:o.optional()}),Gs=Et({description:p().optional(),messages:N(L)}),Js=Et({ttlMs:J().int().min(0),cacheScope:pe(["public","private"]),resources:N(De),nextCursor:o.optional()}),Ks=Et({ttlMs:J().int().min(0),cacheScope:pe(["public","private"]),resourceTemplates:N(Pe),nextCursor:o.optional()}),Bs=Et({ttlMs:J().int().min(0),cacheScope:pe(["public","private"]),contents:N(te([ge,Ie]))}),Ws=Et({completion:T({values:N(p()).max(100),total:J().int().optional(),hasMore:Q().optional()}).loose()}),Da=Et({ttlMs:J().int().min(0),cacheScope:pe(["public","private"])}),Ys=Et({ttlMs:J().int().min(0).catch(0),cacheScope:pe(["public","private"]).catch("private"),supportedVersions:N(p()),capabilities:zn,instructions:p().optional()}),Qr=T({messages:N(Ko),modelPreferences:we.optional(),systemPrompt:p().optional(),includeContext:pe(["none","thisServer","allServers"]).optional(),temperature:J().optional(),maxTokens:J().int(),stopSequences:N(p()).optional(),metadata:t.optional(),tools:N(Jo).optional(),toolChoice:it.optional()}),Xs=T({method:A("sampling/createMessage"),params:Qr}),Qs=T({method:A("roots/list"),params:T({_meta:ee(p(),ce()).optional()}).optional()}),ei=T({...Ko.shape,model:p(),stopReason:p().optional()}),ti=T({roots:N(Ds)}),ri=T({action:pe(["accept","decline","cancel"]),content:ee(p(),te([p(),J(),Q(),N(p())])).optional()}),oi=T({mode:A("url"),message:p(),url:p().url()}),ni=te([Zo,oi]),si=T({method:A("elicitation/create"),params:ni}),ii=te([Xs,Qs,si]),ai=te([ei,ti,ri]),ci=ee(p(),ii),ui=ee(p(),ai),Bo=Et({inputRequests:ci.optional(),requestState:p().optional()}),Wo={inputResponses:ui.optional(),requestState:p().optional()},Ua=T({_meta:Pn,...Wo}),Fa=de({progressToken:r.optional()});function Gt(at,Xo){return T({method:A(at),params:T({_meta:Pn,...Xo})})}function Jt(at,Xo){return T({method:A(at),params:T({_meta:Fa.optional(),...Xo}).optional()})}let li={name:p(),arguments:ee(p(),ce()).optional(),...Wo},lr={cursor:o.optional()},Va=Gt("tools/call",li),Za=Gt("tools/list",lr),Ha=Gt("prompts/list",lr),Ga=Gt("prompts/get",{name:p(),arguments:ee(p(),p()).optional(),...Wo}),Ja=Gt("resources/list",lr),Ka=Gt("resources/templates/list",lr),Ba=Gt("resources/read",{uri:p(),...Wo}),di={ref:te([Go,Ho]),argument:T({name:p(),value:p()}),context:T({arguments:ee(p(),p()).optional()}).optional()},Wa=Gt("completion/complete",di),Ya=Gt("server/discover",{}),xn=T({toolsListChanged:Q().optional(),promptsListChanged:Q().optional(),resourcesListChanged:Q().optional(),resourceSubscriptions:N(p()).optional()}),pi={notifications:xn},Xa=Gt("subscriptions/listen",pi),Qa=kn.extend({"io.modelcontextprotocol/subscriptionId":n}),ec=de({_meta:Qa,resultType:In.default("complete")}),eo={"tools/call":Jt("tools/call",li),"tools/list":Jt("tools/list",lr),"prompts/get":Jt("prompts/get",{name:p(),arguments:ee(p(),p()).optional()}),"prompts/list":Jt("prompts/list",lr),"resources/list":Jt("resources/list",lr),"resources/templates/list":Jt("resources/templates/list",lr),"resources/read":Jt("resources/read",{uri:p()}),"completion/complete":Jt("completion/complete",di),"server/discover":Jt("server/discover",{}),"subscriptions/listen":Jt("subscriptions/listen",pi)};function jt(at){return de({_meta:On,...at})}let tc={"tools/call":jt({content:N(I),structuredContent:ce().optional(),isError:Q().optional()}),"tools/list":jt({ttlMs:J().int().min(0),cacheScope:pe(["public","private"]),tools:N(Jo),nextCursor:o.optional()}),"prompts/get":jt({description:p().optional(),messages:N(L)}),"prompts/list":jt({ttlMs:J().int().min(0),cacheScope:pe(["public","private"]),prompts:N(k),nextCursor:o.optional()}),"resources/list":jt({ttlMs:J().int().min(0),cacheScope:pe(["public","private"]),resources:N(De),nextCursor:o.optional()}),"resources/templates/list":jt({ttlMs:J().int().min(0),cacheScope:pe(["public","private"]),resourceTemplates:N(Pe),nextCursor:o.optional()}),"resources/read":jt({ttlMs:J().int().min(0),cacheScope:pe(["public","private"]),contents:N(te([ge,Ie]))}),"completion/complete":jt({completion:T({values:N(p()).max(100),total:J().int().optional(),hasMore:Q().optional()}).loose()}),"server/discover":jt({ttlMs:J().int().min(0).catch(0),cacheScope:pe(["public","private"]).catch("private"),supportedVersions:N(p()),capabilities:zn,instructions:p().optional()}),"subscriptions/listen":jt({})},Yo=de({"io.modelcontextprotocol/subscriptionId":n.optional()}),Nn=T({method:A("notifications/subscriptions/acknowledged"),params:T({_meta:Yo.optional(),notifications:xn})}),An=T({_meta:Yo.optional(),requestId:n,reason:p().optional()}),jn=T({method:A("notifications/cancelled"),params:An}),lp={"notifications/cancelled":jn,"notifications/progress":x,"notifications/message":B,"notifications/resources/updated":K,"notifications/resources/list_changed":O,"notifications/tools/list_changed":fe,"notifications/prompts/list_changed":j,"notifications/subscriptions/acknowledged":Nn},qt=(at)=>T({jsonrpc:A("2.0"),id:te([p(),J().int()]),result:at}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:r,CursorSchema:o,RequestIdSchema:n,RoleSchema:s,LoggingLevelSchema:i,TaskMetadataSchema:c,RelatedTaskMetadataSchema:u,RequestMetaSchema:l,BaseRequestParamsSchema:d,TaskAugmentedRequestParamsSchema:f,NotificationsParamsSchema:m,NotificationSchema:h,IconSchema:g,IconsSchema:_,BaseMetadataSchema:y,ImplementationSchema:S,ClientTasksCapabilitySchema:z,ServerTasksCapabilitySchema:R,ClientCapabilitiesSchema:b,ServerCapabilitiesSchema:E,ProgressSchema:C,ProgressNotificationParamsSchema:q,ProgressNotificationSchema:x,LoggingMessageNotificationParamsSchema:F,LoggingMessageNotificationSchema:B,ResourceContentsSchema:H,TextResourceContentsSchema:ge,BlobResourceContentsSchema:Ie,AnnotationsSchema:Ne,ResourceSchema:De,ResourceTemplateSchema:Pe,ResourceListChangedNotificationSchema:O,ResourceUpdatedNotificationParamsSchema:M,ResourceUpdatedNotificationSchema:K,PromptArgumentSchema:P,PromptSchema:k,PromptListChangedNotificationSchema:j,TextContentSchema:W,ImageContentSchema:ue,AudioContentSchema:Ee,ToolUseContentSchema:ye,EmbeddedResourceSchema:Ve,ResourceLinkSchema:Ct,ContentBlockSchema:I,PromptMessageSchema:L,ToolAnnotationsSchema:Z,ToolListChangedNotificationSchema:fe,ModelHintSchema:me,ModelPreferencesSchema:we,ToolChoiceSchema:it,BooleanSchemaSchema:pt,StringSchemaSchema:Rt,NumberSchemaSchema:ct,UntitledSingleSelectEnumSchemaSchema:We,TitledSingleSelectEnumSchemaSchema:Xt,LegacyTitledEnumSchemaSchema:ht,SingleSelectEnumSchemaSchema:Mr,UntitledMultiSelectEnumSchemaSchema:ur,TitledMultiSelectEnumSchemaSchema:Lr,MultiSelectEnumSchemaSchema:Wr,EnumSchemaSchema:Yr,PrimitiveSchemaDefinitionSchema:Vo,ElicitRequestFormParamsSchema:Zo,ResourceTemplateReferenceSchema:Ho,PromptReferenceSchema:Go,RootSchema:Ds,ClientCapabilities2026Schema:Us,ServerCapabilities2026Schema:zn,RequestMetaEnvelopeSchema:Pn,ToolSchema:Jo,ToolResultContentSchema:Fs,SamplingMessageContentBlockSchema:Tn,SamplingMessageSchema:Ko,ResultTypeSchema:In,ResultMetaSchema:kn,ResultSchema:Vs,PaginatedResultSchema:La,CallToolResultSchema:Cn,ListToolsResultSchema:Zs,ListPromptsResultSchema:Hs,GetPromptResultSchema:Gs,ListResourcesResultSchema:Js,ListResourceTemplatesResultSchema:Ks,ReadResourceResultSchema:Bs,CompleteResultSchema:Ws,CacheableResultSchema:Da,DiscoverResultSchema:Ys,CreateMessageRequestParamsSchema:Qr,CreateMessageRequestSchema:Xs,ListRootsRequestSchema:Qs,CreateMessageResultSchema:ei,ListRootsResultSchema:ti,ElicitResultSchema:ri,ElicitRequestURLParamsSchema:oi,ElicitRequestParamsSchema:ni,ElicitRequestSchema:si,InputRequestSchema:ii,InputResponseSchema:ai,InputRequestsSchema:ci,InputResponsesSchema:ui,InputRequiredResultSchema:Bo,InputResponseRequestParamsSchema:Ua,CallToolRequestSchema:Va,ListToolsRequestSchema:Za,ListPromptsRequestSchema:Ha,GetPromptRequestSchema:Ga,ListResourcesRequestSchema:Ja,ListResourceTemplatesRequestSchema:Ka,ReadResourceRequestSchema:Ba,CompleteRequestSchema:Wa,DiscoverRequestSchema:Ya,SubscriptionFilterSchema:xn,SubscriptionsListenRequestSchema:Xa,SubscriptionsListenResultMetaSchema:Qa,SubscriptionsListenResultSchema:ec,dispatchRequestSchemas:eo,dispatchResultSchemas:tc,NotificationMetaSchema:Yo,SubscriptionsAcknowledgedNotificationSchema:Nn,CancelledNotificationParamsSchema:An,CancelledNotificationSchema:jn,notificationSchemas2026:lp,JSONRPCResultResponseSchema:qt(Vs),CallToolResultResponseSchema:qt(te([Cn,Bo])),ListToolsResultResponseSchema:qt(Zs),ListPromptsResultResponseSchema:qt(Hs),GetPromptResultResponseSchema:qt(te([Gs,Bo])),ListResourcesResultResponseSchema:qt(Js),ListResourceTemplatesResultResponseSchema:qt(Ks),ReadResourceResultResponseSchema:qt(te([Bs,Bo])),CompleteResultResponseSchema:qt(Ws),DiscoverResultResponseSchema:qt(Ys)}}var sx;function pn(){return sx??=nx()}var ix=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"];function ax(e){return ix.includes(e)}var es=Symbol("modelcontextprotocol.resultCacheHintFallback");function Rl(e,t){if(t===void 0)return e;let r=e[es];if(r===void 0)return{...e,[es]:t};let o={},n=r.ttlMs??t.ttlMs;if(n!==void 0)o.ttlMs=n;let s=r.cacheScope??t.cacheScope;if(s!==void 0)o.cacheScope=s;return{...e,[es]:o}}function cx(e){return e[es]}function lm(e){return typeof e==="number"&&Number.isSafeInteger(e)&&e>=0}function dm(e){return e==="public"||e==="private"}function pm(e,t){if(e.ttlMs!==void 0&&!lm(e.ttlMs))throw RangeError(`Invalid cache hint for ${t}: ttlMs must be a non-negative safe integer (got ${String(e.ttlMs)})`);if(e.cacheScope!==void 0&&!dm(e.cacheScope))throw RangeError(`Invalid cache hint for ${t}: cacheScope must be 'public' or 'private' (got ${String(e.cacheScope)})`)}var Y=function(e){return 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.ResourceNotFound=-32002]="ResourceNotFound",e[e.MissingRequiredClientCapability=-32021]="MissingRequiredClientCapability",e[e.UnsupportedProtocolVersion=-32022]="UnsupportedProtocolVersion",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired",e}({}),le=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](t){return ts(this,t)}static isInstance(t){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return ts(this,t)}constructor(t,r,o){super(r);this.code=t,this.data=o,this.name="ProtocolError",sm(this,new.target)}static fromError(t,r,o){if(t===Y.UrlElicitationRequired&&o){let n=o;if(n.elicitations)return new S0(n.elicitations,r)}if(t===Y.UnsupportedProtocolVersion&&o){let n=o;if(Array.isArray(n.supported)&&typeof n.requested==="string")return new ns({supported:n.supported,requested:n.requested},r)}if(t===Y.InvalidParams||t===Y.ResourceNotFound){let n=o;if(typeof n?.uri==="string"&&(t===Y.ResourceNotFound||Object.keys(n).length===1))return new El(n.uri,r)}if(t===Y.MissingRequiredClientCapability&&o){let n=o;if(n.requiredCapabilities!==null&&typeof n.requiredCapabilities==="object"&&!Array.isArray(n.requiredCapabilities))return new zl({requiredCapabilities:n.requiredCapabilities},r)}return new e(t,r,o)}},El=class extends le{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(e,t=`Resource not found: ${e}`){super(Y.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},S0=class extends le{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(Y.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},ns=class extends le{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(Y.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},zl=class extends le{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(", ")}`){super(Y.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},ux=0,lx="private",dx=["tools/call","prompts/get","resources/read"];function px(e,t){let r=t.resultType;if(r===void 0)return{...t,resultType:"complete"};if(r==="complete")return t;if(dx.includes(e))return t;throw new le(Y.InternalError,`Handler for ${e} returned resultType '${String(r)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function fx(e,t){let r=cx(t);if(t.resultType!=="complete"||!ax(e))return r===void 0?t:_x(t);let o=t,n=lm(o.ttlMs)?o.ttlMs:gx(r),s=dm(o.cacheScope)?o.cacheScope:yx(r),i={...o,ttlMs:n,cacheScope:s};return delete i[es],i}function mx(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function hx(e,t){if(t===void 0)return e;let r=e._meta;if(r===void 0)return{...e,_meta:{[br]:t}};if(!mx(r))return e;if(r[br]!==void 0)return e;return{...e,_meta:{...r,[br]:t}}}function gx(e){return e!==void 0&&lm(e.ttlMs)?e.ttlMs:ux}function yx(e){return e!==void 0&&dm(e.cacheScope)?e.cacheScope:lx}function _x(e){let t={...e};return delete t[es],t}var vx=["elicitation/create","sampling/createMessage","roots/list"],_l;function b0(){if(_l)return _l;let e=pn();return _l={request:{"elicitation/create":T({method:A("elicitation/create"),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":T({method:A("sampling/createMessage"),params:e.CreateMessageRequestParamsSchema}),"roots/list":T({method:A("roots/list"),params:de({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},_l}function $0(e){return vx.includes(e)}function Xf(e){return $0(e)?b0().request[e]:void 0}function Sx(e){return $0(e)?b0().response[e]:void 0}var fm={"tools/call":null,"tools/list":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"completion/complete":null,"server/discover":null,"subscriptions/listen":null},w0={"notifications/cancelled":null,"notifications/progress":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/subscriptions/acknowledged":null};function R0(e){return Object.prototype.hasOwnProperty.call(fm,e)}function E0(e){return Object.prototype.hasOwnProperty.call(w0,e)}function bx(e){return Object.prototype.hasOwnProperty.call(fm,e)}function $x(e){return R0(e)?pn().dispatchRequestSchemas[e]:void 0}function wx(e){return bx(e)?pn().dispatchResultSchemas[e]:void 0}function Rx(e){return E0(e)?pn().notificationSchemas2026[e]:void 0}var XJ=Object.keys(fm),QJ=Object.keys(w0);function ta(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function Qi(e,t){if(e===void 0)return{ok:!1,reason:"not-in-era"};let r=e.safeParse(t);return r.success?{ok:!0,value:r.data}:{ok:!1,reason:"invalid",message:String(r.error)}}var Ex={ok:!1,reason:"not-in-era"},zx=[Vr,Zr];function Px(e,t){let r=t,o=!1,n=()=>{if(!o)r={...r},o=!0;return r},s=t.tools;if(e==="tools/list"&&Array.isArray(s)&&s.some((a)=>ta(a)&&("execution"in a)))n().tools=s.map((a)=>{if(!ta(a)||!("execution"in a))return a;let c={...a};return delete c.execution,c});let i=t.capabilities;if(ta(i)&&"tasks"in i){let a={...i};delete a.tasks,n().capabilities=a}return r}var mm={era:"2026-07-28",hasRequestMethod:R0,hasNotificationMethod:E0,hasInputRequestMethod:(e)=>Xf(e)!==void 0,validateRequest:(e,t)=>Qi($x(e),t),validateResult:(e,t)=>Qi(wx(e),t),validateNotification:(e,t)=>Qi(Rx(e),t),validateInputRequest:(e,t)=>Qi(Xf(e),t),validateInputResponse:(e,t)=>Qi(Sx(e),t),samplingResultVariant:()=>Ex,outboundEnvelope(e){return{[Vr]:e.protocolVersion,[Fn]:e.clientInfo,[Zr]:e.clientCapabilities,...e.logLevel!==void 0&&{[ao]:e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let o of zx)if(!(o in e))t.push({key:o,problem:"missing"});let r=pn().RequestMetaEnvelopeSchema.safeParse(e);if(!r.success)for(let o of r.error.issues){let n=o.path.map(String),s=n.length>0?n.join("."):"_meta";if(n.length===1&&t.some((i)=>i.key===s&&i.problem==="missing"))continue;t.push({key:s,problem:o.message})}return t},projectCallToolResult:(e)=>p0(e),inputRequestSchema:Xf,decodeResult(e,t){if(!ta(t))return{kind:"invalid",error:new Se(Te.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let r=t.resultType;if(r===void 0)return{kind:"invalid",error:new Se(Te.InvalidResult,`Invalid result for ${e}: missing required resultType — servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:e,violation:"missing-resultType"})};if(typeof r!=="string")return{kind:"invalid",error:new Se(Te.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:r})};if(r==="input_required"){let i=t.inputRequests,a=ta(i)?i:{},c=t.requestState;if(Object.keys(a).length===0&&typeof c!=="string")return{kind:"invalid",error:new Se(Te.InvalidResult,`Invalid result for ${e}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:e,violation:"input-required-missing-both"})};return{kind:"input_required",inputRequests:a,...typeof c==="string"&&{requestState:c}}}if(r!=="complete")return{kind:"invalid",error:new Se(Te.UnsupportedResultType,`Unsupported result type '${r}' for ${e}`,{resultType:r,method:e})};let o=Tx(),n=Object.hasOwn(o,e)?o[e]:void 0;if(n!==void 0){let i=n.safeParse(t);if(!i.success)return{kind:"invalid",error:new Se(Te.InvalidResult,`Invalid result for ${e}: ${i.error}`,{method:e})}}let s={...t};return delete s.resultType,{kind:"complete",result:s}},encodeResult(e,t,r){return hx(fx(e,px(e,Px(e,t))),r)},encodeErrorCode:(e)=>e===-32002?-32602:e,checkInboundEnvelope(e){if(e.envelope===void 0)return"Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)";let t=pn().RequestMetaEnvelopeSchema.safeParse(e.envelope);if(!t.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${t.error.issues.map((r)=>r.message).join("; ")}`}},vl;function Tx(){if(vl)return vl;let e=pn();return vl={"tools/call":e.CallToolResultSchema,"tools/list":e.ListToolsResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"completion/complete":e.CompleteResultSchema,"server/discover":e.DiscoverResultSchema},vl}var sa="2026-07-28";function go(e){return e!==void 0&&os(e)?mm:um}function t0(e){if(e.revision!==void 0)return go(e.revision).era;return e.era==="modern"?mm.era:um.era}function Qf(e){return z0.some((t)=>t.hasRequestMethod(e))}function em(e){return z0.some((t)=>t.hasNotificationMethod(e))}var z0=[um,mm];function r0(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function fn(e){if(!r0(e))return;let t=e._meta;return r0(t)?t:void 0}function Pl(e){let t=fn(e);return t!==void 0&&Vr in t}function Tl(e){let t=fn(e)?.[Vr];return typeof t==="string"?t:void 0}function Il(e){return go(sa).validateEnvelopeMeta(e)}var Ix=Jg({AnnotationsSchema:()=>Hr,AudioContentSchema:()=>Bn,BaseMetadataSchema:()=>Fr,BaseRequestParamsSchema:()=>yt,BlobResourceContentsSchema:()=>Ui,BooleanSchemaSchema:()=>Gi,CallToolRequestParamsSchema:()=>Iu,CallToolRequestSchema:()=>ku,CallToolResultSchema:()=>Hi,CancelTaskRequestSchema:()=>jf,CancelTaskResultSchema:()=>qf,CancelledNotificationParamsSchema:()=>Cc,CancelledNotificationSchema:()=>Ai,ClientCapabilitiesSchema:()=>jc,ClientNotificationSchema:()=>Lf,ClientRequestSchema:()=>Mf,ClientResultSchema:()=>Df,ClientTasksCapabilitySchema:()=>Nc,CompatibilityCallToolResultSchema:()=>Ef,CompleteRequestParamsSchema:()=>ol,CompleteRequestSchema:()=>nl,CompleteResultSchema:()=>sl,ContentBlockSchema:()=>Wn,CreateMessageRequestParamsSchema:()=>Fu,CreateMessageRequestSchema:()=>Vu,CreateMessageResultSchema:()=>Zu,CreateMessageResultWithToolsSchema:()=>Hu,CreateTaskResultSchema:()=>Tf,CursorSchema:()=>Ti,DiscoverRequestSchema:()=>Uc,DiscoverResultSchema:()=>Fc,ElicitRequestFormParamsSchema:()=>Qn,ElicitRequestParamsSchema:()=>Wu,ElicitRequestSchema:()=>Yu,ElicitRequestURLParamsSchema:()=>Bu,ElicitResultSchema:()=>el,ElicitationCompleteNotificationParamsSchema:()=>Xu,ElicitationCompleteNotificationSchema:()=>Qu,EmbeddedResourceSchema:()=>Su,EmptyResultSchema:()=>Ni,EnumSchemaSchema:()=>Ku,GetPromptRequestParamsSchema:()=>yu,GetPromptRequestSchema:()=>_u,GetPromptResultSchema:()=>wu,GetTaskPayloadRequestSchema:()=>Cf,GetTaskPayloadResultSchema:()=>xf,GetTaskRequestSchema:()=>kf,GetTaskResultSchema:()=>Of,IconSchema:()=>xc,IconsSchema:()=>uo,ImageContentSchema:()=>Kn,ImplementationSchema:()=>Hn,InitializeRequestParamsSchema:()=>qc,InitializeRequestSchema:()=>Mc,InitializeResultSchema:()=>Lc,InitializedNotificationSchema:()=>Dc,JSONArraySchema:()=>$f,JSONObjectSchema:()=>Xe,JSONRPCErrorResponseSchema:()=>Zn,JSONRPCMessageSchema:()=>xi,JSONRPCNotificationSchema:()=>Ci,JSONRPCRequestSchema:()=>Oi,JSONRPCResponseSchema:()=>wf,JSONRPCResultResponseSchema:()=>Vn,JSONValueSchema:()=>io,LegacyTitledEnumSchemaSchema:()=>Bi,ListChangedOptionsBaseSchema:()=>zf,ListPromptsRequestSchema:()=>hu,ListPromptsResultSchema:()=>gu,ListResourceTemplatesRequestSchema:()=>Bc,ListResourceTemplatesResultSchema:()=>Wc,ListResourcesRequestSchema:()=>Jc,ListResourcesResultSchema:()=>Kc,ListRootsRequestSchema:()=>al,ListRootsResultSchema:()=>cl,ListTasksRequestSchema:()=>Nf,ListTasksResultSchema:()=>Af,ListToolsRequestSchema:()=>Pu,ListToolsResultSchema:()=>Tu,LoggingLevelSchema:()=>mo,LoggingMessageNotificationParamsSchema:()=>Nu,LoggingMessageNotificationSchema:()=>Au,ModelHintSchema:()=>ju,ModelPreferencesSchema:()=>qu,MultiSelectEnumSchemaSchema:()=>Ju,NotificationSchema:()=>Tt,NotificationsParamsSchema:()=>Pt,NumberSchemaSchema:()=>Xn,PaginatedRequestParamsSchema:()=>Hc,PaginatedRequestSchema:()=>lo,PaginatedResultSchema:()=>po,PingRequestSchema:()=>qi,PrimitiveSchemaDefinitionSchema:()=>Xi,ProgressNotificationParamsSchema:()=>Zc,ProgressNotificationSchema:()=>Mi,ProgressSchema:()=>Vc,ProgressTokenSchema:()=>Pi,PromptArgumentSchema:()=>fu,PromptListChangedNotificationSchema:()=>Ru,PromptMessageSchema:()=>$u,PromptReferenceSchema:()=>rl,PromptSchema:()=>mu,ReadResourceRequestParamsSchema:()=>Yc,ReadResourceRequestSchema:()=>Xc,ReadResourceResultSchema:()=>Qc,RelatedTaskMetadataSchema:()=>Oc,RequestIdSchema:()=>co,RequestMetaSchema:()=>Ii,RequestSchema:()=>Qe,ResourceContentsSchema:()=>Li,ResourceLinkSchema:()=>bu,ResourceListChangedNotificationSchema:()=>eu,ResourceRequestParamsSchema:()=>Gn,ResourceSchema:()=>Fi,ResourceTemplateReferenceSchema:()=>tl,ResourceTemplateSchema:()=>Gc,ResourceUpdatedNotificationParamsSchema:()=>du,ResourceUpdatedNotificationSchema:()=>pu,ResultMetaObjectSchema:()=>ki,ResultSchema:()=>et,RoleSchema:()=>fo,RootSchema:()=>il,RootsListChangedNotificationSchema:()=>ul,SamplingContentSchema:()=>Du,SamplingMessageContentBlockSchema:()=>sn,SamplingMessageSchema:()=>Uu,ServerCapabilitiesSchema:()=>ji,ServerNotificationSchema:()=>Ff,ServerRequestSchema:()=>Uf,ServerResultSchema:()=>Vf,ServerTasksCapabilitySchema:()=>Ac,SetLevelRequestParamsSchema:()=>Cu,SetLevelRequestSchema:()=>xu,SingleSelectEnumSchemaSchema:()=>Gu,StringSchemaSchema:()=>Yn,SubscribeRequestParamsSchema:()=>tu,SubscribeRequestSchema:()=>ru,SubscriptionFilterSchema:()=>Vi,SubscriptionsAcknowledgedNotificationParamsSchema:()=>au,SubscriptionsAcknowledgedNotificationSchema:()=>cu,SubscriptionsListenRequestParamsSchema:()=>su,SubscriptionsListenRequestSchema:()=>iu,SubscriptionsListenResultMetaSchema:()=>uu,SubscriptionsListenResultSchema:()=>lu,TaskAugmentedRequestParamsSchema:()=>ln,TaskCreationParamsSchema:()=>Pf,TaskMetadataSchema:()=>kc,TaskSchema:()=>ho,TaskStatusNotificationParamsSchema:()=>dl,TaskStatusNotificationSchema:()=>If,TaskStatusSchema:()=>ll,TextContentSchema:()=>Jn,TextResourceContentsSchema:()=>Di,TitledMultiSelectEnumSchemaSchema:()=>Yi,TitledSingleSelectEnumSchemaSchema:()=>Ki,ToolAnnotationsSchema:()=>Eu,ToolChoiceSchema:()=>Mu,ToolExecutionSchema:()=>zu,ToolListChangedNotificationSchema:()=>Ou,ToolResultContentSchema:()=>Lu,ToolSchema:()=>Zi,ToolUseContentSchema:()=>vu,UnsubscribeRequestParamsSchema:()=>ou,UnsubscribeRequestSchema:()=>nu,UntitledMultiSelectEnumSchemaSchema:()=>Wi,UntitledSingleSelectEnumSchemaSchema:()=>Ji});var er=(e)=>Oi.safeParse(e).success,_o=(e)=>Ci.safeParse(e).success,oa=(e)=>Vn.safeParse(e).success,kl=(e)=>Zn.safeParse(e).success;var Gr=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e)&&e.resultType==="input_required";function hm(e){if(e.params.ref.type!=="ref/prompt")throw TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`)}function gm(e){if(e.params.ref.type!=="ref/resource")throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`)}var o0="x-mcp-header",kx=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,Ox=new Set(["string","integer","boolean","number"]);function ym(e){let t=[],r=new Map,o=(s,i,a)=>{if(s===null||typeof s!=="object")return;let c=s;if(o0 in c){if(!a||i.length===0)return`${Sl(i)}: x-mcp-header is only permitted on properties statically reachable via a chain of 'properties' keys (not under items, additionalProperties, oneOf/anyOf/allOf/not, if/then/else, or $ref)`;let l=c[o0];if(typeof l!=="string"||l.length===0)return`${Sl(i)}: x-mcp-header MUST be a non-empty string`;if(!kx.test(l))return`${Sl(i)}: x-mcp-header '${l}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let d=typeof c.type==="string"?c.type:void 0;if(d===void 0||!Ox.has(d))return`${Sl(i)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${d??"<none>"}`;let f=l.toLowerCase(),m=r.get(f);if(m!==void 0)return`x-mcp-header '${l}' is not case-insensitively unique (also declared as '${m}')`;r.set(f,l),t.push({path:i,headerName:l,type:d})}let u=c.properties;if(u!==null&&typeof u==="object")for(let[l,d]of Object.entries(u)){let f=o(d,[...i,l],a);if(f!==void 0)return f}for(let l of Cx){let d=c[l];if(d===void 0)continue;let f=Array.isArray(d)?d:d!==null&&typeof d==="object"&&xx.has(l)?Object.values(d):[d];for(let m of f){let h=o(m,[...i,`<${l}>`],!1);if(h!==void 0)return h}}},n=o(e,[],!0);return n===void 0?{valid:!0,declarations:t}:{valid:!1,reason:n}}var Cx=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],xx=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);function Sl(e){return e.length===0?"<root>":e.join(".")}var $l=-32020,e3=[{rung:"http-method",order:1,evaluatedAt:"edge",codes:[-32000],conformance:[],rationale:"The modern era is POST-only; GET/DELETE are body-less 2025-era session operations and are method-routed to legacy serving (405 when legacy serving is not configured), before any body is read."},{rung:"jsonrpc-shape",order:2,evaluatedAt:"edge",codes:[Y.InvalidRequest],conformance:["server-stateless"],rationale:"The body must be a JSON-RPC request or notification: posted responses and batch arrays containing a modern or invalid element are rejected before classification (element-wise batch rule); all-legacy arrays stay legacy traffic."},{rung:"era-classification",order:3,evaluatedAt:"edge",codes:[$l,Y.UnsupportedProtocolVersion],conformance:["server-stateless","http-header-validation","http-custom-header-server-validation"],rationale:"Body-primary era classification with the protocol-version header as a cross-check; a header/body disagreement is rejected with -32020 (HeaderMismatch), and an envelope-less request on a modern-only endpoint is answered with the unsupported-protocol-version error naming the supported revisions."},{rung:"envelope",order:4,evaluatedAt:"edge",codes:[Y.InvalidParams],conformance:["server-stateless"],rationale:"A present envelope claim with a malformed envelope — and a missing envelope on a request whose protocol-version header names a modern revision — is an invalid-params rejection naming the offending or missing key(s); never a silent fall back to legacy handling. This is the only place an invalid-params rejection maps to HTTP 400."},{rung:"method-registry",order:5,evaluatedAt:"dispatch",codes:[Y.MethodNotFound],conformance:["server-stateless"],rationale:"Method existence outranks parameter validity: a method absent from the negotiated revision’s registry (or with no handler installed) answers method-not-found before params or capabilities are looked at."},{rung:"request-params",order:6,evaluatedAt:"dispatch",codes:[Y.InvalidParams],conformance:[],rationale:"Per-method params validation; emitted in-band by the dispatch layer (HTTP 200), never via the ladder status table."},{rung:"standard-header-validation",order:7,evaluatedAt:"pre-dispatch",codes:[$l],conformance:["http-header-validation"],rationale:"SEP-2243 standard `Mcp-Method` / `Mcp-Name` headers — presence, sentinel decoding, and `Mcp-Name` ↔ body cross-check — are validated by the HTTP entry on a modern-classified request after the supported-revision gate and before dispatch. The classifier’s own header-mismatch cells (protocol-version, `Mcp-Method` mismatch) stay on the edge `era-classification` rung; this rung carries the entry-layer presence/`Mcp-Name` half. Evaluated before the capability gate, the factory call, and the `Mcp-Param-*` rung so a request that fails several rungs is answered by the standard-header rung first. The documented order (after method-registry 5 and request-params 6) is NOT the observed precedence: serveModern evaluates this rung immediately after the supported-revision gate, so a request that also fails a dispatch rung is answered here before the dispatch rungs (5–6) are consulted."},{rung:"client-capabilities",order:8,evaluatedAt:"pre-dispatch",codes:[Y.MissingRequiredClientCapability],conformance:["server-stateless"],rationale:"The capability requirement is checked by the HTTP entry, pre-dispatch, against the validated envelope the classifier produced — pinning the spec-mandated HTTP 400 independently of how dispatch- and handler-produced errors are mapped. The documented order (after method resolution and params validation) is preserved observably only while the requirement table is empty: once a served method gains a requirement entry, a request that is missing the capability and would also fail a dispatch rung is answered by this gate first, so the entry must consult the method registry before the gate if the documented precedence is to stay observable."},{rung:"param-header-validation",order:9,evaluatedAt:"pre-dispatch",codes:[$l],conformance:["http-custom-header-server-validation"],rationale:"SEP-2243 `Mcp-Param-*` headers are validated against the named tool’s `x-mcp-header` declarations and the body `arguments` after the tool registry is known and before dispatch reaches the handler; a missing/disagreeing/malformed header is rejected 400 / -32020 with the same shape as the standard-header cross-checks. The documented order (after method resolution and params validation) is preserved observably only when the body `arguments` would otherwise validate: the check runs pre-dispatch, so a `tools/call` that fails BOTH this rung and a dispatch-time rung (e.g. order-6 `request-params`, -32602) is answered by this gate first with 400 / -32020, not by the earlier-ordered rung."}],Nx={[Y.ParseError]:400,[Y.InvalidRequest]:400,[Y.MethodNotFound]:404,[Y.UnsupportedProtocolVersion]:400,[Y.MissingRequiredClientCapability]:400,[$l]:400};function bl(e,t,r,o,n){return{kind:"reject",rung:e,cell:t,httpStatus:r,code:o.code,message:o.message,...o.data!==void 0&&{data:o.data},settled:n}}function _m(e){if(!Pl(e))return!1;let t=Tl(e);if(t===void 0||!os(t))return!1;let r=fn(e);return r!==void 0&&Il(r).length===0}function vm(e,t){switch(e.reason){case"http-method":return bl("http-method","modern-only-method-not-allowed",405,new le(-32000,"Method not allowed."),!0);case"batch":return bl("jsonrpc-shape","modern-only-batch-not-supported",400,new le(Y.InvalidRequest,"Bad Request: JSON-RPC batches are not supported by this endpoint"),!0);case"response":return bl("jsonrpc-shape","modern-only-response-post",400,new le(Y.InvalidRequest,"Bad Request: JSON-RPC responses cannot be posted to this endpoint"),!0);case"notification":return;case"initialize":case"no-claim":{let r=e.requestedVersion;return bl("era-classification","modern-only-missing-envelope",400,r===void 0?new le(Y.UnsupportedProtocolVersion,"Unsupported protocol version: the request did not name a protocol version",{supported:[...t]}):new ns({supported:[...t],requested:r}),!0)}}}function Ol(e,t){return Rc(e,t)}function ea(e){return new Set(e.flatMap((t)=>Object.keys(t.shape)))}function rs(e){if(e==null)return!1;let t=typeof e;if(t!=="object"&&t!=="function")return!1;if(!("~standard"in e))return!1;return typeof e["~standard"]?.validate==="function"}var n0=!1,om="draft-2020-12";function vo(e,t="input"){let r=e["~standard"],o;if(r.jsonSchema)o=r.jsonSchema[t]({target:om});else if(r.vendor==="zod"){if(!("_zod"in e))throw Error("Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().");if(!n0)n0=!0,console.warn("[mcp-sdk] Your zod version does not implement `~standard.jsonSchema` (added in zod 4.2.0). Falling back to z.toJSONSchema(). Upgrade to zod >=4.2.0 to silence this warning.");o=$c(e,{target:om,io:t})}else throw Error(`Schema library "${r.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(t==="output"){if(o.type!==void 0)return o;return P0(o)?{type:"object",...o}:o}if(o.type!==void 0&&o.type!=="object")throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(o.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...o}}function P0(e){if("properties"in e||"patternProperties"in e||"additionalProperties"in e||"required"in e)return!0;for(let t of["oneOf","anyOf","allOf"]){let r=e[t];if(Array.isArray(r)&&r.length>0)return r.every((o)=>o!==null&&typeof o==="object"&&(o.type==="object"||P0(o)))}return!1}function Ax(e){if(!e.path?.length)return e.message;return`${e.path.map((t)=>String(typeof t==="object"?t.key:t)).join(".")}: ${e.message}`}async function dn(e,t){let r=await e["~standard"].validate(t);if(r.issues&&r.issues.length>0)return{success:!1,error:r.issues.map((o)=>Ax(o)).join(", ")};return{success:!0,data:r.value}}function jx(e){let t=$c(e,{target:om,io:"input"});return typeof t.pattern==="string"?t.pattern:void 0}var qx=/\\\.\\d\{(\d+)\}/;function Mx(e){let t=qx.exec(e),r=[void 0,-1,0];if(t)r.push(Number(t[1]));return[!1,!0].flatMap((o)=>[!1,!0].flatMap((n)=>r.map((s)=>Dn({local:o,offset:n,precision:s}))))}function Lx(e,t){let r;switch(e){case"email":r=[IS()];break;case"uri":r=[zc()];break;case"date":r=[_f()];break;case"date-time":r=Mx(t);break}return new Set(r.map((o)=>jx(o)).filter((o)=>o!==void 0))}function Dx(e,t,r){if(r!=="zod")return!0;return Lx(e,t).has(t)}function T0(e){let t=vo(e,"input"),r=t.properties||{},o=t.required||[];return Object.entries(r).map(([n,s])=>({name:n,description:s?.description,required:o.includes(n)}))}function na(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Ux(e){try{return vo(e,"input")}catch(t){let r=t instanceof Error?t.message:String(t);throw new le(Y.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${r}`)}}var Fx=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function Sm(e){return Fx.has(e)||e.startsWith("x-")}var Vx=new Set(["$schema",...Object.keys(Qn.shape.requestedSchema.shape)]),s0={string:ea([Yn,Ji,Ki,Bi]),number:ea([Xn]),integer:ea([Xn]),boolean:ea([Gi]),array:ea([Wi,Yi])},Zx=new Set(Yn.shape.format.unwrap().options);function Hx(e,t,r,o){if(!na(e))return e;let n=typeof e.type==="string"&&Object.hasOwn(s0,e.type)?s0[e.type]:void 0;if(n===void 0)return e;let s={};for(let[i,a]of Object.entries(e))if(n.has(i)||Sm(i))s[i]=a;else if(i==="pattern"&&e.type==="string"&&typeof e.format==="string"){if(!Zx.has(e.format))s[i]=a;else if(typeof a!=="string"||!Dx(e.format,a,r))o.push(`${t}.${i}`)}else o.push(`${t}.${i}`);return s}function Gx(e,t){let r={},o=[];for(let[n,s]of Object.entries(e))if(n==="properties"&&na(s))r[n]=Object.fromEntries(Object.entries(s).map(([i,a])=>[i,Hx(a,`properties.${i}`,t,o)]));else if(Vx.has(n))r[n]=s;else if(!Sm(n))o.push(n);if(o.length>0)throw new le(Y.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${o.join(", ")}`);return r}function Jx(e,t){if(!na(e.properties))return t;let r=Object.entries(e.properties).filter(([,o])=>!Ol(Xi,o).success).map(([o])=>`properties.${o}`);return r.length>0?r.join(", "):t}function nm(e,t,r=""){if(Array.isArray(e)&&Array.isArray(t))return e.flatMap((o,n)=>nm(o,t[n],`${r}[${n}]`));if(!na(e)||!na(t))return[];return Object.entries(e).flatMap(([o,n])=>{let s=r?`${r}.${o}`:o;if(!Object.prototype.hasOwnProperty.call(t,o))return Sm(o)?[]:[s];return nm(n,t[o],s)})}function Kx(e){if(!rs(e.requestedSchema))return{...e,mode:"form",requestedSchema:e.requestedSchema};let t=e.requestedSchema["~standard"].vendor,r=Gx(Ux(e.requestedSchema),t),o=Ol(Qn.shape.requestedSchema,r);if(!o.success)throw new le(Y.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${Jx(r,o.error.message)}`);let n=nm(r,o.data);if(n.length>0)throw new le(Y.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${n.join(", ")}`);let s=(o.data.required??[]).filter((i)=>!Object.prototype.hasOwnProperty.call(o.data.properties,i));if(s.length>0)throw new le(Y.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${s.join(", ")}`);return{...e,mode:"form",requestedSchema:o.data}}function Bx(e){let t=e.inputRequests!==void 0&&Object.keys(e.inputRequests).length>0,r=typeof e.requestState==="string";if(!t&&!r)throw TypeError("inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)");return{resultType:"input_required",...e.inputRequests!==void 0&&{inputRequests:e.inputRequests},...e.requestState!==void 0&&{requestState:e.requestState}}}var Wx=Object.assign(Bx,{elicit(e){try{return{method:"elicitation/create",params:Kx(e)}}catch(t){throw t instanceof le?TypeError(t.message,{cause:t}):t}},elicitUrl(e){return{method:"elicitation/create",params:{...e,mode:"url"}}},createMessage(e){return{method:"sampling/createMessage",params:e}},listRoots(){return{method:"roots/list"}}});var I0=250;function k0(e,t){return`Multi-round-trip request '${e}' still required input after ${t} rounds (inputRequired.maxRounds)`}function O0(e,t){return new Promise((r,o)=>{if(t?.aborted){o(t.reason instanceof Se?t.reason:new Se(Te.RequestTimeout,String(t.reason)));return}let n=setTimeout(()=>{t?.removeEventListener("abort",s),r()},e),s=()=>{clearTimeout(n),o(t?.reason instanceof Se?t.reason:new Se(Te.RequestTimeout,String(t?.reason)))};t?.addEventListener("abort",s,{once:!0})})}function C0(e){let t=new AbortController,r=()=>t.abort(e?.reason);if(e?.addEventListener("abort",r,{once:!0}),e?.aborted)t.abort(e.reason);return{signal:t.signal,abort:(o)=>t.abort(o),dispose:()=>e?.removeEventListener("abort",r)}}var Yx=["AnnotationsSchema","AudioContentSchema","BaseMetadataSchema","BlobResourceContentsSchema","BooleanSchemaSchema","CallToolRequestSchema","CallToolRequestParamsSchema","CallToolResultSchema","CancelledNotificationSchema","CancelledNotificationParamsSchema","CancelTaskRequestSchema","CancelTaskResultSchema","ClientCapabilitiesSchema","ClientNotificationSchema","ClientRequestSchema","ClientResultSchema","CompatibilityCallToolResultSchema","CompleteRequestSchema","CompleteRequestParamsSchema","CompleteResultSchema","ContentBlockSchema","CreateMessageRequestSchema","CreateMessageRequestParamsSchema","CreateMessageResultSchema","CreateMessageResultWithToolsSchema","CreateTaskResultSchema","CursorSchema","DiscoverRequestSchema","DiscoverResultSchema","ElicitationCompleteNotificationSchema","ElicitationCompleteNotificationParamsSchema","ElicitRequestSchema","ElicitRequestFormParamsSchema","ElicitRequestParamsSchema","ElicitRequestURLParamsSchema","ElicitResultSchema","EmbeddedResourceSchema","EmptyResultSchema","EnumSchemaSchema","GetPromptRequestSchema","GetPromptRequestParamsSchema","GetPromptResultSchema","GetTaskPayloadRequestSchema","GetTaskPayloadResultSchema","GetTaskRequestSchema","GetTaskResultSchema","IconSchema","IconsSchema","ImageContentSchema","ImplementationSchema","InitializedNotificationSchema","InitializeRequestSchema","InitializeRequestParamsSchema","InitializeResultSchema","JSONArraySchema","JSONObjectSchema","JSONRPCErrorResponseSchema","JSONRPCMessageSchema","JSONRPCNotificationSchema","JSONRPCRequestSchema","JSONRPCResponseSchema","JSONRPCResultResponseSchema","JSONValueSchema","LegacyTitledEnumSchemaSchema","ListPromptsRequestSchema","ListPromptsResultSchema","ListResourcesRequestSchema","ListResourcesResultSchema","ListResourceTemplatesRequestSchema","ListResourceTemplatesResultSchema","ListRootsRequestSchema","ListRootsResultSchema","ListTasksRequestSchema","ListTasksResultSchema","ListToolsRequestSchema","ListToolsResultSchema","LoggingLevelSchema","LoggingMessageNotificationSchema","LoggingMessageNotificationParamsSchema","ModelHintSchema","ModelPreferencesSchema","MultiSelectEnumSchemaSchema","NotificationSchema","NumberSchemaSchema","PaginatedRequestSchema","PaginatedRequestParamsSchema","PaginatedResultSchema","PingRequestSchema","PrimitiveSchemaDefinitionSchema","ProgressSchema","ProgressNotificationSchema","ProgressNotificationParamsSchema","ProgressTokenSchema","PromptSchema","PromptArgumentSchema","PromptListChangedNotificationSchema","PromptMessageSchema","PromptReferenceSchema","ReadResourceRequestSchema","ReadResourceRequestParamsSchema","ReadResourceResultSchema","RelatedTaskMetadataSchema","RequestSchema","RequestIdSchema","RequestMetaSchema","ResourceSchema","ResourceContentsSchema","ResourceLinkSchema","ResourceListChangedNotificationSchema","ResourceRequestParamsSchema","ResourceTemplateSchema","ResourceTemplateReferenceSchema","ResourceUpdatedNotificationSchema","ResourceUpdatedNotificationParamsSchema","ResultMetaObjectSchema","ResultSchema","RoleSchema","RootSchema","RootsListChangedNotificationSchema","SamplingContentSchema","SamplingMessageSchema","SamplingMessageContentBlockSchema","ServerCapabilitiesSchema","ServerNotificationSchema","ServerRequestSchema","ServerResultSchema","SetLevelRequestSchema","SetLevelRequestParamsSchema","SingleSelectEnumSchemaSchema","StringSchemaSchema","SubscribeRequestSchema","SubscribeRequestParamsSchema","SubscriptionFilterSchema","SubscriptionsAcknowledgedNotificationSchema","SubscriptionsAcknowledgedNotificationParamsSchema","SubscriptionsListenRequestSchema","SubscriptionsListenRequestParamsSchema","SubscriptionsListenResultSchema","SubscriptionsListenResultMetaSchema","TaskAugmentedRequestParamsSchema","TaskCreationParamsSchema","TaskMetadataSchema","TaskSchema","TaskStatusSchema","TaskStatusNotificationSchema","TaskStatusNotificationParamsSchema","TextContentSchema","TextResourceContentsSchema","TitledMultiSelectEnumSchemaSchema","TitledSingleSelectEnumSchemaSchema","ToolSchema","ToolAnnotationsSchema","ToolChoiceSchema","ToolExecutionSchema","ToolListChangedNotificationSchema","ToolResultContentSchema","ToolUseContentSchema","UnsubscribeRequestSchema","UnsubscribeRequestParamsSchema","UntitledMultiSelectEnumSchemaSchema","UntitledSingleSelectEnumSchemaSchema"],Xx={IdJagTokenExchangeResponseSchema:Jf,OAuthClientInformationFullSchema:Bf,OAuthClientInformationSchema:hl,OAuthClientMetadataSchema:ml,OAuthClientRegistrationErrorSchema:Wf,OAuthErrorResponseSchema:Kf,OAuthMetadataSchema:pl,OAuthProtectedResourceMetadataSchema:Zf,OAuthTokenRevocationRequestSchema:Yf,OAuthTokensSchema:Gf,OpenIdProviderDiscoveryMetadataSchema:Hf,OpenIdProviderMetadataSchema:fl},x0={},N0={};function A0(e,t){let r=e.slice(0,-6);x0[r]=t,N0[r]=(o)=>t.safeParse(o).success}for(let e of Yx)A0(e,Ix[e]);for(let[e,t]of Object.entries(Xx))A0(e,t);var Qx=Object.freeze(x0),eN=Object.freeze(N0);function tN(e){switch(e){case"initialize":case"notifications/initialized":return go(void 0);case"server/discover":return go(sa);default:return}}var j0=60000,rN=[Vr,Fn,Zr,ao],oN=["inputResponses","requestState"];function i0(e,t){let r=e.params;if(!ra(r))return{message:e,lifted:{}};let o=r._meta,n=ra(o)?rN.filter((c)=>(c in o)):[],s=t==="request"?oN.filter((c)=>(c in r)):[];if(n.length===0&&s.length===0)return{message:e,lifted:{}};let i={},a={...r};if(n.length>0&&ra(o)){let c={},u={...o};for(let l of n)c[l]=o[l],delete u[l];if(i.envelope=c,Object.keys(u).length>0)a._meta=u;else delete a._meta}for(let c of s){if(c==="inputResponses")i.inputResponses=a[c];if(c==="requestState")i.requestState=a[c];delete a[c]}return{message:{...e,params:a},lifted:i}}function a0(e,t){let r=e.validateResult(t,void 0);if(!r.ok&&r.reason==="not-in-era")return;return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(o){let n=e.validateResult(t,o);if(n.ok)return{value:n.value};return{issues:[{message:n.reason==="invalid"?n.message:`not-in-era: ${t}`}]}}}}}function ia(e){return()=>e}var nN=ia(void 0);function bm(e,t){return{...e,mcpReq:{...e.mcpReq,requestState:ia(t)}}}var q0;function $m(e,t){q0(e,t)}var wm=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;static{q0=(e,t)=>{e._negotiatedProtocolVersion=t}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??Tc,this.setNotificationHandler("notifications/cancelled",(t)=>{this._oncancel(t)}),this.setNotificationHandler("notifications/progress",(t)=>{this._onprogress(t)}),this.setRequestHandler("ping",(t)=>({}))}_shouldDropInbound(e){}_outboundMetaEnvelope(){}_envelopeOutbound(e){let t=this._outboundMetaEnvelope();if(t===void 0)return e;let r=e.params??{};return{...e,params:{...r,_meta:{...t,...r._meta}}}}_resolveNonCompleteResult(e,t){return Promise.reject(new Se(Te.UnsupportedResultType,`Unsupported result type '${e.kind}' for ${t.request.method}`,{resultType:e.kind,method:t.request.method}))}_getRequestHandler(e){return this._requestHandlers.get(e)}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,r,o,n=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(o,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:n,onTimeout:o})}_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),new Se(Te.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){this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{try{t?.()}finally{this._onclose()}};let r=this.transport?.onerror;this._transport.onerror=(n)=>{r?.(n),this._onerror(n)};let o=this._transport?.onmessage;this._transport.onmessage=(n,s)=>{if(o?.(n,s),oa(n)||kl(n))this._onresponse(n);else if(er(n))this._onrequest(n,s);else if(_o(n))this._onnotification(n,s);else this._onerror(Error(`Unknown message type: ${JSON.stringify(n)}`))},e.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear();for(let o of this._timeoutInfo.values())clearTimeout(o.timeoutId);this._timeoutInfo.clear();let t=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let r=new Se(Te.ConnectionClosed,"Connection closed");this._transport=void 0;try{this.onclose?.()}finally{for(let o of e.values())o(r);for(let o of t.values())o.abort(r)}}_onerror(e){this.onerror?.(e)}_onnotification(e,t){let{message:r}=i0(e,"notification"),o=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)==="drop")return;if(t?.classification!==void 0){let i=t0(t.classification);if(i!==o.era){this._onerror(Error(`Era mismatch on inbound notification '${r.method}': classified as ${i} but this instance serves ${o.era}`));return}}if(em(r.method)&&!o.hasNotificationMethod(r.method))return;let n=this._notificationHandlers.get(r.method),s=this.fallbackNotificationHandler;if(n===void 0&&s===void 0)return;Promise.resolve().then(()=>n===void 0?s(r):n(r,o)).catch((i)=>this._onerror(Error(`Uncaught error in notification handler: ${i}`)))}_onrequest(e,t){let{message:r,lifted:o}=i0(e,"request"),n=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)==="drop"){this._onerror(Error(`Dropped inbound request '${e.method}': not servable on this connection's protocol era`));return}let s=this._transport,i=(g,_,y)=>{let S={jsonrpc:"2.0",id:r.id,error:{code:g,message:_,...y!==void 0&&{data:y}}};s?.send(S).catch((v)=>this._onerror(Error(`Failed to send an error response: ${v}`)))};if(t?.classification!==void 0){let g=t0(t.classification);if(g!==n.era){this._onerror(Error(`Era mismatch on inbound request '${r.method}': classified as ${g} but this instance serves ${n.era}`));let _=t.classification.revision??g;i(Y.UnsupportedProtocolVersion,`Unsupported protocol version: ${_}`,{supported:this._supportedProtocolVersions,requested:_});return}}if(Qf(r.method)&&!n.hasRequestMethod(r.method)){i(Y.MethodNotFound,"Method not found");return}let a=this._requestHandlers.get(r.method)??this.fallbackRequestHandler;if(a===void 0){i(Y.MethodNotFound,"Method not found");return}let c=n.checkInboundEnvelope(o);if(c!==void 0){i(Y.InvalidParams,c);return}let u=(g,_)=>this._notificationViaCodec(this._resolveOutboundCodec(g.method),g,{..._,relatedRequestId:r.id}),l=(g,_,y)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(g.method),g,_,{...y,relatedRequestId:r.id}),d=new AbortController;this._requestHandlerAbortControllers.set(r.id,d);let f=o.inputResponses===void 0?void 0:sN(o.inputResponses),m={sessionId:s?.sessionId,mcpReq:{id:r.id,method:r.method,_meta:r.params?._meta,...o.envelope!==void 0&&{envelope:o.envelope},...f!==void 0&&{inputResponses:f.accepted},...f!==void 0&&f.droppedKeys.length>0&&{droppedInputResponseKeys:f.droppedKeys},requestState:o.requestState===void 0?nN:ia(o.requestState),signal:d.signal,send:(g,_,y)=>{let S=this._resolveOutboundCodec(g.method);if(this._assertOutboundRequestInEra(S,g.method),rs(_))return l(g,_,y);let v=a0(S,g.method);if(v===void 0)throw TypeError(`'${g.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return l(g,v,_)},notify:u},http:t?.authInfo?{authInfo:t.authInfo}:void 0},h=this.buildContext(m,t);Promise.resolve().then(()=>a(r,h)).then(async(g)=>{if(d.signal.aborted)return;let _;try{_=n.encodeResult(r.method,g,this._outboundServerInfo())}catch(S){this._onerror(Error(`Failed to encode result for ${r.method}: ${S}`)),i(Y.InternalError,"Internal error");return}let y={result:_,jsonrpc:"2.0",id:r.id};await s?.send(y)},async(g)=>{if(d.signal.aborted)return;let _=Number.isSafeInteger(g.code)?g.code:Y.InternalError,y={jsonrpc:"2.0",id:r.id,error:{code:n.encodeErrorCode(_),message:g.message??"Internal error",...g.data!==void 0&&{data:g.data}}};await s?.send(y)}).catch((g)=>this._onerror(Error(`Failed to send response: ${g}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(r.id)===d)this._requestHandlerAbortControllers.delete(r.id)})}_onprogress(e){let{progressToken:t,...r}=e.params,o=Number(t),n=this._progressHandlers.get(o);if(!n){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let s=this._responseHandlers.get(o),i=this._timeoutInfo.get(o);if(i&&s&&i.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(a){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),s(a);return}n(r)}_onresponse(e){let t=Number(e.id),r=this._responseHandlers.get(t);if(r===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(t),this._cleanupTimeout(t),this._progressHandlers.delete(t),oa(e))r(e);else r(le.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}request(e,t,r){let o=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(o,e.method),rs(t))return this._requestWithSchemaViaCodec(o,e,t,r);let n=a0(o,e.method);if(n===void 0)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(o,e,n,t)}_negotiatedWireCodec(){return go(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=tN(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(Qf(t)&&!e.hasRequestMethod(t))throw new Se(Te.MethodNotSupportedByProtocolVersion,`Method '${t}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t,era:e.era})}_requestWithSchema(e,t,r){let o=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(o,e.method),this._requestWithSchemaViaCodec(o,e,t,r)}_requestWithSchemaViaCodec(e,t,r,o){let{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i,headers:a}=o??{},c=Date.now(),u,l;return new Promise((d,f)=>{let m=(R)=>{f(R)};if(!this._transport){m(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(R){m(R);return}if(o?.signal?.aborted){let R=o.signal.reason;throw R instanceof Se?R:new Se(Te.RequestTimeout,String(R))}let h=e.era===sa&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,g=this._requestMessageId++;l=g;let _={...t,jsonrpc:"2.0",id:g};if(o?.onprogress)this._progressHandlers.set(g,o.onprogress),_.params={...t.params,_meta:{...t.params?._meta,progressToken:g}};let y=this._envelopeOutbound(_),S=!1,v=(R)=>{if(S)return;if(this._progressHandlers.delete(g),h===void 0)this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:g,reason:String(R)}}),{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i}).catch((b)=>this._onerror(Error(`Failed to send cancellation: ${b}`)));else h.abort();f(R instanceof Se?R:new Se(Te.RequestTimeout,String(R)))};this._responseHandlers.set(g,(R)=>{if(o?.signal?.aborted)return;if(S=!0,R instanceof Error)return f(R);let b;try{b=e.decodeResult(t.method,R.result)}catch(C){return f(C instanceof Error?C:Error(String(C)))}if(b.kind==="invalid")return f(b.error);if(b.kind==="input_required"){if(o?.allowInputRequired===!0)return d(iN(b));let C={codec:e,request:t,resultSchema:r,options:o,flowStartedAt:c,retry:(q,x)=>this._requestWithSchemaViaCodec(e,q===void 0?{method:t.method}:{method:t.method,params:q},r,x)};return d(this._resolveNonCompleteResult(b,C))}let E=b.result;dn(r,E).then((C)=>{if(C.success)d(C.data);else f(new Se(Te.InvalidResult,`Invalid result for ${t.method}: ${C.error}`))},f)}),u=()=>v(o?.signal?.reason),o?.signal?.addEventListener("abort",u,{once:!0});let w=o?.timeout??j0,z=()=>v(new Se(Te.RequestTimeout,"Request timed out",{timeout:w}));this._setupTimeout(g,w,o?.maxTotalTimeout,z,o?.resetTimeoutOnProgress??!1),this._transport.send(y,{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i,headers:a,requestSignal:h?.signal}).catch((R)=>{this._progressHandlers.delete(g),f(R)})}).finally(()=>{if(u)o?.signal?.removeEventListener("abort",u);if(l!==void 0)this._responseHandlers.delete(l),this._cleanupTimeout(l)})}async notification(e,t){return this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,r){if(!this._transport)throw new Se(Te.NotConnected,"Not connected");if(em(t.method)&&!e.hasNotificationMethod(t.method))throw new Se(Te.MethodNotSupportedByProtocolVersion,`Notification '${t.method}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t.method,era:e.era});this.assertNotificationCapability(t.method);let o=this._envelopeOutbound({jsonrpc:"2.0",...t});if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!r?.relatedRequestId){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;this._transport?.send(o,r).catch((n)=>this._onerror(n))});return}await this._transport.send(o,r)}setRequestHandler(e,t,r){this.assertRequestHandlerCapability(e);let o;if(typeof t==="function"){if(!Qf(e))throw TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);o=(n,s)=>{let i=this._negotiatedWireCodec(),a=i.validateRequest(e,n);if(!a.ok&&a.reason==="not-in-era")a=i.validateInputRequest(e,n);if(!a.ok){if(a.reason==="not-in-era")throw new le(Y.InternalError,`No wire schema for ${e} in the resolved era`);throw Error(a.message)}return Promise.resolve(t(a.value,s))}}else if(r)o=async(n,s)=>{let i=await dn(t.params,{...n.params});if(!i.success)throw new le(Y.InvalidParams,`Invalid params for ${e}: ${i.error}`);return r(i.data,s)};else throw TypeError("setRequestHandler: handler is required");this._requestHandlers.set(e,this._wrapHandler(e,o))}_wrapHandler(e,t){return t}_outboundServerInfo(){}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,r){if(typeof t==="function"){if(!em(e))throw TypeError(`'${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(e,(o,n)=>{let s=n.validateNotification(e,o);if(!s.ok){if(s.reason==="not-in-era")throw new le(Y.InternalError,`No wire schema for ${e} in the resolved era`);throw Error(s.message)}return Promise.resolve(t(s.value))});return}if(!r)throw TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(e,async(o)=>{let n=await dn(t.params,{...o.params});if(!n.success)throw new le(Y.InvalidParams,`Invalid params for notification ${e}: ${n.error}`);await r(n.data,o)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function ra(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function Rm(e,t){let r={...e};for(let o in t){let n=o,s=t[n];if(s===void 0)continue;let i=r[n];r[n]=ra(i)&&ra(s)?{...i,...s}:s}return r}function c0(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function sN(e){let t={},r=[];if(!c0(e))return{accepted:t,droppedKeys:r};for(let[o,n]of Object.entries(e)){if(!c0(n)||"method"in n||"result"in n){r.push(o);continue}t[o]=n}return{accepted:t,droppedKeys:r}}function iN(e){return{resultType:"input_required",inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState}}}/*!
47
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of e.seen.entries()){let a=i[1];if(t===i[0]){s(i);continue}if(e.external){let u=e.external.registry.get(i[0])?.id;if(t!==i[0]&&u){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(a.cycle){s(i);continue}if(a.count>1){if(e.reused==="ref"){s(i);continue}}}}function xi(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=(i)=>{let a=e.seen.get(i);if(a.ref===null)return;let c=a.def??a.schema,u={...c},l=a.ref;if(a.ref=null,l){n(l);let p=e.seen.get(l),m=p.schema;if(m.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))c.allOf=c.allOf??[],c.allOf.push(m);else Object.assign(c,m);if(Object.assign(c,u),i._zod.parent===l)for(let g in c){if(g==="$ref"||g==="allOf")continue;if(!(g in u))delete c[g]}if(m.$ref&&p.def)for(let g in c){if(g==="$ref"||g==="allOf")continue;if(g in p.def&&JSON.stringify(c[g])===JSON.stringify(p.def[g]))delete c[g]}}let d=i._zod.parent;if(d&&d!==l){n(d);let p=e.seen.get(d);if(p?.schema.$ref){if(c.$ref=p.schema.$ref,p.def)for(let m in c){if(m==="$ref"||m==="allOf")continue;if(m in p.def&&JSON.stringify(c[m])===JSON.stringify(p.def[m]))delete c[m]}}}e.override({zodSchema:i,jsonSchema:c,path:a.path??[]})};for(let i of[...e.seen.entries()].reverse())n(i[0]);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 i=e.external.registry.get(t)?.id;if(!i)throw Error("Schema is missing an `id` property");o.$id=e.external.uri(i)}Object.assign(o,r.def??r.schema);let s=e.external?.defs??{};for(let i of e.seen.entries()){let a=i[1];if(a.def&&a.defId)s[a.defId]=a.def}if(e.external);else if(Object.keys(s).length>0)if(e.target==="draft-2020-12")o.$defs=s;else o.definitions=s;try{let i=JSON.parse(JSON.stringify(o));return Object.defineProperty(i,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ii(t,"input",e.processors),output:Ii(t,"output",e.processors)}},enumerable:!1,writable:!1}),i}catch(i){throw Error("Error converting schema to JSON.")}}function Nt(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 Nt(n.element,r);if(n.type==="set")return Nt(n.valueType,r);if(n.type==="lazy")return Nt(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return Nt(n.innerType,r);if(n.type==="intersection")return Nt(n.left,r)||Nt(n.right,r);if(n.type==="record"||n.type==="map")return Nt(n.keyType,r)||Nt(n.valueType,r);if(n.type==="pipe")return Nt(n.in,r)||Nt(n.out,r);if(n.type==="object"){for(let o in n.shape)if(Nt(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(Nt(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(Nt(o,r))return!0;if(n.rest&&Nt(n.rest,r))return!0;return!1}return!1}var wS=(e,t={})=>(r)=>{let n=ki({...r,processors:t});return Ve(e,n),Oi(n,e),xi(n,e)},Ii=(e,t,r={})=>(n)=>{let{libraryOptions:o,target:s}=n??{},i=ki({...o??{},target:s,io:t,processors:r});return Ve(e,i),Oi(i,e),xi(i,e)};var Ux={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},mf=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:s,maximum:i,format:a,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof s==="number")o.minLength=s;if(typeof i==="number")o.maxLength=i;if(a){if(o.format=Ux[a]??a,o.format==="")delete o.format;if(a==="time")delete o.format}if(u)o.contentEncoding=u;if(c&&c.size>0){let l=[...c];if(l.length===1)o.pattern=l[0].source;else if(l.length>1)o.allOf=[...l.map((d)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))]}},hf=(e,t,r,n)=>{let o=r,{minimum:s,maximum:i,format:a,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=e._zod.bag;if(typeof a==="string"&&a.includes("int"))o.type="integer";else o.type="number";if(typeof l==="number")if(t.target==="draft-04"||t.target==="openapi-3.0")o.minimum=l,o.exclusiveMinimum=!0;else o.exclusiveMinimum=l;if(typeof s==="number"){if(o.minimum=s,typeof l==="number"&&t.target!=="draft-04")if(l>=s)delete o.minimum;else delete o.exclusiveMinimum}if(typeof u==="number")if(t.target==="draft-04"||t.target==="openapi-3.0")o.maximum=u,o.exclusiveMaximum=!0;else o.exclusiveMaximum=u;if(typeof i==="number"){if(o.maximum=i,typeof u==="number"&&t.target!=="draft-04")if(u<=i)delete o.maximum;else delete o.exclusiveMaximum}if(typeof c==="number")o.multipleOf=c},gf=(e,t,r,n)=>{r.type="boolean"},ES=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},zS=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema")},yf=(e,t,r,n)=>{if(t.target==="openapi-3.0")r.type="string",r.nullable=!0,r.enum=[null];else r.type="null"},PS=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema")},TS=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema")},_f=(e,t,r,n)=>{r.not={}},vf=(e,t,r,n)=>{},Sf=(e,t,r,n)=>{},IS=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema")},bf=(e,t,r,n)=>{let o=e._zod.def,s=yc(o.entries);if(s.every((i)=>typeof i==="number"))r.type="number";if(s.every((i)=>typeof i==="string"))r.type="string";r.enum=s},$f=(e,t,r,n)=>{let o=e._zod.def,s=[];for(let i of o.values)if(i===void 0){if(t.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof i==="bigint")if(t.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else 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}},kS=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema")},OS=(e,t,r,n)=>{let o=r,s=e._zod.pattern;if(!s)throw Error("Pattern not found in template literal");o.type="string",o.pattern=s.source},xS=(e,t,r,n)=>{let o=r,s={type:"string",format:"binary",contentEncoding:"binary"},{minimum:i,maximum:a,mime:c}=e._zod.bag;if(i!==void 0)s.minLength=i;if(a!==void 0)s.maxLength=a;if(c)if(c.length===1)s.contentMediaType=c[0],Object.assign(o,s);else Object.assign(o,s),o.anyOf=c.map((u)=>({contentMediaType:u}));else Object.assign(o,s)},CS=(e,t,r,n)=>{r.type="boolean"},wf=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")},AS=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Function types cannot be represented in JSON Schema")},Rf=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")},NS=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema")},jS=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema")},Ef=(e,t,r,n)=>{let o=r,s=e._zod.def,{minimum:i,maximum:a}=e._zod.bag;if(typeof i==="number")o.minItems=i;if(typeof a==="number")o.maxItems=a;o.type="array",o.items=Ve(s.element,t,{...n,path:[...n.path,"items"]})},zf=(e,t,r,n)=>{let o=r,s=e._zod.def;o.type="object",o.properties={};let i=s.shape;for(let u in i)o.properties[u]=Ve(i[u],t,{...n,path:[...n.path,"properties",u]});let a=new Set(Object.keys(i)),c=new Set([...a].filter((u)=>{let l=s.shape[u]._zod;if(t.io==="input")return l.optin===void 0;else return l.optout===void 0}));if(c.size>0)o.required=Array.from(c);if(s.catchall?._zod.def.type==="never")o.additionalProperties=!1;else if(!s.catchall){if(t.io==="output")o.additionalProperties=!1}else if(s.catchall)o.additionalProperties=Ve(s.catchall,t,{...n,path:[...n.path,"additionalProperties"]})},Pf=(e,t,r,n)=>{let o=e._zod.def,s=o.inclusive===!1,i=o.options.map((a,c)=>Ve(a,t,{...n,path:[...n.path,s?"oneOf":"anyOf",c]}));if(s)r.oneOf=i;else r.anyOf=i},Tf=(e,t,r,n)=>{let o=e._zod.def,s=Ve(o.left,t,{...n,path:[...n.path,"allOf",0]}),i=Ve(o.right,t,{...n,path:[...n.path,"allOf",1]}),a=(u)=>("allOf"in u)&&Object.keys(u).length===1,c=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];r.allOf=c},qS=(e,t,r,n)=>{let o=r,s=e._zod.def;o.type="array";let i=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"?"items":t.target==="openapi-3.0"?"items":"additionalItems",c=s.items.map((p,m)=>Ve(p,t,{...n,path:[...n.path,i,m]})),u=s.rest?Ve(s.rest,t,{...n,path:[...n.path,a,...t.target==="openapi-3.0"?[s.items.length]:[]]}):null;if(t.target==="draft-2020-12"){if(o.prefixItems=c,u)o.items=u}else if(t.target==="openapi-3.0"){if(o.items={anyOf:c},u)o.items.anyOf.push(u);if(o.minItems=c.length,!u)o.maxItems=c.length}else if(o.items=c,u)o.additionalItems=u;let{minimum:l,maximum:d}=e._zod.bag;if(typeof l==="number")o.minItems=l;if(typeof d==="number")o.maxItems=d},If=(e,t,r,n)=>{let o=r,s=e._zod.def;o.type="object";let i=s.keyType,c=i._zod.bag?.patterns;if(s.mode==="loose"&&c&&c.size>0){let l=Ve(s.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let d of c)o.patternProperties[d.source]=l}else{if(t.target==="draft-07"||t.target==="draft-2020-12")o.propertyNames=Ve(s.keyType,t,{...n,path:[...n.path,"propertyNames"]});o.additionalProperties=Ve(s.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let u=i._zod.values;if(u){let l=[...u].filter((d)=>typeof d==="string"||typeof d==="number");if(l.length>0)o.required=l}},kf=(e,t,r,n)=>{let o=e._zod.def,s=Ve(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"}]},Of=(e,t,r,n)=>{let o=e._zod.def;Ve(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType},xf=(e,t,r,n)=>{let o=e._zod.def;Ve(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},Cf=(e,t,r,n)=>{let o=e._zod.def;Ve(o.innerType,t,n);let s=t.seen.get(e);if(s.ref=o.innerType,t.io==="input")r._prefault=JSON.parse(JSON.stringify(o.defaultValue))},Af=(e,t,r,n)=>{let o=e._zod.def;Ve(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType;let i;try{i=o.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}r.default=i},Nf=(e,t,r,n)=>{let o=e._zod.def,s=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;Ve(s,t,n);let i=t.seen.get(e);i.ref=s},jf=(e,t,r,n)=>{let o=e._zod.def;Ve(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType,r.readOnly=!0},MS=(e,t,r,n)=>{let o=e._zod.def;Ve(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType},xc=(e,t,r,n)=>{let o=e._zod.def;Ve(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType},qf=(e,t,r,n)=>{let o=e._zod.innerType;Ve(o,t,n);let s=t.seen.get(e);s.ref=o},RS={string:mf,number:hf,boolean:gf,bigint:ES,symbol:zS,null:yf,undefined:PS,void:TS,never:_f,any:vf,unknown:Sf,date:IS,enum:bf,literal:$f,nan:kS,template_literal:OS,file:xS,success:CS,custom:wf,function:AS,transform:Rf,map:NS,set:jS,array:Ef,object:zf,union:Pf,intersection:Tf,tuple:qS,record:If,nullable:kf,nonoptional:Of,default:xf,prefault:Cf,catch:Af,pipe:Nf,readonly:jf,promise:MS,optional:xc,lazy:qf};function Cc(e,t){if("_idmap"in e){let n=e,o=ki({...t,processors:RS}),s={};for(let c of n._idmap.entries()){let[u,l]=c;Ve(l,o)}let i={},a={registry:n,uri:t?.uri,defs:s};o.external=a;for(let c of n._idmap.entries()){let[u,l]=c;Oi(o,l),i[u]=xi(o,l)}if(Object.keys(s).length>0){let c=o.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[c]:s}}return{schemas:i}}let r=ki({...t,processors:RS});return Ve(e,r),Oi(r,e),xi(r,e)}var Bx=U("ZodISODateTime",(e,t)=>{ev.init(e,t),Ke.init(e,t)});function Go(e){return cS(Bx,e)}var Wx=U("ZodISODate",(e,t)=>{tv.init(e,t),Ke.init(e,t)});function Mf(e){return uS(Wx,e)}var Yx=U("ZodISOTime",(e,t)=>{rv.init(e,t),Ke.init(e,t)});function LS(e){return lS(Yx,e)}var Xx=U("ZodISODuration",(e,t)=>{nv.init(e,t),Ke.init(e,t)});function DS(e){return dS(Xx,e)}var FS=(e,t)=>{bc.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:(r)=>Up(e,r)},flatten:{value:(r)=>Dp(e,r)},addIssue:{value:(r)=>{e.issues.push(r),e.message=JSON.stringify(e.issues,bi,2)}},addIssues:{value:(r)=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,bi,2)}},isEmpty:{get(){return e.issues.length===0}}})},wK=U("ZodError",FS),Xt=U("ZodError",FS,{Parent:Error});var VS=$c(Xt),HS=wc(Xt),Nc=wi(Xt),ZS=Ri(Xt),GS=Ly(Xt),JS=Dy(Xt),KS=Uy(Xt),BS=Fy(Xt),WS=Vy(Xt),YS=Hy(Xt),XS=Zy(Xt),QS=Gy(Xt);var Ze=U("ZodType",(e,t)=>(Fe.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Ii(e,"input"),output:Ii(e,"output")}}),e.toJSONSchema=wS(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(on(t,{checks:[...t.checks??[],...r.map((n)=>typeof n==="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0}),e.with=e.check,e.clone=(r,n)=>mr(e,r,n),e.brand=()=>e,e.register=(r,n)=>(r.add(e,n),e),e.parse=(r,n)=>VS(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>Nc(e,r,n),e.parseAsync=async(r,n)=>HS(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>ZS(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>GS(e,r,n),e.decode=(r,n)=>JS(e,r,n),e.encodeAsync=async(r,n)=>KS(e,r,n),e.decodeAsync=async(r,n)=>BS(e,r,n),e.safeEncode=(r,n)=>WS(e,r,n),e.safeDecode=(r,n)=>YS(e,r,n),e.safeEncodeAsync=async(r,n)=>XS(e,r,n),e.safeDecodeAsync=async(r,n)=>QS(e,r,n),e.refine=(r,n)=>e.check(FC(r,n)),e.superRefine=(r)=>e.check(VC(r)),e.overwrite=(r)=>e.check(un(r)),e.optional=()=>ae(e),e.exactOptional=()=>TC(e),e.nullable=()=>r0(e),e.nullish=()=>ae(r0(e)),e.nonoptional=(r)=>AC(e,r),e.array=()=>A(e),e.or=(r)=>te([e,r]),e.and=(r)=>Zr(e,r),e.transform=(r)=>Df(e,p0(r)),e.default=(r)=>OC(e,r),e.prefault=(r)=>CC(e,r),e.catch=(r)=>jC(e,r),e.pipe=(r)=>Df(e,r),e.readonly=()=>LC(e),e.describe=(r)=>{let n=e.clone();return cn.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return cn.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return cn.get(e);let n=e.clone();return cn.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=(r)=>r(e),e)),n0=U("_ZodString",(e,t)=>{zc.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,o,s)=>mf(e,n,o,s);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(rf(...n)),e.includes=(...n)=>e.check(sf(...n)),e.startsWith=(...n)=>e.check(af(...n)),e.endsWith=(...n)=>e.check(cf(...n)),e.min=(...n)=>e.check(Ho(...n)),e.max=(...n)=>e.check(kc(...n)),e.length=(...n)=>e.check(Oc(...n)),e.nonempty=(...n)=>e.check(Ho(1,...n)),e.lowercase=(n)=>e.check(nf(n)),e.uppercase=(n)=>e.check(of(n)),e.trim=()=>e.check(lf()),e.normalize=(...n)=>e.check(uf(...n)),e.toLowerCase=()=>e.check(df()),e.toUpperCase=()=>e.check(pf()),e.slugify=()=>e.check(ff())}),o0=U("ZodString",(e,t)=>{zc.init(e,t),n0.init(e,t),e.email=(r)=>e.check(Qp(s0,r)),e.url=(r)=>e.check(tf(a0,r)),e.jwt=(r)=>e.check(aS(mC,r)),e.emoji=(r)=>e.check(Jv(eC,r)),e.guid=(r)=>e.check(ef(e0,r)),e.uuid=(r)=>e.check(Vv(jc,r)),e.uuidv4=(r)=>e.check(Hv(jc,r)),e.uuidv6=(r)=>e.check(Zv(jc,r)),e.uuidv7=(r)=>e.check(Gv(jc,r)),e.nanoid=(r)=>e.check(Kv(tC,r)),e.guid=(r)=>e.check(ef(e0,r)),e.cuid=(r)=>e.check(Bv(rC,r)),e.cuid2=(r)=>e.check(Wv(nC,r)),e.ulid=(r)=>e.check(Yv(oC,r)),e.base64=(r)=>e.check(oS(dC,r)),e.base64url=(r)=>e.check(sS(pC,r)),e.xid=(r)=>e.check(Xv(sC,r)),e.ksuid=(r)=>e.check(Qv(iC,r)),e.ipv4=(r)=>e.check(eS(aC,r)),e.ipv6=(r)=>e.check(tS(cC,r)),e.cidrv4=(r)=>e.check(rS(uC,r)),e.cidrv6=(r)=>e.check(nS(lC,r)),e.e164=(r)=>e.check(iS(fC,r)),e.datetime=(r)=>e.check(Go(r)),e.date=(r)=>e.check(Mf(r)),e.time=(r)=>e.check(LS(r)),e.duration=(r)=>e.check(DS(r))});function f(e){return Fv(o0,e)}var Ke=U("ZodStringFormat",(e,t)=>{Ge.init(e,t),n0.init(e,t)}),s0=U("ZodEmail",(e,t)=>{Z_.init(e,t),Ke.init(e,t)});function i0(e){return Qp(s0,e)}var e0=U("ZodGUID",(e,t)=>{V_.init(e,t),Ke.init(e,t)});var jc=U("ZodUUID",(e,t)=>{H_.init(e,t),Ke.init(e,t)});var a0=U("ZodURL",(e,t)=>{G_.init(e,t),Ke.init(e,t)});function qc(e){return tf(a0,e)}var eC=U("ZodEmoji",(e,t)=>{J_.init(e,t),Ke.init(e,t)});var tC=U("ZodNanoID",(e,t)=>{K_.init(e,t),Ke.init(e,t)});var rC=U("ZodCUID",(e,t)=>{B_.init(e,t),Ke.init(e,t)});var nC=U("ZodCUID2",(e,t)=>{W_.init(e,t),Ke.init(e,t)});var oC=U("ZodULID",(e,t)=>{Y_.init(e,t),Ke.init(e,t)});var sC=U("ZodXID",(e,t)=>{X_.init(e,t),Ke.init(e,t)});var iC=U("ZodKSUID",(e,t)=>{Q_.init(e,t),Ke.init(e,t)});var aC=U("ZodIPv4",(e,t)=>{ov.init(e,t),Ke.init(e,t)});var cC=U("ZodIPv6",(e,t)=>{sv.init(e,t),Ke.init(e,t)});var uC=U("ZodCIDRv4",(e,t)=>{iv.init(e,t),Ke.init(e,t)});var lC=U("ZodCIDRv6",(e,t)=>{av.init(e,t),Ke.init(e,t)});var dC=U("ZodBase64",(e,t)=>{uv.init(e,t),Ke.init(e,t)});var pC=U("ZodBase64URL",(e,t)=>{lv.init(e,t),Ke.init(e,t)});var fC=U("ZodE164",(e,t)=>{dv.init(e,t),Ke.init(e,t)});var mC=U("ZodJWT",(e,t)=>{pv.init(e,t),Ke.init(e,t)});var Mc=U("ZodNumber",(e,t)=>{Bp.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,o,s)=>hf(e,n,o,s),e.gt=(n,o)=>e.check(Tc(n,o)),e.gte=(n,o)=>e.check(Ti(n,o)),e.min=(n,o)=>e.check(Ti(n,o)),e.lt=(n,o)=>e.check(Pc(n,o)),e.lte=(n,o)=>e.check(Pi(n,o)),e.max=(n,o)=>e.check(Pi(n,o)),e.int=(n)=>e.check(t0(n)),e.safe=(n)=>e.check(t0(n)),e.positive=(n)=>e.check(Tc(0,n)),e.nonnegative=(n)=>e.check(Ti(0,n)),e.negative=(n)=>e.check(Pc(0,n)),e.nonpositive=(n)=>e.check(Pi(0,n)),e.multipleOf=(n,o)=>e.check(Ic(n,o)),e.step=(n,o)=>e.check(Ic(n,o)),e.finite=()=>e;let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??0.5),e.isFinite=!0,e.format=r.format??null});function G(e){return pS(Mc,e)}var hC=U("ZodNumberFormat",(e,t)=>{fv.init(e,t),Mc.init(e,t)});function t0(e){return mS(hC,e)}var c0=U("ZodBoolean",(e,t)=>{mv.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>gf(e,r,n,o)});function Q(e){return hS(c0,e)}var gC=U("ZodNull",(e,t)=>{hv.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>yf(e,r,n,o)});function co(e){return gS(gC,e)}var yC=U("ZodAny",(e,t)=>{gv.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>vf(e,r,n,o)});function u0(){return yS(yC)}var _C=U("ZodUnknown",(e,t)=>{yv.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Sf(e,r,n,o)});function ce(){return _S(_C)}var vC=U("ZodNever",(e,t)=>{_v.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_f(e,r,n,o)});function SC(e){return vS(vC,e)}var bC=U("ZodArray",(e,t)=>{vv.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ef(e,r,n,o),e.element=t.element,e.min=(r,n)=>e.check(Ho(r,n)),e.nonempty=(r)=>e.check(Ho(1,r)),e.max=(r,n)=>e.check(kc(r,n)),e.length=(r,n)=>e.check(Oc(r,n)),e.unwrap=()=>e.element});function A(e,t){return SS(bC,e,t)}var l0=U("ZodObject",(e,t)=>{$v.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>zf(e,r,n,o),xe(e,"shape",()=>t.shape),e.keyof=()=>le(Object.keys(e._zod.def.shape)),e.catchall=(r)=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ce()}),e.loose=()=>e.clone({...e._zod.def,catchall:ce()}),e.strict=()=>e.clone({...e._zod.def,catchall:SC()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=(r)=>Px(e,r),e.safeExtend=(r)=>Tx(e,r),e.merge=(r)=>Ix(e,r),e.pick=(r)=>Ex(e,r),e.omit=(r)=>zx(e,r),e.partial=(...r)=>kx(f0,e,r[0]),e.required=(...r)=>Ox(m0,e,r[0])});function T(e,t){let r={type:"object",shape:e??{},...ie(t)};return new l0(r)}function pe(e,t){return new l0({type:"object",shape:e,catchall:ce(),...ie(t)})}var d0=U("ZodUnion",(e,t)=>{Wp.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Pf(e,r,n,o),e.options=t.options});function te(e,t){return new d0({type:"union",options:e,...ie(t)})}var $C=U("ZodDiscriminatedUnion",(e,t)=>{d0.init(e,t),wv.init(e,t)});function Jo(e,t,r){return new $C({type:"union",options:t,discriminator:e,...ie(r)})}var wC=U("ZodIntersection",(e,t)=>{Rv.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Tf(e,r,n,o)});function Zr(e,t){return new wC({type:"intersection",left:e,right:t})}var RC=U("ZodRecord",(e,t)=>{Ev.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>If(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function ee(e,t,r){return new RC({type:"record",keyType:e,valueType:t,...ie(r)})}var Lf=U("ZodEnum",(e,t)=>{zv.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,o,s)=>bf(e,n,o,s),e.enum=t.entries,e.options=Object.values(t.entries);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 Lf({...t,checks:[],...ie(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 Lf({...t,checks:[],...ie(o),entries:s})}});function le(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((n)=>[n,n])):e;return new Lf({type:"enum",entries:r,...ie(t)})}var EC=U("ZodLiteral",(e,t)=>{Pv.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$f(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 N(e,t){return new EC({type:"literal",values:Array.isArray(e)?e:[e],...ie(t)})}var zC=U("ZodTransform",(e,t)=>{Tv.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Rf(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Si(e.constructor.name);r.addIssue=(s)=>{if(typeof s==="string")r.issues.push(ao(s,r.value,t));else{let i=s;if(i.fatal)i.continue=!1;i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),r.issues.push(ao(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 p0(e){return new zC({type:"transform",transform:e})}var f0=U("ZodOptional",(e,t)=>{Yp.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ae(e){return new f0({type:"optional",innerType:e})}var PC=U("ZodExactOptional",(e,t)=>{Iv.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function TC(e){return new PC({type:"optional",innerType:e})}var IC=U("ZodNullable",(e,t)=>{kv.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>kf(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function r0(e){return new IC({type:"nullable",innerType:e})}var kC=U("ZodDefault",(e,t)=>{Ov.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xf(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function OC(e,t){return new kC({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():qp(t)}})}var xC=U("ZodPrefault",(e,t)=>{xv.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Cf(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function CC(e,t){return new xC({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():qp(t)}})}var m0=U("ZodNonOptional",(e,t)=>{Cv.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Of(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function AC(e,t){return new m0({type:"nonoptional",innerType:e,...ie(t)})}var NC=U("ZodCatch",(e,t)=>{Av.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Af(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function jC(e,t){return new NC({type:"catch",innerType:e,catchValue:typeof t==="function"?t:()=>t})}var qC=U("ZodPipe",(e,t)=>{Nv.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Nf(e,r,n,o),e.in=t.in,e.out=t.out});function Df(e,t){return new qC({type:"pipe",in:e,out:t})}var MC=U("ZodReadonly",(e,t)=>{jv.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>jf(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function LC(e){return new MC({type:"readonly",innerType:e})}var DC=U("ZodLazy",(e,t)=>{qv.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>qf(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});function Ci(e){return new DC({type:"lazy",getter:e})}var UC=U("ZodCustom",(e,t)=>{Mv.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wf(e,r,n,o)});function FC(e,t={}){return bS(UC,e,t)}function VC(e){return $S(e)}function uo(e,t){return Df(p0(e),t)}var g0={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 h0;(function(e){})(h0||(h0={}));function HC(e){return fS(Mc,e)}Yt(Xp());var po="2025-11-25";var Lc=[po,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Dc="io.modelcontextprotocol/related-task",Jr="io.modelcontextprotocol/protocolVersion",Ko="io.modelcontextprotocol/clientInfo",Er="io.modelcontextprotocol/serverInfo",Kr="io.modelcontextprotocol/clientCapabilities",fo="io.modelcontextprotocol/subscriptionId",dn="io.modelcontextprotocol/logLevel";var mo="2.0";var ln=Ci(()=>te([f(),G(),Q(),co(),ee(f(),ln),A(ln)])),Xe=ee(f(),ln),Ff=A(ln),Ai=te([f(),G().int()]),Ni=f(),Uc=T({ttl:G().optional()}),Fc=T({taskId:f()}),ji=pe({progressToken:Ai.optional(),[Dc]:Fc.optional()}),_t=T({_meta:ji.optional()}),ho=_t.extend({task:Uc.optional()}),Qe=T({method:f(),params:_t.loose().optional()}),Tt=T({_meta:ji.optional()}),It=T({method:f(),params:Tt.loose().optional()}),qi=pe({get[Er](){return Yo.optional().catch(void 0)}}),et=pe({_meta:qi.optional()}),pn=te([f(),G().int()]),Mi=T({jsonrpc:N(mo),id:pn,...Qe.shape}).strict(),Li=T({jsonrpc:N(mo),...It.shape}).strict(),Bo=T({jsonrpc:N(mo),id:pn,result:et}).strict(),Wo=T({jsonrpc:N(mo),id:pn.optional(),error:T({code:G().int(),message:f(),data:ce().optional()})}).strict(),Di=te([Mi,Li,Bo,Wo]),Vf=te([Bo,Wo]),Ui=et.strict(),Vc=Tt.extend({requestId:pn.optional(),reason:f().optional()}),Fi=It.extend({method:N("notifications/cancelled"),params:Vc}),Hc=T({src:f(),mimeType:f().optional(),sizes:A(f()).optional(),theme:le(["light","dark"]).optional()}),fn=T({icons:A(Hc).optional()}),Gr=T({name:f(),title:f().optional()}),Yo=Gr.extend({...Gr.shape,...fn.shape,version:f(),websiteUrl:f().optional(),description:f().optional()}),GC=Zr(T({applyDefaults:Q().optional()}),Xe),JC=uo((e)=>{if(e&&typeof e==="object"&&!Array.isArray(e)&&Object.keys(e).length===0)return{form:{}};return e},Zr(T({form:GC.optional(),url:Xe.optional()}),Xe.optional())),Zc=pe({list:Xe.optional(),cancel:Xe.optional(),requests:pe({sampling:pe({createMessage:Xe.optional()}).optional(),elicitation:pe({create:Xe.optional()}).optional()}).optional()}),Gc=pe({list:Xe.optional(),cancel:Xe.optional(),requests:pe({tools:pe({call:Xe.optional()}).optional()}).optional()}),Jc=T({experimental:ee(f(),Xe).optional(),sampling:T({context:Xe.optional(),tools:Xe.optional()}).optional(),elicitation:JC.optional(),roots:T({listChanged:Q().optional()}).optional(),tasks:Zc.optional(),extensions:ee(f(),Xe).optional()}),Kc=_t.extend({protocolVersion:f(),capabilities:Jc,clientInfo:Yo}),Bc=Qe.extend({method:N("initialize"),params:Kc}),Vi=T({experimental:ee(f(),Xe).optional(),logging:Xe.optional(),completions:Xe.optional(),prompts:T({listChanged:Q().optional()}).optional(),resources:T({subscribe:Q().optional(),listChanged:Q().optional()}).optional(),tools:T({listChanged:Q().optional()}).optional(),tasks:Gc.optional(),extensions:ee(f(),Xe).optional()}),Wc=et.extend({protocolVersion:f(),capabilities:Vi,serverInfo:Yo,instructions:f().optional()}),Yc=It.extend({method:N("notifications/initialized"),params:Tt.optional()}),Xc=Qe.extend({method:N("server/discover"),params:_t.optional()}),Qc=et.extend({supportedVersions:A(f()),capabilities:Vi,instructions:f().optional()}),Hi=Qe.extend({method:N("ping"),params:_t.optional()}),eu=T({progress:G(),total:ae(G()),message:ae(f())}),tu=T({...Tt.shape,...eu.shape,progressToken:Ai}),Zi=It.extend({method:N("notifications/progress"),params:tu}),ru=_t.extend({cursor:Ni.optional()}),mn=Qe.extend({params:ru.optional()}),hn=et.extend({nextCursor:Ni.optional()}),Gi=T({uri:f(),mimeType:ae(f()),_meta:ee(f(),ce()).optional()}),Ji=Gi.extend({text:f()}),Hf=f().refine((e)=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Ki=Gi.extend({blob:Hf}),gn=le(["user","assistant"]),Br=T({audience:A(gn).optional(),priority:G().min(0).max(1).optional(),lastModified:Go({offset:!0}).optional()}),Bi=T({...Gr.shape,...fn.shape,uri:f(),description:ae(f()),mimeType:ae(f()),size:ae(G()),annotations:Br.optional(),_meta:ae(pe({}))}),nu=T({...Gr.shape,...fn.shape,uriTemplate:f(),description:ae(f()),mimeType:ae(f()),annotations:Br.optional(),_meta:ae(pe({}))}),ou=mn.extend({method:N("resources/list")}),su=hn.extend({resources:A(Bi)}),iu=mn.extend({method:N("resources/templates/list")}),au=hn.extend({resourceTemplates:A(nu)}),Xo=_t.extend({uri:f()}),cu=Xo,uu=Qe.extend({method:N("resources/read"),params:cu}),lu=et.extend({contents:A(te([Ji,Ki]))}),du=It.extend({method:N("notifications/resources/list_changed"),params:Tt.optional()}),pu=Xo,fu=Qe.extend({method:N("resources/subscribe"),params:pu}),mu=Xo,hu=Qe.extend({method:N("resources/unsubscribe"),params:mu}),Wi=T({toolsListChanged:Q().optional(),promptsListChanged:Q().optional(),resourcesListChanged:Q().optional(),resourceSubscriptions:A(f()).optional()}),gu=_t.extend({notifications:Wi}),yu=Qe.extend({method:N("subscriptions/listen"),params:gu}),_u=Tt.extend({notifications:Wi}),vu=It.extend({method:N("notifications/subscriptions/acknowledged"),params:_u}),Su=qi.extend({[fo]:pn}),bu=et.extend({_meta:Su}),$u=Tt.extend({uri:f()}),wu=It.extend({method:N("notifications/resources/updated"),params:$u}),Ru=T({name:f(),description:ae(f()),required:ae(Q())}),Eu=T({...Gr.shape,...fn.shape,description:ae(f()),arguments:ae(A(Ru)),_meta:ae(pe({}))}),zu=mn.extend({method:N("prompts/list")}),Pu=hn.extend({prompts:A(Eu)}),Tu=_t.extend({name:f(),arguments:ee(f(),f()).optional()}),Iu=Qe.extend({method:N("prompts/get"),params:Tu}),Qo=T({type:N("text"),text:f(),annotations:Br.optional(),_meta:ee(f(),ce()).optional()}),es=T({type:N("image"),data:Hf,mimeType:f(),annotations:Br.optional(),_meta:ee(f(),ce()).optional()}),ts=T({type:N("audio"),data:Hf,mimeType:f(),annotations:Br.optional(),_meta:ee(f(),ce()).optional()}),ku=T({type:N("tool_use"),name:f(),id:f(),input:ee(f(),ce()),_meta:ee(f(),ce()).optional()}),Ou=T({type:N("resource"),resource:te([Ji,Ki]),annotations:Br.optional(),_meta:ee(f(),ce()).optional()}),xu=Bi.extend({type:N("resource_link")}),rs=te([Qo,es,ts,xu,Ou]),Cu=T({role:gn,content:rs}),Au=et.extend({description:f().optional(),messages:A(Cu)}),Nu=It.extend({method:N("notifications/prompts/list_changed"),params:Tt.optional()}),ju=T({title:f().optional(),readOnlyHint:Q().optional(),destructiveHint:Q().optional(),idempotentHint:Q().optional(),openWorldHint:Q().optional()}),qu=T({taskSupport:le(["required","optional","forbidden"]).optional()}),Yi=T({...Gr.shape,...fn.shape,description:f().optional(),inputSchema:T({type:N("object"),properties:ee(f(),ln).optional(),required:A(f()).optional()}).catchall(ce()),outputSchema:pe({$schema:f().optional()}).optional(),annotations:ju.optional(),execution:qu.optional(),_meta:ee(f(),ce()).optional()}),Mu=mn.extend({method:N("tools/list")}),Lu=hn.extend({tools:A(Yi)}),Xi=et.extend({content:A(rs).default([]),structuredContent:ce().optional(),isError:Q().optional()}),Zf=Xi.or(et.extend({toolResult:ce()})),Du=ho.extend({name:f(),arguments:ee(f(),ce()).optional()}),Uu=Qe.extend({method:N("tools/call"),params:Du}),Fu=It.extend({method:N("notifications/tools/list_changed"),params:Tt.optional()}),Gf=T({autoRefresh:Q().default(!0),debounceMs:G().int().nonnegative().default(300)}),yn=le(["debug","info","notice","warning","error","critical","alert","emergency"]),Vu=_t.extend({level:yn}),Hu=Qe.extend({method:N("logging/setLevel"),params:Vu}),Zu=Tt.extend({level:yn,logger:f().optional(),data:ce()}),Gu=It.extend({method:N("notifications/message"),params:Zu}),Ju=T({name:f().optional()}),Ku=T({hints:A(Ju).optional(),costPriority:G().min(0).max(1).optional(),speedPriority:G().min(0).max(1).optional(),intelligencePriority:G().min(0).max(1).optional()}),Bu=T({mode:le(["auto","required","none"]).optional()}),Wu=T({type:N("tool_result"),toolUseId:f().describe("The unique identifier for the corresponding tool call."),content:A(rs),structuredContent:ce().optional(),isError:Q().optional(),_meta:ee(f(),ce()).optional()}),Yu=Jo("type",[Qo,es,ts]),lo=Jo("type",[Qo,es,ts,ku,Wu]),Xu=T({role:gn,content:te([lo,A(lo)]),_meta:ee(f(),ce()).optional()}),Qu=ho.extend({messages:A(Xu),modelPreferences:Ku.optional(),systemPrompt:f().optional(),includeContext:le(["none","thisServer","allServers"]).optional(),temperature:G().optional(),maxTokens:G().int(),stopSequences:A(f()).optional(),metadata:Xe.optional(),tools:A(Yi).optional(),toolChoice:Bu.optional()}),el=Qe.extend({method:N("sampling/createMessage"),params:Qu}),tl=et.extend({model:f(),stopReason:ae(le(["endTurn","stopSequence","maxTokens"]).or(f())),role:gn,content:Yu}),rl=et.extend({model:f(),stopReason:ae(le(["endTurn","stopSequence","maxTokens","toolUse"]).or(f())),role:gn,content:te([lo,A(lo)])}),Qi=T({type:N("boolean"),title:f().optional(),description:f().optional(),default:Q().optional()}),ns=T({type:N("string"),title:f().optional(),description:f().optional(),minLength:G().optional(),maxLength:G().optional(),format:le(["email","uri","date","date-time"]).optional(),default:f().optional()}),os=T({type:le(["number","integer"]),title:f().optional(),description:f().optional(),minimum:G().optional(),maximum:G().optional(),default:G().optional()}),ea=T({type:N("string"),title:f().optional(),description:f().optional(),enum:A(f()),default:f().optional()}),ta=T({type:N("string"),title:f().optional(),description:f().optional(),oneOf:A(T({const:f(),title:f()})),default:f().optional()}),ra=T({type:N("string"),title:f().optional(),description:f().optional(),enum:A(f()),enumNames:A(f()).optional(),default:f().optional()}),nl=te([ea,ta]),na=T({type:N("array"),title:f().optional(),description:f().optional(),minItems:G().optional(),maxItems:G().optional(),items:T({type:N("string"),enum:A(f())}),default:A(f()).optional()}),oa=T({type:N("array"),title:f().optional(),description:f().optional(),minItems:G().optional(),maxItems:G().optional(),items:T({anyOf:A(T({const:f(),title:f()}))}),default:A(f()).optional()}),ol=te([na,oa]),sl=te([ra,nl,ol]),sa=te([sl,Qi,ns,os]),ss=ho.extend({mode:N("form").optional(),message:f(),requestedSchema:T({type:N("object"),properties:ee(f(),sa),required:A(f()).optional()}).catchall(ce())}),il=ho.extend({mode:N("url"),message:f(),elicitationId:f(),url:f().url()}),al=te([ss,il]),cl=Qe.extend({method:N("elicitation/create"),params:al}),ul=Tt.extend({elicitationId:f()}),ll=It.extend({method:N("notifications/elicitation/complete"),params:ul}),dl=et.extend({action:le(["accept","decline","cancel"]),content:uo((e)=>e===null?void 0:e,ee(f(),te([f(),G(),Q(),A(f())])).optional())}),pl=T({type:N("ref/resource"),uri:f()}),fl=T({type:N("ref/prompt"),name:f()}),ml=_t.extend({ref:te([fl,pl]),argument:T({name:f(),value:f()}),context:T({arguments:ee(f(),f()).optional()}).optional()}),hl=Qe.extend({method:N("completion/complete"),params:ml}),gl=et.extend({completion:pe({values:A(f()).max(100),total:ae(G().int()),hasMore:ae(Q())})}),yl=T({uri:f().startsWith("file://"),name:f().optional(),_meta:ee(f(),ce()).optional()}),_l=Qe.extend({method:N("roots/list"),params:_t.optional()}),vl=et.extend({roots:A(yl)}),Sl=It.extend({method:N("notifications/roots/list_changed"),params:Tt.optional()}),Jf=pe({ttl:G().optional(),pollInterval:G().optional()}),bl=le(["working","input_required","completed","failed","cancelled"]),_n=T({taskId:f(),status:bl,ttl:te([G(),co()]),createdAt:f(),lastUpdatedAt:f(),pollInterval:ae(G()),statusMessage:ae(f())}),Kf=et.extend({task:_n}),$l=Tt.merge(_n),Bf=It.extend({method:N("notifications/tasks/status"),params:$l}),Wf=Qe.extend({method:N("tasks/get"),params:_t.extend({taskId:f()})}),Yf=et.merge(_n),Xf=Qe.extend({method:N("tasks/result"),params:_t.extend({taskId:f()})}),Qf=et.loose(),em=mn.extend({method:N("tasks/list")}),tm=hn.extend({tasks:A(_n)}),rm=Qe.extend({method:N("tasks/cancel"),params:_t.extend({taskId:f()})}),nm=et.merge(_n),om=te([Hi,Bc,Xc,hl,Hu,Iu,zu,ou,iu,uu,fu,hu,yu,Uu,Mu]),sm=te([Fi,Zi,Yc,Sl]),im=te([Ui,tl,rl,dl,vl]),am=te([Hi,el,cl,_l]),cm=te([Fi,Zi,Gu,wu,du,Fu,Nu,vu,ll]),um=te([Ui,Wc,Qc,gl,Au,Pu,su,au,lu,Xi,Lu,bu]),yt=qc().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:g0.custom,message:"URL must be parseable",fatal:!0}),xp}).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"}),lm=pe({resource:f().url(),authorization_servers:A(yt).optional(),jwks_uri:f().url().optional(),scopes_supported:A(f()).optional(),bearer_methods_supported:A(f()).optional(),resource_signing_alg_values_supported:A(f()).optional(),resource_name:f().optional(),resource_documentation:f().optional(),resource_policy_uri:f().url().optional(),resource_tos_uri:f().url().optional(),tls_client_certificate_bound_access_tokens:Q().optional(),authorization_details_types_supported:A(f()).optional(),dpop_signing_alg_values_supported:A(f()).optional(),dpop_bound_access_tokens_required:Q().optional()}),wl=pe({issuer:f(),authorization_endpoint:yt,token_endpoint:yt,registration_endpoint:yt.optional(),scopes_supported:A(f()).optional(),response_types_supported:A(f()),response_modes_supported:A(f()).optional(),grant_types_supported:A(f()).optional(),token_endpoint_auth_methods_supported:A(f()).optional(),token_endpoint_auth_signing_alg_values_supported:A(f()).optional(),service_documentation:yt.optional(),revocation_endpoint:yt.optional(),revocation_endpoint_auth_methods_supported:A(f()).optional(),revocation_endpoint_auth_signing_alg_values_supported:A(f()).optional(),introspection_endpoint:f().optional(),introspection_endpoint_auth_methods_supported:A(f()).optional(),introspection_endpoint_auth_signing_alg_values_supported:A(f()).optional(),code_challenge_methods_supported:A(f()).optional(),client_id_metadata_document_supported:Q().optional(),authorization_response_iss_parameter_supported:Q().optional().catch(void 0)}),Rl=pe({issuer:f(),authorization_endpoint:yt,token_endpoint:yt,userinfo_endpoint:yt.optional(),jwks_uri:yt,registration_endpoint:yt.optional(),scopes_supported:A(f()).optional(),response_types_supported:A(f()),response_modes_supported:A(f()).optional(),grant_types_supported:A(f()).optional(),acr_values_supported:A(f()).optional(),subject_types_supported:A(f()),id_token_signing_alg_values_supported:A(f()),id_token_encryption_alg_values_supported:A(f()).optional(),id_token_encryption_enc_values_supported:A(f()).optional(),userinfo_signing_alg_values_supported:A(f()).optional(),userinfo_encryption_alg_values_supported:A(f()).optional(),userinfo_encryption_enc_values_supported:A(f()).optional(),request_object_signing_alg_values_supported:A(f()).optional(),request_object_encryption_alg_values_supported:A(f()).optional(),request_object_encryption_enc_values_supported:A(f()).optional(),token_endpoint_auth_methods_supported:A(f()).optional(),token_endpoint_auth_signing_alg_values_supported:A(f()).optional(),display_values_supported:A(f()).optional(),claim_types_supported:A(f()).optional(),claims_supported:A(f()).optional(),service_documentation:f().optional(),claims_locales_supported:A(f()).optional(),ui_locales_supported:A(f()).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:yt.optional(),op_tos_uri:yt.optional(),client_id_metadata_document_supported:Q().optional(),authorization_response_iss_parameter_supported:Q().optional().catch(void 0)}),dm=T({...Rl.shape,...wl.pick({code_challenge_methods_supported:!0}).shape}),pm=T({access_token:f(),id_token:f().optional(),token_type:f(),expires_in:HC().optional(),scope:f().optional(),refresh_token:f().optional()}).strip(),fm=T({issued_token_type:N("urn:ietf:params:oauth:token-type:id-jag"),access_token:f(),token_type:f().optional(),expires_in:G().optional(),scope:f().optional()}).strip(),mm=T({error:f(),error_description:f().optional(),error_uri:f().optional()}),Uf=yt.optional().or(N("").transform(()=>{return})),El=T({redirect_uris:A(yt),token_endpoint_auth_method:f().optional(),grant_types:A(f()).optional(),response_types:A(f()).optional(),application_type:f().optional(),client_name:f().optional(),client_uri:yt.optional(),logo_uri:Uf,scope:f().optional(),contacts:A(f()).optional(),tos_uri:Uf,policy_uri:f().optional(),jwks_uri:yt.optional(),jwks:u0().optional(),software_id:f().optional(),software_version:f().optional(),software_statement:f().optional()}).strip(),zl=T({client_id:f(),client_secret:f().optional(),client_id_issued_at:G().optional(),client_secret_expires_at:G().optional()}).strip(),hm=El.merge(zl),gm=T({error:f(),error_description:f().optional()}).strip(),ym=T({token:f(),token_type_hint:f().optional()}).strip();var bm=Symbol.for("mcp.sdk.errorBrands");function Em(e,t){let r=new Set,n=t;while(typeof n==="function"){let o=n.mcpBrand;if(Object.prototype.hasOwnProperty.call(n,"mcpBrand")&&typeof o==="string")r.add(o);n=Object.getPrototypeOf(n)}if(r.size===0)return;Object.defineProperty(e,bm,{value:r,enumerable:!1,configurable:!0})}function as(e,t){try{if(typeof t==="object"&&t!==null&&Object.prototype.hasOwnProperty.call(e,"mcpBrand")&&typeof e.mcpBrand==="string"&&Object.prototype.hasOwnProperty.call(t,bm)){let r=t[bm];if(r&&typeof r.has==="function"&&r.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}var KC=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](t){return as(this,t)}static isInstance(t){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return as(this,t)}constructor(t,r,n){super(r);this.code=t,this.errorUri=n,this.name="OAuthError",Em(this,new.target)}toResponseObject(){let t={error:this.code,error_description:this.message};if(this.errorUri)t.error_uri=this.errorUri;return t}static fromResponse(t){return new e(t.error,t.error_description??t.error,t.error_uri)}},Te=function(e){return e.NotConnected="NOT_CONNECTED",e.AlreadyConnected="ALREADY_CONNECTED",e.NotInitialized="NOT_INITIALIZED",e.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",e.RequestTimeout="REQUEST_TIMEOUT",e.ConnectionClosed="CONNECTION_CLOSED",e.SendFailed="SEND_FAILED",e.InvalidResult="INVALID_RESULT",e.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",e.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",e.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",e.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",e.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",e.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",e.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",e.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",e.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",e.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",e.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",e}({}),Se=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](e){return as(this,e)}static isInstance(e){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return as(this,e)}constructor(e,t,r){super(t);this.code=e,this.data=r,this.name="SdkError",Em(this,new.target)}},BC=class extends Se{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor(e,t,r){super(e,t,r);this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};function P0(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function WC(e,t,r){return e==="elicitation"&&t==="form"&&r.form===void 0&&r.url===void 0}function D0(e){switch(e.method){case"elicitation/create":if(e.params?.mode==="url")return{elicitation:{url:{}}};return{elicitation:{form:{}}};case"sampling/createMessage":{let t=e.params;if(t!==void 0&&(t.tools!==void 0||t.toolChoice!==void 0))return{sampling:{tools:{}}};return{sampling:{}}}case"roots/list":return{roots:{}};default:return}}function Al(e,t){let r={};for(let[n,o]of Object.entries(e)){if(o===void 0)continue;let s=t===void 0?void 0:t[n];if(s===void 0){r[n]=o;continue}if(P0(o)&&P0(s)){let i={};for(let[a,c]of Object.entries(o))if(c!==void 0&&s[a]===void 0&&!WC(n,a,s))i[a]=c;if(Object.keys(i).length>0)r[n]=i}}return Object.keys(r).length>0?r:void 0}var U0="2026-07-28",Sn=[U0];function us(e){return e>=U0}function F0(e){return e.filter((t)=>!us(t))}function zm(e){return e.filter((t)=>us(t))}function V0(e){let t=e.structuredContent;if(t===void 0)return e;if(!(typeof t!=="object"||t===null||Array.isArray(t)))return e;if(e.content?.some((r)=>r.type==="text")??!1)return e;return{...e,content:[...e.content??[],{type:"text",text:JSON.stringify(t)}]}}var H0=["task","inputRequests","requestState"];function Pm(e){if(e===null||typeof e!=="object"||Array.isArray(e)||e.content!==void 0||H0.some((t)=>(t in e)))return e;return{...e,content:[]}}function YC(){let e=Ci(()=>te([f(),G(),Q(),co(),ee(f(),e),A(e)])),t=ee(f(),e),r=te([f(),G().int()]),n=f(),o=T({ttl:G().optional()}),s=T({taskId:f()}),i=pe({progressToken:r.optional(),"io.modelcontextprotocol/related-task":s.optional()}),a=T({_meta:i.optional()}),c=a.extend({task:o.optional()}),u=T({method:f(),params:a.loose().optional()}),l=T({_meta:i.optional()}),d=T({method:f(),params:l.loose().optional()}),p=pe({_meta:i.optional()}),m=te([f(),G().int()]),h=p.strict(),g=l.extend({requestId:m.optional(),reason:f().optional()}),_=d.extend({method:N("notifications/cancelled"),params:g}),y=T({src:f(),mimeType:f().optional(),sizes:A(f()).optional(),theme:le(["light","dark"]).optional()}),S=T({icons:A(y).optional()}),v=T({name:f(),title:f().optional()}),w=v.extend({...v.shape,...S.shape,version:f(),websiteUrl:f().optional(),description:f().optional()}),z=Zr(T({applyDefaults:Q().optional()}),t),R=uo((Pt)=>{if(Pt&&typeof Pt==="object"&&!Array.isArray(Pt)&&Object.keys(Pt).length===0)return{form:{}};return Pt},Zr(T({form:z.optional(),url:t.optional()}),t.optional())),b=pe({list:t.optional(),cancel:t.optional(),requests:pe({sampling:pe({createMessage:t.optional()}).optional(),elicitation:pe({create:t.optional()}).optional()}).optional()}),E=pe({list:t.optional(),cancel:t.optional(),requests:pe({tools:pe({call:t.optional()}).optional()}).optional()}),x=T({experimental:ee(f(),t).optional(),sampling:T({context:t.optional(),tools:t.optional()}).optional(),elicitation:R.optional(),roots:T({listChanged:Q().optional()}).optional(),tasks:b.optional(),extensions:ee(f(),t).optional()}),q=a.extend({protocolVersion:f(),capabilities:x,clientInfo:w}),C=u.extend({method:N("initialize"),params:q}),F=T({experimental:ee(f(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:T({listChanged:Q().optional()}).optional(),resources:T({subscribe:Q().optional(),listChanged:Q().optional()}).optional(),tools:T({listChanged:Q().optional()}).optional(),tasks:E.optional(),extensions:ee(f(),t).optional()}),B=p.extend({protocolVersion:f(),capabilities:F,serverInfo:w,instructions:f().optional()}),Z=d.extend({method:N("notifications/initialized"),params:l.optional()}),ge=u.extend({method:N("ping"),params:a.optional()}),Ie=T({progress:G(),total:ae(G()),message:ae(f())}),Ae=T({...l.shape,...Ie.shape,progressToken:r}),Ue=d.extend({method:N("notifications/progress"),params:Ae}),Pe=a.extend({cursor:n.optional()}),O=u.extend({params:Pe.optional()}),M=p.extend({nextCursor:n.optional()}),K=T({uri:f(),mimeType:ae(f()),_meta:ee(f(),ce()).optional()}),P=K.extend({text:f()}),k=f().refine((Pt)=>{try{return atob(Pt),!0}catch{return!1}},{message:"Invalid Base64 string"}),j=K.extend({blob:k}),W=le(["user","assistant"]),ue=T({audience:A(W).optional(),priority:G().min(0).max(1).optional(),lastModified:Go({offset:!0}).optional()}),Ee=T({...v.shape,...S.shape,uri:f(),description:ae(f()),mimeType:ae(f()),size:ae(G()),annotations:ue.optional(),_meta:ae(pe({}))}),ye=T({...v.shape,...S.shape,uriTemplate:f(),description:ae(f()),mimeType:ae(f()),annotations:ue.optional(),_meta:ae(pe({}))}),He=O.extend({method:N("resources/list")}),At=M.extend({resources:A(Ee)}),I=O.extend({method:N("resources/templates/list")}),L=M.extend({resourceTemplates:A(ye)}),H=a.extend({uri:f()}),fe=H,me=u.extend({method:N("resources/read"),params:fe}),we=p.extend({contents:A(te([P,j]))}),ct=d.extend({method:N("notifications/resources/list_changed"),params:l.optional()}),ft=H,Et=u.extend({method:N("resources/subscribe"),params:ft}),lt=H,We=u.extend({method:N("resources/unsubscribe"),params:lt}),er=l.extend({uri:f()}),gt=d.extend({method:N("notifications/resources/updated"),params:er}),Fr=T({name:f(),description:ae(f()),required:ae(Q())}),pr=T({...v.shape,...S.shape,description:ae(f()),arguments:ae(A(Fr)),_meta:ae(pe({}))}),Vr=O.extend({method:N("prompts/list")}),Qr=M.extend({prompts:A(pr)}),en=a.extend({name:f(),arguments:ee(f(),f()).optional()}),Kn=u.extend({method:N("prompts/get"),params:en}),Bn=T({type:N("text"),text:f(),annotations:ue.optional(),_meta:ee(f(),ce()).optional()}),Wn=T({type:N("image"),data:k,mimeType:f(),annotations:ue.optional(),_meta:ee(f(),ce()).optional()}),Yn=T({type:N("audio"),data:k,mimeType:f(),annotations:ue.optional(),_meta:ee(f(),ce()).optional()}),Js=T({type:N("tool_use"),name:f(),id:f(),input:ee(f(),ce()),_meta:ee(f(),ce()).optional()}),tn=T({type:N("resource"),resource:te([P,j]),annotations:ue.optional(),_meta:ee(f(),ce()).optional()}),Ks=Ee.extend({type:N("resource_link")}),tr=te([Bn,Wn,Yn,Ks,tn]),xo=T({role:W,content:tr}),Co=p.extend({description:f().optional(),messages:A(xo)}),Xn=d.extend({method:N("notifications/prompts/list_changed"),params:l.optional()}),Bs=T({title:f().optional(),readOnlyHint:Q().optional(),destructiveHint:Q().optional(),idempotentHint:Q().optional(),openWorldHint:Q().optional()}),Ao=T({taskSupport:le(["required","optional","forbidden"]).optional()}),Qn=T({...v.shape,...S.shape,description:f().optional(),inputSchema:T({type:N("object"),properties:ee(f(),e).optional(),required:A(f()).optional()}).catchall(ce()),outputSchema:T({type:N("object"),properties:ee(f(),e).optional(),required:A(f()).optional()}).catchall(ce()).optional(),annotations:Bs.optional(),execution:Ao.optional(),_meta:ee(f(),ce()).optional()}),No=O.extend({method:N("tools/list")}),jo=M.extend({tools:A(Qn)}),qo=p.extend({content:A(tr),structuredContent:ee(f(),ce()).optional(),isError:Q().optional()}),zt=c.extend({name:f(),arguments:ee(f(),ce()).optional()}),Ws=u.extend({method:N("tools/call"),params:zt}),Wa=d.extend({method:N("notifications/tools/list_changed"),params:l.optional()}),Mo=le(["debug","info","notice","warning","error","critical","alert","emergency"]),Ys=a.extend({level:Mo}),Xs=u.extend({method:N("logging/setLevel"),params:Ys}),Qs=l.extend({level:Mo,logger:f().optional(),data:ce()}),ei=d.extend({method:N("notifications/message"),params:Qs}),ti=T({name:f().optional()}),ri=T({hints:A(ti).optional(),costPriority:G().min(0).max(1).optional(),speedPriority:G().min(0).max(1).optional(),intelligencePriority:G().min(0).max(1).optional()}),ni=T({mode:le(["auto","required","none"]).optional()}),Ya=T({type:N("tool_result"),toolUseId:f().describe("The unique identifier for the corresponding tool call."),content:A(tr),structuredContent:T({}).loose().optional(),isError:Q().optional(),_meta:ee(f(),ce()).optional()}),oi=Jo("type",[Bn,Wn,Yn]),rn=Jo("type",[Bn,Wn,Yn,Js,Ya]),si=T({role:W,content:te([rn,A(rn)]),_meta:ee(f(),ce()).optional()}),ii=c.extend({messages:A(si),modelPreferences:ri.optional(),systemPrompt:f().optional(),includeContext:le(["none","thisServer","allServers"]).optional(),temperature:G().optional(),maxTokens:G().int(),stopSequences:A(f()).optional(),metadata:t.optional(),tools:A(Qn).optional(),toolChoice:ni.optional()}),ai=u.extend({method:N("sampling/createMessage"),params:ii}),ci=p.extend({model:f(),stopReason:ae(le(["endTurn","stopSequence","maxTokens"]).or(f())),role:W,content:oi}),ui=p.extend({model:f(),stopReason:ae(le(["endTurn","stopSequence","maxTokens","toolUse"]).or(f())),role:W,content:te([rn,A(rn)])}),li=T({type:N("boolean"),title:f().optional(),description:f().optional(),default:Q().optional()}),di=T({type:N("string"),title:f().optional(),description:f().optional(),minLength:G().optional(),maxLength:G().optional(),format:le(["email","uri","date","date-time"]).optional(),default:f().optional()}),pi=T({type:le(["number","integer"]),title:f().optional(),description:f().optional(),minimum:G().optional(),maximum:G().optional(),default:G().optional()}),fi=T({type:N("string"),title:f().optional(),description:f().optional(),enum:A(f()),default:f().optional()}),mi=T({type:N("string"),title:f().optional(),description:f().optional(),oneOf:A(T({const:f(),title:f()})),default:f().optional()}),hi=T({type:N("string"),title:f().optional(),description:f().optional(),enum:A(f()),enumNames:A(f()).optional(),default:f().optional()}),gi=te([fi,mi]),eo=T({type:N("array"),title:f().optional(),description:f().optional(),minItems:G().optional(),maxItems:G().optional(),items:T({type:N("string"),enum:A(f())}),default:A(f()).optional()}),to=T({type:N("array"),title:f().optional(),description:f().optional(),minItems:G().optional(),maxItems:G().optional(),items:T({anyOf:A(T({const:f(),title:f()}))}),default:A(f()).optional()}),Xa=te([eo,to]),Qa=te([hi,gi,Xa]),Bt=te([Qa,li,di,pi]),Wt=c.extend({mode:N("form").optional(),message:f(),requestedSchema:T({type:N("object"),properties:ee(f(),Bt),required:A(f()).optional()}).catchall(ce())}),yi=c.extend({mode:N("url"),message:f(),elicitationId:f(),url:f().url()}),fr=te([Wt,yi]),ec=u.extend({method:N("elicitation/create"),params:fr}),tc=l.extend({elicitationId:f()}),rc=d.extend({method:N("notifications/elicitation/complete"),params:tc}),nc=p.extend({action:le(["accept","decline","cancel"]),content:uo((Pt)=>Pt===null?void 0:Pt,ee(f(),te([f(),G(),Q(),A(f())])).optional())}),oc=T({type:N("ref/resource"),uri:f()}),sc=T({type:N("ref/prompt"),name:f()}),ic=a.extend({ref:te([sc,oc]),argument:T({name:f(),value:f()}),context:T({arguments:ee(f(),f()).optional()}).optional()}),_i=u.extend({method:N("completion/complete"),params:ic}),ac=p.extend({completion:pe({values:A(f()).max(100),total:ae(G().int()),hasMore:ae(Q())})}),cc=T({uri:f().startsWith("file://"),name:f().optional(),_meta:ee(f(),ce()).optional()}),Lo=u.extend({method:N("roots/list"),params:a.optional()}),vi=p.extend({roots:A(cc)}),uc=d.extend({method:N("notifications/roots/list_changed"),params:l.optional()}),lc=pe({ttl:G().optional(),pollInterval:G().optional()}),dc=le(["working","input_required","completed","failed","cancelled"]),nn=T({taskId:f(),status:dc,ttl:te([G(),co()]),createdAt:f(),lastUpdatedAt:f(),pollInterval:ae(G()),statusMessage:ae(f())}),Mt=p.extend({task:nn}),pc=l.merge(nn),ro=d.extend({method:N("notifications/tasks/status"),params:pc}),Do=u.extend({method:N("tasks/get"),params:a.extend({taskId:f()})}),Uo=p.merge(nn),Fo=u.extend({method:N("tasks/result"),params:a.extend({taskId:f()})}),kp=p.loose(),Lt=O.extend({method:N("tasks/list")}),ut=M.extend({tasks:A(nn)}),no=u.extend({method:N("tasks/cancel"),params:a.extend({taskId:f()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:r,CursorSchema:n,TaskMetadataSchema:o,RelatedTaskMetadataSchema:s,RequestMetaSchema:i,BaseRequestParamsSchema:a,TaskAugmentedRequestParamsSchema:c,RequestSchema:u,NotificationsParamsSchema:l,NotificationSchema:d,ResultSchema:p,RequestIdSchema:m,EmptyResultSchema:h,CancelledNotificationParamsSchema:g,CancelledNotificationSchema:_,IconSchema:y,IconsSchema:S,BaseMetadataSchema:v,ImplementationSchema:w,ClientTasksCapabilitySchema:b,ServerTasksCapabilitySchema:E,ClientCapabilitiesSchema:x,InitializeRequestParamsSchema:q,InitializeRequestSchema:C,ServerCapabilitiesSchema:F,InitializeResultSchema:B,InitializedNotificationSchema:Z,PingRequestSchema:ge,ProgressSchema:Ie,ProgressNotificationParamsSchema:Ae,ProgressNotificationSchema:Ue,PaginatedRequestParamsSchema:Pe,PaginatedRequestSchema:O,PaginatedResultSchema:M,ResourceContentsSchema:K,TextResourceContentsSchema:P,BlobResourceContentsSchema:j,RoleSchema:W,AnnotationsSchema:ue,ResourceSchema:Ee,ResourceTemplateSchema:ye,ListResourcesRequestSchema:He,ListResourcesResultSchema:At,ListResourceTemplatesRequestSchema:I,ListResourceTemplatesResultSchema:L,ResourceRequestParamsSchema:H,ReadResourceRequestParamsSchema:fe,ReadResourceRequestSchema:me,ReadResourceResultSchema:we,ResourceListChangedNotificationSchema:ct,SubscribeRequestParamsSchema:ft,SubscribeRequestSchema:Et,UnsubscribeRequestParamsSchema:lt,UnsubscribeRequestSchema:We,ResourceUpdatedNotificationParamsSchema:er,ResourceUpdatedNotificationSchema:gt,PromptArgumentSchema:Fr,PromptSchema:pr,ListPromptsRequestSchema:Vr,ListPromptsResultSchema:Qr,GetPromptRequestParamsSchema:en,GetPromptRequestSchema:Kn,TextContentSchema:Bn,ImageContentSchema:Wn,AudioContentSchema:Yn,ToolUseContentSchema:Js,EmbeddedResourceSchema:tn,ResourceLinkSchema:Ks,ContentBlockSchema:tr,PromptMessageSchema:xo,GetPromptResultSchema:Co,PromptListChangedNotificationSchema:Xn,ToolAnnotationsSchema:Bs,ToolExecutionSchema:Ao,ToolSchema:Qn,ListToolsRequestSchema:No,ListToolsResultSchema:jo,CallToolResultSchema:qo,CallToolRequestParamsSchema:zt,CallToolRequestSchema:Ws,ToolListChangedNotificationSchema:Wa,LoggingLevelSchema:Mo,SetLevelRequestParamsSchema:Ys,SetLevelRequestSchema:Xs,LoggingMessageNotificationParamsSchema:Qs,LoggingMessageNotificationSchema:ei,ModelHintSchema:ti,ModelPreferencesSchema:ri,ToolChoiceSchema:ni,ToolResultContentSchema:Ya,SamplingContentSchema:oi,SamplingMessageContentBlockSchema:rn,SamplingMessageSchema:si,CreateMessageRequestParamsSchema:ii,CreateMessageRequestSchema:ai,CreateMessageResultSchema:ci,CreateMessageResultWithToolsSchema:ui,BooleanSchemaSchema:li,StringSchemaSchema:di,NumberSchemaSchema:pi,UntitledSingleSelectEnumSchemaSchema:fi,TitledSingleSelectEnumSchemaSchema:mi,LegacyTitledEnumSchemaSchema:hi,SingleSelectEnumSchemaSchema:gi,UntitledMultiSelectEnumSchemaSchema:eo,TitledMultiSelectEnumSchemaSchema:to,MultiSelectEnumSchemaSchema:Xa,EnumSchemaSchema:Qa,PrimitiveSchemaDefinitionSchema:Bt,ElicitRequestFormParamsSchema:Wt,ElicitRequestURLParamsSchema:yi,ElicitRequestParamsSchema:fr,ElicitRequestSchema:ec,ElicitationCompleteNotificationParamsSchema:tc,ElicitationCompleteNotificationSchema:rc,ElicitResultSchema:nc,ResourceTemplateReferenceSchema:oc,PromptReferenceSchema:sc,CompleteRequestParamsSchema:ic,CompleteRequestSchema:_i,CompleteResultSchema:ac,RootSchema:cc,ListRootsRequestSchema:Lo,ListRootsResultSchema:vi,RootsListChangedNotificationSchema:uc,TaskCreationParamsSchema:lc,TaskStatusSchema:dc,TaskSchema:nn,CreateTaskResultSchema:Mt,TaskStatusNotificationParamsSchema:pc,TaskStatusNotificationSchema:ro,GetTaskRequestSchema:Do,GetTaskResultSchema:Uo,GetTaskPayloadRequestSchema:Fo,GetTaskPayloadResultSchema:kp,ListTasksRequestSchema:Lt,ListTasksResultSchema:ut,CancelTaskRequestSchema:no,CancelTaskResultSchema:p.merge(nn),ClientRequestSchema:te([ge,C,_i,Xs,Kn,Vr,He,I,me,Et,We,Ws,No,Do,Fo,Lt,no]),ClientNotificationSchema:te([_,Ue,Z,uc,ro]),ClientResultSchema:te([h,ci,ui,nc,vi,Uo,ut,Mt]),ServerRequestSchema:te([ge,ai,ec,Lo,Do,Fo,Lt,no]),ServerNotificationSchema:te([_,Ue,ei,gt,ct,Wa,Xn,ro,rc]),ServerResultSchema:te([h,B,ac,Co,Qr,At,L,we,qo,jo,Uo,ut,Mt]),CallToolResultWireSchema:ce().superRefine((Pt,cx)=>{if(typeof Pt!=="object"||Pt===null||Array.isArray(Pt)||Pt.content!==void 0)return;for(let by of H0)if(by in Pt){cx.addIssue({code:"custom",message:`content is required when the body carries '${by}' — another result family cannot default into an empty tools/call success`});return}}).transform(Pm).pipe(qo)}}var XC;function Z0(){return XC??=YC()}function G0(e){return e.type!=="object"}var QC=new Set(["const","enum","default","examples"]),eA=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function T0(e){return e!==void 0&&!(typeof e==="string"&&e.startsWith("#"))}function tA(e){let t=typeof e.$schema==="string"?e.$schema:void 0;if(T0(e.$id))return{...t!==void 0&&{$schema:t},type:"object",properties:{result:e},required:["result"]};let r=zy(e.$schema)&&e.$recursiveAnchor!==!0,n=(o,s)=>{if(Array.isArray(o))return o.map((c)=>n(c,!1));if(o===null||typeof o!=="object")return o;if(!s&&T0(o.$id))return o;let i={},a=!1;for(let[c,u]of Object.entries(o))if(s)i[c]=n(u,!1);else if((c==="$ref"||c==="$dynamicRef")&&typeof u==="string")i[c]=u==="#"?"#/properties/result":u.startsWith("#/")?`#/properties/result${u.slice(1)}`:u;else if(c==="$recursiveRef"&&u==="#"&&r)a=!0;else if(QC.has(c))i[c]=u;else if(eA.has(c))i[c]=n(u,!0);else i[c]=n(u,!1);if(a)if("$ref"in i)i.allOf=[...Array.isArray(i.allOf)?i.allOf:[],{$ref:"#/properties/result"}];else i.$ref="#/properties/result";return i};return{...t!==void 0&&{$schema:t},type:"object",properties:{result:n(e,!1)},required:["result"]}}var J0={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},K0={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},rA={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},Pl;function Tm(){if(Pl)return Pl;let e=Z0();return Pl={requestSchemas:{ping:e.PingRequestSchema,initialize:e.InitializeRequestSchema,"completion/complete":e.CompleteRequestSchema,"logging/setLevel":e.SetLevelRequestSchema,"prompts/get":e.GetPromptRequestSchema,"prompts/list":e.ListPromptsRequestSchema,"resources/list":e.ListResourcesRequestSchema,"resources/templates/list":e.ListResourceTemplatesRequestSchema,"resources/read":e.ReadResourceRequestSchema,"resources/subscribe":e.SubscribeRequestSchema,"resources/unsubscribe":e.UnsubscribeRequestSchema,"tools/call":e.CallToolRequestSchema,"tools/list":e.ListToolsRequestSchema,"tasks/get":e.GetTaskRequestSchema,"tasks/result":e.GetTaskPayloadRequestSchema,"tasks/list":e.ListTasksRequestSchema,"tasks/cancel":e.CancelTaskRequestSchema,"sampling/createMessage":e.CreateMessageRequestSchema,"elicitation/create":e.ElicitRequestSchema,"roots/list":e.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":e.CancelledNotificationSchema,"notifications/progress":e.ProgressNotificationSchema,"notifications/initialized":e.InitializedNotificationSchema,"notifications/roots/list_changed":e.RootsListChangedNotificationSchema,"notifications/tasks/status":e.TaskStatusNotificationSchema,"notifications/message":e.LoggingMessageNotificationSchema,"notifications/resources/updated":e.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":e.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":e.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":e.PromptListChangedNotificationSchema,"notifications/elicitation/complete":e.ElicitationCompleteNotificationSchema},resultSchemas:{ping:e.EmptyResultSchema,initialize:e.InitializeResultSchema,"completion/complete":e.CompleteResultSchema,"logging/setLevel":e.EmptyResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"resources/subscribe":e.EmptyResultSchema,"resources/unsubscribe":e.EmptyResultSchema,"tools/call":e.CallToolResultWireSchema,"tools/list":e.ListToolsResultSchema,"sampling/createMessage":e.CreateMessageResultWithToolsSchema,"elicitation/create":e.ElicitResultSchema,"roots/list":e.ListRootsResultSchema}},Pl}function B0(e){return Object.prototype.hasOwnProperty.call(J0,e)}function W0(e){return Object.prototype.hasOwnProperty.call(K0,e)}function nA(e){return Object.prototype.hasOwnProperty.call(rA,e)}function oA(e){return nA(e)?Tm().resultSchemas[e]:void 0}function sA(e){return B0(e)?Tm().requestSchemas[e]:void 0}function iA(e){return W0(e)?Tm().notificationSchemas[e]:void 0}var q3=Object.keys(J0),M3=Object.keys(K0);function $m(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function Tl(e,t){if(e===void 0)return{ok:!1,reason:"not-in-era"};let r=e.safeParse(t);return r.success?{ok:!0,value:r.data}:{ok:!1,reason:"invalid",message:String(r.error)}}var I0={ok:!1,reason:"not-in-era"};function k0(e){return $m(e)&&$m(e.outputSchema)&&G0(e.outputSchema)}function O0(e){return e}var Im={era:"2025-11-25",hasRequestMethod:B0,hasNotificationMethod:W0,validateRequest:(e,t)=>Tl(sA(e),t),validateResult:(e,t)=>Tl(oA(e),t),validateNotification:(e,t)=>Tl(iA(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>I0,validateInputResponse:()=>I0,samplingResultVariant:(e,t)=>{let r=Z0();return Tl(e?r.CreateMessageResultWithToolsSchema:r.CreateMessageResultSchema,t)},outboundEnvelope:(e)=>{return},validateEnvelopeMeta:(e)=>[],projectCallToolResult(e,t){let r=V0(e),n=r.structuredContent;if(n===void 0)return r;let o=typeof n!=="object"||n===null||Array.isArray(n),s=t!==void 0&&G0(t);if(!o&&!s)return r;return{...r,structuredContent:{result:n}}},decodeResult(e,t){if($m(t)&&"resultType"in t){let r={...t};return delete r.resultType,{kind:"complete",result:O0(r)}}return{kind:"complete",result:O0(t)}},encodeResult(e,t){if(e!=="tools/list")return t;let r=t.tools;if(!Array.isArray(r)||!r.some((n)=>k0(n)))return t;return{...t,tools:r.map((n)=>k0(n)?{...n,outputSchema:tA(n.outputSchema)}:n)}},encodeErrorCode:(e)=>e===-32002?-32602:e,checkInboundEnvelope:(e)=>{return}};function aA(){let e=Ci(()=>te([f(),G(),Q(),co(),ee(f(),e),A(e)])),t=ee(f(),e),r=te([f(),G().int()]),n=f(),o=te([f(),G().int()]),s=le(["user","assistant"]),i=le(["debug","info","notice","warning","error","critical","alert","emergency"]),a=f().refine((ut)=>{try{return atob(ut),!0}catch{return!1}},{message:"Invalid Base64 string"}),c=T({ttl:G().optional()}),u=T({taskId:f()}),l=pe({progressToken:r.optional(),"io.modelcontextprotocol/related-task":u.optional()}),d=T({_meta:l.optional()}),p=d.extend({task:c.optional()}),m=T({_meta:l.optional()}),h=T({method:f(),params:m.loose().optional()}),g=T({src:f(),mimeType:f().optional(),sizes:A(f()).optional(),theme:le(["light","dark"]).optional()}),_=T({icons:A(g).optional()}),y=T({name:f(),title:f().optional()}),S=y.extend({...y.shape,..._.shape,version:f(),websiteUrl:f().optional(),description:f().optional()}),v=Zr(T({applyDefaults:Q().optional()}),t),w=uo((ut)=>{if(ut&&typeof ut==="object"&&!Array.isArray(ut)&&Object.keys(ut).length===0)return{form:{}};return ut},Zr(T({form:v.optional(),url:t.optional()}),t.optional())),z=pe({list:t.optional(),cancel:t.optional(),requests:pe({sampling:pe({createMessage:t.optional()}).optional(),elicitation:pe({create:t.optional()}).optional()}).optional()}),R=pe({list:t.optional(),cancel:t.optional(),requests:pe({tools:pe({call:t.optional()}).optional()}).optional()}),b=T({experimental:ee(f(),t).optional(),sampling:T({context:t.optional(),tools:t.optional()}).optional(),elicitation:w.optional(),roots:T({listChanged:Q().optional()}).optional(),tasks:z.optional(),extensions:ee(f(),t).optional()}),E=T({experimental:ee(f(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:T({listChanged:Q().optional()}).optional(),resources:T({subscribe:Q().optional(),listChanged:Q().optional()}).optional(),tools:T({listChanged:Q().optional()}).optional(),tasks:R.optional(),extensions:ee(f(),t).optional()}),x=T({progress:G(),total:ae(G()),message:ae(f())}),q=T({...m.shape,...x.shape,progressToken:r}),C=h.extend({method:N("notifications/progress"),params:q}),F=m.extend({level:i,logger:f().optional(),data:ce()}),B=h.extend({method:N("notifications/message"),params:F}),Z=T({uri:f(),mimeType:ae(f()),_meta:ee(f(),ce()).optional()}),ge=Z.extend({text:f()}),Ie=Z.extend({blob:a}),Ae=T({audience:A(s).optional(),priority:G().min(0).max(1).optional(),lastModified:Go({offset:!0}).optional()}),Ue=T({...y.shape,..._.shape,uri:f(),description:ae(f()),mimeType:ae(f()),size:ae(G()),annotations:Ae.optional(),_meta:ae(pe({}))}),Pe=T({...y.shape,..._.shape,uriTemplate:f(),description:ae(f()),mimeType:ae(f()),annotations:Ae.optional(),_meta:ae(pe({}))}),O=h.extend({method:N("notifications/resources/list_changed"),params:m.optional()}),M=m.extend({uri:f()}),K=h.extend({method:N("notifications/resources/updated"),params:M}),P=T({name:f(),description:ae(f()),required:ae(Q())}),k=T({...y.shape,..._.shape,description:ae(f()),arguments:ae(A(P)),_meta:ae(pe({}))}),j=h.extend({method:N("notifications/prompts/list_changed"),params:m.optional()}),W=T({type:N("text"),text:f(),annotations:Ae.optional(),_meta:ee(f(),ce()).optional()}),ue=T({type:N("image"),data:a,mimeType:f(),annotations:Ae.optional(),_meta:ee(f(),ce()).optional()}),Ee=T({type:N("audio"),data:a,mimeType:f(),annotations:Ae.optional(),_meta:ee(f(),ce()).optional()}),ye=T({type:N("tool_use"),name:f(),id:f(),input:ee(f(),ce()),_meta:ee(f(),ce()).optional()}),He=T({type:N("resource"),resource:te([ge,Ie]),annotations:Ae.optional(),_meta:ee(f(),ce()).optional()}),At=Ue.extend({type:N("resource_link")}),I=te([W,ue,Ee,At,He]),L=T({role:s,content:I}),H=T({title:f().optional(),readOnlyHint:Q().optional(),destructiveHint:Q().optional(),idempotentHint:Q().optional(),openWorldHint:Q().optional()}),fe=h.extend({method:N("notifications/tools/list_changed"),params:m.optional()}),me=T({name:f().optional()}),we=T({hints:A(me).optional(),costPriority:G().min(0).max(1).optional(),speedPriority:G().min(0).max(1).optional(),intelligencePriority:G().min(0).max(1).optional()}),ct=T({mode:le(["auto","required","none"]).optional()}),ft=T({type:N("boolean"),title:f().optional(),description:f().optional(),default:Q().optional()}),Et=T({type:N("string"),title:f().optional(),description:f().optional(),minLength:G().optional(),maxLength:G().optional(),format:le(["email","uri","date","date-time"]).optional(),default:f().optional()}),lt=T({type:le(["number","integer"]),title:f().optional(),description:f().optional(),minimum:G().optional(),maximum:G().optional(),default:G().optional()}),We=T({type:N("string"),title:f().optional(),description:f().optional(),enum:A(f()),default:f().optional()}),er=T({type:N("string"),title:f().optional(),description:f().optional(),oneOf:A(T({const:f(),title:f()})),default:f().optional()}),gt=T({type:N("string"),title:f().optional(),description:f().optional(),enum:A(f()),enumNames:A(f()).optional(),default:f().optional()}),Fr=te([We,er]),pr=T({type:N("array"),title:f().optional(),description:f().optional(),minItems:G().optional(),maxItems:G().optional(),items:T({type:N("string"),enum:A(f())}),default:A(f()).optional()}),Vr=T({type:N("array"),title:f().optional(),description:f().optional(),minItems:G().optional(),maxItems:G().optional(),items:T({anyOf:A(T({const:f(),title:f()}))}),default:A(f()).optional()}),Qr=te([pr,Vr]),en=te([gt,Fr,Qr]),Kn=te([en,ft,Et,lt]),Bn=p.extend({mode:N("form").optional(),message:f(),requestedSchema:T({type:N("object"),properties:ee(f(),Kn),required:A(f()).optional()}).catchall(ce())}),Wn=T({type:N("ref/resource"),uri:f()}),Yn=T({type:N("ref/prompt"),name:f()}),Js=T({uri:f().startsWith("file://"),name:f().optional(),_meta:ee(f(),ce()).optional()}),tn=b.shape,Ks=T({experimental:tn.experimental,sampling:tn.sampling,elicitation:tn.elicitation,roots:tn.roots,extensions:tn.extensions}),tr=E.shape,xo=T({experimental:tr.experimental,logging:tr.logging,completions:tr.completions,prompts:tr.prompts,resources:tr.resources,tools:tr.tools,extensions:tr.extensions}),Co=pe({progressToken:r.optional(),[Jr]:f(),[Ko]:S.optional(),[Kr]:Ks,[dn]:i.optional()}),Xn=T({...y.shape,..._.shape,description:f().optional(),inputSchema:pe({$schema:f().optional(),type:N("object")}),outputSchema:pe({$schema:f().optional()}).optional(),annotations:H.optional(),_meta:ee(f(),ce()).optional()}),Bs=T({type:N("tool_result"),toolUseId:f(),content:A(I),structuredContent:ce().optional(),isError:Q().optional(),_meta:ee(f(),ce()).optional()}),Ao=te([W,ue,Ee,ye,Bs]),Qn=T({role:s,content:te([Ao,A(Ao)]),_meta:ee(f(),ce()).optional()}),No=f(),jo=pe({[Er]:S.optional().catch(void 0)}),qo=jo.optional();function zt(ut){return pe({_meta:qo,resultType:No.default("complete"),...ut})}let Ws=zt({}),Wa=zt({nextCursor:n.optional()}),Mo=zt({content:A(I),structuredContent:ce().optional(),isError:Q().optional()}),Ys=zt({ttlMs:G().int().min(0),cacheScope:le(["public","private"]),tools:A(Xn),nextCursor:n.optional()}),Xs=zt({ttlMs:G().int().min(0),cacheScope:le(["public","private"]),prompts:A(k),nextCursor:n.optional()}),Qs=zt({description:f().optional(),messages:A(L)}),ei=zt({ttlMs:G().int().min(0),cacheScope:le(["public","private"]),resources:A(Ue),nextCursor:n.optional()}),ti=zt({ttlMs:G().int().min(0),cacheScope:le(["public","private"]),resourceTemplates:A(Pe),nextCursor:n.optional()}),ri=zt({ttlMs:G().int().min(0),cacheScope:le(["public","private"]),contents:A(te([ge,Ie]))}),ni=zt({completion:T({values:A(f()).max(100),total:G().int().optional(),hasMore:Q().optional()}).loose()}),Ya=zt({ttlMs:G().int().min(0),cacheScope:le(["public","private"])}),oi=zt({ttlMs:G().int().min(0).catch(0),cacheScope:le(["public","private"]).catch("private"),supportedVersions:A(f()),capabilities:xo,instructions:f().optional()}),rn=T({messages:A(Qn),modelPreferences:we.optional(),systemPrompt:f().optional(),includeContext:le(["none","thisServer","allServers"]).optional(),temperature:G().optional(),maxTokens:G().int(),stopSequences:A(f()).optional(),metadata:t.optional(),tools:A(Xn).optional(),toolChoice:ct.optional()}),si=T({method:N("sampling/createMessage"),params:rn}),ii=T({method:N("roots/list"),params:T({_meta:ee(f(),ce()).optional()}).optional()}),ai=T({...Qn.shape,model:f(),stopReason:f().optional()}),ci=T({roots:A(Js)}),ui=T({action:le(["accept","decline","cancel"]),content:ee(f(),te([f(),G(),Q(),A(f())])).optional()}),li=T({mode:N("url"),message:f(),url:f().url()}),di=te([Bn,li]),pi=T({method:N("elicitation/create"),params:di}),fi=te([si,ii,pi]),mi=te([ai,ci,ui]),hi=ee(f(),fi),gi=ee(f(),mi),eo=zt({inputRequests:hi.optional(),requestState:f().optional()}),to={inputResponses:gi.optional(),requestState:f().optional()},Xa=T({_meta:Co,...to}),Qa=pe({progressToken:r.optional()});function Bt(ut,no){return T({method:N(ut),params:T({_meta:Co,...no})})}function Wt(ut,no){return T({method:N(ut),params:T({_meta:Qa.optional(),...no}).optional()})}let yi={name:f(),arguments:ee(f(),ce()).optional(),...to},fr={cursor:n.optional()},ec=Bt("tools/call",yi),tc=Bt("tools/list",fr),rc=Bt("prompts/list",fr),nc=Bt("prompts/get",{name:f(),arguments:ee(f(),f()).optional(),...to}),oc=Bt("resources/list",fr),sc=Bt("resources/templates/list",fr),ic=Bt("resources/read",{uri:f(),...to}),_i={ref:te([Yn,Wn]),argument:T({name:f(),value:f()}),context:T({arguments:ee(f(),f()).optional()}).optional()},ac=Bt("completion/complete",_i),cc=Bt("server/discover",{}),Lo=T({toolsListChanged:Q().optional(),promptsListChanged:Q().optional(),resourcesListChanged:Q().optional(),resourceSubscriptions:A(f()).optional()}),vi={notifications:Lo},uc=Bt("subscriptions/listen",vi),lc=jo.extend({"io.modelcontextprotocol/subscriptionId":o}),dc=pe({_meta:lc,resultType:No.default("complete")}),nn={"tools/call":Wt("tools/call",yi),"tools/list":Wt("tools/list",fr),"prompts/get":Wt("prompts/get",{name:f(),arguments:ee(f(),f()).optional()}),"prompts/list":Wt("prompts/list",fr),"resources/list":Wt("resources/list",fr),"resources/templates/list":Wt("resources/templates/list",fr),"resources/read":Wt("resources/read",{uri:f()}),"completion/complete":Wt("completion/complete",_i),"server/discover":Wt("server/discover",{}),"subscriptions/listen":Wt("subscriptions/listen",vi)};function Mt(ut){return pe({_meta:qo,...ut})}let pc={"tools/call":Mt({content:A(I),structuredContent:ce().optional(),isError:Q().optional()}),"tools/list":Mt({ttlMs:G().int().min(0),cacheScope:le(["public","private"]),tools:A(Xn),nextCursor:n.optional()}),"prompts/get":Mt({description:f().optional(),messages:A(L)}),"prompts/list":Mt({ttlMs:G().int().min(0),cacheScope:le(["public","private"]),prompts:A(k),nextCursor:n.optional()}),"resources/list":Mt({ttlMs:G().int().min(0),cacheScope:le(["public","private"]),resources:A(Ue),nextCursor:n.optional()}),"resources/templates/list":Mt({ttlMs:G().int().min(0),cacheScope:le(["public","private"]),resourceTemplates:A(Pe),nextCursor:n.optional()}),"resources/read":Mt({ttlMs:G().int().min(0),cacheScope:le(["public","private"]),contents:A(te([ge,Ie]))}),"completion/complete":Mt({completion:T({values:A(f()).max(100),total:G().int().optional(),hasMore:Q().optional()}).loose()}),"server/discover":Mt({ttlMs:G().int().min(0).catch(0),cacheScope:le(["public","private"]).catch("private"),supportedVersions:A(f()),capabilities:xo,instructions:f().optional()}),"subscriptions/listen":Mt({})},ro=pe({"io.modelcontextprotocol/subscriptionId":o.optional()}),Do=T({method:N("notifications/subscriptions/acknowledged"),params:T({_meta:ro.optional(),notifications:Lo})}),Uo=T({_meta:ro.optional(),requestId:o,reason:f().optional()}),Fo=T({method:N("notifications/cancelled"),params:Uo}),kp={"notifications/cancelled":Fo,"notifications/progress":C,"notifications/message":B,"notifications/resources/updated":K,"notifications/resources/list_changed":O,"notifications/tools/list_changed":fe,"notifications/prompts/list_changed":j,"notifications/subscriptions/acknowledged":Do},Lt=(ut)=>T({jsonrpc:N("2.0"),id:te([f(),G().int()]),result:ut}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:r,CursorSchema:n,RequestIdSchema:o,RoleSchema:s,LoggingLevelSchema:i,TaskMetadataSchema:c,RelatedTaskMetadataSchema:u,RequestMetaSchema:l,BaseRequestParamsSchema:d,TaskAugmentedRequestParamsSchema:p,NotificationsParamsSchema:m,NotificationSchema:h,IconSchema:g,IconsSchema:_,BaseMetadataSchema:y,ImplementationSchema:S,ClientTasksCapabilitySchema:z,ServerTasksCapabilitySchema:R,ClientCapabilitiesSchema:b,ServerCapabilitiesSchema:E,ProgressSchema:x,ProgressNotificationParamsSchema:q,ProgressNotificationSchema:C,LoggingMessageNotificationParamsSchema:F,LoggingMessageNotificationSchema:B,ResourceContentsSchema:Z,TextResourceContentsSchema:ge,BlobResourceContentsSchema:Ie,AnnotationsSchema:Ae,ResourceSchema:Ue,ResourceTemplateSchema:Pe,ResourceListChangedNotificationSchema:O,ResourceUpdatedNotificationParamsSchema:M,ResourceUpdatedNotificationSchema:K,PromptArgumentSchema:P,PromptSchema:k,PromptListChangedNotificationSchema:j,TextContentSchema:W,ImageContentSchema:ue,AudioContentSchema:Ee,ToolUseContentSchema:ye,EmbeddedResourceSchema:He,ResourceLinkSchema:At,ContentBlockSchema:I,PromptMessageSchema:L,ToolAnnotationsSchema:H,ToolListChangedNotificationSchema:fe,ModelHintSchema:me,ModelPreferencesSchema:we,ToolChoiceSchema:ct,BooleanSchemaSchema:ft,StringSchemaSchema:Et,NumberSchemaSchema:lt,UntitledSingleSelectEnumSchemaSchema:We,TitledSingleSelectEnumSchemaSchema:er,LegacyTitledEnumSchemaSchema:gt,SingleSelectEnumSchemaSchema:Fr,UntitledMultiSelectEnumSchemaSchema:pr,TitledMultiSelectEnumSchemaSchema:Vr,MultiSelectEnumSchemaSchema:Qr,EnumSchemaSchema:en,PrimitiveSchemaDefinitionSchema:Kn,ElicitRequestFormParamsSchema:Bn,ResourceTemplateReferenceSchema:Wn,PromptReferenceSchema:Yn,RootSchema:Js,ClientCapabilities2026Schema:Ks,ServerCapabilities2026Schema:xo,RequestMetaEnvelopeSchema:Co,ToolSchema:Xn,ToolResultContentSchema:Bs,SamplingMessageContentBlockSchema:Ao,SamplingMessageSchema:Qn,ResultTypeSchema:No,ResultMetaSchema:jo,ResultSchema:Ws,PaginatedResultSchema:Wa,CallToolResultSchema:Mo,ListToolsResultSchema:Ys,ListPromptsResultSchema:Xs,GetPromptResultSchema:Qs,ListResourcesResultSchema:ei,ListResourceTemplatesResultSchema:ti,ReadResourceResultSchema:ri,CompleteResultSchema:ni,CacheableResultSchema:Ya,DiscoverResultSchema:oi,CreateMessageRequestParamsSchema:rn,CreateMessageRequestSchema:si,ListRootsRequestSchema:ii,CreateMessageResultSchema:ai,ListRootsResultSchema:ci,ElicitResultSchema:ui,ElicitRequestURLParamsSchema:li,ElicitRequestParamsSchema:di,ElicitRequestSchema:pi,InputRequestSchema:fi,InputResponseSchema:mi,InputRequestsSchema:hi,InputResponsesSchema:gi,InputRequiredResultSchema:eo,InputResponseRequestParamsSchema:Xa,CallToolRequestSchema:ec,ListToolsRequestSchema:tc,ListPromptsRequestSchema:rc,GetPromptRequestSchema:nc,ListResourcesRequestSchema:oc,ListResourceTemplatesRequestSchema:sc,ReadResourceRequestSchema:ic,CompleteRequestSchema:ac,DiscoverRequestSchema:cc,SubscriptionFilterSchema:Lo,SubscriptionsListenRequestSchema:uc,SubscriptionsListenResultMetaSchema:lc,SubscriptionsListenResultSchema:dc,dispatchRequestSchemas:nn,dispatchResultSchemas:pc,NotificationMetaSchema:ro,SubscriptionsAcknowledgedNotificationSchema:Do,CancelledNotificationParamsSchema:Uo,CancelledNotificationSchema:Fo,notificationSchemas2026:kp,JSONRPCResultResponseSchema:Lt(Ws),CallToolResultResponseSchema:Lt(te([Mo,eo])),ListToolsResultResponseSchema:Lt(Ys),ListPromptsResultResponseSchema:Lt(Xs),GetPromptResultResponseSchema:Lt(te([Qs,eo])),ListResourcesResultResponseSchema:Lt(ei),ListResourceTemplatesResultResponseSchema:Lt(ti),ReadResourceResultResponseSchema:Lt(te([ri,eo])),CompleteResultResponseSchema:Lt(ni),DiscoverResultResponseSchema:Lt(oi)}}var cA;function yo(){return cA??=aA()}var uA=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"];function lA(e){return uA.includes(e)}var is=Symbol("modelcontextprotocol.resultCacheHintFallback");function Nl(e,t){if(t===void 0)return e;let r=e[is];if(r===void 0)return{...e,[is]:t};let n={},o=r.ttlMs??t.ttlMs;if(o!==void 0)n.ttlMs=o;let s=r.cacheScope??t.cacheScope;if(s!==void 0)n.cacheScope=s;return{...e,[is]:n}}function dA(e){return e[is]}function km(e){return typeof e==="number"&&Number.isSafeInteger(e)&&e>=0}function Om(e){return e==="public"||e==="private"}function xm(e,t){if(e.ttlMs!==void 0&&!km(e.ttlMs))throw RangeError(`Invalid cache hint for ${t}: ttlMs must be a non-negative safe integer (got ${String(e.ttlMs)})`);if(e.cacheScope!==void 0&&!Om(e.cacheScope))throw RangeError(`Invalid cache hint for ${t}: cacheScope must be 'public' or 'private' (got ${String(e.cacheScope)})`)}var Y=function(e){return 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.ResourceNotFound=-32002]="ResourceNotFound",e[e.MissingRequiredClientCapability=-32021]="MissingRequiredClientCapability",e[e.UnsupportedProtocolVersion=-32022]="UnsupportedProtocolVersion",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired",e}({}),de=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](t){return as(this,t)}static isInstance(t){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return as(this,t)}constructor(t,r,n){super(r);this.code=t,this.data=n,this.name="ProtocolError",Em(this,new.target)}static fromError(t,r,n){if(t===Y.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new Y0(o.elicitations,r)}if(t===Y.UnsupportedProtocolVersion&&n){let o=n;if(Array.isArray(o.supported)&&typeof o.requested==="string")return new ls({supported:o.supported,requested:o.requested},r)}if(t===Y.InvalidParams||t===Y.ResourceNotFound){let o=n;if(typeof o?.uri==="string"&&(t===Y.ResourceNotFound||Object.keys(o).length===1))return new jl(o.uri,r)}if(t===Y.MissingRequiredClientCapability&&n){let o=n;if(o.requiredCapabilities!==null&&typeof o.requiredCapabilities==="object"&&!Array.isArray(o.requiredCapabilities))return new ql({requiredCapabilities:o.requiredCapabilities},r)}return new e(t,r,n)}},jl=class extends de{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(e,t=`Resource not found: ${e}`){super(Y.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},Y0=class extends de{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(Y.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},ls=class extends de{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(Y.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},ql=class extends de{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(", ")}`){super(Y.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},pA=0,fA="private",mA=["tools/call","prompts/get","resources/read"];function hA(e,t){let r=t.resultType;if(r===void 0)return{...t,resultType:"complete"};if(r==="complete")return t;if(mA.includes(e))return t;throw new de(Y.InternalError,`Handler for ${e} returned resultType '${String(r)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function gA(e,t){let r=dA(t);if(t.resultType!=="complete"||!lA(e))return r===void 0?t:bA(t);let n=t,o=km(n.ttlMs)?n.ttlMs:vA(r),s=Om(n.cacheScope)?n.cacheScope:SA(r),i={...n,ttlMs:o,cacheScope:s};return delete i[is],i}function yA(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function _A(e,t){if(t===void 0)return e;let r=e._meta;if(r===void 0)return{...e,_meta:{[Er]:t}};if(!yA(r))return e;if(r[Er]!==void 0)return e;return{...e,_meta:{...r,[Er]:t}}}function vA(e){return e!==void 0&&km(e.ttlMs)?e.ttlMs:pA}function SA(e){return e!==void 0&&Om(e.cacheScope)?e.cacheScope:fA}function bA(e){let t={...e};return delete t[is],t}var $A=["elicitation/create","sampling/createMessage","roots/list"],Il;function X0(){if(Il)return Il;let e=yo();return Il={request:{"elicitation/create":T({method:N("elicitation/create"),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":T({method:N("sampling/createMessage"),params:e.CreateMessageRequestParamsSchema}),"roots/list":T({method:N("roots/list"),params:pe({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},Il}function Q0(e){return $A.includes(e)}function _m(e){return Q0(e)?X0().request[e]:void 0}function wA(e){return Q0(e)?X0().response[e]:void 0}var Cm={"tools/call":null,"tools/list":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"completion/complete":null,"server/discover":null,"subscriptions/listen":null},eb={"notifications/cancelled":null,"notifications/progress":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/subscriptions/acknowledged":null};function tb(e){return Object.prototype.hasOwnProperty.call(Cm,e)}function rb(e){return Object.prototype.hasOwnProperty.call(eb,e)}function RA(e){return Object.prototype.hasOwnProperty.call(Cm,e)}function EA(e){return tb(e)?yo().dispatchRequestSchemas[e]:void 0}function zA(e){return RA(e)?yo().dispatchResultSchemas[e]:void 0}function PA(e){return rb(e)?yo().notificationSchemas2026[e]:void 0}var L3=Object.keys(Cm),D3=Object.keys(eb);function ca(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function ia(e,t){if(e===void 0)return{ok:!1,reason:"not-in-era"};let r=e.safeParse(t);return r.success?{ok:!0,value:r.data}:{ok:!1,reason:"invalid",message:String(r.error)}}var TA={ok:!1,reason:"not-in-era"},IA=[Jr,Kr];function kA(e,t){let r=t,n=!1,o=()=>{if(!n)r={...r},n=!0;return r},s=t.tools;if(e==="tools/list"&&Array.isArray(s)&&s.some((a)=>ca(a)&&("execution"in a)))o().tools=s.map((a)=>{if(!ca(a)||!("execution"in a))return a;let c={...a};return delete c.execution,c});let i=t.capabilities;if(ca(i)&&"tasks"in i){let a={...i};delete a.tasks,o().capabilities=a}return r}var Am={era:"2026-07-28",hasRequestMethod:tb,hasNotificationMethod:rb,hasInputRequestMethod:(e)=>_m(e)!==void 0,validateRequest:(e,t)=>ia(EA(e),t),validateResult:(e,t)=>ia(zA(e),t),validateNotification:(e,t)=>ia(PA(e),t),validateInputRequest:(e,t)=>ia(_m(e),t),validateInputResponse:(e,t)=>ia(wA(e),t),samplingResultVariant:()=>TA,outboundEnvelope(e){return{[Jr]:e.protocolVersion,[Ko]:e.clientInfo,[Kr]:e.clientCapabilities,...e.logLevel!==void 0&&{[dn]:e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let n of IA)if(!(n in e))t.push({key:n,problem:"missing"});let r=yo().RequestMetaEnvelopeSchema.safeParse(e);if(!r.success)for(let n of r.error.issues){let o=n.path.map(String),s=o.length>0?o.join("."):"_meta";if(o.length===1&&t.some((i)=>i.key===s&&i.problem==="missing"))continue;t.push({key:s,problem:n.message})}return t},projectCallToolResult:(e)=>V0(e),inputRequestSchema:_m,decodeResult(e,t){if(!ca(t))return{kind:"invalid",error:new Se(Te.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let r=t.resultType;if(r===void 0)return{kind:"invalid",error:new Se(Te.InvalidResult,`Invalid result for ${e}: missing required resultType — servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:e,violation:"missing-resultType"})};if(typeof r!=="string")return{kind:"invalid",error:new Se(Te.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:r})};if(r==="input_required"){let i=t.inputRequests,a=ca(i)?i:{},c=t.requestState;if(Object.keys(a).length===0&&typeof c!=="string")return{kind:"invalid",error:new Se(Te.InvalidResult,`Invalid result for ${e}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:e,violation:"input-required-missing-both"})};return{kind:"input_required",inputRequests:a,...typeof c==="string"&&{requestState:c}}}if(r!=="complete")return{kind:"invalid",error:new Se(Te.UnsupportedResultType,`Unsupported result type '${r}' for ${e}`,{resultType:r,method:e})};let n=OA(),o=Object.hasOwn(n,e)?n[e]:void 0;if(o!==void 0){let i=o.safeParse(t);if(!i.success)return{kind:"invalid",error:new Se(Te.InvalidResult,`Invalid result for ${e}: ${i.error}`,{method:e})}}let s={...t};return delete s.resultType,{kind:"complete",result:s}},encodeResult(e,t,r){return _A(gA(e,hA(e,kA(e,t))),r)},encodeErrorCode:(e)=>e===-32002?-32602:e,checkInboundEnvelope(e){if(e.envelope===void 0)return"Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)";let t=yo().RequestMetaEnvelopeSchema.safeParse(e.envelope);if(!t.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${t.error.issues.map((r)=>r.message).join("; ")}`}},kl;function OA(){if(kl)return kl;let e=yo();return kl={"tools/call":e.CallToolResultSchema,"tools/list":e.ListToolsResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"completion/complete":e.CompleteResultSchema,"server/discover":e.DiscoverResultSchema},kl}var pa="2026-07-28";function vn(e){return e!==void 0&&us(e)?Am:Im}function x0(e){if(e.revision!==void 0)return vn(e.revision).era;return e.era==="modern"?Am.era:Im.era}function vm(e){return nb.some((t)=>t.hasRequestMethod(e))}function Sm(e){return nb.some((t)=>t.hasNotificationMethod(e))}var nb=[Im,Am];function C0(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function _o(e){if(!C0(e))return;let t=e._meta;return C0(t)?t:void 0}function Ml(e){let t=_o(e);return t!==void 0&&Jr in t}function Ll(e){let t=_o(e)?.[Jr];return typeof t==="string"?t:void 0}function Dl(e){return vn(pa).validateEnvelopeMeta(e)}var xA=Ry({AnnotationsSchema:()=>Br,AudioContentSchema:()=>ts,BaseMetadataSchema:()=>Gr,BaseRequestParamsSchema:()=>_t,BlobResourceContentsSchema:()=>Ki,BooleanSchemaSchema:()=>Qi,CallToolRequestParamsSchema:()=>Du,CallToolRequestSchema:()=>Uu,CallToolResultSchema:()=>Xi,CancelTaskRequestSchema:()=>rm,CancelTaskResultSchema:()=>nm,CancelledNotificationParamsSchema:()=>Vc,CancelledNotificationSchema:()=>Fi,ClientCapabilitiesSchema:()=>Jc,ClientNotificationSchema:()=>sm,ClientRequestSchema:()=>om,ClientResultSchema:()=>im,ClientTasksCapabilitySchema:()=>Zc,CompatibilityCallToolResultSchema:()=>Zf,CompleteRequestParamsSchema:()=>ml,CompleteRequestSchema:()=>hl,CompleteResultSchema:()=>gl,ContentBlockSchema:()=>rs,CreateMessageRequestParamsSchema:()=>Qu,CreateMessageRequestSchema:()=>el,CreateMessageResultSchema:()=>tl,CreateMessageResultWithToolsSchema:()=>rl,CreateTaskResultSchema:()=>Kf,CursorSchema:()=>Ni,DiscoverRequestSchema:()=>Xc,DiscoverResultSchema:()=>Qc,ElicitRequestFormParamsSchema:()=>ss,ElicitRequestParamsSchema:()=>al,ElicitRequestSchema:()=>cl,ElicitRequestURLParamsSchema:()=>il,ElicitResultSchema:()=>dl,ElicitationCompleteNotificationParamsSchema:()=>ul,ElicitationCompleteNotificationSchema:()=>ll,EmbeddedResourceSchema:()=>Ou,EmptyResultSchema:()=>Ui,EnumSchemaSchema:()=>sl,GetPromptRequestParamsSchema:()=>Tu,GetPromptRequestSchema:()=>Iu,GetPromptResultSchema:()=>Au,GetTaskPayloadRequestSchema:()=>Xf,GetTaskPayloadResultSchema:()=>Qf,GetTaskRequestSchema:()=>Wf,GetTaskResultSchema:()=>Yf,IconSchema:()=>Hc,IconsSchema:()=>fn,ImageContentSchema:()=>es,ImplementationSchema:()=>Yo,InitializeRequestParamsSchema:()=>Kc,InitializeRequestSchema:()=>Bc,InitializeResultSchema:()=>Wc,InitializedNotificationSchema:()=>Yc,JSONArraySchema:()=>Ff,JSONObjectSchema:()=>Xe,JSONRPCErrorResponseSchema:()=>Wo,JSONRPCMessageSchema:()=>Di,JSONRPCNotificationSchema:()=>Li,JSONRPCRequestSchema:()=>Mi,JSONRPCResponseSchema:()=>Vf,JSONRPCResultResponseSchema:()=>Bo,JSONValueSchema:()=>ln,LegacyTitledEnumSchemaSchema:()=>ra,ListChangedOptionsBaseSchema:()=>Gf,ListPromptsRequestSchema:()=>zu,ListPromptsResultSchema:()=>Pu,ListResourceTemplatesRequestSchema:()=>iu,ListResourceTemplatesResultSchema:()=>au,ListResourcesRequestSchema:()=>ou,ListResourcesResultSchema:()=>su,ListRootsRequestSchema:()=>_l,ListRootsResultSchema:()=>vl,ListTasksRequestSchema:()=>em,ListTasksResultSchema:()=>tm,ListToolsRequestSchema:()=>Mu,ListToolsResultSchema:()=>Lu,LoggingLevelSchema:()=>yn,LoggingMessageNotificationParamsSchema:()=>Zu,LoggingMessageNotificationSchema:()=>Gu,ModelHintSchema:()=>Ju,ModelPreferencesSchema:()=>Ku,MultiSelectEnumSchemaSchema:()=>ol,NotificationSchema:()=>It,NotificationsParamsSchema:()=>Tt,NumberSchemaSchema:()=>os,PaginatedRequestParamsSchema:()=>ru,PaginatedRequestSchema:()=>mn,PaginatedResultSchema:()=>hn,PingRequestSchema:()=>Hi,PrimitiveSchemaDefinitionSchema:()=>sa,ProgressNotificationParamsSchema:()=>tu,ProgressNotificationSchema:()=>Zi,ProgressSchema:()=>eu,ProgressTokenSchema:()=>Ai,PromptArgumentSchema:()=>Ru,PromptListChangedNotificationSchema:()=>Nu,PromptMessageSchema:()=>Cu,PromptReferenceSchema:()=>fl,PromptSchema:()=>Eu,ReadResourceRequestParamsSchema:()=>cu,ReadResourceRequestSchema:()=>uu,ReadResourceResultSchema:()=>lu,RelatedTaskMetadataSchema:()=>Fc,RequestIdSchema:()=>pn,RequestMetaSchema:()=>ji,RequestSchema:()=>Qe,ResourceContentsSchema:()=>Gi,ResourceLinkSchema:()=>xu,ResourceListChangedNotificationSchema:()=>du,ResourceRequestParamsSchema:()=>Xo,ResourceSchema:()=>Bi,ResourceTemplateReferenceSchema:()=>pl,ResourceTemplateSchema:()=>nu,ResourceUpdatedNotificationParamsSchema:()=>$u,ResourceUpdatedNotificationSchema:()=>wu,ResultMetaObjectSchema:()=>qi,ResultSchema:()=>et,RoleSchema:()=>gn,RootSchema:()=>yl,RootsListChangedNotificationSchema:()=>Sl,SamplingContentSchema:()=>Yu,SamplingMessageContentBlockSchema:()=>lo,SamplingMessageSchema:()=>Xu,ServerCapabilitiesSchema:()=>Vi,ServerNotificationSchema:()=>cm,ServerRequestSchema:()=>am,ServerResultSchema:()=>um,ServerTasksCapabilitySchema:()=>Gc,SetLevelRequestParamsSchema:()=>Vu,SetLevelRequestSchema:()=>Hu,SingleSelectEnumSchemaSchema:()=>nl,StringSchemaSchema:()=>ns,SubscribeRequestParamsSchema:()=>pu,SubscribeRequestSchema:()=>fu,SubscriptionFilterSchema:()=>Wi,SubscriptionsAcknowledgedNotificationParamsSchema:()=>_u,SubscriptionsAcknowledgedNotificationSchema:()=>vu,SubscriptionsListenRequestParamsSchema:()=>gu,SubscriptionsListenRequestSchema:()=>yu,SubscriptionsListenResultMetaSchema:()=>Su,SubscriptionsListenResultSchema:()=>bu,TaskAugmentedRequestParamsSchema:()=>ho,TaskCreationParamsSchema:()=>Jf,TaskMetadataSchema:()=>Uc,TaskSchema:()=>_n,TaskStatusNotificationParamsSchema:()=>$l,TaskStatusNotificationSchema:()=>Bf,TaskStatusSchema:()=>bl,TextContentSchema:()=>Qo,TextResourceContentsSchema:()=>Ji,TitledMultiSelectEnumSchemaSchema:()=>oa,TitledSingleSelectEnumSchemaSchema:()=>ta,ToolAnnotationsSchema:()=>ju,ToolChoiceSchema:()=>Bu,ToolExecutionSchema:()=>qu,ToolListChangedNotificationSchema:()=>Fu,ToolResultContentSchema:()=>Wu,ToolSchema:()=>Yi,ToolUseContentSchema:()=>ku,UnsubscribeRequestParamsSchema:()=>mu,UnsubscribeRequestSchema:()=>hu,UntitledMultiSelectEnumSchemaSchema:()=>na,UntitledSingleSelectEnumSchemaSchema:()=>ea});var rr=(e)=>Mi.safeParse(e).success,bn=(e)=>Li.safeParse(e).success,la=(e)=>Bo.safeParse(e).success,Ul=(e)=>Wo.safeParse(e).success;var Wr=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e)&&e.resultType==="input_required";function Nm(e){if(e.params.ref.type!=="ref/prompt")throw TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`)}function jm(e){if(e.params.ref.type!=="ref/resource")throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`)}var A0="x-mcp-header",CA=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,AA=new Set(["string","integer","boolean","number"]);function qm(e){let t=[],r=new Map,n=(s,i,a)=>{if(s===null||typeof s!=="object")return;let c=s;if(A0 in c){if(!a||i.length===0)return`${Ol(i)}: x-mcp-header is only permitted on properties statically reachable via a chain of 'properties' keys (not under items, additionalProperties, oneOf/anyOf/allOf/not, if/then/else, or $ref)`;let l=c[A0];if(typeof l!=="string"||l.length===0)return`${Ol(i)}: x-mcp-header MUST be a non-empty string`;if(!CA.test(l))return`${Ol(i)}: x-mcp-header '${l}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let d=typeof c.type==="string"?c.type:void 0;if(d===void 0||!AA.has(d))return`${Ol(i)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${d??"<none>"}`;let p=l.toLowerCase(),m=r.get(p);if(m!==void 0)return`x-mcp-header '${l}' is not case-insensitively unique (also declared as '${m}')`;r.set(p,l),t.push({path:i,headerName:l,type:d})}let u=c.properties;if(u!==null&&typeof u==="object")for(let[l,d]of Object.entries(u)){let p=n(d,[...i,l],a);if(p!==void 0)return p}for(let l of NA){let d=c[l];if(d===void 0)continue;let p=Array.isArray(d)?d:d!==null&&typeof d==="object"&&jA.has(l)?Object.values(d):[d];for(let m of p){let h=n(m,[...i,`<${l}>`],!1);if(h!==void 0)return h}}},o=n(e,[],!0);return o===void 0?{valid:!0,declarations:t}:{valid:!1,reason:o}}var NA=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],jA=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);function Ol(e){return e.length===0?"<root>":e.join(".")}var Cl=-32020,U3=[{rung:"http-method",order:1,evaluatedAt:"edge",codes:[-32000],conformance:[],rationale:"The modern era is POST-only; GET/DELETE are body-less 2025-era session operations and are method-routed to legacy serving (405 when legacy serving is not configured), before any body is read."},{rung:"jsonrpc-shape",order:2,evaluatedAt:"edge",codes:[Y.InvalidRequest],conformance:["server-stateless"],rationale:"The body must be a JSON-RPC request or notification: posted responses and batch arrays containing a modern or invalid element are rejected before classification (element-wise batch rule); all-legacy arrays stay legacy traffic."},{rung:"era-classification",order:3,evaluatedAt:"edge",codes:[Cl,Y.UnsupportedProtocolVersion],conformance:["server-stateless","http-header-validation","http-custom-header-server-validation"],rationale:"Body-primary era classification with the protocol-version header as a cross-check; a header/body disagreement is rejected with -32020 (HeaderMismatch), and an envelope-less request on a modern-only endpoint is answered with the unsupported-protocol-version error naming the supported revisions."},{rung:"envelope",order:4,evaluatedAt:"edge",codes:[Y.InvalidParams],conformance:["server-stateless"],rationale:"A present envelope claim with a malformed envelope — and a missing envelope on a request whose protocol-version header names a modern revision — is an invalid-params rejection naming the offending or missing key(s); never a silent fall back to legacy handling. This is the only place an invalid-params rejection maps to HTTP 400."},{rung:"method-registry",order:5,evaluatedAt:"dispatch",codes:[Y.MethodNotFound],conformance:["server-stateless"],rationale:"Method existence outranks parameter validity: a method absent from the negotiated revision’s registry (or with no handler installed) answers method-not-found before params or capabilities are looked at."},{rung:"request-params",order:6,evaluatedAt:"dispatch",codes:[Y.InvalidParams],conformance:[],rationale:"Per-method params validation; emitted in-band by the dispatch layer (HTTP 200), never via the ladder status table."},{rung:"standard-header-validation",order:7,evaluatedAt:"pre-dispatch",codes:[Cl],conformance:["http-header-validation"],rationale:"SEP-2243 standard `Mcp-Method` / `Mcp-Name` headers — presence, sentinel decoding, and `Mcp-Name` ↔ body cross-check — are validated by the HTTP entry on a modern-classified request after the supported-revision gate and before dispatch. The classifier’s own header-mismatch cells (protocol-version, `Mcp-Method` mismatch) stay on the edge `era-classification` rung; this rung carries the entry-layer presence/`Mcp-Name` half. Evaluated before the capability gate, the factory call, and the `Mcp-Param-*` rung so a request that fails several rungs is answered by the standard-header rung first. The documented order (after method-registry 5 and request-params 6) is NOT the observed precedence: serveModern evaluates this rung immediately after the supported-revision gate, so a request that also fails a dispatch rung is answered here before the dispatch rungs (5–6) are consulted."},{rung:"client-capabilities",order:8,evaluatedAt:"pre-dispatch",codes:[Y.MissingRequiredClientCapability],conformance:["server-stateless"],rationale:"The capability requirement is checked by the HTTP entry, pre-dispatch, against the validated envelope the classifier produced — pinning the spec-mandated HTTP 400 independently of how dispatch- and handler-produced errors are mapped. The documented order (after method resolution and params validation) is preserved observably only while the requirement table is empty: once a served method gains a requirement entry, a request that is missing the capability and would also fail a dispatch rung is answered by this gate first, so the entry must consult the method registry before the gate if the documented precedence is to stay observable."},{rung:"param-header-validation",order:9,evaluatedAt:"pre-dispatch",codes:[Cl],conformance:["http-custom-header-server-validation"],rationale:"SEP-2243 `Mcp-Param-*` headers are validated against the named tool’s `x-mcp-header` declarations and the body `arguments` after the tool registry is known and before dispatch reaches the handler; a missing/disagreeing/malformed header is rejected 400 / -32020 with the same shape as the standard-header cross-checks. The documented order (after method resolution and params validation) is preserved observably only when the body `arguments` would otherwise validate: the check runs pre-dispatch, so a `tools/call` that fails BOTH this rung and a dispatch-time rung (e.g. order-6 `request-params`, -32602) is answered by this gate first with 400 / -32020, not by the earlier-ordered rung."}],qA={[Y.ParseError]:400,[Y.InvalidRequest]:400,[Y.MethodNotFound]:404,[Y.UnsupportedProtocolVersion]:400,[Y.MissingRequiredClientCapability]:400,[Cl]:400};function xl(e,t,r,n,o){return{kind:"reject",rung:e,cell:t,httpStatus:r,code:n.code,message:n.message,...n.data!==void 0&&{data:n.data},settled:o}}function Mm(e){if(!Ml(e))return!1;let t=Ll(e);if(t===void 0||!us(t))return!1;let r=_o(e);return r!==void 0&&Dl(r).length===0}function Lm(e,t){switch(e.reason){case"http-method":return xl("http-method","modern-only-method-not-allowed",405,new de(-32000,"Method not allowed."),!0);case"batch":return xl("jsonrpc-shape","modern-only-batch-not-supported",400,new de(Y.InvalidRequest,"Bad Request: JSON-RPC batches are not supported by this endpoint"),!0);case"response":return xl("jsonrpc-shape","modern-only-response-post",400,new de(Y.InvalidRequest,"Bad Request: JSON-RPC responses cannot be posted to this endpoint"),!0);case"notification":return;case"initialize":case"no-claim":{let r=e.requestedVersion;return xl("era-classification","modern-only-missing-envelope",400,r===void 0?new de(Y.UnsupportedProtocolVersion,"Unsupported protocol version: the request did not name a protocol version",{supported:[...t]}):new ls({supported:[...t],requested:r}),!0)}}}function Fl(e,t){return Nc(e,t)}function aa(e){return new Set(e.flatMap((t)=>Object.keys(t.shape)))}function cs(e){if(e==null)return!1;let t=typeof e;if(t!=="object"&&t!=="function")return!1;if(!("~standard"in e))return!1;return typeof e["~standard"]?.validate==="function"}var N0=!1,wm="draft-2020-12";function $n(e,t="input"){let r=e["~standard"],n;if(r.jsonSchema)n=r.jsonSchema[t]({target:wm});else if(r.vendor==="zod"){if(!("_zod"in e))throw Error("Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().");if(!N0)N0=!0,console.warn("[mcp-sdk] Your zod version does not implement `~standard.jsonSchema` (added in zod 4.2.0). Falling back to z.toJSONSchema(). Upgrade to zod >=4.2.0 to silence this warning.");n=Cc(e,{target:wm,io:t})}else throw Error(`Schema library "${r.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(t==="output"){if(n.type!==void 0)return n;return ob(n)?{type:"object",...n}:n}if(n.type!==void 0&&n.type!=="object")throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(n.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...n}}function ob(e){if("properties"in e||"patternProperties"in e||"additionalProperties"in e||"required"in e)return!0;for(let t of["oneOf","anyOf","allOf"]){let r=e[t];if(Array.isArray(r)&&r.length>0)return r.every((n)=>n!==null&&typeof n==="object"&&(n.type==="object"||ob(n)))}return!1}function MA(e){if(!e.path?.length)return e.message;return`${e.path.map((t)=>String(typeof t==="object"?t.key:t)).join(".")}: ${e.message}`}async function go(e,t){let r=await e["~standard"].validate(t);if(r.issues&&r.issues.length>0)return{success:!1,error:r.issues.map((n)=>MA(n)).join(", ")};return{success:!0,data:r.value}}function LA(e){let t=Cc(e,{target:wm,io:"input"});return typeof t.pattern==="string"?t.pattern:void 0}var DA=/\\\.\\d\{(\d+)\}/;function UA(e){let t=DA.exec(e),r=[void 0,-1,0];if(t)r.push(Number(t[1]));return[!1,!0].flatMap((n)=>[!1,!0].flatMap((o)=>r.map((s)=>Go({local:n,offset:o,precision:s}))))}function FA(e,t){let r;switch(e){case"email":r=[i0()];break;case"uri":r=[qc()];break;case"date":r=[Mf()];break;case"date-time":r=UA(t);break}return new Set(r.map((n)=>LA(n)).filter((n)=>n!==void 0))}function VA(e,t,r){if(r!=="zod")return!0;return FA(e,t).has(t)}function sb(e){let t=$n(e,"input"),r=t.properties||{},n=t.required||[];return Object.entries(r).map(([o,s])=>({name:o,description:s?.description,required:n.includes(o)}))}function da(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function HA(e){try{return $n(e,"input")}catch(t){let r=t instanceof Error?t.message:String(t);throw new de(Y.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${r}`)}}var ZA=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function Dm(e){return ZA.has(e)||e.startsWith("x-")}var GA=new Set(["$schema",...Object.keys(ss.shape.requestedSchema.shape)]),j0={string:aa([ns,ea,ta,ra]),number:aa([os]),integer:aa([os]),boolean:aa([Qi]),array:aa([na,oa])},JA=new Set(ns.shape.format.unwrap().options);function KA(e,t,r,n){if(!da(e))return e;let o=typeof e.type==="string"&&Object.hasOwn(j0,e.type)?j0[e.type]:void 0;if(o===void 0)return e;let s={};for(let[i,a]of Object.entries(e))if(o.has(i)||Dm(i))s[i]=a;else if(i==="pattern"&&e.type==="string"&&typeof e.format==="string"){if(!JA.has(e.format))s[i]=a;else if(typeof a!=="string"||!VA(e.format,a,r))n.push(`${t}.${i}`)}else n.push(`${t}.${i}`);return s}function BA(e,t){let r={},n=[];for(let[o,s]of Object.entries(e))if(o==="properties"&&da(s))r[o]=Object.fromEntries(Object.entries(s).map(([i,a])=>[i,KA(a,`properties.${i}`,t,n)]));else if(GA.has(o))r[o]=s;else if(!Dm(o))n.push(o);if(n.length>0)throw new de(Y.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${n.join(", ")}`);return r}function WA(e,t){if(!da(e.properties))return t;let r=Object.entries(e.properties).filter(([,n])=>!Fl(sa,n).success).map(([n])=>`properties.${n}`);return r.length>0?r.join(", "):t}function Rm(e,t,r=""){if(Array.isArray(e)&&Array.isArray(t))return e.flatMap((n,o)=>Rm(n,t[o],`${r}[${o}]`));if(!da(e)||!da(t))return[];return Object.entries(e).flatMap(([n,o])=>{let s=r?`${r}.${n}`:n;if(!Object.prototype.hasOwnProperty.call(t,n))return Dm(n)?[]:[s];return Rm(o,t[n],s)})}function YA(e){if(!cs(e.requestedSchema))return{...e,mode:"form",requestedSchema:e.requestedSchema};let t=e.requestedSchema["~standard"].vendor,r=BA(HA(e.requestedSchema),t),n=Fl(ss.shape.requestedSchema,r);if(!n.success)throw new de(Y.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${WA(r,n.error.message)}`);let o=Rm(r,n.data);if(o.length>0)throw new de(Y.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${o.join(", ")}`);let s=(n.data.required??[]).filter((i)=>!Object.prototype.hasOwnProperty.call(n.data.properties,i));if(s.length>0)throw new de(Y.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${s.join(", ")}`);return{...e,mode:"form",requestedSchema:n.data}}function XA(e){let t=e.inputRequests!==void 0&&Object.keys(e.inputRequests).length>0,r=typeof e.requestState==="string";if(!t&&!r)throw TypeError("inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)");return{resultType:"input_required",...e.inputRequests!==void 0&&{inputRequests:e.inputRequests},...e.requestState!==void 0&&{requestState:e.requestState}}}var QA=Object.assign(XA,{elicit(e){try{return{method:"elicitation/create",params:YA(e)}}catch(t){throw t instanceof de?TypeError(t.message,{cause:t}):t}},elicitUrl(e){return{method:"elicitation/create",params:{...e,mode:"url"}}},createMessage(e){return{method:"sampling/createMessage",params:e}},listRoots(){return{method:"roots/list"}}});var ib=250;function ab(e,t){return`Multi-round-trip request '${e}' still required input after ${t} rounds (inputRequired.maxRounds)`}function cb(e,t){return new Promise((r,n)=>{if(t?.aborted){n(t.reason instanceof Se?t.reason:new Se(Te.RequestTimeout,String(t.reason)));return}let o=setTimeout(()=>{t?.removeEventListener("abort",s),r()},e),s=()=>{clearTimeout(o),n(t?.reason instanceof Se?t.reason:new Se(Te.RequestTimeout,String(t?.reason)))};t?.addEventListener("abort",s,{once:!0})})}function ub(e){let t=new AbortController,r=()=>t.abort(e?.reason);if(e?.addEventListener("abort",r,{once:!0}),e?.aborted)t.abort(e.reason);return{signal:t.signal,abort:(n)=>t.abort(n),dispose:()=>e?.removeEventListener("abort",r)}}var eN=["AnnotationsSchema","AudioContentSchema","BaseMetadataSchema","BlobResourceContentsSchema","BooleanSchemaSchema","CallToolRequestSchema","CallToolRequestParamsSchema","CallToolResultSchema","CancelledNotificationSchema","CancelledNotificationParamsSchema","CancelTaskRequestSchema","CancelTaskResultSchema","ClientCapabilitiesSchema","ClientNotificationSchema","ClientRequestSchema","ClientResultSchema","CompatibilityCallToolResultSchema","CompleteRequestSchema","CompleteRequestParamsSchema","CompleteResultSchema","ContentBlockSchema","CreateMessageRequestSchema","CreateMessageRequestParamsSchema","CreateMessageResultSchema","CreateMessageResultWithToolsSchema","CreateTaskResultSchema","CursorSchema","DiscoverRequestSchema","DiscoverResultSchema","ElicitationCompleteNotificationSchema","ElicitationCompleteNotificationParamsSchema","ElicitRequestSchema","ElicitRequestFormParamsSchema","ElicitRequestParamsSchema","ElicitRequestURLParamsSchema","ElicitResultSchema","EmbeddedResourceSchema","EmptyResultSchema","EnumSchemaSchema","GetPromptRequestSchema","GetPromptRequestParamsSchema","GetPromptResultSchema","GetTaskPayloadRequestSchema","GetTaskPayloadResultSchema","GetTaskRequestSchema","GetTaskResultSchema","IconSchema","IconsSchema","ImageContentSchema","ImplementationSchema","InitializedNotificationSchema","InitializeRequestSchema","InitializeRequestParamsSchema","InitializeResultSchema","JSONArraySchema","JSONObjectSchema","JSONRPCErrorResponseSchema","JSONRPCMessageSchema","JSONRPCNotificationSchema","JSONRPCRequestSchema","JSONRPCResponseSchema","JSONRPCResultResponseSchema","JSONValueSchema","LegacyTitledEnumSchemaSchema","ListPromptsRequestSchema","ListPromptsResultSchema","ListResourcesRequestSchema","ListResourcesResultSchema","ListResourceTemplatesRequestSchema","ListResourceTemplatesResultSchema","ListRootsRequestSchema","ListRootsResultSchema","ListTasksRequestSchema","ListTasksResultSchema","ListToolsRequestSchema","ListToolsResultSchema","LoggingLevelSchema","LoggingMessageNotificationSchema","LoggingMessageNotificationParamsSchema","ModelHintSchema","ModelPreferencesSchema","MultiSelectEnumSchemaSchema","NotificationSchema","NumberSchemaSchema","PaginatedRequestSchema","PaginatedRequestParamsSchema","PaginatedResultSchema","PingRequestSchema","PrimitiveSchemaDefinitionSchema","ProgressSchema","ProgressNotificationSchema","ProgressNotificationParamsSchema","ProgressTokenSchema","PromptSchema","PromptArgumentSchema","PromptListChangedNotificationSchema","PromptMessageSchema","PromptReferenceSchema","ReadResourceRequestSchema","ReadResourceRequestParamsSchema","ReadResourceResultSchema","RelatedTaskMetadataSchema","RequestSchema","RequestIdSchema","RequestMetaSchema","ResourceSchema","ResourceContentsSchema","ResourceLinkSchema","ResourceListChangedNotificationSchema","ResourceRequestParamsSchema","ResourceTemplateSchema","ResourceTemplateReferenceSchema","ResourceUpdatedNotificationSchema","ResourceUpdatedNotificationParamsSchema","ResultMetaObjectSchema","ResultSchema","RoleSchema","RootSchema","RootsListChangedNotificationSchema","SamplingContentSchema","SamplingMessageSchema","SamplingMessageContentBlockSchema","ServerCapabilitiesSchema","ServerNotificationSchema","ServerRequestSchema","ServerResultSchema","SetLevelRequestSchema","SetLevelRequestParamsSchema","SingleSelectEnumSchemaSchema","StringSchemaSchema","SubscribeRequestSchema","SubscribeRequestParamsSchema","SubscriptionFilterSchema","SubscriptionsAcknowledgedNotificationSchema","SubscriptionsAcknowledgedNotificationParamsSchema","SubscriptionsListenRequestSchema","SubscriptionsListenRequestParamsSchema","SubscriptionsListenResultSchema","SubscriptionsListenResultMetaSchema","TaskAugmentedRequestParamsSchema","TaskCreationParamsSchema","TaskMetadataSchema","TaskSchema","TaskStatusSchema","TaskStatusNotificationSchema","TaskStatusNotificationParamsSchema","TextContentSchema","TextResourceContentsSchema","TitledMultiSelectEnumSchemaSchema","TitledSingleSelectEnumSchemaSchema","ToolSchema","ToolAnnotationsSchema","ToolChoiceSchema","ToolExecutionSchema","ToolListChangedNotificationSchema","ToolResultContentSchema","ToolUseContentSchema","UnsubscribeRequestSchema","UnsubscribeRequestParamsSchema","UntitledMultiSelectEnumSchemaSchema","UntitledSingleSelectEnumSchemaSchema"],tN={IdJagTokenExchangeResponseSchema:fm,OAuthClientInformationFullSchema:hm,OAuthClientInformationSchema:zl,OAuthClientMetadataSchema:El,OAuthClientRegistrationErrorSchema:gm,OAuthErrorResponseSchema:mm,OAuthMetadataSchema:wl,OAuthProtectedResourceMetadataSchema:lm,OAuthTokenRevocationRequestSchema:ym,OAuthTokensSchema:pm,OpenIdProviderDiscoveryMetadataSchema:dm,OpenIdProviderMetadataSchema:Rl},lb={},db={};function pb(e,t){let r=e.slice(0,-6);lb[r]=t,db[r]=(n)=>t.safeParse(n).success}for(let e of eN)pb(e,xA[e]);for(let[e,t]of Object.entries(tN))pb(e,t);var rN=Object.freeze(lb),nN=Object.freeze(db);function oN(e){switch(e){case"initialize":case"notifications/initialized":return vn(void 0);case"server/discover":return vn(pa);default:return}}var fb=60000,sN=[Jr,Ko,Kr,dn],iN=["inputResponses","requestState"];function q0(e,t){let r=e.params;if(!ua(r))return{message:e,lifted:{}};let n=r._meta,o=ua(n)?sN.filter((c)=>(c in n)):[],s=t==="request"?iN.filter((c)=>(c in r)):[];if(o.length===0&&s.length===0)return{message:e,lifted:{}};let i={},a={...r};if(o.length>0&&ua(n)){let c={},u={...n};for(let l of o)c[l]=n[l],delete u[l];if(i.envelope=c,Object.keys(u).length>0)a._meta=u;else delete a._meta}for(let c of s){if(c==="inputResponses")i.inputResponses=a[c];if(c==="requestState")i.requestState=a[c];delete a[c]}return{message:{...e,params:a},lifted:i}}function M0(e,t){let r=e.validateResult(t,void 0);if(!r.ok&&r.reason==="not-in-era")return;return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(n){let o=e.validateResult(t,n);if(o.ok)return{value:o.value};return{issues:[{message:o.reason==="invalid"?o.message:`not-in-era: ${t}`}]}}}}}function fa(e){return()=>e}var aN=fa(void 0);function Um(e,t){return{...e,mcpReq:{...e.mcpReq,requestState:fa(t)}}}var mb;function Fm(e,t){mb(e,t)}var Vm=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;static{mb=(e,t)=>{e._negotiatedProtocolVersion=t}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??Lc,this.setNotificationHandler("notifications/cancelled",(t)=>{this._oncancel(t)}),this.setNotificationHandler("notifications/progress",(t)=>{this._onprogress(t)}),this.setRequestHandler("ping",(t)=>({}))}_shouldDropInbound(e){}_outboundMetaEnvelope(){}_envelopeOutbound(e){let t=this._outboundMetaEnvelope();if(t===void 0)return e;let r=e.params??{};return{...e,params:{...r,_meta:{...t,...r._meta}}}}_resolveNonCompleteResult(e,t){return Promise.reject(new Se(Te.UnsupportedResultType,`Unsupported result type '${e.kind}' for ${t.request.method}`,{resultType:e.kind,method:t.request.method}))}_getRequestHandler(e){return this._requestHandlers.get(e)}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),new Se(Te.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){this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{try{t?.()}finally{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),la(o)||Ul(o))this._onresponse(o);else if(rr(o))this._onrequest(o,s);else if(bn(o))this._onnotification(o,s);else this._onerror(Error(`Unknown message type: ${JSON.stringify(o)}`))},e.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear();for(let n of this._timeoutInfo.values())clearTimeout(n.timeoutId);this._timeoutInfo.clear();let t=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let r=new Se(Te.ConnectionClosed,"Connection closed");this._transport=void 0;try{this.onclose?.()}finally{for(let n of e.values())n(r);for(let n of t.values())n.abort(r)}}_onerror(e){this.onerror?.(e)}_onnotification(e,t){let{message:r}=q0(e,"notification"),n=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)==="drop")return;if(t?.classification!==void 0){let i=x0(t.classification);if(i!==n.era){this._onerror(Error(`Era mismatch on inbound notification '${r.method}': classified as ${i} but this instance serves ${n.era}`));return}}if(Sm(r.method)&&!n.hasNotificationMethod(r.method))return;let o=this._notificationHandlers.get(r.method),s=this.fallbackNotificationHandler;if(o===void 0&&s===void 0)return;Promise.resolve().then(()=>o===void 0?s(r):o(r,n)).catch((i)=>this._onerror(Error(`Uncaught error in notification handler: ${i}`)))}_onrequest(e,t){let{message:r,lifted:n}=q0(e,"request"),o=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)==="drop"){this._onerror(Error(`Dropped inbound request '${e.method}': not servable on this connection's protocol era`));return}let s=this._transport,i=(g,_,y)=>{let S={jsonrpc:"2.0",id:r.id,error:{code:g,message:_,...y!==void 0&&{data:y}}};s?.send(S).catch((v)=>this._onerror(Error(`Failed to send an error response: ${v}`)))};if(t?.classification!==void 0){let g=x0(t.classification);if(g!==o.era){this._onerror(Error(`Era mismatch on inbound request '${r.method}': classified as ${g} but this instance serves ${o.era}`));let _=t.classification.revision??g;i(Y.UnsupportedProtocolVersion,`Unsupported protocol version: ${_}`,{supported:this._supportedProtocolVersions,requested:_});return}}if(vm(r.method)&&!o.hasRequestMethod(r.method)){i(Y.MethodNotFound,"Method not found");return}let a=this._requestHandlers.get(r.method)??this.fallbackRequestHandler;if(a===void 0){i(Y.MethodNotFound,"Method not found");return}let c=o.checkInboundEnvelope(n);if(c!==void 0){i(Y.InvalidParams,c);return}let u=(g,_)=>this._notificationViaCodec(this._resolveOutboundCodec(g.method),g,{..._,relatedRequestId:r.id}),l=(g,_,y)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(g.method),g,_,{...y,relatedRequestId:r.id}),d=new AbortController;this._requestHandlerAbortControllers.set(r.id,d);let p=n.inputResponses===void 0?void 0:cN(n.inputResponses),m={sessionId:s?.sessionId,mcpReq:{id:r.id,method:r.method,_meta:r.params?._meta,...n.envelope!==void 0&&{envelope:n.envelope},...p!==void 0&&{inputResponses:p.accepted},...p!==void 0&&p.droppedKeys.length>0&&{droppedInputResponseKeys:p.droppedKeys},requestState:n.requestState===void 0?aN:fa(n.requestState),signal:d.signal,send:(g,_,y)=>{let S=this._resolveOutboundCodec(g.method);if(this._assertOutboundRequestInEra(S,g.method),cs(_))return l(g,_,y);let v=M0(S,g.method);if(v===void 0)throw TypeError(`'${g.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return l(g,v,_)},notify:u},http:t?.authInfo?{authInfo:t.authInfo}:void 0},h=this.buildContext(m,t);Promise.resolve().then(()=>a(r,h)).then(async(g)=>{if(d.signal.aborted)return;let _;try{_=o.encodeResult(r.method,g,this._outboundServerInfo())}catch(S){this._onerror(Error(`Failed to encode result for ${r.method}: ${S}`)),i(Y.InternalError,"Internal error");return}let y={result:_,jsonrpc:"2.0",id:r.id};await s?.send(y)},async(g)=>{if(d.signal.aborted)return;let _=Number.isSafeInteger(g.code)?g.code:Y.InternalError,y={jsonrpc:"2.0",id:r.id,error:{code:o.encodeErrorCode(_),message:g.message??"Internal error",...g.data!==void 0&&{data:g.data}}};await s?.send(y)}).catch((g)=>this._onerror(Error(`Failed to send response: ${g}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(r.id)===d)this._requestHandlerAbortControllers.delete(r.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._responseHandlers.get(t);if(r===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(t),this._cleanupTimeout(t),this._progressHandlers.delete(t),la(e))r(e);else r(de.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}request(e,t,r){let n=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(n,e.method),cs(t))return this._requestWithSchemaViaCodec(n,e,t,r);let o=M0(n,e.method);if(o===void 0)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(n,e,o,t)}_negotiatedWireCodec(){return vn(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=oN(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(vm(t)&&!e.hasRequestMethod(t))throw new Se(Te.MethodNotSupportedByProtocolVersion,`Method '${t}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t,era:e.era})}_requestWithSchema(e,t,r){let n=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(n,e.method),this._requestWithSchemaViaCodec(n,e,t,r)}_requestWithSchemaViaCodec(e,t,r,n){let{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i,headers:a}=n??{},c=Date.now(),u,l;return new Promise((d,p)=>{let m=(R)=>{p(R)};if(!this._transport){m(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(R){m(R);return}if(n?.signal?.aborted){let R=n.signal.reason;throw R instanceof Se?R:new Se(Te.RequestTimeout,String(R))}let h=e.era===pa&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,g=this._requestMessageId++;l=g;let _={...t,jsonrpc:"2.0",id:g};if(n?.onprogress)this._progressHandlers.set(g,n.onprogress),_.params={...t.params,_meta:{...t.params?._meta,progressToken:g}};let y=this._envelopeOutbound(_),S=!1,v=(R)=>{if(S)return;if(this._progressHandlers.delete(g),h===void 0)this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:g,reason:String(R)}}),{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i}).catch((b)=>this._onerror(Error(`Failed to send cancellation: ${b}`)));else h.abort();p(R instanceof Se?R:new Se(Te.RequestTimeout,String(R)))};this._responseHandlers.set(g,(R)=>{if(n?.signal?.aborted)return;if(S=!0,R instanceof Error)return p(R);let b;try{b=e.decodeResult(t.method,R.result)}catch(x){return p(x instanceof Error?x:Error(String(x)))}if(b.kind==="invalid")return p(b.error);if(b.kind==="input_required"){if(n?.allowInputRequired===!0)return d(uN(b));let x={codec:e,request:t,resultSchema:r,options:n,flowStartedAt:c,retry:(q,C)=>this._requestWithSchemaViaCodec(e,q===void 0?{method:t.method}:{method:t.method,params:q},r,C)};return d(this._resolveNonCompleteResult(b,x))}let E=b.result;go(r,E).then((x)=>{if(x.success)d(x.data);else p(new Se(Te.InvalidResult,`Invalid result for ${t.method}: ${x.error}`))},p)}),u=()=>v(n?.signal?.reason),n?.signal?.addEventListener("abort",u,{once:!0});let w=n?.timeout??fb,z=()=>v(new Se(Te.RequestTimeout,"Request timed out",{timeout:w}));this._setupTimeout(g,w,n?.maxTotalTimeout,z,n?.resetTimeoutOnProgress??!1),this._transport.send(y,{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i,headers:a,requestSignal:h?.signal}).catch((R)=>{this._progressHandlers.delete(g),p(R)})}).finally(()=>{if(u)n?.signal?.removeEventListener("abort",u);if(l!==void 0)this._responseHandlers.delete(l),this._cleanupTimeout(l)})}async notification(e,t){return this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,r){if(!this._transport)throw new Se(Te.NotConnected,"Not connected");if(Sm(t.method)&&!e.hasNotificationMethod(t.method))throw new Se(Te.MethodNotSupportedByProtocolVersion,`Notification '${t.method}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t.method,era:e.era});this.assertNotificationCapability(t.method);let n=this._envelopeOutbound({jsonrpc:"2.0",...t});if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!r?.relatedRequestId){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;this._transport?.send(n,r).catch((o)=>this._onerror(o))});return}await this._transport.send(n,r)}setRequestHandler(e,t,r){this.assertRequestHandlerCapability(e);let n;if(typeof t==="function"){if(!vm(e))throw TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);n=(o,s)=>{let i=this._negotiatedWireCodec(),a=i.validateRequest(e,o);if(!a.ok&&a.reason==="not-in-era")a=i.validateInputRequest(e,o);if(!a.ok){if(a.reason==="not-in-era")throw new de(Y.InternalError,`No wire schema for ${e} in the resolved era`);throw Error(a.message)}return Promise.resolve(t(a.value,s))}}else if(r)n=async(o,s)=>{let i=await go(t.params,{...o.params});if(!i.success)throw new de(Y.InvalidParams,`Invalid params for ${e}: ${i.error}`);return r(i.data,s)};else throw TypeError("setRequestHandler: handler is required");this._requestHandlers.set(e,this._wrapHandler(e,n))}_wrapHandler(e,t){return t}_outboundServerInfo(){}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,r){if(typeof t==="function"){if(!Sm(e))throw TypeError(`'${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(e,(n,o)=>{let s=o.validateNotification(e,n);if(!s.ok){if(s.reason==="not-in-era")throw new de(Y.InternalError,`No wire schema for ${e} in the resolved era`);throw Error(s.message)}return Promise.resolve(t(s.value))});return}if(!r)throw TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(e,async(n)=>{let o=await go(t.params,{...n.params});if(!o.success)throw new de(Y.InvalidParams,`Invalid params for notification ${e}: ${o.error}`);await r(o.data,n)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function ua(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function Hm(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];r[o]=ua(i)&&ua(s)?{...i,...s}:s}return r}function L0(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function cN(e){let t={},r=[];if(!L0(e))return{accepted:t,droppedKeys:r};for(let[n,o]of Object.entries(e)){if(!L0(o)||"method"in o||"result"in o){r.push(n);continue}t[n]=o}return{accepted:t,droppedKeys:r}}function uN(e){return{resultType:"input_required",inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState}}}/*!
48
48
  * content-type
49
49
  * Copyright(c) 2015 Douglas Christopher Wilson
50
50
  * MIT Licensed
51
- */var aN=G((e)=>{var t=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,r=/\\([\u000b\u0020-\u00ff])/g,o=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;e.parse=n;function n(a){if(!a)throw TypeError("argument string is required");var c=typeof a==="object"?s(a):a;if(typeof c!=="string")throw TypeError("argument string is required to be a string");var u=c.indexOf(";"),l=u!==-1?c.slice(0,u).trim():c.trim();if(!o.test(l))throw TypeError("invalid media type");var d=new i(l.toLowerCase());if(u!==-1){var f,m,h;t.lastIndex=u;while(m=t.exec(c)){if(m.index!==u)throw TypeError("invalid parameter format");if(u+=m[0].length,f=m[1].toLowerCase(),h=m[2],h.charCodeAt(0)===34){if(h=h.slice(1,-1),h.indexOf("\\")!==-1)h=h.replace(r,"$1")}d.parameters[f]=h}if(u!==c.length)throw TypeError("invalid parameter format")}return d}function s(a){var c;if(typeof a.getHeader==="function")c=a.getHeader("content-type");else if(typeof a.headers==="object")c=a.headers&&a.headers["content-type"];if(typeof c!=="string")throw TypeError("content-type header is missing from object");return c}function i(a){this.parameters=Object.create(null),this.type=a}}),t3=oc(aN(),1);var M0=10485760,Em=class{_buffer;_maxBufferSize;constructor(e){this._maxBufferSize=e?.maxBufferSize??M0}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(){while(this._buffer){let e=this._buffer.indexOf(`
52
- `);if(e===-1)return null;let t=this._buffer.toString("utf8",0,e).replace(/\r$/,"");this._buffer=this._buffer.subarray(e+1);try{return L0(t)}catch(r){if(r instanceof SyntaxError)continue;throw r}}return null}clear(){this._buffer=void 0}};function L0(e){return xi.parse(JSON.parse(e))}function zm(e){return JSON.stringify(e)+`
53
- `}var cN=/^[A-Za-z0-9._-]{1,128}$/;function uN(e){let t=[];if(e.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(e.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${e.length})`]};if(e.includes(" "))t.push("Tool name contains spaces, which may cause parsing issues");if(e.includes(","))t.push("Tool name contains commas, which may cause parsing issues");if(e.startsWith("-")||e.endsWith("-"))t.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts");if(e.startsWith(".")||e.endsWith("."))t.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts");if(!cN.test(e)){let r=[...e].filter((o)=>!/[A-Za-z0-9._-]/.test(o)).filter((o,n,s)=>s.indexOf(o)===n);return t.push(`Tool name contains invalid characters: ${r.map((o)=>`"${o}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:t}}return{isValid:!0,warnings:t}}function lN(e,t){if(t.length>0){console.warn(`Tool name validation warning for "${e}":`);for(let r of t)console.warn(` - ${r}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function Pm(e){let t=uN(e);return lN(e,t.warnings),t.isValid}function dN(e){return typeof e==="object"&&e!==null&&"_zod"in e}function pN(e){return typeof e==="object"&&e!==null&&!("_zod"in e)&&"_def"in e&&typeof e._def?.typeName==="string"}function fN(e){if(typeof e!=="object"||e===null)return!1;if(rs(e))return!1;let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)return!1;return Object.values(e).every((r)=>dN(r))}function Cl(e){if(e===void 0)return;if(fN(e))return T(e);if(typeof e==="object"&&e!==null&&!rs(e)&&Object.values(e).some((t)=>pN(t)))throw TypeError("Raw-shape inputSchema/outputSchema/argsSchema fields must be Zod v4 schemas. Got a Zod v3 field schema. Import from `zod/v4` (or upgrade your zod import), or wrap with `z.object({...})` yourself.");if(!rs(e))throw TypeError("inputSchema/outputSchema/argsSchema must be a Standard Schema (e.g. z.object({...})) or a raw Zod shape ({ field: z.string() }).");return e}var xl=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;var t=class{};e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var r=class extends t{constructor(y){super();if(!e.IDENTIFIER.test(y))throw Error("CodeGen: name must be a valid identifier");this.str=y}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};e.Name=r;var o=class extends t{constructor(y){super();this._items=typeof y==="string"?[y]:y}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let y=this._items[0];return y===""||y==='""'}get str(){var y;return(y=this._str)!==null&&y!==void 0?y:this._str=this._items.reduce((S,v)=>`${S}${v}`,"")}get names(){var y;return(y=this._names)!==null&&y!==void 0?y:this._names=this._items.reduce((S,v)=>{if(v instanceof r)S[v.str]=(S[v.str]||0)+1;return S},{})}};e._Code=o,e.nil=new o("");function n(y,...S){let v=[y[0]],w=0;while(w<S.length)a(v,S[w]),v.push(y[++w]);return new o(v)}e._=n;let s=new o("+");function i(y,...S){let v=[m(y[0])],w=0;while(w<S.length)v.push(s),a(v,S[w]),v.push(s,m(y[++w]));return c(v),new o(v)}e.str=i;function a(y,S){if(S instanceof o)y.push(...S._items);else if(S instanceof r)y.push(S);else y.push(d(S))}e.addCodeArg=a;function c(y){let S=1;while(S<y.length-1){if(y[S]===s){let v=u(y[S-1],y[S+1]);if(v!==void 0){y.splice(S-1,3,v);continue}y[S++]="+"}S++}}function u(y,S){if(S==='""')return y;if(y==='""')return S;if(typeof y=="string"){if(S instanceof r||y[y.length-1]!=='"')return;if(typeof S!="string")return`${y.slice(0,-1)}${S}"`;if(S[0]==='"')return y.slice(0,-1)+S.slice(1);return}if(typeof S=="string"&&S[0]==='"'&&!(y instanceof r))return`"${y}${S.slice(1)}`}function l(y,S){return S.emptyStr()?y:y.emptyStr()?S:i`${y}${S}`}e.strConcat=l;function d(y){return typeof y=="number"||typeof y=="boolean"||y===null?y:m(Array.isArray(y)?y.join(","):y)}function f(y){return new o(m(y))}e.stringify=f;function m(y){return JSON.stringify(y).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=m;function h(y){return typeof y=="string"&&e.IDENTIFIER.test(y)?new o(`.${y}`):n`[${y}]`}e.getProperty=h;function g(y){if(typeof y=="string"&&e.IDENTIFIER.test(y))return new o(`${y}`);throw Error(`CodeGen: invalid export name: ${y}, use explicit $id name mapping`)}e.getEsmExportName=g;function _(y){return new o(y.toString())}e.regexpCode=_}),D0=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;let t=xl();var r=class extends Error{constructor(c){super(`CodeGen: "code" for ${c} not defined`);this.value=c.value}},o;(function(c){c[c.Started=0]="Started",c[c.Completed=1]="Completed"})(o||(e.UsedValueState=o={})),e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};var n=class{constructor({prefixes:c,parent:u}={}){this._names={},this._prefixes=c,this._parent=u}toName(c){return c instanceof t.Name?c:this.name(c)}name(c){return new t.Name(this._newName(c))}_newName(c){let u=this._names[c]||this._nameGroup(c);return`${c}${u.index++}`}_nameGroup(c){var u,l;if(((l=(u=this._parent)===null||u===void 0?void 0:u._prefixes)===null||l===void 0?void 0:l.has(c))||this._prefixes&&!this._prefixes.has(c))throw Error(`CodeGen: prefix "${c}" is not allowed in this scope`);return this._names[c]={prefix:c,index:0}}};e.Scope=n;var s=class extends t.Name{constructor(c,u){super(u);this.prefix=c}setValue(c,{property:u,itemIndex:l}){this.value=c,this.scopePath=t._`.${new t.Name(u)}[${l}]`}};e.ValueScopeName=s;let i=t._`\n`;var a=class extends n{constructor(c){super(c);this._values={},this._scope=c.scope,this.opts={...c,_n:c.lines?i:t.nil}}get(){return this._scope}name(c){return new s(c,this._newName(c))}value(c,u){var l;if(u.ref===void 0)throw Error("CodeGen: ref must be passed in value");let d=this.toName(c),{prefix:f}=d,m=(l=u.key)!==null&&l!==void 0?l:u.ref,h=this._values[f];if(h){let y=h.get(m);if(y)return y}else h=this._values[f]=new Map;h.set(m,d);let g=this._scope[f]||(this._scope[f]=[]),_=g.length;return g[_]=u.ref,d.setValue(u,{property:f,itemIndex:_}),d}getValue(c,u){let l=this._values[c];if(!l)return;return l.get(u)}scopeRefs(c,u=this._values){return this._reduceValues(u,(l)=>{if(l.scopePath===void 0)throw Error(`CodeGen: name "${l}" has no value`);return t._`${c}${l.scopePath}`})}scopeCode(c=this._values,u,l){return this._reduceValues(c,(d)=>{if(d.value===void 0)throw Error(`CodeGen: name "${d}" has no value`);return d.value.code},u,l)}_reduceValues(c,u,l={},d){let f=t.nil;for(let m in c){let h=c[m];if(!h)continue;let g=l[m]=l[m]||new Map;h.forEach((_)=>{if(g.has(_))return;g.set(_,o.Started);let y=u(_);if(y){let S=this.opts.es5?e.varKinds.var:e.varKinds.const;f=t._`${f}${S} ${_} = ${y};${this.opts._n}`}else if(y=d===null||d===void 0?void 0:d(_))f=t._`${f}${y}${this.opts._n}`;else throw new r(_);g.set(_,o.Completed)})}return f}};e.ValueScope=a}),be=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;let t=xl(),r=D0();var o=xl();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return o._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return o.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return o.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return o.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return o.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return o.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return o.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return o.Name}});var n=D0();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return n.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return n.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return n.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return n.varKinds}}),e.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("+")};var s=class{optimizeNodes(){return this}optimizeNames(P,k){return this}},i=class extends s{constructor(P,k,j){super();this.varKind=P,this.name=k,this.rhs=j}render({es5:P,_n:k}){let j=P?r.varKinds.var:this.varKind,W=this.rhs===void 0?"":` = ${this.rhs}`;return`${j} ${this.name}${W};`+k}optimizeNames(P,k){if(!P[this.name.str])return;if(this.rhs)this.rhs=H(this.rhs,P,k);return this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},a=class extends s{constructor(P,k,j){super();this.lhs=P,this.rhs=k,this.sideEffects=j}render({_n:P}){return`${this.lhs} = ${this.rhs};`+P}optimizeNames(P,k){if(this.lhs instanceof t.Name&&!P[this.lhs.str]&&!this.sideEffects)return;return this.rhs=H(this.rhs,P,k),this}get names(){return B(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}},c=class extends a{constructor(P,k,j,W){super(P,j,W);this.op=k}render({_n:P}){return`${this.lhs} ${this.op}= ${this.rhs};`+P}},u=class extends s{constructor(P){super();this.label=P,this.names={}}render({_n:P}){return`${this.label}:`+P}},l=class extends s{constructor(P){super();this.label=P,this.names={}}render({_n:P}){return`break${this.label?` ${this.label}`:""};`+P}},d=class extends s{constructor(P){super();this.error=P}render({_n:P}){return`throw ${this.error};`+P}get names(){return this.error.names}},f=class extends s{constructor(P){super();this.code=P}render({_n:P}){return`${this.code};`+P}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(P,k){return this.code=H(this.code,P,k),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}},m=class extends s{constructor(P=[]){super();this.nodes=P}render(P){return this.nodes.reduce((k,j)=>k+j.render(P),"")}optimizeNodes(){let{nodes:P}=this,k=P.length;while(k--){let j=P[k].optimizeNodes();if(Array.isArray(j))P.splice(k,1,...j);else if(j)P[k]=j;else P.splice(k,1)}return P.length>0?this:void 0}optimizeNames(P,k){let{nodes:j}=this,W=j.length;while(W--){let ue=j[W];if(ue.optimizeNames(P,k))continue;ge(P,ue.names),j.splice(W,1)}return j.length>0?this:void 0}get names(){return this.nodes.reduce((P,k)=>F(P,k.names),{})}},h=class extends m{render(P){return"{"+P._n+super.render(P)+"}"+P._n}},g=class extends m{},_=class extends h{};_.kind="else";var y=class P extends h{constructor(k,j){super(j);this.condition=k}render(k){let j=`if(${this.condition})`+super.render(k);if(this.else)j+="else "+this.else.render(k);return j}optimizeNodes(){super.optimizeNodes();let k=this.condition;if(k===!0)return this.nodes;let j=this.else;if(j){let W=j.optimizeNodes();j=this.else=Array.isArray(W)?new _(W):W}if(j){if(k===!1)return j instanceof P?j:j.nodes;if(this.nodes.length)return this;return new P(Ie(k),j instanceof P?[j]:j.nodes)}if(k===!1||!this.nodes.length)return;return this}optimizeNames(k,j){var W;if(this.else=(W=this.else)===null||W===void 0?void 0:W.optimizeNames(k,j),!(super.optimizeNames(k,j)||this.else))return;return this.condition=H(this.condition,k,j),this}get names(){let k=super.names;if(B(k,this.condition),this.else)F(k,this.else.names);return k}};y.kind="if";var S=class extends h{};S.kind="for";var v=class extends S{constructor(P){super();this.iteration=P}render(P){return`for(${this.iteration})`+super.render(P)}optimizeNames(P,k){if(!super.optimizeNames(P,k))return;return this.iteration=H(this.iteration,P,k),this}get names(){return F(super.names,this.iteration.names)}},w=class extends S{constructor(P,k,j,W){super();this.varKind=P,this.name=k,this.from=j,this.to=W}render(P){let k=P.es5?r.varKinds.var:this.varKind,{name:j,from:W,to:ue}=this;return`for(${k} ${j}=${W}; ${j}<${ue}; ${j}++)`+super.render(P)}get names(){return B(B(super.names,this.from),this.to)}},z=class extends S{constructor(P,k,j,W){super();this.loop=P,this.varKind=k,this.name=j,this.iterable=W}render(P){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(P)}optimizeNames(P,k){if(!super.optimizeNames(P,k))return;return this.iterable=H(this.iterable,P,k),this}get names(){return F(super.names,this.iterable.names)}},R=class extends h{constructor(P,k,j){super();this.name=P,this.args=k,this.async=j}render(P){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(P)}};R.kind="func";var b=class extends m{render(P){return"return "+super.render(P)}};b.kind="return";var E=class extends h{render(P){let k="try"+super.render(P);if(this.catch)k+=this.catch.render(P);if(this.finally)k+=this.finally.render(P);return k}optimizeNodes(){var P,k;return super.optimizeNodes(),(P=this.catch)===null||P===void 0||P.optimizeNodes(),(k=this.finally)===null||k===void 0||k.optimizeNodes(),this}optimizeNames(P,k){var j,W;return super.optimizeNames(P,k),(j=this.catch)===null||j===void 0||j.optimizeNames(P,k),(W=this.finally)===null||W===void 0||W.optimizeNames(P,k),this}get names(){let P=super.names;if(this.catch)F(P,this.catch.names);if(this.finally)F(P,this.finally.names);return P}},C=class extends h{constructor(P){super();this.error=P}render(P){return`catch(${this.error})`+super.render(P)}};C.kind="catch";var q=class extends h{render(P){return"finally"+super.render(P)}};q.kind="finally";var x=class{constructor(P,k={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...k,_n:k.lines?`
54
- `:""},this._extScope=P,this._scope=new r.Scope({parent:P}),this._nodes=[new g]}toString(){return this._root.render(this.opts)}name(P){return this._scope.name(P)}scopeName(P){return this._extScope.name(P)}scopeValue(P,k){let j=this._extScope.value(P,k);return(this._values[j.prefix]||(this._values[j.prefix]=new Set)).add(j),j}getScopeValue(P,k){return this._extScope.getValue(P,k)}scopeRefs(P){return this._extScope.scopeRefs(P,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(P,k,j,W){let ue=this._scope.toName(k);if(j!==void 0&&W)this._constants[ue.str]=j;return this._leafNode(new i(P,ue,j)),ue}const(P,k,j){return this._def(r.varKinds.const,P,k,j)}let(P,k,j){return this._def(r.varKinds.let,P,k,j)}var(P,k,j){return this._def(r.varKinds.var,P,k,j)}assign(P,k,j){return this._leafNode(new a(P,k,j))}add(P,k){return this._leafNode(new c(P,e.operators.ADD,k))}code(P){if(typeof P=="function")P();else if(P!==t.nil)this._leafNode(new f(P));return this}object(...P){let k=["{"];for(let[j,W]of P){if(k.length>1)k.push(",");if(k.push(j),j!==W||this.opts.es5)k.push(":"),(0,t.addCodeArg)(k,W)}return k.push("}"),new t._Code(k)}if(P,k,j){if(this._blockNode(new y(P)),k&&j)this.code(k).else().code(j).endIf();else if(k)this.code(k).endIf();else if(j)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(P){return this._elseNode(new y(P))}else(){return this._elseNode(new _)}endIf(){return this._endBlockNode(y,_)}_for(P,k){if(this._blockNode(P),k)this.code(k).endFor();return this}for(P,k){return this._for(new v(P),k)}forRange(P,k,j,W,ue=this.opts.es5?r.varKinds.var:r.varKinds.let){let Ee=this._scope.toName(P);return this._for(new w(ue,Ee,k,j),()=>W(Ee))}forOf(P,k,j,W=r.varKinds.const){let ue=this._scope.toName(P);if(this.opts.es5){let Ee=k instanceof t.Name?k:this.var("_arr",k);return this.forRange("_i",0,t._`${Ee}.length`,(ye)=>{this.var(ue,t._`${Ee}[${ye}]`),j(ue)})}return this._for(new z("of",W,ue,k),()=>j(ue))}forIn(P,k,j,W=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(P,t._`Object.keys(${k})`,j);let ue=this._scope.toName(P);return this._for(new z("in",W,ue,k),()=>j(ue))}endFor(){return this._endBlockNode(S)}label(P){return this._leafNode(new u(P))}break(P){return this._leafNode(new l(P))}return(P){let k=new b;if(this._blockNode(k),this.code(P),k.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(b)}try(P,k,j){if(!k&&!j)throw Error('CodeGen: "try" without "catch" and "finally"');let W=new E;if(this._blockNode(W),this.code(P),k){let ue=this.name("e");this._currNode=W.catch=new C(ue),k(ue)}if(j)this._currNode=W.finally=new q,this.code(j);return this._endBlockNode(C,q)}throw(P){return this._leafNode(new d(P))}block(P,k){if(this._blockStarts.push(this._nodes.length),P)this.code(P).endBlock(k);return this}endBlock(P){let k=this._blockStarts.pop();if(k===void 0)throw Error("CodeGen: not in self-balancing block");let j=this._nodes.length-k;if(j<0||P!==void 0&&j!==P)throw Error(`CodeGen: wrong number of nodes: ${j} vs ${P} expected`);return this._nodes.length=k,this}func(P,k=t.nil,j,W){if(this._blockNode(new R(P,k,j)),W)this.code(W).endFunc();return this}endFunc(){return this._endBlockNode(R)}optimize(P=1){while(P-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(P){return this._currNode.nodes.push(P),this}_blockNode(P){this._currNode.nodes.push(P),this._nodes.push(P)}_endBlockNode(P,k){let j=this._currNode;if(j instanceof P||k&&j instanceof k)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${k?`${P.kind}/${k.kind}`:P.kind}"`)}_elseNode(P){let k=this._currNode;if(!(k instanceof y))throw Error('CodeGen: "else" without "if"');return this._currNode=k.else=P,this}get _root(){return this._nodes[0]}get _currNode(){let P=this._nodes;return P[P.length-1]}set _currNode(P){let k=this._nodes;k[k.length-1]=P}};e.CodeGen=x;function F(P,k){for(let j in k)P[j]=(P[j]||0)+(k[j]||0);return P}function B(P,k){return k instanceof t._CodeOrName?F(P,k.names):P}function H(P,k,j){if(P instanceof t.Name)return W(P);if(!ue(P))return P;return new t._Code(P._items.reduce((Ee,ye)=>{if(ye instanceof t.Name)ye=W(ye);if(ye instanceof t._Code)Ee.push(...ye._items);else Ee.push(ye);return Ee},[]));function W(Ee){let ye=j[Ee.str];if(ye===void 0||k[Ee.str]!==1)return Ee;return delete k[Ee.str],ye}function ue(Ee){return Ee instanceof t._Code&&Ee._items.some((ye)=>ye instanceof t.Name&&k[ye.str]===1&&j[ye.str]!==void 0)}}function ge(P,k){for(let j in k)P[j]=(P[j]||0)-(k[j]||0)}function Ie(P){return typeof P=="boolean"||typeof P=="number"||P===null?!P:t._`!${K(P)}`}e.not=Ie;let Ne=M(e.operators.AND);function De(...P){return P.reduce(Ne)}e.and=De;let Pe=M(e.operators.OR);function O(...P){return P.reduce(Pe)}e.or=O;function M(P){return(k,j)=>k===t.nil?j:j===t.nil?k:t._`${K(k)} ${P} ${K(j)}`}function K(P){return P instanceof t.Name?P:t._`(${P})`}}),Oe=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0;let t=be(),r=xl();function o(R){let b={};for(let E of R)b[E]=!0;return b}e.toHash=o;function n(R,b){if(typeof b=="boolean")return b;if(Object.keys(b).length===0)return!0;return s(R,b),!i(b,R.self.RULES.all)}e.alwaysValidSchema=n;function s(R,b=R.schema){let{opts:E,self:C}=R;if(!E.strictSchema)return;if(typeof b==="boolean")return;let q=C.RULES.keywords;for(let x in b)if(!q[x])z(R,`unknown keyword: "${x}"`)}e.checkUnknownRules=s;function i(R,b){if(typeof R=="boolean")return!R;for(let E in R)if(b[E])return!0;return!1}e.schemaHasRules=i;function a(R,b){if(typeof R=="boolean")return!R;for(let E in R)if(E!=="$ref"&&b.all[E])return!0;return!1}e.schemaHasRulesButRef=a;function c({topSchemaRef:R,schemaPath:b},E,C,q){if(!q){if(typeof E=="number"||typeof E=="boolean")return E;if(typeof E=="string")return t._`${E}`}return t._`${R}${b}${(0,t.getProperty)(C)}`}e.schemaRefOrVal=c;function u(R){return f(decodeURIComponent(R))}e.unescapeFragment=u;function l(R){return encodeURIComponent(d(R))}e.escapeFragment=l;function d(R){if(typeof R=="number")return`${R}`;return R.replace(/~/g,"~0").replace(/\//g,"~1")}e.escapeJsonPointer=d;function f(R){return R.replace(/~1/g,"/").replace(/~0/g,"~")}e.unescapeJsonPointer=f;function m(R,b){if(Array.isArray(R))for(let E of R)b(E);else b(R)}e.eachItem=m;function h({mergeNames:R,mergeToName:b,mergeValues:E,resultToName:C}){return(q,x,F,B)=>{let H=F===void 0?x:F instanceof t.Name?(x instanceof t.Name?R(q,x,F):b(q,x,F),F):x instanceof t.Name?(b(q,F,x),x):E(x,F);return B===t.Name&&!(H instanceof t.Name)?C(q,H):H}}e.mergeEvaluated={props:h({mergeNames:(R,b,E)=>R.if(t._`${E} !== true && ${b} !== undefined`,()=>{R.if(t._`${b} === true`,()=>R.assign(E,!0),()=>R.assign(E,t._`${E} || {}`).code(t._`Object.assign(${E}, ${b})`))}),mergeToName:(R,b,E)=>R.if(t._`${E} !== true`,()=>{if(b===!0)R.assign(E,!0);else R.assign(E,t._`${E} || {}`),_(R,E,b)}),mergeValues:(R,b)=>R===!0?!0:{...R,...b},resultToName:g}),items:h({mergeNames:(R,b,E)=>R.if(t._`${E} !== true && ${b} !== undefined`,()=>R.assign(E,t._`${b} === true ? true : ${E} > ${b} ? ${E} : ${b}`)),mergeToName:(R,b,E)=>R.if(t._`${E} !== true`,()=>R.assign(E,b===!0?!0:t._`${E} > ${b} ? ${E} : ${b}`)),mergeValues:(R,b)=>R===!0?!0:Math.max(R,b),resultToName:(R,b)=>R.var("items",b)})};function g(R,b){if(b===!0)return R.var("props",!0);let E=R.var("props",t._`{}`);if(b!==void 0)_(R,E,b);return E}e.evaluatedPropsToName=g;function _(R,b,E){Object.keys(E).forEach((C)=>R.assign(t._`${b}${(0,t.getProperty)(C)}`,!0))}e.setEvaluated=_;let y={};function S(R,b){return R.scopeValue("func",{ref:b,code:y[b.code]||(y[b.code]=new r._Code(b.code))})}e.useFunc=S;var v;(function(R){R[R.Num=0]="Num",R[R.Str=1]="Str"})(v||(e.Type=v={}));function w(R,b,E){if(R instanceof t.Name){let C=b===v.Num;return E?C?t._`"[" + ${R} + "]"`:t._`"['" + ${R} + "']"`:C?t._`"/" + ${R}`:t._`"/" + ${R}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return E?(0,t.getProperty)(R).toString():"/"+d(R)}e.getErrorPath=w;function z(R,b,E=R.opts.strictSchema){if(!E)return;if(b=`strict mode: ${b}`,E===!0)throw Error(b);R.self.logger.warn(b)}e.checkStrictMode=z}),pr=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r={data:new t.Name("data"),valCxt:new t.Name("valCxt"),instancePath:new t.Name("instancePath"),parentData:new t.Name("parentData"),parentDataProperty:new t.Name("parentDataProperty"),rootData:new t.Name("rootData"),dynamicAnchors:new t.Name("dynamicAnchors"),vErrors:new t.Name("vErrors"),errors:new t.Name("errors"),this:new t.Name("this"),self:new t.Name("self"),scope:new t.Name("scope"),json:new t.Name("json"),jsonPos:new t.Name("jsonPos"),jsonLen:new t.Name("jsonLen"),jsonPart:new t.Name("jsonPart")};e.default=r}),Al=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;let t=be(),r=Oe(),o=pr();e.keywordError={message:({keyword:_})=>t.str`must pass "${_}" keyword validation`},e.keyword$DataError={message:({keyword:_,schemaType:y})=>y?t.str`"${_}" keyword must be ${y} ($data)`:t.str`"${_}" keyword is invalid ($data)`};function n(_,y=e.keywordError,S,v){let{it:w}=_,{gen:z,compositeRule:R,allErrors:b}=w,E=d(_,y,S);if(v!==null&&v!==void 0?v:R||b)c(z,E);else u(w,t._`[${E}]`)}e.reportError=n;function s(_,y=e.keywordError,S){let{it:v}=_,{gen:w,compositeRule:z,allErrors:R}=v;if(c(w,d(_,y,S)),!(z||R))u(v,o.default.vErrors)}e.reportExtraError=s;function i(_,y){_.assign(o.default.errors,y),_.if(t._`${o.default.vErrors} !== null`,()=>_.if(y,()=>_.assign(t._`${o.default.vErrors}.length`,y),()=>_.assign(o.default.vErrors,null)))}e.resetErrorsCount=i;function a({gen:_,keyword:y,schemaValue:S,data:v,errsCount:w,it:z}){if(w===void 0)throw Error("ajv implementation error");let R=_.name("err");_.forRange("i",w,o.default.errors,(b)=>{if(_.const(R,t._`${o.default.vErrors}[${b}]`),_.if(t._`${R}.instancePath === undefined`,()=>_.assign(t._`${R}.instancePath`,(0,t.strConcat)(o.default.instancePath,z.errorPath))),_.assign(t._`${R}.schemaPath`,t.str`${z.errSchemaPath}/${y}`),z.opts.verbose)_.assign(t._`${R}.schema`,S),_.assign(t._`${R}.data`,v)})}e.extendErrors=a;function c(_,y){let S=_.const("err",y);_.if(t._`${o.default.vErrors} === null`,()=>_.assign(o.default.vErrors,t._`[${S}]`),t._`${o.default.vErrors}.push(${S})`),_.code(t._`${o.default.errors}++`)}function u(_,y){let{gen:S,validateName:v,schemaEnv:w}=_;if(w.$async)S.throw(t._`new ${_.ValidationError}(${y})`);else S.assign(t._`${v}.errors`,y),S.return(!1)}let l={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function d(_,y,S){let{createErrors:v}=_.it;if(v===!1)return t._`{}`;return f(_,y,S)}function f(_,y,S={}){let{gen:v,it:w}=_,z=[m(w,S),h(_,S)];return g(_,y,z),v.object(...z)}function m({errorPath:_},{instancePath:y}){let S=y?t.str`${_}${(0,r.getErrorPath)(y,r.Type.Str)}`:_;return[o.default.instancePath,(0,t.strConcat)(o.default.instancePath,S)]}function h({keyword:_,it:{errSchemaPath:y}},{schemaPath:S,parentSchema:v}){let w=v?y:t.str`${y}/${_}`;if(S)w=t.str`${w}${(0,r.getErrorPath)(S,r.Type.Str)}`;return[l.schemaPath,w]}function g(_,{params:y,message:S},v){let{keyword:w,data:z,schemaValue:R,it:b}=_,{opts:E,propertyName:C,topSchemaRef:q,schemaPath:x}=b;if(v.push([l.keyword,w],[l.params,typeof y=="function"?y(_):y||t._`{}`]),E.messages)v.push([l.message,typeof S=="function"?S(_):S]);if(E.verbose)v.push([l.schema,R],[l.parentSchema,t._`${q}${x}`],[o.default.data,z]);if(C)v.push([l.propertyName,C])}}),mN=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;let t=Al(),r=be(),o=pr(),n={message:"boolean schema is false"};function s(c){let{gen:u,schema:l,validateName:d}=c;if(l===!1)a(c,!1);else if(typeof l=="object"&&l.$async===!0)u.return(o.default.data);else u.assign(r._`${d}.errors`,null),u.return(!0)}e.topBoolOrEmptySchema=s;function i(c,u){let{gen:l,schema:d}=c;if(d===!1)l.var(u,!1),a(c);else l.var(u,!0)}e.boolOrEmptySchema=i;function a(c,u){let{gen:l,data:d}=c,f={gen:l,keyword:"false schema",data:d,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:c};(0,t.reportError)(f,n,void 0,u)}}),U0=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getRules=e.isJSONType=void 0;let t=new Set(["string","number","integer","boolean","null","object","array"]);function r(n){return typeof n=="string"&&t.has(n)}e.isJSONType=r;function o(){let n={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...n,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},n.number,n.string,n.array,n.object],post:{rules:[]},all:{},keywords:{}}}e.getRules=o}),F0=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.shouldUseRule=e.shouldUseGroup=e.schemaHasRulesForType=void 0;function t({schema:n,self:s},i){let a=s.RULES.types[i];return a&&a!==!0&&r(n,a)}e.schemaHasRulesForType=t;function r(n,s){return s.rules.some((i)=>o(n,i))}e.shouldUseGroup=r;function o(n,s){var i;return n[s.keyword]!==void 0||((i=s.definition.implements)===null||i===void 0?void 0:i.some((a)=>n[a]!==void 0))}e.shouldUseRule=o}),Nl=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;let t=U0(),r=F0(),o=Al(),n=be(),s=Oe();var i;(function(v){v[v.Correct=0]="Correct",v[v.Wrong=1]="Wrong"})(i||(e.DataType=i={}));function a(v){let w=c(v.type);if(w.includes("null")){if(v.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!w.length&&v.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');if(v.nullable===!0)w.push("null")}return w}e.getSchemaTypes=a;function c(v){let w=Array.isArray(v)?v:v?[v]:[];if(w.every(t.isJSONType))return w;throw Error("type must be JSONType or JSONType[]: "+w.join(","))}e.getJSONTypes=c;function u(v,w){let{gen:z,data:R,opts:b}=v,E=d(w,b.coerceTypes),C=w.length>0&&!(E.length===0&&w.length===1&&(0,r.schemaHasRulesForType)(v,w[0]));if(C){let q=g(w,R,b.strictNumbers,i.Wrong);z.if(q,()=>{if(E.length)f(v,w,E);else y(v)})}return C}e.coerceAndCheckDataType=u;let l=new Set(["string","number","integer","boolean","null"]);function d(v,w){return w?v.filter((z)=>l.has(z)||w==="array"&&z==="array"):[]}function f(v,w,z){let{gen:R,data:b,opts:E}=v,C=R.let("dataType",n._`typeof ${b}`),q=R.let("coerced",n._`undefined`);if(E.coerceTypes==="array")R.if(n._`${C} == 'object' && Array.isArray(${b}) && ${b}.length == 1`,()=>R.assign(b,n._`${b}[0]`).assign(C,n._`typeof ${b}`).if(g(w,b,E.strictNumbers),()=>R.assign(q,b)));R.if(n._`${q} !== undefined`);for(let F of z)if(l.has(F)||F==="array"&&E.coerceTypes==="array")x(F);R.else(),y(v),R.endIf(),R.if(n._`${q} !== undefined`,()=>{R.assign(b,q),m(v,q)});function x(F){switch(F){case"string":R.elseIf(n._`${C} == "number" || ${C} == "boolean"`).assign(q,n._`"" + ${b}`).elseIf(n._`${b} === null`).assign(q,n._`""`);return;case"number":R.elseIf(n._`${C} == "boolean" || ${b} === null
55
- || (${C} == "string" && ${b} && ${b} == +${b})`).assign(q,n._`+${b}`);return;case"integer":R.elseIf(n._`${C} === "boolean" || ${b} === null
56
- || (${C} === "string" && ${b} && ${b} == +${b} && !(${b} % 1))`).assign(q,n._`+${b}`);return;case"boolean":R.elseIf(n._`${b} === "false" || ${b} === 0 || ${b} === null`).assign(q,!1).elseIf(n._`${b} === "true" || ${b} === 1`).assign(q,!0);return;case"null":R.elseIf(n._`${b} === "" || ${b} === 0 || ${b} === false`),R.assign(q,null);return;case"array":R.elseIf(n._`${C} === "string" || ${C} === "number"
57
- || ${C} === "boolean" || ${b} === null`).assign(q,n._`[${b}]`)}}}function m({gen:v,parentData:w,parentDataProperty:z},R){v.if(n._`${w} !== undefined`,()=>v.assign(n._`${w}[${z}]`,R))}function h(v,w,z,R=i.Correct){let b=R===i.Correct?n.operators.EQ:n.operators.NEQ,E;switch(v){case"null":return n._`${w} ${b} null`;case"array":E=n._`Array.isArray(${w})`;break;case"object":E=n._`${w} && typeof ${w} == "object" && !Array.isArray(${w})`;break;case"integer":E=C(n._`!(${w} % 1) && !isNaN(${w})`);break;case"number":E=C();break;default:return n._`typeof ${w} ${b} ${v}`}return R===i.Correct?E:(0,n.not)(E);function C(q=n.nil){return(0,n.and)(n._`typeof ${w} == "number"`,q,z?n._`isFinite(${w})`:n.nil)}}e.checkDataType=h;function g(v,w,z,R){if(v.length===1)return h(v[0],w,z,R);let b,E=(0,s.toHash)(v);if(E.array&&E.object){let C=n._`typeof ${w} != "object"`;b=E.null?C:n._`!${w} || ${C}`,delete E.null,delete E.array,delete E.object}else b=n.nil;if(E.number)delete E.integer;for(let C in E)b=(0,n.and)(b,h(C,w,z,R));return b}e.checkDataTypes=g;let _={message:({schema:v})=>`must be ${v}`,params:({schema:v,schemaValue:w})=>typeof v=="string"?n._`{type: ${v}}`:n._`{type: ${w}}`};function y(v){let w=S(v);(0,o.reportError)(w,_)}e.reportTypeError=y;function S(v){let{gen:w,data:z,schema:R}=v,b=(0,s.schemaRefOrVal)(v,R,"type");return{gen:w,keyword:"type",data:z,schema:R.type,schemaCode:b,schemaValue:b,parentSchema:R,params:{},it:v}}}),hN=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.assignDefaults=void 0;let t=be(),r=Oe();function o(s,i){let{properties:a,items:c}=s.schema;if(i==="object"&&a)for(let u in a)n(s,u,a[u].default);else if(i==="array"&&Array.isArray(c))c.forEach((u,l)=>n(s,l,u.default))}e.assignDefaults=o;function n(s,i,a){let{gen:c,compositeRule:u,data:l,opts:d}=s;if(a===void 0)return;let f=t._`${l}${(0,t.getProperty)(i)}`;if(u){(0,r.checkStrictMode)(s,`default is ignored for: ${f}`);return}let m=t._`${f} === undefined`;if(d.useDefaults==="empty")m=t._`${m} || ${f} === null || ${f} === ""`;c.if(m,t._`${f} = ${(0,t.stringify)(a)}`)}}),fr=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateUnion=e.validateArray=e.usePattern=e.callValidateCode=e.schemaProperties=e.allSchemaProperties=e.noPropertyInData=e.propertyInData=e.isOwnProperty=e.hasPropFunc=e.reportMissingProp=e.checkMissingProp=e.checkReportMissingProp=void 0;let t=be(),r=Oe(),o=pr(),n=Oe();function s(v,w){let{gen:z,data:R,it:b}=v;z.if(d(z,R,w,b.opts.ownProperties),()=>{v.setParams({missingProperty:t._`${w}`},!0),v.error()})}e.checkReportMissingProp=s;function i({gen:v,data:w,it:{opts:z}},R,b){return(0,t.or)(...R.map((E)=>(0,t.and)(d(v,w,E,z.ownProperties),t._`${b} = ${E}`)))}e.checkMissingProp=i;function a(v,w){v.setParams({missingProperty:w},!0),v.error()}e.reportMissingProp=a;function c(v){return v.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:t._`Object.prototype.hasOwnProperty`})}e.hasPropFunc=c;function u(v,w,z){return t._`${c(v)}.call(${w}, ${z})`}e.isOwnProperty=u;function l(v,w,z,R){let b=t._`${w}${(0,t.getProperty)(z)} !== undefined`;return R?t._`${b} && ${u(v,w,z)}`:b}e.propertyInData=l;function d(v,w,z,R){let b=t._`${w}${(0,t.getProperty)(z)} === undefined`;return R?(0,t.or)(b,(0,t.not)(u(v,w,z))):b}e.noPropertyInData=d;function f(v){return v?Object.keys(v).filter((w)=>w!=="__proto__"):[]}e.allSchemaProperties=f;function m(v,w){return f(w).filter((z)=>!(0,r.alwaysValidSchema)(v,w[z]))}e.schemaProperties=m;function h({schemaCode:v,data:w,it:{gen:z,topSchemaRef:R,schemaPath:b,errorPath:E},it:C},q,x,F){let B=F?t._`${v}, ${w}, ${R}${b}`:w,H=[[o.default.instancePath,(0,t.strConcat)(o.default.instancePath,E)],[o.default.parentData,C.parentData],[o.default.parentDataProperty,C.parentDataProperty],[o.default.rootData,o.default.rootData]];if(C.opts.dynamicRef)H.push([o.default.dynamicAnchors,o.default.dynamicAnchors]);let ge=t._`${B}, ${z.object(...H)}`;return x!==t.nil?t._`${q}.call(${x}, ${ge})`:t._`${q}(${ge})`}e.callValidateCode=h;let g=t._`new RegExp`;function _({gen:v,it:{opts:w}},z){let R=w.unicodeRegExp?"u":"",{regExp:b}=w.code,E=b(z,R);return v.scopeValue("pattern",{key:E.toString(),ref:E,code:t._`${b.code==="new RegExp"?g:(0,n.useFunc)(v,b)}(${z}, ${R})`})}e.usePattern=_;function y(v){let{gen:w,data:z,keyword:R,it:b}=v,E=w.name("valid");if(b.allErrors){let q=w.let("valid",!0);return C(()=>w.assign(q,!1)),q}return w.var(E,!0),C(()=>w.break()),E;function C(q){let x=w.const("len",t._`${z}.length`);w.forRange("i",0,x,(F)=>{v.subschema({keyword:R,dataProp:F,dataPropType:r.Type.Num},E),w.if((0,t.not)(E),q)})}}e.validateArray=y;function S(v){let{gen:w,schema:z,keyword:R,it:b}=v;if(!Array.isArray(z))throw Error("ajv implementation error");if(z.some((q)=>(0,r.alwaysValidSchema)(b,q))&&!b.opts.unevaluated)return;let E=w.let("valid",!1),C=w.name("_valid");w.block(()=>z.forEach((q,x)=>{let F=v.subschema({keyword:R,schemaProp:x,compositeRule:!0},C);if(w.assign(E,t._`${E} || ${C}`),!v.mergeValidEvaluated(F,C))w.if((0,t.not)(E))})),v.result(E,()=>v.reset(),()=>v.error(!0))}e.validateUnion=S}),gN=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateKeywordUsage=e.validSchemaType=e.funcKeywordCode=e.macroKeywordCode=void 0;let t=be(),r=pr(),o=fr(),n=Al();function s(m,h){let{gen:g,keyword:_,schema:y,parentSchema:S,it:v}=m,w=h.macro.call(v.self,y,S,v),z=l(g,_,w);if(v.opts.validateSchema!==!1)v.self.validateSchema(w,!0);let R=g.name("valid");m.subschema({schema:w,schemaPath:t.nil,errSchemaPath:`${v.errSchemaPath}/${_}`,topSchemaRef:z,compositeRule:!0},R),m.pass(R,()=>m.error(!0))}e.macroKeywordCode=s;function i(m,h){var g;let{gen:_,keyword:y,schema:S,parentSchema:v,$data:w,it:z}=m;u(z,h);let R=l(_,y,!w&&h.compile?h.compile.call(z.self,S,v,z):h.validate),b=_.let("valid");m.block$data(b,E),m.ok((g=h.valid)!==null&&g!==void 0?g:b);function E(){if(h.errors===!1){if(x(),h.modifying)a(m);F(()=>m.error())}else{let B=h.async?C():q();if(h.modifying)a(m);F(()=>c(m,B))}}function C(){let B=_.let("ruleErrs",null);return _.try(()=>x(t._`await `),(H)=>_.assign(b,!1).if(t._`${H} instanceof ${z.ValidationError}`,()=>_.assign(B,t._`${H}.errors`),()=>_.throw(H))),B}function q(){let B=t._`${R}.errors`;return _.assign(B,null),x(t.nil),B}function x(B=h.async?t._`await `:t.nil){let H=z.opts.passContext?r.default.this:r.default.self,ge=!(("compile"in h)&&!w||h.schema===!1);_.assign(b,t._`${B}${(0,o.callValidateCode)(m,R,H,ge)}`,h.modifying)}function F(B){var H;_.if((0,t.not)((H=h.valid)!==null&&H!==void 0?H:b),B)}}e.funcKeywordCode=i;function a(m){let{gen:h,data:g,it:_}=m;h.if(_.parentData,()=>h.assign(g,t._`${_.parentData}[${_.parentDataProperty}]`))}function c(m,h){let{gen:g}=m;g.if(t._`Array.isArray(${h})`,()=>{g.assign(r.default.vErrors,t._`${r.default.vErrors} === null ? ${h} : ${r.default.vErrors}.concat(${h})`).assign(r.default.errors,t._`${r.default.vErrors}.length`),(0,n.extendErrors)(m)},()=>m.error())}function u({schemaEnv:m},h){if(h.async&&!m.$async)throw Error("async keyword in sync schema")}function l(m,h,g){if(g===void 0)throw Error(`keyword "${h}" failed to compile`);return m.scopeValue("keyword",typeof g=="function"?{ref:g}:{ref:g,code:(0,t.stringify)(g)})}function d(m,h,g=!1){return!h.length||h.some((_)=>_==="array"?Array.isArray(m):_==="object"?m&&typeof m=="object"&&!Array.isArray(m):typeof m==_||g&&typeof m>"u")}e.validSchemaType=d;function f({schema:m,opts:h,self:g,errSchemaPath:_},y,S){if(Array.isArray(y.keyword)?!y.keyword.includes(S):y.keyword!==S)throw Error("ajv implementation error");let v=y.dependencies;if(v===null||v===void 0?void 0:v.some((w)=>!Object.prototype.hasOwnProperty.call(m,w)))throw Error(`parent schema must have dependencies of ${S}: ${v.join(",")}`);if(y.validateSchema){if(!y.validateSchema(m[S])){let w=`keyword "${S}" value is invalid at path "${_}": `+g.errorsText(y.validateSchema.errors);if(h.validateSchema==="log")g.logger.error(w);else throw Error(w)}}}e.validateKeywordUsage=f}),yN=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendSubschemaMode=e.extendSubschemaData=e.getSubschema=void 0;let t=be(),r=Oe();function o(i,{keyword:a,schemaProp:c,schema:u,schemaPath:l,errSchemaPath:d,topSchemaRef:f}){if(a!==void 0&&u!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(a!==void 0){let m=i.schema[a];return c===void 0?{schema:m,schemaPath:t._`${i.schemaPath}${(0,t.getProperty)(a)}`,errSchemaPath:`${i.errSchemaPath}/${a}`}:{schema:m[c],schemaPath:t._`${i.schemaPath}${(0,t.getProperty)(a)}${(0,t.getProperty)(c)}`,errSchemaPath:`${i.errSchemaPath}/${a}/${(0,r.escapeFragment)(c)}`}}if(u!==void 0){if(l===void 0||d===void 0||f===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:u,schemaPath:l,topSchemaRef:f,errSchemaPath:d}}throw Error('either "keyword" or "schema" must be passed')}e.getSubschema=o;function n(i,a,{dataProp:c,dataPropType:u,data:l,dataTypes:d,propertyName:f}){if(l!==void 0&&c!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:m}=a;if(c!==void 0){let{errorPath:g,dataPathArr:_,opts:y}=a;h(m.let("data",t._`${a.data}${(0,t.getProperty)(c)}`,!0)),i.errorPath=t.str`${g}${(0,r.getErrorPath)(c,u,y.jsPropertySyntax)}`,i.parentDataProperty=t._`${c}`,i.dataPathArr=[..._,i.parentDataProperty]}if(l!==void 0){if(h(l instanceof t.Name?l:m.let("data",l,!0)),f!==void 0)i.propertyName=f}if(d)i.dataTypes=d;function h(g){i.data=g,i.dataLevel=a.dataLevel+1,i.dataTypes=[],a.definedProperties=new Set,i.parentData=a.data,i.dataNames=[...a.dataNames,g]}}e.extendSubschemaData=n;function s(i,{jtdDiscriminator:a,jtdMetadata:c,compositeRule:u,createErrors:l,allErrors:d}){if(u!==void 0)i.compositeRule=u;if(l!==void 0)i.createErrors=l;if(d!==void 0)i.allErrors=d;i.jtdDiscriminator=a,i.jtdMetadata=c}e.extendSubschemaMode=s}),V0=G((e,t)=>{t.exports=function r(o,n){if(o===n)return!0;if(o&&n&&typeof o=="object"&&typeof n=="object"){if(o.constructor!==n.constructor)return!1;var s,i,a;if(Array.isArray(o)){if(s=o.length,s!=n.length)return!1;for(i=s;i--!==0;)if(!r(o[i],n[i]))return!1;return!0}if(o.constructor===RegExp)return o.source===n.source&&o.flags===n.flags;if(o.valueOf!==Object.prototype.valueOf)return o.valueOf()===n.valueOf();if(o.toString!==Object.prototype.toString)return o.toString()===n.toString();if(a=Object.keys(o),s=a.length,s!==Object.keys(n).length)return!1;for(i=s;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,a[i]))return!1;for(i=s;i--!==0;){var c=a[i];if(!r(o[c],n[c]))return!1}return!0}return o!==o&&n!==n}}),_N=G((e,t)=>{var r=t.exports=function(s,i,a){if(typeof i=="function")a=i,i={};a=i.cb||a;var c=typeof a=="function"?a:a.pre||function(){},u=a.post||function(){};o(i,c,u,s,"",s)};r.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},r.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},r.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},r.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 o(s,i,a,c,u,l,d,f,m,h){if(c&&typeof c=="object"&&!Array.isArray(c)){i(c,u,l,d,f,m,h);for(var g in c){var _=c[g];if(Array.isArray(_)){if(g in r.arrayKeywords)for(var y=0;y<_.length;y++)o(s,i,a,_[y],u+"/"+g+"/"+y,l,u,g,c,y)}else if(g in r.propsKeywords){if(_&&typeof _=="object")for(var S in _)o(s,i,a,_[S],u+"/"+g+"/"+n(S),l,u,g,c,S)}else if(g in r.keywords||s.allKeys&&!(g in r.skipKeywords))o(s,i,a,_,u+"/"+g,l,u,g,c)}a(c,u,l,d,f,m,h)}}function n(s){return s.replace(/~/g,"~0").replace(/\//g,"~1")}}),jl=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getSchemaRefs=e.resolveUrl=e.normalizeId=e._getFullPath=e.getFullPath=e.inlineRef=void 0;let t=Oe(),r=V0(),o=_N(),n=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function s(_,y=!0){if(typeof _=="boolean")return!0;if(y===!0)return!a(_);if(!y)return!1;return c(_)<=y}e.inlineRef=s;let i=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function a(_){for(let y in _){if(i.has(y))return!0;let S=_[y];if(Array.isArray(S)&&S.some(a))return!0;if(typeof S=="object"&&a(S))return!0}return!1}function c(_){let y=0;for(let S in _){if(S==="$ref")return 1/0;if(y++,n.has(S))continue;if(typeof _[S]=="object")(0,t.eachItem)(_[S],(v)=>y+=c(v));if(y===1/0)return 1/0}return y}function u(_,y="",S){if(S!==!1)y=f(y);return l(_,_.parse(y))}e.getFullPath=u;function l(_,y){return _.serialize(y).split("#")[0]+"#"}e._getFullPath=l;let d=/#\/?$/;function f(_){return _?_.replace(d,""):""}e.normalizeId=f;function m(_,y,S){return S=f(S),_.resolve(y,S)}e.resolveUrl=m;let h=/^[a-z_][-a-z0-9._]*$/i;function g(_,y){if(typeof _=="boolean")return{};let{schemaId:S,uriResolver:v}=this.opts,w=f(_[S]||y),z={"":w},R=u(v,w,!1),b={},E=new Set;return o(_,{allKeys:!0},(x,F,B,H)=>{if(H===void 0)return;let ge=R+F,Ie=z[H];if(typeof x[S]=="string")Ie=Ne.call(this,x[S]);De.call(this,x.$anchor),De.call(this,x.$dynamicAnchor),z[F]=Ie;function Ne(Pe){let O=this.opts.uriResolver.resolve;if(Pe=f(Ie?O(Ie,Pe):Pe),E.has(Pe))throw q(Pe);E.add(Pe);let M=this.refs[Pe];if(typeof M=="string")M=this.refs[M];if(typeof M=="object")C(x,M.schema,Pe);else if(Pe!==f(ge))if(Pe[0]==="#")C(x,b[Pe],Pe),b[Pe]=x;else this.refs[Pe]=ge;return Pe}function De(Pe){if(typeof Pe=="string"){if(!h.test(Pe))throw Error(`invalid anchor "${Pe}"`);Ne.call(this,`#${Pe}`)}}}),b;function C(x,F,B){if(F!==void 0&&!r(x,F))throw q(B)}function q(x){return Error(`reference "${x}" resolves to more than one schema`)}}e.getSchemaRefs=g}),ss=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getData=e.KeywordCxt=e.validateFunctionCode=void 0;let t=mN(),r=Nl(),o=F0(),n=Nl(),s=hN(),i=gN(),a=yN(),c=be(),u=pr(),l=jl(),d=Oe(),f=Al();function m(I){if(R(I)){if(E(I),z(I)){y(I);return}}h(I,()=>(0,t.topBoolOrEmptySchema)(I))}e.validateFunctionCode=m;function h({gen:I,validateName:L,schema:Z,schemaEnv:fe,opts:me},we){if(me.code.es5)I.func(L,c._`${u.default.data}, ${u.default.valCxt}`,fe.$async,()=>{I.code(c._`"use strict"; ${v(Z,me)}`),_(I,me),I.code(we)});else I.func(L,c._`${u.default.data}, ${g(me)}`,fe.$async,()=>I.code(v(Z,me)).code(we))}function g(I){return c._`{${u.default.instancePath}="", ${u.default.parentData}, ${u.default.parentDataProperty}, ${u.default.rootData}=${u.default.data}${I.dynamicRef?c._`, ${u.default.dynamicAnchors}={}`:c.nil}}={}`}function _(I,L){I.if(u.default.valCxt,()=>{if(I.var(u.default.instancePath,c._`${u.default.valCxt}.${u.default.instancePath}`),I.var(u.default.parentData,c._`${u.default.valCxt}.${u.default.parentData}`),I.var(u.default.parentDataProperty,c._`${u.default.valCxt}.${u.default.parentDataProperty}`),I.var(u.default.rootData,c._`${u.default.valCxt}.${u.default.rootData}`),L.dynamicRef)I.var(u.default.dynamicAnchors,c._`${u.default.valCxt}.${u.default.dynamicAnchors}`)},()=>{if(I.var(u.default.instancePath,c._`""`),I.var(u.default.parentData,c._`undefined`),I.var(u.default.parentDataProperty,c._`undefined`),I.var(u.default.rootData,u.default.data),L.dynamicRef)I.var(u.default.dynamicAnchors,c._`{}`)})}function y(I){let{schema:L,opts:Z,gen:fe}=I;h(I,()=>{if(Z.$comment&&L.$comment)H(I);if(x(I),fe.let(u.default.vErrors,null),fe.let(u.default.errors,0),Z.unevaluated)S(I);C(I),ge(I)})}function S(I){let{gen:L,validateName:Z}=I;I.evaluated=L.const("evaluated",c._`${Z}.evaluated`),L.if(c._`${I.evaluated}.dynamicProps`,()=>L.assign(c._`${I.evaluated}.props`,c._`undefined`)),L.if(c._`${I.evaluated}.dynamicItems`,()=>L.assign(c._`${I.evaluated}.items`,c._`undefined`))}function v(I,L){let Z=typeof I=="object"&&I[L.schemaId];return Z&&(L.code.source||L.code.process)?c._`/*# sourceURL=${Z} */`:c.nil}function w(I,L){if(R(I)){if(E(I),z(I)){b(I,L);return}}(0,t.boolOrEmptySchema)(I,L)}function z({schema:I,self:L}){if(typeof I=="boolean")return!I;for(let Z in I)if(L.RULES.all[Z])return!0;return!1}function R(I){return typeof I.schema!="boolean"}function b(I,L){let{schema:Z,gen:fe,opts:me}=I;if(me.$comment&&Z.$comment)H(I);F(I),B(I);let we=fe.const("_errs",u.default.errors);C(I,we),fe.var(L,c._`${we} === ${u.default.errors}`)}function E(I){(0,d.checkUnknownRules)(I),q(I)}function C(I,L){if(I.opts.jtd)return Ne(I,[],!1,L);let Z=(0,r.getSchemaTypes)(I.schema);Ne(I,Z,!(0,r.coerceAndCheckDataType)(I,Z),L)}function q(I){let{schema:L,errSchemaPath:Z,opts:fe,self:me}=I;if(L.$ref&&fe.ignoreKeywordsWithRef&&(0,d.schemaHasRulesButRef)(L,me.RULES))me.logger.warn(`$ref: keywords ignored in schema at path "${Z}"`)}function x(I){let{schema:L,opts:Z}=I;if(L.default!==void 0&&Z.useDefaults&&Z.strictSchema)(0,d.checkStrictMode)(I,"default is ignored in the schema root")}function F(I){let L=I.schema[I.opts.schemaId];if(L)I.baseId=(0,l.resolveUrl)(I.opts.uriResolver,I.baseId,L)}function B(I){if(I.schema.$async&&!I.schemaEnv.$async)throw Error("async schema in sync schema")}function H({gen:I,schemaEnv:L,schema:Z,errSchemaPath:fe,opts:me}){let we=Z.$comment;if(me.$comment===!0)I.code(c._`${u.default.self}.logger.log(${we})`);else if(typeof me.$comment=="function"){let it=c.str`${fe}/$comment`,pt=I.scopeValue("root",{ref:L.root});I.code(c._`${u.default.self}.opts.$comment(${we}, ${it}, ${pt}.schema)`)}}function ge(I){let{gen:L,schemaEnv:Z,validateName:fe,ValidationError:me,opts:we}=I;if(Z.$async)L.if(c._`${u.default.errors} === 0`,()=>L.return(u.default.data),()=>L.throw(c._`new ${me}(${u.default.vErrors})`));else{if(L.assign(c._`${fe}.errors`,u.default.vErrors),we.unevaluated)Ie(I);L.return(c._`${u.default.errors} === 0`)}}function Ie({gen:I,evaluated:L,props:Z,items:fe}){if(Z instanceof c.Name)I.assign(c._`${L}.props`,Z);if(fe instanceof c.Name)I.assign(c._`${L}.items`,fe)}function Ne(I,L,Z,fe){let{gen:me,schema:we,data:it,allErrors:pt,opts:Rt,self:ct}=I,{RULES:We}=ct;if(we.$ref&&(Rt.ignoreKeywordsWithRef||!(0,d.schemaHasRulesButRef)(we,We))){me.block(()=>Ee(I,"$ref",We.all.$ref.definition));return}if(!Rt.jtd)Pe(I,L);me.block(()=>{for(let ht of We.rules)Xt(ht);Xt(We.post)});function Xt(ht){if(!(0,o.shouldUseGroup)(we,ht))return;if(ht.type){if(me.if((0,n.checkDataType)(ht.type,it,Rt.strictNumbers)),De(I,ht),L.length===1&&L[0]===ht.type&&Z)me.else(),(0,n.reportTypeError)(I);me.endIf()}else De(I,ht);if(!pt)me.if(c._`${u.default.errors} === ${fe||0}`)}}function De(I,L){let{gen:Z,schema:fe,opts:{useDefaults:me}}=I;if(me)(0,s.assignDefaults)(I,L.type);Z.block(()=>{for(let we of L.rules)if((0,o.shouldUseRule)(fe,we))Ee(I,we.keyword,we.definition,L.type)})}function Pe(I,L){if(I.schemaEnv.meta||!I.opts.strictTypes)return;if(O(I,L),!I.opts.allowUnionTypes)M(I,L);K(I,I.dataTypes)}function O(I,L){if(!L.length)return;if(!I.dataTypes.length){I.dataTypes=L;return}L.forEach((Z)=>{if(!k(I.dataTypes,Z))W(I,`type "${Z}" not allowed by context "${I.dataTypes.join(",")}"`)}),j(I,L)}function M(I,L){if(L.length>1&&!(L.length===2&&L.includes("null")))W(I,"use allowUnionTypes to allow union type keyword")}function K(I,L){let Z=I.self.RULES.all;for(let fe in Z){let me=Z[fe];if(typeof me=="object"&&(0,o.shouldUseRule)(I.schema,me)){let{type:we}=me.definition;if(we.length&&!we.some((it)=>P(L,it)))W(I,`missing type "${we.join(",")}" for keyword "${fe}"`)}}}function P(I,L){return I.includes(L)||L==="number"&&I.includes("integer")}function k(I,L){return I.includes(L)||L==="integer"&&I.includes("number")}function j(I,L){let Z=[];for(let fe of I.dataTypes)if(k(L,fe))Z.push(fe);else if(L.includes("integer")&&fe==="number")Z.push("integer");I.dataTypes=Z}function W(I,L){let Z=I.schemaEnv.baseId+I.errSchemaPath;L+=` at "${Z}" (strictTypes)`,(0,d.checkStrictMode)(I,L,I.opts.strictTypes)}var ue=class{constructor(I,L,Z){if((0,i.validateKeywordUsage)(I,L,Z),this.gen=I.gen,this.allErrors=I.allErrors,this.keyword=Z,this.data=I.data,this.schema=I.schema[Z],this.$data=L.$data&&I.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,d.schemaRefOrVal)(I,this.schema,Z,this.$data),this.schemaType=L.schemaType,this.parentSchema=I.schema,this.params={},this.it=I,this.def=L,this.$data)this.schemaCode=I.gen.const("vSchema",Ct(this.$data,I));else if(this.schemaCode=this.schemaValue,!(0,i.validSchemaType)(this.schema,L.schemaType,L.allowUndefined))throw Error(`${Z} value must be ${JSON.stringify(L.schemaType)}`);if("code"in L?L.trackErrors:L.errors!==!1)this.errsCount=I.gen.const("_errs",u.default.errors)}result(I,L,Z){this.failResult((0,c.not)(I),L,Z)}failResult(I,L,Z){if(this.gen.if(I),Z)Z();else this.error();if(L){if(this.gen.else(),L(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(I,L){this.failResult((0,c.not)(I),void 0,L)}fail(I){if(I===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if(I),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(I){if(!this.$data)return this.fail(I);let{schemaCode:L}=this;this.fail(c._`${L} !== undefined && (${(0,c.or)(this.invalid$data(),I)})`)}error(I,L,Z){if(L){this.setParams(L),this._error(I,Z),this.setParams({});return}this._error(I,Z)}_error(I,L){(I?f.reportExtraError:f.reportError)(this,this.def.error,L)}$dataError(){(0,f.reportError)(this,this.def.$dataError||f.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,f.resetErrorsCount)(this.gen,this.errsCount)}ok(I){if(!this.allErrors)this.gen.if(I)}setParams(I,L){if(L)Object.assign(this.params,I);else this.params=I}block$data(I,L,Z=c.nil){this.gen.block(()=>{this.check$data(I,Z),L()})}check$data(I=c.nil,L=c.nil){if(!this.$data)return;let{gen:Z,schemaCode:fe,schemaType:me,def:we}=this;if(Z.if((0,c.or)(c._`${fe} === undefined`,L)),I!==c.nil)Z.assign(I,!0);if(me.length||we.validateSchema){if(Z.elseIf(this.invalid$data()),this.$dataError(),I!==c.nil)Z.assign(I,!1)}Z.else()}invalid$data(){let{gen:I,schemaCode:L,schemaType:Z,def:fe,it:me}=this;return(0,c.or)(we(),it());function we(){if(Z.length){if(!(L instanceof c.Name))throw Error("ajv implementation error");let pt=Array.isArray(Z)?Z:[Z];return c._`${(0,n.checkDataTypes)(pt,L,me.opts.strictNumbers,n.DataType.Wrong)}`}return c.nil}function it(){if(fe.validateSchema){let pt=I.scopeValue("validate$data",{ref:fe.validateSchema});return c._`!${pt}(${L})`}return c.nil}}subschema(I,L){let Z=(0,a.getSubschema)(this.it,I);(0,a.extendSubschemaData)(Z,this.it,I),(0,a.extendSubschemaMode)(Z,I);let fe={...this.it,...Z,items:void 0,props:void 0};return w(fe,L),fe}mergeEvaluated(I,L){let{it:Z,gen:fe}=this;if(!Z.opts.unevaluated)return;if(Z.props!==!0&&I.props!==void 0)Z.props=d.mergeEvaluated.props(fe,I.props,Z.props,L);if(Z.items!==!0&&I.items!==void 0)Z.items=d.mergeEvaluated.items(fe,I.items,Z.items,L)}mergeValidEvaluated(I,L){let{it:Z,gen:fe}=this;if(Z.opts.unevaluated&&(Z.props!==!0||Z.items!==!0))return fe.if(L,()=>this.mergeEvaluated(I,c.Name)),!0}};e.KeywordCxt=ue;function Ee(I,L,Z,fe){let me=new ue(I,Z,L);if("code"in Z)Z.code(me,fe);else if(me.$data&&Z.validate)(0,i.funcKeywordCode)(me,Z);else if("macro"in Z)(0,i.macroKeywordCode)(me,Z);else if(Z.compile||Z.validate)(0,i.funcKeywordCode)(me,Z)}let ye=/^\/(?:[^~]|~0|~1)*$/,Ve=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Ct(I,{dataLevel:L,dataNames:Z,dataPathArr:fe}){let me,we;if(I==="")return u.default.rootData;if(I[0]==="/"){if(!ye.test(I))throw Error(`Invalid JSON-pointer: ${I}`);me=I,we=u.default.rootData}else{let ct=Ve.exec(I);if(!ct)throw Error(`Invalid JSON-pointer: ${I}`);let We=+ct[1];if(me=ct[2],me==="#"){if(We>=L)throw Error(Rt("property/index",We));return fe[L-We]}if(We>L)throw Error(Rt("data",We));if(we=Z[L-We],!me)return we}let it=we,pt=me.split("/");for(let ct of pt)if(ct)we=c._`${we}${(0,c.getProperty)((0,d.unescapeJsonPointer)(ct))}`,it=c._`${it} && ${we}`;return it;function Rt(ct,We){return`Cannot access ${ct} ${We} levels up, current level is ${L}`}}e.getData=Ct}),aa=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0});var t=class extends Error{constructor(r){super("validation failed");this.errors=r,this.ajv=this.validation=!0}};e.default=t}),is=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=jl();var r=class extends Error{constructor(o,n,s,i){super(i||`can't resolve reference ${s} from id ${n}`);this.missingRef=(0,t.resolveUrl)(o,n,s),this.missingSchema=(0,t.normalizeId)((0,t.getFullPath)(o,this.missingRef))}};e.default=r}),ql=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.resolveSchema=e.getCompilingSchema=e.resolveRef=e.compileSchema=e.SchemaEnv=void 0;let t=be(),r=aa(),o=pr(),n=jl(),s=Oe(),i=ss();var a=class{constructor(y){var S;this.refs={},this.dynamicAnchors={};let v;if(typeof y.schema=="object")v=y.schema;this.schema=y.schema,this.schemaId=y.schemaId,this.root=y.root||this,this.baseId=(S=y.baseId)!==null&&S!==void 0?S:(0,n.normalizeId)(v===null||v===void 0?void 0:v[y.schemaId||"$id"]),this.schemaPath=y.schemaPath,this.localRefs=y.localRefs,this.meta=y.meta,this.$async=v===null||v===void 0?void 0:v.$async,this.refs={}}};e.SchemaEnv=a;function c(y){let S=d.call(this,y);if(S)return S;let v=(0,n.getFullPath)(this.opts.uriResolver,y.root.baseId),{es5:w,lines:z}=this.opts.code,{ownProperties:R}=this.opts,b=new t.CodeGen(this.scope,{es5:w,lines:z,ownProperties:R}),E;if(y.$async)E=b.scopeValue("Error",{ref:r.default,code:t._`require("ajv/dist/runtime/validation_error").default`});let C=b.scopeName("validate");y.validateName=C;let q={gen:b,allErrors:this.opts.allErrors,data:o.default.data,parentData:o.default.parentData,parentDataProperty:o.default.parentDataProperty,dataNames:[o.default.data],dataPathArr:[t.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:b.scopeValue("schema",this.opts.code.source===!0?{ref:y.schema,code:(0,t.stringify)(y.schema)}:{ref:y.schema}),validateName:C,ValidationError:E,schema:y.schema,schemaEnv:y,rootId:v,baseId:y.baseId||v,schemaPath:t.nil,errSchemaPath:y.schemaPath||(this.opts.jtd?"":"#"),errorPath:t._`""`,opts:this.opts,self:this},x;try{this._compilations.add(y),(0,i.validateFunctionCode)(q),b.optimize(this.opts.code.optimize);let F=b.toString();if(x=`${b.scopeRefs(o.default.scope)}return ${F}`,this.opts.code.process)x=this.opts.code.process(x,y);let B=Function(`${o.default.self}`,`${o.default.scope}`,x)(this,this.scope.get());if(this.scope.value(C,{ref:B}),B.errors=null,B.schema=y.schema,B.schemaEnv=y,y.$async)B.$async=!0;if(this.opts.code.source===!0)B.source={validateName:C,validateCode:F,scopeValues:b._values};if(this.opts.unevaluated){let{props:H,items:ge}=q;if(B.evaluated={props:H instanceof t.Name?void 0:H,items:ge instanceof t.Name?void 0:ge,dynamicProps:H instanceof t.Name,dynamicItems:ge instanceof t.Name},B.source)B.source.evaluated=(0,t.stringify)(B.evaluated)}return y.validate=B,y}catch(F){if(delete y.validate,delete y.validateName,x)this.logger.error("Error compiling schema, function code:",x);throw F}finally{this._compilations.delete(y)}}e.compileSchema=c;function u(y,S,v){var w;v=(0,n.resolveUrl)(this.opts.uriResolver,S,v);let z=y.refs[v];if(z)return z;let R=m.call(this,y,v);if(R===void 0){let b=(w=y.localRefs)===null||w===void 0?void 0:w[v],{schemaId:E}=this.opts;if(b)R=new a({schema:b,schemaId:E,root:y,baseId:S})}if(R===void 0)return;return y.refs[v]=l.call(this,R)}e.resolveRef=u;function l(y){if((0,n.inlineRef)(y.schema,this.opts.inlineRefs))return y.schema;return y.validate?y:c.call(this,y)}function d(y){for(let S of this._compilations)if(f(S,y))return S}e.getCompilingSchema=d;function f(y,S){return y.schema===S.schema&&y.root===S.root&&y.baseId===S.baseId}function m(y,S){let v;while(typeof(v=this.refs[S])=="string")S=v;return v||this.schemas[S]||h.call(this,y,S)}function h(y,S){let v=this.opts.uriResolver.parse(S),w=(0,n._getFullPath)(this.opts.uriResolver,v),z=(0,n.getFullPath)(this.opts.uriResolver,y.baseId,void 0);if(Object.keys(y.schema).length>0&&w===z)return _.call(this,v,y);let R=(0,n.normalizeId)(w),b=this.refs[R]||this.schemas[R];if(typeof b=="string"){let E=h.call(this,y,b);if(typeof(E===null||E===void 0?void 0:E.schema)!=="object")return;return _.call(this,v,E)}if(typeof(b===null||b===void 0?void 0:b.schema)!=="object")return;if(!b.validate)c.call(this,b);if(R===(0,n.normalizeId)(S)){let{schema:E}=b,{schemaId:C}=this.opts,q=E[C];if(q)z=(0,n.resolveUrl)(this.opts.uriResolver,z,q);return new a({schema:E,schemaId:C,root:y,baseId:z})}return _.call(this,v,b)}e.resolveSchema=h;let g=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function _(y,{baseId:S,schema:v,root:w}){var z;if(((z=y.fragment)===null||z===void 0?void 0:z[0])!=="/")return;for(let E of y.fragment.slice(1).split("/")){if(typeof v==="boolean")return;let C=v[(0,s.unescapeFragment)(E)];if(C===void 0)return;v=C;let q=typeof v==="object"&&v[this.opts.schemaId];if(!g.has(E)&&q)S=(0,n.resolveUrl)(this.opts.uriResolver,S,q)}let R;if(typeof v!="boolean"&&v.$ref&&!(0,s.schemaHasRulesButRef)(v,this.RULES)){let E=(0,n.resolveUrl)(this.opts.uriResolver,S,v.$ref);R=h.call(this,w,E)}let{schemaId:b}=this.opts;if(R=R||new a({schema:v,schemaId:b,root:w,baseId:S}),R.schema!==R.root.schema)return R}}),vN=G((e,t)=>{t.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}}),Z0=G((e,t)=>{let r=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),o=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function n(h){let g="",_=0,y=0;for(y=0;y<h.length;y++){if(_=h[y].charCodeAt(0),_===48)continue;if(!(_>=48&&_<=57||_>=65&&_<=70||_>=97&&_<=102))return"";g+=h[y];break}for(y+=1;y<h.length;y++){if(_=h[y].charCodeAt(0),!(_>=48&&_<=57||_>=65&&_<=70||_>=97&&_<=102))return"";g+=h[y]}return g}let s=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function i(h){return h.length=0,!0}function a(h,g,_){if(h.length){let y=n(h);if(y!=="")g.push(y);else return _.error=!0,!1;h.length=0}return!0}function c(h){let g=0,_={error:!1,address:"",zone:""},y=[],S=[],v=!1,w=!1,z=a;for(let R=0;R<h.length;R++){let b=h[R];if(b==="["||b==="]")continue;if(b===":"){if(v===!0)w=!0;if(!z(S,y,_))break;if(++g>7){_.error=!0;break}if(R>0&&h[R-1]===":")v=!0;y.push(":");continue}else if(b==="%"){if(!z(S,y,_))break;z=i}else{S.push(b);continue}}if(S.length)if(z===i)_.zone=S.join("");else if(w)y.push(S.join(""));else y.push(n(S));return _.address=y.join(""),_}function u(h){if(l(h,":")<2)return{host:h,isIPV6:!1};let g=c(h);if(!g.error){let{address:_,address:y}=g;if(g.zone)_+="%"+g.zone,y+="%25"+g.zone;return{host:_,isIPV6:!0,escapedHost:y}}else return{host:h,isIPV6:!1}}function l(h,g){let _=0;for(let y=0;y<h.length;y++)if(h[y]===g)_++;return _}function d(h){let g=h,_=[],y=-1,S=0;while(S=g.length){if(S===1)if(g===".")break;else if(g==="/"){_.push("/");break}else{_.push(g);break}else if(S===2){if(g[0]==="."){if(g[1]===".")break;else if(g[1]==="/"){g=g.slice(2);continue}}else if(g[0]==="/"){if(g[1]==="."||g[1]==="/"){_.push("/");break}}}else if(S===3){if(g==="/.."){if(_.length!==0)_.pop();_.push("/");break}}if(g[0]==="."){if(g[1]==="."){if(g[2]==="/"){g=g.slice(3);continue}}else if(g[1]==="/"){g=g.slice(2);continue}}else if(g[0]==="/"){if(g[1]==="."){if(g[2]==="/"){g=g.slice(2);continue}else if(g[2]==="."){if(g[3]==="/"){if(g=g.slice(3),_.length!==0)_.pop();continue}}}}if((y=g.indexOf("/",1))===-1){_.push(g);break}else _.push(g.slice(0,y)),g=g.slice(y)}return _.join("")}function f(h,g){let _=g!==!0?escape:unescape;if(h.scheme!==void 0)h.scheme=_(h.scheme);if(h.userinfo!==void 0)h.userinfo=_(h.userinfo);if(h.host!==void 0)h.host=_(h.host);if(h.path!==void 0)h.path=_(h.path);if(h.query!==void 0)h.query=_(h.query);if(h.fragment!==void 0)h.fragment=_(h.fragment);return h}function m(h){let g=[];if(h.userinfo!==void 0)g.push(h.userinfo),g.push("@");if(h.host!==void 0){let _=unescape(h.host);if(!o(_)){let y=u(_);if(y.isIPV6===!0)_=`[${y.escapedHost}]`;else _=h.host}g.push(_)}if(typeof h.port==="number"||typeof h.port==="string")g.push(":"),g.push(String(h.port));return g.length?g.join(""):void 0}t.exports={nonSimpleDomain:s,recomposeAuthority:m,normalizeComponentEncoding:f,removeDotSegments:d,isIPv4:o,isUUID:r,normalizeIPv6:u,stringArrayToHexStripped:n}}),SN=G((e,t)=>{let{isUUID:r}=Z0(),o=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,n=["http","https","ws","wss","urn","urn:uuid"];function s(b){return n.indexOf(b)!==-1}function i(b){if(b.secure===!0)return!0;else if(b.secure===!1)return!1;else if(b.scheme)return b.scheme.length===3&&(b.scheme[0]==="w"||b.scheme[0]==="W")&&(b.scheme[1]==="s"||b.scheme[1]==="S")&&(b.scheme[2]==="s"||b.scheme[2]==="S");else return!1}function a(b){if(!b.host)b.error=b.error||"HTTP URIs must have a host.";return b}function c(b){let E=String(b.scheme).toLowerCase()==="https";if(b.port===(E?443:80)||b.port==="")b.port=void 0;if(!b.path)b.path="/";return b}function u(b){return b.secure=i(b),b.resourceName=(b.path||"/")+(b.query?"?"+b.query:""),b.path=void 0,b.query=void 0,b}function l(b){if(b.port===(i(b)?443:80)||b.port==="")b.port=void 0;if(typeof b.secure==="boolean")b.scheme=b.secure?"wss":"ws",b.secure=void 0;if(b.resourceName){let[E,C]=b.resourceName.split("?");b.path=E&&E!=="/"?E:void 0,b.query=C,b.resourceName=void 0}return b.fragment=void 0,b}function d(b,E){if(!b.path)return b.error="URN can not be parsed",b;let C=b.path.match(o);if(C){let q=E.scheme||b.scheme||"urn";b.nid=C[1].toLowerCase(),b.nss=C[2];let x=R(`${q}:${E.nid||b.nid}`);if(b.path=void 0,x)b=x.parse(b,E)}else b.error=b.error||"URN can not be parsed.";return b}function f(b,E){if(b.nid===void 0)throw Error("URN without nid cannot be serialized");let C=E.scheme||b.scheme||"urn",q=b.nid.toLowerCase(),x=R(`${C}:${E.nid||q}`);if(x)b=x.serialize(b,E);let F=b,B=b.nss;return F.path=`${q||E.nid}:${B}`,E.skipEscape=!0,F}function m(b,E){let C=b;if(C.uuid=C.nss,C.nss=void 0,!E.tolerant&&(!C.uuid||!r(C.uuid)))C.error=C.error||"UUID is not valid.";return C}function h(b){let E=b;return E.nss=(b.uuid||"").toLowerCase(),E}let g={scheme:"http",domainHost:!0,parse:a,serialize:c},_={scheme:"https",domainHost:g.domainHost,parse:a,serialize:c},y={scheme:"ws",domainHost:!0,parse:u,serialize:l},S={scheme:"wss",domainHost:y.domainHost,parse:y.parse,serialize:y.serialize},z={http:g,https:_,ws:y,wss:S,urn:{scheme:"urn",parse:d,serialize:f,skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:m,serialize:h,skipNormalize:!0}};Object.setPrototypeOf(z,null);function R(b){return b&&(z[b]||z[b.toLowerCase()])||void 0}t.exports={wsIsSecure:i,SCHEMES:z,isValidSchemeName:s,getSchemeHandler:R}}),bN=G((e,t)=>{let{normalizeIPv6:r,removeDotSegments:o,recomposeAuthority:n,normalizeComponentEncoding:s,isIPv4:i,nonSimpleDomain:a}=Z0(),{SCHEMES:c,getSchemeHandler:u}=SN();function l(S,v){if(typeof S==="string")S=h(_(S,v),v);else if(typeof S==="object")S=_(h(S,v),v);return S}function d(S,v,w){let z=w?Object.assign({scheme:"null"},w):{scheme:"null"},R=f(_(S,z),_(v,z),z,!0);return z.skipEscape=!0,h(R,z)}function f(S,v,w,z){let R={};if(!z)S=_(h(S,w),w),v=_(h(v,w),w);if(w=w||{},!w.tolerant&&v.scheme)R.scheme=v.scheme,R.userinfo=v.userinfo,R.host=v.host,R.port=v.port,R.path=o(v.path||""),R.query=v.query;else{if(v.userinfo!==void 0||v.host!==void 0||v.port!==void 0)R.userinfo=v.userinfo,R.host=v.host,R.port=v.port,R.path=o(v.path||""),R.query=v.query;else{if(!v.path)if(R.path=S.path,v.query!==void 0)R.query=v.query;else R.query=S.query;else{if(v.path[0]==="/")R.path=o(v.path);else{if((S.userinfo!==void 0||S.host!==void 0||S.port!==void 0)&&!S.path)R.path="/"+v.path;else if(!S.path)R.path=v.path;else R.path=S.path.slice(0,S.path.lastIndexOf("/")+1)+v.path;R.path=o(R.path)}R.query=v.query}R.userinfo=S.userinfo,R.host=S.host,R.port=S.port}R.scheme=S.scheme}return R.fragment=v.fragment,R}function m(S,v,w){if(typeof S==="string")S=unescape(S),S=h(s(_(S,w),!0),{...w,skipEscape:!0});else if(typeof S==="object")S=h(s(S,!0),{...w,skipEscape:!0});if(typeof v==="string")v=unescape(v),v=h(s(_(v,w),!0),{...w,skipEscape:!0});else if(typeof v==="object")v=h(s(v,!0),{...w,skipEscape:!0});return S.toLowerCase()===v.toLowerCase()}function h(S,v){let w={host:S.host,scheme:S.scheme,userinfo:S.userinfo,port:S.port,path:S.path,query:S.query,nid:S.nid,nss:S.nss,uuid:S.uuid,fragment:S.fragment,reference:S.reference,resourceName:S.resourceName,secure:S.secure,error:""},z=Object.assign({},v),R=[],b=u(z.scheme||w.scheme);if(b&&b.serialize)b.serialize(w,z);if(w.path!==void 0)if(!z.skipEscape){if(w.path=escape(w.path),w.scheme!==void 0)w.path=w.path.split("%3A").join(":")}else w.path=unescape(w.path);if(z.reference!=="suffix"&&w.scheme)R.push(w.scheme,":");let E=n(w);if(E!==void 0){if(z.reference!=="suffix")R.push("//");if(R.push(E),w.path&&w.path[0]!=="/")R.push("/")}if(w.path!==void 0){let C=w.path;if(!z.absolutePath&&(!b||!b.absolutePath))C=o(C);if(E===void 0&&C[0]==="/"&&C[1]==="/")C="/%2F"+C.slice(2);R.push(C)}if(w.query!==void 0)R.push("?",w.query);if(w.fragment!==void 0)R.push("#",w.fragment);return R.join("")}let g=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function _(S,v){let w=Object.assign({},v),z={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},R=!1;if(w.reference==="suffix")if(w.scheme)S=w.scheme+":"+S;else S="//"+S;let b=S.match(g);if(b){if(z.scheme=b[1],z.userinfo=b[3],z.host=b[4],z.port=parseInt(b[5],10),z.path=b[6]||"",z.query=b[7],z.fragment=b[8],isNaN(z.port))z.port=b[5];if(z.host)if(i(z.host)===!1){let C=r(z.host);z.host=C.host.toLowerCase(),R=C.isIPV6}else R=!0;if(z.scheme===void 0&&z.userinfo===void 0&&z.host===void 0&&z.port===void 0&&z.query===void 0&&!z.path)z.reference="same-document";else if(z.scheme===void 0)z.reference="relative";else if(z.fragment===void 0)z.reference="absolute";else z.reference="uri";if(w.reference&&w.reference!=="suffix"&&w.reference!==z.reference)z.error=z.error||"URI is not a "+w.reference+" reference.";let E=u(w.scheme||z.scheme);if(!w.unicodeSupport&&(!E||!E.unicodeSupport)){if(z.host&&(w.domainHost||E&&E.domainHost)&&R===!1&&a(z.host))try{z.host=URL.domainToASCII(z.host.toLowerCase())}catch(C){z.error=z.error||"Host's domain name can not be converted to ASCII: "+C}}if(!E||E&&!E.skipNormalize){if(S.indexOf("%")!==-1){if(z.scheme!==void 0)z.scheme=unescape(z.scheme);if(z.host!==void 0)z.host=unescape(z.host)}if(z.path)z.path=escape(unescape(z.path));if(z.fragment)z.fragment=encodeURI(decodeURIComponent(z.fragment))}if(E&&E.parse)E.parse(z,w)}else z.error=z.error||"URI can not be parsed.";return z}let y={SCHEMES:c,normalize:l,resolve:d,resolveComponent:f,equal:m,serialize:h,parse:_};t.exports=y,t.exports.default=y,t.exports.fastUri=y}),$N=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=bN();t.code='require("ajv/dist/runtime/uri").default',e.default=t}),Im=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=ss();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var r=be();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return r.CodeGen}});let o=aa(),n=is(),s=U0(),i=ql(),a=be(),c=jl(),u=Nl(),l=Oe(),d=vN(),f=$N(),m=(O,M)=>new RegExp(O,M);m.code="new RegExp";let h=["removeAdditional","useDefaults","coerceTypes"],g=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),_={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."},y={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},S=200;function v(O){var M,K,P,k,j,W,ue,Ee,ye,Ve,Ct,I,L,Z,fe,me,we,it,pt,Rt,ct,We,Xt,ht,Mr;let ur=O.strict,Lr=(M=O.code)===null||M===void 0?void 0:M.optimize,Wr=Lr===!0||Lr===void 0?1:Lr||0,Yr=(P=(K=O.code)===null||K===void 0?void 0:K.regExp)!==null&&P!==void 0?P:m,Vo=(k=O.uriResolver)!==null&&k!==void 0?k:f.default;return{strictSchema:(W=(j=O.strictSchema)!==null&&j!==void 0?j:ur)!==null&&W!==void 0?W:!0,strictNumbers:(Ee=(ue=O.strictNumbers)!==null&&ue!==void 0?ue:ur)!==null&&Ee!==void 0?Ee:!0,strictTypes:(Ve=(ye=O.strictTypes)!==null&&ye!==void 0?ye:ur)!==null&&Ve!==void 0?Ve:"log",strictTuples:(I=(Ct=O.strictTuples)!==null&&Ct!==void 0?Ct:ur)!==null&&I!==void 0?I:"log",strictRequired:(Z=(L=O.strictRequired)!==null&&L!==void 0?L:ur)!==null&&Z!==void 0?Z:!1,code:O.code?{...O.code,optimize:Wr,regExp:Yr}:{optimize:Wr,regExp:Yr},loopRequired:(fe=O.loopRequired)!==null&&fe!==void 0?fe:S,loopEnum:(me=O.loopEnum)!==null&&me!==void 0?me:S,meta:(we=O.meta)!==null&&we!==void 0?we:!0,messages:(it=O.messages)!==null&&it!==void 0?it:!0,inlineRefs:(pt=O.inlineRefs)!==null&&pt!==void 0?pt:!0,schemaId:(Rt=O.schemaId)!==null&&Rt!==void 0?Rt:"$id",addUsedSchema:(ct=O.addUsedSchema)!==null&&ct!==void 0?ct:!0,validateSchema:(We=O.validateSchema)!==null&&We!==void 0?We:!0,validateFormats:(Xt=O.validateFormats)!==null&&Xt!==void 0?Xt:!0,unicodeRegExp:(ht=O.unicodeRegExp)!==null&&ht!==void 0?ht:!0,int32range:(Mr=O.int32range)!==null&&Mr!==void 0?Mr:!0,uriResolver:Vo}}var w=class{constructor(O={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,O=this.opts={...O,...v(O)};let{es5:M,lines:K}=this.opts.code;this.scope=new a.ValueScope({scope:{},prefixes:g,es5:M,lines:K}),this.logger=F(O.logger);let P=O.validateFormats;if(O.validateFormats=!1,this.RULES=(0,s.getRules)(),z.call(this,_,O,"NOT SUPPORTED"),z.call(this,y,O,"DEPRECATED","warn"),this._metaOpts=q.call(this),O.formats)E.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),O.keywords)C.call(this,O.keywords);if(typeof O.meta=="object")this.addMetaSchema(O.meta);b.call(this),O.validateFormats=P}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:O,meta:M,schemaId:K}=this.opts,P=d;if(K==="id")P={...d},P.id=P.$id,delete P.$id;if(M&&O)this.addMetaSchema(P,P[K],!1)}defaultMeta(){let{meta:O,schemaId:M}=this.opts;return this.opts.defaultMeta=typeof O=="object"?O[M]||O:void 0}validate(O,M){let K;if(typeof O=="string"){if(K=this.getSchema(O),!K)throw Error(`no schema with key or ref "${O}"`)}else K=this.compile(O);let P=K(M);if(!("$async"in K))this.errors=K.errors;return P}compile(O,M){let K=this._addSchema(O,M);return K.validate||this._compileSchemaEnv(K)}compileAsync(O,M){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:K}=this.opts;return P.call(this,O,M);async function P(ye,Ve){await k.call(this,ye.$schema);let Ct=this._addSchema(ye,Ve);return Ct.validate||j.call(this,Ct)}async function k(ye){if(ye&&!this.getSchema(ye))await P.call(this,{$ref:ye},!0)}async function j(ye){try{return this._compileSchemaEnv(ye)}catch(Ve){if(!(Ve instanceof n.default))throw Ve;return W.call(this,Ve),await ue.call(this,Ve.missingSchema),j.call(this,ye)}}function W({missingSchema:ye,missingRef:Ve}){if(this.refs[ye])throw Error(`AnySchema ${ye} is loaded but ${Ve} cannot be resolved`)}async function ue(ye){let Ve=await Ee.call(this,ye);if(!this.refs[ye])await k.call(this,Ve.$schema);if(!this.refs[ye])this.addSchema(Ve,ye,M)}async function Ee(ye){let Ve=this._loading[ye];if(Ve)return Ve;try{return await(this._loading[ye]=K(ye))}finally{delete this._loading[ye]}}}addSchema(O,M,K,P=this.opts.validateSchema){if(Array.isArray(O)){for(let j of O)this.addSchema(j,void 0,K,P);return this}let k;if(typeof O==="object"){let{schemaId:j}=this.opts;if(k=O[j],k!==void 0&&typeof k!="string")throw Error(`schema ${j} must be string`)}return M=(0,c.normalizeId)(M||k),this._checkUnique(M),this.schemas[M]=this._addSchema(O,K,M,P,!0),this}addMetaSchema(O,M,K=this.opts.validateSchema){return this.addSchema(O,M,!0,K),this}validateSchema(O,M){if(typeof O=="boolean")return!0;let K;if(K=O.$schema,K!==void 0&&typeof K!="string")throw Error("$schema must be a string");if(K=K||this.opts.defaultMeta||this.defaultMeta(),!K)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let P=this.validate(K,O);if(!P&&M){let k="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(k);else throw Error(k)}return P}getSchema(O){let M;while(typeof(M=R.call(this,O))=="string")O=M;if(M===void 0){let{schemaId:K}=this.opts,P=new i.SchemaEnv({schema:{},schemaId:K});if(M=i.resolveSchema.call(this,P,O),!M)return;this.refs[O]=M}return M.validate||this._compileSchemaEnv(M)}removeSchema(O){if(O instanceof RegExp)return this._removeAllSchemas(this.schemas,O),this._removeAllSchemas(this.refs,O),this;switch(typeof O){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let M=R.call(this,O);if(typeof M=="object")this._cache.delete(M.schema);return delete this.schemas[O],delete this.refs[O],this}case"object":{let M=O;this._cache.delete(M);let K=O[this.opts.schemaId];if(K)K=(0,c.normalizeId)(K),delete this.schemas[K],delete this.refs[K];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(O){for(let M of O)this.addKeyword(M);return this}addKeyword(O,M){let K;if(typeof O=="string"){if(K=O,typeof M=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),M.keyword=K}else if(typeof O=="object"&&M===void 0){if(M=O,K=M.keyword,Array.isArray(K)&&!K.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(H.call(this,K,M),!M)return(0,l.eachItem)(K,(k)=>ge.call(this,k)),this;Ne.call(this,M);let P={...M,type:(0,u.getJSONTypes)(M.type),schemaType:(0,u.getJSONTypes)(M.schemaType)};return(0,l.eachItem)(K,P.type.length===0?(k)=>ge.call(this,k,P):(k)=>P.type.forEach((j)=>ge.call(this,k,P,j))),this}getKeyword(O){let M=this.RULES.all[O];return typeof M=="object"?M.definition:!!M}removeKeyword(O){let{RULES:M}=this;delete M.keywords[O],delete M.all[O];for(let K of M.rules){let P=K.rules.findIndex((k)=>k.keyword===O);if(P>=0)K.rules.splice(P,1)}return this}addFormat(O,M){if(typeof M=="string")M=new RegExp(M);return this.formats[O]=M,this}errorsText(O=this.errors,{separator:M=", ",dataVar:K="data"}={}){if(!O||O.length===0)return"No errors";return O.map((P)=>`${K}${P.instancePath} ${P.message}`).reduce((P,k)=>P+M+k)}$dataMetaSchema(O,M){let K=this.RULES.all;O=JSON.parse(JSON.stringify(O));for(let P of M){let k=P.split("/").slice(1),j=O;for(let W of k)j=j[W];for(let W in K){let ue=K[W];if(typeof ue!="object")continue;let{$data:Ee}=ue.definition,ye=j[W];if(Ee&&ye)j[W]=Pe(ye)}}return O}_removeAllSchemas(O,M){for(let K in O){let P=O[K];if(!M||M.test(K)){if(typeof P=="string")delete O[K];else if(P&&!P.meta)this._cache.delete(P.schema),delete O[K]}}}_addSchema(O,M,K,P=this.opts.validateSchema,k=this.opts.addUsedSchema){let j,{schemaId:W}=this.opts;if(typeof O=="object")j=O[W];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof O!="boolean")throw Error("schema must be object or boolean");let ue=this._cache.get(O);if(ue!==void 0)return ue;K=(0,c.normalizeId)(j||K);let Ee=c.getSchemaRefs.call(this,O,K);if(ue=new i.SchemaEnv({schema:O,schemaId:W,meta:M,baseId:K,localRefs:Ee}),this._cache.set(ue.schema,ue),k&&!K.startsWith("#")){if(K)this._checkUnique(K);this.refs[K]=ue}if(P)this.validateSchema(O,!0);return ue}_checkUnique(O){if(this.schemas[O]||this.refs[O])throw Error(`schema with key or id "${O}" already exists`)}_compileSchemaEnv(O){if(O.meta)this._compileMetaSchema(O);else i.compileSchema.call(this,O);if(!O.validate)throw Error("ajv implementation error");return O.validate}_compileMetaSchema(O){let M=this.opts;this.opts=this._metaOpts;try{i.compileSchema.call(this,O)}finally{this.opts=M}}};w.ValidationError=o.default,w.MissingRefError=n.default,e.default=w;function z(O,M,K,P="error"){for(let k in O){let j=k;if(j in M)this.logger[P](`${K}: option ${k}. ${O[j]}`)}}function R(O){return O=(0,c.normalizeId)(O),this.schemas[O]||this.refs[O]}function b(){let O=this.opts.schemas;if(!O)return;if(Array.isArray(O))this.addSchema(O);else for(let M in O)this.addSchema(O[M],M)}function E(){for(let O in this.opts.formats){let M=this.opts.formats[O];if(M)this.addFormat(O,M)}}function C(O){if(Array.isArray(O)){this.addVocabulary(O);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let M in O){let K=O[M];if(!K.keyword)K.keyword=M;this.addKeyword(K)}}function q(){let O={...this.opts};for(let M of h)delete O[M];return O}let x={log(){},warn(){},error(){}};function F(O){if(O===!1)return x;if(O===void 0)return console;if(O.log&&O.warn&&O.error)return O;throw Error("logger must implement log, warn and error methods")}let B=/^[a-z_$][a-z0-9_$:-]*$/i;function H(O,M){let{RULES:K}=this;if((0,l.eachItem)(O,(P)=>{if(K.keywords[P])throw Error(`Keyword ${P} is already defined`);if(!B.test(P))throw Error(`Keyword ${P} has invalid name`)}),!M)return;if(M.$data&&!(("code"in M)||("validate"in M)))throw Error('$data keyword must have "code" or "validate" function')}function ge(O,M,K){var P;let k=M===null||M===void 0?void 0:M.post;if(K&&k)throw Error('keyword with "post" flag cannot have "type"');let{RULES:j}=this,W=k?j.post:j.rules.find(({type:Ee})=>Ee===K);if(!W)W={type:K,rules:[]},j.rules.push(W);if(j.keywords[O]=!0,!M)return;let ue={keyword:O,definition:{...M,type:(0,u.getJSONTypes)(M.type),schemaType:(0,u.getJSONTypes)(M.schemaType)}};if(M.before)Ie.call(this,W,ue,M.before);else W.rules.push(ue);j.all[O]=ue,(P=M.implements)===null||P===void 0||P.forEach((Ee)=>this.addKeyword(Ee))}function Ie(O,M,K){let P=O.rules.findIndex((k)=>k.keyword===K);if(P>=0)O.rules.splice(P,0,M);else O.rules.push(M),this.logger.warn(`rule ${K} is not defined`)}function Ne(O){let{metaSchema:M}=O;if(M===void 0)return;if(O.$data&&this.opts.$data)M=Pe(M);O.validateSchema=this.compile(M,!0)}let De={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Pe(O){return{anyOf:[O,De]}}});var wN=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};e.default=t}),km=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.callRef=e.getValidate=void 0;let t=is(),r=fr(),o=be(),n=pr(),s=ql(),i=Oe(),a={keyword:"$ref",schemaType:"string",code(l){let{gen:d,schema:f,it:m}=l,{baseId:h,schemaEnv:g,validateName:_,opts:y,self:S}=m,{root:v}=g;if((f==="#"||f==="#/")&&h===v.baseId)return z();let w=s.resolveRef.call(S,v,h,f);if(w===void 0)throw new t.default(m.opts.uriResolver,h,f);if(w instanceof s.SchemaEnv)return R(w);return b(w);function z(){if(g===v)return u(l,_,g,g.$async);let E=d.scopeValue("root",{ref:v});return u(l,o._`${E}.validate`,v,v.$async)}function R(E){u(l,c(l,E),E,E.$async)}function b(E){let C=d.scopeValue("schema",y.code.source===!0?{ref:E,code:(0,o.stringify)(E)}:{ref:E}),q=d.name("valid"),x=l.subschema({schema:E,dataTypes:[],schemaPath:o.nil,topSchemaRef:C,errSchemaPath:f},q);l.mergeEvaluated(x),l.ok(q)}}};function c(l,d){let{gen:f}=l;return d.validate?f.scopeValue("validate",{ref:d.validate}):o._`${f.scopeValue("wrapper",{ref:d})}.validate`}e.getValidate=c;function u(l,d,f,m){let{gen:h,it:g}=l,{allErrors:_,schemaEnv:y,opts:S}=g,v=S.passContext?n.default.this:o.nil;if(m)w();else z();function w(){if(!y.$async)throw Error("async schema referenced by sync schema");let E=h.let("valid");h.try(()=>{if(h.code(o._`await ${(0,r.callValidateCode)(l,d,v)}`),b(d),!_)h.assign(E,!0)},(C)=>{if(h.if(o._`!(${C} instanceof ${g.ValidationError})`,()=>h.throw(C)),R(C),!_)h.assign(E,!1)}),l.ok(E)}function z(){l.result((0,r.callValidateCode)(l,d,v),()=>b(d),()=>R(d))}function R(E){let C=o._`${E}.errors`;h.assign(n.default.vErrors,o._`${n.default.vErrors} === null ? ${C} : ${n.default.vErrors}.concat(${C})`),h.assign(n.default.errors,o._`${n.default.vErrors}.length`)}function b(E){var C;if(!g.opts.unevaluated)return;let q=(C=f===null||f===void 0?void 0:f.validate)===null||C===void 0?void 0:C.evaluated;if(g.props!==!0)if(q&&!q.dynamicProps){if(q.props!==void 0)g.props=i.mergeEvaluated.props(h,q.props,g.props)}else{let x=h.var("props",o._`${E}.evaluated.props`);g.props=i.mergeEvaluated.props(h,x,g.props,o.Name)}if(g.items!==!0)if(q&&!q.dynamicItems){if(q.items!==void 0)g.items=i.mergeEvaluated.items(h,q.items,g.items)}else{let x=h.var("items",o._`${E}.evaluated.items`);g.items=i.mergeEvaluated.items(h,x,g.items,o.Name)}}}e.callRef=u,e.default=a}),H0=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=wN(),r=km(),o=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",t.default,r.default];e.default=o}),RN=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r=t.operators,o={maximum:{okStr:"<=",ok:r.LTE,fail:r.GT},minimum:{okStr:">=",ok:r.GTE,fail:r.LT},exclusiveMaximum:{okStr:"<",ok:r.LT,fail:r.GTE},exclusiveMinimum:{okStr:">",ok:r.GT,fail:r.LTE}},n={keyword:Object.keys(o),type:"number",schemaType:"number",$data:!0,error:{message:({keyword:s,schemaCode:i})=>t.str`must be ${o[s].okStr} ${i}`,params:({keyword:s,schemaCode:i})=>t._`{comparison: ${o[s].okStr}, limit: ${i}}`},code(s){let{keyword:i,data:a,schemaCode:c}=s;s.fail$data(t._`${a} ${o[i].fail} ${c} || isNaN(${a})`)}};e.default=n}),EN=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:o})=>t.str`must be multiple of ${o}`,params:({schemaCode:o})=>t._`{multipleOf: ${o}}`},code(o){let{gen:n,data:s,schemaCode:i,it:a}=o,c=a.opts.multipleOfPrecision,u=n.let("res"),l=c?t._`Math.abs(Math.round(${u}) - ${u}) > 1e-${c}`:t._`${u} !== parseInt(${u})`;o.fail$data(t._`(${i} === 0 || (${u} = ${s}/${i}, ${l}))`)}};e.default=r}),zN=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0});function t(r){let o=r.length,n=0,s=0,i;while(s<o)if(n++,i=r.charCodeAt(s++),i>=55296&&i<=56319&&s<o){if(i=r.charCodeAt(s),(i&64512)===56320)s++}return n}e.default=t,t.code='require("ajv/dist/runtime/ucs2length").default'}),PN=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r=Oe(),o=zN(),n={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:s,schemaCode:i}){let a=s==="maxLength"?"more":"fewer";return t.str`must NOT have ${a} than ${i} characters`},params:({schemaCode:s})=>t._`{limit: ${s}}`},code(s){let{keyword:i,data:a,schemaCode:c,it:u}=s,l=i==="maxLength"?t.operators.GT:t.operators.LT,d=u.opts.unicode===!1?t._`${a}.length`:t._`${(0,r.useFunc)(s.gen,o.default)}(${a})`;s.fail$data(t._`${d} ${l} ${c}`)}};e.default=n}),TN=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=fr(),r=Oe(),o=be(),n={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:s})=>o.str`must match pattern "${s}"`,params:({schemaCode:s})=>o._`{pattern: ${s}}`},code(s){let{gen:i,data:a,$data:c,schema:u,schemaCode:l,it:d}=s,f=d.opts.unicodeRegExp?"u":"";if(c){let{regExp:m}=d.opts.code,h=m.code==="new RegExp"?o._`new RegExp`:(0,r.useFunc)(i,m),g=i.let("valid");i.try(()=>i.assign(g,o._`${h}(${l}, ${f}).test(${a})`),()=>i.assign(g,!1)),s.fail$data(o._`!${g}`)}else{let m=(0,t.usePattern)(s,u);s.fail$data(o._`!${m}.test(${a})`)}}};e.default=n}),IN=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:o,schemaCode:n}){let s=o==="maxProperties"?"more":"fewer";return t.str`must NOT have ${s} than ${n} properties`},params:({schemaCode:o})=>t._`{limit: ${o}}`},code(o){let{keyword:n,data:s,schemaCode:i}=o,a=n==="maxProperties"?t.operators.GT:t.operators.LT;o.fail$data(t._`Object.keys(${s}).length ${a} ${i}`)}};e.default=r}),kN=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=fr(),r=be(),o=Oe(),n={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:s}})=>r.str`must have required property '${s}'`,params:({params:{missingProperty:s}})=>r._`{missingProperty: ${s}}`},code(s){let{gen:i,schema:a,schemaCode:c,data:u,$data:l,it:d}=s,{opts:f}=d;if(!l&&a.length===0)return;let m=a.length>=f.loopRequired;if(d.allErrors)h();else g();if(f.strictRequired){let S=s.parentSchema.properties,{definedProperties:v}=s.it;for(let w of a)if((S===null||S===void 0?void 0:S[w])===void 0&&!v.has(w)){let z=`required property "${w}" is not defined at "${d.schemaEnv.baseId+d.errSchemaPath}" (strictRequired)`;(0,o.checkStrictMode)(d,z,d.opts.strictRequired)}}function h(){if(m||l)s.block$data(r.nil,_);else for(let S of a)(0,t.checkReportMissingProp)(s,S)}function g(){let S=i.let("missing");if(m||l){let v=i.let("valid",!0);s.block$data(v,()=>y(S,v)),s.ok(v)}else i.if((0,t.checkMissingProp)(s,a,S)),(0,t.reportMissingProp)(s,S),i.else()}function _(){i.forOf("prop",c,(S)=>{s.setParams({missingProperty:S}),i.if((0,t.noPropertyInData)(i,u,S,f.ownProperties),()=>s.error())})}function y(S,v){s.setParams({missingProperty:S}),i.forOf(S,c,()=>{i.assign(v,(0,t.propertyInData)(i,u,S,f.ownProperties)),i.if((0,r.not)(v),()=>{s.error(),i.break()})},r.nil)}}};e.default=n}),ON=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:o,schemaCode:n}){let s=o==="maxItems"?"more":"fewer";return t.str`must NOT have ${s} than ${n} items`},params:({schemaCode:o})=>t._`{limit: ${o}}`},code(o){let{keyword:n,data:s,schemaCode:i}=o,a=n==="maxItems"?t.operators.GT:t.operators.LT;o.fail$data(t._`${s}.length ${a} ${i}`)}};e.default=r}),Om=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=V0();t.code='require("ajv/dist/runtime/equal").default',e.default=t}),CN=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Nl(),r=be(),o=Oe(),n=Om(),s={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i,j:a}})=>r.str`must NOT have duplicate items (items ## ${a} and ${i} are identical)`,params:({params:{i,j:a}})=>r._`{i: ${i}, j: ${a}}`},code(i){let{gen:a,data:c,$data:u,schema:l,parentSchema:d,schemaCode:f,it:m}=i;if(!u&&!l)return;let h=a.let("valid"),g=d.items?(0,t.getSchemaTypes)(d.items):[];i.block$data(h,_,r._`${f} === false`),i.ok(h);function _(){let w=a.let("i",r._`${c}.length`),z=a.let("j");i.setParams({i:w,j:z}),a.assign(h,!0),a.if(r._`${w} > 1`,()=>(y()?S:v)(w,z))}function y(){return g.length>0&&!g.some((w)=>w==="object"||w==="array")}function S(w,z){let R=a.name("item"),b=(0,t.checkDataTypes)(g,R,m.opts.strictNumbers,t.DataType.Wrong),E=a.const("indices",r._`{}`);a.for(r._`;${w}--;`,()=>{if(a.let(R,r._`${c}[${w}]`),a.if(b,r._`continue`),g.length>1)a.if(r._`typeof ${R} == "string"`,r._`${R} += "_"`);a.if(r._`typeof ${E}[${R}] == "number"`,()=>{a.assign(z,r._`${E}[${R}]`),i.error(),a.assign(h,!1).break()}).code(r._`${E}[${R}] = ${w}`)})}function v(w,z){let R=(0,o.useFunc)(a,n.default),b=a.name("outer");a.label(b).for(r._`;${w}--;`,()=>a.for(r._`${z} = ${w}; ${z}--;`,()=>a.if(r._`${R}(${c}[${w}], ${c}[${z}])`,()=>{i.error(),a.assign(h,!1).break(b)})))}}};e.default=s}),xN=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r=Oe(),o=Om(),n={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:s})=>t._`{allowedValue: ${s}}`},code(s){let{gen:i,data:a,$data:c,schemaCode:u,schema:l}=s;if(c||l&&typeof l=="object")s.fail$data(t._`!${(0,r.useFunc)(i,o.default)}(${a}, ${u})`);else s.fail(t._`${l} !== ${a}`)}};e.default=n}),NN=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r=Oe(),o=Om(),n={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:s})=>t._`{allowedValues: ${s}}`},code(s){let{gen:i,data:a,$data:c,schema:u,schemaCode:l,it:d}=s;if(!c&&u.length===0)throw Error("enum must have non-empty array");let f=u.length>=d.opts.loopEnum,m,h=()=>m!==null&&m!==void 0?m:m=(0,r.useFunc)(i,o.default),g;if(f||c)g=i.let("valid"),s.block$data(g,_);else{if(!Array.isArray(u))throw Error("ajv implementation error");let S=i.const("vSchema",l);g=(0,t.or)(...u.map((v,w)=>y(S,w)))}s.pass(g);function _(){i.assign(g,!1),i.forOf("v",l,(S)=>i.if(t._`${h()}(${a}, ${S})`,()=>i.assign(g,!0).break()))}function y(S,v){let w=u[v];return typeof w==="object"&&w!==null?t._`${h()}(${a}, ${S}[${v}])`:t._`${a} === ${w}`}}};e.default=n}),G0=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=RN(),r=EN(),o=PN(),n=TN(),s=IN(),i=kN(),a=ON(),c=CN(),u=xN(),l=NN(),d=[t.default,r.default,o.default,n.default,s.default,i.default,a.default,c.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},u.default,l.default];e.default=d}),J0=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateAdditionalItems=void 0;let t=be(),r=Oe(),o={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:s}})=>t.str`must NOT have more than ${s} items`,params:({params:{len:s}})=>t._`{limit: ${s}}`},code(s){let{parentSchema:i,it:a}=s,{items:c}=i;if(!Array.isArray(c)){(0,r.checkStrictMode)(a,'"additionalItems" is ignored when "items" is not an array of schemas');return}n(s,c)}};function n(s,i){let{gen:a,schema:c,data:u,keyword:l,it:d}=s;d.items=!0;let f=a.const("len",t._`${u}.length`);if(c===!1)s.setParams({len:i.length}),s.pass(t._`${f} <= ${i.length}`);else if(typeof c=="object"&&!(0,r.alwaysValidSchema)(d,c)){let h=a.var("valid",t._`${f} <= ${i.length}`);a.if((0,t.not)(h),()=>m(h)),s.ok(h)}function m(h){a.forRange("i",i.length,f,(g)=>{if(s.subschema({keyword:l,dataProp:g,dataPropType:r.Type.Num},h),!d.allErrors)a.if((0,t.not)(h),()=>a.break())})}}e.validateAdditionalItems=n,e.default=o}),K0=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateTuple=void 0;let t=be(),r=Oe(),o=fr(),n={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(i){let{schema:a,it:c}=i;if(Array.isArray(a))return s(i,"additionalItems",a);if(c.items=!0,(0,r.alwaysValidSchema)(c,a))return;i.ok((0,o.validateArray)(i))}};function s(i,a,c=i.schema){let{gen:u,parentSchema:l,data:d,keyword:f,it:m}=i;if(_(l),m.opts.unevaluated&&c.length&&m.items!==!0)m.items=r.mergeEvaluated.items(u,c.length,m.items);let h=u.name("valid"),g=u.const("len",t._`${d}.length`);c.forEach((y,S)=>{if((0,r.alwaysValidSchema)(m,y))return;u.if(t._`${g} > ${S}`,()=>i.subschema({keyword:f,schemaProp:S,dataProp:S},h)),i.ok(h)});function _(y){let{opts:S,errSchemaPath:v}=m,w=c.length,z=w===y.minItems&&(w===y.maxItems||y[a]===!1);if(S.strictTuples&&!z){let R=`"${f}" is ${w}-tuple, but minItems or maxItems/${a} are not specified or different at path "${v}"`;(0,r.checkStrictMode)(m,R,S.strictTuples)}}}e.validateTuple=s,e.default=n}),AN=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=K0(),r={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(o)=>(0,t.validateTuple)(o,"items")};e.default=r}),jN=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r=Oe(),o=fr(),n=J0(),s={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:i}})=>t.str`must NOT have more than ${i} items`,params:({params:{len:i}})=>t._`{limit: ${i}}`},code(i){let{schema:a,parentSchema:c,it:u}=i,{prefixItems:l}=c;if(u.items=!0,(0,r.alwaysValidSchema)(u,a))return;if(l)(0,n.validateAdditionalItems)(i,l);else i.ok((0,o.validateArray)(i))}};e.default=s}),qN=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r=Oe(),o={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:n,max:s}})=>s===void 0?t.str`must contain at least ${n} valid item(s)`:t.str`must contain at least ${n} and no more than ${s} valid item(s)`,params:({params:{min:n,max:s}})=>s===void 0?t._`{minContains: ${n}}`:t._`{minContains: ${n}, maxContains: ${s}}`},code(n){let{gen:s,schema:i,parentSchema:a,data:c,it:u}=n,l,d,{minContains:f,maxContains:m}=a;if(u.opts.next)l=f===void 0?1:f,d=m;else l=1;let h=s.const("len",t._`${c}.length`);if(n.setParams({min:l,max:d}),d===void 0&&l===0){(0,r.checkStrictMode)(u,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(d!==void 0&&l>d){(0,r.checkStrictMode)(u,'"minContains" > "maxContains" is always invalid'),n.fail();return}if((0,r.alwaysValidSchema)(u,i)){let v=t._`${h} >= ${l}`;if(d!==void 0)v=t._`${v} && ${h} <= ${d}`;n.pass(v);return}u.items=!0;let g=s.name("valid");if(d===void 0&&l===1)y(g,()=>s.if(g,()=>s.break()));else if(l===0){if(s.let(g,!0),d!==void 0)s.if(t._`${c}.length > 0`,_)}else s.let(g,!1),_();n.result(g,()=>n.reset());function _(){let v=s.name("_valid"),w=s.let("count",0);y(v,()=>s.if(v,()=>S(w)))}function y(v,w){s.forRange("i",0,h,(z)=>{n.subschema({keyword:"contains",dataProp:z,dataPropType:r.Type.Num,compositeRule:!0},v),w()})}function S(v){if(s.code(t._`${v}++`),d===void 0)s.if(t._`${v} >= ${l}`,()=>s.assign(g,!0).break());else if(s.if(t._`${v} > ${d}`,()=>s.assign(g,!1).break()),l===1)s.assign(g,!0);else s.if(t._`${v} >= ${l}`,()=>s.assign(g,!0))}}};e.default=o}),Cm=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;let t=be(),r=Oe(),o=fr();e.error={message:({params:{property:c,depsCount:u,deps:l}})=>{let d=u===1?"property":"properties";return t.str`must have ${d} ${l} when property ${c} is present`},params:({params:{property:c,depsCount:u,deps:l,missingProperty:d}})=>t._`{property: ${c},
51
+ */var lN=J((e)=>{var t=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,r=/\\([\u000b\u0020-\u00ff])/g,n=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;e.parse=o;function o(a){if(!a)throw TypeError("argument string is required");var c=typeof a==="object"?s(a):a;if(typeof c!=="string")throw TypeError("argument string is required to be a string");var u=c.indexOf(";"),l=u!==-1?c.slice(0,u).trim():c.trim();if(!n.test(l))throw TypeError("invalid media type");var d=new i(l.toLowerCase());if(u!==-1){var p,m,h;t.lastIndex=u;while(m=t.exec(c)){if(m.index!==u)throw TypeError("invalid parameter format");if(u+=m[0].length,p=m[1].toLowerCase(),h=m[2],h.charCodeAt(0)===34){if(h=h.slice(1,-1),h.indexOf("\\")!==-1)h=h.replace(r,"$1")}d.parameters[p]=h}if(u!==c.length)throw TypeError("invalid parameter format")}return d}function s(a){var c;if(typeof a.getHeader==="function")c=a.getHeader("content-type");else if(typeof a.headers==="object")c=a.headers&&a.headers["content-type"];if(typeof c!=="string")throw TypeError("content-type header is missing from object");return c}function i(a){this.parameters=Object.create(null),this.type=a}}),F3=mc(lN(),1);var hb=10485760,Zm=class{_buffer;_maxBufferSize;constructor(e){this._maxBufferSize=e?.maxBufferSize??hb}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(){while(this._buffer){let e=this._buffer.indexOf(`
52
+ `);if(e===-1)return null;let t=this._buffer.toString("utf8",0,e).replace(/\r$/,"");this._buffer=this._buffer.subarray(e+1);try{return gb(t)}catch(r){if(r instanceof SyntaxError)continue;throw r}}return null}clear(){this._buffer=void 0}};function gb(e){return Di.parse(JSON.parse(e))}function Gm(e){return JSON.stringify(e)+`
53
+ `}var dN=/^[A-Za-z0-9._-]{1,128}$/;function pN(e){let t=[];if(e.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(e.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${e.length})`]};if(e.includes(" "))t.push("Tool name contains spaces, which may cause parsing issues");if(e.includes(","))t.push("Tool name contains commas, which may cause parsing issues");if(e.startsWith("-")||e.endsWith("-"))t.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts");if(e.startsWith(".")||e.endsWith("."))t.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts");if(!dN.test(e)){let r=[...e].filter((n)=>!/[A-Za-z0-9._-]/.test(n)).filter((n,o,s)=>s.indexOf(n)===o);return t.push(`Tool name contains invalid characters: ${r.map((n)=>`"${n}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:t}}return{isValid:!0,warnings:t}}function fN(e,t){if(t.length>0){console.warn(`Tool name validation warning for "${e}":`);for(let r of t)console.warn(` - ${r}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function Jm(e){let t=pN(e);return fN(e,t.warnings),t.isValid}function mN(e){return typeof e==="object"&&e!==null&&"_zod"in e}function hN(e){return typeof e==="object"&&e!==null&&!("_zod"in e)&&"_def"in e&&typeof e._def?.typeName==="string"}function gN(e){if(typeof e!=="object"||e===null)return!1;if(cs(e))return!1;let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)return!1;return Object.values(e).every((r)=>mN(r))}function Vl(e){if(e===void 0)return;if(gN(e))return T(e);if(typeof e==="object"&&e!==null&&!cs(e)&&Object.values(e).some((t)=>hN(t)))throw TypeError("Raw-shape inputSchema/outputSchema/argsSchema fields must be Zod v4 schemas. Got a Zod v3 field schema. Import from `zod/v4` (or upgrade your zod import), or wrap with `z.object({...})` yourself.");if(!cs(e))throw TypeError("inputSchema/outputSchema/argsSchema must be a Standard Schema (e.g. z.object({...})) or a raw Zod shape ({ field: z.string() }).");return e}var Hl=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;var t=class{};e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var r=class extends t{constructor(y){super();if(!e.IDENTIFIER.test(y))throw Error("CodeGen: name must be a valid identifier");this.str=y}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};e.Name=r;var n=class extends t{constructor(y){super();this._items=typeof y==="string"?[y]:y}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let y=this._items[0];return y===""||y==='""'}get str(){var y;return(y=this._str)!==null&&y!==void 0?y:this._str=this._items.reduce((S,v)=>`${S}${v}`,"")}get names(){var y;return(y=this._names)!==null&&y!==void 0?y:this._names=this._items.reduce((S,v)=>{if(v instanceof r)S[v.str]=(S[v.str]||0)+1;return S},{})}};e._Code=n,e.nil=new n("");function o(y,...S){let v=[y[0]],w=0;while(w<S.length)a(v,S[w]),v.push(y[++w]);return new n(v)}e._=o;let s=new n("+");function i(y,...S){let v=[m(y[0])],w=0;while(w<S.length)v.push(s),a(v,S[w]),v.push(s,m(y[++w]));return c(v),new n(v)}e.str=i;function a(y,S){if(S instanceof n)y.push(...S._items);else if(S instanceof r)y.push(S);else y.push(d(S))}e.addCodeArg=a;function c(y){let S=1;while(S<y.length-1){if(y[S]===s){let v=u(y[S-1],y[S+1]);if(v!==void 0){y.splice(S-1,3,v);continue}y[S++]="+"}S++}}function u(y,S){if(S==='""')return y;if(y==='""')return S;if(typeof y=="string"){if(S instanceof r||y[y.length-1]!=='"')return;if(typeof S!="string")return`${y.slice(0,-1)}${S}"`;if(S[0]==='"')return y.slice(0,-1)+S.slice(1);return}if(typeof S=="string"&&S[0]==='"'&&!(y instanceof r))return`"${y}${S.slice(1)}`}function l(y,S){return S.emptyStr()?y:y.emptyStr()?S:i`${y}${S}`}e.strConcat=l;function d(y){return typeof y=="number"||typeof y=="boolean"||y===null?y:m(Array.isArray(y)?y.join(","):y)}function p(y){return new n(m(y))}e.stringify=p;function m(y){return JSON.stringify(y).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=m;function h(y){return typeof y=="string"&&e.IDENTIFIER.test(y)?new n(`.${y}`):o`[${y}]`}e.getProperty=h;function g(y){if(typeof y=="string"&&e.IDENTIFIER.test(y))return new n(`${y}`);throw Error(`CodeGen: invalid export name: ${y}, use explicit $id name mapping`)}e.getEsmExportName=g;function _(y){return new n(y.toString())}e.regexpCode=_}),yb=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;let t=Hl();var r=class extends Error{constructor(c){super(`CodeGen: "code" for ${c} not defined`);this.value=c.value}},n;(function(c){c[c.Started=0]="Started",c[c.Completed=1]="Completed"})(n||(e.UsedValueState=n={})),e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};var o=class{constructor({prefixes:c,parent:u}={}){this._names={},this._prefixes=c,this._parent=u}toName(c){return c instanceof t.Name?c:this.name(c)}name(c){return new t.Name(this._newName(c))}_newName(c){let u=this._names[c]||this._nameGroup(c);return`${c}${u.index++}`}_nameGroup(c){var u,l;if(((l=(u=this._parent)===null||u===void 0?void 0:u._prefixes)===null||l===void 0?void 0:l.has(c))||this._prefixes&&!this._prefixes.has(c))throw Error(`CodeGen: prefix "${c}" is not allowed in this scope`);return this._names[c]={prefix:c,index:0}}};e.Scope=o;var s=class extends t.Name{constructor(c,u){super(u);this.prefix=c}setValue(c,{property:u,itemIndex:l}){this.value=c,this.scopePath=t._`.${new t.Name(u)}[${l}]`}};e.ValueScopeName=s;let i=t._`\n`;var a=class extends o{constructor(c){super(c);this._values={},this._scope=c.scope,this.opts={...c,_n:c.lines?i:t.nil}}get(){return this._scope}name(c){return new s(c,this._newName(c))}value(c,u){var l;if(u.ref===void 0)throw Error("CodeGen: ref must be passed in value");let d=this.toName(c),{prefix:p}=d,m=(l=u.key)!==null&&l!==void 0?l:u.ref,h=this._values[p];if(h){let y=h.get(m);if(y)return y}else h=this._values[p]=new Map;h.set(m,d);let g=this._scope[p]||(this._scope[p]=[]),_=g.length;return g[_]=u.ref,d.setValue(u,{property:p,itemIndex:_}),d}getValue(c,u){let l=this._values[c];if(!l)return;return l.get(u)}scopeRefs(c,u=this._values){return this._reduceValues(u,(l)=>{if(l.scopePath===void 0)throw Error(`CodeGen: name "${l}" has no value`);return t._`${c}${l.scopePath}`})}scopeCode(c=this._values,u,l){return this._reduceValues(c,(d)=>{if(d.value===void 0)throw Error(`CodeGen: name "${d}" has no value`);return d.value.code},u,l)}_reduceValues(c,u,l={},d){let p=t.nil;for(let m in c){let h=c[m];if(!h)continue;let g=l[m]=l[m]||new Map;h.forEach((_)=>{if(g.has(_))return;g.set(_,n.Started);let y=u(_);if(y){let S=this.opts.es5?e.varKinds.var:e.varKinds.const;p=t._`${p}${S} ${_} = ${y};${this.opts._n}`}else if(y=d===null||d===void 0?void 0:d(_))p=t._`${p}${y}${this.opts._n}`;else throw new r(_);g.set(_,n.Completed)})}return p}};e.ValueScope=a}),be=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;let t=Hl(),r=yb();var n=Hl();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return n.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return n.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return n.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return n.Name}});var o=yb();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return o.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return o.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return o.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return o.varKinds}}),e.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("+")};var s=class{optimizeNodes(){return this}optimizeNames(P,k){return this}},i=class extends s{constructor(P,k,j){super();this.varKind=P,this.name=k,this.rhs=j}render({es5:P,_n:k}){let j=P?r.varKinds.var:this.varKind,W=this.rhs===void 0?"":` = ${this.rhs}`;return`${j} ${this.name}${W};`+k}optimizeNames(P,k){if(!P[this.name.str])return;if(this.rhs)this.rhs=Z(this.rhs,P,k);return this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},a=class extends s{constructor(P,k,j){super();this.lhs=P,this.rhs=k,this.sideEffects=j}render({_n:P}){return`${this.lhs} = ${this.rhs};`+P}optimizeNames(P,k){if(this.lhs instanceof t.Name&&!P[this.lhs.str]&&!this.sideEffects)return;return this.rhs=Z(this.rhs,P,k),this}get names(){return B(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}},c=class extends a{constructor(P,k,j,W){super(P,j,W);this.op=k}render({_n:P}){return`${this.lhs} ${this.op}= ${this.rhs};`+P}},u=class extends s{constructor(P){super();this.label=P,this.names={}}render({_n:P}){return`${this.label}:`+P}},l=class extends s{constructor(P){super();this.label=P,this.names={}}render({_n:P}){return`break${this.label?` ${this.label}`:""};`+P}},d=class extends s{constructor(P){super();this.error=P}render({_n:P}){return`throw ${this.error};`+P}get names(){return this.error.names}},p=class extends s{constructor(P){super();this.code=P}render({_n:P}){return`${this.code};`+P}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(P,k){return this.code=Z(this.code,P,k),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}},m=class extends s{constructor(P=[]){super();this.nodes=P}render(P){return this.nodes.reduce((k,j)=>k+j.render(P),"")}optimizeNodes(){let{nodes:P}=this,k=P.length;while(k--){let j=P[k].optimizeNodes();if(Array.isArray(j))P.splice(k,1,...j);else if(j)P[k]=j;else P.splice(k,1)}return P.length>0?this:void 0}optimizeNames(P,k){let{nodes:j}=this,W=j.length;while(W--){let ue=j[W];if(ue.optimizeNames(P,k))continue;ge(P,ue.names),j.splice(W,1)}return j.length>0?this:void 0}get names(){return this.nodes.reduce((P,k)=>F(P,k.names),{})}},h=class extends m{render(P){return"{"+P._n+super.render(P)+"}"+P._n}},g=class extends m{},_=class extends h{};_.kind="else";var y=class P extends h{constructor(k,j){super(j);this.condition=k}render(k){let j=`if(${this.condition})`+super.render(k);if(this.else)j+="else "+this.else.render(k);return j}optimizeNodes(){super.optimizeNodes();let k=this.condition;if(k===!0)return this.nodes;let j=this.else;if(j){let W=j.optimizeNodes();j=this.else=Array.isArray(W)?new _(W):W}if(j){if(k===!1)return j instanceof P?j:j.nodes;if(this.nodes.length)return this;return new P(Ie(k),j instanceof P?[j]:j.nodes)}if(k===!1||!this.nodes.length)return;return this}optimizeNames(k,j){var W;if(this.else=(W=this.else)===null||W===void 0?void 0:W.optimizeNames(k,j),!(super.optimizeNames(k,j)||this.else))return;return this.condition=Z(this.condition,k,j),this}get names(){let k=super.names;if(B(k,this.condition),this.else)F(k,this.else.names);return k}};y.kind="if";var S=class extends h{};S.kind="for";var v=class extends S{constructor(P){super();this.iteration=P}render(P){return`for(${this.iteration})`+super.render(P)}optimizeNames(P,k){if(!super.optimizeNames(P,k))return;return this.iteration=Z(this.iteration,P,k),this}get names(){return F(super.names,this.iteration.names)}},w=class extends S{constructor(P,k,j,W){super();this.varKind=P,this.name=k,this.from=j,this.to=W}render(P){let k=P.es5?r.varKinds.var:this.varKind,{name:j,from:W,to:ue}=this;return`for(${k} ${j}=${W}; ${j}<${ue}; ${j}++)`+super.render(P)}get names(){return B(B(super.names,this.from),this.to)}},z=class extends S{constructor(P,k,j,W){super();this.loop=P,this.varKind=k,this.name=j,this.iterable=W}render(P){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(P)}optimizeNames(P,k){if(!super.optimizeNames(P,k))return;return this.iterable=Z(this.iterable,P,k),this}get names(){return F(super.names,this.iterable.names)}},R=class extends h{constructor(P,k,j){super();this.name=P,this.args=k,this.async=j}render(P){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(P)}};R.kind="func";var b=class extends m{render(P){return"return "+super.render(P)}};b.kind="return";var E=class extends h{render(P){let k="try"+super.render(P);if(this.catch)k+=this.catch.render(P);if(this.finally)k+=this.finally.render(P);return k}optimizeNodes(){var P,k;return super.optimizeNodes(),(P=this.catch)===null||P===void 0||P.optimizeNodes(),(k=this.finally)===null||k===void 0||k.optimizeNodes(),this}optimizeNames(P,k){var j,W;return super.optimizeNames(P,k),(j=this.catch)===null||j===void 0||j.optimizeNames(P,k),(W=this.finally)===null||W===void 0||W.optimizeNames(P,k),this}get names(){let P=super.names;if(this.catch)F(P,this.catch.names);if(this.finally)F(P,this.finally.names);return P}},x=class extends h{constructor(P){super();this.error=P}render(P){return`catch(${this.error})`+super.render(P)}};x.kind="catch";var q=class extends h{render(P){return"finally"+super.render(P)}};q.kind="finally";var C=class{constructor(P,k={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...k,_n:k.lines?`
54
+ `:""},this._extScope=P,this._scope=new r.Scope({parent:P}),this._nodes=[new g]}toString(){return this._root.render(this.opts)}name(P){return this._scope.name(P)}scopeName(P){return this._extScope.name(P)}scopeValue(P,k){let j=this._extScope.value(P,k);return(this._values[j.prefix]||(this._values[j.prefix]=new Set)).add(j),j}getScopeValue(P,k){return this._extScope.getValue(P,k)}scopeRefs(P){return this._extScope.scopeRefs(P,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(P,k,j,W){let ue=this._scope.toName(k);if(j!==void 0&&W)this._constants[ue.str]=j;return this._leafNode(new i(P,ue,j)),ue}const(P,k,j){return this._def(r.varKinds.const,P,k,j)}let(P,k,j){return this._def(r.varKinds.let,P,k,j)}var(P,k,j){return this._def(r.varKinds.var,P,k,j)}assign(P,k,j){return this._leafNode(new a(P,k,j))}add(P,k){return this._leafNode(new c(P,e.operators.ADD,k))}code(P){if(typeof P=="function")P();else if(P!==t.nil)this._leafNode(new p(P));return this}object(...P){let k=["{"];for(let[j,W]of P){if(k.length>1)k.push(",");if(k.push(j),j!==W||this.opts.es5)k.push(":"),(0,t.addCodeArg)(k,W)}return k.push("}"),new t._Code(k)}if(P,k,j){if(this._blockNode(new y(P)),k&&j)this.code(k).else().code(j).endIf();else if(k)this.code(k).endIf();else if(j)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(P){return this._elseNode(new y(P))}else(){return this._elseNode(new _)}endIf(){return this._endBlockNode(y,_)}_for(P,k){if(this._blockNode(P),k)this.code(k).endFor();return this}for(P,k){return this._for(new v(P),k)}forRange(P,k,j,W,ue=this.opts.es5?r.varKinds.var:r.varKinds.let){let Ee=this._scope.toName(P);return this._for(new w(ue,Ee,k,j),()=>W(Ee))}forOf(P,k,j,W=r.varKinds.const){let ue=this._scope.toName(P);if(this.opts.es5){let Ee=k instanceof t.Name?k:this.var("_arr",k);return this.forRange("_i",0,t._`${Ee}.length`,(ye)=>{this.var(ue,t._`${Ee}[${ye}]`),j(ue)})}return this._for(new z("of",W,ue,k),()=>j(ue))}forIn(P,k,j,W=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(P,t._`Object.keys(${k})`,j);let ue=this._scope.toName(P);return this._for(new z("in",W,ue,k),()=>j(ue))}endFor(){return this._endBlockNode(S)}label(P){return this._leafNode(new u(P))}break(P){return this._leafNode(new l(P))}return(P){let k=new b;if(this._blockNode(k),this.code(P),k.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(b)}try(P,k,j){if(!k&&!j)throw Error('CodeGen: "try" without "catch" and "finally"');let W=new E;if(this._blockNode(W),this.code(P),k){let ue=this.name("e");this._currNode=W.catch=new x(ue),k(ue)}if(j)this._currNode=W.finally=new q,this.code(j);return this._endBlockNode(x,q)}throw(P){return this._leafNode(new d(P))}block(P,k){if(this._blockStarts.push(this._nodes.length),P)this.code(P).endBlock(k);return this}endBlock(P){let k=this._blockStarts.pop();if(k===void 0)throw Error("CodeGen: not in self-balancing block");let j=this._nodes.length-k;if(j<0||P!==void 0&&j!==P)throw Error(`CodeGen: wrong number of nodes: ${j} vs ${P} expected`);return this._nodes.length=k,this}func(P,k=t.nil,j,W){if(this._blockNode(new R(P,k,j)),W)this.code(W).endFunc();return this}endFunc(){return this._endBlockNode(R)}optimize(P=1){while(P-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(P){return this._currNode.nodes.push(P),this}_blockNode(P){this._currNode.nodes.push(P),this._nodes.push(P)}_endBlockNode(P,k){let j=this._currNode;if(j instanceof P||k&&j instanceof k)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${k?`${P.kind}/${k.kind}`:P.kind}"`)}_elseNode(P){let k=this._currNode;if(!(k instanceof y))throw Error('CodeGen: "else" without "if"');return this._currNode=k.else=P,this}get _root(){return this._nodes[0]}get _currNode(){let P=this._nodes;return P[P.length-1]}set _currNode(P){let k=this._nodes;k[k.length-1]=P}};e.CodeGen=C;function F(P,k){for(let j in k)P[j]=(P[j]||0)+(k[j]||0);return P}function B(P,k){return k instanceof t._CodeOrName?F(P,k.names):P}function Z(P,k,j){if(P instanceof t.Name)return W(P);if(!ue(P))return P;return new t._Code(P._items.reduce((Ee,ye)=>{if(ye instanceof t.Name)ye=W(ye);if(ye instanceof t._Code)Ee.push(...ye._items);else Ee.push(ye);return Ee},[]));function W(Ee){let ye=j[Ee.str];if(ye===void 0||k[Ee.str]!==1)return Ee;return delete k[Ee.str],ye}function ue(Ee){return Ee instanceof t._Code&&Ee._items.some((ye)=>ye instanceof t.Name&&k[ye.str]===1&&j[ye.str]!==void 0)}}function ge(P,k){for(let j in k)P[j]=(P[j]||0)-(k[j]||0)}function Ie(P){return typeof P=="boolean"||typeof P=="number"||P===null?!P:t._`!${K(P)}`}e.not=Ie;let Ae=M(e.operators.AND);function Ue(...P){return P.reduce(Ae)}e.and=Ue;let Pe=M(e.operators.OR);function O(...P){return P.reduce(Pe)}e.or=O;function M(P){return(k,j)=>k===t.nil?j:j===t.nil?k:t._`${K(k)} ${P} ${K(j)}`}function K(P){return P instanceof t.Name?P:t._`(${P})`}}),Oe=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0;let t=be(),r=Hl();function n(R){let b={};for(let E of R)b[E]=!0;return b}e.toHash=n;function o(R,b){if(typeof b=="boolean")return b;if(Object.keys(b).length===0)return!0;return s(R,b),!i(b,R.self.RULES.all)}e.alwaysValidSchema=o;function s(R,b=R.schema){let{opts:E,self:x}=R;if(!E.strictSchema)return;if(typeof b==="boolean")return;let q=x.RULES.keywords;for(let C in b)if(!q[C])z(R,`unknown keyword: "${C}"`)}e.checkUnknownRules=s;function i(R,b){if(typeof R=="boolean")return!R;for(let E in R)if(b[E])return!0;return!1}e.schemaHasRules=i;function a(R,b){if(typeof R=="boolean")return!R;for(let E in R)if(E!=="$ref"&&b.all[E])return!0;return!1}e.schemaHasRulesButRef=a;function c({topSchemaRef:R,schemaPath:b},E,x,q){if(!q){if(typeof E=="number"||typeof E=="boolean")return E;if(typeof E=="string")return t._`${E}`}return t._`${R}${b}${(0,t.getProperty)(x)}`}e.schemaRefOrVal=c;function u(R){return p(decodeURIComponent(R))}e.unescapeFragment=u;function l(R){return encodeURIComponent(d(R))}e.escapeFragment=l;function d(R){if(typeof R=="number")return`${R}`;return R.replace(/~/g,"~0").replace(/\//g,"~1")}e.escapeJsonPointer=d;function p(R){return R.replace(/~1/g,"/").replace(/~0/g,"~")}e.unescapeJsonPointer=p;function m(R,b){if(Array.isArray(R))for(let E of R)b(E);else b(R)}e.eachItem=m;function h({mergeNames:R,mergeToName:b,mergeValues:E,resultToName:x}){return(q,C,F,B)=>{let Z=F===void 0?C:F instanceof t.Name?(C instanceof t.Name?R(q,C,F):b(q,C,F),F):C instanceof t.Name?(b(q,F,C),C):E(C,F);return B===t.Name&&!(Z instanceof t.Name)?x(q,Z):Z}}e.mergeEvaluated={props:h({mergeNames:(R,b,E)=>R.if(t._`${E} !== true && ${b} !== undefined`,()=>{R.if(t._`${b} === true`,()=>R.assign(E,!0),()=>R.assign(E,t._`${E} || {}`).code(t._`Object.assign(${E}, ${b})`))}),mergeToName:(R,b,E)=>R.if(t._`${E} !== true`,()=>{if(b===!0)R.assign(E,!0);else R.assign(E,t._`${E} || {}`),_(R,E,b)}),mergeValues:(R,b)=>R===!0?!0:{...R,...b},resultToName:g}),items:h({mergeNames:(R,b,E)=>R.if(t._`${E} !== true && ${b} !== undefined`,()=>R.assign(E,t._`${b} === true ? true : ${E} > ${b} ? ${E} : ${b}`)),mergeToName:(R,b,E)=>R.if(t._`${E} !== true`,()=>R.assign(E,b===!0?!0:t._`${E} > ${b} ? ${E} : ${b}`)),mergeValues:(R,b)=>R===!0?!0:Math.max(R,b),resultToName:(R,b)=>R.var("items",b)})};function g(R,b){if(b===!0)return R.var("props",!0);let E=R.var("props",t._`{}`);if(b!==void 0)_(R,E,b);return E}e.evaluatedPropsToName=g;function _(R,b,E){Object.keys(E).forEach((x)=>R.assign(t._`${b}${(0,t.getProperty)(x)}`,!0))}e.setEvaluated=_;let y={};function S(R,b){return R.scopeValue("func",{ref:b,code:y[b.code]||(y[b.code]=new r._Code(b.code))})}e.useFunc=S;var v;(function(R){R[R.Num=0]="Num",R[R.Str=1]="Str"})(v||(e.Type=v={}));function w(R,b,E){if(R instanceof t.Name){let x=b===v.Num;return E?x?t._`"[" + ${R} + "]"`:t._`"['" + ${R} + "']"`:x?t._`"/" + ${R}`:t._`"/" + ${R}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return E?(0,t.getProperty)(R).toString():"/"+d(R)}e.getErrorPath=w;function z(R,b,E=R.opts.strictSchema){if(!E)return;if(b=`strict mode: ${b}`,E===!0)throw Error(b);R.self.logger.warn(b)}e.checkStrictMode=z}),hr=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r={data:new t.Name("data"),valCxt:new t.Name("valCxt"),instancePath:new t.Name("instancePath"),parentData:new t.Name("parentData"),parentDataProperty:new t.Name("parentDataProperty"),rootData:new t.Name("rootData"),dynamicAnchors:new t.Name("dynamicAnchors"),vErrors:new t.Name("vErrors"),errors:new t.Name("errors"),this:new t.Name("this"),self:new t.Name("self"),scope:new t.Name("scope"),json:new t.Name("json"),jsonPos:new t.Name("jsonPos"),jsonLen:new t.Name("jsonLen"),jsonPart:new t.Name("jsonPart")};e.default=r}),Gl=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;let t=be(),r=Oe(),n=hr();e.keywordError={message:({keyword:_})=>t.str`must pass "${_}" keyword validation`},e.keyword$DataError={message:({keyword:_,schemaType:y})=>y?t.str`"${_}" keyword must be ${y} ($data)`:t.str`"${_}" keyword is invalid ($data)`};function o(_,y=e.keywordError,S,v){let{it:w}=_,{gen:z,compositeRule:R,allErrors:b}=w,E=d(_,y,S);if(v!==null&&v!==void 0?v:R||b)c(z,E);else u(w,t._`[${E}]`)}e.reportError=o;function s(_,y=e.keywordError,S){let{it:v}=_,{gen:w,compositeRule:z,allErrors:R}=v;if(c(w,d(_,y,S)),!(z||R))u(v,n.default.vErrors)}e.reportExtraError=s;function i(_,y){_.assign(n.default.errors,y),_.if(t._`${n.default.vErrors} !== null`,()=>_.if(y,()=>_.assign(t._`${n.default.vErrors}.length`,y),()=>_.assign(n.default.vErrors,null)))}e.resetErrorsCount=i;function a({gen:_,keyword:y,schemaValue:S,data:v,errsCount:w,it:z}){if(w===void 0)throw Error("ajv implementation error");let R=_.name("err");_.forRange("i",w,n.default.errors,(b)=>{if(_.const(R,t._`${n.default.vErrors}[${b}]`),_.if(t._`${R}.instancePath === undefined`,()=>_.assign(t._`${R}.instancePath`,(0,t.strConcat)(n.default.instancePath,z.errorPath))),_.assign(t._`${R}.schemaPath`,t.str`${z.errSchemaPath}/${y}`),z.opts.verbose)_.assign(t._`${R}.schema`,S),_.assign(t._`${R}.data`,v)})}e.extendErrors=a;function c(_,y){let S=_.const("err",y);_.if(t._`${n.default.vErrors} === null`,()=>_.assign(n.default.vErrors,t._`[${S}]`),t._`${n.default.vErrors}.push(${S})`),_.code(t._`${n.default.errors}++`)}function u(_,y){let{gen:S,validateName:v,schemaEnv:w}=_;if(w.$async)S.throw(t._`new ${_.ValidationError}(${y})`);else S.assign(t._`${v}.errors`,y),S.return(!1)}let l={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function d(_,y,S){let{createErrors:v}=_.it;if(v===!1)return t._`{}`;return p(_,y,S)}function p(_,y,S={}){let{gen:v,it:w}=_,z=[m(w,S),h(_,S)];return g(_,y,z),v.object(...z)}function m({errorPath:_},{instancePath:y}){let S=y?t.str`${_}${(0,r.getErrorPath)(y,r.Type.Str)}`:_;return[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,S)]}function h({keyword:_,it:{errSchemaPath:y}},{schemaPath:S,parentSchema:v}){let w=v?y:t.str`${y}/${_}`;if(S)w=t.str`${w}${(0,r.getErrorPath)(S,r.Type.Str)}`;return[l.schemaPath,w]}function g(_,{params:y,message:S},v){let{keyword:w,data:z,schemaValue:R,it:b}=_,{opts:E,propertyName:x,topSchemaRef:q,schemaPath:C}=b;if(v.push([l.keyword,w],[l.params,typeof y=="function"?y(_):y||t._`{}`]),E.messages)v.push([l.message,typeof S=="function"?S(_):S]);if(E.verbose)v.push([l.schema,R],[l.parentSchema,t._`${q}${C}`],[n.default.data,z]);if(x)v.push([l.propertyName,x])}}),yN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;let t=Gl(),r=be(),n=hr(),o={message:"boolean schema is false"};function s(c){let{gen:u,schema:l,validateName:d}=c;if(l===!1)a(c,!1);else if(typeof l=="object"&&l.$async===!0)u.return(n.default.data);else u.assign(r._`${d}.errors`,null),u.return(!0)}e.topBoolOrEmptySchema=s;function i(c,u){let{gen:l,schema:d}=c;if(d===!1)l.var(u,!1),a(c);else l.var(u,!0)}e.boolOrEmptySchema=i;function a(c,u){let{gen:l,data:d}=c,p={gen:l,keyword:"false schema",data:d,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:c};(0,t.reportError)(p,o,void 0,u)}}),_b=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getRules=e.isJSONType=void 0;let t=new Set(["string","number","integer","boolean","null","object","array"]);function r(o){return typeof o=="string"&&t.has(o)}e.isJSONType=r;function n(){let o={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...o,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},o.number,o.string,o.array,o.object],post:{rules:[]},all:{},keywords:{}}}e.getRules=n}),vb=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.shouldUseRule=e.shouldUseGroup=e.schemaHasRulesForType=void 0;function t({schema:o,self:s},i){let a=s.RULES.types[i];return a&&a!==!0&&r(o,a)}e.schemaHasRulesForType=t;function r(o,s){return s.rules.some((i)=>n(o,i))}e.shouldUseGroup=r;function n(o,s){var i;return o[s.keyword]!==void 0||((i=s.definition.implements)===null||i===void 0?void 0:i.some((a)=>o[a]!==void 0))}e.shouldUseRule=n}),Zl=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;let t=_b(),r=vb(),n=Gl(),o=be(),s=Oe();var i;(function(v){v[v.Correct=0]="Correct",v[v.Wrong=1]="Wrong"})(i||(e.DataType=i={}));function a(v){let w=c(v.type);if(w.includes("null")){if(v.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!w.length&&v.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');if(v.nullable===!0)w.push("null")}return w}e.getSchemaTypes=a;function c(v){let w=Array.isArray(v)?v:v?[v]:[];if(w.every(t.isJSONType))return w;throw Error("type must be JSONType or JSONType[]: "+w.join(","))}e.getJSONTypes=c;function u(v,w){let{gen:z,data:R,opts:b}=v,E=d(w,b.coerceTypes),x=w.length>0&&!(E.length===0&&w.length===1&&(0,r.schemaHasRulesForType)(v,w[0]));if(x){let q=g(w,R,b.strictNumbers,i.Wrong);z.if(q,()=>{if(E.length)p(v,w,E);else y(v)})}return x}e.coerceAndCheckDataType=u;let l=new Set(["string","number","integer","boolean","null"]);function d(v,w){return w?v.filter((z)=>l.has(z)||w==="array"&&z==="array"):[]}function p(v,w,z){let{gen:R,data:b,opts:E}=v,x=R.let("dataType",o._`typeof ${b}`),q=R.let("coerced",o._`undefined`);if(E.coerceTypes==="array")R.if(o._`${x} == 'object' && Array.isArray(${b}) && ${b}.length == 1`,()=>R.assign(b,o._`${b}[0]`).assign(x,o._`typeof ${b}`).if(g(w,b,E.strictNumbers),()=>R.assign(q,b)));R.if(o._`${q} !== undefined`);for(let F of z)if(l.has(F)||F==="array"&&E.coerceTypes==="array")C(F);R.else(),y(v),R.endIf(),R.if(o._`${q} !== undefined`,()=>{R.assign(b,q),m(v,q)});function C(F){switch(F){case"string":R.elseIf(o._`${x} == "number" || ${x} == "boolean"`).assign(q,o._`"" + ${b}`).elseIf(o._`${b} === null`).assign(q,o._`""`);return;case"number":R.elseIf(o._`${x} == "boolean" || ${b} === null
55
+ || (${x} == "string" && ${b} && ${b} == +${b})`).assign(q,o._`+${b}`);return;case"integer":R.elseIf(o._`${x} === "boolean" || ${b} === null
56
+ || (${x} === "string" && ${b} && ${b} == +${b} && !(${b} % 1))`).assign(q,o._`+${b}`);return;case"boolean":R.elseIf(o._`${b} === "false" || ${b} === 0 || ${b} === null`).assign(q,!1).elseIf(o._`${b} === "true" || ${b} === 1`).assign(q,!0);return;case"null":R.elseIf(o._`${b} === "" || ${b} === 0 || ${b} === false`),R.assign(q,null);return;case"array":R.elseIf(o._`${x} === "string" || ${x} === "number"
57
+ || ${x} === "boolean" || ${b} === null`).assign(q,o._`[${b}]`)}}}function m({gen:v,parentData:w,parentDataProperty:z},R){v.if(o._`${w} !== undefined`,()=>v.assign(o._`${w}[${z}]`,R))}function h(v,w,z,R=i.Correct){let b=R===i.Correct?o.operators.EQ:o.operators.NEQ,E;switch(v){case"null":return o._`${w} ${b} null`;case"array":E=o._`Array.isArray(${w})`;break;case"object":E=o._`${w} && typeof ${w} == "object" && !Array.isArray(${w})`;break;case"integer":E=x(o._`!(${w} % 1) && !isNaN(${w})`);break;case"number":E=x();break;default:return o._`typeof ${w} ${b} ${v}`}return R===i.Correct?E:(0,o.not)(E);function x(q=o.nil){return(0,o.and)(o._`typeof ${w} == "number"`,q,z?o._`isFinite(${w})`:o.nil)}}e.checkDataType=h;function g(v,w,z,R){if(v.length===1)return h(v[0],w,z,R);let b,E=(0,s.toHash)(v);if(E.array&&E.object){let x=o._`typeof ${w} != "object"`;b=E.null?x:o._`!${w} || ${x}`,delete E.null,delete E.array,delete E.object}else b=o.nil;if(E.number)delete E.integer;for(let x in E)b=(0,o.and)(b,h(x,w,z,R));return b}e.checkDataTypes=g;let _={message:({schema:v})=>`must be ${v}`,params:({schema:v,schemaValue:w})=>typeof v=="string"?o._`{type: ${v}}`:o._`{type: ${w}}`};function y(v){let w=S(v);(0,n.reportError)(w,_)}e.reportTypeError=y;function S(v){let{gen:w,data:z,schema:R}=v,b=(0,s.schemaRefOrVal)(v,R,"type");return{gen:w,keyword:"type",data:z,schema:R.type,schemaCode:b,schemaValue:b,parentSchema:R,params:{},it:v}}}),_N=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.assignDefaults=void 0;let t=be(),r=Oe();function n(s,i){let{properties:a,items:c}=s.schema;if(i==="object"&&a)for(let u in a)o(s,u,a[u].default);else if(i==="array"&&Array.isArray(c))c.forEach((u,l)=>o(s,l,u.default))}e.assignDefaults=n;function o(s,i,a){let{gen:c,compositeRule:u,data:l,opts:d}=s;if(a===void 0)return;let p=t._`${l}${(0,t.getProperty)(i)}`;if(u){(0,r.checkStrictMode)(s,`default is ignored for: ${p}`);return}let m=t._`${p} === undefined`;if(d.useDefaults==="empty")m=t._`${m} || ${p} === null || ${p} === ""`;c.if(m,t._`${p} = ${(0,t.stringify)(a)}`)}}),gr=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateUnion=e.validateArray=e.usePattern=e.callValidateCode=e.schemaProperties=e.allSchemaProperties=e.noPropertyInData=e.propertyInData=e.isOwnProperty=e.hasPropFunc=e.reportMissingProp=e.checkMissingProp=e.checkReportMissingProp=void 0;let t=be(),r=Oe(),n=hr(),o=Oe();function s(v,w){let{gen:z,data:R,it:b}=v;z.if(d(z,R,w,b.opts.ownProperties),()=>{v.setParams({missingProperty:t._`${w}`},!0),v.error()})}e.checkReportMissingProp=s;function i({gen:v,data:w,it:{opts:z}},R,b){return(0,t.or)(...R.map((E)=>(0,t.and)(d(v,w,E,z.ownProperties),t._`${b} = ${E}`)))}e.checkMissingProp=i;function a(v,w){v.setParams({missingProperty:w},!0),v.error()}e.reportMissingProp=a;function c(v){return v.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:t._`Object.prototype.hasOwnProperty`})}e.hasPropFunc=c;function u(v,w,z){return t._`${c(v)}.call(${w}, ${z})`}e.isOwnProperty=u;function l(v,w,z,R){let b=t._`${w}${(0,t.getProperty)(z)} !== undefined`;return R?t._`${b} && ${u(v,w,z)}`:b}e.propertyInData=l;function d(v,w,z,R){let b=t._`${w}${(0,t.getProperty)(z)} === undefined`;return R?(0,t.or)(b,(0,t.not)(u(v,w,z))):b}e.noPropertyInData=d;function p(v){return v?Object.keys(v).filter((w)=>w!=="__proto__"):[]}e.allSchemaProperties=p;function m(v,w){return p(w).filter((z)=>!(0,r.alwaysValidSchema)(v,w[z]))}e.schemaProperties=m;function h({schemaCode:v,data:w,it:{gen:z,topSchemaRef:R,schemaPath:b,errorPath:E},it:x},q,C,F){let B=F?t._`${v}, ${w}, ${R}${b}`:w,Z=[[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,E)],[n.default.parentData,x.parentData],[n.default.parentDataProperty,x.parentDataProperty],[n.default.rootData,n.default.rootData]];if(x.opts.dynamicRef)Z.push([n.default.dynamicAnchors,n.default.dynamicAnchors]);let ge=t._`${B}, ${z.object(...Z)}`;return C!==t.nil?t._`${q}.call(${C}, ${ge})`:t._`${q}(${ge})`}e.callValidateCode=h;let g=t._`new RegExp`;function _({gen:v,it:{opts:w}},z){let R=w.unicodeRegExp?"u":"",{regExp:b}=w.code,E=b(z,R);return v.scopeValue("pattern",{key:E.toString(),ref:E,code:t._`${b.code==="new RegExp"?g:(0,o.useFunc)(v,b)}(${z}, ${R})`})}e.usePattern=_;function y(v){let{gen:w,data:z,keyword:R,it:b}=v,E=w.name("valid");if(b.allErrors){let q=w.let("valid",!0);return x(()=>w.assign(q,!1)),q}return w.var(E,!0),x(()=>w.break()),E;function x(q){let C=w.const("len",t._`${z}.length`);w.forRange("i",0,C,(F)=>{v.subschema({keyword:R,dataProp:F,dataPropType:r.Type.Num},E),w.if((0,t.not)(E),q)})}}e.validateArray=y;function S(v){let{gen:w,schema:z,keyword:R,it:b}=v;if(!Array.isArray(z))throw Error("ajv implementation error");if(z.some((q)=>(0,r.alwaysValidSchema)(b,q))&&!b.opts.unevaluated)return;let E=w.let("valid",!1),x=w.name("_valid");w.block(()=>z.forEach((q,C)=>{let F=v.subschema({keyword:R,schemaProp:C,compositeRule:!0},x);if(w.assign(E,t._`${E} || ${x}`),!v.mergeValidEvaluated(F,x))w.if((0,t.not)(E))})),v.result(E,()=>v.reset(),()=>v.error(!0))}e.validateUnion=S}),vN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateKeywordUsage=e.validSchemaType=e.funcKeywordCode=e.macroKeywordCode=void 0;let t=be(),r=hr(),n=gr(),o=Gl();function s(m,h){let{gen:g,keyword:_,schema:y,parentSchema:S,it:v}=m,w=h.macro.call(v.self,y,S,v),z=l(g,_,w);if(v.opts.validateSchema!==!1)v.self.validateSchema(w,!0);let R=g.name("valid");m.subschema({schema:w,schemaPath:t.nil,errSchemaPath:`${v.errSchemaPath}/${_}`,topSchemaRef:z,compositeRule:!0},R),m.pass(R,()=>m.error(!0))}e.macroKeywordCode=s;function i(m,h){var g;let{gen:_,keyword:y,schema:S,parentSchema:v,$data:w,it:z}=m;u(z,h);let R=l(_,y,!w&&h.compile?h.compile.call(z.self,S,v,z):h.validate),b=_.let("valid");m.block$data(b,E),m.ok((g=h.valid)!==null&&g!==void 0?g:b);function E(){if(h.errors===!1){if(C(),h.modifying)a(m);F(()=>m.error())}else{let B=h.async?x():q();if(h.modifying)a(m);F(()=>c(m,B))}}function x(){let B=_.let("ruleErrs",null);return _.try(()=>C(t._`await `),(Z)=>_.assign(b,!1).if(t._`${Z} instanceof ${z.ValidationError}`,()=>_.assign(B,t._`${Z}.errors`),()=>_.throw(Z))),B}function q(){let B=t._`${R}.errors`;return _.assign(B,null),C(t.nil),B}function C(B=h.async?t._`await `:t.nil){let Z=z.opts.passContext?r.default.this:r.default.self,ge=!(("compile"in h)&&!w||h.schema===!1);_.assign(b,t._`${B}${(0,n.callValidateCode)(m,R,Z,ge)}`,h.modifying)}function F(B){var Z;_.if((0,t.not)((Z=h.valid)!==null&&Z!==void 0?Z:b),B)}}e.funcKeywordCode=i;function a(m){let{gen:h,data:g,it:_}=m;h.if(_.parentData,()=>h.assign(g,t._`${_.parentData}[${_.parentDataProperty}]`))}function c(m,h){let{gen:g}=m;g.if(t._`Array.isArray(${h})`,()=>{g.assign(r.default.vErrors,t._`${r.default.vErrors} === null ? ${h} : ${r.default.vErrors}.concat(${h})`).assign(r.default.errors,t._`${r.default.vErrors}.length`),(0,o.extendErrors)(m)},()=>m.error())}function u({schemaEnv:m},h){if(h.async&&!m.$async)throw Error("async keyword in sync schema")}function l(m,h,g){if(g===void 0)throw Error(`keyword "${h}" failed to compile`);return m.scopeValue("keyword",typeof g=="function"?{ref:g}:{ref:g,code:(0,t.stringify)(g)})}function d(m,h,g=!1){return!h.length||h.some((_)=>_==="array"?Array.isArray(m):_==="object"?m&&typeof m=="object"&&!Array.isArray(m):typeof m==_||g&&typeof m>"u")}e.validSchemaType=d;function p({schema:m,opts:h,self:g,errSchemaPath:_},y,S){if(Array.isArray(y.keyword)?!y.keyword.includes(S):y.keyword!==S)throw Error("ajv implementation error");let v=y.dependencies;if(v===null||v===void 0?void 0:v.some((w)=>!Object.prototype.hasOwnProperty.call(m,w)))throw Error(`parent schema must have dependencies of ${S}: ${v.join(",")}`);if(y.validateSchema){if(!y.validateSchema(m[S])){let w=`keyword "${S}" value is invalid at path "${_}": `+g.errorsText(y.validateSchema.errors);if(h.validateSchema==="log")g.logger.error(w);else throw Error(w)}}}e.validateKeywordUsage=p}),SN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendSubschemaMode=e.extendSubschemaData=e.getSubschema=void 0;let t=be(),r=Oe();function n(i,{keyword:a,schemaProp:c,schema:u,schemaPath:l,errSchemaPath:d,topSchemaRef:p}){if(a!==void 0&&u!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(a!==void 0){let m=i.schema[a];return c===void 0?{schema:m,schemaPath:t._`${i.schemaPath}${(0,t.getProperty)(a)}`,errSchemaPath:`${i.errSchemaPath}/${a}`}:{schema:m[c],schemaPath:t._`${i.schemaPath}${(0,t.getProperty)(a)}${(0,t.getProperty)(c)}`,errSchemaPath:`${i.errSchemaPath}/${a}/${(0,r.escapeFragment)(c)}`}}if(u!==void 0){if(l===void 0||d===void 0||p===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:u,schemaPath:l,topSchemaRef:p,errSchemaPath:d}}throw Error('either "keyword" or "schema" must be passed')}e.getSubschema=n;function o(i,a,{dataProp:c,dataPropType:u,data:l,dataTypes:d,propertyName:p}){if(l!==void 0&&c!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:m}=a;if(c!==void 0){let{errorPath:g,dataPathArr:_,opts:y}=a;h(m.let("data",t._`${a.data}${(0,t.getProperty)(c)}`,!0)),i.errorPath=t.str`${g}${(0,r.getErrorPath)(c,u,y.jsPropertySyntax)}`,i.parentDataProperty=t._`${c}`,i.dataPathArr=[..._,i.parentDataProperty]}if(l!==void 0){if(h(l instanceof t.Name?l:m.let("data",l,!0)),p!==void 0)i.propertyName=p}if(d)i.dataTypes=d;function h(g){i.data=g,i.dataLevel=a.dataLevel+1,i.dataTypes=[],a.definedProperties=new Set,i.parentData=a.data,i.dataNames=[...a.dataNames,g]}}e.extendSubschemaData=o;function s(i,{jtdDiscriminator:a,jtdMetadata:c,compositeRule:u,createErrors:l,allErrors:d}){if(u!==void 0)i.compositeRule=u;if(l!==void 0)i.createErrors=l;if(d!==void 0)i.allErrors=d;i.jtdDiscriminator=a,i.jtdMetadata=c}e.extendSubschemaMode=s}),Sb=J((e,t)=>{t.exports=function r(n,o){if(n===o)return!0;if(n&&o&&typeof n=="object"&&typeof o=="object"){if(n.constructor!==o.constructor)return!1;var s,i,a;if(Array.isArray(n)){if(s=n.length,s!=o.length)return!1;for(i=s;i--!==0;)if(!r(n[i],o[i]))return!1;return!0}if(n.constructor===RegExp)return n.source===o.source&&n.flags===o.flags;if(n.valueOf!==Object.prototype.valueOf)return n.valueOf()===o.valueOf();if(n.toString!==Object.prototype.toString)return n.toString()===o.toString();if(a=Object.keys(n),s=a.length,s!==Object.keys(o).length)return!1;for(i=s;i--!==0;)if(!Object.prototype.hasOwnProperty.call(o,a[i]))return!1;for(i=s;i--!==0;){var c=a[i];if(!r(n[c],o[c]))return!1}return!0}return n!==n&&o!==o}}),bN=J((e,t)=>{var r=t.exports=function(s,i,a){if(typeof i=="function")a=i,i={};a=i.cb||a;var c=typeof a=="function"?a:a.pre||function(){},u=a.post||function(){};n(i,c,u,s,"",s)};r.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},r.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},r.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},r.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 n(s,i,a,c,u,l,d,p,m,h){if(c&&typeof c=="object"&&!Array.isArray(c)){i(c,u,l,d,p,m,h);for(var g in c){var _=c[g];if(Array.isArray(_)){if(g in r.arrayKeywords)for(var y=0;y<_.length;y++)n(s,i,a,_[y],u+"/"+g+"/"+y,l,u,g,c,y)}else if(g in r.propsKeywords){if(_&&typeof _=="object")for(var S in _)n(s,i,a,_[S],u+"/"+g+"/"+o(S),l,u,g,c,S)}else if(g in r.keywords||s.allKeys&&!(g in r.skipKeywords))n(s,i,a,_,u+"/"+g,l,u,g,c)}a(c,u,l,d,p,m,h)}}function o(s){return s.replace(/~/g,"~0").replace(/\//g,"~1")}}),Jl=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getSchemaRefs=e.resolveUrl=e.normalizeId=e._getFullPath=e.getFullPath=e.inlineRef=void 0;let t=Oe(),r=Sb(),n=bN(),o=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function s(_,y=!0){if(typeof _=="boolean")return!0;if(y===!0)return!a(_);if(!y)return!1;return c(_)<=y}e.inlineRef=s;let i=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function a(_){for(let y in _){if(i.has(y))return!0;let S=_[y];if(Array.isArray(S)&&S.some(a))return!0;if(typeof S=="object"&&a(S))return!0}return!1}function c(_){let y=0;for(let S in _){if(S==="$ref")return 1/0;if(y++,o.has(S))continue;if(typeof _[S]=="object")(0,t.eachItem)(_[S],(v)=>y+=c(v));if(y===1/0)return 1/0}return y}function u(_,y="",S){if(S!==!1)y=p(y);return l(_,_.parse(y))}e.getFullPath=u;function l(_,y){return _.serialize(y).split("#")[0]+"#"}e._getFullPath=l;let d=/#\/?$/;function p(_){return _?_.replace(d,""):""}e.normalizeId=p;function m(_,y,S){return S=p(S),_.resolve(y,S)}e.resolveUrl=m;let h=/^[a-z_][-a-z0-9._]*$/i;function g(_,y){if(typeof _=="boolean")return{};let{schemaId:S,uriResolver:v}=this.opts,w=p(_[S]||y),z={"":w},R=u(v,w,!1),b={},E=new Set;return n(_,{allKeys:!0},(C,F,B,Z)=>{if(Z===void 0)return;let ge=R+F,Ie=z[Z];if(typeof C[S]=="string")Ie=Ae.call(this,C[S]);Ue.call(this,C.$anchor),Ue.call(this,C.$dynamicAnchor),z[F]=Ie;function Ae(Pe){let O=this.opts.uriResolver.resolve;if(Pe=p(Ie?O(Ie,Pe):Pe),E.has(Pe))throw q(Pe);E.add(Pe);let M=this.refs[Pe];if(typeof M=="string")M=this.refs[M];if(typeof M=="object")x(C,M.schema,Pe);else if(Pe!==p(ge))if(Pe[0]==="#")x(C,b[Pe],Pe),b[Pe]=C;else this.refs[Pe]=ge;return Pe}function Ue(Pe){if(typeof Pe=="string"){if(!h.test(Pe))throw Error(`invalid anchor "${Pe}"`);Ae.call(this,`#${Pe}`)}}}),b;function x(C,F,B){if(F!==void 0&&!r(C,F))throw q(B)}function q(C){return Error(`reference "${C}" resolves to more than one schema`)}}e.getSchemaRefs=g}),ds=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getData=e.KeywordCxt=e.validateFunctionCode=void 0;let t=yN(),r=Zl(),n=vb(),o=Zl(),s=_N(),i=vN(),a=SN(),c=be(),u=hr(),l=Jl(),d=Oe(),p=Gl();function m(I){if(R(I)){if(E(I),z(I)){y(I);return}}h(I,()=>(0,t.topBoolOrEmptySchema)(I))}e.validateFunctionCode=m;function h({gen:I,validateName:L,schema:H,schemaEnv:fe,opts:me},we){if(me.code.es5)I.func(L,c._`${u.default.data}, ${u.default.valCxt}`,fe.$async,()=>{I.code(c._`"use strict"; ${v(H,me)}`),_(I,me),I.code(we)});else I.func(L,c._`${u.default.data}, ${g(me)}`,fe.$async,()=>I.code(v(H,me)).code(we))}function g(I){return c._`{${u.default.instancePath}="", ${u.default.parentData}, ${u.default.parentDataProperty}, ${u.default.rootData}=${u.default.data}${I.dynamicRef?c._`, ${u.default.dynamicAnchors}={}`:c.nil}}={}`}function _(I,L){I.if(u.default.valCxt,()=>{if(I.var(u.default.instancePath,c._`${u.default.valCxt}.${u.default.instancePath}`),I.var(u.default.parentData,c._`${u.default.valCxt}.${u.default.parentData}`),I.var(u.default.parentDataProperty,c._`${u.default.valCxt}.${u.default.parentDataProperty}`),I.var(u.default.rootData,c._`${u.default.valCxt}.${u.default.rootData}`),L.dynamicRef)I.var(u.default.dynamicAnchors,c._`${u.default.valCxt}.${u.default.dynamicAnchors}`)},()=>{if(I.var(u.default.instancePath,c._`""`),I.var(u.default.parentData,c._`undefined`),I.var(u.default.parentDataProperty,c._`undefined`),I.var(u.default.rootData,u.default.data),L.dynamicRef)I.var(u.default.dynamicAnchors,c._`{}`)})}function y(I){let{schema:L,opts:H,gen:fe}=I;h(I,()=>{if(H.$comment&&L.$comment)Z(I);if(C(I),fe.let(u.default.vErrors,null),fe.let(u.default.errors,0),H.unevaluated)S(I);x(I),ge(I)})}function S(I){let{gen:L,validateName:H}=I;I.evaluated=L.const("evaluated",c._`${H}.evaluated`),L.if(c._`${I.evaluated}.dynamicProps`,()=>L.assign(c._`${I.evaluated}.props`,c._`undefined`)),L.if(c._`${I.evaluated}.dynamicItems`,()=>L.assign(c._`${I.evaluated}.items`,c._`undefined`))}function v(I,L){let H=typeof I=="object"&&I[L.schemaId];return H&&(L.code.source||L.code.process)?c._`/*# sourceURL=${H} */`:c.nil}function w(I,L){if(R(I)){if(E(I),z(I)){b(I,L);return}}(0,t.boolOrEmptySchema)(I,L)}function z({schema:I,self:L}){if(typeof I=="boolean")return!I;for(let H in I)if(L.RULES.all[H])return!0;return!1}function R(I){return typeof I.schema!="boolean"}function b(I,L){let{schema:H,gen:fe,opts:me}=I;if(me.$comment&&H.$comment)Z(I);F(I),B(I);let we=fe.const("_errs",u.default.errors);x(I,we),fe.var(L,c._`${we} === ${u.default.errors}`)}function E(I){(0,d.checkUnknownRules)(I),q(I)}function x(I,L){if(I.opts.jtd)return Ae(I,[],!1,L);let H=(0,r.getSchemaTypes)(I.schema);Ae(I,H,!(0,r.coerceAndCheckDataType)(I,H),L)}function q(I){let{schema:L,errSchemaPath:H,opts:fe,self:me}=I;if(L.$ref&&fe.ignoreKeywordsWithRef&&(0,d.schemaHasRulesButRef)(L,me.RULES))me.logger.warn(`$ref: keywords ignored in schema at path "${H}"`)}function C(I){let{schema:L,opts:H}=I;if(L.default!==void 0&&H.useDefaults&&H.strictSchema)(0,d.checkStrictMode)(I,"default is ignored in the schema root")}function F(I){let L=I.schema[I.opts.schemaId];if(L)I.baseId=(0,l.resolveUrl)(I.opts.uriResolver,I.baseId,L)}function B(I){if(I.schema.$async&&!I.schemaEnv.$async)throw Error("async schema in sync schema")}function Z({gen:I,schemaEnv:L,schema:H,errSchemaPath:fe,opts:me}){let we=H.$comment;if(me.$comment===!0)I.code(c._`${u.default.self}.logger.log(${we})`);else if(typeof me.$comment=="function"){let ct=c.str`${fe}/$comment`,ft=I.scopeValue("root",{ref:L.root});I.code(c._`${u.default.self}.opts.$comment(${we}, ${ct}, ${ft}.schema)`)}}function ge(I){let{gen:L,schemaEnv:H,validateName:fe,ValidationError:me,opts:we}=I;if(H.$async)L.if(c._`${u.default.errors} === 0`,()=>L.return(u.default.data),()=>L.throw(c._`new ${me}(${u.default.vErrors})`));else{if(L.assign(c._`${fe}.errors`,u.default.vErrors),we.unevaluated)Ie(I);L.return(c._`${u.default.errors} === 0`)}}function Ie({gen:I,evaluated:L,props:H,items:fe}){if(H instanceof c.Name)I.assign(c._`${L}.props`,H);if(fe instanceof c.Name)I.assign(c._`${L}.items`,fe)}function Ae(I,L,H,fe){let{gen:me,schema:we,data:ct,allErrors:ft,opts:Et,self:lt}=I,{RULES:We}=lt;if(we.$ref&&(Et.ignoreKeywordsWithRef||!(0,d.schemaHasRulesButRef)(we,We))){me.block(()=>Ee(I,"$ref",We.all.$ref.definition));return}if(!Et.jtd)Pe(I,L);me.block(()=>{for(let gt of We.rules)er(gt);er(We.post)});function er(gt){if(!(0,n.shouldUseGroup)(we,gt))return;if(gt.type){if(me.if((0,o.checkDataType)(gt.type,ct,Et.strictNumbers)),Ue(I,gt),L.length===1&&L[0]===gt.type&&H)me.else(),(0,o.reportTypeError)(I);me.endIf()}else Ue(I,gt);if(!ft)me.if(c._`${u.default.errors} === ${fe||0}`)}}function Ue(I,L){let{gen:H,schema:fe,opts:{useDefaults:me}}=I;if(me)(0,s.assignDefaults)(I,L.type);H.block(()=>{for(let we of L.rules)if((0,n.shouldUseRule)(fe,we))Ee(I,we.keyword,we.definition,L.type)})}function Pe(I,L){if(I.schemaEnv.meta||!I.opts.strictTypes)return;if(O(I,L),!I.opts.allowUnionTypes)M(I,L);K(I,I.dataTypes)}function O(I,L){if(!L.length)return;if(!I.dataTypes.length){I.dataTypes=L;return}L.forEach((H)=>{if(!k(I.dataTypes,H))W(I,`type "${H}" not allowed by context "${I.dataTypes.join(",")}"`)}),j(I,L)}function M(I,L){if(L.length>1&&!(L.length===2&&L.includes("null")))W(I,"use allowUnionTypes to allow union type keyword")}function K(I,L){let H=I.self.RULES.all;for(let fe in H){let me=H[fe];if(typeof me=="object"&&(0,n.shouldUseRule)(I.schema,me)){let{type:we}=me.definition;if(we.length&&!we.some((ct)=>P(L,ct)))W(I,`missing type "${we.join(",")}" for keyword "${fe}"`)}}}function P(I,L){return I.includes(L)||L==="number"&&I.includes("integer")}function k(I,L){return I.includes(L)||L==="integer"&&I.includes("number")}function j(I,L){let H=[];for(let fe of I.dataTypes)if(k(L,fe))H.push(fe);else if(L.includes("integer")&&fe==="number")H.push("integer");I.dataTypes=H}function W(I,L){let H=I.schemaEnv.baseId+I.errSchemaPath;L+=` at "${H}" (strictTypes)`,(0,d.checkStrictMode)(I,L,I.opts.strictTypes)}var ue=class{constructor(I,L,H){if((0,i.validateKeywordUsage)(I,L,H),this.gen=I.gen,this.allErrors=I.allErrors,this.keyword=H,this.data=I.data,this.schema=I.schema[H],this.$data=L.$data&&I.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,d.schemaRefOrVal)(I,this.schema,H,this.$data),this.schemaType=L.schemaType,this.parentSchema=I.schema,this.params={},this.it=I,this.def=L,this.$data)this.schemaCode=I.gen.const("vSchema",At(this.$data,I));else if(this.schemaCode=this.schemaValue,!(0,i.validSchemaType)(this.schema,L.schemaType,L.allowUndefined))throw Error(`${H} value must be ${JSON.stringify(L.schemaType)}`);if("code"in L?L.trackErrors:L.errors!==!1)this.errsCount=I.gen.const("_errs",u.default.errors)}result(I,L,H){this.failResult((0,c.not)(I),L,H)}failResult(I,L,H){if(this.gen.if(I),H)H();else this.error();if(L){if(this.gen.else(),L(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(I,L){this.failResult((0,c.not)(I),void 0,L)}fail(I){if(I===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if(I),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(I){if(!this.$data)return this.fail(I);let{schemaCode:L}=this;this.fail(c._`${L} !== undefined && (${(0,c.or)(this.invalid$data(),I)})`)}error(I,L,H){if(L){this.setParams(L),this._error(I,H),this.setParams({});return}this._error(I,H)}_error(I,L){(I?p.reportExtraError:p.reportError)(this,this.def.error,L)}$dataError(){(0,p.reportError)(this,this.def.$dataError||p.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,p.resetErrorsCount)(this.gen,this.errsCount)}ok(I){if(!this.allErrors)this.gen.if(I)}setParams(I,L){if(L)Object.assign(this.params,I);else this.params=I}block$data(I,L,H=c.nil){this.gen.block(()=>{this.check$data(I,H),L()})}check$data(I=c.nil,L=c.nil){if(!this.$data)return;let{gen:H,schemaCode:fe,schemaType:me,def:we}=this;if(H.if((0,c.or)(c._`${fe} === undefined`,L)),I!==c.nil)H.assign(I,!0);if(me.length||we.validateSchema){if(H.elseIf(this.invalid$data()),this.$dataError(),I!==c.nil)H.assign(I,!1)}H.else()}invalid$data(){let{gen:I,schemaCode:L,schemaType:H,def:fe,it:me}=this;return(0,c.or)(we(),ct());function we(){if(H.length){if(!(L instanceof c.Name))throw Error("ajv implementation error");let ft=Array.isArray(H)?H:[H];return c._`${(0,o.checkDataTypes)(ft,L,me.opts.strictNumbers,o.DataType.Wrong)}`}return c.nil}function ct(){if(fe.validateSchema){let ft=I.scopeValue("validate$data",{ref:fe.validateSchema});return c._`!${ft}(${L})`}return c.nil}}subschema(I,L){let H=(0,a.getSubschema)(this.it,I);(0,a.extendSubschemaData)(H,this.it,I),(0,a.extendSubschemaMode)(H,I);let fe={...this.it,...H,items:void 0,props:void 0};return w(fe,L),fe}mergeEvaluated(I,L){let{it:H,gen:fe}=this;if(!H.opts.unevaluated)return;if(H.props!==!0&&I.props!==void 0)H.props=d.mergeEvaluated.props(fe,I.props,H.props,L);if(H.items!==!0&&I.items!==void 0)H.items=d.mergeEvaluated.items(fe,I.items,H.items,L)}mergeValidEvaluated(I,L){let{it:H,gen:fe}=this;if(H.opts.unevaluated&&(H.props!==!0||H.items!==!0))return fe.if(L,()=>this.mergeEvaluated(I,c.Name)),!0}};e.KeywordCxt=ue;function Ee(I,L,H,fe){let me=new ue(I,H,L);if("code"in H)H.code(me,fe);else if(me.$data&&H.validate)(0,i.funcKeywordCode)(me,H);else if("macro"in H)(0,i.macroKeywordCode)(me,H);else if(H.compile||H.validate)(0,i.funcKeywordCode)(me,H)}let ye=/^\/(?:[^~]|~0|~1)*$/,He=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function At(I,{dataLevel:L,dataNames:H,dataPathArr:fe}){let me,we;if(I==="")return u.default.rootData;if(I[0]==="/"){if(!ye.test(I))throw Error(`Invalid JSON-pointer: ${I}`);me=I,we=u.default.rootData}else{let lt=He.exec(I);if(!lt)throw Error(`Invalid JSON-pointer: ${I}`);let We=+lt[1];if(me=lt[2],me==="#"){if(We>=L)throw Error(Et("property/index",We));return fe[L-We]}if(We>L)throw Error(Et("data",We));if(we=H[L-We],!me)return we}let ct=we,ft=me.split("/");for(let lt of ft)if(lt)we=c._`${we}${(0,c.getProperty)((0,d.unescapeJsonPointer)(lt))}`,ct=c._`${ct} && ${we}`;return ct;function Et(lt,We){return`Cannot access ${lt} ${We} levels up, current level is ${L}`}}e.getData=At}),ma=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});var t=class extends Error{constructor(r){super("validation failed");this.errors=r,this.ajv=this.validation=!0}};e.default=t}),ps=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Jl();var r=class extends Error{constructor(n,o,s,i){super(i||`can't resolve reference ${s} from id ${o}`);this.missingRef=(0,t.resolveUrl)(n,o,s),this.missingSchema=(0,t.normalizeId)((0,t.getFullPath)(n,this.missingRef))}};e.default=r}),Kl=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.resolveSchema=e.getCompilingSchema=e.resolveRef=e.compileSchema=e.SchemaEnv=void 0;let t=be(),r=ma(),n=hr(),o=Jl(),s=Oe(),i=ds();var a=class{constructor(y){var S;this.refs={},this.dynamicAnchors={};let v;if(typeof y.schema=="object")v=y.schema;this.schema=y.schema,this.schemaId=y.schemaId,this.root=y.root||this,this.baseId=(S=y.baseId)!==null&&S!==void 0?S:(0,o.normalizeId)(v===null||v===void 0?void 0:v[y.schemaId||"$id"]),this.schemaPath=y.schemaPath,this.localRefs=y.localRefs,this.meta=y.meta,this.$async=v===null||v===void 0?void 0:v.$async,this.refs={}}};e.SchemaEnv=a;function c(y){let S=d.call(this,y);if(S)return S;let v=(0,o.getFullPath)(this.opts.uriResolver,y.root.baseId),{es5:w,lines:z}=this.opts.code,{ownProperties:R}=this.opts,b=new t.CodeGen(this.scope,{es5:w,lines:z,ownProperties:R}),E;if(y.$async)E=b.scopeValue("Error",{ref:r.default,code:t._`require("ajv/dist/runtime/validation_error").default`});let x=b.scopeName("validate");y.validateName=x;let q={gen:b,allErrors:this.opts.allErrors,data:n.default.data,parentData:n.default.parentData,parentDataProperty:n.default.parentDataProperty,dataNames:[n.default.data],dataPathArr:[t.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:b.scopeValue("schema",this.opts.code.source===!0?{ref:y.schema,code:(0,t.stringify)(y.schema)}:{ref:y.schema}),validateName:x,ValidationError:E,schema:y.schema,schemaEnv:y,rootId:v,baseId:y.baseId||v,schemaPath:t.nil,errSchemaPath:y.schemaPath||(this.opts.jtd?"":"#"),errorPath:t._`""`,opts:this.opts,self:this},C;try{this._compilations.add(y),(0,i.validateFunctionCode)(q),b.optimize(this.opts.code.optimize);let F=b.toString();if(C=`${b.scopeRefs(n.default.scope)}return ${F}`,this.opts.code.process)C=this.opts.code.process(C,y);let B=Function(`${n.default.self}`,`${n.default.scope}`,C)(this,this.scope.get());if(this.scope.value(x,{ref:B}),B.errors=null,B.schema=y.schema,B.schemaEnv=y,y.$async)B.$async=!0;if(this.opts.code.source===!0)B.source={validateName:x,validateCode:F,scopeValues:b._values};if(this.opts.unevaluated){let{props:Z,items:ge}=q;if(B.evaluated={props:Z instanceof t.Name?void 0:Z,items:ge instanceof t.Name?void 0:ge,dynamicProps:Z instanceof t.Name,dynamicItems:ge instanceof t.Name},B.source)B.source.evaluated=(0,t.stringify)(B.evaluated)}return y.validate=B,y}catch(F){if(delete y.validate,delete y.validateName,C)this.logger.error("Error compiling schema, function code:",C);throw F}finally{this._compilations.delete(y)}}e.compileSchema=c;function u(y,S,v){var w;v=(0,o.resolveUrl)(this.opts.uriResolver,S,v);let z=y.refs[v];if(z)return z;let R=m.call(this,y,v);if(R===void 0){let b=(w=y.localRefs)===null||w===void 0?void 0:w[v],{schemaId:E}=this.opts;if(b)R=new a({schema:b,schemaId:E,root:y,baseId:S})}if(R===void 0)return;return y.refs[v]=l.call(this,R)}e.resolveRef=u;function l(y){if((0,o.inlineRef)(y.schema,this.opts.inlineRefs))return y.schema;return y.validate?y:c.call(this,y)}function d(y){for(let S of this._compilations)if(p(S,y))return S}e.getCompilingSchema=d;function p(y,S){return y.schema===S.schema&&y.root===S.root&&y.baseId===S.baseId}function m(y,S){let v;while(typeof(v=this.refs[S])=="string")S=v;return v||this.schemas[S]||h.call(this,y,S)}function h(y,S){let v=this.opts.uriResolver.parse(S),w=(0,o._getFullPath)(this.opts.uriResolver,v),z=(0,o.getFullPath)(this.opts.uriResolver,y.baseId,void 0);if(Object.keys(y.schema).length>0&&w===z)return _.call(this,v,y);let R=(0,o.normalizeId)(w),b=this.refs[R]||this.schemas[R];if(typeof b=="string"){let E=h.call(this,y,b);if(typeof(E===null||E===void 0?void 0:E.schema)!=="object")return;return _.call(this,v,E)}if(typeof(b===null||b===void 0?void 0:b.schema)!=="object")return;if(!b.validate)c.call(this,b);if(R===(0,o.normalizeId)(S)){let{schema:E}=b,{schemaId:x}=this.opts,q=E[x];if(q)z=(0,o.resolveUrl)(this.opts.uriResolver,z,q);return new a({schema:E,schemaId:x,root:y,baseId:z})}return _.call(this,v,b)}e.resolveSchema=h;let g=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function _(y,{baseId:S,schema:v,root:w}){var z;if(((z=y.fragment)===null||z===void 0?void 0:z[0])!=="/")return;for(let E of y.fragment.slice(1).split("/")){if(typeof v==="boolean")return;let x=v[(0,s.unescapeFragment)(E)];if(x===void 0)return;v=x;let q=typeof v==="object"&&v[this.opts.schemaId];if(!g.has(E)&&q)S=(0,o.resolveUrl)(this.opts.uriResolver,S,q)}let R;if(typeof v!="boolean"&&v.$ref&&!(0,s.schemaHasRulesButRef)(v,this.RULES)){let E=(0,o.resolveUrl)(this.opts.uriResolver,S,v.$ref);R=h.call(this,w,E)}let{schemaId:b}=this.opts;if(R=R||new a({schema:v,schemaId:b,root:w,baseId:S}),R.schema!==R.root.schema)return R}}),$N=J((e,t)=>{t.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}}),bb=J((e,t)=>{let r=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),n=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function o(h){let g="",_=0,y=0;for(y=0;y<h.length;y++){if(_=h[y].charCodeAt(0),_===48)continue;if(!(_>=48&&_<=57||_>=65&&_<=70||_>=97&&_<=102))return"";g+=h[y];break}for(y+=1;y<h.length;y++){if(_=h[y].charCodeAt(0),!(_>=48&&_<=57||_>=65&&_<=70||_>=97&&_<=102))return"";g+=h[y]}return g}let s=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function i(h){return h.length=0,!0}function a(h,g,_){if(h.length){let y=o(h);if(y!=="")g.push(y);else return _.error=!0,!1;h.length=0}return!0}function c(h){let g=0,_={error:!1,address:"",zone:""},y=[],S=[],v=!1,w=!1,z=a;for(let R=0;R<h.length;R++){let b=h[R];if(b==="["||b==="]")continue;if(b===":"){if(v===!0)w=!0;if(!z(S,y,_))break;if(++g>7){_.error=!0;break}if(R>0&&h[R-1]===":")v=!0;y.push(":");continue}else if(b==="%"){if(!z(S,y,_))break;z=i}else{S.push(b);continue}}if(S.length)if(z===i)_.zone=S.join("");else if(w)y.push(S.join(""));else y.push(o(S));return _.address=y.join(""),_}function u(h){if(l(h,":")<2)return{host:h,isIPV6:!1};let g=c(h);if(!g.error){let{address:_,address:y}=g;if(g.zone)_+="%"+g.zone,y+="%25"+g.zone;return{host:_,isIPV6:!0,escapedHost:y}}else return{host:h,isIPV6:!1}}function l(h,g){let _=0;for(let y=0;y<h.length;y++)if(h[y]===g)_++;return _}function d(h){let g=h,_=[],y=-1,S=0;while(S=g.length){if(S===1)if(g===".")break;else if(g==="/"){_.push("/");break}else{_.push(g);break}else if(S===2){if(g[0]==="."){if(g[1]===".")break;else if(g[1]==="/"){g=g.slice(2);continue}}else if(g[0]==="/"){if(g[1]==="."||g[1]==="/"){_.push("/");break}}}else if(S===3){if(g==="/.."){if(_.length!==0)_.pop();_.push("/");break}}if(g[0]==="."){if(g[1]==="."){if(g[2]==="/"){g=g.slice(3);continue}}else if(g[1]==="/"){g=g.slice(2);continue}}else if(g[0]==="/"){if(g[1]==="."){if(g[2]==="/"){g=g.slice(2);continue}else if(g[2]==="."){if(g[3]==="/"){if(g=g.slice(3),_.length!==0)_.pop();continue}}}}if((y=g.indexOf("/",1))===-1){_.push(g);break}else _.push(g.slice(0,y)),g=g.slice(y)}return _.join("")}function p(h,g){let _=g!==!0?escape:unescape;if(h.scheme!==void 0)h.scheme=_(h.scheme);if(h.userinfo!==void 0)h.userinfo=_(h.userinfo);if(h.host!==void 0)h.host=_(h.host);if(h.path!==void 0)h.path=_(h.path);if(h.query!==void 0)h.query=_(h.query);if(h.fragment!==void 0)h.fragment=_(h.fragment);return h}function m(h){let g=[];if(h.userinfo!==void 0)g.push(h.userinfo),g.push("@");if(h.host!==void 0){let _=unescape(h.host);if(!n(_)){let y=u(_);if(y.isIPV6===!0)_=`[${y.escapedHost}]`;else _=h.host}g.push(_)}if(typeof h.port==="number"||typeof h.port==="string")g.push(":"),g.push(String(h.port));return g.length?g.join(""):void 0}t.exports={nonSimpleDomain:s,recomposeAuthority:m,normalizeComponentEncoding:p,removeDotSegments:d,isIPv4:n,isUUID:r,normalizeIPv6:u,stringArrayToHexStripped:o}}),wN=J((e,t)=>{let{isUUID:r}=bb(),n=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,o=["http","https","ws","wss","urn","urn:uuid"];function s(b){return o.indexOf(b)!==-1}function i(b){if(b.secure===!0)return!0;else if(b.secure===!1)return!1;else if(b.scheme)return b.scheme.length===3&&(b.scheme[0]==="w"||b.scheme[0]==="W")&&(b.scheme[1]==="s"||b.scheme[1]==="S")&&(b.scheme[2]==="s"||b.scheme[2]==="S");else return!1}function a(b){if(!b.host)b.error=b.error||"HTTP URIs must have a host.";return b}function c(b){let E=String(b.scheme).toLowerCase()==="https";if(b.port===(E?443:80)||b.port==="")b.port=void 0;if(!b.path)b.path="/";return b}function u(b){return b.secure=i(b),b.resourceName=(b.path||"/")+(b.query?"?"+b.query:""),b.path=void 0,b.query=void 0,b}function l(b){if(b.port===(i(b)?443:80)||b.port==="")b.port=void 0;if(typeof b.secure==="boolean")b.scheme=b.secure?"wss":"ws",b.secure=void 0;if(b.resourceName){let[E,x]=b.resourceName.split("?");b.path=E&&E!=="/"?E:void 0,b.query=x,b.resourceName=void 0}return b.fragment=void 0,b}function d(b,E){if(!b.path)return b.error="URN can not be parsed",b;let x=b.path.match(n);if(x){let q=E.scheme||b.scheme||"urn";b.nid=x[1].toLowerCase(),b.nss=x[2];let C=R(`${q}:${E.nid||b.nid}`);if(b.path=void 0,C)b=C.parse(b,E)}else b.error=b.error||"URN can not be parsed.";return b}function p(b,E){if(b.nid===void 0)throw Error("URN without nid cannot be serialized");let x=E.scheme||b.scheme||"urn",q=b.nid.toLowerCase(),C=R(`${x}:${E.nid||q}`);if(C)b=C.serialize(b,E);let F=b,B=b.nss;return F.path=`${q||E.nid}:${B}`,E.skipEscape=!0,F}function m(b,E){let x=b;if(x.uuid=x.nss,x.nss=void 0,!E.tolerant&&(!x.uuid||!r(x.uuid)))x.error=x.error||"UUID is not valid.";return x}function h(b){let E=b;return E.nss=(b.uuid||"").toLowerCase(),E}let g={scheme:"http",domainHost:!0,parse:a,serialize:c},_={scheme:"https",domainHost:g.domainHost,parse:a,serialize:c},y={scheme:"ws",domainHost:!0,parse:u,serialize:l},S={scheme:"wss",domainHost:y.domainHost,parse:y.parse,serialize:y.serialize},z={http:g,https:_,ws:y,wss:S,urn:{scheme:"urn",parse:d,serialize:p,skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:m,serialize:h,skipNormalize:!0}};Object.setPrototypeOf(z,null);function R(b){return b&&(z[b]||z[b.toLowerCase()])||void 0}t.exports={wsIsSecure:i,SCHEMES:z,isValidSchemeName:s,getSchemeHandler:R}}),RN=J((e,t)=>{let{normalizeIPv6:r,removeDotSegments:n,recomposeAuthority:o,normalizeComponentEncoding:s,isIPv4:i,nonSimpleDomain:a}=bb(),{SCHEMES:c,getSchemeHandler:u}=wN();function l(S,v){if(typeof S==="string")S=h(_(S,v),v);else if(typeof S==="object")S=_(h(S,v),v);return S}function d(S,v,w){let z=w?Object.assign({scheme:"null"},w):{scheme:"null"},R=p(_(S,z),_(v,z),z,!0);return z.skipEscape=!0,h(R,z)}function p(S,v,w,z){let R={};if(!z)S=_(h(S,w),w),v=_(h(v,w),w);if(w=w||{},!w.tolerant&&v.scheme)R.scheme=v.scheme,R.userinfo=v.userinfo,R.host=v.host,R.port=v.port,R.path=n(v.path||""),R.query=v.query;else{if(v.userinfo!==void 0||v.host!==void 0||v.port!==void 0)R.userinfo=v.userinfo,R.host=v.host,R.port=v.port,R.path=n(v.path||""),R.query=v.query;else{if(!v.path)if(R.path=S.path,v.query!==void 0)R.query=v.query;else R.query=S.query;else{if(v.path[0]==="/")R.path=n(v.path);else{if((S.userinfo!==void 0||S.host!==void 0||S.port!==void 0)&&!S.path)R.path="/"+v.path;else if(!S.path)R.path=v.path;else R.path=S.path.slice(0,S.path.lastIndexOf("/")+1)+v.path;R.path=n(R.path)}R.query=v.query}R.userinfo=S.userinfo,R.host=S.host,R.port=S.port}R.scheme=S.scheme}return R.fragment=v.fragment,R}function m(S,v,w){if(typeof S==="string")S=unescape(S),S=h(s(_(S,w),!0),{...w,skipEscape:!0});else if(typeof S==="object")S=h(s(S,!0),{...w,skipEscape:!0});if(typeof v==="string")v=unescape(v),v=h(s(_(v,w),!0),{...w,skipEscape:!0});else if(typeof v==="object")v=h(s(v,!0),{...w,skipEscape:!0});return S.toLowerCase()===v.toLowerCase()}function h(S,v){let w={host:S.host,scheme:S.scheme,userinfo:S.userinfo,port:S.port,path:S.path,query:S.query,nid:S.nid,nss:S.nss,uuid:S.uuid,fragment:S.fragment,reference:S.reference,resourceName:S.resourceName,secure:S.secure,error:""},z=Object.assign({},v),R=[],b=u(z.scheme||w.scheme);if(b&&b.serialize)b.serialize(w,z);if(w.path!==void 0)if(!z.skipEscape){if(w.path=escape(w.path),w.scheme!==void 0)w.path=w.path.split("%3A").join(":")}else w.path=unescape(w.path);if(z.reference!=="suffix"&&w.scheme)R.push(w.scheme,":");let E=o(w);if(E!==void 0){if(z.reference!=="suffix")R.push("//");if(R.push(E),w.path&&w.path[0]!=="/")R.push("/")}if(w.path!==void 0){let x=w.path;if(!z.absolutePath&&(!b||!b.absolutePath))x=n(x);if(E===void 0&&x[0]==="/"&&x[1]==="/")x="/%2F"+x.slice(2);R.push(x)}if(w.query!==void 0)R.push("?",w.query);if(w.fragment!==void 0)R.push("#",w.fragment);return R.join("")}let g=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function _(S,v){let w=Object.assign({},v),z={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},R=!1;if(w.reference==="suffix")if(w.scheme)S=w.scheme+":"+S;else S="//"+S;let b=S.match(g);if(b){if(z.scheme=b[1],z.userinfo=b[3],z.host=b[4],z.port=parseInt(b[5],10),z.path=b[6]||"",z.query=b[7],z.fragment=b[8],isNaN(z.port))z.port=b[5];if(z.host)if(i(z.host)===!1){let x=r(z.host);z.host=x.host.toLowerCase(),R=x.isIPV6}else R=!0;if(z.scheme===void 0&&z.userinfo===void 0&&z.host===void 0&&z.port===void 0&&z.query===void 0&&!z.path)z.reference="same-document";else if(z.scheme===void 0)z.reference="relative";else if(z.fragment===void 0)z.reference="absolute";else z.reference="uri";if(w.reference&&w.reference!=="suffix"&&w.reference!==z.reference)z.error=z.error||"URI is not a "+w.reference+" reference.";let E=u(w.scheme||z.scheme);if(!w.unicodeSupport&&(!E||!E.unicodeSupport)){if(z.host&&(w.domainHost||E&&E.domainHost)&&R===!1&&a(z.host))try{z.host=URL.domainToASCII(z.host.toLowerCase())}catch(x){z.error=z.error||"Host's domain name can not be converted to ASCII: "+x}}if(!E||E&&!E.skipNormalize){if(S.indexOf("%")!==-1){if(z.scheme!==void 0)z.scheme=unescape(z.scheme);if(z.host!==void 0)z.host=unescape(z.host)}if(z.path)z.path=escape(unescape(z.path));if(z.fragment)z.fragment=encodeURI(decodeURIComponent(z.fragment))}if(E&&E.parse)E.parse(z,w)}else z.error=z.error||"URI can not be parsed.";return z}let y={SCHEMES:c,normalize:l,resolve:d,resolveComponent:p,equal:m,serialize:h,parse:_};t.exports=y,t.exports.default=y,t.exports.fastUri=y}),EN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=RN();t.code='require("ajv/dist/runtime/uri").default',e.default=t}),Bm=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=ds();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var r=be();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return r.CodeGen}});let n=ma(),o=ps(),s=_b(),i=Kl(),a=be(),c=Jl(),u=Zl(),l=Oe(),d=$N(),p=EN(),m=(O,M)=>new RegExp(O,M);m.code="new RegExp";let h=["removeAdditional","useDefaults","coerceTypes"],g=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),_={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."},y={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},S=200;function v(O){var M,K,P,k,j,W,ue,Ee,ye,He,At,I,L,H,fe,me,we,ct,ft,Et,lt,We,er,gt,Fr;let pr=O.strict,Vr=(M=O.code)===null||M===void 0?void 0:M.optimize,Qr=Vr===!0||Vr===void 0?1:Vr||0,en=(P=(K=O.code)===null||K===void 0?void 0:K.regExp)!==null&&P!==void 0?P:m,Kn=(k=O.uriResolver)!==null&&k!==void 0?k:p.default;return{strictSchema:(W=(j=O.strictSchema)!==null&&j!==void 0?j:pr)!==null&&W!==void 0?W:!0,strictNumbers:(Ee=(ue=O.strictNumbers)!==null&&ue!==void 0?ue:pr)!==null&&Ee!==void 0?Ee:!0,strictTypes:(He=(ye=O.strictTypes)!==null&&ye!==void 0?ye:pr)!==null&&He!==void 0?He:"log",strictTuples:(I=(At=O.strictTuples)!==null&&At!==void 0?At:pr)!==null&&I!==void 0?I:"log",strictRequired:(H=(L=O.strictRequired)!==null&&L!==void 0?L:pr)!==null&&H!==void 0?H:!1,code:O.code?{...O.code,optimize:Qr,regExp:en}:{optimize:Qr,regExp:en},loopRequired:(fe=O.loopRequired)!==null&&fe!==void 0?fe:S,loopEnum:(me=O.loopEnum)!==null&&me!==void 0?me:S,meta:(we=O.meta)!==null&&we!==void 0?we:!0,messages:(ct=O.messages)!==null&&ct!==void 0?ct:!0,inlineRefs:(ft=O.inlineRefs)!==null&&ft!==void 0?ft:!0,schemaId:(Et=O.schemaId)!==null&&Et!==void 0?Et:"$id",addUsedSchema:(lt=O.addUsedSchema)!==null&&lt!==void 0?lt:!0,validateSchema:(We=O.validateSchema)!==null&&We!==void 0?We:!0,validateFormats:(er=O.validateFormats)!==null&&er!==void 0?er:!0,unicodeRegExp:(gt=O.unicodeRegExp)!==null&&gt!==void 0?gt:!0,int32range:(Fr=O.int32range)!==null&&Fr!==void 0?Fr:!0,uriResolver:Kn}}var w=class{constructor(O={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,O=this.opts={...O,...v(O)};let{es5:M,lines:K}=this.opts.code;this.scope=new a.ValueScope({scope:{},prefixes:g,es5:M,lines:K}),this.logger=F(O.logger);let P=O.validateFormats;if(O.validateFormats=!1,this.RULES=(0,s.getRules)(),z.call(this,_,O,"NOT SUPPORTED"),z.call(this,y,O,"DEPRECATED","warn"),this._metaOpts=q.call(this),O.formats)E.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),O.keywords)x.call(this,O.keywords);if(typeof O.meta=="object")this.addMetaSchema(O.meta);b.call(this),O.validateFormats=P}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:O,meta:M,schemaId:K}=this.opts,P=d;if(K==="id")P={...d},P.id=P.$id,delete P.$id;if(M&&O)this.addMetaSchema(P,P[K],!1)}defaultMeta(){let{meta:O,schemaId:M}=this.opts;return this.opts.defaultMeta=typeof O=="object"?O[M]||O:void 0}validate(O,M){let K;if(typeof O=="string"){if(K=this.getSchema(O),!K)throw Error(`no schema with key or ref "${O}"`)}else K=this.compile(O);let P=K(M);if(!("$async"in K))this.errors=K.errors;return P}compile(O,M){let K=this._addSchema(O,M);return K.validate||this._compileSchemaEnv(K)}compileAsync(O,M){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:K}=this.opts;return P.call(this,O,M);async function P(ye,He){await k.call(this,ye.$schema);let At=this._addSchema(ye,He);return At.validate||j.call(this,At)}async function k(ye){if(ye&&!this.getSchema(ye))await P.call(this,{$ref:ye},!0)}async function j(ye){try{return this._compileSchemaEnv(ye)}catch(He){if(!(He instanceof o.default))throw He;return W.call(this,He),await ue.call(this,He.missingSchema),j.call(this,ye)}}function W({missingSchema:ye,missingRef:He}){if(this.refs[ye])throw Error(`AnySchema ${ye} is loaded but ${He} cannot be resolved`)}async function ue(ye){let He=await Ee.call(this,ye);if(!this.refs[ye])await k.call(this,He.$schema);if(!this.refs[ye])this.addSchema(He,ye,M)}async function Ee(ye){let He=this._loading[ye];if(He)return He;try{return await(this._loading[ye]=K(ye))}finally{delete this._loading[ye]}}}addSchema(O,M,K,P=this.opts.validateSchema){if(Array.isArray(O)){for(let j of O)this.addSchema(j,void 0,K,P);return this}let k;if(typeof O==="object"){let{schemaId:j}=this.opts;if(k=O[j],k!==void 0&&typeof k!="string")throw Error(`schema ${j} must be string`)}return M=(0,c.normalizeId)(M||k),this._checkUnique(M),this.schemas[M]=this._addSchema(O,K,M,P,!0),this}addMetaSchema(O,M,K=this.opts.validateSchema){return this.addSchema(O,M,!0,K),this}validateSchema(O,M){if(typeof O=="boolean")return!0;let K;if(K=O.$schema,K!==void 0&&typeof K!="string")throw Error("$schema must be a string");if(K=K||this.opts.defaultMeta||this.defaultMeta(),!K)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let P=this.validate(K,O);if(!P&&M){let k="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(k);else throw Error(k)}return P}getSchema(O){let M;while(typeof(M=R.call(this,O))=="string")O=M;if(M===void 0){let{schemaId:K}=this.opts,P=new i.SchemaEnv({schema:{},schemaId:K});if(M=i.resolveSchema.call(this,P,O),!M)return;this.refs[O]=M}return M.validate||this._compileSchemaEnv(M)}removeSchema(O){if(O instanceof RegExp)return this._removeAllSchemas(this.schemas,O),this._removeAllSchemas(this.refs,O),this;switch(typeof O){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let M=R.call(this,O);if(typeof M=="object")this._cache.delete(M.schema);return delete this.schemas[O],delete this.refs[O],this}case"object":{let M=O;this._cache.delete(M);let K=O[this.opts.schemaId];if(K)K=(0,c.normalizeId)(K),delete this.schemas[K],delete this.refs[K];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(O){for(let M of O)this.addKeyword(M);return this}addKeyword(O,M){let K;if(typeof O=="string"){if(K=O,typeof M=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),M.keyword=K}else if(typeof O=="object"&&M===void 0){if(M=O,K=M.keyword,Array.isArray(K)&&!K.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(Z.call(this,K,M),!M)return(0,l.eachItem)(K,(k)=>ge.call(this,k)),this;Ae.call(this,M);let P={...M,type:(0,u.getJSONTypes)(M.type),schemaType:(0,u.getJSONTypes)(M.schemaType)};return(0,l.eachItem)(K,P.type.length===0?(k)=>ge.call(this,k,P):(k)=>P.type.forEach((j)=>ge.call(this,k,P,j))),this}getKeyword(O){let M=this.RULES.all[O];return typeof M=="object"?M.definition:!!M}removeKeyword(O){let{RULES:M}=this;delete M.keywords[O],delete M.all[O];for(let K of M.rules){let P=K.rules.findIndex((k)=>k.keyword===O);if(P>=0)K.rules.splice(P,1)}return this}addFormat(O,M){if(typeof M=="string")M=new RegExp(M);return this.formats[O]=M,this}errorsText(O=this.errors,{separator:M=", ",dataVar:K="data"}={}){if(!O||O.length===0)return"No errors";return O.map((P)=>`${K}${P.instancePath} ${P.message}`).reduce((P,k)=>P+M+k)}$dataMetaSchema(O,M){let K=this.RULES.all;O=JSON.parse(JSON.stringify(O));for(let P of M){let k=P.split("/").slice(1),j=O;for(let W of k)j=j[W];for(let W in K){let ue=K[W];if(typeof ue!="object")continue;let{$data:Ee}=ue.definition,ye=j[W];if(Ee&&ye)j[W]=Pe(ye)}}return O}_removeAllSchemas(O,M){for(let K in O){let P=O[K];if(!M||M.test(K)){if(typeof P=="string")delete O[K];else if(P&&!P.meta)this._cache.delete(P.schema),delete O[K]}}}_addSchema(O,M,K,P=this.opts.validateSchema,k=this.opts.addUsedSchema){let j,{schemaId:W}=this.opts;if(typeof O=="object")j=O[W];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof O!="boolean")throw Error("schema must be object or boolean");let ue=this._cache.get(O);if(ue!==void 0)return ue;K=(0,c.normalizeId)(j||K);let Ee=c.getSchemaRefs.call(this,O,K);if(ue=new i.SchemaEnv({schema:O,schemaId:W,meta:M,baseId:K,localRefs:Ee}),this._cache.set(ue.schema,ue),k&&!K.startsWith("#")){if(K)this._checkUnique(K);this.refs[K]=ue}if(P)this.validateSchema(O,!0);return ue}_checkUnique(O){if(this.schemas[O]||this.refs[O])throw Error(`schema with key or id "${O}" already exists`)}_compileSchemaEnv(O){if(O.meta)this._compileMetaSchema(O);else i.compileSchema.call(this,O);if(!O.validate)throw Error("ajv implementation error");return O.validate}_compileMetaSchema(O){let M=this.opts;this.opts=this._metaOpts;try{i.compileSchema.call(this,O)}finally{this.opts=M}}};w.ValidationError=n.default,w.MissingRefError=o.default,e.default=w;function z(O,M,K,P="error"){for(let k in O){let j=k;if(j in M)this.logger[P](`${K}: option ${k}. ${O[j]}`)}}function R(O){return O=(0,c.normalizeId)(O),this.schemas[O]||this.refs[O]}function b(){let O=this.opts.schemas;if(!O)return;if(Array.isArray(O))this.addSchema(O);else for(let M in O)this.addSchema(O[M],M)}function E(){for(let O in this.opts.formats){let M=this.opts.formats[O];if(M)this.addFormat(O,M)}}function x(O){if(Array.isArray(O)){this.addVocabulary(O);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let M in O){let K=O[M];if(!K.keyword)K.keyword=M;this.addKeyword(K)}}function q(){let O={...this.opts};for(let M of h)delete O[M];return O}let C={log(){},warn(){},error(){}};function F(O){if(O===!1)return C;if(O===void 0)return console;if(O.log&&O.warn&&O.error)return O;throw Error("logger must implement log, warn and error methods")}let B=/^[a-z_$][a-z0-9_$:-]*$/i;function Z(O,M){let{RULES:K}=this;if((0,l.eachItem)(O,(P)=>{if(K.keywords[P])throw Error(`Keyword ${P} is already defined`);if(!B.test(P))throw Error(`Keyword ${P} has invalid name`)}),!M)return;if(M.$data&&!(("code"in M)||("validate"in M)))throw Error('$data keyword must have "code" or "validate" function')}function ge(O,M,K){var P;let k=M===null||M===void 0?void 0:M.post;if(K&&k)throw Error('keyword with "post" flag cannot have "type"');let{RULES:j}=this,W=k?j.post:j.rules.find(({type:Ee})=>Ee===K);if(!W)W={type:K,rules:[]},j.rules.push(W);if(j.keywords[O]=!0,!M)return;let ue={keyword:O,definition:{...M,type:(0,u.getJSONTypes)(M.type),schemaType:(0,u.getJSONTypes)(M.schemaType)}};if(M.before)Ie.call(this,W,ue,M.before);else W.rules.push(ue);j.all[O]=ue,(P=M.implements)===null||P===void 0||P.forEach((Ee)=>this.addKeyword(Ee))}function Ie(O,M,K){let P=O.rules.findIndex((k)=>k.keyword===K);if(P>=0)O.rules.splice(P,0,M);else O.rules.push(M),this.logger.warn(`rule ${K} is not defined`)}function Ae(O){let{metaSchema:M}=O;if(M===void 0)return;if(O.$data&&this.opts.$data)M=Pe(M);O.validateSchema=this.compile(M,!0)}let Ue={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Pe(O){return{anyOf:[O,Ue]}}});var zN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};e.default=t}),Wm=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.callRef=e.getValidate=void 0;let t=ps(),r=gr(),n=be(),o=hr(),s=Kl(),i=Oe(),a={keyword:"$ref",schemaType:"string",code(l){let{gen:d,schema:p,it:m}=l,{baseId:h,schemaEnv:g,validateName:_,opts:y,self:S}=m,{root:v}=g;if((p==="#"||p==="#/")&&h===v.baseId)return z();let w=s.resolveRef.call(S,v,h,p);if(w===void 0)throw new t.default(m.opts.uriResolver,h,p);if(w instanceof s.SchemaEnv)return R(w);return b(w);function z(){if(g===v)return u(l,_,g,g.$async);let E=d.scopeValue("root",{ref:v});return u(l,n._`${E}.validate`,v,v.$async)}function R(E){u(l,c(l,E),E,E.$async)}function b(E){let x=d.scopeValue("schema",y.code.source===!0?{ref:E,code:(0,n.stringify)(E)}:{ref:E}),q=d.name("valid"),C=l.subschema({schema:E,dataTypes:[],schemaPath:n.nil,topSchemaRef:x,errSchemaPath:p},q);l.mergeEvaluated(C),l.ok(q)}}};function c(l,d){let{gen:p}=l;return d.validate?p.scopeValue("validate",{ref:d.validate}):n._`${p.scopeValue("wrapper",{ref:d})}.validate`}e.getValidate=c;function u(l,d,p,m){let{gen:h,it:g}=l,{allErrors:_,schemaEnv:y,opts:S}=g,v=S.passContext?o.default.this:n.nil;if(m)w();else z();function w(){if(!y.$async)throw Error("async schema referenced by sync schema");let E=h.let("valid");h.try(()=>{if(h.code(n._`await ${(0,r.callValidateCode)(l,d,v)}`),b(d),!_)h.assign(E,!0)},(x)=>{if(h.if(n._`!(${x} instanceof ${g.ValidationError})`,()=>h.throw(x)),R(x),!_)h.assign(E,!1)}),l.ok(E)}function z(){l.result((0,r.callValidateCode)(l,d,v),()=>b(d),()=>R(d))}function R(E){let x=n._`${E}.errors`;h.assign(o.default.vErrors,n._`${o.default.vErrors} === null ? ${x} : ${o.default.vErrors}.concat(${x})`),h.assign(o.default.errors,n._`${o.default.vErrors}.length`)}function b(E){var x;if(!g.opts.unevaluated)return;let q=(x=p===null||p===void 0?void 0:p.validate)===null||x===void 0?void 0:x.evaluated;if(g.props!==!0)if(q&&!q.dynamicProps){if(q.props!==void 0)g.props=i.mergeEvaluated.props(h,q.props,g.props)}else{let C=h.var("props",n._`${E}.evaluated.props`);g.props=i.mergeEvaluated.props(h,C,g.props,n.Name)}if(g.items!==!0)if(q&&!q.dynamicItems){if(q.items!==void 0)g.items=i.mergeEvaluated.items(h,q.items,g.items)}else{let C=h.var("items",n._`${E}.evaluated.items`);g.items=i.mergeEvaluated.items(h,C,g.items,n.Name)}}}e.callRef=u,e.default=a}),$b=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=zN(),r=Wm(),n=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",t.default,r.default];e.default=n}),PN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r=t.operators,n={maximum:{okStr:"<=",ok:r.LTE,fail:r.GT},minimum:{okStr:">=",ok:r.GTE,fail:r.LT},exclusiveMaximum:{okStr:"<",ok:r.LT,fail:r.GTE},exclusiveMinimum:{okStr:">",ok:r.GT,fail:r.LTE}},o={keyword:Object.keys(n),type:"number",schemaType:"number",$data:!0,error:{message:({keyword:s,schemaCode:i})=>t.str`must be ${n[s].okStr} ${i}`,params:({keyword:s,schemaCode:i})=>t._`{comparison: ${n[s].okStr}, limit: ${i}}`},code(s){let{keyword:i,data:a,schemaCode:c}=s;s.fail$data(t._`${a} ${n[i].fail} ${c} || isNaN(${a})`)}};e.default=o}),TN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:n})=>t.str`must be multiple of ${n}`,params:({schemaCode:n})=>t._`{multipleOf: ${n}}`},code(n){let{gen:o,data:s,schemaCode:i,it:a}=n,c=a.opts.multipleOfPrecision,u=o.let("res"),l=c?t._`Math.abs(Math.round(${u}) - ${u}) > 1e-${c}`:t._`${u} !== parseInt(${u})`;n.fail$data(t._`(${i} === 0 || (${u} = ${s}/${i}, ${l}))`)}};e.default=r}),IN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});function t(r){let n=r.length,o=0,s=0,i;while(s<n)if(o++,i=r.charCodeAt(s++),i>=55296&&i<=56319&&s<n){if(i=r.charCodeAt(s),(i&64512)===56320)s++}return o}e.default=t,t.code='require("ajv/dist/runtime/ucs2length").default'}),kN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r=Oe(),n=IN(),o={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:s,schemaCode:i}){let a=s==="maxLength"?"more":"fewer";return t.str`must NOT have ${a} than ${i} characters`},params:({schemaCode:s})=>t._`{limit: ${s}}`},code(s){let{keyword:i,data:a,schemaCode:c,it:u}=s,l=i==="maxLength"?t.operators.GT:t.operators.LT,d=u.opts.unicode===!1?t._`${a}.length`:t._`${(0,r.useFunc)(s.gen,n.default)}(${a})`;s.fail$data(t._`${d} ${l} ${c}`)}};e.default=o}),ON=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=gr(),r=Oe(),n=be(),o={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:s})=>n.str`must match pattern "${s}"`,params:({schemaCode:s})=>n._`{pattern: ${s}}`},code(s){let{gen:i,data:a,$data:c,schema:u,schemaCode:l,it:d}=s,p=d.opts.unicodeRegExp?"u":"";if(c){let{regExp:m}=d.opts.code,h=m.code==="new RegExp"?n._`new RegExp`:(0,r.useFunc)(i,m),g=i.let("valid");i.try(()=>i.assign(g,n._`${h}(${l}, ${p}).test(${a})`),()=>i.assign(g,!1)),s.fail$data(n._`!${g}`)}else{let m=(0,t.usePattern)(s,u);s.fail$data(n._`!${m}.test(${a})`)}}};e.default=o}),xN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:n,schemaCode:o}){let s=n==="maxProperties"?"more":"fewer";return t.str`must NOT have ${s} than ${o} properties`},params:({schemaCode:n})=>t._`{limit: ${n}}`},code(n){let{keyword:o,data:s,schemaCode:i}=n,a=o==="maxProperties"?t.operators.GT:t.operators.LT;n.fail$data(t._`Object.keys(${s}).length ${a} ${i}`)}};e.default=r}),CN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=gr(),r=be(),n=Oe(),o={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:s}})=>r.str`must have required property '${s}'`,params:({params:{missingProperty:s}})=>r._`{missingProperty: ${s}}`},code(s){let{gen:i,schema:a,schemaCode:c,data:u,$data:l,it:d}=s,{opts:p}=d;if(!l&&a.length===0)return;let m=a.length>=p.loopRequired;if(d.allErrors)h();else g();if(p.strictRequired){let S=s.parentSchema.properties,{definedProperties:v}=s.it;for(let w of a)if((S===null||S===void 0?void 0:S[w])===void 0&&!v.has(w)){let z=`required property "${w}" is not defined at "${d.schemaEnv.baseId+d.errSchemaPath}" (strictRequired)`;(0,n.checkStrictMode)(d,z,d.opts.strictRequired)}}function h(){if(m||l)s.block$data(r.nil,_);else for(let S of a)(0,t.checkReportMissingProp)(s,S)}function g(){let S=i.let("missing");if(m||l){let v=i.let("valid",!0);s.block$data(v,()=>y(S,v)),s.ok(v)}else i.if((0,t.checkMissingProp)(s,a,S)),(0,t.reportMissingProp)(s,S),i.else()}function _(){i.forOf("prop",c,(S)=>{s.setParams({missingProperty:S}),i.if((0,t.noPropertyInData)(i,u,S,p.ownProperties),()=>s.error())})}function y(S,v){s.setParams({missingProperty:S}),i.forOf(S,c,()=>{i.assign(v,(0,t.propertyInData)(i,u,S,p.ownProperties)),i.if((0,r.not)(v),()=>{s.error(),i.break()})},r.nil)}}};e.default=o}),AN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:n,schemaCode:o}){let s=n==="maxItems"?"more":"fewer";return t.str`must NOT have ${s} than ${o} items`},params:({schemaCode:n})=>t._`{limit: ${n}}`},code(n){let{keyword:o,data:s,schemaCode:i}=n,a=o==="maxItems"?t.operators.GT:t.operators.LT;n.fail$data(t._`${s}.length ${a} ${i}`)}};e.default=r}),Ym=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Sb();t.code='require("ajv/dist/runtime/equal").default',e.default=t}),NN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Zl(),r=be(),n=Oe(),o=Ym(),s={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i,j:a}})=>r.str`must NOT have duplicate items (items ## ${a} and ${i} are identical)`,params:({params:{i,j:a}})=>r._`{i: ${i}, j: ${a}}`},code(i){let{gen:a,data:c,$data:u,schema:l,parentSchema:d,schemaCode:p,it:m}=i;if(!u&&!l)return;let h=a.let("valid"),g=d.items?(0,t.getSchemaTypes)(d.items):[];i.block$data(h,_,r._`${p} === false`),i.ok(h);function _(){let w=a.let("i",r._`${c}.length`),z=a.let("j");i.setParams({i:w,j:z}),a.assign(h,!0),a.if(r._`${w} > 1`,()=>(y()?S:v)(w,z))}function y(){return g.length>0&&!g.some((w)=>w==="object"||w==="array")}function S(w,z){let R=a.name("item"),b=(0,t.checkDataTypes)(g,R,m.opts.strictNumbers,t.DataType.Wrong),E=a.const("indices",r._`{}`);a.for(r._`;${w}--;`,()=>{if(a.let(R,r._`${c}[${w}]`),a.if(b,r._`continue`),g.length>1)a.if(r._`typeof ${R} == "string"`,r._`${R} += "_"`);a.if(r._`typeof ${E}[${R}] == "number"`,()=>{a.assign(z,r._`${E}[${R}]`),i.error(),a.assign(h,!1).break()}).code(r._`${E}[${R}] = ${w}`)})}function v(w,z){let R=(0,n.useFunc)(a,o.default),b=a.name("outer");a.label(b).for(r._`;${w}--;`,()=>a.for(r._`${z} = ${w}; ${z}--;`,()=>a.if(r._`${R}(${c}[${w}], ${c}[${z}])`,()=>{i.error(),a.assign(h,!1).break(b)})))}}};e.default=s}),jN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r=Oe(),n=Ym(),o={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:s})=>t._`{allowedValue: ${s}}`},code(s){let{gen:i,data:a,$data:c,schemaCode:u,schema:l}=s;if(c||l&&typeof l=="object")s.fail$data(t._`!${(0,r.useFunc)(i,n.default)}(${a}, ${u})`);else s.fail(t._`${l} !== ${a}`)}};e.default=o}),qN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r=Oe(),n=Ym(),o={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:s})=>t._`{allowedValues: ${s}}`},code(s){let{gen:i,data:a,$data:c,schema:u,schemaCode:l,it:d}=s;if(!c&&u.length===0)throw Error("enum must have non-empty array");let p=u.length>=d.opts.loopEnum,m,h=()=>m!==null&&m!==void 0?m:m=(0,r.useFunc)(i,n.default),g;if(p||c)g=i.let("valid"),s.block$data(g,_);else{if(!Array.isArray(u))throw Error("ajv implementation error");let S=i.const("vSchema",l);g=(0,t.or)(...u.map((v,w)=>y(S,w)))}s.pass(g);function _(){i.assign(g,!1),i.forOf("v",l,(S)=>i.if(t._`${h()}(${a}, ${S})`,()=>i.assign(g,!0).break()))}function y(S,v){let w=u[v];return typeof w==="object"&&w!==null?t._`${h()}(${a}, ${S}[${v}])`:t._`${a} === ${w}`}}};e.default=o}),wb=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=PN(),r=TN(),n=kN(),o=ON(),s=xN(),i=CN(),a=AN(),c=NN(),u=jN(),l=qN(),d=[t.default,r.default,n.default,o.default,s.default,i.default,a.default,c.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},u.default,l.default];e.default=d}),Rb=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateAdditionalItems=void 0;let t=be(),r=Oe(),n={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:s}})=>t.str`must NOT have more than ${s} items`,params:({params:{len:s}})=>t._`{limit: ${s}}`},code(s){let{parentSchema:i,it:a}=s,{items:c}=i;if(!Array.isArray(c)){(0,r.checkStrictMode)(a,'"additionalItems" is ignored when "items" is not an array of schemas');return}o(s,c)}};function o(s,i){let{gen:a,schema:c,data:u,keyword:l,it:d}=s;d.items=!0;let p=a.const("len",t._`${u}.length`);if(c===!1)s.setParams({len:i.length}),s.pass(t._`${p} <= ${i.length}`);else if(typeof c=="object"&&!(0,r.alwaysValidSchema)(d,c)){let h=a.var("valid",t._`${p} <= ${i.length}`);a.if((0,t.not)(h),()=>m(h)),s.ok(h)}function m(h){a.forRange("i",i.length,p,(g)=>{if(s.subschema({keyword:l,dataProp:g,dataPropType:r.Type.Num},h),!d.allErrors)a.if((0,t.not)(h),()=>a.break())})}}e.validateAdditionalItems=o,e.default=n}),Eb=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateTuple=void 0;let t=be(),r=Oe(),n=gr(),o={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(i){let{schema:a,it:c}=i;if(Array.isArray(a))return s(i,"additionalItems",a);if(c.items=!0,(0,r.alwaysValidSchema)(c,a))return;i.ok((0,n.validateArray)(i))}};function s(i,a,c=i.schema){let{gen:u,parentSchema:l,data:d,keyword:p,it:m}=i;if(_(l),m.opts.unevaluated&&c.length&&m.items!==!0)m.items=r.mergeEvaluated.items(u,c.length,m.items);let h=u.name("valid"),g=u.const("len",t._`${d}.length`);c.forEach((y,S)=>{if((0,r.alwaysValidSchema)(m,y))return;u.if(t._`${g} > ${S}`,()=>i.subschema({keyword:p,schemaProp:S,dataProp:S},h)),i.ok(h)});function _(y){let{opts:S,errSchemaPath:v}=m,w=c.length,z=w===y.minItems&&(w===y.maxItems||y[a]===!1);if(S.strictTuples&&!z){let R=`"${p}" is ${w}-tuple, but minItems or maxItems/${a} are not specified or different at path "${v}"`;(0,r.checkStrictMode)(m,R,S.strictTuples)}}}e.validateTuple=s,e.default=o}),MN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Eb(),r={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(n)=>(0,t.validateTuple)(n,"items")};e.default=r}),LN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r=Oe(),n=gr(),o=Rb(),s={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:i}})=>t.str`must NOT have more than ${i} items`,params:({params:{len:i}})=>t._`{limit: ${i}}`},code(i){let{schema:a,parentSchema:c,it:u}=i,{prefixItems:l}=c;if(u.items=!0,(0,r.alwaysValidSchema)(u,a))return;if(l)(0,o.validateAdditionalItems)(i,l);else i.ok((0,n.validateArray)(i))}};e.default=s}),DN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r=Oe(),n={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:o,max:s}})=>s===void 0?t.str`must contain at least ${o} valid item(s)`:t.str`must contain at least ${o} and no more than ${s} valid item(s)`,params:({params:{min:o,max:s}})=>s===void 0?t._`{minContains: ${o}}`:t._`{minContains: ${o}, maxContains: ${s}}`},code(o){let{gen:s,schema:i,parentSchema:a,data:c,it:u}=o,l,d,{minContains:p,maxContains:m}=a;if(u.opts.next)l=p===void 0?1:p,d=m;else l=1;let h=s.const("len",t._`${c}.length`);if(o.setParams({min:l,max:d}),d===void 0&&l===0){(0,r.checkStrictMode)(u,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(d!==void 0&&l>d){(0,r.checkStrictMode)(u,'"minContains" > "maxContains" is always invalid'),o.fail();return}if((0,r.alwaysValidSchema)(u,i)){let v=t._`${h} >= ${l}`;if(d!==void 0)v=t._`${v} && ${h} <= ${d}`;o.pass(v);return}u.items=!0;let g=s.name("valid");if(d===void 0&&l===1)y(g,()=>s.if(g,()=>s.break()));else if(l===0){if(s.let(g,!0),d!==void 0)s.if(t._`${c}.length > 0`,_)}else s.let(g,!1),_();o.result(g,()=>o.reset());function _(){let v=s.name("_valid"),w=s.let("count",0);y(v,()=>s.if(v,()=>S(w)))}function y(v,w){s.forRange("i",0,h,(z)=>{o.subschema({keyword:"contains",dataProp:z,dataPropType:r.Type.Num,compositeRule:!0},v),w()})}function S(v){if(s.code(t._`${v}++`),d===void 0)s.if(t._`${v} >= ${l}`,()=>s.assign(g,!0).break());else if(s.if(t._`${v} > ${d}`,()=>s.assign(g,!1).break()),l===1)s.assign(g,!0);else s.if(t._`${v} >= ${l}`,()=>s.assign(g,!0))}}};e.default=n}),Xm=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;let t=be(),r=Oe(),n=gr();e.error={message:({params:{property:c,depsCount:u,deps:l}})=>{let d=u===1?"property":"properties";return t.str`must have ${d} ${l} when property ${c} is present`},params:({params:{property:c,depsCount:u,deps:l,missingProperty:d}})=>t._`{property: ${c},
58
58
  missingProperty: ${d},
59
59
  depsCount: ${u},
60
- deps: ${l}}`};let n={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(c){let[u,l]=s(c);i(c,u),a(c,l)}};function s({schema:c}){let u={},l={};for(let d in c){if(d==="__proto__")continue;let f=Array.isArray(c[d])?u:l;f[d]=c[d]}return[u,l]}function i(c,u=c.schema){let{gen:l,data:d,it:f}=c;if(Object.keys(u).length===0)return;let m=l.let("missing");for(let h in u){let g=u[h];if(g.length===0)continue;let _=(0,o.propertyInData)(l,d,h,f.opts.ownProperties);if(c.setParams({property:h,depsCount:g.length,deps:g.join(", ")}),f.allErrors)l.if(_,()=>{for(let y of g)(0,o.checkReportMissingProp)(c,y)});else l.if(t._`${_} && (${(0,o.checkMissingProp)(c,g,m)})`),(0,o.reportMissingProp)(c,m),l.else()}}e.validatePropertyDeps=i;function a(c,u=c.schema){let{gen:l,data:d,keyword:f,it:m}=c,h=l.name("valid");for(let g in u){if((0,r.alwaysValidSchema)(m,u[g]))continue;l.if((0,o.propertyInData)(l,d,g,m.opts.ownProperties),()=>{let _=c.subschema({keyword:f,schemaProp:g},h);c.mergeValidEvaluated(_,h)},()=>l.var(h,!0)),c.ok(h)}}e.validateSchemaDeps=a,e.default=n}),MN=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r=Oe(),o={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:n})=>t._`{propertyName: ${n.propertyName}}`},code(n){let{gen:s,schema:i,data:a,it:c}=n;if((0,r.alwaysValidSchema)(c,i))return;let u=s.name("valid");s.forIn("key",a,(l)=>{n.setParams({propertyName:l}),n.subschema({keyword:"propertyNames",data:l,dataTypes:["string"],propertyName:l,compositeRule:!0},u),s.if((0,t.not)(u),()=>{if(n.error(!0),!c.allErrors)s.break()})}),n.ok(u)}};e.default=o}),B0=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=fr(),r=be(),o=pr(),n=Oe(),s={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:i})=>r._`{additionalProperty: ${i.additionalProperty}}`},code(i){let{gen:a,schema:c,parentSchema:u,data:l,errsCount:d,it:f}=i;if(!d)throw Error("ajv implementation error");let{allErrors:m,opts:h}=f;if(f.props=!0,h.removeAdditional!=="all"&&(0,n.alwaysValidSchema)(f,c))return;let g=(0,t.allSchemaProperties)(u.properties),_=(0,t.allSchemaProperties)(u.patternProperties);y(),i.ok(r._`${d} === ${o.default.errors}`);function y(){a.forIn("key",l,(R)=>{if(!g.length&&!_.length)w(R);else a.if(S(R),()=>w(R))})}function S(R){let b;if(g.length>8){let E=(0,n.schemaRefOrVal)(f,u.properties,"properties");b=(0,t.isOwnProperty)(a,E,R)}else if(g.length)b=(0,r.or)(...g.map((E)=>r._`${R} === ${E}`));else b=r.nil;if(_.length)b=(0,r.or)(b,..._.map((E)=>r._`${(0,t.usePattern)(i,E)}.test(${R})`));return(0,r.not)(b)}function v(R){a.code(r._`delete ${l}[${R}]`)}function w(R){if(h.removeAdditional==="all"||h.removeAdditional&&c===!1){v(R);return}if(c===!1){if(i.setParams({additionalProperty:R}),i.error(),!m)a.break();return}if(typeof c=="object"&&!(0,n.alwaysValidSchema)(f,c)){let b=a.name("valid");if(h.removeAdditional==="failing")z(R,b,!1),a.if((0,r.not)(b),()=>{i.reset(),v(R)});else if(z(R,b),!m)a.if((0,r.not)(b),()=>a.break())}}function z(R,b,E){let C={keyword:"additionalProperties",dataProp:R,dataPropType:n.Type.Str};if(E===!1)Object.assign(C,{compositeRule:!0,createErrors:!1,allErrors:!1});i.subschema(C,b)}}};e.default=s}),LN=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ss(),r=fr(),o=Oe(),n=B0(),s={keyword:"properties",type:"object",schemaType:"object",code(i){let{gen:a,schema:c,parentSchema:u,data:l,it:d}=i;if(d.opts.removeAdditional==="all"&&u.additionalProperties===void 0)n.default.code(new t.KeywordCxt(d,n.default,"additionalProperties"));let f=(0,r.allSchemaProperties)(c);for(let y of f)d.definedProperties.add(y);if(d.opts.unevaluated&&f.length&&d.props!==!0)d.props=o.mergeEvaluated.props(a,(0,o.toHash)(f),d.props);let m=f.filter((y)=>!(0,o.alwaysValidSchema)(d,c[y]));if(m.length===0)return;let h=a.name("valid");for(let y of m){if(g(y))_(y);else{if(a.if((0,r.propertyInData)(a,l,y,d.opts.ownProperties)),_(y),!d.allErrors)a.else().var(h,!0);a.endIf()}i.it.definedProperties.add(y),i.ok(h)}function g(y){return d.opts.useDefaults&&!d.compositeRule&&c[y].default!==void 0}function _(y){i.subschema({keyword:"properties",schemaProp:y,dataProp:y},h)}}};e.default=s}),DN=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=fr(),r=be(),o=Oe(),n=Oe(),s={keyword:"patternProperties",type:"object",schemaType:"object",code(i){let{gen:a,schema:c,data:u,parentSchema:l,it:d}=i,{opts:f}=d,m=(0,t.allSchemaProperties)(c),h=m.filter((z)=>(0,o.alwaysValidSchema)(d,c[z]));if(m.length===0||h.length===m.length&&(!d.opts.unevaluated||d.props===!0))return;let g=f.strictSchema&&!f.allowMatchingProperties&&l.properties,_=a.name("valid");if(d.props!==!0&&!(d.props instanceof r.Name))d.props=(0,n.evaluatedPropsToName)(a,d.props);let{props:y}=d;S();function S(){for(let z of m){if(g)v(z);if(d.allErrors)w(z);else a.var(_,!0),w(z),a.if(_)}}function v(z){for(let R in g)if(new RegExp(z).test(R))(0,o.checkStrictMode)(d,`property ${R} matches pattern ${z} (use allowMatchingProperties)`)}function w(z){a.forIn("key",u,(R)=>{a.if(r._`${(0,t.usePattern)(i,z)}.test(${R})`,()=>{let b=h.includes(z);if(!b)i.subschema({keyword:"patternProperties",schemaProp:z,dataProp:R,dataPropType:n.Type.Str},_);if(d.opts.unevaluated&&y!==!0)a.assign(r._`${y}[${R}]`,!0);else if(!b&&!d.allErrors)a.if((0,r.not)(_),()=>a.break())})})}}};e.default=s}),UN=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Oe(),r={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(o){let{gen:n,schema:s,it:i}=o;if((0,t.alwaysValidSchema)(i,s)){o.fail();return}let a=n.name("valid");o.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},a),o.failResult(a,()=>o.reset(),()=>o.error())},error:{message:"must NOT be valid"}};e.default=r}),FN=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:fr().validateUnion,error:{message:"must match a schema in anyOf"}};e.default=t}),VN=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r=Oe(),o={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:n})=>t._`{passingSchemas: ${n.passing}}`},code(n){let{gen:s,schema:i,parentSchema:a,it:c}=n;if(!Array.isArray(i))throw Error("ajv implementation error");if(c.opts.discriminator&&a.discriminator)return;let u=i,l=s.let("valid",!1),d=s.let("passing",null),f=s.name("_valid");n.setParams({passing:d}),s.block(m),n.result(l,()=>n.reset(),()=>n.error(!0));function m(){u.forEach((h,g)=>{let _;if((0,r.alwaysValidSchema)(c,h))s.var(f,!0);else _=n.subschema({keyword:"oneOf",schemaProp:g,compositeRule:!0},f);if(g>0)s.if(t._`${f} && ${l}`).assign(l,!1).assign(d,t._`[${d}, ${g}]`).else();s.if(f,()=>{if(s.assign(l,!0),s.assign(d,g),_)n.mergeEvaluated(_,t.Name)})})}}};e.default=o}),ZN=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Oe(),r={keyword:"allOf",schemaType:"array",code(o){let{gen:n,schema:s,it:i}=o;if(!Array.isArray(s))throw Error("ajv implementation error");let a=n.name("valid");s.forEach((c,u)=>{if((0,t.alwaysValidSchema)(i,c))return;let l=o.subschema({keyword:"allOf",schemaProp:u},a);o.ok(a),o.mergeEvaluated(l)})}};e.default=r}),HN=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r=Oe(),o={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:s})=>t.str`must match "${s.ifClause}" schema`,params:({params:s})=>t._`{failingKeyword: ${s.ifClause}}`},code(s){let{gen:i,parentSchema:a,it:c}=s;if(a.then===void 0&&a.else===void 0)(0,r.checkStrictMode)(c,'"if" without "then" and "else" is ignored');let u=n(c,"then"),l=n(c,"else");if(!u&&!l)return;let d=i.let("valid",!0),f=i.name("_valid");if(m(),s.reset(),u&&l){let g=i.let("ifClause");s.setParams({ifClause:g}),i.if(f,h("then",g),h("else",g))}else if(u)i.if(f,h("then"));else i.if((0,t.not)(f),h("else"));s.pass(d,()=>s.error(!0));function m(){let g=s.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},f);s.mergeEvaluated(g)}function h(g,_){return()=>{let y=s.subschema({keyword:g},f);if(i.assign(d,f),s.mergeValidEvaluated(y,d),_)i.assign(_,t._`${g}`);else s.setParams({ifClause:g})}}}};function n(s,i){let a=s.schema[i];return a!==void 0&&!(0,r.alwaysValidSchema)(s,a)}e.default=o}),GN=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Oe(),r={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:o,parentSchema:n,it:s}){if(n.if===void 0)(0,t.checkStrictMode)(s,`"${o}" without "if" is ignored`)}};e.default=r}),W0=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=J0(),r=AN(),o=K0(),n=jN(),s=qN(),i=Cm(),a=MN(),c=B0(),u=LN(),l=DN(),d=UN(),f=FN(),m=VN(),h=ZN(),g=HN(),_=GN();function y(S=!1){let v=[d.default,f.default,m.default,h.default,g.default,_.default,a.default,c.default,i.default,u.default,l.default];if(S)v.push(r.default,n.default);else v.push(t.default,o.default);return v.push(s.default),v}e.default=y}),JN=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:o})=>t.str`must match format "${o}"`,params:({schemaCode:o})=>t._`{format: ${o}}`},code(o,n){let{gen:s,data:i,$data:a,schema:c,schemaCode:u,it:l}=o,{opts:d,errSchemaPath:f,schemaEnv:m,self:h}=l;if(!d.validateFormats)return;if(a)g();else _();function g(){let y=s.scopeValue("formats",{ref:h.formats,code:d.code.formats}),S=s.const("fDef",t._`${y}[${u}]`),v=s.let("fType"),w=s.let("format");s.if(t._`typeof ${S} == "object" && !(${S} instanceof RegExp)`,()=>s.assign(v,t._`${S}.type || "string"`).assign(w,t._`${S}.validate`),()=>s.assign(v,t._`"string"`).assign(w,S)),o.fail$data((0,t.or)(z(),R()));function z(){if(d.strictSchema===!1)return t.nil;return t._`${u} && !${w}`}function R(){let b=m.$async?t._`(${S}.async ? await ${w}(${i}) : ${w}(${i}))`:t._`${w}(${i})`,E=t._`(typeof ${w} == "function" ? ${b} : ${w}.test(${i}))`;return t._`${w} && ${w} !== true && ${v} === ${n} && !${E}`}}function _(){let y=h.formats[c];if(!y){z();return}if(y===!0)return;let[S,v,w]=R(y);if(S===n)o.pass(b());function z(){if(d.strictSchema===!1){h.logger.warn(E());return}throw Error(E());function E(){return`unknown format "${c}" ignored in schema at path "${f}"`}}function R(E){let C=E instanceof RegExp?(0,t.regexpCode)(E):d.code.formats?t._`${d.code.formats}${(0,t.getProperty)(c)}`:void 0,q=s.scopeValue("formats",{key:c,ref:E,code:C});if(typeof E=="object"&&!(E instanceof RegExp))return[E.type||"string",E.validate,t._`${q}.validate`];return["string",E,q]}function b(){if(typeof y=="object"&&!(y instanceof RegExp)&&y.async){if(!m.$async)throw Error("async format in sync schema");return t._`await ${w}(${i})`}return typeof v=="function"?t._`${w}(${i})`:t._`${w}.test(${i})`}}}};e.default=r}),Y0=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=[JN().default];e.default=t}),X0=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.contentVocabulary=e.metadataVocabulary=void 0,e.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],e.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]}),Q0=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=H0(),r=G0(),o=W0(),n=Y0(),s=X0(),i=[t.default,r.default,(0,o.default)(),n.default,s.metadataVocabulary,s.contentVocabulary];e.default=i}),KN=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0;var t;(function(r){r.Tag="tag",r.Mapping="mapping"})(t||(e.DiscrError=t={}))}),xm=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r=KN(),o=ql(),n=is(),s=Oe(),i={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:a,tagName:c}})=>a===r.DiscrError.Tag?`tag "${c}" must be string`:`value of tag "${c}" must be in oneOf`,params:({params:{discrError:a,tag:c,tagName:u}})=>t._`{error: ${a}, tag: ${u}, tagValue: ${c}}`},code(a){let{gen:c,data:u,schema:l,parentSchema:d,it:f}=a,{oneOf:m}=d;if(!f.opts.discriminator)throw Error("discriminator: requires discriminator option");let h=l.propertyName;if(typeof h!="string")throw Error("discriminator: requires propertyName");if(l.mapping)throw Error("discriminator: mapping is not supported");if(!m)throw Error("discriminator: requires oneOf keyword");let g=c.let("valid",!1),_=c.const("tag",t._`${u}${(0,t.getProperty)(h)}`);c.if(t._`typeof ${_} == "string"`,()=>y(),()=>a.error(!1,{discrError:r.DiscrError.Tag,tag:_,tagName:h})),a.ok(g);function y(){let w=v();c.if(!1);for(let z in w)c.elseIf(t._`${_} === ${z}`),c.assign(g,S(w[z]));c.else(),a.error(!1,{discrError:r.DiscrError.Mapping,tag:_,tagName:h}),c.endIf()}function S(w){let z=c.name("valid"),R=a.subschema({keyword:"oneOf",schemaProp:w},z);return a.mergeEvaluated(R,t.Name),z}function v(){var w;let z={},R=E(d),b=!0;for(let x=0;x<m.length;x++){let F=m[x];if((F===null||F===void 0?void 0:F.$ref)&&!(0,s.schemaHasRulesButRef)(F,f.self.RULES)){let H=F.$ref;if(F=o.resolveRef.call(f.self,f.schemaEnv.root,f.baseId,H),F instanceof o.SchemaEnv)F=F.schema;if(F===void 0)throw new n.default(f.opts.uriResolver,f.baseId,H)}let B=(w=F===null||F===void 0?void 0:F.properties)===null||w===void 0?void 0:w[h];if(typeof B!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${h}"`);b=b&&(R||E(F)),C(B,x)}if(!b)throw Error(`discriminator: "${h}" must be required`);return z;function E({required:x}){return Array.isArray(x)&&x.includes(h)}function C(x,F){if(x.const)q(x.const,F);else if(x.enum)for(let B of x.enum)q(B,F);else throw Error(`discriminator: "properties/${h}" must have "const" or "enum"`)}function q(x,F){if(typeof x!="string"||x in z)throw Error(`discriminator: "${h}" values must be unique strings`);z[x]=F}}}};e.default=i}),BN=G((e,t)=>{t.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}}),eb=G((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv=void 0;let r=Im(),o=Q0(),n=xm(),s=BN(),i=["/properties"],a="http://json-schema.org/draft-07/schema";var c=class extends r.default{_addVocabularies(){if(super._addVocabularies(),o.default.forEach((m)=>this.addVocabulary(m)),this.opts.discriminator)this.addKeyword(n.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let m=this.opts.$data?this.$dataMetaSchema(s,i):s;this.addMetaSchema(m,a,!1),this.refs["http://json-schema.org/schema"]=a}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(a)?a:void 0)}};e.Ajv=c,t.exports=e=c,t.exports.Ajv=c,Object.defineProperty(e,"__esModule",{value:!0}),e.default=c;var u=ss();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var l=be();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return l._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return l.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return l.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return l.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return l.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return l.CodeGen}});var d=aa();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return d.default}});var f=is();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return f.default}})}),tb=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicAnchor=void 0;let t=be(),r=pr(),o=ql(),n=km(),s={keyword:"$dynamicAnchor",schemaType:"string",code:(c)=>i(c,c.schema)};function i(c,u){let{gen:l,it:d}=c;d.schemaEnv.root.dynamicAnchors[u]=!0;let f=t._`${r.default.dynamicAnchors}${(0,t.getProperty)(u)}`,m=d.errSchemaPath==="#"?d.validateName:a(c);l.if(t._`!${f}`,()=>l.assign(f,m))}e.dynamicAnchor=i;function a(c){let{schemaEnv:u,schema:l,self:d}=c.it,{root:f,baseId:m,localRefs:h,meta:g}=u.root,{schemaId:_}=d.opts,y=new o.SchemaEnv({schema:l,schemaId:_,root:f,baseId:m,localRefs:h,meta:g});return o.compileSchema.call(d,y),(0,n.getValidate)(c,y)}e.default=s}),rb=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicRef=void 0;let t=be(),r=pr(),o=km(),n={keyword:"$dynamicRef",schemaType:"string",code:(i)=>s(i,i.schema)};function s(i,a){let{gen:c,keyword:u,it:l}=i;if(a[0]!=="#")throw Error(`"${u}" only supports hash fragment reference`);let d=a.slice(1);if(l.allErrors)f();else{let h=c.let("valid",!1);f(h),i.ok(h)}function f(h){if(l.schemaEnv.root.dynamicAnchors[d]){let g=c.let("_v",t._`${r.default.dynamicAnchors}${(0,t.getProperty)(d)}`);c.if(g,m(g,h),m(l.validateName,h))}else m(l.validateName,h)()}function m(h,g){return g?()=>c.block(()=>{(0,o.callRef)(i,h),c.let(g,!0)}):()=>(0,o.callRef)(i,h)}}e.dynamicRef=s,e.default=n}),WN=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=tb(),r=Oe(),o={keyword:"$recursiveAnchor",schemaType:"boolean",code(n){if(n.schema)(0,t.dynamicAnchor)(n,"");else(0,r.checkStrictMode)(n.it,"$recursiveAnchor: false is ignored")}};e.default=o}),YN=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=rb(),r={keyword:"$recursiveRef",schemaType:"string",code:(o)=>(0,t.dynamicRef)(o,o.schema)};e.default=r}),ob=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=tb(),r=rb(),o=WN(),n=YN(),s=[t.default,r.default,o.default,n.default];e.default=s}),XN=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Cm(),r={keyword:"dependentRequired",type:"object",schemaType:"object",error:t.error,code:(o)=>(0,t.validatePropertyDeps)(o)};e.default=r}),QN=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Cm(),r={keyword:"dependentSchemas",type:"object",schemaType:"object",code:(o)=>(0,t.validateSchemaDeps)(o)};e.default=r}),e1=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Oe(),r={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:o,parentSchema:n,it:s}){if(n.contains===void 0)(0,t.checkStrictMode)(s,`"${o}" without "contains" is ignored`)}};e.default=r}),nb=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=XN(),r=QN(),o=e1(),n=[t.default,r.default,o.default];e.default=n}),t1=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r=Oe(),o=pr(),n={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:s})=>t._`{unevaluatedProperty: ${s.unevaluatedProperty}}`},code(s){let{gen:i,schema:a,data:c,errsCount:u,it:l}=s;if(!u)throw Error("ajv implementation error");let{allErrors:d,props:f}=l;if(f instanceof t.Name)i.if(t._`${f} !== true`,()=>i.forIn("key",c,(_)=>i.if(h(f,_),()=>m(_))));else if(f!==!0)i.forIn("key",c,(_)=>f===void 0?m(_):i.if(g(f,_),()=>m(_)));l.props=!0,s.ok(t._`${u} === ${o.default.errors}`);function m(_){if(a===!1){if(s.setParams({unevaluatedProperty:_}),s.error(),!d)i.break();return}if(!(0,r.alwaysValidSchema)(l,a)){let y=i.name("valid");if(s.subschema({keyword:"unevaluatedProperties",dataProp:_,dataPropType:r.Type.Str},y),!d)i.if((0,t.not)(y),()=>i.break())}}function h(_,y){return t._`!${_} || !${_}[${y}]`}function g(_,y){let S=[];for(let v in _)if(_[v]===!0)S.push(t._`${y} !== ${v}`);return(0,t.and)(...S)}}};e.default=n}),r1=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r=Oe(),o={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:n}})=>t.str`must NOT have more than ${n} items`,params:({params:{len:n}})=>t._`{limit: ${n}}`},code(n){let{gen:s,schema:i,data:a,it:c}=n,u=c.items||0;if(u===!0)return;let l=s.const("len",t._`${a}.length`);if(i===!1)n.setParams({len:u}),n.fail(t._`${l} > ${u}`);else if(typeof i=="object"&&!(0,r.alwaysValidSchema)(c,i)){let f=s.var("valid",t._`${l} <= ${u}`);s.if((0,t.not)(f),()=>d(f,u)),n.ok(f)}c.items=!0;function d(f,m){s.forRange("i",m,l,(h)=>{if(n.subschema({keyword:"unevaluatedItems",dataProp:h,dataPropType:r.Type.Num},f),!c.allErrors)s.if((0,t.not)(f),()=>s.break())})}}};e.default=o}),sb=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=t1(),r=r1(),o=[t.default,r.default];e.default=o}),o1=G((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/schema",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0,"https://json-schema.org/draft/2019-09/vocab/applicator":!0,"https://json-schema.org/draft/2019-09/vocab/validation":!0,"https://json-schema.org/draft/2019-09/vocab/meta-data":!0,"https://json-schema.org/draft/2019-09/vocab/format":!1,"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format"},{$ref:"meta/content"}],type:["object","boolean"],properties:{definitions:{$comment:"While no longer an official keyword as it is replaced by $defs, this keyword is retained in the meta-schema to prevent incompatible extensions as it remains in common use.",type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},dependencies:{$comment:'"dependencies" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to "dependentSchemas" and "dependentRequired"',type:"object",additionalProperties:{anyOf:[{$recursiveRef:"#"},{$ref:"meta/validation#/$defs/stringArray"}]}}}}}),n1=G((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/applicator":!0},$recursiveAnchor:!0,title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{additionalItems:{$recursiveRef:"#"},unevaluatedItems:{$recursiveRef:"#"},items:{anyOf:[{$recursiveRef:"#"},{$ref:"#/$defs/schemaArray"}]},contains:{$recursiveRef:"#"},additionalProperties:{$recursiveRef:"#"},unevaluatedProperties:{$recursiveRef:"#"},properties:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$recursiveRef:"#"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$recursiveRef:"#"}},propertyNames:{$recursiveRef:"#"},if:{$recursiveRef:"#"},then:{$recursiveRef:"#"},else:{$recursiveRef:"#"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$recursiveRef:"#"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$recursiveRef:"#"}}}}}),s1=G((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/content",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentMediaType:{type:"string"},contentEncoding:{type:"string"},contentSchema:{$recursiveRef:"#"}}}}),i1=G((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/core",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0},$recursiveAnchor:!0,title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{type:"string",format:"uri"},$anchor:{type:"string",pattern:"^[A-Za-z][-A-Za-z0-9.:_]*$"},$ref:{type:"string",format:"uri-reference"},$recursiveRef:{type:"string",format:"uri-reference"},$recursiveAnchor:{type:"boolean",default:!1},$vocabulary:{type:"object",propertyNames:{type:"string",format:"uri"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}}}}}),a1=G((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/format",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/format":!0},$recursiveAnchor:!0,title:"Format vocabulary meta-schema",type:["object","boolean"],properties:{format:{type:"string"}}}}),c1=G((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/meta-data":!0},$recursiveAnchor:!0,title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}}),u1=G((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/validation",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/validation":!0},$recursiveAnchor:!0,title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}},const:!0,enum:{type:"array",items:!0},type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}}),l1=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=o1(),r=n1(),o=s1(),n=i1(),s=a1(),i=c1(),a=u1(),c=["/properties"];function u(l){return[t,r,o,n,d(this,s),i,d(this,a)].forEach((f)=>this.addMetaSchema(f,void 0,!1)),this;function d(f,m){return l?f.$dataMetaSchema(m,c):m}}e.default=u}),d1=G((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv2019=void 0;let r=Im(),o=Q0(),n=ob(),s=nb(),i=sb(),a=xm(),c=l1(),u="https://json-schema.org/draft/2019-09/schema";var l=class extends r.default{constructor(g={}){super({...g,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){if(super._addVocabularies(),this.addVocabulary(n.default),o.default.forEach((g)=>this.addVocabulary(g)),this.addVocabulary(s.default),this.addVocabulary(i.default),this.opts.discriminator)this.addKeyword(a.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:g,meta:_}=this.opts;if(!_)return;c.default.call(this,g),this.refs["http://json-schema.org/schema"]=u}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(u)?u:void 0)}};e.Ajv2019=l,t.exports=e=l,t.exports.Ajv2019=l,Object.defineProperty(e,"__esModule",{value:!0}),e.default=l;var d=ss();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return d.KeywordCxt}});var f=be();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return f._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return f.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return f.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return f.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return f.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return f.CodeGen}});var m=aa();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return m.default}});var h=is();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return h.default}})}),p1=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=H0(),r=G0(),o=W0(),n=ob(),s=nb(),i=sb(),a=Y0(),c=X0(),u=[n.default,t.default,r.default,(0,o.default)(!0),a.default,c.metadataVocabulary,c.contentVocabulary,s.default,i.default];e.default=u}),f1=G((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/schema",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/unevaluated"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format-annotation"},{$ref:"meta/content"}],type:["object","boolean"],$comment:"This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",properties:{definitions:{$comment:'"definitions" has been replaced by "$defs".',type:"object",additionalProperties:{$dynamicRef:"#meta"},deprecated:!0,default:{}},dependencies:{$comment:'"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',type:"object",additionalProperties:{anyOf:[{$dynamicRef:"#meta"},{$ref:"meta/validation#/$defs/stringArray"}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:'"$recursiveAnchor" has been replaced by "$dynamicAnchor".',$ref:"meta/core#/$defs/anchorString",deprecated:!0},$recursiveRef:{$comment:'"$recursiveRef" has been replaced by "$dynamicRef".',$ref:"meta/core#/$defs/uriReferenceString",deprecated:!0}}}}),m1=G((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/applicator":!0},$dynamicAnchor:"meta",title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{prefixItems:{$ref:"#/$defs/schemaArray"},items:{$dynamicRef:"#meta"},contains:{$dynamicRef:"#meta"},additionalProperties:{$dynamicRef:"#meta"},properties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},patternProperties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},propertyNames:{$dynamicRef:"#meta"},if:{$dynamicRef:"#meta"},then:{$dynamicRef:"#meta"},else:{$dynamicRef:"#meta"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$dynamicRef:"#meta"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$dynamicRef:"#meta"}}}}}),h1=G((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/unevaluated",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},$dynamicAnchor:"meta",title:"Unevaluated applicator vocabulary meta-schema",type:["object","boolean"],properties:{unevaluatedItems:{$dynamicRef:"#meta"},unevaluatedProperties:{$dynamicRef:"#meta"}}}}),g1=G((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/content",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentEncoding:{type:"string"},contentMediaType:{type:"string"},contentSchema:{$dynamicRef:"#meta"}}}}),y1=G((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/core",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0},$dynamicAnchor:"meta",title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{$ref:"#/$defs/uriReferenceString",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{$ref:"#/$defs/uriString"},$ref:{$ref:"#/$defs/uriReferenceString"},$anchor:{$ref:"#/$defs/anchorString"},$dynamicRef:{$ref:"#/$defs/uriReferenceString"},$dynamicAnchor:{$ref:"#/$defs/anchorString"},$vocabulary:{type:"object",propertyNames:{$ref:"#/$defs/uriString"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$dynamicRef:"#meta"}}},$defs:{anchorString:{type:"string",pattern:"^[A-Za-z_][-A-Za-z0-9._]*$"},uriString:{type:"string",format:"uri"},uriReferenceString:{type:"string",format:"uri-reference"}}}}),_1=G((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/format-annotation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},$dynamicAnchor:"meta",title:"Format vocabulary meta-schema for annotation results",type:["object","boolean"],properties:{format:{type:"string"}}}}),v1=G((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},$dynamicAnchor:"meta",title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}}),S1=G((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/validation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/validation":!0},$dynamicAnchor:"meta",title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}}),b1=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=f1(),r=m1(),o=h1(),n=g1(),s=y1(),i=_1(),a=v1(),c=S1(),u=["/properties"];function l(d){return[t,r,o,n,s,f(this,i),a,f(this,c)].forEach((m)=>this.addMetaSchema(m,void 0,!1)),this;function f(m,h){return d?m.$dataMetaSchema(h,u):h}}e.default=l}),$1=G((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv2020=void 0;let r=Im(),o=p1(),n=xm(),s=b1(),i="https://json-schema.org/draft/2020-12/schema";var a=class extends r.default{constructor(f={}){super({...f,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){if(super._addVocabularies(),o.default.forEach((f)=>this.addVocabulary(f)),this.opts.discriminator)this.addKeyword(n.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:f,meta:m}=this.opts;if(!m)return;s.default.call(this,f),this.refs["http://json-schema.org/schema"]=i}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(i)?i:void 0)}};e.Ajv2020=a,t.exports=e=a,t.exports.Ajv2020=a,Object.defineProperty(e,"__esModule",{value:!0}),e.default=a;var c=ss();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var u=be();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return u._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return u.CodeGen}});var l=aa();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return l.default}});var d=is();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return d.default}})}),w1=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(x,F){return{validate:x,compare:F}}e.fullFormats={date:t(s,i),time:t(c(!0),u),"date-time":t(f(!0),m),"iso-time":t(c(),l),"iso-date-time":t(f(),h),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:y,"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:q,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:v,int32:{type:"number",validate:R},int64:{type:"number",validate:b},float:{type:"number",validate:E},double:{type:"number",validate:E},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,i),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,u),"date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,m),"iso-time":t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,l),"iso-date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,h),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},e.formatNames=Object.keys(e.fullFormats);function r(x){return x%4===0&&(x%100!==0||x%400===0)}let o=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,n=[0,31,28,31,30,31,30,31,31,30,31,30,31];function s(x){let F=o.exec(x);if(!F)return!1;let B=+F[1],H=+F[2],ge=+F[3];return H>=1&&H<=12&&ge>=1&&ge<=(H===2&&r(B)?29:n[H])}function i(x,F){if(!(x&&F))return;if(x>F)return 1;if(x<F)return-1;return 0}let a=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function c(x){return function(B){let H=a.exec(B);if(!H)return!1;let ge=+H[1],Ie=+H[2],Ne=+H[3],De=H[4],Pe=H[5]==="-"?-1:1,O=+(H[6]||0),M=+(H[7]||0);if(O>23||M>59||x&&!De)return!1;if(ge<=23&&Ie<=59&&Ne<60)return!0;let K=Ie-M*Pe,P=ge-O*Pe-(K<0?1:0);return(P===23||P===-1)&&(K===59||K===-1)&&Ne<61}}function u(x,F){if(!(x&&F))return;let B=new Date("2020-01-01T"+x).valueOf(),H=new Date("2020-01-01T"+F).valueOf();if(!(B&&H))return;return B-H}function l(x,F){if(!(x&&F))return;let B=a.exec(x),H=a.exec(F);if(!(B&&H))return;if(x=B[1]+B[2]+B[3],F=H[1]+H[2]+H[3],x>F)return 1;if(x<F)return-1;return 0}let d=/t|\s/i;function f(x){let F=c(x);return function(H){let ge=H.split(d);return ge.length===2&&s(ge[0])&&F(ge[1])}}function m(x,F){if(!(x&&F))return;let B=new Date(x).valueOf(),H=new Date(F).valueOf();if(!(B&&H))return;return B-H}function h(x,F){if(!(x&&F))return;let[B,H]=x.split(d),[ge,Ie]=F.split(d),Ne=i(B,ge);if(Ne===void 0)return;return Ne||u(H,Ie)}let g=/\/|:/,_=/^(?:[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 y(x){return g.test(x)&&_.test(x)}let S=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function v(x){return S.lastIndex=0,S.test(x)}let w=-2147483648,z=2147483647;function R(x){return Number.isInteger(x)&&x<=z&&x>=w}function b(x){return Number.isInteger(x)}function E(){return!0}let C=/[^\\]\\Z/;function q(x){if(C.test(x))return!1;try{return new RegExp(x),!0}catch(F){return!1}}}),R1=G((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;let t=eb(),r=be(),o=r.operators,n={formatMaximum:{okStr:"<=",ok:o.LTE,fail:o.GT},formatMinimum:{okStr:">=",ok:o.GTE,fail:o.LT},formatExclusiveMaximum:{okStr:"<",ok:o.LT,fail:o.GTE},formatExclusiveMinimum:{okStr:">",ok:o.GT,fail:o.LTE}},s={message:({keyword:a,schemaCode:c})=>r.str`should be ${n[a].okStr} ${c}`,params:({keyword:a,schemaCode:c})=>r._`{comparison: ${n[a].okStr}, limit: ${c}}`};e.formatLimitDefinition={keyword:Object.keys(n),type:"string",schemaType:"string",$data:!0,error:s,code(a){let{gen:c,data:u,schemaCode:l,keyword:d,it:f}=a,{opts:m,self:h}=f;if(!m.validateFormats)return;let g=new t.KeywordCxt(f,h.RULES.all.format.definition,"format");if(g.$data)_();else y();function _(){let v=c.scopeValue("formats",{ref:h.formats,code:m.code.formats}),w=c.const("fmt",r._`${v}[${g.schemaCode}]`);a.fail$data((0,r.or)(r._`typeof ${w} != "object"`,r._`${w} instanceof RegExp`,r._`typeof ${w}.compare != "function"`,S(w)))}function y(){let v=g.schema,w=h.formats[v];if(!w||w===!0)return;if(typeof w!="object"||w instanceof RegExp||typeof w.compare!="function")throw Error(`"${d}": format "${v}" does not define "compare" function`);let z=c.scopeValue("formats",{key:v,ref:w,code:m.code.formats?r._`${m.code.formats}${(0,r.getProperty)(v)}`:void 0});a.fail$data(S(z))}function S(v){return r._`${v}.compare(${u}, ${l}) ${n[d].fail} 0`}},dependencies:["format"]};let i=(a)=>(a.addKeyword(e.formatLimitDefinition),a);e.default=i}),E1=G((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0});let r=w1(),o=R1(),n=be(),s=new n.Name("fullFormats"),i=new n.Name("fastFormats"),a=(u,l={keywords:!0})=>{if(Array.isArray(l))return c(u,l,r.fullFormats,s),u;let[d,f]=l.mode==="fast"?[r.fastFormats,i]:[r.fullFormats,s];if(c(u,l.formats||r.formatNames,d,f),l.keywords)(0,o.default)(u);return u};a.get=(u,l="full")=>{let d=(l==="fast"?r.fastFormats:r.fullFormats)[u];if(!d)throw Error(`Unknown format "${u}"`);return d};function c(u,l,d,f){var m,h;(m=(h=u.opts.code).formats)!==null&&m!==void 0||(h.formats=n._`require("ajv-formats/dist/formats").${f}`);for(let g of l)u.addFormat(g,d[g])}t.exports=e=a,Object.defineProperty(e,"__esModule",{value:!0}),e.default=a}),ib=eb(),z1=d1(),P1=$1(),T1=oc(E1(),1),I1=T1.default;function Tm(e){let t=new e({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return I1(t),t}var Ml=class{_ajv;_ajvDraft7;_ajv2019;_userAjv;constructor(e){this._userAjv=e!==void 0,this._ajv=e}get ajv(){return this._ajv??=Tm(P1.Ajv2020)}_engineFor(e){if(this._userAjv)return this.ajv;let t=Wg(e,"pass a pre-configured Ajv instance to AjvJsonSchemaValidator(ajv) to validate other dialects.");if(t==="2020-12")return this.ajv;if(t==="2019-09")return this._ajv2019??=Tm(z1.Ajv2019);return this._ajvDraft7??=Tm(ib.Ajv)}getValidator(e){let t=this._engineFor(e),r="$id"in e&&typeof e.$id==="string"?t.getSchema(e.$id)??t.compile(e):t.compile(e);return(o)=>r(o)?{valid:!0,data:o,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:t.errorsText(r.errors)}}},f3=ib.Ajv;import Nm from"node:process";var hb=Symbol.for("mcp.completable");function jm(e){return!!e&&typeof e==="object"&&hb in e}function O1(e){return e[hb]?.complete}function C1(e,t){switch(t.kind){case"tools_list_changed":return e.toolsListChanged===!0;case"prompts_list_changed":return e.promptsListChanged===!0;case"resources_list_changed":return e.resourcesListChanged===!0;case"resource_updated":return e.resourceSubscriptions!==void 0&&e.resourceSubscriptions.includes(t.uri)}}function x1(e,t){let r={},o=(n)=>t===void 0||n===!0;if(e.toolsListChanged===!0&&o(t?.tools?.listChanged))r.toolsListChanged=!0;if(e.promptsListChanged===!0&&o(t?.prompts?.listChanged))r.promptsListChanged=!0;if(e.resourcesListChanged===!0&&o(t?.resources?.listChanged))r.resourcesListChanged=!0;if(e.resourceSubscriptions!==void 0&&e.resourceSubscriptions.length>0&&o(t?.resources?.subscribe))r.resourceSubscriptions=[...e.resourceSubscriptions];return r}var Ll=1024;function ab(e,t){return{method:e.method,params:{...e.params,_meta:{...e.params?._meta,[cn]:t}}}}function N1(e){let t=go(sa).validateRequest("subscriptions/listen",e);return t.ok?t.value.params?.notifications:void 0}var A1=new Set(["notifications/tools/list_changed","notifications/prompts/list_changed","notifications/resources/list_changed","notifications/resources/updated"]),gb=class{_subs=new Map;_serverCapabilities;_serverInfo;constructor(e=Ll,t,r){this._maxSubscriptions=e,this._serverCapabilities=t,this._serverInfo=r}setServerCapabilities(e,t){if(this._serverCapabilities=e,t!==void 0)this._serverInfo=t}has(e){return this._subs.has(e)}serve(e){if(this._serverCapabilities===void 0)throw Error("StdioListenRouter.serve() called before setServerCapabilities(); refusing to honor a filter without capabilities");if(this._subs.size>=this._maxSubscriptions)return{jsonrpc:"2.0",id:e.id,error:{code:-32603,message:"Subscription limit reached"}};let t=N1(e);if(t===void 0)return{jsonrpc:"2.0",id:e.id,error:{code:-32602,message:"Invalid params: 'notifications' is required and must be a valid SubscriptionFilter"}};let r=x1(t,this._serverCapabilities);return this._subs.set(e.id,r),ab({method:"notifications/subscriptions/acknowledged",params:{notifications:r}},e.id)}cancel(e){return this._subs.delete(e)}routeOutbound(e){if(!A1.has(e.method))return"passthrough";let t=e.params?.uri,r=typeof t==="string"?t:void 0,o=j1(e.method,r),n=[];for(let[s,i]of this._subs)if(C1(i,o))n.push(ab({method:e.method,params:e.params??{}},s));return n}teardownAll(){let e=[];for(let t of this._subs.keys())e.push({jsonrpc:"2.0",id:t,result:{resultType:"complete",_meta:{[cn]:t,...this._serverInfo!==void 0&&{[br]:this._serverInfo}}}});return this._subs.clear(),e}};function j1(e,t){switch(e){case"notifications/tools/list_changed":return{kind:"tools_list_changed"};case"notifications/prompts/list_changed":return{kind:"prompts_list_changed"};case"notifications/resources/list_changed":return{kind:"resources_list_changed"};default:return{kind:"resource_updated",uri:t??""}}}var q1=8,M1=600000;function L1(e){if(e?.maxRounds!==void 0&&(!Number.isInteger(e.maxRounds)||e.maxRounds<1))throw RangeError(`inputRequired.maxRounds must be a positive integer (got ${e.maxRounds})`);if(e?.roundTimeoutMs!==void 0&&(!Number.isFinite(e.roundTimeoutMs)||e.roundTimeoutMs<=0))throw RangeError(`inputRequired.roundTimeoutMs must be a positive number (got ${e.roundTimeoutMs})`);return{maxRounds:e?.maxRounds??q1,roundTimeoutMs:e?.roundTimeoutMs??M1,legacyShim:e?.legacyShim??!0}}function yb(e,t,r){if(r===null||typeof r!=="object"||typeof r.method!=="string")throw new le(Y.InternalError,`Handler for ${e} returned an invalid input request '${t}': each inputRequests entry must be an embedded elicitation/create, sampling/createMessage, or roots/list request`);let o=r,n=u0(o);if(n===void 0)throw new le(Y.InternalError,`Handler for ${e} returned an input request '${t}' of kind '${o.method}', which is not an embedded request the 2026-07-28 revision defines`);return{embedded:o,required:n}}function D1(){let e=globalThis.crypto;if(e?.randomUUID!==void 0)return e.randomUUID();let t=new Uint8Array(16);e.getRandomValues(t),t[6]=t[6]&15|64,t[8]=t[8]&63|128;let r=[...t].map((o)=>o.toString(16).padStart(2,"0")).join("");return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20)}`}function Am(e,t){if(e==="tools/call")return{content:[{type:"text",text:t}],isError:!0};throw new le(Y.InternalError,t)}var U1=class{constructor(e){this._host=e}async fulfill(e,t,r,o,n){let{maxRounds:s,roundTimeoutMs:i}=this._host,a=o.mcpReq.signal,c=n,u=0;while(!0){if(u+=1,u>s)return Am(e,k0(e,s));let l=c.inputRequests,d=l!=null&&Object.keys(l).length>0,f=typeof c.requestState==="string"?c.requestState:void 0;if(!d&&f===void 0)throw new le(Y.InternalError,`Handler for ${e} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);let m;if(d){let _=this._host.resolvedClientCapabilities(o),y=[];for(let[v,w]of Object.entries(l)){let{embedded:z,required:R}=yb(e,v,w);if(z.method!=="roots/list"&&z.params===void 0)throw new le(Y.InternalError,`Handler for ${e} returned an input request '${v}' of kind '${z.method}' without params`);if(wl(R,_)!==void 0)return Am(e,`Cannot request input '${v}' (${z.method}): the client on this 2025-era connection did not declare the required capability${_===void 0?" (no client capabilities are available on this connection — per-request legacy serving cannot receive server-to-client requests)":""}`);y.push([v,z])}let S=C0(a);try{let v={relatedRequestId:o.mcpReq.id,timeout:i,resetTimeoutOnProgress:!0,onprogress:()=>{},signal:S.signal},w=await Promise.all(y.map(async([z,R])=>{try{return[z,await this._dispatchLeg(R,v)]}catch(b){throw S.abort(b),b}}));m=Object.fromEntries(w)}catch(v){if(a.aborted)throw v;return Am(e,`Fulfilling input required by '${e}' failed: ${v instanceof Error?v.message:String(v)}`)}finally{S.dispose()}}else await O0(I0,a);let h={...o,mcpReq:{...o.mcpReq,inputResponses:m,droppedInputResponseKeys:void 0,requestState:ia(f)}};if(f!==void 0){let _=await this._host.verifyRequestState(f,h,e);if(_!==void 0)h=bm(h,_)}let g=await t(r,h);if(!Gr(g))return g;c=g}}async _dispatchLeg(e,t){switch(e.method){case"elicitation/create":{let r=e.params;if(r.mode==="url"&&r.elicitationId===void 0)r={...r,elicitationId:D1()};return await this._host.sendElicitation(r,t)}case"sampling/createMessage":return await this._host.sendSampling(e.params,t);case"roots/list":return await this._host.listRoots(e.params,t)}}},F1=new Set(["tools/call","prompts/get","resources/read"]),V1,_b,vb;function qm(e,t){_b(e,t)}function Mm(e){return vb(e)}var Sb=class extends wm{_clientCapabilities;_clientVersion;static{V1=(e,t)=>{if(t.clientCapabilities!==void 0)e._clientCapabilities=t.clientCapabilities;if(t.clientInfo!==void 0)e._clientVersion=t.clientInfo},_b=(e,t)=>{let r=t.filter((o)=>!e._supportedProtocolVersions.includes(o));if(r.length>0)e._supportedProtocolVersions=[...e._supportedProtocolVersions,...r];e.setRequestHandler("server/discover",()=>e._ondiscover())},vb=(e)=>e._serverInfo}_capabilities;_instructions;_jsonSchemaValidator;_cacheHints;_requestStateVerify;_inputRequiredServing;_legacyShim;_legacyInputRequiredShim(){return this._legacyShim??=new U1({maxRounds:this._inputRequiredServing.maxRounds,roundTimeoutMs:this._inputRequiredServing.roundTimeoutMs,resolvedClientCapabilities:(e)=>this._inputRequestCapabilityView(e),verifyRequestState:(e,t,r)=>this._verifyRequestState(e,t,r),sendElicitation:(e,t)=>this._sendElicitationLeg(e,t,{validateAcceptedContent:!1}),sendSampling:(e,t)=>this.createMessage(e,t),listRoots:(e,t)=>this.listRoots(e,t)})}oninitialized;constructor(e,t){super(t);if(this._serverInfo=e,this._capabilities=t?.capabilities?{...t.capabilities}:{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new Ml,this._requestStateVerify=t?.requestState?.verify,this._inputRequiredServing=L1(t?.inputRequired),t?.cacheHints!==void 0){for(let[r,o]of Object.entries(t.cacheHints))if(o!==void 0)pm(o,`cacheHints['${r}']`);this._cacheHints=t.cacheHints}if(this.setRequestHandler("initialize",(r)=>this._oninitialize(r)),this.setNotificationHandler("notifications/initialized",()=>this.oninitialized?.()),im(this._supportedProtocolVersions).length>0)this.setRequestHandler("server/discover",()=>this._ondiscover());if(this._capabilities.logging)this._registerLoggingHandler()}_registerLoggingHandler(){this.setRequestHandler("logging/setLevel",async(e,t)=>{let r=t.sessionId||t.http?.req?.headers.get("mcp-session-id")||void 0,{level:o}=e.params,n=Ol(mo,o);if(n.success)this._loggingLevels.set(r,n.data);return{}})}buildContext(e,t){let r=e.http||t?.request||t?.closeSSEStream||t?.closeStandaloneSSEStream;return{...e,mcpReq:{...e.mcpReq,log:(o,n,s)=>{if(!this._capabilities.logging)return Promise.resolve();let i;if(this._servedModernEra()){if(i=e.mcpReq.envelope?.[ao],i===void 0)return Promise.resolve()}else i=this._loggingLevels.get(e.sessionId)??this._loggingLevels.get(void 0);if(i!==void 0&&this.LOG_LEVEL_SEVERITY.get(o)<this.LOG_LEVEL_SEVERITY.get(i))return Promise.resolve();return e.mcpReq.notify({method:"notifications/message",params:{level:o,data:n,logger:s}})},elicitInput:(o,n)=>this.elicitInput(o,n),requestSampling:(o,n)=>this.createMessage(o,n)},http:r?{...e.http,req:t?.request,closeSSE:t?.closeSSEStream,closeStandaloneSSE:t?.closeStandaloneSSEStream}:void 0}}_loggingLevels=new Map;LOG_LEVEL_SEVERITY=new Map(mo.options.map((e,t)=>[e,t]));isMessageIgnored=(e,t)=>{let r=this._loggingLevels.get(t);return r?this.LOG_LEVEL_SEVERITY.get(e)<this.LOG_LEVEL_SEVERITY.get(r):!1};registerCapabilities(e){if(this.transport)throw new Se(Te.AlreadyConnected,"Cannot register capabilities after connecting to transport");let t=!!this._capabilities.logging;if(this._capabilities=Rm(this._capabilities,e),!t&&this._capabilities.logging)this._registerLoggingHandler()}_wrapHandler(e,t){if(e!=="tools/call"){let r=this._cacheHints?.[e],o=F1.has(e);if(r===void 0&&!o)return async(n,s)=>{let i=await t(n,s);if(Gr(i))throw new le(Y.InternalError,`Handler for ${e} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return i};return async(n,s)=>{let i=o?await this._invokeInputRequiredCapableHandler(e,t,n,s):await t(n,s);if(Gr(i)){if(!o)throw new le(Y.InternalError,`Handler for ${e} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return i}return r===void 0?i:Rl(i,r)}}return async(r,o)=>{let n=go(this._negotiatedProtocolVersion),s=n.validateRequest("tools/call",r);if(!s.ok)throw new le(s.reason==="not-in-era"?Y.InternalError:Y.InvalidParams,s.reason==="not-in-era"?"No wire schema for tools/call in the resolved era":`Invalid tools/call request: ${s.message}`);let i=await this._invokeInputRequiredCapableHandler("tools/call",t,r,o);if(Gr(i))return i;let a=am(i),c=n.validateResult("tools/call",a);if(!c.ok)throw new le(c.reason==="not-in-era"?Y.InternalError:Y.InvalidParams,c.reason==="not-in-era"?"No wire schema for tools/call in the resolved era":`Invalid tools/call result: ${c.message}`);return c.value}}_servedModernEra(){return this._negotiatedProtocolVersion!==void 0&&os(this._negotiatedProtocolVersion)}async _invokeInputRequiredCapableHandler(e,t,r,o){let n=this._servedModernEra(),s=o.mcpReq.requestState();if(s!==void 0&&typeof s!=="string")throw new le(Y.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"});let i=o;if(typeof s==="string"){let d=await this._verifyRequestState(s,o,e);if(d!==void 0)i=bm(o,d)}let a;try{a=await t(r,i)}catch(d){if(d instanceof le&&d.code===Y.UrlElicitationRequired){if(!n)throw d;throw new le(Y.InternalError,`URL elicitation cannot be signalled by throwing UrlElicitationRequiredError on protocol revision ${this._negotiatedProtocolVersion}: return inputRequired({ inputRequests: { …: inputRequired.elicitUrl(...) } }) from the handler instead. The urlElicitationRequired error (-32042) of earlier revisions is not available on this revision.`)}throw d}if(!Gr(a))return a;if(!n){if(!this._inputRequiredServing.legacyShim)throw new le(Y.InternalError,`Handler for ${e} returned an input-required result, but this request is served on protocol revision ${this._negotiatedProtocolVersion??an}, which has no input_required vocabulary`);return await this._legacyInputRequiredShim().fulfill(e,t,r,i,a)}let c=a.inputRequests,u=c!=null&&Object.keys(c).length>0,l=typeof a.requestState==="string";if(!u&&!l)throw new le(Y.InternalError,`Handler for ${e} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);if(u){let d=this._inputRequestCapabilityView(o);for(let[f,m]of Object.entries(c)){let{embedded:h,required:g}=yb(e,f,m),_=wl(g,d);if(_!==void 0)throw new zl({requiredCapabilities:_},`Cannot request input '${f}' (${h.method}): the request's client capabilities do not declare the required capability`)}}return a}async _verifyRequestState(e,t,r){if(this._requestStateVerify===void 0)return;try{return await this._requestStateVerify(e,t)}catch(o){throw this.onerror?.(Error(`requestState verification rejected ${r}: ${o instanceof Error?o.message:String(o)}`)),new le(Y.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"})}}_inputRequestCapabilityView(e){return this._servedModernEra()?e.mcpReq.envelope?.[Zr]:this._clientCapabilities}_assertPushApiInServedEra(e){if(this._servedModernEra())throw new Se(Te.MethodNotSupportedByProtocolVersion,`Server-to-client requests are not available on protocol revision ${this._negotiatedProtocolVersion}: '${e}' cannot be sent while serving a request on that revision. Return inputRequired({ ... }) from the handler instead — the client fulfils the embedded requests and retries the original request (multi round-trip requests).`,{method:e,era:"2026-07-28"})}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Se(Te.CapabilityNotSupported,`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Se(Te.CapabilityNotSupported,`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Se(Te.CapabilityNotSupported,`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 new Se(Te.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Se(Te.CapabilityNotSupported,`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Se(Te.CapabilityNotSupported,`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Se(Te.CapabilityNotSupported,`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Se(Te.CapabilityNotSupported,`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"completion/complete":if(!this._capabilities.completions)throw new Se(Te.CapabilityNotSupported,`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Se(Te.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Se(Te.CapabilityNotSupported,`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Se(Te.CapabilityNotSupported,`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Se(Te.CapabilityNotSupported,`Server does not support tools (required for ${e})`);break;case"ping":case"initialize":break}}async _oninitialize(e){let t=e.params.protocolVersion;this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo;let r=d0(this._supportedProtocolVersions),o=r.includes(t)?t:r[0]??an;return this._negotiatedProtocolVersion=o,this.transport?.setProtocolVersion?.(o),{protocolVersion:o,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}_ondiscover(){return{supportedVersions:im(this._supportedProtocolVersions),capabilities:Z1(this.getCapabilities()),...this._instructions&&{instructions:this._instructions}}}_outboundServerInfo(){return this._serverInfo}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getNegotiatedProtocolVersion(){return this._negotiatedProtocolVersion}projectCallToolResult(e,t){return this._wireCodec().projectCallToolResult(e,t)}getCapabilities(){return this._capabilities}async ping(){return this._assertPushApiInServedEra("ping"),this.request({method:"ping"})}async createMessage(e,t){if(this._assertPushApiInServedEra("sampling/createMessage"),(e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Se(Te.CapabilityNotSupported,"Client does not support sampling tools capability.");if(e.messages.length>0){let s=e.messages.at(-1),i=Array.isArray(s.content)?s.content:[s.content],a=i.some((d)=>d.type==="tool_result"),c=e.messages.length>1?e.messages.at(-2):void 0,u=c?Array.isArray(c.content)?c.content:[c.content]:[],l=u.some((d)=>d.type==="tool_use");if(a){if(i.some((d)=>d.type!=="tool_result"))throw new le(Y.InvalidParams,"The last message must contain only tool_result content if any is present");if(!l)throw new le(Y.InvalidParams,"tool_result blocks are not matching any tool_use from the previous message")}if(l){let d=new Set(u.filter((m)=>m.type==="tool_use").map((m)=>m.id)),f=new Set(i.filter((m)=>m.type==="tool_result").map((m)=>m.toolUseId));if(d.size!==f.size||![...d].every((m)=>f.has(m)))throw new le(Y.InvalidParams,"ids of tool_result blocks and tool_use blocks from previous message do not match")}}let r=Boolean(e.tools||e.toolChoice),o=await this.request({method:"sampling/createMessage",params:e},t),n=this._wireCodec().samplingResultVariant(r,o);if(!n.ok)throw new Se(Te.InvalidResult,`Invalid sampling/createMessage result: ${n.reason==="invalid"?n.message:n.reason}`);return n.value}async elicitInput(e,t){switch(this._assertPushApiInServedEra("elicitation/create"),e.mode??"form"){case"url":if(!this._clientCapabilities?.elicitation?.url)throw new Se(Te.CapabilityNotSupported,"Client does not support url elicitation.");break;case"form":if(!this._clientCapabilities?.elicitation?.form)throw new Se(Te.CapabilityNotSupported,"Client does not support form elicitation.");break}return this._sendElicitationLeg(e,t)}async _sendElicitationLeg(e,t,r){let o=e.mode??"form",n=r?.validateAcceptedContent??!0;switch(o){case"url":{let s=e;return this.request({method:"elicitation/create",params:s},t)}case"form":{let s=e.mode==="form"?e:{...e,mode:"form"},i=await this.request({method:"elicitation/create",params:s},t);if(n&&i.action==="accept"&&i.content&&s.requestedSchema)try{let a=this._jsonSchemaValidator.getValidator(s.requestedSchema)(i.content);if(!a.valid)throw new le(Y.InvalidParams,`Elicitation response content does not match requested schema: ${a.errorMessage}`)}catch(a){if(a instanceof le)throw a;throw new le(Y.InternalError,`Error validating elicitation response: ${a instanceof Error?a.message:String(a)}`)}return i}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw new Se(Te.CapabilityNotSupported,"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._assertPushApiInServedEra("roots/list"),this.request({method:"roots/list",params:e},t)}async sendLoggingMessage(e,t){if(this._capabilities.logging&&!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"})}};function Z1(e){return{...e}}var ua=class{server;_registeredResources={};_registeredResourceTemplates={};_registeredTools={};_registeredPrompts={};_toolInputSchemaJson={};toolInputSchemaJson(e){let t=this._registeredTools[e];if(t===void 0||!t.enabled)return;if(Object.hasOwn(this._toolInputSchemaJson,e))return this._toolInputSchemaJson[e];if(t.inputSchema===void 0)return ub;try{let r=vo(t.inputSchema,"input");return this._toolInputSchemaJson[e]=r,r}catch{return}}constructor(e,t){if(this.server=new Sb(e,t),t?.capabilities?.tools)this.setToolRequestHandlers();if(t?.capabilities?.resources)this.setResourceRequestHandlers();if(t?.capabilities?.prompts)this.setPromptRequestHandlers()}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}_toolHandlersInitialized=!1;setToolRequestHandlers(){if(this._toolHandlersInitialized)return;this.server.assertCanSetRequestHandler("tools/list"),this.server.assertCanSetRequestHandler("tools/call"),this.server.registerCapabilities({tools:{listChanged:this.server.getCapabilities().tools?.listChanged??!0}}),this.server.setRequestHandler("tools/list",()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,t])=>{let r={name:e,title:t.title,description:t.description,inputSchema:t.inputSchema?vo(t.inputSchema,"input"):ub,annotations:t.annotations,icons:t.icons,execution:t.execution,_meta:t._meta};if(t.outputSchema)r.outputSchema=vo(t.outputSchema,"output");return r})})),this.server.setRequestHandler("tools/call",async(e,t)=>{let r=this._registeredTools[e.params.name];if(!r)throw new le(Y.InvalidParams,`Tool ${e.params.name} not found`);if(!r.enabled)throw new le(Y.InvalidParams,`Tool ${e.params.name} disabled`);try{let o=await this.validateToolInput(r,e.params.arguments,e.params.name),n=await this.executeToolHandler(r,o,t);if(await this.validateToolOutput(r,n,e.params.name),Gr(n))return n;return this.server.projectCallToolResult(n,r.outputSchemaJson)}catch(o){if(o instanceof le&&o.code===Y.UrlElicitationRequired)throw o;return this.createToolError(o instanceof Error?o.message:String(o))}}),this._toolHandlersInitialized=!0}createToolError(e){return{content:[{type:"text",text:e}],isError:!0}}async validateToolInput(e,t,r){if(!e.inputSchema)return;let o=await dn(e.inputSchema,t??{});if(!o.success)throw new le(Y.InvalidParams,`Input validation error: Invalid arguments for tool ${r}: ${o.error}`);return o.data}async validateToolOutput(e,t,r){if(!e.outputSchema)return;if(Gr(t))return;if(t.isError)return;if(t.structuredContent===void 0)throw new le(Y.InvalidParams,`Output validation error: Tool ${r} has an output schema but no structured content was provided`);let o=await dn(e.outputSchema,t.structuredContent);if(!o.success)throw new le(Y.InvalidParams,`Output validation error: Invalid structured content for tool ${r}: ${o.error}`)}async executeToolHandler(e,t,r){return e.executor(t,r)}_completionHandlerInitialized=!1;setCompletionRequestHandler(){if(this._completionHandlerInitialized)return;this.server.assertCanSetRequestHandler("completion/complete"),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler("completion/complete",async(e)=>{switch(e.params.ref.type){case"ref/prompt":return hm(e),this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return gm(e),this.handleResourceCompletion(e,e.params.ref);default:throw new le(Y.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0}async handlePromptCompletion(e,t){let r=this._registeredPrompts[t.name];if(!r)throw new le(Y.InvalidParams,`Prompt ${t.name} not found`);if(!r.enabled)throw new le(Y.InvalidParams,`Prompt ${t.name} disabled`);if(!r.argsSchema)return ca;let o=mb(fb(r.argsSchema)?.[e.params.argument.name]);if(!jm(o))return ca;let n=O1(o);if(!n)return ca;return pb(await n(e.params.argument.value,e.params.context))}async handleResourceCompletion(e,t){let r=Object.values(this._registeredResourceTemplates).find((n)=>n.resourceTemplate.uriTemplate.toString()===t.uri);if(!r){if(this._registeredResources[t.uri])return ca;throw new le(Y.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let o=r.resourceTemplate.completeCallback(e.params.argument.name);if(!o)return ca;return pb(await o(e.params.argument.value,e.params.context))}_resourceHandlersInitialized=!1;setResourceRequestHandlers(){if(this._resourceHandlersInitialized)return;this.server.assertCanSetRequestHandler("resources/list"),this.server.assertCanSetRequestHandler("resources/templates/list"),this.server.assertCanSetRequestHandler("resources/read"),this.server.registerCapabilities({resources:{listChanged:this.server.getCapabilities().resources?.listChanged??!0}}),this.server.setRequestHandler("resources/list",async(e,t)=>{let r=Object.entries(this._registeredResources).filter(([n,s])=>s.enabled).map(([n,s])=>({uri:n,name:s.name,...s.metadata})),o=[];for(let n of Object.values(this._registeredResourceTemplates)){if(!n.resourceTemplate.listCallback)continue;let s=await n.resourceTemplate.listCallback(t);for(let i of s.resources)o.push({...n.metadata,...i})}return{resources:[...r,...o]}}),this.server.setRequestHandler("resources/templates/list",async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([e,t])=>({name:e,uriTemplate:t.resourceTemplate.uriTemplate.toString(),...t.metadata}))})),this.server.setRequestHandler("resources/read",async(e,t)=>{let r;try{r=new URL(e.params.uri)}catch{throw new le(Y.InvalidParams,`Resource URI ${e.params.uri} is invalid`,{uri:e.params.uri,reason:"invalid_uri"})}let o=this._registeredResources[r.toString()];if(o){if(!o.enabled)throw new le(Y.InvalidParams,`Resource ${r} disabled`);return Rl(await o.readCallback(r,t),o.cacheHint)}for(let n of Object.values(this._registeredResourceTemplates)){let s=n.resourceTemplate.uriTemplate.match(r.toString());if(s)return Rl(await n.readCallback(r,s,t),n.cacheHint)}throw new El(e.params.uri)}),this._resourceHandlersInitialized=!0}_promptHandlersInitialized=!1;setPromptRequestHandlers(){if(this._promptHandlersInitialized)return;this.server.assertCanSetRequestHandler("prompts/list"),this.server.assertCanSetRequestHandler("prompts/get"),this.server.registerCapabilities({prompts:{listChanged:this.server.getCapabilities().prompts?.listChanged??!0}}),this.server.setRequestHandler("prompts/list",()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,t])=>({name:e,title:t.title,description:t.description,arguments:t.argsSchema?T0(t.argsSchema):void 0,icons:t.icons,_meta:t._meta}))})),this.server.setRequestHandler("prompts/get",async(e,t)=>{let r=this._registeredPrompts[e.params.name];if(!r)throw new le(Y.InvalidParams,`Prompt ${e.params.name} not found`);if(!r.enabled)throw new le(Y.InvalidParams,`Prompt ${e.params.name} disabled`);return r.handler(e.params.arguments,t)}),this._promptHandlersInitialized=!0}registerResource(e,t,r,o){let n=r.cacheHint,s=r;if(n!==void 0){pm(n,`resource ${e}`);let i={...r};delete i.cacheHint,s=i}if(typeof t==="string"){if(this._registeredResources[t])throw Error(`Resource ${t} is already registered`);let i=this._createRegisteredResource(e,r.title,t,s,o);if(n!==void 0)i.cacheHint=n;return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}else{if(this._registeredResourceTemplates[e])throw Error(`Resource template ${e} is already registered`);let i=this._createRegisteredResourceTemplate(e,r.title,t,s,o);if(n!==void 0)i.cacheHint=n;return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}}_createRegisteredResource(e,t,r,o,n){let s={name:e,title:t,metadata:o,readCallback:n,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({uri:null}),update:(i)=>{if(i.uri!==void 0&&i.uri!==r){if(delete this._registeredResources[r],i.uri)this._registeredResources[i.uri]=s}if(i.name!==void 0)s.name=i.name;if(i.title!==void 0)s.title=i.title;if(i.metadata!==void 0)s.metadata=i.metadata;if(i.callback!==void 0)s.readCallback=i.callback;if(i.enabled!==void 0)s.enabled=i.enabled;this.sendResourceListChanged()}};return this._registeredResources[r]=s,s}_createRegisteredResourceTemplate(e,t,r,o,n){let s={resourceTemplate:r,title:t,metadata:o,readCallback:n,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({name:null}),update:(a)=>{if(a.name!==void 0&&a.name!==e){if(delete this._registeredResourceTemplates[e],a.name)this._registeredResourceTemplates[a.name]=s}if(a.title!==void 0)s.title=a.title;if(a.template!==void 0)s.resourceTemplate=a.template;if(a.metadata!==void 0)s.metadata=a.metadata;if(a.callback!==void 0)s.readCallback=a.callback;if(a.enabled!==void 0)s.enabled=a.enabled;this.sendResourceListChanged()}};this._registeredResourceTemplates[e]=s;let i=r.uriTemplate.variableNames;if(Array.isArray(i)&&i.some((a)=>!!r.completeCallback(a)))this.setCompletionRequestHandler();return s}_createRegisteredPrompt(e,t,r,o,n,s,i){let a=o,c=n,u={title:t,description:r,argsSchema:o,icons:s,_meta:i,handler:db(e,o,n),enabled:!0,disable:()=>u.update({enabled:!1}),enable:()=>u.update({enabled:!0}),remove:()=>u.update({name:null}),update:(l)=>{if(l.name!==void 0&&l.name!==e){if(delete this._registeredPrompts[e],l.name)this._registeredPrompts[l.name]=u}if(l.title!==void 0)u.title=l.title;if(l.description!==void 0)u.description=l.description;if(l.icons!==void 0)u.icons=l.icons;if(l._meta!==void 0)u._meta=l._meta;let d=!1;if(l.argsSchema!==void 0)u.argsSchema=l.argsSchema,a=l.argsSchema,d=!0;if(l.callback!==void 0)c=l.callback,d=!0;if(d)u.handler=db(e,a,c);if(l.enabled!==void 0)u.enabled=l.enabled;this.sendPromptListChanged()}};if(this._registeredPrompts[e]=u,o){let l=fb(o);if(l){if(Object.values(l).some((d)=>jm(mb(d))))this.setCompletionRequestHandler()}}return u}_createRegisteredTool(e,t,r,o,n,s,i,a,c,u){if(Pm(e),o!==void 0)try{let f=vo(o,"input");this._toolInputSchemaJson[e]=f;let m=ym(f);if(!m.valid)console.warn(`[mcp-sdk] tool '${e}' carries an invalid x-mcp-header declaration and will be excluded by conforming Streamable HTTP clients: ${m.reason}`)}catch{}let l=u,d={title:t,description:r,inputSchema:o,outputSchema:n,outputSchemaJson:lb(n),annotations:s,icons:i,execution:a,_meta:c,handler:u,executor:cb(o,u),enabled:!0,disable:()=>d.update({enabled:!1}),enable:()=>d.update({enabled:!0}),remove:()=>d.update({name:null}),update:(f)=>{if(f.name!==void 0&&f.name!==e){if(typeof f.name==="string")Pm(f.name);if(delete this._registeredTools[e],delete this._toolInputSchemaJson[e],f.name)delete this._toolInputSchemaJson[f.name],this._registeredTools[f.name]=d,e=f.name}if(f.title!==void 0)d.title=f.title;if(f.description!==void 0)d.description=f.description;let m=!1;if(f.paramsSchema!==void 0)d.inputSchema=f.paramsSchema,delete this._toolInputSchemaJson[e],m=!0;if(f.callback!==void 0)d.handler=f.callback,l=f.callback,m=!0;if(m)d.executor=cb(d.inputSchema,l);if(f.outputSchema!==void 0)d.outputSchema=f.outputSchema,d.outputSchemaJson=lb(f.outputSchema);if(f.annotations!==void 0)d.annotations=f.annotations;if(f.icons!==void 0)d.icons=f.icons;if(f._meta!==void 0)d._meta=f._meta;if(f.enabled!==void 0)d.enabled=f.enabled;this.sendToolListChanged()}};return this._registeredTools[e]=d,this.setToolRequestHandlers(),this.sendToolListChanged(),d}registerTool(e,t,r){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let{title:o,description:n,inputSchema:s,outputSchema:i,annotations:a,icons:c,_meta:u}=t;return this._createRegisteredTool(e,o,n,Cl(s),Cl(i),a,c,void 0,u,r)}registerPrompt(e,t,r){if(this._registeredPrompts[e])throw Error(`Prompt ${e} is already registered`);let{title:o,description:n,argsSchema:s,icons:i,_meta:a}=t,c=this._createRegisteredPrompt(e,o,n,Cl(s),r,i,a);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),c}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(e,t){return this.server.sendLoggingMessage(e,t)}sendResourceListChanged(){if(this.isConnected())this.server.sendResourceListChanged()}sendToolListChanged(){if(this.isConnected())this.server.sendToolListChanged()}sendPromptListChanged(){if(this.isConnected())this.server.sendPromptListChanged()}};function cb(e,t){if(e){let o=t;return async(n,s)=>o(n,s)}let r=t;return async(o,n)=>r(n)}var ub={type:"object",properties:{}};function lb(e){if(e===void 0)return;try{return vo(e,"output")}catch{return}}function db(e,t,r){if(t){let o=r;return async(n,s)=>{let i=await dn(t,n);if(!i.success)throw new le(Y.InvalidParams,`Invalid arguments for prompt ${e}: ${i.error}`);return o(i.data,s)}}else{let o=r;return async(n,s)=>o(s)}}function pb(e){return{completion:{values:e.map(String).slice(0,100),total:e.length,hasMore:e.length>100}}}var ca={completion:{values:[],hasMore:!1}};function fb(e){let t=e;if(t.shape&&typeof t.shape==="object")return t.shape}function H1(e){return e?.type==="optional"}function mb(e){if(!H1(e))return e;return e.def?.innerType??e}var G1=class{_readBuffer;_started=!1;_closed=!1;constructor(e=Nm.stdin,t=Nm.stdout,r){this._stdin=e,this._stdout=t,this._readBuffer=new Em({maxBufferSize:r?.maxBufferSize})}onclose;onerror;onmessage;_ondata=(e)=>{try{this._readBuffer.append(e),this.processReadBuffer()}catch(t){this.onerror?.(t),this.close().catch(()=>{})}};_onerror=(e)=>{this.onerror?.(e)};_onstdouterror=(e)=>{this.onerror?.(e),this.close().catch(()=>{})};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),this._stdout.on("error",this._onstdouterror)}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._closed)return;if(this._closed=!0,this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdout.off("error",this._onstdouterror),this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),this.onclose?.()}send(e){if(this._closed)return Promise.reject(Error("StdioServerTransport is closed"));return new Promise((t,r)=>{let o=zm(e),n=!1,s=(a)=>{if(n)return;n=!0,this._stdout.off("error",s),this._stdout.off("drain",i),r(a)},i=()=>{if(n)return;n=!0,this._stdout.off("error",s),this._stdout.off("drain",i),t()};if(this._stdout.once("error",s),this._stdout.write(o)){if(n)return;n=!0,this._stdout.off("error",s),t()}else if(!n)this._stdout.once("drain",i)})}},bb=3000,J1=class{onclose;onerror;onmessage;_closed=!1;_pendingRequests=new Set;_drainWaiters=[];constructor(e,t,r){this._wire=e,this._onInstanceClose=t,this._outboundIntercept=r}async start(){}async send(e,t){if(oa(e)||kl(e)){let{id:r}=e;if(r!==void 0)this._settle(r)}if(this._closed)return;if(this._outboundIntercept?.(e)==="handled")return;return this._wire.send(e,t)}setProtocolVersion=(e)=>{this._wire.setProtocolVersion?.(e)};deliver(e,t){if(this._closed)return;if(er(e))this._pendingRequests.add(e.id);else if(_o(e)&&e.method==="notifications/cancelled"){let r=e.params?.requestId;if(r!==void 0)this._settle(r)}this.onmessage?.(e,t)}async whenRequestsAnswered(e){if(this._closed||this._pendingRequests.size===0)return!0;return await new Promise((t)=>{let r=()=>{clearTimeout(o),t(!0)},o=setTimeout(()=>{this._drainWaiters=this._drainWaiters.filter((n)=>n!==r),t(!1)},e);this._drainWaiters.push(r)})}async close(){if(this._closed)return;this._closed=!0,this._pendingRequests.clear(),this._releaseDrainWaiters();try{this._onInstanceClose()}finally{this.onclose?.()}}_settle(e){if(this._pendingRequests.delete(e),this._pendingRequests.size===0)this._releaseDrainWaiters()}_releaseDrainWaiters(){let e=this._drainWaiters;this._drainWaiters=[];for(let t of e)t()}};function K1(e){let t=e.params;if(e.method==="initialize"&&!_m(t)){let s=t!==null&&typeof t==="object"&&typeof t.protocolVersion==="string"?t.protocolVersion:void 0;return{kind:"legacy",reason:"initialize",...s!==void 0&&{requestedVersion:s}}}if(!Pl(t))return{kind:"legacy",reason:"no-claim"};let r=fn(t),o=(r===void 0?[]:Il(r))[0];if(o!==void 0)return{kind:"invalid-envelope",issue:o};let n=Tl(t);if(n===void 0||!yo.includes(n))return{kind:"unsupported-revision",requested:n??"unknown"};return{kind:"modern",revision:n,classification:{era:"modern",revision:n}}}function $b(e,t={}){let r=t.legacy??"serve",o=t.transport??new G1,n={phase:"opening"},s,i=!1,a=()=>i||n.phase==="closed",c=(E)=>{try{t.onerror?.(E)}catch{}},u=(E,C,q,x)=>o.send({jsonrpc:"2.0",id:E,error:{code:C,message:q,...x!==void 0&&{data:x}}}).catch((F)=>c(mr(F))),l=new gb(t.maxSubscriptions??Ll),d=(E)=>{if(!_o(E))return;let C=l.routeOutbound(E);if(C==="passthrough")return;for(let q of C)o.send({jsonrpc:"2.0",...q}).catch((x)=>c(mr(x)));return"handled"},f=async(E)=>{if(er(E)&&E.method==="subscriptions/listen"){let C=fn(E.params),q=Pl(E.params)?(C===void 0?[]:Il(C))[0]:{key:"_meta",problem:"the per-request envelope is required on protocol revision 2026-07-28"},x=Tl(E.params),F;if(q!==void 0)F={jsonrpc:"2.0",id:E.id,error:{code:-32602,message:`Invalid _meta envelope: ${q.key}: ${q.problem}`}};else if(x===void 0||!yo.includes(x)){let B=new ns({supported:[...yo],requested:x??"unknown"});F={jsonrpc:"2.0",id:E.id,error:{code:B.code,message:B.message,data:B.data}}}else F=l.serve(E);return await o.send("error"in F?F:{jsonrpc:"2.0",method:F.method,params:F.params}).catch((B)=>c(mr(B))),!0}if(_o(E)&&E.method==="notifications/cancelled"){let C=E.params?.requestId;if(C!==void 0&&l.cancel(C))return!0}return!1},m=(E,C,q)=>{let x=vm({kind:"legacy",reason:C,...q!==void 0&&{requestedVersion:q}},yo);if(x===void 0)return Promise.resolve();return c(Error(`Rejected 2025-era request on a modern-only stdio connection (${x.cell}): ${x.message}`)),u(E.id,x.code,x.message,x.data)},h=(E)=>{if(i||E===s)return;R()},g=async(E,C)=>{let q=await e({era:E}),x=q instanceof ua?q.server:q;if(E==="modern")$m(x,C),qm(x,yo),l.setServerCapabilities(x.getCapabilities(),Mm(x));let F=new J1(o,()=>h(F),E==="modern"?d:void 0);return await q.connect(F),{product:q,channel:F}},_=(E)=>E.product.close().catch((C)=>c(mr(C))),y=async(E)=>{s=E.channel;try{if(!await E.channel.whenRequestsAnswered(bb))c(Error(`Discarded the probe instance with requests still unanswered after ${bb}ms; continuing with the fallback`));await E.product.close()}catch(C){c(mr(C))}finally{s=void 0}},S=async(E)=>{if(n.phase==="closed")return;if(n.phase==="pinned"){if(n.era==="modern"&&er(E)&&E.method==="initialize"&&!_m(E.params)){await m(E,"initialize",E.params!==null&&typeof E.params==="object"&&typeof E.params.protocolVersion==="string"?E.params.protocolVersion:void 0);return}if(n.era==="modern"&&await f(E))return;n.instance.channel.deliver(E);return}if(!er(E)&&!_o(E)){c(Error("Discarded a JSON-RPC response received before the connection negotiated an era"));return}let C=K1(E);switch(C.kind){case"invalid-envelope":{let q=`Invalid _meta envelope for protocol revision 2026-07-28: ${C.issue.key}: ${C.issue.problem}`;if(er(E))await u(E.id,Y.InvalidParams,q,{envelope:C.issue});else c(Error(`Discarded a notification with a malformed envelope: ${q}`));return}case"unsupported-revision":if(er(E)){let q=new ns({supported:[...yo],requested:C.requested});c(q),await u(E.id,q.code,q.message,q.data)}else c(Error(`Discarded a notification claiming unsupported protocol revision ${C.requested}`));return;case"modern":if(er(E)&&E.method==="server/discover"){if(n.phase==="probe"){n.instance.channel.deliver(E,{classification:C.classification});return}let q=await g("modern",C.revision);if(a()){await _(q);return}n={phase:"probe",instance:q},q.channel.deliver(E,{classification:C.classification});return}if(n.phase==="probe"){if(_o(E)){n.instance.channel.deliver(E,{classification:C.classification});return}n={phase:"pinned",era:"modern",instance:n.instance}}else{let q=await g("modern",C.revision);if(a()){await _(q);return}n={phase:"pinned",era:"modern",instance:q}}if(await f(E))return;n.instance.channel.deliver(E,{classification:C.classification});return;case"legacy":{if(r==="reject"){if(er(E))await m(E,C.reason,C.requestedVersion);return}if(n.phase==="probe"){if(await y(n.instance),a())return;n={phase:"opening"}}let q=await g("legacy");if(a()){await _(q);return}n={phase:"pinned",era:"legacy",instance:q},n.instance.channel.deliver(E);return}}},v=[],w=!1,z=async()=>{if(w)return;w=!0;try{while(v.length>0){let E=v.shift();try{await S(E)}catch(C){if(er(E))await u(E.id,Y.InternalError,"Internal server error");c(mr(C))}}}finally{w=!1}},R=async()=>{if(i||n.phase==="closed")return;i=!0;let E=n;n={phase:"closed"};for(let C of l.teardownAll())await o.send(C).catch((q)=>c(mr(q)));if(E.phase==="probe"||E.phase==="pinned")await E.instance.product.close().catch((C)=>c(mr(C)));await o.close().catch((C)=>c(mr(C)))};o.onmessage=(E)=>{v.push(E),z()},o.onerror=(E)=>{if(c(E),n.phase==="probe"||n.phase==="pinned")n.instance.channel.onerror?.(E)},o.onclose=()=>{if(i||n.phase==="closed")return;i=!0;let E=n;if(n={phase:"closed"},E.phase==="probe"||E.phase==="pinned")E.instance.product.close().catch((C)=>c(mr(C)))};let b=o.start().catch((E)=>{throw c(mr(E)),E});return b.catch(()=>{}),{close:async()=>{await b.catch(()=>{}),await R()}}}function mr(e){return e instanceof Error?e:Error(String(e))}class Ke extends Error{exitCode;statusCode;retryAfterS;constructor(e,t=1,r,o){super(e);this.exitCode=t;this.statusCode=r;this.retryAfterS=o;this.name="CliError"}}class mn extends Ke{constructor(e){super("Could not reach the account service to renew the session; try again.",Wt.NETWORK);this.name="RefreshUnavailableError",this.cause=e}}var Wt={SUCCESS:0,ERROR:1,USAGE:2,AUTH:3,RATE_LIMITED:4,NETWORK:5};var wb="grove-cli/0.1.9";class So{baseUrl;apiKey;token;timeout;verbose;userAgent;extraHeaders;onUnauthorized;constructor(e,t={}){this.baseUrl=e.replace(/\/$/,""),this.apiKey=t.apiKey,this.token=t.token,this.timeout=t.timeout??30000,this.verbose=t.verbose??!1,this.userAgent=t.userAgent??wb,this.extraHeaders=t.headers??{},this.onUnauthorized=t.onUnauthorized}authHeader(){if(this.apiKey)return{"X-API-Key":this.apiKey};if(this.token)return{Authorization:`Bearer ${this.token}`};return{}}buildUrl(e,t){let r=new URL(`${this.baseUrl}${e}`);if(t)for(let[o,n]of Object.entries(t))r.searchParams.set(o,n);return r.toString()}async request(e,t,r={}){try{return await this.attemptRequest(e,t,r)}catch(o){if(!(o instanceof Ke&&o.statusCode===401)||!this.onUnauthorized)throw o;let s;try{s=await this.onUnauthorized(this.token)}catch(i){if(i instanceof mn)throw i;throw o}if(!s)throw o;return this.token=s.token,this.attemptRequest(e,t,r)}}async attemptRequest(e,t,r={}){let o=this.buildUrl(t,r.params),n={...this.extraHeaders,"User-Agent":this.userAgent,...this.authHeader(),...r.body!==void 0?{"Content-Type":"application/json"}:{}},s={method:e,headers:n,signal:AbortSignal.timeout(this.timeout)};if(r.body!==void 0)s.body=JSON.stringify(r.body);if(this.verbose)process.stderr.write(`--> ${e} ${o}
61
- `);let i;try{i=await fetch(o,s)}catch(c){let u=c instanceof Error?c.message:String(c);throw new Ke(`Cannot reach API at ${this.baseUrl}: ${u}`,Wt.NETWORK)}if(this.verbose)process.stderr.write(`<-- ${i.status} ${i.statusText}
62
- `);if(i.status===204)return null;if(i.ok){let c=await i.json();if(c&&typeof c==="object"&&"data"in c&&Object.keys(c).length===1)return c.data;return c}let a=`${i.status} ${i.statusText}`;try{let c=await i.json();if(typeof c.message==="string")a=c.message;else if(typeof c.error==="string")a=c.error}catch{}switch(i.status){case 401:throw new Ke("Session expired. Run `grove auth login` to re-authenticate.",Wt.AUTH,401);case 429:{let c=i.headers.get("Retry-After"),u=c&&/^\d+$/.test(c)?Number(c):void 0,l=u!==void 0?`Rate limited. Retry in ${u}s`:"Rate limited. Try again later";throw new Ke(l,Wt.RATE_LIMITED,429,u)}default:if(i.status>=500)throw new Ke(`Server error: ${a}`,Wt.ERROR,i.status);throw new Ke(a,Wt.ERROR,i.status)}}get(e,t){return this.request("GET",e,{params:t})}post(e,t){return this.request("POST",e,{body:t})}patch(e,t){return this.request("PATCH",e,{body:t})}put(e,t){return this.request("PUT",e,{body:t})}delete(e){return this.request("DELETE",e)}async listSources(e){let t={};if(e)t.groupId=e;return this.adminKeyRead("/api/v1/sources",t,"listing sources")}getSource(e){return this.adminKeyRead(`/api/v1/sources/${encodeURIComponent(e)}`,void 0,"reading a source by id")}async adminKeyRead(e,t,r){try{return await this.get(e,t)}catch(o){if(this.apiKey&&o instanceof Ke&&o.statusCode===403)throw new Ke(`Admin API key required: ${r} with an API key needs a key in the server's ADMIN_API_KEYS (a plain API_KEYS key gets 403). Use an admin-key profile, or authenticate as a user to read your own subscriptions.`,o.exitCode,403);throw o}}listAccessRequests(e){let t={};if(e.status)t.status=e.status;if(e.page)t.page=e.page;if(e.limit)t.limit=e.limit;return this.get("/api/v1/admin/access-requests",t)}resolveAccessRequest(e,t){return this.post(`/api/v1/admin/access-requests/${encodeURIComponent(e)}/resolve`,t)}revokeEntitlement(e,t){return this.post(`/api/v1/admin/entitlements/${encodeURIComponent(e)}/revoke`,t)}async getRaw(e,t){let r=this.buildUrl(e,t),n={method:"GET",headers:{...this.extraHeaders,"Content-Type":"application/json","User-Agent":this.userAgent,...this.authHeader()},signal:AbortSignal.timeout(this.timeout)};if(this.verbose)process.stderr.write(`--> GET ${r}
63
- `);let s;try{s=await fetch(r,n)}catch(i){let a=i instanceof Error?i.message:String(i);throw new Ke(`Cannot reach API at ${this.baseUrl}: ${a}`,Wt.NETWORK)}if(this.verbose)process.stderr.write(`<-- ${s.status} ${s.statusText}
64
- `);if(s.ok)return s.text();throw new Ke(`${s.status} ${s.statusText}`,Wt.ERROR)}}import{dirname as nH,join as sH}from"node:path";import{isDeepStrictEqual as MZ}from"node:util";import CI from"node:process";import wn from"node:fs";import xI from"node:path";import xa from"node:crypto";import LZ from"node:assert";var hn=(e)=>{let t=typeof e;return e!==null&&(t==="object"||t==="function")};var Lm=new Set(["__proto__","prototype","constructor"]),B1=new Set("0123456789");function Dl(e){let t=[],r="",o="start",n=!1;for(let s of e)switch(s){case"\\":{if(o==="index")throw Error("Invalid character in an index");if(o==="indexEnd")throw Error("Invalid character after an index");if(n)r+=s;o="property",n=!n;break}case".":{if(o==="index")throw Error("Invalid character in an index");if(o==="indexEnd"){o="property";break}if(n){n=!1,r+=s;break}if(Lm.has(r))return[];t.push(r),r="",o="property";break}case"[":{if(o==="index")throw Error("Invalid character in an index");if(o==="indexEnd"){o="index";break}if(n){n=!1,r+=s;break}if(o==="property"){if(Lm.has(r))return[];t.push(r),r=""}o="index";break}case"]":{if(o==="index"){t.push(Number.parseInt(r,10)),r="",o="indexEnd";break}if(o==="indexEnd")throw Error("Invalid character after an index")}default:{if(o==="index"&&!B1.has(s))throw Error("Invalid character in an index");if(o==="indexEnd")throw Error("Invalid character after an index");if(o==="start")o="property";if(n)n=!1,r+="\\";r+=s}}if(n)r+="\\";switch(o){case"property":{if(Lm.has(r))return[];t.push(r);break}case"index":throw Error("Index was not closed");case"start":{t.push("");break}}return t}function Dm(e,t){if(typeof t!=="number"&&Array.isArray(e)){let r=Number.parseInt(t,10);return Number.isInteger(r)&&e[r]===e[t]}return!1}function Rb(e,t){if(Dm(e,t))throw Error("Cannot use string index")}function Eb(e,t,r){if(!hn(e)||typeof t!=="string")return r===void 0?e:r;let o=Dl(t);if(o.length===0)return r;for(let n=0;n<o.length;n++){let s=o[n];if(Dm(e,s))e=n===o.length-1?void 0:null;else e=e[s];if(e===void 0||e===null){if(n!==o.length-1)return r;break}}return e===void 0?r:e}function Um(e,t,r){if(!hn(e)||typeof t!=="string")return e;let o=e,n=Dl(t);for(let s=0;s<n.length;s++){let i=n[s];if(Rb(e,i),s===n.length-1)e[i]=r;else if(!hn(e[i]))e[i]=typeof n[s+1]==="number"?[]:{};e=e[i]}return o}function zb(e,t){if(!hn(e)||typeof t!=="string")return!1;let r=Dl(t);for(let o=0;o<r.length;o++){let n=r[o];if(Rb(e,n),o===r.length-1)return delete e[n],!0;if(e=e[n],!hn(e))return!1}}function Pb(e,t){if(!hn(e)||typeof t!=="string")return!1;let r=Dl(t);if(r.length===0)return!1;for(let o of r){if(!hn(e)||!(o in e)||Dm(e,o))return!1;e=e[o]}return!0}import Ye from"node:path";import Tb from"node:os";import Fm from"node:process";var bo=Tb.homedir(),Vm=Tb.tmpdir(),{env:as}=Fm,W1=(e)=>{let t=Ye.join(bo,"Library");return{data:Ye.join(t,"Application Support",e),config:Ye.join(t,"Preferences",e),cache:Ye.join(t,"Caches",e),log:Ye.join(t,"Logs",e),temp:Ye.join(Vm,e)}},Y1=(e)=>{let t=as.APPDATA||Ye.join(bo,"AppData","Roaming"),r=as.LOCALAPPDATA||Ye.join(bo,"AppData","Local");return{data:Ye.join(r,e,"Data"),config:Ye.join(t,e,"Config"),cache:Ye.join(r,e,"Cache"),log:Ye.join(r,e,"Log"),temp:Ye.join(Vm,e)}},X1=(e)=>{let t=Ye.basename(bo);return{data:Ye.join(as.XDG_DATA_HOME||Ye.join(bo,".local","share"),e),config:Ye.join(as.XDG_CONFIG_HOME||Ye.join(bo,".config"),e),cache:Ye.join(as.XDG_CACHE_HOME||Ye.join(bo,".cache"),e),log:Ye.join(as.XDG_STATE_HOME||Ye.join(bo,".local","state"),e),temp:Ye.join(Vm,t,e)}};function Zm(e,{suffix:t="nodejs"}={}){if(typeof e!=="string")throw TypeError(`Expected a string, got ${typeof e}`);if(t)e+=`-${t}`;if(Fm.platform==="darwin")return W1(e);if(Fm.platform==="win32")return Y1(e);return X1(e)}import iA from"node:path";import Ae from"node:fs";import{promisify as It}from"node:util";var Q1=(e,t)=>{let{onError:r}=t;return function(...n){return e.apply(void 0,n).catch(r)}},$r=Q1;var eA=(e,t)=>{let{onError:r}=t;return function(...n){try{return e.apply(void 0,n)}catch(s){return r(s)}}},hr=eA;var Ib=250;var tA=(e,t)=>{let{isRetriable:r}=t;return function(n){let{timeout:s}=n,i=n.interval??Ib,a=Date.now()+s;return function c(...u){return e.apply(void 0,u).catch((l)=>{if(!r(l))throw l;if(Date.now()>=a)throw l;let d=Math.round(i*Math.random());if(d>0)return new Promise((m)=>setTimeout(m,d)).then(()=>c.apply(void 0,u));else return c.apply(void 0,u)})}}},wr=tA;var rA=(e,t)=>{let{isRetriable:r}=t;return function(n){let{timeout:s}=n,i=Date.now()+s;return function(...c){while(!0)try{return e.apply(void 0,c)}catch(u){if(!r(u))throw u;if(Date.now()>=i)throw u;continue}}}},Rr=rA;import Ob from"node:process";var la={isChangeErrorOk:(e)=>{if(!la.isNodeError(e))return!1;let{code:t}=e;if(t==="ENOSYS")return!0;if(!kb&&(t==="EINVAL"||t==="EPERM"))return!0;return!1},isNodeError:(e)=>e instanceof Error,isRetriableError:(e)=>{if(!la.isNodeError(e))return!1;let{code:t}=e;if(t==="EMFILE"||t==="ENFILE"||t==="EAGAIN"||t==="EBUSY"||t==="EACCESS"||t==="EACCES"||t==="EACCS"||t==="EPERM")return!0;return!1},onChangeError:(e)=>{if(!la.isNodeError(e))throw e;if(la.isChangeErrorOk(e))return;throw e}},Hm=la;var da={onError:Hm.onChangeError},Mt={onError:()=>{return}},kb=Ob.getuid?!Ob.getuid():!1,bt={isRetriable:Hm.isRetriableError};var oA={attempt:{chmod:$r(It(Ae.chmod),da),chown:$r(It(Ae.chown),da),close:$r(It(Ae.close),Mt),fsync:$r(It(Ae.fsync),Mt),mkdir:$r(It(Ae.mkdir),Mt),realpath:$r(It(Ae.realpath),Mt),stat:$r(It(Ae.stat),Mt),unlink:$r(It(Ae.unlink),Mt),chmodSync:hr(Ae.chmodSync,da),chownSync:hr(Ae.chownSync,da),closeSync:hr(Ae.closeSync,Mt),existsSync:hr(Ae.existsSync,Mt),fsyncSync:hr(Ae.fsync,Mt),mkdirSync:hr(Ae.mkdirSync,Mt),realpathSync:hr(Ae.realpathSync,Mt),statSync:hr(Ae.statSync,Mt),unlinkSync:hr(Ae.unlinkSync,Mt)},retry:{close:wr(It(Ae.close),bt),fsync:wr(It(Ae.fsync),bt),open:wr(It(Ae.open),bt),readFile:wr(It(Ae.readFile),bt),rename:wr(It(Ae.rename),bt),stat:wr(It(Ae.stat),bt),write:wr(It(Ae.write),bt),writeFile:wr(It(Ae.writeFile),bt),closeSync:Rr(Ae.closeSync,bt),fsyncSync:Rr(Ae.fsyncSync,bt),openSync:Rr(Ae.openSync,bt),readFileSync:Rr(Ae.readFileSync,bt),renameSync:Rr(Ae.renameSync,bt),statSync:Rr(Ae.statSync,bt),writeSync:Rr(Ae.writeSync,bt),writeFileSync:Rr(Ae.writeFileSync,bt)}},_t=oA;import gn from"node:process";var Cb="utf8",Gm=438,xb=511;var Nb={},Ab=gn.geteuid?gn.geteuid():-1,jb=gn.getegid?gn.getegid():-1;var qb=1000,Mb=!!gn.getuid,KK=gn.getuid?!gn.getuid():!1,Jm=128;var Lb=(e)=>e instanceof Error&&("code"in e);var Km=(e)=>typeof e==="string",Ul=(e)=>e===void 0;import sA from"node:path";import cs from"node:process";import Db from"node:process";var Ub=Db.platform==="linux",Fl=Db.platform==="win32";var Bm=["SIGHUP","SIGINT","SIGTERM"];if(!Fl)Bm.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(Ub)Bm.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var Fb=Bm;class Vb{constructor(){this.callbacks=new Set,this.exited=!1,this.exit=(e)=>{if(this.exited)return;this.exited=!0;for(let t of this.callbacks)t();if(e)if(Fl&&(e!=="SIGINT"&&e!=="SIGTERM"&&e!=="SIGKILL"))cs.kill(cs.pid,"SIGTERM");else cs.kill(cs.pid,e)},this.hook=()=>{cs.once("exit",()=>this.exit());for(let e of Fb)try{cs.once(e,()=>this.exit(e))}catch{}},this.register=(e)=>(this.callbacks.add(e),()=>{this.callbacks.delete(e)}),this.hook()}}var Zb=new Vb;var nA=Zb.register,Hb=nA;var Yt={store:{},create:(e)=>{let t=`000000${Math.floor(Math.random()*16777215).toString(16)}`.slice(-6),r=Date.now().toString().slice(-10),o="tmp-",n=`.tmp-${r}${t}`;return`${e}${n}`},get:(e,t,r=!0)=>{let o=Yt.truncate(t(e));if(o in Yt.store)return Yt.get(e,t,r);return Yt.store[o]=r,[o,()=>delete Yt.store[o]]},purge:(e)=>{if(!Yt.store[e])return;delete Yt.store[e],_t.attempt.unlink(e)},purgeSync:(e)=>{if(!Yt.store[e])return;delete Yt.store[e],_t.attempt.unlinkSync(e)},purgeSyncAll:()=>{for(let e in Yt.store)Yt.purgeSync(e)},truncate:(e)=>{let t=sA.basename(e);if(t.length<=Jm)return e;let r=/^(\.?)(.*?)((?:\.[^.]+)?(?:\.tmp-\d{10}[a-f0-9]{6})?)$/.exec(t);if(!r)return e;let o=t.length-Jm;return`${e.slice(0,-t.length)}${r[1]}${r[2].slice(0,-o)}${r[3]}`}};Hb(Yt.purgeSyncAll);var pa=Yt;function Wm(e,t,r=Nb){if(Km(r))return Wm(e,t,{encoding:r});let n={timeout:r.timeout??qb},s=null,i=null,a=null;try{let c=_t.attempt.realpathSync(e),u=!!c;e=c||e,[i,s]=pa.get(e,r.tmpCreate||pa.create,r.tmpPurge!==!1);let l=Mb&&Ul(r.chown),d=Ul(r.mode);if(u&&(l||d)){let f=_t.attempt.statSync(e);if(f){if(r={...r},l)r.chown={uid:f.uid,gid:f.gid};if(d)r.mode=f.mode}}if(!u){let f=iA.dirname(e);_t.attempt.mkdirSync(f,{mode:xb,recursive:!0})}if(a=_t.retry.openSync(n)(i,"w",r.mode||Gm),r.tmpCreated)r.tmpCreated(i);if(Km(t))_t.retry.writeSync(n)(a,t,0,r.encoding||Cb);else if(!Ul(t))_t.retry.writeSync(n)(a,t,0,t.length,0);if(r.fsync!==!1)if(r.fsyncWait!==!1)_t.retry.fsyncSync(n)(a);else _t.attempt.fsync(a);if(_t.retry.closeSync(n)(a),a=null,r.chown&&(r.chown.uid!==Ab||r.chown.gid!==jb))_t.attempt.chownSync(i,r.chown.uid,r.chown.gid);if(r.mode&&r.mode!==Gm)_t.attempt.chmodSync(i,r.mode);try{_t.retry.renameSync(n)(i,e)}catch(f){if(!Lb(f))throw f;if(f.code!=="ENAMETOOLONG")throw f;_t.retry.renameSync(n)(i,pa.truncate(e))}s(),i=null}finally{if(a)_t.attempt.closeSync(a);if(i)pa.purge(i)}}var AI=dp(hP(),1),jI=dp(qP(),1);var SV=(e,t,r,o)=>{if(r==="length"||r==="prototype")return;if(r==="arguments"||r==="caller")return;let n=Object.getOwnPropertyDescriptor(e,r),s=Object.getOwnPropertyDescriptor(t,r);if(!bV(n,s)&&o)return;Object.defineProperty(e,r,s)},bV=function(e,t){return e===void 0||e.configurable||e.writable===t.writable&&e.enumerable===t.enumerable&&e.configurable===t.configurable&&(e.writable||e.value===t.value)},$V=(e,t)=>{let r=Object.getPrototypeOf(t);if(r===Object.getPrototypeOf(e))return;Object.setPrototypeOf(e,r)},wV=(e,t)=>`/* Wrapped ${e}*/
65
- ${t}`,RV=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),EV=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),zV=(e,t,r)=>{let o=r===""?"":`with ${r.trim()}() `,n=wV.bind(null,o,t.toString());Object.defineProperty(n,"name",EV);let{writable:s,enumerable:i,configurable:a}=RV;Object.defineProperty(e,"toString",{value:n,writable:s,enumerable:i,configurable:a})};function sg(e,t,{ignoreNonConfigurable:r=!1}={}){let{name:o}=e;for(let n of Reflect.ownKeys(t))SV(e,t,n,r);return $V(e,t),zV(e,t,o),e}var PV=(e,t={})=>{if(typeof e!=="function")throw TypeError(`Expected the first argument to be a function, got \`${typeof e}\``);let{wait:r=0,maxWait:o=Number.POSITIVE_INFINITY,before:n=!1,after:s=!0}=t;if(r<0||o<0)throw RangeError("`wait` and `maxWait` must not be negative.");if(!n&&!s)throw Error("Both `before` and `after` are false, function wouldn't be called.");let i,a,c,u=function(...l){let d=this,f=()=>{if(i=void 0,a)clearTimeout(a),a=void 0;if(s)c=e.apply(d,l)},m=()=>{if(a=void 0,i)clearTimeout(i),i=void 0;if(s)c=e.apply(d,l)},h=n&&!i;if(clearTimeout(i),i=setTimeout(f,r),o>0&&o!==Number.POSITIVE_INFINITY&&!a)a=setTimeout(m,o);if(h)c=e.apply(d,l);return c};return sg(u,e),u.cancel=()=>{if(i)clearTimeout(i),i=void 0;if(a)clearTimeout(a),a=void 0},u},ig=PV;var Rn=dp(TI(),1);var OZ=Object.prototype.toString;function kI(e,t,r){if(!e)return!1;if(e.constructor===t)return!0;return OZ.call(e)===r}function OI(e){return kI(e,Uint8Array,"[object Uint8Array]")}function CZ(e){return kI(e,ArrayBuffer,"[object ArrayBuffer]")}function xZ(e){return OI(e)||CZ(e)}function NZ(e){if(!OI(e))throw TypeError(`Expected \`Uint8Array\`, got \`${typeof e}\``)}function AZ(e){if(!xZ(e))throw TypeError(`Expected \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof e}\``)}function bg(e,t){if(e.length===0)return new Uint8Array(0);t??=e.reduce((n,s)=>n+s.length,0);let r=new Uint8Array(t),o=0;for(let n of e)NZ(n),r.set(n,o),o+=n.length;return r}var II={utf8:new globalThis.TextDecoder("utf8")};function $g(e,t="utf8"){return AZ(e),II[t]??=new globalThis.TextDecoder(t),II[t].decode(e)}function jZ(e){if(typeof e!=="string")throw TypeError(`Expected \`string\`, got \`${typeof e}\``)}var qZ=new globalThis.TextEncoder;function tp(e){return jZ(e),qZ.encode(e)}var j8=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));var DZ=jI.default.default,NI="aes-256-cbc",js=()=>Object.create(null),UZ=(e)=>e!==void 0&&e!==null,FZ=(e,t)=>{let r=new Set(["undefined","symbol","function"]),o=typeof t;if(r.has(o))throw TypeError(`Setting a value of type \`${o}\` for key \`${e}\` is not allowed as it's not supported by JSON`)},rp="__internal__",wg=`${rp}.migrations.version`;class op{path;events;#o;#t;#e;#r={};constructor(e={}){let t={configName:"config",fileExtension:"json",projectSuffix:"nodejs",clearInvalidConfig:!1,accessPropertiesByDotNotation:!0,configFileMode:438,...e};if(!t.cwd){if(!t.projectName)throw Error("Please specify the `projectName` option.");t.cwd=Zm(t.projectName,{suffix:t.projectSuffix}).config}if(this.#e=t,t.schema??t.ajvOptions??t.rootSchema){if(t.schema&&typeof t.schema!=="object")throw TypeError("The `schema` option must be an object.");let s=new AI.Ajv2020({allErrors:!0,useDefaults:!0,...t.ajvOptions});DZ(s);let i={...t.rootSchema,type:"object",properties:t.schema};this.#o=s.compile(i);for(let[a,c]of Object.entries(t.schema??{}))if(c?.default)this.#r[a]=c.default}if(t.defaults)this.#r={...this.#r,...t.defaults};if(t.serialize)this._serialize=t.serialize;if(t.deserialize)this._deserialize=t.deserialize;this.events=new EventTarget,this.#t=t.encryptionKey;let r=t.fileExtension?`.${t.fileExtension}`:"";this.path=xI.resolve(t.cwd,`${t.configName??"config"}${r}`);let o=this.store,n=Object.assign(js(),t.defaults,o);if(t.migrations){if(!t.projectVersion)throw Error("Please specify the `projectVersion` option.");this._migrate(t.migrations,t.projectVersion,t.beforeEachMigration)}this._validate(n);try{LZ.deepEqual(o,n)}catch{this.store=n}if(t.watch)this._watch()}get(e,t){if(this.#e.accessPropertiesByDotNotation)return this._get(e,t);let{store:r}=this;return e in r?r[e]:t}set(e,t){if(typeof e!=="string"&&typeof e!=="object")throw TypeError(`Expected \`key\` to be of type \`string\` or \`object\`, got ${typeof e}`);if(typeof e!=="object"&&t===void 0)throw TypeError("Use `delete()` to clear values");if(this._containsReservedKey(e))throw TypeError(`Please don't use the ${rp} key, as it's used to manage this module internal operations.`);let{store:r}=this,o=(n,s)=>{if(FZ(n,s),this.#e.accessPropertiesByDotNotation)Um(r,n,s);else r[n]=s};if(typeof e==="object"){let n=e;for(let[s,i]of Object.entries(n))o(s,i)}else o(e,t);this.store=r}has(e){if(this.#e.accessPropertiesByDotNotation)return Pb(this.store,e);return e in this.store}reset(...e){for(let t of e)if(UZ(this.#r[t]))this.set(t,this.#r[t])}delete(e){let{store:t}=this;if(this.#e.accessPropertiesByDotNotation)zb(t,e);else delete t[e];this.store=t}clear(){this.store=js();for(let e of Object.keys(this.#r))this.reset(e)}onDidChange(e,t){if(typeof e!=="string")throw TypeError(`Expected \`key\` to be of type \`string\`, got ${typeof e}`);if(typeof t!=="function")throw TypeError(`Expected \`callback\` to be of type \`function\`, got ${typeof t}`);return this._handleChange(()=>this.get(e),t)}onDidAnyChange(e){if(typeof e!=="function")throw TypeError(`Expected \`callback\` to be of type \`function\`, got ${typeof e}`);return this._handleChange(()=>this.store,e)}get size(){return Object.keys(this.store).length}get store(){try{let e=wn.readFileSync(this.path,this.#t?null:"utf8"),t=this._encryptData(e),r=this._deserialize(t);return this._validate(r),Object.assign(js(),r)}catch(e){if(e?.code==="ENOENT")return this._ensureDirectory(),js();if(this.#e.clearInvalidConfig&&e.name==="SyntaxError")return js();throw e}}set store(e){this._ensureDirectory(),this._validate(e),this._write(e),this.events.dispatchEvent(new Event("change"))}*[Symbol.iterator](){for(let[e,t]of Object.entries(this.store))yield[e,t]}_encryptData(e){if(!this.#t)return typeof e==="string"?e:$g(e);try{let t=e.slice(0,16),r=xa.pbkdf2Sync(this.#t,t.toString(),1e4,32,"sha512"),o=xa.createDecipheriv(NI,r,t),n=e.slice(17),s=typeof n==="string"?tp(n):n;return $g(bg([o.update(s),o.final()]))}catch{}return e.toString()}_handleChange(e,t){let r=e(),o=()=>{let n=r,s=e();if(MZ(s,n))return;r=s,t.call(this,s,n)};return this.events.addEventListener("change",o),()=>{this.events.removeEventListener("change",o)}}_deserialize=(e)=>JSON.parse(e);_serialize=(e)=>JSON.stringify(e,void 0,"\t");_validate(e){if(!this.#o)return;if(this.#o(e)||!this.#o.errors)return;let r=this.#o.errors.map(({instancePath:o,message:n=""})=>`\`${o.slice(1)}\` ${n}`);throw Error("Config schema violation: "+r.join("; "))}_ensureDirectory(){wn.mkdirSync(xI.dirname(this.path),{recursive:!0})}_write(e){let t=this._serialize(e);if(this.#t){let r=xa.randomBytes(16),o=xa.pbkdf2Sync(this.#t,r.toString(),1e4,32,"sha512"),n=xa.createCipheriv(NI,o,r);t=bg([r,tp(":"),n.update(tp(t)),n.final()])}if(CI.env.SNAP)wn.writeFileSync(this.path,t,{mode:this.#e.configFileMode});else try{Wm(this.path,t,{mode:this.#e.configFileMode})}catch(r){if(r?.code==="EXDEV"){wn.writeFileSync(this.path,t,{mode:this.#e.configFileMode});return}throw r}}_watch(){if(this._ensureDirectory(),!wn.existsSync(this.path))this._write(js());if(CI.platform==="win32")wn.watch(this.path,{persistent:!1},ig(()=>{this.events.dispatchEvent(new Event("change"))},{wait:100}));else wn.watchFile(this.path,{persistent:!1},ig(()=>{this.events.dispatchEvent(new Event("change"))},{wait:5000}))}_migrate(e,t,r){let o=this._get(wg,"0.0.0"),n=Object.keys(e).filter((i)=>this._shouldPerformMigration(i,o,t)),s={...this.store};for(let i of n)try{if(r)r(this,{fromVersion:o,toVersion:i,finalVersion:t,versions:n});let a=e[i];a?.(this),this._set(wg,i),o=i,s={...this.store}}catch(a){throw this.store=s,Error(`Something went wrong during the migration! Changes applied to the store until this failed migration will be restored. ${a}`)}if(this._isVersionInRangeFormat(o)||!Rn.default.eq(o,t))this._set(wg,t)}_containsReservedKey(e){if(typeof e==="object"){if(Object.keys(e)[0]===rp)return!0}if(typeof e!=="string")return!1;if(this.#e.accessPropertiesByDotNotation){if(e.startsWith(`${rp}.`))return!0;return!1}return!1}_isVersionInRangeFormat(e){return Rn.default.clean(e)===null}_shouldPerformMigration(e,t,r){if(this._isVersionInRangeFormat(e)){if(t!=="0.0.0"&&Rn.default.satisfies(t,e))return!1;return Rn.default.satisfies(r,e)}if(Rn.default.lte(e,t))return!1;if(Rn.default.gt(e,r))return!1;return!0}_get(e,t){return Eb(this.store,e,t)}_set(e,t){let{store:r}=this;Um(r,e,t),this.store=r}}import{chmodSync as iH,existsSync as aH}from"fs";import{randomBytes as qI}from"node:crypto";import{closeSync as VZ,linkSync as ZZ,openSync as HZ,readFileSync as GZ,renameSync as JZ,statSync as KZ,unlinkSync as MI,writeSync as BZ}from"node:fs";var LI=30000,WZ=8000,YZ=2*LI,XZ=100;function QZ(e){try{return process.kill(e,0),!0}catch(t){return t.code==="EPERM"}}function Rg(e){try{let t=JSON.parse(GZ(e,"utf8"));if(typeof t.pid==="number"&&typeof t.ts==="number"&&typeof t.nonce==="string")return t;return null}catch{return null}}function eH(e,t,r){if(t)return r-t.ts;try{return r-KZ(e).mtimeMs}catch{return}}function tH(e,t,r){let o=eH(e,t,r);if(o===void 0)return!1;if(o>LI)return!0;return t!==null&&o>WZ&&!QZ(t.pid)}function rH(e,t){let r=`${e}.stale-${process.pid}-${qI(4).toString("hex")}`;try{JZ(e,r)}catch{return}let o=Rg(r);if(o&&t&&o.nonce!==t.nonce)try{ZZ(r,e)}catch{}try{MI(r)}catch{}}function oH(e,t){let r;try{r=HZ(e,"wx",384)}catch(o){if(o.code==="EEXIST")return!1;throw o}try{BZ(r,JSON.stringify(t))}finally{VZ(r)}return!0}async function DI(e){let t={pid:process.pid,ts:0,nonce:qI(8).toString("hex")},r=Date.now();for(;;){let o=Date.now();if(t.ts=o,oH(e,t))return{release:()=>{if(Rg(e)?.nonce!==t.nonce)return;try{MI(e)}catch{}}};let n=Rg(e);if(tH(e,n,o)){rH(e,n);continue}if(o-r>=YZ)return null;await new Promise((s)=>setTimeout(s,XZ))}}var Eg=null;function cH(e){try{if(aH(e.path))iH(e.path,384)}catch{}}function ZI(){return qs().path}function qs(){if(!Eg){let e=new op({projectName:"grove-cli",configFileMode:384,defaults:{currentProfile:"default",profiles:{}}});cH(e),Eg=e}return Eg}function Tg(e,t){let r=qs(),o=r.get("profiles");o[e]=t,r.set("profiles",o)}function Fo(e){return qs().get("profiles")[e]??null}function np(){return qs().get("currentProfile")}function HI(){let e=np();return Fo(e)}var GI="https://grove.iis.tools",UI="No API URL configured. Run: grove auth login (or set GROVE_API_URL)";function JI(e){let{apiUrl:t,token:r,apiKey:o}=e,n=process.env.GROVE_API_URL,s=process.env.GROVE_TOKEN,i=process.env.GROVE_API_KEY,a=o??i;if(a){let d=t??n??FI(e.profile);if(!d)throw new Ke(UI,Wt.AUTH);return{apiUrl:d,token:a,authType:"api-key"}}let c=r??s,u=t??n??FI(e.profile);if(c&&u)return{apiUrl:u,token:c,authType:"jwt"};if(c)throw new Ke(UI,Wt.AUTH);let l=e.profile?Fo(e.profile):HI();if(l){let d=c??l.token??l.apiKey,f=u??l.baseUrl;if(d&&f){let m=l.apiKey&&!c?"api-key":"jwt";return{apiUrl:f,token:d,authType:m}}}throw new Ke("Not authenticated. Run: grove auth login",Wt.AUTH)}function FI(e){return(e?Fo(e):HI())?.baseUrl}function Ig(e){return e.accountUrl??process.env.GROVE_ACCOUNT_URL??"https://account.iis.tools"}function uH(e){let t=Ig(e);return new So(t,{verbose:e.verbose,timeout:e.timeout?parseInt(e.timeout,10):void 0})}var zg=8000,Pg=new Map;function lH(e){return sH(nH(qs().path),`refresh-${encodeURIComponent(e)}.lock`)}function KI(e,t={},r){let o=`${qs().path}\x00${e}`,n=Pg.get(o);if(n)return n;let s=mH(e,t,r).finally(()=>{Pg.delete(o)});return Pg.set(o,s),s}var dH=30000;function pH(e){let t=e.split(".")[1];if(!t)return!1;try{let{exp:r}=JSON.parse(Buffer.from(t,"base64url").toString("utf8"));return typeof r==="number"&&r*1000>Date.now()+dH}catch{return!1}}function VI(e,t){if(t===void 0||!e?.token||!e.refreshToken)return null;if(e.token===t||!pH(e.token))return null;return{token:e.token,refreshToken:e.refreshToken}}function fH(e){return e instanceof Ke&&(e.statusCode===400||e.statusCode===401)}async function mH(e,t,r){let o=VI(Fo(e),r);if(o)return o;let n;try{n=await DI(lH(e))}catch(s){throw new mn(s)}if(!n)throw new mn;try{let s=Fo(e);if(!s?.refreshToken)return null;let i=VI(s,r);if(i)return i;let a=t.timeout?parseInt(t.timeout,10):zg,u=await uH({...t,timeout:String(Math.min(a||zg,zg))}).post("/auth/refresh",{refreshToken:s.refreshToken});return Tg(e,{...s,token:u.accessToken,refreshToken:u.refreshToken}),{token:u.accessToken,refreshToken:u.refreshToken}}catch(s){if(fH(s))return null;throw new mn(s)}finally{n.release()}}import{spawn as hH}from"node:child_process";import{createHash as WI,randomBytes as sp}from"node:crypto";import{createServer as BI}from"node:http";function YI(){return sp(32).toString("base64url")}function gH(e){return WI("sha256").update(e).digest("base64url")}function XI(e,t,r,o){let n=new URL(`${e.replace(/\/$/,"")}/auth/cli`);return n.searchParams.set("response_type","code"),n.searchParams.set("code_challenge",gH(t)),n.searchParams.set("code_challenge_method","S256"),n.searchParams.set("redirect_uri",r),n.searchParams.set("state",o),n.searchParams.set("service","Grove"),n.toString()}function QI(){let e,t,r=new Promise((o,n)=>{e=o,t=n});return r.catch(()=>{}),{promise:r,resolve:e,reject:t}}var yH="<!doctype html><html><body><h2>Signed in to Grove.</h2><p>You can close this window.</p></body></html>",_H="<!doctype html><html><body><h2>Sign-in link invalid or expired.</h2><p>Start the sign-in again.</p></body></html>";async function ek(e){let t=YI(),r=sp(16).toString("hex"),o=QI(),n=(d,f)=>{let m=new URL(d.url??"/","http://localhost");if(d.method!=="GET"||m.pathname!=="/callback"){f.writeHead(404).end();return}let h=m.searchParams.get("code");if(!h||m.searchParams.get("state")!==r){f.writeHead(400,{"Content-Type":"text/html; charset=utf-8"}).end(_H);return}f.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}).end(yH),o.resolve(h)},s=BI(n);await new Promise((d,f)=>{s.once("error",f),s.listen(0,"127.0.0.1",()=>d())});let{port:i}=s.address(),a=[s],c=BI(n);await new Promise((d)=>{c.once("error",()=>d()),c.listen(i,"::1",()=>{a.push(c),d()})});let u=`http://localhost:${i}/callback`,l=!1;return{mode:"loopback",authUrl:XI(e.accountUrl,t,u,r),redirectUri:u,codeVerifier:t,port:i,waitForCode:()=>o.promise,close:()=>{if(l)return;l=!0,o.reject(Error("login listener closed"));for(let d of a)d.closeAllConnections(),d.close()}}}var vH=3000,SH=1e4;async function tk(e){let t=YI(),r=sp(16).toString("hex"),o=sp(32).toString("base64url"),n=WI("sha256").update(o).digest("base64url"),s=e.apiUrl.replace(/\/$/,""),i=`${s}/auth/cli/callback?k=${n}`,a=e.pollIntervalMs??vH,c=new So(s,{headers:{Authorization:`Relay ${o}`},timeout:SH,userAgent:e.userAgent}),u=QI(),l=!1,d,f=(h)=>{if(l)return;d=setTimeout(()=>void m(),h),d.unref()},m=async()=>{let h=a;try{let g=await c.get("/auth/cli/relay",{k:n});if(!l&&typeof g?.code==="string"&&g.state===r){u.resolve(g.code);return}}catch(g){if(g instanceof Ke&&g.retryAfterS!==void 0)h=Math.max(a,g.retryAfterS*1000)}f(h)};return f(a),{mode:"relay",authUrl:XI(e.accountUrl,t,i,r),redirectUri:i,codeVerifier:t,waitForCode:()=>u.promise,close:()=>{if(l)return;l=!0,clearTimeout(d),u.reject(Error("relay login closed"))}}}function rk(e,t,r){return new So(e).post("/auth/token",{code:r,codeVerifier:t.codeVerifier,redirectUri:t.redirectUri})}function ok(e=process.env,t=process.platform){if(e.SSH_CONNECTION||e.SSH_TTY)return!0;return t==="linux"&&!e.DISPLAY&&!e.WAYLAND_DISPLAY}function nk(e,t=process.platform){let[r,o]=t==="darwin"?["open",[e]]:t==="win32"?["rundll32",["url.dll,FileProtocolHandler",e]]:["xdg-open",[e]];return new Promise((n,s)=>{let i=hH(r,o,{stdio:"ignore"});i.once("error",s),i.once("exit",(a)=>{if(a===0)n();else s(Error(`${r} exited with ${a}`))})})}import{randomUUID as bH}from"node:crypto";var $H=300000,wH=50000,RH=1e4;class En{deps;current;canAutoRefresh;pending=null;live=null;deadProfileKey;reloginSpent=!1;closed=!1;notice=null;profileClients=new WeakSet;constructor(e,t){this.deps=t;if(this.current=e?.client??null,this.canAutoRefresh=e?.canAutoRefresh??!1,e?.profileKey!==void 0)this.profileClients.add(e.client)}static fixed(e,t){return new En({client:e,canAutoRefresh:t})}get canLogin(){return this.deps!==void 0}clientForCall(){if(!this.deps)return this.current;if(this.current&&!this.profileClients.has(this.current))return this.current;let e=this.safeBuild();if(this.current){if(e)return this.current;return this.current=null,this.canAutoRefresh=!1,null}if(!e)return null;if(this.deadProfileKey!==void 0&&e.profileKey===this.deadProfileKey)return null;return this.adopt(e),this.live?.abort(),this.current}mayLogin(){if(!this.deps)return!1;if(this.live||this.pending)return!0;return this.deadProfileKey===void 0||!this.reloginSpent}markRevoked(e,t=!1){if(!this.deps||!this.profileClients.has(e))return!1;if(this.current!==e)return!0;return this.current=null,this.canAutoRefresh=!1,this.deadProfileKey=this.safeBuild()?.profileKey??"",this.reloginSpent=t,!0}close(){this.closed=!0,this.live?.abort()}get loginWaitMs(){return this.deps?.loginWaitMs??wH}get progressIntervalMs(){return this.deps?.progressIntervalMs??RH}canOpenBrowser(){return this.deps?.openBrowser!==void 0&&(this.deps.canOpenBrowser?.()??!0)}takeSignInNotice(){let e=this.notice;return this.notice=null,e}openBrowser(e){let t=this.canOpenBrowser()?this.deps?.openBrowser:void 0,r=e.loopbackUrl??e.relayUrl,o={failed:!1,failure:new Promise(()=>{})};if(!t||!r)o.failed=!0,o.failure=Promise.resolve("open-failed");else o.failure=Promise.resolve().then(()=>t(r)).then(()=>new Promise(()=>{}),()=>(o.failed=!0,"open-failed"));e.browser=o}beginLogin(e="relay"){if(this.pending)return{pending:this.pending,created:!1};let t=this.deps;if(!t)throw Error("this session has no login");if(this.deadProfileKey!==void 0)this.reloginSpent=!0;let r=this.startPending(t,e);return this.pending=r,r.catch(()=>{if(this.pending===r)this.pending=null}),{pending:r,created:!0}}safeBuild(){try{return this.deps?.build()??null}catch{return null}}adopt(e){if(this.current=e.client,this.canAutoRefresh=e.canAutoRefresh,e.profileKey!==void 0)this.profileClients.add(e.client);this.deadProfileKey=void 0,this.reloginSpent=!1}async startPending(e,t){let r=await e.startLogin(t),o=e.ttlMs??$H,n=[r],s,i=new Promise((h)=>s=h),a=!1,c=!1,u=(h)=>{if(a)return;a=!0,clearTimeout(l);for(let g of n)g.close();this.pending=null,this.live=null,s(h)},l=setTimeout(()=>u("expired"),o);l.unref();let d=(h)=>{h.waitForCode().then(async(g)=>{if(a||c)return;c=!0;try{let _=await e.complete(h,g),y=this.safeBuild();if(!y){u("failed");return}this.adopt(y),this.notice={accountId:_?.accountId,mode:h.mode},u("signed-in")}catch{u("failed")}},()=>{})};d(r);let f=r.mode==="relay"?Promise.resolve(r.authUrl):null,m={relayUrl:r.mode==="relay"?r.authUrl:null,loopbackUrl:r.mode==="loopback"?r.authUrl:null,addRelay:()=>{if(a)return Promise.resolve(null);return f??=e.startLogin("relay").then((h)=>{if(a)return h.close(),null;return n.push(h),d(h),m.relayUrl=h.authUrl,h.authUrl}),f},elicitationId:bH(),expiresAt:Date.now()+o,elicited:!1,browser:null,done:i,abort:()=>u("aborted")};if(this.live=m,this.closed)m.abort();return m}}var Na="0.2.2",kg=`grove-mcp/${Na}`;function sk(){let e=process.env.GROVE_PROFILE,t=e??np(),r=Boolean(process.env.GROVE_TOKEN||process.env.GROVE_API_KEY),o=Fo(t);if(!r&&!o)return null;let n=JI({profile:e});if(!r&&n.authType==="jwt"&&!o?.refreshToken&&EH(n.token))return null;let s=n.authType==="jwt"&&!!o?.refreshToken;return{client:new So(n.apiUrl,{apiKey:n.authType==="api-key"?n.token:void 0,token:n.authType==="jwt"?n.token:void 0,userAgent:kg,onUnauthorized:s?(a)=>KI(t,{accountUrl:process.env.GROVE_ACCOUNT_URL},a):void 0}),canAutoRefresh:s,profileKey:r?void 0:o?.refreshToken??n.token}}function EH(e){let t=e.split(".")[1];if(!t)return!1;try{let{exp:r}=JSON.parse(Buffer.from(t,"base64url").toString("utf8"));return typeof r==="number"&&r*1000<=Date.now()}catch{return!1}}function ik(e={}){let t=Ig({}),r=process.env.GROVE_PROFILE??np(),o=()=>process.env.GROVE_API_URL??Fo(r)?.baseUrl??GI;return new En(sk(),{build:sk,startLogin:(n)=>n==="relay"?tk({accountUrl:t,apiUrl:o(),pollIntervalMs:e.relayPollMs,userAgent:kg}):ek({accountUrl:t}),complete:async(n,s)=>{let i=await rk(t,n,s);return Tg(r,{baseUrl:o(),token:i.accessToken,refreshToken:i.refreshToken}),{accountId:i.accountId}},ttlMs:e.ttlMs,loginWaitMs:e.loginWaitMs,progressIntervalMs:e.progressIntervalMs,openBrowser:e.openBrowser??nk,canOpenBrowser:e.openBrowser?void 0:()=>!ok()})}var ak="npm";import{lstatSync as aG,mkdirSync as cG,realpathSync as uG}from"node:fs";import{homedir as lG}from"node:os";import dG from"node:path";import{existsSync as zH,statSync as PH}from"node:fs";import ck from"node:path";var Ms=["claude-code","claude-desktop","cursor","vscode"],uk={"claude-code":"Claude Code","claude-desktop":"Claude Desktop",cursor:"Cursor",vscode:"VS Code"};function lk(e,t,r){return(e==="win32"?t.USERPROFILE:t.HOME)||r}function ip(e,t,r,o){let n=t==="win32"?ck.win32:ck.posix,s=r.APPDATA||n.join(o,"AppData","Roaming"),i=(a)=>t==="darwin"?n.join(o,"Library","Application Support",a):t==="win32"?n.join(s,a):n.join(o,".config",a);switch(e){case"claude-code":{let a=r.CLAUDE_CONFIG_DIR,c=n.join(a||o,".claude.json"),u=a||n.join(o,".claude");return{file:c,legacyFile:n.join(u,".config.json"),detect:[c,u],serversKey:"mcpServers",withType:!0,newFileMode:384}}case"claude-desktop":{let a=i("Claude");return{file:n.join(a,"claude_desktop_config.json"),detect:[a],serversKey:"mcpServers",withType:!1,newFileMode:420}}case"cursor":{let a=n.join(o,".cursor");return{file:n.join(a,"mcp.json"),detect:[a],serversKey:"mcpServers",withType:!1,newFileMode:420}}case"vscode":{let a=n.join(i("Code"),"User");return{file:n.join(a,"mcp.json"),detect:[a],serversKey:"servers",withType:!0,newFileMode:420}}}}function Og(e){if(e.legacyFile)try{if(PH(e.legacyFile).size>0)return e.legacyFile}catch{}return e.file}function dk(e){return e.detect.some((t)=>zH(t))}import{readFileSync as TH,readlinkSync as IH,statSync as kH}from"node:fs";import Aa from"node:path";var OH="@iistools/grove-mcp",fk="https://registry.npmjs.org/",CH=`--@iistools:registry=${fk}`;function xH(e){return e==="win32"?Aa.win32:Aa.posix}function pk(e){try{return kH(e).isFile()}catch{return!1}}function mk(e,t,r){let o=xH(e),n=e==="win32"?"npx.cmd":"npx";for(let i of(t.PATH??"").split(o.delimiter))if(i&&o.isAbsolute(i)&&pk(o.join(i,n)))return NH(o.join(i,n),t,o);let s=o.join(o.dirname(r),n);return pk(s)?s:null}function NH(e,t,r){let o=t.FNM_MULTISHELL_PATH;if(!o||!e.startsWith(o+r.sep))return e;try{return r.resolve(r.dirname(o),IH(o))+e.slice(o.length)}catch{return e}}function hk(e,t,r){if(e==="win32")return null;let o=[Aa.posix.dirname(t),Aa.posix.dirname(r),"/usr/local/bin","/usr/bin","/bin"];return[...new Set(o)].join(Aa.posix.delimiter)}function cp(e){return typeof e.command==="string"&&/\s/.test(e.command.trim())&&(!Array.isArray(e.args)||e.args.length===0)}function Cg(e){return Array.isArray(e.args)?e.args.filter((t)=>typeof t==="string"):[]}function AH(e){return[typeof e.command==="string"?e.command:"",...Cg(e)].join(" ")}var jH=/@iistools\/grove-mcp|iis-grove-mcp|grove-mcp\.js|mcp-main\.js/,qH=/grove-mcp\.js|mcp-main\.js/;function ja(e){return jH.test(AH(e))}function ap(e){return e.split(/[\\/]/).pop()??e}function xg(e){if(e===null||typeof e!=="object"||Array.isArray(e))return`not an entry: ${Array.isArray(e)?"array":typeof e}`;let t=e.command;if(typeof t!=="string"||!t.trim())return"no command";return ap(t.trim().split(/\s+/)[0])}function qa(e){if(cp(e))return null;let t=typeof e.command==="string"?e.command:"";if(ap(t).replace(/\.exe$/i,"")==="iis-grove-mcp")return`installed binary (${ap(t)})`;let r=[t,...Cg(e)].find((o)=>qH.test(o));return r?`local build (${ap(r)})`:null}function gk(e){if(!/^npx(\.cmd)?$/i.test(xg(e)))return[];let r=(cp(e)?e.command.trim().split(/\s+/):Cg(e)).filter((o)=>o.startsWith("--")&&o!=="--yes");return[...new Set(r)]}function yk(e){let t=e.npm_config_userconfig;if(!t)return[];let r;try{r=TH(t,"utf8")}catch{return[]}for(let o of r.split(/\r?\n/)){let n=/^\s*@iistools:registry\s*=\s*(\S+)\s*$/.exec(o);if(!n)continue;return(n[1].endsWith("/")?n[1]:`${n[1]}/`)===fk?[]:[CH]}return[]}function _k(e,t,r){let o=r!==null&&typeof r==="object"&&!Array.isArray(r)?{...r}:{};if(e.envPath!==null&&!("PATH"in o))o.PATH=e.envPath;let n=e.withType?{type:"stdio"}:{};return n.command=e.npx,n.args=["-y",...t,OH],n.env=o,n}import{readFileSync as BH,statSync as WH}from"node:fs";import Ls from"node:path";import{chmodSync as MH,copyFileSync as LH,existsSync as DH,readFileSync as UH,renameSync as FH,rmSync as VH,statSync as ZH,writeFileSync as HH}from"node:fs";import{isDeepStrictEqual as GH}from"node:util";var JH=".bak-grove-mcp",Sk="\uFEFF";function lt(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function Ng(e){let t;try{t=UH(e,"utf8")}catch(a){if(a.code!=="ENOENT")return{ok:!1,reason:`not readable (${a.code})`};return{ok:!0,doc:{exists:!1,data:{},indent:" ",trailingNewline:!0,bom:!1,mode:null}}}let r=t.startsWith(Sk),o=r?t.slice(1):t,n=ZH(e).mode&511,s={indent:/^(\t+| +)"/m.exec(o)?.[1]??" ",trailingNewline:o.endsWith(`
66
- `),bom:r,mode:n};if(o.trim()==="")return{ok:!0,doc:{exists:!0,data:{},...s,trailingNewline:!0}};let i;try{i=JSON.parse(o)}catch{return{ok:!1,reason:"not valid JSON"}}if(!lt(i))return{ok:!1,reason:"not a JSON object"};return{ok:!0,doc:{exists:!0,data:i,...s}}}function KH(e,t){return(e.bom?Sk:"")+JSON.stringify(t,null,e.indent)+(e.trailingNewline?`
67
- `:"")}var bk=(e,t,r)=>HH(e,t,{mode:r});function vk(e,t){return t.reduce((r,o)=>lt(r)?r[o]:void 0,e)}function $k(e,t,r,o,n,s){let i=t.exists?`${e}${JH}`:null;if(i&&!DH(i))LH(e,i);let a=`${e}.${process.pid}.tmp`,c=t.mode??n;try{s(a,KH(t,r),c),MH(a,c),FH(a,e)}catch(d){throw VH(a,{force:!0}),d}let u=Ng(e);return u.ok&&o.every((d)=>GH(vk(u.doc.data,d),vk(r,d)))?{ok:!0,backup:i}:{ok:!1,reason:"verify after write",backup:i}}var Ag="grove-mcp",YH="iis-grove-mcp";function wk(e){let t=Ls.join(e,".config","iis","settings.json");try{let r=JSON.parse(BH(t,"utf8")),o=lt(r)?r.mcp:void 0;if(o===void 0)return{file:t,readable:lt(r),mcp:{}};if(lt(o))return{file:t,readable:!0,mcp:o}}catch{}return{file:t,readable:!1,mcp:{}}}function Rk(e){if(!lt(e)||typeof e.command!=="string")return!1;let{command:t,args:r}=e;return(t==="iis"||t.endsWith("/iis"))&&Array.isArray(r)&&r[0]==="mcp"}function XH(e){for(let t=1;t<e.length;t++){let r=e[t];if(r==="--profile"&&typeof e[t+1]==="string")return e[t+1];if(typeof r==="string"&&r.startsWith("--profile="))return r.slice(10)}return}function QH(e,t){let r=lt(t.profiles)?t.profiles:{},o=(n)=>Array.isArray(r[n])?r[n]:[];if(e)return{ids:o(e),label:e};if(Array.isArray(t.active)&&t.active.length>0)return{ids:t.active,label:"mcp.active"};if(typeof t.profile==="string"&&t.profile)return{ids:o(t.profile),label:t.profile};return{ids:[],label:"dev"}}function eG(e){let t=WH(e,{throwIfNoEntry:!1});return t!==void 0&&t.isFile()&&(t.mode&73)!==0}function tG(e,t){if(t.platform==="win32")return!1;let r=lt(e.env)?e.env:{},o=(i)=>typeof r[i]==="string"&&r[i]?r[i]:t.env[i],n=o("IISTOOLS_DIR");return[...(o("PATH")??"").split(Ls.delimiter).filter((i)=>Ls.isAbsolute(i)),n?Ls.join(n,"bin"):Ls.join(t.home,".iistools","bin")].some((i)=>eG(Ls.join(i,YH)))}function Ek(e,t,r){for(let[o,n]of Object.entries(e)){if(t.has(o)||!Rk(n))continue;let{ids:s,label:i}=QH(XH(n.args),r.settings.mcp);if(s.includes(Ag)&&tG(n,r))return{key:o,label:i}}return null}function jg(e){return Object.values(e).some(Rk)}function zk(e){return lt(e)&&ja(e)}import{mkdirSync as rG,rmdirSync as oG,rmSync as nG,statSync as sG}from"node:fs";var iG=1e4,Pk=[100,200,400,600,700];function Tk(e,t){let r=`${e}.lock`;for(let o=0;;o++){try{return rG(r),()=>oG(r)}catch(s){if(s.code!=="EEXIST")throw s}let n=sG(r,{throwIfNoEntry:!1});if(!n||t.now()-n.mtimeMs>iG){nG(r,{recursive:!0,force:!0});continue}if(o>=Pk.length)return null;t.sleep(Pk[o])}}var pG="npx -y @iistools/grove-mcp install",Lg="claude mcp add -s user grove -- npx -y @iistools/grove-mcp",fG='{"command": "npx", "args": ["-y", "@iistools/grove-mcp"]}',Ik=`Usage: iis-grove-mcp install [--dry-run] [--force] [--client <name>]...
60
+ deps: ${l}}`};let o={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(c){let[u,l]=s(c);i(c,u),a(c,l)}};function s({schema:c}){let u={},l={};for(let d in c){if(d==="__proto__")continue;let p=Array.isArray(c[d])?u:l;p[d]=c[d]}return[u,l]}function i(c,u=c.schema){let{gen:l,data:d,it:p}=c;if(Object.keys(u).length===0)return;let m=l.let("missing");for(let h in u){let g=u[h];if(g.length===0)continue;let _=(0,n.propertyInData)(l,d,h,p.opts.ownProperties);if(c.setParams({property:h,depsCount:g.length,deps:g.join(", ")}),p.allErrors)l.if(_,()=>{for(let y of g)(0,n.checkReportMissingProp)(c,y)});else l.if(t._`${_} && (${(0,n.checkMissingProp)(c,g,m)})`),(0,n.reportMissingProp)(c,m),l.else()}}e.validatePropertyDeps=i;function a(c,u=c.schema){let{gen:l,data:d,keyword:p,it:m}=c,h=l.name("valid");for(let g in u){if((0,r.alwaysValidSchema)(m,u[g]))continue;l.if((0,n.propertyInData)(l,d,g,m.opts.ownProperties),()=>{let _=c.subschema({keyword:p,schemaProp:g},h);c.mergeValidEvaluated(_,h)},()=>l.var(h,!0)),c.ok(h)}}e.validateSchemaDeps=a,e.default=o}),UN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r=Oe(),n={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:o})=>t._`{propertyName: ${o.propertyName}}`},code(o){let{gen:s,schema:i,data:a,it:c}=o;if((0,r.alwaysValidSchema)(c,i))return;let u=s.name("valid");s.forIn("key",a,(l)=>{o.setParams({propertyName:l}),o.subschema({keyword:"propertyNames",data:l,dataTypes:["string"],propertyName:l,compositeRule:!0},u),s.if((0,t.not)(u),()=>{if(o.error(!0),!c.allErrors)s.break()})}),o.ok(u)}};e.default=n}),zb=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=gr(),r=be(),n=hr(),o=Oe(),s={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:i})=>r._`{additionalProperty: ${i.additionalProperty}}`},code(i){let{gen:a,schema:c,parentSchema:u,data:l,errsCount:d,it:p}=i;if(!d)throw Error("ajv implementation error");let{allErrors:m,opts:h}=p;if(p.props=!0,h.removeAdditional!=="all"&&(0,o.alwaysValidSchema)(p,c))return;let g=(0,t.allSchemaProperties)(u.properties),_=(0,t.allSchemaProperties)(u.patternProperties);y(),i.ok(r._`${d} === ${n.default.errors}`);function y(){a.forIn("key",l,(R)=>{if(!g.length&&!_.length)w(R);else a.if(S(R),()=>w(R))})}function S(R){let b;if(g.length>8){let E=(0,o.schemaRefOrVal)(p,u.properties,"properties");b=(0,t.isOwnProperty)(a,E,R)}else if(g.length)b=(0,r.or)(...g.map((E)=>r._`${R} === ${E}`));else b=r.nil;if(_.length)b=(0,r.or)(b,..._.map((E)=>r._`${(0,t.usePattern)(i,E)}.test(${R})`));return(0,r.not)(b)}function v(R){a.code(r._`delete ${l}[${R}]`)}function w(R){if(h.removeAdditional==="all"||h.removeAdditional&&c===!1){v(R);return}if(c===!1){if(i.setParams({additionalProperty:R}),i.error(),!m)a.break();return}if(typeof c=="object"&&!(0,o.alwaysValidSchema)(p,c)){let b=a.name("valid");if(h.removeAdditional==="failing")z(R,b,!1),a.if((0,r.not)(b),()=>{i.reset(),v(R)});else if(z(R,b),!m)a.if((0,r.not)(b),()=>a.break())}}function z(R,b,E){let x={keyword:"additionalProperties",dataProp:R,dataPropType:o.Type.Str};if(E===!1)Object.assign(x,{compositeRule:!0,createErrors:!1,allErrors:!1});i.subschema(x,b)}}};e.default=s}),FN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ds(),r=gr(),n=Oe(),o=zb(),s={keyword:"properties",type:"object",schemaType:"object",code(i){let{gen:a,schema:c,parentSchema:u,data:l,it:d}=i;if(d.opts.removeAdditional==="all"&&u.additionalProperties===void 0)o.default.code(new t.KeywordCxt(d,o.default,"additionalProperties"));let p=(0,r.allSchemaProperties)(c);for(let y of p)d.definedProperties.add(y);if(d.opts.unevaluated&&p.length&&d.props!==!0)d.props=n.mergeEvaluated.props(a,(0,n.toHash)(p),d.props);let m=p.filter((y)=>!(0,n.alwaysValidSchema)(d,c[y]));if(m.length===0)return;let h=a.name("valid");for(let y of m){if(g(y))_(y);else{if(a.if((0,r.propertyInData)(a,l,y,d.opts.ownProperties)),_(y),!d.allErrors)a.else().var(h,!0);a.endIf()}i.it.definedProperties.add(y),i.ok(h)}function g(y){return d.opts.useDefaults&&!d.compositeRule&&c[y].default!==void 0}function _(y){i.subschema({keyword:"properties",schemaProp:y,dataProp:y},h)}}};e.default=s}),VN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=gr(),r=be(),n=Oe(),o=Oe(),s={keyword:"patternProperties",type:"object",schemaType:"object",code(i){let{gen:a,schema:c,data:u,parentSchema:l,it:d}=i,{opts:p}=d,m=(0,t.allSchemaProperties)(c),h=m.filter((z)=>(0,n.alwaysValidSchema)(d,c[z]));if(m.length===0||h.length===m.length&&(!d.opts.unevaluated||d.props===!0))return;let g=p.strictSchema&&!p.allowMatchingProperties&&l.properties,_=a.name("valid");if(d.props!==!0&&!(d.props instanceof r.Name))d.props=(0,o.evaluatedPropsToName)(a,d.props);let{props:y}=d;S();function S(){for(let z of m){if(g)v(z);if(d.allErrors)w(z);else a.var(_,!0),w(z),a.if(_)}}function v(z){for(let R in g)if(new RegExp(z).test(R))(0,n.checkStrictMode)(d,`property ${R} matches pattern ${z} (use allowMatchingProperties)`)}function w(z){a.forIn("key",u,(R)=>{a.if(r._`${(0,t.usePattern)(i,z)}.test(${R})`,()=>{let b=h.includes(z);if(!b)i.subschema({keyword:"patternProperties",schemaProp:z,dataProp:R,dataPropType:o.Type.Str},_);if(d.opts.unevaluated&&y!==!0)a.assign(r._`${y}[${R}]`,!0);else if(!b&&!d.allErrors)a.if((0,r.not)(_),()=>a.break())})})}}};e.default=s}),HN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Oe(),r={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(n){let{gen:o,schema:s,it:i}=n;if((0,t.alwaysValidSchema)(i,s)){n.fail();return}let a=o.name("valid");n.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},a),n.failResult(a,()=>n.reset(),()=>n.error())},error:{message:"must NOT be valid"}};e.default=r}),ZN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:gr().validateUnion,error:{message:"must match a schema in anyOf"}};e.default=t}),GN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r=Oe(),n={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:o})=>t._`{passingSchemas: ${o.passing}}`},code(o){let{gen:s,schema:i,parentSchema:a,it:c}=o;if(!Array.isArray(i))throw Error("ajv implementation error");if(c.opts.discriminator&&a.discriminator)return;let u=i,l=s.let("valid",!1),d=s.let("passing",null),p=s.name("_valid");o.setParams({passing:d}),s.block(m),o.result(l,()=>o.reset(),()=>o.error(!0));function m(){u.forEach((h,g)=>{let _;if((0,r.alwaysValidSchema)(c,h))s.var(p,!0);else _=o.subschema({keyword:"oneOf",schemaProp:g,compositeRule:!0},p);if(g>0)s.if(t._`${p} && ${l}`).assign(l,!1).assign(d,t._`[${d}, ${g}]`).else();s.if(p,()=>{if(s.assign(l,!0),s.assign(d,g),_)o.mergeEvaluated(_,t.Name)})})}}};e.default=n}),JN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Oe(),r={keyword:"allOf",schemaType:"array",code(n){let{gen:o,schema:s,it:i}=n;if(!Array.isArray(s))throw Error("ajv implementation error");let a=o.name("valid");s.forEach((c,u)=>{if((0,t.alwaysValidSchema)(i,c))return;let l=n.subschema({keyword:"allOf",schemaProp:u},a);n.ok(a),n.mergeEvaluated(l)})}};e.default=r}),KN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r=Oe(),n={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:s})=>t.str`must match "${s.ifClause}" schema`,params:({params:s})=>t._`{failingKeyword: ${s.ifClause}}`},code(s){let{gen:i,parentSchema:a,it:c}=s;if(a.then===void 0&&a.else===void 0)(0,r.checkStrictMode)(c,'"if" without "then" and "else" is ignored');let u=o(c,"then"),l=o(c,"else");if(!u&&!l)return;let d=i.let("valid",!0),p=i.name("_valid");if(m(),s.reset(),u&&l){let g=i.let("ifClause");s.setParams({ifClause:g}),i.if(p,h("then",g),h("else",g))}else if(u)i.if(p,h("then"));else i.if((0,t.not)(p),h("else"));s.pass(d,()=>s.error(!0));function m(){let g=s.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},p);s.mergeEvaluated(g)}function h(g,_){return()=>{let y=s.subschema({keyword:g},p);if(i.assign(d,p),s.mergeValidEvaluated(y,d),_)i.assign(_,t._`${g}`);else s.setParams({ifClause:g})}}}};function o(s,i){let a=s.schema[i];return a!==void 0&&!(0,r.alwaysValidSchema)(s,a)}e.default=n}),BN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Oe(),r={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:n,parentSchema:o,it:s}){if(o.if===void 0)(0,t.checkStrictMode)(s,`"${n}" without "if" is ignored`)}};e.default=r}),Pb=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Rb(),r=MN(),n=Eb(),o=LN(),s=DN(),i=Xm(),a=UN(),c=zb(),u=FN(),l=VN(),d=HN(),p=ZN(),m=GN(),h=JN(),g=KN(),_=BN();function y(S=!1){let v=[d.default,p.default,m.default,h.default,g.default,_.default,a.default,c.default,i.default,u.default,l.default];if(S)v.push(r.default,o.default);else v.push(t.default,n.default);return v.push(s.default),v}e.default=y}),WN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:n})=>t.str`must match format "${n}"`,params:({schemaCode:n})=>t._`{format: ${n}}`},code(n,o){let{gen:s,data:i,$data:a,schema:c,schemaCode:u,it:l}=n,{opts:d,errSchemaPath:p,schemaEnv:m,self:h}=l;if(!d.validateFormats)return;if(a)g();else _();function g(){let y=s.scopeValue("formats",{ref:h.formats,code:d.code.formats}),S=s.const("fDef",t._`${y}[${u}]`),v=s.let("fType"),w=s.let("format");s.if(t._`typeof ${S} == "object" && !(${S} instanceof RegExp)`,()=>s.assign(v,t._`${S}.type || "string"`).assign(w,t._`${S}.validate`),()=>s.assign(v,t._`"string"`).assign(w,S)),n.fail$data((0,t.or)(z(),R()));function z(){if(d.strictSchema===!1)return t.nil;return t._`${u} && !${w}`}function R(){let b=m.$async?t._`(${S}.async ? await ${w}(${i}) : ${w}(${i}))`:t._`${w}(${i})`,E=t._`(typeof ${w} == "function" ? ${b} : ${w}.test(${i}))`;return t._`${w} && ${w} !== true && ${v} === ${o} && !${E}`}}function _(){let y=h.formats[c];if(!y){z();return}if(y===!0)return;let[S,v,w]=R(y);if(S===o)n.pass(b());function z(){if(d.strictSchema===!1){h.logger.warn(E());return}throw Error(E());function E(){return`unknown format "${c}" ignored in schema at path "${p}"`}}function R(E){let x=E instanceof RegExp?(0,t.regexpCode)(E):d.code.formats?t._`${d.code.formats}${(0,t.getProperty)(c)}`:void 0,q=s.scopeValue("formats",{key:c,ref:E,code:x});if(typeof E=="object"&&!(E instanceof RegExp))return[E.type||"string",E.validate,t._`${q}.validate`];return["string",E,q]}function b(){if(typeof y=="object"&&!(y instanceof RegExp)&&y.async){if(!m.$async)throw Error("async format in sync schema");return t._`await ${w}(${i})`}return typeof v=="function"?t._`${w}(${i})`:t._`${w}.test(${i})`}}}};e.default=r}),Tb=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=[WN().default];e.default=t}),Ib=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.contentVocabulary=e.metadataVocabulary=void 0,e.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],e.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]}),kb=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=$b(),r=wb(),n=Pb(),o=Tb(),s=Ib(),i=[t.default,r.default,(0,n.default)(),o.default,s.metadataVocabulary,s.contentVocabulary];e.default=i}),YN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0;var t;(function(r){r.Tag="tag",r.Mapping="mapping"})(t||(e.DiscrError=t={}))}),Qm=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r=YN(),n=Kl(),o=ps(),s=Oe(),i={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:a,tagName:c}})=>a===r.DiscrError.Tag?`tag "${c}" must be string`:`value of tag "${c}" must be in oneOf`,params:({params:{discrError:a,tag:c,tagName:u}})=>t._`{error: ${a}, tag: ${u}, tagValue: ${c}}`},code(a){let{gen:c,data:u,schema:l,parentSchema:d,it:p}=a,{oneOf:m}=d;if(!p.opts.discriminator)throw Error("discriminator: requires discriminator option");let h=l.propertyName;if(typeof h!="string")throw Error("discriminator: requires propertyName");if(l.mapping)throw Error("discriminator: mapping is not supported");if(!m)throw Error("discriminator: requires oneOf keyword");let g=c.let("valid",!1),_=c.const("tag",t._`${u}${(0,t.getProperty)(h)}`);c.if(t._`typeof ${_} == "string"`,()=>y(),()=>a.error(!1,{discrError:r.DiscrError.Tag,tag:_,tagName:h})),a.ok(g);function y(){let w=v();c.if(!1);for(let z in w)c.elseIf(t._`${_} === ${z}`),c.assign(g,S(w[z]));c.else(),a.error(!1,{discrError:r.DiscrError.Mapping,tag:_,tagName:h}),c.endIf()}function S(w){let z=c.name("valid"),R=a.subschema({keyword:"oneOf",schemaProp:w},z);return a.mergeEvaluated(R,t.Name),z}function v(){var w;let z={},R=E(d),b=!0;for(let C=0;C<m.length;C++){let F=m[C];if((F===null||F===void 0?void 0:F.$ref)&&!(0,s.schemaHasRulesButRef)(F,p.self.RULES)){let Z=F.$ref;if(F=n.resolveRef.call(p.self,p.schemaEnv.root,p.baseId,Z),F instanceof n.SchemaEnv)F=F.schema;if(F===void 0)throw new o.default(p.opts.uriResolver,p.baseId,Z)}let B=(w=F===null||F===void 0?void 0:F.properties)===null||w===void 0?void 0:w[h];if(typeof B!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${h}"`);b=b&&(R||E(F)),x(B,C)}if(!b)throw Error(`discriminator: "${h}" must be required`);return z;function E({required:C}){return Array.isArray(C)&&C.includes(h)}function x(C,F){if(C.const)q(C.const,F);else if(C.enum)for(let B of C.enum)q(B,F);else throw Error(`discriminator: "properties/${h}" must have "const" or "enum"`)}function q(C,F){if(typeof C!="string"||C in z)throw Error(`discriminator: "${h}" values must be unique strings`);z[C]=F}}}};e.default=i}),XN=J((e,t)=>{t.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}}),Ob=J((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv=void 0;let r=Bm(),n=kb(),o=Qm(),s=XN(),i=["/properties"],a="http://json-schema.org/draft-07/schema";var c=class extends r.default{_addVocabularies(){if(super._addVocabularies(),n.default.forEach((m)=>this.addVocabulary(m)),this.opts.discriminator)this.addKeyword(o.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let m=this.opts.$data?this.$dataMetaSchema(s,i):s;this.addMetaSchema(m,a,!1),this.refs["http://json-schema.org/schema"]=a}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(a)?a:void 0)}};e.Ajv=c,t.exports=e=c,t.exports.Ajv=c,Object.defineProperty(e,"__esModule",{value:!0}),e.default=c;var u=ds();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var l=be();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return l._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return l.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return l.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return l.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return l.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return l.CodeGen}});var d=ma();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return d.default}});var p=ps();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return p.default}})}),xb=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicAnchor=void 0;let t=be(),r=hr(),n=Kl(),o=Wm(),s={keyword:"$dynamicAnchor",schemaType:"string",code:(c)=>i(c,c.schema)};function i(c,u){let{gen:l,it:d}=c;d.schemaEnv.root.dynamicAnchors[u]=!0;let p=t._`${r.default.dynamicAnchors}${(0,t.getProperty)(u)}`,m=d.errSchemaPath==="#"?d.validateName:a(c);l.if(t._`!${p}`,()=>l.assign(p,m))}e.dynamicAnchor=i;function a(c){let{schemaEnv:u,schema:l,self:d}=c.it,{root:p,baseId:m,localRefs:h,meta:g}=u.root,{schemaId:_}=d.opts,y=new n.SchemaEnv({schema:l,schemaId:_,root:p,baseId:m,localRefs:h,meta:g});return n.compileSchema.call(d,y),(0,o.getValidate)(c,y)}e.default=s}),Cb=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicRef=void 0;let t=be(),r=hr(),n=Wm(),o={keyword:"$dynamicRef",schemaType:"string",code:(i)=>s(i,i.schema)};function s(i,a){let{gen:c,keyword:u,it:l}=i;if(a[0]!=="#")throw Error(`"${u}" only supports hash fragment reference`);let d=a.slice(1);if(l.allErrors)p();else{let h=c.let("valid",!1);p(h),i.ok(h)}function p(h){if(l.schemaEnv.root.dynamicAnchors[d]){let g=c.let("_v",t._`${r.default.dynamicAnchors}${(0,t.getProperty)(d)}`);c.if(g,m(g,h),m(l.validateName,h))}else m(l.validateName,h)()}function m(h,g){return g?()=>c.block(()=>{(0,n.callRef)(i,h),c.let(g,!0)}):()=>(0,n.callRef)(i,h)}}e.dynamicRef=s,e.default=o}),QN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=xb(),r=Oe(),n={keyword:"$recursiveAnchor",schemaType:"boolean",code(o){if(o.schema)(0,t.dynamicAnchor)(o,"");else(0,r.checkStrictMode)(o.it,"$recursiveAnchor: false is ignored")}};e.default=n}),e1=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Cb(),r={keyword:"$recursiveRef",schemaType:"string",code:(n)=>(0,t.dynamicRef)(n,n.schema)};e.default=r}),Ab=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=xb(),r=Cb(),n=QN(),o=e1(),s=[t.default,r.default,n.default,o.default];e.default=s}),t1=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Xm(),r={keyword:"dependentRequired",type:"object",schemaType:"object",error:t.error,code:(n)=>(0,t.validatePropertyDeps)(n)};e.default=r}),r1=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Xm(),r={keyword:"dependentSchemas",type:"object",schemaType:"object",code:(n)=>(0,t.validateSchemaDeps)(n)};e.default=r}),n1=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Oe(),r={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:n,parentSchema:o,it:s}){if(o.contains===void 0)(0,t.checkStrictMode)(s,`"${n}" without "contains" is ignored`)}};e.default=r}),Nb=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=t1(),r=r1(),n=n1(),o=[t.default,r.default,n.default];e.default=o}),o1=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r=Oe(),n=hr(),o={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:s})=>t._`{unevaluatedProperty: ${s.unevaluatedProperty}}`},code(s){let{gen:i,schema:a,data:c,errsCount:u,it:l}=s;if(!u)throw Error("ajv implementation error");let{allErrors:d,props:p}=l;if(p instanceof t.Name)i.if(t._`${p} !== true`,()=>i.forIn("key",c,(_)=>i.if(h(p,_),()=>m(_))));else if(p!==!0)i.forIn("key",c,(_)=>p===void 0?m(_):i.if(g(p,_),()=>m(_)));l.props=!0,s.ok(t._`${u} === ${n.default.errors}`);function m(_){if(a===!1){if(s.setParams({unevaluatedProperty:_}),s.error(),!d)i.break();return}if(!(0,r.alwaysValidSchema)(l,a)){let y=i.name("valid");if(s.subschema({keyword:"unevaluatedProperties",dataProp:_,dataPropType:r.Type.Str},y),!d)i.if((0,t.not)(y),()=>i.break())}}function h(_,y){return t._`!${_} || !${_}[${y}]`}function g(_,y){let S=[];for(let v in _)if(_[v]===!0)S.push(t._`${y} !== ${v}`);return(0,t.and)(...S)}}};e.default=o}),s1=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r=Oe(),n={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:o}})=>t.str`must NOT have more than ${o} items`,params:({params:{len:o}})=>t._`{limit: ${o}}`},code(o){let{gen:s,schema:i,data:a,it:c}=o,u=c.items||0;if(u===!0)return;let l=s.const("len",t._`${a}.length`);if(i===!1)o.setParams({len:u}),o.fail(t._`${l} > ${u}`);else if(typeof i=="object"&&!(0,r.alwaysValidSchema)(c,i)){let p=s.var("valid",t._`${l} <= ${u}`);s.if((0,t.not)(p),()=>d(p,u)),o.ok(p)}c.items=!0;function d(p,m){s.forRange("i",m,l,(h)=>{if(o.subschema({keyword:"unevaluatedItems",dataProp:h,dataPropType:r.Type.Num},p),!c.allErrors)s.if((0,t.not)(p),()=>s.break())})}}};e.default=n}),jb=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=o1(),r=s1(),n=[t.default,r.default];e.default=n}),i1=J((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/schema",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0,"https://json-schema.org/draft/2019-09/vocab/applicator":!0,"https://json-schema.org/draft/2019-09/vocab/validation":!0,"https://json-schema.org/draft/2019-09/vocab/meta-data":!0,"https://json-schema.org/draft/2019-09/vocab/format":!1,"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format"},{$ref:"meta/content"}],type:["object","boolean"],properties:{definitions:{$comment:"While no longer an official keyword as it is replaced by $defs, this keyword is retained in the meta-schema to prevent incompatible extensions as it remains in common use.",type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},dependencies:{$comment:'"dependencies" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to "dependentSchemas" and "dependentRequired"',type:"object",additionalProperties:{anyOf:[{$recursiveRef:"#"},{$ref:"meta/validation#/$defs/stringArray"}]}}}}}),a1=J((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/applicator":!0},$recursiveAnchor:!0,title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{additionalItems:{$recursiveRef:"#"},unevaluatedItems:{$recursiveRef:"#"},items:{anyOf:[{$recursiveRef:"#"},{$ref:"#/$defs/schemaArray"}]},contains:{$recursiveRef:"#"},additionalProperties:{$recursiveRef:"#"},unevaluatedProperties:{$recursiveRef:"#"},properties:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$recursiveRef:"#"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$recursiveRef:"#"}},propertyNames:{$recursiveRef:"#"},if:{$recursiveRef:"#"},then:{$recursiveRef:"#"},else:{$recursiveRef:"#"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$recursiveRef:"#"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$recursiveRef:"#"}}}}}),c1=J((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/content",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentMediaType:{type:"string"},contentEncoding:{type:"string"},contentSchema:{$recursiveRef:"#"}}}}),u1=J((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/core",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0},$recursiveAnchor:!0,title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{type:"string",format:"uri"},$anchor:{type:"string",pattern:"^[A-Za-z][-A-Za-z0-9.:_]*$"},$ref:{type:"string",format:"uri-reference"},$recursiveRef:{type:"string",format:"uri-reference"},$recursiveAnchor:{type:"boolean",default:!1},$vocabulary:{type:"object",propertyNames:{type:"string",format:"uri"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}}}}}),l1=J((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/format",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/format":!0},$recursiveAnchor:!0,title:"Format vocabulary meta-schema",type:["object","boolean"],properties:{format:{type:"string"}}}}),d1=J((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/meta-data":!0},$recursiveAnchor:!0,title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}}),p1=J((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/validation",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/validation":!0},$recursiveAnchor:!0,title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}},const:!0,enum:{type:"array",items:!0},type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}}),f1=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=i1(),r=a1(),n=c1(),o=u1(),s=l1(),i=d1(),a=p1(),c=["/properties"];function u(l){return[t,r,n,o,d(this,s),i,d(this,a)].forEach((p)=>this.addMetaSchema(p,void 0,!1)),this;function d(p,m){return l?p.$dataMetaSchema(m,c):m}}e.default=u}),m1=J((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv2019=void 0;let r=Bm(),n=kb(),o=Ab(),s=Nb(),i=jb(),a=Qm(),c=f1(),u="https://json-schema.org/draft/2019-09/schema";var l=class extends r.default{constructor(g={}){super({...g,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){if(super._addVocabularies(),this.addVocabulary(o.default),n.default.forEach((g)=>this.addVocabulary(g)),this.addVocabulary(s.default),this.addVocabulary(i.default),this.opts.discriminator)this.addKeyword(a.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:g,meta:_}=this.opts;if(!_)return;c.default.call(this,g),this.refs["http://json-schema.org/schema"]=u}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(u)?u:void 0)}};e.Ajv2019=l,t.exports=e=l,t.exports.Ajv2019=l,Object.defineProperty(e,"__esModule",{value:!0}),e.default=l;var d=ds();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return d.KeywordCxt}});var p=be();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return p._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return p.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return p.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return p.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return p.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return p.CodeGen}});var m=ma();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return m.default}});var h=ps();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return h.default}})}),h1=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=$b(),r=wb(),n=Pb(),o=Ab(),s=Nb(),i=jb(),a=Tb(),c=Ib(),u=[o.default,t.default,r.default,(0,n.default)(!0),a.default,c.metadataVocabulary,c.contentVocabulary,s.default,i.default];e.default=u}),g1=J((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/schema",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/unevaluated"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format-annotation"},{$ref:"meta/content"}],type:["object","boolean"],$comment:"This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",properties:{definitions:{$comment:'"definitions" has been replaced by "$defs".',type:"object",additionalProperties:{$dynamicRef:"#meta"},deprecated:!0,default:{}},dependencies:{$comment:'"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',type:"object",additionalProperties:{anyOf:[{$dynamicRef:"#meta"},{$ref:"meta/validation#/$defs/stringArray"}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:'"$recursiveAnchor" has been replaced by "$dynamicAnchor".',$ref:"meta/core#/$defs/anchorString",deprecated:!0},$recursiveRef:{$comment:'"$recursiveRef" has been replaced by "$dynamicRef".',$ref:"meta/core#/$defs/uriReferenceString",deprecated:!0}}}}),y1=J((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/applicator":!0},$dynamicAnchor:"meta",title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{prefixItems:{$ref:"#/$defs/schemaArray"},items:{$dynamicRef:"#meta"},contains:{$dynamicRef:"#meta"},additionalProperties:{$dynamicRef:"#meta"},properties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},patternProperties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},propertyNames:{$dynamicRef:"#meta"},if:{$dynamicRef:"#meta"},then:{$dynamicRef:"#meta"},else:{$dynamicRef:"#meta"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$dynamicRef:"#meta"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$dynamicRef:"#meta"}}}}}),_1=J((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/unevaluated",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},$dynamicAnchor:"meta",title:"Unevaluated applicator vocabulary meta-schema",type:["object","boolean"],properties:{unevaluatedItems:{$dynamicRef:"#meta"},unevaluatedProperties:{$dynamicRef:"#meta"}}}}),v1=J((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/content",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentEncoding:{type:"string"},contentMediaType:{type:"string"},contentSchema:{$dynamicRef:"#meta"}}}}),S1=J((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/core",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0},$dynamicAnchor:"meta",title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{$ref:"#/$defs/uriReferenceString",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{$ref:"#/$defs/uriString"},$ref:{$ref:"#/$defs/uriReferenceString"},$anchor:{$ref:"#/$defs/anchorString"},$dynamicRef:{$ref:"#/$defs/uriReferenceString"},$dynamicAnchor:{$ref:"#/$defs/anchorString"},$vocabulary:{type:"object",propertyNames:{$ref:"#/$defs/uriString"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$dynamicRef:"#meta"}}},$defs:{anchorString:{type:"string",pattern:"^[A-Za-z_][-A-Za-z0-9._]*$"},uriString:{type:"string",format:"uri"},uriReferenceString:{type:"string",format:"uri-reference"}}}}),b1=J((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/format-annotation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},$dynamicAnchor:"meta",title:"Format vocabulary meta-schema for annotation results",type:["object","boolean"],properties:{format:{type:"string"}}}}),$1=J((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},$dynamicAnchor:"meta",title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}}),w1=J((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/validation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/validation":!0},$dynamicAnchor:"meta",title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}}),R1=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=g1(),r=y1(),n=_1(),o=v1(),s=S1(),i=b1(),a=$1(),c=w1(),u=["/properties"];function l(d){return[t,r,n,o,s,p(this,i),a,p(this,c)].forEach((m)=>this.addMetaSchema(m,void 0,!1)),this;function p(m,h){return d?m.$dataMetaSchema(h,u):h}}e.default=l}),E1=J((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv2020=void 0;let r=Bm(),n=h1(),o=Qm(),s=R1(),i="https://json-schema.org/draft/2020-12/schema";var a=class extends r.default{constructor(p={}){super({...p,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){if(super._addVocabularies(),n.default.forEach((p)=>this.addVocabulary(p)),this.opts.discriminator)this.addKeyword(o.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:p,meta:m}=this.opts;if(!m)return;s.default.call(this,p),this.refs["http://json-schema.org/schema"]=i}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(i)?i:void 0)}};e.Ajv2020=a,t.exports=e=a,t.exports.Ajv2020=a,Object.defineProperty(e,"__esModule",{value:!0}),e.default=a;var c=ds();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var u=be();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return u._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return u.CodeGen}});var l=ma();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return l.default}});var d=ps();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return d.default}})}),z1=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(C,F){return{validate:C,compare:F}}e.fullFormats={date:t(s,i),time:t(c(!0),u),"date-time":t(p(!0),m),"iso-time":t(c(),l),"iso-date-time":t(p(),h),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:y,"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:q,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:v,int32:{type:"number",validate:R},int64:{type:"number",validate:b},float:{type:"number",validate:E},double:{type:"number",validate:E},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,i),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,u),"date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,m),"iso-time":t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,l),"iso-date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,h),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},e.formatNames=Object.keys(e.fullFormats);function r(C){return C%4===0&&(C%100!==0||C%400===0)}let n=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,o=[0,31,28,31,30,31,30,31,31,30,31,30,31];function s(C){let F=n.exec(C);if(!F)return!1;let B=+F[1],Z=+F[2],ge=+F[3];return Z>=1&&Z<=12&&ge>=1&&ge<=(Z===2&&r(B)?29:o[Z])}function i(C,F){if(!(C&&F))return;if(C>F)return 1;if(C<F)return-1;return 0}let a=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function c(C){return function(B){let Z=a.exec(B);if(!Z)return!1;let ge=+Z[1],Ie=+Z[2],Ae=+Z[3],Ue=Z[4],Pe=Z[5]==="-"?-1:1,O=+(Z[6]||0),M=+(Z[7]||0);if(O>23||M>59||C&&!Ue)return!1;if(ge<=23&&Ie<=59&&Ae<60)return!0;let K=Ie-M*Pe,P=ge-O*Pe-(K<0?1:0);return(P===23||P===-1)&&(K===59||K===-1)&&Ae<61}}function u(C,F){if(!(C&&F))return;let B=new Date("2020-01-01T"+C).valueOf(),Z=new Date("2020-01-01T"+F).valueOf();if(!(B&&Z))return;return B-Z}function l(C,F){if(!(C&&F))return;let B=a.exec(C),Z=a.exec(F);if(!(B&&Z))return;if(C=B[1]+B[2]+B[3],F=Z[1]+Z[2]+Z[3],C>F)return 1;if(C<F)return-1;return 0}let d=/t|\s/i;function p(C){let F=c(C);return function(Z){let ge=Z.split(d);return ge.length===2&&s(ge[0])&&F(ge[1])}}function m(C,F){if(!(C&&F))return;let B=new Date(C).valueOf(),Z=new Date(F).valueOf();if(!(B&&Z))return;return B-Z}function h(C,F){if(!(C&&F))return;let[B,Z]=C.split(d),[ge,Ie]=F.split(d),Ae=i(B,ge);if(Ae===void 0)return;return Ae||u(Z,Ie)}let g=/\/|:/,_=/^(?:[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 y(C){return g.test(C)&&_.test(C)}let S=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function v(C){return S.lastIndex=0,S.test(C)}let w=-2147483648,z=2147483647;function R(C){return Number.isInteger(C)&&C<=z&&C>=w}function b(C){return Number.isInteger(C)}function E(){return!0}let x=/[^\\]\\Z/;function q(C){if(x.test(C))return!1;try{return new RegExp(C),!0}catch(F){return!1}}}),P1=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;let t=Ob(),r=be(),n=r.operators,o={formatMaximum:{okStr:"<=",ok:n.LTE,fail:n.GT},formatMinimum:{okStr:">=",ok:n.GTE,fail:n.LT},formatExclusiveMaximum:{okStr:"<",ok:n.LT,fail:n.GTE},formatExclusiveMinimum:{okStr:">",ok:n.GT,fail:n.LTE}},s={message:({keyword:a,schemaCode:c})=>r.str`should be ${o[a].okStr} ${c}`,params:({keyword:a,schemaCode:c})=>r._`{comparison: ${o[a].okStr}, limit: ${c}}`};e.formatLimitDefinition={keyword:Object.keys(o),type:"string",schemaType:"string",$data:!0,error:s,code(a){let{gen:c,data:u,schemaCode:l,keyword:d,it:p}=a,{opts:m,self:h}=p;if(!m.validateFormats)return;let g=new t.KeywordCxt(p,h.RULES.all.format.definition,"format");if(g.$data)_();else y();function _(){let v=c.scopeValue("formats",{ref:h.formats,code:m.code.formats}),w=c.const("fmt",r._`${v}[${g.schemaCode}]`);a.fail$data((0,r.or)(r._`typeof ${w} != "object"`,r._`${w} instanceof RegExp`,r._`typeof ${w}.compare != "function"`,S(w)))}function y(){let v=g.schema,w=h.formats[v];if(!w||w===!0)return;if(typeof w!="object"||w instanceof RegExp||typeof w.compare!="function")throw Error(`"${d}": format "${v}" does not define "compare" function`);let z=c.scopeValue("formats",{key:v,ref:w,code:m.code.formats?r._`${m.code.formats}${(0,r.getProperty)(v)}`:void 0});a.fail$data(S(z))}function S(v){return r._`${v}.compare(${u}, ${l}) ${o[d].fail} 0`}},dependencies:["format"]};let i=(a)=>(a.addKeyword(e.formatLimitDefinition),a);e.default=i}),T1=J((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0});let r=z1(),n=P1(),o=be(),s=new o.Name("fullFormats"),i=new o.Name("fastFormats"),a=(u,l={keywords:!0})=>{if(Array.isArray(l))return c(u,l,r.fullFormats,s),u;let[d,p]=l.mode==="fast"?[r.fastFormats,i]:[r.fullFormats,s];if(c(u,l.formats||r.formatNames,d,p),l.keywords)(0,n.default)(u);return u};a.get=(u,l="full")=>{let d=(l==="fast"?r.fastFormats:r.fullFormats)[u];if(!d)throw Error(`Unknown format "${u}"`);return d};function c(u,l,d,p){var m,h;(m=(h=u.opts.code).formats)!==null&&m!==void 0||(h.formats=o._`require("ajv-formats/dist/formats").${p}`);for(let g of l)u.addFormat(g,d[g])}t.exports=e=a,Object.defineProperty(e,"__esModule",{value:!0}),e.default=a}),qb=Ob(),I1=m1(),k1=E1(),O1=mc(T1(),1),x1=O1.default;function Km(e){let t=new e({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return x1(t),t}var Bl=class{_ajv;_ajvDraft7;_ajv2019;_userAjv;constructor(e){this._userAjv=e!==void 0,this._ajv=e}get ajv(){return this._ajv??=Km(k1.Ajv2020)}_engineFor(e){if(this._userAjv)return this.ajv;let t=Py(e,"pass a pre-configured Ajv instance to AjvJsonSchemaValidator(ajv) to validate other dialects.");if(t==="2020-12")return this.ajv;if(t==="2019-09")return this._ajv2019??=Km(I1.Ajv2019);return this._ajvDraft7??=Km(qb.Ajv)}getValidator(e){let t=this._engineFor(e),r="$id"in e&&typeof e.$id==="string"?t.getSchema(e.$id)??t.compile(e):t.compile(e);return(n)=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:t.errorsText(r.errors)}}},eB=qb.Ajv;import eh from"node:process";var Gb=Symbol.for("mcp.completable");function rh(e){return!!e&&typeof e==="object"&&Gb in e}function A1(e){return e[Gb]?.complete}function N1(e,t){switch(t.kind){case"tools_list_changed":return e.toolsListChanged===!0;case"prompts_list_changed":return e.promptsListChanged===!0;case"resources_list_changed":return e.resourcesListChanged===!0;case"resource_updated":return e.resourceSubscriptions!==void 0&&e.resourceSubscriptions.includes(t.uri)}}function j1(e,t){let r={},n=(o)=>t===void 0||o===!0;if(e.toolsListChanged===!0&&n(t?.tools?.listChanged))r.toolsListChanged=!0;if(e.promptsListChanged===!0&&n(t?.prompts?.listChanged))r.promptsListChanged=!0;if(e.resourcesListChanged===!0&&n(t?.resources?.listChanged))r.resourcesListChanged=!0;if(e.resourceSubscriptions!==void 0&&e.resourceSubscriptions.length>0&&n(t?.resources?.subscribe))r.resourceSubscriptions=[...e.resourceSubscriptions];return r}var Wl=1024;function Mb(e,t){return{method:e.method,params:{...e.params,_meta:{...e.params?._meta,[fo]:t}}}}function q1(e){let t=vn(pa).validateRequest("subscriptions/listen",e);return t.ok?t.value.params?.notifications:void 0}var M1=new Set(["notifications/tools/list_changed","notifications/prompts/list_changed","notifications/resources/list_changed","notifications/resources/updated"]),Jb=class{_subs=new Map;_serverCapabilities;_serverInfo;constructor(e=Wl,t,r){this._maxSubscriptions=e,this._serverCapabilities=t,this._serverInfo=r}setServerCapabilities(e,t){if(this._serverCapabilities=e,t!==void 0)this._serverInfo=t}has(e){return this._subs.has(e)}serve(e){if(this._serverCapabilities===void 0)throw Error("StdioListenRouter.serve() called before setServerCapabilities(); refusing to honor a filter without capabilities");if(this._subs.size>=this._maxSubscriptions)return{jsonrpc:"2.0",id:e.id,error:{code:-32603,message:"Subscription limit reached"}};let t=q1(e);if(t===void 0)return{jsonrpc:"2.0",id:e.id,error:{code:-32602,message:"Invalid params: 'notifications' is required and must be a valid SubscriptionFilter"}};let r=j1(t,this._serverCapabilities);return this._subs.set(e.id,r),Mb({method:"notifications/subscriptions/acknowledged",params:{notifications:r}},e.id)}cancel(e){return this._subs.delete(e)}routeOutbound(e){if(!M1.has(e.method))return"passthrough";let t=e.params?.uri,r=typeof t==="string"?t:void 0,n=L1(e.method,r),o=[];for(let[s,i]of this._subs)if(N1(i,n))o.push(Mb({method:e.method,params:e.params??{}},s));return o}teardownAll(){let e=[];for(let t of this._subs.keys())e.push({jsonrpc:"2.0",id:t,result:{resultType:"complete",_meta:{[fo]:t,...this._serverInfo!==void 0&&{[Er]:this._serverInfo}}}});return this._subs.clear(),e}};function L1(e,t){switch(e){case"notifications/tools/list_changed":return{kind:"tools_list_changed"};case"notifications/prompts/list_changed":return{kind:"prompts_list_changed"};case"notifications/resources/list_changed":return{kind:"resources_list_changed"};default:return{kind:"resource_updated",uri:t??""}}}var D1=8,U1=600000;function F1(e){if(e?.maxRounds!==void 0&&(!Number.isInteger(e.maxRounds)||e.maxRounds<1))throw RangeError(`inputRequired.maxRounds must be a positive integer (got ${e.maxRounds})`);if(e?.roundTimeoutMs!==void 0&&(!Number.isFinite(e.roundTimeoutMs)||e.roundTimeoutMs<=0))throw RangeError(`inputRequired.roundTimeoutMs must be a positive number (got ${e.roundTimeoutMs})`);return{maxRounds:e?.maxRounds??D1,roundTimeoutMs:e?.roundTimeoutMs??U1,legacyShim:e?.legacyShim??!0}}function Kb(e,t,r){if(r===null||typeof r!=="object"||typeof r.method!=="string")throw new de(Y.InternalError,`Handler for ${e} returned an invalid input request '${t}': each inputRequests entry must be an embedded elicitation/create, sampling/createMessage, or roots/list request`);let n=r,o=D0(n);if(o===void 0)throw new de(Y.InternalError,`Handler for ${e} returned an input request '${t}' of kind '${n.method}', which is not an embedded request the 2026-07-28 revision defines`);return{embedded:n,required:o}}function V1(){let e=globalThis.crypto;if(e?.randomUUID!==void 0)return e.randomUUID();let t=new Uint8Array(16);e.getRandomValues(t),t[6]=t[6]&15|64,t[8]=t[8]&63|128;let r=[...t].map((n)=>n.toString(16).padStart(2,"0")).join("");return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20)}`}function th(e,t){if(e==="tools/call")return{content:[{type:"text",text:t}],isError:!0};throw new de(Y.InternalError,t)}var H1=class{constructor(e){this._host=e}async fulfill(e,t,r,n,o){let{maxRounds:s,roundTimeoutMs:i}=this._host,a=n.mcpReq.signal,c=o,u=0;while(!0){if(u+=1,u>s)return th(e,ab(e,s));let l=c.inputRequests,d=l!=null&&Object.keys(l).length>0,p=typeof c.requestState==="string"?c.requestState:void 0;if(!d&&p===void 0)throw new de(Y.InternalError,`Handler for ${e} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);let m;if(d){let _=this._host.resolvedClientCapabilities(n),y=[];for(let[v,w]of Object.entries(l)){let{embedded:z,required:R}=Kb(e,v,w);if(z.method!=="roots/list"&&z.params===void 0)throw new de(Y.InternalError,`Handler for ${e} returned an input request '${v}' of kind '${z.method}' without params`);if(Al(R,_)!==void 0)return th(e,`Cannot request input '${v}' (${z.method}): the client on this 2025-era connection did not declare the required capability${_===void 0?" (no client capabilities are available on this connection — per-request legacy serving cannot receive server-to-client requests)":""}`);y.push([v,z])}let S=ub(a);try{let v={relatedRequestId:n.mcpReq.id,timeout:i,resetTimeoutOnProgress:!0,onprogress:()=>{},signal:S.signal},w=await Promise.all(y.map(async([z,R])=>{try{return[z,await this._dispatchLeg(R,v)]}catch(b){throw S.abort(b),b}}));m=Object.fromEntries(w)}catch(v){if(a.aborted)throw v;return th(e,`Fulfilling input required by '${e}' failed: ${v instanceof Error?v.message:String(v)}`)}finally{S.dispose()}}else await cb(ib,a);let h={...n,mcpReq:{...n.mcpReq,inputResponses:m,droppedInputResponseKeys:void 0,requestState:fa(p)}};if(p!==void 0){let _=await this._host.verifyRequestState(p,h,e);if(_!==void 0)h=Um(h,_)}let g=await t(r,h);if(!Wr(g))return g;c=g}}async _dispatchLeg(e,t){switch(e.method){case"elicitation/create":{let r=e.params;if(r.mode==="url"&&r.elicitationId===void 0)r={...r,elicitationId:V1()};return await this._host.sendElicitation(r,t)}case"sampling/createMessage":return await this._host.sendSampling(e.params,t);case"roots/list":return await this._host.listRoots(e.params,t)}}},Z1=new Set(["tools/call","prompts/get","resources/read"]),G1,Bb,Wb;function nh(e,t){Bb(e,t)}function oh(e){return Wb(e)}var Yb=class extends Vm{_clientCapabilities;_clientVersion;static{G1=(e,t)=>{if(t.clientCapabilities!==void 0)e._clientCapabilities=t.clientCapabilities;if(t.clientInfo!==void 0)e._clientVersion=t.clientInfo},Bb=(e,t)=>{let r=t.filter((n)=>!e._supportedProtocolVersions.includes(n));if(r.length>0)e._supportedProtocolVersions=[...e._supportedProtocolVersions,...r];e.setRequestHandler("server/discover",()=>e._ondiscover())},Wb=(e)=>e._serverInfo}_capabilities;_instructions;_jsonSchemaValidator;_cacheHints;_requestStateVerify;_inputRequiredServing;_legacyShim;_legacyInputRequiredShim(){return this._legacyShim??=new H1({maxRounds:this._inputRequiredServing.maxRounds,roundTimeoutMs:this._inputRequiredServing.roundTimeoutMs,resolvedClientCapabilities:(e)=>this._inputRequestCapabilityView(e),verifyRequestState:(e,t,r)=>this._verifyRequestState(e,t,r),sendElicitation:(e,t)=>this._sendElicitationLeg(e,t,{validateAcceptedContent:!1}),sendSampling:(e,t)=>this.createMessage(e,t),listRoots:(e,t)=>this.listRoots(e,t)})}oninitialized;constructor(e,t){super(t);if(this._serverInfo=e,this._capabilities=t?.capabilities?{...t.capabilities}:{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new Bl,this._requestStateVerify=t?.requestState?.verify,this._inputRequiredServing=F1(t?.inputRequired),t?.cacheHints!==void 0){for(let[r,n]of Object.entries(t.cacheHints))if(n!==void 0)xm(n,`cacheHints['${r}']`);this._cacheHints=t.cacheHints}if(this.setRequestHandler("initialize",(r)=>this._oninitialize(r)),this.setNotificationHandler("notifications/initialized",()=>this.oninitialized?.()),zm(this._supportedProtocolVersions).length>0)this.setRequestHandler("server/discover",()=>this._ondiscover());if(this._capabilities.logging)this._registerLoggingHandler()}_registerLoggingHandler(){this.setRequestHandler("logging/setLevel",async(e,t)=>{let r=t.sessionId||t.http?.req?.headers.get("mcp-session-id")||void 0,{level:n}=e.params,o=Fl(yn,n);if(o.success)this._loggingLevels.set(r,o.data);return{}})}buildContext(e,t){let r=e.http||t?.request||t?.closeSSEStream||t?.closeStandaloneSSEStream;return{...e,mcpReq:{...e.mcpReq,log:(n,o,s)=>{if(!this._capabilities.logging)return Promise.resolve();let i;if(this._servedModernEra()){if(i=e.mcpReq.envelope?.[dn],i===void 0)return Promise.resolve()}else i=this._loggingLevels.get(e.sessionId)??this._loggingLevels.get(void 0);if(i!==void 0&&this.LOG_LEVEL_SEVERITY.get(n)<this.LOG_LEVEL_SEVERITY.get(i))return Promise.resolve();return e.mcpReq.notify({method:"notifications/message",params:{level:n,data:o,logger:s}})},elicitInput:(n,o)=>this.elicitInput(n,o),requestSampling:(n,o)=>this.createMessage(n,o)},http:r?{...e.http,req:t?.request,closeSSE:t?.closeSSEStream,closeStandaloneSSE:t?.closeStandaloneSSEStream}:void 0}}_loggingLevels=new Map;LOG_LEVEL_SEVERITY=new Map(yn.options.map((e,t)=>[e,t]));isMessageIgnored=(e,t)=>{let r=this._loggingLevels.get(t);return r?this.LOG_LEVEL_SEVERITY.get(e)<this.LOG_LEVEL_SEVERITY.get(r):!1};registerCapabilities(e){if(this.transport)throw new Se(Te.AlreadyConnected,"Cannot register capabilities after connecting to transport");let t=!!this._capabilities.logging;if(this._capabilities=Hm(this._capabilities,e),!t&&this._capabilities.logging)this._registerLoggingHandler()}_wrapHandler(e,t){if(e!=="tools/call"){let r=this._cacheHints?.[e],n=Z1.has(e);if(r===void 0&&!n)return async(o,s)=>{let i=await t(o,s);if(Wr(i))throw new de(Y.InternalError,`Handler for ${e} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return i};return async(o,s)=>{let i=n?await this._invokeInputRequiredCapableHandler(e,t,o,s):await t(o,s);if(Wr(i)){if(!n)throw new de(Y.InternalError,`Handler for ${e} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return i}return r===void 0?i:Nl(i,r)}}return async(r,n)=>{let o=vn(this._negotiatedProtocolVersion),s=o.validateRequest("tools/call",r);if(!s.ok)throw new de(s.reason==="not-in-era"?Y.InternalError:Y.InvalidParams,s.reason==="not-in-era"?"No wire schema for tools/call in the resolved era":`Invalid tools/call request: ${s.message}`);let i=await this._invokeInputRequiredCapableHandler("tools/call",t,r,n);if(Wr(i))return i;let a=Pm(i),c=o.validateResult("tools/call",a);if(!c.ok)throw new de(c.reason==="not-in-era"?Y.InternalError:Y.InvalidParams,c.reason==="not-in-era"?"No wire schema for tools/call in the resolved era":`Invalid tools/call result: ${c.message}`);return c.value}}_servedModernEra(){return this._negotiatedProtocolVersion!==void 0&&us(this._negotiatedProtocolVersion)}async _invokeInputRequiredCapableHandler(e,t,r,n){let o=this._servedModernEra(),s=n.mcpReq.requestState();if(s!==void 0&&typeof s!=="string")throw new de(Y.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"});let i=n;if(typeof s==="string"){let d=await this._verifyRequestState(s,n,e);if(d!==void 0)i=Um(n,d)}let a;try{a=await t(r,i)}catch(d){if(d instanceof de&&d.code===Y.UrlElicitationRequired){if(!o)throw d;throw new de(Y.InternalError,`URL elicitation cannot be signalled by throwing UrlElicitationRequiredError on protocol revision ${this._negotiatedProtocolVersion}: return inputRequired({ inputRequests: { …: inputRequired.elicitUrl(...) } }) from the handler instead. The urlElicitationRequired error (-32042) of earlier revisions is not available on this revision.`)}throw d}if(!Wr(a))return a;if(!o){if(!this._inputRequiredServing.legacyShim)throw new de(Y.InternalError,`Handler for ${e} returned an input-required result, but this request is served on protocol revision ${this._negotiatedProtocolVersion??po}, which has no input_required vocabulary`);return await this._legacyInputRequiredShim().fulfill(e,t,r,i,a)}let c=a.inputRequests,u=c!=null&&Object.keys(c).length>0,l=typeof a.requestState==="string";if(!u&&!l)throw new de(Y.InternalError,`Handler for ${e} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);if(u){let d=this._inputRequestCapabilityView(n);for(let[p,m]of Object.entries(c)){let{embedded:h,required:g}=Kb(e,p,m),_=Al(g,d);if(_!==void 0)throw new ql({requiredCapabilities:_},`Cannot request input '${p}' (${h.method}): the request's client capabilities do not declare the required capability`)}}return a}async _verifyRequestState(e,t,r){if(this._requestStateVerify===void 0)return;try{return await this._requestStateVerify(e,t)}catch(n){throw this.onerror?.(Error(`requestState verification rejected ${r}: ${n instanceof Error?n.message:String(n)}`)),new de(Y.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"})}}_inputRequestCapabilityView(e){return this._servedModernEra()?e.mcpReq.envelope?.[Kr]:this._clientCapabilities}_assertPushApiInServedEra(e){if(this._servedModernEra())throw new Se(Te.MethodNotSupportedByProtocolVersion,`Server-to-client requests are not available on protocol revision ${this._negotiatedProtocolVersion}: '${e}' cannot be sent while serving a request on that revision. Return inputRequired({ ... }) from the handler instead — the client fulfils the embedded requests and retries the original request (multi round-trip requests).`,{method:e,era:"2026-07-28"})}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Se(Te.CapabilityNotSupported,`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Se(Te.CapabilityNotSupported,`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Se(Te.CapabilityNotSupported,`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 new Se(Te.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Se(Te.CapabilityNotSupported,`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Se(Te.CapabilityNotSupported,`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Se(Te.CapabilityNotSupported,`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Se(Te.CapabilityNotSupported,`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"completion/complete":if(!this._capabilities.completions)throw new Se(Te.CapabilityNotSupported,`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Se(Te.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Se(Te.CapabilityNotSupported,`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Se(Te.CapabilityNotSupported,`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Se(Te.CapabilityNotSupported,`Server does not support tools (required for ${e})`);break;case"ping":case"initialize":break}}async _oninitialize(e){let t=e.params.protocolVersion;this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo;let r=F0(this._supportedProtocolVersions),n=r.includes(t)?t:r[0]??po;return this._negotiatedProtocolVersion=n,this.transport?.setProtocolVersion?.(n),{protocolVersion:n,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}_ondiscover(){return{supportedVersions:zm(this._supportedProtocolVersions),capabilities:J1(this.getCapabilities()),...this._instructions&&{instructions:this._instructions}}}_outboundServerInfo(){return this._serverInfo}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getNegotiatedProtocolVersion(){return this._negotiatedProtocolVersion}projectCallToolResult(e,t){return this._wireCodec().projectCallToolResult(e,t)}getCapabilities(){return this._capabilities}async ping(){return this._assertPushApiInServedEra("ping"),this.request({method:"ping"})}async createMessage(e,t){if(this._assertPushApiInServedEra("sampling/createMessage"),(e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Se(Te.CapabilityNotSupported,"Client does not support sampling tools capability.");if(e.messages.length>0){let s=e.messages.at(-1),i=Array.isArray(s.content)?s.content:[s.content],a=i.some((d)=>d.type==="tool_result"),c=e.messages.length>1?e.messages.at(-2):void 0,u=c?Array.isArray(c.content)?c.content:[c.content]:[],l=u.some((d)=>d.type==="tool_use");if(a){if(i.some((d)=>d.type!=="tool_result"))throw new de(Y.InvalidParams,"The last message must contain only tool_result content if any is present");if(!l)throw new de(Y.InvalidParams,"tool_result blocks are not matching any tool_use from the previous message")}if(l){let d=new Set(u.filter((m)=>m.type==="tool_use").map((m)=>m.id)),p=new Set(i.filter((m)=>m.type==="tool_result").map((m)=>m.toolUseId));if(d.size!==p.size||![...d].every((m)=>p.has(m)))throw new de(Y.InvalidParams,"ids of tool_result blocks and tool_use blocks from previous message do not match")}}let r=Boolean(e.tools||e.toolChoice),n=await this.request({method:"sampling/createMessage",params:e},t),o=this._wireCodec().samplingResultVariant(r,n);if(!o.ok)throw new Se(Te.InvalidResult,`Invalid sampling/createMessage result: ${o.reason==="invalid"?o.message:o.reason}`);return o.value}async elicitInput(e,t){switch(this._assertPushApiInServedEra("elicitation/create"),e.mode??"form"){case"url":if(!this._clientCapabilities?.elicitation?.url)throw new Se(Te.CapabilityNotSupported,"Client does not support url elicitation.");break;case"form":if(!this._clientCapabilities?.elicitation?.form)throw new Se(Te.CapabilityNotSupported,"Client does not support form elicitation.");break}return this._sendElicitationLeg(e,t)}async _sendElicitationLeg(e,t,r){let n=e.mode??"form",o=r?.validateAcceptedContent??!0;switch(n){case"url":{let s=e;return this.request({method:"elicitation/create",params:s},t)}case"form":{let s=e.mode==="form"?e:{...e,mode:"form"},i=await this.request({method:"elicitation/create",params:s},t);if(o&&i.action==="accept"&&i.content&&s.requestedSchema)try{let a=this._jsonSchemaValidator.getValidator(s.requestedSchema)(i.content);if(!a.valid)throw new de(Y.InvalidParams,`Elicitation response content does not match requested schema: ${a.errorMessage}`)}catch(a){if(a instanceof de)throw a;throw new de(Y.InternalError,`Error validating elicitation response: ${a instanceof Error?a.message:String(a)}`)}return i}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw new Se(Te.CapabilityNotSupported,"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._assertPushApiInServedEra("roots/list"),this.request({method:"roots/list",params:e},t)}async sendLoggingMessage(e,t){if(this._capabilities.logging&&!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"})}};function J1(e){return{...e}}var ga=class{server;_registeredResources={};_registeredResourceTemplates={};_registeredTools={};_registeredPrompts={};_toolInputSchemaJson={};toolInputSchemaJson(e){let t=this._registeredTools[e];if(t===void 0||!t.enabled)return;if(Object.hasOwn(this._toolInputSchemaJson,e))return this._toolInputSchemaJson[e];if(t.inputSchema===void 0)return Db;try{let r=$n(t.inputSchema,"input");return this._toolInputSchemaJson[e]=r,r}catch{return}}constructor(e,t){if(this.server=new Yb(e,t),t?.capabilities?.tools)this.setToolRequestHandlers();if(t?.capabilities?.resources)this.setResourceRequestHandlers();if(t?.capabilities?.prompts)this.setPromptRequestHandlers()}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}_toolHandlersInitialized=!1;setToolRequestHandlers(){if(this._toolHandlersInitialized)return;this.server.assertCanSetRequestHandler("tools/list"),this.server.assertCanSetRequestHandler("tools/call"),this.server.registerCapabilities({tools:{listChanged:this.server.getCapabilities().tools?.listChanged??!0}}),this.server.setRequestHandler("tools/list",()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,t])=>{let r={name:e,title:t.title,description:t.description,inputSchema:t.inputSchema?$n(t.inputSchema,"input"):Db,annotations:t.annotations,icons:t.icons,execution:t.execution,_meta:t._meta};if(t.outputSchema)r.outputSchema=$n(t.outputSchema,"output");return r})})),this.server.setRequestHandler("tools/call",async(e,t)=>{let r=this._registeredTools[e.params.name];if(!r)throw new de(Y.InvalidParams,`Tool ${e.params.name} not found`);if(!r.enabled)throw new de(Y.InvalidParams,`Tool ${e.params.name} disabled`);try{let n=await this.validateToolInput(r,e.params.arguments,e.params.name),o=await this.executeToolHandler(r,n,t);if(await this.validateToolOutput(r,o,e.params.name),Wr(o))return o;return this.server.projectCallToolResult(o,r.outputSchemaJson)}catch(n){if(n instanceof de&&n.code===Y.UrlElicitationRequired)throw n;return this.createToolError(n instanceof Error?n.message:String(n))}}),this._toolHandlersInitialized=!0}createToolError(e){return{content:[{type:"text",text:e}],isError:!0}}async validateToolInput(e,t,r){if(!e.inputSchema)return;let n=await go(e.inputSchema,t??{});if(!n.success)throw new de(Y.InvalidParams,`Input validation error: Invalid arguments for tool ${r}: ${n.error}`);return n.data}async validateToolOutput(e,t,r){if(!e.outputSchema)return;if(Wr(t))return;if(t.isError)return;if(t.structuredContent===void 0)throw new de(Y.InvalidParams,`Output validation error: Tool ${r} has an output schema but no structured content was provided`);let n=await go(e.outputSchema,t.structuredContent);if(!n.success)throw new de(Y.InvalidParams,`Output validation error: Invalid structured content for tool ${r}: ${n.error}`)}async executeToolHandler(e,t,r){return e.executor(t,r)}_completionHandlerInitialized=!1;setCompletionRequestHandler(){if(this._completionHandlerInitialized)return;this.server.assertCanSetRequestHandler("completion/complete"),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler("completion/complete",async(e)=>{switch(e.params.ref.type){case"ref/prompt":return Nm(e),this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return jm(e),this.handleResourceCompletion(e,e.params.ref);default:throw new de(Y.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0}async handlePromptCompletion(e,t){let r=this._registeredPrompts[t.name];if(!r)throw new de(Y.InvalidParams,`Prompt ${t.name} not found`);if(!r.enabled)throw new de(Y.InvalidParams,`Prompt ${t.name} disabled`);if(!r.argsSchema)return ha;let n=Zb(Hb(r.argsSchema)?.[e.params.argument.name]);if(!rh(n))return ha;let o=A1(n);if(!o)return ha;return Vb(await o(e.params.argument.value,e.params.context))}async handleResourceCompletion(e,t){let r=Object.values(this._registeredResourceTemplates).find((o)=>o.resourceTemplate.uriTemplate.toString()===t.uri);if(!r){if(this._registeredResources[t.uri])return ha;throw new de(Y.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let n=r.resourceTemplate.completeCallback(e.params.argument.name);if(!n)return ha;return Vb(await n(e.params.argument.value,e.params.context))}_resourceHandlersInitialized=!1;setResourceRequestHandlers(){if(this._resourceHandlersInitialized)return;this.server.assertCanSetRequestHandler("resources/list"),this.server.assertCanSetRequestHandler("resources/templates/list"),this.server.assertCanSetRequestHandler("resources/read"),this.server.registerCapabilities({resources:{listChanged:this.server.getCapabilities().resources?.listChanged??!0}}),this.server.setRequestHandler("resources/list",async(e,t)=>{let r=Object.entries(this._registeredResources).filter(([o,s])=>s.enabled).map(([o,s])=>({uri:o,name:s.name,...s.metadata})),n=[];for(let o of Object.values(this._registeredResourceTemplates)){if(!o.resourceTemplate.listCallback)continue;let s=await o.resourceTemplate.listCallback(t);for(let i of s.resources)n.push({...o.metadata,...i})}return{resources:[...r,...n]}}),this.server.setRequestHandler("resources/templates/list",async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([e,t])=>({name:e,uriTemplate:t.resourceTemplate.uriTemplate.toString(),...t.metadata}))})),this.server.setRequestHandler("resources/read",async(e,t)=>{let r;try{r=new URL(e.params.uri)}catch{throw new de(Y.InvalidParams,`Resource URI ${e.params.uri} is invalid`,{uri:e.params.uri,reason:"invalid_uri"})}let n=this._registeredResources[r.toString()];if(n){if(!n.enabled)throw new de(Y.InvalidParams,`Resource ${r} disabled`);return Nl(await n.readCallback(r,t),n.cacheHint)}for(let o of Object.values(this._registeredResourceTemplates)){let s=o.resourceTemplate.uriTemplate.match(r.toString());if(s)return Nl(await o.readCallback(r,s,t),o.cacheHint)}throw new jl(e.params.uri)}),this._resourceHandlersInitialized=!0}_promptHandlersInitialized=!1;setPromptRequestHandlers(){if(this._promptHandlersInitialized)return;this.server.assertCanSetRequestHandler("prompts/list"),this.server.assertCanSetRequestHandler("prompts/get"),this.server.registerCapabilities({prompts:{listChanged:this.server.getCapabilities().prompts?.listChanged??!0}}),this.server.setRequestHandler("prompts/list",()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,t])=>({name:e,title:t.title,description:t.description,arguments:t.argsSchema?sb(t.argsSchema):void 0,icons:t.icons,_meta:t._meta}))})),this.server.setRequestHandler("prompts/get",async(e,t)=>{let r=this._registeredPrompts[e.params.name];if(!r)throw new de(Y.InvalidParams,`Prompt ${e.params.name} not found`);if(!r.enabled)throw new de(Y.InvalidParams,`Prompt ${e.params.name} disabled`);return r.handler(e.params.arguments,t)}),this._promptHandlersInitialized=!0}registerResource(e,t,r,n){let o=r.cacheHint,s=r;if(o!==void 0){xm(o,`resource ${e}`);let i={...r};delete i.cacheHint,s=i}if(typeof t==="string"){if(this._registeredResources[t])throw Error(`Resource ${t} is already registered`);let i=this._createRegisteredResource(e,r.title,t,s,n);if(o!==void 0)i.cacheHint=o;return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}else{if(this._registeredResourceTemplates[e])throw Error(`Resource template ${e} is already registered`);let i=this._createRegisteredResourceTemplate(e,r.title,t,s,n);if(o!==void 0)i.cacheHint=o;return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}}_createRegisteredResource(e,t,r,n,o){let s={name:e,title:t,metadata:n,readCallback:o,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({uri:null}),update:(i)=>{if(i.uri!==void 0&&i.uri!==r){if(delete this._registeredResources[r],i.uri)this._registeredResources[i.uri]=s}if(i.name!==void 0)s.name=i.name;if(i.title!==void 0)s.title=i.title;if(i.metadata!==void 0)s.metadata=i.metadata;if(i.callback!==void 0)s.readCallback=i.callback;if(i.enabled!==void 0)s.enabled=i.enabled;this.sendResourceListChanged()}};return this._registeredResources[r]=s,s}_createRegisteredResourceTemplate(e,t,r,n,o){let s={resourceTemplate:r,title:t,metadata:n,readCallback:o,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({name:null}),update:(a)=>{if(a.name!==void 0&&a.name!==e){if(delete this._registeredResourceTemplates[e],a.name)this._registeredResourceTemplates[a.name]=s}if(a.title!==void 0)s.title=a.title;if(a.template!==void 0)s.resourceTemplate=a.template;if(a.metadata!==void 0)s.metadata=a.metadata;if(a.callback!==void 0)s.readCallback=a.callback;if(a.enabled!==void 0)s.enabled=a.enabled;this.sendResourceListChanged()}};this._registeredResourceTemplates[e]=s;let i=r.uriTemplate.variableNames;if(Array.isArray(i)&&i.some((a)=>!!r.completeCallback(a)))this.setCompletionRequestHandler();return s}_createRegisteredPrompt(e,t,r,n,o,s,i){let a=n,c=o,u={title:t,description:r,argsSchema:n,icons:s,_meta:i,handler:Fb(e,n,o),enabled:!0,disable:()=>u.update({enabled:!1}),enable:()=>u.update({enabled:!0}),remove:()=>u.update({name:null}),update:(l)=>{if(l.name!==void 0&&l.name!==e){if(delete this._registeredPrompts[e],l.name)this._registeredPrompts[l.name]=u}if(l.title!==void 0)u.title=l.title;if(l.description!==void 0)u.description=l.description;if(l.icons!==void 0)u.icons=l.icons;if(l._meta!==void 0)u._meta=l._meta;let d=!1;if(l.argsSchema!==void 0)u.argsSchema=l.argsSchema,a=l.argsSchema,d=!0;if(l.callback!==void 0)c=l.callback,d=!0;if(d)u.handler=Fb(e,a,c);if(l.enabled!==void 0)u.enabled=l.enabled;this.sendPromptListChanged()}};if(this._registeredPrompts[e]=u,n){let l=Hb(n);if(l){if(Object.values(l).some((d)=>rh(Zb(d))))this.setCompletionRequestHandler()}}return u}_createRegisteredTool(e,t,r,n,o,s,i,a,c,u){if(Jm(e),n!==void 0)try{let p=$n(n,"input");this._toolInputSchemaJson[e]=p;let m=qm(p);if(!m.valid)console.warn(`[mcp-sdk] tool '${e}' carries an invalid x-mcp-header declaration and will be excluded by conforming Streamable HTTP clients: ${m.reason}`)}catch{}let l=u,d={title:t,description:r,inputSchema:n,outputSchema:o,outputSchemaJson:Ub(o),annotations:s,icons:i,execution:a,_meta:c,handler:u,executor:Lb(n,u),enabled:!0,disable:()=>d.update({enabled:!1}),enable:()=>d.update({enabled:!0}),remove:()=>d.update({name:null}),update:(p)=>{if(p.name!==void 0&&p.name!==e){if(typeof p.name==="string")Jm(p.name);if(delete this._registeredTools[e],delete this._toolInputSchemaJson[e],p.name)delete this._toolInputSchemaJson[p.name],this._registeredTools[p.name]=d,e=p.name}if(p.title!==void 0)d.title=p.title;if(p.description!==void 0)d.description=p.description;let m=!1;if(p.paramsSchema!==void 0)d.inputSchema=p.paramsSchema,delete this._toolInputSchemaJson[e],m=!0;if(p.callback!==void 0)d.handler=p.callback,l=p.callback,m=!0;if(m)d.executor=Lb(d.inputSchema,l);if(p.outputSchema!==void 0)d.outputSchema=p.outputSchema,d.outputSchemaJson=Ub(p.outputSchema);if(p.annotations!==void 0)d.annotations=p.annotations;if(p.icons!==void 0)d.icons=p.icons;if(p._meta!==void 0)d._meta=p._meta;if(p.enabled!==void 0)d.enabled=p.enabled;this.sendToolListChanged()}};return this._registeredTools[e]=d,this.setToolRequestHandlers(),this.sendToolListChanged(),d}registerTool(e,t,r){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let{title:n,description:o,inputSchema:s,outputSchema:i,annotations:a,icons:c,_meta:u}=t;return this._createRegisteredTool(e,n,o,Vl(s),Vl(i),a,c,void 0,u,r)}registerPrompt(e,t,r){if(this._registeredPrompts[e])throw Error(`Prompt ${e} is already registered`);let{title:n,description:o,argsSchema:s,icons:i,_meta:a}=t,c=this._createRegisteredPrompt(e,n,o,Vl(s),r,i,a);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),c}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(e,t){return this.server.sendLoggingMessage(e,t)}sendResourceListChanged(){if(this.isConnected())this.server.sendResourceListChanged()}sendToolListChanged(){if(this.isConnected())this.server.sendToolListChanged()}sendPromptListChanged(){if(this.isConnected())this.server.sendPromptListChanged()}};function Lb(e,t){if(e){let n=t;return async(o,s)=>n(o,s)}let r=t;return async(n,o)=>r(o)}var Db={type:"object",properties:{}};function Ub(e){if(e===void 0)return;try{return $n(e,"output")}catch{return}}function Fb(e,t,r){if(t){let n=r;return async(o,s)=>{let i=await go(t,o);if(!i.success)throw new de(Y.InvalidParams,`Invalid arguments for prompt ${e}: ${i.error}`);return n(i.data,s)}}else{let n=r;return async(o,s)=>n(s)}}function Vb(e){return{completion:{values:e.map(String).slice(0,100),total:e.length,hasMore:e.length>100}}}var ha={completion:{values:[],hasMore:!1}};function Hb(e){let t=e;if(t.shape&&typeof t.shape==="object")return t.shape}function K1(e){return e?.type==="optional"}function Zb(e){if(!K1(e))return e;return e.def?.innerType??e}var B1=class{_readBuffer;_started=!1;_closed=!1;constructor(e=eh.stdin,t=eh.stdout,r){this._stdin=e,this._stdout=t,this._readBuffer=new Zm({maxBufferSize:r?.maxBufferSize})}onclose;onerror;onmessage;_ondata=(e)=>{try{this._readBuffer.append(e),this.processReadBuffer()}catch(t){this.onerror?.(t),this.close().catch(()=>{})}};_onerror=(e)=>{this.onerror?.(e)};_onstdouterror=(e)=>{this.onerror?.(e),this.close().catch(()=>{})};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),this._stdout.on("error",this._onstdouterror)}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._closed)return;if(this._closed=!0,this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdout.off("error",this._onstdouterror),this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),this.onclose?.()}send(e){if(this._closed)return Promise.reject(Error("StdioServerTransport is closed"));return new Promise((t,r)=>{let n=Gm(e),o=!1,s=(a)=>{if(o)return;o=!0,this._stdout.off("error",s),this._stdout.off("drain",i),r(a)},i=()=>{if(o)return;o=!0,this._stdout.off("error",s),this._stdout.off("drain",i),t()};if(this._stdout.once("error",s),this._stdout.write(n)){if(o)return;o=!0,this._stdout.off("error",s),t()}else if(!o)this._stdout.once("drain",i)})}},Xb=3000,W1=class{onclose;onerror;onmessage;_closed=!1;_pendingRequests=new Set;_drainWaiters=[];constructor(e,t,r){this._wire=e,this._onInstanceClose=t,this._outboundIntercept=r}async start(){}async send(e,t){if(la(e)||Ul(e)){let{id:r}=e;if(r!==void 0)this._settle(r)}if(this._closed)return;if(this._outboundIntercept?.(e)==="handled")return;return this._wire.send(e,t)}setProtocolVersion=(e)=>{this._wire.setProtocolVersion?.(e)};deliver(e,t){if(this._closed)return;if(rr(e))this._pendingRequests.add(e.id);else if(bn(e)&&e.method==="notifications/cancelled"){let r=e.params?.requestId;if(r!==void 0)this._settle(r)}this.onmessage?.(e,t)}async whenRequestsAnswered(e){if(this._closed||this._pendingRequests.size===0)return!0;return await new Promise((t)=>{let r=()=>{clearTimeout(n),t(!0)},n=setTimeout(()=>{this._drainWaiters=this._drainWaiters.filter((o)=>o!==r),t(!1)},e);this._drainWaiters.push(r)})}async close(){if(this._closed)return;this._closed=!0,this._pendingRequests.clear(),this._releaseDrainWaiters();try{this._onInstanceClose()}finally{this.onclose?.()}}_settle(e){if(this._pendingRequests.delete(e),this._pendingRequests.size===0)this._releaseDrainWaiters()}_releaseDrainWaiters(){let e=this._drainWaiters;this._drainWaiters=[];for(let t of e)t()}};function Y1(e){let t=e.params;if(e.method==="initialize"&&!Mm(t)){let s=t!==null&&typeof t==="object"&&typeof t.protocolVersion==="string"?t.protocolVersion:void 0;return{kind:"legacy",reason:"initialize",...s!==void 0&&{requestedVersion:s}}}if(!Ml(t))return{kind:"legacy",reason:"no-claim"};let r=_o(t),n=(r===void 0?[]:Dl(r))[0];if(n!==void 0)return{kind:"invalid-envelope",issue:n};let o=Ll(t);if(o===void 0||!Sn.includes(o))return{kind:"unsupported-revision",requested:o??"unknown"};return{kind:"modern",revision:o,classification:{era:"modern",revision:o}}}function Qb(e,t={}){let r=t.legacy??"serve",n=t.transport??new B1,o={phase:"opening"},s,i=!1,a=()=>i||o.phase==="closed",c=(E)=>{try{t.onerror?.(E)}catch{}},u=(E,x,q,C)=>n.send({jsonrpc:"2.0",id:E,error:{code:x,message:q,...C!==void 0&&{data:C}}}).catch((F)=>c(yr(F))),l=new Jb(t.maxSubscriptions??Wl),d=(E)=>{if(!bn(E))return;let x=l.routeOutbound(E);if(x==="passthrough")return;for(let q of x)n.send({jsonrpc:"2.0",...q}).catch((C)=>c(yr(C)));return"handled"},p=async(E)=>{if(rr(E)&&E.method==="subscriptions/listen"){let x=_o(E.params),q=Ml(E.params)?(x===void 0?[]:Dl(x))[0]:{key:"_meta",problem:"the per-request envelope is required on protocol revision 2026-07-28"},C=Ll(E.params),F;if(q!==void 0)F={jsonrpc:"2.0",id:E.id,error:{code:-32602,message:`Invalid _meta envelope: ${q.key}: ${q.problem}`}};else if(C===void 0||!Sn.includes(C)){let B=new ls({supported:[...Sn],requested:C??"unknown"});F={jsonrpc:"2.0",id:E.id,error:{code:B.code,message:B.message,data:B.data}}}else F=l.serve(E);return await n.send("error"in F?F:{jsonrpc:"2.0",method:F.method,params:F.params}).catch((B)=>c(yr(B))),!0}if(bn(E)&&E.method==="notifications/cancelled"){let x=E.params?.requestId;if(x!==void 0&&l.cancel(x))return!0}return!1},m=(E,x,q)=>{let C=Lm({kind:"legacy",reason:x,...q!==void 0&&{requestedVersion:q}},Sn);if(C===void 0)return Promise.resolve();return c(Error(`Rejected 2025-era request on a modern-only stdio connection (${C.cell}): ${C.message}`)),u(E.id,C.code,C.message,C.data)},h=(E)=>{if(i||E===s)return;R()},g=async(E,x)=>{let q=await e({era:E}),C=q instanceof ga?q.server:q;if(E==="modern")Fm(C,x),nh(C,Sn),l.setServerCapabilities(C.getCapabilities(),oh(C));let F=new W1(n,()=>h(F),E==="modern"?d:void 0);return await q.connect(F),{product:q,channel:F}},_=(E)=>E.product.close().catch((x)=>c(yr(x))),y=async(E)=>{s=E.channel;try{if(!await E.channel.whenRequestsAnswered(Xb))c(Error(`Discarded the probe instance with requests still unanswered after ${Xb}ms; continuing with the fallback`));await E.product.close()}catch(x){c(yr(x))}finally{s=void 0}},S=async(E)=>{if(o.phase==="closed")return;if(o.phase==="pinned"){if(o.era==="modern"&&rr(E)&&E.method==="initialize"&&!Mm(E.params)){await m(E,"initialize",E.params!==null&&typeof E.params==="object"&&typeof E.params.protocolVersion==="string"?E.params.protocolVersion:void 0);return}if(o.era==="modern"&&await p(E))return;o.instance.channel.deliver(E);return}if(!rr(E)&&!bn(E)){c(Error("Discarded a JSON-RPC response received before the connection negotiated an era"));return}let x=Y1(E);switch(x.kind){case"invalid-envelope":{let q=`Invalid _meta envelope for protocol revision 2026-07-28: ${x.issue.key}: ${x.issue.problem}`;if(rr(E))await u(E.id,Y.InvalidParams,q,{envelope:x.issue});else c(Error(`Discarded a notification with a malformed envelope: ${q}`));return}case"unsupported-revision":if(rr(E)){let q=new ls({supported:[...Sn],requested:x.requested});c(q),await u(E.id,q.code,q.message,q.data)}else c(Error(`Discarded a notification claiming unsupported protocol revision ${x.requested}`));return;case"modern":if(rr(E)&&E.method==="server/discover"){if(o.phase==="probe"){o.instance.channel.deliver(E,{classification:x.classification});return}let q=await g("modern",x.revision);if(a()){await _(q);return}o={phase:"probe",instance:q},q.channel.deliver(E,{classification:x.classification});return}if(o.phase==="probe"){if(bn(E)){o.instance.channel.deliver(E,{classification:x.classification});return}o={phase:"pinned",era:"modern",instance:o.instance}}else{let q=await g("modern",x.revision);if(a()){await _(q);return}o={phase:"pinned",era:"modern",instance:q}}if(await p(E))return;o.instance.channel.deliver(E,{classification:x.classification});return;case"legacy":{if(r==="reject"){if(rr(E))await m(E,x.reason,x.requestedVersion);return}if(o.phase==="probe"){if(await y(o.instance),a())return;o={phase:"opening"}}let q=await g("legacy");if(a()){await _(q);return}o={phase:"pinned",era:"legacy",instance:q},o.instance.channel.deliver(E);return}}},v=[],w=!1,z=async()=>{if(w)return;w=!0;try{while(v.length>0){let E=v.shift();try{await S(E)}catch(x){if(rr(E))await u(E.id,Y.InternalError,"Internal server error");c(yr(x))}}}finally{w=!1}},R=async()=>{if(i||o.phase==="closed")return;i=!0;let E=o;o={phase:"closed"};for(let x of l.teardownAll())await n.send(x).catch((q)=>c(yr(q)));if(E.phase==="probe"||E.phase==="pinned")await E.instance.product.close().catch((x)=>c(yr(x)));await n.close().catch((x)=>c(yr(x)))};n.onmessage=(E)=>{v.push(E),z()},n.onerror=(E)=>{if(c(E),o.phase==="probe"||o.phase==="pinned")o.instance.channel.onerror?.(E)},n.onclose=()=>{if(i||o.phase==="closed")return;i=!0;let E=o;if(o={phase:"closed"},E.phase==="probe"||E.phase==="pinned")E.instance.product.close().catch((x)=>c(yr(x)))};let b=n.start().catch((E)=>{throw c(yr(E)),E});return b.catch(()=>{}),{close:async()=>{await b.catch(()=>{}),await R()}}}function yr(e){return e instanceof Error?e:Error(String(e))}class Me extends Error{exitCode;statusCode;retryAfterS;code;constructor(e,t=1,r,n,o){super(e);this.exitCode=t;this.statusCode=r;this.retryAfterS=n;this.code=o;this.name="CliError"}}class vo extends Me{constructor(e){super("Could not reach the account service to renew the session; try again.",Dt.NETWORK);this.name="RefreshUnavailableError",this.cause=e}}var Dt={SUCCESS:0,ERROR:1,USAGE:2,AUTH:3,RATE_LIMITED:4,NETWORK:5};var e$="grove-cli/0.1.11";var r$=50000;function t$(e){return e&&/^\d+$/.test(e)?Number(e):void 0}class wn{baseUrl;apiKey;token;timeout;verbose;userAgent;extraHeaders;onUnauthorized;constructor(e,t={}){this.baseUrl=e.replace(/\/$/,""),this.apiKey=t.apiKey,this.token=t.token,this.timeout=t.timeout??30000,this.verbose=t.verbose??!1,this.userAgent=t.userAgent??e$,this.extraHeaders=t.headers??{},this.onUnauthorized=t.onUnauthorized}get usesApiKey(){return Boolean(this.apiKey)}authHeader(){if(this.apiKey)return{"X-API-Key":this.apiKey};if(this.token)return{Authorization:`Bearer ${this.token}`};return{}}buildUrl(e,t){let r=new URL(`${this.baseUrl}${e}`);if(t)for(let[n,o]of Object.entries(t))r.searchParams.set(n,o);return r.toString()}async request(e,t,r={}){try{return await this.attemptRequest(e,t,r)}catch(n){if(!(n instanceof Me&&n.statusCode===401)||!this.onUnauthorized)throw n;let s;try{s=await this.onUnauthorized(this.token)}catch(i){if(i instanceof vo)throw i;throw n}if(!s)throw n;return this.token=s.token,this.attemptRequest(e,t,r)}}async attemptRequest(e,t,r={}){let n=this.buildUrl(t,r.params),o={...this.extraHeaders,"User-Agent":this.userAgent,...this.authHeader(),...r.body!==void 0?{"Content-Type":"application/json"}:{}},s={method:e,headers:o,signal:AbortSignal.timeout(r.timeoutMs??this.timeout)};if(r.body!==void 0)s.body=JSON.stringify(r.body);if(this.verbose)process.stderr.write(`--> ${e} ${n}
61
+ `);let i;try{i=await fetch(n,s)}catch(u){let l=u instanceof Error?u.message:String(u),d=u instanceof Error&&(u.name==="TimeoutError"||u.name==="AbortError");throw new Me(`Cannot reach API at ${this.baseUrl}: ${l}`,Dt.NETWORK,void 0,void 0,d?"client:timeout":"client:network")}if(this.verbose)process.stderr.write(`<-- ${i.status} ${i.statusText}
62
+ `);if(i.status===204)return r.onHeaders?.(i.headers),null;if(i.ok){r.onHeaders?.(i.headers);let u=await i.json();if(u&&typeof u==="object"&&"data"in u&&Object.keys(u).length===1)return u.data;return u}let a=`${i.status} ${i.statusText}`,c;try{let u=await i.json();if(typeof u.message==="string")a=u.message;else if(typeof u.error==="string")a=u.error;if(typeof u.code==="string")c=u.code}catch{}switch(i.status){case 401:throw new Me("Session expired. Run `grove auth login` to re-authenticate.",Dt.AUTH,401,void 0,c);case 429:{let u=t$(i.headers.get("Retry-After")),l=u!==void 0?`Rate limited. Retry in ${u}s`:"Rate limited. Try again later";throw new Me(l,Dt.RATE_LIMITED,429,u,c)}default:if(i.status===503)throw new Me(`Server error: ${a}`,Dt.ERROR,503,t$(i.headers.get("Retry-After")),c);if(i.status>=500)throw new Me(`Server error: ${a}`,Dt.ERROR,i.status,void 0,c);throw new Me(a,Dt.ERROR,i.status,void 0,c)}}get(e,t){return this.request("GET",e,{params:t})}async getWithHeaders(e,t){let r=new Headers;return{data:await this.request("GET",e,{params:t,onHeaders:(o)=>{r=o}}),headers:r}}post(e,t,r={}){return this.request("POST",e,{body:t,timeoutMs:r.timeoutMs})}patch(e,t){return this.request("PATCH",e,{body:t})}put(e,t){return this.request("PUT",e,{body:t})}delete(e){return this.request("DELETE",e)}async listSources(e){let t={};if(e)t.groupId=e;return this.adminKeyRead("/api/v1/sources",t,"listing sources")}getSource(e){return this.adminKeyRead(`/api/v1/sources/${encodeURIComponent(e)}`,void 0,"reading a source by id")}async adminKeyRead(e,t,r){try{return await this.get(e,t)}catch(n){if(this.apiKey&&n instanceof Me&&n.statusCode===403)throw new Me(`Admin API key required: ${r} with an API key needs a key in the server's ADMIN_API_KEYS (a plain API_KEYS key gets 403). Use an admin-key profile, or authenticate as a user to read your own subscriptions.`,n.exitCode,403);throw n}}listAccessRequests(e){let t={};if(e.status)t.status=e.status;if(e.page)t.page=e.page;if(e.limit)t.limit=e.limit;return this.get("/api/v1/admin/access-requests",t)}resolveAccessRequest(e,t){return this.post(`/api/v1/admin/access-requests/${encodeURIComponent(e)}/resolve`,t)}revokeEntitlement(e,t){return this.post(`/api/v1/admin/entitlements/${encodeURIComponent(e)}/revoke`,t)}async getRaw(e,t){let r=this.buildUrl(e,t),o={method:"GET",headers:{...this.extraHeaders,"Content-Type":"application/json","User-Agent":this.userAgent,...this.authHeader()},signal:AbortSignal.timeout(this.timeout)};if(this.verbose)process.stderr.write(`--> GET ${r}
63
+ `);let s;try{s=await fetch(r,o)}catch(i){let a=i instanceof Error?i.message:String(i);throw new Me(`Cannot reach API at ${this.baseUrl}: ${a}`,Dt.NETWORK)}if(this.verbose)process.stderr.write(`<-- ${s.status} ${s.statusText}
64
+ `);if(s.ok)return s.text();throw new Me(`${s.status} ${s.statusText}`,Dt.ERROR)}}import{dirname as nG,join as oG}from"node:path";import{isDeepStrictEqual as UZ}from"node:util";import dk from"node:process";import To from"node:fs";import pk from"node:path";import Da from"node:crypto";import FZ from"node:assert";var So=(e)=>{let t=typeof e;return e!==null&&(t==="object"||t==="function")};var sh=new Set(["__proto__","prototype","constructor"]),X1=new Set("0123456789");function Yl(e){let t=[],r="",n="start",o=!1;for(let s of e)switch(s){case"\\":{if(n==="index")throw Error("Invalid character in an index");if(n==="indexEnd")throw Error("Invalid character after an index");if(o)r+=s;n="property",o=!o;break}case".":{if(n==="index")throw Error("Invalid character in an index");if(n==="indexEnd"){n="property";break}if(o){o=!1,r+=s;break}if(sh.has(r))return[];t.push(r),r="",n="property";break}case"[":{if(n==="index")throw Error("Invalid character in an index");if(n==="indexEnd"){n="index";break}if(o){o=!1,r+=s;break}if(n==="property"){if(sh.has(r))return[];t.push(r),r=""}n="index";break}case"]":{if(n==="index"){t.push(Number.parseInt(r,10)),r="",n="indexEnd";break}if(n==="indexEnd")throw Error("Invalid character after an index")}default:{if(n==="index"&&!X1.has(s))throw Error("Invalid character in an index");if(n==="indexEnd")throw Error("Invalid character after an index");if(n==="start")n="property";if(o)o=!1,r+="\\";r+=s}}if(o)r+="\\";switch(n){case"property":{if(sh.has(r))return[];t.push(r);break}case"index":throw Error("Index was not closed");case"start":{t.push("");break}}return t}function ih(e,t){if(typeof t!=="number"&&Array.isArray(e)){let r=Number.parseInt(t,10);return Number.isInteger(r)&&e[r]===e[t]}return!1}function n$(e,t){if(ih(e,t))throw Error("Cannot use string index")}function o$(e,t,r){if(!So(e)||typeof t!=="string")return r===void 0?e:r;let n=Yl(t);if(n.length===0)return r;for(let o=0;o<n.length;o++){let s=n[o];if(ih(e,s))e=o===n.length-1?void 0:null;else e=e[s];if(e===void 0||e===null){if(o!==n.length-1)return r;break}}return e===void 0?r:e}function ah(e,t,r){if(!So(e)||typeof t!=="string")return e;let n=e,o=Yl(t);for(let s=0;s<o.length;s++){let i=o[s];if(n$(e,i),s===o.length-1)e[i]=r;else if(!So(e[i]))e[i]=typeof o[s+1]==="number"?[]:{};e=e[i]}return n}function s$(e,t){if(!So(e)||typeof t!=="string")return!1;let r=Yl(t);for(let n=0;n<r.length;n++){let o=r[n];if(n$(e,o),n===r.length-1)return delete e[o],!0;if(e=e[o],!So(e))return!1}}function i$(e,t){if(!So(e)||typeof t!=="string")return!1;let r=Yl(t);if(r.length===0)return!1;for(let n of r){if(!So(e)||!(n in e)||ih(e,n))return!1;e=e[n]}return!0}import Ye from"node:path";import a$ from"node:os";import ch from"node:process";var Rn=a$.homedir(),uh=a$.tmpdir(),{env:fs}=ch,Q1=(e)=>{let t=Ye.join(Rn,"Library");return{data:Ye.join(t,"Application Support",e),config:Ye.join(t,"Preferences",e),cache:Ye.join(t,"Caches",e),log:Ye.join(t,"Logs",e),temp:Ye.join(uh,e)}},ej=(e)=>{let t=fs.APPDATA||Ye.join(Rn,"AppData","Roaming"),r=fs.LOCALAPPDATA||Ye.join(Rn,"AppData","Local");return{data:Ye.join(r,e,"Data"),config:Ye.join(t,e,"Config"),cache:Ye.join(r,e,"Cache"),log:Ye.join(r,e,"Log"),temp:Ye.join(uh,e)}},tj=(e)=>{let t=Ye.basename(Rn);return{data:Ye.join(fs.XDG_DATA_HOME||Ye.join(Rn,".local","share"),e),config:Ye.join(fs.XDG_CONFIG_HOME||Ye.join(Rn,".config"),e),cache:Ye.join(fs.XDG_CACHE_HOME||Ye.join(Rn,".cache"),e),log:Ye.join(fs.XDG_STATE_HOME||Ye.join(Rn,".local","state"),e),temp:Ye.join(uh,t,e)}};function lh(e,{suffix:t="nodejs"}={}){if(typeof e!=="string")throw TypeError(`Expected a string, got ${typeof e}`);if(t)e+=`-${t}`;if(ch.platform==="darwin")return Q1(e);if(ch.platform==="win32")return ej(e);return tj(e)}import uj from"node:path";import Ne from"node:fs";import{promisify as kt}from"node:util";var rj=(e,t)=>{let{onError:r}=t;return function(...o){return e.apply(void 0,o).catch(r)}},zr=rj;var nj=(e,t)=>{let{onError:r}=t;return function(...o){try{return e.apply(void 0,o)}catch(s){return r(s)}}},_r=nj;var c$=250;var oj=(e,t)=>{let{isRetriable:r}=t;return function(o){let{timeout:s}=o,i=o.interval??c$,a=Date.now()+s;return function c(...u){return e.apply(void 0,u).catch((l)=>{if(!r(l))throw l;if(Date.now()>=a)throw l;let d=Math.round(i*Math.random());if(d>0)return new Promise((m)=>setTimeout(m,d)).then(()=>c.apply(void 0,u));else return c.apply(void 0,u)})}}},Pr=oj;var sj=(e,t)=>{let{isRetriable:r}=t;return function(o){let{timeout:s}=o,i=Date.now()+s;return function(...c){while(!0)try{return e.apply(void 0,c)}catch(u){if(!r(u))throw u;if(Date.now()>=i)throw u;continue}}}},Tr=sj;import l$ from"node:process";var ya={isChangeErrorOk:(e)=>{if(!ya.isNodeError(e))return!1;let{code:t}=e;if(t==="ENOSYS")return!0;if(!u$&&(t==="EINVAL"||t==="EPERM"))return!0;return!1},isNodeError:(e)=>e instanceof Error,isRetriableError:(e)=>{if(!ya.isNodeError(e))return!1;let{code:t}=e;if(t==="EMFILE"||t==="ENFILE"||t==="EAGAIN"||t==="EBUSY"||t==="EACCESS"||t==="EACCES"||t==="EACCS"||t==="EPERM")return!0;return!1},onChangeError:(e)=>{if(!ya.isNodeError(e))throw e;if(ya.isChangeErrorOk(e))return;throw e}},dh=ya;var _a={onError:dh.onChangeError},Ut={onError:()=>{return}},u$=l$.getuid?!l$.getuid():!1,$t={isRetriable:dh.isRetriableError};var ij={attempt:{chmod:zr(kt(Ne.chmod),_a),chown:zr(kt(Ne.chown),_a),close:zr(kt(Ne.close),Ut),fsync:zr(kt(Ne.fsync),Ut),mkdir:zr(kt(Ne.mkdir),Ut),realpath:zr(kt(Ne.realpath),Ut),stat:zr(kt(Ne.stat),Ut),unlink:zr(kt(Ne.unlink),Ut),chmodSync:_r(Ne.chmodSync,_a),chownSync:_r(Ne.chownSync,_a),closeSync:_r(Ne.closeSync,Ut),existsSync:_r(Ne.existsSync,Ut),fsyncSync:_r(Ne.fsync,Ut),mkdirSync:_r(Ne.mkdirSync,Ut),realpathSync:_r(Ne.realpathSync,Ut),statSync:_r(Ne.statSync,Ut),unlinkSync:_r(Ne.unlinkSync,Ut)},retry:{close:Pr(kt(Ne.close),$t),fsync:Pr(kt(Ne.fsync),$t),open:Pr(kt(Ne.open),$t),readFile:Pr(kt(Ne.readFile),$t),rename:Pr(kt(Ne.rename),$t),stat:Pr(kt(Ne.stat),$t),write:Pr(kt(Ne.write),$t),writeFile:Pr(kt(Ne.writeFile),$t),closeSync:Tr(Ne.closeSync,$t),fsyncSync:Tr(Ne.fsyncSync,$t),openSync:Tr(Ne.openSync,$t),readFileSync:Tr(Ne.readFileSync,$t),renameSync:Tr(Ne.renameSync,$t),statSync:Tr(Ne.statSync,$t),writeSync:Tr(Ne.writeSync,$t),writeFileSync:Tr(Ne.writeFileSync,$t)}},vt=ij;import bo from"node:process";var d$="utf8",ph=438,p$=511;var f$={},m$=bo.geteuid?bo.geteuid():-1,h$=bo.getegid?bo.getegid():-1;var g$=1000,y$=!!bo.getuid,N5=bo.getuid?!bo.getuid():!1,fh=128;var _$=(e)=>e instanceof Error&&("code"in e);var mh=(e)=>typeof e==="string",Xl=(e)=>e===void 0;import cj from"node:path";import ms from"node:process";import v$ from"node:process";var S$=v$.platform==="linux",Ql=v$.platform==="win32";var hh=["SIGHUP","SIGINT","SIGTERM"];if(!Ql)hh.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(S$)hh.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var b$=hh;class $${constructor(){this.callbacks=new Set,this.exited=!1,this.exit=(e)=>{if(this.exited)return;this.exited=!0;for(let t of this.callbacks)t();if(e)if(Ql&&(e!=="SIGINT"&&e!=="SIGTERM"&&e!=="SIGKILL"))ms.kill(ms.pid,"SIGTERM");else ms.kill(ms.pid,e)},this.hook=()=>{ms.once("exit",()=>this.exit());for(let e of b$)try{ms.once(e,()=>this.exit(e))}catch{}},this.register=(e)=>(this.callbacks.add(e),()=>{this.callbacks.delete(e)}),this.hook()}}var w$=new $$;var aj=w$.register,R$=aj;var Qt={store:{},create:(e)=>{let t=`000000${Math.floor(Math.random()*16777215).toString(16)}`.slice(-6),r=Date.now().toString().slice(-10),n="tmp-",o=`.tmp-${r}${t}`;return`${e}${o}`},get:(e,t,r=!0)=>{let n=Qt.truncate(t(e));if(n in Qt.store)return Qt.get(e,t,r);return Qt.store[n]=r,[n,()=>delete Qt.store[n]]},purge:(e)=>{if(!Qt.store[e])return;delete Qt.store[e],vt.attempt.unlink(e)},purgeSync:(e)=>{if(!Qt.store[e])return;delete Qt.store[e],vt.attempt.unlinkSync(e)},purgeSyncAll:()=>{for(let e in Qt.store)Qt.purgeSync(e)},truncate:(e)=>{let t=cj.basename(e);if(t.length<=fh)return e;let r=/^(\.?)(.*?)((?:\.[^.]+)?(?:\.tmp-\d{10}[a-f0-9]{6})?)$/.exec(t);if(!r)return e;let n=t.length-fh;return`${e.slice(0,-t.length)}${r[1]}${r[2].slice(0,-n)}${r[3]}`}};R$(Qt.purgeSyncAll);var va=Qt;function gh(e,t,r=f$){if(mh(r))return gh(e,t,{encoding:r});let o={timeout:r.timeout??g$},s=null,i=null,a=null;try{let c=vt.attempt.realpathSync(e),u=!!c;e=c||e,[i,s]=va.get(e,r.tmpCreate||va.create,r.tmpPurge!==!1);let l=y$&&Xl(r.chown),d=Xl(r.mode);if(u&&(l||d)){let p=vt.attempt.statSync(e);if(p){if(r={...r},l)r.chown={uid:p.uid,gid:p.gid};if(d)r.mode=p.mode}}if(!u){let p=uj.dirname(e);vt.attempt.mkdirSync(p,{mode:p$,recursive:!0})}if(a=vt.retry.openSync(o)(i,"w",r.mode||ph),r.tmpCreated)r.tmpCreated(i);if(mh(t))vt.retry.writeSync(o)(a,t,0,r.encoding||d$);else if(!Xl(t))vt.retry.writeSync(o)(a,t,0,t.length,0);if(r.fsync!==!1)if(r.fsyncWait!==!1)vt.retry.fsyncSync(o)(a);else vt.attempt.fsync(a);if(vt.retry.closeSync(o)(a),a=null,r.chown&&(r.chown.uid!==m$||r.chown.gid!==h$))vt.attempt.chownSync(i,r.chown.uid,r.chown.gid);if(r.mode&&r.mode!==ph)vt.attempt.chmodSync(i,r.mode);try{vt.retry.renameSync(o)(i,e)}catch(p){if(!_$(p))throw p;if(p.code!=="ENAMETOOLONG")throw p;vt.retry.renameSync(o)(i,va.truncate(e))}s(),i=null}finally{if(a)vt.attempt.closeSync(a);if(i)va.purge(i)}}var mk=Op(KP(),1),hk=Op(gT(),1);var w9=(e,t,r,n)=>{if(r==="length"||r==="prototype")return;if(r==="arguments"||r==="caller")return;let o=Object.getOwnPropertyDescriptor(e,r),s=Object.getOwnPropertyDescriptor(t,r);if(!R9(o,s)&&n)return;Object.defineProperty(e,r,s)},R9=function(e,t){return e===void 0||e.configurable||e.writable===t.writable&&e.enumerable===t.enumerable&&e.configurable===t.configurable&&(e.writable||e.value===t.value)},E9=(e,t)=>{let r=Object.getPrototypeOf(t);if(r===Object.getPrototypeOf(e))return;Object.setPrototypeOf(e,r)},z9=(e,t)=>`/* Wrapped ${e}*/
65
+ ${t}`,P9=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),T9=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),I9=(e,t,r)=>{let n=r===""?"":`with ${r.trim()}() `,o=z9.bind(null,n,t.toString());Object.defineProperty(o,"name",T9);let{writable:s,enumerable:i,configurable:a}=P9;Object.defineProperty(e,"toString",{value:o,writable:s,enumerable:i,configurable:a})};function Eg(e,t,{ignoreNonConfigurable:r=!1}={}){let{name:n}=e;for(let o of Reflect.ownKeys(t))w9(e,t,o,r);return E9(e,t),I9(e,t,n),e}var k9=(e,t={})=>{if(typeof e!=="function")throw TypeError(`Expected the first argument to be a function, got \`${typeof e}\``);let{wait:r=0,maxWait:n=Number.POSITIVE_INFINITY,before:o=!1,after:s=!0}=t;if(r<0||n<0)throw RangeError("`wait` and `maxWait` must not be negative.");if(!o&&!s)throw Error("Both `before` and `after` are false, function wouldn't be called.");let i,a,c,u=function(...l){let d=this,p=()=>{if(i=void 0,a)clearTimeout(a),a=void 0;if(s)c=e.apply(d,l)},m=()=>{if(a=void 0,i)clearTimeout(i),i=void 0;if(s)c=e.apply(d,l)},h=o&&!i;if(clearTimeout(i),i=setTimeout(p,r),n>0&&n!==Number.POSITIVE_INFINITY&&!a)a=setTimeout(m,n);if(h)c=e.apply(d,l);return c};return Eg(u,e),u.cancel=()=>{if(i)clearTimeout(i),i=void 0;if(a)clearTimeout(a),a=void 0},u},zg=k9;var Io=Op(ak(),1);var AZ=Object.prototype.toString;function uk(e,t,r){if(!e)return!1;if(e.constructor===t)return!0;return AZ.call(e)===r}function lk(e){return uk(e,Uint8Array,"[object Uint8Array]")}function NZ(e){return uk(e,ArrayBuffer,"[object ArrayBuffer]")}function jZ(e){return lk(e)||NZ(e)}function qZ(e){if(!lk(e))throw TypeError(`Expected \`Uint8Array\`, got \`${typeof e}\``)}function MZ(e){if(!jZ(e))throw TypeError(`Expected \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof e}\``)}function Ug(e,t){if(e.length===0)return new Uint8Array(0);t??=e.reduce((o,s)=>o+s.length,0);let r=new Uint8Array(t),n=0;for(let o of e)qZ(o),r.set(o,n),n+=o.length;return r}var ck={utf8:new globalThis.TextDecoder("utf8")};function Fg(e,t="utf8"){return MZ(e),ck[t]??=new globalThis.TextDecoder(t),ck[t].decode(e)}function LZ(e){if(typeof e!=="string")throw TypeError(`Expected \`string\`, got \`${typeof e}\``)}var DZ=new globalThis.TextEncoder;function pp(e){return LZ(e),DZ.encode(e)}var wX=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));var VZ=hk.default.default,fk="aes-256-cbc",Fs=()=>Object.create(null),HZ=(e)=>e!==void 0&&e!==null,ZZ=(e,t)=>{let r=new Set(["undefined","symbol","function"]),n=typeof t;if(r.has(n))throw TypeError(`Setting a value of type \`${n}\` for key \`${e}\` is not allowed as it's not supported by JSON`)},fp="__internal__",Vg=`${fp}.migrations.version`;class mp{path;events;#n;#t;#e;#r={};constructor(e={}){let t={configName:"config",fileExtension:"json",projectSuffix:"nodejs",clearInvalidConfig:!1,accessPropertiesByDotNotation:!0,configFileMode:438,...e};if(!t.cwd){if(!t.projectName)throw Error("Please specify the `projectName` option.");t.cwd=lh(t.projectName,{suffix:t.projectSuffix}).config}if(this.#e=t,t.schema??t.ajvOptions??t.rootSchema){if(t.schema&&typeof t.schema!=="object")throw TypeError("The `schema` option must be an object.");let s=new mk.Ajv2020({allErrors:!0,useDefaults:!0,...t.ajvOptions});VZ(s);let i={...t.rootSchema,type:"object",properties:t.schema};this.#n=s.compile(i);for(let[a,c]of Object.entries(t.schema??{}))if(c?.default)this.#r[a]=c.default}if(t.defaults)this.#r={...this.#r,...t.defaults};if(t.serialize)this._serialize=t.serialize;if(t.deserialize)this._deserialize=t.deserialize;this.events=new EventTarget,this.#t=t.encryptionKey;let r=t.fileExtension?`.${t.fileExtension}`:"";this.path=pk.resolve(t.cwd,`${t.configName??"config"}${r}`);let n=this.store,o=Object.assign(Fs(),t.defaults,n);if(t.migrations){if(!t.projectVersion)throw Error("Please specify the `projectVersion` option.");this._migrate(t.migrations,t.projectVersion,t.beforeEachMigration)}this._validate(o);try{FZ.deepEqual(n,o)}catch{this.store=o}if(t.watch)this._watch()}get(e,t){if(this.#e.accessPropertiesByDotNotation)return this._get(e,t);let{store:r}=this;return e in r?r[e]:t}set(e,t){if(typeof e!=="string"&&typeof e!=="object")throw TypeError(`Expected \`key\` to be of type \`string\` or \`object\`, got ${typeof e}`);if(typeof e!=="object"&&t===void 0)throw TypeError("Use `delete()` to clear values");if(this._containsReservedKey(e))throw TypeError(`Please don't use the ${fp} key, as it's used to manage this module internal operations.`);let{store:r}=this,n=(o,s)=>{if(ZZ(o,s),this.#e.accessPropertiesByDotNotation)ah(r,o,s);else r[o]=s};if(typeof e==="object"){let o=e;for(let[s,i]of Object.entries(o))n(s,i)}else n(e,t);this.store=r}has(e){if(this.#e.accessPropertiesByDotNotation)return i$(this.store,e);return e in this.store}reset(...e){for(let t of e)if(HZ(this.#r[t]))this.set(t,this.#r[t])}delete(e){let{store:t}=this;if(this.#e.accessPropertiesByDotNotation)s$(t,e);else delete t[e];this.store=t}clear(){this.store=Fs();for(let e of Object.keys(this.#r))this.reset(e)}onDidChange(e,t){if(typeof e!=="string")throw TypeError(`Expected \`key\` to be of type \`string\`, got ${typeof e}`);if(typeof t!=="function")throw TypeError(`Expected \`callback\` to be of type \`function\`, got ${typeof t}`);return this._handleChange(()=>this.get(e),t)}onDidAnyChange(e){if(typeof e!=="function")throw TypeError(`Expected \`callback\` to be of type \`function\`, got ${typeof e}`);return this._handleChange(()=>this.store,e)}get size(){return Object.keys(this.store).length}get store(){try{let e=To.readFileSync(this.path,this.#t?null:"utf8"),t=this._encryptData(e),r=this._deserialize(t);return this._validate(r),Object.assign(Fs(),r)}catch(e){if(e?.code==="ENOENT")return this._ensureDirectory(),Fs();if(this.#e.clearInvalidConfig&&e.name==="SyntaxError")return Fs();throw e}}set store(e){this._ensureDirectory(),this._validate(e),this._write(e),this.events.dispatchEvent(new Event("change"))}*[Symbol.iterator](){for(let[e,t]of Object.entries(this.store))yield[e,t]}_encryptData(e){if(!this.#t)return typeof e==="string"?e:Fg(e);try{let t=e.slice(0,16),r=Da.pbkdf2Sync(this.#t,t.toString(),1e4,32,"sha512"),n=Da.createDecipheriv(fk,r,t),o=e.slice(17),s=typeof o==="string"?pp(o):o;return Fg(Ug([n.update(s),n.final()]))}catch{}return e.toString()}_handleChange(e,t){let r=e(),n=()=>{let o=r,s=e();if(UZ(s,o))return;r=s,t.call(this,s,o)};return this.events.addEventListener("change",n),()=>{this.events.removeEventListener("change",n)}}_deserialize=(e)=>JSON.parse(e);_serialize=(e)=>JSON.stringify(e,void 0,"\t");_validate(e){if(!this.#n)return;if(this.#n(e)||!this.#n.errors)return;let r=this.#n.errors.map(({instancePath:n,message:o=""})=>`\`${n.slice(1)}\` ${o}`);throw Error("Config schema violation: "+r.join("; "))}_ensureDirectory(){To.mkdirSync(pk.dirname(this.path),{recursive:!0})}_write(e){let t=this._serialize(e);if(this.#t){let r=Da.randomBytes(16),n=Da.pbkdf2Sync(this.#t,r.toString(),1e4,32,"sha512"),o=Da.createCipheriv(fk,n,r);t=Ug([r,pp(":"),o.update(pp(t)),o.final()])}if(dk.env.SNAP)To.writeFileSync(this.path,t,{mode:this.#e.configFileMode});else try{gh(this.path,t,{mode:this.#e.configFileMode})}catch(r){if(r?.code==="EXDEV"){To.writeFileSync(this.path,t,{mode:this.#e.configFileMode});return}throw r}}_watch(){if(this._ensureDirectory(),!To.existsSync(this.path))this._write(Fs());if(dk.platform==="win32")To.watch(this.path,{persistent:!1},zg(()=>{this.events.dispatchEvent(new Event("change"))},{wait:100}));else To.watchFile(this.path,{persistent:!1},zg(()=>{this.events.dispatchEvent(new Event("change"))},{wait:5000}))}_migrate(e,t,r){let n=this._get(Vg,"0.0.0"),o=Object.keys(e).filter((i)=>this._shouldPerformMigration(i,n,t)),s={...this.store};for(let i of o)try{if(r)r(this,{fromVersion:n,toVersion:i,finalVersion:t,versions:o});let a=e[i];a?.(this),this._set(Vg,i),n=i,s={...this.store}}catch(a){throw this.store=s,Error(`Something went wrong during the migration! Changes applied to the store until this failed migration will be restored. ${a}`)}if(this._isVersionInRangeFormat(n)||!Io.default.eq(n,t))this._set(Vg,t)}_containsReservedKey(e){if(typeof e==="object"){if(Object.keys(e)[0]===fp)return!0}if(typeof e!=="string")return!1;if(this.#e.accessPropertiesByDotNotation){if(e.startsWith(`${fp}.`))return!0;return!1}return!1}_isVersionInRangeFormat(e){return Io.default.clean(e)===null}_shouldPerformMigration(e,t,r){if(this._isVersionInRangeFormat(e)){if(t!=="0.0.0"&&Io.default.satisfies(t,e))return!1;return Io.default.satisfies(r,e)}if(Io.default.lte(e,t))return!1;if(Io.default.gt(e,r))return!1;return!0}_get(e,t){return o$(this.store,e,t)}_set(e,t){let{store:r}=this;ah(r,e,t),this.store=r}}import{chmodSync as sG,existsSync as iG}from"fs";import{randomBytes as GZ}from"node:crypto";import{closeSync as gk,openSync as yk,readFileSync as JZ,statSync as _k,unlinkSync as hp,writeSync as KZ}from"node:fs";var vk=30000,BZ=8000,WZ=2*vk,YZ=1e4,XZ=100;function QZ(e){try{return process.kill(e,0),!0}catch(t){return t.code==="EPERM"}}function Hg(e){try{return JZ(e,"utf8")}catch(t){if(t.code==="ENOENT")return null;throw t}}function Zg(e){if(e===null)return null;try{let t=JSON.parse(e);if(typeof t.pid==="number"&&typeof t.ts==="number"&&typeof t.nonce==="string")return t;return null}catch{return null}}function eG(e,t,r){if(t)return r-t.ts;try{return r-_k(e).mtimeMs}catch{return}}function Sk(e,t,r){let n=eG(e,t,r);if(n===void 0)return!1;if(n>vk)return!0;return t!==null&&n>BZ&&!QZ(t.pid)}function tG(e,t){let r=`${e}.break`,n;try{n=yk(r,"wx",384)}catch(o){if(o.code!=="EEXIST")throw o;try{if(Date.now()-_k(r).mtimeMs>YZ)hp(r)}catch(s){if(s.code!=="ENOENT")throw s}return!1}try{gk(n);let o=Hg(e);if(o===t&&Sk(e,Zg(o),Date.now()))try{hp(e)}catch(s){if(s.code!=="ENOENT")throw s}}finally{hp(r)}return!0}function rG(e,t){let r;try{r=yk(e,"wx",384)}catch(n){if(n.code==="EEXIST")return!1;throw n}try{KZ(r,JSON.stringify(t))}finally{gk(r)}return!0}async function bk(e){let t={pid:process.pid,ts:0,nonce:GZ(8).toString("hex")},r=Date.now();for(;;){let n=Date.now();if(t.ts=n,rG(e,t))return{release:()=>{try{if(Zg(Hg(e))?.nonce!==t.nonce)return;hp(e)}catch{}}};let o=Hg(e);if(o===null)continue;if(Sk(e,Zg(o),n)&&tG(e,o))continue;if(n-r>=WZ)return null;await new Promise((s)=>setTimeout(s,XZ))}}var Gg=null;function aG(e){try{if(iG(e.path))sG(e.path,384)}catch{}}function Ek(){return Vs().path}function Vs(){if(!Gg){let e=new mp({projectName:"grove-cli",configFileMode:384,defaults:{currentProfile:"default",profiles:{}}});aG(e),Gg=e}return Gg}function Bg(e,t){let r=Vs(),n=r.get("profiles");n[e]=t,r.set("profiles",n)}function Zn(e){return Vs().get("profiles")[e]??null}function gp(){return Vs().get("currentProfile")}function zk(){let e=gp();return Zn(e)}var Pk="https://grove.iis.tools",$k="No API URL configured. Run: grove auth login (or set GROVE_API_URL)";function Tk(e){let{apiUrl:t,token:r,apiKey:n}=e,o=process.env.GROVE_API_URL,s=process.env.GROVE_TOKEN,i=process.env.GROVE_API_KEY,a=n??i;if(a){let d=t??o??wk(e.profile);if(!d)throw new Me($k,Dt.AUTH);return{apiUrl:d,token:a,authType:"api-key"}}let c=r??s,u=t??o??wk(e.profile);if(c&&u)return{apiUrl:u,token:c,authType:"jwt"};if(c)throw new Me($k,Dt.AUTH);let l=e.profile?Zn(e.profile):zk();if(l){let d=c??l.token??l.apiKey,p=u??l.baseUrl;if(d&&p){let m=l.apiKey&&!c?"api-key":"jwt";return{apiUrl:p,token:d,authType:m}}}throw new Me("Not authenticated. Run: grove auth login",Dt.AUTH)}function wk(e){return(e?Zn(e):zk())?.baseUrl}function Wg(e){return e.accountUrl??process.env.GROVE_ACCOUNT_URL??"https://account.iis.tools"}function cG(e){let t=Wg(e);return new wn(t,{verbose:e.verbose,timeout:e.timeout?parseInt(e.timeout,10):void 0})}var Jg=8000,Kg=new Map;function uG(e){return oG(nG(Vs().path),`refresh-${encodeURIComponent(e)}.lock`)}function Ik(e,t={},r){let n=`${Vs().path}\x00${e}`,o=Kg.get(n);if(o)return o;let s=fG(e,t,r).finally(()=>{Kg.delete(n)});return Kg.set(n,s),s}var lG=30000;function dG(e){let t=e.split(".")[1];if(!t)return!1;try{let{exp:r}=JSON.parse(Buffer.from(t,"base64url").toString("utf8"));return typeof r==="number"&&r*1000>Date.now()+lG}catch{return!1}}function Rk(e,t){if(t===void 0||!e?.token||!e.refreshToken)return null;if(e.token===t||!dG(e.token))return null;return{token:e.token,refreshToken:e.refreshToken}}function pG(e){return e instanceof Me&&(e.statusCode===400||e.statusCode===401)}async function fG(e,t,r){let n=Rk(Zn(e),r);if(n)return n;let o;try{o=await bk(uG(e))}catch(s){throw new vo(s)}if(!o)throw new vo;try{let s=Zn(e);if(!s?.refreshToken)return null;let i=Rk(s,r);if(i)return i;let a=t.timeout?parseInt(t.timeout,10):Jg,u=await cG({...t,timeout:String(Math.min(a||Jg,Jg))}).post("/auth/refresh",{refreshToken:s.refreshToken});return Bg(e,{...s,token:u.accessToken,refreshToken:u.refreshToken}),{token:u.accessToken,refreshToken:u.refreshToken}}catch(s){if(pG(s))return null;throw new vo(s)}finally{o.release()}}import{spawn as mG}from"node:child_process";import{createHash as Ok,randomBytes as yp}from"node:crypto";import{createServer as kk}from"node:http";function xk(){return yp(32).toString("base64url")}function hG(e){return Ok("sha256").update(e).digest("base64url")}function Ck(e,t,r,n){let o=new URL(`${e.replace(/\/$/,"")}/auth/cli`);return o.searchParams.set("response_type","code"),o.searchParams.set("code_challenge",hG(t)),o.searchParams.set("code_challenge_method","S256"),o.searchParams.set("redirect_uri",r),o.searchParams.set("state",n),o.searchParams.set("service","Grove"),o.toString()}function Ak(){let e,t,r=new Promise((n,o)=>{e=n,t=o});return r.catch(()=>{}),{promise:r,resolve:e,reject:t}}var gG="<!doctype html><html><body><h2>Signed in to Grove.</h2><p>You can close this window.</p></body></html>",yG="<!doctype html><html><body><h2>Sign-in link invalid or expired.</h2><p>Start the sign-in again.</p></body></html>";async function Nk(e){let t=xk(),r=yp(16).toString("hex"),n=Ak(),o=(d,p)=>{let m=new URL(d.url??"/","http://localhost");if(d.method!=="GET"||m.pathname!=="/callback"){p.writeHead(404).end();return}let h=m.searchParams.get("code");if(!h||m.searchParams.get("state")!==r){p.writeHead(400,{"Content-Type":"text/html; charset=utf-8"}).end(yG);return}p.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}).end(gG),n.resolve(h)},s=kk(o);await new Promise((d,p)=>{s.once("error",p),s.listen(0,"127.0.0.1",()=>d())});let{port:i}=s.address(),a=[s],c=kk(o);await new Promise((d)=>{c.once("error",()=>d()),c.listen(i,"::1",()=>{a.push(c),d()})});let u=`http://localhost:${i}/callback`,l=!1;return{mode:"loopback",authUrl:Ck(e.accountUrl,t,u,r),redirectUri:u,codeVerifier:t,port:i,waitForCode:()=>n.promise,close:()=>{if(l)return;l=!0,n.reject(Error("login listener closed"));for(let d of a)d.closeAllConnections(),d.close()}}}var _G=3000,vG=60000,SG=1e4;async function jk(e){let t=xk(),r=yp(16).toString("hex"),n=yp(32).toString("base64url"),o=Ok("sha256").update(n).digest("base64url"),s=e.apiUrl.replace(/\/$/,""),i=`${s}/auth/cli/callback?k=${o}`,a=e.pollIntervalMs??_G,c=new wn(s,{headers:{Authorization:`Relay ${n}`},timeout:SG,userAgent:e.userAgent}),u=Ak(),l=!1,d,p=(h)=>{if(l)return;d=setTimeout(()=>void m(),h),d.unref()},m=async()=>{let h=a;try{let g=await c.get("/auth/cli/relay",{k:o});if(!l&&typeof g?.code==="string"&&g.state===r){u.resolve(g.code);return}}catch(g){if(g instanceof Me&&g.retryAfterS!==void 0)h=Math.min(Math.max(a,g.retryAfterS*1000),vG)}p(h)};return p(a),{mode:"relay",authUrl:Ck(e.accountUrl,t,i,r),redirectUri:i,codeVerifier:t,waitForCode:()=>u.promise,close:()=>{if(l)return;l=!0,clearTimeout(d),u.reject(Error("relay login closed"))}}}function qk(e,t,r){return new wn(e).post("/auth/token",{code:r,codeVerifier:t.codeVerifier,redirectUri:t.redirectUri})}function Mk(e=process.env,t=process.platform){if(e.SSH_CONNECTION||e.SSH_TTY)return!0;return t==="linux"&&!e.DISPLAY&&!e.WAYLAND_DISPLAY}function Lk(e,t=process.platform){let[r,n]=t==="darwin"?["open",[e]]:t==="win32"?["rundll32",["url.dll,FileProtocolHandler",e]]:["xdg-open",[e]];return new Promise((o,s)=>{let i=mG(r,n,{stdio:"ignore"});i.once("error",s),i.once("exit",(a)=>{if(a===0)o();else s(Error(`${r} exited with ${a}`))})})}import{randomUUID as bG}from"node:crypto";var $G=300000,wG=50000,RG=1e4;class ko{deps;current;canAutoRefresh;pending=null;live=null;deadProfileKey;reloginSpent=!1;closed=!1;notice=null;profileClients=new WeakSet;constructor(e,t){this.deps=t;if(this.current=e?.client??null,this.canAutoRefresh=e?.canAutoRefresh??!1,e?.profileKey!==void 0)this.profileClients.add(e.client)}static fixed(e,t){return new ko({client:e,canAutoRefresh:t})}get canLogin(){return this.deps!==void 0}clientForCall(){if(!this.deps)return this.current;if(this.current&&!this.profileClients.has(this.current))return this.current;let e=this.safeBuild();if(this.current){if(e)return this.current;return this.current=null,this.canAutoRefresh=!1,null}if(!e)return null;if(this.deadProfileKey!==void 0&&e.profileKey===this.deadProfileKey)return null;return this.adopt(e),this.live?.abort(),this.current}mayLogin(){if(!this.deps)return!1;if(this.live||this.pending)return!0;return this.deadProfileKey===void 0||!this.reloginSpent}markRevoked(e,t=!1){if(!this.deps||!this.profileClients.has(e))return!1;if(this.current!==e)return!0;return this.current=null,this.canAutoRefresh=!1,this.deadProfileKey=this.safeBuild()?.profileKey??"",this.reloginSpent=t,!0}close(){this.closed=!0,this.live?.abort()}get loginWaitMs(){return this.deps?.loginWaitMs??wG}get progressIntervalMs(){return this.deps?.progressIntervalMs??RG}canOpenBrowser(){return this.deps?.openBrowser!==void 0&&(this.deps.canOpenBrowser?.()??!0)}takeSignInNotice(){let e=this.notice;return this.notice=null,e}openBrowser(e){let t=this.canOpenBrowser()?this.deps?.openBrowser:void 0,r=e.loopbackUrl??e.relayUrl,n={failed:!1,failure:new Promise(()=>{})};if(!t||!r)n.failed=!0,n.failure=Promise.resolve("open-failed");else n.failure=Promise.resolve().then(()=>t(r)).then(()=>new Promise(()=>{}),()=>(n.failed=!0,"open-failed"));e.browser=n}beginLogin(e="relay"){if(this.pending)return{pending:this.pending,created:!1};let t=this.deps;if(!t)throw Error("this session has no login");if(this.deadProfileKey!==void 0)this.reloginSpent=!0;let r=this.startPending(t,e);return this.pending=r,r.catch(()=>{if(this.pending===r)this.pending=null}),{pending:r,created:!0}}safeBuild(){try{return this.deps?.build()??null}catch{return null}}adopt(e){if(this.current=e.client,this.canAutoRefresh=e.canAutoRefresh,e.profileKey!==void 0)this.profileClients.add(e.client);this.deadProfileKey=void 0,this.reloginSpent=!1}async startPending(e,t){let r=await e.startLogin(t),n=e.ttlMs??$G,o=[r],s,i=new Promise((h)=>s=h),a=!1,c=!1,u=(h)=>{if(a)return;a=!0,clearTimeout(l);for(let g of o)g.close();this.pending=null,this.live=null,s(h)},l=setTimeout(()=>u("expired"),n);l.unref();let d=(h)=>{h.waitForCode().then(async(g)=>{if(a||c)return;c=!0;try{let _=await e.complete(h,g),y=this.safeBuild();if(!y){u("failed");return}this.adopt(y),this.notice={accountId:_?.accountId,mode:h.mode},u("signed-in")}catch{u("failed")}},()=>{})};d(r);let p=r.mode==="relay"?Promise.resolve(r.authUrl):null,m={relayUrl:r.mode==="relay"?r.authUrl:null,loopbackUrl:r.mode==="loopback"?r.authUrl:null,addRelay:()=>{if(a)return Promise.resolve(null);return p??=e.startLogin("relay").then((h)=>{if(a)return h.close(),null;return o.push(h),d(h),m.relayUrl=h.authUrl,h.authUrl}),p},elicitationId:bG(),expiresAt:Date.now()+n,elicited:!1,browser:null,done:i,abort:()=>u("aborted")};if(this.live=m,this.closed)m.abort();return m}}var Ua="0.4.0",Yg=`grove-mcp/${Ua}`;function Dk(){let e=process.env.GROVE_PROFILE,t=e??gp(),r=Boolean(process.env.GROVE_TOKEN||process.env.GROVE_API_KEY),n=Zn(t);if(!r&&!n)return null;let o=Tk({profile:e});if(!r&&o.authType==="jwt"&&!n?.refreshToken&&EG(o.token))return null;let s=o.authType==="jwt"&&!!n?.refreshToken;return{client:new wn(o.apiUrl,{apiKey:o.authType==="api-key"?o.token:void 0,token:o.authType==="jwt"?o.token:void 0,userAgent:Yg,onUnauthorized:s?(a)=>Ik(t,{accountUrl:process.env.GROVE_ACCOUNT_URL},a):void 0}),canAutoRefresh:s,profileKey:r?void 0:n?.refreshToken??o.token}}function EG(e){let t=e.split(".")[1];if(!t)return!1;try{let{exp:r}=JSON.parse(Buffer.from(t,"base64url").toString("utf8"));return typeof r==="number"&&r*1000<=Date.now()}catch{return!1}}function Uk(e={}){let t=Wg({}),r=process.env.GROVE_PROFILE??gp(),n=()=>process.env.GROVE_API_URL??Zn(r)?.baseUrl??Pk;return new ko(Dk(),{build:Dk,startLogin:(o)=>o==="relay"?jk({accountUrl:t,apiUrl:n(),pollIntervalMs:e.relayPollMs,userAgent:Yg}):Nk({accountUrl:t}),complete:async(o,s)=>{let i=await qk(t,o,s);return Bg(r,{baseUrl:n(),token:i.accessToken,refreshToken:i.refreshToken}),{accountId:i.accountId}},ttlMs:e.ttlMs,loginWaitMs:e.loginWaitMs,progressIntervalMs:e.progressIntervalMs,openBrowser:e.openBrowser??Lk,canOpenBrowser:e.openBrowser?void 0:()=>!Mk()})}var Fk="npm";import{lstatSync as a6,mkdirSync as c6,realpathSync as u6}from"node:fs";import{homedir as l6}from"node:os";import d6 from"node:path";import{existsSync as zG,statSync as PG}from"node:fs";import Vk from"node:path";var Hs=["claude-code","claude-desktop","cursor","vscode"],Hk={"claude-code":"Claude Code","claude-desktop":"Claude Desktop",cursor:"Cursor",vscode:"VS Code"};function Zk(e,t,r){return(e==="win32"?t.USERPROFILE:t.HOME)||r}function _p(e,t,r,n){let o=t==="win32"?Vk.win32:Vk.posix,s=r.APPDATA||o.join(n,"AppData","Roaming"),i=(a)=>t==="darwin"?o.join(n,"Library","Application Support",a):t==="win32"?o.join(s,a):o.join(n,".config",a);switch(e){case"claude-code":{let a=r.CLAUDE_CONFIG_DIR,c=o.join(a||n,".claude.json"),u=a||o.join(n,".claude");return{file:c,legacyFile:o.join(u,".config.json"),detect:[c,u],serversKey:"mcpServers",withType:!0,newFileMode:384}}case"claude-desktop":{let a=i("Claude");return{file:o.join(a,"claude_desktop_config.json"),detect:[a],serversKey:"mcpServers",withType:!1,newFileMode:420}}case"cursor":{let a=o.join(n,".cursor");return{file:o.join(a,"mcp.json"),detect:[a],serversKey:"mcpServers",withType:!1,newFileMode:420}}case"vscode":{let a=o.join(i("Code"),"User");return{file:o.join(a,"mcp.json"),detect:[a],serversKey:"servers",withType:!0,newFileMode:420}}}}function Xg(e){if(e.legacyFile)try{if(PG(e.legacyFile).size>0)return e.legacyFile}catch{}return e.file}function Gk(e){return e.detect.some((t)=>zG(t))}import{readFileSync as TG,readlinkSync as IG,statSync as kG}from"node:fs";import Fa from"node:path";var OG="@iistools/grove-mcp",Kk="https://registry.npmjs.org/",xG=`--@iistools:registry=${Kk}`;function CG(e){return e==="win32"?Fa.win32:Fa.posix}function Jk(e){try{return kG(e).isFile()}catch{return!1}}function Bk(e,t,r){let n=CG(e),o=e==="win32"?"npx.cmd":"npx";for(let i of(t.PATH??"").split(n.delimiter))if(i&&n.isAbsolute(i)&&Jk(n.join(i,o)))return AG(n.join(i,o),t,n);let s=n.join(n.dirname(r),o);return Jk(s)?s:null}function AG(e,t,r){let n=t.FNM_MULTISHELL_PATH;if(!n||!e.startsWith(n+r.sep))return e;try{return r.resolve(r.dirname(n),IG(n))+e.slice(n.length)}catch{return e}}function Wk(e,t,r){if(e==="win32")return null;let n=[Fa.posix.dirname(t),Fa.posix.dirname(r),"/usr/local/bin","/usr/bin","/bin"];return[...new Set(n)].join(Fa.posix.delimiter)}function Sp(e){return typeof e.command==="string"&&/\s/.test(e.command.trim())&&(!Array.isArray(e.args)||e.args.length===0)}function Qg(e){return Array.isArray(e.args)?e.args.filter((t)=>typeof t==="string"):[]}function NG(e){return[typeof e.command==="string"?e.command:"",...Qg(e)].join(" ")}var jG=/@iistools\/grove-mcp|iis-grove-mcp|grove-mcp\.js|mcp-main\.js/,qG=/grove-mcp\.js|mcp-main\.js/;function Va(e){return jG.test(NG(e))}function vp(e){return e.split(/[\\/]/).pop()??e}function ey(e){if(e===null||typeof e!=="object"||Array.isArray(e))return`not an entry: ${Array.isArray(e)?"array":typeof e}`;let t=e.command;if(typeof t!=="string"||!t.trim())return"no command";return vp(t.trim().split(/\s+/)[0])}function Ha(e){if(Sp(e))return null;let t=typeof e.command==="string"?e.command:"";if(vp(t).replace(/\.exe$/i,"")==="iis-grove-mcp")return`installed binary (${vp(t)})`;let r=[t,...Qg(e)].find((n)=>qG.test(n));return r?`local build (${vp(r)})`:null}function Yk(e){if(!/^npx(\.cmd)?$/i.test(ey(e)))return[];let r=(Sp(e)?e.command.trim().split(/\s+/):Qg(e)).filter((n)=>n.startsWith("--")&&n!=="--yes");return[...new Set(r)]}function Xk(e){let t=e.npm_config_userconfig;if(!t)return[];let r;try{r=TG(t,"utf8")}catch{return[]}for(let n of r.split(/\r?\n/)){let o=/^\s*@iistools:registry\s*=\s*(\S+)\s*$/.exec(n);if(!o)continue;return(o[1].endsWith("/")?o[1]:`${o[1]}/`)===Kk?[]:[xG]}return[]}function Qk(e,t,r){let n=r!==null&&typeof r==="object"&&!Array.isArray(r)?{...r}:{};if(e.envPath!==null&&!("PATH"in n))n.PATH=e.envPath;let o=e.withType?{type:"stdio"}:{};return o.command=e.npx,o.args=["-y",...t,OG],o.env=n,o}import{readFileSync as BG,statSync as WG}from"node:fs";import Zs from"node:path";import{chmodSync as MG,copyFileSync as LG,existsSync as DG,readFileSync as UG,renameSync as FG,rmSync as VG,statSync as HG,writeFileSync as ZG}from"node:fs";import{isDeepStrictEqual as GG}from"node:util";var JG=".bak-grove-mcp",tO="\uFEFF";function pt(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function ty(e){let t;try{t=UG(e,"utf8")}catch(a){if(a.code!=="ENOENT")return{ok:!1,reason:`not readable (${a.code})`};return{ok:!0,doc:{exists:!1,data:{},indent:" ",trailingNewline:!0,bom:!1,mode:null}}}let r=t.startsWith(tO),n=r?t.slice(1):t,o=HG(e).mode&511,s={indent:/^(\t+| +)"/m.exec(n)?.[1]??" ",trailingNewline:n.endsWith(`
66
+ `),bom:r,mode:o};if(n.trim()==="")return{ok:!0,doc:{exists:!0,data:{},...s,trailingNewline:!0}};let i;try{i=JSON.parse(n)}catch{return{ok:!1,reason:"not valid JSON"}}if(!pt(i))return{ok:!1,reason:"not a JSON object"};return{ok:!0,doc:{exists:!0,data:i,...s}}}function KG(e,t){return(e.bom?tO:"")+JSON.stringify(t,null,e.indent)+(e.trailingNewline?`
67
+ `:"")}var rO=(e,t,r)=>ZG(e,t,{mode:r});function eO(e,t){return t.reduce((r,n)=>pt(r)?r[n]:void 0,e)}function nO(e,t,r,n,o,s){let i=t.exists?`${e}${JG}`:null;if(i&&!DG(i))LG(e,i);let a=`${e}.${process.pid}.tmp`,c=t.mode??o;try{s(a,KG(t,r),c),MG(a,c),FG(a,e)}catch(d){throw VG(a,{force:!0}),d}let u=ty(e);return u.ok&&n.every((d)=>GG(eO(u.doc.data,d),eO(r,d)))?{ok:!0,backup:i}:{ok:!1,reason:"verify after write",backup:i}}var ry="grove-mcp",YG="iis-grove-mcp";function oO(e){let t=Zs.join(e,".config","iis","settings.json");try{let r=JSON.parse(BG(t,"utf8")),n=pt(r)?r.mcp:void 0;if(n===void 0)return{file:t,readable:pt(r),mcp:{}};if(pt(n))return{file:t,readable:!0,mcp:n}}catch{}return{file:t,readable:!1,mcp:{}}}function sO(e){if(!pt(e)||typeof e.command!=="string")return!1;let{command:t,args:r}=e;return(t==="iis"||t.endsWith("/iis"))&&Array.isArray(r)&&r[0]==="mcp"}function XG(e){for(let t=1;t<e.length;t++){let r=e[t];if(r==="--profile"&&typeof e[t+1]==="string")return e[t+1];if(typeof r==="string"&&r.startsWith("--profile="))return r.slice(10)}return}function QG(e,t){let r=pt(t.profiles)?t.profiles:{},n=(o)=>Array.isArray(r[o])?r[o]:[];if(e)return{ids:n(e),label:e};if(Array.isArray(t.active)&&t.active.length>0)return{ids:t.active,label:"mcp.active"};if(typeof t.profile==="string"&&t.profile)return{ids:n(t.profile),label:t.profile};return{ids:[],label:"dev"}}function e6(e){let t=WG(e,{throwIfNoEntry:!1});return t!==void 0&&t.isFile()&&(t.mode&73)!==0}function t6(e,t){if(t.platform==="win32")return!1;let r=pt(e.env)?e.env:{},n=(i)=>typeof r[i]==="string"&&r[i]?r[i]:t.env[i],o=n("IISTOOLS_DIR");return[...(n("PATH")??"").split(Zs.delimiter).filter((i)=>Zs.isAbsolute(i)),o?Zs.join(o,"bin"):Zs.join(t.home,".iistools","bin")].some((i)=>e6(Zs.join(i,YG)))}function iO(e,t,r){for(let[n,o]of Object.entries(e)){if(t.has(n)||!sO(o))continue;let{ids:s,label:i}=QG(XG(o.args),r.settings.mcp);if(s.includes(ry)&&t6(o,r))return{key:n,label:i}}return null}function ny(e){return Object.values(e).some(sO)}function aO(e){return pt(e)&&Va(e)}import{mkdirSync as r6,rmdirSync as n6,rmSync as o6,statSync as s6}from"node:fs";var i6=1e4,cO=[100,200,400,600,700];function uO(e,t){let r=`${e}.lock`;for(let n=0;;n++){try{return r6(r),()=>n6(r)}catch(s){if(s.code!=="EEXIST")throw s}let o=s6(r,{throwIfNoEntry:!1});if(!o||t.now()-o.mtimeMs>i6){o6(r,{recursive:!0,force:!0});continue}if(n>=cO.length)return null;t.sleep(cO[n])}}var p6="npx -y @iistools/grove-mcp install",iy="claude mcp add -s user grove -- npx -y @iistools/grove-mcp",f6='{"command": "npx", "args": ["-y", "@iistools/grove-mcp"]}',lO=`Usage: iis-grove-mcp install [--dry-run] [--force] [--client <name>]...
68
68
 
69
69
  Registers Grove's MCP server in the MCP apps on this computer: Claude Code
70
70
  (user scope, ~/.claude.json, also read by its VS Code extension), Claude
@@ -74,19 +74,26 @@ sits in "command", and leaves every other server untouched. A changed file
74
74
  keeps a backup beside it (<file>.bak-grove-mcp).
75
75
 
76
76
  --dry-run print what would change, write nothing
77
- --client <name> only this client (repeatable): ${Ms.join(", ")}
77
+ --client <name> only this client (repeatable): ${Hs.join(", ")}
78
78
  --force write "grove" even where Grove already reaches the client
79
79
  another way (iis mcp, or another entry), which mounts it twice
80
80
 
81
81
  Re-run it after a Node upgrade or move: the entry names that node's npx.
82
- Manual form for Claude Code: ${Lg}
83
- `;function Ck(e){return{platform:process.platform,env:process.env,execPath:process.execPath,dist:e,homedir:lG(),out:(t)=>process.stdout.write(`${t}
84
- `),err:(t)=>process.stderr.write(t),now:()=>Date.now(),sleep:(t)=>Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,t),writeFile:bk}}function mG(e){let t={dryRun:!1,force:!1,help:!1,clients:[]};for(let r=0;r<e.length;r++){let o=e[r];if(o==="--dry-run")t.dryRun=!0;else if(o==="--force")t.force=!0;else if(o==="--help"||o==="-h")t.help=!0;else if(o==="--client"||o.startsWith("--client=")){let n=o==="--client"?e[++r]:o.slice(9);if(!Ms.includes(n??""))return`unknown --client ${JSON.stringify(n??"")} (one of: ${Ms.join(", ")})`;if(!t.clients.includes(n))t.clients.push(n)}else return`unexpected argument ${JSON.stringify(o)}`}return t}function kk(e,t,r){return e===null?`${t}.${r}`:`projects[${JSON.stringify(e)}].${t}.${r}`}function qg(e,t,r,o){let n=[],s=Ek(e.servers,e.disabled,r),i=(a)=>o?.has(a)?e.project:null;if(s)n.push({kind:"iis",mount:s,where:kk(i(s.key),t,s.key)});for(let[a,c]of Object.entries(e.servers))if(!e.disabled.has(a)&&zk(c))n.push({kind:"key",key:a,where:kk(i(a),t,a)});return n}function hG(e){return e.kind==="iis"?`iis mcp (profile ${e.mount.label})`:e.where}function Mg(e,t,r,o,n){let s=r.find((c)=>c.kind==="iis")??r.find((c)=>c.kind==="key"&&c.key==="grove")??r[0],i=r.filter((c)=>c!==s&&c.kind==="key").map((c)=>{let u=c.where.startsWith("projects["),l=e!=="claude-code"?"":u?` (or: cd ${gG(t??"")} && claude mcp remove ${c.key} -s local)`:` (or: claude mcp remove ${c.key} -s user)`;return`delete ${c.where} in ${o}${l}`});if(s.kind==="iis")i.push(`or drop ${Ag} from the iis profile in ${n.file}`);let a=t===null?"":` in ${t}`;return`double: ${e}${a} reaches grove twice (${r.map(hG).join(" + ")}); keep one: ${i.join("; ")}`}function gG(e){return`'${e.replace(/'/g,"'\\''")}'`}function Ok(e){return`refused: "grove" points elsewhere (${xg(e)})`}function yG(e,t,r,o){let n=ip(e,r.platform,r.env,o.mountCtx.home),s=Og(n),i=n.serversKey,a=t.dryRun?"[dry-run] ":"",c=(m)=>r.out(`${a}${m}`),u=(m)=>c(`${e} ${s} ${m}`),l={npx:o.npx,envPath:o.envPath,withType:n.withType},d=aG(s,{throwIfNoEntry:!1})?.isSymbolicLink()?uG(s):s,f=null;if(!t.dryRun){if(cG(dG.dirname(s),{recursive:!0}),e==="claude-code"){if(f=Tk(d,r),!f)return u("skipped: Claude Code is writing its config, re-run"),{exit:1,wrote:!1}}}try{let m=Ng(s);if(!m.ok){let H=e==="claude-code"?Lg:`add "grove": ${fG} under "${i}"`;return u(`skipped: ${m.reason}; by hand: ${H}`),{exit:1,wrote:!1}}let h=m.doc,g=structuredClone(h.data);if(g[i]!==void 0&&g[i]!==null&&!lt(g[i]))return u(`skipped: "${i}" is not an object`),{exit:1,wrote:!1};let _=[],y=[],S=0,v=(H,ge)=>{let Ie=H.grove,Ne=_k(l,Ie?gk(Ie):o.fresh,Ie?.env);if(JSON.stringify(Ie)===JSON.stringify(Ne))return"unchanged";if(H.grove=Ne,y.push(ge),!Ie)return"created";return cp(Ie)?"repaired joined command":"updated"},w=e==="claude-code"&&lt(g.projects)?g.projects:{},z=[];for(let[H,ge]of Object.entries(w)){if(!lt(ge))continue;let Ie=lt(ge[i])?ge[i]:{},Ne=new Set(Array.isArray(ge.disabledMcpServers)?ge.disabledMcpServers:[]);z.push({project:H,servers:Ie,disabled:Ne});let De=Ie.grove;if(De===void 0)continue;let Pe=`${e} ${s} projects[${JSON.stringify(H)}]:`;if(!lt(De)||!ja(De))_.push(`${Pe} ${Ok(De)}`),S=1;else if(qa(De))_.push(`${Pe} kept: ${qa(De)}`);else{let O=v(Ie,["projects",H,i,"grove"]);if(O!=="unchanged")_.push(`${Pe} ${O}`)}}let R=lt(g[i])?g[i]:{},b={project:null,servers:R,disabled:new Set},E=qg(b,i,o.mountCtx),C=R.grove,q=E.filter((H)=>!(H.kind==="key"&&H.key==="grove")),x;if(C!==void 0&&(!lt(C)||!ja(C)))x=Ok(C),S=1;else if(E.length>=2&&!t.force)x=Mg(e,null,E,s,o.mountCtx.settings),S=1;else if(C===void 0&&q.length===1&&!t.force){let H=q[0];x=H.kind==="iis"?`skipped: grove already reaches ${e} via iis mcp (profile ${H.mount.label})`:`kept: grove reaches ${e} via ${JSON.stringify(H.key)}`}else if(lt(C)&&qa(C))x=`kept: ${qa(C)}`;else{if(!lt(g[i]))g[i]=R;x=v(R,[i,"grove"]);let H=qg(b,i,o.mountCtx);if(H.length>=2)_.push(Mg(e,null,H,s,o.mountCtx.settings)),S=1}for(let H of z){let ge={...H,servers:{...R,...H.servers}},Ie=qg(ge,i,o.mountCtx,new Set(Object.keys(H.servers)));if(Ie.length>=2&&Ie.some((Ne)=>Ne.where.startsWith("projects[")))_.push(Mg(e,H.project,Ie,s,o.mountCtx.settings)),S=1}if((jg(R)||z.some((H)=>jg(H.servers)))&&!o.mountCtx.settings.readable)_.push(`note: iis settings unreadable (${o.mountCtx.settings.file}), assumed not mounted`);let B=!1;if(y.length>0&&!t.dryRun){let H=$k(d,h,g,y,n.newFileMode,r.writeFile),ge=H.backup?` backup ${H.backup}`:"";if(!H.ok)return u(`failed: ${H.reason}${ge}`),{exit:1,wrote:!1};x+=ge,B=!0}u(x);for(let H of _)c(H);return{exit:S,wrote:B}}finally{f?.()}}function xk(e,t){if(t.dist==="binary")return t.err(`This build is mounted by \`iis mcp\` (iistools#620); to register Grove on its own run \`${pG}\`
85
- `),2;let r=mG(e);if(typeof r==="string")return t.err(`iis-grove-mcp install: ${r}
82
+ Manual form for Claude Code: ${iy}
83
+ `;function fO(e){return{platform:process.platform,env:process.env,execPath:process.execPath,dist:e,homedir:l6(),out:(t)=>process.stdout.write(`${t}
84
+ `),err:(t)=>process.stderr.write(t),now:()=>Date.now(),sleep:(t)=>Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,t),writeFile:rO}}function m6(e){let t={dryRun:!1,force:!1,help:!1,clients:[]};for(let r=0;r<e.length;r++){let n=e[r];if(n==="--dry-run")t.dryRun=!0;else if(n==="--force")t.force=!0;else if(n==="--help"||n==="-h")t.help=!0;else if(n==="--client"||n.startsWith("--client=")){let o=n==="--client"?e[++r]:n.slice(9);if(!Hs.includes(o??""))return`unknown --client ${JSON.stringify(o??"")} (one of: ${Hs.join(", ")})`;if(!t.clients.includes(o))t.clients.push(o)}else return`unexpected argument ${JSON.stringify(n)}`}return t}function dO(e,t,r){return e===null?`${t}.${r}`:`projects[${JSON.stringify(e)}].${t}.${r}`}function oy(e,t,r,n){let o=[],s=iO(e.servers,e.disabled,r),i=(a)=>n?.has(a)?e.project:null;if(s)o.push({kind:"iis",mount:s,where:dO(i(s.key),t,s.key)});for(let[a,c]of Object.entries(e.servers))if(!e.disabled.has(a)&&aO(c))o.push({kind:"key",key:a,where:dO(i(a),t,a)});return o}function h6(e){return e.kind==="iis"?`iis mcp (profile ${e.mount.label})`:e.where}function sy(e,t,r,n,o){let s=r.find((c)=>c.kind==="iis")??r.find((c)=>c.kind==="key"&&c.key==="grove")??r[0],i=r.filter((c)=>c!==s&&c.kind==="key").map((c)=>{let u=c.where.startsWith("projects["),l=e!=="claude-code"?"":u?` (or: cd ${g6(t??"")} && claude mcp remove ${c.key} -s local)`:` (or: claude mcp remove ${c.key} -s user)`;return`delete ${c.where} in ${n}${l}`});if(s.kind==="iis")i.push(`or drop ${ry} from the iis profile in ${o.file}`);let a=t===null?"":` in ${t}`;return`double: ${e}${a} reaches grove twice (${r.map(h6).join(" + ")}); keep one: ${i.join("; ")}`}function g6(e){return`'${e.replace(/'/g,"'\\''")}'`}function pO(e){return`refused: "grove" points elsewhere (${ey(e)})`}function y6(e,t,r,n){let o=_p(e,r.platform,r.env,n.mountCtx.home),s=Xg(o),i=o.serversKey,a=t.dryRun?"[dry-run] ":"",c=(m)=>r.out(`${a}${m}`),u=(m)=>c(`${e} ${s} ${m}`),l={npx:n.npx,envPath:n.envPath,withType:o.withType},d=a6(s,{throwIfNoEntry:!1})?.isSymbolicLink()?u6(s):s,p=null;if(!t.dryRun){if(c6(d6.dirname(s),{recursive:!0}),e==="claude-code"){if(p=uO(d,r),!p)return u("skipped: Claude Code is writing its config, re-run"),{exit:1,wrote:!1}}}try{let m=ty(s);if(!m.ok){let Z=e==="claude-code"?iy:`add "grove": ${f6} under "${i}"`;return u(`skipped: ${m.reason}; by hand: ${Z}`),{exit:1,wrote:!1}}let h=m.doc,g=structuredClone(h.data);if(g[i]!==void 0&&g[i]!==null&&!pt(g[i]))return u(`skipped: "${i}" is not an object`),{exit:1,wrote:!1};let _=[],y=[],S=0,v=(Z,ge)=>{let Ie=Z.grove,Ae=Qk(l,Ie?Yk(Ie):n.fresh,Ie?.env);if(JSON.stringify(Ie)===JSON.stringify(Ae))return"unchanged";if(Z.grove=Ae,y.push(ge),!Ie)return"created";return Sp(Ie)?"repaired joined command":"updated"},w=e==="claude-code"&&pt(g.projects)?g.projects:{},z=[];for(let[Z,ge]of Object.entries(w)){if(!pt(ge))continue;let Ie=pt(ge[i])?ge[i]:{},Ae=new Set(Array.isArray(ge.disabledMcpServers)?ge.disabledMcpServers:[]);z.push({project:Z,servers:Ie,disabled:Ae});let Ue=Ie.grove;if(Ue===void 0)continue;let Pe=`${e} ${s} projects[${JSON.stringify(Z)}]:`;if(!pt(Ue)||!Va(Ue))_.push(`${Pe} ${pO(Ue)}`),S=1;else if(Ha(Ue))_.push(`${Pe} kept: ${Ha(Ue)}`);else{let O=v(Ie,["projects",Z,i,"grove"]);if(O!=="unchanged")_.push(`${Pe} ${O}`)}}let R=pt(g[i])?g[i]:{},b={project:null,servers:R,disabled:new Set},E=oy(b,i,n.mountCtx),x=R.grove,q=E.filter((Z)=>!(Z.kind==="key"&&Z.key==="grove")),C;if(x!==void 0&&(!pt(x)||!Va(x)))C=pO(x),S=1;else if(E.length>=2&&!t.force)C=sy(e,null,E,s,n.mountCtx.settings),S=1;else if(x===void 0&&q.length===1&&!t.force){let Z=q[0];C=Z.kind==="iis"?`skipped: grove already reaches ${e} via iis mcp (profile ${Z.mount.label})`:`kept: grove reaches ${e} via ${JSON.stringify(Z.key)}`}else if(pt(x)&&Ha(x))C=`kept: ${Ha(x)}`;else{if(!pt(g[i]))g[i]=R;C=v(R,[i,"grove"]);let Z=oy(b,i,n.mountCtx);if(Z.length>=2)_.push(sy(e,null,Z,s,n.mountCtx.settings)),S=1}for(let Z of z){let ge={...Z,servers:{...R,...Z.servers}},Ie=oy(ge,i,n.mountCtx,new Set(Object.keys(Z.servers)));if(Ie.length>=2&&Ie.some((Ae)=>Ae.where.startsWith("projects[")))_.push(sy(e,Z.project,Ie,s,n.mountCtx.settings)),S=1}if((ny(R)||z.some((Z)=>ny(Z.servers)))&&!n.mountCtx.settings.readable)_.push(`note: iis settings unreadable (${n.mountCtx.settings.file}), assumed not mounted`);let B=!1;if(y.length>0&&!t.dryRun){let Z=nO(d,h,g,y,o.newFileMode,r.writeFile),ge=Z.backup?` backup ${Z.backup}`:"";if(!Z.ok)return u(`failed: ${Z.reason}${ge}`),{exit:1,wrote:!1};C+=ge,B=!0}u(C);for(let Z of _)c(Z);return{exit:S,wrote:B}}finally{p?.()}}function mO(e,t){if(t.dist==="binary")return t.err(`This build is mounted by \`iis mcp\` (iistools#620); to register Grove on its own run \`${p6}\`
85
+ `),2;let r=m6(e);if(typeof r==="string")return t.err(`iis-grove-mcp install: ${r}
86
86
 
87
- ${Ik}`),2;if(r.help)return t.out(Ik.trimEnd()),0;let o=mk(t.platform,t.env,t.execPath);if(!o)return t.err(`iis-grove-mcp install: npx not found on PATH or beside ${t.execPath}; install Node 20+ and re-run
88
- `),1;let n=lk(t.platform,t.env,t.homedir),s=r.clients.length>0?r.clients:Ms.filter((u)=>dk(ip(u,t.platform,t.env,n)));if(s.length===0)return t.out(`No MCP client found (looked for ${Ms.join(", ")}). Pass --client <name>, or add it by hand: ${Lg}`),1;let i={npx:o,envPath:hk(t.platform,o,t.execPath),fresh:yk(t.env),mountCtx:{home:n,env:t.env,platform:t.platform,settings:wk(n)}},a=0,c=[];for(let u of s){let l;try{l=yG(u,r,t,i)}catch(d){let f=Og(ip(u,t.platform,t.env,n)),{code:m,message:h}=d,g=m&&!h.startsWith(m)?`${m} ${h}`:h;t.out(`${r.dryRun?"[dry-run] ":""}${u} ${f} failed: ${g}`),l={exit:1,wrote:!1}}if(a=Math.max(a,l.exit),l.wrote)c.push(uk[u])}if(c.length>0)t.out(`Restart ${c.join(", ")} to load grove.`);return a}function Nk(e){return{content:[{type:"text",text:JSON.stringify(e===null||e===void 0?{ok:!0}:e,null,2)}]}}function Ak(e,t=!0){if(!t&&e instanceof Ke&&e.statusCode===401)return{content:[{type:"text",text:"Error: access token expired — set a fresh GROVE_TOKEN, or run `grove auth login` to re-authenticate."}],isError:!0};return{content:[{type:"text",text:`Error: ${e instanceof Error?e.message:String(e)}`}],isError:!0}}function Br(e,t){let r={};for(let[o,n]of Object.entries(t)){let s=e[o];if(s!==void 0&&s!==null)r[n]=String(s)}return r}var _G=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function mt(){return p().refine((e)=>_G.test(e),{message:"must be a Grove ID (a UUID)"})}var vG=/^[A-Za-z0-9_-]{1,128}$/;function jk(){return p().refine((e)=>vG.test(e),{message:"must be an Orchard feed ID (letters, digits, - and _)"})}function dt(e){if(e===""||/^\.+$/.test(e))throw Error(`invalid path segment ${JSON.stringify(e)}`);return encodeURIComponent(e)}var qk={name:"grove_news",title:"List articles",description:`List the user's articles ("what's new", "my unread", "what I bookmarked"). Returns an array (title, summary, isRead, sourceName) without the full text and without a total: page with offset. Open one with grove_read.`,inputShape:{source:mt().optional().describe("Source ID (grove_sources)."),group:mt().optional().describe("Group ID (grove_groups)."),isRead:Q().optional().describe("true = read only, false = unread only; omit for both."),engagement:pe(["like","dislike","bookmark","favorite"]).optional().describe("Only articles with this reaction."),topic:p().optional().describe('Topic, e.g. "technology"; comma list = any.'),sort:pe(["newest","oldest"]).optional().describe("Default newest."),limit:J().int().min(1).max(200).optional().describe("Max articles (1-200, default 50)."),offset:J().int().min(0).optional().describe("Articles to skip (paging).")},annotations:{readOnlyHint:!0},handler:async(e,t)=>{let r=Br(t,{source:"sourceId",group:"groupId",engagement:"engagement",topic:"topic",offset:"offset"});if(t.isRead!==void 0)r.isRead=String(t.isRead);return r.sort=t.sort??"newest",r.limit=String(t.limit??50),(await e.get("/api/v1/articles",r)).map(({content:n,...s})=>s)}},Mk={name:"grove_read",title:"Read article",description:'Open one article ("summarize this"): metadata, RSS content and readerContent (extracted text or null); does not mark it read. full:true returns just the body text and marks it read.',inputShape:{id:mt().describe("Article ID."),full:Q().optional().describe("true = body only; marks it read.")},annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0},handler:async(e,t)=>{let r=t.id;if(t.full!==!0)return e.get(`/api/v1/articles/${dt(r)}`);let{rsvp:o,...n}=await e.get(`/api/v1/articles/${dt(r)}/content`);return n}};var Dg=/^[A-Za-z0-9_-]{1,32}$/,Lk="(?:global|[a-z]{2}(?:-[a-z]{2})?)",SG=new RegExp(`^${Lk}(?:,${Lk}){0,19}$`,"i"),bG=["browse","trailing","history","latest"],Dk={name:"grove_charts",title:"Store charts",description:"What is charting in the stores (apps, games, books, podcasts). facets:true -> valid stores (with mediums/subtypes) and regions. Else kind: browse -> charts + top 10 each; trailing -> entries that recently dropped off; latest -> a chart's top 100; history -> its snapshot list (latest/history need sourceId from browse).",inputShape:{kind:pe(bG).optional().describe("What to fetch; omit with facets."),facets:Q().optional().describe("Return { stores, regions }; kind ignored."),store:p().refine((e)=>Dg.test(e),{message:"must be a store name, e.g. apple"}).optional().describe("browse/trailing: store filter."),subtype:p().refine((e)=>Dg.test(e),{message:"must be a subtype name, e.g. top-free"}).optional().describe("browse: subtype filter."),medium:p().refine((e)=>Dg.test(e),{message:"must be a medium name, e.g. app"}).optional().describe("browse/trailing: medium filter."),region:p().refine((e)=>SG.test(e),{message:'must be "global" or ISO codes like us or en-us (comma list for browse)'}).optional().describe("browse/trailing: e.g. us; browse takes a comma list."),sourceId:mt().optional().describe("latest/history: charts[].source.id from browse (not a feed source).")},annotations:{readOnlyHint:!0},handler:async(e,t)=>{if(t.facets===!0){let[o,n]=await Promise.all([e.get("/api/v1/charts/stores"),e.get("/api/v1/charts/regions")]);return{stores:o,regions:n}}let r=t.kind;switch(r){case"browse":return e.get("/api/v1/charts/browse",Br(t,{store:"store",medium:"medium",subtype:"subtype",region:"region"}));case"trailing":if(String(t.region??"").includes(","))throw Error("trailing takes a single region; a comma list is for browse");return e.get("/api/v1/charts/trailing",Br(t,{store:"store",medium:"medium",region:"region"}));case"history":case"latest":{let o=t.sourceId;if(!o)throw Error(`sourceId is required for kind "${r}"`);return e.get(`/api/v1/charts/${dt(o)}/${r==="history"?"snapshots":"latest"}`)}default:throw Error("kind (browse|trailing|history|latest) or facets:true is required")}}};var $G="Kind: blog, newsletter, podcast, website or video_channel; comma list = any. video_channel is hidden from mixed lists unless named here.",wG='Coarse category, e.g. "music" (values: grove_discover_facets; not a topic); comma list = any.',RG='Language, e.g. "en" (also matches en-US); comma list = any. "all" = no filter, the default unless the server sets one for trending/browse.',Ug={sourceKind:"sourceKind",category:"category",language:"language",limit:"limit",cursor:"cursor"},Uk={name:"grove_discover",title:"Discover feeds",description:'Find feeds to follow ("feeds about X"). query -> search; topic or sort -> browse; neither -> trending. Returns data[] (feedUrl, orchardFeedId, alreadySubscribed) + nextCursor (null = no more). Follow with grove_subscribe url.',inputShape:{query:p().optional().describe("Free-text search (3+ chars); selects search."),topic:p().optional().describe('Topic, e.g. "technology"; selects browse unless query is set.'),sort:pe(["popular","active","new"]).optional().describe("Selects browse (new = recently publishing; active = popular); not with query."),sourceKind:p().optional().describe($G),category:p().optional().describe(wG),language:p().optional().describe(RG),limit:J().int().min(1).max(200).optional().describe("Max results (1-200, default 50)."),cursor:p().optional().describe("nextCursor from a prior page.")},annotations:{readOnlyHint:!0},handler:(e,t)=>{let r=t.query;if(r&&t.sort)throw Error("sort is not supported together with query (search has no sort order)");if(r){let o=Br(t,{...Ug,topic:"topic"});return o.q=r,e.get("/api/v1/discover/search",o)}if(t.topic||t.sort)return e.get("/api/v1/discover/browse",Br(t,{...Ug,topic:"topic",sort:"sort"}));return e.get("/api/v1/discover",Br(t,Ug))}},Fk={name:"grove_discover_facets",title:"Discovery filters",description:"Valid category and language values for grove_discover's filters, with live feed counts. Call before filtering. Returns { categories, languages }.",inputShape:{kind:pe(["categories","languages"]).optional().describe("Only this vocabulary; omit for both.")},annotations:{readOnlyHint:!0},handler:async(e,t)=>{let r=t.kind,[o,n]=await Promise.all([r==="languages"?void 0:e.get("/api/v1/discover/categories"),r==="categories"?void 0:e.get("/api/v1/discover/languages")]);return{...o,...n}}},Vk={name:"grove_discover_preview",title:"Preview feed",description:"Preview a catalog feed's latest items (up to 10, live fetch) before following it. Rate-limited per user (20/min).",inputShape:{orchardFeedId:jk().describe("orchardFeedId from grove_discover.")},annotations:{readOnlyHint:!0},handler:(e,t)=>e.get(`/api/v1/discover/${dt(t.orchardFeedId)}/preview`)};var EG=["like","dislike","bookmark","favorite"],zG=[...EG,"read","unread"],Zk=100,Hk={name:"grove_engage",title:"React to articles",description:"Like, dislike, bookmark, favorite, or mark read/unread, for one or more articles. Reactions are the user's taste signal: act only on an explicit request. undo:true reverses it. Returns { applied, failed[] }.",inputShape:{articleIds:N(mt()).min(1).max(Zk).describe(`Article IDs (1-${Zk}).`),action:pe(zG).describe("What to record."),undo:Q().optional().describe("true = reverse it (remove the like, or flip read/unread).")},annotations:{readOnlyHint:!1,destructiveHint:!0,idempotentHint:!0},handler:async(e,t)=>{let{articleIds:r,action:o}=t,n=t.undo===!0,s=o==="read"||o==="unread"?o==="read"!==n?"read":"unread":o;if(s==="read"){let u=await e.post("/api/v1/articles/mark-read",{articleIds:r});return{action:s,applied:u?.marked??r.length}}let i=[],a=0,c;for(let u of r)try{if(s==="unread")await e.patch(`/api/v1/articles/${dt(u)}`,{isRead:!1});else{let l=`/api/v1/articles/${dt(u)}/engagements/${dt(s)}`;if(n)await e.delete(l);else await e.put(l)}a+=1}catch(l){c??=l,i.push({articleId:u,error:l instanceof Error?l.message:String(l)})}if(a===0&&c!==void 0)throw c;return i.length>0?{action:s,applied:a,failed:i}:{action:s,applied:a}}};var Gk={name:"grove_groups",title:"List groups",description:"List the user's groups (folders), or with id one group and its sources.",inputShape:{id:mt().optional().describe("Group ID; omit to list.")},annotations:{readOnlyHint:!0},handler:(e,t)=>{let r=t.id;return e.get(r?`/api/v1/groups/${dt(r)}`:"/api/v1/groups")}},Jk={name:"grove_group_edit",title:"Edit group",description:"Organize groups: create (needs name; returns its id), add_source / remove_source (need groupId and sourceId). add_source: 404 if the user does not follow the source, 409 if already in the group. remove_source leaves the subscription. No rename or delete here.",inputShape:{action:pe(["create","add_source","remove_source"]).describe("create, add_source or remove_source."),name:p().optional().describe("New group name (create)."),groupId:mt().optional().describe("Group ID (add_source, remove_source)."),sourceId:mt().optional().describe("Source ID (add_source, remove_source).")},annotations:{readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1},handler:(e,t)=>{let r=t.action;if(r==="create"){if(!t.name)throw Error("action 'create' needs name");return e.post("/api/v1/groups",{name:t.name})}let{groupId:o,sourceId:n}=t;if(!o||!n)throw Error(`action '${r}' needs groupId and sourceId`);return r==="add_source"?e.post(`/api/v1/groups/${dt(o)}/sources`,{sourceId:n}):e.delete(`/api/v1/groups/${dt(o)}/sources/${dt(n)}`)}};var Kk={name:"grove_opml",title:"Import or export OPML",description:"Bulk-move subscriptions via OPML. import (needs xml) and import_url (needs url) subscribe to every feed in it, so confirm with the user first; both are rate-limited. export returns the user's subscriptions as OPML XML.",inputShape:{action:pe(["import","import_url","export"]).describe("import (inline XML), import_url, or export."),xml:p().optional().describe("OPML document as XML (import)."),url:p().optional().describe("URL of an OPML file (import_url).")},annotations:{readOnlyHint:!1,destructiveHint:!1},handler:(e,t)=>{let r=t.action;if(r==="export")return e.getRaw("/api/v1/opml/export");if(r==="import"){if(!t.xml)throw Error("action 'import' needs xml");return e.post("/api/v1/opml/import",{xml:t.xml})}if(!t.url)throw Error("action 'import_url' needs url");return e.post("/api/v1/opml/import-url",{url:t.url})}};var Bk={name:"grove_overview",title:"Unread overview",description:'Account numbers ("how many unread?"): { counts: unread total/bySource/byGroup (keyed by ID), stats: totals }.',inputShape:{},annotations:{readOnlyHint:!0},handler:async(e)=>{let[t,r]=await Promise.all([e.get("/api/v1/counts"),e.get("/api/v1/stats")]);return{counts:t,stats:r}}};var Wk={name:"grove_sources",title:"List feeds",description:"List the user's subscriptions (id, name, url, status), or with id one source in full. An API-key profile needs an admin API key.",inputShape:{id:mt().optional().describe("Source ID for full detail; omit to list."),group:mt().optional().describe("When listing: only this group ID.")},annotations:{readOnlyHint:!0},handler:(e,t)=>{let r=t.id;return r?e.getSource(r):e.listSources(t.group)}},Yk={name:"grove_subscribe",title:"Follow feed",description:'Follow a feed ("add this feed"). url (feed or site URL, e.g. feedUrl from grove_discover) registers it; intake.fetchStatus "failed" in the result means it did not load. sourceId (instead of url) joins only an Orchard-published source, else 404; prefer url. groupId files it in a group.',inputShape:{url:p().optional().describe("Feed or site URL (this or sourceId)."),orchardFeedId:p().optional().describe("With url: that feed's orchardFeedId from grove_discover."),sourceId:mt().optional().describe("Grove source ID, instead of url (not an orchardFeedId)."),name:p().optional().describe("Display name."),groupId:mt().optional().describe("Group ID to file it in.")},annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0},handler:async(e,t)=>{let{url:r,sourceId:o}=t;if((r?1:0)+(o?1:0)!==1)throw Error("pass exactly one of url or sourceId");let n,s=o;if(r){let a={url:r};if(t.name)a.name=t.name;if(t.orchardFeedId)a.orchardFeedId=t.orchardFeedId;let c=await e.post("/api/v1/sources",a);n=c,s=c?.id}else{let a={sourceId:o};if(t.name)a.displayName=t.name;n=await e.post("/api/v1/sources/subscribe",a)}let i=t.groupId;if(!i)return n;try{if(!s)throw Error("subscribe response carried no source id");return await e.post(`/api/v1/groups/${dt(i)}/sources`,{sourceId:s}),{subscription:n,group:{groupId:i,added:!0}}}catch(a){let c=a instanceof Error?a.message:String(a);return{subscription:n,group:{groupId:i,added:!1,error:c}}}}},Xk={name:"grove_unsubscribe",title:"Unfollow feed",description:"Stop following a feed: deletes the subscription and its group memberships; its articles, bookmarked ones too, leave grove_news. Only on an explicit request.",inputShape:{id:mt().describe("Source ID.")},annotations:{readOnlyHint:!1,destructiveHint:!0},handler:(e,t)=>e.delete(`/api/v1/sources/${dt(t.id)}`)},Qk={name:"grove_refresh",title:"Refresh feeds",description:"Fetch new articles now: one source (sourceId) or all subscriptions. Queues background polls: new articles reach grove_news after a short wait. Once a minute; an excess call is a no-op (recently* true), not an error.",inputShape:{sourceId:mt().optional().describe("Source ID; omit for all subscriptions.")},annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1},handler:(e,t)=>{let r=t.sourceId;return e.post(r?`/api/v1/sources/${dt(r)}/poll`:"/api/v1/sources/refresh")}};var Vg=[qk,Mk,Bk,Wk,Gk,Uk,Fk,Vk,Dk,Hk,Yk,Xk,Qk,Jk],Fg={opml:Kk};function eO(e){let t=[...Vg];for(let r of(e??"").split(",")){let o=r.trim();if(!o)continue;let n=o.startsWith("+")?o.slice(1):"",s=Object.hasOwn(Fg,n)?Fg[n]:void 0;if(!s)throw Error(`GROVE_MCP_TOOLS: unknown entry '${o}' (valid: ${Object.keys(Fg).map((i)=>`+${i}`).join(", ")})`);if(!t.includes(s))t.push(s)}return t}var PG="grove-mcp",TG=Na,IG=3600000,kG=["Grove is the user's personal RSS feed service: their feed subscriptions, the articles polled from them, and their reactions (like, bookmark, read state). Use these tools for anything about their news feeds, reading list or followed sources.","- Read news: grove_news (list), grove_read (open one, text included), grove_overview (unread counts).","- IDs come from earlier results: article ids from grove_news, source ids from grove_sources, group ids from grove_groups. grove_discover gives feedUrl/orchardFeedId, not source ids: follow with grove_subscribe url (sourceId works only for Orchard-published sources).","- React to articles: grove_engage (like/dislike/bookmark/favorite/read/unread, undo:true reverses). Reactions are the user's taste signal: only act on an explicit request.","- Find new feeds: grove_discover (query, topic or sort, else trending), grove_discover_facets for valid category/language values, grove_discover_preview before following.","- Store charts (top apps, games, books, podcasts): grove_charts (read-only; facets:true lists the valid stores and regions).","- Manage feeds: grove_sources, grove_subscribe, grove_unsubscribe, grove_refresh, grove_groups, grove_group_edit. grove_unsubscribe, grove_group_edit and grove_subscribe (and grove_opml import, when present) change what the user has set up, and a subscription puts third-party content into every later grove_news: confirm with the user before calling them unless they asked directly."].join(`
89
- `);function Ma(e){return{content:[{type:"text",text:`Error: ${e}`}],isError:!0}}var oO="If you have the Grove CLI, you can run `grove auth login` instead.";function up(e){return e.mayLogin()?`Call the tool again for a sign-in link. ${oO}`:"Restart the MCP server (or, if you have the Grove CLI, run `grove auth login`), then call the tool again."}function OG(e,t){let r=t?`Sign in to Grove in the browser window that opened, or open ${e} on any device, a phone is fine.`:`Sign in to Grove: open ${e} on any device, a phone is fine.`;return Ma(`${r} Open only a link you just asked for. After signing in, ask again. ${oO}`)}async function CG(e,t){let r=null,o=t.accountId;try{let i=await e.get("/auth/me");r=typeof i?.email==="string"?i.email:null,o??=i?.id}catch{}let n=o?`account ${o}`:"an unknown account",s=r?`${r} (${n})`:n;return t.mode==="relay"?`Signed in to Grove as ${s} through the sign-in link. If this is not your account, stop: remove the sign-in with \`grove auth logout\` if you have the Grove CLI, or by deleting ${ZI()}; the Grove MCP server signs out on its next call (or restart it).`:`Signed in to Grove as ${s}.`}var xG={expired:"Grove sign-in timed out.",aborted:"Grove sign-in was cancelled.",failed:"Grove sign-in failed: the sign-in code could not be exchanged."};function NG(e,t){if(t.mcpReq.envelope)return!1;return Boolean(e.server.getClientCapabilities()?.elicitation?.url)}async function AG(e,t,r){let o=Math.max(1,t.expiresAt-Date.now())+5000,n=e.mcpReq.elicitInput({mode:"url",message:"Sign in to Grove",url:r,elicitationId:t.elicitationId},{timeout:o}).then((s)=>s.action==="accept"?new Promise(()=>{}):"dismissed",()=>"elicit-failed");return Promise.race([t.done,n])}async function tO(e,t,r,o,n){let s,i,a=new Promise((u)=>{s=setTimeout(()=>u("waiting"),r),s.unref()}),c=t.mcpReq._meta?.progressToken;if(c!==void 0){let u=0;i=setInterval(()=>{u+=1,t.mcpReq.notify({method:"notifications/progress",params:{progressToken:c,progress:u,message:"Waiting for you to sign in to Grove"}}).catch(()=>{})},o),i.unref()}try{return await Promise.race(n?[e.done,a,n]:[e.done,a])}finally{clearTimeout(s),clearInterval(i)}}async function jG(e,t,r){let o=t.clientForCall();if(o)return o;if(!t.mayLogin())return Ma(`Grove sign-in required. ${up(t)}`);let n=NG(e,r),s=!n&&t.canOpenBrowser()?"loopback":"relay",i,a;try{let m=t.beginLogin(s);a=m.created,i=await m.pending}catch(m){return rO(t,m)}let c=async()=>{try{return await i.addRelay()}catch(m){return rO(t,m)}},u=async(m)=>{let h=await c();if(h===null)return i.done;return typeof h==="string"?OG(h,m):h},l=null;if(a&&n){i.elicited=!0;let m=await c();if(typeof m!=="string"){if(i.elicited=!1,m!==null)return m;l=await i.done}else{if(l=await AG(r,i,m),l==="signed-in")try{await e.server.createElicitationCompletionNotifier(i.elicitationId)()}catch{}if(l==="dismissed"||l==="elicit-failed")i.elicited=!1}}else if(!a&&i.elicited){if(l=await tO(i,r,t.loginWaitMs,t.progressIntervalMs),l==="waiting"){let m=await u(!1);if(typeof m!=="string")return m;l=m}}if(l===null||l==="dismissed"||l==="elicit-failed"){if(a)t.openBrowser(i);let m=i.browser;if(!m||m.failed){let h=await u(!1);if(typeof h!=="string")return h;l=h}else if(l=await tO(i,r,t.loginWaitMs,t.progressIntervalMs,m.failure),l==="waiting"||l==="open-failed"){let h=await u(l==="waiting");if(typeof h!=="string")return h;l=h}}let d=t.clientForCall();if(d)return d;let f=xG[l==="expired"||l==="aborted"?l:"failed"];return Ma(`${f} ${up(t)}`)}function rO(e,t){let r=t instanceof Error?t.message:String(t);return Ma(`could not start the Grove sign-in (${r}). ${up(e)}`)}function nO(e,t=!0,r=Vg){let o=e instanceof En?e:En.fixed(e,t),n=new ua({name:PG,version:TG},{instructions:kG,cacheHints:{"tools/list":{ttlMs:IG,cacheScope:"public"}}});for(let s of r)n.registerTool(s.name,{title:s.title,description:s.description,annotations:s.annotations,inputSchema:T(s.inputShape)},async(i,a)=>{let c=null,l=await(async()=>{for(let d=0;;d+=1){let f=await jG(n,o,a);if("content"in f)return f;let m=o.takeSignInNotice();if(m)c=await CG(f,m);let h=o.canAutoRefresh;try{let g=await s.handler(f,i);return Nk(g)}catch(g){if(!(g instanceof Ke&&g.statusCode===401&&o.markRevoked(f,d>0)))return Ak(g,h);if(d>0)return Ma(`the Grove session ended (sign-in revoked or expired). ${up(o)}`)}}})();return c?{...l,content:[{type:"text",text:c},...l.content]}:l});return n}var qG=`Usage: iis-grove-mcp [option]
87
+ ${lO}`),2;if(r.help)return t.out(lO.trimEnd()),0;let n=Bk(t.platform,t.env,t.execPath);if(!n)return t.err(`iis-grove-mcp install: npx not found on PATH or beside ${t.execPath}; install Node 20+ and re-run
88
+ `),1;let o=Zk(t.platform,t.env,t.homedir),s=r.clients.length>0?r.clients:Hs.filter((u)=>Gk(_p(u,t.platform,t.env,o)));if(s.length===0)return t.out(`No MCP client found (looked for ${Hs.join(", ")}). Pass --client <name>, or add it by hand: ${iy}`),1;let i={npx:n,envPath:Wk(t.platform,n,t.execPath),fresh:Xk(t.env),mountCtx:{home:o,env:t.env,platform:t.platform,settings:oO(o)}},a=0,c=[];for(let u of s){let l;try{l=y6(u,r,t,i)}catch(d){let p=Xg(_p(u,t.platform,t.env,o)),{code:m,message:h}=d,g=m&&!h.startsWith(m)?`${m} ${h}`:h;t.out(`${r.dryRun?"[dry-run] ":""}${u} ${p} failed: ${g}`),l={exit:1,wrote:!1}}if(a=Math.max(a,l.exit),l.wrote)c.push(Hk[u])}if(c.length>0)t.out(`Restart ${c.join(", ")} to load grove.`);return a}function hO(e,t=2){return{content:[{type:"text",text:JSON.stringify(e===null||e===void 0?{ok:!0}:e,null,t)}]}}function gO(e,t=!0){if(!t&&e instanceof Me&&e.statusCode===401)return{content:[{type:"text",text:"Error: access token expired — set a fresh GROVE_TOKEN, or run `grove auth login` to re-authenticate."}],isError:!0};return{content:[{type:"text",text:Za(e)}],isError:!0}}function Za(e){let t=e instanceof Error?e.message:String(e);if(!(e instanceof Me)||e.statusCode===void 0||e.statusCode===401)return`Error: ${t}`;let r=e.code?`Error ${e.statusCode} ${e.code}`:`Error ${e.statusCode}`;if(typeof e.retryAfterS!=="number")return`${r}: ${t}`;let n=t.replace(/\s*Retry in \d+s\.?$/,"");return`${r}: ${n} Retry after ${e.retryAfterS}s.`}var _6={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" ",hellip:"…",mdash:"—",ndash:"–",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",laquo:"«",raquo:"»",bull:"•",middot:"·",copy:"©",reg:"®",trade:"™",euro:"€",pound:"£",yen:"¥",cent:"¢",deg:"°",times:"×",auml:"ä",ouml:"ö",uuml:"ü",Auml:"Ä",Ouml:"Ö",Uuml:"Ü",szlig:"ß",eacute:"é",egrave:"è",agrave:"à",aacute:"á",ccedil:"ç",ntilde:"ñ"},v6=/&(?:#(\d{1,7})|#[xX]([0-9a-fA-F]{1,6})|([A-Za-z][A-Za-z0-9]{1,9}));/g;function ay(e){return e.replace(v6,(t,r,n,o)=>{if(o!==void 0)return _6[o]??t;let s=r===void 0?Number.parseInt(n??"",16):Number.parseInt(r,10);if(s>1114111||s>=55296&&s<=57343)return"";return String.fromCodePoint(s)})}var yO=/<(script|style)\b/iy,S6={script:/<\/script\s*>/gi,style:/<\/style\s*>/gi};function bO(e,t=()=>" "){let r=[],n=0,o=0,s=!1,i=!1,a=new Set;for(;;){let c=e.indexOf("<",o);if(c===-1)break;let u=-1,l=!1;if(!s&&e.startsWith("<!--",c)){let d=e.indexOf("-->",c+4);if(d===-1)s=!0;else u=d+3}if(u===-1){yO.lastIndex=c;let d=yO.exec(e),p=d?.[1]?.toLowerCase();if(d&&p&&!a.has(p)){let m=S6[p];if(m.lastIndex=c+d[0].length,m.exec(e))u=m.lastIndex;else a.add(p)}}if(u===-1&&!i){let d=e.charAt(c+1)==="/"?c+2:c+1;if(/[A-Za-z!]/.test(e.charAt(d))){let p=e.indexOf(">",d+1);if(p===-1)i=!0;else u=p+1,l=!0}}if(u===-1)o=c+1;else r.push(e.slice(n,c),l?t(e.slice(c,u)):" "),n=o=u}return r.push(e.slice(n)),r.join("")}function it(e){if(!e)return"";let t=bO(e);return ay(t).replace(/\s+/g," ").replace(/[\u0000-\u001f\u007f-\u009f]/g,"").replace(wO,"").replace(/ {2,}/g," ").trim()}function b6(e){let t=e.charCodeAt(e.length-1);return t>=55296&&t<=56319?e.slice(0,-1):e}function Ct(e,t){if(e.length<=t)return e;let r=Math.max(t-1,0),n=b6(e.slice(0,r));if(!/\s/.test(e.charAt(r))){let o=n.search(/\s\S*$/);if(o>0)n=n.slice(0,o)}return`${n.trimEnd()}…`}function Gn(e,t,r=0.6){if(e.length<=t)return e;let n=Math.ceil(t*r),o=-1;for(let s of e.slice(0,t+1).matchAll(/[.!?]["')\]]?/g)){let i=s.index+s[0].length;if(i>t)break;if(i>=n&&(i===e.length||/\s/.test(e.charAt(i))))o=i}return o>0?e.slice(0,o):Ct(e,t)}var $O=/(?:read\s+(?:the\s+)?full\s+(?:article|story)|continue\s+reading|read\s+more|weiterlesen)|(?:\[?(?:…|\.{3})\]?\s*$)/i,$p=String.fromCharCode(57344),bp=String.fromCharCode(57345),_O=String.fromCharCode(57346),vO=String.fromCharCode(57347),wp=String.fromCharCode(57348),wO=new RegExp(`[${$p}-${wp}]`,"g"),SO=`${$p}-${wp}`,$6=new Set(["p","div","h1","h2","h3","h4","h5","h6","blockquote","table","section","article","pre","figure","header","footer"]),w6=new Set(["em","strong","b","i","u","s","del","ins","span","small","sub","sup","mark","code","abbr","cite","q","time","font"]),R6=64,E6=/\bhref\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i,z6=/^https?:\/\/[^\s<>"'\u0000-\u001f\u007f-\u009f]+$/i;function cy(e){if(!e)return"";let t=[],r=bO(e.replace(new RegExp(`[${SO}]`,"g"),""),(d)=>{let p=/^<\/?([A-Za-z][A-Za-z0-9]*)/.exec(d)?.[1]?.toLowerCase(),m=d.startsWith("</");if(p==="a"){if(m)return wp;let h=E6.exec(d),g=ay((h?.[1]??h?.[2]??h?.[3]??"").trim());return t.push(z6.test(g)?g:null),vO}if(p==="br")return $p;if(p==="hr"||p==="ul"||p==="ol")return bp;if(p==="li")return m?"":`${bp}- `;if(p==="tr")return m?bp:" ";if(p!==void 0&&w6.has(p))return"";if(p!==void 0&&$6.has(p))return _O;return" "}),n=[],o=0,s=0,i=(d,p)=>{n.push(d),o+=d.length,s=p},a=(d)=>{if(s<d)i(`
89
+ `.repeat(d-s),d)},c=[],u=0;for(let d of r.split(new RegExp(`([${SO}])`)))if(d===$p)i(`
90
+ `,s+1);else if(d===bp)a(1);else if(d===_O)a(2);else if(d===vO)c.push({href:t[u++]??null,chunk:n.length,length:o});else if(d===wp){let p=c.pop();if(p?.href){let h=o-p.length>p.href.length+R6?null:n.slice(p.chunk).join("").trim();if(h!==""){if(h===null||h!==p.href)i(` (${p.href})`,0)}}}else{let p=ay(d).replace(/\s+/g," ").replace(/[\u0000-\u001f\u007f-\u009f]/g,"").replace(wO,"");if(p!=="")i(p,0)}return n.join("").replace(/[ \t]*\n[ \t]*/g,`
91
+ `).replace(/ {2,}/g," ").replace(/\n{3,}/g,`
92
+
93
+ `).trim()}var ly=150,P6=40,Ga=200,Ja=300,T6=85000,RO=300000;function uy(e){return typeof e==="string"?it(e):""}function EO(e){return typeof e==="string"?e:null}function dy(e){return{id:String(e.id),title:Ct(uy(e.title),ly),sourceName:Ct(uy(e.sourceName),P6),publishedAt:EO(e.publishedAt)}}function zO(e){let t=EO(e.url),{id:r,title:n,sourceName:o,publishedAt:s}=dy(e);return{id:r,title:n,summary:Gn(uy(e.summary),Ja),sourceName:o,publishedAt:s,url:t!==null&&t.length<=Ga?t:null,...typeof e.isRead==="boolean"?{isRead:e.isRead}:{}}}function Oo(e,t,r){let n=Math.min(e,1),o=e;while(n<o){let s=Math.ceil((n+o)/2);if(t(s)<=r)n=s;else o=s-1}return n}function PO(e){let t=e.articles.length,r=(o)=>({...e,articles:e.articles.slice(0,o),count:e.count-(t-o),nextOffset:e.nextOffset-(t-o),hasMore:o<t?!0:e.hasMore}),n=Oo(t,(o)=>JSON.stringify(r(o)).length,T6);return r(n)}var I6=1500,IO=24000,kO=1000,OO=1e5,k6=0.8,py=30,O6=200,Rp="Never fetch an article URL yourself. On blocked or failed, tell the user Grove could not extract it and give them the url. On busy or rate_limited, retry after retryAfterSeconds.";function fy(e){let t=e.readerContent;if(t===null||typeof t!=="object")return null;let r=t.markdown;return typeof r==="string"&&r.trim()!==""?r:null}function TO(e){return typeof e==="string"&&e!==""?e:null}function xO(e,t){if(fy(e)!==null)return"stored";if(t===!1)return"skipped";if(t===!0)return"extract";let r=it(TO(e.content)??TO(e.summary)),n=$O.test(r.slice(-O6));return r.length>=I6&&!n?"not_needed":"extract"}function CO(e){if(!(e instanceof Me))throw e;if(e.statusCode===401)throw e;if(e.code==="client:timeout")return{status:"busy",message:"Extraction is still running in Grove; call grove_read again shortly.",retryAfterSeconds:py};if(e.statusCode===404&&e.code==="feed:error.articleNotFound")throw e;if(e.statusCode===404&&e.code==="feed:error.readerDisabled")return{status:"disabled",message:"Article extraction is switched off on this Grove server; the text is the RSS body. Give the user the url to read the rest."};if(e.statusCode===422)return{status:"blocked",message:`The publisher refused Grove's fetch of this article. ${Rp}`};if(e.statusCode===503){let t=e.retryAfterS??py;return{status:"busy",message:`Extraction is busy; call grove_read again in ${t} s.`,retryAfterSeconds:t}}if(e.statusCode===429){let t=e.retryAfterS??py;return{status:"rate_limited",message:`Too many extractions; call grove_read again in ${t} s.`,retryAfterSeconds:t}}return{status:"failed",message:`${x6(e)} ${Rp}`}}function x6(e){return e.code==="feed:error.readerExtractionFailed"?"Grove could not extract this article.":`Extraction failed: ${e.message}.`}function C6(e){let t=e.charCodeAt(e.length-1);return t>=55296&&t<=56319?e.slice(0,-1):e}function A6(e,t){if(e.length<=t)return{text:e,truncated:!1};let r=C6(e.slice(0,t)),n=Math.ceil(k6*t),o=r.lastIndexOf(`
94
+
95
+ `);if(o>=n)return{text:r.slice(0,o).trimEnd(),truncated:!0};let s=-1;for(let a of r.matchAll(/[.!?]["')\]]?(?=\s)/g))s=a.index+a[0].length;if(s>=n)return{text:r.slice(0,s),truncated:!0};let i=r.search(/\s\S*$/);return{text:(i>0?r.slice(0,i):r).trimEnd(),truncated:!0}}function Gs(e){return typeof e==="string"?e:null}function Ep(e,t,r,n=typeof e.isRead==="boolean"?e.isRead:void 0){let{text:o,truncated:s}=A6(t.text,r);return{id:String(e.id),title:it(Gs(e.title)),url:Gs(e.url),sourceName:it(Gs(e.sourceName)),author:Gs(e.author),publishedAt:Gs(e.publishedAt),...n===void 0?{}:{isRead:n},summary:Gn(it(Gs(e.summary)),Ja),text:o,textSource:t.textSource,textTruncated:s,extraction:t.extraction}}function br(e,t){let r={};for(let[n,o]of Object.entries(t)){let s=e[n];if(s!==void 0&&s!==null)r[o]=String(s)}return r}var N6=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function ht(){return f().refine((e)=>N6.test(e),{message:"must be a Grove ID (a UUID)"})}var j6=/^[A-Za-z0-9_-]{1,128}$/;function AO(){return f().refine((e)=>j6.test(e),{message:"must be an Orchard feed ID (letters, digits, - and _)"})}function at(e){if(e===""||/^\.+$/.test(e))throw Error(`invalid path segment ${JSON.stringify(e)}`);return encodeURIComponent(e)}function my(e){let t=Date.parse(e.get("date")??"");return new Date(Number.isNaN(t)?Date.now():t).toISOString()}var zp=()=>f().refine((e)=>!Number.isNaN(Date.parse(e)),{message:"must be an ISO 8601 date or datetime"}),NO={name:"grove_news",title:"List articles",description:`List the user's articles ("what's new", "my unread", "what I bookmarked"). Returns {asOf, count, hasMore, nextOffset, articles}; each article has id, title, summary (plain text, cut at 300 chars), sourceName, publishedAt, url (null when over 200 chars), isRead; no full text: open one with grove_read. since = published after a date; newSince = pass a previous asOf to get what arrived since; next page: offset = nextOffset. query = one whole-word phrase in title or summary (plural and hyphen forms match); several terms: use any/all/none, not repeated calls. compact:true = id, title, sourceName, publishedAt only, to scan.`,inputShape:{source:ht().optional().describe("Source ID (grove_sources)."),group:ht().optional().describe("Group ID (grove_groups)."),isRead:Q().optional().describe("true = read only, false = unread only; omit for both."),engagement:le(["like","dislike","bookmark","favorite"]).optional().describe("Only articles with this reaction."),topic:f().optional().describe('Topic, e.g. "technology"; comma list = any.'),query:f().trim().min(1).max(100).optional().describe("One whole-word phrase in title or summary, case-insensitive."),any:f().optional().describe("Comma list: at least one term."),all:f().optional().describe("Comma list: every term."),none:f().optional().describe("Comma list: no term."),in:f().optional().describe("Fields for any/all/none: title,summary,author,category (default title,summary)."),since:zp().optional().describe("Only articles published after this ISO date or datetime."),newSince:zp().optional().describe("A previous asOf: articles Grove received since then (5 min overlap; dedupe by id)."),hidden:le(["exclude","include","only"]).optional().describe("Omit: hidden feeds stay out unless source, group, engagement, topic, query or any/all/none is set. only = just those."),compact:Q().optional().describe("true = id, title, sourceName, publishedAt only."),sort:le(["newest","oldest"]).optional().describe("Default newest."),limit:G().int().min(1).max(100).optional().describe("Max articles (1-100, default 50)."),offset:G().int().min(0).optional().describe("Articles to skip (paging): the previous nextOffset.")},annotations:{readOnlyHint:!0},serialize:"compact",handler:async(e,t)=>{let r=t.limit??50,n=t.offset??0,o=br(t,{source:"sourceId",group:"groupId",engagement:"engagement",topic:"topic",query:"q",any:"any",all:"all",none:"none",in:"in",since:"publishedAfter",hidden:"hidden",offset:"offset"});if(t.isRead!==void 0)o.isRead=String(t.isRead);let s=t.newSince;if(s!==void 0){let d=Date.parse(s);if(Number.isNaN(d))throw Error("newSince must be an ISO date or datetime (a previous asOf)");o.fetchedAfter=new Date(d-RO).toISOString()}o.sort=t.sort??"newest",o.limit=String(r+1);let{data:i,headers:a}=await e.getWithHeaders("/api/v1/articles",o),c=Array.isArray(i)?i:[],u=c.slice(0,r),l=t.compact===!0?u.map(dy):u.map(zO);return PO({asOf:my(a),count:l.length,hasMore:c.length>r,nextOffset:n+l.length,articles:l})}},jO={name:"grove_read",title:"Read article",description:'Open one article ("read this", "summarize it"): returns text (stored reader text, else extracted through Grove, else the RSS body as text) with textSource and extraction.status. extract: omit = auto (extracts unless the feed already carries the full text), true = always when none is stored, false = never. maxChars (default 24000) truncates, textTruncated says so. Marks nothing read unless markRead:true.',inputShape:{id:ht().describe("Article ID."),extract:Q().optional().describe("Omit = auto; true = extract whenever no text is stored; false = never extract."),maxChars:G().int().min(kO).max(OO).optional().describe("Cut the text at about this many characters (1000-100000, default 24000)."),markRead:Q().optional().describe("true = also mark the article read."),full:Q().optional().describe("Deprecated alias of markRead.")},annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0},handler:async(e,t)=>{let{id:r,extract:n}=t,o=t.maxChars??IO,s=t.markRead===!0||t.full===!0,i=await e.get(`/api/v1/articles/${at(r)}`),a;switch(xO(i,n)){case"stored":a={text:fy(i),textSource:"reader",extraction:{status:"stored"}};break;case"skipped":a={...Pp(i),extraction:{status:"skipped"}};break;case"not_needed":a={...Pp(i),extraction:{status:"not_needed"}};break;case"extract":a=await M6(e,r,i);break}if(!s)return Ep(i,a,o);if(e.usesApiKey)return{...Ep(i,a,o),message:q6};let c=await e.patch(`/api/v1/articles/${at(r)}`,{isRead:!0});return Ep(i,a,o,typeof c?.isRead==="boolean"?c.isRead:!0)}},q6="markRead needs a user token";function Pp(e){let t=e.content;if(typeof t==="string"&&t!=="")return{text:cy(t),textSource:"rss"};return{text:cy(e.summary),textSource:"summary"}}async function M6(e,t,r){try{let n=await e.post(`/api/v1/articles/${at(t)}/extract`,void 0,{timeoutMs:r$});if(typeof n?.markdown==="string"&&n.markdown.trim()!=="")return{text:n.markdown,textSource:"reader",extraction:{status:"extracted"}};return{...Pp(r),extraction:{status:"failed",message:`Grove could not extract this article. ${Rp}`}}}catch(n){let o=CO(n);return{...Pp(r),extraction:o}}}var hy=/^[A-Za-z0-9_-]{1,32}$/,qO="(?:global|[a-z]{2}(?:-[a-z]{2})?)",L6=new RegExp(`^${qO}(?:,${qO}){0,19}$`,"i"),D6=["browse","trailing","history","latest"],U6=100,F6=60,V6=40000;function Jn(e){return typeof e==="string"?e:null}function Tp(e){return e!==null&&typeof e==="object"?e:{}}function H6(e){let t=Ct(it(Jn(e.artistOrAuthor)),F6),r=Jn(e.storeUrl);return{rank:typeof e.rank==="number"?e.rank:0,title:Ct(it(Jn(e.title)),U6),artist:t===""?null:t,url:r!==null&&r.length<=Ga?r:null}}function MO(e){return Array.isArray(e)?e.map((t)=>H6(Tp(t))):[]}function Z6(e){let t=Tp(e.source);return{sourceId:String(t.id),store:String(t.store),medium:String(t.medium),subtype:Jn(t.subtype),region:String(t.region),fetchedAt:Jn(Tp(e.snapshot).fetchedAt),top:MO(e.preview)}}function G6(e,t){let r=(Array.isArray(e.charts)?e.charts:[]).map(Z6),n=r.slice(t),o=Jn(e.attribution),s=(i)=>({count:i,total:r.length,hasMore:t+i<r.length,nextOffset:t+i,charts:n.slice(0,i),...o!==null?{attribution:o}:{}});return s(Oo(n.length,(i)=>JSON.stringify(s(i)).length,V6))}function J6(e){let t=Jn(e.attribution);return{fetchedAt:Jn(Tp(e.snapshot).fetchedAt),entries:MO(e.entries),...t!==null?{attribution:t}:{}}}var LO={name:"grove_charts",title:"Store charts",description:"What is charting in the stores (apps, games, books, podcasts). facets:true -> valid stores (with mediums/subtypes) and regions. Else kind: browse -> {count, total, hasMore, nextOffset, charts[]}: sourceId, store, medium, subtype, region, fetchedAt, top (10 of rank, title, artist, url), at most 40,000 characters, next page: offset = nextOffset, or narrow with store/medium/subtype/region; trailing -> entries that recently dropped off; latest -> a chart's {fetchedAt, entries[]} (top 100: rank, title, artist, url); history -> its snapshot list (latest/history need a sourceId from browse).",inputShape:{kind:le(D6).optional().describe("What to fetch; omit with facets."),facets:Q().optional().describe("Return { stores, regions }; kind ignored."),store:f().refine((e)=>hy.test(e),{message:"must be a store name, e.g. apple"}).optional().describe("browse/trailing: store filter."),subtype:f().refine((e)=>hy.test(e),{message:"must be a subtype name, e.g. top-free"}).optional().describe("browse: subtype filter."),medium:f().refine((e)=>hy.test(e),{message:"must be a medium name, e.g. app"}).optional().describe("browse/trailing: medium filter."),region:f().refine((e)=>L6.test(e),{message:'must be "global" or ISO codes like us or en-us (comma list for browse)'}).optional().describe("browse/trailing: e.g. us; browse takes a comma list."),sourceId:ht().optional().describe("latest/history: charts[].sourceId from browse (not a feed source)."),offset:G().int().min(0).optional().describe("browse: charts to skip (paging): the previous nextOffset.")},annotations:{readOnlyHint:!0},serialize:"compact",handler:async(e,t)=>{if(t.facets===!0){let[n,o]=await Promise.all([e.get("/api/v1/charts/stores"),e.get("/api/v1/charts/regions")]);return{stores:n,regions:o}}let r=t.kind;switch(r){case"browse":return G6(await e.get("/api/v1/charts/browse",br(t,{store:"store",medium:"medium",subtype:"subtype",region:"region"})),t.offset??0);case"trailing":if(String(t.region??"").includes(","))throw Error("trailing takes a single region; a comma list is for browse");return e.get("/api/v1/charts/trailing",br(t,{store:"store",medium:"medium",region:"region"}));case"history":case"latest":{let n=t.sourceId;if(!n)throw Error(`sourceId is required for kind "${r}"`);if(r==="history")return e.get(`/api/v1/charts/${at(n)}/snapshots`);return J6(await e.get(`/api/v1/charts/${at(n)}/latest`))}default:throw Error("kind (browse|trailing|history|latest) or facets:true is required")}}};var K6=100,UO=200,B6=30,W6=5,Y6=3,X6=100,Q6=85000;function dr(e){return typeof e==="string"?e:null}function DO(e,t){if(!Array.isArray(e))return[];return e.filter((r)=>typeof r==="string").map((r)=>Ct(it(r),B6)).filter((r)=>r!=="").slice(0,t)}function eJ(e){let t=Gn(it(dr(e.description)),UO);return{orchardFeedId:String(e.orchardFeedId),feedUrl:String(e.feedUrl),title:Ct(it(dr(e.title)),K6),description:t===""?null:t,sourceKind:dr(e.sourceKind),topics:DO(e.topics,W6),categories:DO(e.categories,Y6),language:dr(e.language),alreadySubscribed:e.alreadySubscribed===!0,lastPublishedAt:dr(e.lastPublishedAt)}}function gy(e){let t=(Array.isArray(e.data)?e.data:[]).map(eJ),r=(n)=>({data:t.slice(0,n),nextCursor:dr(e.nextCursor),...typeof e.total==="number"?{total:e.total}:{},...e.stale===!0?{stale:!0}:{},...typeof e.freshWindowDays==="number"?{freshWindowDays:e.freshWindowDays}:{},...typeof e.recencyWindowDays==="number"?{recencyWindowDays:e.recencyWindowDays}:{},...n<t.length?{omitted:t.length-n}:{}});return r(Oo(t.length,(n)=>JSON.stringify(r(n)).length,Q6))}function tJ(e){let t=Array.isArray(e.items)?e.items:[],r=Gn(it(dr(e.description)),UO);return{description:r===""?null:r,lastPublishedAt:dr(e.lastPublishedAt),itemCount:typeof e.itemCount==="number"?e.itemCount:t.length,items:t.map((n)=>{let o=dr(n.url),s=Gn(it(dr(n.summary)),Ja);return{title:Ct(it(dr(n.title)),ly),url:o!==null&&o.length<=Ga?o:null,publishedAt:dr(n.publishedAt),summary:s===""?null:s}})}}var rJ="Kind: blog, newsletter, podcast, website or video_channel; comma list = any. video_channel is hidden from mixed lists unless named here.",nJ='Coarse category, e.g. "music" (values: grove_discover_facets; not a topic); comma list = any.',oJ='Language, e.g. "en" (also matches en-US); comma list = any. "all" = no filter, the default unless the server sets one for trending/browse.',yy={sourceKind:"sourceKind",category:"category",language:"language",limit:"limit",cursor:"cursor"},FO={name:"grove_discover",title:"Discover feeds",description:'Find feeds to follow ("feeds about X"). query -> search; topic or sort -> browse; neither -> trending. Returns data[] + nextCursor (null = no more); each feed has orchardFeedId, feedUrl, title, description (plain text, 200 characters), sourceKind, topics, categories, language, alreadySubscribed, lastPublishedAt. At most 100 per page, 85,000 characters (omitted = rows cut for size). Follow with grove_subscribe url.',inputShape:{query:f().optional().describe("Free-text search (3+ chars); selects search."),topic:f().optional().describe('Topic, e.g. "technology"; selects browse unless query is set.'),sort:le(["popular","active","new"]).optional().describe("Selects browse (new = recently publishing; active = popular); not with query."),sourceKind:f().optional().describe(rJ),category:f().optional().describe(nJ),language:f().optional().describe(oJ),limit:G().int().min(1).max(X6).optional().describe("Max results (1-100, default 50)."),cursor:f().optional().describe("nextCursor from a prior page.")},annotations:{readOnlyHint:!0},serialize:"compact",handler:(e,t)=>{let r=t.query;if(r&&t.sort)throw Error("sort is not supported together with query (search has no sort order)");if(r){let n=br(t,{...yy,topic:"topic"});return n.q=r,e.get("/api/v1/discover/search",n).then(gy)}if(t.topic||t.sort)return e.get("/api/v1/discover/browse",br(t,{...yy,topic:"topic",sort:"sort"})).then(gy);return e.get("/api/v1/discover",br(t,yy)).then(gy)}},VO={name:"grove_discover_facets",title:"Discovery filters",description:"Valid category and language values for grove_discover's filters, with live feed counts. Call before filtering. Returns { categories, languages }.",inputShape:{kind:le(["categories","languages"]).optional().describe("Only this vocabulary; omit for both.")},annotations:{readOnlyHint:!0},handler:async(e,t)=>{let r=t.kind,[n,o]=await Promise.all([r==="languages"?void 0:e.get("/api/v1/discover/categories"),r==="categories"?void 0:e.get("/api/v1/discover/languages")]);return{...n,...o}}},HO={name:"grove_discover_preview",title:"Preview feed",description:"Preview a catalog feed's latest items (up to 10, live fetch) before following it. Returns description, lastPublishedAt, itemCount, items[] (title, url, publishedAt, summary: plain text, 300 characters). Rate-limited per user (20/min).",inputShape:{orchardFeedId:AO().describe("orchardFeedId from grove_discover.")},annotations:{readOnlyHint:!0},serialize:"compact",handler:async(e,t)=>tJ(await e.get(`/api/v1/discover/${at(t.orchardFeedId)}/preview`))};var sJ=["like","dislike","bookmark","favorite"],iJ=[...sJ,"read","unread"],ZO=100,GO={name:"grove_engage",title:"React to articles",description:"Like, dislike, bookmark, favorite, or mark read/unread, for one or more articles. Reactions are the user's taste signal: act only on an explicit request. undo:true reverses it. Returns { applied, failed[] }.",inputShape:{articleIds:A(ht()).min(1).max(ZO).describe(`Article IDs (1-${ZO}).`),action:le(iJ).describe("What to record."),undo:Q().optional().describe("true = reverse it (remove the like, or flip read/unread).")},annotations:{readOnlyHint:!1,destructiveHint:!0,idempotentHint:!0},handler:async(e,t)=>{let{articleIds:r,action:n}=t,o=t.undo===!0,s=n==="read"||n==="unread"?n==="read"!==o?"read":"unread":n;if(s==="read"){let u=await e.post("/api/v1/articles/mark-read",{articleIds:r});return{action:s,applied:u?.marked??r.length}}let i=[],a=0,c;for(let u of r)try{if(s==="unread")await e.patch(`/api/v1/articles/${at(u)}`,{isRead:!1});else{let l=`/api/v1/articles/${at(u)}/engagements/${at(s)}`;if(o)await e.delete(l);else await e.put(l)}a+=1}catch(l){c??=l,i.push({articleId:u,error:Za(l)})}if(a===0&&c!==void 0)throw c;return i.length>0?{action:s,applied:a,failed:i}:{action:s,applied:a}}};var JO={name:"grove_groups",title:"List groups",description:"List the user's groups (folders), or with id one group and its sources.",inputShape:{id:ht().optional().describe("Group ID; omit to list.")},annotations:{readOnlyHint:!0},handler:(e,t)=>{let r=t.id;return e.get(r?`/api/v1/groups/${at(r)}`:"/api/v1/groups")}},KO={name:"grove_group_edit",title:"Edit group",description:"Organize groups: create (needs name; returns its id), add_source / remove_source (need groupId and sourceId). add_source: 404 if the user does not follow the source, 409 if already in the group. remove_source leaves the subscription. No rename or delete here.",inputShape:{action:le(["create","add_source","remove_source"]).describe("create, add_source or remove_source."),name:f().optional().describe("New group name (create)."),groupId:ht().optional().describe("Group ID (add_source, remove_source)."),sourceId:ht().optional().describe("Source ID (add_source, remove_source).")},annotations:{readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1},handler:(e,t)=>{let r=t.action;if(r==="create"){if(!t.name)throw Error("action 'create' needs name");return e.post("/api/v1/groups",{name:t.name})}let{groupId:n,sourceId:o}=t;if(!n||!o)throw Error(`action '${r}' needs groupId and sourceId`);return r==="add_source"?e.post(`/api/v1/groups/${at(n)}/sources`,{sourceId:o}):e.delete(`/api/v1/groups/${at(n)}/sources/${at(o)}`)}};var BO={name:"grove_opml",title:"Import or export OPML",description:"Bulk-move subscriptions via OPML. import (needs xml) and import_url (needs url) subscribe to every feed in it, so confirm with the user first; both are rate-limited. export returns the user's subscriptions as OPML XML.",inputShape:{action:le(["import","import_url","export"]).describe("import (inline XML), import_url, or export."),xml:f().optional().describe("OPML document as XML (import)."),url:f().optional().describe("URL of an OPML file (import_url).")},annotations:{readOnlyHint:!1,destructiveHint:!1},handler:(e,t)=>{let r=t.action;if(r==="export")return e.getRaw("/api/v1/opml/export");if(r==="import"){if(!t.xml)throw Error("action 'import' needs xml");return e.post("/api/v1/opml/import",{xml:t.xml})}if(!t.url)throw Error("action 'import_url' needs url");return e.post("/api/v1/opml/import-url",{url:t.url})}};var _y=60,aJ=120,cJ=85000,uJ=["ok","broken","dead","blocked"];function Ka(e){return typeof e==="string"?e:null}function lJ(e){if(e.status==="dead")return"dead";if(e.blockReason!==null&&e.blockReason!==void 0)return"blocked";return e.status==="broken"?"broken":"ok"}function dJ(e){let t=lJ(e),r=Ct(it(Ka(e.lastError)),aJ);return{id:String(e.id),name:Ct(it(Ka(e.name)),_y),url:Ka(e.url),siteUrl:Ka(e.siteUrl),status:t,...t!=="ok"&&r!==""?{lastError:r}:{},lastSuccessAt:Ka(e.lastSuccessAt),articleCount:typeof e.articleCount==="number"?e.articleCount:0}}var WO={name:"grove_sources",title:"List feeds",description:`List the user's subscriptions ("my feeds", "which feeds are broken?"), or with id one source in full. Returns {count, total, hasMore, nextOffset, sources}; each source has id, name, url, siteUrl, status (ok | broken | dead | blocked), lastError (not when ok), lastSuccessAt, articleCount; a page is at most 85,000 characters. Next page: offset = nextOffset. An API-key profile needs an admin API key.`,inputShape:{id:ht().optional().describe("Source ID for full detail; omit to list."),group:ht().optional().describe("When listing: only this group ID."),status:le(uJ).optional().describe("When listing: only this status; broken = failing, blocked = refused by the site."),offset:G().int().min(0).optional().describe("When listing: feeds to skip (paging): the previous nextOffset.")},annotations:{readOnlyHint:!0},serialize:"compact",handler:async(e,t)=>{let r=t.id;if(r)return e.getSource(r);let n=await e.listSources(t.group),o=t.status,s=t.offset??0,i=(Array.isArray(n)?n:[]).map(dJ).filter((u)=>o===void 0||u.status===o),a=i.slice(s),c=(u)=>({count:u,total:i.length,hasMore:s+u<i.length,nextOffset:s+u,sources:a.slice(0,u)});return c(Oo(a.length,(u)=>JSON.stringify(c(u)).length,cJ))}};function pJ(e){if(e===null||typeof e!=="object")return;let t=e,r=(o)=>typeof o==="string"?o.split(",").map((s)=>s.trim()).filter((s)=>s!==""):[],n={};for(let o of["any","all","none"]){let s=r(t[o]);if(s.length>0)n[o]=s}return Object.keys(n).length>0?n:void 0}var YO={name:"grove_subscribe",title:"Follow feed",description:'Follow a feed ("add this feed"). url (feed or site URL, e.g. feedUrl from grove_discover) registers it; intake.fetchStatus "failed" in the result means it did not load. sourceId (instead of url) joins only an Orchard-published source, else 404; prefer url. groupId files it in a group.',inputShape:{url:f().optional().describe("Feed or site URL (this or sourceId)."),orchardFeedId:f().optional().describe("With url: that feed's orchardFeedId from grove_discover."),sourceId:ht().optional().describe("Grove source ID, instead of url (not an orchardFeedId)."),name:f().optional().describe("Display name."),groupId:ht().optional().describe("Group ID to file it in."),hiddenFromAll:Q().optional().describe("true = out of All articles, unread count, digest; still readable by source. New subscriptions only."),filter:T({any:f().optional().describe("Comma list: at least one."),all:f().optional().describe("Comma list: every one."),none:f().optional().describe("Comma list: none.")}).optional().describe("Filter for a NEW subscription: other articles vanish from news, counts, push. Words, phrases, prefix*; no symbols.")},annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0},handler:async(e,t)=>{let{url:r,sourceId:n}=t;if((r?1:0)+(n?1:0)!==1)throw Error("pass exactly one of url or sourceId");let o,s=n,i=t.hiddenFromAll===!0,a=pJ(t.filter);if(r){let u={url:r};if(i)u.hiddenFromAll=!0;if(a)u.filter=a;if(t.name)u.name=t.name;if(t.orchardFeedId)u.orchardFeedId=t.orchardFeedId;let l=await e.post("/api/v1/sources",u);o=l,s=l?.id}else{let u={sourceId:n};if(i)u.hiddenFromAll=!0;if(a)u.filter=a;if(t.name)u.displayName=t.name;o=await e.post("/api/v1/sources/subscribe",u)}let c=t.groupId;if(!c)return o;try{if(!s)throw Error("subscribe response carried no source id");return await e.post(`/api/v1/groups/${at(c)}/sources`,{sourceId:s}),{subscription:o,group:{groupId:c,added:!0}}}catch(u){let l=Za(u);return{subscription:o,group:{groupId:c,added:!1,error:l}}}}},XO={name:"grove_unsubscribe",title:"Unfollow feed",description:"Stop following a feed: deletes the subscription and its group memberships; its articles, bookmarked ones too, leave grove_news. Only on an explicit request.",inputShape:{id:ht().describe("Source ID.")},annotations:{readOnlyHint:!1,destructiveHint:!0},handler:(e,t)=>e.delete(`/api/v1/sources/${at(t.id)}`)},QO={name:"grove_refresh",title:"Refresh feeds",description:"Fetch new articles now: one source (sourceId) or all subscriptions. Queues background polls: new articles reach grove_news after a short wait. Once a minute; an excess call is a no-op (recently* true), not an error.",inputShape:{sourceId:ht().optional().describe("Source ID; omit for all subscriptions.")},annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1},handler:(e,t)=>{let r=t.sourceId;return e.post(r?`/api/v1/sources/${at(r)}/poll`:"/api/v1/sources/refresh")}};var fJ=50;function ex(e){let t=new Map;if(!Array.isArray(e))return t;for(let r of e)if(typeof r.id==="string"&&typeof r.name==="string")t.set(r.id,Ct(it(r.name),_y));return t}function tx(e,t){return Object.entries(e??{}).map(([n,o])=>({id:n,name:t.get(n)??null,unread:o})).sort((n,o)=>o.unread-n.unread)}var rx={name:"grove_overview",title:"Unread overview",description:'Unread counts ("how many unread, per feed, since <date>?"). Returns {asOf, since, unread: {total, sourcesWithUnread, bySource, byGroup}, stats}; bySource and byGroup rows are {id, name, unread}, most unread first, bySource at most 50 (sourcesWithUnread = all feeds with unread). since = count only articles published after a date (stats is not bounded by it). total leaves out hidden feeds; the rows include them.',inputShape:{since:zp().optional().describe("Count only articles published after this ISO date or datetime.")},annotations:{readOnlyHint:!0},serialize:"compact",handler:async(e,t)=>{let r=t.since,n=br(t,{since:"publishedAfter"}),[o,s,i,a]=await Promise.all([e.getWithHeaders("/api/v1/counts",n),e.listSources().catch(()=>[]),e.get("/api/v1/groups").catch(()=>[]),e.get("/api/v1/stats")]),c=ex(s),u=ex(i);return{asOf:my(o.headers),since:r??null,unread:{total:o.data.total??0,sourcesWithUnread:Object.keys(o.data.bySource??{}).length,bySource:tx(o.data.bySource,c).slice(0,fJ),byGroup:tx(o.data.byGroup,u)},stats:a}}};var Sy=[NO,jO,rx,WO,JO,FO,VO,HO,LO,GO,YO,XO,QO,KO],vy={opml:BO};function nx(e){let t=[...Sy];for(let r of(e??"").split(",")){let n=r.trim();if(!n)continue;let o=n.startsWith("+")?n.slice(1):"",s=Object.hasOwn(vy,o)?vy[o]:void 0;if(!s)throw Error(`GROVE_MCP_TOOLS: unknown entry '${n}' (valid: ${Object.keys(vy).map((i)=>`+${i}`).join(", ")})`);if(!t.includes(s))t.push(s)}return t}var mJ="grove-mcp",hJ=Ua,gJ=3600000,yJ=["Grove is the user's personal RSS feed service: their feed subscriptions, the articles polled from them, and their reactions (like, bookmark, read state). Use these tools for anything about their news feeds, reading list or followed sources.","- Read news: grove_news (list; since = published after, newSince = a previous asOf, query, compact:true to scan), grove_read (open one: returns the article text, extracting it through Grove when none is stored), grove_overview (unread counts). Never fetch an article URL yourself. On blocked or failed, tell the user Grove could not extract it and give them the url. On busy or rate_limited, retry after retryAfterSeconds. Mark nothing read unless the user asks (markRead:true).","- IDs come from earlier results: article ids from grove_news, source ids from grove_sources, group ids from grove_groups, chart source ids from grove_charts browse (not feed sources). grove_discover gives feedUrl/orchardFeedId, not source ids: follow with grove_subscribe url (sourceId works only for Orchard-published sources).","- React to articles: grove_engage (like/dislike/bookmark/favorite/read/unread, undo:true reverses). Reactions are the user's taste signal: only act on an explicit request.","- Find new feeds: grove_discover (query, topic or sort, else trending), grove_discover_facets for valid category/language values, grove_discover_preview before following.","- Store charts (top apps, games, books, podcasts): grove_charts (read-only; facets:true lists the valid stores and regions).","- Manage feeds: grove_sources, grove_subscribe, grove_unsubscribe, grove_refresh, grove_groups, grove_group_edit. grove_unsubscribe, grove_group_edit and grove_subscribe (and grove_opml import, when present) change what the user has set up, and a subscription puts third-party content into every later grove_news: confirm with the user before calling them unless they asked directly."].join(`
96
+ `);function Ba(e){return{content:[{type:"text",text:`Error: ${e}`}],isError:!0}}var ix="If you have the Grove CLI, you can run `grove auth login` instead.";function Ip(e){return e.mayLogin()?`Call the tool again for a sign-in link. ${ix}`:"Restart the MCP server (or, if you have the Grove CLI, run `grove auth login`), then call the tool again."}function _J(e,t){let r=t?`Sign in to Grove in the browser window that opened, or open ${e} on any device, a phone is fine.`:`Sign in to Grove: open ${e} on any device, a phone is fine.`;return Ba(`${r} Open only a link you just asked for. After signing in, ask again. ${ix}`)}async function vJ(e,t){let r=null,n=t.accountId;try{let i=await e.get("/auth/me");r=typeof i?.email==="string"?i.email:null,n??=i?.id}catch{}let o=n?`account ${n}`:"an unknown account",s=r?`${r} (${o})`:o;return t.mode==="relay"?`Signed in to Grove as ${s} through the sign-in link. If this is not your account, stop: remove the sign-in with \`grove auth logout\` if you have the Grove CLI, or by deleting ${Ek()}; the Grove MCP server signs out on its next call (or restart it).`:`Signed in to Grove as ${s}.`}var SJ={expired:"Grove sign-in timed out.",aborted:"Grove sign-in was cancelled.",failed:"Grove sign-in failed: the sign-in code could not be exchanged."};function bJ(e,t){if(t.mcpReq.envelope)return!1;return Boolean(e.server.getClientCapabilities()?.elicitation?.url)}async function $J(e,t,r){let n=Math.max(1,t.expiresAt-Date.now())+5000,o=e.mcpReq.elicitInput({mode:"url",message:"Sign in to Grove",url:r,elicitationId:t.elicitationId},{timeout:n}).then((s)=>s.action==="accept"?new Promise(()=>{}):"dismissed",()=>"elicit-failed");return Promise.race([t.done,o])}async function ox(e,t,r,n,o){let s,i,a=new Promise((u)=>{s=setTimeout(()=>u("waiting"),r),s.unref()}),c=t.mcpReq._meta?.progressToken;if(c!==void 0){let u=0;i=setInterval(()=>{u+=1,t.mcpReq.notify({method:"notifications/progress",params:{progressToken:c,progress:u,message:"Waiting for you to sign in to Grove"}}).catch(()=>{})},n),i.unref()}try{return await Promise.race(o?[e.done,a,o]:[e.done,a])}finally{clearTimeout(s),clearInterval(i)}}async function wJ(e,t,r){let n=t.clientForCall();if(n)return n;if(!t.mayLogin())return Ba(`Grove sign-in required. ${Ip(t)}`);let o=bJ(e,r),s=!o&&t.canOpenBrowser()?"loopback":"relay",i,a;try{let m=t.beginLogin(s);a=m.created,i=await m.pending}catch(m){return sx(t,m)}let c=async()=>{try{return await i.addRelay()}catch(m){return sx(t,m)}},u=async(m)=>{let h=await c();if(h===null)return i.done;return typeof h==="string"?_J(h,m):h},l=null;if(a&&o){i.elicited=!0;let m=await c();if(typeof m!=="string"){if(i.elicited=!1,m!==null)return m;l=await i.done}else{if(l=await $J(r,i,m),l==="signed-in")try{await e.server.createElicitationCompletionNotifier(i.elicitationId)()}catch{}if(l==="dismissed"||l==="elicit-failed")i.elicited=!1}}else if(!a&&i.elicited){if(l=await ox(i,r,t.loginWaitMs,t.progressIntervalMs),l==="waiting"){let m=await u(!1);if(typeof m!=="string")return m;l=m}}if(l===null||l==="dismissed"||l==="elicit-failed"){if(a)t.openBrowser(i);let m=i.browser;if(!m||m.failed){let h=await u(!1);if(typeof h!=="string")return h;l=h}else if(l=await ox(i,r,t.loginWaitMs,t.progressIntervalMs,m.failure),l==="waiting"||l==="open-failed"){let h=await u(l==="waiting");if(typeof h!=="string")return h;l=h}}let d=t.clientForCall();if(d)return d;let p=SJ[l==="expired"||l==="aborted"?l:"failed"];return Ba(`${p} ${Ip(t)}`)}function sx(e,t){let r=t instanceof Error?t.message:String(t);return Ba(`could not start the Grove sign-in (${r}). ${Ip(e)}`)}function ax(e,t=!0,r=Sy){let n=e instanceof ko?e:ko.fixed(e,t),o=new ga({name:mJ,version:hJ},{instructions:yJ,cacheHints:{"tools/list":{ttlMs:gJ,cacheScope:"public"}}});for(let s of r)o.registerTool(s.name,{title:s.title,description:s.description,annotations:s.annotations,inputSchema:T(s.inputShape)},async(i,a)=>{let c=null,l=await(async()=>{for(let d=0;;d+=1){let p=await wJ(o,n,a);if("content"in p)return p;let m=n.takeSignInNotice();if(m)c=await vJ(p,m);let h=n.canAutoRefresh;try{let g=await s.handler(p,i);return hO(g,s.serialize==="compact"?0:2)}catch(g){if(!(g instanceof Me&&g.statusCode===401&&n.markRevoked(p,d>0)))return gO(g,h);if(d>0)return Ba(`the Grove session ended (sign-in revoked or expired). ${Ip(n)}`)}}})();return c?{...l,content:[{type:"text",text:c},...l.content]}:l});return o}var RJ=`Usage: iis-grove-mcp [option]
90
97
  iis-grove-mcp install [--dry-run] [--force] [--client <name>]...
91
98
 
92
99
  Grove MCP server. With no option it serves MCP over stdio (the host speaks
@@ -111,8 +118,8 @@ Environment:
111
118
  GROVE_PROFILE CLI profile to use (default: the active one)
112
119
  GROVE_MCP_TOOLS opt-in tools, e.g. +opml
113
120
  `;if(process.argv[2]==="--describe")process.stdout.write(`Grove MCP server — attach Grove (RSS feeds) to an LLM/agent: read news, manage feeds, engage, discover sources
114
- `),process.exit(0);if(process.argv[2]==="--schema")process.exit(0);if(process.argv[2]==="--help"||process.argv[2]==="-h")process.stdout.write(qG),process.exit(0);if(process.argv[2]==="--version"||process.argv[2]==="-v")process.stdout.write(`${Na}
115
- `),process.exit(0);async function MG(){let e=ik(),t=eO(process.env.GROVE_MCP_TOOLS);$b(()=>nO(e,!0,t),{legacy:"serve",onerror:(r)=>{process.stderr.write(`grove-mcp transport error: ${r.message}
121
+ `),process.exit(0);if(process.argv[2]==="--schema")process.exit(0);if(process.argv[2]==="--help"||process.argv[2]==="-h")process.stdout.write(RJ),process.exit(0);if(process.argv[2]==="--version"||process.argv[2]==="-v")process.stdout.write(`${Ua}
122
+ `),process.exit(0);async function EJ(){let e=Uk(),t=nx(process.env.GROVE_MCP_TOOLS);Qb(()=>ax(e,!0,t),{legacy:"serve",onerror:(r)=>{process.stderr.write(`grove-mcp transport error: ${r.message}
116
123
  `)}}),process.stdin.once("end",()=>e.close()),process.stdin.once("close",()=>e.close()),process.stderr.write(`grove-mcp server connected (stdio)
117
- `)}if(process.argv[2]==="install")process.exitCode=xk(process.argv.slice(3),Ck(ak));else MG().catch((e)=>{let t=e instanceof Error?e.message:String(e);process.stderr.write(`grove-mcp failed to start: ${t}
124
+ `)}if(process.argv[2]==="install")process.exitCode=mO(process.argv.slice(3),fO(Fk));else EJ().catch((e)=>{let t=e instanceof Error?e.message:String(e);process.stderr.write(`grove-mcp failed to start: ${t}
118
125
  `),process.exit(1)});