context-doctor 0.32.0 → 0.33.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/README.md +85 -695
- package/dist/autoclear.js +4 -1
- package/dist/autopilot.d.ts +20 -0
- package/dist/autopilot.js +69 -6
- package/dist/ci.js +9 -1
- package/dist/cli.js +355 -245
- package/dist/clihelp.d.ts +24 -0
- package/dist/clihelp.js +116 -0
- package/dist/compactquality.d.ts +1 -1
- package/dist/compactquality.js +3 -2
- package/dist/compactwindow.d.ts +29 -5
- package/dist/compactwindow.js +50 -18
- package/dist/diff.js +24 -2
- package/dist/doctor.d.ts +3 -2
- package/dist/doctor.js +77 -27
- package/dist/install.d.ts +25 -0
- package/dist/install.js +237 -29
- package/dist/invocation.d.ts +18 -0
- package/dist/invocation.js +49 -0
- package/dist/mcp.d.ts +5 -2
- package/dist/mcp.js +93 -299
- package/dist/mcpclient.js +45 -0
- package/dist/mcpschema.d.ts +1 -1
- package/dist/mcpschema.js +11 -8
- package/dist/optimize.d.ts +2 -0
- package/dist/optimize.js +2 -0
- package/dist/overhead.d.ts +12 -1
- package/dist/overhead.js +31 -7
- package/dist/preferences.d.ts +1 -1
- package/dist/preferences.js +5 -5
- package/dist/proxy.d.ts +1 -1
- package/dist/proxy.js +1 -1
- package/dist/savings.d.ts +3 -0
- package/dist/savings.js +9 -3
- package/dist/session.d.ts +15 -0
- package/dist/session.js +43 -0
- package/dist/subagentpay.d.ts +1 -1
- package/dist/subagentpay.js +3 -2
- package/package.json +5 -8
- package/skills/context-doctor/SKILL.md +3 -3
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { createRequire as __cdRequire } from 'module'; const require = __cdRequire(import.meta.url);
|
|
2
|
+
var e_=Object.create;var ss=Object.defineProperty;var t_=Object.getOwnPropertyDescriptor;var r_=Object.getOwnPropertyNames;var o_=Object.getPrototypeOf,n_=Object.prototype.hasOwnProperty;var lt=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var b=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),is=(e,t)=>{for(var r in t)ss(e,r,{get:t[r],enumerable:!0})},s_=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of r_(t))!n_.call(e,n)&&n!==r&&ss(e,n,{get:()=>t[n],enumerable:!(o=t_(t,n))||o.enumerable});return e};var jo=(e,t,r)=>(r=e!=null?e_(o_(e)):{},s_(t||!e||!e.__esModule?ss(r,"default",{value:e,enumerable:!0}):r,e));var Hr=b(F=>{"use strict";Object.defineProperty(F,"__esModule",{value:!0});F.regexpCode=F.getEsmExportName=F.getProperty=F.safeStringify=F.stringify=F.strConcat=F.addCodeArg=F.str=F._=F.nil=F._Code=F.Name=F.IDENTIFIER=F._CodeOrName=void 0;var Fr=class{};F._CodeOrName=Fr;F.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Tt=class extends Fr{constructor(t){if(super(),!F.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};F.Name=Tt;var Ne=class extends Fr{constructor(t){super(),this._items=typeof t=="string"?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let t=this._items[0];return t===""||t==='""'}get str(){var t;return(t=this._str)!==null&&t!==void 0?t:this._str=this._items.reduce((r,o)=>`${r}${o}`,"")}get names(){var t;return(t=this._names)!==null&&t!==void 0?t:this._names=this._items.reduce((r,o)=>(o instanceof Tt&&(r[o.str]=(r[o.str]||0)+1),r),{})}};F._Code=Ne;F.nil=new Ne("");function jp(e,...t){let r=[e[0]],o=0;for(;o<t.length;)Ti(r,t[o]),r.push(e[++o]);return new Ne(r)}F._=jp;var Ei=new Ne("+");function Zp(e,...t){let r=[Vr(e[0])],o=0;for(;o<t.length;)r.push(Ei),Ti(r,t[o]),r.push(Ei,Vr(e[++o]));return d0(r),new Ne(r)}F.str=Zp;function Ti(e,t){t instanceof Ne?e.push(...t._items):t instanceof Tt?e.push(t):e.push(m0(t))}F.addCodeArg=Ti;function d0(e){let t=1;for(;t<e.length-1;){if(e[t]===Ei){let r=p0(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function p0(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof Tt||e[e.length-1]!=='"'?void 0:typeof t!="string"?`${e.slice(0,-1)}${t}"`:t[0]==='"'?e.slice(0,-1)+t.slice(1):void 0;if(typeof t=="string"&&t[0]==='"'&&!(e instanceof Tt))return`"${e}${t.slice(1)}`}function f0(e,t){return t.emptyStr()?e:e.emptyStr()?t:Zp`${e}${t}`}F.strConcat=f0;function m0(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:Vr(Array.isArray(e)?e.join(","):e)}function h0(e){return new Ne(Vr(e))}F.stringify=h0;function Vr(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}F.safeStringify=Vr;function g0(e){return typeof e=="string"&&F.IDENTIFIER.test(e)?new Ne(`.${e}`):jp`[${e}]`}F.getProperty=g0;function _0(e){if(typeof e=="string"&&F.IDENTIFIER.test(e))return new Ne(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}F.getEsmExportName=_0;function y0(e){return new Ne(e.toString())}F.regexpCode=y0});var Oi=b(Pe=>{"use strict";Object.defineProperty(Pe,"__esModule",{value:!0});Pe.ValueScope=Pe.ValueScopeName=Pe.Scope=Pe.varKinds=Pe.UsedValueState=void 0;var ke=Hr(),Ri=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}},gn;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(gn||(Pe.UsedValueState=gn={}));Pe.varKinds={const:new ke.Name("const"),let:new ke.Name("let"),var:new ke.Name("var")};var _n=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof ke.Name?t:this.name(t)}name(t){return new ke.Name(this._newName(t))}_newName(t){let r=this._names[t]||this._nameGroup(t);return`${t}${r.index++}`}_nameGroup(t){var r,o;if(!((o=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||o===void 0)&&o.has(t)||this._prefixes&&!this._prefixes.has(t))throw new Error(`CodeGen: prefix "${t}" is not allowed in this scope`);return this._names[t]={prefix:t,index:0}}};Pe.Scope=_n;var yn=class extends ke.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:r,itemIndex:o}){this.value=t,this.scopePath=(0,ke._)`.${new ke.Name(r)}[${o}]`}};Pe.ValueScopeName=yn;var v0=(0,ke._)`\n`,Ii=class extends _n{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?v0:ke.nil}}get(){return this._scope}name(t){return new yn(t,this._newName(t))}value(t,r){var o;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let n=this.toName(t),{prefix:s}=n,i=(o=r.key)!==null&&o!==void 0?o:r.ref,a=this._values[s];if(a){let u=a.get(i);if(u)return u}else a=this._values[s]=new Map;a.set(i,n);let c=this._scope[s]||(this._scope[s]=[]),l=c.length;return c[l]=r.ref,n.setValue(r,{property:s,itemIndex:l}),n}getValue(t,r){let o=this._values[t];if(o)return o.get(r)}scopeRefs(t,r=this._values){return this._reduceValues(r,o=>{if(o.scopePath===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return(0,ke._)`${t}${o.scopePath}`})}scopeCode(t=this._values,r,o){return this._reduceValues(t,n=>{if(n.value===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return n.value.code},r,o)}_reduceValues(t,r,o={},n){let s=ke.nil;for(let i in t){let a=t[i];if(!a)continue;let c=o[i]=o[i]||new Map;a.forEach(l=>{if(c.has(l))return;c.set(l,gn.Started);let u=r(l);if(u){let d=this.opts.es5?Pe.varKinds.var:Pe.varKinds.const;s=(0,ke._)`${s}${d} ${l} = ${u};${this.opts._n}`}else if(u=n?.(l))s=(0,ke._)`${s}${u}${this.opts._n}`;else throw new Ri(l);c.set(l,gn.Completed)})}return s}};Pe.ValueScope=Ii});var j=b(Z=>{"use strict";Object.defineProperty(Z,"__esModule",{value:!0});Z.or=Z.and=Z.not=Z.CodeGen=Z.operators=Z.varKinds=Z.ValueScopeName=Z.ValueScope=Z.Scope=Z.Name=Z.regexpCode=Z.stringify=Z.getProperty=Z.nil=Z.strConcat=Z.str=Z._=void 0;var M=Hr(),Fe=Oi(),mt=Hr();Object.defineProperty(Z,"_",{enumerable:!0,get:function(){return mt._}});Object.defineProperty(Z,"str",{enumerable:!0,get:function(){return mt.str}});Object.defineProperty(Z,"strConcat",{enumerable:!0,get:function(){return mt.strConcat}});Object.defineProperty(Z,"nil",{enumerable:!0,get:function(){return mt.nil}});Object.defineProperty(Z,"getProperty",{enumerable:!0,get:function(){return mt.getProperty}});Object.defineProperty(Z,"stringify",{enumerable:!0,get:function(){return mt.stringify}});Object.defineProperty(Z,"regexpCode",{enumerable:!0,get:function(){return mt.regexpCode}});Object.defineProperty(Z,"Name",{enumerable:!0,get:function(){return mt.Name}});var xn=Oi();Object.defineProperty(Z,"Scope",{enumerable:!0,get:function(){return xn.Scope}});Object.defineProperty(Z,"ValueScope",{enumerable:!0,get:function(){return xn.ValueScope}});Object.defineProperty(Z,"ValueScopeName",{enumerable:!0,get:function(){return xn.ValueScopeName}});Object.defineProperty(Z,"varKinds",{enumerable:!0,get:function(){return xn.varKinds}});Z.operators={GT:new M._Code(">"),GTE:new M._Code(">="),LT:new M._Code("<"),LTE:new M._Code("<="),EQ:new M._Code("==="),NEQ:new M._Code("!=="),NOT:new M._Code("!"),OR:new M._Code("||"),AND:new M._Code("&&"),ADD:new M._Code("+")};var ot=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},Ci=class extends ot{constructor(t,r,o){super(),this.varKind=t,this.name=r,this.rhs=o}render({es5:t,_n:r}){let o=t?Fe.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return`${o} ${this.name}${n};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=sr(this.rhs,t,r)),this}get names(){return this.rhs instanceof M._CodeOrName?this.rhs.names:{}}},vn=class extends ot{constructor(t,r,o){super(),this.lhs=t,this.rhs=r,this.sideEffects=o}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,r){if(!(this.lhs instanceof M.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=sr(this.rhs,t,r),this}get names(){let t=this.lhs instanceof M.Name?{}:{...this.lhs.names};return wn(t,this.rhs)}},Ai=class extends vn{constructor(t,r,o,n){super(t,o,n),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},Ni=class extends ot{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},ji=class extends ot{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},Zi=class extends ot{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},qi=class extends ot{constructor(t){super(),this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(t,r){return this.code=sr(this.code,t,r),this}get names(){return this.code instanceof M._CodeOrName?this.code.names:{}}},Br=class extends ot{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce((r,o)=>r+o.render(t),"")}optimizeNodes(){let{nodes:t}=this,r=t.length;for(;r--;){let o=t[r].optimizeNodes();Array.isArray(o)?t.splice(r,1,...o):o?t[r]=o:t.splice(r,1)}return t.length>0?this:void 0}optimizeNames(t,r){let{nodes:o}=this,n=o.length;for(;n--;){let s=o[n];s.optimizeNames(t,r)||($0(t,s.names),o.splice(n,1))}return o.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>Ot(t,r.names),{})}},nt=class extends Br{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},Mi=class extends Br{},nr=class extends nt{};nr.kind="else";var Rt=class e extends nt{constructor(t,r){super(r),this.condition=t}render(t){let r=`if(${this.condition})`+super.render(t);return this.else&&(r+="else "+this.else.render(t)),r}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let r=this.else;if(r){let o=r.optimizeNodes();r=this.else=Array.isArray(o)?new nr(o):o}if(r)return t===!1?r instanceof e?r:r.nodes:this.nodes.length?this:new e(qp(t),r instanceof e?[r]:r.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(t,r){var o;if(this.else=(o=this.else)===null||o===void 0?void 0:o.optimizeNames(t,r),!!(super.optimizeNames(t,r)||this.else))return this.condition=sr(this.condition,t,r),this}get names(){let t=super.names;return wn(t,this.condition),this.else&&Ot(t,this.else.names),t}};Rt.kind="if";var It=class extends nt{};It.kind="for";var Di=class extends It{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iteration=sr(this.iteration,t,r),this}get names(){return Ot(super.names,this.iteration.names)}},Ui=class extends It{constructor(t,r,o,n){super(),this.varKind=t,this.name=r,this.from=o,this.to=n}render(t){let r=t.es5?Fe.varKinds.var:this.varKind,{name:o,from:n,to:s}=this;return`for(${r} ${o}=${n}; ${o}<${s}; ${o}++)`+super.render(t)}get names(){let t=wn(super.names,this.from);return wn(t,this.to)}},$n=class extends It{constructor(t,r,o,n){super(),this.loop=t,this.varKind=r,this.name=o,this.iterable=n}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iterable=sr(this.iterable,t,r),this}get names(){return Ot(super.names,this.iterable.names)}},Kr=class extends nt{constructor(t,r,o){super(),this.name=t,this.args=r,this.async=o}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}};Kr.kind="func";var Wr=class extends Br{render(t){return"return "+super.render(t)}};Wr.kind="return";var Li=class extends nt{render(t){let r="try"+super.render(t);return this.catch&&(r+=this.catch.render(t)),this.finally&&(r+=this.finally.render(t)),r}optimizeNodes(){var t,r;return super.optimizeNodes(),(t=this.catch)===null||t===void 0||t.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(t,r){var o,n;return super.optimizeNames(t,r),(o=this.catch)===null||o===void 0||o.optimizeNames(t,r),(n=this.finally)===null||n===void 0||n.optimizeNames(t,r),this}get names(){let t=super.names;return this.catch&&Ot(t,this.catch.names),this.finally&&Ot(t,this.finally.names),t}},Gr=class extends nt{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};Gr.kind="catch";var Jr=class extends nt{render(t){return"finally"+super.render(t)}};Jr.kind="finally";var Fi=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
3
|
+
`:""},this._extScope=t,this._scope=new Fe.Scope({parent:t}),this._nodes=[new Mi]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,r){let o=this._extScope.value(t,r);return(this._values[o.prefix]||(this._values[o.prefix]=new Set)).add(o),o}getScopeValue(t,r){return this._extScope.getValue(t,r)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,r,o,n){let s=this._scope.toName(r);return o!==void 0&&n&&(this._constants[s.str]=o),this._leafNode(new Ci(t,s,o)),s}const(t,r,o){return this._def(Fe.varKinds.const,t,r,o)}let(t,r,o){return this._def(Fe.varKinds.let,t,r,o)}var(t,r,o){return this._def(Fe.varKinds.var,t,r,o)}assign(t,r,o){return this._leafNode(new vn(t,r,o))}add(t,r){return this._leafNode(new Ai(t,Z.operators.ADD,r))}code(t){return typeof t=="function"?t():t!==M.nil&&this._leafNode(new qi(t)),this}object(...t){let r=["{"];for(let[o,n]of t)r.length>1&&r.push(","),r.push(o),(o!==n||this.opts.es5)&&(r.push(":"),(0,M.addCodeArg)(r,n));return r.push("}"),new M._Code(r)}if(t,r,o){if(this._blockNode(new Rt(t)),r&&o)this.code(r).else().code(o).endIf();else if(r)this.code(r).endIf();else if(o)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new Rt(t))}else(){return this._elseNode(new nr)}endIf(){return this._endBlockNode(Rt,nr)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new Di(t),r)}forRange(t,r,o,n,s=this.opts.es5?Fe.varKinds.var:Fe.varKinds.let){let i=this._scope.toName(t);return this._for(new Ui(s,i,r,o),()=>n(i))}forOf(t,r,o,n=Fe.varKinds.const){let s=this._scope.toName(t);if(this.opts.es5){let i=r instanceof M.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,M._)`${i}.length`,a=>{this.var(s,(0,M._)`${i}[${a}]`),o(s)})}return this._for(new $n("of",n,s,r),()=>o(s))}forIn(t,r,o,n=this.opts.es5?Fe.varKinds.var:Fe.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,M._)`Object.keys(${r})`,o);let s=this._scope.toName(t);return this._for(new $n("in",n,s,r),()=>o(s))}endFor(){return this._endBlockNode(It)}label(t){return this._leafNode(new Ni(t))}break(t){return this._leafNode(new ji(t))}return(t){let r=new Wr;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Wr)}try(t,r,o){if(!r&&!o)throw new Error('CodeGen: "try" without "catch" and "finally"');let n=new Li;if(this._blockNode(n),this.code(t),r){let s=this.name("e");this._currNode=n.catch=new Gr(s),r(s)}return o&&(this._currNode=n.finally=new Jr,this.code(o)),this._endBlockNode(Gr,Jr)}throw(t){return this._leafNode(new Zi(t))}block(t,r){return this._blockStarts.push(this._nodes.length),t&&this.code(t).endBlock(r),this}endBlock(t){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let o=this._nodes.length-r;if(o<0||t!==void 0&&o!==t)throw new Error(`CodeGen: wrong number of nodes: ${o} vs ${t} expected`);return this._nodes.length=r,this}func(t,r=M.nil,o,n){return this._blockNode(new Kr(t,r,o)),n&&this.code(n).endFunc(),this}endFunc(){return this._endBlockNode(Kr)}optimize(t=1){for(;t-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(t){return this._currNode.nodes.push(t),this}_blockNode(t){this._currNode.nodes.push(t),this._nodes.push(t)}_endBlockNode(t,r){let o=this._currNode;if(o instanceof t||r&&o instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${t.kind}/${r.kind}`:t.kind}"`)}_elseNode(t){let r=this._currNode;if(!(r instanceof Rt))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=t,this}get _root(){return this._nodes[0]}get _currNode(){let t=this._nodes;return t[t.length-1]}set _currNode(t){let r=this._nodes;r[r.length-1]=t}};Z.CodeGen=Fi;function Ot(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function wn(e,t){return t instanceof M._CodeOrName?Ot(e,t.names):e}function sr(e,t,r){if(e instanceof M.Name)return o(e);if(!n(e))return e;return new M._Code(e._items.reduce((s,i)=>(i instanceof M.Name&&(i=o(i)),i instanceof M._Code?s.push(...i._items):s.push(i),s),[]));function o(s){let i=r[s.str];return i===void 0||t[s.str]!==1?s:(delete t[s.str],i)}function n(s){return s instanceof M._Code&&s._items.some(i=>i instanceof M.Name&&t[i.str]===1&&r[i.str]!==void 0)}}function $0(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function qp(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,M._)`!${Vi(e)}`}Z.not=qp;var w0=Mp(Z.operators.AND);function x0(...e){return e.reduce(w0)}Z.and=x0;var b0=Mp(Z.operators.OR);function z0(...e){return e.reduce(b0)}Z.or=z0;function Mp(e){return(t,r)=>t===M.nil?r:r===M.nil?t:(0,M._)`${Vi(t)} ${e} ${Vi(r)}`}function Vi(e){return e instanceof M.Name?e:(0,M._)`(${e})`}});var D=b(q=>{"use strict";Object.defineProperty(q,"__esModule",{value:!0});q.checkStrictMode=q.getErrorPath=q.Type=q.useFunc=q.setEvaluated=q.evaluatedPropsToName=q.mergeEvaluated=q.eachItem=q.unescapeJsonPointer=q.escapeJsonPointer=q.escapeFragment=q.unescapeFragment=q.schemaRefOrVal=q.schemaHasRulesButRef=q.schemaHasRules=q.checkUnknownRules=q.alwaysValidSchema=q.toHash=void 0;var W=j(),S0=Hr();function k0(e){let t={};for(let r of e)t[r]=!0;return t}q.toHash=k0;function P0(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(Lp(e,t),!Fp(t,e.self.RULES.all))}q.alwaysValidSchema=P0;function Lp(e,t=e.schema){let{opts:r,self:o}=e;if(!r.strictSchema||typeof t=="boolean")return;let n=o.RULES.keywords;for(let s in t)n[s]||Bp(e,`unknown keyword: "${s}"`)}q.checkUnknownRules=Lp;function Fp(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}q.schemaHasRules=Fp;function E0(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}q.schemaHasRulesButRef=E0;function T0({topSchemaRef:e,schemaPath:t},r,o,n){if(!n){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,W._)`${r}`}return(0,W._)`${e}${t}${(0,W.getProperty)(o)}`}q.schemaRefOrVal=T0;function R0(e){return Vp(decodeURIComponent(e))}q.unescapeFragment=R0;function I0(e){return encodeURIComponent(Bi(e))}q.escapeFragment=I0;function Bi(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}q.escapeJsonPointer=Bi;function Vp(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}q.unescapeJsonPointer=Vp;function O0(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}q.eachItem=O0;function Dp({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:o}){return(n,s,i,a)=>{let c=i===void 0?s:i instanceof W.Name?(s instanceof W.Name?e(n,s,i):t(n,s,i),i):s instanceof W.Name?(t(n,i,s),s):r(s,i);return a===W.Name&&!(c instanceof W.Name)?o(n,c):c}}q.mergeEvaluated={props:Dp({mergeNames:(e,t,r)=>e.if((0,W._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,W._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,W._)`${r} || {}`).code((0,W._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,W._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,W._)`${r} || {}`),Ki(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:Hp}),items:Dp({mergeNames:(e,t,r)=>e.if((0,W._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,W._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,W._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,W._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function Hp(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",(0,W._)`{}`);return t!==void 0&&Ki(e,r,t),r}q.evaluatedPropsToName=Hp;function Ki(e,t,r){Object.keys(r).forEach(o=>e.assign((0,W._)`${t}${(0,W.getProperty)(o)}`,!0))}q.setEvaluated=Ki;var Up={};function C0(e,t){return e.scopeValue("func",{ref:t,code:Up[t.code]||(Up[t.code]=new S0._Code(t.code))})}q.useFunc=C0;var Hi;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Hi||(q.Type=Hi={}));function A0(e,t,r){if(e instanceof W.Name){let o=t===Hi.Num;return r?o?(0,W._)`"[" + ${e} + "]"`:(0,W._)`"['" + ${e} + "']"`:o?(0,W._)`"/" + ${e}`:(0,W._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,W.getProperty)(e).toString():"/"+Bi(e)}q.getErrorPath=A0;function Bp(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,r===!0)throw new Error(t);e.self.logger.warn(t)}}q.checkStrictMode=Bp});var st=b(Wi=>{"use strict";Object.defineProperty(Wi,"__esModule",{value:!0});var ye=j(),N0={data:new ye.Name("data"),valCxt:new ye.Name("valCxt"),instancePath:new ye.Name("instancePath"),parentData:new ye.Name("parentData"),parentDataProperty:new ye.Name("parentDataProperty"),rootData:new ye.Name("rootData"),dynamicAnchors:new ye.Name("dynamicAnchors"),vErrors:new ye.Name("vErrors"),errors:new ye.Name("errors"),this:new ye.Name("this"),self:new ye.Name("self"),scope:new ye.Name("scope"),json:new ye.Name("json"),jsonPos:new ye.Name("jsonPos"),jsonLen:new ye.Name("jsonLen"),jsonPart:new ye.Name("jsonPart")};Wi.default=N0});var Qr=b(ve=>{"use strict";Object.defineProperty(ve,"__esModule",{value:!0});ve.extendErrors=ve.resetErrorsCount=ve.reportExtraError=ve.reportError=ve.keyword$DataError=ve.keywordError=void 0;var U=j(),bn=D(),xe=st();ve.keywordError={message:({keyword:e})=>(0,U.str)`must pass "${e}" keyword validation`};ve.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,U.str)`"${e}" keyword must be ${t} ($data)`:(0,U.str)`"${e}" keyword is invalid ($data)`};function j0(e,t=ve.keywordError,r,o){let{it:n}=e,{gen:s,compositeRule:i,allErrors:a}=n,c=Gp(e,t,r);o??(i||a)?Kp(s,c):Wp(n,(0,U._)`[${c}]`)}ve.reportError=j0;function Z0(e,t=ve.keywordError,r){let{it:o}=e,{gen:n,compositeRule:s,allErrors:i}=o,a=Gp(e,t,r);Kp(n,a),s||i||Wp(o,xe.default.vErrors)}ve.reportExtraError=Z0;function q0(e,t){e.assign(xe.default.errors,t),e.if((0,U._)`${xe.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,U._)`${xe.default.vErrors}.length`,t),()=>e.assign(xe.default.vErrors,null)))}ve.resetErrorsCount=q0;function M0({gen:e,keyword:t,schemaValue:r,data:o,errsCount:n,it:s}){if(n===void 0)throw new Error("ajv implementation error");let i=e.name("err");e.forRange("i",n,xe.default.errors,a=>{e.const(i,(0,U._)`${xe.default.vErrors}[${a}]`),e.if((0,U._)`${i}.instancePath === undefined`,()=>e.assign((0,U._)`${i}.instancePath`,(0,U.strConcat)(xe.default.instancePath,s.errorPath))),e.assign((0,U._)`${i}.schemaPath`,(0,U.str)`${s.errSchemaPath}/${t}`),s.opts.verbose&&(e.assign((0,U._)`${i}.schema`,r),e.assign((0,U._)`${i}.data`,o))})}ve.extendErrors=M0;function Kp(e,t){let r=e.const("err",t);e.if((0,U._)`${xe.default.vErrors} === null`,()=>e.assign(xe.default.vErrors,(0,U._)`[${r}]`),(0,U._)`${xe.default.vErrors}.push(${r})`),e.code((0,U._)`${xe.default.errors}++`)}function Wp(e,t){let{gen:r,validateName:o,schemaEnv:n}=e;n.$async?r.throw((0,U._)`new ${e.ValidationError}(${t})`):(r.assign((0,U._)`${o}.errors`,t),r.return(!1))}var Ct={keyword:new U.Name("keyword"),schemaPath:new U.Name("schemaPath"),params:new U.Name("params"),propertyName:new U.Name("propertyName"),message:new U.Name("message"),schema:new U.Name("schema"),parentSchema:new U.Name("parentSchema")};function Gp(e,t,r){let{createErrors:o}=e.it;return o===!1?(0,U._)`{}`:D0(e,t,r)}function D0(e,t,r={}){let{gen:o,it:n}=e,s=[U0(n,r),L0(e,r)];return F0(e,t,s),o.object(...s)}function U0({errorPath:e},{instancePath:t}){let r=t?(0,U.str)`${e}${(0,bn.getErrorPath)(t,bn.Type.Str)}`:e;return[xe.default.instancePath,(0,U.strConcat)(xe.default.instancePath,r)]}function L0({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:o}){let n=o?t:(0,U.str)`${t}/${e}`;return r&&(n=(0,U.str)`${n}${(0,bn.getErrorPath)(r,bn.Type.Str)}`),[Ct.schemaPath,n]}function F0(e,{params:t,message:r},o){let{keyword:n,data:s,schemaValue:i,it:a}=e,{opts:c,propertyName:l,topSchemaRef:u,schemaPath:d}=a;o.push([Ct.keyword,n],[Ct.params,typeof t=="function"?t(e):t||(0,U._)`{}`]),c.messages&&o.push([Ct.message,typeof r=="function"?r(e):r]),c.verbose&&o.push([Ct.schema,i],[Ct.parentSchema,(0,U._)`${u}${d}`],[xe.default.data,s]),l&&o.push([Ct.propertyName,l])}});var Qp=b(ir=>{"use strict";Object.defineProperty(ir,"__esModule",{value:!0});ir.boolOrEmptySchema=ir.topBoolOrEmptySchema=void 0;var V0=Qr(),H0=j(),B0=st(),K0={message:"boolean schema is false"};function W0(e){let{gen:t,schema:r,validateName:o}=e;r===!1?Jp(e,!1):typeof r=="object"&&r.$async===!0?t.return(B0.default.data):(t.assign((0,H0._)`${o}.errors`,null),t.return(!0))}ir.topBoolOrEmptySchema=W0;function G0(e,t){let{gen:r,schema:o}=e;o===!1?(r.var(t,!1),Jp(e)):r.var(t,!0)}ir.boolOrEmptySchema=G0;function Jp(e,t){let{gen:r,data:o}=e,n={gen:r,keyword:"false schema",data:o,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,V0.reportError)(n,K0,void 0,t)}});var Gi=b(ar=>{"use strict";Object.defineProperty(ar,"__esModule",{value:!0});ar.getRules=ar.isJSONType=void 0;var J0=["string","number","integer","boolean","null","object","array"],Q0=new Set(J0);function Y0(e){return typeof e=="string"&&Q0.has(e)}ar.isJSONType=Y0;function X0(){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:{}}}ar.getRules=X0});var Ji=b(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.shouldUseRule=ht.shouldUseGroup=ht.schemaHasRulesForType=void 0;function e$({schema:e,self:t},r){let o=t.RULES.types[r];return o&&o!==!0&&Yp(e,o)}ht.schemaHasRulesForType=e$;function Yp(e,t){return t.rules.some(r=>Xp(e,r))}ht.shouldUseGroup=Yp;function Xp(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(o=>e[o]!==void 0))}ht.shouldUseRule=Xp});var Yr=b($e=>{"use strict";Object.defineProperty($e,"__esModule",{value:!0});$e.reportTypeError=$e.checkDataTypes=$e.checkDataType=$e.coerceAndCheckDataType=$e.getJSONTypes=$e.getSchemaTypes=$e.DataType=void 0;var t$=Gi(),r$=Ji(),o$=Qr(),N=j(),ef=D(),cr;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(cr||($e.DataType=cr={}));function n$(e){let t=tf(e.type);if(t.includes("null")){if(e.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');e.nullable===!0&&t.push("null")}return t}$e.getSchemaTypes=n$;function tf(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(t$.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}$e.getJSONTypes=tf;function s$(e,t){let{gen:r,data:o,opts:n}=e,s=i$(t,n.coerceTypes),i=t.length>0&&!(s.length===0&&t.length===1&&(0,r$.schemaHasRulesForType)(e,t[0]));if(i){let a=Yi(t,o,n.strictNumbers,cr.Wrong);r.if(a,()=>{s.length?a$(e,t,s):Xi(e)})}return i}$e.coerceAndCheckDataType=s$;var rf=new Set(["string","number","integer","boolean","null"]);function i$(e,t){return t?e.filter(r=>rf.has(r)||t==="array"&&r==="array"):[]}function a$(e,t,r){let{gen:o,data:n,opts:s}=e,i=o.let("dataType",(0,N._)`typeof ${n}`),a=o.let("coerced",(0,N._)`undefined`);s.coerceTypes==="array"&&o.if((0,N._)`${i} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>o.assign(n,(0,N._)`${n}[0]`).assign(i,(0,N._)`typeof ${n}`).if(Yi(t,n,s.strictNumbers),()=>o.assign(a,n))),o.if((0,N._)`${a} !== undefined`);for(let l of r)(rf.has(l)||l==="array"&&s.coerceTypes==="array")&&c(l);o.else(),Xi(e),o.endIf(),o.if((0,N._)`${a} !== undefined`,()=>{o.assign(n,a),c$(e,a)});function c(l){switch(l){case"string":o.elseIf((0,N._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,N._)`"" + ${n}`).elseIf((0,N._)`${n} === null`).assign(a,(0,N._)`""`);return;case"number":o.elseIf((0,N._)`${i} == "boolean" || ${n} === null
|
|
4
|
+
|| (${i} == "string" && ${n} && ${n} == +${n})`).assign(a,(0,N._)`+${n}`);return;case"integer":o.elseIf((0,N._)`${i} === "boolean" || ${n} === null
|
|
5
|
+
|| (${i} === "string" && ${n} && ${n} == +${n} && !(${n} % 1))`).assign(a,(0,N._)`+${n}`);return;case"boolean":o.elseIf((0,N._)`${n} === "false" || ${n} === 0 || ${n} === null`).assign(a,!1).elseIf((0,N._)`${n} === "true" || ${n} === 1`).assign(a,!0);return;case"null":o.elseIf((0,N._)`${n} === "" || ${n} === 0 || ${n} === false`),o.assign(a,null);return;case"array":o.elseIf((0,N._)`${i} === "string" || ${i} === "number"
|
|
6
|
+
|| ${i} === "boolean" || ${n} === null`).assign(a,(0,N._)`[${n}]`)}}}function c$({gen:e,parentData:t,parentDataProperty:r},o){e.if((0,N._)`${t} !== undefined`,()=>e.assign((0,N._)`${t}[${r}]`,o))}function Qi(e,t,r,o=cr.Correct){let n=o===cr.Correct?N.operators.EQ:N.operators.NEQ,s;switch(e){case"null":return(0,N._)`${t} ${n} null`;case"array":s=(0,N._)`Array.isArray(${t})`;break;case"object":s=(0,N._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":s=i((0,N._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":s=i();break;default:return(0,N._)`typeof ${t} ${n} ${e}`}return o===cr.Correct?s:(0,N.not)(s);function i(a=N.nil){return(0,N.and)((0,N._)`typeof ${t} == "number"`,a,r?(0,N._)`isFinite(${t})`:N.nil)}}$e.checkDataType=Qi;function Yi(e,t,r,o){if(e.length===1)return Qi(e[0],t,r,o);let n,s=(0,ef.toHash)(e);if(s.array&&s.object){let i=(0,N._)`typeof ${t} != "object"`;n=s.null?i:(0,N._)`!${t} || ${i}`,delete s.null,delete s.array,delete s.object}else n=N.nil;s.number&&delete s.integer;for(let i in s)n=(0,N.and)(n,Qi(i,t,r,o));return n}$e.checkDataTypes=Yi;var u$={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,N._)`{type: ${e}}`:(0,N._)`{type: ${t}}`};function Xi(e){let t=l$(e);(0,o$.reportError)(t,u$)}$e.reportTypeError=Xi;function l$(e){let{gen:t,data:r,schema:o}=e,n=(0,ef.schemaRefOrVal)(e,o,"type");return{gen:t,keyword:"type",data:r,schema:o.type,schemaCode:n,schemaValue:n,parentSchema:o,params:{},it:e}}});var nf=b(zn=>{"use strict";Object.defineProperty(zn,"__esModule",{value:!0});zn.assignDefaults=void 0;var ur=j(),d$=D();function p$(e,t){let{properties:r,items:o}=e.schema;if(t==="object"&&r)for(let n in r)of(e,n,r[n].default);else t==="array"&&Array.isArray(o)&&o.forEach((n,s)=>of(e,s,n.default))}zn.assignDefaults=p$;function of(e,t,r){let{gen:o,compositeRule:n,data:s,opts:i}=e;if(r===void 0)return;let a=(0,ur._)`${s}${(0,ur.getProperty)(t)}`;if(n){(0,d$.checkStrictMode)(e,`default is ignored for: ${a}`);return}let c=(0,ur._)`${a} === undefined`;i.useDefaults==="empty"&&(c=(0,ur._)`${c} || ${a} === null || ${a} === ""`),o.if(c,(0,ur._)`${a} = ${(0,ur.stringify)(r)}`)}});var je=b(B=>{"use strict";Object.defineProperty(B,"__esModule",{value:!0});B.validateUnion=B.validateArray=B.usePattern=B.callValidateCode=B.schemaProperties=B.allSchemaProperties=B.noPropertyInData=B.propertyInData=B.isOwnProperty=B.hasPropFunc=B.reportMissingProp=B.checkMissingProp=B.checkReportMissingProp=void 0;var ee=j(),ea=D(),gt=st(),f$=D();function m$(e,t){let{gen:r,data:o,it:n}=e;r.if(ra(r,o,t,n.opts.ownProperties),()=>{e.setParams({missingProperty:(0,ee._)`${t}`},!0),e.error()})}B.checkReportMissingProp=m$;function h$({gen:e,data:t,it:{opts:r}},o,n){return(0,ee.or)(...o.map(s=>(0,ee.and)(ra(e,t,s,r.ownProperties),(0,ee._)`${n} = ${s}`)))}B.checkMissingProp=h$;function g$(e,t){e.setParams({missingProperty:t},!0),e.error()}B.reportMissingProp=g$;function sf(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,ee._)`Object.prototype.hasOwnProperty`})}B.hasPropFunc=sf;function ta(e,t,r){return(0,ee._)`${sf(e)}.call(${t}, ${r})`}B.isOwnProperty=ta;function _$(e,t,r,o){let n=(0,ee._)`${t}${(0,ee.getProperty)(r)} !== undefined`;return o?(0,ee._)`${n} && ${ta(e,t,r)}`:n}B.propertyInData=_$;function ra(e,t,r,o){let n=(0,ee._)`${t}${(0,ee.getProperty)(r)} === undefined`;return o?(0,ee.or)(n,(0,ee.not)(ta(e,t,r))):n}B.noPropertyInData=ra;function af(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}B.allSchemaProperties=af;function y$(e,t){return af(t).filter(r=>!(0,ea.alwaysValidSchema)(e,t[r]))}B.schemaProperties=y$;function v$({schemaCode:e,data:t,it:{gen:r,topSchemaRef:o,schemaPath:n,errorPath:s},it:i},a,c,l){let u=l?(0,ee._)`${e}, ${t}, ${o}${n}`:t,d=[[gt.default.instancePath,(0,ee.strConcat)(gt.default.instancePath,s)],[gt.default.parentData,i.parentData],[gt.default.parentDataProperty,i.parentDataProperty],[gt.default.rootData,gt.default.rootData]];i.opts.dynamicRef&&d.push([gt.default.dynamicAnchors,gt.default.dynamicAnchors]);let m=(0,ee._)`${u}, ${r.object(...d)}`;return c!==ee.nil?(0,ee._)`${a}.call(${c}, ${m})`:(0,ee._)`${a}(${m})`}B.callValidateCode=v$;var $$=(0,ee._)`new RegExp`;function w$({gen:e,it:{opts:t}},r){let o=t.unicodeRegExp?"u":"",{regExp:n}=t.code,s=n(r,o);return e.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,ee._)`${n.code==="new RegExp"?$$:(0,f$.useFunc)(e,n)}(${r}, ${o})`})}B.usePattern=w$;function x$(e){let{gen:t,data:r,keyword:o,it:n}=e,s=t.name("valid");if(n.allErrors){let a=t.let("valid",!0);return i(()=>t.assign(a,!1)),a}return t.var(s,!0),i(()=>t.break()),s;function i(a){let c=t.const("len",(0,ee._)`${r}.length`);t.forRange("i",0,c,l=>{e.subschema({keyword:o,dataProp:l,dataPropType:ea.Type.Num},s),t.if((0,ee.not)(s),a)})}}B.validateArray=x$;function b$(e){let{gen:t,schema:r,keyword:o,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,ea.alwaysValidSchema)(n,c))&&!n.opts.unevaluated)return;let i=t.let("valid",!1),a=t.name("_valid");t.block(()=>r.forEach((c,l)=>{let u=e.subschema({keyword:o,schemaProp:l,compositeRule:!0},a);t.assign(i,(0,ee._)`${i} || ${a}`),e.mergeValidEvaluated(u,a)||t.if((0,ee.not)(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}B.validateUnion=b$});var lf=b(Ge=>{"use strict";Object.defineProperty(Ge,"__esModule",{value:!0});Ge.validateKeywordUsage=Ge.validSchemaType=Ge.funcKeywordCode=Ge.macroKeywordCode=void 0;var be=j(),At=st(),z$=je(),S$=Qr();function k$(e,t){let{gen:r,keyword:o,schema:n,parentSchema:s,it:i}=e,a=t.macro.call(i.self,n,s,i),c=uf(r,o,a);i.opts.validateSchema!==!1&&i.self.validateSchema(a,!0);let l=r.name("valid");e.subschema({schema:a,schemaPath:be.nil,errSchemaPath:`${i.errSchemaPath}/${o}`,topSchemaRef:c,compositeRule:!0},l),e.pass(l,()=>e.error(!0))}Ge.macroKeywordCode=k$;function P$(e,t){var r;let{gen:o,keyword:n,schema:s,parentSchema:i,$data:a,it:c}=e;T$(c,t);let l=!a&&t.compile?t.compile.call(c.self,s,i,c):t.validate,u=uf(o,n,l),d=o.let("valid");e.block$data(d,m),e.ok((r=t.valid)!==null&&r!==void 0?r:d);function m(){if(t.errors===!1)h(),t.modifying&&cf(e),y(()=>e.error());else{let x=t.async?f():g();t.modifying&&cf(e),y(()=>E$(e,x))}}function f(){let x=o.let("ruleErrs",null);return o.try(()=>h((0,be._)`await `),w=>o.assign(d,!1).if((0,be._)`${w} instanceof ${c.ValidationError}`,()=>o.assign(x,(0,be._)`${w}.errors`),()=>o.throw(w))),x}function g(){let x=(0,be._)`${u}.errors`;return o.assign(x,null),h(be.nil),x}function h(x=t.async?(0,be._)`await `:be.nil){let w=c.opts.passContext?At.default.this:At.default.self,$=!("compile"in t&&!a||t.schema===!1);o.assign(d,(0,be._)`${x}${(0,z$.callValidateCode)(e,u,w,$)}`,t.modifying)}function y(x){var w;o.if((0,be.not)((w=t.valid)!==null&&w!==void 0?w:d),x)}}Ge.funcKeywordCode=P$;function cf(e){let{gen:t,data:r,it:o}=e;t.if(o.parentData,()=>t.assign(r,(0,be._)`${o.parentData}[${o.parentDataProperty}]`))}function E$(e,t){let{gen:r}=e;r.if((0,be._)`Array.isArray(${t})`,()=>{r.assign(At.default.vErrors,(0,be._)`${At.default.vErrors} === null ? ${t} : ${At.default.vErrors}.concat(${t})`).assign(At.default.errors,(0,be._)`${At.default.vErrors}.length`),(0,S$.extendErrors)(e)},()=>e.error())}function T$({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function uf(e,t,r){if(r===void 0)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,be.stringify)(r)})}function R$(e,t,r=!1){return!t.length||t.some(o=>o==="array"?Array.isArray(e):o==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==o||r&&typeof e>"u")}Ge.validSchemaType=R$;function I$({schema:e,opts:t,self:r,errSchemaPath:o},n,s){if(Array.isArray(n.keyword)?!n.keyword.includes(s):n.keyword!==s)throw new Error("ajv implementation error");let i=n.dependencies;if(i?.some(a=>!Object.prototype.hasOwnProperty.call(e,a)))throw new Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(n.validateSchema&&!n.validateSchema(e[s])){let c=`keyword "${s}" value is invalid at path "${o}": `+r.errorsText(n.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}Ge.validateKeywordUsage=I$});var pf=b(_t=>{"use strict";Object.defineProperty(_t,"__esModule",{value:!0});_t.extendSubschemaMode=_t.extendSubschemaData=_t.getSubschema=void 0;var Je=j(),df=D();function O$(e,{keyword:t,schemaProp:r,schema:o,schemaPath:n,errSchemaPath:s,topSchemaRef:i}){if(t!==void 0&&o!==void 0)throw new 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:(0,Je._)`${e.schemaPath}${(0,Je.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:(0,Je._)`${e.schemaPath}${(0,Je.getProperty)(t)}${(0,Je.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,df.escapeFragment)(r)}`}}if(o!==void 0){if(n===void 0||s===void 0||i===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:o,schemaPath:n,topSchemaRef:i,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}_t.getSubschema=O$;function C$(e,t,{dataProp:r,dataPropType:o,data:n,dataTypes:s,propertyName:i}){if(n!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=t;if(r!==void 0){let{errorPath:l,dataPathArr:u,opts:d}=t,m=a.let("data",(0,Je._)`${t.data}${(0,Je.getProperty)(r)}`,!0);c(m),e.errorPath=(0,Je.str)`${l}${(0,df.getErrorPath)(r,o,d.jsPropertySyntax)}`,e.parentDataProperty=(0,Je._)`${r}`,e.dataPathArr=[...u,e.parentDataProperty]}if(n!==void 0){let l=n instanceof Je.Name?n:a.let("data",n,!0);c(l),i!==void 0&&(e.propertyName=i)}s&&(e.dataTypes=s);function c(l){e.data=l,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,l]}}_t.extendSubschemaData=C$;function A$(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:o,createErrors:n,allErrors:s}){o!==void 0&&(e.compositeRule=o),n!==void 0&&(e.createErrors=n),s!==void 0&&(e.allErrors=s),e.jtdDiscriminator=t,e.jtdMetadata=r}_t.extendSubschemaMode=A$});var oa=b((wI,ff)=>{"use strict";ff.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var o,n,s;if(Array.isArray(t)){if(o=t.length,o!=r.length)return!1;for(n=o;n--!==0;)if(!e(t[n],r[n]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(s=Object.keys(t),o=s.length,o!==Object.keys(r).length)return!1;for(n=o;n--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[n]))return!1;for(n=o;n--!==0;){var i=s[n];if(!e(t[i],r[i]))return!1}return!0}return t!==t&&r!==r}});var hf=b((xI,mf)=>{"use strict";var yt=mf.exports=function(e,t,r){typeof t=="function"&&(r=t,t={}),r=t.cb||r;var o=typeof r=="function"?r:r.pre||function(){},n=r.post||function(){};Sn(t,o,n,e,"",e)};yt.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};yt.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};yt.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};yt.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 Sn(e,t,r,o,n,s,i,a,c,l){if(o&&typeof o=="object"&&!Array.isArray(o)){t(o,n,s,i,a,c,l);for(var u in o){var d=o[u];if(Array.isArray(d)){if(u in yt.arrayKeywords)for(var m=0;m<d.length;m++)Sn(e,t,r,d[m],n+"/"+u+"/"+m,s,n,u,o,m)}else if(u in yt.propsKeywords){if(d&&typeof d=="object")for(var f in d)Sn(e,t,r,d[f],n+"/"+u+"/"+N$(f),s,n,u,o,f)}else(u in yt.keywords||e.allKeys&&!(u in yt.skipKeywords))&&Sn(e,t,r,d,n+"/"+u,s,n,u,o)}r(o,n,s,i,a,c,l)}}function N$(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var Xr=b(Ee=>{"use strict";Object.defineProperty(Ee,"__esModule",{value:!0});Ee.getSchemaRefs=Ee.resolveUrl=Ee.normalizeId=Ee._getFullPath=Ee.getFullPath=Ee.inlineRef=void 0;var j$=D(),Z$=oa(),q$=hf(),M$=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function D$(e,t=!0){return typeof e=="boolean"?!0:t===!0?!na(e):t?gf(e)<=t:!1}Ee.inlineRef=D$;var U$=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function na(e){for(let t in e){if(U$.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(na)||typeof r=="object"&&na(r))return!0}return!1}function gf(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!M$.has(r)&&(typeof e[r]=="object"&&(0,j$.eachItem)(e[r],o=>t+=gf(o)),t===1/0))return 1/0}return t}function _f(e,t="",r){r!==!1&&(t=lr(t));let o=e.parse(t);return yf(e,o)}Ee.getFullPath=_f;function yf(e,t){return e.serialize(t).split("#")[0]+"#"}Ee._getFullPath=yf;var L$=/#\/?$/;function lr(e){return e?e.replace(L$,""):""}Ee.normalizeId=lr;function F$(e,t,r){return r=lr(r),e.resolve(t,r)}Ee.resolveUrl=F$;var V$=/^[a-z_][-a-z0-9._]*$/i;function H$(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:o}=this.opts,n=lr(e[r]||t),s={"":n},i=_f(o,n,!1),a={},c=new Set;return q$(e,{allKeys:!0},(d,m,f,g)=>{if(g===void 0)return;let h=i+m,y=s[g];typeof d[r]=="string"&&(y=x.call(this,d[r])),w.call(this,d.$anchor),w.call(this,d.$dynamicAnchor),s[m]=y;function x($){let P=this.opts.uriResolver.resolve;if($=lr(y?P(y,$):$),c.has($))throw u($);c.add($);let v=this.refs[$];return typeof v=="string"&&(v=this.refs[v]),typeof v=="object"?l(d,v.schema,$):$!==lr(h)&&($[0]==="#"?(l(d,a[$],$),a[$]=d):this.refs[$]=h),$}function w($){if(typeof $=="string"){if(!V$.test($))throw new Error(`invalid anchor "${$}"`);x.call(this,`#${$}`)}}}),a;function l(d,m,f){if(m!==void 0&&!Z$(d,m))throw u(f)}function u(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Ee.getSchemaRefs=H$});var ro=b(vt=>{"use strict";Object.defineProperty(vt,"__esModule",{value:!0});vt.getData=vt.KeywordCxt=vt.validateFunctionCode=void 0;var bf=Qp(),vf=Yr(),ia=Ji(),kn=Yr(),B$=nf(),to=lf(),sa=pf(),T=j(),A=st(),K$=Xr(),it=D(),eo=Qr();function W$(e){if(kf(e)&&(Pf(e),Sf(e))){Q$(e);return}zf(e,()=>(0,bf.topBoolOrEmptySchema)(e))}vt.validateFunctionCode=W$;function zf({gen:e,validateName:t,schema:r,schemaEnv:o,opts:n},s){n.code.es5?e.func(t,(0,T._)`${A.default.data}, ${A.default.valCxt}`,o.$async,()=>{e.code((0,T._)`"use strict"; ${$f(r,n)}`),J$(e,n),e.code(s)}):e.func(t,(0,T._)`${A.default.data}, ${G$(n)}`,o.$async,()=>e.code($f(r,n)).code(s))}function G$(e){return(0,T._)`{${A.default.instancePath}="", ${A.default.parentData}, ${A.default.parentDataProperty}, ${A.default.rootData}=${A.default.data}${e.dynamicRef?(0,T._)`, ${A.default.dynamicAnchors}={}`:T.nil}}={}`}function J$(e,t){e.if(A.default.valCxt,()=>{e.var(A.default.instancePath,(0,T._)`${A.default.valCxt}.${A.default.instancePath}`),e.var(A.default.parentData,(0,T._)`${A.default.valCxt}.${A.default.parentData}`),e.var(A.default.parentDataProperty,(0,T._)`${A.default.valCxt}.${A.default.parentDataProperty}`),e.var(A.default.rootData,(0,T._)`${A.default.valCxt}.${A.default.rootData}`),t.dynamicRef&&e.var(A.default.dynamicAnchors,(0,T._)`${A.default.valCxt}.${A.default.dynamicAnchors}`)},()=>{e.var(A.default.instancePath,(0,T._)`""`),e.var(A.default.parentData,(0,T._)`undefined`),e.var(A.default.parentDataProperty,(0,T._)`undefined`),e.var(A.default.rootData,A.default.data),t.dynamicRef&&e.var(A.default.dynamicAnchors,(0,T._)`{}`)})}function Q$(e){let{schema:t,opts:r,gen:o}=e;zf(e,()=>{r.$comment&&t.$comment&&Tf(e),rw(e),o.let(A.default.vErrors,null),o.let(A.default.errors,0),r.unevaluated&&Y$(e),Ef(e),sw(e)})}function Y$(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,T._)`${r}.evaluated`),t.if((0,T._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,T._)`${e.evaluated}.props`,(0,T._)`undefined`)),t.if((0,T._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,T._)`${e.evaluated}.items`,(0,T._)`undefined`))}function $f(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,T._)`/*# sourceURL=${r} */`:T.nil}function X$(e,t){if(kf(e)&&(Pf(e),Sf(e))){ew(e,t);return}(0,bf.boolOrEmptySchema)(e,t)}function Sf({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 kf(e){return typeof e.schema!="boolean"}function ew(e,t){let{schema:r,gen:o,opts:n}=e;n.$comment&&r.$comment&&Tf(e),ow(e),nw(e);let s=o.const("_errs",A.default.errors);Ef(e,s),o.var(t,(0,T._)`${s} === ${A.default.errors}`)}function Pf(e){(0,it.checkUnknownRules)(e),tw(e)}function Ef(e,t){if(e.opts.jtd)return wf(e,[],!1,t);let r=(0,vf.getSchemaTypes)(e.schema),o=(0,vf.coerceAndCheckDataType)(e,r);wf(e,r,!o,t)}function tw(e){let{schema:t,errSchemaPath:r,opts:o,self:n}=e;t.$ref&&o.ignoreKeywordsWithRef&&(0,it.schemaHasRulesButRef)(t,n.RULES)&&n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function rw(e){let{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,it.checkStrictMode)(e,"default is ignored in the schema root")}function ow(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,K$.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function nw(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function Tf({gen:e,schemaEnv:t,schema:r,errSchemaPath:o,opts:n}){let s=r.$comment;if(n.$comment===!0)e.code((0,T._)`${A.default.self}.logger.log(${s})`);else if(typeof n.$comment=="function"){let i=(0,T.str)`${o}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code((0,T._)`${A.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function sw(e){let{gen:t,schemaEnv:r,validateName:o,ValidationError:n,opts:s}=e;r.$async?t.if((0,T._)`${A.default.errors} === 0`,()=>t.return(A.default.data),()=>t.throw((0,T._)`new ${n}(${A.default.vErrors})`)):(t.assign((0,T._)`${o}.errors`,A.default.vErrors),s.unevaluated&&iw(e),t.return((0,T._)`${A.default.errors} === 0`))}function iw({gen:e,evaluated:t,props:r,items:o}){r instanceof T.Name&&e.assign((0,T._)`${t}.props`,r),o instanceof T.Name&&e.assign((0,T._)`${t}.items`,o)}function wf(e,t,r,o){let{gen:n,schema:s,data:i,allErrors:a,opts:c,self:l}=e,{RULES:u}=l;if(s.$ref&&(c.ignoreKeywordsWithRef||!(0,it.schemaHasRulesButRef)(s,u))){n.block(()=>If(e,"$ref",u.all.$ref.definition));return}c.jtd||aw(e,t),n.block(()=>{for(let m of u.rules)d(m);d(u.post)});function d(m){(0,ia.shouldUseGroup)(s,m)&&(m.type?(n.if((0,kn.checkDataType)(m.type,i,c.strictNumbers)),xf(e,m),t.length===1&&t[0]===m.type&&r&&(n.else(),(0,kn.reportTypeError)(e)),n.endIf()):xf(e,m),a||n.if((0,T._)`${A.default.errors} === ${o||0}`))}}function xf(e,t){let{gen:r,schema:o,opts:{useDefaults:n}}=e;n&&(0,B$.assignDefaults)(e,t.type),r.block(()=>{for(let s of t.rules)(0,ia.shouldUseRule)(o,s)&&If(e,s.keyword,s.definition,t.type)})}function aw(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(cw(e,t),e.opts.allowUnionTypes||uw(e,t),lw(e,e.dataTypes))}function cw(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{Rf(e.dataTypes,r)||aa(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),pw(e,t)}}function uw(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&aa(e,"use allowUnionTypes to allow union type keyword")}function lw(e,t){let r=e.self.RULES.all;for(let o in r){let n=r[o];if(typeof n=="object"&&(0,ia.shouldUseRule)(e.schema,n)){let{type:s}=n.definition;s.length&&!s.some(i=>dw(t,i))&&aa(e,`missing type "${s.join(",")}" for keyword "${o}"`)}}}function dw(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function Rf(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function pw(e,t){let r=[];for(let o of e.dataTypes)Rf(t,o)?r.push(o):t.includes("integer")&&o==="number"&&r.push("integer");e.dataTypes=r}function aa(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,it.checkStrictMode)(e,t,e.opts.strictTypes)}var Pn=class{constructor(t,r,o){if((0,to.validateKeywordUsage)(t,r,o),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=o,this.data=t.data,this.schema=t.schema[o],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,it.schemaRefOrVal)(t,this.schema,o,this.$data),this.schemaType=r.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=r,this.$data)this.schemaCode=t.gen.const("vSchema",Of(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,to.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${o} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=t.gen.const("_errs",A.default.errors))}result(t,r,o){this.failResult((0,T.not)(t),r,o)}failResult(t,r,o){this.gen.if(t),o?o():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,r){this.failResult((0,T.not)(t),void 0,r)}fail(t){if(t===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(t),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);let{schemaCode:r}=this;this.fail((0,T._)`${r} !== undefined && (${(0,T.or)(this.invalid$data(),t)})`)}error(t,r,o){if(r){this.setParams(r),this._error(t,o),this.setParams({});return}this._error(t,o)}_error(t,r){(t?eo.reportExtraError:eo.reportError)(this,this.def.error,r)}$dataError(){(0,eo.reportError)(this,this.def.$dataError||eo.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,eo.resetErrorsCount)(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,r){r?Object.assign(this.params,t):this.params=t}block$data(t,r,o=T.nil){this.gen.block(()=>{this.check$data(t,o),r()})}check$data(t=T.nil,r=T.nil){if(!this.$data)return;let{gen:o,schemaCode:n,schemaType:s,def:i}=this;o.if((0,T.or)((0,T._)`${n} === undefined`,r)),t!==T.nil&&o.assign(t,!0),(s.length||i.validateSchema)&&(o.elseIf(this.invalid$data()),this.$dataError(),t!==T.nil&&o.assign(t,!1)),o.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:o,def:n,it:s}=this;return(0,T.or)(i(),a());function i(){if(o.length){if(!(r instanceof T.Name))throw new Error("ajv implementation error");let c=Array.isArray(o)?o:[o];return(0,T._)`${(0,kn.checkDataTypes)(c,r,s.opts.strictNumbers,kn.DataType.Wrong)}`}return T.nil}function a(){if(n.validateSchema){let c=t.scopeValue("validate$data",{ref:n.validateSchema});return(0,T._)`!${c}(${r})`}return T.nil}}subschema(t,r){let o=(0,sa.getSubschema)(this.it,t);(0,sa.extendSubschemaData)(o,this.it,t),(0,sa.extendSubschemaMode)(o,t);let n={...this.it,...o,items:void 0,props:void 0};return X$(n,r),n}mergeEvaluated(t,r){let{it:o,gen:n}=this;o.opts.unevaluated&&(o.props!==!0&&t.props!==void 0&&(o.props=it.mergeEvaluated.props(n,t.props,o.props,r)),o.items!==!0&&t.items!==void 0&&(o.items=it.mergeEvaluated.items(n,t.items,o.items,r)))}mergeValidEvaluated(t,r){let{it:o,gen:n}=this;if(o.opts.unevaluated&&(o.props!==!0||o.items!==!0))return n.if(r,()=>this.mergeEvaluated(t,T.Name)),!0}};vt.KeywordCxt=Pn;function If(e,t,r,o){let n=new Pn(e,r,t);"code"in r?r.code(n,o):n.$data&&r.validate?(0,to.funcKeywordCode)(n,r):"macro"in r?(0,to.macroKeywordCode)(n,r):(r.compile||r.validate)&&(0,to.funcKeywordCode)(n,r)}var fw=/^\/(?:[^~]|~0|~1)*$/,mw=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Of(e,{dataLevel:t,dataNames:r,dataPathArr:o}){let n,s;if(e==="")return A.default.rootData;if(e[0]==="/"){if(!fw.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);n=e,s=A.default.rootData}else{let l=mw.exec(e);if(!l)throw new Error(`Invalid JSON-pointer: ${e}`);let u=+l[1];if(n=l[2],n==="#"){if(u>=t)throw new Error(c("property/index",u));return o[t-u]}if(u>t)throw new Error(c("data",u));if(s=r[t-u],!n)return s}let i=s,a=n.split("/");for(let l of a)l&&(s=(0,T._)`${s}${(0,T.getProperty)((0,it.unescapeJsonPointer)(l))}`,i=(0,T._)`${i} && ${s}`);return i;function c(l,u){return`Cannot access ${l} ${u} levels up, current level is ${t}`}}vt.getData=Of});var En=b(ua=>{"use strict";Object.defineProperty(ua,"__esModule",{value:!0});var ca=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}};ua.default=ca});var oo=b(pa=>{"use strict";Object.defineProperty(pa,"__esModule",{value:!0});var la=Xr(),da=class extends Error{constructor(t,r,o,n){super(n||`can't resolve reference ${o} from id ${r}`),this.missingRef=(0,la.resolveUrl)(t,r,o),this.missingSchema=(0,la.normalizeId)((0,la.getFullPath)(t,this.missingRef))}};pa.default=da});var Rn=b(Ze=>{"use strict";Object.defineProperty(Ze,"__esModule",{value:!0});Ze.resolveSchema=Ze.getCompilingSchema=Ze.resolveRef=Ze.compileSchema=Ze.SchemaEnv=void 0;var Ve=j(),hw=En(),Nt=st(),He=Xr(),Cf=D(),gw=ro(),dr=class{constructor(t){var r;this.refs={},this.dynamicAnchors={};let o;typeof t.schema=="object"&&(o=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=(r=t.baseId)!==null&&r!==void 0?r:(0,He.normalizeId)(o?.[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=o?.$async,this.refs={}}};Ze.SchemaEnv=dr;function ma(e){let t=Af.call(this,e);if(t)return t;let r=(0,He.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:o,lines:n}=this.opts.code,{ownProperties:s}=this.opts,i=new Ve.CodeGen(this.scope,{es5:o,lines:n,ownProperties:s}),a;e.$async&&(a=i.scopeValue("Error",{ref:hw.default,code:(0,Ve._)`require("ajv/dist/runtime/validation_error").default`}));let c=i.scopeName("validate");e.validateName=c;let l={gen:i,allErrors:this.opts.allErrors,data:Nt.default.data,parentData:Nt.default.parentData,parentDataProperty:Nt.default.parentDataProperty,dataNames:[Nt.default.data],dataPathArr:[Ve.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,Ve.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:Ve.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Ve._)`""`,opts:this.opts,self:this},u;try{this._compilations.add(e),(0,gw.validateFunctionCode)(l),i.optimize(this.opts.code.optimize);let d=i.toString();u=`${i.scopeRefs(Nt.default.scope)}return ${d}`,this.opts.code.process&&(u=this.opts.code.process(u,e));let f=new Function(`${Nt.default.self}`,`${Nt.default.scope}`,u)(this,this.scope.get());if(this.scope.value(c,{ref:f}),f.errors=null,f.schema=e.schema,f.schemaEnv=e,e.$async&&(f.$async=!0),this.opts.code.source===!0&&(f.source={validateName:c,validateCode:d,scopeValues:i._values}),this.opts.unevaluated){let{props:g,items:h}=l;f.evaluated={props:g instanceof Ve.Name?void 0:g,items:h instanceof Ve.Name?void 0:h,dynamicProps:g instanceof Ve.Name,dynamicItems:h instanceof Ve.Name},f.source&&(f.source.evaluated=(0,Ve.stringify)(f.evaluated))}return e.validate=f,e}catch(d){throw delete e.validate,delete e.validateName,u&&this.logger.error("Error compiling schema, function code:",u),d}finally{this._compilations.delete(e)}}Ze.compileSchema=ma;function _w(e,t,r){var o;r=(0,He.resolveUrl)(this.opts.uriResolver,t,r);let n=e.refs[r];if(n)return n;let s=$w.call(this,e,r);if(s===void 0){let i=(o=e.localRefs)===null||o===void 0?void 0:o[r],{schemaId:a}=this.opts;i&&(s=new dr({schema:i,schemaId:a,root:e,baseId:t}))}if(s!==void 0)return e.refs[r]=yw.call(this,s)}Ze.resolveRef=_w;function yw(e){return(0,He.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:ma.call(this,e)}function Af(e){for(let t of this._compilations)if(vw(t,e))return t}Ze.getCompilingSchema=Af;function vw(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function $w(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||Tn.call(this,e,t)}function Tn(e,t){let r=this.opts.uriResolver.parse(t),o=(0,He._getFullPath)(this.opts.uriResolver,r),n=(0,He.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&o===n)return fa.call(this,r,e);let s=(0,He.normalizeId)(o),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=Tn.call(this,e,i);return typeof a?.schema!="object"?void 0:fa.call(this,r,a)}if(typeof i?.schema=="object"){if(i.validate||ma.call(this,i),s===(0,He.normalizeId)(t)){let{schema:a}=i,{schemaId:c}=this.opts,l=a[c];return l&&(n=(0,He.resolveUrl)(this.opts.uriResolver,n,l)),new dr({schema:a,schemaId:c,root:e,baseId:n})}return fa.call(this,r,i)}}Ze.resolveSchema=Tn;var ww=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function fa(e,{baseId:t,schema:r,root:o}){var n;if(((n=e.fragment)===null||n===void 0?void 0:n[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,Cf.unescapeFragment)(a)];if(c===void 0)return;r=c;let l=typeof r=="object"&&r[this.opts.schemaId];!ww.has(a)&&l&&(t=(0,He.resolveUrl)(this.opts.uriResolver,t,l))}let s;if(typeof r!="boolean"&&r.$ref&&!(0,Cf.schemaHasRulesButRef)(r,this.RULES)){let a=(0,He.resolveUrl)(this.opts.uriResolver,t,r.$ref);s=Tn.call(this,o,a)}let{schemaId:i}=this.opts;if(s=s||new dr({schema:r,schemaId:i,root:o,baseId:t}),s.schema!==s.root.schema)return s}});var Nf=b((EI,xw)=>{xw.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 $a=b((TI,Lf)=>{"use strict";var bw=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),ga=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),zw=RegExp.prototype.test.bind(/^\d*$/u),jt=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),_a=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),Zf=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),ya=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),Sw=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),Te=new Array(256);{let e="0123456789ABCDEF";for(let t=0;t<256;t++)Te[t]="%"+e[t>>4]+e[t&15]}function we(e){return e<2048?Te[192|e>>6]+Te[128|e&63]:e<65536?Te[224|e>>12]+Te[128|e>>6&63]+Te[128|e&63]:Te[240|e>>18]+Te[128|e>>12&63]+Te[128|e>>6&63]+Te[128|e&63]}function kw(e){let t="",r=0,o=0;for(o=0;o<e.length;o++)if(r=e[o].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[o];break}for(o+=1;o<e.length;o++){if(r=e[o].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[o]}return t}var Pw=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),Ew=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),Tw=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),Rw=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function Iw(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++)if(!Tw(e[t])){if(e[t]==="%"&&t+2<e.length&&jt(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function jf(e){let t=-1,r=0,o=-1,n=0;for(let a=0;a<e.length;a++)e[a]==="0"?(o===-1&&(o=a),n++,n>r&&(r=n,t=o)):(o=-1,n=0);if(r<2)return e.join(":");let s=e.slice(0,t).join(":"),i=e.slice(t+r).join(":");return s+"::"+i}function Ow(e){let t=e.indexOf("::");if(t!==-1&&e.indexOf("::",t+1)!==-1)return;let r=t===-1?e.split(":"):e.slice(0,t).split(":"),o=t===-1?[]:e.slice(t+2).split(":");t!==-1&&(r.length===1&&r[0]===""&&(r.length=0),o.length===1&&o[0]===""&&(o.length=0));let n=r.concat(o),s=0;for(let a=0;a<n.length;a++){let c=n[a];if(c==="")return;if(c.indexOf(".")!==-1){if(a!==n.length-1||t!==-1&&o.length===0||!ga(c))return;s+=2;continue}if(!Pw(c))return;n[a]=parseInt(c,16).toString(16),s++}if(t===-1)return s!==8?void 0:jf(n);if(s>=8)return;let i=n.slice(0,r.length);for(let a=s;a<8;a++)i.push("0");for(let a=r.length;a<n.length;a++)i.push(n[a]);return jf(i)}function ha(e){let t=e[0]==="["&&e[e.length-1]==="]";if((e[0]==="["||e[e.length-1]==="]")&&!t)return{host:e,isIPV6:!1,error:!0};let o=t?e.slice(1,-1):e;if(t&&Ew(o))return o=o.toLowerCase(),{host:`[${o}]`,escapedHost:o,isIPV6:!1,isIPVFuture:!0};if(Cw(o,":")<2)return{host:e,isIPV6:!1,error:t};let n="",s=o.indexOf("%");if(s!==-1){let a=o.slice(s,s+3).toLowerCase()==="%25"?3:1;if(n=o.slice(s+a),!Iw(n))return{host:e,isIPV6:!1,error:!0};o=o.slice(0,s)}let i=Ow(o);return i===void 0?{host:e,isIPV6:!1,error:!0}:{host:i+(n?"%"+n:""),escapedHost:i+(n?"%25"+n:""),isIPV6:!0}}function Cw(e,t){let r=0;for(let o=0;o<e.length;o++)e[o]===t&&r++;return r}function Aw(e){let t=e,r=[],o=-1,n=0;for(;n=t.length;){if(n===1){if(t===".")break;if(t==="/"){r.push("/");break}else{r.push(t);break}}else if(n===2){if(t[0]==="."){if(t[1]===".")break;if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&(t[1]==="."||t[1]==="/")){r.push("/");break}}else if(n===3&&t==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."&&t[3]==="/"){t=t.slice(3),r.length!==0&&r.pop();continue}}if((o=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,o)),t=t.slice(o)}return r.join("")}var Nw={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},jw=/[@/?#:]/g,Zw=/[@/?#]/g;function qf(e,t){let r=t?Zw:jw;return r.lastIndex=0,e.replace(r,o=>Nw[o])}function Mf(e,t=!1){if(e.indexOf("%")===-1)return e;let r="";for(let o=0;o<e.length;o++){if(e[o]==="%"&&o+2<e.length){let n=e.slice(o+1,o+3);if(jt(n)){let s=n.toUpperCase(),i=String.fromCharCode(parseInt(s,16));t&&_a(i)?r+=i:r+="%"+s,o+=2;continue}}r+=e[o]}return r}function qw(e){let t="";for(let r=0;r<e.length;r++){let o=e[r];if(o==="%"&&r+2<e.length){let n=e.slice(r+1,r+3);if(jt(n)){let s=n.toUpperCase(),i=String.fromCharCode(parseInt(s,16));i!=="."&&_a(i)?t+=i:t+="%"+s,r+=2;continue}}if(Zf(o))t+=o;else{let n=e.charCodeAt(r);if(n<128)t+=Uf(n)?o:Te[n];else if(n<55296||n>57343)t+=we(n);else if(n<=56319&&r+1<e.length){let s=e.charCodeAt(r+1);s>=56320&&s<=57343?(t+=we(65536+(n-55296<<10)+(s-56320)),r++):t+=we(65533)}else t+=we(65533)}}return t}function Mw(e,t=!1){let r="",o=t&&e[0]!=="/";for(let n=0;n<e.length;n++){let s=e[n];if(s==="%"&&n+2<e.length){let i=e.slice(n+1,n+3);if(jt(i)){r+="%"+i.toUpperCase(),n+=2;continue}}if(s==="/"&&(o=!1),Zf(s)&&(s!==":"||!o))r+=s;else{let i=e.charCodeAt(n);if(i<128)r+=Te[i];else if(i<55296||i>57343)r+=we(i);else if(i<=56319&&n+1<e.length){let a=e.charCodeAt(n+1);a>=56320&&a<=57343?(r+=we(65536+(i-55296<<10)+(a-56320)),n++):r+=we(65533)}else r+=we(65533)}}return r}function va(e,t){let r="";for(let o=0;o<e.length;o++){let n=e[o];if(n==="%"&&o+2<e.length){let s=e.slice(o+1,o+3);if(jt(s)){r+="%"+s.toUpperCase(),o+=2;continue}}if(t(n))r+=n;else{let s=e.charCodeAt(o);if(s<128)r+=Te[s];else if(s<55296||s>57343)r+=we(s);else if(s<=56319&&o+1<e.length){let i=e.charCodeAt(o+1);i>=56320&&i<=57343?(r+=we(65536+(s-55296<<10)+(i-56320)),o++):r+=we(65533)}else r+=we(65533)}}return r}function Df(e){return va(e,Sw)}function Dw(e){return va(e,ya)}function Uw(e){return va(e,ya)}function Uf(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 Lw(e){let t="";for(let r=0;r<e.length;r++){let o=e[r];if(o==="%"&&r+2<e.length){let n=e.slice(r+1,r+3);if(jt(n)){let s=n.toUpperCase(),i=String.fromCharCode(parseInt(s,16));_a(i)?t+=i:t+="%"+s,r+=2;continue}}if(ya(o))t+=o;else{let n=e.charCodeAt(r);if(n<128)t+=Uf(n)?o:Te[n];else if(n<55296||n>57343)t+=we(n);else if(n<=56319&&r+1<e.length){let s=e.charCodeAt(r+1);s>=56320&&s<=57343?(t+=we(65536+(n-55296<<10)+(s-56320)),r++):t+=we(65533)}else t+=we(65533)}}return t}function Fw(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(jt(o)){t+="%"+o.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function Vw(e){let t=[];if(e.userinfo!==void 0&&(t.push(Df(e.userinfo)),t.push("@")),e.host!==void 0){let r=e.host;if(!ga(r)){let o=ha(r);o.isIPV6!==!0&&o.isIPVFuture!==!0&&(r=Mf(r,!0),o=ha(r)),o.isIPV6===!0||o.isIPVFuture===!0?r=`[${o.escapedHost}]`:r=qf(r,!1)}t.push(r)}if(typeof e.port=="number"||typeof e.port=="string"){let r=String(e.port);if(!zw(r))throw new TypeError("URI port is malformed.");t.push(":"),t.push(r)}return t.length?t.join(""):void 0}Lf.exports={nonSimpleDomain:Rw,recomposeAuthority:Vw,reescapeHostDelimiters:qf,normalizePercentEncoding:Mf,normalizePathEncoding:qw,serializePathEncoding:Mw,normalizeQueryFragmentEncoding:Lw,encodeUserinfo:Df,encodeQuery:Dw,encodeFragment:Uw,escapePreservingEscapes:Fw,removeDotSegments:Aw,isIPv4:ga,isUUID:bw,normalizeIPv6:ha,stringArrayToHexStripped:kw}});var Kf=b((RI,Bf)=>{"use strict";var{isUUID:Hw}=$a(),Bw=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,Kw=["http","https","ws","wss","urn","urn:uuid"];function Ww(e){return Kw.indexOf(e)!==-1}function wa(e){return e.secure===!0?!0:e.secure===!1?!1:e.scheme?e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S"):!1}function Ff(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function Vf(e){let t=String(e.scheme).toLowerCase()==="https";return(e.port===(t?443:80)||e.port==="")&&(e.port=void 0),e.path||(e.path="/"),e}function Gw(e){return e.secure=wa(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function Jw(e){if((e.port===(wa(e)?443:80)||e.port==="")&&(e.port=void 0),typeof e.secure=="boolean"&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){let t=e.resourceName.indexOf("?"),r=t===-1?e.resourceName:e.resourceName.slice(0,t);e.path=r&&r!=="/"?r:void 0,e.query=t===-1?void 0:e.resourceName.slice(t+1),e.resourceName=void 0}return e.fragment=void 0,e}function Qw(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(Bw);if(r&&r[0]===e.path){let o=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let n=`${o}:${t.nid||e.nid}`,s=xa(n);e.path=void 0,s&&(e=s.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function Yw(e,t){if(e.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",o=e.nid.toLowerCase(),n=`${r}:${t.nid||o}`,s=xa(n);s&&(e=s.serialize(e,t));let i=e,a=e.nss;return i.path=`${o||t.nid}:${a}`,t.skipEscape=!0,i}function Xw(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!Hw(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function ex(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var Hf={scheme:"http",domainHost:!0,parse:Ff,serialize:Vf},tx={scheme:"https",domainHost:Hf.domainHost,parse:Ff,serialize:Vf},In={scheme:"ws",domainHost:!0,parse:Gw,serialize:Jw},rx={scheme:"wss",domainHost:In.domainHost,parse:In.parse,serialize:In.serialize},ox={scheme:"urn",parse:Qw,serialize:Yw,skipNormalize:!0},nx={scheme:"urn:uuid",parse:Xw,serialize:ex,skipNormalize:!0},On={http:Hf,https:tx,ws:In,wss:rx,urn:ox,"urn:uuid":nx};Object.setPrototypeOf(On,null);function xa(e){return e&&(On[e]||On[e.toLowerCase()])||void 0}Bf.exports={wsIsSecure:wa,SCHEMES:On,isValidSchemeName:Ww,getSchemeHandler:xa}});var im=b((II,Nn)=>{"use strict";var{normalizeIPv6:Yf,removeDotSegments:so,recomposeAuthority:sx,normalizePercentEncoding:ba,normalizePathEncoding:ix,serializePathEncoding:Wf,normalizeQueryFragmentEncoding:Gf,encodeQuery:ax,encodeFragment:cx,reescapeHostDelimiters:ux,isIPv4:Xf,nonSimpleDomain:lx}=$a(),{SCHEMES:em,getSchemeHandler:za}=Kf(),tm=/^[A-Za-z][A-Za-z0-9+.-]*$/u,rm="URI scheme is malformed.";function Jf(e){let t=unescape(String(e));if(!tm.test(t))throw new TypeError(rm);return t}function dx(e,t){return typeof e=="string"?e=vx(e,t):typeof e=="object"&&(e=An(Zt(e,t),t)),e}function px(e,t,r){let o=r?Object.assign({scheme:"null"},r):{scheme:"null"},{parsed:n,malformedAuthorityOrPort:s,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:c,malformedScheme:l}=Cn(e,o),{parsed:u,malformedAuthorityOrPort:d,malformedPercentEncoding:m,malformedSchemeSpecific:f,malformedHost:g,malformedScheme:h}=Cn(t,o);if(s||d||i||m||a||f||c||g||l||h)throw new Error(n.error||u.error||"URI is malformed.");let y=om(n,u,o,!0),x=za(r&&r.scheme||y.scheme),w=y.host,$=w!==void 0&&w!==""&&(Xf(w)||Yf(w).isIPV6);nm(y,r||{},x,$);let P=w&&w.indexOf("%")!==-1&&!new RegExp("\\P{ASCII}","u").test(w);if(y.error&&!P)throw new Error(y.error);return o.skipEscape=!0,Zt(y,o)}function om(e,t,r,o){let n={};return o||(e=An(Zt(e,r),r),t=An(Zt(t,r),r)),r=r||{},!r.tolerant&&t.scheme?(n.scheme=t.scheme,n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=so(t.path||""),n.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=so(t.path||""),n.query=t.query):(t.path?(t.path[0]==="/"?n.path=so(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?n.path="/"+t.path:e.path?n.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:n.path=t.path,n.path=so(n.path)),n.query=t.query):(n.path=e.path,t.query!==void 0?n.query=t.query:n.query=e.query),n.userinfo=e.userinfo,n.host=e.host,n.port=e.port),n.scheme=e.scheme),n.fragment=t.fragment,n}function fx(e,t,r){let o=Qf(e,r),n=Qf(t,r);return o!==void 0&&n!==void 0&&o===n}function Zt(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},o=Object.assign({},t),n=[];r.scheme&&(r.scheme=Jf(r.scheme));let s=za(o.scheme||r.scheme);s&&s.serialize&&s.serialize(r,o);let i=r.userinfo!==void 0||r.host!==void 0||r.port!==void 0,a=!o.skipEscape&&r.scheme===void 0&&!i;r.path!==void 0&&(o.skipEscape?r.path=ba(r.path):r.path=Wf(r.path,a)),o.reference!=="suffix"&&r.scheme&&(r.scheme=Jf(r.scheme),n.push(r.scheme,":"));let c=sx(r);if(c!==void 0&&(o.reference!=="suffix"&&n.push("//"),n.push(c),r.path&&r.path[0]!=="/"&&n.push("/")),r.path!==void 0){let l=r.path;!o.absolutePath&&(!s||!s.absolutePath)&&(l=so(l)),a&&(l=Wf(l,!0)),c===void 0&&l[0]==="/"&&l[1]==="/"&&(l="/%2F"+l.slice(2)),n.push(l)}return r.query!==void 0&&n.push("?",ax(r.query)),r.fragment!==void 0&&n.push("#",cx(r.fragment)),n.join("")}var mx=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,hx=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,gx=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function _x(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof e.port=="number"&&(e.port<0||e.port>65535))return"URI port is malformed."}function no(e){if(e===void 0)return!1;let t=e.indexOf("%");for(;t!==-1;){if(t+2>=e.length||!/^[\da-f]{2}$/iu.test(e.slice(t+1,t+3)))return!0;t=e.indexOf("%",t+3)}return!1}function Sa(e){return e[0]==="["&&e[e.length-1]==="]"}function yx(e){let t=e[4];return no(e[3])||t!==void 0&&!Sa(t)&&no(t)||no(e[6])||no(e[7])||no(e[8])}function nm(e,t,r,o){if(!t.unicodeSupport&&(!r||!r.unicodeSupport)&&e.host&&!Sa(e.host)&&(t.domainHost||r&&r.domainHost)&&o===!1&&lx(e.host))try{e.host=new URL("http://"+e.host).hostname}catch(n){return e.error=e.error||"Host's domain name can not be converted to ASCII: "+n,!0}return!1}function Cn(e,t){let r=Object.assign({},t),o={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},n=!1,s=!1,i=!1,a=!1,c=!1,l=!1,u=!1;r.reference==="suffix"&&(r.scheme?e=r.scheme+":"+e:e="//"+e);let d=e.match(hx);d!==null&&d[1].indexOf("\\")!==-1&&(o.error="URI authority must not contain a literal backslash.",n=!0);let m=e.match(gx);if(m!==null){let g=m[1],h=g.replace(/[\t\n\r]/g,"");h.length>=2&&(h.slice(0,2)!=="//"?(o.error=o.error||"URI authority must not contain a literal backslash.",n=!0):g.length!==h.length&&(o.error=o.error||"URI authority introducer must not contain whitespace.",n=!0))}let f=e.match(mx);if(f){if(o.scheme=f[1],o.userinfo=f[3],o.host=f[4],o.port=parseInt(f[5],10),o.path=f[6]||"",o.query=f[7],o.fragment=f[8],o.scheme!==void 0){let y=unescape(o.scheme);tm.test(y)?o.scheme=y.toLowerCase():(o.error=o.error||rm,l=!0)}s=yx(f),s&&(o.error=o.error||"URI contains malformed percent-encoding."),isNaN(o.port)&&(o.port=f[5]);let g=_x(o,f);if(g!==void 0&&(o.error=o.error||g,n=!0),o.host)if(Xf(o.host)===!1){let x=Sa(o.host),w=o.host.indexOf("[")!==-1||o.host.indexOf("]")!==-1,$=Yf(o.host);u=$.isIPV6||$.isIPVFuture===!0,c=w&&(!x||$.error===!0),o.host=u?$.host:$.host.toLowerCase(),c&&(o.error=o.error||"URI host is malformed.",n=!0)}else u=!0;o.scheme===void 0&&o.userinfo===void 0&&o.host===void 0&&o.port===void 0&&o.query===void 0&&!o.path?o.reference="same-document":o.scheme===void 0?o.reference="relative":o.fragment===void 0?o.reference="absolute":o.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==o.reference&&(o.error=o.error||"URI is not a "+r.reference+" reference.");let h=za(r.scheme||o.scheme);if(c||(a=nm(o,r,h,u)),e.indexOf("%")!==-1&&o.host!==void 0&&!c){let y=u?o.host:ba(o.host,!0);u||(y=ba(y.toLowerCase())),o.host=ux(y,u)}(!h||h&&!h.skipNormalize)&&(o.path&&(o.path=ix(o.path)),o.query&&(o.query=Gf(o.query)),o.fragment&&(o.fragment=Gf(o.fragment))),h&&h.parse&&(h.parse(o,r),h===em.urn&&o.nid===void 0&&(i=!0))}else o.error=o.error||"URI can not be parsed.";return{parsed:o,malformedAuthorityOrPort:n,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:l}}function An(e,t){return Cn(e,t).parsed}function vx(e,t){return sm(e,t).normalized}function sm(e,t){let{parsed:r,malformedAuthorityOrPort:o,malformedPercentEncoding:n,malformedSchemeSpecific:s,malformedHost:i,malformedScheme:a}=Cn(e,t);return{normalized:o||n||s||i||a?e:Zt(r,t),malformedAuthorityOrPort:o,malformedPercentEncoding:n,malformedSchemeSpecific:s,malformedHost:i,malformedScheme:a}}function Qf(e,t){if(typeof e!="string"&&typeof e!="object")return;let r;try{r=typeof e=="string"?e:Zt(e,t)}catch{return}let{normalized:o,malformedAuthorityOrPort:n,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:c}=sm(r,t);return n||s||i||a||c?void 0:o}var ka={SCHEMES:em,normalize:dx,resolve:px,resolveComponent:om,equal:fx,serialize:Zt,parse:An};Nn.exports=ka;Nn.exports.default=ka;Nn.exports.fastUri=ka});var cm=b(Pa=>{"use strict";Object.defineProperty(Pa,"__esModule",{value:!0});var am=im();am.code='require("ajv/dist/runtime/uri").default';Pa.default=am});var gm=b(me=>{"use strict";Object.defineProperty(me,"__esModule",{value:!0});me.CodeGen=me.Name=me.nil=me.stringify=me.str=me._=me.KeywordCxt=void 0;var $x=ro();Object.defineProperty(me,"KeywordCxt",{enumerable:!0,get:function(){return $x.KeywordCxt}});var pr=j();Object.defineProperty(me,"_",{enumerable:!0,get:function(){return pr._}});Object.defineProperty(me,"str",{enumerable:!0,get:function(){return pr.str}});Object.defineProperty(me,"stringify",{enumerable:!0,get:function(){return pr.stringify}});Object.defineProperty(me,"nil",{enumerable:!0,get:function(){return pr.nil}});Object.defineProperty(me,"Name",{enumerable:!0,get:function(){return pr.Name}});Object.defineProperty(me,"CodeGen",{enumerable:!0,get:function(){return pr.CodeGen}});var wx=En(),fm=oo(),xx=Gi(),io=Rn(),bx=j(),ao=Xr(),jn=Yr(),Ta=D(),um=Nf(),zx=cm(),mm=(e,t)=>new RegExp(e,t);mm.code="new RegExp";var Sx=["removeAdditional","useDefaults","coerceTypes"],kx=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),Px={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."},Ex={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},lm=200;function Tx(e){var t,r,o,n,s,i,a,c,l,u,d,m,f,g,h,y,x,w,$,P,v,z,C,re,ie;let ze=e.strict,br=(t=e.code)===null||t===void 0?void 0:t.optimize,Ao=br===!0||br===void 0?1:br||0,No=(o=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&o!==void 0?o:mm,ut=(n=e.uriResolver)!==null&&n!==void 0?n:zx.default;return{strictSchema:(i=(s=e.strictSchema)!==null&&s!==void 0?s:ze)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=e.strictNumbers)!==null&&a!==void 0?a:ze)!==null&&c!==void 0?c:!0,strictTypes:(u=(l=e.strictTypes)!==null&&l!==void 0?l:ze)!==null&&u!==void 0?u:"log",strictTuples:(m=(d=e.strictTuples)!==null&&d!==void 0?d:ze)!==null&&m!==void 0?m:"log",strictRequired:(g=(f=e.strictRequired)!==null&&f!==void 0?f:ze)!==null&&g!==void 0?g:!1,code:e.code?{...e.code,optimize:Ao,regExp:No}:{optimize:Ao,regExp:No},loopRequired:(h=e.loopRequired)!==null&&h!==void 0?h:lm,loopEnum:(y=e.loopEnum)!==null&&y!==void 0?y:lm,meta:(x=e.meta)!==null&&x!==void 0?x:!0,messages:(w=e.messages)!==null&&w!==void 0?w:!0,inlineRefs:($=e.inlineRefs)!==null&&$!==void 0?$:!0,schemaId:(P=e.schemaId)!==null&&P!==void 0?P:"$id",addUsedSchema:(v=e.addUsedSchema)!==null&&v!==void 0?v:!0,validateSchema:(z=e.validateSchema)!==null&&z!==void 0?z:!0,validateFormats:(C=e.validateFormats)!==null&&C!==void 0?C:!0,unicodeRegExp:(re=e.unicodeRegExp)!==null&&re!==void 0?re:!0,int32range:(ie=e.int32range)!==null&&ie!==void 0?ie:!0,uriResolver:ut}}var co=class{constructor(t={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...Tx(t)};let{es5:r,lines:o}=this.opts.code;this.scope=new bx.ValueScope({scope:{},prefixes:kx,es5:r,lines:o}),this.logger=Nx(t.logger);let n=t.validateFormats;t.validateFormats=!1,this.RULES=(0,xx.getRules)(),dm.call(this,Px,t,"NOT SUPPORTED"),dm.call(this,Ex,t,"DEPRECATED","warn"),this._metaOpts=Cx.call(this),t.formats&&Ix.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&Ox.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),Rx.call(this),t.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:o}=this.opts,n=um;o==="id"&&(n={...um},n.id=n.$id,delete n.$id),r&&t&&this.addMetaSchema(n,n[o],!1)}defaultMeta(){let{meta:t,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof t=="object"?t[r]||t:void 0}validate(t,r){let o;if(typeof t=="string"){if(o=this.getSchema(t),!o)throw new Error(`no schema with key or ref "${t}"`)}else o=this.compile(t);let n=o(r);return"$async"in o||(this.errors=o.errors),n}compile(t,r){let o=this._addSchema(t,r);return o.validate||this._compileSchemaEnv(o)}compileAsync(t,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:o}=this.opts;return n.call(this,t,r);async function n(u,d){await s.call(this,u.$schema);let m=this._addSchema(u,d);return m.validate||i.call(this,m)}async function s(u){u&&!this.getSchema(u)&&await n.call(this,{$ref:u},!0)}async function i(u){try{return this._compileSchemaEnv(u)}catch(d){if(!(d instanceof fm.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),i.call(this,u)}}function a({missingSchema:u,missingRef:d}){if(this.refs[u])throw new Error(`AnySchema ${u} is loaded but ${d} cannot be resolved`)}async function c(u){let d=await l.call(this,u);this.refs[u]||await s.call(this,d.$schema),this.refs[u]||this.addSchema(d,u,r)}async function l(u){let d=this._loading[u];if(d)return d;try{return await(this._loading[u]=o(u))}finally{delete this._loading[u]}}}addSchema(t,r,o,n=this.opts.validateSchema){if(Array.isArray(t)){for(let i of t)this.addSchema(i,void 0,o,n);return this}let s;if(typeof t=="object"){let{schemaId:i}=this.opts;if(s=t[i],s!==void 0&&typeof s!="string")throw new Error(`schema ${i} must be string`)}return r=(0,ao.normalizeId)(r||s),this._checkUnique(r),this.schemas[r]=this._addSchema(t,o,r,n,!0),this}addMetaSchema(t,r,o=this.opts.validateSchema){return this.addSchema(t,r,!0,o),this}validateSchema(t,r){if(typeof t=="boolean")return!0;let o;if(o=t.$schema,o!==void 0&&typeof o!="string")throw new Error("$schema must be a string");if(o=o||this.opts.defaultMeta||this.defaultMeta(),!o)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let n=this.validate(o,t);if(!n&&r){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw new Error(s)}return n}getSchema(t){let r;for(;typeof(r=pm.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:o}=this.opts,n=new io.SchemaEnv({schema:{},schemaId:o});if(r=io.resolveSchema.call(this,n,t),!r)return;this.refs[t]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(t){if(t instanceof RegExp)return this._removeAllSchemas(this.schemas,t),this._removeAllSchemas(this.refs,t),this;switch(typeof t){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=pm.call(this,t);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[t],delete this.refs[t],this}case"object":{let r=t;this._cache.delete(r);let o=t[this.opts.schemaId];return o&&(o=(0,ao.normalizeId)(o),delete this.schemas[o],delete this.refs[o]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(t){for(let r of t)this.addKeyword(r);return this}addKeyword(t,r){let o;if(typeof t=="string")o=t,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=o);else if(typeof t=="object"&&r===void 0){if(r=t,o=r.keyword,Array.isArray(o)&&!o.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(Zx.call(this,o,r),!r)return(0,Ta.eachItem)(o,s=>Ea.call(this,s)),this;Mx.call(this,r);let n={...r,type:(0,jn.getJSONTypes)(r.type),schemaType:(0,jn.getJSONTypes)(r.schemaType)};return(0,Ta.eachItem)(o,n.type.length===0?s=>Ea.call(this,s,n):s=>n.type.forEach(i=>Ea.call(this,s,n,i))),this}getKeyword(t){let r=this.RULES.all[t];return typeof r=="object"?r.definition:!!r}removeKeyword(t){let{RULES:r}=this;delete r.keywords[t],delete r.all[t];for(let o of r.rules){let n=o.rules.findIndex(s=>s.keyword===t);n>=0&&o.rules.splice(n,1)}return this}addFormat(t,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[t]=r,this}errorsText(t=this.errors,{separator:r=", ",dataVar:o="data"}={}){return!t||t.length===0?"No errors":t.map(n=>`${o}${n.instancePath} ${n.message}`).reduce((n,s)=>n+r+s)}$dataMetaSchema(t,r){let o=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(let n of r){let s=n.split("/").slice(1),i=t;for(let a of s)i=i[a];for(let a in o){let c=o[a];if(typeof c!="object")continue;let{$data:l}=c.definition,u=i[a];l&&u&&(i[a]=hm(u))}}return t}_removeAllSchemas(t,r){for(let o in t){let n=t[o];(!r||r.test(o))&&(typeof n=="string"?delete t[o]:n&&!n.meta&&(this._cache.delete(n.schema),delete t[o]))}}_addSchema(t,r,o,n=this.opts.validateSchema,s=this.opts.addUsedSchema){let i,{schemaId:a}=this.opts;if(typeof t=="object")i=t[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof t!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(t);if(c!==void 0)return c;o=(0,ao.normalizeId)(i||o);let l=ao.getSchemaRefs.call(this,t,o);return c=new io.SchemaEnv({schema:t,schemaId:a,meta:r,baseId:o,localRefs:l}),this._cache.set(c.schema,c),s&&!o.startsWith("#")&&(o&&this._checkUnique(o),this.refs[o]=c),n&&this.validateSchema(t,!0),c}_checkUnique(t){if(this.schemas[t]||this.refs[t])throw new Error(`schema with key or id "${t}" already exists`)}_compileSchemaEnv(t){if(t.meta?this._compileMetaSchema(t):io.compileSchema.call(this,t),!t.validate)throw new Error("ajv implementation error");return t.validate}_compileMetaSchema(t){let r=this.opts;this.opts=this._metaOpts;try{io.compileSchema.call(this,t)}finally{this.opts=r}}};co.ValidationError=wx.default;co.MissingRefError=fm.default;me.default=co;function dm(e,t,r,o="error"){for(let n in e){let s=n;s in t&&this.logger[o](`${r}: option ${n}. ${e[s]}`)}}function pm(e){return e=(0,ao.normalizeId)(e),this.schemas[e]||this.refs[e]}function Rx(){let e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function Ix(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function Ox(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}function Cx(){let e={...this.opts};for(let t of Sx)delete e[t];return e}var Ax={log(){},warn(){},error(){}};function Nx(e){if(e===!1)return Ax;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}var jx=/^[a-z_$][a-z0-9_$:-]*$/i;function Zx(e,t){let{RULES:r}=this;if((0,Ta.eachItem)(e,o=>{if(r.keywords[o])throw new Error(`Keyword ${o} is already defined`);if(!jx.test(o))throw new Error(`Keyword ${o} has invalid name`)}),!!t&&t.$data&&!("code"in t||"validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function Ea(e,t,r){var o;let n=t?.post;if(r&&n)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,i=n?s.post:s.rules.find(({type:c})=>c===r);if(i||(i={type:r,rules:[]},s.rules.push(i)),s.keywords[e]=!0,!t)return;let a={keyword:e,definition:{...t,type:(0,jn.getJSONTypes)(t.type),schemaType:(0,jn.getJSONTypes)(t.schemaType)}};t.before?qx.call(this,i,a,t.before):i.rules.push(a),s.all[e]=a,(o=t.implements)===null||o===void 0||o.forEach(c=>this.addKeyword(c))}function qx(e,t,r){let o=e.rules.findIndex(n=>n.keyword===r);o>=0?e.rules.splice(o,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function Mx(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=hm(t)),e.validateSchema=this.compile(t,!0))}var Dx={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function hm(e){return{anyOf:[e,Dx]}}});var _m=b(Ra=>{"use strict";Object.defineProperty(Ra,"__esModule",{value:!0});var Ux={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Ra.default=Ux});var wm=b(qt=>{"use strict";Object.defineProperty(qt,"__esModule",{value:!0});qt.callRef=qt.getValidate=void 0;var Lx=oo(),ym=je(),Re=j(),fr=st(),vm=Rn(),Zn=D(),Fx={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:o}=e,{baseId:n,schemaEnv:s,validateName:i,opts:a,self:c}=o,{root:l}=s;if((r==="#"||r==="#/")&&n===l.baseId)return d();let u=vm.resolveRef.call(c,l,n,r);if(u===void 0)throw new Lx.default(o.opts.uriResolver,n,r);if(u instanceof vm.SchemaEnv)return m(u);return f(u);function d(){if(s===l)return qn(e,i,s,s.$async);let g=t.scopeValue("root",{ref:l});return qn(e,(0,Re._)`${g}.validate`,l,l.$async)}function m(g){let h=$m(e,g);qn(e,h,g,g.$async)}function f(g){let h=t.scopeValue("schema",a.code.source===!0?{ref:g,code:(0,Re.stringify)(g)}:{ref:g}),y=t.name("valid"),x=e.subschema({schema:g,dataTypes:[],schemaPath:Re.nil,topSchemaRef:h,errSchemaPath:r},y);e.mergeEvaluated(x),e.ok(y)}}};function $m(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,Re._)`${r.scopeValue("wrapper",{ref:t})}.validate`}qt.getValidate=$m;function qn(e,t,r,o){let{gen:n,it:s}=e,{allErrors:i,schemaEnv:a,opts:c}=s,l=c.passContext?fr.default.this:Re.nil;o?u():d();function u(){if(!a.$async)throw new Error("async schema referenced by sync schema");let g=n.let("valid");n.try(()=>{n.code((0,Re._)`await ${(0,ym.callValidateCode)(e,t,l)}`),f(t),i||n.assign(g,!0)},h=>{n.if((0,Re._)`!(${h} instanceof ${s.ValidationError})`,()=>n.throw(h)),m(h),i||n.assign(g,!1)}),e.ok(g)}function d(){e.result((0,ym.callValidateCode)(e,t,l),()=>f(t),()=>m(t))}function m(g){let h=(0,Re._)`${g}.errors`;n.assign(fr.default.vErrors,(0,Re._)`${fr.default.vErrors} === null ? ${h} : ${fr.default.vErrors}.concat(${h})`),n.assign(fr.default.errors,(0,Re._)`${fr.default.vErrors}.length`)}function f(g){var h;if(!s.opts.unevaluated)return;let y=(h=r?.validate)===null||h===void 0?void 0:h.evaluated;if(s.props!==!0)if(y&&!y.dynamicProps)y.props!==void 0&&(s.props=Zn.mergeEvaluated.props(n,y.props,s.props));else{let x=n.var("props",(0,Re._)`${g}.evaluated.props`);s.props=Zn.mergeEvaluated.props(n,x,s.props,Re.Name)}if(s.items!==!0)if(y&&!y.dynamicItems)y.items!==void 0&&(s.items=Zn.mergeEvaluated.items(n,y.items,s.items));else{let x=n.var("items",(0,Re._)`${g}.evaluated.items`);s.items=Zn.mergeEvaluated.items(n,x,s.items,Re.Name)}}}qt.callRef=qn;qt.default=Fx});var xm=b(Ia=>{"use strict";Object.defineProperty(Ia,"__esModule",{value:!0});var Vx=_m(),Hx=wm(),Bx=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Vx.default,Hx.default];Ia.default=Bx});var bm=b(Oa=>{"use strict";Object.defineProperty(Oa,"__esModule",{value:!0});var Mn=j(),$t=Mn.operators,Dn={maximum:{okStr:"<=",ok:$t.LTE,fail:$t.GT},minimum:{okStr:">=",ok:$t.GTE,fail:$t.LT},exclusiveMaximum:{okStr:"<",ok:$t.LT,fail:$t.GTE},exclusiveMinimum:{okStr:">",ok:$t.GT,fail:$t.LTE}},Kx={message:({keyword:e,schemaCode:t})=>(0,Mn.str)`must be ${Dn[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,Mn._)`{comparison: ${Dn[e].okStr}, limit: ${t}}`},Wx={keyword:Object.keys(Dn),type:"number",schemaType:"number",$data:!0,error:Kx,code(e){let{keyword:t,data:r,schemaCode:o}=e;e.fail$data((0,Mn._)`${r} ${Dn[t].fail} ${o} || isNaN(${r})`)}};Oa.default=Wx});var zm=b(Ca=>{"use strict";Object.defineProperty(Ca,"__esModule",{value:!0});var uo=j(),Gx={message:({schemaCode:e})=>(0,uo.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,uo._)`{multipleOf: ${e}}`},Jx={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:Gx,code(e){let{gen:t,data:r,schemaCode:o,it:n}=e,s=n.opts.multipleOfPrecision,i=t.let("res"),a=s?(0,uo._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:(0,uo._)`${i} !== parseInt(${i})`;e.fail$data((0,uo._)`(${o} === 0 || (${i} = ${r}/${o}, ${a}))`)}};Ca.default=Jx});var km=b(Aa=>{"use strict";Object.defineProperty(Aa,"__esModule",{value:!0});function Sm(e){let t=e.length,r=0,o=0,n;for(;o<t;)r++,n=e.charCodeAt(o++),n>=55296&&n<=56319&&o<t&&(n=e.charCodeAt(o),(n&64512)===56320&&o++);return r}Aa.default=Sm;Sm.code='require("ajv/dist/runtime/ucs2length").default'});var Pm=b(Na=>{"use strict";Object.defineProperty(Na,"__esModule",{value:!0});var Mt=j(),Qx=D(),Yx=km(),Xx={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return(0,Mt.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,Mt._)`{limit: ${e}}`},eb={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:Xx,code(e){let{keyword:t,data:r,schemaCode:o,it:n}=e,s=t==="maxLength"?Mt.operators.GT:Mt.operators.LT,i=n.opts.unicode===!1?(0,Mt._)`${r}.length`:(0,Mt._)`${(0,Qx.useFunc)(e.gen,Yx.default)}(${r})`;e.fail$data((0,Mt._)`${i} ${s} ${o}`)}};Na.default=eb});var Em=b(ja=>{"use strict";Object.defineProperty(ja,"__esModule",{value:!0});var tb=je(),rb=D(),mr=j(),ob={message:({schemaCode:e})=>(0,mr.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,mr._)`{pattern: ${e}}`},nb={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:ob,code(e){let{gen:t,data:r,$data:o,schema:n,schemaCode:s,it:i}=e,a=i.opts.unicodeRegExp?"u":"";if(o){let{regExp:c}=i.opts.code,l=c.code==="new RegExp"?(0,mr._)`new RegExp`:(0,rb.useFunc)(t,c),u=t.let("valid");t.try(()=>t.assign(u,(0,mr._)`${l}(${s}, ${a}).test(${r})`),()=>t.assign(u,!1)),e.fail$data((0,mr._)`!${u}`)}else{let c=(0,tb.usePattern)(e,n);e.fail$data((0,mr._)`!${c}.test(${r})`)}}};ja.default=nb});var Tm=b(Za=>{"use strict";Object.defineProperty(Za,"__esModule",{value:!0});var lo=j(),sb={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return(0,lo.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,lo._)`{limit: ${e}}`},ib={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:sb,code(e){let{keyword:t,data:r,schemaCode:o}=e,n=t==="maxProperties"?lo.operators.GT:lo.operators.LT;e.fail$data((0,lo._)`Object.keys(${r}).length ${n} ${o}`)}};Za.default=ib});var Rm=b(qa=>{"use strict";Object.defineProperty(qa,"__esModule",{value:!0});var po=je(),fo=j(),ab=D(),cb={message:({params:{missingProperty:e}})=>(0,fo.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,fo._)`{missingProperty: ${e}}`},ub={keyword:"required",type:"object",schemaType:"array",$data:!0,error:cb,code(e){let{gen:t,schema:r,schemaCode:o,data:n,$data:s,it:i}=e,{opts:a}=i;if(!s&&r.length===0)return;let c=r.length>=a.loopRequired;if(i.allErrors?l():u(),a.strictRequired){let f=e.parentSchema.properties,{definedProperties:g}=e.it;for(let h of r)if(f?.[h]===void 0&&!g.has(h)){let y=i.schemaEnv.baseId+i.errSchemaPath,x=`required property "${h}" is not defined at "${y}" (strictRequired)`;(0,ab.checkStrictMode)(i,x,i.opts.strictRequired)}}function l(){if(c||s)e.block$data(fo.nil,d);else for(let f of r)(0,po.checkReportMissingProp)(e,f)}function u(){let f=t.let("missing");if(c||s){let g=t.let("valid",!0);e.block$data(g,()=>m(f,g)),e.ok(g)}else t.if((0,po.checkMissingProp)(e,r,f)),(0,po.reportMissingProp)(e,f),t.else()}function d(){t.forOf("prop",o,f=>{e.setParams({missingProperty:f}),t.if((0,po.noPropertyInData)(t,n,f,a.ownProperties),()=>e.error())})}function m(f,g){e.setParams({missingProperty:f}),t.forOf(f,o,()=>{t.assign(g,(0,po.propertyInData)(t,n,f,a.ownProperties)),t.if((0,fo.not)(g),()=>{e.error(),t.break()})},fo.nil)}}};qa.default=ub});var Im=b(Ma=>{"use strict";Object.defineProperty(Ma,"__esModule",{value:!0});var mo=j(),lb={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return(0,mo.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,mo._)`{limit: ${e}}`},db={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:lb,code(e){let{keyword:t,data:r,schemaCode:o}=e,n=t==="maxItems"?mo.operators.GT:mo.operators.LT;e.fail$data((0,mo._)`${r}.length ${n} ${o}`)}};Ma.default=db});var Un=b(Da=>{"use strict";Object.defineProperty(Da,"__esModule",{value:!0});var Om=oa();Om.code='require("ajv/dist/runtime/equal").default';Da.default=Om});var Cm=b(La=>{"use strict";Object.defineProperty(La,"__esModule",{value:!0});var Ua=Yr(),he=j(),pb=D(),fb=Un(),mb={message:({params:{i:e,j:t}})=>(0,he.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,he._)`{i: ${e}, j: ${t}}`},hb={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:mb,code(e){let{gen:t,data:r,$data:o,schema:n,parentSchema:s,schemaCode:i,it:a}=e;if(!o&&!n)return;let c=t.let("valid"),l=s.items?(0,Ua.getSchemaTypes)(s.items):[];e.block$data(c,u,(0,he._)`${i} === false`),e.ok(c);function u(){let g=t.let("i",(0,he._)`${r}.length`),h=t.let("j");e.setParams({i:g,j:h}),t.assign(c,!0),t.if((0,he._)`${g} > 1`,()=>(d()?m:f)(g,h))}function d(){return l.length>0&&!l.some(g=>g==="object"||g==="array")}function m(g,h){let y=t.name("item"),x=(0,Ua.checkDataTypes)(l,y,a.opts.strictNumbers,Ua.DataType.Wrong),w=t.const("indices",(0,he._)`{}`);t.for((0,he._)`;${g}--;`,()=>{t.let(y,(0,he._)`${r}[${g}]`),t.if(x,(0,he._)`continue`),l.length>1&&t.if((0,he._)`typeof ${y} == "string"`,(0,he._)`${y} += "_"`),t.if((0,he._)`typeof ${w}[${y}] == "number"`,()=>{t.assign(h,(0,he._)`${w}[${y}]`),e.error(),t.assign(c,!1).break()}).code((0,he._)`${w}[${y}] = ${g}`)})}function f(g,h){let y=(0,pb.useFunc)(t,fb.default),x=t.name("outer");t.label(x).for((0,he._)`;${g}--;`,()=>t.for((0,he._)`${h} = ${g}; ${h}--;`,()=>t.if((0,he._)`${y}(${r}[${g}], ${r}[${h}])`,()=>{e.error(),t.assign(c,!1).break(x)})))}}};La.default=hb});var Am=b(Va=>{"use strict";Object.defineProperty(Va,"__esModule",{value:!0});var Fa=j(),gb=D(),_b=Un(),yb={message:"must be equal to constant",params:({schemaCode:e})=>(0,Fa._)`{allowedValue: ${e}}`},vb={keyword:"const",$data:!0,error:yb,code(e){let{gen:t,data:r,$data:o,schemaCode:n,schema:s}=e;o||s&&typeof s=="object"?e.fail$data((0,Fa._)`!${(0,gb.useFunc)(t,_b.default)}(${r}, ${n})`):e.fail((0,Fa._)`${s} !== ${r}`)}};Va.default=vb});var Nm=b(Ha=>{"use strict";Object.defineProperty(Ha,"__esModule",{value:!0});var ho=j(),$b=D(),wb=Un(),xb={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,ho._)`{allowedValues: ${e}}`},bb={keyword:"enum",schemaType:"array",$data:!0,error:xb,code(e){let{gen:t,data:r,$data:o,schema:n,schemaCode:s,it:i}=e;if(!o&&n.length===0)throw new Error("enum must have non-empty array");let a=n.length>=i.opts.loopEnum,c,l=()=>c??(c=(0,$b.useFunc)(t,wb.default)),u;if(a||o)u=t.let("valid"),e.block$data(u,d);else{if(!Array.isArray(n))throw new Error("ajv implementation error");let f=t.const("vSchema",s);u=(0,ho.or)(...n.map((g,h)=>m(f,h)))}e.pass(u);function d(){t.assign(u,!1),t.forOf("v",s,f=>t.if((0,ho._)`${l()}(${r}, ${f})`,()=>t.assign(u,!0).break()))}function m(f,g){let h=n[g];return typeof h=="object"&&h!==null?(0,ho._)`${l()}(${r}, ${f}[${g}])`:(0,ho._)`${r} === ${h}`}}};Ha.default=bb});var jm=b(Ba=>{"use strict";Object.defineProperty(Ba,"__esModule",{value:!0});var zb=bm(),Sb=zm(),kb=Pm(),Pb=Em(),Eb=Tm(),Tb=Rm(),Rb=Im(),Ib=Cm(),Ob=Am(),Cb=Nm(),Ab=[zb.default,Sb.default,kb.default,Pb.default,Eb.default,Tb.default,Rb.default,Ib.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Ob.default,Cb.default];Ba.default=Ab});var Wa=b(go=>{"use strict";Object.defineProperty(go,"__esModule",{value:!0});go.validateAdditionalItems=void 0;var Dt=j(),Ka=D(),Nb={message:({params:{len:e}})=>(0,Dt.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,Dt._)`{limit: ${e}}`},jb={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Nb,code(e){let{parentSchema:t,it:r}=e,{items:o}=t;if(!Array.isArray(o)){(0,Ka.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}Zm(e,o)}};function Zm(e,t){let{gen:r,schema:o,data:n,keyword:s,it:i}=e;i.items=!0;let a=r.const("len",(0,Dt._)`${n}.length`);if(o===!1)e.setParams({len:t.length}),e.pass((0,Dt._)`${a} <= ${t.length}`);else if(typeof o=="object"&&!(0,Ka.alwaysValidSchema)(i,o)){let l=r.var("valid",(0,Dt._)`${a} <= ${t.length}`);r.if((0,Dt.not)(l),()=>c(l)),e.ok(l)}function c(l){r.forRange("i",t.length,a,u=>{e.subschema({keyword:s,dataProp:u,dataPropType:Ka.Type.Num},l),i.allErrors||r.if((0,Dt.not)(l),()=>r.break())})}}go.validateAdditionalItems=Zm;go.default=jb});var Ga=b(_o=>{"use strict";Object.defineProperty(_o,"__esModule",{value:!0});_o.validateTuple=void 0;var qm=j(),Ln=D(),Zb=je(),qb={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return Mm(e,"additionalItems",t);r.items=!0,!(0,Ln.alwaysValidSchema)(r,t)&&e.ok((0,Zb.validateArray)(e))}};function Mm(e,t,r=e.schema){let{gen:o,parentSchema:n,data:s,keyword:i,it:a}=e;u(n),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=Ln.mergeEvaluated.items(o,r.length,a.items));let c=o.name("valid"),l=o.const("len",(0,qm._)`${s}.length`);r.forEach((d,m)=>{(0,Ln.alwaysValidSchema)(a,d)||(o.if((0,qm._)`${l} > ${m}`,()=>e.subschema({keyword:i,schemaProp:m,dataProp:m},c)),e.ok(c))});function u(d){let{opts:m,errSchemaPath:f}=a,g=r.length,h=g===d.minItems&&(g===d.maxItems||d[t]===!1);if(m.strictTuples&&!h){let y=`"${i}" is ${g}-tuple, but minItems or maxItems/${t} are not specified or different at path "${f}"`;(0,Ln.checkStrictMode)(a,y,m.strictTuples)}}}_o.validateTuple=Mm;_o.default=qb});var Dm=b(Ja=>{"use strict";Object.defineProperty(Ja,"__esModule",{value:!0});var Mb=Ga(),Db={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,Mb.validateTuple)(e,"items")};Ja.default=Db});var Lm=b(Qa=>{"use strict";Object.defineProperty(Qa,"__esModule",{value:!0});var Um=j(),Ub=D(),Lb=je(),Fb=Wa(),Vb={message:({params:{len:e}})=>(0,Um.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,Um._)`{limit: ${e}}`},Hb={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:Vb,code(e){let{schema:t,parentSchema:r,it:o}=e,{prefixItems:n}=r;o.items=!0,!(0,Ub.alwaysValidSchema)(o,t)&&(n?(0,Fb.validateAdditionalItems)(e,n):e.ok((0,Lb.validateArray)(e)))}};Qa.default=Hb});var Fm=b(Ya=>{"use strict";Object.defineProperty(Ya,"__esModule",{value:!0});var qe=j(),Fn=D(),Bb={message:({params:{min:e,max:t}})=>t===void 0?(0,qe.str)`must contain at least ${e} valid item(s)`:(0,qe.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,qe._)`{minContains: ${e}}`:(0,qe._)`{minContains: ${e}, maxContains: ${t}}`},Kb={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:Bb,code(e){let{gen:t,schema:r,parentSchema:o,data:n,it:s}=e,i,a,{minContains:c,maxContains:l}=o;s.opts.next?(i=c===void 0?1:c,a=l):i=1;let u=t.const("len",(0,qe._)`${n}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){(0,Fn.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,Fn.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,Fn.alwaysValidSchema)(s,r)){let h=(0,qe._)`${u} >= ${i}`;a!==void 0&&(h=(0,qe._)`${h} && ${u} <= ${a}`),e.pass(h);return}s.items=!0;let d=t.name("valid");a===void 0&&i===1?f(d,()=>t.if(d,()=>t.break())):i===0?(t.let(d,!0),a!==void 0&&t.if((0,qe._)`${n}.length > 0`,m)):(t.let(d,!1),m()),e.result(d,()=>e.reset());function m(){let h=t.name("_valid"),y=t.let("count",0);f(h,()=>t.if(h,()=>g(y)))}function f(h,y){t.forRange("i",0,u,x=>{e.subschema({keyword:"contains",dataProp:x,dataPropType:Fn.Type.Num,compositeRule:!0},h),y()})}function g(h){t.code((0,qe._)`${h}++`),a===void 0?t.if((0,qe._)`${h} >= ${i}`,()=>t.assign(d,!0).break()):(t.if((0,qe._)`${h} > ${a}`,()=>t.assign(d,!1).break()),i===1?t.assign(d,!0):t.if((0,qe._)`${h} >= ${i}`,()=>t.assign(d,!0)))}}};Ya.default=Kb});var Bm=b(Qe=>{"use strict";Object.defineProperty(Qe,"__esModule",{value:!0});Qe.validateSchemaDeps=Qe.validatePropertyDeps=Qe.error=void 0;var Xa=j(),Wb=D(),yo=je();Qe.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let o=t===1?"property":"properties";return(0,Xa.str)`must have ${o} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:o}})=>(0,Xa._)`{property: ${e},
|
|
7
|
+
missingProperty: ${o},
|
|
8
|
+
depsCount: ${t},
|
|
9
|
+
deps: ${r}}`};var Gb={keyword:"dependencies",type:"object",schemaType:"object",error:Qe.error,code(e){let[t,r]=Jb(e);Vm(e,t),Hm(e,r)}};function Jb({schema:e}){let t={},r={};for(let o in e){if(o==="__proto__")continue;let n=Array.isArray(e[o])?t:r;n[o]=e[o]}return[t,r]}function Vm(e,t=e.schema){let{gen:r,data:o,it:n}=e;if(Object.keys(t).length===0)return;let s=r.let("missing");for(let i in t){let a=t[i];if(a.length===0)continue;let c=(0,yo.propertyInData)(r,o,i,n.opts.ownProperties);e.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),n.allErrors?r.if(c,()=>{for(let l of a)(0,yo.checkReportMissingProp)(e,l)}):(r.if((0,Xa._)`${c} && (${(0,yo.checkMissingProp)(e,a,s)})`),(0,yo.reportMissingProp)(e,s),r.else())}}Qe.validatePropertyDeps=Vm;function Hm(e,t=e.schema){let{gen:r,data:o,keyword:n,it:s}=e,i=r.name("valid");for(let a in t)(0,Wb.alwaysValidSchema)(s,t[a])||(r.if((0,yo.propertyInData)(r,o,a,s.opts.ownProperties),()=>{let c=e.subschema({keyword:n,schemaProp:a},i);e.mergeValidEvaluated(c,i)},()=>r.var(i,!0)),e.ok(i))}Qe.validateSchemaDeps=Hm;Qe.default=Gb});var Wm=b(ec=>{"use strict";Object.defineProperty(ec,"__esModule",{value:!0});var Km=j(),Qb=D(),Yb={message:"property name must be valid",params:({params:e})=>(0,Km._)`{propertyName: ${e.propertyName}}`},Xb={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Yb,code(e){let{gen:t,schema:r,data:o,it:n}=e;if((0,Qb.alwaysValidSchema)(n,r))return;let s=t.name("valid");t.forIn("key",o,i=>{e.setParams({propertyName:i}),e.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},s),t.if((0,Km.not)(s),()=>{e.error(!0),n.allErrors||t.break()})}),e.ok(s)}};ec.default=Xb});var rc=b(tc=>{"use strict";Object.defineProperty(tc,"__esModule",{value:!0});var Vn=je(),Be=j(),ez=st(),Hn=D(),tz={message:"must NOT have additional properties",params:({params:e})=>(0,Be._)`{additionalProperty: ${e.additionalProperty}}`},rz={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:tz,code(e){let{gen:t,schema:r,parentSchema:o,data:n,errsCount:s,it:i}=e;if(!s)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&(0,Hn.alwaysValidSchema)(i,r))return;let l=(0,Vn.allSchemaProperties)(o.properties),u=(0,Vn.allSchemaProperties)(o.patternProperties);d(),e.ok((0,Be._)`${s} === ${ez.default.errors}`);function d(){t.forIn("key",n,y=>{!l.length&&!u.length?g(y):t.if(m(y),()=>g(y))})}function m(y){let x;if(l.length>8){let w=(0,Hn.schemaRefOrVal)(i,o.properties,"properties");x=(0,Vn.isOwnProperty)(t,w,y)}else l.length?x=(0,Be.or)(...l.map(w=>(0,Be._)`${y} === ${w}`)):x=Be.nil;return u.length&&(x=(0,Be.or)(x,...u.map(w=>(0,Be._)`${(0,Vn.usePattern)(e,w)}.test(${y})`))),(0,Be.not)(x)}function f(y){t.code((0,Be._)`delete ${n}[${y}]`)}function g(y){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){f(y);return}if(r===!1){e.setParams({additionalProperty:y}),e.error(),a||t.break();return}if(typeof r=="object"&&!(0,Hn.alwaysValidSchema)(i,r)){let x=t.name("valid");c.removeAdditional==="failing"?(h(y,x,!1),t.if((0,Be.not)(x),()=>{e.reset(),f(y)})):(h(y,x),a||t.if((0,Be.not)(x),()=>t.break()))}}function h(y,x,w){let $={keyword:"additionalProperties",dataProp:y,dataPropType:Hn.Type.Str};w===!1&&Object.assign($,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema($,x)}}};tc.default=rz});var Qm=b(nc=>{"use strict";Object.defineProperty(nc,"__esModule",{value:!0});var oz=ro(),Gm=je(),oc=D(),Jm=rc(),nz={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:o,data:n,it:s}=e;s.opts.removeAdditional==="all"&&o.additionalProperties===void 0&&Jm.default.code(new oz.KeywordCxt(s,Jm.default,"additionalProperties"));let i=(0,Gm.allSchemaProperties)(r);for(let d of i)s.definedProperties.add(d);s.opts.unevaluated&&i.length&&s.props!==!0&&(s.props=oc.mergeEvaluated.props(t,(0,oc.toHash)(i),s.props));let a=i.filter(d=>!(0,oc.alwaysValidSchema)(s,r[d]));if(a.length===0)return;let c=t.name("valid");for(let d of a)l(d)?u(d):(t.if((0,Gm.propertyInData)(t,n,d,s.opts.ownProperties)),u(d),s.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(d),e.ok(c);function l(d){return s.opts.useDefaults&&!s.compositeRule&&r[d].default!==void 0}function u(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};nc.default=nz});var th=b(sc=>{"use strict";Object.defineProperty(sc,"__esModule",{value:!0});var Ym=je(),Bn=j(),Xm=D(),eh=D(),sz={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:o,parentSchema:n,it:s}=e,{opts:i}=s,a=(0,Ym.allSchemaProperties)(r),c=a.filter(h=>(0,Xm.alwaysValidSchema)(s,r[h]));if(a.length===0||c.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let l=i.strictSchema&&!i.allowMatchingProperties&&n.properties,u=t.name("valid");s.props!==!0&&!(s.props instanceof Bn.Name)&&(s.props=(0,eh.evaluatedPropsToName)(t,s.props));let{props:d}=s;m();function m(){for(let h of a)l&&f(h),s.allErrors?g(h):(t.var(u,!0),g(h),t.if(u))}function f(h){for(let y in l)new RegExp(h).test(y)&&(0,Xm.checkStrictMode)(s,`property ${y} matches pattern ${h} (use allowMatchingProperties)`)}function g(h){t.forIn("key",o,y=>{t.if((0,Bn._)`${(0,Ym.usePattern)(e,h)}.test(${y})`,()=>{let x=c.includes(h);x||e.subschema({keyword:"patternProperties",schemaProp:h,dataProp:y,dataPropType:eh.Type.Str},u),s.opts.unevaluated&&d!==!0?t.assign((0,Bn._)`${d}[${y}]`,!0):!x&&!s.allErrors&&t.if((0,Bn.not)(u),()=>t.break())})})}}};sc.default=sz});var rh=b(ic=>{"use strict";Object.defineProperty(ic,"__esModule",{value:!0});var iz=D(),az={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:o}=e;if((0,iz.alwaysValidSchema)(o,r)){e.fail();return}let n=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),e.failResult(n,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};ic.default=az});var oh=b(ac=>{"use strict";Object.defineProperty(ac,"__esModule",{value:!0});var cz=je(),uz={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:cz.validateUnion,error:{message:"must match a schema in anyOf"}};ac.default=uz});var nh=b(cc=>{"use strict";Object.defineProperty(cc,"__esModule",{value:!0});var Kn=j(),lz=D(),dz={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,Kn._)`{passingSchemas: ${e.passing}}`},pz={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:dz,code(e){let{gen:t,schema:r,parentSchema:o,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(n.opts.discriminator&&o.discriminator)return;let s=r,i=t.let("valid",!1),a=t.let("passing",null),c=t.name("_valid");e.setParams({passing:a}),t.block(l),e.result(i,()=>e.reset(),()=>e.error(!0));function l(){s.forEach((u,d)=>{let m;(0,lz.alwaysValidSchema)(n,u)?t.var(c,!0):m=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&t.if((0,Kn._)`${c} && ${i}`).assign(i,!1).assign(a,(0,Kn._)`[${a}, ${d}]`).else(),t.if(c,()=>{t.assign(i,!0),t.assign(a,d),m&&e.mergeEvaluated(m,Kn.Name)})})}}};cc.default=pz});var sh=b(uc=>{"use strict";Object.defineProperty(uc,"__esModule",{value:!0});var fz=D(),mz={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");let n=t.name("valid");r.forEach((s,i)=>{if((0,fz.alwaysValidSchema)(o,s))return;let a=e.subschema({keyword:"allOf",schemaProp:i},n);e.ok(n),e.mergeEvaluated(a)})}};uc.default=mz});var ch=b(lc=>{"use strict";Object.defineProperty(lc,"__esModule",{value:!0});var Wn=j(),ah=D(),hz={message:({params:e})=>(0,Wn.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,Wn._)`{failingKeyword: ${e.ifClause}}`},gz={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:hz,code(e){let{gen:t,parentSchema:r,it:o}=e;r.then===void 0&&r.else===void 0&&(0,ah.checkStrictMode)(o,'"if" without "then" and "else" is ignored');let n=ih(o,"then"),s=ih(o,"else");if(!n&&!s)return;let i=t.let("valid",!0),a=t.name("_valid");if(c(),e.reset(),n&&s){let u=t.let("ifClause");e.setParams({ifClause:u}),t.if(a,l("then",u),l("else",u))}else n?t.if(a,l("then")):t.if((0,Wn.not)(a),l("else"));e.pass(i,()=>e.error(!0));function c(){let u=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(u)}function l(u,d){return()=>{let m=e.subschema({keyword:u},a);t.assign(i,a),e.mergeValidEvaluated(m,i),d?t.assign(d,(0,Wn._)`${u}`):e.setParams({ifClause:u})}}}};function ih(e,t){let r=e.schema[t];return r!==void 0&&!(0,ah.alwaysValidSchema)(e,r)}lc.default=gz});var uh=b(dc=>{"use strict";Object.defineProperty(dc,"__esModule",{value:!0});var _z=D(),yz={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,_z.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};dc.default=yz});var lh=b(pc=>{"use strict";Object.defineProperty(pc,"__esModule",{value:!0});var vz=Wa(),$z=Dm(),wz=Ga(),xz=Lm(),bz=Fm(),zz=Bm(),Sz=Wm(),kz=rc(),Pz=Qm(),Ez=th(),Tz=rh(),Rz=oh(),Iz=nh(),Oz=sh(),Cz=ch(),Az=uh();function Nz(e=!1){let t=[Tz.default,Rz.default,Iz.default,Oz.default,Cz.default,Az.default,Sz.default,kz.default,zz.default,Pz.default,Ez.default];return e?t.push($z.default,xz.default):t.push(vz.default,wz.default),t.push(bz.default),t}pc.default=Nz});var dh=b(fc=>{"use strict";Object.defineProperty(fc,"__esModule",{value:!0});var ae=j(),jz={message:({schemaCode:e})=>(0,ae.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,ae._)`{format: ${e}}`},Zz={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:jz,code(e,t){let{gen:r,data:o,$data:n,schema:s,schemaCode:i,it:a}=e,{opts:c,errSchemaPath:l,schemaEnv:u,self:d}=a;if(!c.validateFormats)return;n?m():f();function m(){let g=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),h=r.const("fDef",(0,ae._)`${g}[${i}]`),y=r.let("fType"),x=r.let("format");r.if((0,ae._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(y,(0,ae._)`${h}.type || "string"`).assign(x,(0,ae._)`${h}.validate`),()=>r.assign(y,(0,ae._)`"string"`).assign(x,h)),e.fail$data((0,ae.or)(w(),$()));function w(){return c.strictSchema===!1?ae.nil:(0,ae._)`${i} && !${x}`}function $(){let P=u.$async?(0,ae._)`(${h}.async ? await ${x}(${o}) : ${x}(${o}))`:(0,ae._)`${x}(${o})`,v=(0,ae._)`(typeof ${x} == "function" ? ${P} : ${x}.test(${o}))`;return(0,ae._)`${x} && ${x} !== true && ${y} === ${t} && !${v}`}}function f(){let g=d.formats[s];if(!g){w();return}if(g===!0)return;let[h,y,x]=$(g);h===t&&e.pass(P());function w(){if(c.strictSchema===!1){d.logger.warn(v());return}throw new Error(v());function v(){return`unknown format "${s}" ignored in schema at path "${l}"`}}function $(v){let z=v instanceof RegExp?(0,ae.regexpCode)(v):c.code.formats?(0,ae._)`${c.code.formats}${(0,ae.getProperty)(s)}`:void 0,C=r.scopeValue("formats",{key:s,ref:v,code:z});return typeof v=="object"&&!(v instanceof RegExp)?[v.type||"string",v.validate,(0,ae._)`${C}.validate`]:["string",v,C]}function P(){if(typeof g=="object"&&!(g instanceof RegExp)&&g.async){if(!u.$async)throw new Error("async format in sync schema");return(0,ae._)`await ${x}(${o})`}return typeof y=="function"?(0,ae._)`${x}(${o})`:(0,ae._)`${x}.test(${o})`}}}};fc.default=Zz});var ph=b(mc=>{"use strict";Object.defineProperty(mc,"__esModule",{value:!0});var qz=dh(),Mz=[qz.default];mc.default=Mz});var fh=b(hr=>{"use strict";Object.defineProperty(hr,"__esModule",{value:!0});hr.contentVocabulary=hr.metadataVocabulary=void 0;hr.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];hr.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var hh=b(hc=>{"use strict";Object.defineProperty(hc,"__esModule",{value:!0});var Dz=xm(),Uz=jm(),Lz=lh(),Fz=ph(),mh=fh(),Vz=[Dz.default,Uz.default,(0,Lz.default)(),Fz.default,mh.metadataVocabulary,mh.contentVocabulary];hc.default=Vz});var _h=b(Gn=>{"use strict";Object.defineProperty(Gn,"__esModule",{value:!0});Gn.DiscrError=void 0;var gh;(function(e){e.Tag="tag",e.Mapping="mapping"})(gh||(Gn.DiscrError=gh={}))});var vh=b(_c=>{"use strict";Object.defineProperty(_c,"__esModule",{value:!0});var gr=j(),gc=_h(),yh=Rn(),Hz=oo(),Bz=D(),Kz={message:({params:{discrError:e,tagName:t}})=>e===gc.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,gr._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},Wz={keyword:"discriminator",type:"object",schemaType:"object",error:Kz,code(e){let{gen:t,data:r,schema:o,parentSchema:n,it:s}=e,{oneOf:i}=n;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=o.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(o.mapping)throw new Error("discriminator: mapping is not supported");if(!i)throw new Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),l=t.const("tag",(0,gr._)`${r}${(0,gr.getProperty)(a)}`);t.if((0,gr._)`typeof ${l} == "string"`,()=>u(),()=>e.error(!1,{discrError:gc.DiscrError.Tag,tag:l,tagName:a})),e.ok(c);function u(){let f=m();t.if(!1);for(let g in f)t.elseIf((0,gr._)`${l} === ${g}`),t.assign(c,d(f[g]));t.else(),e.error(!1,{discrError:gc.DiscrError.Mapping,tag:l,tagName:a}),t.endIf()}function d(f){let g=t.name("valid"),h=e.subschema({keyword:"oneOf",schemaProp:f},g);return e.mergeEvaluated(h,gr.Name),g}function m(){var f;let g={},h=x(n),y=!0;for(let P=0;P<i.length;P++){let v=i[P];if(v?.$ref&&!(0,Bz.schemaHasRulesButRef)(v,s.self.RULES)){let C=v.$ref;if(v=yh.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,C),v instanceof yh.SchemaEnv&&(v=v.schema),v===void 0)throw new Hz.default(s.opts.uriResolver,s.baseId,C)}let z=(f=v?.properties)===null||f===void 0?void 0:f[a];if(typeof z!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);y=y&&(h||x(v)),w(z,P)}if(!y)throw new Error(`discriminator: "${a}" must be required`);return g;function x({required:P}){return Array.isArray(P)&&P.includes(a)}function w(P,v){if(P.const)$(P.const,v);else if(P.enum)for(let z of P.enum)$(z,v);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function $(P,v){if(typeof P!="string"||P in g)throw new Error(`discriminator: "${a}" values must be unique strings`);g[P]=v}}}};_c.default=Wz});var $h=b((vO,Gz)=>{Gz.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var vc=b((te,yc)=>{"use strict";Object.defineProperty(te,"__esModule",{value:!0});te.MissingRefError=te.ValidationError=te.CodeGen=te.Name=te.nil=te.stringify=te.str=te._=te.KeywordCxt=te.Ajv=void 0;var Jz=gm(),Qz=hh(),Yz=vh(),wh=$h(),Xz=["/properties"],Jn="http://json-schema.org/draft-07/schema",_r=class extends Jz.default{_addVocabularies(){super._addVocabularies(),Qz.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(Yz.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(wh,Xz):wh;this.addMetaSchema(t,Jn,!1),this.refs["http://json-schema.org/schema"]=Jn}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Jn)?Jn:void 0)}};te.Ajv=_r;yc.exports=te=_r;yc.exports.Ajv=_r;Object.defineProperty(te,"__esModule",{value:!0});te.default=_r;var eS=ro();Object.defineProperty(te,"KeywordCxt",{enumerable:!0,get:function(){return eS.KeywordCxt}});var yr=j();Object.defineProperty(te,"_",{enumerable:!0,get:function(){return yr._}});Object.defineProperty(te,"str",{enumerable:!0,get:function(){return yr.str}});Object.defineProperty(te,"stringify",{enumerable:!0,get:function(){return yr.stringify}});Object.defineProperty(te,"nil",{enumerable:!0,get:function(){return yr.nil}});Object.defineProperty(te,"Name",{enumerable:!0,get:function(){return yr.Name}});Object.defineProperty(te,"CodeGen",{enumerable:!0,get:function(){return yr.CodeGen}});var tS=En();Object.defineProperty(te,"ValidationError",{enumerable:!0,get:function(){return tS.default}});var rS=oo();Object.defineProperty(te,"MissingRefError",{enumerable:!0,get:function(){return rS.default}})});var Th=b(Xe=>{"use strict";Object.defineProperty(Xe,"__esModule",{value:!0});Xe.formatNames=Xe.fastFormats=Xe.fullFormats=void 0;function Ye(e,t){return{validate:e,compare:t}}Xe.fullFormats={date:Ye(Sh,bc),time:Ye(wc(!0),zc),"date-time":Ye(xh(!0),Ph),"iso-time":Ye(wc(),kh),"iso-date-time":Ye(xh(),Eh),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:cS,"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:hS,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:uS,int32:{type:"number",validate:pS},int64:{type:"number",validate:fS},float:{type:"number",validate:zh},double:{type:"number",validate:zh},password:!0,binary:!0};Xe.fastFormats={...Xe.fullFormats,date:Ye(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,bc),time:Ye(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,zc),"date-time":Ye(/^\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,Ph),"iso-time":Ye(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,kh),"iso-date-time":Ye(/^\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,Eh),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};Xe.formatNames=Object.keys(Xe.fullFormats);function oS(e){return e%4===0&&(e%100!==0||e%400===0)}var nS=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,sS=[0,31,28,31,30,31,30,31,31,30,31,30,31];function Sh(e){let t=nS.exec(e);if(!t)return!1;let r=+t[1],o=+t[2],n=+t[3];return o>=1&&o<=12&&n>=1&&n<=(o===2&&oS(r)?29:sS[o])}function bc(e,t){if(e&&t)return e>t?1:e<t?-1:0}var $c=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function wc(e){return function(r){let o=$c.exec(r);if(!o)return!1;let n=+o[1],s=+o[2],i=+o[3],a=o[4],c=o[5]==="-"?-1:1,l=+(o[6]||0),u=+(o[7]||0);if(l>23||u>59||e&&!a)return!1;if(n<=23&&s<=59&&i<60)return!0;let d=s-u*c,m=n-l*c-(d<0?1:0);return(m===23||m===-1)&&(d===59||d===-1)&&i<61}}function zc(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),o=new Date("2020-01-01T"+t).valueOf();if(r&&o)return r-o}function kh(e,t){if(!(e&&t))return;let r=$c.exec(e),o=$c.exec(t);if(r&&o)return e=r[1]+r[2]+r[3],t=o[1]+o[2]+o[3],e>t?1:e<t?-1:0}var xc=/t|\s/i;function xh(e){let t=wc(e);return function(o){let n=o.split(xc);return n.length===2&&Sh(n[0])&&t(n[1])}}function Ph(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),o=new Date(t).valueOf();if(r&&o)return r-o}function Eh(e,t){if(!(e&&t))return;let[r,o]=e.split(xc),[n,s]=t.split(xc),i=bc(r,n);if(i!==void 0)return i||zc(o,s)}var iS=/\/|:/,aS=/^(?:[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 cS(e){return iS.test(e)&&aS.test(e)}var bh=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function uS(e){return bh.lastIndex=0,bh.test(e)}var lS=-(2**31),dS=2**31-1;function pS(e){return Number.isInteger(e)&&e<=dS&&e>=lS}function fS(e){return Number.isInteger(e)}function zh(){return!0}var mS=/[^\\]\\Z/;function hS(e){if(mS.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var Rh=b(vr=>{"use strict";Object.defineProperty(vr,"__esModule",{value:!0});vr.formatLimitDefinition=void 0;var gS=vc(),Ke=j(),wt=Ke.operators,Qn={formatMaximum:{okStr:"<=",ok:wt.LTE,fail:wt.GT},formatMinimum:{okStr:">=",ok:wt.GTE,fail:wt.LT},formatExclusiveMaximum:{okStr:"<",ok:wt.LT,fail:wt.GTE},formatExclusiveMinimum:{okStr:">",ok:wt.GT,fail:wt.LTE}},_S={message:({keyword:e,schemaCode:t})=>(0,Ke.str)`should be ${Qn[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,Ke._)`{comparison: ${Qn[e].okStr}, limit: ${t}}`};vr.formatLimitDefinition={keyword:Object.keys(Qn),type:"string",schemaType:"string",$data:!0,error:_S,code(e){let{gen:t,data:r,schemaCode:o,keyword:n,it:s}=e,{opts:i,self:a}=s;if(!i.validateFormats)return;let c=new gS.KeywordCxt(s,a.RULES.all.format.definition,"format");c.$data?l():u();function l(){let m=t.scopeValue("formats",{ref:a.formats,code:i.code.formats}),f=t.const("fmt",(0,Ke._)`${m}[${c.schemaCode}]`);e.fail$data((0,Ke.or)((0,Ke._)`typeof ${f} != "object"`,(0,Ke._)`${f} instanceof RegExp`,(0,Ke._)`typeof ${f}.compare != "function"`,d(f)))}function u(){let m=c.schema,f=a.formats[m];if(!f||f===!0)return;if(typeof f!="object"||f instanceof RegExp||typeof f.compare!="function")throw new Error(`"${n}": format "${m}" does not define "compare" function`);let g=t.scopeValue("formats",{key:m,ref:f,code:i.code.formats?(0,Ke._)`${i.code.formats}${(0,Ke.getProperty)(m)}`:void 0});e.fail$data(d(g))}function d(m){return(0,Ke._)`${m}.compare(${r}, ${o}) ${Qn[n].fail} 0`}},dependencies:["format"]};var yS=e=>(e.addKeyword(vr.formatLimitDefinition),e);vr.default=yS});var Ah=b((vo,Ch)=>{"use strict";Object.defineProperty(vo,"__esModule",{value:!0});var $r=Th(),vS=Rh(),Sc=j(),Ih=new Sc.Name("fullFormats"),$S=new Sc.Name("fastFormats"),kc=(e,t={keywords:!0})=>{if(Array.isArray(t))return Oh(e,t,$r.fullFormats,Ih),e;let[r,o]=t.mode==="fast"?[$r.fastFormats,$S]:[$r.fullFormats,Ih],n=t.formats||$r.formatNames;return Oh(e,n,r,o),t.keywords&&(0,vS.default)(e),e};kc.get=(e,t="full")=>{let o=(t==="fast"?$r.fastFormats:$r.fullFormats)[e];if(!o)throw new Error(`Unknown format "${e}"`);return o};function Oh(e,t,r,o){var n,s;(n=(s=e.opts.code).formats)!==null&&n!==void 0||(s.formats=(0,Sc._)`require("ajv-formats/dist/formats").${o}`);for(let i of t)e.addFormat(i,r[i])}Ch.exports=vo=kc;Object.defineProperty(vo,"__esModule",{value:!0});vo.default=kc});var Fh=b((CO,Lh)=>{Lh.exports=Uh;Uh.sync=zS;var Mh=lt("fs");function bS(e,t){var r=t.pathExt!==void 0?t.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var o=0;o<r.length;o++){var n=r[o].toLowerCase();if(n&&e.substr(-n.length).toLowerCase()===n)return!0}return!1}function Dh(e,t,r){return!e.isSymbolicLink()&&!e.isFile()?!1:bS(t,r)}function Uh(e,t,r){Mh.stat(e,function(o,n){r(o,o?!1:Dh(n,e,t))})}function zS(e,t){return Dh(Mh.statSync(e),e,t)}});var Wh=b((AO,Kh)=>{Kh.exports=Hh;Hh.sync=SS;var Vh=lt("fs");function Hh(e,t,r){Vh.stat(e,function(o,n){r(o,o?!1:Bh(n,t))})}function SS(e,t){return Bh(Vh.statSync(e),t)}function Bh(e,t){return e.isFile()&&kS(e,t)}function kS(e,t){var r=e.mode,o=e.uid,n=e.gid,s=t.uid!==void 0?t.uid:process.getuid&&process.getuid(),i=t.gid!==void 0?t.gid:process.getgid&&process.getgid(),a=parseInt("100",8),c=parseInt("010",8),l=parseInt("001",8),u=a|c,d=r&l||r&c&&n===i||r&a&&o===s||r&u&&s===0;return d}});var Jh=b((jO,Gh)=>{var NO=lt("fs"),ts;process.platform==="win32"||global.TESTING_WINDOWS?ts=Fh():ts=Wh();Gh.exports=Ec;Ec.sync=PS;function Ec(e,t,r){if(typeof t=="function"&&(r=t,t={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(o,n){Ec(e,t||{},function(s,i){s?n(s):o(i)})})}ts(e,t||{},function(o,n){o&&(o.code==="EACCES"||t&&t.ignoreErrors)&&(o=null,n=!1),r(o,n)})}function PS(e,t){try{return ts.sync(e,t||{})}catch(r){if(t&&t.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var og=b((ZO,rg)=>{var wr=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",Qh=lt("path"),ES=wr?";":":",Yh=Jh(),Xh=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),eg=(e,t)=>{let r=t.colon||ES,o=e.match(/\//)||wr&&e.match(/\\/)?[""]:[...wr?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(r)],n=wr?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",s=wr?n.split(r):[""];return wr&&e.indexOf(".")!==-1&&s[0]!==""&&s.unshift(""),{pathEnv:o,pathExt:s,pathExtExe:n}},tg=(e,t,r)=>{typeof t=="function"&&(r=t,t={}),t||(t={});let{pathEnv:o,pathExt:n,pathExtExe:s}=eg(e,t),i=[],a=l=>new Promise((u,d)=>{if(l===o.length)return t.all&&i.length?u(i):d(Xh(e));let m=o[l],f=/^".*"$/.test(m)?m.slice(1,-1):m,g=Qh.join(f,e),h=!f&&/^\.[\\\/]/.test(e)?e.slice(0,2)+g:g;u(c(h,l,0))}),c=(l,u,d)=>new Promise((m,f)=>{if(d===n.length)return m(a(u+1));let g=n[d];Yh(l+g,{pathExt:s},(h,y)=>{if(!h&&y)if(t.all)i.push(l+g);else return m(l+g);return m(c(l,u,d+1))})});return r?a(0).then(l=>r(null,l),r):a(0)},TS=(e,t)=>{t=t||{};let{pathEnv:r,pathExt:o,pathExtExe:n}=eg(e,t),s=[];for(let i=0;i<r.length;i++){let a=r[i],c=/^".*"$/.test(a)?a.slice(1,-1):a,l=Qh.join(c,e),u=!c&&/^\.[\\\/]/.test(e)?e.slice(0,2)+l:l;for(let d=0;d<o.length;d++){let m=u+o[d];try{if(Yh.sync(m,{pathExt:n}))if(t.all)s.push(m);else return m}catch{}}}if(t.all&&s.length)return s;if(t.nothrow)return null;throw Xh(e)};rg.exports=tg;tg.sync=TS});var sg=b((qO,Tc)=>{"use strict";var ng=(e={})=>{let t=e.env||process.env;return(e.platform||process.platform)!=="win32"?"PATH":Object.keys(t).reverse().find(o=>o.toUpperCase()==="PATH")||"Path"};Tc.exports=ng;Tc.exports.default=ng});var ug=b((MO,cg)=>{"use strict";var ig=lt("path"),RS=og(),IS=sg();function ag(e,t){let r=e.options.env||process.env,o=process.cwd(),n=e.options.cwd!=null,s=n&&process.chdir!==void 0&&!process.chdir.disabled;if(s)try{process.chdir(e.options.cwd)}catch{}let i;try{i=RS.sync(e.command,{path:r[IS({env:r})],pathExt:t?ig.delimiter:void 0})}catch{}finally{s&&process.chdir(o)}return i&&(i=ig.resolve(n?e.options.cwd:"",i)),i}function OS(e){return ag(e)||ag(e,!0)}cg.exports=OS});var lg=b((DO,Ic)=>{"use strict";var Rc=/([()\][%!^"`<>&|;, *?])/g;function CS(e){return e=e.replace(Rc,"^$1"),e}function AS(e,t){return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),e=e.replace(/(?=(\\+?)?)\1$/,"$1$1"),e=`"${e}"`,e=e.replace(Rc,"^$1"),t&&(e=e.replace(Rc,"^$1")),e}Ic.exports.command=CS;Ic.exports.argument=AS});var pg=b((UO,dg)=>{"use strict";dg.exports=/^#!(.*)/});var mg=b((LO,fg)=>{"use strict";var NS=pg();fg.exports=(e="")=>{let t=e.match(NS);if(!t)return null;let[r,o]=t[0].replace(/#! ?/,"").split(" "),n=r.split("/").pop();return n==="env"?o:o?`${n} ${o}`:n}});var gg=b((FO,hg)=>{"use strict";var Oc=lt("fs"),jS=mg();function ZS(e){let r=Buffer.alloc(150),o;try{o=Oc.openSync(e,"r"),Oc.readSync(o,r,0,150,0),Oc.closeSync(o)}catch{}return jS(r.toString())}hg.exports=ZS});var $g=b((VO,vg)=>{"use strict";var qS=lt("path"),_g=ug(),yg=lg(),MS=gg(),DS=process.platform==="win32",US=/\.(?:com|exe)$/i,LS=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function FS(e){e.file=_g(e);let t=e.file&&MS(e.file);return t?(e.args.unshift(e.file),e.command=t,_g(e)):e.file}function VS(e){if(!DS)return e;let t=FS(e),r=!US.test(t);if(e.options.forceShell||r){let o=LS.test(t);e.command=qS.normalize(e.command),e.command=yg.command(e.command),e.args=e.args.map(s=>yg.argument(s,o));let n=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${n}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}function HS(e,t,r){t&&!Array.isArray(t)&&(r=t,t=null),t=t?t.slice(0):[],r=Object.assign({},r);let o={command:e,args:t,options:r,file:void 0,original:{command:e,args:t}};return r.shell?o:VS(o)}vg.exports=HS});var bg=b((HO,xg)=>{"use strict";var Cc=process.platform==="win32";function Ac(e,t){return Object.assign(new Error(`${t} ${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function BS(e,t){if(!Cc)return;let r=e.emit;e.emit=function(o,n){if(o==="exit"){let s=wg(n,t);if(s)return r.call(e,"error",s)}return r.apply(e,arguments)}}function wg(e,t){return Cc&&e===1&&!t.file?Ac(t.original,"spawn"):null}function KS(e,t){return Cc&&e===1&&!t.file?Ac(t.original,"spawnSync"):null}xg.exports={hookChildProcess:BS,verifyENOENT:wg,verifyENOENTSync:KS,notFoundError:Ac}});var kg=b((BO,xr)=>{"use strict";var zg=lt("child_process"),Nc=$g(),jc=bg();function Sg(e,t,r){let o=Nc(e,t,r),n=zg.spawn(o.command,o.args,o.options);return jc.hookChildProcess(n,o),n}function WS(e,t,r){let o=Nc(e,t,r),n=zg.spawnSync(o.command,o.args,o.options);return n.error=n.error||jc.verifyENOENTSync(n.status,o),n}xr.exports=Sg;xr.exports.spawn=Sg;xr.exports.sync=WS;xr.exports._parse=Nc;xr.exports._enoent=jc});var Og=b(Mc=>{"use strict";var Tg=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,ek=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,Rg=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,tk=/\\([\u000b\u0020-\u00ff])/g,rk=/([\\"])/g,Ig=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;Mc.format=ok;Mc.parse=nk;function ok(e){if(!e||typeof e!="object")throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!Ig.test(r))throw new TypeError("invalid type");var o=r;if(t&&typeof t=="object")for(var n,s=Object.keys(t).sort(),i=0;i<s.length;i++){if(n=s[i],!Rg.test(n))throw new TypeError("invalid parameter name");o+="; "+n+"="+ik(t[n])}return o}function nk(e){if(!e)throw new TypeError("argument string is required");var t=typeof e=="object"?sk(e):e;if(typeof t!="string")throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),o=r!==-1?t.slice(0,r).trim():t.trim();if(!Ig.test(o))throw new TypeError("invalid media type");var n=new ak(o.toLowerCase());if(r!==-1){var s,i,a;for(Tg.lastIndex=r;i=Tg.exec(t);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=i[0].length,s=i[1].toLowerCase(),a=i[2],a.charCodeAt(0)===34&&(a=a.slice(1,-1),a.indexOf("\\")!==-1&&(a=a.replace(tk,"$1"))),n.parameters[s]=a}if(r!==t.length)throw new TypeError("invalid parameter format")}return n}function sk(e){var t;if(typeof e.getHeader=="function"?t=e.getHeader("content-type"):typeof e.headers=="object"&&(t=e.headers&&e.headers["content-type"]),typeof t!="string")throw new TypeError("content-type header is missing from object");return t}function ik(e){var t=String(e);if(Rg.test(t))return t;if(t.length>0&&!ek.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(rk,"\\$1")+'"'}function ak(e){this.parameters=Object.create(null),this.type=e}});var as=Object.freeze({status:"aborted"});function _(e,t,r){function o(a,c){var l;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(l=a._zod).traits??(l.traits=new Set),a._zod.traits.add(e),t(a,c);for(let u in i.prototype)u in a||Object.defineProperty(a,u,{value:i.prototype[u].bind(a)});a._zod.constr=i,a._zod.def=c}let n=r?.Parent??Object;class s extends n{}Object.defineProperty(s,"name",{value:e});function i(a){var c;let l=r?.Parent?new s:this;o(l,a),(c=l._zod).deferred??(c.deferred=[]);for(let u of l._zod.deferred)u();return l}return Object.defineProperty(i,"init",{value:o}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}var i_=Symbol("zod_brand"),et=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Zo={};function Ie(e){return e&&Object.assign(Zo,e),Zo}var V={};is(V,{BIGINT_FORMAT_RANGES:()=>Xc,Class:()=>us,NUMBER_FORMAT_RANGES:()=>_s,aborted:()=>zt,allowsEval:()=>ms,assert:()=>d_,assertEqual:()=>a_,assertIs:()=>u_,assertNever:()=>l_,assertNotEqual:()=>c_,assignProp:()=>fs,cached:()=>Sr,captureStackTrace:()=>Mo,cleanEnum:()=>z_,cleanRegex:()=>Pr,clone:()=>Me,createTransparentProxy:()=>__,defineLazy:()=>G,esc:()=>bt,escapeRegex:()=>dt,extend:()=>$_,finalizeIssue:()=>De,floatSafeRemainder:()=>ps,getElementAtPath:()=>p_,getEnumValues:()=>ls,getLengthableOrigin:()=>Er,getParsedType:()=>g_,getSizableOrigin:()=>eu,isObject:()=>Bt,isPlainObject:()=>Kt,issue:()=>ys,joinValues:()=>qo,jsonStringifyReplacer:()=>ds,merge:()=>w_,normalizeParams:()=>R,nullish:()=>kr,numKeys:()=>h_,omit:()=>v_,optionalKeys:()=>gs,partial:()=>x_,pick:()=>y_,prefixIssues:()=>We,primitiveTypes:()=>Yc,promiseAllObject:()=>f_,propertyKeyTypes:()=>hs,randomString:()=>m_,required:()=>b_,stringifyPrimitive:()=>Do,unwrapMessage:()=>zr});function a_(e){return e}function c_(e){return e}function u_(e){}function l_(e){throw new Error}function d_(e){}function ls(e){let t=Object.values(e).filter(o=>typeof o=="number");return Object.entries(e).filter(([o,n])=>t.indexOf(+o)===-1).map(([o,n])=>n)}function qo(e,t="|"){return e.map(r=>Do(r)).join(t)}function ds(e,t){return typeof t=="bigint"?t.toString():t}function Sr(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function kr(e){return e==null}function Pr(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function ps(e,t){let r=(e.toString().split(".")[1]||"").length,o=(t.toString().split(".")[1]||"").length,n=r>o?r:o,s=Number.parseInt(e.toFixed(n).replace(".","")),i=Number.parseInt(t.toFixed(n).replace(".",""));return s%i/10**n}function G(e,t,r){Object.defineProperty(e,t,{get(){{let n=r();return e[t]=n,n}throw new Error("cached value already set")},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function fs(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function p_(e,t){return t?t.reduce((r,o)=>r?.[o],e):e}function f_(e){let t=Object.keys(e),r=t.map(o=>e[o]);return Promise.all(r).then(o=>{let n={};for(let s=0;s<t.length;s++)n[t[s]]=o[s];return n})}function m_(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let o=0;o<e;o++)r+=t[Math.floor(Math.random()*t.length)];return r}function bt(e){return JSON.stringify(e)}var Mo=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function Bt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var ms=Sr(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Kt(e){if(Bt(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;let r=t.prototype;return!(Bt(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function h_(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var g_=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},hs=new Set(["string","number","symbol"]),Yc=new Set(["string","number","bigint","boolean","symbol","undefined"]);function dt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Me(e,t,r){let o=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(o._zod.parent=e),o}function R(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function __(e){let t;return new Proxy({},{get(r,o,n){return t??(t=e()),Reflect.get(t,o,n)},set(r,o,n,s){return t??(t=e()),Reflect.set(t,o,n,s)},has(r,o){return t??(t=e()),Reflect.has(t,o)},deleteProperty(r,o){return t??(t=e()),Reflect.deleteProperty(t,o)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,o){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,o)},defineProperty(r,o,n){return t??(t=e()),Reflect.defineProperty(t,o,n)}})}function Do(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function gs(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var _s={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Xc={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function y_(e,t){let r={},o=e._zod.def;for(let n in t){if(!(n in o.shape))throw new Error(`Unrecognized key: "${n}"`);t[n]&&(r[n]=o.shape[n])}return Me(e,{...e._zod.def,shape:r,checks:[]})}function v_(e,t){let r={...e._zod.def.shape},o=e._zod.def;for(let n in t){if(!(n in o.shape))throw new Error(`Unrecognized key: "${n}"`);t[n]&&delete r[n]}return Me(e,{...e._zod.def,shape:r,checks:[]})}function $_(e,t){if(!Kt(t))throw new Error("Invalid input to extend: expected a plain object");let r={...e._zod.def,get shape(){let o={...e._zod.def.shape,...t};return fs(this,"shape",o),o},checks:[]};return Me(e,r)}function w_(e,t){return Me(e,{...e._zod.def,get shape(){let r={...e._zod.def.shape,...t._zod.def.shape};return fs(this,"shape",r),r},catchall:t._zod.def.catchall,checks:[]})}function x_(e,t,r){let o=t._zod.def.shape,n={...o};if(r)for(let s in r){if(!(s in o))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(n[s]=e?new e({type:"optional",innerType:o[s]}):o[s])}else for(let s in o)n[s]=e?new e({type:"optional",innerType:o[s]}):o[s];return Me(t,{...t._zod.def,shape:n,checks:[]})}function b_(e,t,r){let o=t._zod.def.shape,n={...o};if(r)for(let s in r){if(!(s in n))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(n[s]=new e({type:"nonoptional",innerType:o[s]}))}else for(let s in o)n[s]=new e({type:"nonoptional",innerType:o[s]});return Me(t,{...t._zod.def,shape:n,checks:[]})}function zt(e,t=0){for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function We(e,t){return t.map(r=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function zr(e){return typeof e=="string"?e:e?.message}function De(e,t,r){let o={...e,path:e.path??[]};if(!e.message){let n=zr(e.inst?._zod.def?.error?.(e))??zr(t?.error?.(e))??zr(r.customError?.(e))??zr(r.localeError?.(e))??"Invalid input";o.message=n}return delete o.inst,delete o.continue,t?.reportInput||delete o.input,o}function eu(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Er(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function ys(...e){let[t,r,o]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:o}:{...t}}function z_(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}var us=class{constructor(...t){}};var tu=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get(){return JSON.stringify(t,ds,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Uo=_("$ZodError",tu),vs=_("$ZodError",tu,{Parent:Error});function $s(e,t=r=>r.message){let r={},o=[];for(let n of e.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(t(n))):o.push(t(n));return{formErrors:o,fieldErrors:r}}function ws(e,t){let r=t||function(s){return s.message},o={_errors:[]},n=s=>{for(let i of s.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>n({issues:a}));else if(i.code==="invalid_key")n({issues:i.issues});else if(i.code==="invalid_element")n({issues:i.issues});else if(i.path.length===0)o._errors.push(r(i));else{let a=o,c=0;for(;c<i.path.length;){let l=i.path[c];c===i.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(r(i))):a[l]=a[l]||{_errors:[]},a=a[l],c++}}};return n(e),o}var ru=e=>(t,r,o,n)=>{let s=o?Object.assign(o,{async:!1}):{async:!1},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new et;if(i.issues.length){let a=new(n?.Err??e)(i.issues.map(c=>De(c,s,Ie())));throw Mo(a,n?.callee),a}return i.value};var ou=e=>async(t,r,o,n)=>{let s=o?Object.assign(o,{async:!0}):{async:!0},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){let a=new(n?.Err??e)(i.issues.map(c=>De(c,s,Ie())));throw Mo(a,n?.callee),a}return i.value};var xs=e=>(t,r,o)=>{let n=o?{...o,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},n);if(s instanceof Promise)throw new et;return s.issues.length?{success:!1,error:new(e??Uo)(s.issues.map(i=>De(i,n,Ie())))}:{success:!0,data:s.value}},Tr=xs(vs),bs=e=>async(t,r,o)=>{let n=o?Object.assign(o,{async:!0}):{async:!0},s=t._zod.run({value:r,issues:[]},n);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>De(i,n,Ie())))}:{success:!0,data:s.value}},Lo=bs(vs);var nu=/^[cC][^\s-]{8,}$/,su=/^[0-9a-z]+$/,iu=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,au=/^[0-9a-vA-V]{20}$/,cu=/^[A-Za-z0-9]{27}$/,uu=/^[a-zA-Z0-9_-]{21}$/,lu=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var du=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,zs=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/;var pu=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var k_="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function fu(){return new RegExp(k_,"u")}var mu=/^(?:(?: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])$/,hu=/^(([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})$/,gu=/^((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])$/,_u=/^(([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])$/,yu=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ss=/^[A-Za-z0-9_-]*$/,vu=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/;var $u=/^\+(?:[0-9]){6,14}[0-9]$/,wu="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",xu=new RegExp(`^${wu}$`);function bu(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function zu(e){return new RegExp(`^${bu(e)}$`)}function Su(e){let t=bu({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-]\\d{2}:\\d{2})");let o=`${t}(?:${r.join("|")})`;return new RegExp(`^${wu}T(?:${o})$`)}var ku=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Pu=/^\d+n?$/,Eu=/^\d+$/,Tu=/^-?\d+(?:\.\d+)?/i,Ru=/true|false/i,Iu=/null/i;var Ou=/^[^A-Z]*$/,Cu=/^[^a-z]*$/;var _e=_("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Au={number:"number",bigint:"bigint",object:"date"},ks=_("$ZodCheckLessThan",(e,t)=>{_e.init(e,t);let r=Au[typeof t.value];e._zod.onattach.push(o=>{let n=o._zod.bag,s=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=o=>{(t.inclusive?o.value<=t.value:o.value<t.value)||o.issues.push({origin:r,code:"too_big",maximum:t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ps=_("$ZodCheckGreaterThan",(e,t)=>{_e.init(e,t);let r=Au[typeof t.value];e._zod.onattach.push(o=>{let n=o._zod.bag,s=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=o=>{(t.inclusive?o.value>=t.value:o.value>t.value)||o.issues.push({origin:r,code:"too_small",minimum:t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Nu=_("$ZodCheckMultipleOf",(e,t)=>{_e.init(e,t),e._zod.onattach.push(r=>{var o;(o=r._zod.bag).multipleOf??(o.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):ps(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),ju=_("$ZodCheckNumberFormat",(e,t)=>{_e.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),o=r?"int":"number",[n,s]=_s[t.format];e._zod.onattach.push(i=>{let a=i._zod.bag;a.format=t.format,a.minimum=n,a.maximum=s,r&&(a.pattern=Eu)}),e._zod.check=i=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:o,format:t.format,code:"invalid_type",input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,continue:!t.abort}):i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,continue:!t.abort});return}}a<n&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),a>s&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inst:e})}});var Zu=_("$ZodCheckMaxLength",(e,t)=>{var r;_e.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!kr(n)&&n.length!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(o._zod.bag.maximum=t.maximum)}),e._zod.check=o=>{let n=o.value;if(n.length<=t.maximum)return;let i=Er(n);o.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),qu=_("$ZodCheckMinLength",(e,t)=>{var r;_e.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!kr(n)&&n.length!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(o._zod.bag.minimum=t.minimum)}),e._zod.check=o=>{let n=o.value;if(n.length>=t.minimum)return;let i=Er(n);o.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Mu=_("$ZodCheckLengthEquals",(e,t)=>{var r;_e.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!kr(n)&&n.length!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=o=>{let n=o.value,s=n.length;if(s===t.length)return;let i=Er(n),a=s>t.length;o.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),Rr=_("$ZodCheckStringFormat",(e,t)=>{var r,o;_e.init(e,t),e._zod.onattach.push(n=>{let s=n._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(o=e._zod).check??(o.check=()=>{})}),Du=_("$ZodCheckRegex",(e,t)=>{Rr.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Uu=_("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Ou),Rr.init(e,t)}),Lu=_("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Cu),Rr.init(e,t)}),Fu=_("$ZodCheckIncludes",(e,t)=>{_e.init(e,t);let r=dt(t.includes),o=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=o,e._zod.onattach.push(n=>{let s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(o)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Vu=_("$ZodCheckStartsWith",(e,t)=>{_e.init(e,t);let r=new RegExp(`^${dt(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(o=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=o=>{o.value.startsWith(t.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),Hu=_("$ZodCheckEndsWith",(e,t)=>{_e.init(e,t);let r=new RegExp(`.*${dt(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(o=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=o=>{o.value.endsWith(t.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});var Bu=_("$ZodCheckOverwrite",(e,t)=>{_e.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var Vo=class{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let o=t.split(`
|
|
10
|
+
`).filter(i=>i),n=Math.min(...o.map(i=>i.length-i.trimStart().length)),s=o.map(i=>i.slice(n)).map(i=>" ".repeat(this.indent*2)+i);for(let i of s)this.content.push(i)}compile(){let t=Function,r=this?.args,n=[...(this?.content??[""]).map(s=>` ${s}`)];return new t(...r,n.join(`
|
|
11
|
+
`))}};var Wu={major:4,minor:0,patch:0};var H=_("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Wu;let o=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&o.unshift(e);for(let n of o)for(let s of n._zod.onattach)s(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let n=(s,i,a)=>{let c=zt(s),l;for(let u of i){if(u._zod.def.when){if(!u._zod.def.when(s))continue}else if(c)continue;let d=s.issues.length,m=u._zod.check(s);if(m instanceof Promise&&a?.async===!1)throw new et;if(l||m instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await m,s.issues.length!==d&&(c||(c=zt(s,d)))});else{if(s.issues.length===d)continue;c||(c=zt(s,d))}}return l?l.then(()=>s):s};e._zod.run=(s,i)=>{let a=e._zod.parse(s,i);if(a instanceof Promise){if(i.async===!1)throw new et;return a.then(c=>n(c,o,i))}return n(a,o,i)}}e["~standard"]={validate:n=>{try{let s=Tr(e,n);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return Lo(e,n).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}}),Bo=_("$ZodString",(e,t)=>{H.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??ku(e._zod.bag),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),Y=_("$ZodStringFormat",(e,t)=>{Rr.init(e,t),Bo.init(e,t)}),nl=_("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=du),Y.init(e,t)}),sl=_("$ZodUUID",(e,t)=>{if(t.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=zs(o))}else t.pattern??(t.pattern=zs());Y.init(e,t)}),il=_("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=pu),Y.init(e,t)}),al=_("$ZodURL",(e,t)=>{Y.init(e,t),e._zod.check=r=>{try{let o=r.value,n=new URL(o),s=n.href;t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(n.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:vu.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),!o.endsWith("/")&&s.endsWith("/")?r.value=s.slice(0,-1):r.value=s;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),cl=_("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=fu()),Y.init(e,t)}),ul=_("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=uu),Y.init(e,t)}),ll=_("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=nu),Y.init(e,t)}),dl=_("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=su),Y.init(e,t)}),pl=_("$ZodULID",(e,t)=>{t.pattern??(t.pattern=iu),Y.init(e,t)}),fl=_("$ZodXID",(e,t)=>{t.pattern??(t.pattern=au),Y.init(e,t)}),ml=_("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=cu),Y.init(e,t)}),hl=_("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Su(t)),Y.init(e,t)}),gl=_("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=xu),Y.init(e,t)}),_l=_("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=zu(t)),Y.init(e,t)}),yl=_("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=lu),Y.init(e,t)}),vl=_("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=mu),Y.init(e,t),e._zod.onattach.push(r=>{let o=r._zod.bag;o.format="ipv4"})}),$l=_("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=hu),Y.init(e,t),e._zod.onattach.push(r=>{let o=r._zod.bag;o.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})}}}),wl=_("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=gu),Y.init(e,t)}),xl=_("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=_u),Y.init(e,t),e._zod.check=r=>{let[o,n]=r.value.split("/");try{if(!n)throw new Error;let s=Number(n);if(`${s}`!==n)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function bl(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var zl=_("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=yu),Y.init(e,t),e._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64"}),e._zod.check=r=>{bl(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function P_(e){if(!Ss.test(e))return!1;let t=e.replace(/[-_]/g,o=>o==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return bl(r)}var Sl=_("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Ss),Y.init(e,t),e._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64url"}),e._zod.check=r=>{P_(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),kl=_("$ZodE164",(e,t)=>{t.pattern??(t.pattern=$u),Y.init(e,t)});function E_(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[o]=r;if(!o)return!1;let n=JSON.parse(atob(o));return!("typ"in n&&n?.typ!=="JWT"||!n.alg||t&&(!("alg"in n)||n.alg!==t))}catch{return!1}}var Pl=_("$ZodJWT",(e,t)=>{Y.init(e,t),e._zod.check=r=>{E_(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var Ts=_("$ZodNumber",(e,t)=>{H.init(e,t),e._zod.pattern=e._zod.bag.pattern??Tu,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let n=r.value;if(typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let s=typeof n=="number"?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...s?{received:s}:{}}),r}}),El=_("$ZodNumber",(e,t)=>{ju.init(e,t),Ts.init(e,t)}),Tl=_("$ZodBoolean",(e,t)=>{H.init(e,t),e._zod.pattern=Ru,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=!!r.value}catch{}let n=r.value;return typeof n=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),r}}),Rl=_("$ZodBigInt",(e,t)=>{H.init(e,t),e._zod.pattern=Pu,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}});var Il=_("$ZodNull",(e,t)=>{H.init(e,t),e._zod.pattern=Iu,e._zod.values=new Set([null]),e._zod.parse=(r,o)=>{let n=r.value;return n===null||r.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),r}}),Ol=_("$ZodAny",(e,t)=>{H.init(e,t),e._zod.parse=r=>r}),Cl=_("$ZodUnknown",(e,t)=>{H.init(e,t),e._zod.parse=r=>r}),Al=_("$ZodNever",(e,t)=>{H.init(e,t),e._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});var Nl=_("$ZodDate",(e,t)=>{H.init(e,t),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let n=r.value,s=n instanceof Date;return s&&!Number.isNaN(n.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:n,...s?{received:"Invalid Date"}:{},inst:e}),r}});function Gu(e,t,r){e.issues.length&&t.issues.push(...We(r,e.issues)),t.value[r]=e.value}var jl=_("$ZodArray",(e,t)=>{H.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:e}),r;r.value=Array(n.length);let s=[];for(let i=0;i<n.length;i++){let a=n[i],c=t.element._zod.run({value:a,issues:[]},o);c instanceof Promise?s.push(c.then(l=>Gu(l,r,i))):Gu(c,r,i)}return s.length?Promise.all(s).then(()=>r):r}});function Ho(e,t,r){e.issues.length&&t.issues.push(...We(r,e.issues)),t.value[r]=e.value}function Ju(e,t,r,o){e.issues.length?o[r]===void 0?r in o?t.value[r]=void 0:t.value[r]=e.value:t.issues.push(...We(r,e.issues)):e.value===void 0?r in o&&(t.value[r]=void 0):t.value[r]=e.value}var Zl=_("$ZodObject",(e,t)=>{H.init(e,t);let r=Sr(()=>{let d=Object.keys(t.shape);for(let f of d)if(!(t.shape[f]instanceof H))throw new Error(`Invalid element at key "${f}": expected a Zod schema`);let m=gs(t.shape);return{shape:t.shape,keys:d,keySet:new Set(d),numKeys:d.length,optionalKeys:new Set(m)}});G(e._zod,"propValues",()=>{let d=t.shape,m={};for(let f in d){let g=d[f]._zod;if(g.values){m[f]??(m[f]=new Set);for(let h of g.values)m[f].add(h)}}return m});let o=d=>{let m=new Vo(["shape","payload","ctx"]),f=r.value,g=w=>{let $=bt(w);return`shape[${$}]._zod.run({ value: input[${$}], issues: [] }, ctx)`};m.write("const input = payload.value;");let h=Object.create(null),y=0;for(let w of f.keys)h[w]=`key_${y++}`;m.write("const newResult = {}");for(let w of f.keys)if(f.optionalKeys.has(w)){let $=h[w];m.write(`const ${$} = ${g(w)};`);let P=bt(w);m.write(`
|
|
12
|
+
if (${$}.issues.length) {
|
|
13
|
+
if (input[${P}] === undefined) {
|
|
14
|
+
if (${P} in input) {
|
|
15
|
+
newResult[${P}] = undefined;
|
|
16
|
+
}
|
|
17
|
+
} else {
|
|
18
|
+
payload.issues = payload.issues.concat(
|
|
19
|
+
${$}.issues.map((iss) => ({
|
|
20
|
+
...iss,
|
|
21
|
+
path: iss.path ? [${P}, ...iss.path] : [${P}],
|
|
22
|
+
}))
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
} else if (${$}.value === undefined) {
|
|
26
|
+
if (${P} in input) newResult[${P}] = undefined;
|
|
27
|
+
} else {
|
|
28
|
+
newResult[${P}] = ${$}.value;
|
|
29
|
+
}
|
|
30
|
+
`)}else{let $=h[w];m.write(`const ${$} = ${g(w)};`),m.write(`
|
|
31
|
+
if (${$}.issues.length) payload.issues = payload.issues.concat(${$}.issues.map(iss => ({
|
|
32
|
+
...iss,
|
|
33
|
+
path: iss.path ? [${bt(w)}, ...iss.path] : [${bt(w)}]
|
|
34
|
+
})));`),m.write(`newResult[${bt(w)}] = ${$}.value`)}m.write("payload.value = newResult;"),m.write("return payload;");let x=m.compile();return(w,$)=>x(d,w,$)},n,s=Bt,i=!Zo.jitless,c=i&&ms.value,l=t.catchall,u;e._zod.parse=(d,m)=>{u??(u=r.value);let f=d.value;if(!s(f))return d.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),d;let g=[];if(i&&c&&m?.async===!1&&m.jitless!==!0)n||(n=o(t.shape)),d=n(d,m);else{d.value={};let $=u.shape;for(let P of u.keys){let v=$[P],z=v._zod.run({value:f[P],issues:[]},m),C=v._zod.optin==="optional"&&v._zod.optout==="optional";z instanceof Promise?g.push(z.then(re=>C?Ju(re,d,P,f):Ho(re,d,P))):C?Ju(z,d,P,f):Ho(z,d,P)}}if(!l)return g.length?Promise.all(g).then(()=>d):d;let h=[],y=u.keySet,x=l._zod,w=x.def.type;for(let $ of Object.keys(f)){if(y.has($))continue;if(w==="never"){h.push($);continue}let P=x.run({value:f[$],issues:[]},m);P instanceof Promise?g.push(P.then(v=>Ho(v,d,$))):Ho(P,d,$)}return h.length&&d.issues.push({code:"unrecognized_keys",keys:h,input:f,inst:e}),g.length?Promise.all(g).then(()=>d):d}});function Qu(e,t,r,o){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(n=>n.issues.map(s=>De(s,o,Ie())))}),t}var Rs=_("$ZodUnion",(e,t)=>{H.init(e,t),G(e._zod,"optin",()=>t.options.some(r=>r._zod.optin==="optional")?"optional":void 0),G(e._zod,"optout",()=>t.options.some(r=>r._zod.optout==="optional")?"optional":void 0),G(e._zod,"values",()=>{if(t.options.every(r=>r._zod.values))return new Set(t.options.flatMap(r=>Array.from(r._zod.values)))}),G(e._zod,"pattern",()=>{if(t.options.every(r=>r._zod.pattern)){let r=t.options.map(o=>o._zod.pattern);return new RegExp(`^(${r.map(o=>Pr(o.source)).join("|")})$`)}}),e._zod.parse=(r,o)=>{let n=!1,s=[];for(let i of t.options){let a=i._zod.run({value:r.value,issues:[]},o);if(a instanceof Promise)s.push(a),n=!0;else{if(a.issues.length===0)return a;s.push(a)}}return n?Promise.all(s).then(i=>Qu(i,r,e,o)):Qu(s,r,e,o)}}),ql=_("$ZodDiscriminatedUnion",(e,t)=>{Rs.init(e,t);let r=e._zod.parse;G(e._zod,"propValues",()=>{let n={};for(let s of t.options){let i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let[a,c]of Object.entries(i)){n[a]||(n[a]=new Set);for(let l of c)n[a].add(l)}}return n});let o=Sr(()=>{let n=t.options,s=new Map;for(let i of n){let a=i._zod.propValues[t.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let c of a){if(s.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);s.set(c,i)}}return s});e._zod.parse=(n,s)=>{let i=n.value;if(!Bt(i))return n.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),n;let a=o.value.get(i?.[t.discriminator]);return a?a._zod.run(n,s):t.unionFallback?r(n,s):(n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:i,path:[t.discriminator],inst:e}),n)}}),Ml=_("$ZodIntersection",(e,t)=>{H.init(e,t),e._zod.parse=(r,o)=>{let n=r.value,s=t.left._zod.run({value:n,issues:[]},o),i=t.right._zod.run({value:n,issues:[]},o);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,l])=>Yu(r,c,l)):Yu(r,s,i)}});function Es(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(Kt(e)&&Kt(t)){let r=Object.keys(t),o=Object.keys(e).filter(s=>r.indexOf(s)!==-1),n={...e,...t};for(let s of o){let i=Es(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};n[s]=i.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<e.length;o++){let n=e[o],s=t[o],i=Es(n,s);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Yu(e,t,r){if(t.issues.length&&e.issues.push(...t.issues),r.issues.length&&e.issues.push(...r.issues),zt(e))return e;let o=Es(t.value,r.value);if(!o.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var Dl=_("$ZodRecord",(e,t)=>{H.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!Kt(n))return r.issues.push({expected:"record",code:"invalid_type",input:n,inst:e}),r;let s=[];if(t.keyType._zod.values){let i=t.keyType._zod.values;r.value={};for(let c of i)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){let l=t.valueType._zod.run({value:n[c],issues:[]},o);l instanceof Promise?s.push(l.then(u=>{u.issues.length&&r.issues.push(...We(c,u.issues)),r.value[c]=u.value})):(l.issues.length&&r.issues.push(...We(c,l.issues)),r.value[c]=l.value)}let a;for(let c in n)i.has(c)||(a=a??[],a.push(c));a&&a.length>0&&r.issues.push({code:"unrecognized_keys",input:n,inst:e,keys:a})}else{r.value={};for(let i of Reflect.ownKeys(n)){if(i==="__proto__")continue;let a=t.keyType._zod.run({value:i,issues:[]},o);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(a.issues.length){r.issues.push({origin:"record",code:"invalid_key",issues:a.issues.map(l=>De(l,o,Ie())),input:i,path:[i],inst:e}),r.value[a.value]=a.value;continue}let c=t.valueType._zod.run({value:n[i],issues:[]},o);c instanceof Promise?s.push(c.then(l=>{l.issues.length&&r.issues.push(...We(i,l.issues)),r.value[a.value]=l.value})):(c.issues.length&&r.issues.push(...We(i,c.issues)),r.value[a.value]=c.value)}}return s.length?Promise.all(s).then(()=>r):r}});var Ul=_("$ZodEnum",(e,t)=>{H.init(e,t);let r=ls(t.entries);e._zod.values=new Set(r),e._zod.pattern=new RegExp(`^(${r.filter(o=>hs.has(typeof o)).map(o=>typeof o=="string"?dt(o):o.toString()).join("|")})$`),e._zod.parse=(o,n)=>{let s=o.value;return e._zod.values.has(s)||o.issues.push({code:"invalid_value",values:r,input:s,inst:e}),o}}),Ll=_("$ZodLiteral",(e,t)=>{H.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?dt(r):r?r.toString():String(r)).join("|")})$`),e._zod.parse=(r,o)=>{let n=r.value;return e._zod.values.has(n)||r.issues.push({code:"invalid_value",values:t.values,input:n,inst:e}),r}});var Fl=_("$ZodTransform",(e,t)=>{H.init(e,t),e._zod.parse=(r,o)=>{let n=t.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then(i=>(r.value=i,r));if(n instanceof Promise)throw new et;return r.value=n,r}}),Vl=_("$ZodOptional",(e,t)=>{H.init(e,t),e._zod.optin="optional",e._zod.optout="optional",G(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),G(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Pr(r.source)})?$`):void 0}),e._zod.parse=(r,o)=>t.innerType._zod.optin==="optional"?t.innerType._zod.run(r,o):r.value===void 0?r:t.innerType._zod.run(r,o)}),Hl=_("$ZodNullable",(e,t)=>{H.init(e,t),G(e._zod,"optin",()=>t.innerType._zod.optin),G(e._zod,"optout",()=>t.innerType._zod.optout),G(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Pr(r.source)}|null)$`):void 0}),G(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,o)=>r.value===null?r:t.innerType._zod.run(r,o)}),Bl=_("$ZodDefault",(e,t)=>{H.init(e,t),e._zod.optin="optional",G(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(r.value===void 0)return r.value=t.defaultValue,r;let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>Xu(s,t)):Xu(n,t)}});function Xu(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Kl=_("$ZodPrefault",(e,t)=>{H.init(e,t),e._zod.optin="optional",G(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>(r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,o))}),Wl=_("$ZodNonOptional",(e,t)=>{H.init(e,t),G(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter(o=>o!==void 0)):void 0}),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>el(s,e)):el(n,e)}});function el(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}var Gl=_("$ZodCatch",(e,t)=>{H.init(e,t),e._zod.optin="optional",G(e._zod,"optout",()=>t.innerType._zod.optout),G(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>(r.value=s.value,s.issues.length&&(r.value=t.catchValue({...r,error:{issues:s.issues.map(i=>De(i,o,Ie()))},input:r.value}),r.issues=[]),r)):(r.value=n.value,n.issues.length&&(r.value=t.catchValue({...r,error:{issues:n.issues.map(s=>De(s,o,Ie()))},input:r.value}),r.issues=[]),r)}});var Jl=_("$ZodPipe",(e,t)=>{H.init(e,t),G(e._zod,"values",()=>t.in._zod.values),G(e._zod,"optin",()=>t.in._zod.optin),G(e._zod,"optout",()=>t.out._zod.optout),e._zod.parse=(r,o)=>{let n=t.in._zod.run(r,o);return n instanceof Promise?n.then(s=>tl(s,t,o)):tl(n,t,o)}});function tl(e,t,r){return zt(e)?e:t.out._zod.run({value:e.value,issues:e.issues},r)}var Ql=_("$ZodReadonly",(e,t)=>{H.init(e,t),G(e._zod,"propValues",()=>t.innerType._zod.propValues),G(e._zod,"values",()=>t.innerType._zod.values),G(e._zod,"optin",()=>t.innerType._zod.optin),G(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(rl):rl(n)}});function rl(e){return e.value=Object.freeze(e.value),e}var Yl=_("$ZodCustom",(e,t)=>{_e.init(e,t),H.init(e,t),e._zod.parse=(r,o)=>r,e._zod.check=r=>{let o=r.value,n=t.fn(o);if(n instanceof Promise)return n.then(s=>ol(s,r,o,e));ol(n,r,o,e)}});function ol(e,t,r,o){if(!e){let n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(n.params=o._zod.def.params),t.issues.push(ys(n))}}var T_=e=>{let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"number";case"object":{if(Array.isArray(e))return"array";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},R_=()=>{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"}};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",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"};return o=>{switch(o.code){case"invalid_type":return`Invalid input: expected ${o.expected}, received ${T_(o.input)}`;case"invalid_value":return o.values.length===1?`Invalid input: expected ${Do(o.values[0])}`:`Invalid option: expected one of ${qo(o.values,"|")}`;case"too_big":{let n=o.inclusive?"<=":"<",s=t(o.origin);return s?`Too big: expected ${o.origin??"value"} to have ${n}${o.maximum.toString()} ${s.unit??"elements"}`:`Too big: expected ${o.origin??"value"} to be ${n}${o.maximum.toString()}`}case"too_small":{let n=o.inclusive?">=":">",s=t(o.origin);return s?`Too small: expected ${o.origin} to have ${n}${o.minimum.toString()} ${s.unit}`:`Too small: expected ${o.origin} to be ${n}${o.minimum.toString()}`}case"invalid_format":{let n=o;return n.format==="starts_with"?`Invalid string: must start with "${n.prefix}"`:n.format==="ends_with"?`Invalid string: must end with "${n.suffix}"`:n.format==="includes"?`Invalid string: must include "${n.includes}"`:n.format==="regex"?`Invalid string: must match pattern ${n.pattern}`:`Invalid ${r[n.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":""}: ${qo(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 Xl(){return{localeError:R_()}}var I_=Symbol("ZodOutput"),O_=Symbol("ZodInput"),Is=class{constructor(){this._map=new Map,this._idmap=new Map}add(t,...r){let o=r[0];if(this._map.set(t,o),o&&typeof o=="object"&&"id"in o){if(this._idmap.has(o.id))throw new Error(`ID ${o.id} already exists in the registry`);this._idmap.set(o.id,t)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let o={...this.get(r)??{}};return delete o.id,{...o,...this._map.get(t)}}return this._map.get(t)}has(t){return this._map.has(t)}};function ed(){return new Is}var Wt=ed();function td(e,t){return new e({type:"string",...R(t)})}function rd(e,t){return new e({type:"string",coerce:!0,...R(t)})}function od(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...R(t)})}function Os(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...R(t)})}function nd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...R(t)})}function sd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...R(t)})}function id(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...R(t)})}function ad(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...R(t)})}function Cs(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...R(t)})}function cd(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...R(t)})}function ud(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...R(t)})}function ld(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...R(t)})}function dd(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...R(t)})}function pd(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...R(t)})}function fd(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...R(t)})}function md(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...R(t)})}function hd(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...R(t)})}function gd(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...R(t)})}function _d(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...R(t)})}function yd(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...R(t)})}function vd(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...R(t)})}function $d(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...R(t)})}function wd(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...R(t)})}function xd(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...R(t)})}function bd(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...R(t)})}function zd(e,t){return new e({type:"string",format:"date",check:"string_format",...R(t)})}function Sd(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...R(t)})}function kd(e,t){return new e({type:"string",format:"duration",check:"string_format",...R(t)})}function Pd(e,t){return new e({type:"number",checks:[],...R(t)})}function Ed(e,t){return new e({type:"number",coerce:!0,checks:[],...R(t)})}function Td(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...R(t)})}function Rd(e,t){return new e({type:"boolean",...R(t)})}function Id(e,t){return new e({type:"boolean",coerce:!0,...R(t)})}function Od(e,t){return new e({type:"bigint",coerce:!0,...R(t)})}function Cd(e,t){return new e({type:"null",...R(t)})}function Ad(e){return new e({type:"any"})}function Nd(e){return new e({type:"unknown"})}function jd(e,t){return new e({type:"never",...R(t)})}function Zd(e,t){return new e({type:"date",coerce:!0,...R(t)})}function Gt(e,t){return new ks({check:"less_than",...R(t),value:e,inclusive:!1})}function tt(e,t){return new ks({check:"less_than",...R(t),value:e,inclusive:!0})}function Jt(e,t){return new Ps({check:"greater_than",...R(t),value:e,inclusive:!1})}function Ue(e,t){return new Ps({check:"greater_than",...R(t),value:e,inclusive:!0})}function Ir(e,t){return new Nu({check:"multiple_of",...R(t),value:e})}function Ko(e,t){return new Zu({check:"max_length",...R(t),maximum:e})}function Qt(e,t){return new qu({check:"min_length",...R(t),minimum:e})}function Wo(e,t){return new Mu({check:"length_equals",...R(t),length:e})}function As(e,t){return new Du({check:"string_format",format:"regex",...R(t),pattern:e})}function Ns(e){return new Uu({check:"string_format",format:"lowercase",...R(e)})}function js(e){return new Lu({check:"string_format",format:"uppercase",...R(e)})}function Zs(e,t){return new Fu({check:"string_format",format:"includes",...R(t),includes:e})}function qs(e,t){return new Vu({check:"string_format",format:"starts_with",...R(t),prefix:e})}function Ms(e,t){return new Hu({check:"string_format",format:"ends_with",...R(t),suffix:e})}function St(e){return new Bu({check:"overwrite",tx:e})}function Ds(e){return St(t=>t.normalize(e))}function Us(){return St(e=>e.trim())}function Ls(){return St(e=>e.toLowerCase())}function Fs(){return St(e=>e.toUpperCase())}function qd(e,t,r){return new e({type:"array",element:t,...R(r)})}function Md(e,t,r){let o=R(r);return o.abort??(o.abort=!0),new e({type:"custom",check:"custom",fn:t,...o})}function Dd(e,t,r){return new e({type:"custom",check:"custom",fn:t,...R(r)})}function Go(e){return!!e._zod}function Le(e,t){return Go(e)?Tr(e,t):e.safeParse(t)}function Jo(e){if(!e)return;let t;if(Go(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function Qo(e){if(Go(e)){let s=e._zod?.def;if(s){if(s.value!==void 0)return s.value;if(Array.isArray(s.values)&&s.values.length>0)return s.values[0]}}let r=e._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let o=e.value;if(o!==void 0)return o}var Or={};is(Or,{ZodISODate:()=>Ld,ZodISODateTime:()=>Ud,ZodISODuration:()=>Vd,ZodISOTime:()=>Fd,date:()=>Hs,datetime:()=>Vs,duration:()=>Ks,time:()=>Bs});var Ud=_("ZodISODateTime",(e,t)=>{hl.init(e,t),oe.init(e,t)});function Vs(e){return bd(Ud,e)}var Ld=_("ZodISODate",(e,t)=>{gl.init(e,t),oe.init(e,t)});function Hs(e){return zd(Ld,e)}var Fd=_("ZodISOTime",(e,t)=>{_l.init(e,t),oe.init(e,t)});function Bs(e){return Sd(Fd,e)}var Vd=_("ZodISODuration",(e,t)=>{yl.init(e,t),oe.init(e,t)});function Ks(e){return kd(Vd,e)}var Bd=(e,t)=>{Uo.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>ws(e,r)},flatten:{value:r=>$s(e,r)},addIssue:{value:r=>e.issues.push(r)},addIssues:{value:r=>e.issues.push(...r)},isEmpty:{get(){return e.issues.length===0}}})},PP=_("ZodError",Bd),Cr=_("ZodError",Bd,{Parent:Error});var Kd=ru(Cr),Wd=ou(Cr),Gd=xs(Cr),Jd=bs(Cr);var J=_("ZodType",(e,t)=>(H.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),e.clone=(r,o)=>Me(e,r,o),e.brand=()=>e,e.register=((r,o)=>(r.add(e,o),e)),e.parse=(r,o)=>Kd(e,r,o,{callee:e.parse}),e.safeParse=(r,o)=>Gd(e,r,o),e.parseAsync=async(r,o)=>Wd(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>Jd(e,r,o),e.spa=e.safeParseAsync,e.refine=(r,o)=>e.check(ky(r,o)),e.superRefine=r=>e.check(Py(r)),e.overwrite=r=>e.check(St(r)),e.optional=()=>se(e),e.nullable=()=>Xd(e),e.nullish=()=>se(Xd(e)),e.nonoptional=r=>vy(e,r),e.array=()=>S(e),e.or=r=>X([e,r]),e.and=r=>en(e,r),e.transform=r=>Gs(e,up(r)),e.default=r=>gy(e,r),e.prefault=r=>yy(e,r),e.catch=r=>wy(e,r),e.pipe=r=>Gs(e,r),e.readonly=()=>zy(e),e.describe=r=>{let o=e.clone();return Wt.add(o,{description:r}),o},Object.defineProperty(e,"description",{get(){return Wt.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Wt.get(e);let o=e.clone();return Wt.add(o,r[0]),o},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),ep=_("_ZodString",(e,t)=>{Bo.init(e,t),J.init(e,t);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...o)=>e.check(As(...o)),e.includes=(...o)=>e.check(Zs(...o)),e.startsWith=(...o)=>e.check(qs(...o)),e.endsWith=(...o)=>e.check(Ms(...o)),e.min=(...o)=>e.check(Qt(...o)),e.max=(...o)=>e.check(Ko(...o)),e.length=(...o)=>e.check(Wo(...o)),e.nonempty=(...o)=>e.check(Qt(1,...o)),e.lowercase=o=>e.check(Ns(o)),e.uppercase=o=>e.check(js(o)),e.trim=()=>e.check(Us()),e.normalize=(...o)=>e.check(Ds(...o)),e.toLowerCase=()=>e.check(Ls()),e.toUpperCase=()=>e.check(Fs())}),Js=_("ZodString",(e,t)=>{Bo.init(e,t),ep.init(e,t),e.email=r=>e.check(od(D_,r)),e.url=r=>e.check(Cs(tp,r)),e.jwt=r=>e.check(xd(ty,r)),e.emoji=r=>e.check(cd(U_,r)),e.guid=r=>e.check(Os(Qd,r)),e.uuid=r=>e.check(nd(Yo,r)),e.uuidv4=r=>e.check(sd(Yo,r)),e.uuidv6=r=>e.check(id(Yo,r)),e.uuidv7=r=>e.check(ad(Yo,r)),e.nanoid=r=>e.check(ud(L_,r)),e.guid=r=>e.check(Os(Qd,r)),e.cuid=r=>e.check(ld(F_,r)),e.cuid2=r=>e.check(dd(V_,r)),e.ulid=r=>e.check(pd(H_,r)),e.base64=r=>e.check(vd(Y_,r)),e.base64url=r=>e.check($d(X_,r)),e.xid=r=>e.check(fd(B_,r)),e.ksuid=r=>e.check(md(K_,r)),e.ipv4=r=>e.check(hd(W_,r)),e.ipv6=r=>e.check(gd(G_,r)),e.cidrv4=r=>e.check(_d(J_,r)),e.cidrv6=r=>e.check(yd(Q_,r)),e.e164=r=>e.check(wd(ey,r)),e.datetime=r=>e.check(Vs(r)),e.date=r=>e.check(Hs(r)),e.time=r=>e.check(Bs(r)),e.duration=r=>e.check(Ks(r))});function p(e){return td(Js,e)}var oe=_("ZodStringFormat",(e,t)=>{Y.init(e,t),ep.init(e,t)}),D_=_("ZodEmail",(e,t)=>{il.init(e,t),oe.init(e,t)});var Qd=_("ZodGUID",(e,t)=>{nl.init(e,t),oe.init(e,t)});var Yo=_("ZodUUID",(e,t)=>{sl.init(e,t),oe.init(e,t)});var tp=_("ZodURL",(e,t)=>{al.init(e,t),oe.init(e,t)});function rp(e){return Cs(tp,e)}var U_=_("ZodEmoji",(e,t)=>{cl.init(e,t),oe.init(e,t)});var L_=_("ZodNanoID",(e,t)=>{ul.init(e,t),oe.init(e,t)});var F_=_("ZodCUID",(e,t)=>{ll.init(e,t),oe.init(e,t)});var V_=_("ZodCUID2",(e,t)=>{dl.init(e,t),oe.init(e,t)});var H_=_("ZodULID",(e,t)=>{pl.init(e,t),oe.init(e,t)});var B_=_("ZodXID",(e,t)=>{fl.init(e,t),oe.init(e,t)});var K_=_("ZodKSUID",(e,t)=>{ml.init(e,t),oe.init(e,t)});var W_=_("ZodIPv4",(e,t)=>{vl.init(e,t),oe.init(e,t)});var G_=_("ZodIPv6",(e,t)=>{$l.init(e,t),oe.init(e,t)});var J_=_("ZodCIDRv4",(e,t)=>{wl.init(e,t),oe.init(e,t)});var Q_=_("ZodCIDRv6",(e,t)=>{xl.init(e,t),oe.init(e,t)});var Y_=_("ZodBase64",(e,t)=>{zl.init(e,t),oe.init(e,t)});var X_=_("ZodBase64URL",(e,t)=>{Sl.init(e,t),oe.init(e,t)});var ey=_("ZodE164",(e,t)=>{kl.init(e,t),oe.init(e,t)});var ty=_("ZodJWT",(e,t)=>{Pl.init(e,t),oe.init(e,t)});var Xo=_("ZodNumber",(e,t)=>{Ts.init(e,t),J.init(e,t),e.gt=(o,n)=>e.check(Jt(o,n)),e.gte=(o,n)=>e.check(Ue(o,n)),e.min=(o,n)=>e.check(Ue(o,n)),e.lt=(o,n)=>e.check(Gt(o,n)),e.lte=(o,n)=>e.check(tt(o,n)),e.max=(o,n)=>e.check(tt(o,n)),e.int=o=>e.check(Yd(o)),e.safe=o=>e.check(Yd(o)),e.positive=o=>e.check(Jt(0,o)),e.nonnegative=o=>e.check(Ue(0,o)),e.negative=o=>e.check(Gt(0,o)),e.nonpositive=o=>e.check(tt(0,o)),e.multipleOf=(o,n)=>e.check(Ir(o,n)),e.step=(o,n)=>e.check(Ir(o,n)),e.finite=()=>e;let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function L(e){return Pd(Xo,e)}var ry=_("ZodNumberFormat",(e,t)=>{El.init(e,t),Xo.init(e,t)});function Yd(e){return Td(ry,e)}var Qs=_("ZodBoolean",(e,t)=>{Tl.init(e,t),J.init(e,t)});function K(e){return Rd(Qs,e)}var op=_("ZodBigInt",(e,t)=>{Rl.init(e,t),J.init(e,t),e.gte=(o,n)=>e.check(Ue(o,n)),e.min=(o,n)=>e.check(Ue(o,n)),e.gt=(o,n)=>e.check(Jt(o,n)),e.gte=(o,n)=>e.check(Ue(o,n)),e.min=(o,n)=>e.check(Ue(o,n)),e.lt=(o,n)=>e.check(Gt(o,n)),e.lte=(o,n)=>e.check(tt(o,n)),e.max=(o,n)=>e.check(tt(o,n)),e.positive=o=>e.check(Jt(BigInt(0),o)),e.negative=o=>e.check(Gt(BigInt(0),o)),e.nonpositive=o=>e.check(tt(BigInt(0),o)),e.nonnegative=o=>e.check(Ue(BigInt(0),o)),e.multipleOf=(o,n)=>e.check(Ir(o,n));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});var oy=_("ZodNull",(e,t)=>{Il.init(e,t),J.init(e,t)});function np(e){return Cd(oy,e)}var ny=_("ZodAny",(e,t)=>{Ol.init(e,t),J.init(e,t)});function sp(){return Ad(ny)}var sy=_("ZodUnknown",(e,t)=>{Cl.init(e,t),J.init(e,t)});function ne(){return Nd(sy)}var iy=_("ZodNever",(e,t)=>{Al.init(e,t),J.init(e,t)});function ay(e){return jd(iy,e)}var ip=_("ZodDate",(e,t)=>{Nl.init(e,t),J.init(e,t),e.min=(o,n)=>e.check(Ue(o,n)),e.max=(o,n)=>e.check(tt(o,n));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});var cy=_("ZodArray",(e,t)=>{jl.init(e,t),J.init(e,t),e.element=t.element,e.min=(r,o)=>e.check(Qt(r,o)),e.nonempty=r=>e.check(Qt(1,r)),e.max=(r,o)=>e.check(Ko(r,o)),e.length=(r,o)=>e.check(Wo(r,o)),e.unwrap=()=>e.element});function S(e,t){return qd(cy,e,t)}var ap=_("ZodObject",(e,t)=>{Zl.init(e,t),J.init(e,t),V.defineLazy(e,"shape",()=>t.shape),e.keyof=()=>Se(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ne()}),e.loose=()=>e.clone({...e._zod.def,catchall:ne()}),e.strict=()=>e.clone({...e._zod.def,catchall:ay()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>V.extend(e,r),e.merge=r=>V.merge(e,r),e.pick=r=>V.pick(e,r),e.omit=r=>V.omit(e,r),e.partial=(...r)=>V.partial(lp,e,r[0]),e.required=(...r)=>V.required(dp,e,r[0])});function k(e,t){let r={type:"object",get shape(){return V.assignProp(this,"shape",{...e}),this.shape},...V.normalizeParams(t)};return new ap(r)}function ue(e,t){return new ap({type:"object",get shape(){return V.assignProp(this,"shape",{...e}),this.shape},catchall:ne(),...V.normalizeParams(t)})}var cp=_("ZodUnion",(e,t)=>{Rs.init(e,t),J.init(e,t),e.options=t.options});function X(e,t){return new cp({type:"union",options:e,...V.normalizeParams(t)})}var uy=_("ZodDiscriminatedUnion",(e,t)=>{cp.init(e,t),ql.init(e,t)});function Ys(e,t,r){return new uy({type:"union",options:t,discriminator:e,...V.normalizeParams(r)})}var ly=_("ZodIntersection",(e,t)=>{Ml.init(e,t),J.init(e,t)});function en(e,t){return new ly({type:"intersection",left:e,right:t})}var dy=_("ZodRecord",(e,t)=>{Dl.init(e,t),J.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function Q(e,t,r){return new dy({type:"record",keyType:e,valueType:t,...V.normalizeParams(r)})}var Ws=_("ZodEnum",(e,t)=>{Ul.init(e,t),J.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(o,n)=>{let s={};for(let i of o)if(r.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new Ws({...t,checks:[],...V.normalizeParams(n),entries:s})},e.exclude=(o,n)=>{let s={...t.entries};for(let i of o)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new Ws({...t,checks:[],...V.normalizeParams(n),entries:s})}});function Se(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new Ws({type:"enum",entries:r,...V.normalizeParams(t)})}var py=_("ZodLiteral",(e,t)=>{Ll.init(e,t),J.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function E(e,t){return new py({type:"literal",values:Array.isArray(e)?e:[e],...V.normalizeParams(t)})}var fy=_("ZodTransform",(e,t)=>{Fl.init(e,t),J.init(e,t),e._zod.parse=(r,o)=>{r.addIssue=s=>{if(typeof s=="string")r.issues.push(V.issue(s,r.value,t));else{let i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),i.continue??(i.continue=!0),r.issues.push(V.issue(i))}};let n=t.transform(r.value,r);return n instanceof Promise?n.then(s=>(r.value=s,r)):(r.value=n,r)}});function up(e){return new fy({type:"transform",transform:e})}var lp=_("ZodOptional",(e,t)=>{Vl.init(e,t),J.init(e,t),e.unwrap=()=>e._zod.def.innerType});function se(e){return new lp({type:"optional",innerType:e})}var my=_("ZodNullable",(e,t)=>{Hl.init(e,t),J.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Xd(e){return new my({type:"nullable",innerType:e})}var hy=_("ZodDefault",(e,t)=>{Bl.init(e,t),J.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function gy(e,t){return new hy({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}var _y=_("ZodPrefault",(e,t)=>{Kl.init(e,t),J.init(e,t),e.unwrap=()=>e._zod.def.innerType});function yy(e,t){return new _y({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}var dp=_("ZodNonOptional",(e,t)=>{Wl.init(e,t),J.init(e,t),e.unwrap=()=>e._zod.def.innerType});function vy(e,t){return new dp({type:"nonoptional",innerType:e,...V.normalizeParams(t)})}var $y=_("ZodCatch",(e,t)=>{Gl.init(e,t),J.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function wy(e,t){return new $y({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var xy=_("ZodPipe",(e,t)=>{Jl.init(e,t),J.init(e,t),e.in=t.in,e.out=t.out});function Gs(e,t){return new xy({type:"pipe",in:e,out:t})}var by=_("ZodReadonly",(e,t)=>{Ql.init(e,t),J.init(e,t)});function zy(e){return new by({type:"readonly",innerType:e})}var pp=_("ZodCustom",(e,t)=>{Yl.init(e,t),J.init(e,t)});function Sy(e){let t=new _e({check:"custom"});return t._zod.check=e,t}function fp(e,t){return Md(pp,e??(()=>!0),t)}function ky(e,t={}){return Dd(pp,e,t)}function Py(e){let t=Sy(r=>(r.addIssue=o=>{if(typeof o=="string")r.issues.push(V.issue(o,r.value,t._zod.def));else{let n=o;n.fatal&&(n.continue=!1),n.code??(n.code="custom"),n.input??(n.input=r.value),n.inst??(n.inst=t),n.continue??(n.continue=!t._zod.def.abort),r.issues.push(V.issue(n))}},e(r.value,r)));return t}function Xs(e,t){return Gs(up(e),t)}var mp={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 tn={};is(tn,{bigint:()=>Iy,boolean:()=>Ry,date:()=>Oy,number:()=>Ty,string:()=>Ey});function Ey(e){return rd(Js,e)}function Ty(e){return Ed(Xo,e)}function Ry(e){return Id(Qs,e)}function Iy(e){return Od(op,e)}function Oy(e){return Zd(ip,e)}Ie(Xl());var er="2025-11-25";var hp=[er,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],pt="io.modelcontextprotocol/related-task",on="2.0",le=fp(e=>e!==null&&(typeof e=="object"||typeof e=="function")),gp=X([p(),L().int()]),_p=p(),wE=ue({ttl:L().optional(),pollInterval:L().optional()}),Ay=k({ttl:L().optional()}),Ny=k({taskId:p()}),ti=ue({progressToken:gp.optional(),[pt]:Ny.optional()}),Oe=k({_meta:ti.optional()}),Ar=Oe.extend({task:Ay.optional()}),yp=e=>Ar.safeParse(e).success,de=k({method:p(),params:Oe.loose().optional()}),Ce=k({_meta:ti.optional()}),Ae=k({method:p(),params:Ce.loose().optional()}),pe=ue({_meta:ti.optional()}),nn=X([p(),L().int()]),vp=k({jsonrpc:E(on),id:nn,...de.shape}).strict(),Nr=e=>vp.safeParse(e).success,$p=k({jsonrpc:E(on),...Ae.shape}).strict(),wp=e=>$p.safeParse(e).success,ri=k({jsonrpc:E(on),id:nn,result:pe}).strict(),kt=e=>ri.safeParse(e).success;var O;(function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(O||(O={}));var oi=k({jsonrpc:E(on),id:nn.optional(),error:k({code:L().int(),message:p(),data:ne().optional()})}).strict();var xp=e=>oi.safeParse(e).success;var tr=X([vp,$p,ri,oi]),xE=X([ri,oi]),Pt=pe.strict(),jy=Ce.extend({requestId:nn.optional(),reason:p().optional()}),sn=Ae.extend({method:E("notifications/cancelled"),params:jy}),Zy=k({src:p(),mimeType:p().optional(),sizes:S(p()).optional(),theme:Se(["light","dark"]).optional()}),jr=k({icons:S(Zy).optional()}),Xt=k({name:p(),title:p().optional()}),bp=Xt.extend({...Xt.shape,...jr.shape,version:p(),websiteUrl:p().optional(),description:p().optional()}),qy=en(k({applyDefaults:K().optional()}),Q(p(),ne())),My=Xs(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,en(k({form:qy.optional(),url:le.optional()}),Q(p(),ne()).optional())),Dy=ue({list:le.optional(),cancel:le.optional(),requests:ue({sampling:ue({createMessage:le.optional()}).optional(),elicitation:ue({create:le.optional()}).optional()}).optional()}),Uy=ue({list:le.optional(),cancel:le.optional(),requests:ue({tools:ue({call:le.optional()}).optional()}).optional()}),Ly=k({experimental:Q(p(),le).optional(),sampling:k({context:le.optional(),tools:le.optional()}).optional(),elicitation:My.optional(),roots:k({listChanged:K().optional()}).optional(),tasks:Dy.optional(),extensions:Q(p(),le).optional()}),Fy=Oe.extend({protocolVersion:p(),capabilities:Ly,clientInfo:bp}),Vy=de.extend({method:E("initialize"),params:Fy});var Hy=k({experimental:Q(p(),le).optional(),logging:le.optional(),completions:le.optional(),prompts:k({listChanged:K().optional()}).optional(),resources:k({subscribe:K().optional(),listChanged:K().optional()}).optional(),tools:k({listChanged:K().optional()}).optional(),tasks:Uy.optional(),extensions:Q(p(),le).optional()}),ni=pe.extend({protocolVersion:p(),capabilities:Hy,serverInfo:bp,instructions:p().optional()}),zp=Ae.extend({method:E("notifications/initialized"),params:Ce.optional()}),Sp=e=>zp.safeParse(e).success,an=de.extend({method:E("ping"),params:Oe.optional()}),By=k({progress:L(),total:se(L()),message:se(p())}),Ky=k({...Ce.shape,...By.shape,progressToken:gp}),cn=Ae.extend({method:E("notifications/progress"),params:Ky}),Wy=Oe.extend({cursor:_p.optional()}),Zr=de.extend({params:Wy.optional()}),qr=pe.extend({nextCursor:_p.optional()}),Gy=Se(["working","input_required","completed","failed","cancelled"]),Mr=k({taskId:p(),status:Gy,ttl:X([L(),np()]),createdAt:p(),lastUpdatedAt:p(),pollInterval:se(L()),statusMessage:se(p())}),Et=pe.extend({task:Mr}),Jy=Ce.merge(Mr),Dr=Ae.extend({method:E("notifications/tasks/status"),params:Jy}),un=de.extend({method:E("tasks/get"),params:Oe.extend({taskId:p()})}),ln=pe.merge(Mr),dn=de.extend({method:E("tasks/result"),params:Oe.extend({taskId:p()})}),bE=pe.loose(),pn=Zr.extend({method:E("tasks/list")}),fn=qr.extend({tasks:S(Mr)}),mn=de.extend({method:E("tasks/cancel"),params:Oe.extend({taskId:p()})}),kp=pe.merge(Mr),Pp=k({uri:p(),mimeType:se(p()),_meta:Q(p(),ne()).optional()}),Ep=Pp.extend({text:p()}),si=p().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Tp=Pp.extend({blob:si}),Ur=Se(["user","assistant"]),rr=k({audience:S(Ur).optional(),priority:L().min(0).max(1).optional(),lastModified:Or.datetime({offset:!0}).optional()}),Rp=k({...Xt.shape,...jr.shape,uri:p(),description:se(p()),mimeType:se(p()),size:se(L()),annotations:rr.optional(),_meta:se(ue({}))}),Qy=k({...Xt.shape,...jr.shape,uriTemplate:p(),description:se(p()),mimeType:se(p()),annotations:rr.optional(),_meta:se(ue({}))}),Yy=Zr.extend({method:E("resources/list")}),ii=qr.extend({resources:S(Rp)}),Xy=Zr.extend({method:E("resources/templates/list")}),ai=qr.extend({resourceTemplates:S(Qy)}),ci=Oe.extend({uri:p()}),ev=ci,tv=de.extend({method:E("resources/read"),params:ev}),ui=pe.extend({contents:S(X([Ep,Tp]))}),li=Ae.extend({method:E("notifications/resources/list_changed"),params:Ce.optional()}),rv=ci,ov=de.extend({method:E("resources/subscribe"),params:rv}),nv=ci,sv=de.extend({method:E("resources/unsubscribe"),params:nv}),iv=Ce.extend({uri:p()}),av=Ae.extend({method:E("notifications/resources/updated"),params:iv}),cv=k({name:p(),description:se(p()),required:se(K())}),uv=k({...Xt.shape,...jr.shape,description:se(p()),arguments:se(S(cv)),_meta:se(ue({}))}),lv=Zr.extend({method:E("prompts/list")}),di=qr.extend({prompts:S(uv)}),dv=Oe.extend({name:p(),arguments:Q(p(),p()).optional()}),pv=de.extend({method:E("prompts/get"),params:dv}),pi=k({type:E("text"),text:p(),annotations:rr.optional(),_meta:Q(p(),ne()).optional()}),fi=k({type:E("image"),data:si,mimeType:p(),annotations:rr.optional(),_meta:Q(p(),ne()).optional()}),mi=k({type:E("audio"),data:si,mimeType:p(),annotations:rr.optional(),_meta:Q(p(),ne()).optional()}),fv=k({type:E("tool_use"),name:p(),id:p(),input:Q(p(),ne()),_meta:Q(p(),ne()).optional()}),mv=k({type:E("resource"),resource:X([Ep,Tp]),annotations:rr.optional(),_meta:Q(p(),ne()).optional()}),hv=Rp.extend({type:E("resource_link")}),hi=X([pi,fi,mi,hv,mv]),gv=k({role:Ur,content:hi}),gi=pe.extend({description:p().optional(),messages:S(gv)}),_i=Ae.extend({method:E("notifications/prompts/list_changed"),params:Ce.optional()}),_v=k({title:p().optional(),readOnlyHint:K().optional(),destructiveHint:K().optional(),idempotentHint:K().optional(),openWorldHint:K().optional()}),yv=k({taskSupport:Se(["required","optional","forbidden"]).optional()}),Ip=k({...Xt.shape,...jr.shape,description:p().optional(),inputSchema:k({type:E("object"),properties:Q(p(),le).optional(),required:S(p()).optional()}).catchall(ne()),outputSchema:k({type:E("object"),properties:Q(p(),le).optional(),required:S(p()).optional()}).catchall(ne()).optional(),annotations:_v.optional(),execution:yv.optional(),_meta:Q(p(),ne()).optional()}),vv=Zr.extend({method:E("tools/list")}),yi=qr.extend({tools:S(Ip)}),or=pe.extend({content:S(hi).default([]),structuredContent:Q(p(),ne()).optional(),isError:K().optional()}),zE=or.or(pe.extend({toolResult:ne()})),$v=Ar.extend({name:p(),arguments:Q(p(),ne()).optional()}),wv=de.extend({method:E("tools/call"),params:$v}),vi=Ae.extend({method:E("notifications/tools/list_changed"),params:Ce.optional()}),Op=k({autoRefresh:K().default(!0),debounceMs:L().int().nonnegative().default(300)}),Cp=Se(["debug","info","notice","warning","error","critical","alert","emergency"]),xv=Oe.extend({level:Cp}),bv=de.extend({method:E("logging/setLevel"),params:xv}),zv=Ce.extend({level:Cp,logger:p().optional(),data:ne()}),Sv=Ae.extend({method:E("notifications/message"),params:zv}),kv=k({name:p().optional()}),Pv=k({hints:S(kv).optional(),costPriority:L().min(0).max(1).optional(),speedPriority:L().min(0).max(1).optional(),intelligencePriority:L().min(0).max(1).optional()}),Ev=k({mode:Se(["auto","required","none"]).optional()}),Tv=k({type:E("tool_result"),toolUseId:p().describe("The unique identifier for the corresponding tool call."),content:S(hi).default([]),structuredContent:k({}).loose().optional(),isError:K().optional(),_meta:Q(p(),ne()).optional()}),Rv=Ys("type",[pi,fi,mi]),rn=Ys("type",[pi,fi,mi,fv,Tv]),Iv=k({role:Ur,content:X([rn,S(rn)]),_meta:Q(p(),ne()).optional()}),Ov=Ar.extend({messages:S(Iv),modelPreferences:Pv.optional(),systemPrompt:p().optional(),includeContext:Se(["none","thisServer","allServers"]).optional(),temperature:L().optional(),maxTokens:L().int(),stopSequences:S(p()).optional(),metadata:le.optional(),tools:S(Ip).optional(),toolChoice:Ev.optional()}),$i=de.extend({method:E("sampling/createMessage"),params:Ov}),wi=pe.extend({model:p(),stopReason:se(Se(["endTurn","stopSequence","maxTokens"]).or(p())),role:Ur,content:Rv}),xi=pe.extend({model:p(),stopReason:se(Se(["endTurn","stopSequence","maxTokens","toolUse"]).or(p())),role:Ur,content:X([rn,S(rn)])}),Cv=k({type:E("boolean"),title:p().optional(),description:p().optional(),default:K().optional()}),Av=k({type:E("string"),title:p().optional(),description:p().optional(),minLength:L().optional(),maxLength:L().optional(),format:Se(["email","uri","date","date-time"]).optional(),default:p().optional()}),Nv=k({type:Se(["number","integer"]),title:p().optional(),description:p().optional(),minimum:L().optional(),maximum:L().optional(),default:L().optional()}),jv=k({type:E("string"),title:p().optional(),description:p().optional(),enum:S(p()),default:p().optional()}),Zv=k({type:E("string"),title:p().optional(),description:p().optional(),oneOf:S(k({const:p(),title:p()})),default:p().optional()}),qv=k({type:E("string"),title:p().optional(),description:p().optional(),enum:S(p()),enumNames:S(p()).optional(),default:p().optional()}),Mv=X([jv,Zv]),Dv=k({type:E("array"),title:p().optional(),description:p().optional(),minItems:L().optional(),maxItems:L().optional(),items:k({type:E("string"),enum:S(p())}),default:S(p()).optional()}),Uv=k({type:E("array"),title:p().optional(),description:p().optional(),minItems:L().optional(),maxItems:L().optional(),items:k({anyOf:S(k({const:p(),title:p()}))}),default:S(p()).optional()}),Lv=X([Dv,Uv]),Fv=X([qv,Mv,Lv]),Vv=X([Fv,Cv,Av,Nv]),Hv=Ar.extend({mode:E("form").optional(),message:p(),requestedSchema:k({type:E("object"),properties:Q(p(),Vv),required:S(p()).optional()})}),Bv=Ar.extend({mode:E("url"),message:p(),elicitationId:p(),url:p().url()}),Kv=X([Hv,Bv]),bi=de.extend({method:E("elicitation/create"),params:Kv}),Wv=Ce.extend({elicitationId:p()}),Gv=Ae.extend({method:E("notifications/elicitation/complete"),params:Wv}),zi=pe.extend({action:Se(["accept","decline","cancel"]),content:Xs(e=>e===null?void 0:e,Q(p(),X([p(),L(),K(),S(p())])).optional())}),Jv=k({type:E("ref/resource"),uri:p()});var Qv=k({type:E("ref/prompt"),name:p()}),Yv=Oe.extend({ref:X([Qv,Jv]),argument:k({name:p(),value:p()}),context:k({arguments:Q(p(),p()).optional()}).optional()}),Xv=de.extend({method:E("completion/complete"),params:Yv});var Si=pe.extend({completion:ue({values:S(p()).max(100),total:se(L().int()),hasMore:se(K())})}),e0=k({uri:p().startsWith("file://"),name:p().optional(),_meta:Q(p(),ne()).optional()}),t0=de.extend({method:E("roots/list"),params:Oe.optional()}),r0=pe.extend({roots:S(e0)}),o0=Ae.extend({method:E("notifications/roots/list_changed"),params:Ce.optional()}),SE=X([an,Vy,Xv,bv,pv,lv,Yy,Xy,tv,ov,sv,wv,vv,un,dn,pn,mn]),kE=X([sn,cn,zp,o0,Dr]),PE=X([Pt,wi,xi,zi,r0,ln,fn,Et]),EE=X([an,$i,bi,t0,un,dn,pn,mn]),TE=X([sn,cn,Sv,av,li,vi,_i,Dr,Gv]),RE=X([Pt,ni,Si,gi,di,ii,ai,ui,or,yi,ln,fn,Et]),I=class e extends Error{constructor(t,r,o){super(`MCP error ${t}: ${r}`),this.code=t,this.data=o,this.name="McpError"}static fromError(t,r,o){if(t===O.UrlElicitationRequired&&o){let n=o;if(n.elicitations)return new ei(n.elicitations,r)}return new e(t,r,o)}},ei=class extends I{constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(O.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}};function ft(e){return e==="completed"||e==="failed"||e==="cancelled"}var n0=Symbol("Let zodToJsonSchema decide on which parser to use");var uT=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function ki(e){let r=Jo(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let o=Qo(r);if(typeof o!="string")throw new Error("Schema method literal must be a string");return o}function Pi(e,t){let r=Le(e,t);if(!r.success)throw r.error;return r.data}var l0=6e4,hn=class{constructor(t){this._options=t,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(sn,r=>{this._oncancel(r)}),this.setNotificationHandler(cn,r=>{this._onprogress(r)}),this.setRequestHandler(an,r=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(un,async(r,o)=>{let n=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!n)throw new I(O.InvalidParams,"Failed to retrieve task: Task not found");return{...n}}),this.setRequestHandler(dn,async(r,o)=>{let n=async()=>{let s=r.params.taskId;if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(s,o.sessionId);){if(a.type==="response"||a.type==="error"){let c=a.message,l=c.id,u=this._requestResolvers.get(l);if(u)if(this._requestResolvers.delete(l),a.type==="response")u(c);else{let d=c,m=new I(d.error.code,d.error.message,d.error.data);u(m)}else{let d=a.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${l}`))}continue}await this._transport?.send(a.message,{relatedRequestId:o.requestId})}}let i=await this._taskStore.getTask(s,o.sessionId);if(!i)throw new I(O.InvalidParams,`Task not found: ${s}`);if(!ft(i.status))return await this._waitForTaskUpdate(s,o.signal),await n();if(ft(i.status)){let a=await this._taskStore.getTaskResult(s,o.sessionId);return this._clearTaskQueue(s),{...a,_meta:{...a._meta,[pt]:{taskId:s}}}}return await n()};return await n()}),this.setRequestHandler(pn,async(r,o)=>{try{let{tasks:n,nextCursor:s}=await this._taskStore.listTasks(r.params?.cursor,o.sessionId);return{tasks:n,nextCursor:s,_meta:{}}}catch(n){throw new I(O.InvalidParams,`Failed to list tasks: ${n instanceof Error?n.message:String(n)}`)}}),this.setRequestHandler(mn,async(r,o)=>{try{let n=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!n)throw new I(O.InvalidParams,`Task not found: ${r.params.taskId}`);if(ft(n.status))throw new I(O.InvalidParams,`Cannot cancel task in terminal status: ${n.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",o.sessionId),this._clearTaskQueue(r.params.taskId);let s=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!s)throw new I(O.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...s}}catch(n){throw n instanceof I?n:new I(O.InvalidRequest,`Failed to cancel task: ${n instanceof Error?n.message:String(n)}`)}}))}async _oncancel(t){if(!t.params.requestId)return;this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,r,o,n,s=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(n,r),startTime:Date.now(),timeout:r,maxTotalTimeout:o,resetTimeoutOnProgress:s,onTimeout:n})}_resetTimeout(t){let r=this._timeoutInfo.get(t);if(!r)return!1;let o=Date.now()-r.startTime;if(r.maxTotalTimeout&&o>=r.maxTotalTimeout)throw this._timeoutInfo.delete(t),I.fromError(O.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:o});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(t){let r=this._timeoutInfo.get(t);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(t))}async connect(t){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=t;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let o=this.transport?.onerror;this._transport.onerror=s=>{o?.(s),this._onerror(s)};let n=this._transport?.onmessage;this._transport.onmessage=(s,i)=>{n?.(s,i),kt(s)||xp(s)?this._onresponse(s):Nr(s)?this._onrequest(s,i):wp(s)?this._onnotification(s):this._onerror(new Error(`Unknown message type: ${JSON.stringify(s)}`))},await this._transport.start()}_onclose(){let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let o of this._timeoutInfo.values())clearTimeout(o.timeoutId);this._timeoutInfo.clear();for(let o of this._requestHandlerAbortControllers.values())o.abort();this._requestHandlerAbortControllers.clear();let r=I.fromError(O.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let o of t.values())o(r)}_onerror(t){this.onerror?.(t)}_onnotification(t){let r=this._notificationHandlers.get(t.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(t)).catch(o=>this._onerror(new Error(`Uncaught error in notification handler: ${o}`)))}_onrequest(t,r){let o=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,n=this._transport,s=t.params?._meta?.[pt]?.taskId;if(o===void 0){let u={jsonrpc:"2.0",id:t.id,error:{code:O.MethodNotFound,message:"Method not found"}};s&&this._taskMessageQueue?this._enqueueTaskMessage(s,{type:"error",message:u,timestamp:Date.now()},n?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):n?.send(u).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let i=new AbortController;this._requestHandlerAbortControllers.set(t.id,i);let a=yp(t.params)?t.params.task:void 0,c=this._taskStore?this.requestTaskStore(t,n?.sessionId):void 0,l={signal:i.signal,sessionId:n?.sessionId,_meta:t.params?._meta,sendNotification:async u=>{if(i.signal.aborted)return;let d={relatedRequestId:t.id};s&&(d.relatedTask={taskId:s}),await this.notification(u,d)},sendRequest:async(u,d,m)=>{if(i.signal.aborted)throw new I(O.ConnectionClosed,"Request was cancelled");let f={...m,relatedRequestId:t.id};s&&!f.relatedTask&&(f.relatedTask={taskId:s});let g=f.relatedTask?.taskId??s;return g&&c&&await c.updateTaskStatus(g,"input_required"),await this.request(u,d,f)},authInfo:r?.authInfo,requestId:t.id,requestInfo:r?.requestInfo,taskId:s,taskStore:c,taskRequestedTtl:a?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(t.method)}).then(()=>o(t,l)).then(async u=>{if(i.signal.aborted)return;let d={result:u,jsonrpc:"2.0",id:t.id};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"response",message:d,timestamp:Date.now()},n?.sessionId):await n?.send(d)},async u=>{if(i.signal.aborted)return;let d={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(u.code)?u.code:O.InternalError,message:u.message??"Internal error",...u.data!==void 0&&{data:u.data}}};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"error",message:d,timestamp:Date.now()},n?.sessionId):await n?.send(d)}).catch(u=>this._onerror(new Error(`Failed to send response: ${u}`))).finally(()=>{this._requestHandlerAbortControllers.get(t.id)===i&&this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){let{progressToken:r,...o}=t.params,n=Number(r),s=this._progressHandlers.get(n);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}let i=this._responseHandlers.get(n),a=this._timeoutInfo.get(n);if(a&&i&&a.resetTimeoutOnProgress)try{this._resetTimeout(n)}catch(c){this._responseHandlers.delete(n),this._progressHandlers.delete(n),this._cleanupTimeout(n),i(c);return}s(o)}_onresponse(t){let r=Number(t.id),o=this._requestResolvers.get(r);if(o){if(this._requestResolvers.delete(r),kt(t))o(t);else{let i=new I(t.error.code,t.error.message,t.error.data);o(i)}return}let n=this._responseHandlers.get(r);if(n===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let s=!1;if(kt(t)&&t.result&&typeof t.result=="object"){let i=t.result;if(i.task&&typeof i.task=="object"){let a=i.task;typeof a.taskId=="string"&&(s=!0,this._taskProgressTokens.set(a.taskId,r))}}if(s||this._progressHandlers.delete(r),kt(t))n(t);else{let i=I.fromError(t.error.code,t.error.message,t.error.data);n(i)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(t,r,o){let{task:n}=o??{};if(!n){try{yield{type:"result",result:await this.request(t,r,o)}}catch(i){yield{type:"error",error:i instanceof I?i:new I(O.InternalError,String(i))}}return}let s;try{let i=await this.request(t,Et,o);if(i.task)s=i.task.taskId,yield{type:"taskCreated",task:i.task};else throw new I(O.InternalError,"Task creation did not return a task");for(;;){let a=await this.getTask({taskId:s},o);if(yield{type:"taskStatus",task:a},ft(a.status)){a.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:s},r,o)}:a.status==="failed"?yield{type:"error",error:new I(O.InternalError,`Task ${s} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new I(O.InternalError,`Task ${s} was cancelled`)});return}if(a.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:s},r,o)};return}let c=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(l=>setTimeout(l,c)),o?.signal?.throwIfAborted()}}catch(i){yield{type:"error",error:i instanceof I?i:new I(O.InternalError,String(i))}}}request(t,r,o){let{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i,task:a,relatedTask:c}=o??{};return new Promise((l,u)=>{let d=w=>{u(w)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method),a&&this.assertTaskCapability(t.method)}catch(w){d(w);return}o?.signal?.throwIfAborted();let m=this._requestMessageId++,f={...t,jsonrpc:"2.0",id:m};o?.onprogress&&(this._progressHandlers.set(m,o.onprogress),f.params={...t.params,_meta:{...t.params?._meta||{},progressToken:m}}),a&&(f.params={...f.params,task:a}),c&&(f.params={...f.params,_meta:{...f.params?._meta||{},[pt]:c}});let g=w=>{this._responseHandlers.delete(m),this._progressHandlers.delete(m),this._cleanupTimeout(m),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:m,reason:String(w)}},{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i}).catch(P=>this._onerror(new Error(`Failed to send cancellation: ${P}`)));let $=w instanceof I?w:new I(O.RequestTimeout,String(w));u($)};this._responseHandlers.set(m,w=>{if(!o?.signal?.aborted){if(w instanceof Error)return u(w);try{let $=Le(r,w.result);$.success?l($.data):u($.error)}catch($){u($)}}}),o?.signal?.addEventListener("abort",()=>{g(o?.signal?.reason)});let h=o?.timeout??l0,y=()=>g(I.fromError(O.RequestTimeout,"Request timed out",{timeout:h}));this._setupTimeout(m,h,o?.maxTotalTimeout,y,o?.resetTimeoutOnProgress??!1);let x=c?.taskId;if(x){let w=$=>{let P=this._responseHandlers.get(m);P?P($):this._onerror(new Error(`Response handler missing for side-channeled request ${m}`))};this._requestResolvers.set(m,w),this._enqueueTaskMessage(x,{type:"request",message:f,timestamp:Date.now()}).catch($=>{this._cleanupTimeout(m),u($)})}else this._transport.send(f,{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i}).catch(w=>{this._cleanupTimeout(m),u(w)})})}async getTask(t,r){return this.request({method:"tasks/get",params:t},ln,r)}async getTaskResult(t,r,o){return this.request({method:"tasks/result",params:t},r,o)}async listTasks(t,r){return this.request({method:"tasks/list",params:t},fn,r)}async cancelTask(t,r){return this.request({method:"tasks/cancel",params:t},kp,r)}async notification(t,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);let o=r?.relatedTask?.taskId;if(o){let a={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...t.params?._meta||{},[pt]:r.relatedTask}}};await this._enqueueTaskMessage(o,{type:"notification",message:a,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;let a={...t,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[pt]:r.relatedTask}}}),this._transport?.send(a,r).catch(c=>this._onerror(c))});return}let i={...t,jsonrpc:"2.0"};r?.relatedTask&&(i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[pt]:r.relatedTask}}}),await this._transport.send(i,r)}setRequestHandler(t,r){let o=ki(t);this.assertRequestHandlerCapability(o),this._requestHandlers.set(o,(n,s)=>{let i=Pi(t,n);return Promise.resolve(r(i,s))})}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw new Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,r){let o=ki(t);this._notificationHandlers.set(o,n=>{let s=Pi(t,n);return Promise.resolve(r(s))})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}_cleanupTaskProgressHandler(t){let r=this._taskProgressTokens.get(t);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(t))}async _enqueueTaskMessage(t,r,o){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let n=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,r,o,n)}async _clearTaskQueue(t,r){if(this._taskMessageQueue){let o=await this._taskMessageQueue.dequeueAll(t,r);for(let n of o)if(n.type==="request"&&Nr(n.message)){let s=n.message.id,i=this._requestResolvers.get(s);i?(i(new I(O.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(s)):this._onerror(new Error(`Resolver missing for request ${s} during task ${t} cleanup`))}}}async _waitForTaskUpdate(t,r){let o=this._options?.defaultTaskPollInterval??1e3;try{let n=await this._taskStore?.getTask(t);n?.pollInterval&&(o=n.pollInterval)}catch{}return new Promise((n,s)=>{if(r.aborted){s(new I(O.InvalidRequest,"Request cancelled"));return}let i=setTimeout(n,o);r.addEventListener("abort",()=>{clearTimeout(i),s(new I(O.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,r){let o=this._taskStore;if(!o)throw new Error("No task store configured");return{createTask:async n=>{if(!t)throw new Error("No request provided");return await o.createTask(n,t.id,{method:t.method,params:t.params},r)},getTask:async n=>{let s=await o.getTask(n,r);if(!s)throw new I(O.InvalidParams,"Failed to retrieve task: Task not found");return s},storeTaskResult:async(n,s,i)=>{await o.storeTaskResult(n,s,i,r);let a=await o.getTask(n,r);if(a){let c=Dr.parse({method:"notifications/tasks/status",params:a});await this.notification(c),ft(a.status)&&this._cleanupTaskProgressHandler(n)}},getTaskResult:n=>o.getTaskResult(n,r),updateTaskStatus:async(n,s,i)=>{let a=await o.getTask(n,r);if(!a)throw new I(O.InvalidParams,`Task "${n}" not found - it may have been cleaned up`);if(ft(a.status))throw new I(O.InvalidParams,`Cannot update task "${n}" from terminal status "${a.status}" to "${s}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await o.updateTaskStatus(n,s,i,r);let c=await o.getTask(n,r);if(c){let l=Dr.parse({method:"notifications/tasks/status",params:c});await this.notification(l),ft(c.status)&&this._cleanupTaskProgressHandler(n)}},listTasks:n=>o.listTasks(n,r)}}};function Ap(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Np(e,t){let r={...e};for(let o in t){let n=o,s=t[n];if(s===void 0)continue;let i=r[n];Ap(i)&&Ap(s)?r[n]={...i,...s}:r[n]=s}return r}var Nh=jo(vc(),1),jh=jo(Ah(),1);function wS(){let e=new Nh.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,jh.default)(e),e}var Yn=class{constructor(t){this._ajv=t??wS()}getValidator(t){let r="$id"in t&&typeof t.$id=="string"?this._ajv.getSchema(t.$id)??this._ajv.compile(t):this._ajv.compile(t);return o=>r(o)?{valid:!0,data:o,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var Xn=class{constructor(t){this._client=t}async*callToolStream(t,r=or,o){let n=this._client,s={...o,task:o?.task??(n.isToolTask(t.name)?{}:void 0)},i=n.requestStream({method:"tools/call",params:t},r,s),a=n.getToolOutputValidator(t.name);for await(let c of i){if(c.type==="result"&&a){let l=c.result;if(!l.structuredContent&&!l.isError){yield{type:"error",error:new I(O.InvalidRequest,`Tool ${t.name} has an output schema but did not return structured content`)};return}if(l.structuredContent)try{let u=a(l.structuredContent);if(!u.valid){yield{type:"error",error:new I(O.InvalidParams,`Structured content does not match the tool's output schema: ${u.errorMessage}`)};return}}catch(u){if(u instanceof I){yield{type:"error",error:u};return}yield{type:"error",error:new I(O.InvalidParams,`Failed to validate structured content: ${u instanceof Error?u.message:String(u)}`)};return}}yield c}}async getTask(t,r){return this._client.getTask({taskId:t},r)}async getTaskResult(t,r,o){return this._client.getTaskResult({taskId:t},r,o)}async listTasks(t,r){return this._client.listTasks(t?{cursor:t}:void 0,r)}async cancelTask(t,r){return this._client.cancelTask({taskId:t},r)}requestStream(t,r,o){return this._client.requestStream(t,r,o)}};function Zh(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!e.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${t})`);break;default:break}}function qh(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!e.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!e.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${t})`);break;default:break}}function es(e,t){if(!(!e||t===null||typeof t!="object")){if(e.type==="object"&&e.properties&&typeof e.properties=="object"){let r=t,o=e.properties;for(let n of Object.keys(o)){let s=o[n];r[n]===void 0&&Object.prototype.hasOwnProperty.call(s,"default")&&(r[n]=s.default),r[n]!==void 0&&es(s,r[n])}}if(Array.isArray(e.anyOf))for(let r of e.anyOf)typeof r!="boolean"&&es(r,t);if(Array.isArray(e.oneOf))for(let r of e.oneOf)typeof r!="boolean"&&es(r,t)}}function xS(e){if(!e)return{supportsFormMode:!1,supportsUrlMode:!1};let t=e.form!==void 0,r=e.url!==void 0;return{supportsFormMode:t||!t&&!r,supportsUrlMode:r}}var Pc=class extends hn{constructor(t,r){super(r),this._clientInfo=t,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._listChangedDebounceTimers=new Map,this._capabilities=r?.capabilities??{},this._jsonSchemaValidator=r?.jsonSchemaValidator??new Yn,r?.listChanged&&(this._pendingListChangedConfig=r.listChanged)}_setupListChangedHandlers(t){t.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler("tools",vi,t.tools,async()=>(await this.listTools()).tools),t.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler("prompts",_i,t.prompts,async()=>(await this.listPrompts()).prompts),t.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler("resources",li,t.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new Xn(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Np(this._capabilities,t)}setRequestHandler(t,r){let n=Jo(t)?.method;if(!n)throw new Error("Schema is missing a method literal");let s=Qo(n);if(typeof s!="string")throw new Error("Schema method literal must be a string");let i=s;if(i==="elicitation/create"){let a=async(c,l)=>{let u=Le(bi,c);if(!u.success){let w=u.error instanceof Error?u.error.message:String(u.error);throw new I(O.InvalidParams,`Invalid elicitation request: ${w}`)}let{params:d}=u.data;d.mode=d.mode??"form";let{supportsFormMode:m,supportsUrlMode:f}=xS(this._capabilities.elicitation);if(d.mode==="form"&&!m)throw new I(O.InvalidParams,"Client does not support form-mode elicitation requests");if(d.mode==="url"&&!f)throw new I(O.InvalidParams,"Client does not support URL-mode elicitation requests");let g=await Promise.resolve(r(c,l));if(d.task){let w=Le(Et,g);if(!w.success){let $=w.error instanceof Error?w.error.message:String(w.error);throw new I(O.InvalidParams,`Invalid task creation result: ${$}`)}return w.data}let h=Le(zi,g);if(!h.success){let w=h.error instanceof Error?h.error.message:String(h.error);throw new I(O.InvalidParams,`Invalid elicitation result: ${w}`)}let y=h.data,x=d.mode==="form"?d.requestedSchema:void 0;if(d.mode==="form"&&y.action==="accept"&&y.content&&x&&this._capabilities.elicitation?.form?.applyDefaults)try{es(x,y.content)}catch{}return y};return super.setRequestHandler(t,a)}if(i==="sampling/createMessage"){let a=async(c,l)=>{let u=Le($i,c);if(!u.success){let y=u.error instanceof Error?u.error.message:String(u.error);throw new I(O.InvalidParams,`Invalid sampling request: ${y}`)}let{params:d}=u.data,m=await Promise.resolve(r(c,l));if(d.task){let y=Le(Et,m);if(!y.success){let x=y.error instanceof Error?y.error.message:String(y.error);throw new I(O.InvalidParams,`Invalid task creation result: ${x}`)}return y.data}let g=d.tools||d.toolChoice?xi:wi,h=Le(g,m);if(!h.success){let y=h.error instanceof Error?h.error.message:String(h.error);throw new I(O.InvalidParams,`Invalid sampling result: ${y}`)}return h.data};return super.setRequestHandler(t,a)}return super.setRequestHandler(t,r)}assertCapability(t,r){if(!this._serverCapabilities?.[t])throw new Error(`Server does not support ${t} (required for ${r})`)}async connect(t,r){if(await super.connect(t),t.sessionId===void 0)try{let o=await this.request({method:"initialize",params:{protocolVersion:er,capabilities:this._capabilities,clientInfo:this._clientInfo}},ni,r);if(o===void 0)throw new Error(`Server sent invalid initialize result: ${o}`);if(!hp.includes(o.protocolVersion))throw new Error(`Server's protocol version is not supported: ${o.protocolVersion}`);this._serverCapabilities=o.capabilities,this._serverVersion=o.serverInfo,t.setProtocolVersion&&t.setProtocolVersion(o.protocolVersion),this._instructions=o.instructions,await this.notification({method:"notifications/initialized"}),this._pendingListChangedConfig&&(this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0)}catch(o){throw this.close(),o}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(t){switch(t){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw new Error(`Server does not support prompts (required for ${t})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!this._serverCapabilities?.resources)throw new Error(`Server does not support resources (required for ${t})`);if(t==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${t})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw new Error(`Server does not support tools (required for ${t})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw new Error(`Server does not support completions (required for ${t})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(t){switch(t){case"notifications/roots/list_changed":if(!this._capabilities.roots?.listChanged)throw new Error(`Client does not support roots list changed notifications (required for ${t})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(t){if(this._capabilities)switch(t){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${t})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${t})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${t})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Client does not support tasks capability (required for ${t})`);break;case"ping":break}}assertTaskCapability(t){Zh(this._serverCapabilities?.tasks?.requests,t,"Server")}assertTaskHandlerCapability(t){this._capabilities&&qh(this._capabilities.tasks?.requests,t,"Client")}async ping(t){return this.request({method:"ping"},Pt,t)}async complete(t,r){return this.request({method:"completion/complete",params:t},Si,r)}async setLoggingLevel(t,r){return this.request({method:"logging/setLevel",params:{level:t}},Pt,r)}async getPrompt(t,r){return this.request({method:"prompts/get",params:t},gi,r)}async listPrompts(t,r){return this.request({method:"prompts/list",params:t},di,r)}async listResources(t,r){return this.request({method:"resources/list",params:t},ii,r)}async listResourceTemplates(t,r){return this.request({method:"resources/templates/list",params:t},ai,r)}async readResource(t,r){return this.request({method:"resources/read",params:t},ui,r)}async subscribeResource(t,r){return this.request({method:"resources/subscribe",params:t},Pt,r)}async unsubscribeResource(t,r){return this.request({method:"resources/unsubscribe",params:t},Pt,r)}async callTool(t,r=or,o){if(this.isToolTaskRequired(t.name))throw new I(O.InvalidRequest,`Tool "${t.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);let n=await this.request({method:"tools/call",params:t},r,o),s=this.getToolOutputValidator(t.name);if(s){if(!n.structuredContent&&!n.isError)throw new I(O.InvalidRequest,`Tool ${t.name} has an output schema but did not return structured content`);if(n.structuredContent)try{let i=s(n.structuredContent);if(!i.valid)throw new I(O.InvalidParams,`Structured content does not match the tool's output schema: ${i.errorMessage}`)}catch(i){throw i instanceof I?i:new I(O.InvalidParams,`Failed to validate structured content: ${i instanceof Error?i.message:String(i)}`)}}return n}isToolTask(t){return this._serverCapabilities?.tasks?.requests?.tools?.call?this._cachedKnownTaskTools.has(t):!1}isToolTaskRequired(t){return this._cachedRequiredTaskTools.has(t)}cacheToolMetadata(t){this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(let r of t){if(r.outputSchema){let n=this._jsonSchemaValidator.getValidator(r.outputSchema);this._cachedToolOutputValidators.set(r.name,n)}let o=r.execution?.taskSupport;(o==="required"||o==="optional")&&this._cachedKnownTaskTools.add(r.name),o==="required"&&this._cachedRequiredTaskTools.add(r.name)}}getToolOutputValidator(t){return this._cachedToolOutputValidators.get(t)}async listTools(t,r){let o=await this.request({method:"tools/list",params:t},yi,r);return this.cacheToolMetadata(o.tools),o}_setupListChangedHandler(t,r,o,n){let s=Op.safeParse(o);if(!s.success)throw new Error(`Invalid ${t} listChanged options: ${s.error.message}`);if(typeof o.onChanged!="function")throw new Error(`Invalid ${t} listChanged options: onChanged must be a function`);let{autoRefresh:i,debounceMs:a}=s.data,{onChanged:c}=o,l=async()=>{if(!i){c(null,null);return}try{let d=await n();c(null,d)}catch(d){let m=d instanceof Error?d:new Error(String(d));c(m,null)}},u=()=>{if(a){let d=this._listChangedDebounceTimers.get(t);d&&clearTimeout(d);let m=setTimeout(l,a);this._listChangedDebounceTimers.set(t,m)}else l()};this.setNotificationHandler(r,u)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};var Eg=jo(kg(),1);import qc from"node:process";import{PassThrough as QS}from"node:stream";var GS=10*1024*1024,rs=class{constructor(t){this._maxBufferSize=t?.maxBufferSize??GS}append(t){if((this._buffer?.length??0)+t.length>this._maxBufferSize)throw this.clear(),new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,t]):t}readMessage(){if(!this._buffer)return null;let t=this._buffer.indexOf(`
|
|
35
|
+
`);if(t===-1)return null;let r=this._buffer.toString("utf8",0,t).replace(/\r$/,"");return this._buffer=this._buffer.subarray(t+1),JS(r)}clear(){this._buffer=void 0}};function JS(e){return tr.parse(JSON.parse(e))}function Pg(e){return JSON.stringify(e)+`
|
|
36
|
+
`}var YS=qc.platform==="win32"?["APPDATA","HOMEDRIVE","HOMEPATH","LOCALAPPDATA","PATH","PROCESSOR_ARCHITECTURE","SYSTEMDRIVE","SYSTEMROOT","TEMP","USERNAME","USERPROFILE","PROGRAMFILES"]:["HOME","LOGNAME","PATH","SHELL","TERM","USER"];function XS(){let e={};for(let t of YS){let r=qc.env[t];r!==void 0&&(r.startsWith("()")||(e[t]=r))}return e}var Zc=class{constructor(t){this._stderrStream=null,this._serverParams=t,this._readBuffer=new rs({maxBufferSize:t.maxBufferSize}),(t.stderr==="pipe"||t.stderr==="overlapped")&&(this._stderrStream=new QS)}async start(){if(this._process)throw new Error("StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise((t,r)=>{this._process=(0,Eg.default)(this._serverParams.command,this._serverParams.args??[],{env:{...XS(),...this._serverParams.env},stdio:["pipe","pipe",this._serverParams.stderr??"inherit"],shell:!1,windowsHide:qc.platform==="win32",cwd:this._serverParams.cwd}),this._process.on("error",o=>{r(o),this.onerror?.(o)}),this._process.on("spawn",()=>{t()}),this._process.on("close",o=>{this._process=void 0,this.onclose?.()}),this._process.stdin?.on("error",o=>{this.onerror?.(o)}),this._process.stdout?.on("data",o=>{try{this._readBuffer.append(o),this.processReadBuffer()}catch(n){this.onerror?.(n),this.close().catch(()=>{})}}),this._process.stdout?.on("error",o=>{this.onerror?.(o)}),this._stderrStream&&this._process.stderr&&this._process.stderr.pipe(this._stderrStream)})}get stderr(){return this._stderrStream?this._stderrStream:this._process?.stderr??null}get pid(){return this._process?.pid??null}processReadBuffer(){for(;;)try{let t=this._readBuffer.readMessage();if(t===null)break;this.onmessage?.(t)}catch(t){this.onerror?.(t)}}async close(){if(this._process){let t=this._process;this._process=void 0;let r=new Promise(o=>{t.once("close",()=>{o()})});try{t.stdin?.end()}catch{}if(await Promise.race([r,new Promise(o=>setTimeout(o,2e3).unref())]),t.exitCode===null){try{t.kill("SIGTERM")}catch{}await Promise.race([r,new Promise(o=>setTimeout(o,2e3).unref())])}if(t.exitCode===null)try{t.kill("SIGKILL")}catch{}}this._readBuffer.clear()}send(t){return new Promise(r=>{if(!this._process?.stdin)throw new Error("Not connected");let o=Pg(t);this._process.stdin.write(o)?r():this._process.stdin.once("drain",r)})}};var Cg=jo(Og(),1);function Ag(e){if(e)try{return Cg.default.parse(e).type}catch{let t=(e.split(";",1)[0]??"").trim().toLowerCase();return t===""||e.slice(t.length).includes(",")?void 0:t}}function os(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}function Ng(e=fetch,t){return t?async(r,o)=>{let n={...t,...o,headers:o?.headers?{...os(t.headers),...os(o.headers)}:t.headers};return e(r,n)}:e}var Dc;Dc=globalThis.crypto?.webcrypto??globalThis.crypto??import("node:crypto").then(e=>e.webcrypto);async function ck(e){return(await Dc).getRandomValues(new Uint8Array(e))}async function uk(e){let t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r=Math.pow(2,8)-Math.pow(2,8)%t.length,o="";for(;o.length<e;){let n=await ck(e-o.length);for(let s of n)s<r&&(o+=t[s%t.length])}return o}async function lk(e){return await uk(e)}async function dk(e){let t=await(await Dc).subtle.digest("SHA-256",new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function Uc(e){if(e||(e=43),e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;let t=await lk(e),r=await dk(t);return{code_verifier:t,code_challenge:r}}var ge=rp().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:mp.custom,message:"URL must be parseable",fatal:!0}),as}).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"}),Zg=ue({resource:p().url(),authorization_servers:S(ge).optional(),jwks_uri:p().url().optional(),scopes_supported:S(p()).optional(),bearer_methods_supported:S(p()).optional(),resource_signing_alg_values_supported:S(p()).optional(),resource_name:p().optional(),resource_documentation:p().optional(),resource_policy_uri:p().url().optional(),resource_tos_uri:p().url().optional(),tls_client_certificate_bound_access_tokens:K().optional(),authorization_details_types_supported:S(p()).optional(),dpop_signing_alg_values_supported:S(p()).optional(),dpop_bound_access_tokens_required:K().optional()}),Lc=ue({issuer:p(),authorization_endpoint:ge,token_endpoint:ge,registration_endpoint:ge.optional(),scopes_supported:S(p()).optional(),response_types_supported:S(p()),response_modes_supported:S(p()).optional(),grant_types_supported:S(p()).optional(),token_endpoint_auth_methods_supported:S(p()).optional(),token_endpoint_auth_signing_alg_values_supported:S(p()).optional(),service_documentation:ge.optional(),revocation_endpoint:ge.optional(),revocation_endpoint_auth_methods_supported:S(p()).optional(),revocation_endpoint_auth_signing_alg_values_supported:S(p()).optional(),introspection_endpoint:p().optional(),introspection_endpoint_auth_methods_supported:S(p()).optional(),introspection_endpoint_auth_signing_alg_values_supported:S(p()).optional(),code_challenge_methods_supported:S(p()).optional(),client_id_metadata_document_supported:K().optional()}),pk=ue({issuer:p(),authorization_endpoint:ge,token_endpoint:ge,userinfo_endpoint:ge.optional(),jwks_uri:ge,registration_endpoint:ge.optional(),scopes_supported:S(p()).optional(),response_types_supported:S(p()),response_modes_supported:S(p()).optional(),grant_types_supported:S(p()).optional(),acr_values_supported:S(p()).optional(),subject_types_supported:S(p()),id_token_signing_alg_values_supported:S(p()),id_token_encryption_alg_values_supported:S(p()).optional(),id_token_encryption_enc_values_supported:S(p()).optional(),userinfo_signing_alg_values_supported:S(p()).optional(),userinfo_encryption_alg_values_supported:S(p()).optional(),userinfo_encryption_enc_values_supported:S(p()).optional(),request_object_signing_alg_values_supported:S(p()).optional(),request_object_encryption_alg_values_supported:S(p()).optional(),request_object_encryption_enc_values_supported:S(p()).optional(),token_endpoint_auth_methods_supported:S(p()).optional(),token_endpoint_auth_signing_alg_values_supported:S(p()).optional(),display_values_supported:S(p()).optional(),claim_types_supported:S(p()).optional(),claims_supported:S(p()).optional(),service_documentation:p().optional(),claims_locales_supported:S(p()).optional(),ui_locales_supported:S(p()).optional(),claims_parameter_supported:K().optional(),request_parameter_supported:K().optional(),request_uri_parameter_supported:K().optional(),require_request_uri_registration:K().optional(),op_policy_uri:ge.optional(),op_tos_uri:ge.optional(),client_id_metadata_document_supported:K().optional()}),qg=k({...pk.shape,...Lc.pick({code_challenge_methods_supported:!0}).shape}),Mg=k({access_token:p(),id_token:p().optional(),token_type:p(),expires_in:tn.number().optional(),scope:p().optional(),refresh_token:p().optional()}).strip(),Dg=k({error:p(),error_description:p().optional(),error_uri:p().optional()}),jg=ge.optional().or(E("").transform(()=>{})),fk=k({redirect_uris:S(ge),token_endpoint_auth_method:p().optional(),grant_types:S(p()).optional(),response_types:S(p()).optional(),client_name:p().optional(),client_uri:ge.optional(),logo_uri:jg,scope:p().optional(),contacts:S(p()).optional(),tos_uri:jg,policy_uri:p().optional(),jwks_uri:ge.optional(),jwks:sp().optional(),software_id:p().optional(),software_version:p().optional(),software_statement:p().optional()}).strip(),mk=k({client_id:p(),client_secret:p().optional(),client_id_issued_at:L().optional(),client_secret_expires_at:L().optional()}).strip(),Ug=fk.merge(mk),oC=k({error:p(),error_description:p().optional()}).strip(),nC=k({token:p(),token_type_hint:p().optional()}).strip();function Lg(e){let t=typeof e=="string"?new URL(e):new URL(e.href);return t.hash="",t}function Fg({requestedResource:e,configuredResource:t}){let r=typeof e=="string"?new URL(e):new URL(e.href),o=typeof t=="string"?new URL(t):new URL(t.href);if(r.origin!==o.origin||r.pathname.length<o.pathname.length)return!1;let n=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",s=o.pathname.endsWith("/")?o.pathname:o.pathname+"/";return n.startsWith(s)}var ce=class extends Error{constructor(t,r){super(t),this.errorUri=r,this.name=this.constructor.name}toResponseObject(){let t={error:this.errorCode,error_description:this.message};return this.errorUri&&(t.error_uri=this.errorUri),t}get errorCode(){return this.constructor.errorCode}},$o=class extends ce{};$o.errorCode="invalid_request";var Ut=class extends ce{};Ut.errorCode="invalid_client";var Lt=class extends ce{};Lt.errorCode="invalid_grant";var Ft=class extends ce{};Ft.errorCode="unauthorized_client";var wo=class extends ce{};wo.errorCode="unsupported_grant_type";var xo=class extends ce{};xo.errorCode="invalid_scope";var bo=class extends ce{};bo.errorCode="access_denied";var at=class extends ce{};at.errorCode="server_error";var zo=class extends ce{};zo.errorCode="temporarily_unavailable";var So=class extends ce{};So.errorCode="unsupported_response_type";var ko=class extends ce{};ko.errorCode="unsupported_token_type";var Po=class extends ce{};Po.errorCode="invalid_token";var Eo=class extends ce{};Eo.errorCode="method_not_allowed";var To=class extends ce{};To.errorCode="too_many_requests";var Vt=class extends ce{};Vt.errorCode="invalid_client_metadata";var Ro=class extends ce{};Ro.errorCode="insufficient_scope";var Io=class extends ce{};Io.errorCode="invalid_target";var Vg={[$o.errorCode]:$o,[Ut.errorCode]:Ut,[Lt.errorCode]:Lt,[Ft.errorCode]:Ft,[wo.errorCode]:wo,[xo.errorCode]:xo,[bo.errorCode]:bo,[at.errorCode]:at,[zo.errorCode]:zo,[So.errorCode]:So,[ko.errorCode]:ko,[Po.errorCode]:Po,[Eo.errorCode]:Eo,[To.errorCode]:To,[Vt.errorCode]:Vt,[Ro.errorCode]:Ro,[Io.errorCode]:Io};var ct=class extends Error{constructor(t){super(t??"Unauthorized")}};function hk(e){return["client_secret_basic","client_secret_post","none"].includes(e)}var Fc="code",Vc="S256";function gk(e,t){let r=e.client_secret!==void 0;return"token_endpoint_auth_method"in e&&e.token_endpoint_auth_method&&hk(e.token_endpoint_auth_method)&&(t.length===0||t.includes(e.token_endpoint_auth_method))?e.token_endpoint_auth_method:t.length===0?r?"client_secret_basic":"none":r&&t.includes("client_secret_basic")?"client_secret_basic":r&&t.includes("client_secret_post")?"client_secret_post":t.includes("none")?"none":r?"client_secret_post":"none"}function _k(e,t,r,o){let{client_id:n,client_secret:s}=t;switch(e){case"client_secret_basic":yk(n,s,r);return;case"client_secret_post":vk(n,s,o);return;case"none":$k(n,o);return;default:throw new Error(`Unsupported client authentication method: ${e}`)}}function yk(e,t,r){if(!t)throw new Error("client_secret_basic authentication requires a client_secret");let o=btoa(`${e}:${t}`);r.set("Authorization",`Basic ${o}`)}function vk(e,t,r){r.set("client_id",e),t&&r.set("client_secret",t)}function $k(e,t){t.set("client_id",e)}async function Bg(e){let t=e instanceof Response?e.status:void 0,r=e instanceof Response?await e.text():e;try{let o=Dg.parse(JSON.parse(r)),{error:n,error_description:s,error_uri:i}=o,a=Vg[n]||at;return new a(s||"",i)}catch(o){let n=`${t?`HTTP ${t}: `:""}Invalid OAuth error response: ${o}. Raw body: ${r}`;return new at(n)}}async function Oo(e,t){try{return await Hc(e,t)}catch(r){if(r instanceof Ut||r instanceof Ft)return await e.invalidateCredentials?.("all"),await Hc(e,t);if(r instanceof Lt)return await e.invalidateCredentials?.("tokens"),await Hc(e,t);throw r}}async function Hc(e,{serverUrl:t,authorizationCode:r,scope:o,resourceMetadataUrl:n,fetchFn:s}){let i=await e.discoveryState?.(),a,c,l,u=n;if(!u&&i?.resourceMetadataUrl&&(u=new URL(i.resourceMetadataUrl)),i?.authorizationServerUrl){if(c=i.authorizationServerUrl,a=i.resourceMetadata,l=i.authorizationServerMetadata??await Wg(c,{fetchFn:s}),!a)try{a=await Kg(t,{resourceMetadataUrl:u},s)}catch{}(l!==i.authorizationServerMetadata||a!==i.resourceMetadata)&&await e.saveDiscoveryState?.({authorizationServerUrl:String(c),resourceMetadataUrl:u?.toString(),resourceMetadata:a,authorizationServerMetadata:l})}else{let $=await Pk(t,{resourceMetadataUrl:u,fetchFn:s});c=$.authorizationServerUrl,l=$.authorizationServerMetadata,a=$.resourceMetadata,await e.saveDiscoveryState?.({authorizationServerUrl:String(c),resourceMetadataUrl:u?.toString(),resourceMetadata:a,authorizationServerMetadata:l})}let d=await xk(t,e,a),m=o||a?.scopes_supported?.join(" ")||e.clientMetadata.scope,f=await Promise.resolve(e.clientInformation());if(!f){if(r!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");let $=l?.client_id_metadata_document_supported===!0,P=e.clientMetadataUrl;if(P&&!wk(P))throw new Vt(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${P}`);if($&&P)f={client_id:P},await e.saveClientInformation?.(f);else{if(!e.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");let z=await Ok(c,{metadata:l,clientMetadata:e.clientMetadata,scope:m,fetchFn:s});await e.saveClientInformation(z),f=z}}let g=!e.redirectUrl;if(r!==void 0||g){let $=await Ik(e,c,{metadata:l,resource:d,authorizationCode:r,fetchFn:s});return await e.saveTokens($),"AUTHORIZED"}let h=await e.tokens();if(h?.refresh_token)try{let $=await Rk(c,{metadata:l,clientInformation:f,refreshToken:h.refresh_token,resource:d,addClientAuthentication:e.addClientAuthentication,fetchFn:s});return await e.saveTokens($),"AUTHORIZED"}catch($){if(!(!($ instanceof ce)||$ instanceof at))throw $}let y=e.state?await e.state():void 0,{authorizationUrl:x,codeVerifier:w}=await Ek(c,{metadata:l,clientInformation:f,state:y,redirectUrl:e.redirectUrl,scope:m,resource:d});return await e.saveCodeVerifier(w),await e.redirectToAuthorization(x),"REDIRECT"}function wk(e){if(!e)return!1;try{let t=new URL(e);return t.protocol==="https:"&&t.pathname!=="/"}catch{return!1}}async function xk(e,t,r){let o=Lg(e);if(t.validateResourceURL)return await t.validateResourceURL(o,r?.resource);if(r){if(!Fg({requestedResource:o,configuredResource:r.resource}))throw new Error(`Protected resource ${r.resource} does not match expected ${o} (or origin)`);return new URL(r.resource)}}function Kc(e){let t=e.headers.get("WWW-Authenticate");if(!t)return{};let[r,o]=t.split(" ");if(r.toLowerCase()!=="bearer"||!o)return{};let n=Bc(e,"resource_metadata")||void 0,s;if(n)try{s=new URL(n)}catch{}let i=Bc(e,"scope")||void 0,a=Bc(e,"error")||void 0;return{resourceMetadataUrl:s,scope:i,error:a}}function Bc(e,t){let r=e.headers.get("WWW-Authenticate");if(!r)return null;let o=new RegExp(`${t}=(?:"([^"]+)"|([^\\s,]+))`),n=r.match(o);return n?n[1]||n[2]:null}async function Kg(e,t,r=fetch){let o=await Sk(e,"oauth-protected-resource",r,{protocolVersion:t?.protocolVersion,metadataUrl:t?.resourceMetadataUrl});if(!o||o.status===404)throw await o?.body?.cancel(),new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!o.ok)throw await o.body?.cancel(),new Error(`HTTP ${o.status} trying to load well-known OAuth protected resource metadata.`);return Zg.parse(await o.json())}async function Wc(e,t,r=fetch){try{return await r(e,{headers:t})}catch(o){if(o instanceof TypeError)return t?Wc(e,void 0,r):void 0;throw o}}function bk(e,t="",r={}){return t.endsWith("/")&&(t=t.slice(0,-1)),r.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}async function Hg(e,t,r=fetch){return await Wc(e,{"MCP-Protocol-Version":t},r)}function zk(e,t){return!e||e.status>=400&&e.status<500&&t!=="/"}async function Sk(e,t,r,o){let n=new URL(e),s=o?.protocolVersion??er,i;if(o?.metadataUrl)i=new URL(o.metadataUrl);else{let c=bk(t,n.pathname);i=new URL(c,o?.metadataServerUrl??n),i.search=n.search}let a=await Hg(i,s,r);if(!o?.metadataUrl&&zk(a,n.pathname)){let c=new URL(`/.well-known/${t}`,n);a=await Hg(c,s,r)}return a}function kk(e){let t=typeof e=="string"?new URL(e):e,r=t.pathname!=="/",o=[];if(!r)return o.push({url:new URL("/.well-known/oauth-authorization-server",t.origin),type:"oauth"}),o.push({url:new URL("/.well-known/openid-configuration",t.origin),type:"oidc"}),o;let n=t.pathname;return n.endsWith("/")&&(n=n.slice(0,-1)),o.push({url:new URL(`/.well-known/oauth-authorization-server${n}`,t.origin),type:"oauth"}),o.push({url:new URL(`/.well-known/openid-configuration${n}`,t.origin),type:"oidc"}),o.push({url:new URL(`${n}/.well-known/openid-configuration`,t.origin),type:"oidc"}),o}async function Wg(e,{fetchFn:t=fetch,protocolVersion:r=er}={}){let o={"MCP-Protocol-Version":r,Accept:"application/json"},n=kk(e);for(let{url:s,type:i}of n){let a=await Wc(s,o,t);if(a){if(!a.ok){if(await a.body?.cancel(),a.status>=400&&a.status<500)continue;throw new Error(`HTTP ${a.status} trying to load ${i==="oauth"?"OAuth":"OpenID provider"} metadata from ${s}`)}return i==="oauth"?Lc.parse(await a.json()):qg.parse(await a.json())}}}async function Pk(e,t){let r,o;try{r=await Kg(e,{resourceMetadataUrl:t?.resourceMetadataUrl},t?.fetchFn),r.authorization_servers&&r.authorization_servers.length>0&&(o=r.authorization_servers[0])}catch{}o||(o=String(new URL("/",e)));let n=await Wg(o,{fetchFn:t?.fetchFn});return{authorizationServerUrl:o,authorizationServerMetadata:n,resourceMetadata:r}}async function Ek(e,{metadata:t,clientInformation:r,redirectUrl:o,scope:n,state:s,resource:i}){let a;if(t){if(a=new URL(t.authorization_endpoint),!t.response_types_supported.includes(Fc))throw new Error(`Incompatible auth server: does not support response type ${Fc}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(Vc))throw new Error(`Incompatible auth server: does not support code challenge method ${Vc}`)}else a=new URL("/authorize",e);let c=await Uc(),l=c.code_verifier,u=c.code_challenge;return a.searchParams.set("response_type",Fc),a.searchParams.set("client_id",r.client_id),a.searchParams.set("code_challenge",u),a.searchParams.set("code_challenge_method",Vc),a.searchParams.set("redirect_uri",String(o)),s&&a.searchParams.set("state",s),n&&a.searchParams.set("scope",n),n?.includes("offline_access")&&a.searchParams.append("prompt","consent"),i&&a.searchParams.set("resource",i.href),{authorizationUrl:a,codeVerifier:l}}function Tk(e,t,r){return new URLSearchParams({grant_type:"authorization_code",code:e,code_verifier:t,redirect_uri:String(r)})}async function Gg(e,{metadata:t,tokenRequestParams:r,clientInformation:o,addClientAuthentication:n,resource:s,fetchFn:i}){let a=t?.token_endpoint?new URL(t.token_endpoint):new URL("/token",e),c=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});if(s&&r.set("resource",s.href),n)await n(c,r,a,t);else if(o){let u=t?.token_endpoint_auth_methods_supported??[],d=gk(o,u);_k(d,o,c,r)}let l=await(i??fetch)(a,{method:"POST",headers:c,body:r});if(!l.ok)throw await Bg(l);return Mg.parse(await l.json())}async function Rk(e,{metadata:t,clientInformation:r,refreshToken:o,resource:n,addClientAuthentication:s,fetchFn:i}){let a=new URLSearchParams({grant_type:"refresh_token",refresh_token:o}),c=await Gg(e,{metadata:t,tokenRequestParams:a,clientInformation:r,addClientAuthentication:s,resource:n,fetchFn:i});return{refresh_token:o,...c}}async function Ik(e,t,{metadata:r,resource:o,authorizationCode:n,fetchFn:s}={}){let i=e.clientMetadata.scope,a;if(e.prepareTokenRequest&&(a=await e.prepareTokenRequest(i)),!a){if(!n)throw new Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!e.redirectUrl)throw new Error("redirectUrl is required for authorization_code flow");let l=await e.codeVerifier();a=Tk(n,l,e.redirectUrl)}let c=await e.clientInformation();return Gg(t,{metadata:r,tokenRequestParams:a,clientInformation:c??void 0,addClientAuthentication:e.addClientAuthentication,resource:o,fetchFn:s})}async function Ok(e,{metadata:t,clientMetadata:r,scope:o,fetchFn:n}){let s;if(t){if(!t.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");s=new URL(t.registration_endpoint)}else s=new URL("/register",e);let i=await(n??fetch)(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...r,...o!==void 0?{scope:o}:{}})});if(!i.ok)throw await Bg(i);return Ug.parse(await i.json())}var Co=class extends Error{constructor(t,r){super(t),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}},Jg=10,Ck=13,Ht=32;function Gc(e){}function Xg(e){if(typeof e=="function")throw new TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");let{onEvent:t=Gc,onError:r=Gc,onRetry:o=Gc,onComment:n,maxBufferSize:s}=e,i=[],a=0,c=!0,l,u="",d=0,m,f=!1;function g(v){if(f)throw new Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(c&&(c=!1,v.charCodeAt(0)===239&&v.charCodeAt(1)===187&&v.charCodeAt(2)===191&&(v=v.slice(3))),i.length===0){let re=y(v);re!==""&&(i.push(re),a=re.length),h();return}if(v.indexOf(`
|
|
37
|
+
`)===-1&&v.indexOf("\r")===-1){i.push(v),a+=v.length,h();return}i.push(v);let z=i.join("");i.length=0,a=0;let C=y(z);C!==""&&(i.push(C),a=C.length),h()}function h(){s!==void 0&&(a+u.length<=s||(f=!0,i.length=0,a=0,l=void 0,u="",d=0,m=void 0,r(new Co(`Buffered data exceeded max buffer size of ${s} characters`,{type:"max-buffer-size-exceeded"}))))}function y(v){let z=0;if(v.indexOf("\r")===-1){let C=v.indexOf(`
|
|
38
|
+
`,z);for(;C!==-1;){if(z===C){d>0&&t({id:l,event:m,data:u}),l=void 0,u="",d=0,m=void 0,z=C+1,C=v.indexOf(`
|
|
39
|
+
`,z);continue}let re=v.charCodeAt(z);if(Qg(v,z,re)){let ie=v.charCodeAt(z+5)===Ht?z+6:z+5,ze=v.slice(ie,C);if(d===0&&v.charCodeAt(C+1)===Jg){t({id:l,event:m,data:ze}),l=void 0,u="",m=void 0,z=C+2,C=v.indexOf(`
|
|
40
|
+
`,z);continue}u=d===0?ze:`${u}
|
|
41
|
+
${ze}`,d++}else Yg(v,z,re)?m=v.slice(v.charCodeAt(z+6)===Ht?z+7:z+6,C)||void 0:x(v,z,C);z=C+1,C=v.indexOf(`
|
|
42
|
+
`,z)}return v.slice(z)}for(;z<v.length;){let C=v.indexOf("\r",z),re=v.indexOf(`
|
|
43
|
+
`,z),ie=-1;if(C!==-1&&re!==-1?ie=C<re?C:re:C!==-1?C===v.length-1?ie=-1:ie=C:re!==-1&&(ie=re),ie===-1)break;x(v,z,ie),z=ie+1,v.charCodeAt(z-1)===Ck&&v.charCodeAt(z)===Jg&&z++}return v.slice(z)}function x(v,z,C){if(z===C){$();return}let re=v.charCodeAt(z);if(Qg(v,z,re)){let ut=v.charCodeAt(z+5)===Ht?z+6:z+5,Qc=v.slice(ut,C);u=d===0?Qc:`${u}
|
|
44
|
+
${Qc}`,d++;return}if(Yg(v,z,re)){m=v.slice(v.charCodeAt(z+6)===Ht?z+7:z+6,C)||void 0;return}if(re===105&&v.charCodeAt(z+1)===100&&v.charCodeAt(z+2)===58){let ut=v.slice(v.charCodeAt(z+3)===Ht?z+4:z+3,C);ut.includes("\0")||(l=ut);return}if(re===58){if(n){let ut=v.slice(z,C);n(ut.slice(v.charCodeAt(z+1)===Ht?2:1))}return}let ie=v.slice(z,C),ze=ie.indexOf(":");if(ze===-1){w(ie,"",ie);return}let br=ie.slice(0,ze),Ao=ie.charCodeAt(ze+1)===Ht?2:1,No=ie.slice(ze+Ao);w(br,No,ie)}function w(v,z,C){switch(v){case"event":m=z||void 0;break;case"data":u=d===0?z:`${u}
|
|
45
|
+
${z}`,d++;break;case"id":z.includes("\0")||(l=z);break;case"retry":/^\d+$/.test(z)?o(parseInt(z,10)):r(new Co(`Invalid \`retry\` value: "${z}"`,{type:"invalid-retry",value:z,line:C}));break;default:r(new Co(`Unknown field "${v.length>20?`${v.slice(0,20)}\u2026`:v}"`,{type:"unknown-field",field:v,value:z,line:C}));break}}function $(){d>0&&t({id:l,event:m,data:u}),l=void 0,u="",d=0,m=void 0}function P(v={}){if(v.consume&&i.length>0){let z=i.join("");x(z,0,z.length)}c=!0,l=void 0,u="",d=0,m=void 0,i.length=0,a=0,f=!1}return{feed:g,reset:P}}function Qg(e,t,r){return r===100&&e.charCodeAt(t+1)===97&&e.charCodeAt(t+2)===116&&e.charCodeAt(t+3)===97&&e.charCodeAt(t+4)===58}function Yg(e,t,r){return r===101&&e.charCodeAt(t+1)===118&&e.charCodeAt(t+2)===101&&e.charCodeAt(t+3)===110&&e.charCodeAt(t+4)===116&&e.charCodeAt(t+5)===58}var ns=class extends TransformStream{constructor({onError:t,onRetry:r,onComment:o,maxBufferSize:n}={}){let s;super({start(i){s=Xg({onEvent:a=>{i.enqueue(a)},onError(a){typeof t=="function"&&t(a),(t==="terminate"||a.type==="max-buffer-size-exceeded")&&i.error(a)},onRetry:r,onComment:o,maxBufferSize:n})},transform(i){s.feed(i)}})}};var Ak={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},xt=class extends Error{constructor(t,r){super(`Streamable HTTP error: ${r}`),this.code=t}},Jc=class{constructor(t,r){this._hasCompletedAuthFlow=!1,this._url=t,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch,this._fetchWithInit=Ng(r?.fetch,r?.requestInit),this._sessionId=r?.sessionId,this._reconnectionOptions=r?.reconnectionOptions??Ak}async _authThenStart(){if(!this._authProvider)throw new ct("No auth provider");let t;try{t=await Oo(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(r){throw this.onerror?.(r),r}if(t!=="AUTHORIZED")throw new ct;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){let t={};if(this._authProvider){let o=await this._authProvider.tokens();o&&(t.Authorization=`Bearer ${o.access_token}`)}this._sessionId&&(t["mcp-session-id"]=this._sessionId),this._protocolVersion&&(t["mcp-protocol-version"]=this._protocolVersion);let r=os(this._requestInit?.headers);return new Headers({...t,...r})}async _startOrAuthSse(t){let{resumptionToken:r}=t;try{let o=await this._commonHeaders();o.set("Accept","text/event-stream"),r&&o.set("last-event-id",r);let n=await(this._fetch??fetch)(this._url,{method:"GET",headers:o,signal:this._abortController?.signal});if(!n.ok){if(await n.body?.cancel(),n.status===401&&this._authProvider)return await this._authThenStart();if(n.status===405)return;throw new xt(n.status,`Failed to open SSE stream: ${n.statusText}`)}this._handleSseStream(n.body,t,!0)}catch(o){throw this.onerror?.(o),o}}_getNextReconnectionDelay(t){if(this._serverRetryMs!==void 0)return this._serverRetryMs;let r=this._reconnectionOptions.initialReconnectionDelay,o=this._reconnectionOptions.reconnectionDelayGrowFactor,n=this._reconnectionOptions.maxReconnectionDelay;return Math.min(r*Math.pow(o,t),n)}_scheduleReconnection(t,r=0){let o=this._reconnectionOptions.maxRetries;if(r>=o){this.onerror?.(new Error(`Maximum reconnection attempts (${o}) exceeded.`));return}let n=this._getNextReconnectionDelay(r);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(t).catch(s=>{this.onerror?.(new Error(`Failed to reconnect SSE stream: ${s instanceof Error?s.message:String(s)}`)),this._scheduleReconnection(t,r+1)})},n)}_handleSseStream(t,r,o){if(!t)return;let{onresumptiontoken:n,replayMessageId:s}=r,i,a=!1,c=!1;(async()=>{try{let u=t.pipeThrough(new TextDecoderStream).pipeThrough(new ns({onRetry:f=>{this._serverRetryMs=f}})).getReader();for(;;){let{value:f,done:g}=await u.read();if(g)break;if(f.id&&(i=f.id,a=!0,n?.(f.id)),!!f.data&&(!f.event||f.event==="message"))try{let h=tr.parse(JSON.parse(f.data));kt(h)&&(c=!0,s!==void 0&&(h.id=s)),this.onmessage?.(h)}catch(h){this.onerror?.(h)}}(o||a)&&!c&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:i,onresumptiontoken:n,replayMessageId:s},0)}catch(u){if(this.onerror?.(new Error(`SSE stream disconnected: ${u}`)),(o||a)&&!c&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:i,onresumptiontoken:n,replayMessageId:s},0)}catch(f){this.onerror?.(new Error(`Failed to reconnect: ${f instanceof Error?f.message:String(f)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(t){if(!this._authProvider)throw new ct("No auth provider");if(await Oo(this._authProvider,{serverUrl:this._url,authorizationCode:t,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new ct("Failed to authorize")}async close(){this._reconnectionTimeout&&(clearTimeout(this._reconnectionTimeout),this._reconnectionTimeout=void 0),this._abortController?.abort(),this.onclose?.()}async send(t,r){try{let{resumptionToken:o,onresumptiontoken:n}=r||{};if(o){this._startOrAuthSse({resumptionToken:o,replayMessageId:Nr(t)?t.id:void 0}).catch(f=>this.onerror?.(f));return}let s=await this._commonHeaders();s.set("content-type","application/json"),s.set("accept","application/json, text/event-stream");let i={...this._requestInit,method:"POST",headers:s,body:JSON.stringify(t),signal:this._abortController?.signal},a=await(this._fetch??fetch)(this._url,i),c=a.headers.get("mcp-session-id");if(c&&(this._sessionId=c),!a.ok){let f=await a.text().catch(()=>null);if(a.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new xt(401,"Server returned 401 after successful authentication");let{resourceMetadataUrl:g,scope:h}=Kc(a);if(this._resourceMetadataUrl=g,this._scope=h,await Oo(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new ct;return this._hasCompletedAuthFlow=!0,this.send(t)}if(a.status===403&&this._authProvider){let{resourceMetadataUrl:g,scope:h,error:y}=Kc(a);if(y==="insufficient_scope"){let x=a.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===x)throw new xt(403,"Server returned 403 after trying upscoping");if(h&&(this._scope=h),g&&(this._resourceMetadataUrl=g),this._lastUpscopingHeader=x??void 0,await Oo(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new ct;return this.send(t)}}throw new xt(a.status,`Error POSTing to endpoint: ${f}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,a.status===202){await a.body?.cancel(),Sp(t)&&this._startOrAuthSse({resumptionToken:void 0}).catch(f=>this.onerror?.(f));return}let u=(Array.isArray(t)?t:[t]).filter(f=>"method"in f&&"id"in f&&f.id!==void 0).length>0,d=a.headers.get("content-type"),m=Ag(d);if(u)if(m==="text/event-stream")this._handleSseStream(a.body,{onresumptiontoken:n},!1);else if(m==="application/json"){let f=await a.json(),g=Array.isArray(f)?f.map(h=>tr.parse(h)):[tr.parse(f)];for(let h of g)this.onmessage?.(h)}else throw await a.body?.cancel(),new xt(-1,`Unexpected content type: ${d}`);else await a.body?.cancel()}catch(o){throw this.onerror?.(o),o}}get sessionId(){return this._sessionId}async terminateSession(){if(this._sessionId)try{let t=await this._commonHeaders(),r={...this._requestInit,method:"DELETE",headers:t,signal:this._abortController?.signal},o=await(this._fetch??fetch)(this._url,r);if(await o.body?.cancel(),!o.ok&&o.status!==405)throw new xt(o.status,`Failed to terminate session: ${o.statusText}`);this._sessionId=void 0}catch(t){throw this.onerror?.(t),t}}setProtocolVersion(t){this._protocolVersion=t}get protocolVersion(){return this._protocolVersion}async resumeStream(t,r){await this._startOrAuthSse({resumptionToken:t,onresumptiontoken:r?.onresumptiontoken})}};export{Pc as Client,Zc as StdioClientTransport,Jc as StreamableHTTPClientTransport};
|