@iistools/grove-mcp 0.4.2 → 0.5.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/THIRD_PARTY_NOTICES.txt +2 -2
- package/grove-mcp.js +53 -39
- package/package.json +1 -1
package/grove-mcp.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var fO=Object.create;var{getPrototypeOf:mO,defineProperty:by,getOwnPropertyNames:hO}=Object;var $y=Object.prototype.hasOwnProperty;function gO(e){return this[e]}var yO,_O,Cp=(e,t,r)=>{var n=e!=null&&typeof e==="object";if(n){var o=t?yO??=new WeakMap:_O??=new WeakMap,s=o.get(e);if(s)return s}r=e!=null?fO(mO(e)):{};let i=t||!e||!e.__esModule||!$y.call(e,"default")?by(r,"default",{value:e,enumerable:!0}):r;if(e&&typeof e==="object"||typeof e==="function"){for(let a of hO(e))if(!$y.call(i,a))by(i,a,{get:gO.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 td{}P$._CodeOrName=td;P$.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class gs extends td{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=gs;class vr extends td{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 gs)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)Sh(r,t[n]),r.push(e[++n]);return new vr(r)}P$._=E$;var vh=new vr("+");function z$(e,...t){let r=[Sa(e[0])],n=0;while(n<t.length)r.push(vh),Sh(r,t[n]),r.push(vh,Sa(e[++n]));return hj(r),new vr(r)}P$.str=z$;function Sh(e,t){if(t instanceof vr)e.push(...t._items);else if(t instanceof gs)e.push(t);else e.push(_j(t))}P$.addCodeArg=Sh;function hj(e){let t=1;while(t<e.length-1){if(e[t]===vh){let r=gj(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function gj(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string"){if(t instanceof gs||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 gs))return`"${e}${t.slice(1)}`;return}function yj(e,t){return t.emptyStr()?e:e.emptyStr()?t:z$`${e}${t}`}P$.strConcat=yj;function _j(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:Sa(Array.isArray(e)?e.join(","):e)}function vj(e){return new vr(Sa(e))}P$.stringify=vj;function Sa(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}P$.safeStringify=Sa;function Sj(e){return typeof e=="string"&&P$.IDENTIFIER.test(e)?new vr(`.${e}`):E$`[${e}]`}P$.getProperty=Sj;function bj(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=bj;function $j(e){return new vr(e.toString())}P$.regexpCode=$j});var Rh=D(function(k$){Object.defineProperty(k$,"__esModule",{value:!0});k$.ValueScope=k$.ValueScopeName=k$.Scope=k$.varKinds=k$.UsedValueState=void 0;var Le=ba();class I$ extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`);this.value=e.value}}var nd;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(nd||(k$.UsedValueState=nd={}));k$.varKinds={const:new Le.Name("const"),let:new Le.Name("let"),var:new Le.Name("var")};class $h{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}}}k$.Scope=$h;class wh 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}]`}}k$.ValueScopeName=wh;var Nj=Le._`\n`;class x$ extends $h{constructor(e){super(e);this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?Nj:Le.nil}}get(){return this._scope}name(e){return new wh(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,nd.Started);let u=t(c);if(u){let l=this.opts.es5?k$.varKinds.var:k$.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,nd.Completed)})}return o}}k$.ValueScope=x$});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(),rt=Rh(),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 ud=Rh();Object.defineProperty(Ft,"Scope",{enumerable:!0,get:function(){return ud.Scope}});Object.defineProperty(Ft,"ValueScope",{enumerable:!0,get:function(){return ud.ValueScope}});Object.defineProperty(Ft,"ValueScopeName",{enumerable:!0,get:function(){return ud.ValueScopeName}});Object.defineProperty(Ft,"varKinds",{enumerable:!0,get:function(){return ud.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?rt.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=_s(this.rhs,e,t);return this}get names(){return this.rhs instanceof re._CodeOrName?this.rhs.names:{}}}class Ph 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=_s(this.rhs,e,t),this}get names(){let e=this.lhs instanceof re.Name?{}:{...this.lhs.names};return cd(e,this.rhs)}}class A$ extends Ph{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=_s(this.code,e,t),this}get names(){return this.code instanceof re._CodeOrName?this.code.names:{}}}class ld 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;Lj(e,o.names),r.splice(n,1)}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>wo(e,t.names),{})}}class Pn extends ld{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class L$ extends ld{}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=_s(this.condition,e,t),this}get names(){let e=super.names;if(cd(e,this.condition),this.else)wo(e,this.else.names);return e}}Yr.kind="if";class ys extends Pn{}ys.kind="for";class D$ extends ys{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=_s(this.iteration,e,t),this}get names(){return wo(super.names,this.iteration.names)}}class U$ extends ys{constructor(e,t,r,n){super();this.varKind=e,this.name=t,this.from=r,this.to=n}render(e){let t=e.es5?rt.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=cd(super.names,this.from);return cd(e,this.to)}}class Eh extends ys{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=_s(this.iterable,e,t),this}get names(){return wo(super.names,this.iterable.names)}}class od 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)}}od.kind="func";class sd extends ld{render(e){return"return "+super.render(e)}}sd.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)wo(e,this.catch.names);if(this.finally)wo(e,this.finally.names);return e}}class id extends Pn{constructor(e){super();this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}id.kind="catch";class ad extends Pn{render(e){return"finally"+super.render(e)}}ad.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 rt.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(rt.varKinds.const,e,t,r)}let(e,t,r){return this._def(rt.varKinds.let,e,t,r)}var(e,t,r){return this._def(rt.varKinds.var,e,t,r)}assign(e,t,r){return this._leafNode(new Ph(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?rt.varKinds.var:rt.varKinds.let){let s=this._scope.toName(e);return this._for(new U$(o,s,t,r),()=>n(s))}forOf(e,t,r,n=rt.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 Eh("of",n,o,t),()=>r(o))}forIn(e,t,r,n=this.opts.es5?rt.varKinds.var:rt.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 Eh("in",n,o,t),()=>r(o))}endFor(){return this._endBlockNode(ys)}label(e){return this._leafNode(new N$(e))}break(e){return this._leafNode(new j$(e))}return(e){let t=new sd;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(sd)}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 id(o),t(o)}if(r)this._currNode=n.finally=new ad,this.code(r);return this._endBlockNode(id,ad)}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 od(e,t,r)),n)this.code(n).endFunc();return this}endFunc(){return this._endBlockNode(od)}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 wo(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function cd(e,t){return t instanceof re._CodeOrName?wo(e,t.names):e}function _s(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 Lj(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._`!${zh(e)}`}Ft.not=H$;var Dj=Z$(Ft.operators.AND);function Uj(...e){return e.reduce(Dj)}Ft.and=Uj;var Fj=Z$(Ft.operators.OR);function Vj(...e){return e.reduce(Fj)}Ft.or=Vj;function Z$(e){return(t,r)=>t===re.nil?r:r===re.nil?t:re._`${zh(t)} ${e} ${zh(r)}`}function zh(e){return e instanceof re.Name?e:re._`(${e})`}});var xe=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 Jj(e){let t={};for(let r of e)t[r]=!0;return t}tw.toHash=Jj;function Kj(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=Kj;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 Bj(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=Bj;function Wj({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=Wj;function Yj(e){return X$(decodeURIComponent(e))}tw.unescapeFragment=Yj;function Xj(e){return encodeURIComponent(Ih(e))}tw.escapeFragment=Xj;function Ih(e){if(typeof e=="number")return`${e}`;return e.replace(/~/g,"~0").replace(/\//g,"~1")}tw.escapeJsonPointer=Ih;function X$(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}tw.unescapeJsonPointer=X$;function Qj(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}tw.eachItem=Qj;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} || {}`),xh(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)xh(e,r,t);return r}tw.evaluatedPropsToName=Q$;function xh(e,t,r){Object.keys(r).forEach((n)=>e.assign(he._`${t}${he.getProperty(n)}`,!0))}tw.setEvaluated=xh;var K$={};function eq(e,t){return e.scopeValue("func",{ref:t,code:K$[t.code]||(K$[t.code]=new B$._Code(t.code))})}tw.useFunc=eq;var Th;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Th||(tw.Type=Th={}));function tq(e,t,r){if(e instanceof he.Name){let n=t===Th.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():"/"+Ih(e)}tw.getErrorPath=tq;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 qe=$e(),vq={data:new qe.Name("data"),valCxt:new qe.Name("valCxt"),instancePath:new qe.Name("instancePath"),parentData:new qe.Name("parentData"),parentDataProperty:new qe.Name("parentDataProperty"),rootData:new qe.Name("rootData"),dynamicAnchors:new qe.Name("dynamicAnchors"),vErrors:new qe.Name("vErrors"),errors:new qe.Name("errors"),this:new qe.Name("this"),self:new qe.Name("self"),scope:new qe.Name("scope"),json:new qe.Name("json"),jsonPos:new qe.Name("jsonPos"),jsonLen:new qe.Name("jsonLen"),jsonPart:new qe.Name("jsonPart")};nw.default=vq});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=xe(),qt=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 bq(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=bq;function $q(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,qt.default.vErrors)}aw.reportExtraError=$q;function wq(e,t){e.assign(qt.default.errors,t),e.if(ne._`${qt.default.vErrors} !== null`,()=>e.if(t,()=>e.assign(ne._`${qt.default.vErrors}.length`,t),()=>e.assign(qt.default.vErrors,null)))}aw.resetErrorsCount=wq;function Rq({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,qt.default.errors,(a)=>{if(e.const(i,ne._`${qt.default.vErrors}[${a}]`),e.if(ne._`${i}.instancePath === undefined`,()=>e.assign(ne._`${i}.instancePath`,ne.strConcat(qt.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=Rq;function ow(e,t){let r=e.const("err",t);e.if(ne._`${qt.default.vErrors} === null`,()=>e.assign(qt.default.vErrors,ne._`[${r}]`),ne._`${qt.default.vErrors}.push(${r})`),e.code(ne._`${qt.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 Ro={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 Eq(e,t,r)}function Eq(e,t,r={}){let{gen:n,it:o}=e,s=[zq(o,r),Pq(e,r)];return Tq(e,t,s),n.object(...s)}function zq({errorPath:e},{instancePath:t}){let r=t?ne.str`${e}${Tn.getErrorPath(t,Tn.Type.Str)}`:e;return[qt.default.instancePath,ne.strConcat(qt.default.instancePath,r)]}function Pq({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[Ro.schemaPath,o]}function Tq(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([Ro.keyword,o],[Ro.params,typeof t=="function"?t(e):t||ne._`{}`]),c.messages)n.push([Ro.message,typeof r=="function"?r(e):r]);if(c.verbose)n.push([Ro.schema,i],[Ro.parentSchema,ne._`${l}${d}`],[qt.default.data,s]);if(u)n.push([Ro.propertyName,u])}});var mw=D(function(pw){Object.defineProperty(pw,"__esModule",{value:!0});pw.boolOrEmptySchema=pw.topBoolOrEmptySchema=void 0;var uw=wa(),lw=$e(),Cq=nr(),Aq={message:"boolean schema is false"};function Nq(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(Cq.default.data);else t.assign(lw._`${n}.errors`,null),t.return(!0)}pw.topBoolOrEmptySchema=Nq;function jq(e,t){let{gen:r,schema:n}=e;if(n===!1)r.var(t,!1),dw(e);else r.var(t,!0)}pw.boolOrEmptySchema=jq;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},Aq,void 0,t)}});var Oh=D(function(hw){Object.defineProperty(hw,"__esModule",{value:!0});hw.getRules=hw.isJSONType=void 0;var Mq=["string","number","integer","boolean","null","object","array"],Lq=new Set(Mq);function Dq(e){return typeof e=="string"&&Lq.has(e)}hw.isJSONType=Dq;function Uq(){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=Uq});var Ch=D(function(vw){Object.defineProperty(vw,"__esModule",{value:!0});vw.shouldUseRule=vw.shouldUseGroup=vw.schemaHasRulesForType=void 0;function Vq({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&yw(e,n)}vw.schemaHasRulesForType=Vq;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=Oh(),$w=Ch(),ww=wa(),Q=$e(),pd=xe(),vs;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(vs||(zw.DataType=vs={}));function Gq(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=Gq;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 Jq(e,t){let{gen:r,data:n,opts:o}=e,s=Kq(t,o.coerceTypes),i=t.length>0&&!(s.length===0&&t.length===1&&$w.schemaHasRulesForType(e,t[0]));if(i){let a=Nh(t,n,o.strictNumbers,vs.Wrong);r.if(a,()=>{if(s.length)Bq(e,t,s);else jh(e)})}return i}zw.coerceAndCheckDataType=Jq;var Ew=new Set(["string","number","integer","boolean","null"]);function Kq(e,t){return t?e.filter((r)=>Ew.has(r)||t==="array"&&r==="array"):[]}function Bq(e,t,r){let{gen:n,data:o,opts:s}=e,i=n.let("dataType",Q._`typeof ${o}`),a=n.let("coerced",Q._`undefined`);if(s.coerceTypes==="array")n.if(Q._`${i} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,Q._`${o}[0]`).assign(i,Q._`typeof ${o}`).if(Nh(t,o,s.strictNumbers),()=>n.assign(a,o)));n.if(Q._`${a} !== undefined`);for(let u of r)if(Ew.has(u)||u==="array"&&s.coerceTypes==="array")c(u);n.else(),jh(e),n.endIf(),n.if(Q._`${a} !== undefined`,()=>{n.assign(o,a),Wq(e,a)});function c(u){switch(u){case"string":n.elseIf(Q._`${i} == "number" || ${i} == "boolean"`).assign(a,Q._`"" + ${o}`).elseIf(Q._`${o} === null`).assign(a,Q._`""`);return;case"number":n.elseIf(Q._`${i} == "boolean" || ${o} === null
|
|
2
|
+
var CC=Object.create;var{getPrototypeOf:OC,defineProperty:Oy,getOwnPropertyNames:AC}=Object;var Ay=Object.prototype.hasOwnProperty;function NC(e){return this[e]}var jC,qC,Mp=(e,t,r)=>{var n=e!=null&&typeof e==="object";if(n){var o=t?jC??=new WeakMap:qC??=new WeakMap,s=o.get(e);if(s)return s}r=e!=null?CC(OC(e)):{};let i=t||!e||!e.__esModule||!Ay.call(e,"default")?Oy(r,"default",{value:e,enumerable:!0}):r;if(e&&typeof e==="object"||typeof e==="function"){for(let a of AC(e))if(!Ay.call(i,a))Oy(i,a,{get:NC.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 za=D(function(Dw){Object.defineProperty(Dw,"__esModule",{value:!0});Dw.regexpCode=Dw.getEsmExportName=Dw.getProperty=Dw.safeStringify=Dw.stringify=Dw.strConcat=Dw.addCodeArg=Dw.str=Dw._=Dw.nil=Dw._Code=Dw.Name=Dw.IDENTIFIER=Dw._CodeOrName=void 0;class od{}Dw._CodeOrName=od;Dw.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class _s extends od{constructor(e){super();if(!Dw.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}}}Dw.Name=_s;class vr extends od{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 _s)t[r.str]=(t[r.str]||0)+1;return t},{})}}Dw._Code=vr;Dw.nil=new vr("");function Mw(e,...t){let r=[e[0]],n=0;while(n<t.length)Eh(r,t[n]),r.push(e[++n]);return new vr(r)}Dw._=Mw;var Rh=new vr("+");function Lw(e,...t){let r=[Ea(e[0])],n=0;while(n<t.length)r.push(Rh),Eh(r,t[n]),r.push(Rh,Ea(e[++n]));return Nj(r),new vr(r)}Dw.str=Lw;function Eh(e,t){if(t instanceof vr)e.push(...t._items);else if(t instanceof _s)e.push(t);else e.push(Mj(t))}Dw.addCodeArg=Eh;function Nj(e){let t=1;while(t<e.length-1){if(e[t]===Rh){let r=jj(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function jj(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string"){if(t instanceof _s||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 _s))return`"${e}${t.slice(1)}`;return}function qj(e,t){return t.emptyStr()?e:e.emptyStr()?t:Lw`${e}${t}`}Dw.strConcat=qj;function Mj(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:Ea(Array.isArray(e)?e.join(","):e)}function Lj(e){return new vr(Ea(e))}Dw.stringify=Lj;function Ea(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}Dw.safeStringify=Ea;function Dj(e){return typeof e=="string"&&Dw.IDENTIFIER.test(e)?new vr(`.${e}`):Mw`[${e}]`}Dw.getProperty=Dj;function Uj(e){if(typeof e=="string"&&Dw.IDENTIFIER.test(e))return new vr(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}Dw.getEsmExportName=Uj;function Fj(e){return new vr(e.toString())}Dw.regexpCode=Fj});var kh=D(function(Hw){Object.defineProperty(Hw,"__esModule",{value:!0});Hw.ValueScope=Hw.ValueScopeName=Hw.Scope=Hw.varKinds=Hw.UsedValueState=void 0;var De=za();class Fw extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`);this.value=e.value}}var id;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(id||(Hw.UsedValueState=id={}));Hw.varKinds={const:new De.Name("const"),let:new De.Name("let"),var:new De.Name("var")};class Ph{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof De.Name?e:this.name(e)}name(e){return new De.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}}}Hw.Scope=Ph;class Th extends De.Name{constructor(e,t){super(t);this.prefix=e}setValue(e,{property:t,itemIndex:r}){this.value=e,this.scopePath=De._`.${new De.Name(t)}[${r}]`}}Hw.ValueScopeName=Th;var tq=De._`\n`;class Vw extends Ph{constructor(e){super(e);this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?tq:De.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 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 De._`${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=De.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,id.Started);let u=t(c);if(u){let l=this.opts.es5?Hw.varKinds.var:Hw.varKinds.const;o=De._`${o}${l} ${c} = ${u};${this.opts._n}`}else if(u=n===null||n===void 0?void 0:n(c))o=De._`${o}${u}${this.opts._n}`;else throw new Fw(c);a.set(c,id.Completed)})}return o}}Hw.ValueScope=Vw});var we=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=za(),ot=kh(),zn=za();Object.defineProperty(Ft,"_",{enumerable:!0,get:function(){return zn._}});Object.defineProperty(Ft,"str",{enumerable:!0,get:function(){return zn.str}});Object.defineProperty(Ft,"strConcat",{enumerable:!0,get:function(){return zn.strConcat}});Object.defineProperty(Ft,"nil",{enumerable:!0,get:function(){return zn.nil}});Object.defineProperty(Ft,"getProperty",{enumerable:!0,get:function(){return zn.getProperty}});Object.defineProperty(Ft,"stringify",{enumerable:!0,get:function(){return zn.stringify}});Object.defineProperty(Ft,"regexpCode",{enumerable:!0,get:function(){return zn.regexpCode}});Object.defineProperty(Ft,"Name",{enumerable:!0,get:function(){return zn.Name}});var pd=kh();Object.defineProperty(Ft,"Scope",{enumerable:!0,get:function(){return pd.Scope}});Object.defineProperty(Ft,"ValueScope",{enumerable:!0,get:function(){return pd.ValueScope}});Object.defineProperty(Ft,"ValueScopeName",{enumerable:!0,get:function(){return pd.ValueScopeName}});Object.defineProperty(Ft,"varKinds",{enumerable:!0,get:function(){return pd.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 Pn{optimizeNodes(){return this}optimizeNames(e,t){return this}}class Gw extends Pn{constructor(e,t,r){super();this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){let r=e?ot.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=Ss(this.rhs,e,t);return this}get names(){return this.rhs instanceof re._CodeOrName?this.rhs.names:{}}}class Ch extends Pn{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=Ss(this.rhs,e,t),this}get names(){let e=this.lhs instanceof re.Name?{}:{...this.lhs.names};return dd(e,this.rhs)}}class Jw extends Ch{constructor(e,t,r,n){super(e,r,n);this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class Bw extends Pn{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class Kw extends Pn{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class Ww extends Pn{constructor(e){super();this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class Yw extends Pn{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=Ss(this.code,e,t),this}get names(){return this.code instanceof re._CodeOrName?this.code.names:{}}}class fd extends Pn{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;sq(e,o.names),r.splice(n,1)}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>Eo(e,t.names),{})}}class Tn extends fd{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class Xw extends fd{}class Pa extends Tn{}Pa.kind="else";class Xr extends Tn{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 Pa(r):r}if(t){if(e===!1)return t instanceof Xr?t:t.nodes;if(this.nodes.length)return this;return new Xr(n$(e),t instanceof Xr?[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=Ss(this.condition,e,t),this}get names(){let e=super.names;if(dd(e,this.condition),this.else)Eo(e,this.else.names);return e}}Xr.kind="if";class vs extends Tn{}vs.kind="for";class Qw extends vs{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=Ss(this.iteration,e,t),this}get names(){return Eo(super.names,this.iteration.names)}}class e$ extends vs{constructor(e,t,r,n){super();this.varKind=e,this.name=t,this.from=r,this.to=n}render(e){let t=e.es5?ot.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=dd(super.names,this.from);return dd(e,this.to)}}class Ih extends vs{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=Ss(this.iterable,e,t),this}get names(){return Eo(super.names,this.iterable.names)}}class ad extends Tn{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)}}ad.kind="func";class cd extends fd{render(e){return"return "+super.render(e)}}cd.kind="return";class t$ extends Tn{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)Eo(e,this.catch.names);if(this.finally)Eo(e,this.finally.names);return e}}class ud extends Tn{constructor(e){super();this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}ud.kind="catch";class ld extends Tn{render(e){return"finally"+super.render(e)}}ld.kind="finally";class r${constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
|
|
3
|
+
`:""},this._extScope=e,this._scope=new ot.Scope({parent:e}),this._nodes=[new Xw]}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 Gw(e,o,r)),o}const(e,t,r){return this._def(ot.varKinds.const,e,t,r)}let(e,t,r){return this._def(ot.varKinds.let,e,t,r)}var(e,t,r){return this._def(ot.varKinds.var,e,t,r)}assign(e,t,r){return this._leafNode(new Ch(e,t,r))}add(e,t){return this._leafNode(new Jw(e,Ft.operators.ADD,t))}code(e){if(typeof e=="function")e();else if(e!==re.nil)this._leafNode(new Yw(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 Xr(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 Xr(e))}else(){return this._elseNode(new Pa)}endIf(){return this._endBlockNode(Xr,Pa)}_for(e,t){if(this._blockNode(e),t)this.code(t).endFor();return this}for(e,t){return this._for(new Qw(e),t)}forRange(e,t,r,n,o=this.opts.es5?ot.varKinds.var:ot.varKinds.let){let s=this._scope.toName(e);return this._for(new e$(o,s,t,r),()=>n(s))}forOf(e,t,r,n=ot.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 Ih("of",n,o,t),()=>r(o))}forIn(e,t,r,n=this.opts.es5?ot.varKinds.var:ot.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 Ih("in",n,o,t),()=>r(o))}endFor(){return this._endBlockNode(vs)}label(e){return this._leafNode(new Bw(e))}break(e){return this._leafNode(new Kw(e))}return(e){let t=new cd;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(cd)}try(e,t,r){if(!t&&!r)throw Error('CodeGen: "try" without "catch" and "finally"');let n=new t$;if(this._blockNode(n),this.code(e),t){let o=this.name("e");this._currNode=n.catch=new ud(o),t(o)}if(r)this._currNode=n.finally=new ld,this.code(r);return this._endBlockNode(ud,ld)}throw(e){return this._leafNode(new Ww(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 ad(e,t,r)),n)this.code(n).endFunc();return this}endFunc(){return this._endBlockNode(ad)}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 Xr))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=r$;function Eo(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function dd(e,t){return t instanceof re._CodeOrName?Eo(e,t.names):e}function Ss(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 sq(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function n$(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:re._`!${xh(e)}`}Ft.not=n$;var iq=o$(Ft.operators.AND);function aq(...e){return e.reduce(iq)}Ft.and=aq;var cq=o$(Ft.operators.OR);function uq(...e){return e.reduce(cq)}Ft.or=uq;function o$(e){return(t,r)=>t===re.nil?r:r===re.nil?t:re._`${xh(t)} ${e} ${xh(r)}`}function xh(e){return e instanceof re.Name?e:re._`(${e})`}});var Ie=D(function(m$){Object.defineProperty(m$,"__esModule",{value:!0});m$.checkStrictMode=m$.getErrorPath=m$.Type=m$.useFunc=m$.setEvaluated=m$.evaluatedPropsToName=m$.mergeEvaluated=m$.eachItem=m$.unescapeJsonPointer=m$.escapeJsonPointer=m$.escapeFragment=m$.unescapeFragment=m$.schemaRefOrVal=m$.schemaHasRulesButRef=m$.schemaHasRules=m$.checkUnknownRules=m$.alwaysValidSchema=m$.toHash=void 0;var he=we(),c$=za();function fq(e){let t={};for(let r of e)t[r]=!0;return t}m$.toHash=fq;function mq(e,t){if(typeof t=="boolean")return t;if(Object.keys(t).length===0)return!0;return u$(e,t),!l$(t,e.self.RULES.all)}m$.alwaysValidSchema=mq;function u$(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])f$(e,`unknown keyword: "${s}"`)}m$.checkUnknownRules=u$;function l$(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}m$.schemaHasRules=l$;function hq(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}m$.schemaHasRulesButRef=hq;function gq({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)}`}m$.schemaRefOrVal=gq;function yq(e){return d$(decodeURIComponent(e))}m$.unescapeFragment=yq;function _q(e){return encodeURIComponent(Ah(e))}m$.escapeFragment=_q;function Ah(e){if(typeof e=="number")return`${e}`;return e.replace(/~/g,"~0").replace(/\//g,"~1")}m$.escapeJsonPointer=Ah;function d$(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}m$.unescapeJsonPointer=d$;function vq(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}m$.eachItem=vq;function i$({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}}m$.mergeEvaluated={props:i$({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} || {}`),Nh(e,r,t)}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:p$}),items:i$({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 p$(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",he._`{}`);if(t!==void 0)Nh(e,r,t);return r}m$.evaluatedPropsToName=p$;function Nh(e,t,r){Object.keys(r).forEach((n)=>e.assign(he._`${t}${he.getProperty(n)}`,!0))}m$.setEvaluated=Nh;var a$={};function Sq(e,t){return e.scopeValue("func",{ref:t,code:a$[t.code]||(a$[t.code]=new c$._Code(t.code))})}m$.useFunc=Sq;var Oh;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Oh||(m$.Type=Oh={}));function bq(e,t,r){if(e instanceof he.Name){let n=t===Oh.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():"/"+Ah(e)}m$.getErrorPath=bq;function f$(e,t,r=e.opts.strictSchema){if(!r)return;if(t=`strict mode: ${t}`,r===!0)throw Error(t);e.self.logger.warn(t)}m$.checkStrictMode=f$});var nr=D(function(g$){Object.defineProperty(g$,"__esModule",{value:!0});var qe=we(),Lq={data:new qe.Name("data"),valCxt:new qe.Name("valCxt"),instancePath:new qe.Name("instancePath"),parentData:new qe.Name("parentData"),parentDataProperty:new qe.Name("parentDataProperty"),rootData:new qe.Name("rootData"),dynamicAnchors:new qe.Name("dynamicAnchors"),vErrors:new qe.Name("vErrors"),errors:new qe.Name("errors"),this:new qe.Name("this"),self:new qe.Name("self"),scope:new qe.Name("scope"),json:new qe.Name("json"),jsonPos:new qe.Name("jsonPos"),jsonLen:new qe.Name("jsonLen"),jsonPart:new qe.Name("jsonPart")};g$.default=Lq});var Ta=D(function(S$){Object.defineProperty(S$,"__esModule",{value:!0});S$.extendErrors=S$.resetErrorsCount=S$.reportExtraError=S$.reportError=S$.keyword$DataError=S$.keywordError=void 0;var ne=we(),kn=Ie(),qt=nr();S$.keywordError={message:({keyword:e})=>ne.str`must pass "${e}" keyword validation`};S$.keyword$DataError={message:({keyword:e,schemaType:t})=>t?ne.str`"${e}" keyword must be ${t} ($data)`:ne.str`"${e}" keyword is invalid ($data)`};function Uq(e,t=S$.keywordError,r,n){let{it:o}=e,{gen:s,compositeRule:i,allErrors:a}=o,c=v$(e,t,r);if(n!==null&&n!==void 0?n:i||a)y$(s,c);else _$(o,ne._`[${c}]`)}S$.reportError=Uq;function Fq(e,t=S$.keywordError,r){let{it:n}=e,{gen:o,compositeRule:s,allErrors:i}=n,a=v$(e,t,r);if(y$(o,a),!(s||i))_$(n,qt.default.vErrors)}S$.reportExtraError=Fq;function Vq(e,t){e.assign(qt.default.errors,t),e.if(ne._`${qt.default.vErrors} !== null`,()=>e.if(t,()=>e.assign(ne._`${qt.default.vErrors}.length`,t),()=>e.assign(qt.default.vErrors,null)))}S$.resetErrorsCount=Vq;function Hq({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,qt.default.errors,(a)=>{if(e.const(i,ne._`${qt.default.vErrors}[${a}]`),e.if(ne._`${i}.instancePath === undefined`,()=>e.assign(ne._`${i}.instancePath`,ne.strConcat(qt.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)})}S$.extendErrors=Hq;function y$(e,t){let r=e.const("err",t);e.if(ne._`${qt.default.vErrors} === null`,()=>e.assign(qt.default.vErrors,ne._`[${r}]`),ne._`${qt.default.vErrors}.push(${r})`),e.code(ne._`${qt.default.errors}++`)}function _$(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 zo={keyword:new ne.Name("keyword"),schemaPath:new ne.Name("schemaPath"),params:new ne.Name("params"),propertyName:new ne.Name("propertyName"),message:new ne.Name("message"),schema:new ne.Name("schema"),parentSchema:new ne.Name("parentSchema")};function v$(e,t,r){let{createErrors:n}=e.it;if(n===!1)return ne._`{}`;return Zq(e,t,r)}function Zq(e,t,r={}){let{gen:n,it:o}=e,s=[Gq(o,r),Jq(e,r)];return Bq(e,t,s),n.object(...s)}function Gq({errorPath:e},{instancePath:t}){let r=t?ne.str`${e}${kn.getErrorPath(t,kn.Type.Str)}`:e;return[qt.default.instancePath,ne.strConcat(qt.default.instancePath,r)]}function Jq({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let o=n?t:ne.str`${t}/${e}`;if(r)o=ne.str`${o}${kn.getErrorPath(r,kn.Type.Str)}`;return[zo.schemaPath,o]}function Bq(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([zo.keyword,o],[zo.params,typeof t=="function"?t(e):t||ne._`{}`]),c.messages)n.push([zo.message,typeof r=="function"?r(e):r]);if(c.verbose)n.push([zo.schema,i],[zo.parentSchema,ne._`${l}${d}`],[qt.default.data,s]);if(u)n.push([zo.propertyName,u])}});var P$=D(function(E$){Object.defineProperty(E$,"__esModule",{value:!0});E$.boolOrEmptySchema=E$.topBoolOrEmptySchema=void 0;var w$=Ta(),$$=we(),Qq=nr(),eM={message:"boolean schema is false"};function tM(e){let{gen:t,schema:r,validateName:n}=e;if(r===!1)R$(e,!1);else if(typeof r=="object"&&r.$async===!0)t.return(Qq.default.data);else t.assign($$._`${n}.errors`,null),t.return(!0)}E$.topBoolOrEmptySchema=tM;function rM(e,t){let{gen:r,schema:n}=e;if(n===!1)r.var(t,!1),R$(e);else r.var(t,!0)}E$.boolOrEmptySchema=rM;function R$(e,t){let{gen:r,data:n}=e;w$.reportError({gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e},eM,void 0,t)}});var qh=D(function(T$){Object.defineProperty(T$,"__esModule",{value:!0});T$.getRules=T$.isJSONType=void 0;var oM=["string","number","integer","boolean","null","object","array"],sM=new Set(oM);function iM(e){return typeof e=="string"&&sM.has(e)}T$.isJSONType=iM;function aM(){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:{}}}T$.getRules=aM});var Mh=D(function(C$){Object.defineProperty(C$,"__esModule",{value:!0});C$.shouldUseRule=C$.shouldUseGroup=C$.schemaHasRulesForType=void 0;function uM({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&I$(e,n)}C$.schemaHasRulesForType=uM;function I$(e,t){return t.rules.some((r)=>x$(e,r))}C$.shouldUseGroup=I$;function x$(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))}C$.shouldUseRule=x$});var ka=D(function(L$){Object.defineProperty(L$,"__esModule",{value:!0});L$.reportTypeError=L$.checkDataTypes=L$.checkDataType=L$.coerceAndCheckDataType=L$.getJSONTypes=L$.getSchemaTypes=L$.DataType=void 0;var A$=qh(),N$=Mh(),j$=Ta(),Q=we(),hd=Ie(),bs;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(bs||(L$.DataType=bs={}));function pM(e){let t=q$(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}L$.getSchemaTypes=pM;function q$(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(A$.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}L$.getJSONTypes=q$;function fM(e,t){let{gen:r,data:n,opts:o}=e,s=mM(t,o.coerceTypes),i=t.length>0&&!(s.length===0&&t.length===1&&N$.schemaHasRulesForType(e,t[0]));if(i){let a=Dh(t,n,o.strictNumbers,bs.Wrong);r.if(a,()=>{if(s.length)hM(e,t,s);else Uh(e)})}return i}L$.coerceAndCheckDataType=fM;var M$=new Set(["string","number","integer","boolean","null"]);function mM(e,t){return t?e.filter((r)=>M$.has(r)||t==="array"&&r==="array"):[]}function hM(e,t,r){let{gen:n,data:o,opts:s}=e,i=n.let("dataType",Q._`typeof ${o}`),a=n.let("coerced",Q._`undefined`);if(s.coerceTypes==="array")n.if(Q._`${i} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,Q._`${o}[0]`).assign(i,Q._`typeof ${o}`).if(Dh(t,o,s.strictNumbers),()=>n.assign(a,o)));n.if(Q._`${a} !== undefined`);for(let u of r)if(M$.has(u)||u==="array"&&s.coerceTypes==="array")c(u);n.else(),Uh(e),n.endIf(),n.if(Q._`${a} !== undefined`,()=>{n.assign(o,a),gM(e,a)});function c(u){switch(u){case"string":n.elseIf(Q._`${i} == "number" || ${i} == "boolean"`).assign(a,Q._`"" + ${o}`).elseIf(Q._`${o} === null`).assign(a,Q._`""`);return;case"number":n.elseIf(Q._`${i} == "boolean" || ${o} === null
|
|
4
4
|
|| (${i} == "string" && ${o} && ${o} == +${o})`).assign(a,Q._`+${o}`);return;case"integer":n.elseIf(Q._`${i} === "boolean" || ${o} === null
|
|
5
5
|
|| (${i} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(a,Q._`+${o}`);return;case"boolean":n.elseIf(Q._`${o} === "false" || ${o} === 0 || ${o} === null`).assign(a,!1).elseIf(Q._`${o} === "true" || ${o} === 1`).assign(a,!0);return;case"null":n.elseIf(Q._`${o} === "" || ${o} === 0 || ${o} === false`),n.assign(a,null);return;case"array":n.elseIf(Q._`${i} === "string" || ${i} === "number"
|
|
6
|
-
|| ${i} === "boolean" || ${o} === null`).assign(a,Q._`[${o}]`)}}}function Wq({gen:e,parentData:t,parentDataProperty:r},n){e.if(Q._`${t} !== undefined`,()=>e.assign(Q._`${t}[${r}]`,n))}function Ah(e,t,r,n=vs.Correct){let o=n===vs.Correct?Q.operators.EQ:Q.operators.NEQ,s;switch(e){case"null":return Q._`${t} ${o} null`;case"array":s=Q._`Array.isArray(${t})`;break;case"object":s=Q._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":s=i(Q._`!(${t} % 1) && !isNaN(${t})`);break;case"number":s=i();break;default:return Q._`typeof ${t} ${o} ${e}`}return n===vs.Correct?s:Q.not(s);function i(a=Q.nil){return Q.and(Q._`typeof ${t} == "number"`,a,r?Q._`isFinite(${t})`:Q.nil)}}zw.checkDataType=Ah;function Nh(e,t,r,n){if(e.length===1)return Ah(e[0],t,r,n);let o,s=pd.toHash(e);if(s.array&&s.object){let i=Q._`typeof ${t} != "object"`;o=s.null?i:Q._`!${t} || ${i}`,delete s.null,delete s.array,delete s.object}else o=Q.nil;if(s.number)delete s.integer;for(let i in s)o=Q.and(o,Ah(i,t,r,n));return o}zw.checkDataTypes=Nh;var Yq={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?Q._`{type: ${e}}`:Q._`{type: ${t}}`};function jh(e){let t=Xq(e);ww.reportError(t,Yq)}zw.reportTypeError=jh;function Xq(e){let{gen:t,data:r,schema:n}=e,o=pd.schemaRefOrVal(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:e}}});var Ow=D(function(xw){Object.defineProperty(xw,"__esModule",{value:!0});xw.assignDefaults=void 0;var or=$e(),Iw=xe();function sM(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))}xw.assignDefaults=sM;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(),Ss=xe(),In=nr(),Cw=xe();function iM(e,t){let{gen:r,data:n,it:o}=e;r.if(Mh(r,n,t,o.opts.ownProperties),()=>{e.setParams({missingProperty:_e._`${t}`},!0),e.error()})}jw.checkReportMissingProp=iM;function aM({gen:e,data:t,it:{opts:r}},n,o){return _e.or(...n.map((s)=>_e.and(Mh(e,t,s,r.ownProperties),_e._`${o} = ${s}`)))}jw.checkMissingProp=aM;function cM(e,t){e.setParams({missingProperty:t},!0),e.error()}jw.reportMissingProp=cM;function Aw(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:_e._`Object.prototype.hasOwnProperty`})}jw.hasPropFunc=Aw;function qh(e,t,r){return _e._`${Aw(e)}.call(${t}, ${r})`}jw.isOwnProperty=qh;function uM(e,t,r,n){let o=_e._`${t}${_e.getProperty(r)} !== undefined`;return n?_e._`${o} && ${qh(e,t,r)}`:o}jw.propertyInData=uM;function Mh(e,t,r,n){let o=_e._`${t}${_e.getProperty(r)} === undefined`;return n?_e.or(o,_e.not(qh(e,t,r))):o}jw.noPropertyInData=Mh;function Nw(e){return e?Object.keys(e).filter((t)=>t!=="__proto__"):[]}jw.allSchemaProperties=Nw;function lM(e,t){return Nw(t).filter((r)=>!Ss.alwaysValidSchema(e,t[r]))}jw.schemaProperties=lM;function dM({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=dM;var pM=_e._`new RegExp`;function fM({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"?pM:Cw.useFunc(e,o)}(${r}, ${n})`})}jw.usePattern=fM;function mM(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:Ss.Type.Num},s),t.if(_e.not(s),a)})}}jw.validateArray=mM;function hM(e){let{gen:t,schema:r,keyword:n,it:o}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(r.some((c)=>Ss.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=hM});var Hw=D(function(Fw){Object.defineProperty(Fw,"__esModule",{value:!0});Fw.validateKeywordUsage=Fw.validSchemaType=Fw.funcKeywordCode=Fw.macroKeywordCode=void 0;var Me=$e(),Eo=nr(),Lw=sr(),Dw=wa();function TM(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:Me.nil,errSchemaPath:`${i.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}Fw.macroKeywordCode=TM;function IM(e,t){var r;let{gen:n,keyword:o,schema:s,parentSchema:i,$data:a,it:c}=e;kM(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);_(()=>xM(e,y))}}function m(){let y=n.let("ruleErrs",null);return n.try(()=>g(Me._`await `),(S)=>n.assign(d,!1).if(Me._`${S} instanceof ${c.ValidationError}`,()=>n.assign(y,Me._`${S}.errors`),()=>n.throw(S))),y}function h(){let y=Me._`${l}.errors`;return n.assign(y,null),g(Me.nil),y}function g(y=t.async?Me._`await `:Me.nil){let S=c.opts.passContext?Eo.default.this:Eo.default.self,v=!(("compile"in t)&&!a||t.schema===!1);n.assign(d,Me._`${y}${Lw.callValidateCode(e,l,S,v)}`,t.modifying)}function _(y){var S;n.if(Me.not((S=t.valid)!==null&&S!==void 0?S:d),y)}}Fw.funcKeywordCode=IM;function Mw(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,Me._`${n.parentData}[${n.parentDataProperty}]`))}function xM(e,t){let{gen:r}=e;r.if(Me._`Array.isArray(${t})`,()=>{r.assign(Eo.default.vErrors,Me._`${Eo.default.vErrors} === null ? ${t} : ${Eo.default.vErrors}.concat(${t})`).assign(Eo.default.errors,Me._`${Eo.default.vErrors}.length`),Dw.extendErrors(e)},()=>e.error())}function kM({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:Me.stringify(r)})}function OM(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=OM;function CM({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=CM});var Jw=D(function(Zw){Object.defineProperty(Zw,"__esModule",{value:!0});Zw.extendSubschemaMode=Zw.extendSubschemaData=Zw.getSubschema=void 0;var dt=$e(),fd=xe();function qM(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}/${fd.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=qM;function MM(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}${fd.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=MM;function LM(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=LM});var Lh=D(function(GW,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(JW,Bw){var xn=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(){};md(t,n,o,e,"",e)};xn.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};xn.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};xn.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};xn.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 md(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 xn.arrayKeywords)for(var p=0;p<d.length;p++)md(e,t,r,d[p],o+"/"+l+"/"+p,s,o,l,n,p)}else if(l in xn.propsKeywords){if(d&&typeof d=="object")for(var m in d)md(e,t,r,d[m],o+"/"+l+"/"+FM(m),s,o,l,n,m)}else if(l in xn.keywords||e.allKeys&&!(l in xn.skipKeywords))md(e,t,r,d,o+"/"+l,s,o,l,n)}r(n,o,s,i,a,c,u)}}function FM(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=xe(),VM=Lh(),HM=Ww(),ZM=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function GM(e,t=!0){if(typeof e=="boolean")return!0;if(t===!0)return!Dh(e);if(!t)return!1;return Xw(e)<=t}tR.inlineRef=GM;var JM=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Dh(e){for(let t in e){if(JM.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(Dh))return!0;if(typeof r=="object"&&Dh(r))return!0}return!1}function Xw(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,ZM.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=bs(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 KM=/#\/?$/;function bs(e){return e?e.replace(KM,""):""}tR.normalizeId=bs;function BM(e,t,r){return r=bs(r),e.resolve(t,r)}tR.resolveUrl=BM;var WM=/^[a-z_][-a-z0-9._]*$/i;function YM(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=bs(e[r]||t),s={"":o},i=Qw(n,o,!1),a={},c=new Set;return HM(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=bs(_?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!==bs(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(!WM.test(v))throw Error(`invalid anchor "${v}"`);y.call(this,`#${v}`)}}}),a;function u(d,p,m){if(p!==void 0&&!VM(d,p))throw l(m)}function l(d){return Error(`reference "${d}" resolves to more than one schema`)}}tR.getSchemaRefs=YM});var Rs=D(function(yR){Object.defineProperty(yR,"__esModule",{value:!0});yR.getData=yR.KeywordCxt=yR.validateFunctionCode=void 0;var gd=mw(),hd=Ra(),ws=Ch(),kn=Ra(),iR=Ow(),xr=Hw(),$s=Jw(),V=$e(),ve=nr(),aR=Ea(),St=xe(),Ir=wa();function nL(e){if(lR(e)){if(dR(e),uR(e)){iL(e);return}}cR(e,()=>gd.topBoolOrEmptySchema(e))}yR.validateFunctionCode=nL;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)}`),sL(e,o),e.code(s)});else e.func(t,V._`${ve.default.data}, ${oL(o)}`,n.$async,()=>e.code(nR(r,o)).code(s))}function oL(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 sL(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 iL(e){let{schema:t,opts:r,gen:n}=e;cR(e,()=>{if(r.$comment&&t.$comment)fR(e);if(dL(e),n.let(ve.default.vErrors,null),n.let(ve.default.errors,0),r.unevaluated)aL(e);pR(e),mL(e)});return}function aL(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 cL(e,t){if(lR(e)){if(dR(e),uR(e)){uL(e,t);return}}gd.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 uL(e,t){let{schema:r,gen:n,opts:o}=e;if(o.$comment&&r.$comment)fR(e);pL(e),fL(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),lL(e)}function pR(e,t){if(e.opts.jtd)return oR(e,[],!1,t);let r=hd.getSchemaTypes(e.schema),n=hd.coerceAndCheckDataType(e,r);oR(e,r,!n,t)}function lL(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 dL(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 pL(e){let t=e.schema[e.opts.schemaId];if(t)e.baseId=aR.resolveUrl(e.opts.uriResolver,e.baseId,t)}function fL(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 mL(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)hL(e);t.return(V._`${ve.default.errors} === 0`)}}function hL({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)gL(e,t);o.block(()=>{for(let p of l.rules)d(p);d(l.post)});function d(p){if(!ws.shouldUseGroup(s,p))return;if(p.type){if(o.if(kn.checkDataType(p.type,i,c.strictNumbers)),sR(e,p),t.length===1&&t[0]===p.type&&r)o.else(),kn.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(ws.shouldUseRule(n,s))hR(e,s.keyword,s.definition,t.type)})}function gL(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;if(yL(e,t),!e.opts.allowUnionTypes)_L(e,t);vL(e,e.dataTypes)}function yL(e,t){if(!t.length)return;if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach((r)=>{if(!mR(e.dataTypes,r))Uh(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),bL(e,t)}function _L(e,t){if(t.length>1&&!(t.length===2&&t.includes("null")))Uh(e,"use allowUnionTypes to allow union type keyword")}function vL(e,t){let r=e.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&ws.shouldUseRule(e.schema,o)){let{type:s}=o.definition;if(s.length&&!s.some((i)=>SL(t,i)))Uh(e,`missing type "${s.join(",")}" for keyword "${n}"`)}}}function SL(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 bL(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 Uh(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,St.checkStrictMode(e,t,e.opts.strictTypes)}class Fh{constructor(e,t,r){if(xr.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,!xr.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._`${kn.checkDataTypes(a,t,o.opts.strictNumbers,kn.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=$s.getSubschema(this.it,e);$s.extendSubschemaData(r,this.it,e),$s.extendSubschemaMode(r,e);let n={...this.it,...r,items:void 0,props:void 0};return cL(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=Fh;function hR(e,t,r,n){let o=new Fh(e,r,t);if("code"in r)r.code(o,n);else if(o.$data&&r.validate)xr.funcKeywordCode(o,r);else if("macro"in r)xr.macroKeywordCode(o,r);else if(r.compile||r.validate)xr.funcKeywordCode(o,r)}var $L=/^\/(?:[^~]|~0|~1)*$/,wL=/^([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(!$L.test(e))throw Error(`Invalid JSON-pointer: ${e}`);o=e,s=ve.default.rootData}else{let u=wL.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 zs=D(function($R){Object.defineProperty($R,"__esModule",{value:!0});var Es=Ea();class bR extends Error{constructor(e,t,r,n){super(n||`can't resolve reference ${r} from id ${t}`);this.missingRef=Es.resolveUrl(e,t,r),this.missingSchema=Es.normalizeId(Es.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 nt=$e(),TL=za(),zo=nr(),ot=Ea(),yd=xe(),wR=Rs();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: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={}}}ER.SchemaEnv=Pa;function Hh(e){let t=RR.call(this,e);if(t)return t;let r=ot.getFullPath(this.opts.uriResolver,e.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:s}=this.opts,i=new nt.CodeGen(this.scope,{es5:n,lines:o,ownProperties:s}),a;if(e.$async)a=i.scopeValue("Error",{ref:TL.default,code:nt._`require("ajv/dist/runtime/validation_error").default`});let c=i.scopeName("validate");e.validateName=c;let u={gen:i,allErrors:this.opts.allErrors,data:zo.default.data,parentData:zo.default.parentData,parentDataProperty:zo.default.parentDataProperty,dataNames:[zo.default.data],dataPathArr:[nt.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:nt.stringify(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:nt.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:nt._`""`,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(zo.default.scope)}return ${d}`,this.opts.code.process)l=this.opts.code.process(l,e);let m=Function(`${zo.default.self}`,`${zo.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 nt.Name?void 0:h,items:g instanceof nt.Name?void 0:g,dynamicProps:h instanceof nt.Name,dynamicItems:g instanceof nt.Name},m.source)m.source.evaluated=nt.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=Hh;function IL(e,t,r){var n;r=ot.resolveUrl(this.opts.uriResolver,t,r);let o=e.refs[r];if(o)return o;let s=OL.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]=xL.call(this,s)}ER.resolveRef=IL;function xL(e){if(ot.inlineRef(e.schema,this.opts.inlineRefs))return e.schema;return e.validate?e:Hh.call(this,e)}function RR(e){for(let t of this._compilations)if(kL(t,e))return t}ER.getCompilingSchema=RR;function kL(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function OL(e,t){let r;while(typeof(r=this.refs[t])=="string")t=r;return r||this.schemas[t]||_d.call(this,e,t)}function _d(e,t){let r=this.opts.uriResolver.parse(t),n=ot._getFullPath(this.opts.uriResolver,r),o=ot.getFullPath(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===o)return Vh.call(this,r,e);let s=ot.normalizeId(n),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=_d.call(this,e,i);if(typeof(a===null||a===void 0?void 0:a.schema)!=="object")return;return Vh.call(this,r,a)}if(typeof(i===null||i===void 0?void 0:i.schema)!=="object")return;if(!i.validate)Hh.call(this,i);if(s===ot.normalizeId(t)){let{schema:a}=i,{schemaId:c}=this.opts,u=a[c];if(u)o=ot.resolveUrl(this.opts.uriResolver,o,u);return new Pa({schema:a,schemaId:c,root:e,baseId:o})}return Vh.call(this,r,i)}ER.resolveSchema=_d;var CL=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Vh(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[yd.unescapeFragment(a)];if(c===void 0)return;r=c;let u=typeof r==="object"&&r[this.opts.schemaId];if(!CL.has(a)&&u)t=ot.resolveUrl(this.opts.uriResolver,t,u)}let s;if(typeof r!="boolean"&&r.$ref&&!yd.schemaHasRulesButRef(r,this.RULES)){let a=ot.resolveUrl(this.opts.uriResolver,t,r.$ref);s=_d.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(QW,ML){ML.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 Wh=D(function(e8,AR){var LL=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Gh=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),DL=RegExp.prototype.test.bind(/^\d*$/u),Po=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),Jh=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),IR=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),Kh=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),UL=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 Ct(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 FL(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 VL=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),HL=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),ZL=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),GL=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function JL(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++){if(ZL(e[t]))continue;if(e[t]==="%"&&t+2<e.length&&Po(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 KL(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||!Gh(c))return;s+=2;continue}if(!VL(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 Zh(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&&HL(n))return n=n.toLowerCase(),{host:`[${n}]`,escapedHost:n,isIPV6:!1,isIPVFuture:!0};if(BL(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),!JL(o))return{host:e,isIPV6:!1,error:!0};n=n.slice(0,s)}let i=KL(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 BL(e,t){let r=0;for(let n=0;n<e.length;n++)if(e[n]===t)r++;return r}function WL(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 YL={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},XL=/[@/?#:]/g,QL=/[@/?#]/g;function xR(e,t){let r=t?QL:XL;return r.lastIndex=0,e.replace(r,(n)=>YL[n])}function kR(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(Po(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));if(t&&Jh(i))r+=i;else r+="%"+s;n+=2;continue}}r+=e[n]}return r}function e2(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(Po(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));if(i!=="."&&Jh(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+=Ct(o);else if(o<=56319&&r+1<e.length){let s=e.charCodeAt(r+1);if(s>=56320&&s<=57343)t+=Ct(65536+(o-55296<<10)+(s-56320)),r++;else t+=Ct(65533)}else t+=Ct(65533)}}return t}function t2(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(Po(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+=Ct(i);else if(i<=56319&&o+1<e.length){let a=e.charCodeAt(o+1);if(a>=56320&&a<=57343)r+=Ct(65536+(i-55296<<10)+(a-56320)),o++;else r+=Ct(65533)}else r+=Ct(65533)}}return r}function Bh(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(Po(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+=Ct(s);else if(s<=56319&&n+1<e.length){let i=e.charCodeAt(n+1);if(i>=56320&&i<=57343)r+=Ct(65536+(s-55296<<10)+(i-56320)),n++;else r+=Ct(65533)}else r+=Ct(65533)}}return r}function OR(e){return Bh(e,UL)}function r2(e){return Bh(e,Kh)}function n2(e){return Bh(e,Kh)}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 o2(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(Po(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));if(Jh(i))t+=i;else t+="%"+s;r+=2;continue}}if(Kh(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+=Ct(o);else if(o<=56319&&r+1<e.length){let s=e.charCodeAt(r+1);if(s>=56320&&s<=57343)t+=Ct(65536+(o-55296<<10)+(s-56320)),r++;else t+=Ct(65533)}else t+=Ct(65533)}}return t}function s2(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(Po(n)){t+="%"+n.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function i2(e){let t=[];if(e.userinfo!==void 0)t.push(OR(e.userinfo)),t.push("@");if(e.host!==void 0){let r=e.host;if(!Gh(r)){let n=Zh(r);if(n.isIPV6!==!0&&n.isIPVFuture!==!0)r=kR(r,!0),n=Zh(r);if(n.isIPV6===!0||n.isIPVFuture===!0)r=`[${n.escapedHost}]`;else r=xR(r,!1)}t.push(r)}if(typeof e.port==="number"||typeof e.port==="string"){let r=String(e.port);if(!DL(r))throw TypeError("URI port is malformed.");t.push(":"),t.push(r)}return t.length?t.join(""):void 0}AR.exports={nonSimpleDomain:GL,recomposeAuthority:i2,reescapeHostDelimiters:xR,normalizePercentEncoding:kR,normalizePathEncoding:e2,serializePathEncoding:t2,normalizeQueryFragmentEncoding:o2,encodeUserinfo:OR,encodeQuery:r2,encodeFragment:n2,escapePreservingEscapes:s2,removeDotSegments:WL,isIPv4:Gh,isUUID:LL,normalizeIPv6:Zh,stringArrayToHexStripped:FL}});var LR=D(function(t8,MR){var{isUUID:a2}=Wh(),c2=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,u2=["http","https","ws","wss","urn","urn:uuid"];function l2(e){return u2.indexOf(e)!==-1}function Yh(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 d2(e){return e.secure=Yh(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function p2(e){if(e.port===(Yh(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 f2(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(c2);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=Xh(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 m2(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=Xh(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 h2(e,t){let r=e;if(r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!a2(r.uuid)))r.error=r.error||"UUID is not valid.";return r}function g2(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var qR={scheme:"http",domainHost:!0,parse:NR,serialize:jR},y2={scheme:"https",domainHost:qR.domainHost,parse:NR,serialize:jR},vd={scheme:"ws",domainHost:!0,parse:d2,serialize:p2},_2={scheme:"wss",domainHost:vd.domainHost,parse:vd.parse,serialize:vd.serialize},v2={scheme:"urn",parse:f2,serialize:m2,skipNormalize:!0},S2={scheme:"urn:uuid",parse:h2,serialize:g2,skipNormalize:!0},Sd={http:qR,https:y2,ws:vd,wss:_2,urn:v2,"urn:uuid":S2};Object.setPrototypeOf(Sd,null);function Xh(e){return e&&(Sd[e]||Sd[e.toLowerCase()])||void 0}MR.exports={wsIsSecure:Yh,SCHEMES:Sd,isValidSchemeName:l2,getSchemeHandler:Xh}});var YR=D(function(r8,wd){var{normalizeIPv6:HR,removeDotSegments:xa,recomposeAuthority:b2,normalizePercentEncoding:Qh,normalizePathEncoding:$2,serializePathEncoding:DR,normalizeQueryFragmentEncoding:UR,encodeQuery:w2,encodeFragment:R2,reescapeHostDelimiters:E2,isIPv4:ZR,nonSimpleDomain:z2}=Wh(),{SCHEMES:GR,getSchemeHandler:eg}=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 P2(e,t){if(typeof e==="string")e=N2(e,t);else if(typeof e==="object")e=$d(To(e,t),t);return e}function T2(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}=bd(e,n),{parsed:l,malformedAuthorityOrPort:d,malformedPercentEncoding:p,malformedSchemeSpecific:m,malformedHost:h,malformedScheme:g}=bd(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=eg(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,To(_,n)}function KR(e,t,r,n){let o={};if(!n)e=$d(To(e,r),r),t=$d(To(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=xa(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=xa(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=xa(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=xa(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 I2(e,t,r){let n=VR(e,r),o=VR(t,r);return n!==void 0&&o!==void 0&&n===o}function To(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=eg(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=Qh(r.path);if(n.reference!=="suffix"&&r.scheme)r.scheme=FR(r.scheme),o.push(r.scheme,":");let c=b2(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=xa(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("?",w2(r.query));if(r.fragment!==void 0)o.push("#",R2(r.fragment));return o.join("")}var x2=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,k2=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,O2=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function C2(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 tg(e){return e[0]==="["&&e[e.length-1]==="]"}function A2(e){let t=e[4];return Ia(e[3])||t!==void 0&&!tg(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&&!tg(e.host)&&(t.domainHost||r&&r.domainHost)&&n===!1&&z2(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 bd(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(k2);if(d!==null&&d[1].indexOf("\\")!==-1)n.error="URI authority must not contain a literal backslash.",o=!0;let p=e.match(O2);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(x2);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=A2(m),s)n.error=n.error||"URI contains malformed percent-encoding.";if(isNaN(n.port))n.port=m[5];let h=C2(n,m);if(h!==void 0)n.error=n.error||h,o=!0;if(n.host)if(ZR(n.host)===!1){let y=tg(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=eg(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:Qh(n.host,!0);if(!l)_=Qh(_.toLowerCase());n.host=E2(_,l)}if(!g||g&&!g.skipNormalize){if(n.path)n.path=$2(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 $d(e,t){return bd(e,t).parsed}function N2(e,t){return WR(e,t).normalized}function WR(e,t){let{parsed:r,malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:s,malformedHost:i,malformedScheme:a}=bd(e,t);return{normalized:n||o||s||i||a?e:To(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:To(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 rg={SCHEMES:GR,normalize:P2,resolve:T2,resolveComponent:KR,equal:I2,serialize:To,parse:$d};wd.exports=rg;wd.exports.default=rg;wd.exports.fastUri=rg});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 og=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 q2=Rs();Object.defineProperty(Xr,"KeywordCxt",{enumerable:!0,get:function(){return q2.KeywordCxt}});var Ts=$e();Object.defineProperty(Xr,"_",{enumerable:!0,get:function(){return Ts._}});Object.defineProperty(Xr,"str",{enumerable:!0,get:function(){return Ts.str}});Object.defineProperty(Xr,"stringify",{enumerable:!0,get:function(){return Ts.stringify}});Object.defineProperty(Xr,"nil",{enumerable:!0,get:function(){return Ts.nil}});Object.defineProperty(Xr,"Name",{enumerable:!0,get:function(){return Ts.Name}});Object.defineProperty(Xr,"CodeGen",{enumerable:!0,get:function(){return Ts.CodeGen}});var M2=za(),sE=zs(),iE=Oh(),kr=Ta(),aE=$e(),Or=Ea(),On=Ra(),Ps=xe(),tE=PR(),L2=eE(),cE=(e,t)=>new RegExp(e,t);cE.code="new RegExp";var D2=["removeAdditional","useDefaults","coerceTypes"],U2=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),F2={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."},V2={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},rE=200;function H2(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,O;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:L2.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:(O=e.int32range)!==null&&O!==void 0?O:!0,uriResolver:Z}}class Rd{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...H2(e)};let{es5:t,lines:r}=this.opts.code;this.scope=new aE.ValueScope({scope:{},prefixes:U2,es5:t,lines:r}),this.logger=W2(e.logger);let n=e.validateFormats;if(e.validateFormats=!1,this.RULES=iE.getRules(),nE.call(this,F2,e,"NOT SUPPORTED"),nE.call(this,V2,e,"DEPRECATED","warn"),this._metaOpts=K2.call(this),e.formats)G2.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords)J2.call(this,e.keywords);if(typeof e.meta=="object")this.addMetaSchema(e.meta);Z2.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=Or.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 kr.SchemaEnv({schema:{},schemaId:r});if(t=kr.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=Or.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(X2.call(this,r,t),!t)return Ps.eachItem(r,(o)=>ng.call(this,o)),this;eD.call(this,t);let n={...t,type:On.getJSONTypes(t.type),schemaType:On.getJSONTypes(t.schemaType)};return Ps.eachItem(r,n.type.length===0?(o)=>ng.call(this,o,n):(o)=>n.type.forEach((s)=>ng.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=Or.normalizeId(s||r);let c=Or.getSchemaRefs.call(this,e,r);if(a=new kr.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 kr.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{kr.compileSchema.call(this,e)}finally{this.opts=t}}}Rd.ValidationError=M2.default;Rd.MissingRefError=sE.default;Xr.default=Rd;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=Or.normalizeId(e),this.schemas[e]||this.refs[e]}function Z2(){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 G2(){for(let e in this.opts.formats){let t=this.opts.formats[e];if(t)this.addFormat(e,t)}}function J2(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 K2(){let e={...this.opts};for(let t of D2)delete e[t];return e}var B2={log(){},warn(){},error(){}};function W2(e){if(e===!1)return B2;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 Y2=/^[a-z_$][a-z0-9_$:-]*$/i;function X2(e,t){let{RULES:r}=this;if(Ps.eachItem(e,(n)=>{if(r.keywords[n])throw Error(`Keyword ${n} is already defined`);if(!Y2.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 ng(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:On.getJSONTypes(t.type),schemaType:On.getJSONTypes(t.schemaType)}};if(t.before)Q2.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 Q2(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 eD(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 tD={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function uE(e){return{anyOf:[e,tD]}}});var dE=D(function(lE){Object.defineProperty(lE,"__esModule",{value:!0});var oD={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};lE.default=oD});var Td=D(function(fE){Object.defineProperty(fE,"__esModule",{value:!0});fE.callRef=fE.getValidate=void 0;var iD=zs(),zd=sr(),De=$e(),Is=nr(),Pd=Ta(),Cn=xe(),aD={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=Pd.resolveRef.call(c,u,o,r);if(l===void 0)throw new iD.default(n.opts.uriResolver,o,r);if(l instanceof Pd.SchemaEnv)return p(l);return m(l);function d(){if(s===u)return Ed(e,i,s,s.$async);let h=t.scopeValue("root",{ref:u});return Ed(e,De._`${h}.validate`,u,u.$async)}function p(h){let g=pE(e,h);Ed(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 Ed(e,t,r,n){let{gen:o,it:s}=e,{allErrors:i,schemaEnv:a,opts:c}=s,u=c.passContext?Is.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 ${zd.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(zd.callValidateCode(e,t,u),()=>m(t),()=>p(t))}function p(h){let g=De._`${h}.errors`;o.assign(Is.default.vErrors,De._`${Is.default.vErrors} === null ? ${g} : ${Is.default.vErrors}.concat(${g})`),o.assign(Is.default.errors,De._`${Is.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=Ed;fE.default=aD});var sg=D(function(hE){Object.defineProperty(hE,"__esModule",{value:!0});var lD=dE(),dD=Td(),pD=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",lD.default,dD.default];hE.default=pD});var yE=D(function(gE){Object.defineProperty(gE,"__esModule",{value:!0});var Nn=$e(),An=Nn.operators,Id={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}},mD={message:({keyword:e,schemaCode:t})=>Nn.str`must be ${Id[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>Nn._`{comparison: ${Id[e].okStr}, limit: ${t}}`},hD={keyword:Object.keys(Id),type:"number",schemaType:"number",$data:!0,error:mD,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data(Nn._`${r} ${Id[t].fail} ${n} || isNaN(${r})`)}};gE.default=hD});var vE=D(function(_E){Object.defineProperty(_E,"__esModule",{value:!0});var Cr=$e(),yD={message:({schemaCode:e})=>Cr.str`must be multiple of ${e}`,params:({schemaCode:e})=>Cr._`{multipleOf: ${e}}`},_D={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:yD,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=_D});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=xe(),bD=$E(),$D={message({keyword:e,schemaCode:t}){return Ht.str`must NOT have ${e==="maxLength"?"more":"fewer"} than ${t} characters`},params:({schemaCode:e})=>Ht._`{limit: ${e}}`},wD={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:$D,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,bD.default)}(${r})`;e.fail$data(Ht._`${i} ${s} ${n}`)}};RE.default=wD});var IE=D(function(TE){Object.defineProperty(TE,"__esModule",{value:!0});var zE=sr(),PE=xe(),ir=$e(),ED={message:({schemaCode:e})=>ir.str`must match pattern "${e}"`,params:({schemaCode:e})=>ir._`{pattern: ${e}}`},zD={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:ED,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=zD});var kE=D(function(xE){Object.defineProperty(xE,"__esModule",{value:!0});var Ar=$e(),TD={message({keyword:e,schemaCode:t}){return Ar.str`must NOT have ${e==="maxProperties"?"more":"fewer"} than ${t} properties`},params:({schemaCode:e})=>Ar._`{limit: ${e}}`},ID={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:TD,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}`)}};xE.default=ID});var AE=D(function(CE){Object.defineProperty(CE,"__esModule",{value:!0});var Nr=sr(),jr=$e(),OE=xe(),kD={message:({params:{missingProperty:e}})=>jr.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>jr._`{missingProperty: ${e}}`},OD={keyword:"required",type:"object",schemaType:"array",$data:!0,error:kD,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)`;OE.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=OD});var jE=D(function(NE){Object.defineProperty(NE,"__esModule",{value:!0});var qr=$e(),AD={message({keyword:e,schemaCode:t}){return qr.str`must NOT have ${e==="maxItems"?"more":"fewer"} than ${t} items`},params:({schemaCode:e})=>qr._`{limit: ${e}}`},ND={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:AD,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=ND});var xd=D(function(ME){Object.defineProperty(ME,"__esModule",{value:!0});var qE=Lh();qE.code='require("ajv/dist/runtime/equal").default';ME.default=qE});var UE=D(function(DE){Object.defineProperty(DE,"__esModule",{value:!0});var xs=Ra(),Ce=$e(),LE=xe(),MD=xd(),LD={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}}`},DD={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:LD,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?xs.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=xs.checkDataTypes(u,_,a.opts.strictNumbers,xs.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,MD.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=DD});var HE=D(function(VE){Object.defineProperty(VE,"__esModule",{value:!0});var ks=$e(),FE=xe(),FD=xd(),VD={message:"must be equal to constant",params:({schemaCode:e})=>ks._`{allowedValue: ${e}}`},HD={keyword:"const",$data:!0,error:VD,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,FD.default)}(${r}, ${o})`);else e.fail(ks._`${s} !== ${r}`)}};VE.default=HD});var JE=D(function(GE){Object.defineProperty(GE,"__esModule",{value:!0});var Mr=$e(),ZE=xe(),GD=xd(),JD={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>Mr._`{allowedValues: ${e}}`},KD={keyword:"enum",schemaType:"array",$data:!0,error:JD,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,GD.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=KD});var ig=D(function(KE){Object.defineProperty(KE,"__esModule",{value:!0});var WD=yE(),YD=vE(),XD=EE(),QD=IE(),eU=kE(),tU=AE(),rU=jE(),nU=UE(),oU=HE(),sU=JE(),iU=[WD.default,YD.default,XD.default,QD.default,eU.default,tU.default,rU.default,nU.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},oU.default,sU.default];KE.default=iU});var ag=D(function(WE){Object.defineProperty(WE,"__esModule",{value:!0});WE.validateAdditionalItems=void 0;var Zt=$e(),Os=xe(),cU={message:({params:{len:e}})=>Zt.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Zt._`{limit: ${e}}`},uU={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:cU,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=uU});var cg=D(function(ez){Object.defineProperty(ez,"__esModule",{value:!0});ez.validateTuple=void 0;var kd=$e(),jn=xe(),XE=sr(),dU={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=dU});var oz=D(function(nz){Object.defineProperty(nz,"__esModule",{value:!0});var rz=cg(),fU={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(e)=>rz.validateTuple(e,"items")};nz.default=fU});var uz=D(function(cz){Object.defineProperty(cz,"__esModule",{value:!0});var Od=$e(),sz=xe(),iz=sr(),az=ag(),hU={message:({params:{len:e}})=>Od.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Od._`{limit: ${e}}`},gU={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:hU,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=gU});var dz=D(function(lz){Object.defineProperty(lz,"__esModule",{value:!0});var Be=$e(),qn=xe(),_U={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}}`},vU={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:_U,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=vU});var Cd=D(function(hz){Object.defineProperty(hz,"__esModule",{value:!0});hz.validateSchemaDeps=hz.validatePropertyDeps=hz.error=void 0;var Cs=$e(),pz=xe(),Lr=sr();hz.error={message:({params:{property:e,depsCount:t,deps:r}})=>Cs.str`must have ${t===1?"property":"properties"} ${r} when property ${e} is present`,params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>Cs._`{property: ${e},
|
|
6
|
+
|| ${i} === "boolean" || ${o} === null`).assign(a,Q._`[${o}]`)}}}function gM({gen:e,parentData:t,parentDataProperty:r},n){e.if(Q._`${t} !== undefined`,()=>e.assign(Q._`${t}[${r}]`,n))}function Lh(e,t,r,n=bs.Correct){let o=n===bs.Correct?Q.operators.EQ:Q.operators.NEQ,s;switch(e){case"null":return Q._`${t} ${o} null`;case"array":s=Q._`Array.isArray(${t})`;break;case"object":s=Q._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":s=i(Q._`!(${t} % 1) && !isNaN(${t})`);break;case"number":s=i();break;default:return Q._`typeof ${t} ${o} ${e}`}return n===bs.Correct?s:Q.not(s);function i(a=Q.nil){return Q.and(Q._`typeof ${t} == "number"`,a,r?Q._`isFinite(${t})`:Q.nil)}}L$.checkDataType=Lh;function Dh(e,t,r,n){if(e.length===1)return Lh(e[0],t,r,n);let o,s=hd.toHash(e);if(s.array&&s.object){let i=Q._`typeof ${t} != "object"`;o=s.null?i:Q._`!${t} || ${i}`,delete s.null,delete s.array,delete s.object}else o=Q.nil;if(s.number)delete s.integer;for(let i in s)o=Q.and(o,Lh(i,t,r,n));return o}L$.checkDataTypes=Dh;var yM={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?Q._`{type: ${e}}`:Q._`{type: ${t}}`};function Uh(e){let t=_M(e);j$.reportError(t,yM)}L$.reportTypeError=Uh;function _M(e){let{gen:t,data:r,schema:n}=e,o=hd.schemaRefOrVal(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:e}}});var Z$=D(function(V$){Object.defineProperty(V$,"__esModule",{value:!0});V$.assignDefaults=void 0;var or=we(),F$=Ie();function EM(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let o in r)U$(e,o,r[o].default);else if(t==="array"&&Array.isArray(n))n.forEach((o,s)=>U$(e,s,o.default))}V$.assignDefaults=EM;function U$(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){F$.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(K$){Object.defineProperty(K$,"__esModule",{value:!0});K$.validateUnion=K$.validateArray=K$.usePattern=K$.callValidateCode=K$.schemaProperties=K$.allSchemaProperties=K$.noPropertyInData=K$.propertyInData=K$.isOwnProperty=K$.hasPropFunc=K$.reportMissingProp=K$.checkMissingProp=K$.checkReportMissingProp=void 0;var _e=we(),ws=Ie(),In=nr(),G$=Ie();function zM(e,t){let{gen:r,data:n,it:o}=e;r.if(Vh(r,n,t,o.opts.ownProperties),()=>{e.setParams({missingProperty:_e._`${t}`},!0),e.error()})}K$.checkReportMissingProp=zM;function PM({gen:e,data:t,it:{opts:r}},n,o){return _e.or(...n.map((s)=>_e.and(Vh(e,t,s,r.ownProperties),_e._`${o} = ${s}`)))}K$.checkMissingProp=PM;function TM(e,t){e.setParams({missingProperty:t},!0),e.error()}K$.reportMissingProp=TM;function J$(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:_e._`Object.prototype.hasOwnProperty`})}K$.hasPropFunc=J$;function Fh(e,t,r){return _e._`${J$(e)}.call(${t}, ${r})`}K$.isOwnProperty=Fh;function kM(e,t,r,n){let o=_e._`${t}${_e.getProperty(r)} !== undefined`;return n?_e._`${o} && ${Fh(e,t,r)}`:o}K$.propertyInData=kM;function Vh(e,t,r,n){let o=_e._`${t}${_e.getProperty(r)} === undefined`;return n?_e.or(o,_e.not(Fh(e,t,r))):o}K$.noPropertyInData=Vh;function B$(e){return e?Object.keys(e).filter((t)=>t!=="__proto__"):[]}K$.allSchemaProperties=B$;function IM(e,t){return B$(t).filter((r)=>!ws.alwaysValidSchema(e,t[r]))}K$.schemaProperties=IM;function xM({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})`}K$.callValidateCode=xM;var CM=_e._`new RegExp`;function OM({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"?CM:G$.useFunc(e,o)}(${r}, ${n})`})}K$.usePattern=OM;function AM(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:ws.Type.Num},s),t.if(_e.not(s),a)})}}K$.validateArray=AM;function NM(e){let{gen:t,schema:r,keyword:n,it:o}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(r.some((c)=>ws.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))}K$.validateUnion=NM});var nR=D(function(tR){Object.defineProperty(tR,"__esModule",{value:!0});tR.validateKeywordUsage=tR.validSchemaType=tR.funcKeywordCode=tR.macroKeywordCode=void 0;var Me=we(),Po=nr(),X$=sr(),Q$=Ta();function BM(e,t){let{gen:r,keyword:n,schema:o,parentSchema:s,it:i}=e,a=t.macro.call(i.self,o,s,i),c=eR(r,n,a);if(i.opts.validateSchema!==!1)i.self.validateSchema(a,!0);let u=r.name("valid");e.subschema({schema:a,schemaPath:Me.nil,errSchemaPath:`${i.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}tR.macroKeywordCode=BM;function KM(e,t){var r;let{gen:n,keyword:o,schema:s,parentSchema:i,$data:a,it:c}=e;YM(c,t);let u=!a&&t.compile?t.compile.call(c.self,s,i,c):t.validate,l=eR(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(y(),t.modifying)Y$(e);_(()=>e.error())}else{let g=t.async?f():h();if(t.modifying)Y$(e);_(()=>WM(e,g))}}function f(){let g=n.let("ruleErrs",null);return n.try(()=>y(Me._`await `),(S)=>n.assign(d,!1).if(Me._`${S} instanceof ${c.ValidationError}`,()=>n.assign(g,Me._`${S}.errors`),()=>n.throw(S))),g}function h(){let g=Me._`${l}.errors`;return n.assign(g,null),y(Me.nil),g}function y(g=t.async?Me._`await `:Me.nil){let S=c.opts.passContext?Po.default.this:Po.default.self,v=!(("compile"in t)&&!a||t.schema===!1);n.assign(d,Me._`${g}${X$.callValidateCode(e,l,S,v)}`,t.modifying)}function _(g){var S;n.if(Me.not((S=t.valid)!==null&&S!==void 0?S:d),g)}}tR.funcKeywordCode=KM;function Y$(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,Me._`${n.parentData}[${n.parentDataProperty}]`))}function WM(e,t){let{gen:r}=e;r.if(Me._`Array.isArray(${t})`,()=>{r.assign(Po.default.vErrors,Me._`${Po.default.vErrors} === null ? ${t} : ${Po.default.vErrors}.concat(${t})`).assign(Po.default.errors,Me._`${Po.default.vErrors}.length`),Q$.extendErrors(e)},()=>e.error())}function YM({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}function eR(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:Me.stringify(r)})}function XM(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")}tR.validSchemaType=XM;function QM({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)}}}tR.validateKeywordUsage=QM});var iR=D(function(oR){Object.defineProperty(oR,"__esModule",{value:!0});oR.extendSubschemaMode=oR.extendSubschemaData=oR.getSubschema=void 0;var pt=we(),gd=Ie();function nL(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:pt._`${e.schemaPath}${pt.getProperty(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:pt._`${e.schemaPath}${pt.getProperty(t)}${pt.getProperty(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${gd.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')}oR.getSubschema=nL;function oL(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",pt._`${t.data}${pt.getProperty(r)}`,!0);c(p),e.errorPath=pt.str`${u}${gd.getErrorPath(r,n,d.jsPropertySyntax)}`,e.parentDataProperty=pt._`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(o!==void 0){let u=o instanceof pt.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]}}oR.extendSubschemaData=oL;function sL(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}oR.extendSubschemaMode=sL});var Hh=D(function(Y8,aR){aR.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 uR=D(function(X8,cR){var xn=cR.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(){};yd(t,n,o,e,"",e)};xn.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};xn.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};xn.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};xn.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 yd(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 xn.arrayKeywords)for(var p=0;p<d.length;p++)yd(e,t,r,d[p],o+"/"+l+"/"+p,s,o,l,n,p)}else if(l in xn.propsKeywords){if(d&&typeof d=="object")for(var f in d)yd(e,t,r,d[f],o+"/"+l+"/"+cL(f),s,o,l,n,f)}else if(l in xn.keywords||e.allKeys&&!(l in xn.skipKeywords))yd(e,t,r,d,o+"/"+l,s,o,l,n)}r(n,o,s,i,a,c,u)}}function cL(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var Ia=D(function(mR){Object.defineProperty(mR,"__esModule",{value:!0});mR.getSchemaRefs=mR.resolveUrl=mR.normalizeId=mR._getFullPath=mR.getFullPath=mR.inlineRef=void 0;var lR=Ie(),uL=Hh(),lL=uR(),dL=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function pL(e,t=!0){if(typeof e=="boolean")return!0;if(t===!0)return!Zh(e);if(!t)return!1;return dR(e)<=t}mR.inlineRef=pL;var fL=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Zh(e){for(let t in e){if(fL.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(Zh))return!0;if(typeof r=="object"&&Zh(r))return!0}return!1}function dR(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,dL.has(r))continue;if(typeof e[r]=="object")lR.eachItem(e[r],(n)=>t+=dR(n));if(t===1/0)return 1/0}return t}function pR(e,t="",r){if(r!==!1)t=$s(t);let n=e.parse(t);return fR(e,n)}mR.getFullPath=pR;function fR(e,t){return e.serialize(t).split("#")[0]+"#"}mR._getFullPath=fR;var mL=/#\/?$/;function $s(e){return e?e.replace(mL,""):""}mR.normalizeId=$s;function hL(e,t,r){return r=$s(r),e.resolve(t,r)}mR.resolveUrl=hL;var gL=/^[a-z_][-a-z0-9._]*$/i;function yL(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=$s(e[r]||t),s={"":o},i=pR(n,o,!1),a={},c=new Set;return lL(e,{allKeys:!0},(d,p,f,h)=>{if(h===void 0)return;let y=i+p,_=s[h];if(typeof d[r]=="string")_=g.call(this,d[r]);S.call(this,d.$anchor),S.call(this,d.$dynamicAnchor),s[p]=_;function g(v){let w=this.opts.uriResolver.resolve;if(v=$s(_?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!==$s(y))if(v[0]==="#")u(d,a[v],v),a[v]=d;else this.refs[v]=y;return v}function S(v){if(typeof v=="string"){if(!gL.test(v))throw Error(`invalid anchor "${v}"`);g.call(this,`#${v}`)}}}),a;function u(d,p,f){if(p!==void 0&&!uL(d,p))throw l(f)}function l(d){return Error(`reference "${d}" resolves to more than one schema`)}}mR.getSchemaRefs=yL});var zs=D(function(IR){Object.defineProperty(IR,"__esModule",{value:!0});IR.getData=IR.KeywordCxt=IR.validateFunctionCode=void 0;var vd=P$(),_d=ka(),Es=Mh(),Cn=ka(),vR=Z$(),xr=nR(),Rs=iR(),V=we(),ve=nr(),SR=Ia(),bt=Ie(),Ir=Ta();function $L(e){if($R(e)){if(RR(e),wR(e)){zL(e);return}}bR(e,()=>vd.topBoolOrEmptySchema(e))}IR.validateFunctionCode=$L;function bR({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"; ${gR(r,o)}`),EL(e,o),e.code(s)});else e.func(t,V._`${ve.default.data}, ${RL(o)}`,n.$async,()=>e.code(gR(r,o)).code(s))}function RL(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 zL(e){let{schema:t,opts:r,gen:n}=e;bR(e,()=>{if(r.$comment&&t.$comment)zR(e);if(xL(e),n.let(ve.default.vErrors,null),n.let(ve.default.errors,0),r.unevaluated)PL(e);ER(e),AL(e)});return}function PL(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 gR(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?V._`/*# sourceURL=${r} */`:V.nil}function TL(e,t){if($R(e)){if(RR(e),wR(e)){kL(e,t);return}}vd.boolOrEmptySchema(e,t)}function wR({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 $R(e){return typeof e.schema!="boolean"}function kL(e,t){let{schema:r,gen:n,opts:o}=e;if(o.$comment&&r.$comment)zR(e);CL(e),OL(e);let s=n.const("_errs",ve.default.errors);ER(e,s),n.var(t,V._`${s} === ${ve.default.errors}`)}function RR(e){bt.checkUnknownRules(e),IL(e)}function ER(e,t){if(e.opts.jtd)return yR(e,[],!1,t);let r=_d.getSchemaTypes(e.schema),n=_d.coerceAndCheckDataType(e,r);yR(e,r,!n,t)}function IL(e){let{schema:t,errSchemaPath:r,opts:n,self:o}=e;if(t.$ref&&n.ignoreKeywordsWithRef&&bt.schemaHasRulesButRef(t,o.RULES))o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function xL(e){let{schema:t,opts:r}=e;if(t.default!==void 0&&r.useDefaults&&r.strictSchema)bt.checkStrictMode(e,"default is ignored in the schema root")}function CL(e){let t=e.schema[e.opts.schemaId];if(t)e.baseId=SR.resolveUrl(e.opts.uriResolver,e.baseId,t)}function OL(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}function zR({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 AL(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)NL(e);t.return(V._`${ve.default.errors} === 0`)}}function NL({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 yR(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||!bt.schemaHasRulesButRef(s,l))){o.block(()=>TR(e,"$ref",l.all.$ref.definition));return}if(!c.jtd)jL(e,t);o.block(()=>{for(let p of l.rules)d(p);d(l.post)});function d(p){if(!Es.shouldUseGroup(s,p))return;if(p.type){if(o.if(Cn.checkDataType(p.type,i,c.strictNumbers)),_R(e,p),t.length===1&&t[0]===p.type&&r)o.else(),Cn.reportTypeError(e);o.endIf()}else _R(e,p);if(!a)o.if(V._`${ve.default.errors} === ${n||0}`)}}function _R(e,t){let{gen:r,schema:n,opts:{useDefaults:o}}=e;if(o)vR.assignDefaults(e,t.type);r.block(()=>{for(let s of t.rules)if(Es.shouldUseRule(n,s))TR(e,s.keyword,s.definition,t.type)})}function jL(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;if(qL(e,t),!e.opts.allowUnionTypes)ML(e,t);LL(e,e.dataTypes)}function qL(e,t){if(!t.length)return;if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach((r)=>{if(!PR(e.dataTypes,r))Gh(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),UL(e,t)}function ML(e,t){if(t.length>1&&!(t.length===2&&t.includes("null")))Gh(e,"use allowUnionTypes to allow union type keyword")}function LL(e,t){let r=e.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&Es.shouldUseRule(e.schema,o)){let{type:s}=o.definition;if(s.length&&!s.some((i)=>DL(t,i)))Gh(e,`missing type "${s.join(",")}" for keyword "${n}"`)}}}function DL(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function PR(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function UL(e,t){let r=[];for(let n of e.dataTypes)if(PR(t,n))r.push(n);else if(t.includes("integer")&&n==="number")r.push("integer");e.dataTypes=r}function Gh(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,bt.checkStrictMode(e,t,e.opts.strictTypes)}class Jh{constructor(e,t,r){if(xr.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=bt.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",kR(this.$data,e));else if(this.schemaCode=this.schemaValue,!xr.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._`${Cn.checkDataTypes(a,t,o.opts.strictNumbers,Cn.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=Rs.getSubschema(this.it,e);Rs.extendSubschemaData(r,this.it,e),Rs.extendSubschemaMode(r,e);let n={...this.it,...r,items:void 0,props:void 0};return TL(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=bt.mergeEvaluated.props(n,e.props,r.props,t);if(r.items!==!0&&e.items!==void 0)r.items=bt.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}}IR.KeywordCxt=Jh;function TR(e,t,r,n){let o=new Jh(e,r,t);if("code"in r)r.code(o,n);else if(o.$data&&r.validate)xr.funcKeywordCode(o,r);else if("macro"in r)xr.macroKeywordCode(o,r);else if(r.compile||r.validate)xr.funcKeywordCode(o,r)}var FL=/^\/(?:[^~]|~0|~1)*$/,VL=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function kR(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let o,s;if(e==="")return ve.default.rootData;if(e[0]==="/"){if(!FL.test(e))throw Error(`Invalid JSON-pointer: ${e}`);o=e,s=ve.default.rootData}else{let u=VL.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(bt.unescapeJsonPointer(u))}`,i=V._`${i} && ${s}`;return i;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${t}`}}IR.getData=kR});var xa=D(function(OR){Object.defineProperty(OR,"__esModule",{value:!0});class CR extends Error{constructor(e){super("validation failed");this.errors=e,this.ajv=this.validation=!0}}OR.default=CR});var Ts=D(function(NR){Object.defineProperty(NR,"__esModule",{value:!0});var Ps=Ia();class AR extends Error{constructor(e,t,r,n){super(n||`can't resolve reference ${r} from id ${t}`);this.missingRef=Ps.resolveUrl(e,t,r),this.missingSchema=Ps.normalizeId(Ps.getFullPath(e,this.missingRef))}}NR.default=AR});var Oa=D(function(MR){Object.defineProperty(MR,"__esModule",{value:!0});MR.resolveSchema=MR.getCompilingSchema=MR.resolveRef=MR.compileSchema=MR.SchemaEnv=void 0;var st=we(),BL=xa(),To=nr(),it=Ia(),Sd=Ie(),jR=zs();class Ca{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:it.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={}}}MR.SchemaEnv=Ca;function Kh(e){let t=qR.call(this,e);if(t)return t;let r=it.getFullPath(this.opts.uriResolver,e.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:s}=this.opts,i=new st.CodeGen(this.scope,{es5:n,lines:o,ownProperties:s}),a;if(e.$async)a=i.scopeValue("Error",{ref:BL.default,code:st._`require("ajv/dist/runtime/validation_error").default`});let c=i.scopeName("validate");e.validateName=c;let u={gen:i,allErrors:this.opts.allErrors,data:To.default.data,parentData:To.default.parentData,parentDataProperty:To.default.parentDataProperty,dataNames:[To.default.data],dataPathArr:[st.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:st.stringify(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:st.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:st._`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),jR.validateFunctionCode(u),i.optimize(this.opts.code.optimize);let d=i.toString();if(l=`${i.scopeRefs(To.default.scope)}return ${d}`,this.opts.code.process)l=this.opts.code.process(l,e);let f=Function(`${To.default.self}`,`${To.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:f}),f.errors=null,f.schema=e.schema,f.schemaEnv=e,e.$async)f.$async=!0;if(this.opts.code.source===!0)f.source={validateName:c,validateCode:d,scopeValues:i._values};if(this.opts.unevaluated){let{props:h,items:y}=u;if(f.evaluated={props:h instanceof st.Name?void 0:h,items:y instanceof st.Name?void 0:y,dynamicProps:h instanceof st.Name,dynamicItems:y instanceof st.Name},f.source)f.source.evaluated=st.stringify(f.evaluated)}return e.validate=f,e}catch(d){if(delete e.validate,delete e.validateName,l)this.logger.error("Error compiling schema, function code:",l);throw d}finally{this._compilations.delete(e)}}MR.compileSchema=Kh;function KL(e,t,r){var n;r=it.resolveUrl(this.opts.uriResolver,t,r);let o=e.refs[r];if(o)return o;let s=XL.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 Ca({schema:i,schemaId:a,root:e,baseId:t})}if(s===void 0)return;return e.refs[r]=WL.call(this,s)}MR.resolveRef=KL;function WL(e){if(it.inlineRef(e.schema,this.opts.inlineRefs))return e.schema;return e.validate?e:Kh.call(this,e)}function qR(e){for(let t of this._compilations)if(YL(t,e))return t}MR.getCompilingSchema=qR;function YL(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function XL(e,t){let r;while(typeof(r=this.refs[t])=="string")t=r;return r||this.schemas[t]||bd.call(this,e,t)}function bd(e,t){let r=this.opts.uriResolver.parse(t),n=it._getFullPath(this.opts.uriResolver,r),o=it.getFullPath(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===o)return Bh.call(this,r,e);let s=it.normalizeId(n),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=bd.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)Kh.call(this,i);if(s===it.normalizeId(t)){let{schema:a}=i,{schemaId:c}=this.opts,u=a[c];if(u)o=it.resolveUrl(this.opts.uriResolver,o,u);return new Ca({schema:a,schemaId:c,root:e,baseId:o})}return Bh.call(this,r,i)}MR.resolveSchema=bd;var QL=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Bh(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[Sd.unescapeFragment(a)];if(c===void 0)return;r=c;let u=typeof r==="object"&&r[this.opts.schemaId];if(!QL.has(a)&&u)t=it.resolveUrl(this.opts.uriResolver,t,u)}let s;if(typeof r!="boolean"&&r.$ref&&!Sd.schemaHasRulesButRef(r,this.RULES)){let a=it.resolveUrl(this.opts.uriResolver,t,r.$ref);s=bd.call(this,n,a)}let{schemaId:i}=this.opts;if(s=s||new Ca({schema:r,schemaId:i,root:n,baseId:t}),s.schema!==s.root.schema)return s;return}});var DR=D(function(oY,o2){o2.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 tg=D(function(sY,JR){var s2=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Yh=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),i2=RegExp.prototype.test.bind(/^\d*$/u),ko=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),Xh=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),FR=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),Qh=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),a2=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 c2(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 u2=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),l2=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),d2=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),p2=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function f2(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++){if(d2(e[t]))continue;if(e[t]==="%"&&t+2<e.length&&ko(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function UR(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 m2(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||!Yh(c))return;s+=2;continue}if(!u2(c))return;o[a]=parseInt(c,16).toString(16),s++}if(t===-1){if(s!==8)return;return UR(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 UR(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 n=t?e.slice(1,-1):e;if(t&&l2(n))return n=n.toLowerCase(),{host:`[${n}]`,escapedHost:n,isIPV6:!1,isIPVFuture:!0};if(h2(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),!f2(o))return{host:e,isIPV6:!1,error:!0};n=n.slice(0,s)}let i=m2(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 h2(e,t){let r=0;for(let n=0;n<e.length;n++)if(e[n]===t)r++;return r}function g2(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 y2={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},_2=/[@/?#:]/g,v2=/[@/?#]/g;function VR(e,t){let r=t?v2:_2;return r.lastIndex=0,e.replace(r,(n)=>y2[n])}function HR(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(ko(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));if(t&&Xh(i))r+=i;else r+="%"+s;n+=2;continue}}r+=e[n]}return r}function S2(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(ko(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));if(i!=="."&&Xh(i))t+=i;else t+="%"+s;r+=2;continue}}if(FR(n))t+=n;else{let o=e.charCodeAt(r);if(o<128)t+=GR(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 b2(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(ko(i)){r+="%"+i.toUpperCase(),o+=2;continue}}if(s==="/")n=!1;if(FR(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 eg(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(ko(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 ZR(e){return eg(e,a2)}function w2(e){return eg(e,Qh)}function $2(e){return eg(e,Qh)}function GR(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 R2(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(ko(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));if(Xh(i))t+=i;else t+="%"+s;r+=2;continue}}if(Qh(n))t+=n;else{let o=e.charCodeAt(r);if(o<128)t+=GR(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(ko(n)){t+="%"+n.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function z2(e){let t=[];if(e.userinfo!==void 0)t.push(ZR(e.userinfo)),t.push("@");if(e.host!==void 0){let r=e.host;if(!Yh(r)){let n=Wh(r);if(n.isIPV6!==!0&&n.isIPVFuture!==!0)r=HR(r,!0),n=Wh(r);if(n.isIPV6===!0||n.isIPVFuture===!0)r=`[${n.escapedHost}]`;else r=VR(r,!1)}t.push(r)}if(typeof e.port==="number"||typeof e.port==="string"){let r=String(e.port);if(!i2(r))throw TypeError("URI port is malformed.");t.push(":"),t.push(r)}return t.length?t.join(""):void 0}JR.exports={nonSimpleDomain:p2,recomposeAuthority:z2,reescapeHostDelimiters:VR,normalizePercentEncoding:HR,normalizePathEncoding:S2,serializePathEncoding:b2,normalizeQueryFragmentEncoding:R2,encodeUserinfo:ZR,encodeQuery:w2,encodeFragment:$2,escapePreservingEscapes:E2,removeDotSegments:g2,isIPv4:Yh,isUUID:s2,normalizeIPv6:Wh,stringArrayToHexStripped:c2}});var XR=D(function(iY,YR){var{isUUID:P2}=tg(),T2=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,k2=["http","https","ws","wss","urn","urn:uuid"];function I2(e){return k2.indexOf(e)!==-1}function rg(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 BR(e){if(!e.host)e.error=e.error||"HTTP URIs must have a host.";return e}function KR(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 x2(e){return e.secure=rg(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function C2(e){if(e.port===(rg(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 O2(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(T2);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=ng(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 A2(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=ng(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 N2(e,t){let r=e;if(r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!P2(r.uuid)))r.error=r.error||"UUID is not valid.";return r}function j2(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var WR={scheme:"http",domainHost:!0,parse:BR,serialize:KR},q2={scheme:"https",domainHost:WR.domainHost,parse:BR,serialize:KR},wd={scheme:"ws",domainHost:!0,parse:x2,serialize:C2},M2={scheme:"wss",domainHost:wd.domainHost,parse:wd.parse,serialize:wd.serialize},L2={scheme:"urn",parse:O2,serialize:A2,skipNormalize:!0},D2={scheme:"urn:uuid",parse:N2,serialize:j2,skipNormalize:!0},$d={http:WR,https:q2,ws:wd,wss:M2,urn:L2,"urn:uuid":D2};Object.setPrototypeOf($d,null);function ng(e){return e&&($d[e]||$d[e.toLowerCase()])||void 0}YR.exports={wsIsSecure:rg,SCHEMES:$d,isValidSchemeName:I2,getSchemeHandler:ng}});var lE=D(function(aY,zd){var{normalizeIPv6:nE,removeDotSegments:Na,recomposeAuthority:U2,normalizePercentEncoding:og,normalizePathEncoding:F2,serializePathEncoding:QR,normalizeQueryFragmentEncoding:eE,encodeQuery:V2,encodeFragment:H2,reescapeHostDelimiters:Z2,isIPv4:oE,nonSimpleDomain:G2}=tg(),{SCHEMES:sE,getSchemeHandler:sg}=XR(),iE=/^[A-Za-z][A-Za-z0-9+.-]*$/u;function tE(e){let t=unescape(String(e));if(!iE.test(t))throw TypeError("URI scheme is malformed.");return t}function J2(e,t){if(typeof e==="string")e=tD(e,t);else if(typeof e==="object")e=Ed(Io(e,t),t);return e}function B2(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}=Rd(e,n),{parsed:l,malformedAuthorityOrPort:d,malformedPercentEncoding:p,malformedSchemeSpecific:f,malformedHost:h,malformedScheme:y}=Rd(t,n);if(s||d||i||p||a||f||c||h||u||y)throw Error(o.error||l.error||"URI is malformed.");let _=aE(o,l,n,!0),g=sg(r&&r.scheme||_.scheme),S=_.host,v=S!==void 0&&S!==""&&(oE(S)||nE(S).isIPV6);cE(_,r||{},g,v);let w=S&&S.indexOf("%")!==-1&&!/\P{ASCII}/u.test(S);if(_.error&&!w)throw Error(_.error);return n.skipEscape=!0,Io(_,n)}function aE(e,t,r,n){let o={};if(!n)e=Ed(Io(e,r),r),t=Ed(Io(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=Na(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=Na(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=Na(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=Na(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 K2(e,t,r){let n=rE(e,r),o=rE(t,r);return n!==void 0&&o!==void 0&&n===o}function Io(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=tE(r.scheme);let s=sg(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=QR(r.path,a);else r.path=og(r.path);if(n.reference!=="suffix"&&r.scheme)r.scheme=tE(r.scheme),o.push(r.scheme,":");let c=U2(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=Na(u);if(a)u=QR(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("?",V2(r.query));if(r.fragment!==void 0)o.push("#",H2(r.fragment));return o.join("")}var W2=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,Y2=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,X2=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function Q2(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 Aa(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 ig(e){return e[0]==="["&&e[e.length-1]==="]"}function eD(e){let t=e[4];return Aa(e[3])||t!==void 0&&!ig(t)&&Aa(t)||Aa(e[6])||Aa(e[7])||Aa(e[8])}function cE(e,t,r,n){if(!t.unicodeSupport&&(!r||!r.unicodeSupport)&&e.host&&!ig(e.host)&&(t.domainHost||r&&r.domainHost)&&n===!1&&G2(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 Rd(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(Y2);if(d!==null&&d[1].indexOf("\\")!==-1)n.error="URI authority must not contain a literal backslash.",o=!0;let p=e.match(X2);if(p!==null){let h=p[1],y=h.replace(/[\t\n\r]/g,"");if(y.length>=2){if(y.slice(0,2)!=="//")n.error=n.error||"URI authority must not contain a literal backslash.",o=!0;else if(h.length!==y.length)n.error=n.error||"URI authority introducer must not contain whitespace.",o=!0}}let f=e.match(W2);if(f){if(n.scheme=f[1],n.userinfo=f[3],n.host=f[4],n.port=parseInt(f[5],10),n.path=f[6]||"",n.query=f[7],n.fragment=f[8],n.scheme!==void 0){let _=unescape(n.scheme);if(iE.test(_))n.scheme=_.toLowerCase();else n.error=n.error||"URI scheme is malformed.",u=!0}if(s=eD(f),s)n.error=n.error||"URI contains malformed percent-encoding.";if(isNaN(n.port))n.port=f[5];let h=Q2(n,f);if(h!==void 0)n.error=n.error||h,o=!0;if(n.host)if(oE(n.host)===!1){let g=ig(n.host),S=n.host.indexOf("[")!==-1||n.host.indexOf("]")!==-1,v=nE(n.host);if(l=v.isIPV6||v.isIPVFuture===!0,c=S&&(!g||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 y=sg(r.scheme||n.scheme);if(!c)a=cE(n,r,y,l);if(e.indexOf("%")!==-1&&n.host!==void 0&&!c){let _=l?n.host:og(n.host,!0);if(!l)_=og(_.toLowerCase());n.host=Z2(_,l)}if(!y||y&&!y.skipNormalize){if(n.path)n.path=F2(n.path);if(n.query)n.query=eE(n.query);if(n.fragment)n.fragment=eE(n.fragment)}if(y&&y.parse){if(y.parse(n,r),y===sE.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 Ed(e,t){return Rd(e,t).parsed}function tD(e,t){return uE(e,t).normalized}function uE(e,t){let{parsed:r,malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:s,malformedHost:i,malformedScheme:a}=Rd(e,t);return{normalized:n||o||s||i||a?e:Io(r,t),malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:s,malformedHost:i,malformedScheme:a}}function rE(e,t){if(typeof e!=="string"&&typeof e!=="object")return;let r;try{r=typeof e==="string"?e:Io(e,t)}catch{return}let{normalized:n,malformedAuthorityOrPort:o,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:c}=uE(r,t);return o||s||i||a||c?void 0:n}var ag={SCHEMES:sE,normalize:J2,resolve:B2,resolveComponent:aE,equal:K2,serialize:Io,parse:Ed};zd.exports=ag;zd.exports.default=ag;zd.exports.fastUri=ag});var fE=D(function(pE){Object.defineProperty(pE,"__esModule",{value:!0});var dE=lE();dE.code='require("ajv/dist/runtime/uri").default';pE.default=dE});var ug=D(function(Qr){Object.defineProperty(Qr,"__esModule",{value:!0});Qr.CodeGen=Qr.Name=Qr.nil=Qr.stringify=Qr.str=Qr._=Qr.KeywordCxt=void 0;var nD=zs();Object.defineProperty(Qr,"KeywordCxt",{enumerable:!0,get:function(){return nD.KeywordCxt}});var Is=we();Object.defineProperty(Qr,"_",{enumerable:!0,get:function(){return Is._}});Object.defineProperty(Qr,"str",{enumerable:!0,get:function(){return Is.str}});Object.defineProperty(Qr,"stringify",{enumerable:!0,get:function(){return Is.stringify}});Object.defineProperty(Qr,"nil",{enumerable:!0,get:function(){return Is.nil}});Object.defineProperty(Qr,"Name",{enumerable:!0,get:function(){return Is.Name}});Object.defineProperty(Qr,"CodeGen",{enumerable:!0,get:function(){return Is.CodeGen}});var oD=xa(),_E=Ts(),vE=qh(),Cr=Oa(),SE=we(),Or=Ia(),On=ka(),ks=Ie(),mE=DR(),sD=fE(),bE=(e,t)=>new RegExp(e,t);bE.code="new RegExp";var iD=["removeAdditional","useDefaults","coerceTypes"],aD=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),cD={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."},uD={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},hE=200;function lD(e){var t,r,n,o,s,i,a,c,u,l,d,p,f,h,y,_,g,S,v,w,z,R,b,E,C;let q=e.strict,O=(t=e.code)===null||t===void 0?void 0:t.optimize,F=O===!0||O===void 0?1:O||0,K=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:bE,G=(o=e.uriResolver)!==null&&o!==void 0?o:sD.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=(f=e.strictRequired)!==null&&f!==void 0?f:q)!==null&&h!==void 0?h:!1,code:e.code?{...e.code,optimize:F,regExp:K}:{optimize:F,regExp:K},loopRequired:(y=e.loopRequired)!==null&&y!==void 0?y:hE,loopEnum:(_=e.loopEnum)!==null&&_!==void 0?_:hE,meta:(g=e.meta)!==null&&g!==void 0?g:!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:G}}class Pd{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...lD(e)};let{es5:t,lines:r}=this.opts.code;this.scope=new SE.ValueScope({scope:{},prefixes:aD,es5:t,lines:r}),this.logger=gD(e.logger);let n=e.validateFormats;if(e.validateFormats=!1,this.RULES=vE.getRules(),gE.call(this,cD,e,"NOT SUPPORTED"),gE.call(this,uD,e,"DEPRECATED","warn"),this._metaOpts=mD.call(this),e.formats)pD.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords)fD.call(this,e.keywords);if(typeof e.meta=="object")this.addMetaSchema(e.meta);dD.call(this),e.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:r}=this.opts,n=mE;if(r==="id")n={...mE},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 _E.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=Or.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=yE.call(this,e))=="string")e=t;if(t===void 0){let{schemaId:r}=this.opts,n=new Cr.SchemaEnv({schema:{},schemaId:r});if(t=Cr.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=yE.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=Or.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(_D.call(this,r,t),!t)return ks.eachItem(r,(o)=>cg.call(this,o)),this;SD.call(this,t);let n={...t,type:On.getJSONTypes(t.type),schemaType:On.getJSONTypes(t.schemaType)};return ks.eachItem(r,n.type.length===0?(o)=>cg.call(this,o,n):(o)=>n.type.forEach((s)=>cg.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]=wE(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=Or.normalizeId(s||r);let c=Or.getSchemaRefs.call(this,e,r);if(a=new Cr.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 Cr.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{Cr.compileSchema.call(this,e)}finally{this.opts=t}}}Pd.ValidationError=oD.default;Pd.MissingRefError=_E.default;Qr.default=Pd;function gE(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 yE(e){return e=Or.normalizeId(e),this.schemas[e]||this.refs[e]}function dD(){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 pD(){for(let e in this.opts.formats){let t=this.opts.formats[e];if(t)this.addFormat(e,t)}}function fD(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 mD(){let e={...this.opts};for(let t of iD)delete e[t];return e}var hD={log(){},warn(){},error(){}};function gD(e){if(e===!1)return hD;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 yD=/^[a-z_$][a-z0-9_$:-]*$/i;function _D(e,t){let{RULES:r}=this;if(ks.eachItem(e,(n)=>{if(r.keywords[n])throw Error(`Keyword ${n} is already defined`);if(!yD.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 cg(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:On.getJSONTypes(t.type),schemaType:On.getJSONTypes(t.schemaType)}};if(t.before)vD.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 vD(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 SD(e){let{metaSchema:t}=e;if(t===void 0)return;if(e.$data&&this.opts.$data)t=wE(t);e.validateSchema=this.compile(t,!0)}var bD={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function wE(e){return{anyOf:[e,bD]}}});var RE=D(function($E){Object.defineProperty($E,"__esModule",{value:!0});var RD={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};$E.default=RD});var xd=D(function(zE){Object.defineProperty(zE,"__esModule",{value:!0});zE.callRef=zE.getValidate=void 0;var zD=Ts(),kd=sr(),Ue=we(),xs=nr(),Id=Oa(),An=Ie(),PD={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=Id.resolveRef.call(c,u,o,r);if(l===void 0)throw new zD.default(n.opts.uriResolver,o,r);if(l instanceof Id.SchemaEnv)return p(l);return f(l);function d(){if(s===u)return Td(e,i,s,s.$async);let h=t.scopeValue("root",{ref:u});return Td(e,Ue._`${h}.validate`,u,u.$async)}function p(h){let y=EE(e,h);Td(e,y,h,h.$async)}function f(h){let y=t.scopeValue("schema",a.code.source===!0?{ref:h,code:Ue.stringify(h)}:{ref:h}),_=t.name("valid"),g=e.subschema({schema:h,dataTypes:[],schemaPath:Ue.nil,topSchemaRef:y,errSchemaPath:r},_);e.mergeEvaluated(g),e.ok(_)}}};function EE(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):Ue._`${r.scopeValue("wrapper",{ref:t})}.validate`}zE.getValidate=EE;function Td(e,t,r,n){let{gen:o,it:s}=e,{allErrors:i,schemaEnv:a,opts:c}=s,u=c.passContext?xs.default.this:Ue.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(Ue._`await ${kd.callValidateCode(e,t,u)}`),f(t),!i)o.assign(h,!0)},(y)=>{if(o.if(Ue._`!(${y} instanceof ${s.ValidationError})`,()=>o.throw(y)),p(y),!i)o.assign(h,!1)}),e.ok(h)}function d(){e.result(kd.callValidateCode(e,t,u),()=>f(t),()=>p(t))}function p(h){let y=Ue._`${h}.errors`;o.assign(xs.default.vErrors,Ue._`${xs.default.vErrors} === null ? ${y} : ${xs.default.vErrors}.concat(${y})`),o.assign(xs.default.errors,Ue._`${xs.default.vErrors}.length`)}function f(h){var y;if(!s.opts.unevaluated)return;let _=(y=r===null||r===void 0?void 0:r.validate)===null||y===void 0?void 0:y.evaluated;if(s.props!==!0)if(_&&!_.dynamicProps){if(_.props!==void 0)s.props=An.mergeEvaluated.props(o,_.props,s.props)}else{let g=o.var("props",Ue._`${h}.evaluated.props`);s.props=An.mergeEvaluated.props(o,g,s.props,Ue.Name)}if(s.items!==!0)if(_&&!_.dynamicItems){if(_.items!==void 0)s.items=An.mergeEvaluated.items(o,_.items,s.items)}else{let g=o.var("items",Ue._`${h}.evaluated.items`);s.items=An.mergeEvaluated.items(o,g,s.items,Ue.Name)}}}zE.callRef=Td;zE.default=PD});var lg=D(function(TE){Object.defineProperty(TE,"__esModule",{value:!0});var ID=RE(),xD=xd(),CD=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",ID.default,xD.default];TE.default=CD});var IE=D(function(kE){Object.defineProperty(kE,"__esModule",{value:!0});var jn=we(),Nn=jn.operators,Cd={maximum:{okStr:"<=",ok:Nn.LTE,fail:Nn.GT},minimum:{okStr:">=",ok:Nn.GTE,fail:Nn.LT},exclusiveMaximum:{okStr:"<",ok:Nn.LT,fail:Nn.GTE},exclusiveMinimum:{okStr:">",ok:Nn.GT,fail:Nn.LTE}},AD={message:({keyword:e,schemaCode:t})=>jn.str`must be ${Cd[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>jn._`{comparison: ${Cd[e].okStr}, limit: ${t}}`},ND={keyword:Object.keys(Cd),type:"number",schemaType:"number",$data:!0,error:AD,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data(jn._`${r} ${Cd[t].fail} ${n} || isNaN(${r})`)}};kE.default=ND});var CE=D(function(xE){Object.defineProperty(xE,"__esModule",{value:!0});var Ar=we(),qD={message:({schemaCode:e})=>Ar.str`must be multiple of ${e}`,params:({schemaCode:e})=>Ar._`{multipleOf: ${e}}`},MD={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:qD,code(e){let{gen:t,data:r,schemaCode:n,it:o}=e,s=o.opts.multipleOfPrecision,i=t.let("res"),a=s?Ar._`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:Ar._`${i} !== parseInt(${i})`;e.fail$data(Ar._`(${n} === 0 || (${i} = ${r}/${n}, ${a}))`)}};xE.default=MD});var NE=D(function(AE){Object.defineProperty(AE,"__esModule",{value:!0});function OE(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}AE.default=OE;OE.code='require("ajv/dist/runtime/ucs2length").default'});var ME=D(function(qE){Object.defineProperty(qE,"__esModule",{value:!0});var Ht=we(),jE=Ie(),UD=NE(),FD={message({keyword:e,schemaCode:t}){return Ht.str`must NOT have ${e==="maxLength"?"more":"fewer"} than ${t} characters`},params:({schemaCode:e})=>Ht._`{limit: ${e}}`},VD={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:FD,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._`${jE.useFunc(e.gen,UD.default)}(${r})`;e.fail$data(Ht._`${i} ${s} ${n}`)}};qE.default=VD});var FE=D(function(UE){Object.defineProperty(UE,"__esModule",{value:!0});var LE=sr(),DE=Ie(),ir=we(),ZD={message:({schemaCode:e})=>ir.str`must match pattern "${e}"`,params:({schemaCode:e})=>ir._`{pattern: ${e}}`},GD={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:ZD,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`:DE.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=LE.usePattern(e,o);e.fail$data(ir._`!${c}.test(${r})`)}}};UE.default=GD});var HE=D(function(VE){Object.defineProperty(VE,"__esModule",{value:!0});var Nr=we(),BD={message({keyword:e,schemaCode:t}){return Nr.str`must NOT have ${e==="maxProperties"?"more":"fewer"} than ${t} properties`},params:({schemaCode:e})=>Nr._`{limit: ${e}}`},KD={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:BD,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxProperties"?Nr.operators.GT:Nr.operators.LT;e.fail$data(Nr._`Object.keys(${r}).length ${o} ${n}`)}};VE.default=KD});var JE=D(function(GE){Object.defineProperty(GE,"__esModule",{value:!0});var jr=sr(),qr=we(),ZE=Ie(),YD={message:({params:{missingProperty:e}})=>qr.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>qr._`{missingProperty: ${e}}`},XD={keyword:"required",type:"object",schemaType:"array",$data:!0,error:YD,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 f=e.parentSchema.properties,{definedProperties:h}=e.it;for(let y of r)if((f===null||f===void 0?void 0:f[y])===void 0&&!h.has(y)){let _=i.schemaEnv.baseId+i.errSchemaPath,g=`required property "${y}" is not defined at "${_}" (strictRequired)`;ZE.checkStrictMode(i,g,i.opts.strictRequired)}}function u(){if(c||s)e.block$data(qr.nil,d);else for(let f of r)jr.checkReportMissingProp(e,f)}function l(){let f=t.let("missing");if(c||s){let h=t.let("valid",!0);e.block$data(h,()=>p(f,h)),e.ok(h)}else t.if(jr.checkMissingProp(e,r,f)),jr.reportMissingProp(e,f),t.else()}function d(){t.forOf("prop",n,(f)=>{e.setParams({missingProperty:f}),t.if(jr.noPropertyInData(t,o,f,a.ownProperties),()=>e.error())})}function p(f,h){e.setParams({missingProperty:f}),t.forOf(f,n,()=>{t.assign(h,jr.propertyInData(t,o,f,a.ownProperties)),t.if(qr.not(h),()=>{e.error(),t.break()})},qr.nil)}}};GE.default=XD});var KE=D(function(BE){Object.defineProperty(BE,"__esModule",{value:!0});var Mr=we(),eU={message({keyword:e,schemaCode:t}){return Mr.str`must NOT have ${e==="maxItems"?"more":"fewer"} than ${t} items`},params:({schemaCode:e})=>Mr._`{limit: ${e}}`},tU={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:eU,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxItems"?Mr.operators.GT:Mr.operators.LT;e.fail$data(Mr._`${r}.length ${o} ${n}`)}};BE.default=tU});var Od=D(function(YE){Object.defineProperty(YE,"__esModule",{value:!0});var WE=Hh();WE.code='require("ajv/dist/runtime/equal").default';YE.default=WE});var ez=D(function(QE){Object.defineProperty(QE,"__esModule",{value:!0});var Cs=ka(),Ae=we(),XE=Ie(),oU=Od(),sU={message:({params:{i:e,j:t}})=>Ae.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>Ae._`{i: ${e}, j: ${t}}`},iU={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:sU,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?Cs.getSchemaTypes(s.items):[];e.block$data(c,l,Ae._`${i} === false`),e.ok(c);function l(){let h=t.let("i",Ae._`${r}.length`),y=t.let("j");e.setParams({i:h,j:y}),t.assign(c,!0),t.if(Ae._`${h} > 1`,()=>(d()?p:f)(h,y))}function d(){return u.length>0&&!u.some((h)=>h==="object"||h==="array")}function p(h,y){let _=t.name("item"),g=Cs.checkDataTypes(u,_,a.opts.strictNumbers,Cs.DataType.Wrong),S=t.const("indices",Ae._`{}`);t.for(Ae._`;${h}--;`,()=>{if(t.let(_,Ae._`${r}[${h}]`),t.if(g,Ae._`continue`),u.length>1)t.if(Ae._`typeof ${_} == "string"`,Ae._`${_} += "_"`);t.if(Ae._`typeof ${S}[${_}] == "number"`,()=>{t.assign(y,Ae._`${S}[${_}]`),e.error(),t.assign(c,!1).break()}).code(Ae._`${S}[${_}] = ${h}`)})}function f(h,y){let _=XE.useFunc(t,oU.default),g=t.name("outer");t.label(g).for(Ae._`;${h}--;`,()=>t.for(Ae._`${y} = ${h}; ${y}--;`,()=>t.if(Ae._`${_}(${r}[${h}], ${r}[${y}])`,()=>{e.error(),t.assign(c,!1).break(g)})))}}};QE.default=iU});var nz=D(function(rz){Object.defineProperty(rz,"__esModule",{value:!0});var Os=we(),tz=Ie(),cU=Od(),uU={message:"must be equal to constant",params:({schemaCode:e})=>Os._`{allowedValue: ${e}}`},lU={keyword:"const",$data:!0,error:uU,code(e){let{gen:t,data:r,$data:n,schemaCode:o,schema:s}=e;if(n||s&&typeof s=="object")e.fail$data(Os._`!${tz.useFunc(t,cU.default)}(${r}, ${o})`);else e.fail(Os._`${s} !== ${r}`)}};rz.default=lU});var iz=D(function(sz){Object.defineProperty(sz,"__esModule",{value:!0});var Lr=we(),oz=Ie(),pU=Od(),fU={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>Lr._`{allowedValues: ${e}}`},mU={keyword:"enum",schemaType:"array",$data:!0,error:fU,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=oz.useFunc(t,pU.default),l;if(a||n)l=t.let("valid"),e.block$data(l,d);else{if(!Array.isArray(o))throw Error("ajv implementation error");let f=t.const("vSchema",s);l=Lr.or(...o.map((h,y)=>p(f,y)))}e.pass(l);function d(){t.assign(l,!1),t.forOf("v",s,(f)=>t.if(Lr._`${u()}(${r}, ${f})`,()=>t.assign(l,!0).break()))}function p(f,h){let y=o[h];return typeof y==="object"&&y!==null?Lr._`${u()}(${r}, ${f}[${h}])`:Lr._`${r} === ${y}`}}};sz.default=mU});var dg=D(function(az){Object.defineProperty(az,"__esModule",{value:!0});var gU=IE(),yU=CE(),_U=ME(),vU=FE(),SU=HE(),bU=JE(),wU=KE(),$U=ez(),RU=nz(),EU=iz(),zU=[gU.default,yU.default,_U.default,vU.default,SU.default,bU.default,wU.default,$U.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},RU.default,EU.default];az.default=zU});var pg=D(function(uz){Object.defineProperty(uz,"__esModule",{value:!0});uz.validateAdditionalItems=void 0;var Zt=we(),As=Ie(),TU={message:({params:{len:e}})=>Zt.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Zt._`{limit: ${e}}`},kU={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:TU,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){As.checkStrictMode(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}cz(e,n)}};function cz(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"&&!As.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:As.Type.Num},u),!i.allErrors)r.if(Zt.not(u),()=>r.break())})}}uz.validateAdditionalItems=cz;uz.default=kU});var fg=D(function(fz){Object.defineProperty(fz,"__esModule",{value:!0});fz.validateTuple=void 0;var Ad=we(),qn=Ie(),dz=sr(),xU={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return pz(e,"additionalItems",t);if(r.items=!0,qn.alwaysValidSchema(r,t))return;e.ok(dz.validateArray(e))}};function pz(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=qn.mergeEvaluated.items(n,r.length,a.items);let c=n.name("valid"),u=n.const("len",Ad._`${s}.length`);r.forEach((d,p)=>{if(qn.alwaysValidSchema(a,d))return;n.if(Ad._`${u} > ${p}`,()=>e.subschema({keyword:i,schemaProp:p,dataProp:p},c)),e.ok(c)});function l(d){let{opts:p,errSchemaPath:f}=a,h=r.length,y=h===d.minItems&&(h===d.maxItems||d[t]===!1);if(p.strictTuples&&!y){let _=`"${i}" is ${h}-tuple, but minItems or maxItems/${t} are not specified or different at path "${f}"`;qn.checkStrictMode(a,_,p.strictTuples)}}}fz.validateTuple=pz;fz.default=xU});var yz=D(function(gz){Object.defineProperty(gz,"__esModule",{value:!0});var hz=fg(),OU={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(e)=>hz.validateTuple(e,"items")};gz.default=OU});var wz=D(function(bz){Object.defineProperty(bz,"__esModule",{value:!0});var Nd=we(),_z=Ie(),vz=sr(),Sz=pg(),NU={message:({params:{len:e}})=>Nd.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Nd._`{limit: ${e}}`},jU={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:NU,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:o}=r;if(n.items=!0,_z.alwaysValidSchema(n,t))return;if(o)Sz.validateAdditionalItems(e,o);else e.ok(vz.validateArray(e))}};bz.default=jU});var Rz=D(function($z){Object.defineProperty($z,"__esModule",{value:!0});var Ye=we(),Mn=Ie(),MU={message:({params:{min:e,max:t}})=>t===void 0?Ye.str`must contain at least ${e} valid item(s)`:Ye.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?Ye._`{minContains: ${e}}`:Ye._`{minContains: ${e}, maxContains: ${t}}`},LU={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:MU,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",Ye._`${o}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){Mn.checkStrictMode(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){Mn.checkStrictMode(s,'"minContains" > "maxContains" is always invalid'),e.fail();return}if(Mn.alwaysValidSchema(s,r)){let y=Ye._`${l} >= ${i}`;if(a!==void 0)y=Ye._`${y} && ${l} <= ${a}`;e.pass(y);return}s.items=!0;let d=t.name("valid");if(a===void 0&&i===1)f(d,()=>t.if(d,()=>t.break()));else if(i===0){if(t.let(d,!0),a!==void 0)t.if(Ye._`${o}.length > 0`,p)}else t.let(d,!1),p();e.result(d,()=>e.reset());function p(){let y=t.name("_valid"),_=t.let("count",0);f(y,()=>t.if(y,()=>h(_)))}function f(y,_){t.forRange("i",0,l,(g)=>{e.subschema({keyword:"contains",dataProp:g,dataPropType:Mn.Type.Num,compositeRule:!0},y),_()})}function h(y){if(t.code(Ye._`${y}++`),a===void 0)t.if(Ye._`${y} >= ${i}`,()=>t.assign(d,!0).break());else if(t.if(Ye._`${y} > ${a}`,()=>t.assign(d,!1).break()),i===1)t.assign(d,!0);else t.if(Ye._`${y} >= ${i}`,()=>t.assign(d,!0))}}};$z.default=LU});var jd=D(function(Tz){Object.defineProperty(Tz,"__esModule",{value:!0});Tz.validateSchemaDeps=Tz.validatePropertyDeps=Tz.error=void 0;var Ns=we(),Ez=Ie(),Dr=sr();Tz.error={message:({params:{property:e,depsCount:t,deps:r}})=>Ns.str`must have ${t===1?"property":"properties"} ${r} when property ${e} is present`,params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>Ns._`{property: ${e},
|
|
7
7
|
missingProperty: ${n},
|
|
8
8
|
depsCount: ${t},
|
|
9
|
-
deps: ${r}}`};var bU={keyword:"dependencies",type:"object",schemaType:"object",error:hz.error,code(e){let[t,r]=$U(e);fz(e,t),mz(e,r)}};function $U({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(Cs._`${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=bU});var Sz=D(function(vz){Object.defineProperty(vz,"__esModule",{value:!0});var Ad=$e(),_z=xe(),EU={message:"property name must be valid",params:({params:e})=>Ad._`{propertyName: ${e.propertyName}}`},zU={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:EU,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(Ad.not(s),()=>{if(e.error(!0),!o.allErrors)t.break()})}),e.ok(s)}};vz.default=zU});var ug=D(function(bz){Object.defineProperty(bz,"__esModule",{value:!0});var Mn=sr(),st=$e(),TU=nr(),Ln=xe(),IU={message:"must NOT have additional properties",params:({params:e})=>st._`{additionalProperty: ${e.additionalProperty}}`},xU={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:IU,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(st._`${s} === ${TU.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=st.or(...u.map((S)=>st._`${_} === ${S}`));else y=st.nil;if(l.length)y=st.or(y,...l.map((S)=>st._`${Mn.usePattern(e,S)}.test(${_})`));return st.not(y)}function m(_){t.code(st._`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(st.not(y),()=>{e.reset(),m(_)});else if(g(_,y),!a)t.if(st.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=xU});var Ez=D(function(Rz){Object.defineProperty(Rz,"__esModule",{value:!0});var wz=Rs(),Nd=sr(),As=xe(),$z=ug(),OU={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=Nd.allSchemaProperties(r);for(let d of i)s.definedProperties.add(d);if(s.opts.unevaluated&&i.length&&s.props!==!0)s.props=As.mergeEvaluated.props(t,As.toHash(i),s.props);let a=i.filter((d)=>!As.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(Nd.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=OU});var Pz=D(function(zz){Object.defineProperty(zz,"__esModule",{value:!0});var jd=sr(),Dn=$e(),qd=xe(),Md=xe(),AU={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:o,it:s}=e,{opts:i}=s,a=jd.allSchemaProperties(r),c=a.filter((g)=>qd.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=Md.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(_))qd.checkStrictMode(s,`property ${_} matches pattern ${g} (use allowMatchingProperties)`)}function h(g){t.forIn("key",n,(_)=>{t.if(Dn._`${jd.usePattern(e,g)}.test(${_})`,()=>{let y=c.includes(g);if(!y)e.subschema({keyword:"patternProperties",schemaProp:g,dataProp:_,dataPropType:Md.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=AU});var xz=D(function(Iz){Object.defineProperty(Iz,"__esModule",{value:!0});var Tz=xe(),jU={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=jU});var Cz=D(function(Oz){Object.defineProperty(Oz,"__esModule",{value:!0});var kz=sr(),MU={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:kz.validateUnion,error:{message:"must match a schema in anyOf"}};Oz.default=MU});var jz=D(function(Nz){Object.defineProperty(Nz,"__esModule",{value:!0});var Un=$e(),Az=xe(),DU={message:"must match exactly one schema in oneOf",params:({params:e})=>Un._`{passingSchemas: ${e.passing}}`},UU={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:DU,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=UU});var Lz=D(function(Mz){Object.defineProperty(Mz,"__esModule",{value:!0});var qz=xe(),VU={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=VU});var Fz=D(function(Uz){Object.defineProperty(Uz,"__esModule",{value:!0});var Fn=$e(),Ld=xe(),ZU={message:({params:e})=>Fn.str`must match "${e.ifClause}" schema`,params:({params:e})=>Fn._`{failingKeyword: ${e.ifClause}}`},GU={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:ZU,code(e){let{gen:t,parentSchema:r,it:n}=e;if(r.then===void 0&&r.else===void 0)Ld.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&&!Ld.alwaysValidSchema(e,r)}Uz.default=GU});var Zz=D(function(Hz){Object.defineProperty(Hz,"__esModule",{value:!0});var Vz=xe(),KU={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=KU});var lg=D(function(Gz){Object.defineProperty(Gz,"__esModule",{value:!0});var WU=ag(),YU=oz(),XU=cg(),QU=uz(),eF=dz(),tF=Cd(),rF=Sz(),nF=ug(),oF=Ez(),sF=Pz(),iF=xz(),aF=Cz(),cF=jz(),uF=Lz(),lF=Fz(),dF=Zz();function pF(e=!1){let t=[iF.default,aF.default,cF.default,uF.default,lF.default,dF.default,rF.default,nF.default,tF.default,oF.default,sF.default];if(e)t.push(YU.default,QU.default);else t.push(WU.default,XU.default);return t.push(eF.default),t}Gz.default=pF});var dg=D(function(Bz){Object.defineProperty(Bz,"__esModule",{value:!0});Bz.dynamicAnchor=void 0;var Ns=$e(),mF=nr(),Dd=Ta(),Jz=Td(),hF={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=Ns._`${mF.default.dynamicAnchors}${Ns.getProperty(t)}`,s=n.errSchemaPath==="#"?n.validateName:gF(e);r.if(Ns._`!${o}`,()=>r.assign(o,s))}Bz.dynamicAnchor=Kz;function gF(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 Dd.SchemaEnv({schema:r,schemaId:c,root:o,baseId:s,localRefs:i,meta:a});return Dd.compileSchema.call(n,u),Jz.getValidate(e,u)}Bz.default=hF});var pg=D(function(Xz){Object.defineProperty(Xz,"__esModule",{value:!0});Xz.dynamicRef=void 0;var Ud=$e(),_F=nr(),Fd=Td(),vF={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",Ud._`${_F.default.dynamicAnchors}${Ud.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(()=>{Fd.callRef(e,c),r.let(u,!0)}):()=>Fd.callRef(e,c)}}Xz.dynamicRef=Yz;Xz.default=vF});var nP=D(function(rP){Object.defineProperty(rP,"__esModule",{value:!0});var eP=dg(),tP=xe(),bF={keyword:"$recursiveAnchor",schemaType:"boolean",code(e){if(e.schema)eP.dynamicAnchor(e,"");else tP.checkStrictMode(e.it,"$recursiveAnchor: false is ignored")}};rP.default=bF});var iP=D(function(sP){Object.defineProperty(sP,"__esModule",{value:!0});var oP=pg(),wF={keyword:"$recursiveRef",schemaType:"string",code:(e)=>oP.dynamicRef(e,e.schema)};sP.default=wF});var cP=D(function(aP){Object.defineProperty(aP,"__esModule",{value:!0});var EF=dg(),zF=pg(),PF=nP(),TF=iP(),IF=[EF.default,zF.default,PF.default,TF.default];aP.default=IF});var lP=D(function(uP){Object.defineProperty(uP,"__esModule",{value:!0});var Vd=Cd(),kF={keyword:"dependentRequired",type:"object",schemaType:"object",error:Vd.error,code:(e)=>Vd.validatePropertyDeps(e)};uP.default=kF});var fP=D(function(pP){Object.defineProperty(pP,"__esModule",{value:!0});var dP=Cd(),CF={keyword:"dependentSchemas",type:"object",schemaType:"object",code:(e)=>dP.validateSchemaDeps(e)};pP.default=CF});var gP=D(function(hP){Object.defineProperty(hP,"__esModule",{value:!0});var mP=xe(),NF={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=NF});var _P=D(function(yP){Object.defineProperty(yP,"__esModule",{value:!0});var qF=lP(),MF=fP(),LF=gP(),DF=[qF.default,MF.default,LF.default];yP.default=DF});var SP=D(function(vP){Object.defineProperty(vP,"__esModule",{value:!0});var At=$e(),Hd=xe(),FF=nr(),VF={message:"must NOT have unevaluated properties",params:({params:e})=>At._`{unevaluatedProperty: ${e.unevaluatedProperty}}`},HF={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:VF,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 At.Name)t.if(At._`${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(At._`${o} === ${FF.default.errors}`);function c(d){if(r===!1){if(e.setParams({unevaluatedProperty:d}),e.error(),!i)t.break();return}if(!Hd.alwaysValidSchema(s,r)){let p=t.name("valid");if(e.subschema({keyword:"unevaluatedProperties",dataProp:d,dataPropType:Hd.Type.Str},p),!i)t.if(At.not(p),()=>t.break())}}function u(d,p){return At._`!${d} || !${d}[${p}]`}function l(d,p){let m=[];for(let h in d)if(d[h]===!0)m.push(At._`${p} !== ${h}`);return At.and(...m)}}};vP.default=HF});var $P=D(function(bP){Object.defineProperty(bP,"__esModule",{value:!0});var Gt=$e(),Zd=xe(),GF={message:({params:{len:e}})=>Gt.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Gt._`{limit: ${e}}`},JF={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:GF,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"&&!Zd.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:Zd.Type.Num},c),!o.allErrors)t.if(Gt.not(c),()=>t.break())})}}};bP.default=JF});var RP=D(function(wP){Object.defineProperty(wP,"__esModule",{value:!0});var BF=SP(),WF=$P(),YF=[BF.default,WF.default];wP.default=YF});var zP=D(function(EP){Object.defineProperty(EP,"__esModule",{value:!0});var ze=$e(),QF={message:({schemaCode:e})=>ze.str`must match format "${e}"`,params:({schemaCode:e})=>ze._`{format: ${e}}`},eV={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:QF,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=eV});var fg=D(function(PP){Object.defineProperty(PP,"__esModule",{value:!0});var rV=zP(),nV=[rV.default];PP.default=nV});var mg=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 kP=D(function(xP){Object.defineProperty(xP,"__esModule",{value:!0});var iV=sg(),aV=ig(),cV=lg(),uV=cP(),lV=_P(),dV=RP(),pV=fg(),Gd=mg(),fV=[uV.default,iV.default,aV.default,(0,cV.default)(!0),pV.default,Gd.metadataVocabulary,Gd.contentVocabulary,lV.default,dV.default];xP.default=fV});var NP=D(function(CP){Object.defineProperty(CP,"__esModule",{value:!0});CP.DiscrError=void 0;var OP;(function(e){e.Tag="tag",e.Mapping="mapping"})(OP||(CP.DiscrError=OP={}))});var hg=D(function(qP){Object.defineProperty(qP,"__esModule",{value:!0});var ar=$e(),js=NP(),Jd=Ta(),hV=zs(),jP=xe(),gV={message:({params:{discrError:e,tagName:t}})=>e===js.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}}`},yV={keyword:"discriminator",type:"object",schemaType:"object",error:gV,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:js.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:js.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=Jd.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,b),z instanceof Jd.SchemaEnv)z=z.schema;if(z===void 0)throw new hV.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=yV});var MP=D(function(cY,vV){vV.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(uY,SV){SV.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(lY,bV){bV.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(dY,$V){$V.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(pY,wV){wV.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(fY,RV){RV.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(mY,EV){EV.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(hY,zV){zV.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 PV=MP(),TV=LP(),IV=DP(),xV=UP(),kV=FP(),OV=VP(),CV=HP(),AV=ZP(),NV=["/properties"];function jV(e){return[PV,TV,IV,xV,kV,t(this,OV),CV,t(this,AV)].forEach((r)=>this.addMetaSchema(r,void 0,!1)),this;function t(r,n){return e?r.$dataMetaSchema(n,NV):n}}GP.default=jV});var KP=D(function(Jt,yg){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 MV=og(),LV=kP(),DV=hg(),UV=JP(),gg="https://json-schema.org/draft/2020-12/schema";class ka extends MV.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){if(super._addVocabularies(),LV.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(DV.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:e,meta:t}=this.opts;if(!t)return;UV.default.call(this,e),this.refs["http://json-schema.org/schema"]=gg}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(gg)?gg:void 0)}}Jt.Ajv2020=ka;yg.exports=Jt=ka;yg.exports.Ajv2020=ka;Object.defineProperty(Jt,"__esModule",{value:!0});Jt.default=ka;var FV=Rs();Object.defineProperty(Jt,"KeywordCxt",{enumerable:!0,get:function(){return FV.KeywordCxt}});var qs=$e();Object.defineProperty(Jt,"_",{enumerable:!0,get:function(){return qs._}});Object.defineProperty(Jt,"str",{enumerable:!0,get:function(){return qs.str}});Object.defineProperty(Jt,"stringify",{enumerable:!0,get:function(){return qs.stringify}});Object.defineProperty(Jt,"nil",{enumerable:!0,get:function(){return qs.nil}});Object.defineProperty(Jt,"Name",{enumerable:!0,get:function(){return qs.Name}});Object.defineProperty(Jt,"CodeGen",{enumerable:!0,get:function(){return qs.CodeGen}});var VV=za();Object.defineProperty(Jt,"ValidationError",{enumerable:!0,get:function(){return VV.default}});var HV=zs();Object.defineProperty(Jt,"MissingRefError",{enumerable:!0,get:function(){return HV.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,bg),time:Dr(vg(!0),$g),"date-time":Dr(BP(!0),eT),"iso-time":Dr(vg(),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:XV,"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:s9,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:QV,int32:{type:"number",validate:r9},int64:{type:"number",validate:n9},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$/,bg),time:Dr(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,$g),"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 JV(e){return e%4===0&&(e%100!==0||e%400===0)}var KV=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,BV=[0,31,28,31,30,31,30,31,31,30,31,30,31];function XP(e){let t=KV.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&&JV(r)?29:BV[n])}function bg(e,t){if(!(e&&t))return;if(e>t)return 1;if(e<t)return-1;return 0}var _g=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function vg(e){return function(r){let n=_g.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 $g(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=_g.exec(e),n=_g.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 Sg=/t|\s/i;function BP(e){let t=vg(e);return function(n){let o=n.split(Sg);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(Sg),[o,s]=t.split(Sg),i=bg(r,o);if(i===void 0)return;return i||$g(n,s)}var WV=/\/|:/,YV=/^(?:[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 XV(e){return WV.test(e)&&YV.test(e)}var WP=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function QV(e){return WP.lastIndex=0,WP.test(e)}var e9=-2147483648,t9=2147483647;function r9(e){return Number.isInteger(e)&&e<=t9&&e>=e9}function n9(e){return Number.isInteger(e)}function YP(){return!0}var o9=/[^\\]\\Z/;function s9(e){if(o9.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 a9=sg(),c9=ig(),u9=lg(),l9=fg(),Kd=mg(),d9=[a9.default,c9.default,(0,u9.default)(),l9.default,Kd.metadataVocabulary,Kd.contentVocabulary];sT.default=d9});var aT=D(function(PY,f9){f9.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,Rg){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 m9=og(),h9=iT(),g9=hg(),cT=aT(),y9=["/properties"],Bd="http://json-schema.org/draft-07/schema";class Oa extends m9.default{_addVocabularies(){if(super._addVocabularies(),h9.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(g9.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(cT,y9):cT;this.addMetaSchema(e,Bd,!1),this.refs["http://json-schema.org/schema"]=Bd}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Bd)?Bd:void 0)}}Kt.Ajv=Oa;Rg.exports=Kt=Oa;Rg.exports.Ajv=Oa;Object.defineProperty(Kt,"__esModule",{value:!0});Kt.default=Oa;var _9=Rs();Object.defineProperty(Kt,"KeywordCxt",{enumerable:!0,get:function(){return _9.KeywordCxt}});var Ms=$e();Object.defineProperty(Kt,"_",{enumerable:!0,get:function(){return Ms._}});Object.defineProperty(Kt,"str",{enumerable:!0,get:function(){return Ms.str}});Object.defineProperty(Kt,"stringify",{enumerable:!0,get:function(){return Ms.stringify}});Object.defineProperty(Kt,"nil",{enumerable:!0,get:function(){return Ms.nil}});Object.defineProperty(Kt,"Name",{enumerable:!0,get:function(){return Ms.Name}});Object.defineProperty(Kt,"CodeGen",{enumerable:!0,get:function(){return Ms.CodeGen}});var v9=za();Object.defineProperty(Kt,"ValidationError",{enumerable:!0,get:function(){return v9.default}});var S9=zs();Object.defineProperty(Kt,"MissingRefError",{enumerable:!0,get:function(){return S9.default}})});var pT=D(function(dT){Object.defineProperty(dT,"__esModule",{value:!0});dT.formatLimitDefinition=void 0;var lT=uT(),it=$e(),Vn=it.operators,Wd={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}},w9={message:({keyword:e,schemaCode:t})=>it.str`should be ${Wd[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>it._`{comparison: ${Wd[e].okStr}, limit: ${t}}`};dT.formatLimitDefinition={keyword:Object.keys(Wd),type:"string",schemaType:"string",$data:!0,error:w9,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",it._`${p}[${c.schemaCode}]`);e.fail$data(it.or(it._`typeof ${m} != "object"`,it._`${m} instanceof RegExp`,it._`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?it._`${i.code.formats}${it.getProperty(p)}`:void 0});e.fail$data(d(h))}function d(p){return it._`${p}.compare(${r}, ${n}) ${Wd[o].fail} 0`}},dependencies:["format"]};var R9=(e)=>(e.addKeyword(dT.formatLimitDefinition),e);dT.default=R9});var gT=D(function(Ca,hT){Object.defineProperty(Ca,"__esModule",{value:!0});var cr=oT(),z9=pT(),Ls=$e(),fT=new Ls.Name("fullFormats"),P9=new Ls.Name("fastFormats"),zg=(e,t={keywords:!0})=>{if(Array.isArray(t))return mT(e,t,cr.fullFormats,fT),e;let[r,n]=t.mode==="fast"?[cr.fastFormats,P9]:[cr.fullFormats,fT],o=t.formats||cr.formatNames;if(mT(e,o,r,n),t.keywords)(0,z9.default)(e);return e};zg.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=Ls._`require("ajv-formats/dist/formats").${n}`);for(let i of t)e.addFormat(i,r[i])}hT.exports=Ca=zg;Object.defineProperty(Ca,"__esModule",{value:!0});Ca.default=zg});var Ds=D(function(DY,yT){var j9=Number.MAX_SAFE_INTEGER||9007199254740991,q9=["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:j9,RELEASE_TYPES:q9,SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var Aa=D(function(UY,_T){var M9=typeof process==="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};_T.exports=M9});var Us=D(function(Ur,vT){var{MAX_SAFE_COMPONENT_LENGTH:Ig,MAX_SAFE_BUILD_LENGTH:L9,MAX_LENGTH:D9}=Ds(),U9=Aa();Ur=vT.exports={};var F9=Ur.re=[],V9=Ur.safeRe=[],oe=Ur.src=[],H9=Ur.safeSrc=[],se=Ur.t={},Z9=0,xg="[a-zA-Z0-9-]",G9=[["\\s",1],["\\d",D9],[xg,L9]],J9=(e)=>{for(let[t,r]of G9)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e},Re=(e,t,r)=>{let n=J9(t),o=Z9++;U9(e,o,t),se[e]=o,oe[o]=t,H9[o]=n,F9[o]=new RegExp(t,r?"g":void 0),V9[o]=new RegExp(n,r?"g":void 0)};Re("NUMERICIDENTIFIER","0|[1-9]\\d*");Re("NUMERICIDENTIFIERLOOSE","\\d+");Re("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${xg}*`);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",`${xg}+`);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,${Ig}})(?:\\.(\\d{1,${Ig}}))?(?:\\.(\\d{1,${Ig}}))?`);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 Yd=D(function(FY,ST){var K9=Object.freeze({loose:!0}),B9=Object.freeze({}),W9=(e)=>{if(!e)return B9;if(typeof e!=="object")return K9;return e};ST.exports=W9});var kg=D(function(VY,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},Y9=(e,t)=>$T(t,e);wT.exports={compareIdentifiers:$T,rcompareIdentifiers:Y9}});var wt=D(function(HY,ET){var Xd=Aa(),{MAX_LENGTH:RT,MAX_SAFE_INTEGER:Qd}=Ds(),{safeRe:ep,t:tp}=Us(),X9=Yd(),{compareIdentifiers:Og}=kg(),Q9=(e,t)=>{let r=t.split(".");if(r.length>e.length)return!1;for(let n=0;n<r.length;n++)if(Og(e[n],r[n])!==0)return!1;return!0};class Sr{constructor(e,t){if(t=X9(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`);Xd("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let r=e.trim().match(t.loose?ep[tp.LOOSE]:ep[tp.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>Qd||this.major<0)throw TypeError("Invalid major version");if(this.minor>Qd||this.minor<0)throw TypeError("Invalid minor version");if(this.patch>Qd||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<Qd)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(Xd("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(Xd("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 Og(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(Xd("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 Og(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?ep[tp.PRERELEASELOOSE]:ep[tp.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(Q9(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(ZY,PT){var zT=wt(),e4=(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=e4});var IT=D(function(GY,TT){var t4=Hn(),r4=(e,t)=>{let r=t4(e,t);return r?r.version:null};TT.exports=r4});var kT=D(function(JY,xT){var n4=Hn(),o4=(e,t)=>{let r=n4(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};xT.exports=o4});var AT=D(function(KY,CT){var OT=wt(),s4=(e,t,r,n,o)=>{if(typeof r==="string")o=n,n=r,r=void 0;try{return new OT(e instanceof OT?e.version:e,r).inc(t,n,o).version}catch(s){return null}};CT.exports=s4});var qT=D(function(BY,jT){var NT=Hn(),i4=(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=i4});var LT=D(function(WY,MT){var a4=wt(),c4=(e,t)=>new a4(e,t).major;MT.exports=c4});var UT=D(function(YY,DT){var u4=wt(),l4=(e,t)=>new u4(e,t).minor;DT.exports=l4});var VT=D(function(XY,FT){var d4=wt(),p4=(e,t)=>new d4(e,t).patch;FT.exports=p4});var ZT=D(function(QY,HT){var f4=Hn(),m4=(e,t)=>{let r=f4(e,t);return r&&r.prerelease.length?r.prerelease:null};HT.exports=m4});var ur=D(function(eX,JT){var GT=wt(),h4=(e,t,r)=>new GT(e,r).compare(new GT(t,r));JT.exports=h4});var BT=D(function(tX,KT){var g4=ur(),y4=(e,t,r)=>g4(t,e,r);KT.exports=y4});var YT=D(function(rX,WT){var _4=ur(),v4=(e,t)=>_4(e,t,!0);WT.exports=v4});var rp=D(function(nX,QT){var XT=wt(),S4=(e,t,r)=>{let n=new XT(e,r),o=new XT(t,r);return n.compare(o)||n.compareBuild(o)};QT.exports=S4});var tI=D(function(oX,eI){var b4=rp(),$4=(e,t)=>e.sort((r,n)=>b4(r,n,t));eI.exports=$4});var nI=D(function(sX,rI){var w4=rp(),R4=(e,t)=>e.sort((r,n)=>w4(n,r,t));rI.exports=R4});var Na=D(function(iX,oI){var E4=ur(),z4=(e,t,r)=>E4(e,t,r)>0;oI.exports=z4});var np=D(function(aX,sI){var P4=ur(),T4=(e,t,r)=>P4(e,t,r)<0;sI.exports=T4});var Cg=D(function(cX,iI){var I4=ur(),x4=(e,t,r)=>I4(e,t,r)===0;iI.exports=x4});var Ag=D(function(uX,aI){var k4=ur(),O4=(e,t,r)=>k4(e,t,r)!==0;aI.exports=O4});var op=D(function(lX,cI){var C4=ur(),A4=(e,t,r)=>C4(e,t,r)>=0;cI.exports=A4});var sp=D(function(dX,uI){var N4=ur(),j4=(e,t,r)=>N4(e,t,r)<=0;uI.exports=j4});var Ng=D(function(pX,lI){var q4=Cg(),M4=Ag(),L4=Na(),D4=op(),U4=np(),F4=sp(),V4=(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 q4(e,r,n);case"!=":return M4(e,r,n);case">":return L4(e,r,n);case">=":return D4(e,r,n);case"<":return U4(e,r,n);case"<=":return F4(e,r,n);default:throw TypeError(`Invalid operator: ${t}`)}};lI.exports=V4});var pI=D(function(fX,dI){var H4=wt(),Z4=Hn(),{safeRe:ip,t:ap}=Us(),G4=(e,t)=>{if(e instanceof H4)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?ip[ap.COERCEFULL]:ip[ap.COERCE]);else{let c=t.includePrerelease?ip[ap.COERCERTLFULL]:ip[ap.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 Z4(`${n}.${o}.${s}${i}${a}`,t)};dI.exports=G4});var hI=D(function(mX,mI){var J4=Hn(),fI=Ds(),K4=wt(),B4=(e,t,r)=>{if(!fI.RELEASE_TYPES.includes(t))return null;let n=W4(e,r);return n&&Y4(n,t)},W4=(e,t)=>{let r=e instanceof K4?e.version:e;return J4(r,t)},Y4=(e,t)=>{if(X4(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()},X4=(e)=>e.startsWith("pre");mI.exports=B4});var _I=D(function(hX,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(gX,$I){var Q4=/\s+/g;class ja{constructor(e,t){if(t=tH(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 cp)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(Q4," "),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&&lH(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(uH,"");let r=((this.options.includePrerelease&&aH)|(this.options.loose&&cH))+":"+e,n=vI.get(r);if(n)return n;let o=this.options.loose,s=o?Mt[Rt.HYPHENRANGELOOSE]:Mt[Rt.HYPHENRANGE];e=e.replace(s,bH(this.options.includePrerelease)),Je("hyphen replace",e),e=e.replace(Mt[Rt.COMPARATORTRIM],oH),Je("comparator trim",e),e=e.replace(Mt[Rt.TILDETRIM],sH),Je("tilde trim",e),e=e.replace(Mt[Rt.CARETTRIM],iH),Je("caret trim",e);let i=e.split(" ").map((l)=>dH(l,this.options)).join(" ").split(/\s+/).map((l)=>SH(l,this.options));if(o)i=i.filter((l)=>(Je("loose invalid filter",l,this.options),!!l.match(Mt[Rt.COMPARATORLOOSE])));Je("range list",i);let a=new Map,c=i.map((l)=>new cp(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 rH(e,this.options)}catch(t){return!1}for(let t=0;t<this.set.length;t++)if($H(this.set[t],e,this.options))return!0;return!1}}$I.exports=ja;var eH=_I(),vI=new eH,tH=Yd(),cp=qa(),Je=Aa(),rH=wt(),{safeRe:Mt,src:nH,t:Rt,comparatorTrimReplace:oH,tildeTrimReplace:sH,caretTrimReplace:iH}=Us(),{FLAG_INCLUDE_PRERELEASE:aH,FLAG_LOOSE:cH}=Ds(),uH=new RegExp(nH[Rt.BUILD],"g"),SI=(e)=>e.value==="<0.0.0-0",lH=(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},dH=(e,t)=>(e=e.replace(Mt[Rt.BUILD],""),Je("comp",e,t),e=hH(e,t),Je("caret",e),e=fH(e,t),Je("tildes",e),e=yH(e,t),Je("xrange",e),e=vH(e,t),Je("stars",e),e),mt=(e)=>!e||e.toLowerCase()==="x"||e==="*",pH=(e,t,r)=>mt(e)&&!mt(t)||mt(t)&&r&&!mt(r),fH=(e,t)=>e.trim().split(/\s+/).map((r)=>mH(r,t)).join(" "),mH=(e,t)=>{let r=t.loose?Mt[Rt.TILDELOOSE]:Mt[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})},hH=(e,t)=>e.trim().split(/\s+/).map((r)=>gH(r,t)).join(" "),gH=(e,t)=>{Je("caret",e,t);let r=t.loose?Mt[Rt.CARETLOOSE]:Mt[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})},yH=(e,t)=>(Je("replaceXRanges",e,t),e.split(/\s+/).map((r)=>_H(r,t)).join(" ")),_H=(e,t)=>{e=e.trim();let r=t.loose?Mt[Rt.XRANGELOOSE]:Mt[Rt.XRANGE];return e.replace(r,(n,o,s,i,a,c)=>{if(Je("xRange",e,n,o,s,i,a,c),pH(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})},vH=(e,t)=>(Je("replaceStars",e,t),e.trim().replace(Mt[Rt.STAR],"")),SH=(e,t)=>(Je("replaceGTE0",e,t),e.trim().replace(Mt[t.includePrerelease?Rt.GTE0PRE:Rt.GTE0],"")),bH=(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()},$H=(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===cp.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(yX,TI){var Ma=Symbol("SemVer ANY");class up{static get ANY(){return Ma}constructor(e,t){if(t=wI(t),e instanceof up)if(e.loose===!!t.loose)return e;else e=e.value;if(e=e.trim().split(/\s+/).join(" "),qg("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;qg("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(qg("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 jg(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof up))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(jg(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))return!0;if(jg(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">"))return!0;return!1}}TI.exports=up;var wI=Yd(),{safeRe:RI,t:EI}=Us(),jg=Ng(),qg=Aa(),zI=wt(),PI=lr()});var La=D(function(_X,II){var wH=lr(),RH=(e,t,r)=>{try{t=new wH(t,r)}catch(n){return!1}return t.test(e)};II.exports=RH});var kI=D(function(vX,xI){var EH=lr(),zH=(e,t)=>new EH(e,t).set.map((r)=>r.map((n)=>n.value).join(" ").trim().split(" "));xI.exports=zH});var CI=D(function(SX,OI){var PH=wt(),TH=lr(),IH=(e,t,r)=>{let n=null,o=null,s=null;try{s=new TH(t,r)}catch(i){return null}return e.forEach((i)=>{if(s.test(i)){if(!n||o.compare(i)===-1)n=i,o=new PH(n,r)}}),n};OI.exports=IH});var NI=D(function(bX,AI){var xH=wt(),kH=lr(),OH=(e,t,r)=>{let n=null,o=null,s=null;try{s=new kH(t,r)}catch(i){return null}return e.forEach((i)=>{if(s.test(i)){if(!n||o.compare(i)===1)n=i,o=new xH(n,r)}}),n};AI.exports=OH});var MI=D(function($X,qI){var Mg=wt(),CH=lr(),jI=Na(),AH=(e,t)=>{e=new CH(e,t);let r=new Mg("0.0.0");if(e.test(r))return r;if(r=new Mg("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 Mg(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=AH});var DI=D(function(wX,LI){var NH=lr(),jH=(e,t)=>{try{return new NH(e,t).range||"*"}catch(r){return null}};LI.exports=jH});var lp=D(function(RX,HI){var qH=wt(),VI=qa(),{ANY:MH}=VI,LH=lr(),DH=La(),UI=Na(),FI=np(),UH=sp(),FH=op(),VH=(e,t,r,n)=>{e=new qH(e,n),t=new LH(t,n);let o,s,i,a,c;switch(r){case">":o=UI,s=UH,i=FI,a=">",c=">=";break;case"<":o=FI,s=FH,i=UI,a="<",c="<=";break;default:throw TypeError('Must provide a hilo val of "<" or ">"')}if(DH(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===MH)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=VH});var GI=D(function(EX,ZI){var HH=lp(),ZH=(e,t,r)=>HH(e,t,">",r);ZI.exports=ZH});var KI=D(function(zX,JI){var GH=lp(),JH=(e,t,r)=>GH(e,t,"<",r);JI.exports=JH});var YI=D(function(PX,WI){var BI=lr(),KH=(e,t,r)=>(e=new BI(e,r),t=new BI(t,r),e.intersects(t,r));WI.exports=KH});var QI=D(function(TX,XI){var BH=La(),WH=ur();XI.exports=(e,t,r)=>{let n=[],o=null,s=null,i=e.sort((l,d)=>WH(l,d,r));for(let l of i)if(BH(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 sx=D(function(IX,ox){var ex=lr(),Ug=qa(),{ANY:Lg}=Ug,Dg=La(),Fg=ur(),YH=(e,t,r={})=>{if(e===t)return!0;e=new ex(e,r),t=new ex(t,r);let n=!1;e:for(let o of e.set){for(let s of t.set){let i=QH(o,s,r);if(n=n||i!==null,i)continue e}if(n)return!1}return!0},XH=[new Ug(">=0.0.0-0")],tx=[new Ug(">=0.0.0")],QH=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===Lg)if(t.length===1&&t[0].semver===Lg)return!0;else if(r.includePrerelease)e=XH;else e=tx;if(t.length===1&&t[0].semver===Lg)if(r.includePrerelease)return!0;else t=tx;let n=new Set,o,s;for(let m of e)if(m.operator===">"||m.operator===">=")o=rx(o,m,r);else if(m.operator==="<"||m.operator==="<=")s=nx(s,m,r);else n.add(m.semver);if(n.size>1)return null;let i;if(o&&s){if(i=Fg(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&&!Dg(m,String(o),r))return null;if(s&&!Dg(m,String(s),r))return null;for(let h of t)if(!Dg(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=rx(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=nx(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},rx=(e,t,r)=>{if(!e)return t;let n=Fg(e.semver,t.semver,r);return n>0?e:n<0?t:t.operator===">"&&e.operator===">="?t:e},nx=(e,t,r)=>{if(!e)return t;let n=Fg(e.semver,t.semver,r);return n<0?e:n>0?t:t.operator==="<"&&e.operator==="<="?t:e};ox.exports=YH});var ax=D(function(xX,ix){var Fs=Us(),dp=Ds(),eZ=wt(),pp=kg(),tZ=Hn(),rZ=IT(),nZ=kT(),oZ=AT(),sZ=qT(),iZ=LT(),aZ=UT(),cZ=VT(),uZ=ZT(),lZ=ur(),dZ=BT(),pZ=YT(),fZ=rp(),mZ=tI(),hZ=nI(),gZ=Na(),yZ=np(),_Z=Cg(),vZ=Ag(),SZ=op(),bZ=sp(),$Z=Ng(),wZ=pI(),RZ=hI(),EZ=qa(),zZ=lr(),PZ=La(),TZ=kI(),IZ=CI(),xZ=NI(),kZ=MI(),OZ=DI(),CZ=lp(),AZ=GI(),NZ=KI(),jZ=YI(),qZ=QI(),MZ=sx();ix.exports={parse:tZ,valid:rZ,clean:nZ,inc:oZ,diff:sZ,major:iZ,minor:aZ,patch:cZ,prerelease:uZ,compare:lZ,rcompare:dZ,compareLoose:pZ,compareBuild:fZ,sort:mZ,rsort:hZ,gt:gZ,lt:yZ,eq:_Z,neq:vZ,gte:SZ,lte:bZ,cmp:$Z,coerce:wZ,truncate:RZ,Comparator:EZ,Range:zZ,satisfies:PZ,toComparators:TZ,maxSatisfying:IZ,minSatisfying:xZ,minVersion:kZ,validRange:OZ,outside:CZ,gtr:AZ,ltr:NZ,intersects:jZ,simplifyRange:qZ,subset:MZ,SemVer:eZ,re:Fs.re,src:Fs.src,tokens:Fs.t,SEMVER_SPEC_VERSION:dp.SEMVER_SPEC_VERSION,RELEASE_TYPES:dp.RELEASE_TYPES,compareIdentifiers:pp.compareIdentifiers,rcompareIdentifiers:pp.rcompareIdentifiers}});var{create:vO,defineProperty:mc,getOwnPropertyDescriptor:SO,getOwnPropertyNames:bO,getPrototypeOf:$O}=Object,wO=Object.prototype.hasOwnProperty,J=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),wy=(e,t)=>{let r={};for(var n in e)mc(r,n,{get:e[n],enumerable:!0});if(t)mc(r,Symbol.toStringTag,{value:"Module"});return r},RO=(e,t,r,n)=>{if(t&&typeof t==="object"||typeof t==="function"){for(var o=bO(t),s=0,i=o.length,a;s<i;s++)if(a=o[s],!wO.call(e,a)&&a!==r)mc(e,a,{get:((c)=>t[c]).bind(null,a),enumerable:!(n=SO(t,a))||n.enumerable})}return e},hc=(e,t,r)=>(r=e!=null?vO($O(e)):{},RO(t||!e||!e.__esModule?mc(r,"default",{value:e,enumerable:!0}):r,e));var EO=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),Ry=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),zO=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),PO=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"]);function Ey(e){return typeof e==="string"&&Ry.has(e.replace(/#$/,""))}function zy(e,t){if(!("$schema"in e)||typeof e.$schema!=="string")return"2020-12";let r=e.$schema.replace(/#$/,"");if(EO.has(r))return"2020-12";if(Ry.has(r))return"2019-09";if(zO.has(r)||PO.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 Ap=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 TO=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 gc={};function Yt(e){if(e)Object.assign(gc,e);return gc}function _c(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 jp(e,t="|"){return e.map((r)=>Dp(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 vc(e){return e===null||e===void 0}function Sc(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Ty(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 Py=Symbol("evaluating");function Oe(e,t,r){let n=void 0;Object.defineProperty(e,t,{get(){if(n===Py)return;if(n===void 0)n=Py,n=r();return n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function so(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 qp(e){return JSON.stringify(e)}function Iy(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Mp="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Ho(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var xy=$i(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function io(e){if(Ho(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(Ho(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function Lp(e){if(io(e))return{...e};if(Array.isArray(e))return[...e];return e}var ky=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 Dp(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function Oy(e){return Object.keys(e).filter((t)=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Cy={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 IO(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 so(this,"shape",i),i},checks:[]});return mr(e,s)}function xO(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 so(this,"shape",i),i},checks:[]});return mr(e,s)}function kO(e,t){if(!io(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 so(this,"shape",s),s}});return mr(e,o)}function OO(e,t){if(!io(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 so(this,"shape",n),n}});return mr(e,r)}function CO(e,t){let r=on(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return so(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return mr(e,r)}function AO(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 so(this,"shape",c),c},checks:[]});return mr(t,i)}function NO(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 so(this,"shape",s),s}});return mr(t,n)}function ao(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 yc(e){return typeof e==="string"?e:e?.message}function $r(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let o=yc(e.inst?._zod.def?.error?.(e))??yc(t?.error?.(e))??yc(r.customError?.(e))??yc(r.localeError?.(e))??"Invalid input";n.message=o}if(delete n.inst,delete n.continue,!t?.reportInput)delete n.input;return n}function bc(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function Ay(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 co(...e){let[t,r,n]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:n};return{...t}}var Ny=(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})},$c=U("$ZodError",Ny),Up=U("$ZodError",Ny,{Parent:Error});function Fp(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 Vp(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 wc=(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 Mp(a,o?.callee),a}return i.value};var Rc=(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 Mp(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??$c)(s.issues.map((i)=>$r(i,o,Yt())))}:{success:!0,data:s.value}},jy=wi(Up),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}},qy=Ri(Up),My=(e)=>(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return wc(e)(t,r,o)};var Ly=(e)=>(t,r,n)=>wc(e)(t,r,n);var Dy=(e)=>async(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Rc(e)(t,r,o)};var Uy=(e)=>async(t,r,n)=>Rc(e)(t,r,n);var Fy=(e)=>(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return wi(e)(t,r,o)};var Vy=(e)=>(t,r,n)=>wi(e)(t,r,n);var Hy=(e)=>async(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Ri(e)(t,r,o)};var Zy=(e)=>async(t,r,n)=>Ri(e)(t,r,n);var Gy=/^[cC][^\s-]{8,}$/,Jy=/^[0-9a-z]+$/,Ky=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,By=/^[0-9a-vA-V]{20}$/,Wy=/^[A-Za-z0-9]{27}$/,Yy=/^[a-zA-Z0-9_-]{21}$/,Xy=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Qy=/^([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})$/,Hp=(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 e_=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var qO="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function t_(){return new RegExp(qO,"u")}var r_=/^(?:(?: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])$/,n_=/^(([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 o_=/^((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])$/,s_=/^(([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])$/,i_=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Zp=/^[A-Za-z0-9_-]*$/;var a_=/^\+[1-9]\d{6,14}$/,c_="(?:(?:\\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])))",u_=new RegExp(`^${c_}$`);function l_(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 d_(e){return new RegExp(`^${l_(e)}$`)}function p_(e){let t=l_({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(`^${c_}T(?:${n})$`)}var f_=(e)=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var m_=/^-?\d+$/,Gp=/^-?\d+(?:\.\d+)?$/,h_=/^(?:true|false)$/i,g_=/^null$/i;var y_=/^[^A-Z]*$/,__=/^[^a-z]*$/;var bt=U("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),v_={number:"number",bigint:"bigint",object:"date"},Jp=U("$ZodCheckLessThan",(e,t)=>{bt.init(e,t);let r=v_[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})}}),Kp=U("$ZodCheckGreaterThan",(e,t)=>{bt.init(e,t);let r=v_[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})}}),S_=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):Ty(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})}}),b_=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]=Cy[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=m_}),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 $_=U("$ZodCheckMaxLength",(e,t)=>{var r;bt.init(e,t),(r=e._zod.def).when??(r.when=(n)=>{let o=n.value;return!vc(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=bc(o);n.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),w_=U("$ZodCheckMinLength",(e,t)=>{var r;bt.init(e,t),(r=e._zod.def).when??(r.when=(n)=>{let o=n.value;return!vc(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=bc(o);n.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),R_=U("$ZodCheckLengthEquals",(e,t)=>{var r;bt.init(e,t),(r=e._zod.def).when??(r.when=(n)=>{let o=n.value;return!vc(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=bc(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=()=>{})}),E_=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})}}),z_=U("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=y_),zi.init(e,t)}),P_=U("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=__),zi.init(e,t)}),T_=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})}}),I_=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})}}),x_=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 k_=U("$ZodCheckOverwrite",(e,t)=>{bt.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class Bp{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(`
|
|
9
|
+
deps: ${r}}`};var UU={keyword:"dependencies",type:"object",schemaType:"object",error:Tz.error,code(e){let[t,r]=FU(e);zz(e,t),Pz(e,r)}};function FU({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 zz(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=Dr.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)Dr.checkReportMissingProp(e,u)});else r.if(Ns._`${c} && (${Dr.checkMissingProp(e,a,s)})`),Dr.reportMissingProp(e,s),r.else()}}Tz.validatePropertyDeps=zz;function Pz(e,t=e.schema){let{gen:r,data:n,keyword:o,it:s}=e,i=r.name("valid");for(let a in t){if(Ez.alwaysValidSchema(s,t[a]))continue;r.if(Dr.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)}}Tz.validateSchemaDeps=Pz;Tz.default=UU});var Oz=D(function(Cz){Object.defineProperty(Cz,"__esModule",{value:!0});var qd=we(),xz=Ie(),ZU={message:"property name must be valid",params:({params:e})=>qd._`{propertyName: ${e.propertyName}}`},GU={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:ZU,code(e){let{gen:t,schema:r,data:n,it:o}=e;if(xz.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(qd.not(s),()=>{if(e.error(!0),!o.allErrors)t.break()})}),e.ok(s)}};Cz.default=GU});var mg=D(function(Az){Object.defineProperty(Az,"__esModule",{value:!0});var Ln=sr(),at=we(),BU=nr(),Dn=Ie(),KU={message:"must NOT have additional properties",params:({params:e})=>at._`{additionalProperty: ${e.additionalProperty}}`},WU={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:KU,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"&&Dn.alwaysValidSchema(i,r))return;let u=Ln.allSchemaProperties(n.properties),l=Ln.allSchemaProperties(n.patternProperties);d(),e.ok(at._`${s} === ${BU.default.errors}`);function d(){t.forIn("key",o,(_)=>{if(!u.length&&!l.length)h(_);else t.if(p(_),()=>h(_))})}function p(_){let g;if(u.length>8){let S=Dn.schemaRefOrVal(i,n.properties,"properties");g=Ln.isOwnProperty(t,S,_)}else if(u.length)g=at.or(...u.map((S)=>at._`${_} === ${S}`));else g=at.nil;if(l.length)g=at.or(g,...l.map((S)=>at._`${Ln.usePattern(e,S)}.test(${_})`));return at.not(g)}function f(_){t.code(at._`delete ${o}[${_}]`)}function h(_){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){f(_);return}if(r===!1){if(e.setParams({additionalProperty:_}),e.error(),!a)t.break();return}if(typeof r=="object"&&!Dn.alwaysValidSchema(i,r)){let g=t.name("valid");if(c.removeAdditional==="failing")y(_,g,!1),t.if(at.not(g),()=>{e.reset(),f(_)});else if(y(_,g),!a)t.if(at.not(g),()=>t.break())}}function y(_,g,S){let v={keyword:"additionalProperties",dataProp:_,dataPropType:Dn.Type.Str};if(S===!1)Object.assign(v,{compositeRule:!0,createErrors:!1,allErrors:!1});e.subschema(v,g)}}};Az.default=WU});var Mz=D(function(qz){Object.defineProperty(qz,"__esModule",{value:!0});var jz=zs(),Md=sr(),js=Ie(),Nz=mg(),XU={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)Nz.default.code(new jz.KeywordCxt(s,Nz.default,"additionalProperties"));let i=Md.allSchemaProperties(r);for(let d of i)s.definedProperties.add(d);if(s.opts.unevaluated&&i.length&&s.props!==!0)s.props=js.mergeEvaluated.props(t,js.toHash(i),s.props);let a=i.filter((d)=>!js.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(Md.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)}}};qz.default=XU});var Dz=D(function(Lz){Object.defineProperty(Lz,"__esModule",{value:!0});var Ld=sr(),Un=we(),Dd=Ie(),Ud=Ie(),eF={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:o,it:s}=e,{opts:i}=s,a=Ld.allSchemaProperties(r),c=a.filter((y)=>Dd.alwaysValidSchema(s,r[y]));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 Un.Name))s.props=Ud.evaluatedPropsToName(t,s.props);let{props:d}=s;p();function p(){for(let y of a){if(u)f(y);if(s.allErrors)h(y);else t.var(l,!0),h(y),t.if(l)}}function f(y){for(let _ in u)if(new RegExp(y).test(_))Dd.checkStrictMode(s,`property ${_} matches pattern ${y} (use allowMatchingProperties)`)}function h(y){t.forIn("key",n,(_)=>{t.if(Un._`${Ld.usePattern(e,y)}.test(${_})`,()=>{let g=c.includes(y);if(!g)e.subschema({keyword:"patternProperties",schemaProp:y,dataProp:_,dataPropType:Ud.Type.Str},l);if(s.opts.unevaluated&&d!==!0)t.assign(Un._`${d}[${_}]`,!0);else if(!g&&!s.allErrors)t.if(Un.not(l),()=>t.break())})})}}};Lz.default=eF});var Vz=D(function(Fz){Object.defineProperty(Fz,"__esModule",{value:!0});var Uz=Ie(),rF={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if(Uz.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"}};Fz.default=rF});var Gz=D(function(Zz){Object.defineProperty(Zz,"__esModule",{value:!0});var Hz=sr(),oF={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Hz.validateUnion,error:{message:"must match a schema in anyOf"}};Zz.default=oF});var Kz=D(function(Bz){Object.defineProperty(Bz,"__esModule",{value:!0});var Fn=we(),Jz=Ie(),iF={message:"must match exactly one schema in oneOf",params:({params:e})=>Fn._`{passingSchemas: ${e.passing}}`},aF={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:iF,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(Jz.alwaysValidSchema(o,l))t.var(c,!0);else p=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c);if(d>0)t.if(Fn._`${c} && ${i}`).assign(i,!1).assign(a,Fn._`[${a}, ${d}]`).else();t.if(c,()=>{if(t.assign(i,!0),t.assign(a,d),p)e.mergeEvaluated(p,Fn.Name)})})}}};Bz.default=aF});var Xz=D(function(Yz){Object.defineProperty(Yz,"__esModule",{value:!0});var Wz=Ie(),uF={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(Wz.alwaysValidSchema(n,s))return;let a=e.subschema({keyword:"allOf",schemaProp:i},o);e.ok(o),e.mergeEvaluated(a)})}};Yz.default=uF});var tP=D(function(eP){Object.defineProperty(eP,"__esModule",{value:!0});var Vn=we(),Fd=Ie(),dF={message:({params:e})=>Vn.str`must match "${e.ifClause}" schema`,params:({params:e})=>Vn._`{failingKeyword: ${e.ifClause}}`},pF={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:dF,code(e){let{gen:t,parentSchema:r,it:n}=e;if(r.then===void 0&&r.else===void 0)Fd.checkStrictMode(n,'"if" without "then" and "else" is ignored');let o=Qz(n,"then"),s=Qz(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(Vn.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,Vn._`${l}`);else e.setParams({ifClause:l})}}}};function Qz(e,t){let r=e.schema[t];return r!==void 0&&!Fd.alwaysValidSchema(e,r)}eP.default=pF});var oP=D(function(nP){Object.defineProperty(nP,"__esModule",{value:!0});var rP=Ie(),mF={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){if(t.if===void 0)rP.checkStrictMode(r,`"${e}" without "if" is ignored`)}};nP.default=mF});var hg=D(function(sP){Object.defineProperty(sP,"__esModule",{value:!0});var gF=pg(),yF=yz(),_F=fg(),vF=wz(),SF=Rz(),bF=jd(),wF=Oz(),$F=mg(),RF=Mz(),EF=Dz(),zF=Vz(),PF=Gz(),TF=Kz(),kF=Xz(),IF=tP(),xF=oP();function CF(e=!1){let t=[zF.default,PF.default,TF.default,kF.default,IF.default,xF.default,wF.default,$F.default,bF.default,RF.default,EF.default];if(e)t.push(yF.default,vF.default);else t.push(gF.default,_F.default);return t.push(SF.default),t}sP.default=CF});var gg=D(function(cP){Object.defineProperty(cP,"__esModule",{value:!0});cP.dynamicAnchor=void 0;var qs=we(),AF=nr(),Vd=Oa(),iP=xd(),NF={keyword:"$dynamicAnchor",schemaType:"string",code:(e)=>aP(e,e.schema)};function aP(e,t){let{gen:r,it:n}=e;n.schemaEnv.root.dynamicAnchors[t]=!0;let o=qs._`${AF.default.dynamicAnchors}${qs.getProperty(t)}`,s=n.errSchemaPath==="#"?n.validateName:jF(e);r.if(qs._`!${o}`,()=>r.assign(o,s))}cP.dynamicAnchor=aP;function jF(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 Vd.SchemaEnv({schema:r,schemaId:c,root:o,baseId:s,localRefs:i,meta:a});return Vd.compileSchema.call(n,u),iP.getValidate(e,u)}cP.default=NF});var yg=D(function(dP){Object.defineProperty(dP,"__esModule",{value:!0});dP.dynamicRef=void 0;var Hd=we(),MF=nr(),Zd=xd(),LF={keyword:"$dynamicRef",schemaType:"string",code:(e)=>lP(e,e.schema)};function lP(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",Hd._`${MF.default.dynamicAnchors}${Hd.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(()=>{Zd.callRef(e,c),r.let(u,!0)}):()=>Zd.callRef(e,c)}}dP.dynamicRef=lP;dP.default=LF});var gP=D(function(hP){Object.defineProperty(hP,"__esModule",{value:!0});var fP=gg(),mP=Ie(),UF={keyword:"$recursiveAnchor",schemaType:"boolean",code(e){if(e.schema)fP.dynamicAnchor(e,"");else mP.checkStrictMode(e.it,"$recursiveAnchor: false is ignored")}};hP.default=UF});var vP=D(function(_P){Object.defineProperty(_P,"__esModule",{value:!0});var yP=yg(),VF={keyword:"$recursiveRef",schemaType:"string",code:(e)=>yP.dynamicRef(e,e.schema)};_P.default=VF});var bP=D(function(SP){Object.defineProperty(SP,"__esModule",{value:!0});var ZF=gg(),GF=yg(),JF=gP(),BF=vP(),KF=[ZF.default,GF.default,JF.default,BF.default];SP.default=KF});var $P=D(function(wP){Object.defineProperty(wP,"__esModule",{value:!0});var Gd=jd(),YF={keyword:"dependentRequired",type:"object",schemaType:"object",error:Gd.error,code:(e)=>Gd.validatePropertyDeps(e)};wP.default=YF});var zP=D(function(EP){Object.defineProperty(EP,"__esModule",{value:!0});var RP=jd(),QF={keyword:"dependentSchemas",type:"object",schemaType:"object",code:(e)=>RP.validateSchemaDeps(e)};EP.default=QF});var kP=D(function(TP){Object.defineProperty(TP,"__esModule",{value:!0});var PP=Ie(),tV={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:e,parentSchema:t,it:r}){if(t.contains===void 0)PP.checkStrictMode(r,`"${e}" without "contains" is ignored`)}};TP.default=tV});var xP=D(function(IP){Object.defineProperty(IP,"__esModule",{value:!0});var nV=$P(),oV=zP(),sV=kP(),iV=[nV.default,oV.default,sV.default];IP.default=iV});var OP=D(function(CP){Object.defineProperty(CP,"__esModule",{value:!0});var At=we(),Jd=Ie(),cV=nr(),uV={message:"must NOT have unevaluated properties",params:({params:e})=>At._`{unevaluatedProperty: ${e.unevaluatedProperty}}`},lV={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:uV,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 At.Name)t.if(At._`${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(At._`${o} === ${cV.default.errors}`);function c(d){if(r===!1){if(e.setParams({unevaluatedProperty:d}),e.error(),!i)t.break();return}if(!Jd.alwaysValidSchema(s,r)){let p=t.name("valid");if(e.subschema({keyword:"unevaluatedProperties",dataProp:d,dataPropType:Jd.Type.Str},p),!i)t.if(At.not(p),()=>t.break())}}function u(d,p){return At._`!${d} || !${d}[${p}]`}function l(d,p){let f=[];for(let h in d)if(d[h]===!0)f.push(At._`${p} !== ${h}`);return At.and(...f)}}};CP.default=lV});var NP=D(function(AP){Object.defineProperty(AP,"__esModule",{value:!0});var Gt=we(),Bd=Ie(),pV={message:({params:{len:e}})=>Gt.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Gt._`{limit: ${e}}`},fV={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:pV,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"&&!Bd.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:Bd.Type.Num},c),!o.allErrors)t.if(Gt.not(c),()=>t.break())})}}};AP.default=fV});var qP=D(function(jP){Object.defineProperty(jP,"__esModule",{value:!0});var hV=OP(),gV=NP(),yV=[hV.default,gV.default];jP.default=yV});var LP=D(function(MP){Object.defineProperty(MP,"__esModule",{value:!0});var ze=we(),vV={message:({schemaCode:e})=>ze.str`must match format "${e}"`,params:({schemaCode:e})=>ze._`{format: ${e}}`},SV={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:vV,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 f();function p(){let h=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),y=r.const("fDef",ze._`${h}[${i}]`),_=r.let("fType"),g=r.let("format");r.if(ze._`typeof ${y} == "object" && !(${y} instanceof RegExp)`,()=>r.assign(_,ze._`${y}.type || "string"`).assign(g,ze._`${y}.validate`),()=>r.assign(_,ze._`"string"`).assign(g,y)),e.fail$data(ze.or(S(),v()));function S(){if(c.strictSchema===!1)return ze.nil;return ze._`${i} && !${g}`}function v(){let w=l.$async?ze._`(${y}.async ? await ${g}(${n}) : ${g}(${n}))`:ze._`${g}(${n})`,z=ze._`(typeof ${g} == "function" ? ${w} : ${g}.test(${n}))`;return ze._`${g} && ${g} !== true && ${_} === ${t} && !${z}`}}function f(){let h=d.formats[s];if(!h){S();return}if(h===!0)return;let[y,_,g]=v(h);if(y===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 ${g}(${n})`}return typeof _=="function"?ze._`${g}(${n})`:ze._`${g}.test(${n})`}}}};MP.default=SV});var _g=D(function(DP){Object.defineProperty(DP,"__esModule",{value:!0});var wV=LP(),$V=[wV.default];DP.default=$V});var vg=D(function(UP){Object.defineProperty(UP,"__esModule",{value:!0});UP.contentVocabulary=UP.metadataVocabulary=void 0;UP.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];UP.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var HP=D(function(VP){Object.defineProperty(VP,"__esModule",{value:!0});var zV=lg(),PV=dg(),TV=hg(),kV=bP(),IV=xP(),xV=qP(),CV=_g(),Kd=vg(),OV=[kV.default,zV.default,PV.default,(0,TV.default)(!0),CV.default,Kd.metadataVocabulary,Kd.contentVocabulary,IV.default,xV.default];VP.default=OV});var BP=D(function(GP){Object.defineProperty(GP,"__esModule",{value:!0});GP.DiscrError=void 0;var ZP;(function(e){e.Tag="tag",e.Mapping="mapping"})(ZP||(GP.DiscrError=ZP={}))});var Sg=D(function(WP){Object.defineProperty(WP,"__esModule",{value:!0});var ar=we(),Ms=BP(),Wd=Oa(),NV=Ts(),KP=Ie(),jV={message:({params:{discrError:e,tagName:t}})=>e===Ms.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}}`},qV={keyword:"discriminator",type:"object",schemaType:"object",error:jV,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:Ms.DiscrError.Tag,tag:u,tagName:a})),e.ok(c);function l(){let f=p();t.if(!1);for(let h in f)t.elseIf(ar._`${u} === ${h}`),t.assign(c,d(f[h]));t.else(),e.error(!1,{discrError:Ms.DiscrError.Mapping,tag:u,tagName:a}),t.endIf()}function d(f){let h=t.name("valid"),y=e.subschema({keyword:"oneOf",schemaProp:f},h);return e.mergeEvaluated(y,ar.Name),h}function p(){var f;let h={},y=g(o),_=!0;for(let w=0;w<i.length;w++){let z=i[w];if((z===null||z===void 0?void 0:z.$ref)&&!KP.schemaHasRulesButRef(z,s.self.RULES)){let b=z.$ref;if(z=Wd.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,b),z instanceof Wd.SchemaEnv)z=z.schema;if(z===void 0)throw new NV.default(s.opts.uriResolver,s.baseId,b)}let R=(f=z===null||z===void 0?void 0:z.properties)===null||f===void 0?void 0:f[a];if(typeof R!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);_=_&&(y||g(z)),S(R,w)}if(!_)throw Error(`discriminator: "${a}" must be required`);return h;function g({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}}}};WP.default=qV});var YP=D(function(fX,LV){LV.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 XP=D(function(mX,DV){DV.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 QP=D(function(hX,UV){UV.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 eT=D(function(gX,FV){FV.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 tT=D(function(yX,VV){VV.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 rT=D(function(_X,HV){HV.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 nT=D(function(vX,ZV){ZV.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 oT=D(function(SX,GV){GV.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 iT=D(function(sT){Object.defineProperty(sT,"__esModule",{value:!0});var JV=YP(),BV=XP(),KV=QP(),WV=eT(),YV=tT(),XV=rT(),QV=nT(),eH=oT(),tH=["/properties"];function rH(e){return[JV,BV,KV,WV,YV,t(this,XV),QV,t(this,eH)].forEach((r)=>this.addMetaSchema(r,void 0,!1)),this;function t(r,n){return e?r.$dataMetaSchema(n,tH):n}}sT.default=rH});var aT=D(function(Jt,wg){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 oH=ug(),sH=HP(),iH=Sg(),aH=iT(),bg="https://json-schema.org/draft/2020-12/schema";class ja extends oH.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){if(super._addVocabularies(),sH.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(iH.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:e,meta:t}=this.opts;if(!t)return;aH.default.call(this,e),this.refs["http://json-schema.org/schema"]=bg}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(bg)?bg:void 0)}}Jt.Ajv2020=ja;wg.exports=Jt=ja;wg.exports.Ajv2020=ja;Object.defineProperty(Jt,"__esModule",{value:!0});Jt.default=ja;var cH=zs();Object.defineProperty(Jt,"KeywordCxt",{enumerable:!0,get:function(){return cH.KeywordCxt}});var Ls=we();Object.defineProperty(Jt,"_",{enumerable:!0,get:function(){return Ls._}});Object.defineProperty(Jt,"str",{enumerable:!0,get:function(){return Ls.str}});Object.defineProperty(Jt,"stringify",{enumerable:!0,get:function(){return Ls.stringify}});Object.defineProperty(Jt,"nil",{enumerable:!0,get:function(){return Ls.nil}});Object.defineProperty(Jt,"Name",{enumerable:!0,get:function(){return Ls.Name}});Object.defineProperty(Jt,"CodeGen",{enumerable:!0,get:function(){return Ls.CodeGen}});var uH=xa();Object.defineProperty(Jt,"ValidationError",{enumerable:!0,get:function(){return uH.default}});var lH=Ts();Object.defineProperty(Jt,"MissingRefError",{enumerable:!0,get:function(){return lH.default}})});var yT=D(function(hT){Object.defineProperty(hT,"__esModule",{value:!0});hT.formatNames=hT.fastFormats=hT.fullFormats=void 0;function Ur(e,t){return{validate:e,compare:t}}hT.fullFormats={date:Ur(dT,zg),time:Ur(Rg(!0),Pg),"date-time":Ur(cT(!0),fT),"iso-time":Ur(Rg(),pT),"iso-date-time":Ur(cT(),mT),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:_H,"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:EH,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:vH,int32:{type:"number",validate:wH},int64:{type:"number",validate:$H},float:{type:"number",validate:lT},double:{type:"number",validate:lT},password:!0,binary:!0};hT.fastFormats={...hT.fullFormats,date:Ur(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,zg),time:Ur(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Pg),"date-time":Ur(/^\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,fT),"iso-time":Ur(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,pT),"iso-date-time":Ur(/^\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,mT),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};hT.formatNames=Object.keys(hT.fullFormats);function fH(e){return e%4===0&&(e%100!==0||e%400===0)}var mH=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,hH=[0,31,28,31,30,31,30,31,31,30,31,30,31];function dT(e){let t=mH.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&&fH(r)?29:hH[n])}function zg(e,t){if(!(e&&t))return;if(e>t)return 1;if(e<t)return-1;return 0}var $g=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Rg(e){return function(r){let n=$g.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 Pg(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 pT(e,t){if(!(e&&t))return;let r=$g.exec(e),n=$g.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 Eg=/t|\s/i;function cT(e){let t=Rg(e);return function(n){let o=n.split(Eg);return o.length===2&&dT(o[0])&&t(o[1])}}function fT(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 mT(e,t){if(!(e&&t))return;let[r,n]=e.split(Eg),[o,s]=t.split(Eg),i=zg(r,o);if(i===void 0)return;return i||Pg(n,s)}var gH=/\/|:/,yH=/^(?:[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 _H(e){return gH.test(e)&&yH.test(e)}var uT=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function vH(e){return uT.lastIndex=0,uT.test(e)}var SH=-2147483648,bH=2147483647;function wH(e){return Number.isInteger(e)&&e<=bH&&e>=SH}function $H(e){return Number.isInteger(e)}function lT(){return!0}var RH=/[^\\]\\Z/;function EH(e){if(RH.test(e))return!1;try{return new RegExp(e),!0}catch(t){return!1}}});var vT=D(function(_T){Object.defineProperty(_T,"__esModule",{value:!0});var PH=lg(),TH=dg(),kH=hg(),IH=_g(),Yd=vg(),xH=[PH.default,TH.default,(0,kH.default)(),IH.default,Yd.metadataVocabulary,Yd.contentVocabulary];_T.default=xH});var ST=D(function(CX,OH){OH.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 wT=D(function(Bt,kg){Object.defineProperty(Bt,"__esModule",{value:!0});Bt.MissingRefError=Bt.ValidationError=Bt.CodeGen=Bt.Name=Bt.nil=Bt.stringify=Bt.str=Bt._=Bt.KeywordCxt=Bt.Ajv=void 0;var AH=ug(),NH=vT(),jH=Sg(),bT=ST(),qH=["/properties"],Xd="http://json-schema.org/draft-07/schema";class qa extends AH.default{_addVocabularies(){if(super._addVocabularies(),NH.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(jH.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(bT,qH):bT;this.addMetaSchema(e,Xd,!1),this.refs["http://json-schema.org/schema"]=Xd}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Xd)?Xd:void 0)}}Bt.Ajv=qa;kg.exports=Bt=qa;kg.exports.Ajv=qa;Object.defineProperty(Bt,"__esModule",{value:!0});Bt.default=qa;var MH=zs();Object.defineProperty(Bt,"KeywordCxt",{enumerable:!0,get:function(){return MH.KeywordCxt}});var Ds=we();Object.defineProperty(Bt,"_",{enumerable:!0,get:function(){return Ds._}});Object.defineProperty(Bt,"str",{enumerable:!0,get:function(){return Ds.str}});Object.defineProperty(Bt,"stringify",{enumerable:!0,get:function(){return Ds.stringify}});Object.defineProperty(Bt,"nil",{enumerable:!0,get:function(){return Ds.nil}});Object.defineProperty(Bt,"Name",{enumerable:!0,get:function(){return Ds.Name}});Object.defineProperty(Bt,"CodeGen",{enumerable:!0,get:function(){return Ds.CodeGen}});var LH=xa();Object.defineProperty(Bt,"ValidationError",{enumerable:!0,get:function(){return LH.default}});var DH=Ts();Object.defineProperty(Bt,"MissingRefError",{enumerable:!0,get:function(){return DH.default}})});var ET=D(function(RT){Object.defineProperty(RT,"__esModule",{value:!0});RT.formatLimitDefinition=void 0;var $T=wT(),ct=we(),Hn=ct.operators,Qd={formatMaximum:{okStr:"<=",ok:Hn.LTE,fail:Hn.GT},formatMinimum:{okStr:">=",ok:Hn.GTE,fail:Hn.LT},formatExclusiveMaximum:{okStr:"<",ok:Hn.LT,fail:Hn.GTE},formatExclusiveMinimum:{okStr:">",ok:Hn.GT,fail:Hn.LTE}},VH={message:({keyword:e,schemaCode:t})=>ct.str`should be ${Qd[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>ct._`{comparison: ${Qd[e].okStr}, limit: ${t}}`};RT.formatLimitDefinition={keyword:Object.keys(Qd),type:"string",schemaType:"string",$data:!0,error:VH,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 $T.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}),f=t.const("fmt",ct._`${p}[${c.schemaCode}]`);e.fail$data(ct.or(ct._`typeof ${f} != "object"`,ct._`${f} instanceof RegExp`,ct._`typeof ${f}.compare != "function"`,d(f)))}function l(){let p=c.schema,f=a.formats[p];if(!f||f===!0)return;if(typeof f!="object"||f instanceof RegExp||typeof f.compare!="function")throw Error(`"${o}": format "${p}" does not define "compare" function`);let h=t.scopeValue("formats",{key:p,ref:f,code:i.code.formats?ct._`${i.code.formats}${ct.getProperty(p)}`:void 0});e.fail$data(d(h))}function d(p){return ct._`${p}.compare(${r}, ${n}) ${Qd[o].fail} 0`}},dependencies:["format"]};var HH=(e)=>(e.addKeyword(RT.formatLimitDefinition),e);RT.default=HH});var kT=D(function(Ma,TT){Object.defineProperty(Ma,"__esModule",{value:!0});var cr=yT(),GH=ET(),Us=we(),zT=new Us.Name("fullFormats"),JH=new Us.Name("fastFormats"),xg=(e,t={keywords:!0})=>{if(Array.isArray(t))return PT(e,t,cr.fullFormats,zT),e;let[r,n]=t.mode==="fast"?[cr.fastFormats,JH]:[cr.fullFormats,zT],o=t.formats||cr.formatNames;if(PT(e,o,r,n),t.keywords)(0,GH.default)(e);return e};xg.get=(e,t="full")=>{let n=(t==="fast"?cr.fastFormats:cr.fullFormats)[e];if(!n)throw Error(`Unknown format "${e}"`);return n};function PT(e,t,r,n){var o,s;(o=(s=e.opts.code).formats)!==null&&o!==void 0||(s.formats=Us._`require("ajv-formats/dist/formats").${n}`);for(let i of t)e.addFormat(i,r[i])}TT.exports=Ma=xg;Object.defineProperty(Ma,"__esModule",{value:!0});Ma.default=xg});var Fs=D(function(ZX,IT){var r9=Number.MAX_SAFE_INTEGER||9007199254740991,n9=["major","premajor","minor","preminor","patch","prepatch","prerelease"];IT.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:r9,RELEASE_TYPES:n9,SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var La=D(function(GX,xT){var o9=typeof process==="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};xT.exports=o9});var Vs=D(function(Fr,CT){var{MAX_SAFE_COMPONENT_LENGTH:Ag,MAX_SAFE_BUILD_LENGTH:s9,MAX_LENGTH:i9}=Fs(),a9=La();Fr=CT.exports={};var c9=Fr.re=[],u9=Fr.safeRe=[],oe=Fr.src=[],l9=Fr.safeSrc=[],se=Fr.t={},d9=0,Ng="[a-zA-Z0-9-]",p9=[["\\s",1],["\\d",i9],[Ng,s9]],f9=(e)=>{for(let[t,r]of p9)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++;a9(e,o,t),se[e]=o,oe[o]=t,l9[o]=n,c9[o]=new RegExp(t,r?"g":void 0),u9[o]=new RegExp(n,r?"g":void 0)};Re("NUMERICIDENTIFIER","0|[1-9]\\d*");Re("NUMERICIDENTIFIERLOOSE","\\d+");Re("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${Ng}*`);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",`${Ng}+`);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,${Ag}})(?:\\.(\\d{1,${Ag}}))?(?:\\.(\\d{1,${Ag}}))?`);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);Fr.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);Fr.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);Fr.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 ep=D(function(JX,OT){var m9=Object.freeze({loose:!0}),h9=Object.freeze({}),g9=(e)=>{if(!e)return h9;if(typeof e!=="object")return m9;return e};OT.exports=g9});var jg=D(function(BX,jT){var AT=/^[0-9]+$/,NT=(e,t)=>{if(typeof e==="number"&&typeof t==="number")return e===t?0:e<t?-1:1;let r=AT.test(e),n=AT.test(t);if(r&&n)e=+e,t=+t;return e===t?0:r&&!n?-1:n&&!r?1:e<t?-1:1},y9=(e,t)=>NT(t,e);jT.exports={compareIdentifiers:NT,rcompareIdentifiers:y9}});var Rt=D(function(KX,MT){var tp=La(),{MAX_LENGTH:qT,MAX_SAFE_INTEGER:rp}=Fs(),{safeRe:np,t:op}=Vs(),_9=ep(),{compareIdentifiers:qg}=jg(),v9=(e,t)=>{let r=t.split(".");if(r.length>e.length)return!1;for(let n=0;n<r.length;n++)if(qg(e[n],r[n])!==0)return!1;return!0};class Sr{constructor(e,t){if(t=_9(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>qT)throw TypeError(`version is longer than ${qT} characters`);tp("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let r=e.trim().match(t.loose?np[op.LOOSE]:np[op.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>rp||this.major<0)throw TypeError("Invalid major version");if(this.minor>rp||this.minor<0)throw TypeError("Invalid minor version");if(this.patch>rp||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<rp)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(tp("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(tp("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 qg(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(tp("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 qg(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?np[op.PRERELEASELOOSE]:np[op.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(v9(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}}MT.exports=Sr});var Zn=D(function(WX,DT){var LT=Rt(),S9=(e,t,r=!1)=>{if(e instanceof LT)return e;try{return new LT(e,t)}catch(n){if(!r)return null;throw n}};DT.exports=S9});var FT=D(function(YX,UT){var b9=Zn(),w9=(e,t)=>{let r=b9(e,t);return r?r.version:null};UT.exports=w9});var HT=D(function(XX,VT){var $9=Zn(),R9=(e,t)=>{let r=$9(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};VT.exports=R9});var JT=D(function(QX,GT){var ZT=Rt(),E9=(e,t,r,n,o)=>{if(typeof r==="string")o=n,n=r,r=void 0;try{return new ZT(e instanceof ZT?e.version:e,r).inc(t,n,o).version}catch(s){return null}};GT.exports=E9});var WT=D(function(e7,KT){var BT=Zn(),z9=(e,t)=>{let r=BT(e,null,!0),n=BT(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"};KT.exports=z9});var XT=D(function(t7,YT){var P9=Rt(),T9=(e,t)=>new P9(e,t).major;YT.exports=T9});var ek=D(function(r7,QT){var k9=Rt(),I9=(e,t)=>new k9(e,t).minor;QT.exports=I9});var rk=D(function(n7,tk){var x9=Rt(),C9=(e,t)=>new x9(e,t).patch;tk.exports=C9});var ok=D(function(o7,nk){var O9=Zn(),A9=(e,t)=>{let r=O9(e,t);return r&&r.prerelease.length?r.prerelease:null};nk.exports=A9});var ur=D(function(s7,ik){var sk=Rt(),N9=(e,t,r)=>new sk(e,r).compare(new sk(t,r));ik.exports=N9});var ck=D(function(i7,ak){var j9=ur(),q9=(e,t,r)=>j9(t,e,r);ak.exports=q9});var lk=D(function(a7,uk){var M9=ur(),L9=(e,t)=>M9(e,t,!0);uk.exports=L9});var sp=D(function(c7,pk){var dk=Rt(),D9=(e,t,r)=>{let n=new dk(e,r),o=new dk(t,r);return n.compare(o)||n.compareBuild(o)};pk.exports=D9});var mk=D(function(u7,fk){var U9=sp(),F9=(e,t)=>e.sort((r,n)=>U9(r,n,t));fk.exports=F9});var gk=D(function(l7,hk){var V9=sp(),H9=(e,t)=>e.sort((r,n)=>V9(n,r,t));hk.exports=H9});var Da=D(function(d7,yk){var Z9=ur(),G9=(e,t,r)=>Z9(e,t,r)>0;yk.exports=G9});var ip=D(function(p7,_k){var J9=ur(),B9=(e,t,r)=>J9(e,t,r)<0;_k.exports=B9});var Mg=D(function(f7,vk){var K9=ur(),W9=(e,t,r)=>K9(e,t,r)===0;vk.exports=W9});var Lg=D(function(m7,Sk){var Y9=ur(),X9=(e,t,r)=>Y9(e,t,r)!==0;Sk.exports=X9});var ap=D(function(h7,bk){var Q9=ur(),e4=(e,t,r)=>Q9(e,t,r)>=0;bk.exports=e4});var cp=D(function(g7,wk){var t4=ur(),r4=(e,t,r)=>t4(e,t,r)<=0;wk.exports=r4});var Dg=D(function(y7,$k){var n4=Mg(),o4=Lg(),s4=Da(),i4=ap(),a4=ip(),c4=cp(),u4=(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 n4(e,r,n);case"!=":return o4(e,r,n);case">":return s4(e,r,n);case">=":return i4(e,r,n);case"<":return a4(e,r,n);case"<=":return c4(e,r,n);default:throw TypeError(`Invalid operator: ${t}`)}};$k.exports=u4});var Ek=D(function(_7,Rk){var l4=Rt(),d4=Zn(),{safeRe:up,t:lp}=Vs(),p4=(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?up[lp.COERCEFULL]:up[lp.COERCE]);else{let c=t.includePrerelease?up[lp.COERCERTLFULL]:up[lp.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)};Rk.exports=p4});var Tk=D(function(v7,Pk){var f4=Zn(),zk=Fs(),m4=Rt(),h4=(e,t,r)=>{if(!zk.RELEASE_TYPES.includes(t))return null;let n=g4(e,r);return n&&y4(n,t)},g4=(e,t)=>{let r=e instanceof m4?e.version:e;return f4(r,t)},y4=(e,t)=>{if(_4(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()},_4=(e)=>e.startsWith("pre");Pk.exports=h4});var xk=D(function(S7,Ik){class kk{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}}Ik.exports=kk});var lr=D(function(b7,Nk){var v4=/\s+/g;class Ua{constructor(e,t){if(t=b4(t),e instanceof Ua)if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;else return new Ua(e.raw,t);if(e instanceof dp)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(v4," "),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)=>!Ok(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&&I4(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(k4,"");let r=((this.options.includePrerelease&&P4)|(this.options.loose&&T4))+":"+e,n=Ck.get(r);if(n)return n;let o=this.options.loose,s=o?Mt[Et.HYPHENRANGELOOSE]:Mt[Et.HYPHENRANGE];e=e.replace(s,U4(this.options.includePrerelease)),Ke("hyphen replace",e),e=e.replace(Mt[Et.COMPARATORTRIM],R4),Ke("comparator trim",e),e=e.replace(Mt[Et.TILDETRIM],E4),Ke("tilde trim",e),e=e.replace(Mt[Et.CARETTRIM],z4),Ke("caret trim",e);let i=e.split(" ").map((l)=>x4(l,this.options)).join(" ").split(/\s+/).map((l)=>D4(l,this.options));if(o)i=i.filter((l)=>(Ke("loose invalid filter",l,this.options),!!l.match(Mt[Et.COMPARATORLOOSE])));Ke("range list",i);let a=new Map,c=i.map((l)=>new dp(l,this.options));for(let l of c){if(Ok(l))return[l];a.set(l.value,l)}if(a.size>1&&a.has(""))a.delete("");let u=[...a.values()];return Ck.set(r,u),u}intersects(e,t){if(!(e instanceof Ua))throw TypeError("a Range is required");return this.set.some((r)=>Ak(r,t)&&e.set.some((n)=>Ak(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 w4(e,this.options)}catch(t){return!1}for(let t=0;t<this.set.length;t++)if(F4(this.set[t],e,this.options))return!0;return!1}}Nk.exports=Ua;var S4=xk(),Ck=new S4,b4=ep(),dp=Fa(),Ke=La(),w4=Rt(),{safeRe:Mt,src:$4,t:Et,comparatorTrimReplace:R4,tildeTrimReplace:E4,caretTrimReplace:z4}=Vs(),{FLAG_INCLUDE_PRERELEASE:P4,FLAG_LOOSE:T4}=Fs(),k4=new RegExp($4[Et.BUILD],"g"),Ok=(e)=>e.value==="<0.0.0-0",I4=(e)=>e.value==="",Ak=(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},x4=(e,t)=>(e=e.replace(Mt[Et.BUILD],""),Ke("comp",e,t),e=N4(e,t),Ke("caret",e),e=O4(e,t),Ke("tildes",e),e=q4(e,t),Ke("xrange",e),e=L4(e,t),Ke("stars",e),e),ht=(e)=>!e||e.toLowerCase()==="x"||e==="*",C4=(e,t,r)=>ht(e)&&!ht(t)||ht(t)&&r&&!ht(r),O4=(e,t)=>e.trim().split(/\s+/).map((r)=>A4(r,t)).join(" "),A4=(e,t)=>{let r=t.loose?Mt[Et.TILDELOOSE]:Mt[Et.TILDE],n=t.includePrerelease?"-0":"";return e.replace(r,(o,s,i,a,c)=>{Ke("tilde",e,o,s,i,a,c);let u;if(ht(s))u="";else if(ht(i))u=`>=${s}.0.0${n} <${+s+1}.0.0-0`;else if(ht(a))u=`>=${s}.${i}.0${n} <${s}.${+i+1}.0-0`;else if(c)Ke("replaceTilde pr",c),u=`>=${s}.${i}.${a}-${c} <${s}.${+i+1}.0-0`;else u=`>=${s}.${i}.${a} <${s}.${+i+1}.0-0`;return Ke("tilde return",u),u})},N4=(e,t)=>e.trim().split(/\s+/).map((r)=>j4(r,t)).join(" "),j4=(e,t)=>{Ke("caret",e,t);let r=t.loose?Mt[Et.CARETLOOSE]:Mt[Et.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,(o,s,i,a,c)=>{Ke("caret",e,o,s,i,a,c);let u;if(ht(s))u="";else if(ht(i))u=`>=${s}.0.0${n} <${+s+1}.0.0-0`;else if(ht(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(Ke("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(Ke("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 Ke("caret return",u),u})},q4=(e,t)=>(Ke("replaceXRanges",e,t),e.split(/\s+/).map((r)=>M4(r,t)).join(" ")),M4=(e,t)=>{e=e.trim();let r=t.loose?Mt[Et.XRANGELOOSE]:Mt[Et.XRANGE];return e.replace(r,(n,o,s,i,a,c)=>{if(Ke("xRange",e,n,o,s,i,a,c),C4(s,i,a))return e;let u=ht(s),l=u||ht(i),d=l||ht(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 Ke("xRange return",n),n})},L4=(e,t)=>(Ke("replaceStars",e,t),e.trim().replace(Mt[Et.STAR],"")),D4=(e,t)=>(Ke("replaceGTE0",e,t),e.trim().replace(Mt[t.includePrerelease?Et.GTE0PRE:Et.GTE0],"")),U4=(e)=>(t,r,n,o,s,i,a,c,u,l,d,p)=>{if(ht(n))r="";else if(ht(o))r=`>=${n}.0.0${e?"-0":""}`;else if(ht(s))r=`>=${n}.${o}.0${e?"-0":""}`;else if(i)r=`>=${r}`;else r=`>=${r}${e?"-0":""}`;if(ht(u))c="";else if(ht(l))c=`<${+u+1}.0.0-0`;else if(ht(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()},F4=(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(Ke(e[n].semver),e[n].semver===dp.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 Fa=D(function(w7,Uk){var Va=Symbol("SemVer ANY");class pp{static get ANY(){return Va}constructor(e,t){if(t=jk(t),e instanceof pp)if(e.loose===!!t.loose)return e;else e=e.value;if(e=e.trim().split(/\s+/).join(" "),Fg("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===Va)this.value="";else this.value=this.operator+this.semver.version;Fg("comp",this)}parse(e){let t=this.options.loose?qk[Mk.COMPARATORLOOSE]:qk[Mk.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=Va;else this.semver=new Lk(r[2],this.options.loose)}toString(){return this.value}test(e){if(Fg("Comparator.test",e,this.options.loose),this.semver===Va||e===Va)return!0;if(typeof e==="string")try{e=new Lk(e,this.options)}catch(t){return!1}return Ug(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof pp))throw TypeError("a Comparator is required");if(this.operator===""){if(this.value==="")return!0;return new Dk(e.value,t).test(this.value)}else if(e.operator===""){if(e.value==="")return!0;return new Dk(this.value,t).test(e.semver)}if(t=jk(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(Ug(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))return!0;if(Ug(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">"))return!0;return!1}}Uk.exports=pp;var jk=ep(),{safeRe:qk,t:Mk}=Vs(),Ug=Dg(),Fg=La(),Lk=Rt(),Dk=lr()});var Ha=D(function($7,Fk){var V4=lr(),H4=(e,t,r)=>{try{t=new V4(t,r)}catch(n){return!1}return t.test(e)};Fk.exports=H4});var Hk=D(function(R7,Vk){var Z4=lr(),G4=(e,t)=>new Z4(e,t).set.map((r)=>r.map((n)=>n.value).join(" ").trim().split(" "));Vk.exports=G4});var Gk=D(function(E7,Zk){var J4=Rt(),B4=lr(),K4=(e,t,r)=>{let n=null,o=null,s=null;try{s=new B4(t,r)}catch(i){return null}return e.forEach((i)=>{if(s.test(i)){if(!n||o.compare(i)===-1)n=i,o=new J4(n,r)}}),n};Zk.exports=K4});var Bk=D(function(z7,Jk){var W4=Rt(),Y4=lr(),X4=(e,t,r)=>{let n=null,o=null,s=null;try{s=new Y4(t,r)}catch(i){return null}return e.forEach((i)=>{if(s.test(i)){if(!n||o.compare(i)===1)n=i,o=new W4(n,r)}}),n};Jk.exports=X4});var Yk=D(function(P7,Wk){var Vg=Rt(),Q4=lr(),Kk=Da(),eZ=(e,t)=>{e=new Q4(e,t);let r=new Vg("0.0.0");if(e.test(r))return r;if(r=new Vg("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 Vg(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||Kk(a,s))s=a;break;case"<":case"<=":break;default:throw Error(`Unexpected operation: ${i.operator}`)}}),s&&(!r||Kk(r,s)))r=s}if(r&&e.test(r))return r;return null};Wk.exports=eZ});var Qk=D(function(T7,Xk){var tZ=lr(),rZ=(e,t)=>{try{return new tZ(e,t).range||"*"}catch(r){return null}};Xk.exports=rZ});var fp=D(function(k7,nI){var nZ=Rt(),rI=Fa(),{ANY:oZ}=rI,sZ=lr(),iZ=Ha(),eI=Da(),tI=ip(),aZ=cp(),cZ=ap(),uZ=(e,t,r,n)=>{e=new nZ(e,n),t=new sZ(t,n);let o,s,i,a,c;switch(r){case">":o=eI,s=aZ,i=tI,a=">",c=">=";break;case"<":o=tI,s=cZ,i=eI,a="<",c="<=";break;default:throw TypeError('Must provide a hilo val of "<" or ">"')}if(iZ(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((f)=>{if(f.semver===oZ)f=new rI(">=0.0.0");if(d=d||f,p=p||f,o(f.semver,d.semver,n))d=f;else if(i(f.semver,p.semver,n))p=f}),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};nI.exports=uZ});var sI=D(function(I7,oI){var lZ=fp(),dZ=(e,t,r)=>lZ(e,t,">",r);oI.exports=dZ});var aI=D(function(x7,iI){var pZ=fp(),fZ=(e,t,r)=>pZ(e,t,"<",r);iI.exports=fZ});var lI=D(function(C7,uI){var cI=lr(),mZ=(e,t,r)=>(e=new cI(e,r),t=new cI(t,r),e.intersects(t,r));uI.exports=mZ});var pI=D(function(O7,dI){var hZ=Ha(),gZ=ur();dI.exports=(e,t,r)=>{let n=[],o=null,s=null,i=e.sort((l,d)=>gZ(l,d,r));for(let l of i)if(hZ(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 _I=D(function(A7,yI){var fI=lr(),Gg=Fa(),{ANY:Hg}=Gg,Zg=Ha(),Jg=ur(),yZ=(e,t,r={})=>{if(e===t)return!0;e=new fI(e,r),t=new fI(t,r);let n=!1;e:for(let o of e.set){for(let s of t.set){let i=vZ(o,s,r);if(n=n||i!==null,i)continue e}if(n)return!1}return!0},_Z=[new Gg(">=0.0.0-0")],mI=[new Gg(">=0.0.0")],vZ=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===Hg)if(t.length===1&&t[0].semver===Hg)return!0;else if(r.includePrerelease)e=_Z;else e=mI;if(t.length===1&&t[0].semver===Hg)if(r.includePrerelease)return!0;else t=mI;let n=new Set,o,s;for(let f of e)if(f.operator===">"||f.operator===">=")o=hI(o,f,r);else if(f.operator==="<"||f.operator==="<=")s=gI(s,f,r);else n.add(f.semver);if(n.size>1)return null;let i;if(o&&s){if(i=Jg(o.semver,s.semver,r),i>0)return null;else if(i===0&&(o.operator!==">="||s.operator!=="<="))return null}for(let f of n){if(o&&!Zg(f,String(o),r))return null;if(s&&!Zg(f,String(s),r))return null;for(let h of t)if(!Zg(f,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 f of t){if(l=l||f.operator===">"||f.operator===">=",u=u||f.operator==="<"||f.operator==="<=",o){if(p){if(f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===p.major&&f.semver.minor===p.minor&&f.semver.patch===p.patch)p=!1}if(f.operator===">"||f.operator===">="){if(a=hI(o,f,r),a===f&&a!==o)return!1}else if(o.operator===">="&&!f.test(o.semver))return!1}if(s){if(d){if(f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===d.major&&f.semver.minor===d.minor&&f.semver.patch===d.patch)d=!1}if(f.operator==="<"||f.operator==="<="){if(c=gI(s,f,r),c===f&&c!==s)return!1}else if(s.operator==="<="&&!f.test(s.semver))return!1}if(!f.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},hI=(e,t,r)=>{if(!e)return t;let n=Jg(e.semver,t.semver,r);return n>0?e:n<0?t:t.operator===">"&&e.operator===">="?t:e},gI=(e,t,r)=>{if(!e)return t;let n=Jg(e.semver,t.semver,r);return n<0?e:n>0?t:t.operator==="<"&&e.operator==="<="?t:e};yI.exports=yZ});var SI=D(function(N7,vI){var Hs=Vs(),mp=Fs(),SZ=Rt(),hp=jg(),bZ=Zn(),wZ=FT(),$Z=HT(),RZ=JT(),EZ=WT(),zZ=XT(),PZ=ek(),TZ=rk(),kZ=ok(),IZ=ur(),xZ=ck(),CZ=lk(),OZ=sp(),AZ=mk(),NZ=gk(),jZ=Da(),qZ=ip(),MZ=Mg(),LZ=Lg(),DZ=ap(),UZ=cp(),FZ=Dg(),VZ=Ek(),HZ=Tk(),ZZ=Fa(),GZ=lr(),JZ=Ha(),BZ=Hk(),KZ=Gk(),WZ=Bk(),YZ=Yk(),XZ=Qk(),QZ=fp(),eG=sI(),tG=aI(),rG=lI(),nG=pI(),oG=_I();vI.exports={parse:bZ,valid:wZ,clean:$Z,inc:RZ,diff:EZ,major:zZ,minor:PZ,patch:TZ,prerelease:kZ,compare:IZ,rcompare:xZ,compareLoose:CZ,compareBuild:OZ,sort:AZ,rsort:NZ,gt:jZ,lt:qZ,eq:MZ,neq:LZ,gte:DZ,lte:UZ,cmp:FZ,coerce:VZ,truncate:HZ,Comparator:ZZ,Range:GZ,satisfies:JZ,toComparators:BZ,maxSatisfying:KZ,minSatisfying:WZ,minVersion:YZ,validRange:XZ,outside:QZ,gtr:eG,ltr:tG,intersects:rG,simplifyRange:nG,subset:oG,SemVer:SZ,re:Hs.re,src:Hs.src,tokens:Hs.t,SEMVER_SPEC_VERSION:mp.SEMVER_SPEC_VERSION,RELEASE_TYPES:mp.RELEASE_TYPES,compareIdentifiers:hp.compareIdentifiers,rcompareIdentifiers:hp.rcompareIdentifiers}});var{create:MC,defineProperty:yc,getOwnPropertyDescriptor:LC,getOwnPropertyNames:DC,getPrototypeOf:UC}=Object,FC=Object.prototype.hasOwnProperty,J=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ny=(e,t)=>{let r={};for(var n in e)yc(r,n,{get:e[n],enumerable:!0});if(t)yc(r,Symbol.toStringTag,{value:"Module"});return r},VC=(e,t,r,n)=>{if(t&&typeof t==="object"||typeof t==="function"){for(var o=DC(t),s=0,i=o.length,a;s<i;s++)if(a=o[s],!FC.call(e,a)&&a!==r)yc(e,a,{get:((c)=>t[c]).bind(null,a),enumerable:!(n=LC(t,a))||n.enumerable})}return e},_c=(e,t,r)=>(r=e!=null?MC(UC(e)):{},VC(t||!e||!e.__esModule?yc(r,"default",{value:e,enumerable:!0}):r,e));var HC=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),jy=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),ZC=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),GC=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"]);function qy(e){return typeof e==="string"&&jy.has(e.replace(/#$/,""))}function My(e,t){if(!("$schema"in e)||typeof e.$schema!=="string")return"2020-12";let r=e.$schema.replace(/#$/,"");if(HC.has(r))return"2020-12";if(jy.has(r))return"2019-09";if(ZC.has(r)||GC.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 Lp=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 JC=Symbol("zod_brand");class Zr extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Ei extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}var vc={};function Yt(e){if(e)Object.assign(vc,e);return vc}function bc(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 Up(e,t="|"){return e.map((r)=>Zp(r)).join(t)}function zi(e,t){if(typeof t==="bigint")return t.toString();return t}function Pi(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw Error("cached value already set")}}}function wc(e){return e===null||e===void 0}function $c(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Dy(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 Ly=Symbol("evaluating");function Ce(e,t,r){let n=void 0;Object.defineProperty(e,t,{get(){if(n===Ly)return;if(n===void 0)n=Ly,n=r();return n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function ao(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function sn(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function Fp(e){return JSON.stringify(e)}function Uy(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Vp="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Go(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var Fy=Pi(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function co(e){if(Go(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(Go(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function Hp(e){if(co(e))return{...e};if(Array.isArray(e))return[...e];return e}var Vy=new Set(["string","number","symbol"]);function an(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 Zp(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function Hy(e){return Object.keys(e).filter((t)=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Zy={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 BC(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=sn(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 ao(this,"shape",i),i},checks:[]});return mr(e,s)}function KC(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=sn(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 ao(this,"shape",i),i},checks:[]});return mr(e,s)}function WC(e,t){if(!co(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=sn(e._zod.def,{get shape(){let s={...e._zod.def.shape,...t};return ao(this,"shape",s),s}});return mr(e,o)}function YC(e,t){if(!co(t))throw Error("Invalid input to safeExtend: expected a plain object");let r=sn(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return ao(this,"shape",n),n}});return mr(e,r)}function XC(e,t){let r=sn(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return ao(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return mr(e,r)}function QC(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=sn(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 ao(this,"shape",c),c},checks:[]});return mr(t,i)}function eO(e,t,r){let n=sn(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 ao(this,"shape",s),s}});return mr(t,n)}function uo(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 cn(e,t){return t.map((r)=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Sc(e){return typeof e==="string"?e:e?.message}function $r(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let o=Sc(e.inst?._zod.def?.error?.(e))??Sc(t?.error?.(e))??Sc(r.customError?.(e))??Sc(r.localeError?.(e))??"Invalid input";n.message=o}if(delete n.inst,delete n.continue,!t?.reportInput)delete n.input;return n}function Rc(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function Gy(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 lo(...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,zi,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ec=U("$ZodError",Jy),Gp=U("$ZodError",Jy,{Parent:Error});function Jp(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 Bp(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 zc=(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 Zr;if(i.issues.length){let a=new(o?.Err??e)(i.issues.map((c)=>$r(c,s,Yt())));throw Vp(a,o?.callee),a}return i.value};var Pc=(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 Vp(a,o?.callee),a}return i.value};var Ti=(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 Zr;return s.issues.length?{success:!1,error:new(e??Ec)(s.issues.map((i)=>$r(i,o,Yt())))}:{success:!0,data:s.value}},By=Ti(Gp),ki=(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}},Ky=ki(Gp),Wy=(e)=>(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return zc(e)(t,r,o)};var Yy=(e)=>(t,r,n)=>zc(e)(t,r,n);var Xy=(e)=>async(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Pc(e)(t,r,o)};var Qy=(e)=>async(t,r,n)=>Pc(e)(t,r,n);var e_=(e)=>(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Ti(e)(t,r,o)};var t_=(e)=>(t,r,n)=>Ti(e)(t,r,n);var r_=(e)=>async(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return ki(e)(t,r,o)};var n_=(e)=>async(t,r,n)=>ki(e)(t,r,n);var o_=/^[cC][^\s-]{8,}$/,s_=/^[0-9a-z]+$/,i_=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,a_=/^[0-9a-vA-V]{20}$/,c_=/^[A-Za-z0-9]{27}$/,u_=/^[a-zA-Z0-9_-]{21}$/,l_=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var d_=/^([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})$/,Kp=(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 p_=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var rO="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function f_(){return new RegExp(rO,"u")}var m_=/^(?:(?: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])$/,h_=/^(([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 g_=/^((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])$/,y_=/^(([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])$/,__=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Wp=/^[A-Za-z0-9_-]*$/;var v_=/^\+[1-9]\d{6,14}$/,S_="(?:(?:\\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])))",b_=new RegExp(`^${S_}$`);function w_(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 $_(e){return new RegExp(`^${w_(e)}$`)}function R_(e){let t=w_({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(`^${S_}T(?:${n})$`)}var E_=(e)=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var z_=/^-?\d+$/,Yp=/^-?\d+(?:\.\d+)?$/,P_=/^(?:true|false)$/i,T_=/^null$/i;var k_=/^[^A-Z]*$/,I_=/^[^a-z]*$/;var wt=U("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),x_={number:"number",bigint:"bigint",object:"date"},Xp=U("$ZodCheckLessThan",(e,t)=>{wt.init(e,t);let r=x_[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})}}),Qp=U("$ZodCheckGreaterThan",(e,t)=>{wt.init(e,t);let r=x_[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})}}),C_=U("$ZodCheckMultipleOf",(e,t)=>{wt.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):Dy(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})}}),O_=U("$ZodCheckNumberFormat",(e,t)=>{wt.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,s]=Zy[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=z_}),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 A_=U("$ZodCheckMaxLength",(e,t)=>{var r;wt.init(e,t),(r=e._zod.def).when??(r.when=(n)=>{let o=n.value;return!wc(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=Rc(o);n.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),N_=U("$ZodCheckMinLength",(e,t)=>{var r;wt.init(e,t),(r=e._zod.def).when??(r.when=(n)=>{let o=n.value;return!wc(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=Rc(o);n.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),j_=U("$ZodCheckLengthEquals",(e,t)=>{var r;wt.init(e,t),(r=e._zod.def).when??(r.when=(n)=>{let o=n.value;return!wc(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=Rc(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})}}),xi=U("$ZodCheckStringFormat",(e,t)=>{var r,n;if(wt.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=()=>{})}),q_=U("$ZodCheckRegex",(e,t)=>{xi.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})}}),M_=U("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=k_),xi.init(e,t)}),L_=U("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=I_),xi.init(e,t)}),D_=U("$ZodCheckIncludes",(e,t)=>{wt.init(e,t);let r=an(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})}}),U_=U("$ZodCheckStartsWith",(e,t)=>{wt.init(e,t);let r=new RegExp(`^${an(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})}}),F_=U("$ZodCheckEndsWith",(e,t)=>{wt.init(e,t);let r=new RegExp(`.*${an(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 V_=U("$ZodCheckOverwrite",(e,t)=>{wt.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class ef{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
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
|
|
11
|
+
`))}}var Z_={major:4,minor:3,patch:6};var Ve=U("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Z_;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=uo(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,f=d._zod.check(i);if(f instanceof Promise&&c?.async===!1)throw new Zr;if(l||f instanceof Promise)l=(l??Promise.resolve()).then(async()=>{if(await f,i.issues.length===p)return;if(!u)u=uo(i,p)});else{if(i.issues.length===p)continue;if(!u)u=uo(i,p)}}if(l)return l.then(()=>i);return i},s=(i,a,c)=>{if(uo(i))return i.aborted=!0,i;let u=o(a,n,c);if(u instanceof Promise){if(c.async===!1)throw new Zr;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 Zr;return c.then((u)=>o(u,n,a))}return o(c,n,a)}}Ce(e,"~standard",()=>({validate:(o)=>{try{let s=By(e,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch(s){return Ky(e,o).then((i)=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),Ic=U("$ZodString",(e,t)=>{Ve.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??E_(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}}),Be=U("$ZodStringFormat",(e,t)=>{xi.init(e,t),Ic.init(e,t)}),ev=U("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=d_),Be.init(e,t)}),tv=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=Kp(n))}else t.pattern??(t.pattern=Kp());Be.init(e,t)}),rv=U("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=p_),Be.init(e,t)}),nv=U("$ZodURL",(e,t)=>{Be.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})}}}),ov=U("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=f_()),Be.init(e,t)}),sv=U("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=u_),Be.init(e,t)}),iv=U("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=o_),Be.init(e,t)}),av=U("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=s_),Be.init(e,t)}),cv=U("$ZodULID",(e,t)=>{t.pattern??(t.pattern=i_),Be.init(e,t)}),uv=U("$ZodXID",(e,t)=>{t.pattern??(t.pattern=a_),Be.init(e,t)}),lv=U("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=c_),Be.init(e,t)}),dv=U("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=R_(t)),Be.init(e,t)}),pv=U("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=b_),Be.init(e,t)}),fv=U("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=$_(t)),Be.init(e,t)}),mv=U("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=l_),Be.init(e,t)}),hv=U("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=m_),Be.init(e,t),e._zod.bag.format="ipv4"}),gv=U("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=h_),Be.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 yv=U("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=g_),Be.init(e,t)}),_v=U("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=y_),Be.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 vv(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Sv=U("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=__),Be.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=(r)=>{if(vv(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function nO(e){if(!Wp.test(e))return!1;let t=e.replace(/[-_]/g,(n)=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return vv(r)}var bv=U("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Wp),Be.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=(r)=>{if(nO(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),wv=U("$ZodE164",(e,t)=>{t.pattern??(t.pattern=v_),Be.init(e,t)});function oO(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 $v=U("$ZodJWT",(e,t)=>{Be.init(e,t),e._zod.check=(r)=>{if(oO(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var rf=U("$ZodNumber",(e,t)=>{Ve.init(e,t),e._zod.pattern=e._zod.bag.pattern??Yp,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}}),Rv=U("$ZodNumberFormat",(e,t)=>{O_.init(e,t),rf.init(e,t)}),Ev=U("$ZodBoolean",(e,t)=>{Ve.init(e,t),e._zod.pattern=P_,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 zv=U("$ZodNull",(e,t)=>{Ve.init(e,t),e._zod.pattern=T_,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}}),Pv=U("$ZodAny",(e,t)=>{Ve.init(e,t),e._zod.parse=(r)=>r}),Tv=U("$ZodUnknown",(e,t)=>{Ve.init(e,t),e._zod.parse=(r)=>r}),kv=U("$ZodNever",(e,t)=>{Ve.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function G_(e,t,r){if(e.issues.length)t.issues.push(...cn(r,e.issues));t.value[r]=e.value}var Iv=U("$ZodArray",(e,t)=>{Ve.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)=>G_(u,r,i)));else G_(c,r,i)}if(s.length)return Promise.all(s).then(()=>r);return r}});function kc(e,t,r,n,o){if(e.issues.length){if(o&&!(r in n))return;t.issues.push(...cn(r,e.issues))}if(e.value===void 0){if(r in n)t.value[r]=void 0}else t.value[r]=e.value}function xv(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=Hy(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Cv(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((f)=>kc(f,r,d,t,l)));else kc(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 sO=U("$ZodObject",(e,t)=>{if(Ve.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=Pi(()=>xv(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 o=Go,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 f=d[p],h=f._zod.optout==="optional",y=f._zod.run({value:u[p],issues:[]},c);if(y instanceof Promise)l.push(y.then((_)=>kc(_,a,p,u,h)));else kc(y,a,p,u,h)}if(!s)return l.length?Promise.all(l).then(()=>a):a;return Cv(l,u,a,c,n.value,e)}}),Ov=U("$ZodObjectJIT",(e,t)=>{sO.init(e,t);let r=e._zod.parse,n=Pi(()=>xv(t)),o=(p)=>{let f=new ef(["shape","payload","ctx"]),h=n.value,y=(v)=>{let w=Fp(v);return`shape[${w}]._zod.run({ value: input[${w}], issues: [] }, ctx)`};f.write("const input = payload.value;");let _=Object.create(null),g=0;for(let v of h.keys)_[v]=`key_${g++}`;f.write("const newResult = {};");for(let v of h.keys){let w=_[v],z=Fp(v),b=p[v]?._zod?.optout==="optional";if(f.write(`const ${w} = ${y(v)};`),b)f.write(`
|
|
12
12
|
if (${w}.issues.length) {
|
|
13
13
|
if (${z} in input) {
|
|
14
14
|
payload.issues = payload.issues.concat(${w}.issues.map(iss => ({
|
|
@@ -26,7 +26,7 @@ var fO=Object.create;var{getPrototypeOf:mO,defineProperty:by,getOwnPropertyNames
|
|
|
26
26
|
newResult[${z}] = ${w}.value;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
`);else
|
|
29
|
+
`);else f.write(`
|
|
30
30
|
if (${w}.issues.length) {
|
|
31
31
|
payload.issues = payload.issues.concat(${w}.issues.map(iss => ({
|
|
32
32
|
...iss,
|
|
@@ -42,29 +42,29 @@ var fO=Object.create;var{getPrototypeOf:mO,defineProperty:by,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(p,v,w)},s,i=Ho,a=!gc.jitless,u=a&&xy.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 Sv([],h,p,m,d,e)}return r(p,m)}});function N_(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)=>!ao(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 Xp=U("$ZodUnion",(e,t)=>{Fe.init(e,t),Oe(e._zod,"optin",()=>t.options.some((o)=>o._zod.optin==="optional")?"optional":void 0),Oe(e._zod,"optout",()=>t.options.some((o)=>o._zod.optout==="optional")?"optional":void 0),Oe(e._zod,"values",()=>{if(t.options.every((o)=>o._zod.values))return new Set(t.options.flatMap((o)=>Array.from(o._zod.values)));return}),Oe(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)=>Sc(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 N_(a,o,e,s);return Promise.all(a).then((c)=>N_(c,o,e,s))}});var $v=U("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Xp.init(e,t);let r=e._zod.parse;Oe(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(!Ho(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}}),wv=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])=>j_(r,c,u));return j_(r,s,i)}});function Wp(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(io(e)&&io(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=Wp(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=Wp(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 j_(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(ao(e))return e;let i=Wp(t.value,r.value);if(!i.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}var Rv=U("$ZodRecord",(e,t)=>{Fe.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!io(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"&&Gp.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 Ev=U("$ZodEnum",(e,t)=>{Fe.init(e,t);let r=_c(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter((o)=>ky.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}}),zv=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 Pv=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 q_(e,t){if(e.issues.length&&t===void 0)return{issues:[],value:void 0};return e}var Qp=U("$ZodOptional",(e,t)=>{Fe.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Oe(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Oe(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Sc(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)=>q_(s,r.value));return q_(o,r.value)}if(r.value===void 0)return r;return t.innerType._zod.run(r,n)}}),Tv=U("$ZodExactOptional",(e,t)=>{Qp.init(e,t),Oe(e._zod,"values",()=>t.innerType._zod.values),Oe(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),Iv=U("$ZodNullable",(e,t)=>{Fe.init(e,t),Oe(e._zod,"optin",()=>t.innerType._zod.optin),Oe(e._zod,"optout",()=>t.innerType._zod.optout),Oe(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Sc(r.source)}|null)$`):void 0}),Oe(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)}}),xv=U("$ZodDefault",(e,t)=>{Fe.init(e,t),e._zod.optin="optional",Oe(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)=>M_(s,t));return M_(o,t)}});function M_(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var kv=U("$ZodPrefault",(e,t)=>{Fe.init(e,t),e._zod.optin="optional",Oe(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)}}),Ov=U("$ZodNonOptional",(e,t)=>{Fe.init(e,t),Oe(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)=>L_(s,e));return L_(o,e)}});function L_(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 Cv=U("$ZodCatch",(e,t)=>{Fe.init(e,t),Oe(e._zod,"optin",()=>t.innerType._zod.optin),Oe(e._zod,"optout",()=>t.innerType._zod.optout),Oe(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 Av=U("$ZodPipe",(e,t)=>{Fe.init(e,t),Oe(e._zod,"values",()=>t.in._zod.values),Oe(e._zod,"optin",()=>t.in._zod.optin),Oe(e._zod,"optout",()=>t.out._zod.optout),Oe(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)=>Ec(i,t.in,n));return Ec(s,t.in,n)}let o=t.in._zod.run(r,n);if(o instanceof Promise)return o.then((s)=>Ec(s,t.out,n));return Ec(o,t.out,n)}});function Ec(e,t,r){if(e.issues.length)return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues},r)}var Nv=U("$ZodReadonly",(e,t)=>{Fe.init(e,t),Oe(e._zod,"propValues",()=>t.innerType._zod.propValues),Oe(e._zod,"values",()=>t.innerType._zod.values),Oe(e._zod,"optin",()=>t.innerType?._zod?.optin),Oe(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(D_);return D_(o)}});function D_(e){return e.value=Object.freeze(e.value),e}var jv=U("$ZodLazy",(e,t)=>{Fe.init(e,t),Oe(e._zod,"innerType",()=>t.getter()),Oe(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),Oe(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),Oe(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),Oe(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(r,n)=>e._zod.innerType._zod.run(r,n)}),qv=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)=>U_(s,r,n,e));U_(o,r,n,e);return}});function U_(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(co(o))}}var UO=()=>{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=Ay(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 ${Dp(o.values[0])}`;return`Invalid option: expected one of ${jp(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":""}: ${jp(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 ef(){return{localeError:UO()}}var Mv,FO=Symbol("ZodOutput"),VO=Symbol("ZodInput");class Lv{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 Dv(){return new Lv}(Mv=globalThis).__zod_globalRegistry??(Mv.__zod_globalRegistry=Dv());var cn=globalThis.__zod_globalRegistry;function Uv(e,t){return new e({type:"string",...ie(t)})}function tf(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...ie(t)})}function rf(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...ie(t)})}function Fv(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...ie(t)})}function Vv(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ie(t)})}function Hv(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ie(t)})}function Zv(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ie(t)})}function nf(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 Jv(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...ie(t)})}function Kv(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...ie(t)})}function Bv(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...ie(t)})}function Wv(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...ie(t)})}function Yv(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...ie(t)})}function Xv(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...ie(t)})}function Qv(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...ie(t)})}function eS(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...ie(t)})}function tS(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ie(t)})}function rS(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ie(t)})}function nS(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...ie(t)})}function oS(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...ie(t)})}function sS(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...ie(t)})}function iS(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...ie(t)})}function aS(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ie(t)})}function cS(e,t){return new e({type:"string",format:"date",check:"string_format",...ie(t)})}function uS(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...ie(t)})}function lS(e,t){return new e({type:"string",format:"duration",check:"string_format",...ie(t)})}function dS(e,t){return new e({type:"number",checks:[],...ie(t)})}function pS(e,t){return new e({type:"number",coerce:!0,checks:[],...ie(t)})}function fS(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...ie(t)})}function mS(e,t){return new e({type:"boolean",...ie(t)})}function hS(e,t){return new e({type:"null",...ie(t)})}function gS(e){return new e({type:"any"})}function yS(e){return new e({type:"unknown"})}function _S(e,t){return new e({type:"never",...ie(t)})}function Tc(e,t){return new Jp({check:"less_than",...ie(t),value:e,inclusive:!1})}function Pi(e,t){return new Jp({check:"less_than",...ie(t),value:e,inclusive:!0})}function Ic(e,t){return new Kp({check:"greater_than",...ie(t),value:e,inclusive:!1})}function Ti(e,t){return new Kp({check:"greater_than",...ie(t),value:e,inclusive:!0})}function xc(e,t){return new S_({check:"multiple_of",...ie(t),value:e})}function kc(e,t){return new $_({check:"max_length",...ie(t),maximum:e})}function Zo(e,t){return new w_({check:"min_length",...ie(t),minimum:e})}function Oc(e,t){return new R_({check:"length_equals",...ie(t),length:e})}function of(e,t){return new E_({check:"string_format",format:"regex",...ie(t),pattern:e})}function sf(e){return new z_({check:"string_format",format:"lowercase",...ie(e)})}function af(e){return new P_({check:"string_format",format:"uppercase",...ie(e)})}function cf(e,t){return new T_({check:"string_format",format:"includes",...ie(t),includes:e})}function uf(e,t){return new I_({check:"string_format",format:"starts_with",...ie(t),prefix:e})}function lf(e,t){return new x_({check:"string_format",format:"ends_with",...ie(t),suffix:e})}function un(e){return new k_({check:"overwrite",tx:e})}function df(e){return un((t)=>t.normalize(e))}function pf(){return un((e)=>e.trim())}function ff(){return un((e)=>e.toLowerCase())}function mf(){return un((e)=>e.toUpperCase())}function hf(){return un((e)=>Iy(e))}function vS(e,t,r){return new e({type:"array",element:t,...ie(r)})}function SS(e,t,r){return new e({type:"custom",check:"custom",fn:t,...ie(r)})}function bS(e){let t=HO((r)=>(r.addIssue=(n)=>{if(typeof n==="string")r.issues.push(co(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(co(o))}},e(r.value,r)));return t}function HO(e,t){let r=new bt({check:"custom",...ie(t)});return r._zod.check=e,r}function xi(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"&&jt(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 ki(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>
|
|
45
|
+
`)}f.write("payload.value = newResult;"),f.write("return payload;");let S=f.compile();return(v,w)=>S(p,v,w)},s,i=Go,a=!vc.jitless,u=a&&Fy.value,l=t.catchall,d;e._zod.parse=(p,f)=>{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&&f?.async===!1&&f.jitless!==!0){if(!s)s=o(t.shape);if(p=s(p,f),!l)return p;return Cv([],h,p,f,d,e)}return r(p,f)}});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)=>!uo(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 nf=U("$ZodUnion",(e,t)=>{Ve.init(e,t),Ce(e._zod,"optin",()=>t.options.some((o)=>o._zod.optin==="optional")?"optional":void 0),Ce(e._zod,"optout",()=>t.options.some((o)=>o._zod.optout==="optional")?"optional":void 0),Ce(e._zod,"values",()=>{if(t.options.every((o)=>o._zod.values))return new Set(t.options.flatMap((o)=>Array.from(o._zod.values)));return}),Ce(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)=>$c(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 Av=U("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,nf.init(e,t);let r=e._zod.parse;Ce(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=Pi(()=>{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(!Go(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}}),Nv=U("$ZodIntersection",(e,t)=>{Ve.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])=>B_(r,c,u));return B_(r,s,i)}});function tf(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(co(e)&&co(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=tf(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=tf(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 B_(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(uo(e))return e;let i=tf(t.value,r.value);if(!i.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}var jv=U("$ZodRecord",(e,t)=>{Ve.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!co(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(...cn(u,d.issues));r.value[u]=d.value}));else{if(l.issues.length)r.issues.push(...cn(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"&&Yp.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(...cn(a,d.issues));r.value[c.value]=d.value}));else{if(l.issues.length)r.issues.push(...cn(a,l.issues));r.value[c.value]=l.value}}}if(s.length)return Promise.all(s).then(()=>r);return r}});var qv=U("$ZodEnum",(e,t)=>{Ve.init(e,t);let r=bc(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter((o)=>Vy.has(typeof o)).map((o)=>typeof o==="string"?an(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}}),Mv=U("$ZodLiteral",(e,t)=>{if(Ve.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"?an(n):n?an(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 Lv=U("$ZodTransform",(e,t)=>{Ve.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Ei(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 Zr;return r.value=o,r}});function K_(e,t){if(e.issues.length&&t===void 0)return{issues:[],value:void 0};return e}var of=U("$ZodOptional",(e,t)=>{Ve.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(`^(${$c(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)=>K_(s,r.value));return K_(o,r.value)}if(r.value===void 0)return r;return t.innerType._zod.run(r,n)}}),Dv=U("$ZodExactOptional",(e,t)=>{of.init(e,t),Ce(e._zod,"values",()=>t.innerType._zod.values),Ce(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),Uv=U("$ZodNullable",(e,t)=>{Ve.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(`^(${$c(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,n)=>{if(r.value===null)return r;return t.innerType._zod.run(r,n)}}),Fv=U("$ZodDefault",(e,t)=>{Ve.init(e,t),e._zod.optin="optional",Ce(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)=>W_(s,t));return W_(o,t)}});function W_(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var Vv=U("$ZodPrefault",(e,t)=>{Ve.init(e,t),e._zod.optin="optional",Ce(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)}}),Hv=U("$ZodNonOptional",(e,t)=>{Ve.init(e,t),Ce(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)=>Y_(s,e));return Y_(o,e)}});function Y_(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 Zv=U("$ZodCatch",(e,t)=>{Ve.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,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 Gv=U("$ZodPipe",(e,t)=>{Ve.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,n)=>{if(n.direction==="backward"){let s=t.out._zod.run(r,n);if(s instanceof Promise)return s.then((i)=>Tc(i,t.in,n));return Tc(s,t.in,n)}let o=t.in._zod.run(r,n);if(o instanceof Promise)return o.then((s)=>Tc(s,t.out,n));return Tc(o,t.out,n)}});function Tc(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)=>{Ve.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,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(X_);return X_(o)}});function X_(e){return e.value=Object.freeze(e.value),e}var Bv=U("$ZodLazy",(e,t)=>{Ve.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,n)=>e._zod.innerType._zod.run(r,n)}),Kv=U("$ZodCustom",(e,t)=>{wt.init(e,t),Ve.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)=>Q_(s,r,n,e));Q_(o,r,n,e);return}});function Q_(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(lo(o))}}var iO=()=>{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=Gy(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 ${Zp(o.values[0])}`;return`Invalid option: expected one of ${Up(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":""}: ${Up(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 sf(){return{localeError:iO()}}var Wv,aO=Symbol("ZodOutput"),cO=Symbol("ZodInput");class Yv{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 Xv(){return new Yv}(Wv=globalThis).__zod_globalRegistry??(Wv.__zod_globalRegistry=Xv());var un=globalThis.__zod_globalRegistry;function Qv(e,t){return new e({type:"string",...ie(t)})}function af(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...ie(t)})}function cf(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...ie(t)})}function eS(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...ie(t)})}function tS(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ie(t)})}function rS(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ie(t)})}function nS(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ie(t)})}function uf(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...ie(t)})}function oS(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...ie(t)})}function sS(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...ie(t)})}function iS(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...ie(t)})}function aS(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...ie(t)})}function cS(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...ie(t)})}function uS(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...ie(t)})}function lS(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...ie(t)})}function dS(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...ie(t)})}function pS(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...ie(t)})}function fS(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ie(t)})}function mS(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ie(t)})}function hS(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...ie(t)})}function gS(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...ie(t)})}function yS(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...ie(t)})}function _S(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...ie(t)})}function vS(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ie(t)})}function SS(e,t){return new e({type:"string",format:"date",check:"string_format",...ie(t)})}function bS(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...ie(t)})}function wS(e,t){return new e({type:"string",format:"duration",check:"string_format",...ie(t)})}function $S(e,t){return new e({type:"number",checks:[],...ie(t)})}function RS(e,t){return new e({type:"number",coerce:!0,checks:[],...ie(t)})}function ES(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...ie(t)})}function zS(e,t){return new e({type:"boolean",...ie(t)})}function PS(e,t){return new e({type:"null",...ie(t)})}function TS(e){return new e({type:"any"})}function kS(e){return new e({type:"unknown"})}function IS(e,t){return new e({type:"never",...ie(t)})}function xc(e,t){return new Xp({check:"less_than",...ie(t),value:e,inclusive:!1})}function Ci(e,t){return new Xp({check:"less_than",...ie(t),value:e,inclusive:!0})}function Cc(e,t){return new Qp({check:"greater_than",...ie(t),value:e,inclusive:!1})}function Oi(e,t){return new Qp({check:"greater_than",...ie(t),value:e,inclusive:!0})}function Oc(e,t){return new C_({check:"multiple_of",...ie(t),value:e})}function Ac(e,t){return new A_({check:"max_length",...ie(t),maximum:e})}function Jo(e,t){return new N_({check:"min_length",...ie(t),minimum:e})}function Nc(e,t){return new j_({check:"length_equals",...ie(t),length:e})}function lf(e,t){return new q_({check:"string_format",format:"regex",...ie(t),pattern:e})}function df(e){return new M_({check:"string_format",format:"lowercase",...ie(e)})}function pf(e){return new L_({check:"string_format",format:"uppercase",...ie(e)})}function ff(e,t){return new D_({check:"string_format",format:"includes",...ie(t),includes:e})}function mf(e,t){return new U_({check:"string_format",format:"starts_with",...ie(t),prefix:e})}function hf(e,t){return new F_({check:"string_format",format:"ends_with",...ie(t),suffix:e})}function ln(e){return new V_({check:"overwrite",tx:e})}function gf(e){return ln((t)=>t.normalize(e))}function yf(){return ln((e)=>e.trim())}function _f(){return ln((e)=>e.toLowerCase())}function vf(){return ln((e)=>e.toUpperCase())}function Sf(){return ln((e)=>Uy(e))}function xS(e,t,r){return new e({type:"array",element:t,...ie(r)})}function CS(e,t,r){return new e({type:"custom",check:"custom",fn:t,...ie(r)})}function OS(e){let t=uO((r)=>(r.addIssue=(n)=>{if(typeof n==="string")r.issues.push(lo(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(lo(o))}},e(r.value,r)));return t}function uO(e,t){let r=new wt({check:"custom",...ie(t)});return r._zod.check=e,r}function Ni(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??un,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 He(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,s=t.seen.get(e);if(s){if(s.count++,r.schemaPath.includes(e))s.cycle=r.path;return s.schema}let i={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,i);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,f=t.processors[o.type];if(!f)throw Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);f(e,t,p,l)}let d=e._zod.parent;if(d){if(!i.ref)i.ref=d;He(d,t,l),t.seen.get(d).isParent=!0}}let c=t.metadataRegistry.get(e);if(c)Object.assign(i.schema,c);if(t.io==="input"&&jt(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 ji(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 f=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=f,{defId:f,ref:`${p("__shared")}#/${a}/${f}`}}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 Oi(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 jt(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 jt(n.element,r);if(n.type==="set")return jt(n.valueType,r);if(n.type==="lazy")return jt(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 jt(n.innerType,r);if(n.type==="intersection")return jt(n.left,r)||jt(n.right,r);if(n.type==="record"||n.type==="map")return jt(n.keyType,r)||jt(n.valueType,r);if(n.type==="pipe")return jt(n.in,r)||jt(n.out,r);if(n.type==="object"){for(let o in n.shape)if(jt(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(jt(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(jt(o,r))return!0;if(n.rest&&jt(n.rest,r))return!0;return!1}return!1}var $S=(e,t={})=>(r)=>{let n=xi({...r,processors:t});return Ve(e,n),ki(n,e),Oi(n,e)},Ii=(e,t,r={})=>(n)=>{let{libraryOptions:o,target:s}=n??{},i=xi({...o??{},target:s,io:t,processors:r});return Ve(e,i),ki(i,e),Oi(i,e)};var ZO={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},gf=(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=ZO[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}))]}},yf=(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},_f=(e,t,r,n)=>{r.type="boolean"},RS=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},ES=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema")},vf=(e,t,r,n)=>{if(t.target==="openapi-3.0")r.type="string",r.nullable=!0,r.enum=[null];else r.type="null"},zS=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema")},PS=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema")},Sf=(e,t,r,n)=>{r.not={}},bf=(e,t,r,n)=>{},$f=(e,t,r,n)=>{},TS=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema")},wf=(e,t,r,n)=>{let o=e._zod.def,s=_c(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},Rf=(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}},IS=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema")},xS=(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},kS=(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)},OS=(e,t,r,n)=>{r.type="boolean"},Ef=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")},CS=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Function types cannot be represented in JSON Schema")},zf=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")},AS=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema")},NS=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema")},Pf=(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"]})},Tf=(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"]})},If=(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},xf=(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},jS=(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},kf=(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}},Of=(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"}]},Cf=(e,t,r,n)=>{let o=e._zod.def;Ve(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType},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,r.default=JSON.parse(JSON.stringify(o.defaultValue))},Nf=(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))},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;let i;try{i=o.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}r.default=i},qf=(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},Mf=(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},qS=(e,t,r,n)=>{let o=e._zod.def;Ve(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType},Cc=(e,t,r,n)=>{let o=e._zod.def;Ve(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType},Lf=(e,t,r,n)=>{let o=e._zod.innerType;Ve(o,t,n);let s=t.seen.get(e);s.ref=o},wS={string:gf,number:yf,boolean:_f,bigint:RS,symbol:ES,null:vf,undefined:zS,void:PS,never:Sf,any:bf,unknown:$f,date:TS,enum:wf,literal:Rf,nan:IS,template_literal:xS,file:kS,success:OS,custom:Ef,function:CS,transform:zf,map:AS,set:NS,array:Pf,object:Tf,union:If,intersection:xf,tuple:jS,record:kf,nullable:Of,nonoptional:Cf,default:Af,prefault:Nf,catch:jf,pipe:qf,readonly:Mf,promise:qS,optional:Cc,lazy:Lf};function Ac(e,t){if("_idmap"in e){let n=e,o=xi({...t,processors:wS}),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;ki(o,l),i[u]=Oi(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=xi({...t,processors:wS});return Ve(e,r),ki(r,e),Oi(r,e)}var QO=U("ZodISODateTime",(e,t)=>{Q_.init(e,t),Ke.init(e,t)});function Jo(e){return aS(QO,e)}var eC=U("ZodISODate",(e,t)=>{ev.init(e,t),Ke.init(e,t)});function Df(e){return cS(eC,e)}var tC=U("ZodISOTime",(e,t)=>{tv.init(e,t),Ke.init(e,t)});function MS(e){return uS(tC,e)}var rC=U("ZodISODuration",(e,t)=>{rv.init(e,t),Ke.init(e,t)});function LS(e){return lS(rC,e)}var US=(e,t)=>{$c.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:(r)=>Vp(e,r)},flatten:{value:(r)=>Fp(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}}})},k3=U("ZodError",US),Xt=U("ZodError",US,{Parent:Error});var FS=wc(Xt),VS=Rc(Xt),jc=wi(Xt),HS=Ri(Xt),ZS=My(Xt),GS=Ly(Xt),JS=Dy(Xt),KS=Uy(Xt),BS=Fy(Xt),WS=Vy(Xt),YS=Hy(Xt),XS=Zy(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=$S(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)=>FS(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>jc(e,r,n),e.parseAsync=async(r,n)=>VS(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>HS(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>ZS(e,r,n),e.decode=(r,n)=>GS(e,r,n),e.encodeAsync=async(r,n)=>JS(e,r,n),e.decodeAsync=async(r,n)=>KS(e,r,n),e.safeEncode=(r,n)=>BS(e,r,n),e.safeDecode=(r,n)=>WS(e,r,n),e.safeEncodeAsync=async(r,n)=>YS(e,r,n),e.safeDecodeAsync=async(r,n)=>XS(e,r,n),e.refine=(r,n)=>e.check(GC(r,n)),e.superRefine=(r)=>e.check(JC(r)),e.overwrite=(r)=>e.check(un(r)),e.optional=()=>ae(e),e.exactOptional=()=>OC(e),e.nullable=()=>t0(e),e.nullish=()=>ae(t0(e)),e.nonoptional=(r)=>MC(e,r),e.array=()=>A(e),e.or=(r)=>te([e,r]),e.and=(r)=>Zr(e,r),e.transform=(r)=>Ff(e,d0(r)),e.default=(r)=>NC(e,r),e.prefault=(r)=>qC(e,r),e.catch=(r)=>DC(e,r),e.pipe=(r)=>Ff(e,r),e.readonly=()=>VC(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)),r0=U("_ZodString",(e,t)=>{Pc.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,o,s)=>gf(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(of(...n)),e.includes=(...n)=>e.check(cf(...n)),e.startsWith=(...n)=>e.check(uf(...n)),e.endsWith=(...n)=>e.check(lf(...n)),e.min=(...n)=>e.check(Zo(...n)),e.max=(...n)=>e.check(kc(...n)),e.length=(...n)=>e.check(Oc(...n)),e.nonempty=(...n)=>e.check(Zo(1,...n)),e.lowercase=(n)=>e.check(sf(n)),e.uppercase=(n)=>e.check(af(n)),e.trim=()=>e.check(pf()),e.normalize=(...n)=>e.check(df(...n)),e.toLowerCase=()=>e.check(ff()),e.toUpperCase=()=>e.check(mf()),e.slugify=()=>e.check(hf())}),n0=U("ZodString",(e,t)=>{Pc.init(e,t),r0.init(e,t),e.email=(r)=>e.check(tf(o0,r)),e.url=(r)=>e.check(nf(i0,r)),e.jwt=(r)=>e.check(iS(_C,r)),e.emoji=(r)=>e.check(Gv(oC,r)),e.guid=(r)=>e.check(rf(QS,r)),e.uuid=(r)=>e.check(Fv(qc,r)),e.uuidv4=(r)=>e.check(Vv(qc,r)),e.uuidv6=(r)=>e.check(Hv(qc,r)),e.uuidv7=(r)=>e.check(Zv(qc,r)),e.nanoid=(r)=>e.check(Jv(sC,r)),e.guid=(r)=>e.check(rf(QS,r)),e.cuid=(r)=>e.check(Kv(iC,r)),e.cuid2=(r)=>e.check(Bv(aC,r)),e.ulid=(r)=>e.check(Wv(cC,r)),e.base64=(r)=>e.check(nS(hC,r)),e.base64url=(r)=>e.check(oS(gC,r)),e.xid=(r)=>e.check(Yv(uC,r)),e.ksuid=(r)=>e.check(Xv(lC,r)),e.ipv4=(r)=>e.check(Qv(dC,r)),e.ipv6=(r)=>e.check(eS(pC,r)),e.cidrv4=(r)=>e.check(tS(fC,r)),e.cidrv6=(r)=>e.check(rS(mC,r)),e.e164=(r)=>e.check(sS(yC,r)),e.datetime=(r)=>e.check(Jo(r)),e.date=(r)=>e.check(Df(r)),e.time=(r)=>e.check(MS(r)),e.duration=(r)=>e.check(LS(r))});function f(e){return Uv(n0,e)}var Ke=U("ZodStringFormat",(e,t)=>{Ge.init(e,t),r0.init(e,t)}),o0=U("ZodEmail",(e,t)=>{H_.init(e,t),Ke.init(e,t)});function s0(e){return tf(o0,e)}var QS=U("ZodGUID",(e,t)=>{F_.init(e,t),Ke.init(e,t)});var qc=U("ZodUUID",(e,t)=>{V_.init(e,t),Ke.init(e,t)});var i0=U("ZodURL",(e,t)=>{Z_.init(e,t),Ke.init(e,t)});function Mc(e){return nf(i0,e)}var oC=U("ZodEmoji",(e,t)=>{G_.init(e,t),Ke.init(e,t)});var sC=U("ZodNanoID",(e,t)=>{J_.init(e,t),Ke.init(e,t)});var iC=U("ZodCUID",(e,t)=>{K_.init(e,t),Ke.init(e,t)});var aC=U("ZodCUID2",(e,t)=>{B_.init(e,t),Ke.init(e,t)});var cC=U("ZodULID",(e,t)=>{W_.init(e,t),Ke.init(e,t)});var uC=U("ZodXID",(e,t)=>{Y_.init(e,t),Ke.init(e,t)});var lC=U("ZodKSUID",(e,t)=>{X_.init(e,t),Ke.init(e,t)});var dC=U("ZodIPv4",(e,t)=>{nv.init(e,t),Ke.init(e,t)});var pC=U("ZodIPv6",(e,t)=>{ov.init(e,t),Ke.init(e,t)});var fC=U("ZodCIDRv4",(e,t)=>{sv.init(e,t),Ke.init(e,t)});var mC=U("ZodCIDRv6",(e,t)=>{iv.init(e,t),Ke.init(e,t)});var hC=U("ZodBase64",(e,t)=>{cv.init(e,t),Ke.init(e,t)});var gC=U("ZodBase64URL",(e,t)=>{uv.init(e,t),Ke.init(e,t)});var yC=U("ZodE164",(e,t)=>{lv.init(e,t),Ke.init(e,t)});var _C=U("ZodJWT",(e,t)=>{dv.init(e,t),Ke.init(e,t)});var Lc=U("ZodNumber",(e,t)=>{Yp.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,o,s)=>yf(e,n,o,s),e.gt=(n,o)=>e.check(Ic(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(Tc(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(e0(n)),e.safe=(n)=>e.check(e0(n)),e.positive=(n)=>e.check(Ic(0,n)),e.nonnegative=(n)=>e.check(Ti(0,n)),e.negative=(n)=>e.check(Tc(0,n)),e.nonpositive=(n)=>e.check(Pi(0,n)),e.multipleOf=(n,o)=>e.check(xc(n,o)),e.step=(n,o)=>e.check(xc(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 dS(Lc,e)}var vC=U("ZodNumberFormat",(e,t)=>{pv.init(e,t),Lc.init(e,t)});function e0(e){return fS(vC,e)}var a0=U("ZodBoolean",(e,t)=>{fv.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_f(e,r,n,o)});function Y(e){return mS(a0,e)}var SC=U("ZodNull",(e,t)=>{mv.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>vf(e,r,n,o)});function uo(e){return hS(SC,e)}var bC=U("ZodAny",(e,t)=>{hv.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>bf(e,r,n,o)});function c0(){return gS(bC)}var $C=U("ZodUnknown",(e,t)=>{gv.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$f(e,r,n,o)});function ce(){return yS($C)}var wC=U("ZodNever",(e,t)=>{yv.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Sf(e,r,n,o)});function RC(e){return _S(wC,e)}var EC=U("ZodArray",(e,t)=>{_v.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Pf(e,r,n,o),e.element=t.element,e.min=(r,n)=>e.check(Zo(r,n)),e.nonempty=(r)=>e.check(Zo(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 vS(EC,e,t)}var u0=U("ZodObject",(e,t)=>{bv.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Tf(e,r,n,o),Oe(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:RC()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=(r)=>kO(e,r),e.safeExtend=(r)=>OO(e,r),e.merge=(r)=>CO(e,r),e.pick=(r)=>IO(e,r),e.omit=(r)=>xO(e,r),e.partial=(...r)=>AO(p0,e,r[0]),e.required=(...r)=>NO(f0,e,r[0])});function T(e,t){let r={type:"object",shape:e??{},...ie(t)};return new u0(r)}function pe(e,t){return new u0({type:"object",shape:e,catchall:ce(),...ie(t)})}var l0=U("ZodUnion",(e,t)=>{Xp.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>If(e,r,n,o),e.options=t.options});function te(e,t){return new l0({type:"union",options:e,...ie(t)})}var zC=U("ZodDiscriminatedUnion",(e,t)=>{l0.init(e,t),$v.init(e,t)});function Ko(e,t,r){return new zC({type:"union",options:t,discriminator:e,...ie(r)})}var PC=U("ZodIntersection",(e,t)=>{wv.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xf(e,r,n,o)});function Zr(e,t){return new PC({type:"intersection",left:e,right:t})}var TC=U("ZodRecord",(e,t)=>{Rv.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>kf(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function ee(e,t,r){return new TC({type:"record",keyType:e,valueType:t,...ie(r)})}var Uf=U("ZodEnum",(e,t)=>{Ev.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,o,s)=>wf(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 Uf({...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 Uf({...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 Uf({type:"enum",entries:r,...ie(t)})}var IC=U("ZodLiteral",(e,t)=>{zv.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Rf(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 IC({type:"literal",values:Array.isArray(e)?e:[e],...ie(t)})}var xC=U("ZodTransform",(e,t)=>{Pv.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>zf(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(co(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(co(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 d0(e){return new xC({type:"transform",transform:e})}var p0=U("ZodOptional",(e,t)=>{Qp.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Cc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ae(e){return new p0({type:"optional",innerType:e})}var kC=U("ZodExactOptional",(e,t)=>{Tv.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Cc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function OC(e){return new kC({type:"optional",innerType:e})}var CC=U("ZodNullable",(e,t)=>{Iv.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 t0(e){return new CC({type:"nullable",innerType:e})}var AC=U("ZodDefault",(e,t)=>{xv.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.removeDefault=e.unwrap});function NC(e,t){return new AC({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():Lp(t)}})}var jC=U("ZodPrefault",(e,t)=>{kv.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Nf(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function qC(e,t){return new jC({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():Lp(t)}})}var f0=U("ZodNonOptional",(e,t)=>{Ov.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 MC(e,t){return new f0({type:"nonoptional",innerType:e,...ie(t)})}var LC=U("ZodCatch",(e,t)=>{Cv.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>jf(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function DC(e,t){return new LC({type:"catch",innerType:e,catchValue:typeof t==="function"?t:()=>t})}var UC=U("ZodPipe",(e,t)=>{Av.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>qf(e,r,n,o),e.in=t.in,e.out=t.out});function Ff(e,t){return new UC({type:"pipe",in:e,out:t})}var FC=U("ZodReadonly",(e,t)=>{Nv.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Mf(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function VC(e){return new FC({type:"readonly",innerType:e})}var HC=U("ZodLazy",(e,t)=>{jv.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Lf(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});function Ci(e){return new HC({type:"lazy",getter:e})}var ZC=U("ZodCustom",(e,t)=>{qv.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ef(e,r,n,o)});function GC(e,t={}){return SS(ZC,e,t)}function JC(e){return bS(e)}function lo(e,t){return Ff(d0(e),t)}var h0={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 m0;(function(e){})(m0||(m0={}));function KC(e){return pS(Lc,e)}Yt(ef());var fo="2025-11-25";var Dc=[fo,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Uc="io.modelcontextprotocol/related-task",Jr="io.modelcontextprotocol/protocolVersion",Bo="io.modelcontextprotocol/clientInfo",Er="io.modelcontextprotocol/serverInfo",Kr="io.modelcontextprotocol/clientCapabilities",mo="io.modelcontextprotocol/subscriptionId",dn="io.modelcontextprotocol/logLevel";var ho="2.0";var ln=Ci(()=>te([f(),G(),Y(),uo(),ee(f(),ln),A(ln)])),Qe=ee(f(),ln),Hf=A(ln),Ai=te([f(),G().int()]),Ni=f(),Fc=T({ttl:G().optional()}),Vc=T({taskId:f()}),ji=pe({progressToken:Ai.optional(),[Uc]:Vc.optional()}),_t=T({_meta:ji.optional()}),go=_t.extend({task:Fc.optional()}),et=T({method:f(),params:_t.loose().optional()}),It=T({_meta:ji.optional()}),xt=T({method:f(),params:It.loose().optional()}),qi=pe({get[Er](){return Xo.optional().catch(void 0)}}),tt=pe({_meta:qi.optional()}),pn=te([f(),G().int()]),Mi=T({jsonrpc:N(ho),id:pn,...et.shape}).strict(),Li=T({jsonrpc:N(ho),...xt.shape}).strict(),Wo=T({jsonrpc:N(ho),id:pn,result:tt}).strict(),Yo=T({jsonrpc:N(ho),id:pn.optional(),error:T({code:G().int(),message:f(),data:ce().optional()})}).strict(),Di=te([Mi,Li,Wo,Yo]),Zf=te([Wo,Yo]),Ui=tt.strict(),Hc=It.extend({requestId:pn.optional(),reason:f().optional()}),Fi=xt.extend({method:N("notifications/cancelled"),params:Hc}),Zc=T({src:f(),mimeType:f().optional(),sizes:A(f()).optional(),theme:le(["light","dark"]).optional()}),fn=T({icons:A(Zc).optional()}),Gr=T({name:f(),title:f().optional()}),Xo=Gr.extend({...Gr.shape,...fn.shape,version:f(),websiteUrl:f().optional(),description:f().optional()}),WC=Zr(T({applyDefaults:Y().optional()}),Qe),YC=lo((e)=>{if(e&&typeof e==="object"&&!Array.isArray(e)&&Object.keys(e).length===0)return{form:{}};return e},Zr(T({form:WC.optional(),url:Qe.optional()}),Qe.optional())),Gc=pe({list:Qe.optional(),cancel:Qe.optional(),requests:pe({sampling:pe({createMessage:Qe.optional()}).optional(),elicitation:pe({create:Qe.optional()}).optional()}).optional()}),Jc=pe({list:Qe.optional(),cancel:Qe.optional(),requests:pe({tools:pe({call:Qe.optional()}).optional()}).optional()}),Kc=T({experimental:ee(f(),Qe).optional(),sampling:T({context:Qe.optional(),tools:Qe.optional()}).optional(),elicitation:YC.optional(),roots:T({listChanged:Y().optional()}).optional(),tasks:Gc.optional(),extensions:ee(f(),Qe).optional()}),Bc=_t.extend({protocolVersion:f(),capabilities:Kc,clientInfo:Xo}),Wc=et.extend({method:N("initialize"),params:Bc}),Vi=T({experimental:ee(f(),Qe).optional(),logging:Qe.optional(),completions:Qe.optional(),prompts:T({listChanged:Y().optional()}).optional(),resources:T({subscribe:Y().optional(),listChanged:Y().optional()}).optional(),tools:T({listChanged:Y().optional()}).optional(),tasks:Jc.optional(),extensions:ee(f(),Qe).optional()}),Yc=tt.extend({protocolVersion:f(),capabilities:Vi,serverInfo:Xo,instructions:f().optional()}),Xc=xt.extend({method:N("notifications/initialized"),params:It.optional()}),Qc=et.extend({method:N("server/discover"),params:_t.optional()}),eu=tt.extend({supportedVersions:A(f()),capabilities:Vi,instructions:f().optional()}),Hi=et.extend({method:N("ping"),params:_t.optional()}),tu=T({progress:G(),total:ae(G()),message:ae(f())}),ru=T({...It.shape,...tu.shape,progressToken:Ai}),Zi=xt.extend({method:N("notifications/progress"),params:ru}),nu=_t.extend({cursor:Ni.optional()}),mn=et.extend({params:nu.optional()}),hn=tt.extend({nextCursor:Ni.optional()}),Gi=T({uri:f(),mimeType:ae(f()),_meta:ee(f(),ce()).optional()}),Ji=Gi.extend({text:f()}),Gf=f().refine((e)=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Ki=Gi.extend({blob:Gf}),gn=le(["user","assistant"]),Br=T({audience:A(gn).optional(),priority:G().min(0).max(1).optional(),lastModified:Jo({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({}))}),ou=T({...Gr.shape,...fn.shape,uriTemplate:f(),description:ae(f()),mimeType:ae(f()),annotations:Br.optional(),_meta:ae(pe({}))}),su=mn.extend({method:N("resources/list")}),iu=hn.extend({resources:A(Bi)}),au=mn.extend({method:N("resources/templates/list")}),cu=hn.extend({resourceTemplates:A(ou)}),Qo=_t.extend({uri:f()}),uu=Qo,lu=et.extend({method:N("resources/read"),params:uu}),du=tt.extend({contents:A(te([Ji,Ki]))}),pu=xt.extend({method:N("notifications/resources/list_changed"),params:It.optional()}),fu=Qo,mu=et.extend({method:N("resources/subscribe"),params:fu}),hu=Qo,gu=et.extend({method:N("resources/unsubscribe"),params:hu}),Wi=T({toolsListChanged:Y().optional(),promptsListChanged:Y().optional(),resourcesListChanged:Y().optional(),resourceSubscriptions:A(f()).optional()}),yu=_t.extend({notifications:Wi}),_u=et.extend({method:N("subscriptions/listen"),params:yu}),vu=It.extend({notifications:Wi}),Su=xt.extend({method:N("notifications/subscriptions/acknowledged"),params:vu}),bu=qi.extend({[mo]:pn}),$u=tt.extend({_meta:bu}),wu=It.extend({uri:f()}),Ru=xt.extend({method:N("notifications/resources/updated"),params:wu}),Eu=T({name:f(),description:ae(f()),required:ae(Y())}),zu=T({...Gr.shape,...fn.shape,description:ae(f()),arguments:ae(A(Eu)),_meta:ae(pe({}))}),Pu=mn.extend({method:N("prompts/list")}),Tu=hn.extend({prompts:A(zu)}),Iu=_t.extend({name:f(),arguments:ee(f(),f()).optional()}),xu=et.extend({method:N("prompts/get"),params:Iu}),es=T({type:N("text"),text:f(),annotations:Br.optional(),_meta:ee(f(),ce()).optional()}),ts=T({type:N("image"),data:Gf,mimeType:f(),annotations:Br.optional(),_meta:ee(f(),ce()).optional()}),rs=T({type:N("audio"),data:Gf,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()}),Cu=Bi.extend({type:N("resource_link")}),ns=te([es,ts,rs,Cu,Ou]),Au=T({role:gn,content:ns}),Nu=tt.extend({description:f().optional(),messages:A(Au)}),ju=xt.extend({method:N("notifications/prompts/list_changed"),params:It.optional()}),qu=T({title:f().optional(),readOnlyHint:Y().optional(),destructiveHint:Y().optional(),idempotentHint:Y().optional(),openWorldHint:Y().optional()}),Mu=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:qu.optional(),execution:Mu.optional(),_meta:ee(f(),ce()).optional()}),Lu=mn.extend({method:N("tools/list")}),Du=hn.extend({tools:A(Yi)}),Xi=tt.extend({content:A(ns).default([]),structuredContent:ce().optional(),isError:Y().optional()}),Jf=Xi.or(tt.extend({toolResult:ce()})),Uu=go.extend({name:f(),arguments:ee(f(),ce()).optional()}),Fu=et.extend({method:N("tools/call"),params:Uu}),Vu=xt.extend({method:N("notifications/tools/list_changed"),params:It.optional()}),Kf=T({autoRefresh:Y().default(!0),debounceMs:G().int().nonnegative().default(300)}),yn=le(["debug","info","notice","warning","error","critical","alert","emergency"]),Hu=_t.extend({level:yn}),Zu=et.extend({method:N("logging/setLevel"),params:Hu}),Gu=It.extend({level:yn,logger:f().optional(),data:ce()}),Ju=xt.extend({method:N("notifications/message"),params:Gu}),Ku=T({name:f().optional()}),Bu=T({hints:A(Ku).optional(),costPriority:G().min(0).max(1).optional(),speedPriority:G().min(0).max(1).optional(),intelligencePriority:G().min(0).max(1).optional()}),Wu=T({mode:le(["auto","required","none"]).optional()}),Yu=T({type:N("tool_result"),toolUseId:f().describe("The unique identifier for the corresponding tool call."),content:A(ns),structuredContent:ce().optional(),isError:Y().optional(),_meta:ee(f(),ce()).optional()}),Xu=Ko("type",[es,ts,rs]),po=Ko("type",[es,ts,rs,ku,Yu]),Qu=T({role:gn,content:te([po,A(po)]),_meta:ee(f(),ce()).optional()}),el=go.extend({messages:A(Qu),modelPreferences:Bu.optional(),systemPrompt:f().optional(),includeContext:le(["none","thisServer","allServers"]).optional(),temperature:G().optional(),maxTokens:G().int(),stopSequences:A(f()).optional(),metadata:Qe.optional(),tools:A(Yi).optional(),toolChoice:Wu.optional()}),tl=et.extend({method:N("sampling/createMessage"),params:el}),rl=tt.extend({model:f(),stopReason:ae(le(["endTurn","stopSequence","maxTokens"]).or(f())),role:gn,content:Xu}),nl=tt.extend({model:f(),stopReason:ae(le(["endTurn","stopSequence","maxTokens","toolUse"]).or(f())),role:gn,content:te([po,A(po)])}),Qi=T({type:N("boolean"),title:f().optional(),description:f().optional(),default:Y().optional()}),os=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()}),ss=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()}),ol=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()}),sl=te([na,oa]),il=te([ra,ol,sl]),sa=te([il,Qi,os,ss]),is=go.extend({mode:N("form").optional(),message:f(),requestedSchema:T({type:N("object"),properties:ee(f(),sa),required:A(f()).optional()}).catchall(ce())}),al=go.extend({mode:N("url"),message:f(),elicitationId:f(),url:f().url()}),cl=te([is,al]),ul=et.extend({method:N("elicitation/create"),params:cl}),ll=It.extend({elicitationId:f()}),dl=xt.extend({method:N("notifications/elicitation/complete"),params:ll}),pl=tt.extend({action:le(["accept","decline","cancel"]),content:lo((e)=>e===null?void 0:e,ee(f(),te([f(),G(),Y(),A(f())])).optional())}),fl=T({type:N("ref/resource"),uri:f()}),ml=T({type:N("ref/prompt"),name:f()}),hl=_t.extend({ref:te([ml,fl]),argument:T({name:f(),value:f()}),context:T({arguments:ee(f(),f()).optional()}).optional()}),gl=et.extend({method:N("completion/complete"),params:hl}),yl=tt.extend({completion:pe({values:A(f()).max(100),total:ae(G().int()),hasMore:ae(Y())})}),_l=T({uri:f().startsWith("file://"),name:f().optional(),_meta:ee(f(),ce()).optional()}),vl=et.extend({method:N("roots/list"),params:_t.optional()}),Sl=tt.extend({roots:A(_l)}),bl=xt.extend({method:N("notifications/roots/list_changed"),params:It.optional()}),Bf=pe({ttl:G().optional(),pollInterval:G().optional()}),$l=le(["working","input_required","completed","failed","cancelled"]),_n=T({taskId:f(),status:$l,ttl:te([G(),uo()]),createdAt:f(),lastUpdatedAt:f(),pollInterval:ae(G()),statusMessage:ae(f())}),Wf=tt.extend({task:_n}),wl=It.merge(_n),Yf=xt.extend({method:N("notifications/tasks/status"),params:wl}),Xf=et.extend({method:N("tasks/get"),params:_t.extend({taskId:f()})}),Qf=tt.merge(_n),em=et.extend({method:N("tasks/result"),params:_t.extend({taskId:f()})}),tm=tt.loose(),rm=mn.extend({method:N("tasks/list")}),nm=hn.extend({tasks:A(_n)}),om=et.extend({method:N("tasks/cancel"),params:_t.extend({taskId:f()})}),sm=tt.merge(_n),im=te([Hi,Wc,Qc,gl,Zu,xu,Pu,su,au,lu,mu,gu,_u,Fu,Lu]),am=te([Fi,Zi,Xc,bl]),cm=te([Ui,rl,nl,pl,Sl]),um=te([Hi,tl,ul,vl]),lm=te([Fi,Zi,Ju,Ru,pu,Vu,ju,Su,dl]),dm=te([Ui,Yc,eu,yl,Nu,Tu,iu,cu,du,Xi,Du,$u]),yt=Mc().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:h0.custom,message:"URL must be parseable",fatal:!0}),Ap}).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"}),pm=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:Y().optional(),authorization_details_types_supported:A(f()).optional(),dpop_signing_alg_values_supported:A(f()).optional(),dpop_bound_access_tokens_required:Y().optional()}),Rl=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:Y().optional(),authorization_response_iss_parameter_supported:Y().optional().catch(void 0)}),El=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:Y().optional(),request_parameter_supported:Y().optional(),request_uri_parameter_supported:Y().optional(),require_request_uri_registration:Y().optional(),op_policy_uri:yt.optional(),op_tos_uri:yt.optional(),client_id_metadata_document_supported:Y().optional(),authorization_response_iss_parameter_supported:Y().optional().catch(void 0)}),fm=T({...El.shape,...Rl.pick({code_challenge_methods_supported:!0}).shape}),mm=T({access_token:f(),id_token:f().optional(),token_type:f(),expires_in:KC().optional(),scope:f().optional(),refresh_token:f().optional()}).strip(),hm=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(),gm=T({error:f(),error_description:f().optional(),error_uri:f().optional()}),Vf=yt.optional().or(N("").transform(()=>{return})),zl=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:Vf,scope:f().optional(),contacts:A(f()).optional(),tos_uri:Vf,policy_uri:f().optional(),jwks_uri:yt.optional(),jwks:c0().optional(),software_id:f().optional(),software_version:f().optional(),software_statement:f().optional()}).strip(),Pl=T({client_id:f(),client_secret:f().optional(),client_id_issued_at:G().optional(),client_secret_expires_at:G().optional()}).strip(),ym=zl.merge(Pl),_m=T({error:f(),error_description:f().optional()}).strip(),vm=T({token:f(),token_type_hint:f().optional()}).strip();var wm=Symbol.for("mcp.sdk.errorBrands");function Pm(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,wm,{value:r,enumerable:!1,configurable:!0})}function cs(e,t){try{if(typeof t==="object"&&t!==null&&Object.prototype.hasOwnProperty.call(e,"mcpBrand")&&typeof e.mcpBrand==="string"&&Object.prototype.hasOwnProperty.call(t,wm)){let r=t[wm];if(r&&typeof r.has==="function"&&r.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}var XC=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](t){return cs(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 cs(this,t)}constructor(t,r,n){super(r);this.code=t,this.errorUri=n,this.name="OAuthError",Pm(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 cs(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 cs(this,e)}constructor(e,t,r){super(t);this.code=e,this.data=r,this.name="SdkError",Pm(this,new.target)}},QC=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 z0(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function eA(e,t,r){return e==="elicitation"&&t==="form"&&r.form===void 0&&r.url===void 0}function L0(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 Nl(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(z0(o)&&z0(s)){let i={};for(let[a,c]of Object.entries(o))if(c!==void 0&&s[a]===void 0&&!eA(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 D0="2026-07-28",Sn=[D0];function ls(e){return e>=D0}function U0(e){return e.filter((t)=>!ls(t))}function Tm(e){return e.filter((t)=>ls(t))}function F0(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 V0=["task","inputRequests","requestState"];function Im(e){if(e===null||typeof e!=="object"||Array.isArray(e)||e.content!==void 0||V0.some((t)=>(t in e)))return e;return{...e,content:[]}}function tA(){let e=Ci(()=>te([f(),G(),Y(),uo(),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:Y().optional()}),t),R=lo((Tt)=>{if(Tt&&typeof Tt==="object"&&!Array.isArray(Tt)&&Object.keys(Tt).length===0)return{form:{}};return Tt},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()}),O=T({experimental:ee(f(),t).optional(),sampling:T({context:t.optional(),tools:t.optional()}).optional(),elicitation:R.optional(),roots:T({listChanged:Y().optional()}).optional(),tasks:b.optional(),extensions:ee(f(),t).optional()}),q=a.extend({protocolVersion:f(),capabilities:O,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:Y().optional()}).optional(),resources:T({subscribe:Y().optional(),listChanged:Y().optional()}).optional(),tools:T({listChanged:Y().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()}),k=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()}),x=f().refine((Tt)=>{try{return atob(Tt),!0}catch{return!1}},{message:"Invalid Base64 string"}),j=K.extend({blob:x}),W=le(["user","assistant"]),ue=T({audience:A(W).optional(),priority:G().min(0).max(1).optional(),lastModified:Jo({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=k.extend({method:N("resources/list")}),Nt=M.extend({resources:A(Ee)}),I=k.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,zt=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(Y())}),pr=T({...v.shape,...S.shape,description:ae(f()),arguments:ae(A(Fr)),_meta:ae(pe({}))}),Vr=k.extend({method:N("prompts/list")}),Qr=M.extend({prompts:A(pr)}),en=a.extend({name:f(),arguments:ee(f(),f()).optional()}),Bn=u.extend({method:N("prompts/get"),params:en}),Wn=T({type:N("text"),text:f(),annotations:ue.optional(),_meta:ee(f(),ce()).optional()}),Yn=T({type:N("image"),data:x,mimeType:f(),annotations:ue.optional(),_meta:ee(f(),ce()).optional()}),Xn=T({type:N("audio"),data:x,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([Wn,Yn,Xn,Ks,tn]),Co=T({role:W,content:tr}),Ao=p.extend({description:f().optional(),messages:A(Co)}),Qn=d.extend({method:N("notifications/prompts/list_changed"),params:l.optional()}),Bs=T({title:f().optional(),readOnlyHint:Y().optional(),destructiveHint:Y().optional(),idempotentHint:Y().optional(),openWorldHint:Y().optional()}),No=T({taskSupport:le(["required","optional","forbidden"]).optional()}),eo=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:No.optional(),_meta:ee(f(),ce()).optional()}),jo=k.extend({method:N("tools/list")}),qo=M.extend({tools:A(eo)}),Mo=p.extend({content:A(tr),structuredContent:ee(f(),ce()).optional(),isError:Y().optional()}),Pt=c.extend({name:f(),arguments:ee(f(),ce()).optional()}),Ws=u.extend({method:N("tools/call"),params:Pt}),Ya=d.extend({method:N("notifications/tools/list_changed"),params:l.optional()}),Lo=le(["debug","info","notice","warning","error","critical","alert","emergency"]),Ys=a.extend({level:Lo}),Xs=u.extend({method:N("logging/setLevel"),params:Ys}),Qs=l.extend({level:Lo,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()}),Xa=T({type:N("tool_result"),toolUseId:f().describe("The unique identifier for the corresponding tool call."),content:A(tr),structuredContent:T({}).loose().optional(),isError:Y().optional(),_meta:ee(f(),ce()).optional()}),oi=Ko("type",[Wn,Yn,Xn]),rn=Ko("type",[Wn,Yn,Xn,Js,Xa]),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(eo).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:Y().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]),to=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()}),ro=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()}),Qa=te([to,ro]),ec=te([hi,gi,Qa]),Bt=te([ec,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]),tc=u.extend({method:N("elicitation/create"),params:fr}),rc=l.extend({elicitationId:f()}),nc=d.extend({method:N("notifications/elicitation/complete"),params:rc}),oc=p.extend({action:le(["accept","decline","cancel"]),content:lo((Tt)=>Tt===null?void 0:Tt,ee(f(),te([f(),G(),Y(),A(f())])).optional())}),sc=T({type:N("ref/resource"),uri:f()}),ic=T({type:N("ref/prompt"),name:f()}),ac=a.extend({ref:te([ic,sc]),argument:T({name:f(),value:f()}),context:T({arguments:ee(f(),f()).optional()}).optional()}),_i=u.extend({method:N("completion/complete"),params:ac}),cc=p.extend({completion:pe({values:A(f()).max(100),total:ae(G().int()),hasMore:ae(Y())})}),uc=T({uri:f().startsWith("file://"),name:f().optional(),_meta:ee(f(),ce()).optional()}),Do=u.extend({method:N("roots/list"),params:a.optional()}),vi=p.extend({roots:A(uc)}),lc=d.extend({method:N("notifications/roots/list_changed"),params:l.optional()}),dc=pe({ttl:G().optional(),pollInterval:G().optional()}),pc=le(["working","input_required","completed","failed","cancelled"]),nn=T({taskId:f(),status:pc,ttl:te([G(),uo()]),createdAt:f(),lastUpdatedAt:f(),pollInterval:ae(G()),statusMessage:ae(f())}),Lt=p.extend({task:nn}),fc=l.merge(nn),no=d.extend({method:N("notifications/tasks/status"),params:fc}),Uo=u.extend({method:N("tasks/get"),params:a.extend({taskId:f()})}),Fo=p.merge(nn),Vo=u.extend({method:N("tasks/result"),params:a.extend({taskId:f()})}),Op=p.loose(),Dt=k.extend({method:N("tasks/list")}),ut=M.extend({tasks:A(nn)}),oo=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:O,InitializeRequestParamsSchema:q,InitializeRequestSchema:C,ServerCapabilitiesSchema:F,InitializeResultSchema:B,InitializedNotificationSchema:Z,PingRequestSchema:ge,ProgressSchema:Ie,ProgressNotificationParamsSchema:Ae,ProgressNotificationSchema:Ue,PaginatedRequestParamsSchema:Pe,PaginatedRequestSchema:k,PaginatedResultSchema:M,ResourceContentsSchema:K,TextResourceContentsSchema:P,BlobResourceContentsSchema:j,RoleSchema:W,AnnotationsSchema:ue,ResourceSchema:Ee,ResourceTemplateSchema:ye,ListResourcesRequestSchema:He,ListResourcesResultSchema:Nt,ListResourceTemplatesRequestSchema:I,ListResourceTemplatesResultSchema:L,ResourceRequestParamsSchema:H,ReadResourceRequestParamsSchema:fe,ReadResourceRequestSchema:me,ReadResourceResultSchema:we,ResourceListChangedNotificationSchema:ct,SubscribeRequestParamsSchema:ft,SubscribeRequestSchema:zt,UnsubscribeRequestParamsSchema:lt,UnsubscribeRequestSchema:We,ResourceUpdatedNotificationParamsSchema:er,ResourceUpdatedNotificationSchema:gt,PromptArgumentSchema:Fr,PromptSchema:pr,ListPromptsRequestSchema:Vr,ListPromptsResultSchema:Qr,GetPromptRequestParamsSchema:en,GetPromptRequestSchema:Bn,TextContentSchema:Wn,ImageContentSchema:Yn,AudioContentSchema:Xn,ToolUseContentSchema:Js,EmbeddedResourceSchema:tn,ResourceLinkSchema:Ks,ContentBlockSchema:tr,PromptMessageSchema:Co,GetPromptResultSchema:Ao,PromptListChangedNotificationSchema:Qn,ToolAnnotationsSchema:Bs,ToolExecutionSchema:No,ToolSchema:eo,ListToolsRequestSchema:jo,ListToolsResultSchema:qo,CallToolResultSchema:Mo,CallToolRequestParamsSchema:Pt,CallToolRequestSchema:Ws,ToolListChangedNotificationSchema:Ya,LoggingLevelSchema:Lo,SetLevelRequestParamsSchema:Ys,SetLevelRequestSchema:Xs,LoggingMessageNotificationParamsSchema:Qs,LoggingMessageNotificationSchema:ei,ModelHintSchema:ti,ModelPreferencesSchema:ri,ToolChoiceSchema:ni,ToolResultContentSchema:Xa,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:to,TitledMultiSelectEnumSchemaSchema:ro,MultiSelectEnumSchemaSchema:Qa,EnumSchemaSchema:ec,PrimitiveSchemaDefinitionSchema:Bt,ElicitRequestFormParamsSchema:Wt,ElicitRequestURLParamsSchema:yi,ElicitRequestParamsSchema:fr,ElicitRequestSchema:tc,ElicitationCompleteNotificationParamsSchema:rc,ElicitationCompleteNotificationSchema:nc,ElicitResultSchema:oc,ResourceTemplateReferenceSchema:sc,PromptReferenceSchema:ic,CompleteRequestParamsSchema:ac,CompleteRequestSchema:_i,CompleteResultSchema:cc,RootSchema:uc,ListRootsRequestSchema:Do,ListRootsResultSchema:vi,RootsListChangedNotificationSchema:lc,TaskCreationParamsSchema:dc,TaskStatusSchema:pc,TaskSchema:nn,CreateTaskResultSchema:Lt,TaskStatusNotificationParamsSchema:fc,TaskStatusNotificationSchema:no,GetTaskRequestSchema:Uo,GetTaskResultSchema:Fo,GetTaskPayloadRequestSchema:Vo,GetTaskPayloadResultSchema:Op,ListTasksRequestSchema:Dt,ListTasksResultSchema:ut,CancelTaskRequestSchema:oo,CancelTaskResultSchema:p.merge(nn),ClientRequestSchema:te([ge,C,_i,Xs,Bn,Vr,He,I,me,zt,We,Ws,jo,Uo,Vo,Dt,oo]),ClientNotificationSchema:te([_,Ue,Z,lc,no]),ClientResultSchema:te([h,ci,ui,oc,vi,Fo,ut,Lt]),ServerRequestSchema:te([ge,ai,tc,Do,Uo,Vo,Dt,oo]),ServerNotificationSchema:te([_,Ue,ei,gt,ct,Ya,Qn,no,nc]),ServerResultSchema:te([h,B,cc,Ao,Qr,Nt,L,we,Mo,qo,Fo,ut,Lt]),CallToolResultWireSchema:ce().superRefine((Tt,pO)=>{if(typeof Tt!=="object"||Tt===null||Array.isArray(Tt)||Tt.content!==void 0)return;for(let Sy of V0)if(Sy in Tt){pO.addIssue({code:"custom",message:`content is required when the body carries '${Sy}' — another result family cannot default into an empty tools/call success`});return}}).transform(Im).pipe(Mo)}}var rA;function H0(){return rA??=tA()}function Z0(e){return e.type!=="object"}var nA=new Set(["const","enum","default","examples"]),oA=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function P0(e){return e!==void 0&&!(typeof e==="string"&&e.startsWith("#"))}function sA(e){let t=typeof e.$schema==="string"?e.$schema:void 0;if(P0(e.$id))return{...t!==void 0&&{$schema:t},type:"object",properties:{result:e},required:["result"]};let r=Ey(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&&P0(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(nA.has(c))i[c]=u;else if(oA.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 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},J0={"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},iA={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},Tl;function xm(){if(Tl)return Tl;let e=H0();return Tl={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}},Tl}function K0(e){return Object.prototype.hasOwnProperty.call(G0,e)}function B0(e){return Object.prototype.hasOwnProperty.call(J0,e)}function aA(e){return Object.prototype.hasOwnProperty.call(iA,e)}function cA(e){return aA(e)?xm().resultSchemas[e]:void 0}function uA(e){return K0(e)?xm().requestSchemas[e]:void 0}function lA(e){return B0(e)?xm().notificationSchemas[e]:void 0}var ZK=Object.keys(G0),GK=Object.keys(J0);function Rm(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function Il(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 T0={ok:!1,reason:"not-in-era"};function I0(e){return Rm(e)&&Rm(e.outputSchema)&&Z0(e.outputSchema)}function x0(e){return e}var km={era:"2025-11-25",hasRequestMethod:K0,hasNotificationMethod:B0,validateRequest:(e,t)=>Il(uA(e),t),validateResult:(e,t)=>Il(cA(e),t),validateNotification:(e,t)=>Il(lA(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>T0,validateInputResponse:()=>T0,samplingResultVariant:(e,t)=>{let r=H0();return Il(e?r.CreateMessageResultWithToolsSchema:r.CreateMessageResultSchema,t)},outboundEnvelope:(e)=>{return},validateEnvelopeMeta:(e)=>[],projectCallToolResult(e,t){let r=F0(e),n=r.structuredContent;if(n===void 0)return r;let o=typeof n!=="object"||n===null||Array.isArray(n),s=t!==void 0&&Z0(t);if(!o&&!s)return r;return{...r,structuredContent:{result:n}}},decodeResult(e,t){if(Rm(t)&&"resultType"in t){let r={...t};return delete r.resultType,{kind:"complete",result:x0(r)}}return{kind:"complete",result:x0(t)}},encodeResult(e,t){if(e!=="tools/list")return t;let r=t.tools;if(!Array.isArray(r)||!r.some((n)=>I0(n)))return t;return{...t,tools:r.map((n)=>I0(n)?{...n,outputSchema:sA(n.outputSchema)}:n)}},encodeErrorCode:(e)=>e===-32002?-32602:e,checkInboundEnvelope:(e)=>{return}};function dA(){let e=Ci(()=>te([f(),G(),Y(),uo(),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:Y().optional()}),t),w=lo((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:Y().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:Y().optional()}).optional(),resources:T({subscribe:Y().optional(),listChanged:Y().optional()}).optional(),tools:T({listChanged:Y().optional()}).optional(),tasks:R.optional(),extensions:ee(f(),t).optional()}),O=T({progress:G(),total:ae(G()),message:ae(f())}),q=T({...m.shape,...O.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:Jo({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({}))}),k=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(Y())}),x=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()}),Nt=Ue.extend({type:N("resource_link")}),I=te([W,ue,Ee,Nt,He]),L=T({role:s,content:I}),H=T({title:f().optional(),readOnlyHint:Y().optional(),destructiveHint:Y().optional(),idempotentHint:Y().optional(),openWorldHint:Y().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:Y().optional()}),zt=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]),Bn=te([en,ft,zt,lt]),Wn=p.extend({mode:N("form").optional(),message:f(),requestedSchema:T({type:N("object"),properties:ee(f(),Bn),required:A(f()).optional()}).catchall(ce())}),Yn=T({type:N("ref/resource"),uri:f()}),Xn=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,Co=T({experimental:tr.experimental,logging:tr.logging,completions:tr.completions,prompts:tr.prompts,resources:tr.resources,tools:tr.tools,extensions:tr.extensions}),Ao=pe({progressToken:r.optional(),[Jr]:f(),[Bo]:S.optional(),[Kr]:Ks,[dn]:i.optional()}),Qn=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:Y().optional(),_meta:ee(f(),ce()).optional()}),No=te([W,ue,Ee,ye,Bs]),eo=T({role:s,content:te([No,A(No)]),_meta:ee(f(),ce()).optional()}),jo=f(),qo=pe({[Er]:S.optional().catch(void 0)}),Mo=qo.optional();function Pt(ut){return pe({_meta:Mo,resultType:jo.default("complete"),...ut})}let Ws=Pt({}),Ya=Pt({nextCursor:n.optional()}),Lo=Pt({content:A(I),structuredContent:ce().optional(),isError:Y().optional()}),Ys=Pt({ttlMs:G().int().min(0),cacheScope:le(["public","private"]),tools:A(Qn),nextCursor:n.optional()}),Xs=Pt({ttlMs:G().int().min(0),cacheScope:le(["public","private"]),prompts:A(x),nextCursor:n.optional()}),Qs=Pt({description:f().optional(),messages:A(L)}),ei=Pt({ttlMs:G().int().min(0),cacheScope:le(["public","private"]),resources:A(Ue),nextCursor:n.optional()}),ti=Pt({ttlMs:G().int().min(0),cacheScope:le(["public","private"]),resourceTemplates:A(Pe),nextCursor:n.optional()}),ri=Pt({ttlMs:G().int().min(0),cacheScope:le(["public","private"]),contents:A(te([ge,Ie]))}),ni=Pt({completion:T({values:A(f()).max(100),total:G().int().optional(),hasMore:Y().optional()}).loose()}),Xa=Pt({ttlMs:G().int().min(0),cacheScope:le(["public","private"])}),oi=Pt({ttlMs:G().int().min(0).catch(0),cacheScope:le(["public","private"]).catch("private"),supportedVersions:A(f()),capabilities:Co,instructions:f().optional()}),rn=T({messages:A(eo),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(Qn).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({...eo.shape,model:f(),stopReason:f().optional()}),ci=T({roots:A(Js)}),ui=T({action:le(["accept","decline","cancel"]),content:ee(f(),te([f(),G(),Y(),A(f())])).optional()}),li=T({mode:N("url"),message:f(),url:f().url()}),di=te([Wn,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),to=Pt({inputRequests:hi.optional(),requestState:f().optional()}),ro={inputResponses:gi.optional(),requestState:f().optional()},Qa=T({_meta:Ao,...ro}),ec=pe({progressToken:r.optional()});function Bt(ut,oo){return T({method:N(ut),params:T({_meta:Ao,...oo})})}function Wt(ut,oo){return T({method:N(ut),params:T({_meta:ec.optional(),...oo}).optional()})}let yi={name:f(),arguments:ee(f(),ce()).optional(),...ro},fr={cursor:n.optional()},tc=Bt("tools/call",yi),rc=Bt("tools/list",fr),nc=Bt("prompts/list",fr),oc=Bt("prompts/get",{name:f(),arguments:ee(f(),f()).optional(),...ro}),sc=Bt("resources/list",fr),ic=Bt("resources/templates/list",fr),ac=Bt("resources/read",{uri:f(),...ro}),_i={ref:te([Xn,Yn]),argument:T({name:f(),value:f()}),context:T({arguments:ee(f(),f()).optional()}).optional()},cc=Bt("completion/complete",_i),uc=Bt("server/discover",{}),Do=T({toolsListChanged:Y().optional(),promptsListChanged:Y().optional(),resourcesListChanged:Y().optional(),resourceSubscriptions:A(f()).optional()}),vi={notifications:Do},lc=Bt("subscriptions/listen",vi),dc=qo.extend({"io.modelcontextprotocol/subscriptionId":o}),pc=pe({_meta:dc,resultType:jo.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 Lt(ut){return pe({_meta:Mo,...ut})}let fc={"tools/call":Lt({content:A(I),structuredContent:ce().optional(),isError:Y().optional()}),"tools/list":Lt({ttlMs:G().int().min(0),cacheScope:le(["public","private"]),tools:A(Qn),nextCursor:n.optional()}),"prompts/get":Lt({description:f().optional(),messages:A(L)}),"prompts/list":Lt({ttlMs:G().int().min(0),cacheScope:le(["public","private"]),prompts:A(x),nextCursor:n.optional()}),"resources/list":Lt({ttlMs:G().int().min(0),cacheScope:le(["public","private"]),resources:A(Ue),nextCursor:n.optional()}),"resources/templates/list":Lt({ttlMs:G().int().min(0),cacheScope:le(["public","private"]),resourceTemplates:A(Pe),nextCursor:n.optional()}),"resources/read":Lt({ttlMs:G().int().min(0),cacheScope:le(["public","private"]),contents:A(te([ge,Ie]))}),"completion/complete":Lt({completion:T({values:A(f()).max(100),total:G().int().optional(),hasMore:Y().optional()}).loose()}),"server/discover":Lt({ttlMs:G().int().min(0).catch(0),cacheScope:le(["public","private"]).catch("private"),supportedVersions:A(f()),capabilities:Co,instructions:f().optional()}),"subscriptions/listen":Lt({})},no=pe({"io.modelcontextprotocol/subscriptionId":o.optional()}),Uo=T({method:N("notifications/subscriptions/acknowledged"),params:T({_meta:no.optional(),notifications:Do})}),Fo=T({_meta:no.optional(),requestId:o,reason:f().optional()}),Vo=T({method:N("notifications/cancelled"),params:Fo}),Op={"notifications/cancelled":Vo,"notifications/progress":C,"notifications/message":B,"notifications/resources/updated":K,"notifications/resources/list_changed":k,"notifications/tools/list_changed":fe,"notifications/prompts/list_changed":j,"notifications/subscriptions/acknowledged":Uo},Dt=(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:O,ProgressNotificationParamsSchema:q,ProgressNotificationSchema:C,LoggingMessageNotificationParamsSchema:F,LoggingMessageNotificationSchema:B,ResourceContentsSchema:Z,TextResourceContentsSchema:ge,BlobResourceContentsSchema:Ie,AnnotationsSchema:Ae,ResourceSchema:Ue,ResourceTemplateSchema:Pe,ResourceListChangedNotificationSchema:k,ResourceUpdatedNotificationParamsSchema:M,ResourceUpdatedNotificationSchema:K,PromptArgumentSchema:P,PromptSchema:x,PromptListChangedNotificationSchema:j,TextContentSchema:W,ImageContentSchema:ue,AudioContentSchema:Ee,ToolUseContentSchema:ye,EmbeddedResourceSchema:He,ResourceLinkSchema:Nt,ContentBlockSchema:I,PromptMessageSchema:L,ToolAnnotationsSchema:H,ToolListChangedNotificationSchema:fe,ModelHintSchema:me,ModelPreferencesSchema:we,ToolChoiceSchema:ct,BooleanSchemaSchema:ft,StringSchemaSchema:zt,NumberSchemaSchema:lt,UntitledSingleSelectEnumSchemaSchema:We,TitledSingleSelectEnumSchemaSchema:er,LegacyTitledEnumSchemaSchema:gt,SingleSelectEnumSchemaSchema:Fr,UntitledMultiSelectEnumSchemaSchema:pr,TitledMultiSelectEnumSchemaSchema:Vr,MultiSelectEnumSchemaSchema:Qr,EnumSchemaSchema:en,PrimitiveSchemaDefinitionSchema:Bn,ElicitRequestFormParamsSchema:Wn,ResourceTemplateReferenceSchema:Yn,PromptReferenceSchema:Xn,RootSchema:Js,ClientCapabilities2026Schema:Ks,ServerCapabilities2026Schema:Co,RequestMetaEnvelopeSchema:Ao,ToolSchema:Qn,ToolResultContentSchema:Bs,SamplingMessageContentBlockSchema:No,SamplingMessageSchema:eo,ResultTypeSchema:jo,ResultMetaSchema:qo,ResultSchema:Ws,PaginatedResultSchema:Ya,CallToolResultSchema:Lo,ListToolsResultSchema:Ys,ListPromptsResultSchema:Xs,GetPromptResultSchema:Qs,ListResourcesResultSchema:ei,ListResourceTemplatesResultSchema:ti,ReadResourceResultSchema:ri,CompleteResultSchema:ni,CacheableResultSchema:Xa,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:to,InputResponseRequestParamsSchema:Qa,CallToolRequestSchema:tc,ListToolsRequestSchema:rc,ListPromptsRequestSchema:nc,GetPromptRequestSchema:oc,ListResourcesRequestSchema:sc,ListResourceTemplatesRequestSchema:ic,ReadResourceRequestSchema:ac,CompleteRequestSchema:cc,DiscoverRequestSchema:uc,SubscriptionFilterSchema:Do,SubscriptionsListenRequestSchema:lc,SubscriptionsListenResultMetaSchema:dc,SubscriptionsListenResultSchema:pc,dispatchRequestSchemas:nn,dispatchResultSchemas:fc,NotificationMetaSchema:no,SubscriptionsAcknowledgedNotificationSchema:Uo,CancelledNotificationParamsSchema:Fo,CancelledNotificationSchema:Vo,notificationSchemas2026:Op,JSONRPCResultResponseSchema:Dt(Ws),CallToolResultResponseSchema:Dt(te([Lo,to])),ListToolsResultResponseSchema:Dt(Ys),ListPromptsResultResponseSchema:Dt(Xs),GetPromptResultResponseSchema:Dt(te([Qs,to])),ListResourcesResultResponseSchema:Dt(ei),ListResourceTemplatesResultResponseSchema:Dt(ti),ReadResourceResultResponseSchema:Dt(te([ri,to])),CompleteResultResponseSchema:Dt(ni),DiscoverResultResponseSchema:Dt(oi)}}var pA;function _o(){return pA??=dA()}var fA=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"];function mA(e){return fA.includes(e)}var as=Symbol("modelcontextprotocol.resultCacheHintFallback");function jl(e,t){if(t===void 0)return e;let r=e[as];if(r===void 0)return{...e,[as]: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,[as]:n}}function hA(e){return e[as]}function Om(e){return typeof e==="number"&&Number.isSafeInteger(e)&&e>=0}function Cm(e){return e==="public"||e==="private"}function Am(e,t){if(e.ttlMs!==void 0&&!Om(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&&!Cm(e.cacheScope))throw RangeError(`Invalid cache hint for ${t}: cacheScope must be 'public' or 'private' (got ${String(e.cacheScope)})`)}var X=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 cs(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 cs(this,t)}constructor(t,r,n){super(r);this.code=t,this.data=n,this.name="ProtocolError",Pm(this,new.target)}static fromError(t,r,n){if(t===X.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new W0(o.elicitations,r)}if(t===X.UnsupportedProtocolVersion&&n){let o=n;if(Array.isArray(o.supported)&&typeof o.requested==="string")return new ds({supported:o.supported,requested:o.requested},r)}if(t===X.InvalidParams||t===X.ResourceNotFound){let o=n;if(typeof o?.uri==="string"&&(t===X.ResourceNotFound||Object.keys(o).length===1))return new ql(o.uri,r)}if(t===X.MissingRequiredClientCapability&&n){let o=n;if(o.requiredCapabilities!==null&&typeof o.requiredCapabilities==="object"&&!Array.isArray(o.requiredCapabilities))return new Ml({requiredCapabilities:o.requiredCapabilities},r)}return new e(t,r,n)}},ql=class extends de{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(e,t=`Resource not found: ${e}`){super(X.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},W0=class extends de{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(X.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},ds=class extends de{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(X.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},Ml=class extends de{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(", ")}`){super(X.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},gA=0,yA="private",_A=["tools/call","prompts/get","resources/read"];function vA(e,t){let r=t.resultType;if(r===void 0)return{...t,resultType:"complete"};if(r==="complete")return t;if(_A.includes(e))return t;throw new de(X.InternalError,`Handler for ${e} returned resultType '${String(r)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function SA(e,t){let r=hA(t);if(t.resultType!=="complete"||!mA(e))return r===void 0?t:EA(t);let n=t,o=Om(n.ttlMs)?n.ttlMs:wA(r),s=Cm(n.cacheScope)?n.cacheScope:RA(r),i={...n,ttlMs:o,cacheScope:s};return delete i[as],i}function bA(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(!bA(r))return e;if(r[Er]!==void 0)return e;return{...e,_meta:{...r,[Er]:t}}}function wA(e){return e!==void 0&&Om(e.ttlMs)?e.ttlMs:gA}function RA(e){return e!==void 0&&Cm(e.cacheScope)?e.cacheScope:yA}function EA(e){let t={...e};return delete t[as],t}var zA=["elicitation/create","sampling/createMessage","roots/list"],xl;function Y0(){if(xl)return xl;let e=_o();return xl={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}},xl}function X0(e){return zA.includes(e)}function Sm(e){return X0(e)?Y0().request[e]:void 0}function PA(e){return X0(e)?Y0().response[e]:void 0}var Nm={"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},Q0={"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 eb(e){return Object.prototype.hasOwnProperty.call(Nm,e)}function tb(e){return Object.prototype.hasOwnProperty.call(Q0,e)}function TA(e){return Object.prototype.hasOwnProperty.call(Nm,e)}function IA(e){return eb(e)?_o().dispatchRequestSchemas[e]:void 0}function xA(e){return TA(e)?_o().dispatchResultSchemas[e]:void 0}function kA(e){return tb(e)?_o().notificationSchemas2026[e]:void 0}var JK=Object.keys(Nm),KK=Object.keys(Q0);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 OA={ok:!1,reason:"not-in-era"},CA=[Jr,Kr];function AA(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 jm={era:"2026-07-28",hasRequestMethod:eb,hasNotificationMethod:tb,hasInputRequestMethod:(e)=>Sm(e)!==void 0,validateRequest:(e,t)=>ia(IA(e),t),validateResult:(e,t)=>ia(xA(e),t),validateNotification:(e,t)=>ia(kA(e),t),validateInputRequest:(e,t)=>ia(Sm(e),t),validateInputResponse:(e,t)=>ia(PA(e),t),samplingResultVariant:()=>OA,outboundEnvelope(e){return{[Jr]:e.protocolVersion,[Bo]:e.clientInfo,[Kr]:e.clientCapabilities,...e.logLevel!==void 0&&{[dn]:e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let n of CA)if(!(n in e))t.push({key:n,problem:"missing"});let r=_o().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)=>F0(e),inputRequestSchema:Sm,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=NA(),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(SA(e,vA(e,AA(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=_o().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 NA(){if(kl)return kl;let e=_o();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&&ls(e)?jm:km}function k0(e){if(e.revision!==void 0)return vn(e.revision).era;return e.era==="modern"?jm.era:km.era}function bm(e){return rb.some((t)=>t.hasRequestMethod(e))}function $m(e){return rb.some((t)=>t.hasNotificationMethod(e))}var rb=[km,jm];function O0(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function vo(e){if(!O0(e))return;let t=e._meta;return O0(t)?t:void 0}function Ll(e){let t=vo(e);return t!==void 0&&Jr in t}function Dl(e){let t=vo(e)?.[Jr];return typeof t==="string"?t:void 0}function Ul(e){return vn(pa).validateEnvelopeMeta(e)}var jA=wy({AnnotationsSchema:()=>Br,AudioContentSchema:()=>rs,BaseMetadataSchema:()=>Gr,BaseRequestParamsSchema:()=>_t,BlobResourceContentsSchema:()=>Ki,BooleanSchemaSchema:()=>Qi,CallToolRequestParamsSchema:()=>Uu,CallToolRequestSchema:()=>Fu,CallToolResultSchema:()=>Xi,CancelTaskRequestSchema:()=>om,CancelTaskResultSchema:()=>sm,CancelledNotificationParamsSchema:()=>Hc,CancelledNotificationSchema:()=>Fi,ClientCapabilitiesSchema:()=>Kc,ClientNotificationSchema:()=>am,ClientRequestSchema:()=>im,ClientResultSchema:()=>cm,ClientTasksCapabilitySchema:()=>Gc,CompatibilityCallToolResultSchema:()=>Jf,CompleteRequestParamsSchema:()=>hl,CompleteRequestSchema:()=>gl,CompleteResultSchema:()=>yl,ContentBlockSchema:()=>ns,CreateMessageRequestParamsSchema:()=>el,CreateMessageRequestSchema:()=>tl,CreateMessageResultSchema:()=>rl,CreateMessageResultWithToolsSchema:()=>nl,CreateTaskResultSchema:()=>Wf,CursorSchema:()=>Ni,DiscoverRequestSchema:()=>Qc,DiscoverResultSchema:()=>eu,ElicitRequestFormParamsSchema:()=>is,ElicitRequestParamsSchema:()=>cl,ElicitRequestSchema:()=>ul,ElicitRequestURLParamsSchema:()=>al,ElicitResultSchema:()=>pl,ElicitationCompleteNotificationParamsSchema:()=>ll,ElicitationCompleteNotificationSchema:()=>dl,EmbeddedResourceSchema:()=>Ou,EmptyResultSchema:()=>Ui,EnumSchemaSchema:()=>il,GetPromptRequestParamsSchema:()=>Iu,GetPromptRequestSchema:()=>xu,GetPromptResultSchema:()=>Nu,GetTaskPayloadRequestSchema:()=>em,GetTaskPayloadResultSchema:()=>tm,GetTaskRequestSchema:()=>Xf,GetTaskResultSchema:()=>Qf,IconSchema:()=>Zc,IconsSchema:()=>fn,ImageContentSchema:()=>ts,ImplementationSchema:()=>Xo,InitializeRequestParamsSchema:()=>Bc,InitializeRequestSchema:()=>Wc,InitializeResultSchema:()=>Yc,InitializedNotificationSchema:()=>Xc,JSONArraySchema:()=>Hf,JSONObjectSchema:()=>Qe,JSONRPCErrorResponseSchema:()=>Yo,JSONRPCMessageSchema:()=>Di,JSONRPCNotificationSchema:()=>Li,JSONRPCRequestSchema:()=>Mi,JSONRPCResponseSchema:()=>Zf,JSONRPCResultResponseSchema:()=>Wo,JSONValueSchema:()=>ln,LegacyTitledEnumSchemaSchema:()=>ra,ListChangedOptionsBaseSchema:()=>Kf,ListPromptsRequestSchema:()=>Pu,ListPromptsResultSchema:()=>Tu,ListResourceTemplatesRequestSchema:()=>au,ListResourceTemplatesResultSchema:()=>cu,ListResourcesRequestSchema:()=>su,ListResourcesResultSchema:()=>iu,ListRootsRequestSchema:()=>vl,ListRootsResultSchema:()=>Sl,ListTasksRequestSchema:()=>rm,ListTasksResultSchema:()=>nm,ListToolsRequestSchema:()=>Lu,ListToolsResultSchema:()=>Du,LoggingLevelSchema:()=>yn,LoggingMessageNotificationParamsSchema:()=>Gu,LoggingMessageNotificationSchema:()=>Ju,ModelHintSchema:()=>Ku,ModelPreferencesSchema:()=>Bu,MultiSelectEnumSchemaSchema:()=>sl,NotificationSchema:()=>xt,NotificationsParamsSchema:()=>It,NumberSchemaSchema:()=>ss,PaginatedRequestParamsSchema:()=>nu,PaginatedRequestSchema:()=>mn,PaginatedResultSchema:()=>hn,PingRequestSchema:()=>Hi,PrimitiveSchemaDefinitionSchema:()=>sa,ProgressNotificationParamsSchema:()=>ru,ProgressNotificationSchema:()=>Zi,ProgressSchema:()=>tu,ProgressTokenSchema:()=>Ai,PromptArgumentSchema:()=>Eu,PromptListChangedNotificationSchema:()=>ju,PromptMessageSchema:()=>Au,PromptReferenceSchema:()=>ml,PromptSchema:()=>zu,ReadResourceRequestParamsSchema:()=>uu,ReadResourceRequestSchema:()=>lu,ReadResourceResultSchema:()=>du,RelatedTaskMetadataSchema:()=>Vc,RequestIdSchema:()=>pn,RequestMetaSchema:()=>ji,RequestSchema:()=>et,ResourceContentsSchema:()=>Gi,ResourceLinkSchema:()=>Cu,ResourceListChangedNotificationSchema:()=>pu,ResourceRequestParamsSchema:()=>Qo,ResourceSchema:()=>Bi,ResourceTemplateReferenceSchema:()=>fl,ResourceTemplateSchema:()=>ou,ResourceUpdatedNotificationParamsSchema:()=>wu,ResourceUpdatedNotificationSchema:()=>Ru,ResultMetaObjectSchema:()=>qi,ResultSchema:()=>tt,RoleSchema:()=>gn,RootSchema:()=>_l,RootsListChangedNotificationSchema:()=>bl,SamplingContentSchema:()=>Xu,SamplingMessageContentBlockSchema:()=>po,SamplingMessageSchema:()=>Qu,ServerCapabilitiesSchema:()=>Vi,ServerNotificationSchema:()=>lm,ServerRequestSchema:()=>um,ServerResultSchema:()=>dm,ServerTasksCapabilitySchema:()=>Jc,SetLevelRequestParamsSchema:()=>Hu,SetLevelRequestSchema:()=>Zu,SingleSelectEnumSchemaSchema:()=>ol,StringSchemaSchema:()=>os,SubscribeRequestParamsSchema:()=>fu,SubscribeRequestSchema:()=>mu,SubscriptionFilterSchema:()=>Wi,SubscriptionsAcknowledgedNotificationParamsSchema:()=>vu,SubscriptionsAcknowledgedNotificationSchema:()=>Su,SubscriptionsListenRequestParamsSchema:()=>yu,SubscriptionsListenRequestSchema:()=>_u,SubscriptionsListenResultMetaSchema:()=>bu,SubscriptionsListenResultSchema:()=>$u,TaskAugmentedRequestParamsSchema:()=>go,TaskCreationParamsSchema:()=>Bf,TaskMetadataSchema:()=>Fc,TaskSchema:()=>_n,TaskStatusNotificationParamsSchema:()=>wl,TaskStatusNotificationSchema:()=>Yf,TaskStatusSchema:()=>$l,TextContentSchema:()=>es,TextResourceContentsSchema:()=>Ji,TitledMultiSelectEnumSchemaSchema:()=>oa,TitledSingleSelectEnumSchemaSchema:()=>ta,ToolAnnotationsSchema:()=>qu,ToolChoiceSchema:()=>Wu,ToolExecutionSchema:()=>Mu,ToolListChangedNotificationSchema:()=>Vu,ToolResultContentSchema:()=>Yu,ToolSchema:()=>Yi,ToolUseContentSchema:()=>ku,UnsubscribeRequestParamsSchema:()=>hu,UnsubscribeRequestSchema:()=>gu,UntitledMultiSelectEnumSchemaSchema:()=>na,UntitledSingleSelectEnumSchemaSchema:()=>ea});var rr=(e)=>Mi.safeParse(e).success,bn=(e)=>Li.safeParse(e).success,la=(e)=>Wo.safeParse(e).success,Fl=(e)=>Yo.safeParse(e).success;var Wr=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e)&&e.resultType==="input_required";function qm(e){if(e.params.ref.type!=="ref/prompt")throw TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`)}function Mm(e){if(e.params.ref.type!=="ref/resource")throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`)}var C0="x-mcp-header",qA=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,MA=new Set(["string","integer","boolean","number"]);function Lm(e){let t=[],r=new Map,n=(s,i,a)=>{if(s===null||typeof s!=="object")return;let c=s;if(C0 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[C0];if(typeof l!=="string"||l.length===0)return`${Ol(i)}: x-mcp-header MUST be a non-empty string`;if(!qA.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||!MA.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 LA){let d=c[l];if(d===void 0)continue;let p=Array.isArray(d)?d:d!==null&&typeof d==="object"&&DA.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 LA=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],DA=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);function Ol(e){return e.length===0?"<root>":e.join(".")}var Al=-32020,BK=[{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:[X.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:[Al,X.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:[X.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:[X.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:[X.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:[Al],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:[X.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:[Al],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."}],UA={[X.ParseError]:400,[X.InvalidRequest]:400,[X.MethodNotFound]:404,[X.UnsupportedProtocolVersion]:400,[X.MissingRequiredClientCapability]:400,[Al]:400};function Cl(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 Dm(e){if(!Ll(e))return!1;let t=Dl(e);if(t===void 0||!ls(t))return!1;let r=vo(e);return r!==void 0&&Ul(r).length===0}function Um(e,t){switch(e.reason){case"http-method":return Cl("http-method","modern-only-method-not-allowed",405,new de(-32000,"Method not allowed."),!0);case"batch":return Cl("jsonrpc-shape","modern-only-batch-not-supported",400,new de(X.InvalidRequest,"Bad Request: JSON-RPC batches are not supported by this endpoint"),!0);case"response":return Cl("jsonrpc-shape","modern-only-response-post",400,new de(X.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 Cl("era-classification","modern-only-missing-envelope",400,r===void 0?new de(X.UnsupportedProtocolVersion,"Unsupported protocol version: the request did not name a protocol version",{supported:[...t]}):new ds({supported:[...t],requested:r}),!0)}}}function Vl(e,t){return jc(e,t)}function aa(e){return new Set(e.flatMap((t)=>Object.keys(t.shape)))}function us(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 A0=!1,Em="draft-2020-12";function $n(e,t="input"){let r=e["~standard"],n;if(r.jsonSchema)n=r.jsonSchema[t]({target:Em});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(!A0)A0=!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=Ac(e,{target:Em,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 nb(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 nb(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"||nb(n)))}return!1}function FA(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 yo(e,t){let r=await e["~standard"].validate(t);if(r.issues&&r.issues.length>0)return{success:!1,error:r.issues.map((n)=>FA(n)).join(", ")};return{success:!0,data:r.value}}function VA(e){let t=Ac(e,{target:Em,io:"input"});return typeof t.pattern==="string"?t.pattern:void 0}var HA=/\\\.\\d\{(\d+)\}/;function ZA(e){let t=HA.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)=>Jo({local:n,offset:o,precision:s}))))}function GA(e,t){let r;switch(e){case"email":r=[s0()];break;case"uri":r=[Mc()];break;case"date":r=[Df()];break;case"date-time":r=ZA(t);break}return new Set(r.map((n)=>VA(n)).filter((n)=>n!==void 0))}function JA(e,t,r){if(r!=="zod")return!0;return GA(e,t).has(t)}function ob(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 KA(e){try{return $n(e,"input")}catch(t){let r=t instanceof Error?t.message:String(t);throw new de(X.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${r}`)}}var BA=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function Fm(e){return BA.has(e)||e.startsWith("x-")}var WA=new Set(["$schema",...Object.keys(is.shape.requestedSchema.shape)]),N0={string:aa([os,ea,ta,ra]),number:aa([ss]),integer:aa([ss]),boolean:aa([Qi]),array:aa([na,oa])},YA=new Set(os.shape.format.unwrap().options);function XA(e,t,r,n){if(!da(e))return e;let o=typeof e.type==="string"&&Object.hasOwn(N0,e.type)?N0[e.type]:void 0;if(o===void 0)return e;let s={};for(let[i,a]of Object.entries(e))if(o.has(i)||Fm(i))s[i]=a;else if(i==="pattern"&&e.type==="string"&&typeof e.format==="string"){if(!YA.has(e.format))s[i]=a;else if(typeof a!=="string"||!JA(e.format,a,r))n.push(`${t}.${i}`)}else n.push(`${t}.${i}`);return s}function QA(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,XA(a,`properties.${i}`,t,n)]));else if(WA.has(o))r[o]=s;else if(!Fm(o))n.push(o);if(n.length>0)throw new de(X.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${n.join(", ")}`);return r}function eN(e,t){if(!da(e.properties))return t;let r=Object.entries(e.properties).filter(([,n])=>!Vl(sa,n).success).map(([n])=>`properties.${n}`);return r.length>0?r.join(", "):t}function zm(e,t,r=""){if(Array.isArray(e)&&Array.isArray(t))return e.flatMap((n,o)=>zm(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 Fm(n)?[]:[s];return zm(o,t[n],s)})}function tN(e){if(!us(e.requestedSchema))return{...e,mode:"form",requestedSchema:e.requestedSchema};let t=e.requestedSchema["~standard"].vendor,r=QA(KA(e.requestedSchema),t),n=Vl(is.shape.requestedSchema,r);if(!n.success)throw new de(X.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${eN(r,n.error.message)}`);let o=zm(r,n.data);if(o.length>0)throw new de(X.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(X.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${s.join(", ")}`);return{...e,mode:"form",requestedSchema:n.data}}function rN(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 nN=Object.assign(rN,{elicit(e){try{return{method:"elicitation/create",params:tN(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 sb=250;function ib(e,t){return`Multi-round-trip request '${e}' still required input after ${t} rounds (inputRequired.maxRounds)`}function ab(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 cb(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 oN=["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"],sN={IdJagTokenExchangeResponseSchema:hm,OAuthClientInformationFullSchema:ym,OAuthClientInformationSchema:Pl,OAuthClientMetadataSchema:zl,OAuthClientRegistrationErrorSchema:_m,OAuthErrorResponseSchema:gm,OAuthMetadataSchema:Rl,OAuthProtectedResourceMetadataSchema:pm,OAuthTokenRevocationRequestSchema:vm,OAuthTokensSchema:mm,OpenIdProviderDiscoveryMetadataSchema:fm,OpenIdProviderMetadataSchema:El},ub={},lb={};function db(e,t){let r=e.slice(0,-6);ub[r]=t,lb[r]=(n)=>t.safeParse(n).success}for(let e of oN)db(e,jA[e]);for(let[e,t]of Object.entries(sN))db(e,t);var iN=Object.freeze(ub),aN=Object.freeze(lb);function cN(e){switch(e){case"initialize":case"notifications/initialized":return vn(void 0);case"server/discover":return vn(pa);default:return}}var pb=60000,uN=[Jr,Bo,Kr,dn],lN=["inputResponses","requestState"];function j0(e,t){let r=e.params;if(!ua(r))return{message:e,lifted:{}};let n=r._meta,o=ua(n)?uN.filter((c)=>(c in n)):[],s=t==="request"?lN.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 q0(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 dN=fa(void 0);function Vm(e,t){return{...e,mcpReq:{...e.mcpReq,requestState:fa(t)}}}var fb;function Hm(e,t){fb(e,t)}var Zm=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{fb=(e,t)=>{e._negotiatedProtocolVersion=t}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??Dc,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)||Fl(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}=j0(e,"notification"),n=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)==="drop")return;if(t?.classification!==void 0){let i=k0(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($m(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}=j0(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=k0(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(X.UnsupportedProtocolVersion,`Unsupported protocol version: ${_}`,{supported:this._supportedProtocolVersions,requested:_});return}}if(bm(r.method)&&!o.hasRequestMethod(r.method)){i(X.MethodNotFound,"Method not found");return}let a=this._requestHandlers.get(r.method)??this.fallbackRequestHandler;if(a===void 0){i(X.MethodNotFound,"Method not found");return}let c=o.checkInboundEnvelope(n);if(c!==void 0){i(X.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:pN(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?dN:fa(n.requestState),signal:d.signal,send:(g,_,y)=>{let S=this._resolveOutboundCodec(g.method);if(this._assertOutboundRequestInEra(S,g.method),us(_))return l(g,_,y);let v=q0(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(X.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:X.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),us(t))return this._requestWithSchemaViaCodec(n,e,t,r);let o=q0(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=cN(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(bm(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(O){return p(O instanceof Error?O:Error(String(O)))}if(b.kind==="invalid")return p(b.error);if(b.kind==="input_required"){if(n?.allowInputRequired===!0)return d(fN(b));let O={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,O))}let E=b.result;yo(r,E).then((O)=>{if(O.success)d(O.data);else p(new Se(Te.InvalidResult,`Invalid result for ${t.method}: ${O.error}`))},p)}),u=()=>v(n?.signal?.reason),n?.signal?.addEventListener("abort",u,{once:!0});let w=n?.timeout??pb,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($m(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(!bm(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(X.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 yo(t.params,{...o.params});if(!i.success)throw new de(X.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(!$m(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(X.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 yo(t.params,{...n.params});if(!o.success)throw new de(X.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 Gm(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 M0(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function pN(e){let t={},r=[];if(!M0(e))return{accepted:t,droppedKeys:r};for(let[n,o]of Object.entries(e)){if(!M0(o)||"method"in o||"result"in o){r.push(n);continue}t[n]=o}return{accepted:t,droppedKeys:r}}function fN(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 qi(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),f=p.schema;if(f.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))c.allOf=c.allOf??[],c.allOf.push(f);else Object.assign(c,f);if(Object.assign(c,u),i._zod.parent===l)for(let y in c){if(y==="$ref"||y==="allOf")continue;if(!(y in u))delete c[y]}if(f.$ref&&p.def)for(let y in c){if(y==="$ref"||y==="allOf")continue;if(y in p.def&&JSON.stringify(c[y])===JSON.stringify(p.def[y]))delete c[y]}}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 f in c){if(f==="$ref"||f==="allOf")continue;if(f in p.def&&JSON.stringify(c[f])===JSON.stringify(p.def[f]))delete c[f]}}}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:Ai(t,"input",e.processors),output:Ai(t,"output",e.processors)}},enumerable:!1,writable:!1}),i}catch(i){throw Error("Error converting schema to JSON.")}}function jt(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 jt(n.element,r);if(n.type==="set")return jt(n.valueType,r);if(n.type==="lazy")return jt(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 jt(n.innerType,r);if(n.type==="intersection")return jt(n.left,r)||jt(n.right,r);if(n.type==="record"||n.type==="map")return jt(n.keyType,r)||jt(n.valueType,r);if(n.type==="pipe")return jt(n.in,r)||jt(n.out,r);if(n.type==="object"){for(let o in n.shape)if(jt(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(jt(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(jt(o,r))return!0;if(n.rest&&jt(n.rest,r))return!0;return!1}return!1}var AS=(e,t={})=>(r)=>{let n=Ni({...r,processors:t});return He(e,n),ji(n,e),qi(n,e)},Ai=(e,t,r={})=>(n)=>{let{libraryOptions:o,target:s}=n??{},i=Ni({...o??{},target:s,io:t,processors:r});return He(e,i),ji(i,e),qi(i,e)};var lO={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},bf=(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=lO[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}))]}},wf=(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},$f=(e,t,r,n)=>{r.type="boolean"},jS=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},qS=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema")},Rf=(e,t,r,n)=>{if(t.target==="openapi-3.0")r.type="string",r.nullable=!0,r.enum=[null];else r.type="null"},MS=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema")},LS=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema")},Ef=(e,t,r,n)=>{r.not={}},zf=(e,t,r,n)=>{},Pf=(e,t,r,n)=>{},DS=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema")},Tf=(e,t,r,n)=>{let o=e._zod.def,s=bc(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},kf=(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}},US=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema")},FS=(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},VS=(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)},HS=(e,t,r,n)=>{r.type="boolean"},If=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")},ZS=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Function types cannot be represented in JSON Schema")},xf=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")},GS=(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")},Cf=(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=He(s.element,t,{...n,path:[...n.path,"items"]})},Of=(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]=He(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=He(s.catchall,t,{...n,path:[...n.path,"additionalProperties"]})},Af=(e,t,r,n)=>{let o=e._zod.def,s=o.inclusive===!1,i=o.options.map((a,c)=>He(a,t,{...n,path:[...n.path,s?"oneOf":"anyOf",c]}));if(s)r.oneOf=i;else r.anyOf=i},Nf=(e,t,r,n)=>{let o=e._zod.def,s=He(o.left,t,{...n,path:[...n.path,"allOf",0]}),i=He(o.right,t,{...n,path:[...n.path,"allOf",1]}),a=(u)=>("allOf"in u)&&Object.keys(u).length===1,c=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];r.allOf=c},BS=(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,f)=>He(p,t,{...n,path:[...n.path,i,f]})),u=s.rest?He(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},jf=(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=He(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=He(s.keyType,t,{...n,path:[...n.path,"propertyNames"]});o.additionalProperties=He(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}},qf=(e,t,r,n)=>{let o=e._zod.def,s=He(o.innerType,t,n),i=t.seen.get(e);if(t.target==="openapi-3.0")i.ref=o.innerType,r.nullable=!0;else r.anyOf=[s,{type:"null"}]},Mf=(e,t,r,n)=>{let o=e._zod.def;He(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType},Lf=(e,t,r,n)=>{let o=e._zod.def;He(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},Df=(e,t,r,n)=>{let o=e._zod.def;He(o.innerType,t,n);let s=t.seen.get(e);if(s.ref=o.innerType,t.io==="input")r._prefault=JSON.parse(JSON.stringify(o.defaultValue))},Uf=(e,t,r,n)=>{let o=e._zod.def;He(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType;let i;try{i=o.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}r.default=i},Ff=(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;He(s,t,n);let i=t.seen.get(e);i.ref=s},Vf=(e,t,r,n)=>{let o=e._zod.def;He(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType,r.readOnly=!0},KS=(e,t,r,n)=>{let o=e._zod.def;He(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType},jc=(e,t,r,n)=>{let o=e._zod.def;He(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType},Hf=(e,t,r,n)=>{let o=e._zod.innerType;He(o,t,n);let s=t.seen.get(e);s.ref=o},NS={string:bf,number:wf,boolean:$f,bigint:jS,symbol:qS,null:Rf,undefined:MS,void:LS,never:Ef,any:zf,unknown:Pf,date:DS,enum:Tf,literal:kf,nan:US,template_literal:FS,file:VS,success:HS,custom:If,function:ZS,transform:xf,map:GS,set:JS,array:Cf,object:Of,union:Af,intersection:Nf,tuple:BS,record:jf,nullable:qf,nonoptional:Mf,default:Lf,prefault:Df,catch:Uf,pipe:Ff,readonly:Vf,promise:KS,optional:jc,lazy:Hf};function qc(e,t){if("_idmap"in e){let n=e,o=Ni({...t,processors:NS}),s={};for(let c of n._idmap.entries()){let[u,l]=c;He(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;ji(o,l),i[u]=qi(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=Ni({...t,processors:NS});return He(e,r),ji(r,e),qi(r,e)}var _O=U("ZodISODateTime",(e,t)=>{dv.init(e,t),We.init(e,t)});function Ko(e){return vS(_O,e)}var vO=U("ZodISODate",(e,t)=>{pv.init(e,t),We.init(e,t)});function Zf(e){return SS(vO,e)}var SO=U("ZodISOTime",(e,t)=>{fv.init(e,t),We.init(e,t)});function WS(e){return bS(SO,e)}var bO=U("ZodISODuration",(e,t)=>{mv.init(e,t),We.init(e,t)});function YS(e){return wS(bO,e)}var QS=(e,t)=>{Ec.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:(r)=>Bp(e,r)},flatten:{value:(r)=>Jp(e,r)},addIssue:{value:(r)=>{e.issues.push(r),e.message=JSON.stringify(e.issues,zi,2)}},addIssues:{value:(r)=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,zi,2)}},isEmpty:{get(){return e.issues.length===0}}})},jB=U("ZodError",QS),Xt=U("ZodError",QS,{Parent:Error});var eb=zc(Xt),tb=Pc(Xt),Lc=Ti(Xt),rb=ki(Xt),nb=Wy(Xt),ob=Yy(Xt),sb=Xy(Xt),ib=Qy(Xt),ab=e_(Xt),cb=t_(Xt),ub=r_(Xt),lb=n_(Xt);var Ge=U("ZodType",(e,t)=>(Ve.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Ai(e,"input"),output:Ai(e,"output")}}),e.toJSONSchema=AS(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(sn(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)=>eb(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>Lc(e,r,n),e.parseAsync=async(r,n)=>tb(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>rb(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>nb(e,r,n),e.decode=(r,n)=>ob(e,r,n),e.encodeAsync=async(r,n)=>sb(e,r,n),e.decodeAsync=async(r,n)=>ib(e,r,n),e.safeEncode=(r,n)=>ab(e,r,n),e.safeDecode=(r,n)=>cb(e,r,n),e.safeEncodeAsync=async(r,n)=>ub(e,r,n),e.safeDecodeAsync=async(r,n)=>lb(e,r,n),e.refine=(r,n)=>e.check(dA(r,n)),e.superRefine=(r)=>e.check(pA(r)),e.overwrite=(r)=>e.check(ln(r)),e.optional=()=>ae(e),e.exactOptional=()=>YO(e),e.nullable=()=>fb(e),e.nullish=()=>ae(fb(e)),e.nonoptional=(r)=>nA(e,r),e.array=()=>A(e),e.or=(r)=>te([e,r]),e.and=(r)=>Gr(e,r),e.transform=(r)=>Jf(e,$b(r)),e.default=(r)=>eA(e,r),e.prefault=(r)=>rA(e,r),e.catch=(r)=>sA(e,r),e.pipe=(r)=>Jf(e,r),e.readonly=()=>cA(e),e.describe=(r)=>{let n=e.clone();return un.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return un.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return un.get(e);let n=e.clone();return un.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=(r)=>r(e),e)),mb=U("_ZodString",(e,t)=>{Ic.init(e,t),Ge.init(e,t),e._zod.processJSONSchema=(n,o,s)=>bf(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(lf(...n)),e.includes=(...n)=>e.check(ff(...n)),e.startsWith=(...n)=>e.check(mf(...n)),e.endsWith=(...n)=>e.check(hf(...n)),e.min=(...n)=>e.check(Jo(...n)),e.max=(...n)=>e.check(Ac(...n)),e.length=(...n)=>e.check(Nc(...n)),e.nonempty=(...n)=>e.check(Jo(1,...n)),e.lowercase=(n)=>e.check(df(n)),e.uppercase=(n)=>e.check(pf(n)),e.trim=()=>e.check(yf()),e.normalize=(...n)=>e.check(gf(...n)),e.toLowerCase=()=>e.check(_f()),e.toUpperCase=()=>e.check(vf()),e.slugify=()=>e.check(Sf())}),hb=U("ZodString",(e,t)=>{Ic.init(e,t),mb.init(e,t),e.email=(r)=>e.check(af(gb,r)),e.url=(r)=>e.check(uf(_b,r)),e.jwt=(r)=>e.check(_S(qO,r)),e.emoji=(r)=>e.check(oS($O,r)),e.guid=(r)=>e.check(cf(db,r)),e.uuid=(r)=>e.check(eS(Dc,r)),e.uuidv4=(r)=>e.check(tS(Dc,r)),e.uuidv6=(r)=>e.check(rS(Dc,r)),e.uuidv7=(r)=>e.check(nS(Dc,r)),e.nanoid=(r)=>e.check(sS(RO,r)),e.guid=(r)=>e.check(cf(db,r)),e.cuid=(r)=>e.check(iS(EO,r)),e.cuid2=(r)=>e.check(aS(zO,r)),e.ulid=(r)=>e.check(cS(PO,r)),e.base64=(r)=>e.check(hS(AO,r)),e.base64url=(r)=>e.check(gS(NO,r)),e.xid=(r)=>e.check(uS(TO,r)),e.ksuid=(r)=>e.check(lS(kO,r)),e.ipv4=(r)=>e.check(dS(IO,r)),e.ipv6=(r)=>e.check(pS(xO,r)),e.cidrv4=(r)=>e.check(fS(CO,r)),e.cidrv6=(r)=>e.check(mS(OO,r)),e.e164=(r)=>e.check(yS(jO,r)),e.datetime=(r)=>e.check(Ko(r)),e.date=(r)=>e.check(Zf(r)),e.time=(r)=>e.check(WS(r)),e.duration=(r)=>e.check(YS(r))});function m(e){return Qv(hb,e)}var We=U("ZodStringFormat",(e,t)=>{Be.init(e,t),mb.init(e,t)}),gb=U("ZodEmail",(e,t)=>{rv.init(e,t),We.init(e,t)});function yb(e){return af(gb,e)}var db=U("ZodGUID",(e,t)=>{ev.init(e,t),We.init(e,t)});var Dc=U("ZodUUID",(e,t)=>{tv.init(e,t),We.init(e,t)});var _b=U("ZodURL",(e,t)=>{nv.init(e,t),We.init(e,t)});function Uc(e){return uf(_b,e)}var $O=U("ZodEmoji",(e,t)=>{ov.init(e,t),We.init(e,t)});var RO=U("ZodNanoID",(e,t)=>{sv.init(e,t),We.init(e,t)});var EO=U("ZodCUID",(e,t)=>{iv.init(e,t),We.init(e,t)});var zO=U("ZodCUID2",(e,t)=>{av.init(e,t),We.init(e,t)});var PO=U("ZodULID",(e,t)=>{cv.init(e,t),We.init(e,t)});var TO=U("ZodXID",(e,t)=>{uv.init(e,t),We.init(e,t)});var kO=U("ZodKSUID",(e,t)=>{lv.init(e,t),We.init(e,t)});var IO=U("ZodIPv4",(e,t)=>{hv.init(e,t),We.init(e,t)});var xO=U("ZodIPv6",(e,t)=>{gv.init(e,t),We.init(e,t)});var CO=U("ZodCIDRv4",(e,t)=>{yv.init(e,t),We.init(e,t)});var OO=U("ZodCIDRv6",(e,t)=>{_v.init(e,t),We.init(e,t)});var AO=U("ZodBase64",(e,t)=>{Sv.init(e,t),We.init(e,t)});var NO=U("ZodBase64URL",(e,t)=>{bv.init(e,t),We.init(e,t)});var jO=U("ZodE164",(e,t)=>{wv.init(e,t),We.init(e,t)});var qO=U("ZodJWT",(e,t)=>{$v.init(e,t),We.init(e,t)});var Fc=U("ZodNumber",(e,t)=>{rf.init(e,t),Ge.init(e,t),e._zod.processJSONSchema=(n,o,s)=>wf(e,n,o,s),e.gt=(n,o)=>e.check(Cc(n,o)),e.gte=(n,o)=>e.check(Oi(n,o)),e.min=(n,o)=>e.check(Oi(n,o)),e.lt=(n,o)=>e.check(xc(n,o)),e.lte=(n,o)=>e.check(Ci(n,o)),e.max=(n,o)=>e.check(Ci(n,o)),e.int=(n)=>e.check(pb(n)),e.safe=(n)=>e.check(pb(n)),e.positive=(n)=>e.check(Cc(0,n)),e.nonnegative=(n)=>e.check(Oi(0,n)),e.negative=(n)=>e.check(xc(0,n)),e.nonpositive=(n)=>e.check(Ci(0,n)),e.multipleOf=(n,o)=>e.check(Oc(n,o)),e.step=(n,o)=>e.check(Oc(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 Z(e){return $S(Fc,e)}var MO=U("ZodNumberFormat",(e,t)=>{Rv.init(e,t),Fc.init(e,t)});function pb(e){return ES(MO,e)}var vb=U("ZodBoolean",(e,t)=>{Ev.init(e,t),Ge.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$f(e,r,n,o)});function Y(e){return zS(vb,e)}var LO=U("ZodNull",(e,t)=>{zv.init(e,t),Ge.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Rf(e,r,n,o)});function po(e){return PS(LO,e)}var DO=U("ZodAny",(e,t)=>{Pv.init(e,t),Ge.init(e,t),e._zod.processJSONSchema=(r,n,o)=>zf(e,r,n,o)});function Sb(){return TS(DO)}var UO=U("ZodUnknown",(e,t)=>{Tv.init(e,t),Ge.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Pf(e,r,n,o)});function ce(){return kS(UO)}var FO=U("ZodNever",(e,t)=>{kv.init(e,t),Ge.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ef(e,r,n,o)});function VO(e){return IS(FO,e)}var HO=U("ZodArray",(e,t)=>{Iv.init(e,t),Ge.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Cf(e,r,n,o),e.element=t.element,e.min=(r,n)=>e.check(Jo(r,n)),e.nonempty=(r)=>e.check(Jo(1,r)),e.max=(r,n)=>e.check(Ac(r,n)),e.length=(r,n)=>e.check(Nc(r,n)),e.unwrap=()=>e.element});function A(e,t){return xS(HO,e,t)}var bb=U("ZodObject",(e,t)=>{Ov.init(e,t),Ge.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Of(e,r,n,o),Ce(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:VO()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=(r)=>WC(e,r),e.safeExtend=(r)=>YC(e,r),e.merge=(r)=>XC(e,r),e.pick=(r)=>BC(e,r),e.omit=(r)=>KC(e,r),e.partial=(...r)=>QC(Rb,e,r[0]),e.required=(...r)=>eO(Eb,e,r[0])});function T(e,t){let r={type:"object",shape:e??{},...ie(t)};return new bb(r)}function pe(e,t){return new bb({type:"object",shape:e,catchall:ce(),...ie(t)})}var wb=U("ZodUnion",(e,t)=>{nf.init(e,t),Ge.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Af(e,r,n,o),e.options=t.options});function te(e,t){return new wb({type:"union",options:e,...ie(t)})}var ZO=U("ZodDiscriminatedUnion",(e,t)=>{wb.init(e,t),Av.init(e,t)});function Wo(e,t,r){return new ZO({type:"union",options:t,discriminator:e,...ie(r)})}var GO=U("ZodIntersection",(e,t)=>{Nv.init(e,t),Ge.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Nf(e,r,n,o)});function Gr(e,t){return new GO({type:"intersection",left:e,right:t})}var JO=U("ZodRecord",(e,t)=>{jv.init(e,t),Ge.init(e,t),e._zod.processJSONSchema=(r,n,o)=>jf(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function ee(e,t,r){return new JO({type:"record",keyType:e,valueType:t,...ie(r)})}var Gf=U("ZodEnum",(e,t)=>{qv.init(e,t),Ge.init(e,t),e._zod.processJSONSchema=(n,o,s)=>Tf(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 Gf({...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 Gf({...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 Gf({type:"enum",entries:r,...ie(t)})}var BO=U("ZodLiteral",(e,t)=>{Mv.init(e,t),Ge.init(e,t),e._zod.processJSONSchema=(r,n,o)=>kf(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 BO({type:"literal",values:Array.isArray(e)?e:[e],...ie(t)})}var KO=U("ZodTransform",(e,t)=>{Lv.init(e,t),Ge.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xf(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Ei(e.constructor.name);r.addIssue=(s)=>{if(typeof s==="string")r.issues.push(lo(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(lo(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 $b(e){return new KO({type:"transform",transform:e})}var Rb=U("ZodOptional",(e,t)=>{of.init(e,t),Ge.init(e,t),e._zod.processJSONSchema=(r,n,o)=>jc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ae(e){return new Rb({type:"optional",innerType:e})}var WO=U("ZodExactOptional",(e,t)=>{Dv.init(e,t),Ge.init(e,t),e._zod.processJSONSchema=(r,n,o)=>jc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function YO(e){return new WO({type:"optional",innerType:e})}var XO=U("ZodNullable",(e,t)=>{Uv.init(e,t),Ge.init(e,t),e._zod.processJSONSchema=(r,n,o)=>qf(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function fb(e){return new XO({type:"nullable",innerType:e})}var QO=U("ZodDefault",(e,t)=>{Fv.init(e,t),Ge.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Lf(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function eA(e,t){return new QO({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():Hp(t)}})}var tA=U("ZodPrefault",(e,t)=>{Vv.init(e,t),Ge.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Df(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function rA(e,t){return new tA({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():Hp(t)}})}var Eb=U("ZodNonOptional",(e,t)=>{Hv.init(e,t),Ge.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Mf(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function nA(e,t){return new Eb({type:"nonoptional",innerType:e,...ie(t)})}var oA=U("ZodCatch",(e,t)=>{Zv.init(e,t),Ge.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Uf(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function sA(e,t){return new oA({type:"catch",innerType:e,catchValue:typeof t==="function"?t:()=>t})}var iA=U("ZodPipe",(e,t)=>{Gv.init(e,t),Ge.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ff(e,r,n,o),e.in=t.in,e.out=t.out});function Jf(e,t){return new iA({type:"pipe",in:e,out:t})}var aA=U("ZodReadonly",(e,t)=>{Jv.init(e,t),Ge.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Vf(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function cA(e){return new aA({type:"readonly",innerType:e})}var uA=U("ZodLazy",(e,t)=>{Bv.init(e,t),Ge.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hf(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});function Mi(e){return new uA({type:"lazy",getter:e})}var lA=U("ZodCustom",(e,t)=>{Kv.init(e,t),Ge.init(e,t),e._zod.processJSONSchema=(r,n,o)=>If(e,r,n,o)});function dA(e,t={}){return CS(lA,e,t)}function pA(e){return OS(e)}function fo(e,t){return Jf($b(e),t)}var Pb={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 zb;(function(e){})(zb||(zb={}));function fA(e){return RS(Fc,e)}Yt(sf());var ho="2025-11-25";var Vc=[ho,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Hc="io.modelcontextprotocol/related-task",Br="io.modelcontextprotocol/protocolVersion",Yo="io.modelcontextprotocol/clientInfo",zr="io.modelcontextprotocol/serverInfo",Kr="io.modelcontextprotocol/clientCapabilities",go="io.modelcontextprotocol/subscriptionId",pn="io.modelcontextprotocol/logLevel";var yo="2.0";var dn=Mi(()=>te([m(),Z(),Y(),po(),ee(m(),dn),A(dn)])),tt=ee(m(),dn),Kf=A(dn),Li=te([m(),Z().int()]),Di=m(),Zc=T({ttl:Z().optional()}),Gc=T({taskId:m()}),Ui=pe({progressToken:Li.optional(),[Hc]:Gc.optional()}),vt=T({_meta:Ui.optional()}),_o=vt.extend({task:Zc.optional()}),rt=T({method:m(),params:vt.loose().optional()}),kt=T({_meta:Ui.optional()}),It=T({method:m(),params:kt.loose().optional()}),Fi=pe({get[zr](){return es.optional().catch(void 0)}}),nt=pe({_meta:Fi.optional()}),fn=te([m(),Z().int()]),Vi=T({jsonrpc:N(yo),id:fn,...rt.shape}).strict(),Hi=T({jsonrpc:N(yo),...It.shape}).strict(),Xo=T({jsonrpc:N(yo),id:fn,result:nt}).strict(),Qo=T({jsonrpc:N(yo),id:fn.optional(),error:T({code:Z().int(),message:m(),data:ce().optional()})}).strict(),Zi=te([Vi,Hi,Xo,Qo]),Wf=te([Xo,Qo]),Gi=nt.strict(),Jc=kt.extend({requestId:fn.optional(),reason:m().optional()}),Ji=It.extend({method:N("notifications/cancelled"),params:Jc}),Bc=T({src:m(),mimeType:m().optional(),sizes:A(m()).optional(),theme:le(["light","dark"]).optional()}),mn=T({icons:A(Bc).optional()}),Jr=T({name:m(),title:m().optional()}),es=Jr.extend({...Jr.shape,...mn.shape,version:m(),websiteUrl:m().optional(),description:m().optional()}),hA=Gr(T({applyDefaults:Y().optional()}),tt),gA=fo((e)=>{if(e&&typeof e==="object"&&!Array.isArray(e)&&Object.keys(e).length===0)return{form:{}};return e},Gr(T({form:hA.optional(),url:tt.optional()}),tt.optional())),Kc=pe({list:tt.optional(),cancel:tt.optional(),requests:pe({sampling:pe({createMessage:tt.optional()}).optional(),elicitation:pe({create:tt.optional()}).optional()}).optional()}),Wc=pe({list:tt.optional(),cancel:tt.optional(),requests:pe({tools:pe({call:tt.optional()}).optional()}).optional()}),Yc=T({experimental:ee(m(),tt).optional(),sampling:T({context:tt.optional(),tools:tt.optional()}).optional(),elicitation:gA.optional(),roots:T({listChanged:Y().optional()}).optional(),tasks:Kc.optional(),extensions:ee(m(),tt).optional()}),Xc=vt.extend({protocolVersion:m(),capabilities:Yc,clientInfo:es}),Qc=rt.extend({method:N("initialize"),params:Xc}),Bi=T({experimental:ee(m(),tt).optional(),logging:tt.optional(),completions:tt.optional(),prompts:T({listChanged:Y().optional()}).optional(),resources:T({subscribe:Y().optional(),listChanged:Y().optional()}).optional(),tools:T({listChanged:Y().optional()}).optional(),tasks:Wc.optional(),extensions:ee(m(),tt).optional()}),eu=nt.extend({protocolVersion:m(),capabilities:Bi,serverInfo:es,instructions:m().optional()}),tu=It.extend({method:N("notifications/initialized"),params:kt.optional()}),ru=rt.extend({method:N("server/discover"),params:vt.optional()}),nu=nt.extend({supportedVersions:A(m()),capabilities:Bi,instructions:m().optional()}),Ki=rt.extend({method:N("ping"),params:vt.optional()}),ou=T({progress:Z(),total:ae(Z()),message:ae(m())}),su=T({...kt.shape,...ou.shape,progressToken:Li}),Wi=It.extend({method:N("notifications/progress"),params:su}),iu=vt.extend({cursor:Di.optional()}),hn=rt.extend({params:iu.optional()}),gn=nt.extend({nextCursor:Di.optional()}),Yi=T({uri:m(),mimeType:ae(m()),_meta:ee(m(),ce()).optional()}),Xi=Yi.extend({text:m()}),Yf=m().refine((e)=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Qi=Yi.extend({blob:Yf}),yn=le(["user","assistant"]),Wr=T({audience:A(yn).optional(),priority:Z().min(0).max(1).optional(),lastModified:Ko({offset:!0}).optional()}),ea=T({...Jr.shape,...mn.shape,uri:m(),description:ae(m()),mimeType:ae(m()),size:ae(Z()),annotations:Wr.optional(),_meta:ae(pe({}))}),au=T({...Jr.shape,...mn.shape,uriTemplate:m(),description:ae(m()),mimeType:ae(m()),annotations:Wr.optional(),_meta:ae(pe({}))}),cu=hn.extend({method:N("resources/list")}),uu=gn.extend({resources:A(ea)}),lu=hn.extend({method:N("resources/templates/list")}),du=gn.extend({resourceTemplates:A(au)}),ts=vt.extend({uri:m()}),pu=ts,fu=rt.extend({method:N("resources/read"),params:pu}),mu=nt.extend({contents:A(te([Xi,Qi]))}),hu=It.extend({method:N("notifications/resources/list_changed"),params:kt.optional()}),gu=ts,yu=rt.extend({method:N("resources/subscribe"),params:gu}),_u=ts,vu=rt.extend({method:N("resources/unsubscribe"),params:_u}),ta=T({toolsListChanged:Y().optional(),promptsListChanged:Y().optional(),resourcesListChanged:Y().optional(),resourceSubscriptions:A(m()).optional()}),Su=vt.extend({notifications:ta}),bu=rt.extend({method:N("subscriptions/listen"),params:Su}),wu=kt.extend({notifications:ta}),$u=It.extend({method:N("notifications/subscriptions/acknowledged"),params:wu}),Ru=Fi.extend({[go]:fn}),Eu=nt.extend({_meta:Ru}),zu=kt.extend({uri:m()}),Pu=It.extend({method:N("notifications/resources/updated"),params:zu}),Tu=T({name:m(),description:ae(m()),required:ae(Y())}),ku=T({...Jr.shape,...mn.shape,description:ae(m()),arguments:ae(A(Tu)),_meta:ae(pe({}))}),Iu=hn.extend({method:N("prompts/list")}),xu=gn.extend({prompts:A(ku)}),Cu=vt.extend({name:m(),arguments:ee(m(),m()).optional()}),Ou=rt.extend({method:N("prompts/get"),params:Cu}),rs=T({type:N("text"),text:m(),annotations:Wr.optional(),_meta:ee(m(),ce()).optional()}),ns=T({type:N("image"),data:Yf,mimeType:m(),annotations:Wr.optional(),_meta:ee(m(),ce()).optional()}),os=T({type:N("audio"),data:Yf,mimeType:m(),annotations:Wr.optional(),_meta:ee(m(),ce()).optional()}),Au=T({type:N("tool_use"),name:m(),id:m(),input:ee(m(),ce()),_meta:ee(m(),ce()).optional()}),Nu=T({type:N("resource"),resource:te([Xi,Qi]),annotations:Wr.optional(),_meta:ee(m(),ce()).optional()}),ju=ea.extend({type:N("resource_link")}),ss=te([rs,ns,os,ju,Nu]),qu=T({role:yn,content:ss}),Mu=nt.extend({description:m().optional(),messages:A(qu)}),Lu=It.extend({method:N("notifications/prompts/list_changed"),params:kt.optional()}),Du=T({title:m().optional(),readOnlyHint:Y().optional(),destructiveHint:Y().optional(),idempotentHint:Y().optional(),openWorldHint:Y().optional()}),Uu=T({taskSupport:le(["required","optional","forbidden"]).optional()}),ra=T({...Jr.shape,...mn.shape,description:m().optional(),inputSchema:T({type:N("object"),properties:ee(m(),dn).optional(),required:A(m()).optional()}).catchall(ce()),outputSchema:pe({$schema:m().optional()}).optional(),annotations:Du.optional(),execution:Uu.optional(),_meta:ee(m(),ce()).optional()}),Fu=hn.extend({method:N("tools/list")}),Vu=gn.extend({tools:A(ra)}),na=nt.extend({content:A(ss).default([]),structuredContent:ce().optional(),isError:Y().optional()}),Xf=na.or(nt.extend({toolResult:ce()})),Hu=_o.extend({name:m(),arguments:ee(m(),ce()).optional()}),Zu=rt.extend({method:N("tools/call"),params:Hu}),Gu=It.extend({method:N("notifications/tools/list_changed"),params:kt.optional()}),Qf=T({autoRefresh:Y().default(!0),debounceMs:Z().int().nonnegative().default(300)}),_n=le(["debug","info","notice","warning","error","critical","alert","emergency"]),Ju=vt.extend({level:_n}),Bu=rt.extend({method:N("logging/setLevel"),params:Ju}),Ku=kt.extend({level:_n,logger:m().optional(),data:ce()}),Wu=It.extend({method:N("notifications/message"),params:Ku}),Yu=T({name:m().optional()}),Xu=T({hints:A(Yu).optional(),costPriority:Z().min(0).max(1).optional(),speedPriority:Z().min(0).max(1).optional(),intelligencePriority:Z().min(0).max(1).optional()}),Qu=T({mode:le(["auto","required","none"]).optional()}),el=T({type:N("tool_result"),toolUseId:m().describe("The unique identifier for the corresponding tool call."),content:A(ss),structuredContent:ce().optional(),isError:Y().optional(),_meta:ee(m(),ce()).optional()}),tl=Wo("type",[rs,ns,os]),mo=Wo("type",[rs,ns,os,Au,el]),rl=T({role:yn,content:te([mo,A(mo)]),_meta:ee(m(),ce()).optional()}),nl=_o.extend({messages:A(rl),modelPreferences:Xu.optional(),systemPrompt:m().optional(),includeContext:le(["none","thisServer","allServers"]).optional(),temperature:Z().optional(),maxTokens:Z().int(),stopSequences:A(m()).optional(),metadata:tt.optional(),tools:A(ra).optional(),toolChoice:Qu.optional()}),ol=rt.extend({method:N("sampling/createMessage"),params:nl}),sl=nt.extend({model:m(),stopReason:ae(le(["endTurn","stopSequence","maxTokens"]).or(m())),role:yn,content:tl}),il=nt.extend({model:m(),stopReason:ae(le(["endTurn","stopSequence","maxTokens","toolUse"]).or(m())),role:yn,content:te([mo,A(mo)])}),oa=T({type:N("boolean"),title:m().optional(),description:m().optional(),default:Y().optional()}),is=T({type:N("string"),title:m().optional(),description:m().optional(),minLength:Z().optional(),maxLength:Z().optional(),format:le(["email","uri","date","date-time"]).optional(),default:m().optional()}),as=T({type:le(["number","integer"]),title:m().optional(),description:m().optional(),minimum:Z().optional(),maximum:Z().optional(),default:Z().optional()}),sa=T({type:N("string"),title:m().optional(),description:m().optional(),enum:A(m()),default:m().optional()}),ia=T({type:N("string"),title:m().optional(),description:m().optional(),oneOf:A(T({const:m(),title:m()})),default:m().optional()}),aa=T({type:N("string"),title:m().optional(),description:m().optional(),enum:A(m()),enumNames:A(m()).optional(),default:m().optional()}),al=te([sa,ia]),ca=T({type:N("array"),title:m().optional(),description:m().optional(),minItems:Z().optional(),maxItems:Z().optional(),items:T({type:N("string"),enum:A(m())}),default:A(m()).optional()}),ua=T({type:N("array"),title:m().optional(),description:m().optional(),minItems:Z().optional(),maxItems:Z().optional(),items:T({anyOf:A(T({const:m(),title:m()}))}),default:A(m()).optional()}),cl=te([ca,ua]),ul=te([aa,al,cl]),la=te([ul,oa,is,as]),cs=_o.extend({mode:N("form").optional(),message:m(),requestedSchema:T({type:N("object"),properties:ee(m(),la),required:A(m()).optional()}).catchall(ce())}),ll=_o.extend({mode:N("url"),message:m(),elicitationId:m(),url:m().url()}),dl=te([cs,ll]),pl=rt.extend({method:N("elicitation/create"),params:dl}),fl=kt.extend({elicitationId:m()}),ml=It.extend({method:N("notifications/elicitation/complete"),params:fl}),hl=nt.extend({action:le(["accept","decline","cancel"]),content:fo((e)=>e===null?void 0:e,ee(m(),te([m(),Z(),Y(),A(m())])).optional())}),gl=T({type:N("ref/resource"),uri:m()}),yl=T({type:N("ref/prompt"),name:m()}),_l=vt.extend({ref:te([yl,gl]),argument:T({name:m(),value:m()}),context:T({arguments:ee(m(),m()).optional()}).optional()}),vl=rt.extend({method:N("completion/complete"),params:_l}),Sl=nt.extend({completion:pe({values:A(m()).max(100),total:ae(Z().int()),hasMore:ae(Y())})}),bl=T({uri:m().startsWith("file://"),name:m().optional(),_meta:ee(m(),ce()).optional()}),wl=rt.extend({method:N("roots/list"),params:vt.optional()}),$l=nt.extend({roots:A(bl)}),Rl=It.extend({method:N("notifications/roots/list_changed"),params:kt.optional()}),em=pe({ttl:Z().optional(),pollInterval:Z().optional()}),El=le(["working","input_required","completed","failed","cancelled"]),vn=T({taskId:m(),status:El,ttl:te([Z(),po()]),createdAt:m(),lastUpdatedAt:m(),pollInterval:ae(Z()),statusMessage:ae(m())}),tm=nt.extend({task:vn}),zl=kt.merge(vn),rm=It.extend({method:N("notifications/tasks/status"),params:zl}),nm=rt.extend({method:N("tasks/get"),params:vt.extend({taskId:m()})}),om=nt.merge(vn),sm=rt.extend({method:N("tasks/result"),params:vt.extend({taskId:m()})}),im=nt.loose(),am=hn.extend({method:N("tasks/list")}),cm=gn.extend({tasks:A(vn)}),um=rt.extend({method:N("tasks/cancel"),params:vt.extend({taskId:m()})}),lm=nt.merge(vn),dm=te([Ki,Qc,ru,vl,Bu,Ou,Iu,cu,lu,fu,yu,vu,bu,Zu,Fu]),pm=te([Ji,Wi,tu,Rl]),fm=te([Gi,sl,il,hl,$l]),mm=te([Ki,ol,pl,wl]),hm=te([Ji,Wi,Wu,Pu,hu,Gu,Lu,$u,ml]),gm=te([Gi,eu,nu,Sl,Mu,xu,uu,du,mu,na,Vu,Eu]),_t=Uc().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:Pb.custom,message:"URL must be parseable",fatal:!0}),Lp}).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"}),ym=pe({resource:m().url(),authorization_servers:A(_t).optional(),jwks_uri:m().url().optional(),scopes_supported:A(m()).optional(),bearer_methods_supported:A(m()).optional(),resource_signing_alg_values_supported:A(m()).optional(),resource_name:m().optional(),resource_documentation:m().optional(),resource_policy_uri:m().url().optional(),resource_tos_uri:m().url().optional(),tls_client_certificate_bound_access_tokens:Y().optional(),authorization_details_types_supported:A(m()).optional(),dpop_signing_alg_values_supported:A(m()).optional(),dpop_bound_access_tokens_required:Y().optional()}),Pl=pe({issuer:m(),authorization_endpoint:_t,token_endpoint:_t,registration_endpoint:_t.optional(),scopes_supported:A(m()).optional(),response_types_supported:A(m()),response_modes_supported:A(m()).optional(),grant_types_supported:A(m()).optional(),token_endpoint_auth_methods_supported:A(m()).optional(),token_endpoint_auth_signing_alg_values_supported:A(m()).optional(),service_documentation:_t.optional(),revocation_endpoint:_t.optional(),revocation_endpoint_auth_methods_supported:A(m()).optional(),revocation_endpoint_auth_signing_alg_values_supported:A(m()).optional(),introspection_endpoint:m().optional(),introspection_endpoint_auth_methods_supported:A(m()).optional(),introspection_endpoint_auth_signing_alg_values_supported:A(m()).optional(),code_challenge_methods_supported:A(m()).optional(),client_id_metadata_document_supported:Y().optional(),authorization_response_iss_parameter_supported:Y().optional().catch(void 0)}),Tl=pe({issuer:m(),authorization_endpoint:_t,token_endpoint:_t,userinfo_endpoint:_t.optional(),jwks_uri:_t,registration_endpoint:_t.optional(),scopes_supported:A(m()).optional(),response_types_supported:A(m()),response_modes_supported:A(m()).optional(),grant_types_supported:A(m()).optional(),acr_values_supported:A(m()).optional(),subject_types_supported:A(m()),id_token_signing_alg_values_supported:A(m()),id_token_encryption_alg_values_supported:A(m()).optional(),id_token_encryption_enc_values_supported:A(m()).optional(),userinfo_signing_alg_values_supported:A(m()).optional(),userinfo_encryption_alg_values_supported:A(m()).optional(),userinfo_encryption_enc_values_supported:A(m()).optional(),request_object_signing_alg_values_supported:A(m()).optional(),request_object_encryption_alg_values_supported:A(m()).optional(),request_object_encryption_enc_values_supported:A(m()).optional(),token_endpoint_auth_methods_supported:A(m()).optional(),token_endpoint_auth_signing_alg_values_supported:A(m()).optional(),display_values_supported:A(m()).optional(),claim_types_supported:A(m()).optional(),claims_supported:A(m()).optional(),service_documentation:m().optional(),claims_locales_supported:A(m()).optional(),ui_locales_supported:A(m()).optional(),claims_parameter_supported:Y().optional(),request_parameter_supported:Y().optional(),request_uri_parameter_supported:Y().optional(),require_request_uri_registration:Y().optional(),op_policy_uri:_t.optional(),op_tos_uri:_t.optional(),client_id_metadata_document_supported:Y().optional(),authorization_response_iss_parameter_supported:Y().optional().catch(void 0)}),_m=T({...Tl.shape,...Pl.pick({code_challenge_methods_supported:!0}).shape}),vm=T({access_token:m(),id_token:m().optional(),token_type:m(),expires_in:fA().optional(),scope:m().optional(),refresh_token:m().optional()}).strip(),Sm=T({issued_token_type:N("urn:ietf:params:oauth:token-type:id-jag"),access_token:m(),token_type:m().optional(),expires_in:Z().optional(),scope:m().optional()}).strip(),bm=T({error:m(),error_description:m().optional(),error_uri:m().optional()}),Bf=_t.optional().or(N("").transform(()=>{return})),kl=T({redirect_uris:A(_t),token_endpoint_auth_method:m().optional(),grant_types:A(m()).optional(),response_types:A(m()).optional(),application_type:m().optional(),client_name:m().optional(),client_uri:_t.optional(),logo_uri:Bf,scope:m().optional(),contacts:A(m()).optional(),tos_uri:Bf,policy_uri:m().optional(),jwks_uri:_t.optional(),jwks:Sb().optional(),software_id:m().optional(),software_version:m().optional(),software_statement:m().optional()}).strip(),Il=T({client_id:m(),client_secret:m().optional(),client_id_issued_at:Z().optional(),client_secret_expires_at:Z().optional()}).strip(),wm=kl.merge(Il),$m=T({error:m(),error_description:m().optional()}).strip(),Rm=T({token:m(),token_type_hint:m().optional()}).strip();var Tm=Symbol.for("mcp.sdk.errorBrands");function Cm(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,Tm,{value:r,enumerable:!1,configurable:!0})}function ls(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 yA=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](t){return ls(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 ls(this,t)}constructor(t,r,n){super(r);this.code=t,this.errorUri=n,this.name="OAuthError",Cm(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 ls(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 ls(this,e)}constructor(e,t,r){super(t);this.code=e,this.data=r,this.name="SdkError",Cm(this,new.target)}},_A=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 Mb(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function vA(e,t,r){return e==="elicitation"&&t==="form"&&r.form===void 0&&r.url===void 0}function Yb(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 Ml(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(Mb(o)&&Mb(s)){let i={};for(let[a,c]of Object.entries(o))if(c!==void 0&&s[a]===void 0&&!vA(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 Xb="2026-07-28",bn=[Xb];function ps(e){return e>=Xb}function Qb(e){return e.filter((t)=>!ps(t))}function Om(e){return e.filter((t)=>ps(t))}function e0(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 t0=["task","inputRequests","requestState"];function Am(e){if(e===null||typeof e!=="object"||Array.isArray(e)||e.content!==void 0||t0.some((t)=>(t in e)))return e;return{...e,content:[]}}function SA(){let e=Mi(()=>te([m(),Z(),Y(),po(),ee(m(),e),A(e)])),t=ee(m(),e),r=te([m(),Z().int()]),n=m(),o=T({ttl:Z().optional()}),s=T({taskId:m()}),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:m(),params:a.loose().optional()}),l=T({_meta:i.optional()}),d=T({method:m(),params:l.loose().optional()}),p=pe({_meta:i.optional()}),f=te([m(),Z().int()]),h=p.strict(),y=l.extend({requestId:f.optional(),reason:m().optional()}),_=d.extend({method:N("notifications/cancelled"),params:y}),g=T({src:m(),mimeType:m().optional(),sizes:A(m()).optional(),theme:le(["light","dark"]).optional()}),S=T({icons:A(g).optional()}),v=T({name:m(),title:m().optional()}),w=v.extend({...v.shape,...S.shape,version:m(),websiteUrl:m().optional(),description:m().optional()}),z=Gr(T({applyDefaults:Y().optional()}),t),R=fo((Tt)=>{if(Tt&&typeof Tt==="object"&&!Array.isArray(Tt)&&Object.keys(Tt).length===0)return{form:{}};return Tt},Gr(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()}),C=T({experimental:ee(m(),t).optional(),sampling:T({context:t.optional(),tools:t.optional()}).optional(),elicitation:R.optional(),roots:T({listChanged:Y().optional()}).optional(),tasks:b.optional(),extensions:ee(m(),t).optional()}),q=a.extend({protocolVersion:m(),capabilities:C,clientInfo:w}),O=u.extend({method:N("initialize"),params:q}),F=T({experimental:ee(m(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:T({listChanged:Y().optional()}).optional(),resources:T({subscribe:Y().optional(),listChanged:Y().optional()}).optional(),tools:T({listChanged:Y().optional()}).optional(),tasks:E.optional(),extensions:ee(m(),t).optional()}),K=p.extend({protocolVersion:m(),capabilities:F,serverInfo:w,instructions:m().optional()}),G=d.extend({method:N("notifications/initialized"),params:l.optional()}),ge=u.extend({method:N("ping"),params:a.optional()}),ke=T({progress:Z(),total:ae(Z()),message:ae(m())}),Ne=T({...l.shape,...ke.shape,progressToken:r}),Fe=d.extend({method:N("notifications/progress"),params:Ne}),Pe=a.extend({cursor:n.optional()}),x=u.extend({params:Pe.optional()}),M=p.extend({nextCursor:n.optional()}),B=T({uri:m(),mimeType:ae(m()),_meta:ee(m(),ce()).optional()}),P=B.extend({text:m()}),I=m().refine((Tt)=>{try{return atob(Tt),!0}catch{return!1}},{message:"Invalid Base64 string"}),j=B.extend({blob:I}),W=le(["user","assistant"]),ue=T({audience:A(W).optional(),priority:Z().min(0).max(1).optional(),lastModified:Ko({offset:!0}).optional()}),Ee=T({...v.shape,...S.shape,uri:m(),description:ae(m()),mimeType:ae(m()),size:ae(Z()),annotations:ue.optional(),_meta:ae(pe({}))}),ye=T({...v.shape,...S.shape,uriTemplate:m(),description:ae(m()),mimeType:ae(m()),annotations:ue.optional(),_meta:ae(pe({}))}),Ze=x.extend({method:N("resources/list")}),Nt=M.extend({resources:A(Ee)}),k=x.extend({method:N("resources/templates/list")}),L=M.extend({resourceTemplates:A(ye)}),H=a.extend({uri:m()}),fe=H,me=u.extend({method:N("resources/read"),params:fe}),$e=p.extend({contents:A(te([P,j]))}),ut=d.extend({method:N("notifications/resources/list_changed"),params:l.optional()}),mt=H,zt=u.extend({method:N("resources/subscribe"),params:mt}),dt=H,Xe=u.extend({method:N("resources/unsubscribe"),params:dt}),er=l.extend({uri:m()}),yt=d.extend({method:N("notifications/resources/updated"),params:er}),Vr=T({name:m(),description:ae(m()),required:ae(Y())}),pr=T({...v.shape,...S.shape,description:ae(m()),arguments:ae(A(Vr)),_meta:ae(pe({}))}),Hr=x.extend({method:N("prompts/list")}),en=M.extend({prompts:A(pr)}),tn=a.extend({name:m(),arguments:ee(m(),m()).optional()}),Yn=u.extend({method:N("prompts/get"),params:tn}),Xn=T({type:N("text"),text:m(),annotations:ue.optional(),_meta:ee(m(),ce()).optional()}),Qn=T({type:N("image"),data:I,mimeType:m(),annotations:ue.optional(),_meta:ee(m(),ce()).optional()}),eo=T({type:N("audio"),data:I,mimeType:m(),annotations:ue.optional(),_meta:ee(m(),ce()).optional()}),Xs=T({type:N("tool_use"),name:m(),id:m(),input:ee(m(),ce()),_meta:ee(m(),ce()).optional()}),rn=T({type:N("resource"),resource:te([P,j]),annotations:ue.optional(),_meta:ee(m(),ce()).optional()}),Qs=Ee.extend({type:N("resource_link")}),tr=te([Xn,Qn,eo,Qs,rn]),No=T({role:W,content:tr}),jo=p.extend({description:m().optional(),messages:A(No)}),to=d.extend({method:N("notifications/prompts/list_changed"),params:l.optional()}),ei=T({title:m().optional(),readOnlyHint:Y().optional(),destructiveHint:Y().optional(),idempotentHint:Y().optional(),openWorldHint:Y().optional()}),qo=T({taskSupport:le(["required","optional","forbidden"]).optional()}),ro=T({...v.shape,...S.shape,description:m().optional(),inputSchema:T({type:N("object"),properties:ee(m(),e).optional(),required:A(m()).optional()}).catchall(ce()),outputSchema:T({type:N("object"),properties:ee(m(),e).optional(),required:A(m()).optional()}).catchall(ce()).optional(),annotations:ei.optional(),execution:qo.optional(),_meta:ee(m(),ce()).optional()}),Mo=x.extend({method:N("tools/list")}),Lo=M.extend({tools:A(ro)}),Do=p.extend({content:A(tr),structuredContent:ee(m(),ce()).optional(),isError:Y().optional()}),Pt=c.extend({name:m(),arguments:ee(m(),ce()).optional()}),ti=u.extend({method:N("tools/call"),params:Pt}),ec=d.extend({method:N("notifications/tools/list_changed"),params:l.optional()}),Uo=le(["debug","info","notice","warning","error","critical","alert","emergency"]),ri=a.extend({level:Uo}),ni=u.extend({method:N("logging/setLevel"),params:ri}),oi=l.extend({level:Uo,logger:m().optional(),data:ce()}),si=d.extend({method:N("notifications/message"),params:oi}),ii=T({name:m().optional()}),ai=T({hints:A(ii).optional(),costPriority:Z().min(0).max(1).optional(),speedPriority:Z().min(0).max(1).optional(),intelligencePriority:Z().min(0).max(1).optional()}),ci=T({mode:le(["auto","required","none"]).optional()}),tc=T({type:N("tool_result"),toolUseId:m().describe("The unique identifier for the corresponding tool call."),content:A(tr),structuredContent:T({}).loose().optional(),isError:Y().optional(),_meta:ee(m(),ce()).optional()}),ui=Wo("type",[Xn,Qn,eo]),nn=Wo("type",[Xn,Qn,eo,Xs,tc]),li=T({role:W,content:te([nn,A(nn)]),_meta:ee(m(),ce()).optional()}),di=c.extend({messages:A(li),modelPreferences:ai.optional(),systemPrompt:m().optional(),includeContext:le(["none","thisServer","allServers"]).optional(),temperature:Z().optional(),maxTokens:Z().int(),stopSequences:A(m()).optional(),metadata:t.optional(),tools:A(ro).optional(),toolChoice:ci.optional()}),pi=u.extend({method:N("sampling/createMessage"),params:di}),fi=p.extend({model:m(),stopReason:ae(le(["endTurn","stopSequence","maxTokens"]).or(m())),role:W,content:ui}),mi=p.extend({model:m(),stopReason:ae(le(["endTurn","stopSequence","maxTokens","toolUse"]).or(m())),role:W,content:te([nn,A(nn)])}),hi=T({type:N("boolean"),title:m().optional(),description:m().optional(),default:Y().optional()}),gi=T({type:N("string"),title:m().optional(),description:m().optional(),minLength:Z().optional(),maxLength:Z().optional(),format:le(["email","uri","date","date-time"]).optional(),default:m().optional()}),yi=T({type:le(["number","integer"]),title:m().optional(),description:m().optional(),minimum:Z().optional(),maximum:Z().optional(),default:Z().optional()}),_i=T({type:N("string"),title:m().optional(),description:m().optional(),enum:A(m()),default:m().optional()}),vi=T({type:N("string"),title:m().optional(),description:m().optional(),oneOf:A(T({const:m(),title:m()})),default:m().optional()}),Si=T({type:N("string"),title:m().optional(),description:m().optional(),enum:A(m()),enumNames:A(m()).optional(),default:m().optional()}),bi=te([_i,vi]),no=T({type:N("array"),title:m().optional(),description:m().optional(),minItems:Z().optional(),maxItems:Z().optional(),items:T({type:N("string"),enum:A(m())}),default:A(m()).optional()}),oo=T({type:N("array"),title:m().optional(),description:m().optional(),minItems:Z().optional(),maxItems:Z().optional(),items:T({anyOf:A(T({const:m(),title:m()}))}),default:A(m()).optional()}),rc=te([no,oo]),nc=te([Si,bi,rc]),Kt=te([nc,hi,gi,yi]),Wt=c.extend({mode:N("form").optional(),message:m(),requestedSchema:T({type:N("object"),properties:ee(m(),Kt),required:A(m()).optional()}).catchall(ce())}),wi=c.extend({mode:N("url"),message:m(),elicitationId:m(),url:m().url()}),fr=te([Wt,wi]),oc=u.extend({method:N("elicitation/create"),params:fr}),sc=l.extend({elicitationId:m()}),ic=d.extend({method:N("notifications/elicitation/complete"),params:sc}),ac=p.extend({action:le(["accept","decline","cancel"]),content:fo((Tt)=>Tt===null?void 0:Tt,ee(m(),te([m(),Z(),Y(),A(m())])).optional())}),cc=T({type:N("ref/resource"),uri:m()}),uc=T({type:N("ref/prompt"),name:m()}),lc=a.extend({ref:te([uc,cc]),argument:T({name:m(),value:m()}),context:T({arguments:ee(m(),m()).optional()}).optional()}),$i=u.extend({method:N("completion/complete"),params:lc}),dc=p.extend({completion:pe({values:A(m()).max(100),total:ae(Z().int()),hasMore:ae(Y())})}),pc=T({uri:m().startsWith("file://"),name:m().optional(),_meta:ee(m(),ce()).optional()}),Fo=u.extend({method:N("roots/list"),params:a.optional()}),Ri=p.extend({roots:A(pc)}),fc=d.extend({method:N("notifications/roots/list_changed"),params:l.optional()}),mc=pe({ttl:Z().optional(),pollInterval:Z().optional()}),hc=le(["working","input_required","completed","failed","cancelled"]),on=T({taskId:m(),status:hc,ttl:te([Z(),po()]),createdAt:m(),lastUpdatedAt:m(),pollInterval:ae(Z()),statusMessage:ae(m())}),Lt=p.extend({task:on}),gc=l.merge(on),so=d.extend({method:N("notifications/tasks/status"),params:gc}),Vo=u.extend({method:N("tasks/get"),params:a.extend({taskId:m()})}),Ho=p.merge(on),Zo=u.extend({method:N("tasks/result"),params:a.extend({taskId:m()})}),qp=p.loose(),Dt=x.extend({method:N("tasks/list")}),lt=M.extend({tasks:A(on)}),io=u.extend({method:N("tasks/cancel"),params:a.extend({taskId:m()})});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:f,EmptyResultSchema:h,CancelledNotificationParamsSchema:y,CancelledNotificationSchema:_,IconSchema:g,IconsSchema:S,BaseMetadataSchema:v,ImplementationSchema:w,ClientTasksCapabilitySchema:b,ServerTasksCapabilitySchema:E,ClientCapabilitiesSchema:C,InitializeRequestParamsSchema:q,InitializeRequestSchema:O,ServerCapabilitiesSchema:F,InitializeResultSchema:K,InitializedNotificationSchema:G,PingRequestSchema:ge,ProgressSchema:ke,ProgressNotificationParamsSchema:Ne,ProgressNotificationSchema:Fe,PaginatedRequestParamsSchema:Pe,PaginatedRequestSchema:x,PaginatedResultSchema:M,ResourceContentsSchema:B,TextResourceContentsSchema:P,BlobResourceContentsSchema:j,RoleSchema:W,AnnotationsSchema:ue,ResourceSchema:Ee,ResourceTemplateSchema:ye,ListResourcesRequestSchema:Ze,ListResourcesResultSchema:Nt,ListResourceTemplatesRequestSchema:k,ListResourceTemplatesResultSchema:L,ResourceRequestParamsSchema:H,ReadResourceRequestParamsSchema:fe,ReadResourceRequestSchema:me,ReadResourceResultSchema:$e,ResourceListChangedNotificationSchema:ut,SubscribeRequestParamsSchema:mt,SubscribeRequestSchema:zt,UnsubscribeRequestParamsSchema:dt,UnsubscribeRequestSchema:Xe,ResourceUpdatedNotificationParamsSchema:er,ResourceUpdatedNotificationSchema:yt,PromptArgumentSchema:Vr,PromptSchema:pr,ListPromptsRequestSchema:Hr,ListPromptsResultSchema:en,GetPromptRequestParamsSchema:tn,GetPromptRequestSchema:Yn,TextContentSchema:Xn,ImageContentSchema:Qn,AudioContentSchema:eo,ToolUseContentSchema:Xs,EmbeddedResourceSchema:rn,ResourceLinkSchema:Qs,ContentBlockSchema:tr,PromptMessageSchema:No,GetPromptResultSchema:jo,PromptListChangedNotificationSchema:to,ToolAnnotationsSchema:ei,ToolExecutionSchema:qo,ToolSchema:ro,ListToolsRequestSchema:Mo,ListToolsResultSchema:Lo,CallToolResultSchema:Do,CallToolRequestParamsSchema:Pt,CallToolRequestSchema:ti,ToolListChangedNotificationSchema:ec,LoggingLevelSchema:Uo,SetLevelRequestParamsSchema:ri,SetLevelRequestSchema:ni,LoggingMessageNotificationParamsSchema:oi,LoggingMessageNotificationSchema:si,ModelHintSchema:ii,ModelPreferencesSchema:ai,ToolChoiceSchema:ci,ToolResultContentSchema:tc,SamplingContentSchema:ui,SamplingMessageContentBlockSchema:nn,SamplingMessageSchema:li,CreateMessageRequestParamsSchema:di,CreateMessageRequestSchema:pi,CreateMessageResultSchema:fi,CreateMessageResultWithToolsSchema:mi,BooleanSchemaSchema:hi,StringSchemaSchema:gi,NumberSchemaSchema:yi,UntitledSingleSelectEnumSchemaSchema:_i,TitledSingleSelectEnumSchemaSchema:vi,LegacyTitledEnumSchemaSchema:Si,SingleSelectEnumSchemaSchema:bi,UntitledMultiSelectEnumSchemaSchema:no,TitledMultiSelectEnumSchemaSchema:oo,MultiSelectEnumSchemaSchema:rc,EnumSchemaSchema:nc,PrimitiveSchemaDefinitionSchema:Kt,ElicitRequestFormParamsSchema:Wt,ElicitRequestURLParamsSchema:wi,ElicitRequestParamsSchema:fr,ElicitRequestSchema:oc,ElicitationCompleteNotificationParamsSchema:sc,ElicitationCompleteNotificationSchema:ic,ElicitResultSchema:ac,ResourceTemplateReferenceSchema:cc,PromptReferenceSchema:uc,CompleteRequestParamsSchema:lc,CompleteRequestSchema:$i,CompleteResultSchema:dc,RootSchema:pc,ListRootsRequestSchema:Fo,ListRootsResultSchema:Ri,RootsListChangedNotificationSchema:fc,TaskCreationParamsSchema:mc,TaskStatusSchema:hc,TaskSchema:on,CreateTaskResultSchema:Lt,TaskStatusNotificationParamsSchema:gc,TaskStatusNotificationSchema:so,GetTaskRequestSchema:Vo,GetTaskResultSchema:Ho,GetTaskPayloadRequestSchema:Zo,GetTaskPayloadResultSchema:qp,ListTasksRequestSchema:Dt,ListTasksResultSchema:lt,CancelTaskRequestSchema:io,CancelTaskResultSchema:p.merge(on),ClientRequestSchema:te([ge,O,$i,ni,Yn,Hr,Ze,k,me,zt,Xe,ti,Mo,Vo,Zo,Dt,io]),ClientNotificationSchema:te([_,Fe,G,fc,so]),ClientResultSchema:te([h,fi,mi,ac,Ri,Ho,lt,Lt]),ServerRequestSchema:te([ge,pi,oc,Fo,Vo,Zo,Dt,io]),ServerNotificationSchema:te([_,Fe,si,yt,ut,ec,to,so,ic]),ServerResultSchema:te([h,K,dc,jo,en,Nt,L,$e,Do,Lo,Ho,lt,Lt]),CallToolResultWireSchema:ce().superRefine((Tt,xC)=>{if(typeof Tt!=="object"||Tt===null||Array.isArray(Tt)||Tt.content!==void 0)return;for(let Cy of t0)if(Cy in Tt){xC.addIssue({code:"custom",message:`content is required when the body carries '${Cy}' — another result family cannot default into an empty tools/call success`});return}}).transform(Am).pipe(Do)}}var bA;function r0(){return bA??=SA()}function n0(e){return e.type!=="object"}var wA=new Set(["const","enum","default","examples"]),$A=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function Lb(e){return e!==void 0&&!(typeof e==="string"&&e.startsWith("#"))}function RA(e){let t=typeof e.$schema==="string"?e.$schema:void 0;if(Lb(e.$id))return{...t!==void 0&&{$schema:t},type:"object",properties:{result:e},required:["result"]};let r=qy(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&&Lb(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(wA.has(c))i[c]=u;else if($A.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 o0={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},s0={"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},EA={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},xl;function Nm(){if(xl)return xl;let e=r0();return xl={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}},xl}function i0(e){return Object.prototype.hasOwnProperty.call(o0,e)}function a0(e){return Object.prototype.hasOwnProperty.call(s0,e)}function zA(e){return Object.prototype.hasOwnProperty.call(EA,e)}function PA(e){return zA(e)?Nm().resultSchemas[e]:void 0}function TA(e){return i0(e)?Nm().requestSchemas[e]:void 0}function kA(e){return a0(e)?Nm().notificationSchemas[e]:void 0}var WK=Object.keys(o0),YK=Object.keys(s0);function km(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function Cl(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 Db={ok:!1,reason:"not-in-era"};function Ub(e){return km(e)&&km(e.outputSchema)&&n0(e.outputSchema)}function Fb(e){return e}var jm={era:"2025-11-25",hasRequestMethod:i0,hasNotificationMethod:a0,validateRequest:(e,t)=>Cl(TA(e),t),validateResult:(e,t)=>Cl(PA(e),t),validateNotification:(e,t)=>Cl(kA(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>Db,validateInputResponse:()=>Db,samplingResultVariant:(e,t)=>{let r=r0();return Cl(e?r.CreateMessageResultWithToolsSchema:r.CreateMessageResultSchema,t)},outboundEnvelope:(e)=>{return},validateEnvelopeMeta:(e)=>[],projectCallToolResult(e,t){let r=e0(e),n=r.structuredContent;if(n===void 0)return r;let o=typeof n!=="object"||n===null||Array.isArray(n),s=t!==void 0&&n0(t);if(!o&&!s)return r;return{...r,structuredContent:{result:n}}},decodeResult(e,t){if(km(t)&&"resultType"in t){let r={...t};return delete r.resultType,{kind:"complete",result:Fb(r)}}return{kind:"complete",result:Fb(t)}},encodeResult(e,t){if(e!=="tools/list")return t;let r=t.tools;if(!Array.isArray(r)||!r.some((n)=>Ub(n)))return t;return{...t,tools:r.map((n)=>Ub(n)?{...n,outputSchema:RA(n.outputSchema)}:n)}},encodeErrorCode:(e)=>e===-32002?-32602:e,checkInboundEnvelope:(e)=>{return}};function IA(){let e=Mi(()=>te([m(),Z(),Y(),po(),ee(m(),e),A(e)])),t=ee(m(),e),r=te([m(),Z().int()]),n=m(),o=te([m(),Z().int()]),s=le(["user","assistant"]),i=le(["debug","info","notice","warning","error","critical","alert","emergency"]),a=m().refine((lt)=>{try{return atob(lt),!0}catch{return!1}},{message:"Invalid Base64 string"}),c=T({ttl:Z().optional()}),u=T({taskId:m()}),l=pe({progressToken:r.optional(),"io.modelcontextprotocol/related-task":u.optional()}),d=T({_meta:l.optional()}),p=d.extend({task:c.optional()}),f=T({_meta:l.optional()}),h=T({method:m(),params:f.loose().optional()}),y=T({src:m(),mimeType:m().optional(),sizes:A(m()).optional(),theme:le(["light","dark"]).optional()}),_=T({icons:A(y).optional()}),g=T({name:m(),title:m().optional()}),S=g.extend({...g.shape,..._.shape,version:m(),websiteUrl:m().optional(),description:m().optional()}),v=Gr(T({applyDefaults:Y().optional()}),t),w=fo((lt)=>{if(lt&&typeof lt==="object"&&!Array.isArray(lt)&&Object.keys(lt).length===0)return{form:{}};return lt},Gr(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(m(),t).optional(),sampling:T({context:t.optional(),tools:t.optional()}).optional(),elicitation:w.optional(),roots:T({listChanged:Y().optional()}).optional(),tasks:z.optional(),extensions:ee(m(),t).optional()}),E=T({experimental:ee(m(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:T({listChanged:Y().optional()}).optional(),resources:T({subscribe:Y().optional(),listChanged:Y().optional()}).optional(),tools:T({listChanged:Y().optional()}).optional(),tasks:R.optional(),extensions:ee(m(),t).optional()}),C=T({progress:Z(),total:ae(Z()),message:ae(m())}),q=T({...f.shape,...C.shape,progressToken:r}),O=h.extend({method:N("notifications/progress"),params:q}),F=f.extend({level:i,logger:m().optional(),data:ce()}),K=h.extend({method:N("notifications/message"),params:F}),G=T({uri:m(),mimeType:ae(m()),_meta:ee(m(),ce()).optional()}),ge=G.extend({text:m()}),ke=G.extend({blob:a}),Ne=T({audience:A(s).optional(),priority:Z().min(0).max(1).optional(),lastModified:Ko({offset:!0}).optional()}),Fe=T({...g.shape,..._.shape,uri:m(),description:ae(m()),mimeType:ae(m()),size:ae(Z()),annotations:Ne.optional(),_meta:ae(pe({}))}),Pe=T({...g.shape,..._.shape,uriTemplate:m(),description:ae(m()),mimeType:ae(m()),annotations:Ne.optional(),_meta:ae(pe({}))}),x=h.extend({method:N("notifications/resources/list_changed"),params:f.optional()}),M=f.extend({uri:m()}),B=h.extend({method:N("notifications/resources/updated"),params:M}),P=T({name:m(),description:ae(m()),required:ae(Y())}),I=T({...g.shape,..._.shape,description:ae(m()),arguments:ae(A(P)),_meta:ae(pe({}))}),j=h.extend({method:N("notifications/prompts/list_changed"),params:f.optional()}),W=T({type:N("text"),text:m(),annotations:Ne.optional(),_meta:ee(m(),ce()).optional()}),ue=T({type:N("image"),data:a,mimeType:m(),annotations:Ne.optional(),_meta:ee(m(),ce()).optional()}),Ee=T({type:N("audio"),data:a,mimeType:m(),annotations:Ne.optional(),_meta:ee(m(),ce()).optional()}),ye=T({type:N("tool_use"),name:m(),id:m(),input:ee(m(),ce()),_meta:ee(m(),ce()).optional()}),Ze=T({type:N("resource"),resource:te([ge,ke]),annotations:Ne.optional(),_meta:ee(m(),ce()).optional()}),Nt=Fe.extend({type:N("resource_link")}),k=te([W,ue,Ee,Nt,Ze]),L=T({role:s,content:k}),H=T({title:m().optional(),readOnlyHint:Y().optional(),destructiveHint:Y().optional(),idempotentHint:Y().optional(),openWorldHint:Y().optional()}),fe=h.extend({method:N("notifications/tools/list_changed"),params:f.optional()}),me=T({name:m().optional()}),$e=T({hints:A(me).optional(),costPriority:Z().min(0).max(1).optional(),speedPriority:Z().min(0).max(1).optional(),intelligencePriority:Z().min(0).max(1).optional()}),ut=T({mode:le(["auto","required","none"]).optional()}),mt=T({type:N("boolean"),title:m().optional(),description:m().optional(),default:Y().optional()}),zt=T({type:N("string"),title:m().optional(),description:m().optional(),minLength:Z().optional(),maxLength:Z().optional(),format:le(["email","uri","date","date-time"]).optional(),default:m().optional()}),dt=T({type:le(["number","integer"]),title:m().optional(),description:m().optional(),minimum:Z().optional(),maximum:Z().optional(),default:Z().optional()}),Xe=T({type:N("string"),title:m().optional(),description:m().optional(),enum:A(m()),default:m().optional()}),er=T({type:N("string"),title:m().optional(),description:m().optional(),oneOf:A(T({const:m(),title:m()})),default:m().optional()}),yt=T({type:N("string"),title:m().optional(),description:m().optional(),enum:A(m()),enumNames:A(m()).optional(),default:m().optional()}),Vr=te([Xe,er]),pr=T({type:N("array"),title:m().optional(),description:m().optional(),minItems:Z().optional(),maxItems:Z().optional(),items:T({type:N("string"),enum:A(m())}),default:A(m()).optional()}),Hr=T({type:N("array"),title:m().optional(),description:m().optional(),minItems:Z().optional(),maxItems:Z().optional(),items:T({anyOf:A(T({const:m(),title:m()}))}),default:A(m()).optional()}),en=te([pr,Hr]),tn=te([yt,Vr,en]),Yn=te([tn,mt,zt,dt]),Xn=p.extend({mode:N("form").optional(),message:m(),requestedSchema:T({type:N("object"),properties:ee(m(),Yn),required:A(m()).optional()}).catchall(ce())}),Qn=T({type:N("ref/resource"),uri:m()}),eo=T({type:N("ref/prompt"),name:m()}),Xs=T({uri:m().startsWith("file://"),name:m().optional(),_meta:ee(m(),ce()).optional()}),rn=b.shape,Qs=T({experimental:rn.experimental,sampling:rn.sampling,elicitation:rn.elicitation,roots:rn.roots,extensions:rn.extensions}),tr=E.shape,No=T({experimental:tr.experimental,logging:tr.logging,completions:tr.completions,prompts:tr.prompts,resources:tr.resources,tools:tr.tools,extensions:tr.extensions}),jo=pe({progressToken:r.optional(),[Br]:m(),[Yo]:S.optional(),[Kr]:Qs,[pn]:i.optional()}),to=T({...g.shape,..._.shape,description:m().optional(),inputSchema:pe({$schema:m().optional(),type:N("object")}),outputSchema:pe({$schema:m().optional()}).optional(),annotations:H.optional(),_meta:ee(m(),ce()).optional()}),ei=T({type:N("tool_result"),toolUseId:m(),content:A(k),structuredContent:ce().optional(),isError:Y().optional(),_meta:ee(m(),ce()).optional()}),qo=te([W,ue,Ee,ye,ei]),ro=T({role:s,content:te([qo,A(qo)]),_meta:ee(m(),ce()).optional()}),Mo=m(),Lo=pe({[zr]:S.optional().catch(void 0)}),Do=Lo.optional();function Pt(lt){return pe({_meta:Do,resultType:Mo.default("complete"),...lt})}let ti=Pt({}),ec=Pt({nextCursor:n.optional()}),Uo=Pt({content:A(k),structuredContent:ce().optional(),isError:Y().optional()}),ri=Pt({ttlMs:Z().int().min(0),cacheScope:le(["public","private"]),tools:A(to),nextCursor:n.optional()}),ni=Pt({ttlMs:Z().int().min(0),cacheScope:le(["public","private"]),prompts:A(I),nextCursor:n.optional()}),oi=Pt({description:m().optional(),messages:A(L)}),si=Pt({ttlMs:Z().int().min(0),cacheScope:le(["public","private"]),resources:A(Fe),nextCursor:n.optional()}),ii=Pt({ttlMs:Z().int().min(0),cacheScope:le(["public","private"]),resourceTemplates:A(Pe),nextCursor:n.optional()}),ai=Pt({ttlMs:Z().int().min(0),cacheScope:le(["public","private"]),contents:A(te([ge,ke]))}),ci=Pt({completion:T({values:A(m()).max(100),total:Z().int().optional(),hasMore:Y().optional()}).loose()}),tc=Pt({ttlMs:Z().int().min(0),cacheScope:le(["public","private"])}),ui=Pt({ttlMs:Z().int().min(0).catch(0),cacheScope:le(["public","private"]).catch("private"),supportedVersions:A(m()),capabilities:No,instructions:m().optional()}),nn=T({messages:A(ro),modelPreferences:$e.optional(),systemPrompt:m().optional(),includeContext:le(["none","thisServer","allServers"]).optional(),temperature:Z().optional(),maxTokens:Z().int(),stopSequences:A(m()).optional(),metadata:t.optional(),tools:A(to).optional(),toolChoice:ut.optional()}),li=T({method:N("sampling/createMessage"),params:nn}),di=T({method:N("roots/list"),params:T({_meta:ee(m(),ce()).optional()}).optional()}),pi=T({...ro.shape,model:m(),stopReason:m().optional()}),fi=T({roots:A(Xs)}),mi=T({action:le(["accept","decline","cancel"]),content:ee(m(),te([m(),Z(),Y(),A(m())])).optional()}),hi=T({mode:N("url"),message:m(),url:m().url()}),gi=te([Xn,hi]),yi=T({method:N("elicitation/create"),params:gi}),_i=te([li,di,yi]),vi=te([pi,fi,mi]),Si=ee(m(),_i),bi=ee(m(),vi),no=Pt({inputRequests:Si.optional(),requestState:m().optional()}),oo={inputResponses:bi.optional(),requestState:m().optional()},rc=T({_meta:jo,...oo}),nc=pe({progressToken:r.optional()});function Kt(lt,io){return T({method:N(lt),params:T({_meta:jo,...io})})}function Wt(lt,io){return T({method:N(lt),params:T({_meta:nc.optional(),...io}).optional()})}let wi={name:m(),arguments:ee(m(),ce()).optional(),...oo},fr={cursor:n.optional()},oc=Kt("tools/call",wi),sc=Kt("tools/list",fr),ic=Kt("prompts/list",fr),ac=Kt("prompts/get",{name:m(),arguments:ee(m(),m()).optional(),...oo}),cc=Kt("resources/list",fr),uc=Kt("resources/templates/list",fr),lc=Kt("resources/read",{uri:m(),...oo}),$i={ref:te([eo,Qn]),argument:T({name:m(),value:m()}),context:T({arguments:ee(m(),m()).optional()}).optional()},dc=Kt("completion/complete",$i),pc=Kt("server/discover",{}),Fo=T({toolsListChanged:Y().optional(),promptsListChanged:Y().optional(),resourcesListChanged:Y().optional(),resourceSubscriptions:A(m()).optional()}),Ri={notifications:Fo},fc=Kt("subscriptions/listen",Ri),mc=Lo.extend({"io.modelcontextprotocol/subscriptionId":o}),hc=pe({_meta:mc,resultType:Mo.default("complete")}),on={"tools/call":Wt("tools/call",wi),"tools/list":Wt("tools/list",fr),"prompts/get":Wt("prompts/get",{name:m(),arguments:ee(m(),m()).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:m()}),"completion/complete":Wt("completion/complete",$i),"server/discover":Wt("server/discover",{}),"subscriptions/listen":Wt("subscriptions/listen",Ri)};function Lt(lt){return pe({_meta:Do,...lt})}let gc={"tools/call":Lt({content:A(k),structuredContent:ce().optional(),isError:Y().optional()}),"tools/list":Lt({ttlMs:Z().int().min(0),cacheScope:le(["public","private"]),tools:A(to),nextCursor:n.optional()}),"prompts/get":Lt({description:m().optional(),messages:A(L)}),"prompts/list":Lt({ttlMs:Z().int().min(0),cacheScope:le(["public","private"]),prompts:A(I),nextCursor:n.optional()}),"resources/list":Lt({ttlMs:Z().int().min(0),cacheScope:le(["public","private"]),resources:A(Fe),nextCursor:n.optional()}),"resources/templates/list":Lt({ttlMs:Z().int().min(0),cacheScope:le(["public","private"]),resourceTemplates:A(Pe),nextCursor:n.optional()}),"resources/read":Lt({ttlMs:Z().int().min(0),cacheScope:le(["public","private"]),contents:A(te([ge,ke]))}),"completion/complete":Lt({completion:T({values:A(m()).max(100),total:Z().int().optional(),hasMore:Y().optional()}).loose()}),"server/discover":Lt({ttlMs:Z().int().min(0).catch(0),cacheScope:le(["public","private"]).catch("private"),supportedVersions:A(m()),capabilities:No,instructions:m().optional()}),"subscriptions/listen":Lt({})},so=pe({"io.modelcontextprotocol/subscriptionId":o.optional()}),Vo=T({method:N("notifications/subscriptions/acknowledged"),params:T({_meta:so.optional(),notifications:Fo})}),Ho=T({_meta:so.optional(),requestId:o,reason:m().optional()}),Zo=T({method:N("notifications/cancelled"),params:Ho}),qp={"notifications/cancelled":Zo,"notifications/progress":O,"notifications/message":K,"notifications/resources/updated":B,"notifications/resources/list_changed":x,"notifications/tools/list_changed":fe,"notifications/prompts/list_changed":j,"notifications/subscriptions/acknowledged":Vo},Dt=(lt)=>T({jsonrpc:N("2.0"),id:te([m(),Z().int()]),result:lt}).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:f,NotificationSchema:h,IconSchema:y,IconsSchema:_,BaseMetadataSchema:g,ImplementationSchema:S,ClientTasksCapabilitySchema:z,ServerTasksCapabilitySchema:R,ClientCapabilitiesSchema:b,ServerCapabilitiesSchema:E,ProgressSchema:C,ProgressNotificationParamsSchema:q,ProgressNotificationSchema:O,LoggingMessageNotificationParamsSchema:F,LoggingMessageNotificationSchema:K,ResourceContentsSchema:G,TextResourceContentsSchema:ge,BlobResourceContentsSchema:ke,AnnotationsSchema:Ne,ResourceSchema:Fe,ResourceTemplateSchema:Pe,ResourceListChangedNotificationSchema:x,ResourceUpdatedNotificationParamsSchema:M,ResourceUpdatedNotificationSchema:B,PromptArgumentSchema:P,PromptSchema:I,PromptListChangedNotificationSchema:j,TextContentSchema:W,ImageContentSchema:ue,AudioContentSchema:Ee,ToolUseContentSchema:ye,EmbeddedResourceSchema:Ze,ResourceLinkSchema:Nt,ContentBlockSchema:k,PromptMessageSchema:L,ToolAnnotationsSchema:H,ToolListChangedNotificationSchema:fe,ModelHintSchema:me,ModelPreferencesSchema:$e,ToolChoiceSchema:ut,BooleanSchemaSchema:mt,StringSchemaSchema:zt,NumberSchemaSchema:dt,UntitledSingleSelectEnumSchemaSchema:Xe,TitledSingleSelectEnumSchemaSchema:er,LegacyTitledEnumSchemaSchema:yt,SingleSelectEnumSchemaSchema:Vr,UntitledMultiSelectEnumSchemaSchema:pr,TitledMultiSelectEnumSchemaSchema:Hr,MultiSelectEnumSchemaSchema:en,EnumSchemaSchema:tn,PrimitiveSchemaDefinitionSchema:Yn,ElicitRequestFormParamsSchema:Xn,ResourceTemplateReferenceSchema:Qn,PromptReferenceSchema:eo,RootSchema:Xs,ClientCapabilities2026Schema:Qs,ServerCapabilities2026Schema:No,RequestMetaEnvelopeSchema:jo,ToolSchema:to,ToolResultContentSchema:ei,SamplingMessageContentBlockSchema:qo,SamplingMessageSchema:ro,ResultTypeSchema:Mo,ResultMetaSchema:Lo,ResultSchema:ti,PaginatedResultSchema:ec,CallToolResultSchema:Uo,ListToolsResultSchema:ri,ListPromptsResultSchema:ni,GetPromptResultSchema:oi,ListResourcesResultSchema:si,ListResourceTemplatesResultSchema:ii,ReadResourceResultSchema:ai,CompleteResultSchema:ci,CacheableResultSchema:tc,DiscoverResultSchema:ui,CreateMessageRequestParamsSchema:nn,CreateMessageRequestSchema:li,ListRootsRequestSchema:di,CreateMessageResultSchema:pi,ListRootsResultSchema:fi,ElicitResultSchema:mi,ElicitRequestURLParamsSchema:hi,ElicitRequestParamsSchema:gi,ElicitRequestSchema:yi,InputRequestSchema:_i,InputResponseSchema:vi,InputRequestsSchema:Si,InputResponsesSchema:bi,InputRequiredResultSchema:no,InputResponseRequestParamsSchema:rc,CallToolRequestSchema:oc,ListToolsRequestSchema:sc,ListPromptsRequestSchema:ic,GetPromptRequestSchema:ac,ListResourcesRequestSchema:cc,ListResourceTemplatesRequestSchema:uc,ReadResourceRequestSchema:lc,CompleteRequestSchema:dc,DiscoverRequestSchema:pc,SubscriptionFilterSchema:Fo,SubscriptionsListenRequestSchema:fc,SubscriptionsListenResultMetaSchema:mc,SubscriptionsListenResultSchema:hc,dispatchRequestSchemas:on,dispatchResultSchemas:gc,NotificationMetaSchema:so,SubscriptionsAcknowledgedNotificationSchema:Vo,CancelledNotificationParamsSchema:Ho,CancelledNotificationSchema:Zo,notificationSchemas2026:qp,JSONRPCResultResponseSchema:Dt(ti),CallToolResultResponseSchema:Dt(te([Uo,no])),ListToolsResultResponseSchema:Dt(ri),ListPromptsResultResponseSchema:Dt(ni),GetPromptResultResponseSchema:Dt(te([oi,no])),ListResourcesResultResponseSchema:Dt(si),ListResourceTemplatesResultResponseSchema:Dt(ii),ReadResourceResultResponseSchema:Dt(te([ai,no])),CompleteResultResponseSchema:Dt(ci),DiscoverResultResponseSchema:Dt(ui)}}var xA;function So(){return xA??=IA()}var CA=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"];function OA(e){return CA.includes(e)}var us=Symbol("modelcontextprotocol.resultCacheHintFallback");function Ll(e,t){if(t===void 0)return e;let r=e[us];if(r===void 0)return{...e,[us]: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,[us]:n}}function AA(e){return e[us]}function qm(e){return typeof e==="number"&&Number.isSafeInteger(e)&&e>=0}function Mm(e){return e==="public"||e==="private"}function Lm(e,t){if(e.ttlMs!==void 0&&!qm(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&&!Mm(e.cacheScope))throw RangeError(`Invalid cache hint for ${t}: cacheScope must be 'public' or 'private' (got ${String(e.cacheScope)})`)}var X=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 ls(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 ls(this,t)}constructor(t,r,n){super(r);this.code=t,this.data=n,this.name="ProtocolError",Cm(this,new.target)}static fromError(t,r,n){if(t===X.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new c0(o.elicitations,r)}if(t===X.UnsupportedProtocolVersion&&n){let o=n;if(Array.isArray(o.supported)&&typeof o.requested==="string")return new fs({supported:o.supported,requested:o.requested},r)}if(t===X.InvalidParams||t===X.ResourceNotFound){let o=n;if(typeof o?.uri==="string"&&(t===X.ResourceNotFound||Object.keys(o).length===1))return new Dl(o.uri,r)}if(t===X.MissingRequiredClientCapability&&n){let o=n;if(o.requiredCapabilities!==null&&typeof o.requiredCapabilities==="object"&&!Array.isArray(o.requiredCapabilities))return new Ul({requiredCapabilities:o.requiredCapabilities},r)}return new e(t,r,n)}},Dl=class extends de{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(e,t=`Resource not found: ${e}`){super(X.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},c0=class extends de{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(X.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},fs=class extends de{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(X.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},Ul=class extends de{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(", ")}`){super(X.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},NA=0,jA="private",qA=["tools/call","prompts/get","resources/read"];function MA(e,t){let r=t.resultType;if(r===void 0)return{...t,resultType:"complete"};if(r==="complete")return t;if(qA.includes(e))return t;throw new de(X.InternalError,`Handler for ${e} returned resultType '${String(r)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function LA(e,t){let r=AA(t);if(t.resultType!=="complete"||!OA(e))return r===void 0?t:HA(t);let n=t,o=qm(n.ttlMs)?n.ttlMs:FA(r),s=Mm(n.cacheScope)?n.cacheScope:VA(r),i={...n,ttlMs:o,cacheScope:s};return delete i[us],i}function DA(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function UA(e,t){if(t===void 0)return e;let r=e._meta;if(r===void 0)return{...e,_meta:{[zr]:t}};if(!DA(r))return e;if(r[zr]!==void 0)return e;return{...e,_meta:{...r,[zr]:t}}}function FA(e){return e!==void 0&&qm(e.ttlMs)?e.ttlMs:NA}function VA(e){return e!==void 0&&Mm(e.cacheScope)?e.cacheScope:jA}function HA(e){let t={...e};return delete t[us],t}var ZA=["elicitation/create","sampling/createMessage","roots/list"],Ol;function u0(){if(Ol)return Ol;let e=So();return Ol={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}},Ol}function l0(e){return ZA.includes(e)}function Em(e){return l0(e)?u0().request[e]:void 0}function GA(e){return l0(e)?u0().response[e]:void 0}var Dm={"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},d0={"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 p0(e){return Object.prototype.hasOwnProperty.call(Dm,e)}function f0(e){return Object.prototype.hasOwnProperty.call(d0,e)}function JA(e){return Object.prototype.hasOwnProperty.call(Dm,e)}function BA(e){return p0(e)?So().dispatchRequestSchemas[e]:void 0}function KA(e){return JA(e)?So().dispatchResultSchemas[e]:void 0}function WA(e){return f0(e)?So().notificationSchemas2026[e]:void 0}var XK=Object.keys(Dm),QK=Object.keys(d0);function fa(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function da(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 YA={ok:!1,reason:"not-in-era"},XA=[Br,Kr];function QA(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)=>fa(a)&&("execution"in a)))o().tools=s.map((a)=>{if(!fa(a)||!("execution"in a))return a;let c={...a};return delete c.execution,c});let i=t.capabilities;if(fa(i)&&"tasks"in i){let a={...i};delete a.tasks,o().capabilities=a}return r}var Um={era:"2026-07-28",hasRequestMethod:p0,hasNotificationMethod:f0,hasInputRequestMethod:(e)=>Em(e)!==void 0,validateRequest:(e,t)=>da(BA(e),t),validateResult:(e,t)=>da(KA(e),t),validateNotification:(e,t)=>da(WA(e),t),validateInputRequest:(e,t)=>da(Em(e),t),validateInputResponse:(e,t)=>da(GA(e),t),samplingResultVariant:()=>YA,outboundEnvelope(e){return{[Br]:e.protocolVersion,[Yo]:e.clientInfo,[Kr]:e.clientCapabilities,...e.logLevel!==void 0&&{[pn]:e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let n of XA)if(!(n in e))t.push({key:n,problem:"missing"});let r=So().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)=>e0(e),inputRequestSchema:Em,decodeResult(e,t){if(!fa(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=fa(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=eN(),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 UA(LA(e,MA(e,QA(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=So().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("; ")}`}},Al;function eN(){if(Al)return Al;let e=So();return Al={"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},Al}var ya="2026-07-28";function Sn(e){return e!==void 0&&ps(e)?Um:jm}function Vb(e){if(e.revision!==void 0)return Sn(e.revision).era;return e.era==="modern"?Um.era:jm.era}function zm(e){return m0.some((t)=>t.hasRequestMethod(e))}function Pm(e){return m0.some((t)=>t.hasNotificationMethod(e))}var m0=[jm,Um];function Hb(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function bo(e){if(!Hb(e))return;let t=e._meta;return Hb(t)?t:void 0}function Fl(e){let t=bo(e);return t!==void 0&&Br in t}function Vl(e){let t=bo(e)?.[Br];return typeof t==="string"?t:void 0}function Hl(e){return Sn(ya).validateEnvelopeMeta(e)}var tN=Ny({AnnotationsSchema:()=>Wr,AudioContentSchema:()=>os,BaseMetadataSchema:()=>Jr,BaseRequestParamsSchema:()=>vt,BlobResourceContentsSchema:()=>Qi,BooleanSchemaSchema:()=>oa,CallToolRequestParamsSchema:()=>Hu,CallToolRequestSchema:()=>Zu,CallToolResultSchema:()=>na,CancelTaskRequestSchema:()=>um,CancelTaskResultSchema:()=>lm,CancelledNotificationParamsSchema:()=>Jc,CancelledNotificationSchema:()=>Ji,ClientCapabilitiesSchema:()=>Yc,ClientNotificationSchema:()=>pm,ClientRequestSchema:()=>dm,ClientResultSchema:()=>fm,ClientTasksCapabilitySchema:()=>Kc,CompatibilityCallToolResultSchema:()=>Xf,CompleteRequestParamsSchema:()=>_l,CompleteRequestSchema:()=>vl,CompleteResultSchema:()=>Sl,ContentBlockSchema:()=>ss,CreateMessageRequestParamsSchema:()=>nl,CreateMessageRequestSchema:()=>ol,CreateMessageResultSchema:()=>sl,CreateMessageResultWithToolsSchema:()=>il,CreateTaskResultSchema:()=>tm,CursorSchema:()=>Di,DiscoverRequestSchema:()=>ru,DiscoverResultSchema:()=>nu,ElicitRequestFormParamsSchema:()=>cs,ElicitRequestParamsSchema:()=>dl,ElicitRequestSchema:()=>pl,ElicitRequestURLParamsSchema:()=>ll,ElicitResultSchema:()=>hl,ElicitationCompleteNotificationParamsSchema:()=>fl,ElicitationCompleteNotificationSchema:()=>ml,EmbeddedResourceSchema:()=>Nu,EmptyResultSchema:()=>Gi,EnumSchemaSchema:()=>ul,GetPromptRequestParamsSchema:()=>Cu,GetPromptRequestSchema:()=>Ou,GetPromptResultSchema:()=>Mu,GetTaskPayloadRequestSchema:()=>sm,GetTaskPayloadResultSchema:()=>im,GetTaskRequestSchema:()=>nm,GetTaskResultSchema:()=>om,IconSchema:()=>Bc,IconsSchema:()=>mn,ImageContentSchema:()=>ns,ImplementationSchema:()=>es,InitializeRequestParamsSchema:()=>Xc,InitializeRequestSchema:()=>Qc,InitializeResultSchema:()=>eu,InitializedNotificationSchema:()=>tu,JSONArraySchema:()=>Kf,JSONObjectSchema:()=>tt,JSONRPCErrorResponseSchema:()=>Qo,JSONRPCMessageSchema:()=>Zi,JSONRPCNotificationSchema:()=>Hi,JSONRPCRequestSchema:()=>Vi,JSONRPCResponseSchema:()=>Wf,JSONRPCResultResponseSchema:()=>Xo,JSONValueSchema:()=>dn,LegacyTitledEnumSchemaSchema:()=>aa,ListChangedOptionsBaseSchema:()=>Qf,ListPromptsRequestSchema:()=>Iu,ListPromptsResultSchema:()=>xu,ListResourceTemplatesRequestSchema:()=>lu,ListResourceTemplatesResultSchema:()=>du,ListResourcesRequestSchema:()=>cu,ListResourcesResultSchema:()=>uu,ListRootsRequestSchema:()=>wl,ListRootsResultSchema:()=>$l,ListTasksRequestSchema:()=>am,ListTasksResultSchema:()=>cm,ListToolsRequestSchema:()=>Fu,ListToolsResultSchema:()=>Vu,LoggingLevelSchema:()=>_n,LoggingMessageNotificationParamsSchema:()=>Ku,LoggingMessageNotificationSchema:()=>Wu,ModelHintSchema:()=>Yu,ModelPreferencesSchema:()=>Xu,MultiSelectEnumSchemaSchema:()=>cl,NotificationSchema:()=>It,NotificationsParamsSchema:()=>kt,NumberSchemaSchema:()=>as,PaginatedRequestParamsSchema:()=>iu,PaginatedRequestSchema:()=>hn,PaginatedResultSchema:()=>gn,PingRequestSchema:()=>Ki,PrimitiveSchemaDefinitionSchema:()=>la,ProgressNotificationParamsSchema:()=>su,ProgressNotificationSchema:()=>Wi,ProgressSchema:()=>ou,ProgressTokenSchema:()=>Li,PromptArgumentSchema:()=>Tu,PromptListChangedNotificationSchema:()=>Lu,PromptMessageSchema:()=>qu,PromptReferenceSchema:()=>yl,PromptSchema:()=>ku,ReadResourceRequestParamsSchema:()=>pu,ReadResourceRequestSchema:()=>fu,ReadResourceResultSchema:()=>mu,RelatedTaskMetadataSchema:()=>Gc,RequestIdSchema:()=>fn,RequestMetaSchema:()=>Ui,RequestSchema:()=>rt,ResourceContentsSchema:()=>Yi,ResourceLinkSchema:()=>ju,ResourceListChangedNotificationSchema:()=>hu,ResourceRequestParamsSchema:()=>ts,ResourceSchema:()=>ea,ResourceTemplateReferenceSchema:()=>gl,ResourceTemplateSchema:()=>au,ResourceUpdatedNotificationParamsSchema:()=>zu,ResourceUpdatedNotificationSchema:()=>Pu,ResultMetaObjectSchema:()=>Fi,ResultSchema:()=>nt,RoleSchema:()=>yn,RootSchema:()=>bl,RootsListChangedNotificationSchema:()=>Rl,SamplingContentSchema:()=>tl,SamplingMessageContentBlockSchema:()=>mo,SamplingMessageSchema:()=>rl,ServerCapabilitiesSchema:()=>Bi,ServerNotificationSchema:()=>hm,ServerRequestSchema:()=>mm,ServerResultSchema:()=>gm,ServerTasksCapabilitySchema:()=>Wc,SetLevelRequestParamsSchema:()=>Ju,SetLevelRequestSchema:()=>Bu,SingleSelectEnumSchemaSchema:()=>al,StringSchemaSchema:()=>is,SubscribeRequestParamsSchema:()=>gu,SubscribeRequestSchema:()=>yu,SubscriptionFilterSchema:()=>ta,SubscriptionsAcknowledgedNotificationParamsSchema:()=>wu,SubscriptionsAcknowledgedNotificationSchema:()=>$u,SubscriptionsListenRequestParamsSchema:()=>Su,SubscriptionsListenRequestSchema:()=>bu,SubscriptionsListenResultMetaSchema:()=>Ru,SubscriptionsListenResultSchema:()=>Eu,TaskAugmentedRequestParamsSchema:()=>_o,TaskCreationParamsSchema:()=>em,TaskMetadataSchema:()=>Zc,TaskSchema:()=>vn,TaskStatusNotificationParamsSchema:()=>zl,TaskStatusNotificationSchema:()=>rm,TaskStatusSchema:()=>El,TextContentSchema:()=>rs,TextResourceContentsSchema:()=>Xi,TitledMultiSelectEnumSchemaSchema:()=>ua,TitledSingleSelectEnumSchemaSchema:()=>ia,ToolAnnotationsSchema:()=>Du,ToolChoiceSchema:()=>Qu,ToolExecutionSchema:()=>Uu,ToolListChangedNotificationSchema:()=>Gu,ToolResultContentSchema:()=>el,ToolSchema:()=>ra,ToolUseContentSchema:()=>Au,UnsubscribeRequestParamsSchema:()=>_u,UnsubscribeRequestSchema:()=>vu,UntitledMultiSelectEnumSchemaSchema:()=>ca,UntitledSingleSelectEnumSchemaSchema:()=>sa});var rr=(e)=>Vi.safeParse(e).success,wn=(e)=>Hi.safeParse(e).success,ha=(e)=>Xo.safeParse(e).success,Zl=(e)=>Qo.safeParse(e).success;var Yr=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e)&&e.resultType==="input_required";function Fm(e){if(e.params.ref.type!=="ref/prompt")throw TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`)}function Vm(e){if(e.params.ref.type!=="ref/resource")throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`)}var Zb="x-mcp-header",rN=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,nN=new Set(["string","integer","boolean","number"]);function Hm(e){let t=[],r=new Map,n=(s,i,a)=>{if(s===null||typeof s!=="object")return;let c=s;if(Zb in c){if(!a||i.length===0)return`${Nl(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[Zb];if(typeof l!=="string"||l.length===0)return`${Nl(i)}: x-mcp-header MUST be a non-empty string`;if(!rN.test(l))return`${Nl(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||!nN.has(d))return`${Nl(i)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${d??"<none>"}`;let p=l.toLowerCase(),f=r.get(p);if(f!==void 0)return`x-mcp-header '${l}' is not case-insensitively unique (also declared as '${f}')`;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 oN){let d=c[l];if(d===void 0)continue;let p=Array.isArray(d)?d:d!==null&&typeof d==="object"&&sN.has(l)?Object.values(d):[d];for(let f of p){let h=n(f,[...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 oN=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],sN=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);function Nl(e){return e.length===0?"<root>":e.join(".")}var ql=-32020,e5=[{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:[X.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:[ql,X.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:[X.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:[X.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:[X.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:[ql],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:[X.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:[ql],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."}],iN={[X.ParseError]:400,[X.InvalidRequest]:400,[X.MethodNotFound]:404,[X.UnsupportedProtocolVersion]:400,[X.MissingRequiredClientCapability]:400,[ql]:400};function jl(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 Zm(e){if(!Fl(e))return!1;let t=Vl(e);if(t===void 0||!ps(t))return!1;let r=bo(e);return r!==void 0&&Hl(r).length===0}function Gm(e,t){switch(e.reason){case"http-method":return jl("http-method","modern-only-method-not-allowed",405,new de(-32000,"Method not allowed."),!0);case"batch":return jl("jsonrpc-shape","modern-only-batch-not-supported",400,new de(X.InvalidRequest,"Bad Request: JSON-RPC batches are not supported by this endpoint"),!0);case"response":return jl("jsonrpc-shape","modern-only-response-post",400,new de(X.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 jl("era-classification","modern-only-missing-envelope",400,r===void 0?new de(X.UnsupportedProtocolVersion,"Unsupported protocol version: the request did not name a protocol version",{supported:[...t]}):new fs({supported:[...t],requested:r}),!0)}}}function Gl(e,t){return Lc(e,t)}function pa(e){return new Set(e.flatMap((t)=>Object.keys(t.shape)))}function ds(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 Gb=!1,Im="draft-2020-12";function $n(e,t="input"){let r=e["~standard"],n;if(r.jsonSchema)n=r.jsonSchema[t]({target:Im});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(!Gb)Gb=!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=qc(e,{target:Im,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 h0(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 h0(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"||h0(n)))}return!1}function aN(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 vo(e,t){let r=await e["~standard"].validate(t);if(r.issues&&r.issues.length>0)return{success:!1,error:r.issues.map((n)=>aN(n)).join(", ")};return{success:!0,data:r.value}}function cN(e){let t=qc(e,{target:Im,io:"input"});return typeof t.pattern==="string"?t.pattern:void 0}var uN=/\\\.\\d\{(\d+)\}/;function lN(e){let t=uN.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)=>Ko({local:n,offset:o,precision:s}))))}function dN(e,t){let r;switch(e){case"email":r=[yb()];break;case"uri":r=[Uc()];break;case"date":r=[Zf()];break;case"date-time":r=lN(t);break}return new Set(r.map((n)=>cN(n)).filter((n)=>n!==void 0))}function pN(e,t,r){if(r!=="zod")return!0;return dN(e,t).has(t)}function g0(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 ga(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function fN(e){try{return $n(e,"input")}catch(t){let r=t instanceof Error?t.message:String(t);throw new de(X.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${r}`)}}var mN=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function Jm(e){return mN.has(e)||e.startsWith("x-")}var hN=new Set(["$schema",...Object.keys(cs.shape.requestedSchema.shape)]),Jb={string:pa([is,sa,ia,aa]),number:pa([as]),integer:pa([as]),boolean:pa([oa]),array:pa([ca,ua])},gN=new Set(is.shape.format.unwrap().options);function yN(e,t,r,n){if(!ga(e))return e;let o=typeof e.type==="string"&&Object.hasOwn(Jb,e.type)?Jb[e.type]:void 0;if(o===void 0)return e;let s={};for(let[i,a]of Object.entries(e))if(o.has(i)||Jm(i))s[i]=a;else if(i==="pattern"&&e.type==="string"&&typeof e.format==="string"){if(!gN.has(e.format))s[i]=a;else if(typeof a!=="string"||!pN(e.format,a,r))n.push(`${t}.${i}`)}else n.push(`${t}.${i}`);return s}function _N(e,t){let r={},n=[];for(let[o,s]of Object.entries(e))if(o==="properties"&&ga(s))r[o]=Object.fromEntries(Object.entries(s).map(([i,a])=>[i,yN(a,`properties.${i}`,t,n)]));else if(hN.has(o))r[o]=s;else if(!Jm(o))n.push(o);if(n.length>0)throw new de(X.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${n.join(", ")}`);return r}function vN(e,t){if(!ga(e.properties))return t;let r=Object.entries(e.properties).filter(([,n])=>!Gl(la,n).success).map(([n])=>`properties.${n}`);return r.length>0?r.join(", "):t}function xm(e,t,r=""){if(Array.isArray(e)&&Array.isArray(t))return e.flatMap((n,o)=>xm(n,t[o],`${r}[${o}]`));if(!ga(e)||!ga(t))return[];return Object.entries(e).flatMap(([n,o])=>{let s=r?`${r}.${n}`:n;if(!Object.prototype.hasOwnProperty.call(t,n))return Jm(n)?[]:[s];return xm(o,t[n],s)})}function SN(e){if(!ds(e.requestedSchema))return{...e,mode:"form",requestedSchema:e.requestedSchema};let t=e.requestedSchema["~standard"].vendor,r=_N(fN(e.requestedSchema),t),n=Gl(cs.shape.requestedSchema,r);if(!n.success)throw new de(X.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${vN(r,n.error.message)}`);let o=xm(r,n.data);if(o.length>0)throw new de(X.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(X.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${s.join(", ")}`);return{...e,mode:"form",requestedSchema:n.data}}function bN(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 wN=Object.assign(bN,{elicit(e){try{return{method:"elicitation/create",params:SN(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 y0=250;function _0(e,t){return`Multi-round-trip request '${e}' still required input after ${t} rounds (inputRequired.maxRounds)`}function v0(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 S0(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 $N=["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"],RN={IdJagTokenExchangeResponseSchema:Sm,OAuthClientInformationFullSchema:wm,OAuthClientInformationSchema:Il,OAuthClientMetadataSchema:kl,OAuthClientRegistrationErrorSchema:$m,OAuthErrorResponseSchema:bm,OAuthMetadataSchema:Pl,OAuthProtectedResourceMetadataSchema:ym,OAuthTokenRevocationRequestSchema:Rm,OAuthTokensSchema:vm,OpenIdProviderDiscoveryMetadataSchema:_m,OpenIdProviderMetadataSchema:Tl},b0={},w0={};function $0(e,t){let r=e.slice(0,-6);b0[r]=t,w0[r]=(n)=>t.safeParse(n).success}for(let e of $N)$0(e,tN[e]);for(let[e,t]of Object.entries(RN))$0(e,t);var EN=Object.freeze(b0),zN=Object.freeze(w0);function PN(e){switch(e){case"initialize":case"notifications/initialized":return Sn(void 0);case"server/discover":return Sn(ya);default:return}}var R0=60000,TN=[Br,Yo,Kr,pn],kN=["inputResponses","requestState"];function Bb(e,t){let r=e.params;if(!ma(r))return{message:e,lifted:{}};let n=r._meta,o=ma(n)?TN.filter((c)=>(c in n)):[],s=t==="request"?kN.filter((c)=>(c in r)):[];if(o.length===0&&s.length===0)return{message:e,lifted:{}};let i={},a={...r};if(o.length>0&&ma(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 Kb(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 _a(e){return()=>e}var IN=_a(void 0);function Bm(e,t){return{...e,mcpReq:{...e.mcpReq,requestState:_a(t)}}}var E0;function Km(e,t){E0(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{E0=(e,t)=>{e._negotiatedProtocolVersion=t}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??Vc,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),ha(o)||Zl(o))this._onresponse(o);else if(rr(o))this._onrequest(o,s);else if(wn(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}=Bb(e,"notification"),n=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)==="drop")return;if(t?.classification!==void 0){let i=Vb(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(Pm(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}=Bb(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=(y,_,g)=>{let S={jsonrpc:"2.0",id:r.id,error:{code:y,message:_,...g!==void 0&&{data:g}}};s?.send(S).catch((v)=>this._onerror(Error(`Failed to send an error response: ${v}`)))};if(t?.classification!==void 0){let y=Vb(t.classification);if(y!==o.era){this._onerror(Error(`Era mismatch on inbound request '${r.method}': classified as ${y} but this instance serves ${o.era}`));let _=t.classification.revision??y;i(X.UnsupportedProtocolVersion,`Unsupported protocol version: ${_}`,{supported:this._supportedProtocolVersions,requested:_});return}}if(zm(r.method)&&!o.hasRequestMethod(r.method)){i(X.MethodNotFound,"Method not found");return}let a=this._requestHandlers.get(r.method)??this.fallbackRequestHandler;if(a===void 0){i(X.MethodNotFound,"Method not found");return}let c=o.checkInboundEnvelope(n);if(c!==void 0){i(X.InvalidParams,c);return}let u=(y,_)=>this._notificationViaCodec(this._resolveOutboundCodec(y.method),y,{..._,relatedRequestId:r.id}),l=(y,_,g)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(y.method),y,_,{...g,relatedRequestId:r.id}),d=new AbortController;this._requestHandlerAbortControllers.set(r.id,d);let p=n.inputResponses===void 0?void 0:xN(n.inputResponses),f={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?IN:_a(n.requestState),signal:d.signal,send:(y,_,g)=>{let S=this._resolveOutboundCodec(y.method);if(this._assertOutboundRequestInEra(S,y.method),ds(_))return l(y,_,g);let v=Kb(S,y.method);if(v===void 0)throw TypeError(`'${y.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return l(y,v,_)},notify:u},http:t?.authInfo?{authInfo:t.authInfo}:void 0},h=this.buildContext(f,t);Promise.resolve().then(()=>a(r,h)).then(async(y)=>{if(d.signal.aborted)return;let _;try{_=o.encodeResult(r.method,y,this._outboundServerInfo())}catch(S){this._onerror(Error(`Failed to encode result for ${r.method}: ${S}`)),i(X.InternalError,"Internal error");return}let g={result:_,jsonrpc:"2.0",id:r.id};await s?.send(g)},async(y)=>{if(d.signal.aborted)return;let _=Number.isSafeInteger(y.code)?y.code:X.InternalError,g={jsonrpc:"2.0",id:r.id,error:{code:o.encodeErrorCode(_),message:y.message??"Internal error",...y.data!==void 0&&{data:y.data}}};await s?.send(g)}).catch((y)=>this._onerror(Error(`Failed to send response: ${y}`))).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),ha(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),ds(t))return this._requestWithSchemaViaCodec(n,e,t,r);let o=Kb(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 Sn(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=PN(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(zm(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 f=(R)=>{p(R)};if(!this._transport){f(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(R){f(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===ya&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,y=this._requestMessageId++;l=y;let _={...t,jsonrpc:"2.0",id:y};if(n?.onprogress)this._progressHandlers.set(y,n.onprogress),_.params={...t.params,_meta:{...t.params?._meta,progressToken:y}};let g=this._envelopeOutbound(_),S=!1,v=(R)=>{if(S)return;if(this._progressHandlers.delete(y),h===void 0)this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:y,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(y,(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(C){return p(C instanceof Error?C:Error(String(C)))}if(b.kind==="invalid")return p(b.error);if(b.kind==="input_required"){if(n?.allowInputRequired===!0)return d(CN(b));let C={codec:e,request:t,resultSchema:r,options:n,flowStartedAt:c,retry:(q,O)=>this._requestWithSchemaViaCodec(e,q===void 0?{method:t.method}:{method:t.method,params:q},r,O)};return d(this._resolveNonCompleteResult(b,C))}let E=b.result;vo(r,E).then((C)=>{if(C.success)d(C.data);else p(new Se(Te.InvalidResult,`Invalid result for ${t.method}: ${C.error}`))},p)}),u=()=>v(n?.signal?.reason),n?.signal?.addEventListener("abort",u,{once:!0});let w=n?.timeout??R0,z=()=>v(new Se(Te.RequestTimeout,"Request timed out",{timeout:w}));this._setupTimeout(y,w,n?.maxTotalTimeout,z,n?.resetTimeoutOnProgress??!1),this._transport.send(g,{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i,headers:a,requestSignal:h?.signal}).catch((R)=>{this._progressHandlers.delete(y),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(Pm(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(!zm(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(X.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 vo(t.params,{...o.params});if(!i.success)throw new de(X.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(!Pm(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(X.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 vo(t.params,{...n.params});if(!o.success)throw new de(X.InvalidParams,`Invalid params for notification ${e}: ${o.error}`);await r(o.data,n)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function ma(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function Ym(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]=ma(i)&&ma(s)?{...i,...s}:s}return r}function Wb(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function xN(e){let t={},r=[];if(!Wb(e))return{accepted:t,droppedKeys:r};for(let[n,o]of Object.entries(e)){if(!Wb(o)||"method"in o||"result"in o){r.push(n);continue}t[n]=o}return{accepted:t,droppedKeys:r}}function CN(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
|
|
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
|
|
53
|
-
`}var hN=/^[A-Za-z0-9._-]{1,128}$/;function gN(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(!hN.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 yN(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 Bm(e){let t=gN(e);return yN(e,t.warnings),t.isValid}function _N(e){return typeof e==="object"&&e!==null&&"_zod"in e}function vN(e){return typeof e==="object"&&e!==null&&!("_zod"in e)&&"_def"in e&&typeof e._def?.typeName==="string"}function SN(e){if(typeof e!=="object"||e===null)return!1;if(us(e))return!1;let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)return!1;return Object.values(e).every((r)=>_N(r))}function Hl(e){if(e===void 0)return;if(SN(e))return T(e);if(typeof e==="object"&&e!==null&&!us(e)&&Object.values(e).some((t)=>vN(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(!us(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 Zl=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=_}),gb=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;let t=Zl();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=Zl(),r=gb();var n=Zl();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=gb();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,x){return this}},i=class extends s{constructor(P,x,j){super();this.varKind=P,this.name=x,this.rhs=j}render({es5:P,_n:x}){let j=P?r.varKinds.var:this.varKind,W=this.rhs===void 0?"":` = ${this.rhs}`;return`${j} ${this.name}${W};`+x}optimizeNames(P,x){if(!P[this.name.str])return;if(this.rhs)this.rhs=Z(this.rhs,P,x);return this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},a=class extends s{constructor(P,x,j){super();this.lhs=P,this.rhs=x,this.sideEffects=j}render({_n:P}){return`${this.lhs} = ${this.rhs};`+P}optimizeNames(P,x){if(this.lhs instanceof t.Name&&!P[this.lhs.str]&&!this.sideEffects)return;return this.rhs=Z(this.rhs,P,x),this}get names(){return B(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}},c=class extends a{constructor(P,x,j,W){super(P,j,W);this.op=x}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,x){return this.code=Z(this.code,P,x),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((x,j)=>x+j.render(P),"")}optimizeNodes(){let{nodes:P}=this,x=P.length;while(x--){let j=P[x].optimizeNodes();if(Array.isArray(j))P.splice(x,1,...j);else if(j)P[x]=j;else P.splice(x,1)}return P.length>0?this:void 0}optimizeNames(P,x){let{nodes:j}=this,W=j.length;while(W--){let ue=j[W];if(ue.optimizeNames(P,x))continue;ge(P,ue.names),j.splice(W,1)}return j.length>0?this:void 0}get names(){return this.nodes.reduce((P,x)=>F(P,x.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(x,j){super(j);this.condition=x}render(x){let j=`if(${this.condition})`+super.render(x);if(this.else)j+="else "+this.else.render(x);return j}optimizeNodes(){super.optimizeNodes();let x=this.condition;if(x===!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(x===!1)return j instanceof P?j:j.nodes;if(this.nodes.length)return this;return new P(Ie(x),j instanceof P?[j]:j.nodes)}if(x===!1||!this.nodes.length)return;return this}optimizeNames(x,j){var W;if(this.else=(W=this.else)===null||W===void 0?void 0:W.optimizeNames(x,j),!(super.optimizeNames(x,j)||this.else))return;return this.condition=Z(this.condition,x,j),this}get names(){let x=super.names;if(B(x,this.condition),this.else)F(x,this.else.names);return x}};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,x){if(!super.optimizeNames(P,x))return;return this.iteration=Z(this.iteration,P,x),this}get names(){return F(super.names,this.iteration.names)}},w=class extends S{constructor(P,x,j,W){super();this.varKind=P,this.name=x,this.from=j,this.to=W}render(P){let x=P.es5?r.varKinds.var:this.varKind,{name:j,from:W,to:ue}=this;return`for(${x} ${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,x,j,W){super();this.loop=P,this.varKind=x,this.name=j,this.iterable=W}render(P){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(P)}optimizeNames(P,x){if(!super.optimizeNames(P,x))return;return this.iterable=Z(this.iterable,P,x),this}get names(){return F(super.names,this.iterable.names)}},R=class extends h{constructor(P,x,j){super();this.name=P,this.args=x,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 x="try"+super.render(P);if(this.catch)x+=this.catch.render(P);if(this.finally)x+=this.finally.render(P);return x}optimizeNodes(){var P,x;return super.optimizeNodes(),(P=this.catch)===null||P===void 0||P.optimizeNodes(),(x=this.finally)===null||x===void 0||x.optimizeNodes(),this}optimizeNames(P,x){var j,W;return super.optimizeNames(P,x),(j=this.catch)===null||j===void 0||j.optimizeNames(P,x),(W=this.finally)===null||W===void 0||W.optimizeNames(P,x),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}},O=class extends h{constructor(P){super();this.error=P}render(P){return`catch(${this.error})`+super.render(P)}};O.kind="catch";var q=class extends h{render(P){return"finally"+super.render(P)}};q.kind="finally";var C=class{constructor(P,x={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...x,_n:x.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,x){let j=this._extScope.value(P,x);return(this._values[j.prefix]||(this._values[j.prefix]=new Set)).add(j),j}getScopeValue(P,x){return this._extScope.getValue(P,x)}scopeRefs(P){return this._extScope.scopeRefs(P,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(P,x,j,W){let ue=this._scope.toName(x);if(j!==void 0&&W)this._constants[ue.str]=j;return this._leafNode(new i(P,ue,j)),ue}const(P,x,j){return this._def(r.varKinds.const,P,x,j)}let(P,x,j){return this._def(r.varKinds.let,P,x,j)}var(P,x,j){return this._def(r.varKinds.var,P,x,j)}assign(P,x,j){return this._leafNode(new a(P,x,j))}add(P,x){return this._leafNode(new c(P,e.operators.ADD,x))}code(P){if(typeof P=="function")P();else if(P!==t.nil)this._leafNode(new p(P));return this}object(...P){let x=["{"];for(let[j,W]of P){if(x.length>1)x.push(",");if(x.push(j),j!==W||this.opts.es5)x.push(":"),(0,t.addCodeArg)(x,W)}return x.push("}"),new t._Code(x)}if(P,x,j){if(this._blockNode(new y(P)),x&&j)this.code(x).else().code(j).endIf();else if(x)this.code(x).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,x){if(this._blockNode(P),x)this.code(x).endFor();return this}for(P,x){return this._for(new v(P),x)}forRange(P,x,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,x,j),()=>W(Ee))}forOf(P,x,j,W=r.varKinds.const){let ue=this._scope.toName(P);if(this.opts.es5){let Ee=x instanceof t.Name?x:this.var("_arr",x);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,x),()=>j(ue))}forIn(P,x,j,W=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(P,t._`Object.keys(${x})`,j);let ue=this._scope.toName(P);return this._for(new z("in",W,ue,x),()=>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 x=new b;if(this._blockNode(x),this.code(P),x.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(b)}try(P,x,j){if(!x&&!j)throw Error('CodeGen: "try" without "catch" and "finally"');let W=new E;if(this._blockNode(W),this.code(P),x){let ue=this.name("e");this._currNode=W.catch=new O(ue),x(ue)}if(j)this._currNode=W.finally=new q,this.code(j);return this._endBlockNode(O,q)}throw(P){return this._leafNode(new d(P))}block(P,x){if(this._blockStarts.push(this._nodes.length),P)this.code(P).endBlock(x);return this}endBlock(P){let x=this._blockStarts.pop();if(x===void 0)throw Error("CodeGen: not in self-balancing block");let j=this._nodes.length-x;if(j<0||P!==void 0&&j!==P)throw Error(`CodeGen: wrong number of nodes: ${j} vs ${P} expected`);return this._nodes.length=x,this}func(P,x=t.nil,j,W){if(this._blockNode(new R(P,x,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,x){let j=this._currNode;if(j instanceof P||x&&j instanceof x)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${x?`${P.kind}/${x.kind}`:P.kind}"`)}_elseNode(P){let x=this._currNode;if(!(x instanceof y))throw Error('CodeGen: "else" without "if"');return this._currNode=x.else=P,this}get _root(){return this._nodes[0]}get _currNode(){let P=this._nodes;return P[P.length-1]}set _currNode(P){let x=this._nodes;x[x.length-1]=P}};e.CodeGen=C;function F(P,x){for(let j in x)P[j]=(P[j]||0)+(x[j]||0);return P}function B(P,x){return x instanceof t._CodeOrName?F(P,x.names):P}function Z(P,x,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||x[Ee.str]!==1)return Ee;return delete x[Ee.str],ye}function ue(Ee){return Ee instanceof t._Code&&Ee._items.some((ye)=>ye instanceof t.Name&&x[ye.str]===1&&j[ye.str]!==void 0)}}function ge(P,x){for(let j in x)P[j]=(P[j]||0)-(x[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 k(...P){return P.reduce(Pe)}e.or=k;function M(P){return(x,j)=>x===t.nil?j:j===t.nil?x:t._`${K(x)} ${P} ${K(j)}`}function K(P){return P instanceof t.Name?P:t._`(${P})`}}),ke=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=Zl();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:O}=R;if(!E.strictSchema)return;if(typeof b==="boolean")return;let q=O.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,O,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)(O)}`}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:O}){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)?O(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((O)=>R.assign(t._`${b}${(0,t.getProperty)(O)}`,!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 O=b===v.Num;return E?O?t._`"[" + ${R} + "]"`:t._`"['" + ${R} + "']"`:O?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}),Jl=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=ke(),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:O,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(O)v.push([l.propertyName,O])}}),bN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;let t=Jl(),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)}}),yb=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}),_b=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}),Gl=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=yb(),r=_b(),n=Jl(),o=be(),s=ke();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),O=w.length>0&&!(E.length===0&&w.length===1&&(0,r.schemaHasRulesForType)(v,w[0]));if(O){let q=g(w,R,b.strictNumbers,i.Wrong);z.if(q,()=>{if(E.length)p(v,w,E);else y(v)})}return O}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,O=R.let("dataType",o._`typeof ${b}`),q=R.let("coerced",o._`undefined`);if(E.coerceTypes==="array")R.if(o._`${O} == 'object' && Array.isArray(${b}) && ${b}.length == 1`,()=>R.assign(b,o._`${b}[0]`).assign(O,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._`${O} == "number" || ${O} == "boolean"`).assign(q,o._`"" + ${b}`).elseIf(o._`${b} === null`).assign(q,o._`""`);return;case"number":R.elseIf(o._`${O} == "boolean" || ${b} === null
|
|
55
|
-
|| (${
|
|
56
|
-
|| (${
|
|
57
|
-
|| ${O} === "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=O(o._`!(${w} % 1) && !isNaN(${w})`);break;case"number":E=O();break;default:return o._`typeof ${w} ${b} ${v}`}return R===i.Correct?E:(0,o.not)(E);function O(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 O=o._`typeof ${w} != "object"`;b=E.null?O:o._`!${w} || ${O}`,delete E.null,delete E.array,delete E.object}else b=o.nil;if(E.number)delete E.integer;for(let O in E)b=(0,o.and)(b,h(O,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=ke();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=ke(),n=hr(),o=ke();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:O},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,O.parentData],[n.default.parentDataProperty,O.parentDataProperty],[n.default.rootData,n.default.rootData]];if(O.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 O(()=>w.assign(q,!1)),q}return w.var(E,!0),O(()=>w.break()),E;function O(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),O=w.name("_valid");w.block(()=>z.forEach((q,C)=>{let F=v.subschema({keyword:R,schemaProp:C,compositeRule:!0},O);if(w.assign(E,t._`${E} || ${O}`),!v.mergeValidEvaluated(F,O))w.if((0,t.not)(E))})),v.result(E,()=>v.reset(),()=>v.error(!0))}e.validateUnion=S}),wN=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=Jl();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?O():q();if(h.modifying)a(m);F(()=>c(m,B))}}function O(){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}),RN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendSubschemaMode=e.extendSubschemaData=e.getSubschema=void 0;let t=be(),r=ke();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}),vb=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}}),EN=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")}}),Kl=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getSchemaRefs=e.resolveUrl=e.normalizeId=e._getFullPath=e.getFullPath=e.inlineRef=void 0;let t=ke(),r=vb(),n=EN(),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 k=this.opts.uriResolver.resolve;if(Pe=p(Ie?k(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")O(C,M.schema,Pe);else if(Pe!==p(ge))if(Pe[0]==="#")O(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 O(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}),ps=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getData=e.KeywordCxt=e.validateFunctionCode=void 0;let t=bN(),r=Gl(),n=_b(),o=Gl(),s=$N(),i=wN(),a=RN(),c=be(),u=hr(),l=Kl(),d=ke(),p=Jl();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);O(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);O(I,we),fe.var(L,c._`${we} === ${u.default.errors}`)}function E(I){(0,d.checkUnknownRules)(I),q(I)}function O(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:zt,self:lt}=I,{RULES:We}=lt;if(we.$ref&&(zt.ignoreKeywordsWithRef||!(0,d.schemaHasRulesButRef)(we,We))){me.block(()=>Ee(I,"$ref",We.all.$ref.definition));return}if(!zt.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,zt.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(k(I,L),!I.opts.allowUnionTypes)M(I,L);K(I,I.dataTypes)}function k(I,L){if(!L.length)return;if(!I.dataTypes.length){I.dataTypes=L;return}L.forEach((H)=>{if(!x(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 x(I,L){return I.includes(L)||L==="integer"&&I.includes("number")}function j(I,L){let H=[];for(let fe of I.dataTypes)if(x(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",Nt(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 Nt(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(zt("property/index",We));return fe[L-We]}if(We>L)throw Error(zt("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 zt(lt,We){return`Cannot access ${lt} ${We} levels up, current level is ${L}`}}e.getData=Nt}),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}),fs=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Kl();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}),Bl=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=Kl(),s=ke(),i=ps();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 O=b.scopeName("validate");y.validateName=O;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:O,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(O,{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:O,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:O}=this.opts,q=E[O];if(q)z=(0,o.resolveUrl)(this.opts.uriResolver,z,q);return new a({schema:E,schemaId:O,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 O=v[(0,s.unescapeFragment)(E)];if(O===void 0)return;v=O;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}}),zN=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}}),Sb=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}}),PN=J((e,t)=>{let{isUUID:r}=Sb(),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,O]=b.resourceName.split("?");b.path=E&&E!=="/"?E:void 0,b.query=O,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 O=b.path.match(n);if(O){let q=E.scheme||b.scheme||"urn";b.nid=O[1].toLowerCase(),b.nss=O[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 O=E.scheme||b.scheme||"urn",q=b.nid.toLowerCase(),C=R(`${O}:${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 O=b;if(O.uuid=O.nss,O.nss=void 0,!E.tolerant&&(!O.uuid||!r(O.uuid)))O.error=O.error||"UUID is not valid.";return O}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}}),TN=J((e,t)=>{let{normalizeIPv6:r,removeDotSegments:n,recomposeAuthority:o,normalizeComponentEncoding:s,isIPv4:i,nonSimpleDomain:a}=Sb(),{SCHEMES:c,getSchemeHandler:u}=PN();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 O=w.path;if(!z.absolutePath&&(!b||!b.absolutePath))O=n(O);if(E===void 0&&O[0]==="/"&&O[1]==="/")O="/%2F"+O.slice(2);R.push(O)}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 O=r(z.host);z.host=O.host.toLowerCase(),R=O.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(O){z.error=z.error||"Host's domain name can not be converted to ASCII: "+O}}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}),IN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=TN();t.code='require("ajv/dist/runtime/uri").default',e.default=t}),Ym=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=ps();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=fs(),s=yb(),i=Bl(),a=be(),c=Kl(),u=Gl(),l=ke(),d=zN(),p=IN(),m=(k,M)=>new RegExp(k,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(k){var M,K,P,x,j,W,ue,Ee,ye,He,Nt,I,L,H,fe,me,we,ct,ft,zt,lt,We,er,gt,Fr;let pr=k.strict,Vr=(M=k.code)===null||M===void 0?void 0:M.optimize,Qr=Vr===!0||Vr===void 0?1:Vr||0,en=(P=(K=k.code)===null||K===void 0?void 0:K.regExp)!==null&&P!==void 0?P:m,Bn=(x=k.uriResolver)!==null&&x!==void 0?x:p.default;return{strictSchema:(W=(j=k.strictSchema)!==null&&j!==void 0?j:pr)!==null&&W!==void 0?W:!0,strictNumbers:(Ee=(ue=k.strictNumbers)!==null&&ue!==void 0?ue:pr)!==null&&Ee!==void 0?Ee:!0,strictTypes:(He=(ye=k.strictTypes)!==null&&ye!==void 0?ye:pr)!==null&&He!==void 0?He:"log",strictTuples:(I=(Nt=k.strictTuples)!==null&&Nt!==void 0?Nt:pr)!==null&&I!==void 0?I:"log",strictRequired:(H=(L=k.strictRequired)!==null&&L!==void 0?L:pr)!==null&&H!==void 0?H:!1,code:k.code?{...k.code,optimize:Qr,regExp:en}:{optimize:Qr,regExp:en},loopRequired:(fe=k.loopRequired)!==null&&fe!==void 0?fe:S,loopEnum:(me=k.loopEnum)!==null&&me!==void 0?me:S,meta:(we=k.meta)!==null&&we!==void 0?we:!0,messages:(ct=k.messages)!==null&&ct!==void 0?ct:!0,inlineRefs:(ft=k.inlineRefs)!==null&&ft!==void 0?ft:!0,schemaId:(zt=k.schemaId)!==null&&zt!==void 0?zt:"$id",addUsedSchema:(lt=k.addUsedSchema)!==null&<!==void 0?lt:!0,validateSchema:(We=k.validateSchema)!==null&&We!==void 0?We:!0,validateFormats:(er=k.validateFormats)!==null&&er!==void 0?er:!0,unicodeRegExp:(gt=k.unicodeRegExp)!==null&>!==void 0?gt:!0,int32range:(Fr=k.int32range)!==null&&Fr!==void 0?Fr:!0,uriResolver:Bn}}var w=class{constructor(k={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,k=this.opts={...k,...v(k)};let{es5:M,lines:K}=this.opts.code;this.scope=new a.ValueScope({scope:{},prefixes:g,es5:M,lines:K}),this.logger=F(k.logger);let P=k.validateFormats;if(k.validateFormats=!1,this.RULES=(0,s.getRules)(),z.call(this,_,k,"NOT SUPPORTED"),z.call(this,y,k,"DEPRECATED","warn"),this._metaOpts=q.call(this),k.formats)E.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),k.keywords)O.call(this,k.keywords);if(typeof k.meta=="object")this.addMetaSchema(k.meta);b.call(this),k.validateFormats=P}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:k,meta:M,schemaId:K}=this.opts,P=d;if(K==="id")P={...d},P.id=P.$id,delete P.$id;if(M&&k)this.addMetaSchema(P,P[K],!1)}defaultMeta(){let{meta:k,schemaId:M}=this.opts;return this.opts.defaultMeta=typeof k=="object"?k[M]||k:void 0}validate(k,M){let K;if(typeof k=="string"){if(K=this.getSchema(k),!K)throw Error(`no schema with key or ref "${k}"`)}else K=this.compile(k);let P=K(M);if(!("$async"in K))this.errors=K.errors;return P}compile(k,M){let K=this._addSchema(k,M);return K.validate||this._compileSchemaEnv(K)}compileAsync(k,M){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:K}=this.opts;return P.call(this,k,M);async function P(ye,He){await x.call(this,ye.$schema);let Nt=this._addSchema(ye,He);return Nt.validate||j.call(this,Nt)}async function x(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 x.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(k,M,K,P=this.opts.validateSchema){if(Array.isArray(k)){for(let j of k)this.addSchema(j,void 0,K,P);return this}let x;if(typeof k==="object"){let{schemaId:j}=this.opts;if(x=k[j],x!==void 0&&typeof x!="string")throw Error(`schema ${j} must be string`)}return M=(0,c.normalizeId)(M||x),this._checkUnique(M),this.schemas[M]=this._addSchema(k,K,M,P,!0),this}addMetaSchema(k,M,K=this.opts.validateSchema){return this.addSchema(k,M,!0,K),this}validateSchema(k,M){if(typeof k=="boolean")return!0;let K;if(K=k.$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,k);if(!P&&M){let x="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(x);else throw Error(x)}return P}getSchema(k){let M;while(typeof(M=R.call(this,k))=="string")k=M;if(M===void 0){let{schemaId:K}=this.opts,P=new i.SchemaEnv({schema:{},schemaId:K});if(M=i.resolveSchema.call(this,P,k),!M)return;this.refs[k]=M}return M.validate||this._compileSchemaEnv(M)}removeSchema(k){if(k instanceof RegExp)return this._removeAllSchemas(this.schemas,k),this._removeAllSchemas(this.refs,k),this;switch(typeof k){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let M=R.call(this,k);if(typeof M=="object")this._cache.delete(M.schema);return delete this.schemas[k],delete this.refs[k],this}case"object":{let M=k;this._cache.delete(M);let K=k[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(k){for(let M of k)this.addKeyword(M);return this}addKeyword(k,M){let K;if(typeof k=="string"){if(K=k,typeof M=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),M.keyword=K}else if(typeof k=="object"&&M===void 0){if(M=k,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,(x)=>ge.call(this,x)),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?(x)=>ge.call(this,x,P):(x)=>P.type.forEach((j)=>ge.call(this,x,P,j))),this}getKeyword(k){let M=this.RULES.all[k];return typeof M=="object"?M.definition:!!M}removeKeyword(k){let{RULES:M}=this;delete M.keywords[k],delete M.all[k];for(let K of M.rules){let P=K.rules.findIndex((x)=>x.keyword===k);if(P>=0)K.rules.splice(P,1)}return this}addFormat(k,M){if(typeof M=="string")M=new RegExp(M);return this.formats[k]=M,this}errorsText(k=this.errors,{separator:M=", ",dataVar:K="data"}={}){if(!k||k.length===0)return"No errors";return k.map((P)=>`${K}${P.instancePath} ${P.message}`).reduce((P,x)=>P+M+x)}$dataMetaSchema(k,M){let K=this.RULES.all;k=JSON.parse(JSON.stringify(k));for(let P of M){let x=P.split("/").slice(1),j=k;for(let W of x)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 k}_removeAllSchemas(k,M){for(let K in k){let P=k[K];if(!M||M.test(K)){if(typeof P=="string")delete k[K];else if(P&&!P.meta)this._cache.delete(P.schema),delete k[K]}}}_addSchema(k,M,K,P=this.opts.validateSchema,x=this.opts.addUsedSchema){let j,{schemaId:W}=this.opts;if(typeof k=="object")j=k[W];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof k!="boolean")throw Error("schema must be object or boolean");let ue=this._cache.get(k);if(ue!==void 0)return ue;K=(0,c.normalizeId)(j||K);let Ee=c.getSchemaRefs.call(this,k,K);if(ue=new i.SchemaEnv({schema:k,schemaId:W,meta:M,baseId:K,localRefs:Ee}),this._cache.set(ue.schema,ue),x&&!K.startsWith("#")){if(K)this._checkUnique(K);this.refs[K]=ue}if(P)this.validateSchema(k,!0);return ue}_checkUnique(k){if(this.schemas[k]||this.refs[k])throw Error(`schema with key or id "${k}" already exists`)}_compileSchemaEnv(k){if(k.meta)this._compileMetaSchema(k);else i.compileSchema.call(this,k);if(!k.validate)throw Error("ajv implementation error");return k.validate}_compileMetaSchema(k){let M=this.opts;this.opts=this._metaOpts;try{i.compileSchema.call(this,k)}finally{this.opts=M}}};w.ValidationError=n.default,w.MissingRefError=o.default,e.default=w;function z(k,M,K,P="error"){for(let x in k){let j=x;if(j in M)this.logger[P](`${K}: option ${x}. ${k[j]}`)}}function R(k){return k=(0,c.normalizeId)(k),this.schemas[k]||this.refs[k]}function b(){let k=this.opts.schemas;if(!k)return;if(Array.isArray(k))this.addSchema(k);else for(let M in k)this.addSchema(k[M],M)}function E(){for(let k in this.opts.formats){let M=this.opts.formats[k];if(M)this.addFormat(k,M)}}function O(k){if(Array.isArray(k)){this.addVocabulary(k);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let M in k){let K=k[M];if(!K.keyword)K.keyword=M;this.addKeyword(K)}}function q(){let k={...this.opts};for(let M of h)delete k[M];return k}let C={log(){},warn(){},error(){}};function F(k){if(k===!1)return C;if(k===void 0)return console;if(k.log&&k.warn&&k.error)return k;throw Error("logger must implement log, warn and error methods")}let B=/^[a-z_$][a-z0-9_$:-]*$/i;function Z(k,M){let{RULES:K}=this;if((0,l.eachItem)(k,(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(k,M,K){var P;let x=M===null||M===void 0?void 0:M.post;if(K&&x)throw Error('keyword with "post" flag cannot have "type"');let{RULES:j}=this,W=x?j.post:j.rules.find(({type:Ee})=>Ee===K);if(!W)W={type:K,rules:[]},j.rules.push(W);if(j.keywords[k]=!0,!M)return;let ue={keyword:k,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[k]=ue,(P=M.implements)===null||P===void 0||P.forEach((Ee)=>this.addKeyword(Ee))}function Ie(k,M,K){let P=k.rules.findIndex((x)=>x.keyword===K);if(P>=0)k.rules.splice(P,0,M);else k.rules.push(M),this.logger.warn(`rule ${K} is not defined`)}function Ae(k){let{metaSchema:M}=k;if(M===void 0)return;if(k.$data&&this.opts.$data)M=Pe(M);k.validateSchema=this.compile(M,!0)}let Ue={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Pe(k){return{anyOf:[k,Ue]}}});var xN=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}),Xm=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.callRef=e.getValidate=void 0;let t=fs(),r=gr(),n=be(),o=hr(),s=Bl(),i=ke(),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 O=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:O,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)},(O)=>{if(h.if(n._`!(${O} instanceof ${g.ValidationError})`,()=>h.throw(O)),R(O),!_)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 O=n._`${E}.errors`;h.assign(o.default.vErrors,n._`${o.default.vErrors} === null ? ${O} : ${o.default.vErrors}.concat(${O})`),h.assign(o.default.errors,n._`${o.default.vErrors}.length`)}function b(E){var O;if(!g.opts.unevaluated)return;let q=(O=p===null||p===void 0?void 0:p.validate)===null||O===void 0?void 0:O.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}),bb=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=xN(),r=Xm(),n=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",t.default,r.default];e.default=n}),kN=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}),ON=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}),CN=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'}),AN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r=ke(),n=CN(),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}),NN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=gr(),r=ke(),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}),jN=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}),qN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=gr(),r=be(),n=ke(),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}),MN=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}),Qm=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=vb();t.code='require("ajv/dist/runtime/equal").default',e.default=t}),LN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Gl(),r=be(),n=ke(),o=Qm(),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}),DN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r=ke(),n=Qm(),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}),UN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r=ke(),n=Qm(),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}),$b=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=kN(),r=ON(),n=AN(),o=NN(),s=jN(),i=qN(),a=MN(),c=LN(),u=DN(),l=UN(),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}),wb=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateAdditionalItems=void 0;let t=be(),r=ke(),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}),Rb=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateTuple=void 0;let t=be(),r=ke(),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}),FN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Rb(),r={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(n)=>(0,t.validateTuple)(n,"items")};e.default=r}),VN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r=ke(),n=gr(),o=wb(),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}),HN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r=ke(),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}),eh=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;let t=be(),r=ke(),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},
|
|
51
|
+
*/var ON=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,f,h;t.lastIndex=u;while(f=t.exec(c)){if(f.index!==u)throw TypeError("invalid parameter format");if(u+=f[0].length,p=f[1].toLowerCase(),h=f[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}}),t5=_c(ON(),1);var z0=10485760,Xm=class{_buffer;_maxBufferSize;constructor(e){this._maxBufferSize=e?.maxBufferSize??z0}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 P0(t)}catch(r){if(r instanceof SyntaxError)continue;throw r}}return null}clear(){this._buffer=void 0}};function P0(e){return Zi.parse(JSON.parse(e))}function Qm(e){return JSON.stringify(e)+`
|
|
53
|
+
`}var AN=/^[A-Za-z0-9._-]{1,128}$/;function NN(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(!AN.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 jN(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 eh(e){let t=NN(e);return jN(e,t.warnings),t.isValid}function qN(e){return typeof e==="object"&&e!==null&&"_zod"in e}function MN(e){return typeof e==="object"&&e!==null&&!("_zod"in e)&&"_def"in e&&typeof e._def?.typeName==="string"}function LN(e){if(typeof e!=="object"||e===null)return!1;if(ds(e))return!1;let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)return!1;return Object.values(e).every((r)=>qN(r))}function Jl(e){if(e===void 0)return;if(LN(e))return T(e);if(typeof e==="object"&&e!==null&&!ds(e)&&Object.values(e).some((t)=>MN(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(!ds(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 Bl=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(g){super();if(!e.IDENTIFIER.test(g))throw Error("CodeGen: name must be a valid identifier");this.str=g}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};e.Name=r;var n=class extends t{constructor(g){super();this._items=typeof g==="string"?[g]:g}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let g=this._items[0];return g===""||g==='""'}get str(){var g;return(g=this._str)!==null&&g!==void 0?g:this._str=this._items.reduce((S,v)=>`${S}${v}`,"")}get names(){var g;return(g=this._names)!==null&&g!==void 0?g: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(g,...S){let v=[g[0]],w=0;while(w<S.length)a(v,S[w]),v.push(g[++w]);return new n(v)}e._=o;let s=new n("+");function i(g,...S){let v=[f(g[0])],w=0;while(w<S.length)v.push(s),a(v,S[w]),v.push(s,f(g[++w]));return c(v),new n(v)}e.str=i;function a(g,S){if(S instanceof n)g.push(...S._items);else if(S instanceof r)g.push(S);else g.push(d(S))}e.addCodeArg=a;function c(g){let S=1;while(S<g.length-1){if(g[S]===s){let v=u(g[S-1],g[S+1]);if(v!==void 0){g.splice(S-1,3,v);continue}g[S++]="+"}S++}}function u(g,S){if(S==='""')return g;if(g==='""')return S;if(typeof g=="string"){if(S instanceof r||g[g.length-1]!=='"')return;if(typeof S!="string")return`${g.slice(0,-1)}${S}"`;if(S[0]==='"')return g.slice(0,-1)+S.slice(1);return}if(typeof S=="string"&&S[0]==='"'&&!(g instanceof r))return`"${g}${S.slice(1)}`}function l(g,S){return S.emptyStr()?g:g.emptyStr()?S:i`${g}${S}`}e.strConcat=l;function d(g){return typeof g=="number"||typeof g=="boolean"||g===null?g:f(Array.isArray(g)?g.join(","):g)}function p(g){return new n(f(g))}e.stringify=p;function f(g){return JSON.stringify(g).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=f;function h(g){return typeof g=="string"&&e.IDENTIFIER.test(g)?new n(`.${g}`):o`[${g}]`}e.getProperty=h;function y(g){if(typeof g=="string"&&e.IDENTIFIER.test(g))return new n(`${g}`);throw Error(`CodeGen: invalid export name: ${g}, use explicit $id name mapping`)}e.getEsmExportName=y;function _(g){return new n(g.toString())}e.regexpCode=_}),T0=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;let t=Bl();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,f=(l=u.key)!==null&&l!==void 0?l:u.ref,h=this._values[p];if(h){let g=h.get(f);if(g)return g}else h=this._values[p]=new Map;h.set(f,d);let y=this._scope[p]||(this._scope[p]=[]),_=y.length;return y[_]=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 f in c){let h=c[f];if(!h)continue;let y=l[f]=l[f]||new Map;h.forEach((_)=>{if(y.has(_))return;y.set(_,n.Started);let g=u(_);if(g){let S=this.opts.es5?e.varKinds.var:e.varKinds.const;p=t._`${p}${S} ${_} = ${g};${this.opts._n}`}else if(g=d===null||d===void 0?void 0:d(_))p=t._`${p}${g}${this.opts._n}`;else throw new r(_);y.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=Bl(),r=T0();var n=Bl();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=T0();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,I){return this}},i=class extends s{constructor(P,I,j){super();this.varKind=P,this.name=I,this.rhs=j}render({es5:P,_n:I}){let j=P?r.varKinds.var:this.varKind,W=this.rhs===void 0?"":` = ${this.rhs}`;return`${j} ${this.name}${W};`+I}optimizeNames(P,I){if(!P[this.name.str])return;if(this.rhs)this.rhs=G(this.rhs,P,I);return this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},a=class extends s{constructor(P,I,j){super();this.lhs=P,this.rhs=I,this.sideEffects=j}render({_n:P}){return`${this.lhs} = ${this.rhs};`+P}optimizeNames(P,I){if(this.lhs instanceof t.Name&&!P[this.lhs.str]&&!this.sideEffects)return;return this.rhs=G(this.rhs,P,I),this}get names(){return K(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}},c=class extends a{constructor(P,I,j,W){super(P,j,W);this.op=I}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,I){return this.code=G(this.code,P,I),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}},f=class extends s{constructor(P=[]){super();this.nodes=P}render(P){return this.nodes.reduce((I,j)=>I+j.render(P),"")}optimizeNodes(){let{nodes:P}=this,I=P.length;while(I--){let j=P[I].optimizeNodes();if(Array.isArray(j))P.splice(I,1,...j);else if(j)P[I]=j;else P.splice(I,1)}return P.length>0?this:void 0}optimizeNames(P,I){let{nodes:j}=this,W=j.length;while(W--){let ue=j[W];if(ue.optimizeNames(P,I))continue;ge(P,ue.names),j.splice(W,1)}return j.length>0?this:void 0}get names(){return this.nodes.reduce((P,I)=>F(P,I.names),{})}},h=class extends f{render(P){return"{"+P._n+super.render(P)+"}"+P._n}},y=class extends f{},_=class extends h{};_.kind="else";var g=class P extends h{constructor(I,j){super(j);this.condition=I}render(I){let j=`if(${this.condition})`+super.render(I);if(this.else)j+="else "+this.else.render(I);return j}optimizeNodes(){super.optimizeNodes();let I=this.condition;if(I===!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(I===!1)return j instanceof P?j:j.nodes;if(this.nodes.length)return this;return new P(ke(I),j instanceof P?[j]:j.nodes)}if(I===!1||!this.nodes.length)return;return this}optimizeNames(I,j){var W;if(this.else=(W=this.else)===null||W===void 0?void 0:W.optimizeNames(I,j),!(super.optimizeNames(I,j)||this.else))return;return this.condition=G(this.condition,I,j),this}get names(){let I=super.names;if(K(I,this.condition),this.else)F(I,this.else.names);return I}};g.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,I){if(!super.optimizeNames(P,I))return;return this.iteration=G(this.iteration,P,I),this}get names(){return F(super.names,this.iteration.names)}},w=class extends S{constructor(P,I,j,W){super();this.varKind=P,this.name=I,this.from=j,this.to=W}render(P){let I=P.es5?r.varKinds.var:this.varKind,{name:j,from:W,to:ue}=this;return`for(${I} ${j}=${W}; ${j}<${ue}; ${j}++)`+super.render(P)}get names(){return K(K(super.names,this.from),this.to)}},z=class extends S{constructor(P,I,j,W){super();this.loop=P,this.varKind=I,this.name=j,this.iterable=W}render(P){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(P)}optimizeNames(P,I){if(!super.optimizeNames(P,I))return;return this.iterable=G(this.iterable,P,I),this}get names(){return F(super.names,this.iterable.names)}},R=class extends h{constructor(P,I,j){super();this.name=P,this.args=I,this.async=j}render(P){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(P)}};R.kind="func";var b=class extends f{render(P){return"return "+super.render(P)}};b.kind="return";var E=class extends h{render(P){let I="try"+super.render(P);if(this.catch)I+=this.catch.render(P);if(this.finally)I+=this.finally.render(P);return I}optimizeNodes(){var P,I;return super.optimizeNodes(),(P=this.catch)===null||P===void 0||P.optimizeNodes(),(I=this.finally)===null||I===void 0||I.optimizeNodes(),this}optimizeNames(P,I){var j,W;return super.optimizeNames(P,I),(j=this.catch)===null||j===void 0||j.optimizeNames(P,I),(W=this.finally)===null||W===void 0||W.optimizeNames(P,I),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 O=class{constructor(P,I={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...I,_n:I.lines?`
|
|
54
|
+
`:""},this._extScope=P,this._scope=new r.Scope({parent:P}),this._nodes=[new y]}toString(){return this._root.render(this.opts)}name(P){return this._scope.name(P)}scopeName(P){return this._extScope.name(P)}scopeValue(P,I){let j=this._extScope.value(P,I);return(this._values[j.prefix]||(this._values[j.prefix]=new Set)).add(j),j}getScopeValue(P,I){return this._extScope.getValue(P,I)}scopeRefs(P){return this._extScope.scopeRefs(P,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(P,I,j,W){let ue=this._scope.toName(I);if(j!==void 0&&W)this._constants[ue.str]=j;return this._leafNode(new i(P,ue,j)),ue}const(P,I,j){return this._def(r.varKinds.const,P,I,j)}let(P,I,j){return this._def(r.varKinds.let,P,I,j)}var(P,I,j){return this._def(r.varKinds.var,P,I,j)}assign(P,I,j){return this._leafNode(new a(P,I,j))}add(P,I){return this._leafNode(new c(P,e.operators.ADD,I))}code(P){if(typeof P=="function")P();else if(P!==t.nil)this._leafNode(new p(P));return this}object(...P){let I=["{"];for(let[j,W]of P){if(I.length>1)I.push(",");if(I.push(j),j!==W||this.opts.es5)I.push(":"),(0,t.addCodeArg)(I,W)}return I.push("}"),new t._Code(I)}if(P,I,j){if(this._blockNode(new g(P)),I&&j)this.code(I).else().code(j).endIf();else if(I)this.code(I).endIf();else if(j)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(P){return this._elseNode(new g(P))}else(){return this._elseNode(new _)}endIf(){return this._endBlockNode(g,_)}_for(P,I){if(this._blockNode(P),I)this.code(I).endFor();return this}for(P,I){return this._for(new v(P),I)}forRange(P,I,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,I,j),()=>W(Ee))}forOf(P,I,j,W=r.varKinds.const){let ue=this._scope.toName(P);if(this.opts.es5){let Ee=I instanceof t.Name?I:this.var("_arr",I);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,I),()=>j(ue))}forIn(P,I,j,W=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(P,t._`Object.keys(${I})`,j);let ue=this._scope.toName(P);return this._for(new z("in",W,ue,I),()=>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 I=new b;if(this._blockNode(I),this.code(P),I.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(b)}try(P,I,j){if(!I&&!j)throw Error('CodeGen: "try" without "catch" and "finally"');let W=new E;if(this._blockNode(W),this.code(P),I){let ue=this.name("e");this._currNode=W.catch=new C(ue),I(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,I){if(this._blockStarts.push(this._nodes.length),P)this.code(P).endBlock(I);return this}endBlock(P){let I=this._blockStarts.pop();if(I===void 0)throw Error("CodeGen: not in self-balancing block");let j=this._nodes.length-I;if(j<0||P!==void 0&&j!==P)throw Error(`CodeGen: wrong number of nodes: ${j} vs ${P} expected`);return this._nodes.length=I,this}func(P,I=t.nil,j,W){if(this._blockNode(new R(P,I,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,I){let j=this._currNode;if(j instanceof P||I&&j instanceof I)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${I?`${P.kind}/${I.kind}`:P.kind}"`)}_elseNode(P){let I=this._currNode;if(!(I instanceof g))throw Error('CodeGen: "else" without "if"');return this._currNode=I.else=P,this}get _root(){return this._nodes[0]}get _currNode(){let P=this._nodes;return P[P.length-1]}set _currNode(P){let I=this._nodes;I[I.length-1]=P}};e.CodeGen=O;function F(P,I){for(let j in I)P[j]=(P[j]||0)+(I[j]||0);return P}function K(P,I){return I instanceof t._CodeOrName?F(P,I.names):P}function G(P,I,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||I[Ee.str]!==1)return Ee;return delete I[Ee.str],ye}function ue(Ee){return Ee instanceof t._Code&&Ee._items.some((ye)=>ye instanceof t.Name&&I[ye.str]===1&&j[ye.str]!==void 0)}}function ge(P,I){for(let j in I)P[j]=(P[j]||0)-(I[j]||0)}function ke(P){return typeof P=="boolean"||typeof P=="number"||P===null?!P:t._`!${B(P)}`}e.not=ke;let Ne=M(e.operators.AND);function Fe(...P){return P.reduce(Ne)}e.and=Fe;let Pe=M(e.operators.OR);function x(...P){return P.reduce(Pe)}e.or=x;function M(P){return(I,j)=>I===t.nil?j:j===t.nil?I:t._`${B(I)} ${P} ${B(j)}`}function B(P){return P instanceof t.Name?P:t._`(${P})`}}),xe=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=Bl();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:C}=R;if(!E.strictSchema)return;if(typeof b==="boolean")return;let q=C.RULES.keywords;for(let O in b)if(!q[O])z(R,`unknown keyword: "${O}"`)}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 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 f(R,b){if(Array.isArray(R))for(let E of R)b(E);else b(R)}e.eachItem=f;function h({mergeNames:R,mergeToName:b,mergeValues:E,resultToName:C}){return(q,O,F,K)=>{let G=F===void 0?O:F instanceof t.Name?(O instanceof t.Name?R(q,O,F):b(q,O,F),F):O instanceof t.Name?(b(q,F,O),O):E(O,F);return K===t.Name&&!(G instanceof t.Name)?C(q,G):G}}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:y}),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 y(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=y;function _(R,b,E){Object.keys(E).forEach((C)=>R.assign(t._`${b}${(0,t.getProperty)(C)}`,!0))}e.setEvaluated=_;let g={};function S(R,b){return R.scopeValue("func",{ref:b,code:g[b.code]||(g[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}),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}),Wl=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=xe(),n=hr();e.keywordError={message:({keyword:_})=>t.str`must pass "${_}" keyword validation`},e.keyword$DataError={message:({keyword:_,schemaType:g})=>g?t.str`"${_}" keyword must be ${g} ($data)`:t.str`"${_}" keyword is invalid ($data)`};function o(_,g=e.keywordError,S,v){let{it:w}=_,{gen:z,compositeRule:R,allErrors:b}=w,E=d(_,g,S);if(v!==null&&v!==void 0?v:R||b)c(z,E);else u(w,t._`[${E}]`)}e.reportError=o;function s(_,g=e.keywordError,S){let{it:v}=_,{gen:w,compositeRule:z,allErrors:R}=v;if(c(w,d(_,g,S)),!(z||R))u(v,n.default.vErrors)}e.reportExtraError=s;function i(_,g){_.assign(n.default.errors,g),_.if(t._`${n.default.vErrors} !== null`,()=>_.if(g,()=>_.assign(t._`${n.default.vErrors}.length`,g),()=>_.assign(n.default.vErrors,null)))}e.resetErrorsCount=i;function a({gen:_,keyword:g,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}/${g}`),z.opts.verbose)_.assign(t._`${R}.schema`,S),_.assign(t._`${R}.data`,v)})}e.extendErrors=a;function c(_,g){let S=_.const("err",g);_.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(_,g){let{gen:S,validateName:v,schemaEnv:w}=_;if(w.$async)S.throw(t._`new ${_.ValidationError}(${g})`);else S.assign(t._`${v}.errors`,g),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(_,g,S){let{createErrors:v}=_.it;if(v===!1)return t._`{}`;return p(_,g,S)}function p(_,g,S={}){let{gen:v,it:w}=_,z=[f(w,S),h(_,S)];return y(_,g,z),v.object(...z)}function f({errorPath:_},{instancePath:g}){let S=g?t.str`${_}${(0,r.getErrorPath)(g,r.Type.Str)}`:_;return[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,S)]}function h({keyword:_,it:{errSchemaPath:g}},{schemaPath:S,parentSchema:v}){let w=v?g:t.str`${g}/${_}`;if(S)w=t.str`${w}${(0,r.getErrorPath)(S,r.Type.Str)}`;return[l.schemaPath,w]}function y(_,{params:g,message:S},v){let{keyword:w,data:z,schemaValue:R,it:b}=_,{opts:E,propertyName:C,topSchemaRef:q,schemaPath:O}=b;if(v.push([l.keyword,w],[l.params,typeof g=="function"?g(_):g||t._`{}`]),E.messages)v.push([l.message,typeof S=="function"?S(_):S]);if(E.verbose)v.push([l.schema,R],[l.parentSchema,t._`${q}${O}`],[n.default.data,z]);if(C)v.push([l.propertyName,C])}}),DN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;let t=Wl(),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)}}),k0=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}),I0=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}),Kl=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=k0(),r=I0(),n=Wl(),o=be(),s=xe();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=y(w,R,b.strictNumbers,i.Wrong);z.if(q,()=>{if(E.length)p(v,w,E);else g(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 p(v,w,z){let{gen:R,data:b,opts:E}=v,C=R.let("dataType",o._`typeof ${b}`),q=R.let("coerced",o._`undefined`);if(E.coerceTypes==="array")R.if(o._`${C} == 'object' && Array.isArray(${b}) && ${b}.length == 1`,()=>R.assign(b,o._`${b}[0]`).assign(C,o._`typeof ${b}`).if(y(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")O(F);R.else(),g(v),R.endIf(),R.if(o._`${q} !== undefined`,()=>{R.assign(b,q),f(v,q)});function O(F){switch(F){case"string":R.elseIf(o._`${C} == "number" || ${C} == "boolean"`).assign(q,o._`"" + ${b}`).elseIf(o._`${b} === null`).assign(q,o._`""`);return;case"number":R.elseIf(o._`${C} == "boolean" || ${b} === null
|
|
55
|
+
|| (${C} == "string" && ${b} && ${b} == +${b})`).assign(q,o._`+${b}`);return;case"integer":R.elseIf(o._`${C} === "boolean" || ${b} === null
|
|
56
|
+
|| (${C} === "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._`${C} === "string" || ${C} === "number"
|
|
57
|
+
|| ${C} === "boolean" || ${b} === null`).assign(q,o._`[${b}]`)}}}function f({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=C(o._`!(${w} % 1) && !isNaN(${w})`);break;case"number":E=C();break;default:return o._`typeof ${w} ${b} ${v}`}return R===i.Correct?E:(0,o.not)(E);function C(q=o.nil){return(0,o.and)(o._`typeof ${w} == "number"`,q,z?o._`isFinite(${w})`:o.nil)}}e.checkDataType=h;function y(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=o._`typeof ${w} != "object"`;b=E.null?C:o._`!${w} || ${C}`,delete E.null,delete E.array,delete E.object}else b=o.nil;if(E.number)delete E.integer;for(let C in E)b=(0,o.and)(b,h(C,w,z,R));return b}e.checkDataTypes=y;let _={message:({schema:v})=>`must be ${v}`,params:({schema:v,schemaValue:w})=>typeof v=="string"?o._`{type: ${v}}`:o._`{type: ${w}}`};function g(v){let w=S(v);(0,n.reportError)(w,_)}e.reportTypeError=g;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}}}),UN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.assignDefaults=void 0;let t=be(),r=xe();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 f=t._`${p} === undefined`;if(d.useDefaults==="empty")f=t._`${f} || ${p} === null || ${p} === ""`;c.if(f,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=xe(),n=hr(),o=xe();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 f(v,w){return p(w).filter((z)=>!(0,r.alwaysValidSchema)(v,w[z]))}e.schemaProperties=f;function h({schemaCode:v,data:w,it:{gen:z,topSchemaRef:R,schemaPath:b,errorPath:E},it:C},q,O,F){let K=F?t._`${v}, ${w}, ${R}${b}`:w,G=[[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,E)],[n.default.parentData,C.parentData],[n.default.parentDataProperty,C.parentDataProperty],[n.default.rootData,n.default.rootData]];if(C.opts.dynamicRef)G.push([n.default.dynamicAnchors,n.default.dynamicAnchors]);let ge=t._`${K}, ${z.object(...G)}`;return O!==t.nil?t._`${q}.call(${O}, ${ge})`:t._`${q}(${ge})`}e.callValidateCode=h;let y=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"?y:(0,o.useFunc)(v,b)}(${z}, ${R})`})}e.usePattern=_;function g(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 O=w.const("len",t._`${z}.length`);w.forRange("i",0,O,(F)=>{v.subschema({keyword:R,dataProp:F,dataPropType:r.Type.Num},E),w.if((0,t.not)(E),q)})}}e.validateArray=g;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,O)=>{let F=v.subschema({keyword:R,schemaProp:O,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}),FN=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=Wl();function s(f,h){let{gen:y,keyword:_,schema:g,parentSchema:S,it:v}=f,w=h.macro.call(v.self,g,S,v),z=l(y,_,w);if(v.opts.validateSchema!==!1)v.self.validateSchema(w,!0);let R=y.name("valid");f.subschema({schema:w,schemaPath:t.nil,errSchemaPath:`${v.errSchemaPath}/${_}`,topSchemaRef:z,compositeRule:!0},R),f.pass(R,()=>f.error(!0))}e.macroKeywordCode=s;function i(f,h){var y;let{gen:_,keyword:g,schema:S,parentSchema:v,$data:w,it:z}=f;u(z,h);let R=l(_,g,!w&&h.compile?h.compile.call(z.self,S,v,z):h.validate),b=_.let("valid");f.block$data(b,E),f.ok((y=h.valid)!==null&&y!==void 0?y:b);function E(){if(h.errors===!1){if(O(),h.modifying)a(f);F(()=>f.error())}else{let K=h.async?C():q();if(h.modifying)a(f);F(()=>c(f,K))}}function C(){let K=_.let("ruleErrs",null);return _.try(()=>O(t._`await `),(G)=>_.assign(b,!1).if(t._`${G} instanceof ${z.ValidationError}`,()=>_.assign(K,t._`${G}.errors`),()=>_.throw(G))),K}function q(){let K=t._`${R}.errors`;return _.assign(K,null),O(t.nil),K}function O(K=h.async?t._`await `:t.nil){let G=z.opts.passContext?r.default.this:r.default.self,ge=!(("compile"in h)&&!w||h.schema===!1);_.assign(b,t._`${K}${(0,n.callValidateCode)(f,R,G,ge)}`,h.modifying)}function F(K){var G;_.if((0,t.not)((G=h.valid)!==null&&G!==void 0?G:b),K)}}e.funcKeywordCode=i;function a(f){let{gen:h,data:y,it:_}=f;h.if(_.parentData,()=>h.assign(y,t._`${_.parentData}[${_.parentDataProperty}]`))}function c(f,h){let{gen:y}=f;y.if(t._`Array.isArray(${h})`,()=>{y.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)(f)},()=>f.error())}function u({schemaEnv:f},h){if(h.async&&!f.$async)throw Error("async keyword in sync schema")}function l(f,h,y){if(y===void 0)throw Error(`keyword "${h}" failed to compile`);return f.scopeValue("keyword",typeof y=="function"?{ref:y}:{ref:y,code:(0,t.stringify)(y)})}function d(f,h,y=!1){return!h.length||h.some((_)=>_==="array"?Array.isArray(f):_==="object"?f&&typeof f=="object"&&!Array.isArray(f):typeof f==_||y&&typeof f>"u")}e.validSchemaType=d;function p({schema:f,opts:h,self:y,errSchemaPath:_},g,S){if(Array.isArray(g.keyword)?!g.keyword.includes(S):g.keyword!==S)throw Error("ajv implementation error");let v=g.dependencies;if(v===null||v===void 0?void 0:v.some((w)=>!Object.prototype.hasOwnProperty.call(f,w)))throw Error(`parent schema must have dependencies of ${S}: ${v.join(",")}`);if(g.validateSchema){if(!g.validateSchema(f[S])){let w=`keyword "${S}" value is invalid at path "${_}": `+y.errorsText(g.validateSchema.errors);if(h.validateSchema==="log")y.logger.error(w);else throw Error(w)}}}e.validateKeywordUsage=p}),VN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendSubschemaMode=e.extendSubschemaData=e.getSubschema=void 0;let t=be(),r=xe();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 f=i.schema[a];return c===void 0?{schema:f,schemaPath:t._`${i.schemaPath}${(0,t.getProperty)(a)}`,errSchemaPath:`${i.errSchemaPath}/${a}`}:{schema:f[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:f}=a;if(c!==void 0){let{errorPath:y,dataPathArr:_,opts:g}=a;h(f.let("data",t._`${a.data}${(0,t.getProperty)(c)}`,!0)),i.errorPath=t.str`${y}${(0,r.getErrorPath)(c,u,g.jsPropertySyntax)}`,i.parentDataProperty=t._`${c}`,i.dataPathArr=[..._,i.parentDataProperty]}if(l!==void 0){if(h(l instanceof t.Name?l:f.let("data",l,!0)),p!==void 0)i.propertyName=p}if(d)i.dataTypes=d;function h(y){i.data=y,i.dataLevel=a.dataLevel+1,i.dataTypes=[],a.definedProperties=new Set,i.parentData=a.data,i.dataNames=[...a.dataNames,y]}}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}),x0=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}}),HN=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,f,h){if(c&&typeof c=="object"&&!Array.isArray(c)){i(c,u,l,d,p,f,h);for(var y in c){var _=c[y];if(Array.isArray(_)){if(y in r.arrayKeywords)for(var g=0;g<_.length;g++)n(s,i,a,_[g],u+"/"+y+"/"+g,l,u,y,c,g)}else if(y in r.propsKeywords){if(_&&typeof _=="object")for(var S in _)n(s,i,a,_[S],u+"/"+y+"/"+o(S),l,u,y,c,S)}else if(y in r.keywords||s.allKeys&&!(y in r.skipKeywords))n(s,i,a,_,u+"/"+y,l,u,y,c)}a(c,u,l,d,p,f,h)}}function o(s){return s.replace(/~/g,"~0").replace(/\//g,"~1")}}),Yl=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getSchemaRefs=e.resolveUrl=e.normalizeId=e._getFullPath=e.getFullPath=e.inlineRef=void 0;let t=xe(),r=x0(),n=HN(),o=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function s(_,g=!0){if(typeof _=="boolean")return!0;if(g===!0)return!a(_);if(!g)return!1;return c(_)<=g}e.inlineRef=s;let i=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function a(_){for(let g in _){if(i.has(g))return!0;let S=_[g];if(Array.isArray(S)&&S.some(a))return!0;if(typeof S=="object"&&a(S))return!0}return!1}function c(_){let g=0;for(let S in _){if(S==="$ref")return 1/0;if(g++,o.has(S))continue;if(typeof _[S]=="object")(0,t.eachItem)(_[S],(v)=>g+=c(v));if(g===1/0)return 1/0}return g}function u(_,g="",S){if(S!==!1)g=p(g);return l(_,_.parse(g))}e.getFullPath=u;function l(_,g){return _.serialize(g).split("#")[0]+"#"}e._getFullPath=l;let d=/#\/?$/;function p(_){return _?_.replace(d,""):""}e.normalizeId=p;function f(_,g,S){return S=p(S),_.resolve(g,S)}e.resolveUrl=f;let h=/^[a-z_][-a-z0-9._]*$/i;function y(_,g){if(typeof _=="boolean")return{};let{schemaId:S,uriResolver:v}=this.opts,w=p(_[S]||g),z={"":w},R=u(v,w,!1),b={},E=new Set;return n(_,{allKeys:!0},(O,F,K,G)=>{if(G===void 0)return;let ge=R+F,ke=z[G];if(typeof O[S]=="string")ke=Ne.call(this,O[S]);Fe.call(this,O.$anchor),Fe.call(this,O.$dynamicAnchor),z[F]=ke;function Ne(Pe){let x=this.opts.uriResolver.resolve;if(Pe=p(ke?x(ke,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(O,M.schema,Pe);else if(Pe!==p(ge))if(Pe[0]==="#")C(O,b[Pe],Pe),b[Pe]=O;else this.refs[Pe]=ge;return Pe}function Fe(Pe){if(typeof Pe=="string"){if(!h.test(Pe))throw Error(`invalid anchor "${Pe}"`);Ne.call(this,`#${Pe}`)}}}),b;function C(O,F,K){if(F!==void 0&&!r(O,F))throw q(K)}function q(O){return Error(`reference "${O}" resolves to more than one schema`)}}e.getSchemaRefs=y}),ms=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getData=e.KeywordCxt=e.validateFunctionCode=void 0;let t=DN(),r=Kl(),n=I0(),o=Kl(),s=UN(),i=FN(),a=VN(),c=be(),u=hr(),l=Yl(),d=xe(),p=Wl();function f(k){if(R(k)){if(E(k),z(k)){g(k);return}}h(k,()=>(0,t.topBoolOrEmptySchema)(k))}e.validateFunctionCode=f;function h({gen:k,validateName:L,schema:H,schemaEnv:fe,opts:me},$e){if(me.code.es5)k.func(L,c._`${u.default.data}, ${u.default.valCxt}`,fe.$async,()=>{k.code(c._`"use strict"; ${v(H,me)}`),_(k,me),k.code($e)});else k.func(L,c._`${u.default.data}, ${y(me)}`,fe.$async,()=>k.code(v(H,me)).code($e))}function y(k){return c._`{${u.default.instancePath}="", ${u.default.parentData}, ${u.default.parentDataProperty}, ${u.default.rootData}=${u.default.data}${k.dynamicRef?c._`, ${u.default.dynamicAnchors}={}`:c.nil}}={}`}function _(k,L){k.if(u.default.valCxt,()=>{if(k.var(u.default.instancePath,c._`${u.default.valCxt}.${u.default.instancePath}`),k.var(u.default.parentData,c._`${u.default.valCxt}.${u.default.parentData}`),k.var(u.default.parentDataProperty,c._`${u.default.valCxt}.${u.default.parentDataProperty}`),k.var(u.default.rootData,c._`${u.default.valCxt}.${u.default.rootData}`),L.dynamicRef)k.var(u.default.dynamicAnchors,c._`${u.default.valCxt}.${u.default.dynamicAnchors}`)},()=>{if(k.var(u.default.instancePath,c._`""`),k.var(u.default.parentData,c._`undefined`),k.var(u.default.parentDataProperty,c._`undefined`),k.var(u.default.rootData,u.default.data),L.dynamicRef)k.var(u.default.dynamicAnchors,c._`{}`)})}function g(k){let{schema:L,opts:H,gen:fe}=k;h(k,()=>{if(H.$comment&&L.$comment)G(k);if(O(k),fe.let(u.default.vErrors,null),fe.let(u.default.errors,0),H.unevaluated)S(k);C(k),ge(k)})}function S(k){let{gen:L,validateName:H}=k;k.evaluated=L.const("evaluated",c._`${H}.evaluated`),L.if(c._`${k.evaluated}.dynamicProps`,()=>L.assign(c._`${k.evaluated}.props`,c._`undefined`)),L.if(c._`${k.evaluated}.dynamicItems`,()=>L.assign(c._`${k.evaluated}.items`,c._`undefined`))}function v(k,L){let H=typeof k=="object"&&k[L.schemaId];return H&&(L.code.source||L.code.process)?c._`/*# sourceURL=${H} */`:c.nil}function w(k,L){if(R(k)){if(E(k),z(k)){b(k,L);return}}(0,t.boolOrEmptySchema)(k,L)}function z({schema:k,self:L}){if(typeof k=="boolean")return!k;for(let H in k)if(L.RULES.all[H])return!0;return!1}function R(k){return typeof k.schema!="boolean"}function b(k,L){let{schema:H,gen:fe,opts:me}=k;if(me.$comment&&H.$comment)G(k);F(k),K(k);let $e=fe.const("_errs",u.default.errors);C(k,$e),fe.var(L,c._`${$e} === ${u.default.errors}`)}function E(k){(0,d.checkUnknownRules)(k),q(k)}function C(k,L){if(k.opts.jtd)return Ne(k,[],!1,L);let H=(0,r.getSchemaTypes)(k.schema);Ne(k,H,!(0,r.coerceAndCheckDataType)(k,H),L)}function q(k){let{schema:L,errSchemaPath:H,opts:fe,self:me}=k;if(L.$ref&&fe.ignoreKeywordsWithRef&&(0,d.schemaHasRulesButRef)(L,me.RULES))me.logger.warn(`$ref: keywords ignored in schema at path "${H}"`)}function O(k){let{schema:L,opts:H}=k;if(L.default!==void 0&&H.useDefaults&&H.strictSchema)(0,d.checkStrictMode)(k,"default is ignored in the schema root")}function F(k){let L=k.schema[k.opts.schemaId];if(L)k.baseId=(0,l.resolveUrl)(k.opts.uriResolver,k.baseId,L)}function K(k){if(k.schema.$async&&!k.schemaEnv.$async)throw Error("async schema in sync schema")}function G({gen:k,schemaEnv:L,schema:H,errSchemaPath:fe,opts:me}){let $e=H.$comment;if(me.$comment===!0)k.code(c._`${u.default.self}.logger.log(${$e})`);else if(typeof me.$comment=="function"){let ut=c.str`${fe}/$comment`,mt=k.scopeValue("root",{ref:L.root});k.code(c._`${u.default.self}.opts.$comment(${$e}, ${ut}, ${mt}.schema)`)}}function ge(k){let{gen:L,schemaEnv:H,validateName:fe,ValidationError:me,opts:$e}=k;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),$e.unevaluated)ke(k);L.return(c._`${u.default.errors} === 0`)}}function ke({gen:k,evaluated:L,props:H,items:fe}){if(H instanceof c.Name)k.assign(c._`${L}.props`,H);if(fe instanceof c.Name)k.assign(c._`${L}.items`,fe)}function Ne(k,L,H,fe){let{gen:me,schema:$e,data:ut,allErrors:mt,opts:zt,self:dt}=k,{RULES:Xe}=dt;if($e.$ref&&(zt.ignoreKeywordsWithRef||!(0,d.schemaHasRulesButRef)($e,Xe))){me.block(()=>Ee(k,"$ref",Xe.all.$ref.definition));return}if(!zt.jtd)Pe(k,L);me.block(()=>{for(let yt of Xe.rules)er(yt);er(Xe.post)});function er(yt){if(!(0,n.shouldUseGroup)($e,yt))return;if(yt.type){if(me.if((0,o.checkDataType)(yt.type,ut,zt.strictNumbers)),Fe(k,yt),L.length===1&&L[0]===yt.type&&H)me.else(),(0,o.reportTypeError)(k);me.endIf()}else Fe(k,yt);if(!mt)me.if(c._`${u.default.errors} === ${fe||0}`)}}function Fe(k,L){let{gen:H,schema:fe,opts:{useDefaults:me}}=k;if(me)(0,s.assignDefaults)(k,L.type);H.block(()=>{for(let $e of L.rules)if((0,n.shouldUseRule)(fe,$e))Ee(k,$e.keyword,$e.definition,L.type)})}function Pe(k,L){if(k.schemaEnv.meta||!k.opts.strictTypes)return;if(x(k,L),!k.opts.allowUnionTypes)M(k,L);B(k,k.dataTypes)}function x(k,L){if(!L.length)return;if(!k.dataTypes.length){k.dataTypes=L;return}L.forEach((H)=>{if(!I(k.dataTypes,H))W(k,`type "${H}" not allowed by context "${k.dataTypes.join(",")}"`)}),j(k,L)}function M(k,L){if(L.length>1&&!(L.length===2&&L.includes("null")))W(k,"use allowUnionTypes to allow union type keyword")}function B(k,L){let H=k.self.RULES.all;for(let fe in H){let me=H[fe];if(typeof me=="object"&&(0,n.shouldUseRule)(k.schema,me)){let{type:$e}=me.definition;if($e.length&&!$e.some((ut)=>P(L,ut)))W(k,`missing type "${$e.join(",")}" for keyword "${fe}"`)}}}function P(k,L){return k.includes(L)||L==="number"&&k.includes("integer")}function I(k,L){return k.includes(L)||L==="integer"&&k.includes("number")}function j(k,L){let H=[];for(let fe of k.dataTypes)if(I(L,fe))H.push(fe);else if(L.includes("integer")&&fe==="number")H.push("integer");k.dataTypes=H}function W(k,L){let H=k.schemaEnv.baseId+k.errSchemaPath;L+=` at "${H}" (strictTypes)`,(0,d.checkStrictMode)(k,L,k.opts.strictTypes)}var ue=class{constructor(k,L,H){if((0,i.validateKeywordUsage)(k,L,H),this.gen=k.gen,this.allErrors=k.allErrors,this.keyword=H,this.data=k.data,this.schema=k.schema[H],this.$data=L.$data&&k.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,d.schemaRefOrVal)(k,this.schema,H,this.$data),this.schemaType=L.schemaType,this.parentSchema=k.schema,this.params={},this.it=k,this.def=L,this.$data)this.schemaCode=k.gen.const("vSchema",Nt(this.$data,k));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=k.gen.const("_errs",u.default.errors)}result(k,L,H){this.failResult((0,c.not)(k),L,H)}failResult(k,L,H){if(this.gen.if(k),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(k,L){this.failResult((0,c.not)(k),void 0,L)}fail(k){if(k===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if(k),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(k){if(!this.$data)return this.fail(k);let{schemaCode:L}=this;this.fail(c._`${L} !== undefined && (${(0,c.or)(this.invalid$data(),k)})`)}error(k,L,H){if(L){this.setParams(L),this._error(k,H),this.setParams({});return}this._error(k,H)}_error(k,L){(k?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(k){if(!this.allErrors)this.gen.if(k)}setParams(k,L){if(L)Object.assign(this.params,k);else this.params=k}block$data(k,L,H=c.nil){this.gen.block(()=>{this.check$data(k,H),L()})}check$data(k=c.nil,L=c.nil){if(!this.$data)return;let{gen:H,schemaCode:fe,schemaType:me,def:$e}=this;if(H.if((0,c.or)(c._`${fe} === undefined`,L)),k!==c.nil)H.assign(k,!0);if(me.length||$e.validateSchema){if(H.elseIf(this.invalid$data()),this.$dataError(),k!==c.nil)H.assign(k,!1)}H.else()}invalid$data(){let{gen:k,schemaCode:L,schemaType:H,def:fe,it:me}=this;return(0,c.or)($e(),ut());function $e(){if(H.length){if(!(L instanceof c.Name))throw Error("ajv implementation error");let mt=Array.isArray(H)?H:[H];return c._`${(0,o.checkDataTypes)(mt,L,me.opts.strictNumbers,o.DataType.Wrong)}`}return c.nil}function ut(){if(fe.validateSchema){let mt=k.scopeValue("validate$data",{ref:fe.validateSchema});return c._`!${mt}(${L})`}return c.nil}}subschema(k,L){let H=(0,a.getSubschema)(this.it,k);(0,a.extendSubschemaData)(H,this.it,k),(0,a.extendSubschemaMode)(H,k);let fe={...this.it,...H,items:void 0,props:void 0};return w(fe,L),fe}mergeEvaluated(k,L){let{it:H,gen:fe}=this;if(!H.opts.unevaluated)return;if(H.props!==!0&&k.props!==void 0)H.props=d.mergeEvaluated.props(fe,k.props,H.props,L);if(H.items!==!0&&k.items!==void 0)H.items=d.mergeEvaluated.items(fe,k.items,H.items,L)}mergeValidEvaluated(k,L){let{it:H,gen:fe}=this;if(H.opts.unevaluated&&(H.props!==!0||H.items!==!0))return fe.if(L,()=>this.mergeEvaluated(k,c.Name)),!0}};e.KeywordCxt=ue;function Ee(k,L,H,fe){let me=new ue(k,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)*$/,Ze=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Nt(k,{dataLevel:L,dataNames:H,dataPathArr:fe}){let me,$e;if(k==="")return u.default.rootData;if(k[0]==="/"){if(!ye.test(k))throw Error(`Invalid JSON-pointer: ${k}`);me=k,$e=u.default.rootData}else{let dt=Ze.exec(k);if(!dt)throw Error(`Invalid JSON-pointer: ${k}`);let Xe=+dt[1];if(me=dt[2],me==="#"){if(Xe>=L)throw Error(zt("property/index",Xe));return fe[L-Xe]}if(Xe>L)throw Error(zt("data",Xe));if($e=H[L-Xe],!me)return $e}let ut=$e,mt=me.split("/");for(let dt of mt)if(dt)$e=c._`${$e}${(0,c.getProperty)((0,d.unescapeJsonPointer)(dt))}`,ut=c._`${ut} && ${$e}`;return ut;function zt(dt,Xe){return`Cannot access ${dt} ${Xe} levels up, current level is ${L}`}}e.getData=Nt}),va=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}),hs=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Yl();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}),Xl=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.resolveSchema=e.getCompilingSchema=e.resolveRef=e.compileSchema=e.SchemaEnv=void 0;let t=be(),r=va(),n=hr(),o=Yl(),s=xe(),i=ms();var a=class{constructor(g){var S;this.refs={},this.dynamicAnchors={};let v;if(typeof g.schema=="object")v=g.schema;this.schema=g.schema,this.schemaId=g.schemaId,this.root=g.root||this,this.baseId=(S=g.baseId)!==null&&S!==void 0?S:(0,o.normalizeId)(v===null||v===void 0?void 0:v[g.schemaId||"$id"]),this.schemaPath=g.schemaPath,this.localRefs=g.localRefs,this.meta=g.meta,this.$async=v===null||v===void 0?void 0:v.$async,this.refs={}}};e.SchemaEnv=a;function c(g){let S=d.call(this,g);if(S)return S;let v=(0,o.getFullPath)(this.opts.uriResolver,g.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(g.$async)E=b.scopeValue("Error",{ref:r.default,code:t._`require("ajv/dist/runtime/validation_error").default`});let C=b.scopeName("validate");g.validateName=C;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:g.schema,code:(0,t.stringify)(g.schema)}:{ref:g.schema}),validateName:C,ValidationError:E,schema:g.schema,schemaEnv:g,rootId:v,baseId:g.baseId||v,schemaPath:t.nil,errSchemaPath:g.schemaPath||(this.opts.jtd?"":"#"),errorPath:t._`""`,opts:this.opts,self:this},O;try{this._compilations.add(g),(0,i.validateFunctionCode)(q),b.optimize(this.opts.code.optimize);let F=b.toString();if(O=`${b.scopeRefs(n.default.scope)}return ${F}`,this.opts.code.process)O=this.opts.code.process(O,g);let K=Function(`${n.default.self}`,`${n.default.scope}`,O)(this,this.scope.get());if(this.scope.value(C,{ref:K}),K.errors=null,K.schema=g.schema,K.schemaEnv=g,g.$async)K.$async=!0;if(this.opts.code.source===!0)K.source={validateName:C,validateCode:F,scopeValues:b._values};if(this.opts.unevaluated){let{props:G,items:ge}=q;if(K.evaluated={props:G instanceof t.Name?void 0:G,items:ge instanceof t.Name?void 0:ge,dynamicProps:G instanceof t.Name,dynamicItems:ge instanceof t.Name},K.source)K.source.evaluated=(0,t.stringify)(K.evaluated)}return g.validate=K,g}catch(F){if(delete g.validate,delete g.validateName,O)this.logger.error("Error compiling schema, function code:",O);throw F}finally{this._compilations.delete(g)}}e.compileSchema=c;function u(g,S,v){var w;v=(0,o.resolveUrl)(this.opts.uriResolver,S,v);let z=g.refs[v];if(z)return z;let R=f.call(this,g,v);if(R===void 0){let b=(w=g.localRefs)===null||w===void 0?void 0:w[v],{schemaId:E}=this.opts;if(b)R=new a({schema:b,schemaId:E,root:g,baseId:S})}if(R===void 0)return;return g.refs[v]=l.call(this,R)}e.resolveRef=u;function l(g){if((0,o.inlineRef)(g.schema,this.opts.inlineRefs))return g.schema;return g.validate?g:c.call(this,g)}function d(g){for(let S of this._compilations)if(p(S,g))return S}e.getCompilingSchema=d;function p(g,S){return g.schema===S.schema&&g.root===S.root&&g.baseId===S.baseId}function f(g,S){let v;while(typeof(v=this.refs[S])=="string")S=v;return v||this.schemas[S]||h.call(this,g,S)}function h(g,S){let v=this.opts.uriResolver.parse(S),w=(0,o._getFullPath)(this.opts.uriResolver,v),z=(0,o.getFullPath)(this.opts.uriResolver,g.baseId,void 0);if(Object.keys(g.schema).length>0&&w===z)return _.call(this,v,g);let R=(0,o.normalizeId)(w),b=this.refs[R]||this.schemas[R];if(typeof b=="string"){let E=h.call(this,g,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:C}=this.opts,q=E[C];if(q)z=(0,o.resolveUrl)(this.opts.uriResolver,z,q);return new a({schema:E,schemaId:C,root:g,baseId:z})}return _.call(this,v,b)}e.resolveSchema=h;let y=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function _(g,{baseId:S,schema:v,root:w}){var z;if(((z=g.fragment)===null||z===void 0?void 0:z[0])!=="/")return;for(let E of g.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(!y.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}}),ZN=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}}),C0=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 y="",_=0,g=0;for(g=0;g<h.length;g++){if(_=h[g].charCodeAt(0),_===48)continue;if(!(_>=48&&_<=57||_>=65&&_<=70||_>=97&&_<=102))return"";y+=h[g];break}for(g+=1;g<h.length;g++){if(_=h[g].charCodeAt(0),!(_>=48&&_<=57||_>=65&&_<=70||_>=97&&_<=102))return"";y+=h[g]}return y}let s=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function i(h){return h.length=0,!0}function a(h,y,_){if(h.length){let g=o(h);if(g!=="")y.push(g);else return _.error=!0,!1;h.length=0}return!0}function c(h){let y=0,_={error:!1,address:"",zone:""},g=[],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,g,_))break;if(++y>7){_.error=!0;break}if(R>0&&h[R-1]===":")v=!0;g.push(":");continue}else if(b==="%"){if(!z(S,g,_))break;z=i}else{S.push(b);continue}}if(S.length)if(z===i)_.zone=S.join("");else if(w)g.push(S.join(""));else g.push(o(S));return _.address=g.join(""),_}function u(h){if(l(h,":")<2)return{host:h,isIPV6:!1};let y=c(h);if(!y.error){let{address:_,address:g}=y;if(y.zone)_+="%"+y.zone,g+="%25"+y.zone;return{host:_,isIPV6:!0,escapedHost:g}}else return{host:h,isIPV6:!1}}function l(h,y){let _=0;for(let g=0;g<h.length;g++)if(h[g]===y)_++;return _}function d(h){let y=h,_=[],g=-1,S=0;while(S=y.length){if(S===1)if(y===".")break;else if(y==="/"){_.push("/");break}else{_.push(y);break}else if(S===2){if(y[0]==="."){if(y[1]===".")break;else if(y[1]==="/"){y=y.slice(2);continue}}else if(y[0]==="/"){if(y[1]==="."||y[1]==="/"){_.push("/");break}}}else if(S===3){if(y==="/.."){if(_.length!==0)_.pop();_.push("/");break}}if(y[0]==="."){if(y[1]==="."){if(y[2]==="/"){y=y.slice(3);continue}}else if(y[1]==="/"){y=y.slice(2);continue}}else if(y[0]==="/"){if(y[1]==="."){if(y[2]==="/"){y=y.slice(2);continue}else if(y[2]==="."){if(y[3]==="/"){if(y=y.slice(3),_.length!==0)_.pop();continue}}}}if((g=y.indexOf("/",1))===-1){_.push(y);break}else _.push(y.slice(0,g)),y=y.slice(g)}return _.join("")}function p(h,y){let _=y!==!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 f(h){let y=[];if(h.userinfo!==void 0)y.push(h.userinfo),y.push("@");if(h.host!==void 0){let _=unescape(h.host);if(!n(_)){let g=u(_);if(g.isIPV6===!0)_=`[${g.escapedHost}]`;else _=h.host}y.push(_)}if(typeof h.port==="number"||typeof h.port==="string")y.push(":"),y.push(String(h.port));return y.length?y.join(""):void 0}t.exports={nonSimpleDomain:s,recomposeAuthority:f,normalizeComponentEncoding:p,removeDotSegments:d,isIPv4:n,isUUID:r,normalizeIPv6:u,stringArrayToHexStripped:o}}),GN=J((e,t)=>{let{isUUID:r}=C0(),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,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(n);if(C){let q=E.scheme||b.scheme||"urn";b.nid=C[1].toLowerCase(),b.nss=C[2];let O=R(`${q}:${E.nid||b.nid}`);if(b.path=void 0,O)b=O.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 C=E.scheme||b.scheme||"urn",q=b.nid.toLowerCase(),O=R(`${C}:${E.nid||q}`);if(O)b=O.serialize(b,E);let F=b,K=b.nss;return F.path=`${q||E.nid}:${K}`,E.skipEscape=!0,F}function f(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 y={scheme:"http",domainHost:!0,parse:a,serialize:c},_={scheme:"https",domainHost:y.domainHost,parse:a,serialize:c},g={scheme:"ws",domainHost:!0,parse:u,serialize:l},S={scheme:"wss",domainHost:g.domainHost,parse:g.parse,serialize:g.serialize},z={http:y,https:_,ws:g,wss:S,urn:{scheme:"urn",parse:d,serialize:p,skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:f,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}}),JN=J((e,t)=>{let{normalizeIPv6:r,removeDotSegments:n,recomposeAuthority:o,normalizeComponentEncoding:s,isIPv4:i,nonSimpleDomain:a}=C0(),{SCHEMES:c,getSchemeHandler:u}=GN();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 f(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 C=w.path;if(!z.absolutePath&&(!b||!b.absolutePath))C=n(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 y=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\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(y);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 g={SCHEMES:c,normalize:l,resolve:d,resolveComponent:p,equal:f,serialize:h,parse:_};t.exports=g,t.exports.default=g,t.exports.fastUri=g}),BN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=JN();t.code='require("ajv/dist/runtime/uri").default',e.default=t}),rh=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=ms();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=va(),o=hs(),s=k0(),i=Xl(),a=be(),c=Yl(),u=Kl(),l=xe(),d=ZN(),p=BN(),f=(x,M)=>new RegExp(x,M);f.code="new RegExp";let h=["removeAdditional","useDefaults","coerceTypes"],y=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."},g={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},S=200;function v(x){var M,B,P,I,j,W,ue,Ee,ye,Ze,Nt,k,L,H,fe,me,$e,ut,mt,zt,dt,Xe,er,yt,Vr;let pr=x.strict,Hr=(M=x.code)===null||M===void 0?void 0:M.optimize,en=Hr===!0||Hr===void 0?1:Hr||0,tn=(P=(B=x.code)===null||B===void 0?void 0:B.regExp)!==null&&P!==void 0?P:f,Yn=(I=x.uriResolver)!==null&&I!==void 0?I:p.default;return{strictSchema:(W=(j=x.strictSchema)!==null&&j!==void 0?j:pr)!==null&&W!==void 0?W:!0,strictNumbers:(Ee=(ue=x.strictNumbers)!==null&&ue!==void 0?ue:pr)!==null&&Ee!==void 0?Ee:!0,strictTypes:(Ze=(ye=x.strictTypes)!==null&&ye!==void 0?ye:pr)!==null&&Ze!==void 0?Ze:"log",strictTuples:(k=(Nt=x.strictTuples)!==null&&Nt!==void 0?Nt:pr)!==null&&k!==void 0?k:"log",strictRequired:(H=(L=x.strictRequired)!==null&&L!==void 0?L:pr)!==null&&H!==void 0?H:!1,code:x.code?{...x.code,optimize:en,regExp:tn}:{optimize:en,regExp:tn},loopRequired:(fe=x.loopRequired)!==null&&fe!==void 0?fe:S,loopEnum:(me=x.loopEnum)!==null&&me!==void 0?me:S,meta:($e=x.meta)!==null&&$e!==void 0?$e:!0,messages:(ut=x.messages)!==null&&ut!==void 0?ut:!0,inlineRefs:(mt=x.inlineRefs)!==null&&mt!==void 0?mt:!0,schemaId:(zt=x.schemaId)!==null&&zt!==void 0?zt:"$id",addUsedSchema:(dt=x.addUsedSchema)!==null&&dt!==void 0?dt:!0,validateSchema:(Xe=x.validateSchema)!==null&&Xe!==void 0?Xe:!0,validateFormats:(er=x.validateFormats)!==null&&er!==void 0?er:!0,unicodeRegExp:(yt=x.unicodeRegExp)!==null&&yt!==void 0?yt:!0,int32range:(Vr=x.int32range)!==null&&Vr!==void 0?Vr:!0,uriResolver:Yn}}var w=class{constructor(x={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,x=this.opts={...x,...v(x)};let{es5:M,lines:B}=this.opts.code;this.scope=new a.ValueScope({scope:{},prefixes:y,es5:M,lines:B}),this.logger=F(x.logger);let P=x.validateFormats;if(x.validateFormats=!1,this.RULES=(0,s.getRules)(),z.call(this,_,x,"NOT SUPPORTED"),z.call(this,g,x,"DEPRECATED","warn"),this._metaOpts=q.call(this),x.formats)E.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),x.keywords)C.call(this,x.keywords);if(typeof x.meta=="object")this.addMetaSchema(x.meta);b.call(this),x.validateFormats=P}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:x,meta:M,schemaId:B}=this.opts,P=d;if(B==="id")P={...d},P.id=P.$id,delete P.$id;if(M&&x)this.addMetaSchema(P,P[B],!1)}defaultMeta(){let{meta:x,schemaId:M}=this.opts;return this.opts.defaultMeta=typeof x=="object"?x[M]||x:void 0}validate(x,M){let B;if(typeof x=="string"){if(B=this.getSchema(x),!B)throw Error(`no schema with key or ref "${x}"`)}else B=this.compile(x);let P=B(M);if(!("$async"in B))this.errors=B.errors;return P}compile(x,M){let B=this._addSchema(x,M);return B.validate||this._compileSchemaEnv(B)}compileAsync(x,M){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:B}=this.opts;return P.call(this,x,M);async function P(ye,Ze){await I.call(this,ye.$schema);let Nt=this._addSchema(ye,Ze);return Nt.validate||j.call(this,Nt)}async function I(ye){if(ye&&!this.getSchema(ye))await P.call(this,{$ref:ye},!0)}async function j(ye){try{return this._compileSchemaEnv(ye)}catch(Ze){if(!(Ze instanceof o.default))throw Ze;return W.call(this,Ze),await ue.call(this,Ze.missingSchema),j.call(this,ye)}}function W({missingSchema:ye,missingRef:Ze}){if(this.refs[ye])throw Error(`AnySchema ${ye} is loaded but ${Ze} cannot be resolved`)}async function ue(ye){let Ze=await Ee.call(this,ye);if(!this.refs[ye])await I.call(this,Ze.$schema);if(!this.refs[ye])this.addSchema(Ze,ye,M)}async function Ee(ye){let Ze=this._loading[ye];if(Ze)return Ze;try{return await(this._loading[ye]=B(ye))}finally{delete this._loading[ye]}}}addSchema(x,M,B,P=this.opts.validateSchema){if(Array.isArray(x)){for(let j of x)this.addSchema(j,void 0,B,P);return this}let I;if(typeof x==="object"){let{schemaId:j}=this.opts;if(I=x[j],I!==void 0&&typeof I!="string")throw Error(`schema ${j} must be string`)}return M=(0,c.normalizeId)(M||I),this._checkUnique(M),this.schemas[M]=this._addSchema(x,B,M,P,!0),this}addMetaSchema(x,M,B=this.opts.validateSchema){return this.addSchema(x,M,!0,B),this}validateSchema(x,M){if(typeof x=="boolean")return!0;let B;if(B=x.$schema,B!==void 0&&typeof B!="string")throw Error("$schema must be a string");if(B=B||this.opts.defaultMeta||this.defaultMeta(),!B)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let P=this.validate(B,x);if(!P&&M){let I="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(I);else throw Error(I)}return P}getSchema(x){let M;while(typeof(M=R.call(this,x))=="string")x=M;if(M===void 0){let{schemaId:B}=this.opts,P=new i.SchemaEnv({schema:{},schemaId:B});if(M=i.resolveSchema.call(this,P,x),!M)return;this.refs[x]=M}return M.validate||this._compileSchemaEnv(M)}removeSchema(x){if(x instanceof RegExp)return this._removeAllSchemas(this.schemas,x),this._removeAllSchemas(this.refs,x),this;switch(typeof x){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let M=R.call(this,x);if(typeof M=="object")this._cache.delete(M.schema);return delete this.schemas[x],delete this.refs[x],this}case"object":{let M=x;this._cache.delete(M);let B=x[this.opts.schemaId];if(B)B=(0,c.normalizeId)(B),delete this.schemas[B],delete this.refs[B];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(x){for(let M of x)this.addKeyword(M);return this}addKeyword(x,M){let B;if(typeof x=="string"){if(B=x,typeof M=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),M.keyword=B}else if(typeof x=="object"&&M===void 0){if(M=x,B=M.keyword,Array.isArray(B)&&!B.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(G.call(this,B,M),!M)return(0,l.eachItem)(B,(I)=>ge.call(this,I)),this;Ne.call(this,M);let P={...M,type:(0,u.getJSONTypes)(M.type),schemaType:(0,u.getJSONTypes)(M.schemaType)};return(0,l.eachItem)(B,P.type.length===0?(I)=>ge.call(this,I,P):(I)=>P.type.forEach((j)=>ge.call(this,I,P,j))),this}getKeyword(x){let M=this.RULES.all[x];return typeof M=="object"?M.definition:!!M}removeKeyword(x){let{RULES:M}=this;delete M.keywords[x],delete M.all[x];for(let B of M.rules){let P=B.rules.findIndex((I)=>I.keyword===x);if(P>=0)B.rules.splice(P,1)}return this}addFormat(x,M){if(typeof M=="string")M=new RegExp(M);return this.formats[x]=M,this}errorsText(x=this.errors,{separator:M=", ",dataVar:B="data"}={}){if(!x||x.length===0)return"No errors";return x.map((P)=>`${B}${P.instancePath} ${P.message}`).reduce((P,I)=>P+M+I)}$dataMetaSchema(x,M){let B=this.RULES.all;x=JSON.parse(JSON.stringify(x));for(let P of M){let I=P.split("/").slice(1),j=x;for(let W of I)j=j[W];for(let W in B){let ue=B[W];if(typeof ue!="object")continue;let{$data:Ee}=ue.definition,ye=j[W];if(Ee&&ye)j[W]=Pe(ye)}}return x}_removeAllSchemas(x,M){for(let B in x){let P=x[B];if(!M||M.test(B)){if(typeof P=="string")delete x[B];else if(P&&!P.meta)this._cache.delete(P.schema),delete x[B]}}}_addSchema(x,M,B,P=this.opts.validateSchema,I=this.opts.addUsedSchema){let j,{schemaId:W}=this.opts;if(typeof x=="object")j=x[W];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof x!="boolean")throw Error("schema must be object or boolean");let ue=this._cache.get(x);if(ue!==void 0)return ue;B=(0,c.normalizeId)(j||B);let Ee=c.getSchemaRefs.call(this,x,B);if(ue=new i.SchemaEnv({schema:x,schemaId:W,meta:M,baseId:B,localRefs:Ee}),this._cache.set(ue.schema,ue),I&&!B.startsWith("#")){if(B)this._checkUnique(B);this.refs[B]=ue}if(P)this.validateSchema(x,!0);return ue}_checkUnique(x){if(this.schemas[x]||this.refs[x])throw Error(`schema with key or id "${x}" already exists`)}_compileSchemaEnv(x){if(x.meta)this._compileMetaSchema(x);else i.compileSchema.call(this,x);if(!x.validate)throw Error("ajv implementation error");return x.validate}_compileMetaSchema(x){let M=this.opts;this.opts=this._metaOpts;try{i.compileSchema.call(this,x)}finally{this.opts=M}}};w.ValidationError=n.default,w.MissingRefError=o.default,e.default=w;function z(x,M,B,P="error"){for(let I in x){let j=I;if(j in M)this.logger[P](`${B}: option ${I}. ${x[j]}`)}}function R(x){return x=(0,c.normalizeId)(x),this.schemas[x]||this.refs[x]}function b(){let x=this.opts.schemas;if(!x)return;if(Array.isArray(x))this.addSchema(x);else for(let M in x)this.addSchema(x[M],M)}function E(){for(let x in this.opts.formats){let M=this.opts.formats[x];if(M)this.addFormat(x,M)}}function C(x){if(Array.isArray(x)){this.addVocabulary(x);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let M in x){let B=x[M];if(!B.keyword)B.keyword=M;this.addKeyword(B)}}function q(){let x={...this.opts};for(let M of h)delete x[M];return x}let O={log(){},warn(){},error(){}};function F(x){if(x===!1)return O;if(x===void 0)return console;if(x.log&&x.warn&&x.error)return x;throw Error("logger must implement log, warn and error methods")}let K=/^[a-z_$][a-z0-9_$:-]*$/i;function G(x,M){let{RULES:B}=this;if((0,l.eachItem)(x,(P)=>{if(B.keywords[P])throw Error(`Keyword ${P} is already defined`);if(!K.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(x,M,B){var P;let I=M===null||M===void 0?void 0:M.post;if(B&&I)throw Error('keyword with "post" flag cannot have "type"');let{RULES:j}=this,W=I?j.post:j.rules.find(({type:Ee})=>Ee===B);if(!W)W={type:B,rules:[]},j.rules.push(W);if(j.keywords[x]=!0,!M)return;let ue={keyword:x,definition:{...M,type:(0,u.getJSONTypes)(M.type),schemaType:(0,u.getJSONTypes)(M.schemaType)}};if(M.before)ke.call(this,W,ue,M.before);else W.rules.push(ue);j.all[x]=ue,(P=M.implements)===null||P===void 0||P.forEach((Ee)=>this.addKeyword(Ee))}function ke(x,M,B){let P=x.rules.findIndex((I)=>I.keyword===B);if(P>=0)x.rules.splice(P,0,M);else x.rules.push(M),this.logger.warn(`rule ${B} is not defined`)}function Ne(x){let{metaSchema:M}=x;if(M===void 0)return;if(x.$data&&this.opts.$data)M=Pe(M);x.validateSchema=this.compile(M,!0)}let Fe={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Pe(x){return{anyOf:[x,Fe]}}});var KN=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}),nh=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.callRef=e.getValidate=void 0;let t=hs(),r=gr(),n=be(),o=hr(),s=Xl(),i=xe(),a={keyword:"$ref",schemaType:"string",code(l){let{gen:d,schema:p,it:f}=l,{baseId:h,schemaEnv:y,validateName:_,opts:g,self:S}=f,{root:v}=y;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(f.opts.uriResolver,h,p);if(w instanceof s.SchemaEnv)return R(w);return b(w);function z(){if(y===v)return u(l,_,y,y.$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 C=d.scopeValue("schema",g.code.source===!0?{ref:E,code:(0,n.stringify)(E)}:{ref:E}),q=d.name("valid"),O=l.subschema({schema:E,dataTypes:[],schemaPath:n.nil,topSchemaRef:C,errSchemaPath:p},q);l.mergeEvaluated(O),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,f){let{gen:h,it:y}=l,{allErrors:_,schemaEnv:g,opts:S}=y,v=S.passContext?o.default.this:n.nil;if(f)w();else z();function w(){if(!g.$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)},(C)=>{if(h.if(n._`!(${C} instanceof ${y.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=n._`${E}.errors`;h.assign(o.default.vErrors,n._`${o.default.vErrors} === null ? ${C} : ${o.default.vErrors}.concat(${C})`),h.assign(o.default.errors,n._`${o.default.vErrors}.length`)}function b(E){var C;if(!y.opts.unevaluated)return;let q=(C=p===null||p===void 0?void 0:p.validate)===null||C===void 0?void 0:C.evaluated;if(y.props!==!0)if(q&&!q.dynamicProps){if(q.props!==void 0)y.props=i.mergeEvaluated.props(h,q.props,y.props)}else{let O=h.var("props",n._`${E}.evaluated.props`);y.props=i.mergeEvaluated.props(h,O,y.props,n.Name)}if(y.items!==!0)if(q&&!q.dynamicItems){if(q.items!==void 0)y.items=i.mergeEvaluated.items(h,q.items,y.items)}else{let O=h.var("items",n._`${E}.evaluated.items`);y.items=i.mergeEvaluated.items(h,O,y.items,n.Name)}}}e.callRef=u,e.default=a}),O0=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=KN(),r=nh(),n=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",t.default,r.default];e.default=n}),WN=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}),YN=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}),XN=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'}),QN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r=xe(),n=XN(),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}),e1=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=gr(),r=xe(),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:f}=d.opts.code,h=f.code==="new RegExp"?n._`new RegExp`:(0,r.useFunc)(i,f),y=i.let("valid");i.try(()=>i.assign(y,n._`${h}(${l}, ${p}).test(${a})`),()=>i.assign(y,!1)),s.fail$data(n._`!${y}`)}else{let f=(0,t.usePattern)(s,u);s.fail$data(n._`!${f}.test(${a})`)}}};e.default=o}),t1=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}),r1=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=gr(),r=be(),n=xe(),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 f=a.length>=p.loopRequired;if(d.allErrors)h();else y();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(f||l)s.block$data(r.nil,_);else for(let S of a)(0,t.checkReportMissingProp)(s,S)}function y(){let S=i.let("missing");if(f||l){let v=i.let("valid",!0);s.block$data(v,()=>g(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 g(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}),n1=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}),oh=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=x0();t.code='require("ajv/dist/runtime/equal").default',e.default=t}),o1=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Kl(),r=be(),n=xe(),o=oh(),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:f}=i;if(!u&&!l)return;let h=a.let("valid"),y=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`,()=>(g()?S:v)(w,z))}function g(){return y.length>0&&!y.some((w)=>w==="object"||w==="array")}function S(w,z){let R=a.name("item"),b=(0,t.checkDataTypes)(y,R,f.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`),y.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}),s1=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r=xe(),n=oh(),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}),i1=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r=xe(),n=oh(),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,f,h=()=>f!==null&&f!==void 0?f:f=(0,r.useFunc)(i,n.default),y;if(p||c)y=i.let("valid"),s.block$data(y,_);else{if(!Array.isArray(u))throw Error("ajv implementation error");let S=i.const("vSchema",l);y=(0,t.or)(...u.map((v,w)=>g(S,w)))}s.pass(y);function _(){i.assign(y,!1),i.forOf("v",l,(S)=>i.if(t._`${h()}(${a}, ${S})`,()=>i.assign(y,!0).break()))}function g(S,v){let w=u[v];return typeof w==="object"&&w!==null?t._`${h()}(${a}, ${S}[${v}])`:t._`${a} === ${w}`}}};e.default=o}),A0=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=WN(),r=YN(),n=QN(),o=e1(),s=t1(),i=r1(),a=n1(),c=o1(),u=s1(),l=i1(),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}),N0=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateAdditionalItems=void 0;let t=be(),r=xe(),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),()=>f(h)),s.ok(h)}function f(h){a.forRange("i",i.length,p,(y)=>{if(s.subschema({keyword:l,dataProp:y,dataPropType:r.Type.Num},h),!d.allErrors)a.if((0,t.not)(h),()=>a.break())})}}e.validateAdditionalItems=o,e.default=n}),j0=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateTuple=void 0;let t=be(),r=xe(),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:f}=i;if(_(l),f.opts.unevaluated&&c.length&&f.items!==!0)f.items=r.mergeEvaluated.items(u,c.length,f.items);let h=u.name("valid"),y=u.const("len",t._`${d}.length`);c.forEach((g,S)=>{if((0,r.alwaysValidSchema)(f,g))return;u.if(t._`${y} > ${S}`,()=>i.subschema({keyword:p,schemaProp:S,dataProp:S},h)),i.ok(h)});function _(g){let{opts:S,errSchemaPath:v}=f,w=c.length,z=w===g.minItems&&(w===g.maxItems||g[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)(f,R,S.strictTuples)}}}e.validateTuple=s,e.default=o}),a1=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=j0(),r={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(n)=>(0,t.validateTuple)(n,"items")};e.default=r}),c1=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r=xe(),n=gr(),o=N0(),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}),u1=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r=xe(),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:f}=a;if(u.opts.next)l=p===void 0?1:p,d=f;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 y=s.name("valid");if(d===void 0&&l===1)g(y,()=>s.if(y,()=>s.break()));else if(l===0){if(s.let(y,!0),d!==void 0)s.if(t._`${c}.length > 0`,_)}else s.let(y,!1),_();o.result(y,()=>o.reset());function _(){let v=s.name("_valid"),w=s.let("count",0);g(v,()=>s.if(v,()=>S(w)))}function g(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(y,!0).break());else if(s.if(t._`${v} > ${d}`,()=>s.assign(y,!1).break()),l===1)s.assign(y,!0);else s.if(t._`${v} >= ${l}`,()=>s.assign(y,!0))}}};e.default=n}),sh=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;let t=be(),r=xe(),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 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}),ZN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r=ke(),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}),Eb=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=gr(),r=be(),n=hr(),o=ke(),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 O={keyword:"additionalProperties",dataProp:R,dataPropType:o.Type.Str};if(E===!1)Object.assign(O,{compositeRule:!0,createErrors:!1,allErrors:!1});i.subschema(O,b)}}};e.default=s}),GN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ps(),r=gr(),n=ke(),o=Eb(),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}),JN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=gr(),r=be(),n=ke(),o=ke(),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}),KN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ke(),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}),BN=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}),WN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r=ke(),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}),YN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ke(),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}),XN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r=ke(),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}),QN=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ke(),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}),zb=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=wb(),r=FN(),n=Rb(),o=VN(),s=HN(),i=eh(),a=ZN(),c=Eb(),u=GN(),l=JN(),d=KN(),p=BN(),m=WN(),h=YN(),g=XN(),_=QN();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}),e1=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 O=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:O});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}),Pb=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=[e1().default];e.default=t}),Tb=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"]}),Ib=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=bb(),r=$b(),n=zb(),o=Pb(),s=Tb(),i=[t.default,r.default,(0,n.default)(),o.default,s.metadataVocabulary,s.contentVocabulary];e.default=i}),t1=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={}))}),th=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r=t1(),n=Bl(),o=fs(),s=ke(),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)),O(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 O(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}),r1=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}}),xb=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=Ym(),n=Ib(),o=th(),s=r1(),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=ps();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=fs();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return p.default}})}),kb=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicAnchor=void 0;let t=be(),r=hr(),n=Bl(),o=Xm(),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}),Ob=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicRef=void 0;let t=be(),r=hr(),n=Xm(),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}),n1=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=kb(),r=ke(),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}),o1=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Ob(),r={keyword:"$recursiveRef",schemaType:"string",code:(n)=>(0,t.dynamicRef)(n,n.schema)};e.default=r}),Cb=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=kb(),r=Ob(),n=n1(),o=o1(),s=[t.default,r.default,n.default,o.default];e.default=s}),s1=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=eh(),r={keyword:"dependentRequired",type:"object",schemaType:"object",error:t.error,code:(n)=>(0,t.validatePropertyDeps)(n)};e.default=r}),i1=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=eh(),r={keyword:"dependentSchemas",type:"object",schemaType:"object",code:(n)=>(0,t.validateSchemaDeps)(n)};e.default=r}),a1=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ke(),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}),Ab=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=s1(),r=i1(),n=a1(),o=[t.default,r.default,n.default];e.default=o}),c1=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r=ke(),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}),u1=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r=ke(),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}),Nb=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=c1(),r=u1(),n=[t.default,r.default];e.default=n}),l1=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"}]}}}}}),d1=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:"#"}}}}}),p1=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:"#"}}}}),f1=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:{}}}}}),m1=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"}}}}),h1=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}}}}),g1=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:[]}}}}),y1=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=l1(),r=d1(),n=p1(),o=f1(),s=m1(),i=h1(),a=g1(),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}),_1=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=Ym(),n=Ib(),o=Cb(),s=Ab(),i=Nb(),a=th(),c=y1(),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=ps();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=fs();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return h.default}})}),v1=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=bb(),r=$b(),n=zb(),o=Cb(),s=Ab(),i=Nb(),a=Pb(),c=Tb(),u=[o.default,t.default,r.default,(0,n.default)(!0),a.default,c.metadataVocabulary,c.contentVocabulary,s.default,i.default];e.default=u}),S1=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}}}}),b1=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"}}}}),w1=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"}}}}),R1=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"}}}}),E1=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"}}}}),z1=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}}}}),P1=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:[]}}}}),T1=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=S1(),r=b1(),n=$1(),o=w1(),s=R1(),i=E1(),a=z1(),c=P1(),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}),I1=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=Ym(),n=v1(),o=th(),s=T1(),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=ps();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=fs();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return d.default}})}),x1=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,k=+(Z[6]||0),M=+(Z[7]||0);if(k>23||M>59||C&&!Ue)return!1;if(ge<=23&&Ie<=59&&Ae<60)return!0;let K=Ie-M*Pe,P=ge-k*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 O=/[^\\]\\Z/;function q(C){if(O.test(C))return!1;try{return new RegExp(C),!0}catch(F){return!1}}}),k1=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;let t=xb(),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}),O1=J((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0});let r=x1(),n=k1(),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}),jb=xb(),C1=_1(),A1=I1(),N1=hc(O1(),1),j1=N1.default;function Wm(e){let t=new e({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return j1(t),t}var Wl=class{_ajv;_ajvDraft7;_ajv2019;_userAjv;constructor(e){this._userAjv=e!==void 0,this._ajv=e}get ajv(){return this._ajv??=Wm(A1.Ajv2020)}_engineFor(e){if(this._userAjv)return this.ajv;let t=zy(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??=Wm(C1.Ajv2019);return this._ajvDraft7??=Wm(jb.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)}}},cB=jb.Ajv;import rh from"node:process";var Zb=Symbol.for("mcp.completable");function oh(e){return!!e&&typeof e==="object"&&Zb in e}function M1(e){return e[Zb]?.complete}function L1(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 D1(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 Yl=1024;function qb(e,t){return{method:e.method,params:{...e.params,_meta:{...e.params?._meta,[mo]:t}}}}function U1(e){let t=vn(pa).validateRequest("subscriptions/listen",e);return t.ok?t.value.params?.notifications:void 0}var F1=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=Yl,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=U1(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=D1(t,this._serverCapabilities);return this._subs.set(e.id,r),qb({method:"notifications/subscriptions/acknowledged",params:{notifications:r}},e.id)}cancel(e){return this._subs.delete(e)}routeOutbound(e){if(!F1.has(e.method))return"passthrough";let t=e.params?.uri,r=typeof t==="string"?t:void 0,n=V1(e.method,r),o=[];for(let[s,i]of this._subs)if(L1(i,n))o.push(qb({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:{[mo]:t,...this._serverInfo!==void 0&&{[Er]:this._serverInfo}}}});return this._subs.clear(),e}};function V1(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 H1=8,Z1=600000;function G1(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??H1,roundTimeoutMs:e?.roundTimeoutMs??Z1,legacyShim:e?.legacyShim??!0}}function Jb(e,t,r){if(r===null||typeof r!=="object"||typeof r.method!=="string")throw new de(X.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=L0(n);if(o===void 0)throw new de(X.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 J1(){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 nh(e,t){if(e==="tools/call")return{content:[{type:"text",text:t}],isError:!0};throw new de(X.InternalError,t)}var K1=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 nh(e,ib(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(X.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}=Jb(e,v,w);if(z.method!=="roots/list"&&z.params===void 0)throw new de(X.InternalError,`Handler for ${e} returned an input request '${v}' of kind '${z.method}' without params`);if(Nl(R,_)!==void 0)return nh(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=cb(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 nh(e,`Fulfilling input required by '${e}' failed: ${v instanceof Error?v.message:String(v)}`)}finally{S.dispose()}}else await ab(sb,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=Vm(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:J1()};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)}}},B1=new Set(["tools/call","prompts/get","resources/read"]),W1,Kb,Bb;function sh(e,t){Kb(e,t)}function ih(e){return Bb(e)}var Wb=class extends Zm{_clientCapabilities;_clientVersion;static{W1=(e,t)=>{if(t.clientCapabilities!==void 0)e._clientCapabilities=t.clientCapabilities;if(t.clientInfo!==void 0)e._clientVersion=t.clientInfo},Kb=(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())},Bb=(e)=>e._serverInfo}_capabilities;_instructions;_jsonSchemaValidator;_cacheHints;_requestStateVerify;_inputRequiredServing;_legacyShim;_legacyInputRequiredShim(){return this._legacyShim??=new K1({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 Wl,this._requestStateVerify=t?.requestState?.verify,this._inputRequiredServing=G1(t?.inputRequired),t?.cacheHints!==void 0){for(let[r,n]of Object.entries(t.cacheHints))if(n!==void 0)Am(n,`cacheHints['${r}']`);this._cacheHints=t.cacheHints}if(this.setRequestHandler("initialize",(r)=>this._oninitialize(r)),this.setNotificationHandler("notifications/initialized",()=>this.oninitialized?.()),Tm(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=Vl(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=Gm(this._capabilities,e),!t&&this._capabilities.logging)this._registerLoggingHandler()}_wrapHandler(e,t){if(e!=="tools/call"){let r=this._cacheHints?.[e],n=B1.has(e);if(r===void 0&&!n)return async(o,s)=>{let i=await t(o,s);if(Wr(i))throw new de(X.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(X.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:jl(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"?X.InternalError:X.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=Im(i),c=o.validateResult("tools/call",a);if(!c.ok)throw new de(c.reason==="not-in-era"?X.InternalError:X.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&&ls(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(X.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=Vm(n,d)}let a;try{a=await t(r,i)}catch(d){if(d instanceof de&&d.code===X.UrlElicitationRequired){if(!o)throw d;throw new de(X.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(X.InternalError,`Handler for ${e} returned an input-required result, but this request is served on protocol revision ${this._negotiatedProtocolVersion??fo}, 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(X.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}=Jb(e,p,m),_=Nl(g,d);if(_!==void 0)throw new Ml({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(X.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=U0(this._supportedProtocolVersions),n=r.includes(t)?t:r[0]??fo;return this._negotiatedProtocolVersion=n,this.transport?.setProtocolVersion?.(n),{protocolVersion:n,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}_ondiscover(){return{supportedVersions:Tm(this._supportedProtocolVersions),capabilities:Y1(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(X.InvalidParams,"The last message must contain only tool_result content if any is present");if(!l)throw new de(X.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(X.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(X.InvalidParams,`Elicitation response content does not match requested schema: ${a.errorMessage}`)}catch(a){if(a instanceof de)throw a;throw new de(X.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 Y1(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 Lb;try{let r=$n(t.inputSchema,"input");return this._toolInputSchemaJson[e]=r,r}catch{return}}constructor(e,t){if(this.server=new Wb(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"):Lb,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(X.InvalidParams,`Tool ${e.params.name} not found`);if(!r.enabled)throw new de(X.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===X.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 yo(e.inputSchema,t??{});if(!n.success)throw new de(X.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(X.InvalidParams,`Output validation error: Tool ${r} has an output schema but no structured content was provided`);let n=await yo(e.outputSchema,t.structuredContent);if(!n.success)throw new de(X.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 qm(e),this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return Mm(e),this.handleResourceCompletion(e,e.params.ref);default:throw new de(X.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(X.InvalidParams,`Prompt ${t.name} not found`);if(!r.enabled)throw new de(X.InvalidParams,`Prompt ${t.name} disabled`);if(!r.argsSchema)return ha;let n=Hb(Vb(r.argsSchema)?.[e.params.argument.name]);if(!oh(n))return ha;let o=M1(n);if(!o)return ha;return Fb(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(X.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let n=r.resourceTemplate.completeCallback(e.params.argument.name);if(!n)return ha;return Fb(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(X.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(X.InvalidParams,`Resource ${r} disabled`);return jl(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 jl(await o.readCallback(r,s,t),o.cacheHint)}throw new ql(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?ob(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(X.InvalidParams,`Prompt ${e.params.name} not found`);if(!r.enabled)throw new de(X.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){Am(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:Ub(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=Ub(e,a,c);if(l.enabled!==void 0)u.enabled=l.enabled;this.sendPromptListChanged()}};if(this._registeredPrompts[e]=u,n){let l=Vb(n);if(l){if(Object.values(l).some((d)=>oh(Hb(d))))this.setCompletionRequestHandler()}}return u}_createRegisteredTool(e,t,r,n,o,s,i,a,c,u){if(Bm(e),n!==void 0)try{let p=$n(n,"input");this._toolInputSchemaJson[e]=p;let m=Lm(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:Db(o),annotations:s,icons:i,execution:a,_meta:c,handler:u,executor:Mb(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")Bm(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=Mb(d.inputSchema,l);if(p.outputSchema!==void 0)d.outputSchema=p.outputSchema,d.outputSchemaJson=Db(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,Hl(s),Hl(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,Hl(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 Mb(e,t){if(e){let n=t;return async(o,s)=>n(o,s)}let r=t;return async(n,o)=>r(o)}var Lb={type:"object",properties:{}};function Db(e){if(e===void 0)return;try{return $n(e,"output")}catch{return}}function Ub(e,t,r){if(t){let n=r;return async(o,s)=>{let i=await yo(t,o);if(!i.success)throw new de(X.InvalidParams,`Invalid arguments for prompt ${e}: ${i.error}`);return n(i.data,s)}}else{let n=r;return async(o,s)=>n(s)}}function Fb(e){return{completion:{values:e.map(String).slice(0,100),total:e.length,hasMore:e.length>100}}}var ha={completion:{values:[],hasMore:!1}};function Vb(e){let t=e;if(t.shape&&typeof t.shape==="object")return t.shape}function X1(e){return e?.type==="optional"}function Hb(e){if(!X1(e))return e;return e.def?.innerType??e}var Q1=class{_readBuffer;_started=!1;_closed=!1;constructor(e=rh.stdin,t=rh.stdout,r){this._stdin=e,this._stdout=t,this._readBuffer=new Jm({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=Km(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)})}},Yb=3000,ej=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)||Fl(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 tj(e){let t=e.params;if(e.method==="initialize"&&!Dm(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(!Ll(t))return{kind:"legacy",reason:"no-claim"};let r=vo(t),n=(r===void 0?[]:Ul(r))[0];if(n!==void 0)return{kind:"invalid-envelope",issue:n};let o=Dl(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 Xb(e,t={}){let r=t.legacy??"serve",n=t.transport??new Q1,o={phase:"opening"},s,i=!1,a=()=>i||o.phase==="closed",c=(E)=>{try{t.onerror?.(E)}catch{}},u=(E,O,q,C)=>n.send({jsonrpc:"2.0",id:E,error:{code:O,message:q,...C!==void 0&&{data:C}}}).catch((F)=>c(yr(F))),l=new Gb(t.maxSubscriptions??Yl),d=(E)=>{if(!bn(E))return;let O=l.routeOutbound(E);if(O==="passthrough")return;for(let q of O)n.send({jsonrpc:"2.0",...q}).catch((C)=>c(yr(C)));return"handled"},p=async(E)=>{if(rr(E)&&E.method==="subscriptions/listen"){let O=vo(E.params),q=Ll(E.params)?(O===void 0?[]:Ul(O))[0]:{key:"_meta",problem:"the per-request envelope is required on protocol revision 2026-07-28"},C=Dl(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 ds({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 O=E.params?.requestId;if(O!==void 0&&l.cancel(O))return!0}return!1},m=(E,O,q)=>{let C=Um({kind:"legacy",reason:O,...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,O)=>{let q=await e({era:E}),C=q instanceof ga?q.server:q;if(E==="modern")Hm(C,O),sh(C,Sn),l.setServerCapabilities(C.getCapabilities(),ih(C));let F=new ej(n,()=>h(F),E==="modern"?d:void 0);return await q.connect(F),{product:q,channel:F}},_=(E)=>E.product.close().catch((O)=>c(yr(O))),y=async(E)=>{s=E.channel;try{if(!await E.channel.whenRequestsAnswered(Yb))c(Error(`Discarded the probe instance with requests still unanswered after ${Yb}ms; continuing with the fallback`));await E.product.close()}catch(O){c(yr(O))}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"&&!Dm(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 O=tj(E);switch(O.kind){case"invalid-envelope":{let q=`Invalid _meta envelope for protocol revision 2026-07-28: ${O.issue.key}: ${O.issue.problem}`;if(rr(E))await u(E.id,X.InvalidParams,q,{envelope:O.issue});else c(Error(`Discarded a notification with a malformed envelope: ${q}`));return}case"unsupported-revision":if(rr(E)){let q=new ds({supported:[...Sn],requested:O.requested});c(q),await u(E.id,q.code,q.message,q.data)}else c(Error(`Discarded a notification claiming unsupported protocol revision ${O.requested}`));return;case"modern":if(rr(E)&&E.method==="server/discover"){if(o.phase==="probe"){o.instance.channel.deliver(E,{classification:O.classification});return}let q=await g("modern",O.revision);if(a()){await _(q);return}o={phase:"probe",instance:q},q.channel.deliver(E,{classification:O.classification});return}if(o.phase==="probe"){if(bn(E)){o.instance.channel.deliver(E,{classification:O.classification});return}o={phase:"pinned",era:"modern",instance:o.instance}}else{let q=await g("modern",O.revision);if(a()){await _(q);return}o={phase:"pinned",era:"modern",instance:q}}if(await p(E))return;o.instance.channel.deliver(E,{classification:O.classification});return;case"legacy":{if(r==="reject"){if(rr(E))await m(E,O.reason,O.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(O){if(rr(E))await u(E.id,X.InternalError,"Internal server error");c(yr(O))}}}finally{w=!1}},R=async()=>{if(i||o.phase==="closed")return;i=!0;let E=o;o={phase:"closed"};for(let O of l.teardownAll())await n.send(O).catch((q)=>c(yr(q)));if(E.phase==="probe"||E.phase==="pinned")await E.instance.product.close().catch((O)=>c(yr(O)));await n.close().catch((O)=>c(yr(O)))};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((O)=>c(yr(O)))};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 je 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 So extends je{constructor(e){super("Could not reach the account service to renew the session; try again.",kt.NETWORK);this.name="RefreshUnavailableError",this.cause=e}}var kt={SUCCESS:0,ERROR:1,USAGE:2,AUTH:3,RATE_LIMITED:4,NETWORK:5};var Qb="grove-cli/0.1.14";var t$=50000;function e$(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??Qb,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 je&&n.statusCode===401)||!this.onUnauthorized)throw n;let s;try{s=await this.onUnauthorized(this.token)}catch(i){if(i instanceof So)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(
|
|
62
|
-
`);if(i.status===204)return r.onHeaders?.(i.headers),null;if(i.ok){r.onHeaders?.(i.headers);let
|
|
63
|
-
`);let s;try{s=await fetch(r,o)}catch(a){let c=a instanceof Error?a.message:String(a);throw new
|
|
64
|
-
`);if(s.ok)return s.text();let i;try{let a=await s.json();if(typeof a.code==="string")i=a.code}catch{}throw new je(`${s.status} ${s.statusText}`,kt.ERROR,s.status,void 0,i)}}var rj=20;async function r$(e,t){let r=await e.get("/api/v1/views"),n=Array.isArray(r)?r:[];if(n.some((c)=>c.id===t))return t;let o=n.find((c)=>c.name===t);if(o)return o.id;let s=t.toLowerCase(),i=n.filter((c)=>c.name.toLowerCase()===s);if(i.length===1)return i[0].id;if(i.length>1)throw new je(`view name is ambiguous: ${i.map((c)=>c.name).join(", ")} (use the id)`,kt.USAGE);let a=n.slice(0,rj).map((c)=>c.name);throw new je(`no view named ${t}; ${a.length>0?`views: ${a.join(", ")}`:"you have no views"}`,kt.USAGE)}import{dirname as cG,join as uG}from"node:path";import{isDeepStrictEqual as GZ}from"node:util";import dx from"node:process";import Io from"node:fs";import px from"node:path";import Da from"node:crypto";import JZ from"node:assert";var bo=(e)=>{let t=typeof e;return e!==null&&(t==="object"||t==="function")};var ah=new Set(["__proto__","prototype","constructor"]),nj=new Set("0123456789");function Xl(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(ah.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(ah.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"&&!nj.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(ah.has(r))return[];t.push(r);break}case"index":throw Error("Index was not closed");case"start":{t.push("");break}}return t}function ch(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(ch(e,t))throw Error("Cannot use string index")}function o$(e,t,r){if(!bo(e)||typeof t!=="string")return r===void 0?e:r;let n=Xl(t);if(n.length===0)return r;for(let o=0;o<n.length;o++){let s=n[o];if(ch(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 uh(e,t,r){if(!bo(e)||typeof t!=="string")return e;let n=e,o=Xl(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(!bo(e[i]))e[i]=typeof o[s+1]==="number"?[]:{};e=e[i]}return n}function s$(e,t){if(!bo(e)||typeof t!=="string")return!1;let r=Xl(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],!bo(e))return!1}}function i$(e,t){if(!bo(e)||typeof t!=="string")return!1;let r=Xl(t);if(r.length===0)return!1;for(let n of r){if(!bo(e)||!(n in e)||ch(e,n))return!1;e=e[n]}return!0}import Ye from"node:path";import a$ from"node:os";import lh from"node:process";var Rn=a$.homedir(),dh=a$.tmpdir(),{env:ms}=lh,oj=(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(dh,e)}},sj=(e)=>{let t=ms.APPDATA||Ye.join(Rn,"AppData","Roaming"),r=ms.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(dh,e)}},ij=(e)=>{let t=Ye.basename(Rn);return{data:Ye.join(ms.XDG_DATA_HOME||Ye.join(Rn,".local","share"),e),config:Ye.join(ms.XDG_CONFIG_HOME||Ye.join(Rn,".config"),e),cache:Ye.join(ms.XDG_CACHE_HOME||Ye.join(Rn,".cache"),e),log:Ye.join(ms.XDG_STATE_HOME||Ye.join(Rn,".local","state"),e),temp:Ye.join(dh,t,e)}};function ph(e,{suffix:t="nodejs"}={}){if(typeof e!=="string")throw TypeError(`Expected a string, got ${typeof e}`);if(t)e+=`-${t}`;if(lh.platform==="darwin")return oj(e);if(lh.platform==="win32")return sj(e);return ij(e)}import mj from"node:path";import Ne from"node:fs";import{promisify as Ot}from"node:util";var aj=(e,t)=>{let{onError:r}=t;return function(...o){return e.apply(void 0,o).catch(r)}},zr=aj;var cj=(e,t)=>{let{onError:r}=t;return function(...o){try{return e.apply(void 0,o)}catch(s){return r(s)}}},_r=cj;var c$=250;var uj=(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=uj;var lj=(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=lj;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}},fh=ya;var _a={onError:fh.onChangeError},Ut={onError:()=>{return}},u$=l$.getuid?!l$.getuid():!1,$t={isRetriable:fh.isRetriableError};var dj={attempt:{chmod:zr(Ot(Ne.chmod),_a),chown:zr(Ot(Ne.chown),_a),close:zr(Ot(Ne.close),Ut),fsync:zr(Ot(Ne.fsync),Ut),mkdir:zr(Ot(Ne.mkdir),Ut),realpath:zr(Ot(Ne.realpath),Ut),stat:zr(Ot(Ne.stat),Ut),unlink:zr(Ot(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(Ot(Ne.close),$t),fsync:Pr(Ot(Ne.fsync),$t),open:Pr(Ot(Ne.open),$t),readFile:Pr(Ot(Ne.readFile),$t),rename:Pr(Ot(Ne.rename),$t),stat:Pr(Ot(Ne.stat),$t),write:Pr(Ot(Ne.write),$t),writeFile:Pr(Ot(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=dj;import $o from"node:process";var d$="utf8",mh=438,p$=511;var f$={},m$=$o.geteuid?$o.geteuid():-1,h$=$o.getegid?$o.getegid():-1;var g$=1000,y$=!!$o.getuid,V5=$o.getuid?!$o.getuid():!1,hh=128;var _$=(e)=>e instanceof Error&&("code"in e);var gh=(e)=>typeof e==="string",Ql=(e)=>e===void 0;import fj from"node:path";import hs from"node:process";import v$ from"node:process";var S$=v$.platform==="linux",ed=v$.platform==="win32";var yh=["SIGHUP","SIGINT","SIGTERM"];if(!ed)yh.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(S$)yh.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var b$=yh;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(ed&&(e!=="SIGINT"&&e!=="SIGTERM"&&e!=="SIGKILL"))hs.kill(hs.pid,"SIGTERM");else hs.kill(hs.pid,e)},this.hook=()=>{hs.once("exit",()=>this.exit());for(let e of b$)try{hs.once(e,()=>this.exit(e))}catch{}},this.register=(e)=>(this.callbacks.add(e),()=>{this.callbacks.delete(e)}),this.hook()}}var w$=new $$;var pj=w$.register,R$=pj;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=fj.basename(e);if(t.length<=hh)return e;let r=/^(\.?)(.*?)((?:\.[^.]+)?(?:\.tmp-\d{10}[a-f0-9]{6})?)$/.exec(t);if(!r)return e;let n=t.length-hh;return`${e.slice(0,-t.length)}${r[1]}${r[2].slice(0,-n)}${r[3]}`}};R$(Qt.purgeSyncAll);var va=Qt;function _h(e,t,r=f$){if(gh(r))return _h(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$&&Ql(r.chown),d=Ql(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=mj.dirname(e);vt.attempt.mkdirSync(p,{mode:p$,recursive:!0})}if(a=vt.retry.openSync(o)(i,"w",r.mode||mh),r.tmpCreated)r.tmpCreated(i);if(gh(t))vt.retry.writeSync(o)(a,t,0,r.encoding||d$);else if(!Ql(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!==mh)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 mx=Cp(KP(),1),hx=Cp(gT(),1);var T9=(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(!I9(o,s)&&n)return;Object.defineProperty(e,r,s)},I9=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)},x9=(e,t)=>{let r=Object.getPrototypeOf(t);if(r===Object.getPrototypeOf(e))return;Object.setPrototypeOf(e,r)},k9=(e,t)=>`/* Wrapped ${e}*/
|
|
65
|
-
${t}`,O9=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),C9=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),A9=(e,t,r)=>{let n=r===""?"":`with ${r.trim()}() `,o=k9.bind(null,n,t.toString());Object.defineProperty(o,"name",C9);let{writable:s,enumerable:i,configurable:a}=O9;Object.defineProperty(e,"toString",{value:o,writable:s,enumerable:i,configurable:a})};function Pg(e,t,{ignoreNonConfigurable:r=!1}={}){let{name:n}=e;for(let o of Reflect.ownKeys(t))T9(e,t,o,r);return x9(e,t),A9(e,t,n),e}var N9=(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 Pg(u,e),u.cancel=()=>{if(i)clearTimeout(i),i=void 0;if(a)clearTimeout(a),a=void 0},u},Tg=N9;var xo=Cp(ax(),1);var LZ=Object.prototype.toString;function ux(e,t,r){if(!e)return!1;if(e.constructor===t)return!0;return LZ.call(e)===r}function lx(e){return ux(e,Uint8Array,"[object Uint8Array]")}function DZ(e){return ux(e,ArrayBuffer,"[object ArrayBuffer]")}function UZ(e){return lx(e)||DZ(e)}function FZ(e){if(!lx(e))throw TypeError(`Expected \`Uint8Array\`, got \`${typeof e}\``)}function VZ(e){if(!UZ(e))throw TypeError(`Expected \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof e}\``)}function Vg(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)FZ(o),r.set(o,n),n+=o.length;return r}var cx={utf8:new globalThis.TextDecoder("utf8")};function Hg(e,t="utf8"){return VZ(e),cx[t]??=new globalThis.TextDecoder(t),cx[t].decode(e)}function HZ(e){if(typeof e!=="string")throw TypeError(`Expected \`string\`, got \`${typeof e}\``)}var ZZ=new globalThis.TextEncoder;function fp(e){return HZ(e),ZZ.encode(e)}var kX=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));var KZ=hx.default.default,fx="aes-256-cbc",Vs=()=>Object.create(null),BZ=(e)=>e!==void 0&&e!==null,WZ=(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`)},mp="__internal__",Zg=`${mp}.migrations.version`;class hp{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=ph(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 mx.Ajv2020({allErrors:!0,useDefaults:!0,...t.ajvOptions});KZ(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=px.resolve(t.cwd,`${t.configName??"config"}${r}`);let n=this.store,o=Object.assign(Vs(),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{JZ.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 ${mp} key, as it's used to manage this module internal operations.`);let{store:r}=this,n=(o,s)=>{if(WZ(o,s),this.#e.accessPropertiesByDotNotation)uh(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(BZ(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=Vs();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=Io.readFileSync(this.path,this.#t?null:"utf8"),t=this._encryptData(e),r=this._deserialize(t);return this._validate(r),Object.assign(Vs(),r)}catch(e){if(e?.code==="ENOENT")return this._ensureDirectory(),Vs();if(this.#e.clearInvalidConfig&&e.name==="SyntaxError")return Vs();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:Hg(e);try{let t=e.slice(0,16),r=Da.pbkdf2Sync(this.#t,t.toString(),1e4,32,"sha512"),n=Da.createDecipheriv(fx,r,t),o=e.slice(17),s=typeof o==="string"?fp(o):o;return Hg(Vg([n.update(s),n.final()]))}catch{}return e.toString()}_handleChange(e,t){let r=e(),n=()=>{let o=r,s=e();if(GZ(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(){Io.mkdirSync(px.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(fx,n,r);t=Vg([r,fp(":"),o.update(fp(t)),o.final()])}if(dx.env.SNAP)Io.writeFileSync(this.path,t,{mode:this.#e.configFileMode});else try{_h(this.path,t,{mode:this.#e.configFileMode})}catch(r){if(r?.code==="EXDEV"){Io.writeFileSync(this.path,t,{mode:this.#e.configFileMode});return}throw r}}_watch(){if(this._ensureDirectory(),!Io.existsSync(this.path))this._write(Vs());if(dx.platform==="win32")Io.watch(this.path,{persistent:!1},Tg(()=>{this.events.dispatchEvent(new Event("change"))},{wait:100}));else Io.watchFile(this.path,{persistent:!1},Tg(()=>{this.events.dispatchEvent(new Event("change"))},{wait:5000}))}_migrate(e,t,r){let n=this._get(Zg,"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(Zg,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)||!xo.default.eq(n,t))this._set(Zg,t)}_containsReservedKey(e){if(typeof e==="object"){if(Object.keys(e)[0]===mp)return!0}if(typeof e!=="string")return!1;if(this.#e.accessPropertiesByDotNotation){if(e.startsWith(`${mp}.`))return!0;return!1}return!1}_isVersionInRangeFormat(e){return xo.default.clean(e)===null}_shouldPerformMigration(e,t,r){if(this._isVersionInRangeFormat(e)){if(t!=="0.0.0"&&xo.default.satisfies(t,e))return!1;return xo.default.satisfies(r,e)}if(xo.default.lte(e,t))return!1;if(xo.default.gt(e,r))return!1;return!0}_get(e,t){return o$(this.store,e,t)}_set(e,t){let{store:r}=this;uh(r,e,t),this.store=r}}import{chmodSync as lG,existsSync as dG}from"fs";import{randomBytes as YZ}from"node:crypto";import{closeSync as gx,openSync as yx,readFileSync as XZ,statSync as _x,unlinkSync as gp,writeSync as QZ}from"node:fs";var vx=30000,eG=8000,tG=2*vx,rG=1e4,nG=100;function oG(e){try{return process.kill(e,0),!0}catch(t){return t.code==="EPERM"}}function Gg(e){try{return XZ(e,"utf8")}catch(t){if(t.code==="ENOENT")return null;throw t}}function Jg(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 sG(e,t,r){if(t)return r-t.ts;try{return r-_x(e).mtimeMs}catch{return}}function Sx(e,t,r){let n=sG(e,t,r);if(n===void 0)return!1;if(n>vx)return!0;return t!==null&&n>eG&&!oG(t.pid)}function iG(e,t){let r=`${e}.break`,n;try{n=yx(r,"wx",384)}catch(o){if(o.code!=="EEXIST")throw o;try{if(Date.now()-_x(r).mtimeMs>rG)gp(r)}catch(s){if(s.code!=="ENOENT")throw s}return!1}try{gx(n);let o=Gg(e);if(o===t&&Sx(e,Jg(o),Date.now()))try{gp(e)}catch(s){if(s.code!=="ENOENT")throw s}}finally{gp(r)}return!0}function aG(e,t){let r;try{r=yx(e,"wx",384)}catch(n){if(n.code==="EEXIST")return!1;throw n}try{QZ(r,JSON.stringify(t))}finally{gx(r)}return!0}async function bx(e){let t={pid:process.pid,ts:0,nonce:YZ(8).toString("hex")},r=Date.now();for(;;){let n=Date.now();if(t.ts=n,aG(e,t))return{release:()=>{try{if(Jg(Gg(e))?.nonce!==t.nonce)return;gp(e)}catch{}}};let o=Gg(e);if(o===null)continue;if(Sx(e,Jg(o),n)&&iG(e,o))continue;if(n-r>=tG)return null;await new Promise((s)=>setTimeout(s,nG))}}var Kg=null;function pG(e){try{if(dG(e.path))lG(e.path,384)}catch{}}function Ex(){return Hs().path}function Hs(){if(!Kg){let e=new hp({projectName:"grove-cli",configFileMode:384,defaults:{currentProfile:"default",profiles:{}}});pG(e),Kg=e}return Kg}function Yg(e,t){let r=Hs(),n=r.get("profiles");n[e]=t,r.set("profiles",n)}function Zn(e){return Hs().get("profiles")[e]??null}function yp(){return Hs().get("currentProfile")}function zx(){let e=yp();return Zn(e)}var Px="https://grove.iis.tools",$x="No API URL configured. Run: grove auth login (or set GROVE_API_URL)";function Tx(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??wx(e.profile);if(!d)throw new je($x,kt.AUTH);return{apiUrl:d,token:a,authType:"api-key"}}let c=r??s,u=t??o??wx(e.profile);if(c&&u)return{apiUrl:u,token:c,authType:"jwt"};if(c)throw new je($x,kt.AUTH);let l=e.profile?Zn(e.profile):zx();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 je("Not authenticated. Run: grove auth login",kt.AUTH)}function wx(e){return(e?Zn(e):zx())?.baseUrl}function Xg(e){return e.accountUrl??process.env.GROVE_ACCOUNT_URL??"https://account.iis.tools"}function fG(e){let t=Xg(e);return new wn(t,{verbose:e.verbose,timeout:e.timeout?parseInt(e.timeout,10):void 0})}var Bg=8000,Wg=new Map;function mG(e){return uG(cG(Hs().path),`refresh-${encodeURIComponent(e)}.lock`)}function Ix(e,t={},r){let n=`${Hs().path}\x00${e}`,o=Wg.get(n);if(o)return o;let s=_G(e,t,r).finally(()=>{Wg.delete(n)});return Wg.set(n,s),s}var hG=30000;function gG(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()+hG}catch{return!1}}function Rx(e,t){if(t===void 0||!e?.token||!e.refreshToken)return null;if(e.token===t||!gG(e.token))return null;return{token:e.token,refreshToken:e.refreshToken}}function yG(e){return e instanceof je&&(e.statusCode===400||e.statusCode===401)}async function _G(e,t,r){let n=Rx(Zn(e),r);if(n)return n;let o;try{o=await bx(mG(e))}catch(s){throw new So(s)}if(!o)throw new So;try{let s=Zn(e);if(!s?.refreshToken)return null;let i=Rx(s,r);if(i)return i;let a=t.timeout?parseInt(t.timeout,10):Bg,u=await fG({...t,timeout:String(Math.min(a||Bg,Bg))}).post("/auth/refresh",{refreshToken:s.refreshToken});return Yg(e,{...s,token:u.accessToken,refreshToken:u.refreshToken}),{token:u.accessToken,refreshToken:u.refreshToken}}catch(s){if(yG(s))return null;throw new So(s)}finally{o.release()}}import{spawn as vG}from"node:child_process";import{createHash as kx,randomBytes as _p}from"node:crypto";import{createServer as xx}from"node:http";function Ox(){return _p(32).toString("base64url")}function SG(e){return kx("sha256").update(e).digest("base64url")}function Cx(e,t,r,n){let o=new URL(`${e.replace(/\/$/,"")}/auth/cli`);return o.searchParams.set("response_type","code"),o.searchParams.set("code_challenge",SG(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 Ax(){let e,t,r=new Promise((n,o)=>{e=n,t=o});return r.catch(()=>{}),{promise:r,resolve:e,reject:t}}var bG="<!doctype html><html><body><h2>Signed in to Grove.</h2><p>You can close this window.</p></body></html>",$G="<!doctype html><html><body><h2>Sign-in link invalid or expired.</h2><p>Start the sign-in again.</p></body></html>";async function Nx(e){let t=Ox(),r=_p(16).toString("hex"),n=Ax(),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($G);return}p.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}).end(bG),n.resolve(h)},s=xx(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=xx(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:Cx(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 wG=3000,RG=60000,EG=1e4;async function jx(e){let t=Ox(),r=_p(16).toString("hex"),n=_p(32).toString("base64url"),o=kx("sha256").update(n).digest("base64url"),s=e.apiUrl.replace(/\/$/,""),i=`${s}/auth/cli/callback?k=${o}`,a=e.pollIntervalMs??wG,c=new wn(s,{headers:{Authorization:`Relay ${n}`},timeout:EG,userAgent:e.userAgent}),u=Ax(),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 je&&g.retryAfterS!==void 0)h=Math.min(Math.max(a,g.retryAfterS*1000),RG)}p(h)};return p(a),{mode:"relay",authUrl:Cx(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 qx(e,t,r){return new wn(e).post("/auth/token",{code:r,codeVerifier:t.codeVerifier,redirectUri:t.redirectUri})}function Mx(e=process.env,t=process.platform){if(e.SSH_CONNECTION||e.SSH_TTY)return!0;return t==="linux"&&!e.DISPLAY&&!e.WAYLAND_DISPLAY}function Lx(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=vG(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 zG}from"node:crypto";var PG=300000,TG=50000,IG=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??TG}get progressIntervalMs(){return this.deps?.progressIntervalMs??IG}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??PG,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:zG(),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.2",Qg=`grove-mcp/${Ua}`;function Dx(){let e=process.env.GROVE_PROFILE,t=e??yp(),r=Boolean(process.env.GROVE_TOKEN||process.env.GROVE_API_KEY),n=Zn(t);if(!r&&!n)return null;let o=Tx({profile:e});if(!r&&o.authType==="jwt"&&!n?.refreshToken&&xG(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:Qg,onUnauthorized:s?(a)=>Ix(t,{accountUrl:process.env.GROVE_ACCOUNT_URL},a):void 0}),canAutoRefresh:s,profileKey:r?void 0:n?.refreshToken??o.token}}function xG(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 Ux(e={}){let t=Xg({}),r=process.env.GROVE_PROFILE??yp(),n=()=>process.env.GROVE_API_URL??Zn(r)?.baseUrl??Px;return new ko(Dx(),{build:Dx,startLogin:(o)=>o==="relay"?jx({accountUrl:t,apiUrl:n(),pollIntervalMs:e.relayPollMs,userAgent:Qg}):Nx({accountUrl:t}),complete:async(o,s)=>{let i=await qx(t,o,s);return Yg(r,{baseUrl:n(),token:i.accessToken,refreshToken:i.refreshToken}),{accountId:i.accountId}},ttlMs:e.ttlMs,loginWaitMs:e.loginWaitMs,progressIntervalMs:e.progressIntervalMs,openBrowser:e.openBrowser??Lx,canOpenBrowser:e.openBrowser?void 0:()=>!Mx()})}var Fx="npm";import{lstatSync as p6,mkdirSync as f6,realpathSync as m6}from"node:fs";import{homedir as h6}from"node:os";import g6 from"node:path";import{existsSync as kG,statSync as OG}from"node:fs";import Vx from"node:path";var Zs=["claude-code","claude-desktop","cursor","vscode"],Hx={"claude-code":"Claude Code","claude-desktop":"Claude Desktop",cursor:"Cursor",vscode:"VS Code"};function Zx(e,t,r){return(e==="win32"?t.USERPROFILE:t.HOME)||r}function vp(e,t,r,n){let o=t==="win32"?Vx.win32:Vx.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 ey(e){if(e.legacyFile)try{if(OG(e.legacyFile).size>0)return e.legacyFile}catch{}return e.file}function Gx(e){return e.detect.some((t)=>kG(t))}import{readFileSync as CG,readlinkSync as AG,statSync as NG}from"node:fs";import Fa from"node:path";var jG="@iistools/grove-mcp",Kx="https://registry.npmjs.org/",qG=`--@iistools:registry=${Kx}`;function MG(e){return e==="win32"?Fa.win32:Fa.posix}function Jx(e){try{return NG(e).isFile()}catch{return!1}}function Bx(e,t,r){let n=MG(e),o=e==="win32"?"npx.cmd":"npx";for(let i of(t.PATH??"").split(n.delimiter))if(i&&n.isAbsolute(i)&&Jx(n.join(i,o)))return LG(n.join(i,o),t,n);let s=n.join(n.dirname(r),o);return Jx(s)?s:null}function LG(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),AG(n))+e.slice(n.length)}catch{return e}}function Wx(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 bp(e){return typeof e.command==="string"&&/\s/.test(e.command.trim())&&(!Array.isArray(e.args)||e.args.length===0)}function ty(e){return Array.isArray(e.args)?e.args.filter((t)=>typeof t==="string"):[]}function DG(e){return[typeof e.command==="string"?e.command:"",...ty(e)].join(" ")}var UG=/@iistools\/grove-mcp|iis-grove-mcp|grove-mcp\.js|mcp-main\.js/,FG=/grove-mcp\.js|mcp-main\.js/;function Va(e){return UG.test(DG(e))}function Sp(e){return e.split(/[\\/]/).pop()??e}function ry(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 Sp(t.trim().split(/\s+/)[0])}function Ha(e){if(bp(e))return null;let t=typeof e.command==="string"?e.command:"";if(Sp(t).replace(/\.exe$/i,"")==="iis-grove-mcp")return`installed binary (${Sp(t)})`;let r=[t,...ty(e)].find((n)=>FG.test(n));return r?`local build (${Sp(r)})`:null}function Yx(e){if(!/^npx(\.cmd)?$/i.test(ry(e)))return[];let r=(bp(e)?e.command.trim().split(/\s+/):ty(e)).filter((n)=>n.startsWith("--")&&n!=="--yes");return[...new Set(r)]}function Xx(e){let t=e.npm_config_userconfig;if(!t)return[];let r;try{r=CG(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]}/`)===Kx?[]:[qG]}return[]}function Qx(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,jG],o.env=n,o}import{readFileSync as e6,statSync as t6}from"node:fs";import Gs from"node:path";import{chmodSync as VG,copyFileSync as HG,existsSync as ZG,readFileSync as GG,renameSync as JG,rmSync as KG,statSync as BG,writeFileSync as WG}from"node:fs";import{isDeepStrictEqual as YG}from"node:util";var XG=".bak-grove-mcp",tk="\uFEFF";function pt(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function ny(e){let t;try{t=GG(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(tk),n=r?t.slice(1):t,o=BG(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(!
|
|
67
|
-
`:"")}var
|
|
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 f=l.let("missing");for(let h in u){let y=u[h];if(y.length===0)continue;let _=(0,n.propertyInData)(l,d,h,p.opts.ownProperties);if(c.setParams({property:h,depsCount:y.length,deps:y.join(", ")}),p.allErrors)l.if(_,()=>{for(let g of y)(0,n.checkReportMissingProp)(c,g)});else l.if(t._`${_} && (${(0,n.checkMissingProp)(c,y,f)})`),(0,n.reportMissingProp)(c,f),l.else()}}e.validatePropertyDeps=i;function a(c,u=c.schema){let{gen:l,data:d,keyword:p,it:f}=c,h=l.name("valid");for(let y in u){if((0,r.alwaysValidSchema)(f,u[y]))continue;l.if((0,n.propertyInData)(l,d,y,f.opts.ownProperties),()=>{let _=c.subschema({keyword:p,schemaProp:y},h);c.mergeValidEvaluated(_,h)},()=>l.var(h,!0)),c.ok(h)}}e.validateSchemaDeps=a,e.default=o}),l1=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r=xe(),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}),q0=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=gr(),r=be(),n=hr(),o=xe(),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:f,opts:h}=p;if(p.props=!0,h.removeAdditional!=="all"&&(0,o.alwaysValidSchema)(p,c))return;let y=(0,t.allSchemaProperties)(u.properties),_=(0,t.allSchemaProperties)(u.patternProperties);g(),i.ok(r._`${d} === ${n.default.errors}`);function g(){a.forIn("key",l,(R)=>{if(!y.length&&!_.length)w(R);else a.if(S(R),()=>w(R))})}function S(R){let b;if(y.length>8){let E=(0,o.schemaRefOrVal)(p,u.properties,"properties");b=(0,t.isOwnProperty)(a,E,R)}else if(y.length)b=(0,r.or)(...y.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(),!f)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),!f)a.if((0,r.not)(b),()=>a.break())}}function z(R,b,E){let C={keyword:"additionalProperties",dataProp:R,dataPropType:o.Type.Str};if(E===!1)Object.assign(C,{compositeRule:!0,createErrors:!1,allErrors:!1});i.subschema(C,b)}}};e.default=s}),d1=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ms(),r=gr(),n=xe(),o=q0(),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 g of p)d.definedProperties.add(g);if(d.opts.unevaluated&&p.length&&d.props!==!0)d.props=n.mergeEvaluated.props(a,(0,n.toHash)(p),d.props);let f=p.filter((g)=>!(0,n.alwaysValidSchema)(d,c[g]));if(f.length===0)return;let h=a.name("valid");for(let g of f){if(y(g))_(g);else{if(a.if((0,r.propertyInData)(a,l,g,d.opts.ownProperties)),_(g),!d.allErrors)a.else().var(h,!0);a.endIf()}i.it.definedProperties.add(g),i.ok(h)}function y(g){return d.opts.useDefaults&&!d.compositeRule&&c[g].default!==void 0}function _(g){i.subschema({keyword:"properties",schemaProp:g,dataProp:g},h)}}};e.default=s}),p1=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=gr(),r=be(),n=xe(),o=xe(),s={keyword:"patternProperties",type:"object",schemaType:"object",code(i){let{gen:a,schema:c,data:u,parentSchema:l,it:d}=i,{opts:p}=d,f=(0,t.allSchemaProperties)(c),h=f.filter((z)=>(0,n.alwaysValidSchema)(d,c[z]));if(f.length===0||h.length===f.length&&(!d.opts.unevaluated||d.props===!0))return;let y=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:g}=d;S();function S(){for(let z of f){if(y)v(z);if(d.allErrors)w(z);else a.var(_,!0),w(z),a.if(_)}}function v(z){for(let R in y)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&&g!==!0)a.assign(r._`${g}[${R}]`,!0);else if(!b&&!d.allErrors)a.if((0,r.not)(_),()=>a.break())})})}}};e.default=s}),f1=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=xe(),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}),m1=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}),h1=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r=xe(),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(f),o.result(l,()=>o.reset(),()=>o.error(!0));function f(){u.forEach((h,y)=>{let _;if((0,r.alwaysValidSchema)(c,h))s.var(p,!0);else _=o.subschema({keyword:"oneOf",schemaProp:y,compositeRule:!0},p);if(y>0)s.if(t._`${p} && ${l}`).assign(l,!1).assign(d,t._`[${d}, ${y}]`).else();s.if(p,()=>{if(s.assign(l,!0),s.assign(d,y),_)o.mergeEvaluated(_,t.Name)})})}}};e.default=n}),g1=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=xe(),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}),y1=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r=xe(),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(f(),s.reset(),u&&l){let y=i.let("ifClause");s.setParams({ifClause:y}),i.if(p,h("then",y),h("else",y))}else if(u)i.if(p,h("then"));else i.if((0,t.not)(p),h("else"));s.pass(d,()=>s.error(!0));function f(){let y=s.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},p);s.mergeEvaluated(y)}function h(y,_){return()=>{let g=s.subschema({keyword:y},p);if(i.assign(d,p),s.mergeValidEvaluated(g,d),_)i.assign(_,t._`${y}`);else s.setParams({ifClause:y})}}}};function o(s,i){let a=s.schema[i];return a!==void 0&&!(0,r.alwaysValidSchema)(s,a)}e.default=n}),_1=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=xe(),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}),M0=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=N0(),r=a1(),n=j0(),o=c1(),s=u1(),i=sh(),a=l1(),c=q0(),u=d1(),l=p1(),d=f1(),p=m1(),f=h1(),h=g1(),y=y1(),_=_1();function g(S=!1){let v=[d.default,p.default,f.default,h.default,y.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=g}),v1=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:f,self:h}=l;if(!d.validateFormats)return;if(a)y();else _();function y(){let g=s.scopeValue("formats",{ref:h.formats,code:d.code.formats}),S=s.const("fDef",t._`${g}[${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=f.$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 g=h.formats[c];if(!g){z();return}if(g===!0)return;let[S,v,w]=R(g);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 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 g=="object"&&!(g instanceof RegExp)&&g.async){if(!f.$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}),L0=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=[v1().default];e.default=t}),D0=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"]}),U0=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=O0(),r=A0(),n=M0(),o=L0(),s=D0(),i=[t.default,r.default,(0,n.default)(),o.default,s.metadataVocabulary,s.contentVocabulary];e.default=i}),S1=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={}))}),ih=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r=S1(),n=Xl(),o=hs(),s=xe(),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:f}=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(!f)throw Error("discriminator: requires oneOf keyword");let y=c.let("valid",!1),_=c.const("tag",t._`${u}${(0,t.getProperty)(h)}`);c.if(t._`typeof ${_} == "string"`,()=>g(),()=>a.error(!1,{discrError:r.DiscrError.Tag,tag:_,tagName:h})),a.ok(y);function g(){let w=v();c.if(!1);for(let z in w)c.elseIf(t._`${_} === ${z}`),c.assign(y,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 O=0;O<f.length;O++){let F=f[O];if((F===null||F===void 0?void 0:F.$ref)&&!(0,s.schemaHasRulesButRef)(F,p.self.RULES)){let G=F.$ref;if(F=n.resolveRef.call(p.self,p.schemaEnv.root,p.baseId,G),F instanceof n.SchemaEnv)F=F.schema;if(F===void 0)throw new o.default(p.opts.uriResolver,p.baseId,G)}let K=(w=F===null||F===void 0?void 0:F.properties)===null||w===void 0?void 0:w[h];if(typeof K!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${h}"`);b=b&&(R||E(F)),C(K,O)}if(!b)throw Error(`discriminator: "${h}" must be required`);return z;function E({required:O}){return Array.isArray(O)&&O.includes(h)}function C(O,F){if(O.const)q(O.const,F);else if(O.enum)for(let K of O.enum)q(K,F);else throw Error(`discriminator: "properties/${h}" must have "const" or "enum"`)}function q(O,F){if(typeof O!="string"||O in z)throw Error(`discriminator: "${h}" values must be unique strings`);z[O]=F}}}};e.default=i}),b1=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}}),F0=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=rh(),n=U0(),o=ih(),s=b1(),i=["/properties"],a="http://json-schema.org/draft-07/schema";var c=class extends r.default{_addVocabularies(){if(super._addVocabularies(),n.default.forEach((f)=>this.addVocabulary(f)),this.opts.discriminator)this.addKeyword(o.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let f=this.opts.$data?this.$dataMetaSchema(s,i):s;this.addMetaSchema(f,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=ms();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=va();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return d.default}});var p=hs();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return p.default}})}),V0=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicAnchor=void 0;let t=be(),r=hr(),n=Xl(),o=nh(),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)}`,f=d.errSchemaPath==="#"?d.validateName:a(c);l.if(t._`!${p}`,()=>l.assign(p,f))}e.dynamicAnchor=i;function a(c){let{schemaEnv:u,schema:l,self:d}=c.it,{root:p,baseId:f,localRefs:h,meta:y}=u.root,{schemaId:_}=d.opts,g=new n.SchemaEnv({schema:l,schemaId:_,root:p,baseId:f,localRefs:h,meta:y});return n.compileSchema.call(d,g),(0,o.getValidate)(c,g)}e.default=s}),H0=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicRef=void 0;let t=be(),r=hr(),n=nh(),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 y=c.let("_v",t._`${r.default.dynamicAnchors}${(0,t.getProperty)(d)}`);c.if(y,f(y,h),f(l.validateName,h))}else f(l.validateName,h)()}function f(h,y){return y?()=>c.block(()=>{(0,n.callRef)(i,h),c.let(y,!0)}):()=>(0,n.callRef)(i,h)}}e.dynamicRef=s,e.default=o}),w1=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=V0(),r=xe(),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}),$1=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=H0(),r={keyword:"$recursiveRef",schemaType:"string",code:(n)=>(0,t.dynamicRef)(n,n.schema)};e.default=r}),Z0=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=V0(),r=H0(),n=w1(),o=$1(),s=[t.default,r.default,n.default,o.default];e.default=s}),R1=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=sh(),r={keyword:"dependentRequired",type:"object",schemaType:"object",error:t.error,code:(n)=>(0,t.validatePropertyDeps)(n)};e.default=r}),E1=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=sh(),r={keyword:"dependentSchemas",type:"object",schemaType:"object",code:(n)=>(0,t.validateSchemaDeps)(n)};e.default=r}),z1=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=xe(),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}),G0=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=R1(),r=E1(),n=z1(),o=[t.default,r.default,n.default];e.default=o}),P1=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r=xe(),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,_),()=>f(_))));else if(p!==!0)i.forIn("key",c,(_)=>p===void 0?f(_):i.if(y(p,_),()=>f(_)));l.props=!0,s.ok(t._`${u} === ${n.default.errors}`);function f(_){if(a===!1){if(s.setParams({unevaluatedProperty:_}),s.error(),!d)i.break();return}if(!(0,r.alwaysValidSchema)(l,a)){let g=i.name("valid");if(s.subschema({keyword:"unevaluatedProperties",dataProp:_,dataPropType:r.Type.Str},g),!d)i.if((0,t.not)(g),()=>i.break())}}function h(_,g){return t._`!${_} || !${_}[${g}]`}function y(_,g){let S=[];for(let v in _)if(_[v]===!0)S.push(t._`${g} !== ${v}`);return(0,t.and)(...S)}}};e.default=o}),T1=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=be(),r=xe(),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,f){s.forRange("i",f,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}),J0=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=P1(),r=T1(),n=[t.default,r.default];e.default=n}),k1=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"}]}}}}}),I1=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:"#"}}}}}),x1=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:"#"}}}}),C1=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:{}}}}}),O1=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"}}}}),A1=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}}}}),N1=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:[]}}}}),j1=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=k1(),r=I1(),n=x1(),o=C1(),s=O1(),i=A1(),a=N1(),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,f){return l?p.$dataMetaSchema(f,c):f}}e.default=u}),q1=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=rh(),n=U0(),o=Z0(),s=G0(),i=J0(),a=ih(),c=j1(),u="https://json-schema.org/draft/2019-09/schema";var l=class extends r.default{constructor(y={}){super({...y,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){if(super._addVocabularies(),this.addVocabulary(o.default),n.default.forEach((y)=>this.addVocabulary(y)),this.addVocabulary(s.default),this.addVocabulary(i.default),this.opts.discriminator)this.addKeyword(a.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:y,meta:_}=this.opts;if(!_)return;c.default.call(this,y),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=ms();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 f=va();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return f.default}});var h=hs();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return h.default}})}),M1=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=O0(),r=A0(),n=M0(),o=Z0(),s=G0(),i=J0(),a=L0(),c=D0(),u=[o.default,t.default,r.default,(0,n.default)(!0),a.default,c.metadataVocabulary,c.contentVocabulary,s.default,i.default];e.default=u}),L1=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}}}}),D1=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"}}}}}),U1=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"}}}}),F1=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"}}}}),V1=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"}}}}),H1=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"}}}}),Z1=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}}}}),G1=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:[]}}}}),J1=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0});let t=L1(),r=D1(),n=U1(),o=F1(),s=V1(),i=H1(),a=Z1(),c=G1(),u=["/properties"];function l(d){return[t,r,n,o,s,p(this,i),a,p(this,c)].forEach((f)=>this.addMetaSchema(f,void 0,!1)),this;function p(f,h){return d?f.$dataMetaSchema(h,u):h}}e.default=l}),B1=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=rh(),n=M1(),o=ih(),s=J1(),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:f}=this.opts;if(!f)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=ms();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=va();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return l.default}});var d=hs();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return d.default}})}),K1=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(O,F){return{validate:O,compare:F}}e.fullFormats={date:t(s,i),time:t(c(!0),u),"date-time":t(p(!0),f),"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:g,"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,f),"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(O){return O%4===0&&(O%100!==0||O%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(O){let F=n.exec(O);if(!F)return!1;let K=+F[1],G=+F[2],ge=+F[3];return G>=1&&G<=12&&ge>=1&&ge<=(G===2&&r(K)?29:o[G])}function i(O,F){if(!(O&&F))return;if(O>F)return 1;if(O<F)return-1;return 0}let a=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function c(O){return function(K){let G=a.exec(K);if(!G)return!1;let ge=+G[1],ke=+G[2],Ne=+G[3],Fe=G[4],Pe=G[5]==="-"?-1:1,x=+(G[6]||0),M=+(G[7]||0);if(x>23||M>59||O&&!Fe)return!1;if(ge<=23&&ke<=59&&Ne<60)return!0;let B=ke-M*Pe,P=ge-x*Pe-(B<0?1:0);return(P===23||P===-1)&&(B===59||B===-1)&&Ne<61}}function u(O,F){if(!(O&&F))return;let K=new Date("2020-01-01T"+O).valueOf(),G=new Date("2020-01-01T"+F).valueOf();if(!(K&&G))return;return K-G}function l(O,F){if(!(O&&F))return;let K=a.exec(O),G=a.exec(F);if(!(K&&G))return;if(O=K[1]+K[2]+K[3],F=G[1]+G[2]+G[3],O>F)return 1;if(O<F)return-1;return 0}let d=/t|\s/i;function p(O){let F=c(O);return function(G){let ge=G.split(d);return ge.length===2&&s(ge[0])&&F(ge[1])}}function f(O,F){if(!(O&&F))return;let K=new Date(O).valueOf(),G=new Date(F).valueOf();if(!(K&&G))return;return K-G}function h(O,F){if(!(O&&F))return;let[K,G]=O.split(d),[ge,ke]=F.split(d),Ne=i(K,ge);if(Ne===void 0)return;return Ne||u(G,ke)}let y=/\/|:/,_=/^(?:[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 g(O){return y.test(O)&&_.test(O)}let S=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function v(O){return S.lastIndex=0,S.test(O)}let w=-2147483648,z=2147483647;function R(O){return Number.isInteger(O)&&O<=z&&O>=w}function b(O){return Number.isInteger(O)}function E(){return!0}let C=/[^\\]\\Z/;function q(O){if(C.test(O))return!1;try{return new RegExp(O),!0}catch(F){return!1}}}),W1=J((e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;let t=F0(),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:f,self:h}=p;if(!f.validateFormats)return;let y=new t.KeywordCxt(p,h.RULES.all.format.definition,"format");if(y.$data)_();else g();function _(){let v=c.scopeValue("formats",{ref:h.formats,code:f.code.formats}),w=c.const("fmt",r._`${v}[${y.schemaCode}]`);a.fail$data((0,r.or)(r._`typeof ${w} != "object"`,r._`${w} instanceof RegExp`,r._`typeof ${w}.compare != "function"`,S(w)))}function g(){let v=y.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:f.code.formats?r._`${f.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}),Y1=J((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0});let r=K1(),n=W1(),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 f,h;(f=(h=u.opts.code).formats)!==null&&f!==void 0||(h.formats=o._`require("ajv-formats/dist/formats").${p}`);for(let y of l)u.addFormat(y,d[y])}t.exports=e=a,Object.defineProperty(e,"__esModule",{value:!0}),e.default=a}),B0=F0(),X1=q1(),Q1=B1(),ej=_c(Y1(),1),tj=ej.default;function th(e){let t=new e({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return tj(t),t}var Ql=class{_ajv;_ajvDraft7;_ajv2019;_userAjv;constructor(e){this._userAjv=e!==void 0,this._ajv=e}get ajv(){return this._ajv??=th(Q1.Ajv2020)}_engineFor(e){if(this._userAjv)return this.ajv;let t=My(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??=th(X1.Ajv2019);return this._ajvDraft7??=th(B0.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)}}},f5=B0.Ajv;import ah from"node:process";var nw=Symbol.for("mcp.completable");function uh(e){return!!e&&typeof e==="object"&&nw in e}function nj(e){return e[nw]?.complete}function oj(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 sj(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 ed=1024;function K0(e,t){return{method:e.method,params:{...e.params,_meta:{...e.params?._meta,[go]:t}}}}function ij(e){let t=Sn(ya).validateRequest("subscriptions/listen",e);return t.ok?t.value.params?.notifications:void 0}var aj=new Set(["notifications/tools/list_changed","notifications/prompts/list_changed","notifications/resources/list_changed","notifications/resources/updated"]),ow=class{_subs=new Map;_serverCapabilities;_serverInfo;constructor(e=ed,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=ij(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=sj(t,this._serverCapabilities);return this._subs.set(e.id,r),K0({method:"notifications/subscriptions/acknowledged",params:{notifications:r}},e.id)}cancel(e){return this._subs.delete(e)}routeOutbound(e){if(!aj.has(e.method))return"passthrough";let t=e.params?.uri,r=typeof t==="string"?t:void 0,n=cj(e.method,r),o=[];for(let[s,i]of this._subs)if(oj(i,n))o.push(K0({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:{[go]:t,...this._serverInfo!==void 0&&{[zr]:this._serverInfo}}}});return this._subs.clear(),e}};function cj(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 uj=8,lj=600000;function dj(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??uj,roundTimeoutMs:e?.roundTimeoutMs??lj,legacyShim:e?.legacyShim??!0}}function sw(e,t,r){if(r===null||typeof r!=="object"||typeof r.method!=="string")throw new de(X.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=Yb(n);if(o===void 0)throw new de(X.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 pj(){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 ch(e,t){if(e==="tools/call")return{content:[{type:"text",text:t}],isError:!0};throw new de(X.InternalError,t)}var fj=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 ch(e,_0(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(X.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 f;if(d){let _=this._host.resolvedClientCapabilities(n),g=[];for(let[v,w]of Object.entries(l)){let{embedded:z,required:R}=sw(e,v,w);if(z.method!=="roots/list"&&z.params===void 0)throw new de(X.InternalError,`Handler for ${e} returned an input request '${v}' of kind '${z.method}' without params`);if(Ml(R,_)!==void 0)return ch(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)":""}`);g.push([v,z])}let S=S0(a);try{let v={relatedRequestId:n.mcpReq.id,timeout:i,resetTimeoutOnProgress:!0,onprogress:()=>{},signal:S.signal},w=await Promise.all(g.map(async([z,R])=>{try{return[z,await this._dispatchLeg(R,v)]}catch(b){throw S.abort(b),b}}));f=Object.fromEntries(w)}catch(v){if(a.aborted)throw v;return ch(e,`Fulfilling input required by '${e}' failed: ${v instanceof Error?v.message:String(v)}`)}finally{S.dispose()}}else await v0(y0,a);let h={...n,mcpReq:{...n.mcpReq,inputResponses:f,droppedInputResponseKeys:void 0,requestState:_a(p)}};if(p!==void 0){let _=await this._host.verifyRequestState(p,h,e);if(_!==void 0)h=Bm(h,_)}let y=await t(r,h);if(!Yr(y))return y;c=y}}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:pj()};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)}}},mj=new Set(["tools/call","prompts/get","resources/read"]),hj,iw,aw;function lh(e,t){iw(e,t)}function dh(e){return aw(e)}var cw=class extends Wm{_clientCapabilities;_clientVersion;static{hj=(e,t)=>{if(t.clientCapabilities!==void 0)e._clientCapabilities=t.clientCapabilities;if(t.clientInfo!==void 0)e._clientVersion=t.clientInfo},iw=(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())},aw=(e)=>e._serverInfo}_capabilities;_instructions;_jsonSchemaValidator;_cacheHints;_requestStateVerify;_inputRequiredServing;_legacyShim;_legacyInputRequiredShim(){return this._legacyShim??=new fj({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 Ql,this._requestStateVerify=t?.requestState?.verify,this._inputRequiredServing=dj(t?.inputRequired),t?.cacheHints!==void 0){for(let[r,n]of Object.entries(t.cacheHints))if(n!==void 0)Lm(n,`cacheHints['${r}']`);this._cacheHints=t.cacheHints}if(this.setRequestHandler("initialize",(r)=>this._oninitialize(r)),this.setNotificationHandler("notifications/initialized",()=>this.oninitialized?.()),Om(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=Gl(_n,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?.[pn],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(_n.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=Ym(this._capabilities,e),!t&&this._capabilities.logging)this._registerLoggingHandler()}_wrapHandler(e,t){if(e!=="tools/call"){let r=this._cacheHints?.[e],n=mj.has(e);if(r===void 0&&!n)return async(o,s)=>{let i=await t(o,s);if(Yr(i))throw new de(X.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(Yr(i)){if(!n)throw new de(X.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:Ll(i,r)}}return async(r,n)=>{let o=Sn(this._negotiatedProtocolVersion),s=o.validateRequest("tools/call",r);if(!s.ok)throw new de(s.reason==="not-in-era"?X.InternalError:X.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(Yr(i))return i;let a=Am(i),c=o.validateResult("tools/call",a);if(!c.ok)throw new de(c.reason==="not-in-era"?X.InternalError:X.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&&ps(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(X.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=Bm(n,d)}let a;try{a=await t(r,i)}catch(d){if(d instanceof de&&d.code===X.UrlElicitationRequired){if(!o)throw d;throw new de(X.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(!Yr(a))return a;if(!o){if(!this._inputRequiredServing.legacyShim)throw new de(X.InternalError,`Handler for ${e} returned an input-required result, but this request is served on protocol revision ${this._negotiatedProtocolVersion??ho}, 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(X.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,f]of Object.entries(c)){let{embedded:h,required:y}=sw(e,p,f),_=Ml(y,d);if(_!==void 0)throw new Ul({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(X.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=Qb(this._supportedProtocolVersions),n=r.includes(t)?t:r[0]??ho;return this._negotiatedProtocolVersion=n,this.transport?.setProtocolVersion?.(n),{protocolVersion:n,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}_ondiscover(){return{supportedVersions:Om(this._supportedProtocolVersions),capabilities:gj(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(X.InvalidParams,"The last message must contain only tool_result content if any is present");if(!l)throw new de(X.InvalidParams,"tool_result blocks are not matching any tool_use from the previous message")}if(l){let d=new Set(u.filter((f)=>f.type==="tool_use").map((f)=>f.id)),p=new Set(i.filter((f)=>f.type==="tool_result").map((f)=>f.toolUseId));if(d.size!==p.size||![...d].every((f)=>p.has(f)))throw new de(X.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(X.InvalidParams,`Elicitation response content does not match requested schema: ${a.errorMessage}`)}catch(a){if(a instanceof de)throw a;throw new de(X.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 gj(e){return{...e}}var ba=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 Y0;try{let r=$n(t.inputSchema,"input");return this._toolInputSchemaJson[e]=r,r}catch{return}}constructor(e,t){if(this.server=new cw(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"):Y0,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(X.InvalidParams,`Tool ${e.params.name} not found`);if(!r.enabled)throw new de(X.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),Yr(o))return o;return this.server.projectCallToolResult(o,r.outputSchemaJson)}catch(n){if(n instanceof de&&n.code===X.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 vo(e.inputSchema,t??{});if(!n.success)throw new de(X.InvalidParams,`Input validation error: Invalid arguments for tool ${r}: ${n.error}`);return n.data}async validateToolOutput(e,t,r){if(!e.outputSchema)return;if(Yr(t))return;if(t.isError)return;if(t.structuredContent===void 0)throw new de(X.InvalidParams,`Output validation error: Tool ${r} has an output schema but no structured content was provided`);let n=await vo(e.outputSchema,t.structuredContent);if(!n.success)throw new de(X.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 Fm(e),this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return Vm(e),this.handleResourceCompletion(e,e.params.ref);default:throw new de(X.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(X.InvalidParams,`Prompt ${t.name} not found`);if(!r.enabled)throw new de(X.InvalidParams,`Prompt ${t.name} disabled`);if(!r.argsSchema)return Sa;let n=rw(tw(r.argsSchema)?.[e.params.argument.name]);if(!uh(n))return Sa;let o=nj(n);if(!o)return Sa;return ew(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 Sa;throw new de(X.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let n=r.resourceTemplate.completeCallback(e.params.argument.name);if(!n)return Sa;return ew(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(X.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(X.InvalidParams,`Resource ${r} disabled`);return Ll(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 Ll(await o.readCallback(r,s,t),o.cacheHint)}throw new Dl(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?g0(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(X.InvalidParams,`Prompt ${e.params.name} not found`);if(!r.enabled)throw new de(X.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){Lm(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:Q0(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=Q0(e,a,c);if(l.enabled!==void 0)u.enabled=l.enabled;this.sendPromptListChanged()}};if(this._registeredPrompts[e]=u,n){let l=tw(n);if(l){if(Object.values(l).some((d)=>uh(rw(d))))this.setCompletionRequestHandler()}}return u}_createRegisteredTool(e,t,r,n,o,s,i,a,c,u){if(eh(e),n!==void 0)try{let p=$n(n,"input");this._toolInputSchemaJson[e]=p;let f=Hm(p);if(!f.valid)console.warn(`[mcp-sdk] tool '${e}' carries an invalid x-mcp-header declaration and will be excluded by conforming Streamable HTTP clients: ${f.reason}`)}catch{}let l=u,d={title:t,description:r,inputSchema:n,outputSchema:o,outputSchemaJson:X0(o),annotations:s,icons:i,execution:a,_meta:c,handler:u,executor:W0(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")eh(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 f=!1;if(p.paramsSchema!==void 0)d.inputSchema=p.paramsSchema,delete this._toolInputSchemaJson[e],f=!0;if(p.callback!==void 0)d.handler=p.callback,l=p.callback,f=!0;if(f)d.executor=W0(d.inputSchema,l);if(p.outputSchema!==void 0)d.outputSchema=p.outputSchema,d.outputSchemaJson=X0(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,Jl(s),Jl(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,Jl(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 W0(e,t){if(e){let n=t;return async(o,s)=>n(o,s)}let r=t;return async(n,o)=>r(o)}var Y0={type:"object",properties:{}};function X0(e){if(e===void 0)return;try{return $n(e,"output")}catch{return}}function Q0(e,t,r){if(t){let n=r;return async(o,s)=>{let i=await vo(t,o);if(!i.success)throw new de(X.InvalidParams,`Invalid arguments for prompt ${e}: ${i.error}`);return n(i.data,s)}}else{let n=r;return async(o,s)=>n(s)}}function ew(e){return{completion:{values:e.map(String).slice(0,100),total:e.length,hasMore:e.length>100}}}var Sa={completion:{values:[],hasMore:!1}};function tw(e){let t=e;if(t.shape&&typeof t.shape==="object")return t.shape}function yj(e){return e?.type==="optional"}function rw(e){if(!yj(e))return e;return e.def?.innerType??e}var _j=class{_readBuffer;_started=!1;_closed=!1;constructor(e=ah.stdin,t=ah.stdout,r){this._stdin=e,this._stdout=t,this._readBuffer=new Xm({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=Qm(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)})}},uw=3000,vj=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(ha(e)||Zl(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(wn(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 Sj(e){let t=e.params;if(e.method==="initialize"&&!Zm(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(!Fl(t))return{kind:"legacy",reason:"no-claim"};let r=bo(t),n=(r===void 0?[]:Hl(r))[0];if(n!==void 0)return{kind:"invalid-envelope",issue:n};let o=Vl(t);if(o===void 0||!bn.includes(o))return{kind:"unsupported-revision",requested:o??"unknown"};return{kind:"modern",revision:o,classification:{era:"modern",revision:o}}}function lw(e,t={}){let r=t.legacy??"serve",n=t.transport??new _j,o={phase:"opening"},s,i=!1,a=()=>i||o.phase==="closed",c=(E)=>{try{t.onerror?.(E)}catch{}},u=(E,C,q,O)=>n.send({jsonrpc:"2.0",id:E,error:{code:C,message:q,...O!==void 0&&{data:O}}}).catch((F)=>c(yr(F))),l=new ow(t.maxSubscriptions??ed),d=(E)=>{if(!wn(E))return;let C=l.routeOutbound(E);if(C==="passthrough")return;for(let q of C)n.send({jsonrpc:"2.0",...q}).catch((O)=>c(yr(O)));return"handled"},p=async(E)=>{if(rr(E)&&E.method==="subscriptions/listen"){let C=bo(E.params),q=Fl(E.params)?(C===void 0?[]:Hl(C))[0]:{key:"_meta",problem:"the per-request envelope is required on protocol revision 2026-07-28"},O=Vl(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(O===void 0||!bn.includes(O)){let K=new fs({supported:[...bn],requested:O??"unknown"});F={jsonrpc:"2.0",id:E.id,error:{code:K.code,message:K.message,data:K.data}}}else F=l.serve(E);return await n.send("error"in F?F:{jsonrpc:"2.0",method:F.method,params:F.params}).catch((K)=>c(yr(K))),!0}if(wn(E)&&E.method==="notifications/cancelled"){let C=E.params?.requestId;if(C!==void 0&&l.cancel(C))return!0}return!1},f=(E,C,q)=>{let O=Gm({kind:"legacy",reason:C,...q!==void 0&&{requestedVersion:q}},bn);if(O===void 0)return Promise.resolve();return c(Error(`Rejected 2025-era request on a modern-only stdio connection (${O.cell}): ${O.message}`)),u(E.id,O.code,O.message,O.data)},h=(E)=>{if(i||E===s)return;R()},y=async(E,C)=>{let q=await e({era:E}),O=q instanceof ba?q.server:q;if(E==="modern")Km(O,C),lh(O,bn),l.setServerCapabilities(O.getCapabilities(),dh(O));let F=new vj(n,()=>h(F),E==="modern"?d:void 0);return await q.connect(F),{product:q,channel:F}},_=(E)=>E.product.close().catch((C)=>c(yr(C))),g=async(E)=>{s=E.channel;try{if(!await E.channel.whenRequestsAnswered(uw))c(Error(`Discarded the probe instance with requests still unanswered after ${uw}ms; continuing with the fallback`));await E.product.close()}catch(C){c(yr(C))}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"&&!Zm(E.params)){await f(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)&&!wn(E)){c(Error("Discarded a JSON-RPC response received before the connection negotiated an era"));return}let C=Sj(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(rr(E))await u(E.id,X.InvalidParams,q,{envelope:C.issue});else c(Error(`Discarded a notification with a malformed envelope: ${q}`));return}case"unsupported-revision":if(rr(E)){let q=new fs({supported:[...bn],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(rr(E)&&E.method==="server/discover"){if(o.phase==="probe"){o.instance.channel.deliver(E,{classification:C.classification});return}let q=await y("modern",C.revision);if(a()){await _(q);return}o={phase:"probe",instance:q},q.channel.deliver(E,{classification:C.classification});return}if(o.phase==="probe"){if(wn(E)){o.instance.channel.deliver(E,{classification:C.classification});return}o={phase:"pinned",era:"modern",instance:o.instance}}else{let q=await y("modern",C.revision);if(a()){await _(q);return}o={phase:"pinned",era:"modern",instance:q}}if(await p(E))return;o.instance.channel.deliver(E,{classification:C.classification});return;case"legacy":{if(r==="reject"){if(rr(E))await f(E,C.reason,C.requestedVersion);return}if(o.phase==="probe"){if(await g(o.instance),a())return;o={phase:"opening"}}let q=await y("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(C){if(rr(E))await u(E.id,X.InternalError,"Internal server error");c(yr(C))}}}finally{w=!1}},R=async()=>{if(i||o.phase==="closed")return;i=!0;let E=o;o={phase:"closed"};for(let C of l.teardownAll())await n.send(C).catch((q)=>c(yr(q)));if(E.phase==="probe"||E.phase==="pinned")await E.instance.product.close().catch((C)=>c(yr(C)));await n.close().catch((C)=>c(yr(C)))};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((C)=>c(yr(C)))};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 Oe extends Error{exitCode;statusCode;retryAfterS;code;publisherBlock;constructor(e,t=1,r,n,o,s){super(e);this.exitCode=t;this.statusCode=r;this.retryAfterS=n;this.code=o;this.publisherBlock=s;this.name="CliError"}}class wo extends Oe{constructor(e){super("Could not reach the account service to renew the session; try again.",xt.NETWORK);this.name="RefreshUnavailableError",this.cause=e}}var xt={SUCCESS:0,ERROR:1,USAGE:2,AUTH:3,RATE_LIMITED:4,NETWORK:5};var dw="grove-cli/0.1.15";var pw="X-Grove-Agent",mw=50000;function fw(e){return e&&/^\d+$/.test(e)?Number(e):void 0}function bj(e){if(e===null||typeof e!=="object")return;let t=e;if(typeof t.httpStatus!=="number"||typeof t.vendor!=="string")return;return{httpStatus:t.httpStatus,vendor:t.vendor,...typeof t.retryAfterSeconds==="number"?{retryAfterSeconds:t.retryAfterSeconds}:{}}}class Rn{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??dw,this.extraHeaders={...t.headers},this.onUnauthorized=t.onUnauthorized}setAgentName(e){let t=(e??"").toLowerCase().replace(/[^a-z0-9._-]+/g,"-").slice(0,40).replace(/^-+|-+$/g,"");if(t)this.extraHeaders[pw]=t;else delete this.extraHeaders[pw]}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 Oe&&n.statusCode===401)||!this.onUnauthorized)throw n;let s;try{s=await this.onUnauthorized(this.token)}catch(i){if(i instanceof wo)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(l){let d=l instanceof Error?l.message:String(l),p=l instanceof Error&&(l.name==="TimeoutError"||l.name==="AbortError");throw new Oe(`Cannot reach API at ${this.baseUrl}: ${d}`,xt.NETWORK,void 0,void 0,p?"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 l=await i.json();if(l&&typeof l==="object"&&"data"in l&&Object.keys(l).length===1)return l.data;return l}let a=`${i.status} ${i.statusText}`,c,u;try{let l=await i.json();if(typeof l.message==="string")a=l.message;else if(typeof l.error==="string")a=l.error;if(typeof l.code==="string")c=l.code;u=bj(l.publisherBlock)}catch{}switch(i.status){case 401:throw new Oe("Session expired. Run `grove auth login` to re-authenticate.",xt.AUTH,401,void 0,c);case 429:{let l=fw(i.headers.get("Retry-After")),d=l!==void 0?`Rate limited. Retry in ${l}s`:"Rate limited. Try again later";throw new Oe(d,xt.RATE_LIMITED,429,l,c)}default:if(i.status===503)throw new Oe(`Server error: ${a}`,xt.ERROR,503,fw(i.headers.get("Retry-After")),c);if(i.status>=500)throw new Oe(`Server error: ${a}`,xt.ERROR,i.status,void 0,c);throw new Oe(a,xt.ERROR,i.status,void 0,c,u)}}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 Oe&&n.statusCode===403)throw new Oe(`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,void 0,n.code);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(a){let c=a instanceof Error?a.message:String(a);throw new Oe(`Cannot reach API at ${this.baseUrl}: ${c}`,xt.NETWORK)}if(this.verbose)process.stderr.write(`<-- ${s.status} ${s.statusText}
|
|
64
|
+
`);if(s.ok)return s.text();let i;try{let a=await s.json();if(typeof a.code==="string")i=a.code}catch{}throw new Oe(`${s.status} ${s.statusText}`,xt.ERROR,s.status,void 0,i)}}var wj=20;async function hw(e,t){let r=await e.get("/api/v1/views"),n=Array.isArray(r)?r:[];if(n.some((c)=>c.id===t))return t;let o=n.find((c)=>c.name===t);if(o)return o.id;let s=t.toLowerCase(),i=n.filter((c)=>c.name.toLowerCase()===s);if(i.length===1)return i[0].id;if(i.length>1)throw new Oe(`view name is ambiguous: ${i.map((c)=>c.name).join(", ")} (use the id)`,xt.USAGE);let a=n.slice(0,wj).map((c)=>c.name);throw new Oe(`no view named ${t}; ${a.length>0?`views: ${a.join(", ")}`:"you have no views"}`,xt.USAGE)}import{dirname as TG,join as kG}from"node:path";import{isDeepStrictEqual as pG}from"node:util";import RI from"node:process";import xo from"node:fs";import EI from"node:path";import Za from"node:crypto";import fG from"node:assert";var $o=(e)=>{let t=typeof e;return e!==null&&(t==="object"||t==="function")};var ph=new Set(["__proto__","prototype","constructor"]),$j=new Set("0123456789");function td(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(ph.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(ph.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"&&!$j.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(ph.has(r))return[];t.push(r);break}case"index":throw Error("Index was not closed");case"start":{t.push("");break}}return t}function fh(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 gw(e,t){if(fh(e,t))throw Error("Cannot use string index")}function yw(e,t,r){if(!$o(e)||typeof t!=="string")return r===void 0?e:r;let n=td(t);if(n.length===0)return r;for(let o=0;o<n.length;o++){let s=n[o];if(fh(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 mh(e,t,r){if(!$o(e)||typeof t!=="string")return e;let n=e,o=td(t);for(let s=0;s<o.length;s++){let i=o[s];if(gw(e,i),s===o.length-1)e[i]=r;else if(!$o(e[i]))e[i]=typeof o[s+1]==="number"?[]:{};e=e[i]}return n}function _w(e,t){if(!$o(e)||typeof t!=="string")return!1;let r=td(t);for(let n=0;n<r.length;n++){let o=r[n];if(gw(e,o),n===r.length-1)return delete e[o],!0;if(e=e[o],!$o(e))return!1}}function vw(e,t){if(!$o(e)||typeof t!=="string")return!1;let r=td(t);if(r.length===0)return!1;for(let n of r){if(!$o(e)||!(n in e)||fh(e,n))return!1;e=e[n]}return!0}import Qe from"node:path";import Sw from"node:os";import hh from"node:process";var En=Sw.homedir(),gh=Sw.tmpdir(),{env:gs}=hh,Rj=(e)=>{let t=Qe.join(En,"Library");return{data:Qe.join(t,"Application Support",e),config:Qe.join(t,"Preferences",e),cache:Qe.join(t,"Caches",e),log:Qe.join(t,"Logs",e),temp:Qe.join(gh,e)}},Ej=(e)=>{let t=gs.APPDATA||Qe.join(En,"AppData","Roaming"),r=gs.LOCALAPPDATA||Qe.join(En,"AppData","Local");return{data:Qe.join(r,e,"Data"),config:Qe.join(t,e,"Config"),cache:Qe.join(r,e,"Cache"),log:Qe.join(r,e,"Log"),temp:Qe.join(gh,e)}},zj=(e)=>{let t=Qe.basename(En);return{data:Qe.join(gs.XDG_DATA_HOME||Qe.join(En,".local","share"),e),config:Qe.join(gs.XDG_CONFIG_HOME||Qe.join(En,".config"),e),cache:Qe.join(gs.XDG_CACHE_HOME||Qe.join(En,".cache"),e),log:Qe.join(gs.XDG_STATE_HOME||Qe.join(En,".local","state"),e),temp:Qe.join(gh,t,e)}};function yh(e,{suffix:t="nodejs"}={}){if(typeof e!=="string")throw TypeError(`Expected a string, got ${typeof e}`);if(t)e+=`-${t}`;if(hh.platform==="darwin")return Rj(e);if(hh.platform==="win32")return Ej(e);return zj(e)}import Aj from"node:path";import je from"node:fs";import{promisify as Ct}from"node:util";var Pj=(e,t)=>{let{onError:r}=t;return function(...o){return e.apply(void 0,o).catch(r)}},Pr=Pj;var Tj=(e,t)=>{let{onError:r}=t;return function(...o){try{return e.apply(void 0,o)}catch(s){return r(s)}}},_r=Tj;var bw=250;var kj=(e,t)=>{let{isRetriable:r}=t;return function(o){let{timeout:s}=o,i=o.interval??bw,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((f)=>setTimeout(f,d)).then(()=>c.apply(void 0,u));else return c.apply(void 0,u)})}}},Tr=kj;var Ij=(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}}}},kr=Ij;import $w from"node:process";var wa={isChangeErrorOk:(e)=>{if(!wa.isNodeError(e))return!1;let{code:t}=e;if(t==="ENOSYS")return!0;if(!ww&&(t==="EINVAL"||t==="EPERM"))return!0;return!1},isNodeError:(e)=>e instanceof Error,isRetriableError:(e)=>{if(!wa.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(!wa.isNodeError(e))throw e;if(wa.isChangeErrorOk(e))return;throw e}},_h=wa;var $a={onError:_h.onChangeError},Ut={onError:()=>{return}},ww=$w.getuid?!$w.getuid():!1,$t={isRetriable:_h.isRetriableError};var xj={attempt:{chmod:Pr(Ct(je.chmod),$a),chown:Pr(Ct(je.chown),$a),close:Pr(Ct(je.close),Ut),fsync:Pr(Ct(je.fsync),Ut),mkdir:Pr(Ct(je.mkdir),Ut),realpath:Pr(Ct(je.realpath),Ut),stat:Pr(Ct(je.stat),Ut),unlink:Pr(Ct(je.unlink),Ut),chmodSync:_r(je.chmodSync,$a),chownSync:_r(je.chownSync,$a),closeSync:_r(je.closeSync,Ut),existsSync:_r(je.existsSync,Ut),fsyncSync:_r(je.fsync,Ut),mkdirSync:_r(je.mkdirSync,Ut),realpathSync:_r(je.realpathSync,Ut),statSync:_r(je.statSync,Ut),unlinkSync:_r(je.unlinkSync,Ut)},retry:{close:Tr(Ct(je.close),$t),fsync:Tr(Ct(je.fsync),$t),open:Tr(Ct(je.open),$t),readFile:Tr(Ct(je.readFile),$t),rename:Tr(Ct(je.rename),$t),stat:Tr(Ct(je.stat),$t),write:Tr(Ct(je.write),$t),writeFile:Tr(Ct(je.writeFile),$t),closeSync:kr(je.closeSync,$t),fsyncSync:kr(je.fsyncSync,$t),openSync:kr(je.openSync,$t),readFileSync:kr(je.readFileSync,$t),renameSync:kr(je.renameSync,$t),statSync:kr(je.statSync,$t),writeSync:kr(je.writeSync,$t),writeFileSync:kr(je.writeFileSync,$t)}},St=xj;import Ro from"node:process";var Rw="utf8",vh=438,Ew=511;var zw={},Pw=Ro.geteuid?Ro.geteuid():-1,Tw=Ro.getegid?Ro.getegid():-1;var kw=1000,Iw=!!Ro.getuid,BW=Ro.getuid?!Ro.getuid():!1,Sh=128;var xw=(e)=>e instanceof Error&&("code"in e);var bh=(e)=>typeof e==="string",rd=(e)=>e===void 0;import Oj from"node:path";import ys from"node:process";import Cw from"node:process";var Ow=Cw.platform==="linux",nd=Cw.platform==="win32";var wh=["SIGHUP","SIGINT","SIGTERM"];if(!nd)wh.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(Ow)wh.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var Aw=wh;class Nw{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(nd&&(e!=="SIGINT"&&e!=="SIGTERM"&&e!=="SIGKILL"))ys.kill(ys.pid,"SIGTERM");else ys.kill(ys.pid,e)},this.hook=()=>{ys.once("exit",()=>this.exit());for(let e of Aw)try{ys.once(e,()=>this.exit(e))}catch{}},this.register=(e)=>(this.callbacks.add(e),()=>{this.callbacks.delete(e)}),this.hook()}}var jw=new Nw;var Cj=jw.register,qw=Cj;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],St.attempt.unlink(e)},purgeSync:(e)=>{if(!Qt.store[e])return;delete Qt.store[e],St.attempt.unlinkSync(e)},purgeSyncAll:()=>{for(let e in Qt.store)Qt.purgeSync(e)},truncate:(e)=>{let t=Oj.basename(e);if(t.length<=Sh)return e;let r=/^(\.?)(.*?)((?:\.[^.]+)?(?:\.tmp-\d{10}[a-f0-9]{6})?)$/.exec(t);if(!r)return e;let n=t.length-Sh;return`${e.slice(0,-t.length)}${r[1]}${r[2].slice(0,-n)}${r[3]}`}};qw(Qt.purgeSyncAll);var Ra=Qt;function $h(e,t,r=zw){if(bh(r))return $h(e,t,{encoding:r});let o={timeout:r.timeout??kw},s=null,i=null,a=null;try{let c=St.attempt.realpathSync(e),u=!!c;e=c||e,[i,s]=Ra.get(e,r.tmpCreate||Ra.create,r.tmpPurge!==!1);let l=Iw&&rd(r.chown),d=rd(r.mode);if(u&&(l||d)){let p=St.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=Aj.dirname(e);St.attempt.mkdirSync(p,{mode:Ew,recursive:!0})}if(a=St.retry.openSync(o)(i,"w",r.mode||vh),r.tmpCreated)r.tmpCreated(i);if(bh(t))St.retry.writeSync(o)(a,t,0,r.encoding||Rw);else if(!rd(t))St.retry.writeSync(o)(a,t,0,t.length,0);if(r.fsync!==!1)if(r.fsyncWait!==!1)St.retry.fsyncSync(o)(a);else St.attempt.fsync(a);if(St.retry.closeSync(o)(a),a=null,r.chown&&(r.chown.uid!==Pw||r.chown.gid!==Tw))St.attempt.chownSync(i,r.chown.uid,r.chown.gid);if(r.mode&&r.mode!==vh)St.attempt.chmodSync(i,r.mode);try{St.retry.renameSync(o)(i,e)}catch(p){if(!xw(p))throw p;if(p.code!=="ENAMETOOLONG")throw p;St.retry.renameSync(o)(i,Ra.truncate(e))}s(),i=null}finally{if(a)St.attempt.closeSync(a);if(i)Ra.purge(i)}}var PI=Mp(aT(),1),TI=Mp(kT(),1);var BH=(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(!KH(o,s)&&n)return;Object.defineProperty(e,r,s)},KH=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)},WH=(e,t)=>{let r=Object.getPrototypeOf(t);if(r===Object.getPrototypeOf(e))return;Object.setPrototypeOf(e,r)},YH=(e,t)=>`/* Wrapped ${e}*/
|
|
65
|
+
${t}`,XH=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),QH=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),e9=(e,t,r)=>{let n=r===""?"":`with ${r.trim()}() `,o=YH.bind(null,n,t.toString());Object.defineProperty(o,"name",QH);let{writable:s,enumerable:i,configurable:a}=XH;Object.defineProperty(e,"toString",{value:o,writable:s,enumerable:i,configurable:a})};function Cg(e,t,{ignoreNonConfigurable:r=!1}={}){let{name:n}=e;for(let o of Reflect.ownKeys(t))BH(e,t,o,r);return WH(e,t),e9(e,t,n),e}var t9=(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)},f=()=>{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(f,n);if(h)c=e.apply(d,l);return c};return Cg(u,e),u.cancel=()=>{if(i)clearTimeout(i),i=void 0;if(a)clearTimeout(a),a=void 0},u},Og=t9;var Co=Mp(SI(),1);var sG=Object.prototype.toString;function wI(e,t,r){if(!e)return!1;if(e.constructor===t)return!0;return sG.call(e)===r}function $I(e){return wI(e,Uint8Array,"[object Uint8Array]")}function iG(e){return wI(e,ArrayBuffer,"[object ArrayBuffer]")}function aG(e){return $I(e)||iG(e)}function cG(e){if(!$I(e))throw TypeError(`Expected \`Uint8Array\`, got \`${typeof e}\``)}function uG(e){if(!aG(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((o,s)=>o+s.length,0);let r=new Uint8Array(t),n=0;for(let o of e)cG(o),r.set(o,n),n+=o.length;return r}var bI={utf8:new globalThis.TextDecoder("utf8")};function Kg(e,t="utf8"){return uG(e),bI[t]??=new globalThis.TextDecoder(t),bI[t].decode(e)}function lG(e){if(typeof e!=="string")throw TypeError(`Expected \`string\`, got \`${typeof e}\``)}var dG=new globalThis.TextEncoder;function gp(e){return lG(e),dG.encode(e)}var j7=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));var mG=TI.default.default,zI="aes-256-cbc",Zs=()=>Object.create(null),hG=(e)=>e!==void 0&&e!==null,gG=(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`)},yp="__internal__",Wg=`${yp}.migrations.version`;class _p{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=yh(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 PI.Ajv2020({allErrors:!0,useDefaults:!0,...t.ajvOptions});mG(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=EI.resolve(t.cwd,`${t.configName??"config"}${r}`);let n=this.store,o=Object.assign(Zs(),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{fG.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 ${yp} key, as it's used to manage this module internal operations.`);let{store:r}=this,n=(o,s)=>{if(gG(o,s),this.#e.accessPropertiesByDotNotation)mh(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 vw(this.store,e);return e in this.store}reset(...e){for(let t of e)if(hG(this.#r[t]))this.set(t,this.#r[t])}delete(e){let{store:t}=this;if(this.#e.accessPropertiesByDotNotation)_w(t,e);else delete t[e];this.store=t}clear(){this.store=Zs();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=xo.readFileSync(this.path,this.#t?null:"utf8"),t=this._encryptData(e),r=this._deserialize(t);return this._validate(r),Object.assign(Zs(),r)}catch(e){if(e?.code==="ENOENT")return this._ensureDirectory(),Zs();if(this.#e.clearInvalidConfig&&e.name==="SyntaxError")return Zs();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:Kg(e);try{let t=e.slice(0,16),r=Za.pbkdf2Sync(this.#t,t.toString(),1e4,32,"sha512"),n=Za.createDecipheriv(zI,r,t),o=e.slice(17),s=typeof o==="string"?gp(o):o;return Kg(Bg([n.update(s),n.final()]))}catch{}return e.toString()}_handleChange(e,t){let r=e(),n=()=>{let o=r,s=e();if(pG(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(){xo.mkdirSync(EI.dirname(this.path),{recursive:!0})}_write(e){let t=this._serialize(e);if(this.#t){let r=Za.randomBytes(16),n=Za.pbkdf2Sync(this.#t,r.toString(),1e4,32,"sha512"),o=Za.createCipheriv(zI,n,r);t=Bg([r,gp(":"),o.update(gp(t)),o.final()])}if(RI.env.SNAP)xo.writeFileSync(this.path,t,{mode:this.#e.configFileMode});else try{$h(this.path,t,{mode:this.#e.configFileMode})}catch(r){if(r?.code==="EXDEV"){xo.writeFileSync(this.path,t,{mode:this.#e.configFileMode});return}throw r}}_watch(){if(this._ensureDirectory(),!xo.existsSync(this.path))this._write(Zs());if(RI.platform==="win32")xo.watch(this.path,{persistent:!1},Og(()=>{this.events.dispatchEvent(new Event("change"))},{wait:100}));else xo.watchFile(this.path,{persistent:!1},Og(()=>{this.events.dispatchEvent(new Event("change"))},{wait:5000}))}_migrate(e,t,r){let n=this._get(Wg,"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(Wg,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)||!Co.default.eq(n,t))this._set(Wg,t)}_containsReservedKey(e){if(typeof e==="object"){if(Object.keys(e)[0]===yp)return!0}if(typeof e!=="string")return!1;if(this.#e.accessPropertiesByDotNotation){if(e.startsWith(`${yp}.`))return!0;return!1}return!1}_isVersionInRangeFormat(e){return Co.default.clean(e)===null}_shouldPerformMigration(e,t,r){if(this._isVersionInRangeFormat(e)){if(t!=="0.0.0"&&Co.default.satisfies(t,e))return!1;return Co.default.satisfies(r,e)}if(Co.default.lte(e,t))return!1;if(Co.default.gt(e,r))return!1;return!0}_get(e,t){return yw(this.store,e,t)}_set(e,t){let{store:r}=this;mh(r,e,t),this.store=r}}import{chmodSync as IG,existsSync as xG}from"fs";import{randomBytes as yG}from"node:crypto";import{closeSync as kI,openSync as II,readFileSync as _G,statSync as xI,unlinkSync as vp,writeSync as vG}from"node:fs";var CI=30000,SG=8000,bG=2*CI,wG=1e4,$G=100;function RG(e){try{return process.kill(e,0),!0}catch(t){return t.code==="EPERM"}}function Yg(e){try{return _G(e,"utf8")}catch(t){if(t.code==="ENOENT")return null;throw t}}function Xg(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-xI(e).mtimeMs}catch{return}}function OI(e,t,r){let n=EG(e,t,r);if(n===void 0)return!1;if(n>CI)return!0;return t!==null&&n>SG&&!RG(t.pid)}function zG(e,t){let r=`${e}.break`,n;try{n=II(r,"wx",384)}catch(o){if(o.code!=="EEXIST")throw o;try{if(Date.now()-xI(r).mtimeMs>wG)vp(r)}catch(s){if(s.code!=="ENOENT")throw s}return!1}try{kI(n);let o=Yg(e);if(o===t&&OI(e,Xg(o),Date.now()))try{vp(e)}catch(s){if(s.code!=="ENOENT")throw s}}finally{vp(r)}return!0}function PG(e,t){let r;try{r=II(e,"wx",384)}catch(n){if(n.code==="EEXIST")return!1;throw n}try{vG(r,JSON.stringify(t))}finally{kI(r)}return!0}async function AI(e){let t={pid:process.pid,ts:0,nonce:yG(8).toString("hex")},r=Date.now();for(;;){let n=Date.now();if(t.ts=n,PG(e,t))return{release:()=>{try{if(Xg(Yg(e))?.nonce!==t.nonce)return;vp(e)}catch{}}};let o=Yg(e);if(o===null)continue;if(OI(e,Xg(o),n)&&zG(e,o))continue;if(n-r>=bG)return null;await new Promise((s)=>setTimeout(s,$G))}}var Qg=null;function CG(e){try{if(xG(e.path))IG(e.path,384)}catch{}}function MI(){return Gs().path}function Gs(){if(!Qg){let e=new _p({projectName:"grove-cli",configFileMode:384,defaults:{currentProfile:"default",profiles:{}}});CG(e),Qg=e}return Qg}function ry(e,t){let r=Gs(),n=r.get("profiles");n[e]=t,r.set("profiles",n)}function Gn(e){return Gs().get("profiles")[e]??null}function Sp(){return Gs().get("currentProfile")}function LI(){let e=Sp();return Gn(e)}var DI="https://grove.iis.tools",NI="No API URL configured. Run: grove auth login (or set GROVE_API_URL)";function UI(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??jI(e.profile);if(!d)throw new Oe(NI,xt.AUTH);return{apiUrl:d,token:a,authType:"api-key"}}let c=r??s,u=t??o??jI(e.profile);if(c&&u)return{apiUrl:u,token:c,authType:"jwt"};if(c)throw new Oe(NI,xt.AUTH);let l=e.profile?Gn(e.profile):LI();if(l){let d=c??l.token??l.apiKey,p=u??l.baseUrl;if(d&&p){let f=l.apiKey&&!c?"api-key":"jwt";return{apiUrl:p,token:d,authType:f}}}throw new Oe("Not authenticated. Run: grove auth login",xt.AUTH)}function jI(e){return(e?Gn(e):LI())?.baseUrl}function ny(e){return e.accountUrl??process.env.GROVE_ACCOUNT_URL??"https://account.iis.tools"}function OG(e){let t=ny(e);return new Rn(t,{verbose:e.verbose,timeout:e.timeout?parseInt(e.timeout,10):void 0})}var ey=8000,ty=new Map;function AG(e){return kG(TG(Gs().path),`refresh-${encodeURIComponent(e)}.lock`)}function FI(e,t={},r){let n=`${Gs().path}\x00${e}`,o=ty.get(n);if(o)return o;let s=MG(e,t,r).finally(()=>{ty.delete(n)});return ty.set(n,s),s}var NG=30000;function jG(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()+NG}catch{return!1}}function qI(e,t){if(t===void 0||!e?.token||!e.refreshToken)return null;if(e.token===t||!jG(e.token))return null;return{token:e.token,refreshToken:e.refreshToken}}function qG(e){return e instanceof Oe&&(e.statusCode===400||e.statusCode===401)}async function MG(e,t,r){let n=qI(Gn(e),r);if(n)return n;let o;try{o=await AI(AG(e))}catch(s){throw new wo(s)}if(!o)throw new wo;try{let s=Gn(e);if(!s?.refreshToken)return null;let i=qI(s,r);if(i)return i;let a=t.timeout?parseInt(t.timeout,10):ey,u=await OG({...t,timeout:String(Math.min(a||ey,ey))}).post("/auth/refresh",{refreshToken:s.refreshToken});return ry(e,{...s,token:u.accessToken,refreshToken:u.refreshToken}),{token:u.accessToken,refreshToken:u.refreshToken}}catch(s){if(qG(s))return null;throw new wo(s)}finally{o.release()}}import{spawn as LG}from"node:child_process";import{createHash as HI,randomBytes as bp}from"node:crypto";import{createServer as VI}from"node:http";function ZI(){return bp(32).toString("base64url")}function DG(e){return HI("sha256").update(e).digest("base64url")}function GI(e,t,r,n){let o=new URL(`${e.replace(/\/$/,"")}/auth/cli`);return o.searchParams.set("response_type","code"),o.searchParams.set("code_challenge",DG(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 JI(){let e,t,r=new Promise((n,o)=>{e=n,t=o});return r.catch(()=>{}),{promise:r,resolve:e,reject:t}}var UG="<!doctype html><html><body><h2>Signed in to Grove.</h2><p>You can close this window.</p></body></html>",FG="<!doctype html><html><body><h2>Sign-in link invalid or expired.</h2><p>Start the sign-in again.</p></body></html>";async function BI(e){let t=ZI(),r=bp(16).toString("hex"),n=JI(),o=(d,p)=>{let f=new URL(d.url??"/","http://localhost");if(d.method!=="GET"||f.pathname!=="/callback"){p.writeHead(404).end();return}let h=f.searchParams.get("code");if(!h||f.searchParams.get("state")!==r){p.writeHead(400,{"Content-Type":"text/html; charset=utf-8"}).end(FG);return}p.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}).end(UG),n.resolve(h)},s=VI(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=VI(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:GI(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 VG=3000,HG=60000,ZG=1e4;async function KI(e){let t=ZI(),r=bp(16).toString("hex"),n=bp(32).toString("base64url"),o=HI("sha256").update(n).digest("base64url"),s=e.apiUrl.replace(/\/$/,""),i=`${s}/auth/cli/callback?k=${o}`,a=e.pollIntervalMs??VG,c=new Rn(s,{headers:{Authorization:`Relay ${n}`},timeout:ZG,userAgent:e.userAgent}),u=JI(),l=!1,d,p=(h)=>{if(l)return;d=setTimeout(()=>void f(),h),d.unref()},f=async()=>{let h=a;try{let y=await c.get("/auth/cli/relay",{k:o});if(!l&&typeof y?.code==="string"&&y.state===r){u.resolve(y.code);return}}catch(y){if(y instanceof Oe&&y.retryAfterS!==void 0)h=Math.min(Math.max(a,y.retryAfterS*1000),HG)}p(h)};return p(a),{mode:"relay",authUrl:GI(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 WI(e,t,r){return new Rn(e).post("/auth/token",{code:r,codeVerifier:t.codeVerifier,redirectUri:t.redirectUri})}function YI(e=process.env,t=process.platform){if(e.SSH_CONNECTION||e.SSH_TTY)return!0;return t==="linux"&&!e.DISPLAY&&!e.WAYLAND_DISPLAY}function XI(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=LG(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 GG}from"node:crypto";var JG=300000,BG=50000,KG=1e4;class Oo{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 Oo({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??BG}get progressIntervalMs(){return this.deps?.progressIntervalMs??KG}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??JG,o=[r],s,i=new Promise((h)=>s=h),a=!1,c=!1,u=(h)=>{if(a)return;a=!0,clearTimeout(l);for(let y of o)y.close();this.pending=null,this.live=null,s(h)},l=setTimeout(()=>u("expired"),n);l.unref();let d=(h)=>{h.waitForCode().then(async(y)=>{if(a||c)return;c=!0;try{let _=await e.complete(h,y),g=this.safeBuild();if(!g){u("failed");return}this.adopt(g),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,f={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),f.relayUrl=h.authUrl,h.authUrl}),p},elicitationId:GG(),expiresAt:Date.now()+n,elicited:!1,browser:null,done:i,abort:()=>u("aborted")};if(this.live=f,this.closed)f.abort();return f}}var Ga="0.5.0",oy=`grove-mcp/${Ga}`;function QI(){let e=process.env.GROVE_PROFILE,t=e??Sp(),r=Boolean(process.env.GROVE_TOKEN||process.env.GROVE_API_KEY),n=Gn(t);if(!r&&!n)return null;let o=UI({profile:e});if(!r&&o.authType==="jwt"&&!n?.refreshToken&&WG(o.token))return null;let s=o.authType==="jwt"&&!!n?.refreshToken;return{client:new Rn(o.apiUrl,{apiKey:o.authType==="api-key"?o.token:void 0,token:o.authType==="jwt"?o.token:void 0,userAgent:oy,onUnauthorized:s?(a)=>FI(t,{accountUrl:process.env.GROVE_ACCOUNT_URL},a):void 0}),canAutoRefresh:s,profileKey:r?void 0:n?.refreshToken??o.token}}function WG(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 ex(e={}){let t=ny({}),r=process.env.GROVE_PROFILE??Sp(),n=()=>process.env.GROVE_API_URL??Gn(r)?.baseUrl??DI;return new Oo(QI(),{build:QI,startLogin:(o)=>o==="relay"?KI({accountUrl:t,apiUrl:n(),pollIntervalMs:e.relayPollMs,userAgent:oy}):BI({accountUrl:t}),complete:async(o,s)=>{let i=await WI(t,o,s);return ry(r,{baseUrl:n(),token:i.accessToken,refreshToken:i.refreshToken}),{accountId:i.accountId}},ttlMs:e.ttlMs,loginWaitMs:e.loginWaitMs,progressIntervalMs:e.progressIntervalMs,openBrowser:e.openBrowser??XI,canOpenBrowser:e.openBrowser?void 0:()=>!YI()})}var tx="npm";import{lstatSync as C6,mkdirSync as O6,realpathSync as A6}from"node:fs";import{homedir as N6}from"node:os";import j6 from"node:path";import{existsSync as YG,statSync as XG}from"node:fs";import rx from"node:path";var Js=["claude-code","claude-desktop","cursor","vscode"],nx={"claude-code":"Claude Code","claude-desktop":"Claude Desktop",cursor:"Cursor",vscode:"VS Code"};function ox(e,t,r){return(e==="win32"?t.USERPROFILE:t.HOME)||r}function wp(e,t,r,n){let o=t==="win32"?rx.win32:rx.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 sy(e){if(e.legacyFile)try{if(XG(e.legacyFile).size>0)return e.legacyFile}catch{}return e.file}function sx(e){return e.detect.some((t)=>YG(t))}import{readFileSync as QG,readlinkSync as e6,statSync as t6}from"node:fs";import Ja from"node:path";var r6="@iistools/grove-mcp",ax="https://registry.npmjs.org/",n6=`--@iistools:registry=${ax}`;function o6(e){return e==="win32"?Ja.win32:Ja.posix}function ix(e){try{return t6(e).isFile()}catch{return!1}}function cx(e,t,r){let n=o6(e),o=e==="win32"?"npx.cmd":"npx";for(let i of(t.PATH??"").split(n.delimiter))if(i&&n.isAbsolute(i)&&ix(n.join(i,o)))return s6(n.join(i,o),t,n);let s=n.join(n.dirname(r),o);return ix(s)?s:null}function s6(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),e6(n))+e.slice(n.length)}catch{return e}}function ux(e,t,r){if(e==="win32")return null;let n=[Ja.posix.dirname(t),Ja.posix.dirname(r),"/usr/local/bin","/usr/bin","/bin"];return[...new Set(n)].join(Ja.posix.delimiter)}function Rp(e){return typeof e.command==="string"&&/\s/.test(e.command.trim())&&(!Array.isArray(e.args)||e.args.length===0)}function iy(e){return Array.isArray(e.args)?e.args.filter((t)=>typeof t==="string"):[]}function i6(e){return[typeof e.command==="string"?e.command:"",...iy(e)].join(" ")}var a6=/@iistools\/grove-mcp|iis-grove-mcp|grove-mcp\.js|mcp-main\.js/,c6=/grove-mcp\.js|mcp-main\.js/;function Ba(e){return a6.test(i6(e))}function $p(e){return e.split(/[\\/]/).pop()??e}function ay(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 $p(t.trim().split(/\s+/)[0])}function Ka(e){if(Rp(e))return null;let t=typeof e.command==="string"?e.command:"";if($p(t).replace(/\.exe$/i,"")==="iis-grove-mcp")return`installed binary (${$p(t)})`;let r=[t,...iy(e)].find((n)=>c6.test(n));return r?`local build (${$p(r)})`:null}function lx(e){if(!/^npx(\.cmd)?$/i.test(ay(e)))return[];let r=(Rp(e)?e.command.trim().split(/\s+/):iy(e)).filter((n)=>n.startsWith("--")&&n!=="--yes");return[...new Set(r)]}function dx(e){let t=e.npm_config_userconfig;if(!t)return[];let r;try{r=QG(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]}/`)===ax?[]:[n6]}return[]}function px(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,r6],o.env=n,o}import{readFileSync as S6,statSync as b6}from"node:fs";import Bs from"node:path";import{chmodSync as u6,copyFileSync as l6,existsSync as d6,readFileSync as p6,renameSync as f6,rmSync as m6,statSync as h6,writeFileSync as g6}from"node:fs";import{isDeepStrictEqual as y6}from"node:util";var _6=".bak-grove-mcp",mx="\uFEFF";function ft(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function cy(e){let t;try{t=p6(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(mx),n=r?t.slice(1):t,o=h6(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(!ft(i))return{ok:!1,reason:"not a JSON object"};return{ok:!0,doc:{exists:!0,data:i,...s}}}function v6(e,t){return(e.bom?mx:"")+JSON.stringify(t,null,e.indent)+(e.trailingNewline?`
|
|
67
|
+
`:"")}var hx=(e,t,r)=>g6(e,t,{mode:r});function fx(e,t){return t.reduce((r,n)=>ft(r)?r[n]:void 0,e)}function gx(e,t,r,n,o,s){let i=t.exists?`${e}${_6}`:null;if(i&&!d6(i))l6(e,i);let a=`${e}.${process.pid}.tmp`,c=t.mode??o;try{s(a,v6(t,r),c),u6(a,c),f6(a,e)}catch(d){throw m6(a,{force:!0}),d}let u=cy(e);return u.ok&&n.every((d)=>y6(fx(u.doc.data,d),fx(r,d)))?{ok:!0,backup:i}:{ok:!1,reason:"verify after write",backup:i}}var uy="grove-mcp",w6="iis-grove-mcp";function yx(e){let t=Bs.join(e,".config","iis","settings.json");try{let r=JSON.parse(S6(t,"utf8")),n=ft(r)?r.mcp:void 0;if(n===void 0)return{file:t,readable:ft(r),mcp:{}};if(ft(n))return{file:t,readable:!0,mcp:n}}catch{}return{file:t,readable:!1,mcp:{}}}function _x(e){if(!ft(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 $6(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 R6(e,t){let r=ft(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=b6(e,{throwIfNoEntry:!1});return t!==void 0&&t.isFile()&&(t.mode&73)!==0}function z6(e,t){if(t.platform==="win32")return!1;let r=ft(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(Bs.delimiter).filter((i)=>Bs.isAbsolute(i)),o?Bs.join(o,"bin"):Bs.join(t.home,".iistools","bin")].some((i)=>E6(Bs.join(i,w6)))}function vx(e,t,r){for(let[n,o]of Object.entries(e)){if(t.has(n)||!_x(o))continue;let{ids:s,label:i}=R6($6(o.args),r.settings.mcp);if(s.includes(uy)&&z6(o,r))return{key:n,label:i}}return null}function ly(e){return Object.values(e).some(_x)}function Sx(e){return ft(e)&&Ba(e)}import{mkdirSync as P6,rmdirSync as T6,rmSync as k6,statSync as I6}from"node:fs";var x6=1e4,bx=[100,200,400,600,700];function wx(e,t){let r=`${e}.lock`;for(let n=0;;n++){try{return P6(r),()=>T6(r)}catch(s){if(s.code!=="EEXIST")throw s}let o=I6(r,{throwIfNoEntry:!1});if(!o||t.now()-o.mtimeMs>x6){k6(r,{recursive:!0,force:!0});continue}if(n>=bx.length)return null;t.sleep(bx[n])}}var q6="npx -y @iistools/grove-mcp install",fy="claude mcp add -s user grove -- npx -y @iistools/grove-mcp",M6='{"command": "npx", "args": ["-y", "@iistools/grove-mcp"]}',$x=`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,26 +74,40 @@ 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): ${
|
|
77
|
+
--client <name> only this client (repeatable): ${Js.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: ${
|
|
83
|
-
`;function
|
|
84
|
-
`),err:(t)=>process.stderr.write(t),now:()=>Date.now(),sleep:(t)=>Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,t),writeFile:
|
|
85
|
-
`),2;let r=
|
|
82
|
+
Manual form for Claude Code: ${fy}
|
|
83
|
+
`;function zx(e){return{platform:process.platform,env:process.env,execPath:process.execPath,dist:e,homedir:N6(),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:hx}}function L6(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(!Js.includes(o??""))return`unknown --client ${JSON.stringify(o??"")} (one of: ${Js.join(", ")})`;if(!t.clients.includes(o))t.clients.push(o)}else return`unexpected argument ${JSON.stringify(n)}`}return t}function Rx(e,t,r){return e===null?`${t}.${r}`:`projects[${JSON.stringify(e)}].${t}.${r}`}function dy(e,t,r,n){let o=[],s=vx(e.servers,e.disabled,r),i=(a)=>n?.has(a)?e.project:null;if(s)o.push({kind:"iis",mount:s,where:Rx(i(s.key),t,s.key)});for(let[a,c]of Object.entries(e.servers))if(!e.disabled.has(a)&&Sx(c))o.push({kind:"key",key:a,where:Rx(i(a),t,a)});return o}function D6(e){return e.kind==="iis"?`iis mcp (profile ${e.mount.label})`:e.where}function py(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 ${U6(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 ${uy} from the iis profile in ${o.file}`);let a=t===null?"":` in ${t}`;return`double: ${e}${a} reaches grove twice (${r.map(D6).join(" + ")}); keep one: ${i.join("; ")}`}function U6(e){return`'${e.replace(/'/g,"'\\''")}'`}function Ex(e){return`refused: "grove" points elsewhere (${ay(e)})`}function F6(e,t,r,n){let o=wp(e,r.platform,r.env,n.mountCtx.home),s=sy(o),i=o.serversKey,a=t.dryRun?"[dry-run] ":"",c=(f)=>r.out(`${a}${f}`),u=(f)=>c(`${e} ${s} ${f}`),l={npx:n.npx,envPath:n.envPath,withType:o.withType},d=C6(s,{throwIfNoEntry:!1})?.isSymbolicLink()?A6(s):s,p=null;if(!t.dryRun){if(O6(j6.dirname(s),{recursive:!0}),e==="claude-code"){if(p=wx(d,r),!p)return u("skipped: Claude Code is writing its config, re-run"),{exit:1,wrote:!1}}}try{let f=cy(s);if(!f.ok){let G=e==="claude-code"?fy:`add "grove": ${M6} under "${i}"`;return u(`skipped: ${f.reason}; by hand: ${G}`),{exit:1,wrote:!1}}let h=f.doc,y=structuredClone(h.data);if(y[i]!==void 0&&y[i]!==null&&!ft(y[i]))return u(`skipped: "${i}" is not an object`),{exit:1,wrote:!1};let _=[],g=[],S=0,v=(G,ge)=>{let ke=G.grove,Ne=px(l,ke?lx(ke):n.fresh,ke?.env);if(JSON.stringify(ke)===JSON.stringify(Ne))return"unchanged";if(G.grove=Ne,g.push(ge),!ke)return"created";return Rp(ke)?"repaired joined command":"updated"},w=e==="claude-code"&&ft(y.projects)?y.projects:{},z=[];for(let[G,ge]of Object.entries(w)){if(!ft(ge))continue;let ke=ft(ge[i])?ge[i]:{},Ne=new Set(Array.isArray(ge.disabledMcpServers)?ge.disabledMcpServers:[]);z.push({project:G,servers:ke,disabled:Ne});let Fe=ke.grove;if(Fe===void 0)continue;let Pe=`${e} ${s} projects[${JSON.stringify(G)}]:`;if(!ft(Fe)||!Ba(Fe))_.push(`${Pe} ${Ex(Fe)}`),S=1;else if(Ka(Fe))_.push(`${Pe} kept: ${Ka(Fe)}`);else{let x=v(ke,["projects",G,i,"grove"]);if(x!=="unchanged")_.push(`${Pe} ${x}`)}}let R=ft(y[i])?y[i]:{},b={project:null,servers:R,disabled:new Set},E=dy(b,i,n.mountCtx),C=R.grove,q=E.filter((G)=>!(G.kind==="key"&&G.key==="grove")),O;if(C!==void 0&&(!ft(C)||!Ba(C)))O=Ex(C),S=1;else if(E.length>=2&&!t.force)O=py(e,null,E,s,n.mountCtx.settings),S=1;else if(C===void 0&&q.length===1&&!t.force){let G=q[0];O=G.kind==="iis"?`skipped: grove already reaches ${e} via iis mcp (profile ${G.mount.label})`:`kept: grove reaches ${e} via ${JSON.stringify(G.key)}`}else if(ft(C)&&Ka(C))O=`kept: ${Ka(C)}`;else{if(!ft(y[i]))y[i]=R;O=v(R,[i,"grove"]);let G=dy(b,i,n.mountCtx);if(G.length>=2)_.push(py(e,null,G,s,n.mountCtx.settings)),S=1}for(let G of z){let ge={...G,servers:{...R,...G.servers}},ke=dy(ge,i,n.mountCtx,new Set(Object.keys(G.servers)));if(ke.length>=2&&ke.some((Ne)=>Ne.where.startsWith("projects[")))_.push(py(e,G.project,ke,s,n.mountCtx.settings)),S=1}if((ly(R)||z.some((G)=>ly(G.servers)))&&!n.mountCtx.settings.readable)_.push(`note: iis settings unreadable (${n.mountCtx.settings.file}), assumed not mounted`);let K=!1;if(g.length>0&&!t.dryRun){let G=gx(d,h,y,g,o.newFileMode,r.writeFile),ge=G.backup?` backup ${G.backup}`:"";if(!G.ok)return u(`failed: ${G.reason}${ge}`),{exit:1,wrote:!1};O+=ge,K=!0}u(O);for(let G of _)c(G);return{exit:S,wrote:K}}finally{p?.()}}function Px(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 \`${q6}\`
|
|
85
|
+
`),2;let r=L6(e);if(typeof r==="string")return t.err(`iis-grove-mcp install: ${r}
|
|
86
86
|
|
|
87
|
-
${
|
|
88
|
-
`),1;let o=
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
87
|
+
${$x}`),2;if(r.help)return t.out($x.trimEnd()),0;let n=cx(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=ox(t.platform,t.env,t.homedir),s=r.clients.length>0?r.clients:Js.filter((u)=>sx(wp(u,t.platform,t.env,o)));if(s.length===0)return t.out(`No MCP client found (looked for ${Js.join(", ")}). Pass --client <name>, or add it by hand: ${fy}`),1;let i={npx:n,envPath:ux(t.platform,n,t.execPath),fresh:dx(t.env),mountCtx:{home:o,env:t.env,platform:t.platform,settings:yx(o)}},a=0,c=[];for(let u of s){let l;try{l=F6(u,r,t,i)}catch(d){let p=sy(wp(u,t.platform,t.env,o)),{code:f,message:h}=d,y=f&&!h.startsWith(f)?`${f} ${h}`:h;t.out(`${r.dryRun?"[dry-run] ":""}${u} ${p} failed: ${y}`),l={exit:1,wrote:!1}}if(a=Math.max(a,l.exit),l.wrote)c.push(nx[u])}if(c.length>0)t.out(`Restart ${c.join(", ")} to load grove.`);return a}function Tx(e,t=2){return{content:[{type:"text",text:JSON.stringify(e===null||e===void 0?{ok:!0}:e,null,t)}]}}function kx(e,t=!0){if(!t&&e instanceof Oe&&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:Ks(e)}],isError:!0}}function V6(e){if(!e.trimStart().startsWith("["))return e;let t;try{t=JSON.parse(e)}catch{return e}if(!Array.isArray(t)||t.length===0)return e;let r=[];for(let n of t){if(typeof n!=="object"||n===null)return e;let{message:o,path:s}=n;if(typeof o!=="string")return e;let i=Array.isArray(s)?s.join("."):"";r.push(i===""?o:`${i}: ${o}`)}return r.join(`
|
|
89
|
+
`)}function Ks(e){let t=V6(e instanceof Error?e.message:String(e));if(!(e instanceof Oe)||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.`}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 H6=/^[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 gt(){return m().refine((e)=>H6.test(e),{message:"must be a Grove ID (a UUID)"})}var Z6=/^[A-Za-z0-9_-]{1,128}$/;function Ix(){return m().refine((e)=>Z6.test(e),{message:"must be an Orchard feed ID (letters, digits, - and _)"})}function Je(e){if(e===""||/^\.+$/.test(e))throw Error(`invalid path segment ${JSON.stringify(e)}`);return encodeURIComponent(e)}var G6=["like","dislike","bookmark","favorite"],J6=[...G6,"read","unread"],xx=100,my="Write the user's state (reactions, read state, views, groups) only when the user asks or requests it, takes an action that shows it is their choice, or has approved it (a proposal you made, a setting they turned on, a standing instruction they gave), and say which; never for your own bookkeeping.",B6="feed:error.engagementNotFound",Cx={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. ${my} undo:true reverses it (read+undo marks unread). Returns {action, applied, undo (on undo), nothingToRemove (reaction not set), failed[] (partial)}.`,inputShape:{articleIds:A(gt()).min(1).max(xx).describe(`Article IDs (1-${xx}).`),action:le(J6).describe("What to record."),undo:Y().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=o?{undo:!0}:{},i=n==="read"||n==="unread"?n==="read"!==o?"read":"unread":n;if(i==="read"){let d=await e.post("/api/v1/articles/mark-read",{articleIds:r});return{action:i,applied:d?.marked??r.length,...s}}let a=[],c=0,u=0,l;for(let d of r)try{if(i==="unread")await e.patch(`/api/v1/articles/${Je(d)}`,{isRead:!1});else{let p=`/api/v1/articles/${Je(d)}/engagements/${Je(i)}`;if(o)await e.delete(p);else await e.put(p)}c+=1}catch(p){if(o&&p instanceof Oe&&p.code===B6){c+=1,u+=1;continue}l??=p,a.push({articleId:d,error:Ks(p)})}if(c===0&&l!==void 0)throw l;return{action:i,applied:c,...s,...u>0?{nothingToRemove:u}:{},...a.length>0?{failed:a}:{}}}};var K6={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:"ñ"},W6=/&(?:#(\d{1,7})|#[xX]([0-9a-fA-F]{1,6})|([A-Za-z][A-Za-z0-9]{1,9}));/g;function zp(e){return e.replace(W6,(t,r,n,o)=>{if(o!==void 0)return K6[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 Ox=/<(script|style)\b/iy,Y6={script:/<\/script\s*>/gi,style:/<\/style\s*>/gi};function gy(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){Ox.lastIndex=c;let d=Ox.exec(e),p=d?.[1]?.toLowerCase();if(d&&p&&!a.has(p)){let f=Y6[p];if(f.lastIndex=c+d[0].length,f.exec(e))u=f.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 Le(e){if(!e)return"";let t=gy(e);return zp(t).replace(/\s+/g," ").replace(/[\u0000-\u001f\u007f-\u009f]/g,"").replace(yy,"").replace(/ {2,}/g," ").trim()}function X6(e){let t=e.charCodeAt(e.length-1);return t>=55296&&t<=56319?e.slice(0,-1):e}function et(e,t){if(e.length<=t)return e;let r=Math.max(t-1,0),n=X6(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 Jn(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):et(e,t)}var jx=/(?:read\s+(?:the\s+)?full\s+(?:article|story)|continue\s+reading|read\s+more|weiterlesen)|(?:\[?(?:…|\.{3})\]?\s*$)/i,Pp=String.fromCharCode(57344),Ao=String.fromCharCode(57345),Ep=String.fromCharCode(57346),hy=String.fromCharCode(57347),Ax=String.fromCharCode(57348),Tp=String.fromCharCode(57349),yy=new RegExp(`[${Pp}-${Tp}]`,"g"),Nx=`${Pp}-${Tp}`,qx=new Set(["p","div","h1","h2","h3","h4","h5","h6","blockquote","table","section","article","pre","figure","header","footer"]),Mx=new Set(["em","strong","b","i","u","s","del","ins","span","small","sub","sup","mark","code","abbr","cite","q","time","font"]),Q6=new Set([...qx,...Mx,...`a area address aside audio base basefont bdi bdo bgsound big blink body br button canvas caption
|
|
90
|
+
center col colgroup data datalist dd details dfn dialog dir dl dt embed fieldset figcaption form frame
|
|
91
|
+
frameset head hgroup hr html iframe img input kbd keygen label legend li link listing main map marquee
|
|
92
|
+
math menu menuitem meta meter multicol nav nextid nobr noembed noframes noscript object ol optgroup
|
|
93
|
+
option output param picture plaintext progress rb rp rt rtc ruby samp search select slot source spacer
|
|
94
|
+
strike summary svg tbody td template textarea tfoot th thead title tr track tt ul var video wbr xmp
|
|
95
|
+
acronym applet`.split(/\s+/)]),e3=(e)=>e===e.toLowerCase()||e===e.toUpperCase(),t3=/<(?:!--|!doctype\b|script\b|style\b)/i,r3=64,n3=/\bhref\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i,o3=/^https?:\/\/[^\s<>"'\u0000-\u001f\u007f-\u009f]+$/i;function s3(e){if(!e.includes("`")&&!e.includes("~~~"))return e;let t=e.split(`
|
|
96
|
+
`),r=null;for(let n=0;n<t.length;n++){let o=t[n];if(r){let i=/^ {0,3}(`{3,}|~{3,})[ \t]*$/.exec(o)?.[1];if(i?.[0]===r.char&&i.length>=r.size)r=null;t[n]="";continue}let s=/^ {0,3}(`{3,}|~{3,})/.exec(o)?.[1];if(s)r={char:s.charAt(0),size:s.length},t[n]="";else if(o.includes("`"))t[n]=i3(o)}return t.join(`
|
|
97
|
+
`)}function i3(e){let t=[...e.matchAll(/`+/g)].map((i)=>({at:i.index,size:i[0].length})),r=Array(t.length).fill(-1),n=new Map;for(let i=t.length-1;i>=0;i--){let a=t[i];r[i]=n.get(a.size)??-1,n.set(a.size,i)}let o=[],s=0;for(let i=0;i<t.length;i++){let a=r[i];if(a===-1)continue;let c=t[i],u=t[a];o.push(e.slice(s,c.at)," "),s=u.at+u.size,i=a}return o.push(e.slice(s)),o.join("")}function a3(e){let t=s3(e);if(t3.test(t))return!0;let r=!1;return gy(t,(n)=>{let o=/^<\/?([A-Za-z][A-Za-z0-9]*)/.exec(n)?.[1];if(o!==void 0&&Q6.has(o.toLowerCase())&&e3(o))r=!0;return""}),r}function Wa(e){if(!e)return"";let t=[],r=e.replace(new RegExp(`[${Nx}]`,"g"),"");if(!a3(r))return u3(r);let n=[],o=gy(r,(y)=>{let _=/^<\/?([A-Za-z][A-Za-z0-9]*)/.exec(y)?.[1]?.toLowerCase(),g=y.startsWith("</");if(_==="a"){if(g)return Ax;let S=n3.exec(y),v=zp((S?.[1]??S?.[2]??S?.[3]??"").trim());return t.push(o3.test(v)?v:null),hy}if(_==="br")return Pp;if(_==="ul"||_==="ol"){if(g)n.pop();else n.push(!1);return Ao}if(_==="hr")return Ao;if(_==="li"){if(n.length>0)n[n.length-1]=!g;return g?"":`${Ao}- `}if(_==="tr")return g?Ao:" ";if(_==="sup")return g?"":Tp;if(_!==void 0&&/^h[1-6]$/.test(_))return g?Ep:`${Ep}## `;if(_!==void 0&&Mx.has(_))return"";if(_!==void 0&&qx.has(_))return n.at(-1)?Ao:Ep;return" "}),s=[],i=0,a=0,c=(y,_)=>{s.push(y),i+=y.length,a=_},u=(y)=>{if(a<y)c(`
|
|
98
|
+
`.repeat(y-a),y)},l=[],d=0,p=-1,f=o.split(new RegExp(`([${Nx}])`));for(let y=0;y<f.length;y++){let _=f[y];if(_===Tp){let g=y+1;while(f[g]===""||f[g]===hy)g++;let S=s[s.length-1];if(/^\s*\d/.test(f[g]??"")&&S!==void 0&&!/\s/.test(S.slice(-1)))c(" ",0)}else if(_===Pp)c(`
|
|
99
|
+
`,a+1);else if(_===Ao){if(s.length!==p)u(1)}else if(_===Ep){if(s.length!==p)u(2)}else if(_===hy)l.push({href:t[d++]??null,chunk:s.length,length:i});else if(_===Ax){let g=l.pop();if(g?.href){let v=i-g.length>g.href.length+r3?null:s.slice(g.chunk).join("").trim();if(v!==""){if(v===null||v!==g.href)c(` (${g.href})`,0)}}}else{let g=zp(_).replace(/\s+/g," ").replace(/[\u0000-\u001f\u007f-\u009f]/g,"").replace(yy,"");if(g!=="")c(g,0);if(g==="- "&&f[y-1]===Ao)p=s.length}}return s.join("").replace(/[ \t]*\n[ \t]*/g,`
|
|
100
|
+
`).replace(/ {2,}/g," ").replace(/(^|\n)##(?=\n|$)/g,"$1").replace(/\n{3,}/g,`
|
|
92
101
|
|
|
93
|
-
`).trim()}
|
|
102
|
+
`).trim()}function c3(e){let t=[],r=0;for(let n=e.indexOf("{/*");n!==-1;){let o=e.indexOf("*/}",n+3);if(o===-1)break;t.push(e.slice(r,n)),r=o+3,n=e.indexOf("{/*",r)}return t.push(e.slice(r)),t.join("")}function u3(e){return c3(zp(e)).replace(/\r\n?/g,`
|
|
103
|
+
`).replace(/[\u0000-\u0008\u000b-\u001f\u007f-\u009f]/g,"").replace(yy,"").split(`
|
|
104
|
+
`).map((t)=>t.trimEnd()).join(`
|
|
105
|
+
`).replace(/\n{3,}/g,`
|
|
94
106
|
|
|
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 Ik(e,t){if(e===null||e.trim()==="")return{text:null,truncated:!1};return Nk(e,t)}function jk(e,t,r){let n=e.content,o=Ik(t.textSource==="reader"?t.text:null,r),s=Ik(typeof n==="string"?Ga(n):null,r);return{readerText:o.text,readerTruncated:o.truncated,feedText:s.text,feedTruncated:s.truncated}}function Jn(e){return typeof e==="string"?e:null}function qk(e,t,r,n=typeof e.isRead==="boolean"?e.isRead:void 0){let{text:o,truncated:s}=Nk(t.text,r);return{id:String(e.id),title:Xe(Jn(e.title)),url:Jn(e.url),sourceName:Xe(Jn(e.sourceName)),author:Jn(e.author),publishedAt:Jn(e.publishedAt),...n===void 0?{}:{isRead:n},summary:Gn(Xe(Jn(e.summary)),Ka),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 U6=/^[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)=>U6.test(e),{message:"must be a Grove ID (a UUID)"})}var F6=/^[A-Za-z0-9_-]{1,128}$/;function Mk(){return f().refine((e)=>F6.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 Tp=()=>f().refine((e)=>!Number.isNaN(Date.parse(e)),{message:"must be an ISO 8601 date or datetime"}),Lk={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)."),view:f().trim().min(1).max(100).optional().describe("Saved view, name or id (grove_overview lists them); its filters combine with these."),isRead:Y().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:Tp().optional().describe("Only articles published after this ISO date or datetime."),newSince:Tp().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:Y().optional().describe("true = id, title, sourceName, publishedAt only."),sort:le(["newest","oldest","random"]).optional().describe("Default newest. random = a fresh sample each call; it cannot be paged (offset must be 0, hasMore is false)."),perSource:G().int().min(1).max(20).optional().describe("At most this many per source (1-20), the first in the sort order. limit still caps a random sample, so sources past it are missed; to reach every source use newest and page by offset."),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},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",perSource:"perSource"});if(t.isRead!==void 0)o.isRead=String(t.isRead);let s=t.view;if(s!==void 0)o.view=await r$(e,s);let i=t.newSince;if(i!==void 0){let g=Date.parse(i);if(Number.isNaN(g))throw Error("newSince must be an ISO date or datetime (a previous asOf)");o.fetchedAfter=new Date(g-Rk).toISOString()}let a=t.sort??"newest";o.sort=a;let c=a!=="random";o.limit=String(c?r+1:r);let{data:u,headers:l}=await e.getWithHeaders("/api/v1/articles",o),d=Array.isArray(u)?u:[],p=d.slice(0,r),m=t.compact===!0?p.map(dy):p.map(zk),h=Pk({asOf:my(l),count:m.length,hasMore:c&&d.length>r,nextOffset:n+m.length,articles:m});return c?h:{...h,hasMore:!1}}},Dk={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. For reader text, extraction also has extractedAt, extractionMethod and extractionQuality ({score 0-1, tier, escalated, escalationReasons, metricsPartial}; null when none): low score = suspect text; compare scores only among equal metricsPartial, a partial score measures length and paragraphs only. extract: omit = auto (extracts unless the feed already carries the full text), true = always when none is stored, false = never. fresh:true re-extracts over stored text (after an extractor fix) and replaces it. maxChars (default 24000) truncates, textTruncated says so. Marks nothing read unless markRead:true.',inputShape:{id:ht().describe("Article ID."),extract:Y().optional().describe("Omit = auto; true = extract whenever no text is stored; false = never extract."),fresh:Y().optional().describe("true = extract again even when text is stored, and replace the stored text; for re-checking an article after an extractor fix. Costs a full extraction, limited to 60 per hour per user (rate_limited when over)."),maxChars:G().int().min(kk).max(Ok).optional().describe("Cut the text at about this many characters (1000-100000, default 24000)."),compare:Y().optional().describe("true = also return comparison {readerText, readerTruncated, feedText, feedTruncated}: the reader text and the RSS body as text, each cut at maxChars, null when missing. For checking reader text against the feed. The result then holds up to three texts: keep maxChars at 28000 or below."),markRead:Y().optional().describe("true = also mark the article read."),full:Y().optional().describe("Deprecated and ignored: use markRead.")},annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0},handler:async(e,t)=>{let{id:r,extract:n}=t,o=t.fresh===!0,s=t.maxChars??xk,i=t.markRead===!0,a=t.compare===!0,c=await e.get(`/api/v1/articles/${at(r)}`),u;switch(Ck(c,n,o)){case"stored":u={text:zp(c),textSource:"reader",extraction:{status:"stored",...Pp(c.readerContent)}};break;case"skipped":u={...fy(c),extraction:{status:"skipped"}};break;case"not_needed":u={...fy(c),extraction:{status:"not_needed"}};break;case"extract":u=await H6(e,r,c,o);break}let l=(p)=>{let m=qk(c,u,s,p);return a?{...m,comparison:jk(c,u,s)}:m};if(!i)return l();if(e.usesApiKey)return{...l(),message:V6};let d=await e.patch(`/api/v1/articles/${at(r)}`,{isRead:!0});return l(typeof d?.isRead==="boolean"?d.isRead:!0)}},V6="markRead needs a user token";function fy(e){let t=e.content;if(typeof t==="string"&&t!=="")return{text:Ga(t),textSource:"rss"};return{text:Ga(e.summary),textSource:"summary"}}async function H6(e,t,r,n){let o=zp(r),s=(i,a=!1)=>{if(!n||o===null)return{...fy(r),extraction:i};let c=Pp(r.readerContent),u=`The text is the earlier stored extraction (extractedAt ${c.extractedAt??"unknown"}), not a new one.`,l=a?"Call grove_read without fresh shortly and compare extractedAt; fresh:true would start another extraction.":"Pass fresh:true again to re-check.",d=i.status==="disabled"?`Article extraction is switched off on this Grove server. ${u}`:`${i.message??""} ${u} ${l}`.trim();return{text:o,textSource:"reader",extraction:{...c,...i,message:d}}};try{let i=await e.post(`/api/v1/articles/${at(t)}/extract${n?"?fresh=true":""}`,void 0,{timeoutMs:t$});if(typeof i?.markdown==="string"&&i.markdown.trim()!=="")return{text:i.markdown,textSource:"reader",extraction:{status:"extracted",...Pp(i)}};return s({status:"failed",message:`Grove could not extract this article. ${Ep}`})}catch(i){return s(Ak(i),i instanceof je&&i.code==="client:timeout")}}var hy=/^[A-Za-z0-9_-]{1,32}$/,Uk="(?:global|[a-z]{2}(?:-[a-z]{2})?)",Z6=new RegExp(`^${Uk}(?:,${Uk}){0,19}$`,"i"),G6=["browse","trailing","history","latest"],J6=100,K6=60,B6=40000;function Kn(e){return typeof e==="string"?e:null}function Ip(e){return e!==null&&typeof e==="object"?e:{}}function W6(e){let t=Et(Xe(Kn(e.artistOrAuthor)),K6),r=Kn(e.storeUrl);return{rank:typeof e.rank==="number"?e.rank:0,title:Et(Xe(Kn(e.title)),J6),artist:t===""?null:t,url:r!==null&&r.length<=Ja?r:null}}function Fk(e){return Array.isArray(e)?e.map((t)=>W6(Ip(t))):[]}function Y6(e){let t=Ip(e.source);return{sourceId:String(t.id),store:String(t.store),medium:String(t.medium),subtype:Kn(t.subtype),region:String(t.region),fetchedAt:Kn(Ip(e.snapshot).fetchedAt),top:Fk(e.preview)}}function X6(e,t){let r=(Array.isArray(e.charts)?e.charts:[]).map(Y6),n=r.slice(t),o=Kn(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,B6))}function Q6(e){let t=Kn(e.attribution);return{fetchedAt:Kn(Ip(e.snapshot).fetchedAt),entries:Fk(e.entries),...t!==null?{attribution:t}:{}}}var Vk={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(G6).optional().describe("What to fetch; omit with facets."),facets:Y().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)=>Z6.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},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 X6(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 Q6(await e.get(`/api/v1/charts/${at(n)}/latest`))}default:throw Error("kind (browse|trailing|history|latest) or facets:true is required")}}};var eJ=150,tJ=100,Zk=200,rJ=30,nJ=5,oJ=3,sJ=100,iJ=85000;function dr(e){return typeof e==="string"?e:null}function Hk(e,t){if(!Array.isArray(e))return[];return e.filter((r)=>typeof r==="string").map((r)=>Et(Xe(r),rJ)).filter((r)=>r!=="").slice(0,t)}function aJ(e){let t=Gn(Xe(dr(e.description)),Zk);return{orchardFeedId:String(e.orchardFeedId),feedUrl:String(e.feedUrl),title:Et(Xe(dr(e.title)),tJ),description:t===""?null:t,sourceKind:dr(e.sourceKind),topics:Hk(e.topics,nJ),categories:Hk(e.categories,oJ),language:dr(e.language),alreadySubscribed:e.alreadySubscribed===!0,lastPublishedAt:dr(e.lastPublishedAt)}}function gy(e){let t=(Array.isArray(e.data)?e.data:[]).map(aJ),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,iJ))}function cJ(e){let t=Array.isArray(e.items)?e.items:[],r=Gn(Xe(dr(e.description)),Zk);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(Xe(dr(n.summary)),Ka);return{title:Et(Xe(dr(n.title)),eJ),url:o!==null&&o.length<=Ja?o:null,publishedAt:dr(n.publishedAt),summary:s===""?null:s}})}}var uJ="Kind: blog, newsletter, podcast, website or video_channel; comma list = any. video_channel is hidden from mixed lists unless named here.",lJ='Coarse category, e.g. "music" (values: grove_discover_facets; not a topic); comma list = any.',dJ='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"},Gk={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(uJ),category:f().optional().describe(lJ),language:f().optional().describe(dJ),limit:G().int().min(1).max(sJ).optional().describe("Max results (1-100, default 50)."),cursor:f().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 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)}},Jk={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}}},Kk={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). A feed Grove cannot fetch is an error, not an empty preview: tell the user, and do not recommend it unless they still want it. Rate-limited per user (20/min).",inputShape:{orchardFeedId:Mk().describe("orchardFeedId from grove_discover.")},annotations:{readOnlyHint:!0},handler:async(e,t)=>cJ(await e.get(`/api/v1/discover/${at(t.orchardFeedId)}/preview`))};var pJ=["like","dislike","bookmark","favorite"],fJ=[...pJ,"read","unread"],Bk=100,Wk={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. Write a reaction or read state only when (1) the user names it, (2) the user accepts a proposal you made, (3) a setting the user turned on calls for it, or (4) a standing instruction the user gave you covers it, and say which; never for your own bookkeeping. undo:true reverses it. Returns { applied, failed[] }.",inputShape:{articleIds:A(ht()).min(1).max(Bk).describe(`Article IDs (1-${Bk}).`),action:le(fJ).describe("What to record."),undo:Y().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 Yk={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")}},Xk={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 Qk={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 xp=60,mJ=120,hJ=85000,gJ=["ok","broken","dead","blocked"];function Ba(e){return typeof e==="string"?e:null}function yJ(e){if(e.status==="dead")return"dead";if(e.blockReason!==null&&e.blockReason!==void 0)return"blocked";return e.status==="broken"?"broken":"ok"}function _J(e){let t=yJ(e),r=Et(Xe(Ba(e.lastError)),mJ);return{id:String(e.id),name:Et(Xe(Ba(e.name)),xp),url:Ba(e.url),siteUrl:Ba(e.siteUrl),status:t,...t!=="ok"&&r!==""?{lastError:r}:{},lastSuccessAt:Ba(e.lastSuccessAt),articleCount:typeof e.articleCount==="number"?e.articleCount:0}}var eO={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(gJ).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},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(_J).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,hJ))}};function vJ(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 tO={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:Y().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=vJ(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}}}}},rO={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)}`)},nO={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 SJ=50;function bJ(e){if(!Array.isArray(e))return null;return e.flatMap((t)=>typeof t.id==="string"?[{id:t.id,name:typeof t.name==="string"?Et(Xe(t.name),xp):null,unread:typeof t.unread==="number"?t.unread:null}]:[])}function oO(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,Et(Xe(r.name),xp));return t}function sO(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 iO={name:"grove_overview",title:"Unread overview",description:'Unread counts ("how many unread, per feed, since <date>?"). Returns {asOf, since, unread: {total, sourcesWithUnread, bySource, byGroup}, views, stats}; bySource and byGroup rows are {id, name, unread}, most unread first, bySource at most 50 (sourcesWithUnread = all feeds with unread). views = saved views as {id, name, unread} (null: unreadable). since = count only articles published after a date: bySource, byGroup, total and the view unread counts are windowed by it (all-time when since is omitted); stats is not. total leaves out hidden feeds; the rows include them.',inputShape:{since:Tp().optional().describe("Count only articles published after this ISO date or datetime.")},annotations:{readOnlyHint:!0},handler:async(e,t)=>{let r=t.since,n=br(t,{since:"publishedAfter"}),[o,s,i,a,c]=await Promise.all([e.getWithHeaders("/api/v1/counts",n),e.listSources().catch(()=>[]),e.get("/api/v1/groups").catch(()=>[]),e.get("/api/v1/views",{unread:"true",...r!==void 0&&{publishedAfter:r}}).catch(()=>null),e.get("/api/v1/stats")]),u=oO(s),l=oO(i);return{asOf:my(o.headers),since:r??null,unread:{total:o.data.total??0,sourcesWithUnread:Object.keys(o.data.bySource??{}).length,bySource:sO(o.data.bySource,u).slice(0,SJ),byGroup:sO(o.data.byGroup,l)},views:bJ(a),stats:c}}};var vy=[Lk,Dk,iO,eO,Yk,Gk,Jk,Kk,Vk,Wk,tO,rO,nO,Xk],_y={opml:Qk};function aO(e){let t=[...vy];for(let r of(e??"").split(",")){let n=r.trim();if(!n)continue;let o=n.startsWith("+")?n.slice(1):"",s=Object.hasOwn(_y,o)?_y[o]:void 0;if(!s)throw Error(`GROVE_MCP_TOOLS: unknown entry '${n}' (valid: ${Object.keys(_y).map((i)=>`+${i}`).join(", ")})`);if(!t.includes(s))t.push(s)}return t}var $J="grove-mcp",wJ=Ua,RJ=3600000,EJ=["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 read only as the write rule below allows (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. Write a reaction or read state only when (1) the user names it, (2) the user accepts a proposal you made, (3) a setting the user turned on calls for it, or (4) a standing instruction the user gave you covers it, and say which; never for your own bookkeeping.","- 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
|
-
|
|
107
|
+
`).trim()}var l3=250,d3=100,Ya=200,Xa=300,p3=85000,Sy=50,Lx=300000;function _y(e){return typeof e==="string"?Le(e):""}function vy(e){return typeof e==="string"?e:null}function by(e){return{id:String(e.id),title:et(_y(e.title),l3),sourceName:et(_y(e.sourceName),d3),sourceId:vy(e.sourceId)??"",publishedAt:vy(e.publishedAt)}}function Dx(e){let t=vy(e.url),{id:r,title:n,sourceName:o,sourceId:s,publishedAt:i}=by(e),a=Array.isArray(e.topics)?e.topics.filter((c)=>typeof c==="string"&&c!==""):[];return{id:r,title:n,summary:Jn(_y(e.summary),Xa),sourceName:o,sourceId:s,publishedAt:i,url:t!==null&&t.length<=Ya?t:null,...typeof e.isRead==="boolean"?{isRead:e.isRead}:{},...a.length>0?{topics:a}:{},...e.lang==="en"||e.lang==="de"?{lang:e.lang}:{},...f3(e.rankReason)}}function f3(e){if(typeof e!=="object"||e===null)return{};let{sourceYield:t,ageHours:r}=e;if(typeof t!=="number"||typeof r!=="number")return{};return{rankReason:{sourceYield:Math.round(t*1e4)/1e4,ageHours:r}}}function Bn(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 Ux(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=Bn(t,(o)=>JSON.stringify(r(o)).length,p3);return r(n)}var m3=1500,Hx=24000,Zx=1000,Gx=1e5,h3=0.8,wy=30,g3=200,Ws="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 kp(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 y3(e){if(e===null||typeof e!=="object")return null;let t=e,r=t.escalationReasons;if(typeof t.score!=="number"||typeof t.tier!=="string"||typeof t.escalated!=="boolean"||typeof t.metricsPartial!=="boolean"||!Array.isArray(r))return null;return{score:t.score,tier:t.tier,escalated:t.escalated,escalationReasons:r.filter((n)=>typeof n==="string"),metricsPartial:t.metricsPartial}}function Ip(e){let t=e!==null&&typeof e==="object"?e:{};return{extractedAt:Kn(t.extractedAt),extractionMethod:Kn(t.extractionMethod),extractionQuality:y3(t.extractionQuality)}}var _3=/thin content|paywall/i,v3="Only part of the article is here (a teaser or paywall stub). Tell the user the text is partial and give them the url.";function $y(e){return e?.escalationReasons.some((t)=>_3.test(t))?{partial:!0,message:v3}:{}}function Fx(e){return typeof e==="string"&&e!==""?e:null}function Jx(e,t,r=!1){if(r)return"extract";if(kp(e)!==null)return"stored";if(t===!1)return"skipped";if(t===!0)return"extract";let n=Le(Fx(e.content)??Fx(e.summary)),o=jx.test(n.slice(-g3));return n.length>=m3&&!o?"not_needed":"extract"}function Bx(e){if(!(e instanceof Oe))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:wy};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 S3(e);if(e.statusCode===503){let t=e.retryAfterS??wy;return{status:"busy",message:`Extraction is busy; call grove_read again in ${t} s.`,retryAfterSeconds:t}}if(e.statusCode===429){let t=e.retryAfterS??wy;return{status:"rate_limited",message:`Too many extractions; call grove_read again in ${t} s.`,retryAfterSeconds:t}}return{status:"failed",message:`${b3(e)} ${Ws}`}}function S3(e){let t=e.publisherBlock;if(!t)return{status:"blocked",message:`The publisher refused Grove's fetch of this article. ${Ws}`};let{httpStatus:r,vendor:n,retryAfterSeconds:o}=t,s=`HTTP ${r}${n==="unknown"?"":`, ${n}`}`,i=r===429?`The publisher is temporarily rate-limiting Grove (${s}); this is not permanent. Try grove_read again later${o?`, not before ${o} s`:""}. ${Ws}`:`The publisher refused Grove's fetch of this article (${s}). ${Ws}`;return{status:"blocked",httpStatus:r,vendor:n,...o===void 0?{}:{retryAfterSeconds:o},message:i}}function b3(e){return e.code==="feed:error.readerExtractionFailed"?"Grove could not extract this article.":`Extraction failed: ${e.message}.`}function w3(e){let t=e.charCodeAt(e.length-1);return t>=55296&&t<=56319?e.slice(0,-1):e}function Kx(e,t){if(e.length<=t)return{text:e,truncated:!1};let r=w3(e.slice(0,t)),n=Math.ceil(h3*t),o=r.lastIndexOf(`
|
|
108
|
+
|
|
109
|
+
`);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 Vx(e,t){if(e===null||e.trim()==="")return{text:null,truncated:!1};return Kx(e,t)}function Wx(e,t,r){let n=e.content,o=Vx(t.textSource==="reader"?t.text:null,r),s=Vx(typeof n==="string"?Wa(n):null,r);return{readerText:o.text,readerTruncated:o.truncated,feedText:s.text,feedTruncated:s.truncated}}function Kn(e){return typeof e==="string"?e:null}function Yx(e,t,r,n=typeof e.isRead==="boolean"?e.isRead:void 0){let{text:o,truncated:s}=Kx(t.text,r);return{id:String(e.id),title:Le(Kn(e.title)),url:Kn(e.url),sourceName:Le(Kn(e.sourceName)),author:Kn(e.author),publishedAt:Kn(e.publishedAt),...n===void 0?{}:{isRead:n},...e.lang==="en"||e.lang==="de"?{lang:e.lang}:{},summary:Jn(Le(Kn(e.summary)),Xa),text:o,textSource:t.textSource,textTruncated:s,extraction:t.extraction}}function Ey(e){let t=Date.parse(e.get("date")??"");return new Date(Number.isNaN(t)?Date.now():t).toISOString()}var xp=()=>m().refine((e)=>!Number.isNaN(Date.parse(e)),{message:"must be an ISO 8601 date or datetime"}),Xx={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, sourceId (joins grove_sources), publishedAt, url (null when over 200 chars), isRead, topics (up to 3; not in compact); no full text: open one with grove_read. since = published at or after a date; newSince = pass a previous asOf (or any ISO time) to get what arrived since; hiddenOmitted (+ hint) when the default scope left out hidden-feed articles; next page: offset = nextOffset. query = one whole-word phrase in title or summary (German and English word forms and hyphen forms match; term* = prefix); several terms: use any/all/none, not repeated calls. mode:"smart" with query = ranked by meaning as well as words; smartFallback says when only keywords ranked. compact:true = id, title, sourceName, sourceId, publishedAt only, to scan.`,inputShape:{source:gt().optional().describe("Source ID (grove_sources)."),group:gt().optional().describe("Group ID (grove_groups)."),view:m().trim().min(1).max(100).optional().describe("Saved view, name or id (grove_overview lists them); its filters combine with these."),isRead:Y().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:m().optional().describe("Topic; comma list = any. Valid values are the topics on grove_news rows."),query:m().trim().min(1).max(100).optional().describe("One whole-word phrase in title or summary, case-insensitive. German and English word forms match (Agent finds Agenten; Wien finds Wiener, not the reverse); other languages match the exact word or its -s plural. Trailing * = any word starting so, no word forms (Agent*)."),mode:le(["exact","smart"]).optional().describe("Default exact. smart = rank query by meaning as well as words, most relevant first: for a topic in the user's own words, where articles may use other words or another language. exact for a name or a word that must appear. Needs query; omit sort (newest only) and perSource. When Grove could rank by keywords only, the result carries smartFallback with the reason."),any:m().optional().describe("Comma list: at least one term. Word forms and term* as in query."),all:m().optional().describe("Comma list: every term. Word forms and term* as in query."),none:m().optional().describe("Comma list: no term. Matches the written word and its -s plural only, no word forms."),in:m().optional().describe("Fields for any/all/none: title,summary,author,category (default title,summary)."),since:xp().optional().describe("Only articles published at or after this ISO date or datetime."),newSince:xp().optional().describe("A previous asOf, or any ISO time (first run: now - 24h): 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 (newSince, since and isRead are not a scope). include = both. only = just those."),compact:Y().optional().describe("true = id, title, sourceName, publishedAt only."),sort:le(["newest","oldest","random","yield"]).optional().describe("Default newest. yield = the user's own taste: sources they bookmark often first, then recency; rows carry rankReason; newest while they have no bookmarks. random = a fresh sample each call; it cannot be paged (offset must be 0; no nextOffset, hasMore false)."),perSource:Z().int().min(1).max(20).optional().describe("At most this many per source (1-20), the first in the sort order. limit still caps a random sample, so sources past it are missed; to reach every source use newest and page by offset."),limit:Z().int().min(1).max(100).optional().describe("Max articles (1-100, default 50)."),offset:Z().int().min(0).optional().describe("Articles to skip (paging): the previous nextOffset.")},annotations:{readOnlyHint:!0},handler:async(e,t)=>{let r=t.mode==="smart";if(r&&t.query===void 0)throw Error("mode smart needs query");let n=t.limit??50,o=t.offset??0,s=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",perSource:"perSource"});if(t.isRead!==void 0)s.isRead=String(t.isRead);if(r)s.mode="smart";let i=t.view;if(i!==void 0)s.view=await hw(e,i);let a=t.newSince;if(a!==void 0){let w=Date.parse(a);if(Number.isNaN(w))throw Error("newSince must be an ISO date or datetime (a previous asOf)");s.fetchedAfter=new Date(w-Lx).toISOString()}let c=t.sort??"newest";s.sort=c;let u=c!=="random";s.limit=String(u?n+1:n);let[{data:l,headers:d},p]=await Promise.all([e.getWithHeaders("/api/v1/articles",s),E3(e,t,s)]),f=Array.isArray(l)?l:[];if(f.length===0)await P3(e,t);let h=f.slice(0,n),y=t.compact===!0?h.map(by):h.map(Dx),_=$3(h),g=Ux({asOf:Ey(d),count:y.length,hasMore:u&&f.length>n,nextOffset:o+y.length,...p>0?T3(p):{},..._!==null?{smartFallback:_}:{},articles:y});if(u)return g;let{nextOffset:S,...v}=g;return{...v,hasMore:!1}}};function $3(e){for(let t of e){let r=t.rankReason;if(r?.kind==="keyword"&&typeof r.fallback==="string")return r.fallback}return null}var R3=["source","group","engagement","topic","query","any","all","none","view"];async function E3(e,t,r){if(t.hidden!==void 0)return 0;if(R3.some((o)=>t[o]!==void 0))return 0;let n={hidden:"only",sort:"newest"};for(let o of["isRead","publishedAfter","fetchedAfter"]){let s=r[o];if(s!==void 0)n[o]=s}n.limit=String(Sy);try{let o=await e.get("/api/v1/articles",n);return Array.isArray(o)?o.filter((s)=>typeof s?.isRead==="boolean").length:0}catch{return 0}}var z3=[{arg:"source",path:"/api/v1/sources/",advice:"No such source among your subscriptions. Source ids come from grove_sources."},{arg:"group",path:"/api/v1/groups/",advice:"No such group. Group ids come from grove_groups."}];async function P3(e,t){for(let{arg:r,path:n,advice:o}of z3){let s=t[r];if(typeof s!=="string")continue;try{await e.get(n+Je(s))}catch(i){if(i instanceof Oe&&i.statusCode===404)throw new Oe(o,i.exitCode,i.statusCode,i.retryAfterS,i.code);throw i}}}function T3(e){let t=e>=Sy?"at least ":"";return{hiddenOmitted:e,hint:`${t}${e} matching articles from feeds hidden from All were left out; pass hidden:"include" to add them or hidden:"only" for just those.`}}var Qx={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. For reader text, extraction also has extractedAt, extractionMethod and extractionQuality ({score 0-1, tier, escalated, escalationReasons, metricsPartial}; null when none): low score = suspect text; compare scores only among equal metricsPartial, a partial score measures length and paragraphs only; partial:true = escalation named thin content or a paywall, so text is a teaser: say so. blocked also has httpStatus and vendor; a publisher 429 is temporary (retryAfterSeconds when known). extract: omit = auto (extracts unless the feed already carries the full text), true = always when none is stored, false = never. fresh:true re-extracts over stored text (after an extractor fix) and replaces it. maxChars (default 24000) truncates, textTruncated says so. Marks nothing read unless markRead:true.',inputShape:{id:gt().describe("Article ID."),extract:Y().optional().describe("Omit = auto; true = extract whenever no text is stored; false = never extract."),fresh:Y().optional().describe("true = extract again even when text is stored, and replace the stored text; for re-checking an article after an extractor fix. Costs a full extraction, limited to 60 per hour per user (rate_limited when over)."),maxChars:Z().int().min(Zx).max(Gx).optional().describe("Cut the text at about this many characters (1000-100000, default 24000)."),compare:Y().optional().describe("true = also return comparison {readerText, readerTruncated, feedText, feedTruncated}: the reader text and the RSS body as text, each cut at maxChars, null when missing. For checking reader text against the feed. The result then holds up to three texts: keep maxChars at 28000 or below."),markRead:Y().optional().describe("true = also mark the article read."),full:Y().optional().describe("Deprecated and ignored: use markRead.")},annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0},handler:async(e,t)=>{let{id:r,extract:n}=t,o=t.fresh===!0,s=t.maxChars??Hx,i=t.markRead===!0,a=t.compare===!0,c=await e.get(`/api/v1/articles/${Je(r)}`),u;switch(Jx(c,n,o)){case"stored":u={text:kp(c),textSource:"reader",extraction:eC("stored",Ip(c.readerContent))};break;case"skipped":u={...Ry(c),extraction:{status:"skipped"}};break;case"not_needed":u={...Ry(c),extraction:{status:"not_needed"}};break;case"extract":u=await I3(e,r,c,o);break}let l=(p)=>{let f=Yx(c,u,s,p);return a?{...f,comparison:Wx(c,u,s)}:f};if(!i)return l();if(e.usesApiKey)return{...l(),message:k3};let d=await e.patch(`/api/v1/articles/${Je(r)}`,{isRead:!0});return l(typeof d?.isRead==="boolean"?d.isRead:!0)}};function eC(e,t){return{status:e,...t,...$y(t.extractionQuality)}}var k3="markRead needs a user token";function Ry(e){let t=e.content;if(typeof t==="string"&&t!=="")return{text:Wa(t),textSource:"rss"};return{text:Wa(e.summary),textSource:"summary"}}async function I3(e,t,r,n){let o=kp(r),s=(i,a=!1)=>{if(!n||o===null)return{...Ry(r),extraction:i};let c=Ip(r.readerContent),u=`The text is the earlier stored extraction (extractedAt ${c.extractedAt??"unknown"}), not a new one.`,l=a?"Call grove_read without fresh shortly and compare extractedAt; fresh:true would start another extraction.":"Pass fresh:true again to re-check.",d=i.status==="disabled"?`Article extraction is switched off on this Grove server. ${u}`:`${i.message??""} ${u} ${l}`.trim();return{text:o,textSource:"reader",extraction:{...c,...$y(c.extractionQuality),...i,message:d}}};try{let i=await e.post(`/api/v1/articles/${Je(t)}/extract${n?"?fresh=true":""}`,void 0,{timeoutMs:mw});if(typeof i?.markdown==="string"&&i.markdown.trim()!=="")return{text:i.markdown,textSource:"reader",extraction:eC("extracted",Ip(i))};return s({status:"failed",message:`Grove could not extract this article. ${Ws}`})}catch(i){return s(Bx(i),i instanceof Oe&&i.code==="client:timeout")}}var zy=/^[A-Za-z0-9_-]{1,32}$/,tC="(?:global|[a-z]{2}(?:-[a-z]{2})?)",x3=new RegExp(`^${tC}(?:,${tC}){0,19}$`,"i"),C3=["browse","trailing","history","latest"],O3=100,A3=60,N3=40000;function wr(e){return typeof e==="string"?e:null}function Cp(e){return e!==null&&typeof e==="object"?e:{}}function rC(e){let t=et(Le(wr(e.artistOrAuthor)),A3),r=wr(e.storeUrl);return{rank:typeof e.rank==="number"?e.rank:0,title:et(Le(wr(e.title)),O3),artist:t===""?null:t,url:r!==null&&r.length<=Ya?r:null}}function nC(e){return Array.isArray(e)?e.map((t)=>rC(Cp(t))):[]}function j3(e){let t=Cp(e.source);return{sourceId:String(t.id),store:String(t.store),medium:String(t.medium),subtype:wr(t.subtype),region:String(t.region),fetchedAt:wr(Cp(e.snapshot).fetchedAt),top:nC(e.preview)}}function q3(e,t){let r=(Array.isArray(e.charts)?e.charts:[]).map(j3),n=r.slice(t),o=wr(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(Bn(n.length,(i)=>JSON.stringify(s(i)).length,N3))}var M3=40000;function L3(e){return{store:String(e.store),medium:String(e.medium),subtype:wr(e.subtype),region:String(e.region)}}async function oC(e,t){let r=[...new Set(t)],n=await Promise.all(r.map((o)=>e.get(`/api/v1/charts/sources/${Je(o)}`).then(L3).catch(()=>null)));return new Map(r.map((o,s)=>[o,n[s]]))}async function D3(e,t){let r=Array.isArray(t)?t:[],n=await oC(e,r.map((i)=>String(i.chartSourceId))),o=r.map((i)=>({...rC({...i,rank:i.lastRank}),chart:n.get(String(i.chartSourceId))??null,droppedAt:wr(i.droppedAt)})),s=(i)=>({count:i,entries:o.slice(0,i),...i<o.length?{omitted:o.length-i}:{}});return s(Bn(o.length,(i)=>JSON.stringify(s(i)).length,M3))}async function U3(e,t,r){let n=(Array.isArray(r)?r:[]).map((s)=>({fetchedAt:wr(s.fetchedAt),entryCount:typeof s.entryCount==="number"?s.entryCount:0}));return{chart:(await oC(e,[t])).get(t)??null,count:n.length,snapshots:n}}function F3(e){let t=wr(e.attribution);return{fetchedAt:wr(Cp(e.snapshot).fetchedAt),entries:nC(e.entries),...t!==null?{attribution:t}:{}}}var sC={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 -> {count, entries[]}: rank, title, artist, url, chart {store, medium, subtype, region}, droppedAt, for entries that recently dropped off; latest -> a chart's {fetchedAt, entries[]} (top 100: rank, title, artist, url); history -> {chart, count, snapshots[]: fetchedAt, entryCount} (latest/history need a sourceId from browse).",inputShape:{kind:le(C3).optional().describe("What to fetch; omit with facets."),facets:Y().optional().describe("Return { stores, regions }; kind ignored."),store:m().refine((e)=>zy.test(e),{message:"must be a store name, e.g. apple"}).optional().describe("browse/trailing: store filter."),subtype:m().refine((e)=>zy.test(e),{message:"must be a subtype name, e.g. top-free"}).optional().describe("browse: subtype filter."),medium:m().refine((e)=>zy.test(e),{message:"must be a medium name, e.g. app"}).optional().describe("browse/trailing: medium filter."),region:m().refine((e)=>x3.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:gt().optional().describe("latest/history: charts[].sourceId from browse (not a feed source)."),offset:Z().int().min(0).optional().describe("browse: charts to skip (paging): the previous nextOffset.")},annotations:{readOnlyHint:!0},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 q3(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 D3(e,await 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 U3(e,n,await e.get(`/api/v1/charts/${Je(n)}/snapshots`));return F3(await e.get(`/api/v1/charts/${Je(n)}/latest`))}default:throw Error("kind (browse|trailing|history|latest) or facets:true is required")}}};var V3=150,lC=100,dC=200,H3=30,Z3=5,G3=3,iC=5,aC="about: ",J3=100,B3=85000;function dr(e){return typeof e==="string"?e:null}function Op(e,t){if(!Array.isArray(e))return[];return e.filter((r)=>typeof r==="string").map((r)=>et(Le(r),H3)).filter((r)=>r!=="").slice(0,t)}function K3(e){if(Array.isArray(e.languages))return Op(e.languages,iC);return Op([e.language],iC)}function W3(e){let t=e.descriptionSource==="entity",r=dC-(t?aC.length:0),n=Jn(Le(dr(e.description)),r);if(n==="")return null;return t?`${aC}${n}`:n}var Y3=["poll","preview","probe"];function X3(e){if(typeof e!=="object"||e===null)return{};let{id:t,name:r}=e;if(typeof t!=="number"||!Number.isInteger(t)||typeof r!=="string")return{};return{publisher:{id:t,name:et(Le(r),lC)}}}function Q3(e){let t=dr(e.lastPublishedAt),r=Y3.find((n)=>n===e.lastPublishedSource);return{orchardFeedId:String(e.orchardFeedId),feedUrl:String(e.feedUrl),title:et(Le(dr(e.title)),lC),description:W3(e),sourceKind:dr(e.sourceKind),topics:Op(e.topics,Z3),categories:Op(e.categories,G3),languages:K3(e),alreadySubscribed:e.alreadySubscribed===!0,lastPublishedAt:t,...t!==null&&r!==void 0?{lastPublishedSource:r}:{},...X3(e.publisher),...typeof e.matchedTerms==="number"?{matchedTerms:e.matchedTerms}:{}}}function eJ(e){if(typeof e!=="object"||e===null)return;let{qMatch:t,count:r}=e;if(t!=="words"&&t!=="substring")return;return{qMatch:t,count:typeof r==="number"?r:null}}var cC='Words match: feeds matching all words come first, then those matching some; "…" is a phrase, -word excludes, or joins alternatives, the last word matches as a prefix.';function tJ(e,t){if(e?.qMatch!=="words")return{};let r=e.count,n=r===null?-1:t.findIndex((o)=>o.matchedTerms!==void 0&&o.matchedTerms<r);return{hint:n<0?cC:`${cC} Rows from index ${n} on match only some of the ${r} clauses (matchedTerms); the rest match all.`}}function rJ(e){if(typeof e!=="object"||e===null)return{};let{requested:t,used:r}=e;if(typeof t!=="string"||typeof r!=="string")return{};return{hint:`No feed matched "${t}" as one phrase, so these match "${r}" alone. Check each title and description for the other words.`}}function nJ(...e){let t=e.flatMap((r)=>r.hint===void 0?[]:[r.hint]);return t.length===0?{}:{hint:t.join(" ")}}function oJ(e){let t=(Array.isArray(e.data)?e.data:[]).map(Q3),r=eJ(e.queryTerms),n=(o)=>({data:t.slice(0,o),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}:{},...o<t.length?{omitted:t.length-o}:{},...r?{queryTerms:r}:{},...nJ(rJ(e.queryFallback),tJ(r,t.slice(0,o)))});return n(Bn(t.length,(o)=>JSON.stringify(n(o)).length,B3))}function sJ(e){let t=Array.isArray(e.items)?e.items:[],r=Jn(Le(dr(e.description)),dC);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=Jn(Le(dr(n.summary)),Xa);return{title:et(Le(dr(n.title)),V3),url:o!==null&&o.length<=Ya?o:null,publishedAt:dr(n.publishedAt),summary:s===""?null:s}})}}var iJ='Kind: blog, newsletter, podcast, website or video_channel; comma list = any. video_channel is hidden from mixed lists unless named here. With sort:"new" it only un-hides video_channel and does not narrow the list to the kind.',aJ='Coarse category, e.g. "music" (values: grove_discover_facets; not a topic); comma list = any.',cJ=`Language, e.g. "en" (also matches en-US); comma list = any. "all" = no filter, the default unless the server sets one for trending/browse. Ignored with sort:"new" (that list has no language data): check each row's languages.`,uJ='Free-text search, 3-200 chars; selects search. queryTerms.qMatch in the result says how it matched. substring: the whole text as one substring of title, publisher or description ("CVE" also matches inside longer words); if a multi-word query matches nothing, the longest word is searched and hint says so. words: whole-word match; feeds matching all words come first, then partial matches (matchedTerms of queryTerms.count); "…" is a phrase, -word excludes, or joins alternatives, the last word matches as a prefix.',uC=`language is not applied with sort:"new" (that list has no language data); check each row's languages.`,Py={sourceKind:"sourceKind",category:"category",language:"language",limit:"limit",cursor:"cursor"};async function lJ(e,t,r){let n=t.category;if(typeof n!=="string"||r.data.length>0)return r;let o=n.split(",").map((u)=>u.trim().toLowerCase()).filter((u)=>u!==""),s="Valid category values: grove_discover_facets.",i=null;try{let l=(await e.get("/api/v1/discover/categories")).categories;if(Array.isArray(l))i=l.map((d)=>dr(d.category)).filter((d)=>d!==null)}catch{i=null}if(i===null)return{...r,hint:`No rows. ${s}`};let a=new Set(i.map((u)=>u.toLowerCase())),c=o.filter((u)=>!a.has(u));if(c.length===0)return r;return{...r,hint:`Unknown category ${c.map((u)=>`"${u}"`).join(", ")}. Valid values: ${i.join(", ")}.`}}function dJ(e,t){if(e.sort!=="new"||typeof e.language!=="string")return t;if(e.language.trim().toLowerCase()==="all")return t;if(t.recencyWindowDays===void 0)return t;return{...t,hint:t.hint?`${t.hint} ${uC}`:uC}}var pC={name:"grove_discover",title:"Discover feeds",description:'Find feeds to follow ("feeds about X"). query -> search; sort -> browse; neither -> trending. To narrow by subject use category (values: grove_discover_facets), on any of the three. Returns data[] + nextCursor (null = no more); each feed has orchardFeedId, feedUrl, title, description (plain text, 200 characters; "about: " = about the feed subject, not its own text), sourceKind, topics, categories, languages (the filtered one first), alreadySubscribed, lastPublishedAt, lastPublishedSource (poll = kept current; preview, probe = a one-time look), publisher ({ id, name }; browse shows one feed per publisher, pass id as publisher for the rest). At most 100 per page, 85,000 characters (omitted = rows cut for size). Follow with grove_subscribe url.',inputShape:{query:m().min(3).max(200).optional().describe(uJ),topic:m().optional().describe("Do not use: the catalog carries no content topics, so this matches nothing. Filter by category instead (values: grove_discover_facets)."),sort:le(["popular","active","new"]).optional().describe("Selects browse (popular, new = recently publishing; active = deprecated, the same as popular); not with query."),publisher:Z().int().min(1).optional().describe(`Selects browse: one publisher's feeds, from a row's publisher.id. Browse shows one feed per publisher; this lists the rest. Always sorted popular (not with sort:"new"). Video channels need sourceKind:"video_channel". Not with query.`),sourceKind:m().optional().describe(iJ),category:m().optional().describe(aJ),language:m().optional().describe(cJ),limit:Z().int().min(1).max(J3).optional().describe("Max results (1-100, default 50)."),cursor:m().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&&t.publisher)throw Error("publisher is not supported together with query");let n=(o,s)=>e.get(o,s).then(oJ).then((i)=>lJ(e,t,i)).then((i)=>dJ(t,i));if(r){let o=br(t,{...Py,topic:"topic"});return o.q=r,n("/api/v1/discover/search",o)}if(t.topic||t.sort||t.publisher)return n("/api/v1/discover/browse",br(t,{...Py,topic:"topic",sort:"sort",publisher:"publisher"}));return n("/api/v1/discover",br(t,Py))}},fC={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}}},mC={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). A feed Grove cannot fetch is an error, not an empty preview: tell the user, and do not recommend it unless they still want it. Rate-limited per user (20/min).",inputShape:{orchardFeedId:Ix().describe("orchardFeedId from grove_discover.")},annotations:{readOnlyHint:!0},handler:async(e,t)=>sJ(await e.get(`/api/v1/discover/${Je(t.orchardFeedId)}/preview`))};var Ys=60,pJ=120,fJ=85000,mJ=["ok","broken","dead","blocked"];function Wn(e){return typeof e==="string"?e:null}function hJ(e){if(e.status==="dead")return"dead";if(e.blockReason!==null&&e.blockReason!==void 0)return"blocked";return e.status==="broken"?"broken":"ok"}function ky(e){let t=hJ(e),r=et(Le(Wn(e.lastError)),pJ);return{id:String(e.id),name:et(Le(Wn(e.name)),Ys),url:Wn(e.url),siteUrl:Wn(e.siteUrl),status:t,...t!=="ok"&&r!==""?{lastError:r}:{},lastSuccessAt:Wn(e.lastSuccessAt),articleCount:typeof e.articleCount==="number"?e.articleCount:0,...e.hiddenFromAll===!0?{hiddenFromAll:!0}:{},...typeof e.filter==="object"&&e.filter!==null&&!Array.isArray(e.filter)?{filter:e.filter}:{}}}var gJ=200;function yJ(e){let t=et(Le(Wn(e.description)),gJ),r=e.blockReason,n=typeof r==="object"&&r!==null?r:null,o=Wn(e.language);return{...ky(e),...t!==""?{description:t}:{},...o!==null&&o!==""?{language:o}:{},...typeof e.pollIntervalMinutes==="number"?{pollIntervalMinutes:e.pollIntervalMinutes}:{},...typeof e.consecutiveFailures==="number"&&e.consecutiveFailures>0?{consecutiveFailures:e.consecutiveFailures}:{},...n!==null?{blockReason:{vendor:String(n.vendor),httpStatus:typeof n.httpStatus==="number"?n.httpStatus:null}}:{}}}function _J(e,t){if(t===void 0)return!0;return t==="broken"?e==="broken"||e==="blocked":e===t}var gC={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, hiddenFromAll (only when true), filter (only when set); a page is at most 85,000 characters. Next page: offset = nextOffset. An API-key profile needs an admin API key.`,inputShape:{id:gt().optional().describe("Source ID for full detail; omit to list."),group:gt().optional().describe("When listing: only this group ID."),status:le(mJ).optional().describe("When listing: only this status; broken = failing, blocked included; blocked = refused by the site."),offset:Z().int().min(0).optional().describe("When listing: feeds to skip (paging): the previous nextOffset.")},annotations:{readOnlyHint:!0},handler:async(e,t)=>{let r=t.id;if(r)return yJ(await e.getSource(r));let n=await e.listSources(t.group),o=t.status,s=t.offset??0,i=(Array.isArray(n)?n:[]).map(ky).filter((u)=>_J(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(Bn(a.length,(u)=>JSON.stringify(c(u)).length,fJ))}};function vJ(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}function SJ(e){if(typeof e!=="object"||e===null)return;let t=e,r=Ty(t.error).message;return{fetchStatus:String(t.fetchStatus),...typeof r==="string"&&r!==""?{error:et(Le(r),160)}:{}}}function Ty(e){return typeof e==="object"&&e!==null?e:{}}function hC(e,t,r,n){let o=ky(e),s=SJ(r);return{id:o.id,...n===void 0||o.name!==""?{name:o.name}:{},status:o.status,created:t,...n===void 0?{hiddenFromAll:o.hiddenFromAll===!0,filter:o.filter??null}:{detailError:n},...s!==void 0?{intake:s}:{}}}var yC={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. Returns {id, name, status, created, hiddenFromAll, filter, intake}: created false = already followed (hiddenFromAll, filter as kept); intake.fetchStatus "failed" = 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:m().optional().describe("Feed or site URL (this or sourceId)."),orchardFeedId:m().optional().describe("With url: that feed's orchardFeedId from grove_discover."),sourceId:gt().optional().describe("Grove source ID, instead of url (not an orchardFeedId)."),name:m().optional().describe("Display name."),groupId:gt().optional().describe("Group ID to file it in."),hiddenFromAll:Y().optional().describe("true = out of All articles, unread count, digest; still readable by source. New subscriptions only."),filter:T({any:m().optional().describe("Comma list: at least one."),all:m().optional().describe("Comma list: every one."),none:m().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=await e.listSources(),s=new Set((Array.isArray(o)?o:[]).map((h)=>String(h.id))),i,a,c=n,u=t.hiddenFromAll===!0,l=vJ(t.filter);if(r){let h={url:r};if(u)h.hiddenFromAll=!0;if(l)h.filter=l;if(t.name)h.name=t.name;if(t.orchardFeedId)h.orchardFeedId=t.orchardFeedId;a=Ty(await e.post("/api/v1/sources",h)),i=a.intake,c=Wn(a.id)??void 0}else{let h={sourceId:n};if(u)h.hiddenFromAll=!0;if(l)h.filter=l;if(t.name)h.displayName=t.name;a=Ty(await e.post("/api/v1/sources/subscribe",h))}if(!c)throw Error("subscribe response carried no source id");let d=!s.has(c),p;try{p=hC(await e.getSource(c),d,i)}catch(h){p=hC({...a,id:c},d,i,Ks(h))}let f=t.groupId;if(!f)return p;try{return await e.post(`/api/v1/groups/${Je(f)}/sources`,{sourceId:c}),{subscription:p,group:{groupId:f,added:!0}}}catch(h){let y=Ks(h);return{subscription:p,group:{groupId:f,added:!1,error:y}}}}},_C={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:gt().describe("Source ID.")},annotations:{readOnlyHint:!1,destructiveHint:!0},handler:(e,t)=>e.delete(`/api/v1/sources/${Je(t.id)}`)},vC={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:gt().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/${Je(r)}/poll`:"/api/v1/sources/refresh")}};var bJ=100;function Ap(e){return typeof e==="string"?e:null}function Np(e){let t=Ap(e.color);return{id:String(e.id),name:et(Le(Ap(e.name)),bJ),...t!==null&&t!==""?{color:t}:{},...typeof e.sourceCount==="number"?{sourceCount:e.sourceCount}:{}}}function wJ(e){let t=Array.isArray(e.sources)?e.sources:[];return{...Np(e),sourceCount:t.length,sources:t.map((r)=>({id:String(r.id),name:et(Le(Ap(r.name)),Ys),url:Ap(r.url),articleCount:typeof r.articleCount==="number"?r.articleCount:0}))}}var SC={name:"grove_groups",title:"List groups",description:"List the user's groups (folders): id, name, color (when set), sourceCount. With id, one group and its sources (id, name, url, articleCount).",inputShape:{id:gt().optional().describe("Group ID; omit to list.")},annotations:{readOnlyHint:!0},handler:async(e,t)=>{let r=t.id;if(r)return wJ(await e.get(`/api/v1/groups/${Je(r)}`));let n=await e.get("/api/v1/groups");return(Array.isArray(n)?n:[]).map(Np)}},bC={name:"grove_group_edit",title:"Edit group",description:"Organize groups: create (needs name; returns its id), rename (groupId, name), delete (groupId; its sources stay followed), add_source / remove_source (groupId, sourceId). add_source: 404 if the user does not follow the source, 409 if already in the group. remove_source leaves the subscription.",inputShape:{action:le(["create","rename","delete","add_source","remove_source"]).describe("create, rename, delete, add_source or remove_source."),name:m().optional().describe("Group name (create, rename)."),groupId:gt().optional().describe("Group ID (all but create)."),sourceId:gt().optional().describe("Source ID (add_source, remove_source).")},annotations:{readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1},handler:async(e,t)=>{let r=t.action;if(r==="create"){if(!t.name)throw Error("action 'create' needs name");return Np(await e.post("/api/v1/groups",{name:t.name}))}let n=t.groupId;if(r==="rename"){if(!n||!t.name)throw Error("action 'rename' needs groupId and name");return Np(await e.patch(`/api/v1/groups/${Je(n)}`,{name:t.name}))}if(r==="delete"){if(!n)throw Error("action 'delete' needs groupId");return await e.delete(`/api/v1/groups/${Je(n)}`),{deleted:!0,groupId:n}}let o=t.sourceId;if(!n||!o)throw Error(`action '${r}' needs groupId and sourceId`);return r==="add_source"?e.post(`/api/v1/groups/${Je(n)}/sources`,{sourceId:o}):e.delete(`/api/v1/groups/${Je(n)}/sources/${Je(o)}`)}};var wC={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:m().optional().describe("OPML document as XML (import)."),url:m().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 $J=50;function RJ(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function EJ(e){if(!Array.isArray(e))return null;return e.flatMap((t)=>typeof t.id==="string"?[{id:t.id,name:typeof t.name==="string"?et(Le(t.name),Ys):null,unread:typeof t.unread==="number"?t.unread:null,params:RJ(t.params)?t.params:null}]:[])}function $C(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,et(Le(r.name),Ys));return t}function RC(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 EC={name:"grove_overview",title:"Unread overview",description:'Unread counts ("how many unread, per feed, since <date>?"). Returns {asOf, since, unread: {total, sourcesWithUnread, bySource, byGroup}, views, stats}; bySource and byGroup rows are {id, name, unread}, most unread first, bySource at most 50 (sourcesWithUnread = all feeds with unread). views = saved views as {id, name, unread, params} (params = the filters it stores; unread and params are null when unreadable). since = count only articles published at or after a date: bySource, byGroup, total and the view unread counts are windowed by it (all-time when since is omitted); stats is not. total leaves out hidden feeds; the rows include them.',inputShape:{since:xp().optional().describe("Count only articles published at or after this ISO date or datetime.")},annotations:{readOnlyHint:!0},handler:async(e,t)=>{let r=t.since,n=br(t,{since:"publishedAfter"}),[o,s,i,a,c]=await Promise.all([e.getWithHeaders("/api/v1/counts",n),e.listSources().catch(()=>[]),e.get("/api/v1/groups").catch(()=>[]),e.get("/api/v1/views",{unread:"true",...r!==void 0&&{publishedAfter:r}}).catch(()=>null),e.get("/api/v1/stats")]),u=$C(s),l=$C(i);return{asOf:Ey(o.headers),since:r??null,unread:{total:o.data.total??0,sourcesWithUnread:Object.keys(o.data.bySource??{}).length,bySource:RC(o.data.bySource,u).slice(0,$J),byGroup:RC(o.data.byGroup,l)},views:EJ(a),stats:c}}};var xy=[Xx,Qx,EC,gC,SC,pC,fC,mC,sC,Cx,yC,_C,vC,bC],Iy={opml:wC};function zC(e){let t=[...xy];for(let r of(e??"").split(",")){let n=r.trim();if(!n)continue;let o=n.startsWith("+")?n.slice(1):"",s=Object.hasOwn(Iy,o)?Iy[o]:void 0;if(!s)throw Error(`GROVE_MCP_TOOLS: unknown entry '${n}' (valid: ${Object.keys(Iy).map((i)=>`+${i}`).join(", ")})`);if(!t.includes(s))t.push(s)}return t}var zJ="grove-mcp",PJ=Ga,TJ=3600000,kJ=["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 at or after, newSince = a previous asOf, or any ISO time, query, compact:true to scan; query, any and all match German and English word forms, Agent finds Agenten and Wien finds Wiener but not the reverse, while other languages match the exact word or its -s plural, and term* matches any word starting so, with no word forms, and none matches only the written word and its -s plural), 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 read only as the write rule below allows (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. ${my}`,`- Automated or recurring use (a daily brief, a check-in): call grove_news with newSince = the asOf of your last run (first run: now - 24h; any ISO time works), hidden:"include" (the default leaves out feeds the user hid from All articles and reports the count as hiddenOmitted), and isRead:false when the user wants only unseen items. The 5-minute overlap repeats rows: de-duplicate by id. "Already briefed" is your own state: never markRead for it. since filters on publish date and misses late arrivals; newSince filters on arrival. A saved view is the user's standing question: run it with newSince and nothing else, because a group, source or isRead beside view silently replaces the view's own key; a view applies its own hidden rule, so it may leave hidden feeds out without a hiddenOmitted count. Meanings: groups are the user's beats (use them as headings); hidden feeds are pull, not push (brief them in a separate section); a feed's filter rule is already applied (trust the cut); bookmark = keep, favorite = the strongest signal, read = triaged by the user. grove_read with extract:false checks an article without starting an extraction (the default can take up to 50 s). A blocked or broken source (grove_sources status) is silent in grove_news: silence is not a quiet day.`,"- Find new feeds: grove_discover (query, category 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(`
|
|
110
|
+
`);function Qa(e){return{content:[{type:"text",text:`Error: ${e}`}],isError:!0}}var kC="If you have the Grove CLI, you can run `grove auth login` instead.";function jp(e){return e.mayLogin()?`Call the tool again for a sign-in link. ${kC}`:"Restart the MCP server (or, if you have the Grove CLI, run `grove auth login`), then call the tool again."}function IJ(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 Qa(`${r} Open only a link you just asked for. After signing in, ask again. ${kC}`)}async function xJ(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 ${MI()}; the Grove MCP server signs out on its next call (or restart it).`:`Signed in to Grove as ${s}.`}var CJ={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 OJ(e,t){if(t.mcpReq.envelope)return!1;return Boolean(e.server.getClientCapabilities()?.elicitation?.url)}async function AJ(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 PC(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 NJ(e,t,r){let n=t.clientForCall();if(n)return n;if(!t.mayLogin())return Qa(`Grove sign-in required. ${jp(t)}`);let o=OJ(e,r),s=!o&&t.canOpenBrowser()?"loopback":"relay",i,a;try{let f=t.beginLogin(s);a=f.created,i=await f.pending}catch(f){return TC(t,f)}let c=async()=>{try{return await i.addRelay()}catch(f){return TC(t,f)}},u=async(f)=>{let h=await c();if(h===null)return i.done;return typeof h==="string"?IJ(h,f):h},l=null;if(a&&o){i.elicited=!0;let f=await c();if(typeof f!=="string"){if(i.elicited=!1,f!==null)return f;l=await i.done}else{if(l=await AJ(r,i,f),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 PC(i,r,t.loginWaitMs,t.progressIntervalMs),l==="waiting"){let f=await u(!1);if(typeof f!=="string")return f;l=f}}if(l===null||l==="dismissed"||l==="elicit-failed"){if(a)t.openBrowser(i);let f=i.browser;if(!f||f.failed){let h=await u(!1);if(typeof h!=="string")return h;l=h}else if(l=await PC(i,r,t.loginWaitMs,t.progressIntervalMs,f.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=CJ[l==="expired"||l==="aborted"?l:"failed"];return Qa(`${p} ${jp(t)}`)}function jJ(e){return e.server.getClientVersion()?.name}function TC(e,t){let r=t instanceof Error?t.message:String(t);return Qa(`could not start the Grove sign-in (${r}). ${jp(e)}`)}function IC(e,t=!0,r=xy,n=!0){let o=e instanceof Oo?e:Oo.fixed(e,t),s=new ba({name:zJ,version:PJ},{instructions:kJ,cacheHints:{"tools/list":{ttlMs:TJ,cacheScope:"public"}}});for(let i of r)s.registerTool(i.name,{title:i.title,description:i.description,annotations:i.annotations,inputSchema:T(i.inputShape)},async(a,c)=>{let u=null,d=await(async()=>{for(let p=0;;p+=1){let f=await NJ(s,o,c);if("content"in f)return f;let h=o.takeSignInNotice();if(h)u=await xJ(f,h);let y=o.canAutoRefresh;if(n)f.setAgentName(jJ(s));try{let _=await i.handler(f,a);return Tx(_,i.serialize==="pretty"?2:0)}catch(_){if(!(_ instanceof Oe&&_.statusCode===401&&o.markRevoked(f,p>0)))return kx(_,y);if(p>0)return Qa(`the Grove session ended (sign-in revoked or expired). ${jp(o)}`)}}})();return u?{...d,content:[{type:"text",text:u},...d.content]}:d});return s}var qJ=`Usage: iis-grove-mcp [option]
|
|
97
111
|
iis-grove-mcp install [--dry-run] [--force] [--client <name>]...
|
|
98
112
|
|
|
99
113
|
Grove MCP server. With no option it serves MCP over stdio (the host speaks
|
|
@@ -118,8 +132,8 @@ Environment:
|
|
|
118
132
|
GROVE_PROFILE CLI profile to use (default: the active one)
|
|
119
133
|
GROVE_MCP_TOOLS opt-in tools, e.g. +opml
|
|
120
134
|
`;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
|
|
121
|
-
`),process.exit(0);if(process.argv[2]==="--schema")process.exit(0);if(process.argv[2]==="--help"||process.argv[2]==="-h")process.stdout.write(
|
|
122
|
-
`),process.exit(0);async function
|
|
135
|
+
`),process.exit(0);if(process.argv[2]==="--schema")process.exit(0);if(process.argv[2]==="--help"||process.argv[2]==="-h")process.stdout.write(qJ),process.exit(0);if(process.argv[2]==="--version"||process.argv[2]==="-v")process.stdout.write(`${Ga}
|
|
136
|
+
`),process.exit(0);async function MJ(){let e=ex(),t=zC(process.env.GROVE_MCP_TOOLS);lw(()=>IC(e,!0,t),{legacy:"serve",onerror:(r)=>{process.stderr.write(`grove-mcp transport error: ${r.message}
|
|
123
137
|
`)}}),process.stdin.once("end",()=>e.close()),process.stdin.once("close",()=>e.close()),process.stderr.write(`grove-mcp server connected (stdio)
|
|
124
|
-
`)}if(process.argv[2]==="install")process.exitCode=
|
|
138
|
+
`)}if(process.argv[2]==="install")process.exitCode=Px(process.argv.slice(3),zx(tx));else MJ().catch((e)=>{let t=e instanceof Error?e.message:String(e);process.stderr.write(`grove-mcp failed to start: ${t}
|
|
125
139
|
`),process.exit(1)});
|