@opentiny/next-sdk 0.1.15-beta.4 → 0.1.15-beta.5

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.
@@ -0,0 +1,43 @@
1
+ (function(E,Ft){typeof exports=="object"&&typeof module<"u"?Ft(exports):typeof define=="function"&&define.amd?define(["exports"],Ft):(E=typeof globalThis<"u"?globalThis:E||self,Ft(E.MCPSDK={}))})(this,(function(E){"use strict";function Ft(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Ur={exports:{}},Ss={},_t={},zt={},ks={},Es={},Rs={},$a;function Dr(){return $a||($a=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.regexpCode=t.getEsmExportName=t.getProperty=t.safeStringify=t.stringify=t.strConcat=t.addCodeArg=t.str=t._=t.nil=t._Code=t.Name=t.IDENTIFIER=t._CodeOrName=void 0;class e{}t._CodeOrName=e,t.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class r extends e{constructor(d){if(super(),!t.IDENTIFIER.test(d))throw new Error("CodeGen: name must be a valid identifier");this.str=d}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}t.Name=r;class n extends e{constructor(d){super(),this._items=typeof d=="string"?[d]:d}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const d=this._items[0];return d===""||d==='""'}get str(){var d;return(d=this._str)!==null&&d!==void 0?d:this._str=this._items.reduce((m,w)=>`${m}${w}`,"")}get names(){var d;return(d=this._names)!==null&&d!==void 0?d:this._names=this._items.reduce((m,w)=>(w instanceof r&&(m[w.str]=(m[w.str]||0)+1),m),{})}}t._Code=n,t.nil=new n("");function s(_,...d){const m=[_[0]];let w=0;for(;w<d.length;)o(m,d[w]),m.push(_[++w]);return new n(m)}t._=s;const i=new n("+");function a(_,...d){const m=[y(_[0])];let w=0;for(;w<d.length;)m.push(i),o(m,d[w]),m.push(i,y(_[++w]));return c(m),new n(m)}t.str=a;function o(_,d){d instanceof n?_.push(...d._items):d instanceof r?_.push(d):_.push(p(d))}t.addCodeArg=o;function c(_){let d=1;for(;d<_.length-1;){if(_[d]===i){const m=u(_[d-1],_[d+1]);if(m!==void 0){_.splice(d-1,3,m);continue}_[d++]="+"}d++}}function u(_,d){if(d==='""')return _;if(_==='""')return d;if(typeof _=="string")return d instanceof r||_[_.length-1]!=='"'?void 0:typeof d!="string"?`${_.slice(0,-1)}${d}"`:d[0]==='"'?_.slice(0,-1)+d.slice(1):void 0;if(typeof d=="string"&&d[0]==='"'&&!(_ instanceof r))return`"${_}${d.slice(1)}`}function l(_,d){return d.emptyStr()?_:_.emptyStr()?d:a`${_}${d}`}t.strConcat=l;function p(_){return typeof _=="number"||typeof _=="boolean"||_===null?_:y(Array.isArray(_)?_.join(","):_)}function b(_){return new n(y(_))}t.stringify=b;function y(_){return JSON.stringify(_).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}t.safeStringify=y;function h(_){return typeof _=="string"&&t.IDENTIFIER.test(_)?new n(`.${_}`):s`[${_}]`}t.getProperty=h;function v(_){if(typeof _=="string"&&t.IDENTIFIER.test(_))return new n(`${_}`);throw new Error(`CodeGen: invalid export name: ${_}, use explicit $id name mapping`)}t.getEsmExportName=v;function f(_){return new n(_.toString())}t.regexpCode=f})(Rs)),Rs}var Ps={},Sa;function ka(){return Sa||(Sa=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;const e=Dr();class r extends Error{constructor(u){super(`CodeGen: "code" for ${u} not defined`),this.value=u.value}}var n;(function(c){c[c.Started=0]="Started",c[c.Completed=1]="Completed"})(n||(t.UsedValueState=n={})),t.varKinds={const:new e.Name("const"),let:new e.Name("let"),var:new e.Name("var")};class s{constructor({prefixes:u,parent:l}={}){this._names={},this._prefixes=u,this._parent=l}toName(u){return u instanceof e.Name?u:this.name(u)}name(u){return new e.Name(this._newName(u))}_newName(u){const l=this._names[u]||this._nameGroup(u);return`${u}${l.index++}`}_nameGroup(u){var l,p;if(!((p=(l=this._parent)===null||l===void 0?void 0:l._prefixes)===null||p===void 0)&&p.has(u)||this._prefixes&&!this._prefixes.has(u))throw new Error(`CodeGen: prefix "${u}" is not allowed in this scope`);return this._names[u]={prefix:u,index:0}}}t.Scope=s;class i extends e.Name{constructor(u,l){super(l),this.prefix=u}setValue(u,{property:l,itemIndex:p}){this.value=u,this.scopePath=(0,e._)`.${new e.Name(l)}[${p}]`}}t.ValueScopeName=i;const a=(0,e._)`\n`;class o extends s{constructor(u){super(u),this._values={},this._scope=u.scope,this.opts={...u,_n:u.lines?a:e.nil}}get(){return this._scope}name(u){return new i(u,this._newName(u))}value(u,l){var p;if(l.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const b=this.toName(u),{prefix:y}=b,h=(p=l.key)!==null&&p!==void 0?p:l.ref;let v=this._values[y];if(v){const d=v.get(h);if(d)return d}else v=this._values[y]=new Map;v.set(h,b);const f=this._scope[y]||(this._scope[y]=[]),_=f.length;return f[_]=l.ref,b.setValue(l,{property:y,itemIndex:_}),b}getValue(u,l){const p=this._values[u];if(p)return p.get(l)}scopeRefs(u,l=this._values){return this._reduceValues(l,p=>{if(p.scopePath===void 0)throw new Error(`CodeGen: name "${p}" has no value`);return(0,e._)`${u}${p.scopePath}`})}scopeCode(u=this._values,l,p){return this._reduceValues(u,b=>{if(b.value===void 0)throw new Error(`CodeGen: name "${b}" has no value`);return b.value.code},l,p)}_reduceValues(u,l,p={},b){let y=e.nil;for(const h in u){const v=u[h];if(!v)continue;const f=p[h]=p[h]||new Map;v.forEach(_=>{if(f.has(_))return;f.set(_,n.Started);let d=l(_);if(d){const m=this.opts.es5?t.varKinds.var:t.varKinds.const;y=(0,e._)`${y}${m} ${_} = ${d};${this.opts._n}`}else if(d=b?.(_))y=(0,e._)`${y}${d}${this.opts._n}`;else throw new r(_);f.set(_,n.Completed)})}return y}}t.ValueScope=o})(Ps)),Ps}var Ea;function se(){return Ea||(Ea=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.or=t.and=t.not=t.CodeGen=t.operators=t.varKinds=t.ValueScopeName=t.ValueScope=t.Scope=t.Name=t.regexpCode=t.stringify=t.getProperty=t.nil=t.strConcat=t.str=t._=void 0;const e=Dr(),r=ka();var n=Dr();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(t,"strConcat",{enumerable:!0,get:function(){return n.strConcat}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(t,"getProperty",{enumerable:!0,get:function(){return n.getProperty}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(t,"regexpCode",{enumerable:!0,get:function(){return n.regexpCode}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return n.Name}});var s=ka();Object.defineProperty(t,"Scope",{enumerable:!0,get:function(){return s.Scope}}),Object.defineProperty(t,"ValueScope",{enumerable:!0,get:function(){return s.ValueScope}}),Object.defineProperty(t,"ValueScopeName",{enumerable:!0,get:function(){return s.ValueScopeName}}),Object.defineProperty(t,"varKinds",{enumerable:!0,get:function(){return s.varKinds}}),t.operators={GT:new e._Code(">"),GTE:new e._Code(">="),LT:new e._Code("<"),LTE:new e._Code("<="),EQ:new e._Code("==="),NEQ:new e._Code("!=="),NOT:new e._Code("!"),OR:new e._Code("||"),AND:new e._Code("&&"),ADD:new e._Code("+")};class i{optimizeNodes(){return this}optimizeNames(S,R){return this}}class a extends i{constructor(S,R,j){super(),this.varKind=S,this.name=R,this.rhs=j}render({es5:S,_n:R}){const j=S?r.varKinds.var:this.varKind,X=this.rhs===void 0?"":` = ${this.rhs}`;return`${j} ${this.name}${X};`+R}optimizeNames(S,R){if(S[this.name.str])return this.rhs&&(this.rhs=G(this.rhs,S,R)),this}get names(){return this.rhs instanceof e._CodeOrName?this.rhs.names:{}}}class o extends i{constructor(S,R,j){super(),this.lhs=S,this.rhs=R,this.sideEffects=j}render({_n:S}){return`${this.lhs} = ${this.rhs};`+S}optimizeNames(S,R){if(!(this.lhs instanceof e.Name&&!S[this.lhs.str]&&!this.sideEffects))return this.rhs=G(this.rhs,S,R),this}get names(){const S=this.lhs instanceof e.Name?{}:{...this.lhs.names};return J(S,this.rhs)}}class c extends o{constructor(S,R,j,X){super(S,j,X),this.op=R}render({_n:S}){return`${this.lhs} ${this.op}= ${this.rhs};`+S}}class u extends i{constructor(S){super(),this.label=S,this.names={}}render({_n:S}){return`${this.label}:`+S}}class l extends i{constructor(S){super(),this.label=S,this.names={}}render({_n:S}){return`break${this.label?` ${this.label}`:""};`+S}}class p extends i{constructor(S){super(),this.error=S}render({_n:S}){return`throw ${this.error};`+S}get names(){return this.error.names}}class b extends i{constructor(S){super(),this.code=S}render({_n:S}){return`${this.code};`+S}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(S,R){return this.code=G(this.code,S,R),this}get names(){return this.code instanceof e._CodeOrName?this.code.names:{}}}class y extends i{constructor(S=[]){super(),this.nodes=S}render(S){return this.nodes.reduce((R,j)=>R+j.render(S),"")}optimizeNodes(){const{nodes:S}=this;let R=S.length;for(;R--;){const j=S[R].optimizeNodes();Array.isArray(j)?S.splice(R,1,...j):j?S[R]=j:S.splice(R,1)}return S.length>0?this:void 0}optimizeNames(S,R){const{nodes:j}=this;let X=j.length;for(;X--;){const te=j[X];te.optimizeNames(S,R)||(ge(S,te.names),j.splice(X,1))}return j.length>0?this:void 0}get names(){return this.nodes.reduce((S,R)=>V(S,R.names),{})}}class h extends y{render(S){return"{"+S._n+super.render(S)+"}"+S._n}}class v extends y{}class f extends h{}f.kind="else";class _ extends h{constructor(S,R){super(R),this.condition=S}render(S){let R=`if(${this.condition})`+super.render(S);return this.else&&(R+="else "+this.else.render(S)),R}optimizeNodes(){super.optimizeNodes();const S=this.condition;if(S===!0)return this.nodes;let R=this.else;if(R){const j=R.optimizeNodes();R=this.else=Array.isArray(j)?new f(j):j}if(R)return S===!1?R instanceof _?R:R.nodes:this.nodes.length?this:new _(Ve(S),R instanceof _?[R]:R.nodes);if(!(S===!1||!this.nodes.length))return this}optimizeNames(S,R){var j;if(this.else=(j=this.else)===null||j===void 0?void 0:j.optimizeNames(S,R),!!(super.optimizeNames(S,R)||this.else))return this.condition=G(this.condition,S,R),this}get names(){const S=super.names;return J(S,this.condition),this.else&&V(S,this.else.names),S}}_.kind="if";class d extends h{}d.kind="for";class m extends d{constructor(S){super(),this.iteration=S}render(S){return`for(${this.iteration})`+super.render(S)}optimizeNames(S,R){if(super.optimizeNames(S,R))return this.iteration=G(this.iteration,S,R),this}get names(){return V(super.names,this.iteration.names)}}class w extends d{constructor(S,R,j,X){super(),this.varKind=S,this.name=R,this.from=j,this.to=X}render(S){const R=S.es5?r.varKinds.var:this.varKind,{name:j,from:X,to:te}=this;return`for(${R} ${j}=${X}; ${j}<${te}; ${j}++)`+super.render(S)}get names(){const S=J(super.names,this.from);return J(S,this.to)}}class g extends d{constructor(S,R,j,X){super(),this.loop=S,this.varKind=R,this.name=j,this.iterable=X}render(S){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(S)}optimizeNames(S,R){if(super.optimizeNames(S,R))return this.iterable=G(this.iterable,S,R),this}get names(){return V(super.names,this.iterable.names)}}class $ extends h{constructor(S,R,j){super(),this.name=S,this.args=R,this.async=j}render(S){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(S)}}$.kind="func";class k extends y{render(S){return"return "+super.render(S)}}k.kind="return";class N extends h{render(S){let R="try"+super.render(S);return this.catch&&(R+=this.catch.render(S)),this.finally&&(R+=this.finally.render(S)),R}optimizeNodes(){var S,R;return super.optimizeNodes(),(S=this.catch)===null||S===void 0||S.optimizeNodes(),(R=this.finally)===null||R===void 0||R.optimizeNodes(),this}optimizeNames(S,R){var j,X;return super.optimizeNames(S,R),(j=this.catch)===null||j===void 0||j.optimizeNames(S,R),(X=this.finally)===null||X===void 0||X.optimizeNames(S,R),this}get names(){const S=super.names;return this.catch&&V(S,this.catch.names),this.finally&&V(S,this.finally.names),S}}class Z extends h{constructor(S){super(),this.error=S}render(S){return`catch(${this.error})`+super.render(S)}}Z.kind="catch";class H extends h{render(S){return"finally"+super.render(S)}}H.kind="finally";class z{constructor(S,R={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...R,_n:R.lines?`
2
+ `:""},this._extScope=S,this._scope=new r.Scope({parent:S}),this._nodes=[new v]}toString(){return this._root.render(this.opts)}name(S){return this._scope.name(S)}scopeName(S){return this._extScope.name(S)}scopeValue(S,R){const j=this._extScope.value(S,R);return(this._values[j.prefix]||(this._values[j.prefix]=new Set)).add(j),j}getScopeValue(S,R){return this._extScope.getValue(S,R)}scopeRefs(S){return this._extScope.scopeRefs(S,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(S,R,j,X){const te=this._scope.toName(R);return j!==void 0&&X&&(this._constants[te.str]=j),this._leafNode(new a(S,te,j)),te}const(S,R,j){return this._def(r.varKinds.const,S,R,j)}let(S,R,j){return this._def(r.varKinds.let,S,R,j)}var(S,R,j){return this._def(r.varKinds.var,S,R,j)}assign(S,R,j){return this._leafNode(new o(S,R,j))}add(S,R){return this._leafNode(new c(S,t.operators.ADD,R))}code(S){return typeof S=="function"?S():S!==e.nil&&this._leafNode(new b(S)),this}object(...S){const R=["{"];for(const[j,X]of S)R.length>1&&R.push(","),R.push(j),(j!==X||this.opts.es5)&&(R.push(":"),(0,e.addCodeArg)(R,X));return R.push("}"),new e._Code(R)}if(S,R,j){if(this._blockNode(new _(S)),R&&j)this.code(R).else().code(j).endIf();else if(R)this.code(R).endIf();else if(j)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(S){return this._elseNode(new _(S))}else(){return this._elseNode(new f)}endIf(){return this._endBlockNode(_,f)}_for(S,R){return this._blockNode(S),R&&this.code(R).endFor(),this}for(S,R){return this._for(new m(S),R)}forRange(S,R,j,X,te=this.opts.es5?r.varKinds.var:r.varKinds.let){const _e=this._scope.toName(S);return this._for(new w(te,_e,R,j),()=>X(_e))}forOf(S,R,j,X=r.varKinds.const){const te=this._scope.toName(S);if(this.opts.es5){const _e=R instanceof e.Name?R:this.var("_arr",R);return this.forRange("_i",0,(0,e._)`${_e}.length`,de=>{this.var(te,(0,e._)`${_e}[${de}]`),j(te)})}return this._for(new g("of",X,te,R),()=>j(te))}forIn(S,R,j,X=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(S,(0,e._)`Object.keys(${R})`,j);const te=this._scope.toName(S);return this._for(new g("in",X,te,R),()=>j(te))}endFor(){return this._endBlockNode(d)}label(S){return this._leafNode(new u(S))}break(S){return this._leafNode(new l(S))}return(S){const R=new k;if(this._blockNode(R),this.code(S),R.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(k)}try(S,R,j){if(!R&&!j)throw new Error('CodeGen: "try" without "catch" and "finally"');const X=new N;if(this._blockNode(X),this.code(S),R){const te=this.name("e");this._currNode=X.catch=new Z(te),R(te)}return j&&(this._currNode=X.finally=new H,this.code(j)),this._endBlockNode(Z,H)}throw(S){return this._leafNode(new p(S))}block(S,R){return this._blockStarts.push(this._nodes.length),S&&this.code(S).endBlock(R),this}endBlock(S){const R=this._blockStarts.pop();if(R===void 0)throw new Error("CodeGen: not in self-balancing block");const j=this._nodes.length-R;if(j<0||S!==void 0&&j!==S)throw new Error(`CodeGen: wrong number of nodes: ${j} vs ${S} expected`);return this._nodes.length=R,this}func(S,R=e.nil,j,X){return this._blockNode(new $(S,R,j)),X&&this.code(X).endFunc(),this}endFunc(){return this._endBlockNode($)}optimize(S=1){for(;S-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(S){return this._currNode.nodes.push(S),this}_blockNode(S){this._currNode.nodes.push(S),this._nodes.push(S)}_endBlockNode(S,R){const j=this._currNode;if(j instanceof S||R&&j instanceof R)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${R?`${S.kind}/${R.kind}`:S.kind}"`)}_elseNode(S){const R=this._currNode;if(!(R instanceof _))throw new Error('CodeGen: "else" without "if"');return this._currNode=R.else=S,this}get _root(){return this._nodes[0]}get _currNode(){const S=this._nodes;return S[S.length-1]}set _currNode(S){const R=this._nodes;R[R.length-1]=S}}t.CodeGen=z;function V(I,S){for(const R in S)I[R]=(I[R]||0)+(S[R]||0);return I}function J(I,S){return S instanceof e._CodeOrName?V(I,S.names):I}function G(I,S,R){if(I instanceof e.Name)return j(I);if(!X(I))return I;return new e._Code(I._items.reduce((te,_e)=>(_e instanceof e.Name&&(_e=j(_e)),_e instanceof e._Code?te.push(..._e._items):te.push(_e),te),[]));function j(te){const _e=R[te.str];return _e===void 0||S[te.str]!==1?te:(delete S[te.str],_e)}function X(te){return te instanceof e._Code&&te._items.some(_e=>_e instanceof e.Name&&S[_e.str]===1&&R[_e.str]!==void 0)}}function ge(I,S){for(const R in S)I[R]=(I[R]||0)-(S[R]||0)}function Ve(I){return typeof I=="boolean"||typeof I=="number"||I===null?!I:(0,e._)`!${q(I)}`}t.not=Ve;const Fe=C(t.operators.AND);function be(...I){return I.reduce(Fe)}t.and=be;const ft=C(t.operators.OR);function U(...I){return I.reduce(ft)}t.or=U;function C(I){return(S,R)=>S===e.nil?R:R===e.nil?S:(0,e._)`${q(S)} ${I} ${q(R)}`}function q(I){return I instanceof e.Name?I:(0,e._)`(${I})`}})(Es)),Es}var ie={},Ra;function he(){if(Ra)return ie;Ra=1,Object.defineProperty(ie,"__esModule",{value:!0}),ie.checkStrictMode=ie.getErrorPath=ie.Type=ie.useFunc=ie.setEvaluated=ie.evaluatedPropsToName=ie.mergeEvaluated=ie.eachItem=ie.unescapeJsonPointer=ie.escapeJsonPointer=ie.escapeFragment=ie.unescapeFragment=ie.schemaRefOrVal=ie.schemaHasRulesButRef=ie.schemaHasRules=ie.checkUnknownRules=ie.alwaysValidSchema=ie.toHash=void 0;const t=se(),e=Dr();function r(g){const $={};for(const k of g)$[k]=!0;return $}ie.toHash=r;function n(g,$){return typeof $=="boolean"?$:Object.keys($).length===0?!0:(s(g,$),!i($,g.self.RULES.all))}ie.alwaysValidSchema=n;function s(g,$=g.schema){const{opts:k,self:N}=g;if(!k.strictSchema||typeof $=="boolean")return;const Z=N.RULES.keywords;for(const H in $)Z[H]||w(g,`unknown keyword: "${H}"`)}ie.checkUnknownRules=s;function i(g,$){if(typeof g=="boolean")return!g;for(const k in g)if($[k])return!0;return!1}ie.schemaHasRules=i;function a(g,$){if(typeof g=="boolean")return!g;for(const k in g)if(k!=="$ref"&&$.all[k])return!0;return!1}ie.schemaHasRulesButRef=a;function o({topSchemaRef:g,schemaPath:$},k,N,Z){if(!Z){if(typeof k=="number"||typeof k=="boolean")return k;if(typeof k=="string")return(0,t._)`${k}`}return(0,t._)`${g}${$}${(0,t.getProperty)(N)}`}ie.schemaRefOrVal=o;function c(g){return p(decodeURIComponent(g))}ie.unescapeFragment=c;function u(g){return encodeURIComponent(l(g))}ie.escapeFragment=u;function l(g){return typeof g=="number"?`${g}`:g.replace(/~/g,"~0").replace(/\//g,"~1")}ie.escapeJsonPointer=l;function p(g){return g.replace(/~1/g,"/").replace(/~0/g,"~")}ie.unescapeJsonPointer=p;function b(g,$){if(Array.isArray(g))for(const k of g)$(k);else $(g)}ie.eachItem=b;function y({mergeNames:g,mergeToName:$,mergeValues:k,resultToName:N}){return(Z,H,z,V)=>{const J=z===void 0?H:z instanceof t.Name?(H instanceof t.Name?g(Z,H,z):$(Z,H,z),z):H instanceof t.Name?($(Z,z,H),H):k(H,z);return V===t.Name&&!(J instanceof t.Name)?N(Z,J):J}}ie.mergeEvaluated={props:y({mergeNames:(g,$,k)=>g.if((0,t._)`${k} !== true && ${$} !== undefined`,()=>{g.if((0,t._)`${$} === true`,()=>g.assign(k,!0),()=>g.assign(k,(0,t._)`${k} || {}`).code((0,t._)`Object.assign(${k}, ${$})`))}),mergeToName:(g,$,k)=>g.if((0,t._)`${k} !== true`,()=>{$===!0?g.assign(k,!0):(g.assign(k,(0,t._)`${k} || {}`),v(g,k,$))}),mergeValues:(g,$)=>g===!0?!0:{...g,...$},resultToName:h}),items:y({mergeNames:(g,$,k)=>g.if((0,t._)`${k} !== true && ${$} !== undefined`,()=>g.assign(k,(0,t._)`${$} === true ? true : ${k} > ${$} ? ${k} : ${$}`)),mergeToName:(g,$,k)=>g.if((0,t._)`${k} !== true`,()=>g.assign(k,$===!0?!0:(0,t._)`${k} > ${$} ? ${k} : ${$}`)),mergeValues:(g,$)=>g===!0?!0:Math.max(g,$),resultToName:(g,$)=>g.var("items",$)})};function h(g,$){if($===!0)return g.var("props",!0);const k=g.var("props",(0,t._)`{}`);return $!==void 0&&v(g,k,$),k}ie.evaluatedPropsToName=h;function v(g,$,k){Object.keys(k).forEach(N=>g.assign((0,t._)`${$}${(0,t.getProperty)(N)}`,!0))}ie.setEvaluated=v;const f={};function _(g,$){return g.scopeValue("func",{ref:$,code:f[$.code]||(f[$.code]=new e._Code($.code))})}ie.useFunc=_;var d;(function(g){g[g.Num=0]="Num",g[g.Str=1]="Str"})(d||(ie.Type=d={}));function m(g,$,k){if(g instanceof t.Name){const N=$===d.Num;return k?N?(0,t._)`"[" + ${g} + "]"`:(0,t._)`"['" + ${g} + "']"`:N?(0,t._)`"/" + ${g}`:(0,t._)`"/" + ${g}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return k?(0,t.getProperty)(g).toString():"/"+l(g)}ie.getErrorPath=m;function w(g,$,k=g.opts.strictSchema){if(k){if($=`strict mode: ${$}`,k===!0)throw new Error($);g.self.logger.warn($)}}return ie.checkStrictMode=w,ie}var Vr={},Pa;function $t(){if(Pa)return Vr;Pa=1,Object.defineProperty(Vr,"__esModule",{value:!0});const t=se(),e={data:new t.Name("data"),valCxt:new t.Name("valCxt"),instancePath:new t.Name("instancePath"),parentData:new t.Name("parentData"),parentDataProperty:new t.Name("parentDataProperty"),rootData:new t.Name("rootData"),dynamicAnchors:new t.Name("dynamicAnchors"),vErrors:new t.Name("vErrors"),errors:new t.Name("errors"),this:new t.Name("this"),self:new t.Name("self"),scope:new t.Name("scope"),json:new t.Name("json"),jsonPos:new t.Name("jsonPos"),jsonLen:new t.Name("jsonLen"),jsonPart:new t.Name("jsonPart")};return Vr.default=e,Vr}var Ta;function Fr(){return Ta||(Ta=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.extendErrors=t.resetErrorsCount=t.reportExtraError=t.reportError=t.keyword$DataError=t.keywordError=void 0;const e=se(),r=he(),n=$t();t.keywordError={message:({keyword:f})=>(0,e.str)`must pass "${f}" keyword validation`},t.keyword$DataError={message:({keyword:f,schemaType:_})=>_?(0,e.str)`"${f}" keyword must be ${_} ($data)`:(0,e.str)`"${f}" keyword is invalid ($data)`};function s(f,_=t.keywordError,d,m){const{it:w}=f,{gen:g,compositeRule:$,allErrors:k}=w,N=p(f,_,d);m??($||k)?c(g,N):u(w,(0,e._)`[${N}]`)}t.reportError=s;function i(f,_=t.keywordError,d){const{it:m}=f,{gen:w,compositeRule:g,allErrors:$}=m,k=p(f,_,d);c(w,k),g||$||u(m,n.default.vErrors)}t.reportExtraError=i;function a(f,_){f.assign(n.default.errors,_),f.if((0,e._)`${n.default.vErrors} !== null`,()=>f.if(_,()=>f.assign((0,e._)`${n.default.vErrors}.length`,_),()=>f.assign(n.default.vErrors,null)))}t.resetErrorsCount=a;function o({gen:f,keyword:_,schemaValue:d,data:m,errsCount:w,it:g}){if(w===void 0)throw new Error("ajv implementation error");const $=f.name("err");f.forRange("i",w,n.default.errors,k=>{f.const($,(0,e._)`${n.default.vErrors}[${k}]`),f.if((0,e._)`${$}.instancePath === undefined`,()=>f.assign((0,e._)`${$}.instancePath`,(0,e.strConcat)(n.default.instancePath,g.errorPath))),f.assign((0,e._)`${$}.schemaPath`,(0,e.str)`${g.errSchemaPath}/${_}`),g.opts.verbose&&(f.assign((0,e._)`${$}.schema`,d),f.assign((0,e._)`${$}.data`,m))})}t.extendErrors=o;function c(f,_){const d=f.const("err",_);f.if((0,e._)`${n.default.vErrors} === null`,()=>f.assign(n.default.vErrors,(0,e._)`[${d}]`),(0,e._)`${n.default.vErrors}.push(${d})`),f.code((0,e._)`${n.default.errors}++`)}function u(f,_){const{gen:d,validateName:m,schemaEnv:w}=f;w.$async?d.throw((0,e._)`new ${f.ValidationError}(${_})`):(d.assign((0,e._)`${m}.errors`,_),d.return(!1))}const l={keyword:new e.Name("keyword"),schemaPath:new e.Name("schemaPath"),params:new e.Name("params"),propertyName:new e.Name("propertyName"),message:new e.Name("message"),schema:new e.Name("schema"),parentSchema:new e.Name("parentSchema")};function p(f,_,d){const{createErrors:m}=f.it;return m===!1?(0,e._)`{}`:b(f,_,d)}function b(f,_,d={}){const{gen:m,it:w}=f,g=[y(w,d),h(f,d)];return v(f,_,g),m.object(...g)}function y({errorPath:f},{instancePath:_}){const d=_?(0,e.str)`${f}${(0,r.getErrorPath)(_,r.Type.Str)}`:f;return[n.default.instancePath,(0,e.strConcat)(n.default.instancePath,d)]}function h({keyword:f,it:{errSchemaPath:_}},{schemaPath:d,parentSchema:m}){let w=m?_:(0,e.str)`${_}/${f}`;return d&&(w=(0,e.str)`${w}${(0,r.getErrorPath)(d,r.Type.Str)}`),[l.schemaPath,w]}function v(f,{params:_,message:d},m){const{keyword:w,data:g,schemaValue:$,it:k}=f,{opts:N,propertyName:Z,topSchemaRef:H,schemaPath:z}=k;m.push([l.keyword,w],[l.params,typeof _=="function"?_(f):_||(0,e._)`{}`]),N.messages&&m.push([l.message,typeof d=="function"?d(f):d]),N.verbose&&m.push([l.schema,$],[l.parentSchema,(0,e._)`${H}${z}`],[n.default.data,g]),Z&&m.push([l.propertyName,Z])}})(ks)),ks}var Ca;function md(){if(Ca)return zt;Ca=1,Object.defineProperty(zt,"__esModule",{value:!0}),zt.boolOrEmptySchema=zt.topBoolOrEmptySchema=void 0;const t=Fr(),e=se(),r=$t(),n={message:"boolean schema is false"};function s(o){const{gen:c,schema:u,validateName:l}=o;u===!1?a(o,!1):typeof u=="object"&&u.$async===!0?c.return(r.default.data):(c.assign((0,e._)`${l}.errors`,null),c.return(!0))}zt.topBoolOrEmptySchema=s;function i(o,c){const{gen:u,schema:l}=o;l===!1?(u.var(c,!1),a(o)):u.var(c,!0)}zt.boolOrEmptySchema=i;function a(o,c){const{gen:u,data:l}=o,p={gen:u,keyword:"false schema",data:l,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:o};(0,t.reportError)(p,n,void 0,c)}return zt}var ze={},Mt={},Oa;function Ia(){if(Oa)return Mt;Oa=1,Object.defineProperty(Mt,"__esModule",{value:!0}),Mt.getRules=Mt.isJSONType=void 0;const t=["string","number","integer","boolean","null","object","array"],e=new Set(t);function r(s){return typeof s=="string"&&e.has(s)}Mt.isJSONType=r;function n(){const s={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...s,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},s.number,s.string,s.array,s.object],post:{rules:[]},all:{},keywords:{}}}return Mt.getRules=n,Mt}var gt={},Na;function Aa(){if(Na)return gt;Na=1,Object.defineProperty(gt,"__esModule",{value:!0}),gt.shouldUseRule=gt.shouldUseGroup=gt.schemaHasRulesForType=void 0;function t({schema:n,self:s},i){const a=s.RULES.types[i];return a&&a!==!0&&e(n,a)}gt.schemaHasRulesForType=t;function e(n,s){return s.rules.some(i=>r(n,i))}gt.shouldUseGroup=e;function r(n,s){var i;return n[s.keyword]!==void 0||((i=s.definition.implements)===null||i===void 0?void 0:i.some(a=>n[a]!==void 0))}return gt.shouldUseRule=r,gt}var ja;function Hr(){if(ja)return ze;ja=1,Object.defineProperty(ze,"__esModule",{value:!0}),ze.reportTypeError=ze.checkDataTypes=ze.checkDataType=ze.coerceAndCheckDataType=ze.getJSONTypes=ze.getSchemaTypes=ze.DataType=void 0;const t=Ia(),e=Aa(),r=Fr(),n=se(),s=he();var i;(function(d){d[d.Correct=0]="Correct",d[d.Wrong=1]="Wrong"})(i||(ze.DataType=i={}));function a(d){const m=o(d.type);if(m.includes("null")){if(d.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!m.length&&d.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');d.nullable===!0&&m.push("null")}return m}ze.getSchemaTypes=a;function o(d){const m=Array.isArray(d)?d:d?[d]:[];if(m.every(t.isJSONType))return m;throw new Error("type must be JSONType or JSONType[]: "+m.join(","))}ze.getJSONTypes=o;function c(d,m){const{gen:w,data:g,opts:$}=d,k=l(m,$.coerceTypes),N=m.length>0&&!(k.length===0&&m.length===1&&(0,e.schemaHasRulesForType)(d,m[0]));if(N){const Z=h(m,g,$.strictNumbers,i.Wrong);w.if(Z,()=>{k.length?p(d,m,k):f(d)})}return N}ze.coerceAndCheckDataType=c;const u=new Set(["string","number","integer","boolean","null"]);function l(d,m){return m?d.filter(w=>u.has(w)||m==="array"&&w==="array"):[]}function p(d,m,w){const{gen:g,data:$,opts:k}=d,N=g.let("dataType",(0,n._)`typeof ${$}`),Z=g.let("coerced",(0,n._)`undefined`);k.coerceTypes==="array"&&g.if((0,n._)`${N} == 'object' && Array.isArray(${$}) && ${$}.length == 1`,()=>g.assign($,(0,n._)`${$}[0]`).assign(N,(0,n._)`typeof ${$}`).if(h(m,$,k.strictNumbers),()=>g.assign(Z,$))),g.if((0,n._)`${Z} !== undefined`);for(const z of w)(u.has(z)||z==="array"&&k.coerceTypes==="array")&&H(z);g.else(),f(d),g.endIf(),g.if((0,n._)`${Z} !== undefined`,()=>{g.assign($,Z),b(d,Z)});function H(z){switch(z){case"string":g.elseIf((0,n._)`${N} == "number" || ${N} == "boolean"`).assign(Z,(0,n._)`"" + ${$}`).elseIf((0,n._)`${$} === null`).assign(Z,(0,n._)`""`);return;case"number":g.elseIf((0,n._)`${N} == "boolean" || ${$} === null
3
+ || (${N} == "string" && ${$} && ${$} == +${$})`).assign(Z,(0,n._)`+${$}`);return;case"integer":g.elseIf((0,n._)`${N} === "boolean" || ${$} === null
4
+ || (${N} === "string" && ${$} && ${$} == +${$} && !(${$} % 1))`).assign(Z,(0,n._)`+${$}`);return;case"boolean":g.elseIf((0,n._)`${$} === "false" || ${$} === 0 || ${$} === null`).assign(Z,!1).elseIf((0,n._)`${$} === "true" || ${$} === 1`).assign(Z,!0);return;case"null":g.elseIf((0,n._)`${$} === "" || ${$} === 0 || ${$} === false`),g.assign(Z,null);return;case"array":g.elseIf((0,n._)`${N} === "string" || ${N} === "number"
5
+ || ${N} === "boolean" || ${$} === null`).assign(Z,(0,n._)`[${$}]`)}}}function b({gen:d,parentData:m,parentDataProperty:w},g){d.if((0,n._)`${m} !== undefined`,()=>d.assign((0,n._)`${m}[${w}]`,g))}function y(d,m,w,g=i.Correct){const $=g===i.Correct?n.operators.EQ:n.operators.NEQ;let k;switch(d){case"null":return(0,n._)`${m} ${$} null`;case"array":k=(0,n._)`Array.isArray(${m})`;break;case"object":k=(0,n._)`${m} && typeof ${m} == "object" && !Array.isArray(${m})`;break;case"integer":k=N((0,n._)`!(${m} % 1) && !isNaN(${m})`);break;case"number":k=N();break;default:return(0,n._)`typeof ${m} ${$} ${d}`}return g===i.Correct?k:(0,n.not)(k);function N(Z=n.nil){return(0,n.and)((0,n._)`typeof ${m} == "number"`,Z,w?(0,n._)`isFinite(${m})`:n.nil)}}ze.checkDataType=y;function h(d,m,w,g){if(d.length===1)return y(d[0],m,w,g);let $;const k=(0,s.toHash)(d);if(k.array&&k.object){const N=(0,n._)`typeof ${m} != "object"`;$=k.null?N:(0,n._)`!${m} || ${N}`,delete k.null,delete k.array,delete k.object}else $=n.nil;k.number&&delete k.integer;for(const N in k)$=(0,n.and)($,y(N,m,w,g));return $}ze.checkDataTypes=h;const v={message:({schema:d})=>`must be ${d}`,params:({schema:d,schemaValue:m})=>typeof d=="string"?(0,n._)`{type: ${d}}`:(0,n._)`{type: ${m}}`};function f(d){const m=_(d);(0,r.reportError)(m,v)}ze.reportTypeError=f;function _(d){const{gen:m,data:w,schema:g}=d,$=(0,s.schemaRefOrVal)(d,g,"type");return{gen:m,keyword:"type",data:w,schema:g.type,schemaCode:$,schemaValue:$,parentSchema:g,params:{},it:d}}return ze}var cr={},za;function _d(){if(za)return cr;za=1,Object.defineProperty(cr,"__esModule",{value:!0}),cr.assignDefaults=void 0;const t=se(),e=he();function r(s,i){const{properties:a,items:o}=s.schema;if(i==="object"&&a)for(const c in a)n(s,c,a[c].default);else i==="array"&&Array.isArray(o)&&o.forEach((c,u)=>n(s,u,c.default))}cr.assignDefaults=r;function n(s,i,a){const{gen:o,compositeRule:c,data:u,opts:l}=s;if(a===void 0)return;const p=(0,t._)`${u}${(0,t.getProperty)(i)}`;if(c){(0,e.checkStrictMode)(s,`default is ignored for: ${p}`);return}let b=(0,t._)`${p} === undefined`;l.useDefaults==="empty"&&(b=(0,t._)`${b} || ${p} === null || ${p} === ""`),o.if(b,(0,t._)`${p} = ${(0,t.stringify)(a)}`)}return cr}var nt={},ve={},Ma;function st(){if(Ma)return ve;Ma=1,Object.defineProperty(ve,"__esModule",{value:!0}),ve.validateUnion=ve.validateArray=ve.usePattern=ve.callValidateCode=ve.schemaProperties=ve.allSchemaProperties=ve.noPropertyInData=ve.propertyInData=ve.isOwnProperty=ve.hasPropFunc=ve.reportMissingProp=ve.checkMissingProp=ve.checkReportMissingProp=void 0;const t=se(),e=he(),r=$t(),n=he();function s(d,m){const{gen:w,data:g,it:$}=d;w.if(l(w,g,m,$.opts.ownProperties),()=>{d.setParams({missingProperty:(0,t._)`${m}`},!0),d.error()})}ve.checkReportMissingProp=s;function i({gen:d,data:m,it:{opts:w}},g,$){return(0,t.or)(...g.map(k=>(0,t.and)(l(d,m,k,w.ownProperties),(0,t._)`${$} = ${k}`)))}ve.checkMissingProp=i;function a(d,m){d.setParams({missingProperty:m},!0),d.error()}ve.reportMissingProp=a;function o(d){return d.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,t._)`Object.prototype.hasOwnProperty`})}ve.hasPropFunc=o;function c(d,m,w){return(0,t._)`${o(d)}.call(${m}, ${w})`}ve.isOwnProperty=c;function u(d,m,w,g){const $=(0,t._)`${m}${(0,t.getProperty)(w)} !== undefined`;return g?(0,t._)`${$} && ${c(d,m,w)}`:$}ve.propertyInData=u;function l(d,m,w,g){const $=(0,t._)`${m}${(0,t.getProperty)(w)} === undefined`;return g?(0,t.or)($,(0,t.not)(c(d,m,w))):$}ve.noPropertyInData=l;function p(d){return d?Object.keys(d).filter(m=>m!=="__proto__"):[]}ve.allSchemaProperties=p;function b(d,m){return p(m).filter(w=>!(0,e.alwaysValidSchema)(d,m[w]))}ve.schemaProperties=b;function y({schemaCode:d,data:m,it:{gen:w,topSchemaRef:g,schemaPath:$,errorPath:k},it:N},Z,H,z){const V=z?(0,t._)`${d}, ${m}, ${g}${$}`:m,J=[[r.default.instancePath,(0,t.strConcat)(r.default.instancePath,k)],[r.default.parentData,N.parentData],[r.default.parentDataProperty,N.parentDataProperty],[r.default.rootData,r.default.rootData]];N.opts.dynamicRef&&J.push([r.default.dynamicAnchors,r.default.dynamicAnchors]);const G=(0,t._)`${V}, ${w.object(...J)}`;return H!==t.nil?(0,t._)`${Z}.call(${H}, ${G})`:(0,t._)`${Z}(${G})`}ve.callValidateCode=y;const h=(0,t._)`new RegExp`;function v({gen:d,it:{opts:m}},w){const g=m.unicodeRegExp?"u":"",{regExp:$}=m.code,k=$(w,g);return d.scopeValue("pattern",{key:k.toString(),ref:k,code:(0,t._)`${$.code==="new RegExp"?h:(0,n.useFunc)(d,$)}(${w}, ${g})`})}ve.usePattern=v;function f(d){const{gen:m,data:w,keyword:g,it:$}=d,k=m.name("valid");if($.allErrors){const Z=m.let("valid",!0);return N(()=>m.assign(Z,!1)),Z}return m.var(k,!0),N(()=>m.break()),k;function N(Z){const H=m.const("len",(0,t._)`${w}.length`);m.forRange("i",0,H,z=>{d.subschema({keyword:g,dataProp:z,dataPropType:e.Type.Num},k),m.if((0,t.not)(k),Z)})}}ve.validateArray=f;function _(d){const{gen:m,schema:w,keyword:g,it:$}=d;if(!Array.isArray(w))throw new Error("ajv implementation error");if(w.some(H=>(0,e.alwaysValidSchema)($,H))&&!$.opts.unevaluated)return;const N=m.let("valid",!1),Z=m.name("_valid");m.block(()=>w.forEach((H,z)=>{const V=d.subschema({keyword:g,schemaProp:z,compositeRule:!0},Z);m.assign(N,(0,t._)`${N} || ${Z}`),d.mergeValidEvaluated(V,Z)||m.if((0,t.not)(N))})),d.result(N,()=>d.reset(),()=>d.error(!0))}return ve.validateUnion=_,ve}var qa;function gd(){if(qa)return nt;qa=1,Object.defineProperty(nt,"__esModule",{value:!0}),nt.validateKeywordUsage=nt.validSchemaType=nt.funcKeywordCode=nt.macroKeywordCode=void 0;const t=se(),e=$t(),r=st(),n=Fr();function s(b,y){const{gen:h,keyword:v,schema:f,parentSchema:_,it:d}=b,m=y.macro.call(d.self,f,_,d),w=u(h,v,m);d.opts.validateSchema!==!1&&d.self.validateSchema(m,!0);const g=h.name("valid");b.subschema({schema:m,schemaPath:t.nil,errSchemaPath:`${d.errSchemaPath}/${v}`,topSchemaRef:w,compositeRule:!0},g),b.pass(g,()=>b.error(!0))}nt.macroKeywordCode=s;function i(b,y){var h;const{gen:v,keyword:f,schema:_,parentSchema:d,$data:m,it:w}=b;c(w,y);const g=!m&&y.compile?y.compile.call(w.self,_,d,w):y.validate,$=u(v,f,g),k=v.let("valid");b.block$data(k,N),b.ok((h=y.valid)!==null&&h!==void 0?h:k);function N(){if(y.errors===!1)z(),y.modifying&&a(b),V(()=>b.error());else{const J=y.async?Z():H();y.modifying&&a(b),V(()=>o(b,J))}}function Z(){const J=v.let("ruleErrs",null);return v.try(()=>z((0,t._)`await `),G=>v.assign(k,!1).if((0,t._)`${G} instanceof ${w.ValidationError}`,()=>v.assign(J,(0,t._)`${G}.errors`),()=>v.throw(G))),J}function H(){const J=(0,t._)`${$}.errors`;return v.assign(J,null),z(t.nil),J}function z(J=y.async?(0,t._)`await `:t.nil){const G=w.opts.passContext?e.default.this:e.default.self,ge=!("compile"in y&&!m||y.schema===!1);v.assign(k,(0,t._)`${J}${(0,r.callValidateCode)(b,$,G,ge)}`,y.modifying)}function V(J){var G;v.if((0,t.not)((G=y.valid)!==null&&G!==void 0?G:k),J)}}nt.funcKeywordCode=i;function a(b){const{gen:y,data:h,it:v}=b;y.if(v.parentData,()=>y.assign(h,(0,t._)`${v.parentData}[${v.parentDataProperty}]`))}function o(b,y){const{gen:h}=b;h.if((0,t._)`Array.isArray(${y})`,()=>{h.assign(e.default.vErrors,(0,t._)`${e.default.vErrors} === null ? ${y} : ${e.default.vErrors}.concat(${y})`).assign(e.default.errors,(0,t._)`${e.default.vErrors}.length`),(0,n.extendErrors)(b)},()=>b.error())}function c({schemaEnv:b},y){if(y.async&&!b.$async)throw new Error("async keyword in sync schema")}function u(b,y,h){if(h===void 0)throw new Error(`keyword "${y}" failed to compile`);return b.scopeValue("keyword",typeof h=="function"?{ref:h}:{ref:h,code:(0,t.stringify)(h)})}function l(b,y,h=!1){return!y.length||y.some(v=>v==="array"?Array.isArray(b):v==="object"?b&&typeof b=="object"&&!Array.isArray(b):typeof b==v||h&&typeof b>"u")}nt.validSchemaType=l;function p({schema:b,opts:y,self:h,errSchemaPath:v},f,_){if(Array.isArray(f.keyword)?!f.keyword.includes(_):f.keyword!==_)throw new Error("ajv implementation error");const d=f.dependencies;if(d?.some(m=>!Object.prototype.hasOwnProperty.call(b,m)))throw new Error(`parent schema must have dependencies of ${_}: ${d.join(",")}`);if(f.validateSchema&&!f.validateSchema(b[_])){const w=`keyword "${_}" value is invalid at path "${v}": `+h.errorsText(f.validateSchema.errors);if(y.validateSchema==="log")h.logger.error(w);else throw new Error(w)}}return nt.validateKeywordUsage=p,nt}var vt={},Za;function vd(){if(Za)return vt;Za=1,Object.defineProperty(vt,"__esModule",{value:!0}),vt.extendSubschemaMode=vt.extendSubschemaData=vt.getSubschema=void 0;const t=se(),e=he();function r(i,{keyword:a,schemaProp:o,schema:c,schemaPath:u,errSchemaPath:l,topSchemaRef:p}){if(a!==void 0&&c!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(a!==void 0){const b=i.schema[a];return o===void 0?{schema:b,schemaPath:(0,t._)`${i.schemaPath}${(0,t.getProperty)(a)}`,errSchemaPath:`${i.errSchemaPath}/${a}`}:{schema:b[o],schemaPath:(0,t._)`${i.schemaPath}${(0,t.getProperty)(a)}${(0,t.getProperty)(o)}`,errSchemaPath:`${i.errSchemaPath}/${a}/${(0,e.escapeFragment)(o)}`}}if(c!==void 0){if(u===void 0||l===void 0||p===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:c,schemaPath:u,topSchemaRef:p,errSchemaPath:l}}throw new Error('either "keyword" or "schema" must be passed')}vt.getSubschema=r;function n(i,a,{dataProp:o,dataPropType:c,data:u,dataTypes:l,propertyName:p}){if(u!==void 0&&o!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:b}=a;if(o!==void 0){const{errorPath:h,dataPathArr:v,opts:f}=a,_=b.let("data",(0,t._)`${a.data}${(0,t.getProperty)(o)}`,!0);y(_),i.errorPath=(0,t.str)`${h}${(0,e.getErrorPath)(o,c,f.jsPropertySyntax)}`,i.parentDataProperty=(0,t._)`${o}`,i.dataPathArr=[...v,i.parentDataProperty]}if(u!==void 0){const h=u instanceof t.Name?u:b.let("data",u,!0);y(h),p!==void 0&&(i.propertyName=p)}l&&(i.dataTypes=l);function y(h){i.data=h,i.dataLevel=a.dataLevel+1,i.dataTypes=[],a.definedProperties=new Set,i.parentData=a.data,i.dataNames=[...a.dataNames,h]}}vt.extendSubschemaData=n;function s(i,{jtdDiscriminator:a,jtdMetadata:o,compositeRule:c,createErrors:u,allErrors:l}){c!==void 0&&(i.compositeRule=c),u!==void 0&&(i.createErrors=u),l!==void 0&&(i.allErrors=l),i.jtdDiscriminator=a,i.jtdMetadata=o}return vt.extendSubschemaMode=s,vt}var Le={},Ts,xa;function La(){return xa||(xa=1,Ts=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,s,i;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(s=n;s--!==0;)if(!t(e[s],r[s]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(i=Object.keys(e),n=i.length,n!==Object.keys(r).length)return!1;for(s=n;s--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[s]))return!1;for(s=n;s--!==0;){var a=i[s];if(!t(e[a],r[a]))return!1}return!0}return e!==e&&r!==r}),Ts}var Cs={exports:{}},Ua;function yd(){if(Ua)return Cs.exports;Ua=1;var t=Cs.exports=function(n,s,i){typeof s=="function"&&(i=s,s={}),i=s.cb||i;var a=typeof i=="function"?i:i.pre||function(){},o=i.post||function(){};e(s,a,o,n,"",n)};t.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},t.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},t.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},t.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 e(n,s,i,a,o,c,u,l,p,b){if(a&&typeof a=="object"&&!Array.isArray(a)){s(a,o,c,u,l,p,b);for(var y in a){var h=a[y];if(Array.isArray(h)){if(y in t.arrayKeywords)for(var v=0;v<h.length;v++)e(n,s,i,h[v],o+"/"+y+"/"+v,c,o,y,a,v)}else if(y in t.propsKeywords){if(h&&typeof h=="object")for(var f in h)e(n,s,i,h[f],o+"/"+y+"/"+r(f),c,o,y,a,f)}else(y in t.keywords||n.allKeys&&!(y in t.skipKeywords))&&e(n,s,i,h,o+"/"+y,c,o,y,a)}i(a,o,c,u,l,p,b)}}function r(n){return n.replace(/~/g,"~0").replace(/\//g,"~1")}return Cs.exports}var Da;function Wr(){if(Da)return Le;Da=1,Object.defineProperty(Le,"__esModule",{value:!0}),Le.getSchemaRefs=Le.resolveUrl=Le.normalizeId=Le._getFullPath=Le.getFullPath=Le.inlineRef=void 0;const t=he(),e=La(),r=yd(),n=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function s(v,f=!0){return typeof v=="boolean"?!0:f===!0?!a(v):f?o(v)<=f:!1}Le.inlineRef=s;const i=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function a(v){for(const f in v){if(i.has(f))return!0;const _=v[f];if(Array.isArray(_)&&_.some(a)||typeof _=="object"&&a(_))return!0}return!1}function o(v){let f=0;for(const _ in v){if(_==="$ref")return 1/0;if(f++,!n.has(_)&&(typeof v[_]=="object"&&(0,t.eachItem)(v[_],d=>f+=o(d)),f===1/0))return 1/0}return f}function c(v,f="",_){_!==!1&&(f=p(f));const d=v.parse(f);return u(v,d)}Le.getFullPath=c;function u(v,f){return v.serialize(f).split("#")[0]+"#"}Le._getFullPath=u;const l=/#\/?$/;function p(v){return v?v.replace(l,""):""}Le.normalizeId=p;function b(v,f,_){return _=p(_),v.resolve(f,_)}Le.resolveUrl=b;const y=/^[a-z_][-a-z0-9._]*$/i;function h(v,f){if(typeof v=="boolean")return{};const{schemaId:_,uriResolver:d}=this.opts,m=p(v[_]||f),w={"":m},g=c(d,m,!1),$={},k=new Set;return r(v,{allKeys:!0},(H,z,V,J)=>{if(J===void 0)return;const G=g+z;let ge=w[J];typeof H[_]=="string"&&(ge=Ve.call(this,H[_])),Fe.call(this,H.$anchor),Fe.call(this,H.$dynamicAnchor),w[z]=ge;function Ve(be){const ft=this.opts.uriResolver.resolve;if(be=p(ge?ft(ge,be):be),k.has(be))throw Z(be);k.add(be);let U=this.refs[be];return typeof U=="string"&&(U=this.refs[U]),typeof U=="object"?N(H,U.schema,be):be!==p(G)&&(be[0]==="#"?(N(H,$[be],be),$[be]=H):this.refs[be]=G),be}function Fe(be){if(typeof be=="string"){if(!y.test(be))throw new Error(`invalid anchor "${be}"`);Ve.call(this,`#${be}`)}}}),$;function N(H,z,V){if(z!==void 0&&!e(H,z))throw Z(V)}function Z(H){return new Error(`reference "${H}" resolves to more than one schema`)}}return Le.getSchemaRefs=h,Le}var Va;function Kr(){if(Va)return _t;Va=1,Object.defineProperty(_t,"__esModule",{value:!0}),_t.getData=_t.KeywordCxt=_t.validateFunctionCode=void 0;const t=md(),e=Hr(),r=Aa(),n=Hr(),s=_d(),i=gd(),a=vd(),o=se(),c=$t(),u=Wr(),l=he(),p=Fr();function b(T){if(g(T)&&(k(T),w(T))){f(T);return}y(T,()=>(0,t.topBoolOrEmptySchema)(T))}_t.validateFunctionCode=b;function y({gen:T,validateName:O,schema:M,schemaEnv:D,opts:ee},ce){ee.code.es5?T.func(O,(0,o._)`${c.default.data}, ${c.default.valCxt}`,D.$async,()=>{T.code((0,o._)`"use strict"; ${d(M,ee)}`),v(T,ee),T.code(ce)}):T.func(O,(0,o._)`${c.default.data}, ${h(ee)}`,D.$async,()=>T.code(d(M,ee)).code(ce))}function h(T){return(0,o._)`{${c.default.instancePath}="", ${c.default.parentData}, ${c.default.parentDataProperty}, ${c.default.rootData}=${c.default.data}${T.dynamicRef?(0,o._)`, ${c.default.dynamicAnchors}={}`:o.nil}}={}`}function v(T,O){T.if(c.default.valCxt,()=>{T.var(c.default.instancePath,(0,o._)`${c.default.valCxt}.${c.default.instancePath}`),T.var(c.default.parentData,(0,o._)`${c.default.valCxt}.${c.default.parentData}`),T.var(c.default.parentDataProperty,(0,o._)`${c.default.valCxt}.${c.default.parentDataProperty}`),T.var(c.default.rootData,(0,o._)`${c.default.valCxt}.${c.default.rootData}`),O.dynamicRef&&T.var(c.default.dynamicAnchors,(0,o._)`${c.default.valCxt}.${c.default.dynamicAnchors}`)},()=>{T.var(c.default.instancePath,(0,o._)`""`),T.var(c.default.parentData,(0,o._)`undefined`),T.var(c.default.parentDataProperty,(0,o._)`undefined`),T.var(c.default.rootData,c.default.data),O.dynamicRef&&T.var(c.default.dynamicAnchors,(0,o._)`{}`)})}function f(T){const{schema:O,opts:M,gen:D}=T;y(T,()=>{M.$comment&&O.$comment&&J(T),H(T),D.let(c.default.vErrors,null),D.let(c.default.errors,0),M.unevaluated&&_(T),N(T),G(T)})}function _(T){const{gen:O,validateName:M}=T;T.evaluated=O.const("evaluated",(0,o._)`${M}.evaluated`),O.if((0,o._)`${T.evaluated}.dynamicProps`,()=>O.assign((0,o._)`${T.evaluated}.props`,(0,o._)`undefined`)),O.if((0,o._)`${T.evaluated}.dynamicItems`,()=>O.assign((0,o._)`${T.evaluated}.items`,(0,o._)`undefined`))}function d(T,O){const M=typeof T=="object"&&T[O.schemaId];return M&&(O.code.source||O.code.process)?(0,o._)`/*# sourceURL=${M} */`:o.nil}function m(T,O){if(g(T)&&(k(T),w(T))){$(T,O);return}(0,t.boolOrEmptySchema)(T,O)}function w({schema:T,self:O}){if(typeof T=="boolean")return!T;for(const M in T)if(O.RULES.all[M])return!0;return!1}function g(T){return typeof T.schema!="boolean"}function $(T,O){const{schema:M,gen:D,opts:ee}=T;ee.$comment&&M.$comment&&J(T),z(T),V(T);const ce=D.const("_errs",c.default.errors);N(T,ce),D.var(O,(0,o._)`${ce} === ${c.default.errors}`)}function k(T){(0,l.checkUnknownRules)(T),Z(T)}function N(T,O){if(T.opts.jtd)return Ve(T,[],!1,O);const M=(0,e.getSchemaTypes)(T.schema),D=(0,e.coerceAndCheckDataType)(T,M);Ve(T,M,!D,O)}function Z(T){const{schema:O,errSchemaPath:M,opts:D,self:ee}=T;O.$ref&&D.ignoreKeywordsWithRef&&(0,l.schemaHasRulesButRef)(O,ee.RULES)&&ee.logger.warn(`$ref: keywords ignored in schema at path "${M}"`)}function H(T){const{schema:O,opts:M}=T;O.default!==void 0&&M.useDefaults&&M.strictSchema&&(0,l.checkStrictMode)(T,"default is ignored in the schema root")}function z(T){const O=T.schema[T.opts.schemaId];O&&(T.baseId=(0,u.resolveUrl)(T.opts.uriResolver,T.baseId,O))}function V(T){if(T.schema.$async&&!T.schemaEnv.$async)throw new Error("async schema in sync schema")}function J({gen:T,schemaEnv:O,schema:M,errSchemaPath:D,opts:ee}){const ce=M.$comment;if(ee.$comment===!0)T.code((0,o._)`${c.default.self}.logger.log(${ce})`);else if(typeof ee.$comment=="function"){const Ze=(0,o.str)`${D}/$comment`,ht=T.scopeValue("root",{ref:O.root});T.code((0,o._)`${c.default.self}.opts.$comment(${ce}, ${Ze}, ${ht}.schema)`)}}function G(T){const{gen:O,schemaEnv:M,validateName:D,ValidationError:ee,opts:ce}=T;M.$async?O.if((0,o._)`${c.default.errors} === 0`,()=>O.return(c.default.data),()=>O.throw((0,o._)`new ${ee}(${c.default.vErrors})`)):(O.assign((0,o._)`${D}.errors`,c.default.vErrors),ce.unevaluated&&ge(T),O.return((0,o._)`${c.default.errors} === 0`))}function ge({gen:T,evaluated:O,props:M,items:D}){M instanceof o.Name&&T.assign((0,o._)`${O}.props`,M),D instanceof o.Name&&T.assign((0,o._)`${O}.items`,D)}function Ve(T,O,M,D){const{gen:ee,schema:ce,data:Ze,allErrors:ht,opts:Je,self:Be}=T,{RULES:xe}=Be;if(ce.$ref&&(Je.ignoreKeywordsWithRef||!(0,l.schemaHasRulesButRef)(ce,xe))){ee.block(()=>X(T,"$ref",xe.all.$ref.definition));return}Je.jtd||be(T,O),ee.block(()=>{for(const rt of xe.rules)or(rt);or(xe.post)});function or(rt){(0,r.shouldUseGroup)(ce,rt)&&(rt.type?(ee.if((0,n.checkDataType)(rt.type,Ze,Je.strictNumbers)),Fe(T,rt),O.length===1&&O[0]===rt.type&&M&&(ee.else(),(0,n.reportTypeError)(T)),ee.endIf()):Fe(T,rt),ht||ee.if((0,o._)`${c.default.errors} === ${D||0}`))}}function Fe(T,O){const{gen:M,schema:D,opts:{useDefaults:ee}}=T;ee&&(0,s.assignDefaults)(T,O.type),M.block(()=>{for(const ce of O.rules)(0,r.shouldUseRule)(D,ce)&&X(T,ce.keyword,ce.definition,O.type)})}function be(T,O){T.schemaEnv.meta||!T.opts.strictTypes||(ft(T,O),T.opts.allowUnionTypes||U(T,O),C(T,T.dataTypes))}function ft(T,O){if(O.length){if(!T.dataTypes.length){T.dataTypes=O;return}O.forEach(M=>{I(T.dataTypes,M)||R(T,`type "${M}" not allowed by context "${T.dataTypes.join(",")}"`)}),S(T,O)}}function U(T,O){O.length>1&&!(O.length===2&&O.includes("null"))&&R(T,"use allowUnionTypes to allow union type keyword")}function C(T,O){const M=T.self.RULES.all;for(const D in M){const ee=M[D];if(typeof ee=="object"&&(0,r.shouldUseRule)(T.schema,ee)){const{type:ce}=ee.definition;ce.length&&!ce.some(Ze=>q(O,Ze))&&R(T,`missing type "${ce.join(",")}" for keyword "${D}"`)}}}function q(T,O){return T.includes(O)||O==="number"&&T.includes("integer")}function I(T,O){return T.includes(O)||O==="integer"&&T.includes("number")}function S(T,O){const M=[];for(const D of T.dataTypes)I(O,D)?M.push(D):O.includes("integer")&&D==="number"&&M.push("integer");T.dataTypes=M}function R(T,O){const M=T.schemaEnv.baseId+T.errSchemaPath;O+=` at "${M}" (strictTypes)`,(0,l.checkStrictMode)(T,O,T.opts.strictTypes)}class j{constructor(O,M,D){if((0,i.validateKeywordUsage)(O,M,D),this.gen=O.gen,this.allErrors=O.allErrors,this.keyword=D,this.data=O.data,this.schema=O.schema[D],this.$data=M.$data&&O.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,l.schemaRefOrVal)(O,this.schema,D,this.$data),this.schemaType=M.schemaType,this.parentSchema=O.schema,this.params={},this.it=O,this.def=M,this.$data)this.schemaCode=O.gen.const("vSchema",de(this.$data,O));else if(this.schemaCode=this.schemaValue,!(0,i.validSchemaType)(this.schema,M.schemaType,M.allowUndefined))throw new Error(`${D} value must be ${JSON.stringify(M.schemaType)}`);("code"in M?M.trackErrors:M.errors!==!1)&&(this.errsCount=O.gen.const("_errs",c.default.errors))}result(O,M,D){this.failResult((0,o.not)(O),M,D)}failResult(O,M,D){this.gen.if(O),D?D():this.error(),M?(this.gen.else(),M(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(O,M){this.failResult((0,o.not)(O),void 0,M)}fail(O){if(O===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(O),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(O){if(!this.$data)return this.fail(O);const{schemaCode:M}=this;this.fail((0,o._)`${M} !== undefined && (${(0,o.or)(this.invalid$data(),O)})`)}error(O,M,D){if(M){this.setParams(M),this._error(O,D),this.setParams({});return}this._error(O,D)}_error(O,M){(O?p.reportExtraError:p.reportError)(this,this.def.error,M)}$dataError(){(0,p.reportError)(this,this.def.$dataError||p.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,p.resetErrorsCount)(this.gen,this.errsCount)}ok(O){this.allErrors||this.gen.if(O)}setParams(O,M){M?Object.assign(this.params,O):this.params=O}block$data(O,M,D=o.nil){this.gen.block(()=>{this.check$data(O,D),M()})}check$data(O=o.nil,M=o.nil){if(!this.$data)return;const{gen:D,schemaCode:ee,schemaType:ce,def:Ze}=this;D.if((0,o.or)((0,o._)`${ee} === undefined`,M)),O!==o.nil&&D.assign(O,!0),(ce.length||Ze.validateSchema)&&(D.elseIf(this.invalid$data()),this.$dataError(),O!==o.nil&&D.assign(O,!1)),D.else()}invalid$data(){const{gen:O,schemaCode:M,schemaType:D,def:ee,it:ce}=this;return(0,o.or)(Ze(),ht());function Ze(){if(D.length){if(!(M instanceof o.Name))throw new Error("ajv implementation error");const Je=Array.isArray(D)?D:[D];return(0,o._)`${(0,n.checkDataTypes)(Je,M,ce.opts.strictNumbers,n.DataType.Wrong)}`}return o.nil}function ht(){if(ee.validateSchema){const Je=O.scopeValue("validate$data",{ref:ee.validateSchema});return(0,o._)`!${Je}(${M})`}return o.nil}}subschema(O,M){const D=(0,a.getSubschema)(this.it,O);(0,a.extendSubschemaData)(D,this.it,O),(0,a.extendSubschemaMode)(D,O);const ee={...this.it,...D,items:void 0,props:void 0};return m(ee,M),ee}mergeEvaluated(O,M){const{it:D,gen:ee}=this;D.opts.unevaluated&&(D.props!==!0&&O.props!==void 0&&(D.props=l.mergeEvaluated.props(ee,O.props,D.props,M)),D.items!==!0&&O.items!==void 0&&(D.items=l.mergeEvaluated.items(ee,O.items,D.items,M)))}mergeValidEvaluated(O,M){const{it:D,gen:ee}=this;if(D.opts.unevaluated&&(D.props!==!0||D.items!==!0))return ee.if(M,()=>this.mergeEvaluated(O,o.Name)),!0}}_t.KeywordCxt=j;function X(T,O,M,D){const ee=new j(T,M,O);"code"in M?M.code(ee,D):ee.$data&&M.validate?(0,i.funcKeywordCode)(ee,M):"macro"in M?(0,i.macroKeywordCode)(ee,M):(M.compile||M.validate)&&(0,i.funcKeywordCode)(ee,M)}const te=/^\/(?:[^~]|~0|~1)*$/,_e=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function de(T,{dataLevel:O,dataNames:M,dataPathArr:D}){let ee,ce;if(T==="")return c.default.rootData;if(T[0]==="/"){if(!te.test(T))throw new Error(`Invalid JSON-pointer: ${T}`);ee=T,ce=c.default.rootData}else{const Be=_e.exec(T);if(!Be)throw new Error(`Invalid JSON-pointer: ${T}`);const xe=+Be[1];if(ee=Be[2],ee==="#"){if(xe>=O)throw new Error(Je("property/index",xe));return D[O-xe]}if(xe>O)throw new Error(Je("data",xe));if(ce=M[O-xe],!ee)return ce}let Ze=ce;const ht=ee.split("/");for(const Be of ht)Be&&(ce=(0,o._)`${ce}${(0,o.getProperty)((0,l.unescapeJsonPointer)(Be))}`,Ze=(0,o._)`${Ze} && ${ce}`);return Ze;function Je(Be,xe){return`Cannot access ${Be} ${xe} levels up, current level is ${O}`}}return _t.getData=de,_t}var Jr={},Fa;function Os(){if(Fa)return Jr;Fa=1,Object.defineProperty(Jr,"__esModule",{value:!0});class t extends Error{constructor(r){super("validation failed"),this.errors=r,this.ajv=this.validation=!0}}return Jr.default=t,Jr}var Br={},Ha;function Gr(){if(Ha)return Br;Ha=1,Object.defineProperty(Br,"__esModule",{value:!0});const t=Wr();class e extends Error{constructor(n,s,i,a){super(a||`can't resolve reference ${i} from id ${s}`),this.missingRef=(0,t.resolveUrl)(n,s,i),this.missingSchema=(0,t.normalizeId)((0,t.getFullPath)(n,this.missingRef))}}return Br.default=e,Br}var Ge={},Wa;function Is(){if(Wa)return Ge;Wa=1,Object.defineProperty(Ge,"__esModule",{value:!0}),Ge.resolveSchema=Ge.getCompilingSchema=Ge.resolveRef=Ge.compileSchema=Ge.SchemaEnv=void 0;const t=se(),e=Os(),r=$t(),n=Wr(),s=he(),i=Kr();class a{constructor(_){var d;this.refs={},this.dynamicAnchors={};let m;typeof _.schema=="object"&&(m=_.schema),this.schema=_.schema,this.schemaId=_.schemaId,this.root=_.root||this,this.baseId=(d=_.baseId)!==null&&d!==void 0?d:(0,n.normalizeId)(m?.[_.schemaId||"$id"]),this.schemaPath=_.schemaPath,this.localRefs=_.localRefs,this.meta=_.meta,this.$async=m?.$async,this.refs={}}}Ge.SchemaEnv=a;function o(f){const _=l.call(this,f);if(_)return _;const d=(0,n.getFullPath)(this.opts.uriResolver,f.root.baseId),{es5:m,lines:w}=this.opts.code,{ownProperties:g}=this.opts,$=new t.CodeGen(this.scope,{es5:m,lines:w,ownProperties:g});let k;f.$async&&(k=$.scopeValue("Error",{ref:e.default,code:(0,t._)`require("ajv/dist/runtime/validation_error").default`}));const N=$.scopeName("validate");f.validateName=N;const Z={gen:$,allErrors:this.opts.allErrors,data:r.default.data,parentData:r.default.parentData,parentDataProperty:r.default.parentDataProperty,dataNames:[r.default.data],dataPathArr:[t.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:$.scopeValue("schema",this.opts.code.source===!0?{ref:f.schema,code:(0,t.stringify)(f.schema)}:{ref:f.schema}),validateName:N,ValidationError:k,schema:f.schema,schemaEnv:f,rootId:d,baseId:f.baseId||d,schemaPath:t.nil,errSchemaPath:f.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,t._)`""`,opts:this.opts,self:this};let H;try{this._compilations.add(f),(0,i.validateFunctionCode)(Z),$.optimize(this.opts.code.optimize);const z=$.toString();H=`${$.scopeRefs(r.default.scope)}return ${z}`,this.opts.code.process&&(H=this.opts.code.process(H,f));const J=new Function(`${r.default.self}`,`${r.default.scope}`,H)(this,this.scope.get());if(this.scope.value(N,{ref:J}),J.errors=null,J.schema=f.schema,J.schemaEnv=f,f.$async&&(J.$async=!0),this.opts.code.source===!0&&(J.source={validateName:N,validateCode:z,scopeValues:$._values}),this.opts.unevaluated){const{props:G,items:ge}=Z;J.evaluated={props:G instanceof t.Name?void 0:G,items:ge instanceof t.Name?void 0:ge,dynamicProps:G instanceof t.Name,dynamicItems:ge instanceof t.Name},J.source&&(J.source.evaluated=(0,t.stringify)(J.evaluated))}return f.validate=J,f}catch(z){throw delete f.validate,delete f.validateName,H&&this.logger.error("Error compiling schema, function code:",H),z}finally{this._compilations.delete(f)}}Ge.compileSchema=o;function c(f,_,d){var m;d=(0,n.resolveUrl)(this.opts.uriResolver,_,d);const w=f.refs[d];if(w)return w;let g=b.call(this,f,d);if(g===void 0){const $=(m=f.localRefs)===null||m===void 0?void 0:m[d],{schemaId:k}=this.opts;$&&(g=new a({schema:$,schemaId:k,root:f,baseId:_}))}if(g!==void 0)return f.refs[d]=u.call(this,g)}Ge.resolveRef=c;function u(f){return(0,n.inlineRef)(f.schema,this.opts.inlineRefs)?f.schema:f.validate?f:o.call(this,f)}function l(f){for(const _ of this._compilations)if(p(_,f))return _}Ge.getCompilingSchema=l;function p(f,_){return f.schema===_.schema&&f.root===_.root&&f.baseId===_.baseId}function b(f,_){let d;for(;typeof(d=this.refs[_])=="string";)_=d;return d||this.schemas[_]||y.call(this,f,_)}function y(f,_){const d=this.opts.uriResolver.parse(_),m=(0,n._getFullPath)(this.opts.uriResolver,d);let w=(0,n.getFullPath)(this.opts.uriResolver,f.baseId,void 0);if(Object.keys(f.schema).length>0&&m===w)return v.call(this,d,f);const g=(0,n.normalizeId)(m),$=this.refs[g]||this.schemas[g];if(typeof $=="string"){const k=y.call(this,f,$);return typeof k?.schema!="object"?void 0:v.call(this,d,k)}if(typeof $?.schema=="object"){if($.validate||o.call(this,$),g===(0,n.normalizeId)(_)){const{schema:k}=$,{schemaId:N}=this.opts,Z=k[N];return Z&&(w=(0,n.resolveUrl)(this.opts.uriResolver,w,Z)),new a({schema:k,schemaId:N,root:f,baseId:w})}return v.call(this,d,$)}}Ge.resolveSchema=y;const h=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function v(f,{baseId:_,schema:d,root:m}){var w;if(((w=f.fragment)===null||w===void 0?void 0:w[0])!=="/")return;for(const k of f.fragment.slice(1).split("/")){if(typeof d=="boolean")return;const N=d[(0,s.unescapeFragment)(k)];if(N===void 0)return;d=N;const Z=typeof d=="object"&&d[this.opts.schemaId];!h.has(k)&&Z&&(_=(0,n.resolveUrl)(this.opts.uriResolver,_,Z))}let g;if(typeof d!="boolean"&&d.$ref&&!(0,s.schemaHasRulesButRef)(d,this.RULES)){const k=(0,n.resolveUrl)(this.opts.uriResolver,_,d.$ref);g=y.call(this,m,k)}const{schemaId:$}=this.opts;if(g=g||new a({schema:d,schemaId:$,root:m,baseId:_}),g.schema!==g.root.schema)return g}return Ge}const bd={$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 Yr={},ur={exports:{}},Ns,Ka;function Ja(){if(Ka)return Ns;Ka=1;const t=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),e=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function r(b){let y="",h=0,v=0;for(v=0;v<b.length;v++)if(h=b[v].charCodeAt(0),h!==48){if(!(h>=48&&h<=57||h>=65&&h<=70||h>=97&&h<=102))return"";y+=b[v];break}for(v+=1;v<b.length;v++){if(h=b[v].charCodeAt(0),!(h>=48&&h<=57||h>=65&&h<=70||h>=97&&h<=102))return"";y+=b[v]}return y}const n=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function s(b){return b.length=0,!0}function i(b,y,h){if(b.length){const v=r(b);if(v!=="")y.push(v);else return h.error=!0,!1;b.length=0}return!0}function a(b){let y=0;const h={error:!1,address:"",zone:""},v=[],f=[];let _=!1,d=!1,m=i;for(let w=0;w<b.length;w++){const g=b[w];if(!(g==="["||g==="]"))if(g===":"){if(_===!0&&(d=!0),!m(f,v,h))break;if(++y>7){h.error=!0;break}w>0&&b[w-1]===":"&&(_=!0),v.push(":");continue}else if(g==="%"){if(!m(f,v,h))break;m=s}else{f.push(g);continue}}return f.length&&(m===s?h.zone=f.join(""):d?v.push(f.join("")):v.push(r(f))),h.address=v.join(""),h}function o(b){if(c(b,":")<2)return{host:b,isIPV6:!1};const y=a(b);if(y.error)return{host:b,isIPV6:!1};{let h=y.address,v=y.address;return y.zone&&(h+="%"+y.zone,v+="%25"+y.zone),{host:h,isIPV6:!0,escapedHost:v}}}function c(b,y){let h=0;for(let v=0;v<b.length;v++)b[v]===y&&h++;return h}function u(b){let y=b;const h=[];let v=-1,f=0;for(;f=y.length;){if(f===1){if(y===".")break;if(y==="/"){h.push("/");break}else{h.push(y);break}}else if(f===2){if(y[0]==="."){if(y[1]===".")break;if(y[1]==="/"){y=y.slice(2);continue}}else if(y[0]==="/"&&(y[1]==="."||y[1]==="/")){h.push("/");break}}else if(f===3&&y==="/.."){h.length!==0&&h.pop(),h.push("/");break}if(y[0]==="."){if(y[1]==="."){if(y[2]==="/"){y=y.slice(3);continue}}else if(y[1]==="/"){y=y.slice(2);continue}}else if(y[0]==="/"&&y[1]==="."){if(y[2]==="/"){y=y.slice(2);continue}else if(y[2]==="."&&y[3]==="/"){y=y.slice(3),h.length!==0&&h.pop();continue}}if((v=y.indexOf("/",1))===-1){h.push(y);break}else h.push(y.slice(0,v)),y=y.slice(v)}return h.join("")}function l(b,y){const h=y!==!0?escape:unescape;return b.scheme!==void 0&&(b.scheme=h(b.scheme)),b.userinfo!==void 0&&(b.userinfo=h(b.userinfo)),b.host!==void 0&&(b.host=h(b.host)),b.path!==void 0&&(b.path=h(b.path)),b.query!==void 0&&(b.query=h(b.query)),b.fragment!==void 0&&(b.fragment=h(b.fragment)),b}function p(b){const y=[];if(b.userinfo!==void 0&&(y.push(b.userinfo),y.push("@")),b.host!==void 0){let h=unescape(b.host);if(!e(h)){const v=o(h);v.isIPV6===!0?h=`[${v.escapedHost}]`:h=b.host}y.push(h)}return(typeof b.port=="number"||typeof b.port=="string")&&(y.push(":"),y.push(String(b.port))),y.length?y.join(""):void 0}return Ns={nonSimpleDomain:n,recomposeAuthority:p,normalizeComponentEncoding:l,removeDotSegments:u,isIPv4:e,isUUID:t,normalizeIPv6:o,stringArrayToHexStripped:r},Ns}var As,Ba;function wd(){if(Ba)return As;Ba=1;const{isUUID:t}=Ja(),e=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,r=["http","https","ws","wss","urn","urn:uuid"];function n(g){return r.indexOf(g)!==-1}function s(g){return g.secure===!0?!0:g.secure===!1?!1:g.scheme?g.scheme.length===3&&(g.scheme[0]==="w"||g.scheme[0]==="W")&&(g.scheme[1]==="s"||g.scheme[1]==="S")&&(g.scheme[2]==="s"||g.scheme[2]==="S"):!1}function i(g){return g.host||(g.error=g.error||"HTTP URIs must have a host."),g}function a(g){const $=String(g.scheme).toLowerCase()==="https";return(g.port===($?443:80)||g.port==="")&&(g.port=void 0),g.path||(g.path="/"),g}function o(g){return g.secure=s(g),g.resourceName=(g.path||"/")+(g.query?"?"+g.query:""),g.path=void 0,g.query=void 0,g}function c(g){if((g.port===(s(g)?443:80)||g.port==="")&&(g.port=void 0),typeof g.secure=="boolean"&&(g.scheme=g.secure?"wss":"ws",g.secure=void 0),g.resourceName){const[$,k]=g.resourceName.split("?");g.path=$&&$!=="/"?$:void 0,g.query=k,g.resourceName=void 0}return g.fragment=void 0,g}function u(g,$){if(!g.path)return g.error="URN can not be parsed",g;const k=g.path.match(e);if(k){const N=$.scheme||g.scheme||"urn";g.nid=k[1].toLowerCase(),g.nss=k[2];const Z=`${N}:${$.nid||g.nid}`,H=w(Z);g.path=void 0,H&&(g=H.parse(g,$))}else g.error=g.error||"URN can not be parsed.";return g}function l(g,$){if(g.nid===void 0)throw new Error("URN without nid cannot be serialized");const k=$.scheme||g.scheme||"urn",N=g.nid.toLowerCase(),Z=`${k}:${$.nid||N}`,H=w(Z);H&&(g=H.serialize(g,$));const z=g,V=g.nss;return z.path=`${N||$.nid}:${V}`,$.skipEscape=!0,z}function p(g,$){const k=g;return k.uuid=k.nss,k.nss=void 0,!$.tolerant&&(!k.uuid||!t(k.uuid))&&(k.error=k.error||"UUID is not valid."),k}function b(g){const $=g;return $.nss=(g.uuid||"").toLowerCase(),$}const y={scheme:"http",domainHost:!0,parse:i,serialize:a},h={scheme:"https",domainHost:y.domainHost,parse:i,serialize:a},v={scheme:"ws",domainHost:!0,parse:o,serialize:c},f={scheme:"wss",domainHost:v.domainHost,parse:v.parse,serialize:v.serialize},m={http:y,https:h,ws:v,wss:f,urn:{scheme:"urn",parse:u,serialize:l,skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:p,serialize:b,skipNormalize:!0}};Object.setPrototypeOf(m,null);function w(g){return g&&(m[g]||m[g.toLowerCase()])||void 0}return As={wsIsSecure:s,SCHEMES:m,isValidSchemeName:n,getSchemeHandler:w},As}var Ga;function $d(){if(Ga)return ur.exports;Ga=1;const{normalizeIPv6:t,removeDotSegments:e,recomposeAuthority:r,normalizeComponentEncoding:n,isIPv4:s,nonSimpleDomain:i}=Ja(),{SCHEMES:a,getSchemeHandler:o}=wd();function c(f,_){return typeof f=="string"?f=b(h(f,_),_):typeof f=="object"&&(f=h(b(f,_),_)),f}function u(f,_,d){const m=d?Object.assign({scheme:"null"},d):{scheme:"null"},w=l(h(f,m),h(_,m),m,!0);return m.skipEscape=!0,b(w,m)}function l(f,_,d,m){const w={};return m||(f=h(b(f,d),d),_=h(b(_,d),d)),d=d||{},!d.tolerant&&_.scheme?(w.scheme=_.scheme,w.userinfo=_.userinfo,w.host=_.host,w.port=_.port,w.path=e(_.path||""),w.query=_.query):(_.userinfo!==void 0||_.host!==void 0||_.port!==void 0?(w.userinfo=_.userinfo,w.host=_.host,w.port=_.port,w.path=e(_.path||""),w.query=_.query):(_.path?(_.path[0]==="/"?w.path=e(_.path):((f.userinfo!==void 0||f.host!==void 0||f.port!==void 0)&&!f.path?w.path="/"+_.path:f.path?w.path=f.path.slice(0,f.path.lastIndexOf("/")+1)+_.path:w.path=_.path,w.path=e(w.path)),w.query=_.query):(w.path=f.path,_.query!==void 0?w.query=_.query:w.query=f.query),w.userinfo=f.userinfo,w.host=f.host,w.port=f.port),w.scheme=f.scheme),w.fragment=_.fragment,w}function p(f,_,d){return typeof f=="string"?(f=unescape(f),f=b(n(h(f,d),!0),{...d,skipEscape:!0})):typeof f=="object"&&(f=b(n(f,!0),{...d,skipEscape:!0})),typeof _=="string"?(_=unescape(_),_=b(n(h(_,d),!0),{...d,skipEscape:!0})):typeof _=="object"&&(_=b(n(_,!0),{...d,skipEscape:!0})),f.toLowerCase()===_.toLowerCase()}function b(f,_){const d={host:f.host,scheme:f.scheme,userinfo:f.userinfo,port:f.port,path:f.path,query:f.query,nid:f.nid,nss:f.nss,uuid:f.uuid,fragment:f.fragment,reference:f.reference,resourceName:f.resourceName,secure:f.secure,error:""},m=Object.assign({},_),w=[],g=o(m.scheme||d.scheme);g&&g.serialize&&g.serialize(d,m),d.path!==void 0&&(m.skipEscape?d.path=unescape(d.path):(d.path=escape(d.path),d.scheme!==void 0&&(d.path=d.path.split("%3A").join(":")))),m.reference!=="suffix"&&d.scheme&&w.push(d.scheme,":");const $=r(d);if($!==void 0&&(m.reference!=="suffix"&&w.push("//"),w.push($),d.path&&d.path[0]!=="/"&&w.push("/")),d.path!==void 0){let k=d.path;!m.absolutePath&&(!g||!g.absolutePath)&&(k=e(k)),$===void 0&&k[0]==="/"&&k[1]==="/"&&(k="/%2F"+k.slice(2)),w.push(k)}return d.query!==void 0&&w.push("?",d.query),d.fragment!==void 0&&w.push("#",d.fragment),w.join("")}const y=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function h(f,_){const d=Object.assign({},_),m={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0};let w=!1;d.reference==="suffix"&&(d.scheme?f=d.scheme+":"+f:f="//"+f);const g=f.match(y);if(g){if(m.scheme=g[1],m.userinfo=g[3],m.host=g[4],m.port=parseInt(g[5],10),m.path=g[6]||"",m.query=g[7],m.fragment=g[8],isNaN(m.port)&&(m.port=g[5]),m.host)if(s(m.host)===!1){const N=t(m.host);m.host=N.host.toLowerCase(),w=N.isIPV6}else w=!0;m.scheme===void 0&&m.userinfo===void 0&&m.host===void 0&&m.port===void 0&&m.query===void 0&&!m.path?m.reference="same-document":m.scheme===void 0?m.reference="relative":m.fragment===void 0?m.reference="absolute":m.reference="uri",d.reference&&d.reference!=="suffix"&&d.reference!==m.reference&&(m.error=m.error||"URI is not a "+d.reference+" reference.");const $=o(d.scheme||m.scheme);if(!d.unicodeSupport&&(!$||!$.unicodeSupport)&&m.host&&(d.domainHost||$&&$.domainHost)&&w===!1&&i(m.host))try{m.host=URL.domainToASCII(m.host.toLowerCase())}catch(k){m.error=m.error||"Host's domain name can not be converted to ASCII: "+k}(!$||$&&!$.skipNormalize)&&(f.indexOf("%")!==-1&&(m.scheme!==void 0&&(m.scheme=unescape(m.scheme)),m.host!==void 0&&(m.host=unescape(m.host))),m.path&&(m.path=escape(unescape(m.path))),m.fragment&&(m.fragment=encodeURI(decodeURIComponent(m.fragment)))),$&&$.parse&&$.parse(m,d)}else m.error=m.error||"URI can not be parsed.";return m}const v={SCHEMES:a,normalize:c,resolve:u,resolveComponent:l,equal:p,serialize:b,parse:h};return ur.exports=v,ur.exports.default=v,ur.exports.fastUri=v,ur.exports}var Ya;function Sd(){if(Ya)return Yr;Ya=1,Object.defineProperty(Yr,"__esModule",{value:!0});const t=$d();return t.code='require("ajv/dist/runtime/uri").default',Yr.default=t,Yr}var Xa;function kd(){return Xa||(Xa=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;var e=Kr();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return e.KeywordCxt}});var r=se();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return r.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return r.CodeGen}});const n=Os(),s=Gr(),i=Ia(),a=Is(),o=se(),c=Wr(),u=Hr(),l=he(),p=bd,b=Sd(),y=(U,C)=>new RegExp(U,C);y.code="new RegExp";const h=["removeAdditional","useDefaults","coerceTypes"],v=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),f={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."},_={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},d=200;function m(U){var C,q,I,S,R,j,X,te,_e,de,T,O,M,D,ee,ce,Ze,ht,Je,Be,xe,or,rt,ya,ba;const Lr=U.strict,wa=(C=U.code)===null||C===void 0?void 0:C.optimize,hd=wa===!0||wa===void 0?1:wa||0,pd=(I=(q=U.code)===null||q===void 0?void 0:q.regExp)!==null&&I!==void 0?I:y,Cv=(S=U.uriResolver)!==null&&S!==void 0?S:b.default;return{strictSchema:(j=(R=U.strictSchema)!==null&&R!==void 0?R:Lr)!==null&&j!==void 0?j:!0,strictNumbers:(te=(X=U.strictNumbers)!==null&&X!==void 0?X:Lr)!==null&&te!==void 0?te:!0,strictTypes:(de=(_e=U.strictTypes)!==null&&_e!==void 0?_e:Lr)!==null&&de!==void 0?de:"log",strictTuples:(O=(T=U.strictTuples)!==null&&T!==void 0?T:Lr)!==null&&O!==void 0?O:"log",strictRequired:(D=(M=U.strictRequired)!==null&&M!==void 0?M:Lr)!==null&&D!==void 0?D:!1,code:U.code?{...U.code,optimize:hd,regExp:pd}:{optimize:hd,regExp:pd},loopRequired:(ee=U.loopRequired)!==null&&ee!==void 0?ee:d,loopEnum:(ce=U.loopEnum)!==null&&ce!==void 0?ce:d,meta:(Ze=U.meta)!==null&&Ze!==void 0?Ze:!0,messages:(ht=U.messages)!==null&&ht!==void 0?ht:!0,inlineRefs:(Je=U.inlineRefs)!==null&&Je!==void 0?Je:!0,schemaId:(Be=U.schemaId)!==null&&Be!==void 0?Be:"$id",addUsedSchema:(xe=U.addUsedSchema)!==null&&xe!==void 0?xe:!0,validateSchema:(or=U.validateSchema)!==null&&or!==void 0?or:!0,validateFormats:(rt=U.validateFormats)!==null&&rt!==void 0?rt:!0,unicodeRegExp:(ya=U.unicodeRegExp)!==null&&ya!==void 0?ya:!0,int32range:(ba=U.int32range)!==null&&ba!==void 0?ba:!0,uriResolver:Cv}}class w{constructor(C={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,C=this.opts={...C,...m(C)};const{es5:q,lines:I}=this.opts.code;this.scope=new o.ValueScope({scope:{},prefixes:v,es5:q,lines:I}),this.logger=V(C.logger);const S=C.validateFormats;C.validateFormats=!1,this.RULES=(0,i.getRules)(),g.call(this,f,C,"NOT SUPPORTED"),g.call(this,_,C,"DEPRECATED","warn"),this._metaOpts=H.call(this),C.formats&&N.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),C.keywords&&Z.call(this,C.keywords),typeof C.meta=="object"&&this.addMetaSchema(C.meta),k.call(this),C.validateFormats=S}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:C,meta:q,schemaId:I}=this.opts;let S=p;I==="id"&&(S={...p},S.id=S.$id,delete S.$id),q&&C&&this.addMetaSchema(S,S[I],!1)}defaultMeta(){const{meta:C,schemaId:q}=this.opts;return this.opts.defaultMeta=typeof C=="object"?C[q]||C:void 0}validate(C,q){let I;if(typeof C=="string"){if(I=this.getSchema(C),!I)throw new Error(`no schema with key or ref "${C}"`)}else I=this.compile(C);const S=I(q);return"$async"in I||(this.errors=I.errors),S}compile(C,q){const I=this._addSchema(C,q);return I.validate||this._compileSchemaEnv(I)}compileAsync(C,q){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:I}=this.opts;return S.call(this,C,q);async function S(de,T){await R.call(this,de.$schema);const O=this._addSchema(de,T);return O.validate||j.call(this,O)}async function R(de){de&&!this.getSchema(de)&&await S.call(this,{$ref:de},!0)}async function j(de){try{return this._compileSchemaEnv(de)}catch(T){if(!(T instanceof s.default))throw T;return X.call(this,T),await te.call(this,T.missingSchema),j.call(this,de)}}function X({missingSchema:de,missingRef:T}){if(this.refs[de])throw new Error(`AnySchema ${de} is loaded but ${T} cannot be resolved`)}async function te(de){const T=await _e.call(this,de);this.refs[de]||await R.call(this,T.$schema),this.refs[de]||this.addSchema(T,de,q)}async function _e(de){const T=this._loading[de];if(T)return T;try{return await(this._loading[de]=I(de))}finally{delete this._loading[de]}}}addSchema(C,q,I,S=this.opts.validateSchema){if(Array.isArray(C)){for(const j of C)this.addSchema(j,void 0,I,S);return this}let R;if(typeof C=="object"){const{schemaId:j}=this.opts;if(R=C[j],R!==void 0&&typeof R!="string")throw new Error(`schema ${j} must be string`)}return q=(0,c.normalizeId)(q||R),this._checkUnique(q),this.schemas[q]=this._addSchema(C,I,q,S,!0),this}addMetaSchema(C,q,I=this.opts.validateSchema){return this.addSchema(C,q,!0,I),this}validateSchema(C,q){if(typeof C=="boolean")return!0;let I;if(I=C.$schema,I!==void 0&&typeof I!="string")throw new Error("$schema must be a string");if(I=I||this.opts.defaultMeta||this.defaultMeta(),!I)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const S=this.validate(I,C);if(!S&&q){const R="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(R);else throw new Error(R)}return S}getSchema(C){let q;for(;typeof(q=$.call(this,C))=="string";)C=q;if(q===void 0){const{schemaId:I}=this.opts,S=new a.SchemaEnv({schema:{},schemaId:I});if(q=a.resolveSchema.call(this,S,C),!q)return;this.refs[C]=q}return q.validate||this._compileSchemaEnv(q)}removeSchema(C){if(C instanceof RegExp)return this._removeAllSchemas(this.schemas,C),this._removeAllSchemas(this.refs,C),this;switch(typeof C){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const q=$.call(this,C);return typeof q=="object"&&this._cache.delete(q.schema),delete this.schemas[C],delete this.refs[C],this}case"object":{const q=C;this._cache.delete(q);let I=C[this.opts.schemaId];return I&&(I=(0,c.normalizeId)(I),delete this.schemas[I],delete this.refs[I]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(C){for(const q of C)this.addKeyword(q);return this}addKeyword(C,q){let I;if(typeof C=="string")I=C,typeof q=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),q.keyword=I);else if(typeof C=="object"&&q===void 0){if(q=C,I=q.keyword,Array.isArray(I)&&!I.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(G.call(this,I,q),!q)return(0,l.eachItem)(I,R=>ge.call(this,R)),this;Fe.call(this,q);const S={...q,type:(0,u.getJSONTypes)(q.type),schemaType:(0,u.getJSONTypes)(q.schemaType)};return(0,l.eachItem)(I,S.type.length===0?R=>ge.call(this,R,S):R=>S.type.forEach(j=>ge.call(this,R,S,j))),this}getKeyword(C){const q=this.RULES.all[C];return typeof q=="object"?q.definition:!!q}removeKeyword(C){const{RULES:q}=this;delete q.keywords[C],delete q.all[C];for(const I of q.rules){const S=I.rules.findIndex(R=>R.keyword===C);S>=0&&I.rules.splice(S,1)}return this}addFormat(C,q){return typeof q=="string"&&(q=new RegExp(q)),this.formats[C]=q,this}errorsText(C=this.errors,{separator:q=", ",dataVar:I="data"}={}){return!C||C.length===0?"No errors":C.map(S=>`${I}${S.instancePath} ${S.message}`).reduce((S,R)=>S+q+R)}$dataMetaSchema(C,q){const I=this.RULES.all;C=JSON.parse(JSON.stringify(C));for(const S of q){const R=S.split("/").slice(1);let j=C;for(const X of R)j=j[X];for(const X in I){const te=I[X];if(typeof te!="object")continue;const{$data:_e}=te.definition,de=j[X];_e&&de&&(j[X]=ft(de))}}return C}_removeAllSchemas(C,q){for(const I in C){const S=C[I];(!q||q.test(I))&&(typeof S=="string"?delete C[I]:S&&!S.meta&&(this._cache.delete(S.schema),delete C[I]))}}_addSchema(C,q,I,S=this.opts.validateSchema,R=this.opts.addUsedSchema){let j;const{schemaId:X}=this.opts;if(typeof C=="object")j=C[X];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof C!="boolean")throw new Error("schema must be object or boolean")}let te=this._cache.get(C);if(te!==void 0)return te;I=(0,c.normalizeId)(j||I);const _e=c.getSchemaRefs.call(this,C,I);return te=new a.SchemaEnv({schema:C,schemaId:X,meta:q,baseId:I,localRefs:_e}),this._cache.set(te.schema,te),R&&!I.startsWith("#")&&(I&&this._checkUnique(I),this.refs[I]=te),S&&this.validateSchema(C,!0),te}_checkUnique(C){if(this.schemas[C]||this.refs[C])throw new Error(`schema with key or id "${C}" already exists`)}_compileSchemaEnv(C){if(C.meta?this._compileMetaSchema(C):a.compileSchema.call(this,C),!C.validate)throw new Error("ajv implementation error");return C.validate}_compileMetaSchema(C){const q=this.opts;this.opts=this._metaOpts;try{a.compileSchema.call(this,C)}finally{this.opts=q}}}w.ValidationError=n.default,w.MissingRefError=s.default,t.default=w;function g(U,C,q,I="error"){for(const S in U){const R=S;R in C&&this.logger[I](`${q}: option ${S}. ${U[R]}`)}}function $(U){return U=(0,c.normalizeId)(U),this.schemas[U]||this.refs[U]}function k(){const U=this.opts.schemas;if(U)if(Array.isArray(U))this.addSchema(U);else for(const C in U)this.addSchema(U[C],C)}function N(){for(const U in this.opts.formats){const C=this.opts.formats[U];C&&this.addFormat(U,C)}}function Z(U){if(Array.isArray(U)){this.addVocabulary(U);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const C in U){const q=U[C];q.keyword||(q.keyword=C),this.addKeyword(q)}}function H(){const U={...this.opts};for(const C of h)delete U[C];return U}const z={log(){},warn(){},error(){}};function V(U){if(U===!1)return z;if(U===void 0)return console;if(U.log&&U.warn&&U.error)return U;throw new Error("logger must implement log, warn and error methods")}const J=/^[a-z_$][a-z0-9_$:-]*$/i;function G(U,C){const{RULES:q}=this;if((0,l.eachItem)(U,I=>{if(q.keywords[I])throw new Error(`Keyword ${I} is already defined`);if(!J.test(I))throw new Error(`Keyword ${I} has invalid name`)}),!!C&&C.$data&&!("code"in C||"validate"in C))throw new Error('$data keyword must have "code" or "validate" function')}function ge(U,C,q){var I;const S=C?.post;if(q&&S)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:R}=this;let j=S?R.post:R.rules.find(({type:te})=>te===q);if(j||(j={type:q,rules:[]},R.rules.push(j)),R.keywords[U]=!0,!C)return;const X={keyword:U,definition:{...C,type:(0,u.getJSONTypes)(C.type),schemaType:(0,u.getJSONTypes)(C.schemaType)}};C.before?Ve.call(this,j,X,C.before):j.rules.push(X),R.all[U]=X,(I=C.implements)===null||I===void 0||I.forEach(te=>this.addKeyword(te))}function Ve(U,C,q){const I=U.rules.findIndex(S=>S.keyword===q);I>=0?U.rules.splice(I,0,C):(U.rules.push(C),this.logger.warn(`rule ${q} is not defined`))}function Fe(U){let{metaSchema:C}=U;C!==void 0&&(U.$data&&this.opts.$data&&(C=ft(C)),U.validateSchema=this.compile(C,!0))}const be={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function ft(U){return{anyOf:[U,be]}}})(Ss)),Ss}var Xr={},Qr={},en={},Qa;function Ed(){if(Qa)return en;Qa=1,Object.defineProperty(en,"__esModule",{value:!0});const t={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};return en.default=t,en}var St={},eo;function Rd(){if(eo)return St;eo=1,Object.defineProperty(St,"__esModule",{value:!0}),St.callRef=St.getValidate=void 0;const t=Gr(),e=st(),r=se(),n=$t(),s=Is(),i=he(),a={keyword:"$ref",schemaType:"string",code(u){const{gen:l,schema:p,it:b}=u,{baseId:y,schemaEnv:h,validateName:v,opts:f,self:_}=b,{root:d}=h;if((p==="#"||p==="#/")&&y===d.baseId)return w();const m=s.resolveRef.call(_,d,y,p);if(m===void 0)throw new t.default(b.opts.uriResolver,y,p);if(m instanceof s.SchemaEnv)return g(m);return $(m);function w(){if(h===d)return c(u,v,h,h.$async);const k=l.scopeValue("root",{ref:d});return c(u,(0,r._)`${k}.validate`,d,d.$async)}function g(k){const N=o(u,k);c(u,N,k,k.$async)}function $(k){const N=l.scopeValue("schema",f.code.source===!0?{ref:k,code:(0,r.stringify)(k)}:{ref:k}),Z=l.name("valid"),H=u.subschema({schema:k,dataTypes:[],schemaPath:r.nil,topSchemaRef:N,errSchemaPath:p},Z);u.mergeEvaluated(H),u.ok(Z)}}};function o(u,l){const{gen:p}=u;return l.validate?p.scopeValue("validate",{ref:l.validate}):(0,r._)`${p.scopeValue("wrapper",{ref:l})}.validate`}St.getValidate=o;function c(u,l,p,b){const{gen:y,it:h}=u,{allErrors:v,schemaEnv:f,opts:_}=h,d=_.passContext?n.default.this:r.nil;b?m():w();function m(){if(!f.$async)throw new Error("async schema referenced by sync schema");const k=y.let("valid");y.try(()=>{y.code((0,r._)`await ${(0,e.callValidateCode)(u,l,d)}`),$(l),v||y.assign(k,!0)},N=>{y.if((0,r._)`!(${N} instanceof ${h.ValidationError})`,()=>y.throw(N)),g(N),v||y.assign(k,!1)}),u.ok(k)}function w(){u.result((0,e.callValidateCode)(u,l,d),()=>$(l),()=>g(l))}function g(k){const N=(0,r._)`${k}.errors`;y.assign(n.default.vErrors,(0,r._)`${n.default.vErrors} === null ? ${N} : ${n.default.vErrors}.concat(${N})`),y.assign(n.default.errors,(0,r._)`${n.default.vErrors}.length`)}function $(k){var N;if(!h.opts.unevaluated)return;const Z=(N=p?.validate)===null||N===void 0?void 0:N.evaluated;if(h.props!==!0)if(Z&&!Z.dynamicProps)Z.props!==void 0&&(h.props=i.mergeEvaluated.props(y,Z.props,h.props));else{const H=y.var("props",(0,r._)`${k}.evaluated.props`);h.props=i.mergeEvaluated.props(y,H,h.props,r.Name)}if(h.items!==!0)if(Z&&!Z.dynamicItems)Z.items!==void 0&&(h.items=i.mergeEvaluated.items(y,Z.items,h.items));else{const H=y.var("items",(0,r._)`${k}.evaluated.items`);h.items=i.mergeEvaluated.items(y,H,h.items,r.Name)}}}return St.callRef=c,St.default=a,St}var to;function Pd(){if(to)return Qr;to=1,Object.defineProperty(Qr,"__esModule",{value:!0});const t=Ed(),e=Rd(),r=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",t.default,e.default];return Qr.default=r,Qr}var tn={},rn={},ro;function Td(){if(ro)return rn;ro=1,Object.defineProperty(rn,"__esModule",{value:!0});const t=se(),e=t.operators,r={maximum:{okStr:"<=",ok:e.LTE,fail:e.GT},minimum:{okStr:">=",ok:e.GTE,fail:e.LT},exclusiveMaximum:{okStr:"<",ok:e.LT,fail:e.GTE},exclusiveMinimum:{okStr:">",ok:e.GT,fail:e.LTE}},n={message:({keyword:i,schemaCode:a})=>(0,t.str)`must be ${r[i].okStr} ${a}`,params:({keyword:i,schemaCode:a})=>(0,t._)`{comparison: ${r[i].okStr}, limit: ${a}}`},s={keyword:Object.keys(r),type:"number",schemaType:"number",$data:!0,error:n,code(i){const{keyword:a,data:o,schemaCode:c}=i;i.fail$data((0,t._)`${o} ${r[a].fail} ${c} || isNaN(${o})`)}};return rn.default=s,rn}var nn={},no;function Cd(){if(no)return nn;no=1,Object.defineProperty(nn,"__esModule",{value:!0});const t=se(),r={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:n})=>(0,t.str)`must be multiple of ${n}`,params:({schemaCode:n})=>(0,t._)`{multipleOf: ${n}}`},code(n){const{gen:s,data:i,schemaCode:a,it:o}=n,c=o.opts.multipleOfPrecision,u=s.let("res"),l=c?(0,t._)`Math.abs(Math.round(${u}) - ${u}) > 1e-${c}`:(0,t._)`${u} !== parseInt(${u})`;n.fail$data((0,t._)`(${a} === 0 || (${u} = ${i}/${a}, ${l}))`)}};return nn.default=r,nn}var sn={},an={},so;function Od(){if(so)return an;so=1,Object.defineProperty(an,"__esModule",{value:!0});function t(e){const r=e.length;let n=0,s=0,i;for(;s<r;)n++,i=e.charCodeAt(s++),i>=55296&&i<=56319&&s<r&&(i=e.charCodeAt(s),(i&64512)===56320&&s++);return n}return an.default=t,t.code='require("ajv/dist/runtime/ucs2length").default',an}var io;function Id(){if(io)return sn;io=1,Object.defineProperty(sn,"__esModule",{value:!0});const t=se(),e=he(),r=Od(),s={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:i,schemaCode:a}){const o=i==="maxLength"?"more":"fewer";return(0,t.str)`must NOT have ${o} than ${a} characters`},params:({schemaCode:i})=>(0,t._)`{limit: ${i}}`},code(i){const{keyword:a,data:o,schemaCode:c,it:u}=i,l=a==="maxLength"?t.operators.GT:t.operators.LT,p=u.opts.unicode===!1?(0,t._)`${o}.length`:(0,t._)`${(0,e.useFunc)(i.gen,r.default)}(${o})`;i.fail$data((0,t._)`${p} ${l} ${c}`)}};return sn.default=s,sn}var on={},ao;function Nd(){if(ao)return on;ao=1,Object.defineProperty(on,"__esModule",{value:!0});const t=st(),e=se(),n={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:s})=>(0,e.str)`must match pattern "${s}"`,params:({schemaCode:s})=>(0,e._)`{pattern: ${s}}`},code(s){const{data:i,$data:a,schema:o,schemaCode:c,it:u}=s,l=u.opts.unicodeRegExp?"u":"",p=a?(0,e._)`(new RegExp(${c}, ${l}))`:(0,t.usePattern)(s,o);s.fail$data((0,e._)`!${p}.test(${i})`)}};return on.default=n,on}var cn={},oo;function Ad(){if(oo)return cn;oo=1,Object.defineProperty(cn,"__esModule",{value:!0});const t=se(),r={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:n,schemaCode:s}){const i=n==="maxProperties"?"more":"fewer";return(0,t.str)`must NOT have ${i} than ${s} properties`},params:({schemaCode:n})=>(0,t._)`{limit: ${n}}`},code(n){const{keyword:s,data:i,schemaCode:a}=n,o=s==="maxProperties"?t.operators.GT:t.operators.LT;n.fail$data((0,t._)`Object.keys(${i}).length ${o} ${a}`)}};return cn.default=r,cn}var un={},co;function jd(){if(co)return un;co=1,Object.defineProperty(un,"__esModule",{value:!0});const t=st(),e=se(),r=he(),s={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:i}})=>(0,e.str)`must have required property '${i}'`,params:({params:{missingProperty:i}})=>(0,e._)`{missingProperty: ${i}}`},code(i){const{gen:a,schema:o,schemaCode:c,data:u,$data:l,it:p}=i,{opts:b}=p;if(!l&&o.length===0)return;const y=o.length>=b.loopRequired;if(p.allErrors?h():v(),b.strictRequired){const d=i.parentSchema.properties,{definedProperties:m}=i.it;for(const w of o)if(d?.[w]===void 0&&!m.has(w)){const g=p.schemaEnv.baseId+p.errSchemaPath,$=`required property "${w}" is not defined at "${g}" (strictRequired)`;(0,r.checkStrictMode)(p,$,p.opts.strictRequired)}}function h(){if(y||l)i.block$data(e.nil,f);else for(const d of o)(0,t.checkReportMissingProp)(i,d)}function v(){const d=a.let("missing");if(y||l){const m=a.let("valid",!0);i.block$data(m,()=>_(d,m)),i.ok(m)}else a.if((0,t.checkMissingProp)(i,o,d)),(0,t.reportMissingProp)(i,d),a.else()}function f(){a.forOf("prop",c,d=>{i.setParams({missingProperty:d}),a.if((0,t.noPropertyInData)(a,u,d,b.ownProperties),()=>i.error())})}function _(d,m){i.setParams({missingProperty:d}),a.forOf(d,c,()=>{a.assign(m,(0,t.propertyInData)(a,u,d,b.ownProperties)),a.if((0,e.not)(m),()=>{i.error(),a.break()})},e.nil)}}};return un.default=s,un}var ln={},uo;function zd(){if(uo)return ln;uo=1,Object.defineProperty(ln,"__esModule",{value:!0});const t=se(),r={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:n,schemaCode:s}){const i=n==="maxItems"?"more":"fewer";return(0,t.str)`must NOT have ${i} than ${s} items`},params:({schemaCode:n})=>(0,t._)`{limit: ${n}}`},code(n){const{keyword:s,data:i,schemaCode:a}=n,o=s==="maxItems"?t.operators.GT:t.operators.LT;n.fail$data((0,t._)`${i}.length ${o} ${a}`)}};return ln.default=r,ln}var dn={},fn={},lo;function js(){if(lo)return fn;lo=1,Object.defineProperty(fn,"__esModule",{value:!0});const t=La();return t.code='require("ajv/dist/runtime/equal").default',fn.default=t,fn}var fo;function Md(){if(fo)return dn;fo=1,Object.defineProperty(dn,"__esModule",{value:!0});const t=Hr(),e=se(),r=he(),n=js(),i={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:a,j:o}})=>(0,e.str)`must NOT have duplicate items (items ## ${o} and ${a} are identical)`,params:({params:{i:a,j:o}})=>(0,e._)`{i: ${a}, j: ${o}}`},code(a){const{gen:o,data:c,$data:u,schema:l,parentSchema:p,schemaCode:b,it:y}=a;if(!u&&!l)return;const h=o.let("valid"),v=p.items?(0,t.getSchemaTypes)(p.items):[];a.block$data(h,f,(0,e._)`${b} === false`),a.ok(h);function f(){const w=o.let("i",(0,e._)`${c}.length`),g=o.let("j");a.setParams({i:w,j:g}),o.assign(h,!0),o.if((0,e._)`${w} > 1`,()=>(_()?d:m)(w,g))}function _(){return v.length>0&&!v.some(w=>w==="object"||w==="array")}function d(w,g){const $=o.name("item"),k=(0,t.checkDataTypes)(v,$,y.opts.strictNumbers,t.DataType.Wrong),N=o.const("indices",(0,e._)`{}`);o.for((0,e._)`;${w}--;`,()=>{o.let($,(0,e._)`${c}[${w}]`),o.if(k,(0,e._)`continue`),v.length>1&&o.if((0,e._)`typeof ${$} == "string"`,(0,e._)`${$} += "_"`),o.if((0,e._)`typeof ${N}[${$}] == "number"`,()=>{o.assign(g,(0,e._)`${N}[${$}]`),a.error(),o.assign(h,!1).break()}).code((0,e._)`${N}[${$}] = ${w}`)})}function m(w,g){const $=(0,r.useFunc)(o,n.default),k=o.name("outer");o.label(k).for((0,e._)`;${w}--;`,()=>o.for((0,e._)`${g} = ${w}; ${g}--;`,()=>o.if((0,e._)`${$}(${c}[${w}], ${c}[${g}])`,()=>{a.error(),o.assign(h,!1).break(k)})))}}};return dn.default=i,dn}var hn={},ho;function qd(){if(ho)return hn;ho=1,Object.defineProperty(hn,"__esModule",{value:!0});const t=se(),e=he(),r=js(),s={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:i})=>(0,t._)`{allowedValue: ${i}}`},code(i){const{gen:a,data:o,$data:c,schemaCode:u,schema:l}=i;c||l&&typeof l=="object"?i.fail$data((0,t._)`!${(0,e.useFunc)(a,r.default)}(${o}, ${u})`):i.fail((0,t._)`${l} !== ${o}`)}};return hn.default=s,hn}var pn={},po;function Zd(){if(po)return pn;po=1,Object.defineProperty(pn,"__esModule",{value:!0});const t=se(),e=he(),r=js(),s={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:i})=>(0,t._)`{allowedValues: ${i}}`},code(i){const{gen:a,data:o,$data:c,schema:u,schemaCode:l,it:p}=i;if(!c&&u.length===0)throw new Error("enum must have non-empty array");const b=u.length>=p.opts.loopEnum;let y;const h=()=>y??(y=(0,e.useFunc)(a,r.default));let v;if(b||c)v=a.let("valid"),i.block$data(v,f);else{if(!Array.isArray(u))throw new Error("ajv implementation error");const d=a.const("vSchema",l);v=(0,t.or)(...u.map((m,w)=>_(d,w)))}i.pass(v);function f(){a.assign(v,!1),a.forOf("v",l,d=>a.if((0,t._)`${h()}(${o}, ${d})`,()=>a.assign(v,!0).break()))}function _(d,m){const w=u[m];return typeof w=="object"&&w!==null?(0,t._)`${h()}(${o}, ${d}[${m}])`:(0,t._)`${o} === ${w}`}}};return pn.default=s,pn}var mo;function xd(){if(mo)return tn;mo=1,Object.defineProperty(tn,"__esModule",{value:!0});const t=Td(),e=Cd(),r=Id(),n=Nd(),s=Ad(),i=jd(),a=zd(),o=Md(),c=qd(),u=Zd(),l=[t.default,e.default,r.default,n.default,s.default,i.default,a.default,o.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},c.default,u.default];return tn.default=l,tn}var mn={},Ht={},_o;function go(){if(_o)return Ht;_o=1,Object.defineProperty(Ht,"__esModule",{value:!0}),Ht.validateAdditionalItems=void 0;const t=se(),e=he(),n={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:i}})=>(0,t.str)`must NOT have more than ${i} items`,params:({params:{len:i}})=>(0,t._)`{limit: ${i}}`},code(i){const{parentSchema:a,it:o}=i,{items:c}=a;if(!Array.isArray(c)){(0,e.checkStrictMode)(o,'"additionalItems" is ignored when "items" is not an array of schemas');return}s(i,c)}};function s(i,a){const{gen:o,schema:c,data:u,keyword:l,it:p}=i;p.items=!0;const b=o.const("len",(0,t._)`${u}.length`);if(c===!1)i.setParams({len:a.length}),i.pass((0,t._)`${b} <= ${a.length}`);else if(typeof c=="object"&&!(0,e.alwaysValidSchema)(p,c)){const h=o.var("valid",(0,t._)`${b} <= ${a.length}`);o.if((0,t.not)(h),()=>y(h)),i.ok(h)}function y(h){o.forRange("i",a.length,b,v=>{i.subschema({keyword:l,dataProp:v,dataPropType:e.Type.Num},h),p.allErrors||o.if((0,t.not)(h),()=>o.break())})}}return Ht.validateAdditionalItems=s,Ht.default=n,Ht}var _n={},Wt={},vo;function yo(){if(vo)return Wt;vo=1,Object.defineProperty(Wt,"__esModule",{value:!0}),Wt.validateTuple=void 0;const t=se(),e=he(),r=st(),n={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(i){const{schema:a,it:o}=i;if(Array.isArray(a))return s(i,"additionalItems",a);o.items=!0,!(0,e.alwaysValidSchema)(o,a)&&i.ok((0,r.validateArray)(i))}};function s(i,a,o=i.schema){const{gen:c,parentSchema:u,data:l,keyword:p,it:b}=i;v(u),b.opts.unevaluated&&o.length&&b.items!==!0&&(b.items=e.mergeEvaluated.items(c,o.length,b.items));const y=c.name("valid"),h=c.const("len",(0,t._)`${l}.length`);o.forEach((f,_)=>{(0,e.alwaysValidSchema)(b,f)||(c.if((0,t._)`${h} > ${_}`,()=>i.subschema({keyword:p,schemaProp:_,dataProp:_},y)),i.ok(y))});function v(f){const{opts:_,errSchemaPath:d}=b,m=o.length,w=m===f.minItems&&(m===f.maxItems||f[a]===!1);if(_.strictTuples&&!w){const g=`"${p}" is ${m}-tuple, but minItems or maxItems/${a} are not specified or different at path "${d}"`;(0,e.checkStrictMode)(b,g,_.strictTuples)}}}return Wt.validateTuple=s,Wt.default=n,Wt}var bo;function Ld(){if(bo)return _n;bo=1,Object.defineProperty(_n,"__esModule",{value:!0});const t=yo(),e={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:r=>(0,t.validateTuple)(r,"items")};return _n.default=e,_n}var gn={},wo;function Ud(){if(wo)return gn;wo=1,Object.defineProperty(gn,"__esModule",{value:!0});const t=se(),e=he(),r=st(),n=go(),i={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:a}})=>(0,t.str)`must NOT have more than ${a} items`,params:({params:{len:a}})=>(0,t._)`{limit: ${a}}`},code(a){const{schema:o,parentSchema:c,it:u}=a,{prefixItems:l}=c;u.items=!0,!(0,e.alwaysValidSchema)(u,o)&&(l?(0,n.validateAdditionalItems)(a,l):a.ok((0,r.validateArray)(a)))}};return gn.default=i,gn}var vn={},$o;function Dd(){if($o)return vn;$o=1,Object.defineProperty(vn,"__esModule",{value:!0});const t=se(),e=he(),n={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:s,max:i}})=>i===void 0?(0,t.str)`must contain at least ${s} valid item(s)`:(0,t.str)`must contain at least ${s} and no more than ${i} valid item(s)`,params:({params:{min:s,max:i}})=>i===void 0?(0,t._)`{minContains: ${s}}`:(0,t._)`{minContains: ${s}, maxContains: ${i}}`},code(s){const{gen:i,schema:a,parentSchema:o,data:c,it:u}=s;let l,p;const{minContains:b,maxContains:y}=o;u.opts.next?(l=b===void 0?1:b,p=y):l=1;const h=i.const("len",(0,t._)`${c}.length`);if(s.setParams({min:l,max:p}),p===void 0&&l===0){(0,e.checkStrictMode)(u,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(p!==void 0&&l>p){(0,e.checkStrictMode)(u,'"minContains" > "maxContains" is always invalid'),s.fail();return}if((0,e.alwaysValidSchema)(u,a)){let m=(0,t._)`${h} >= ${l}`;p!==void 0&&(m=(0,t._)`${m} && ${h} <= ${p}`),s.pass(m);return}u.items=!0;const v=i.name("valid");p===void 0&&l===1?_(v,()=>i.if(v,()=>i.break())):l===0?(i.let(v,!0),p!==void 0&&i.if((0,t._)`${c}.length > 0`,f)):(i.let(v,!1),f()),s.result(v,()=>s.reset());function f(){const m=i.name("_valid"),w=i.let("count",0);_(m,()=>i.if(m,()=>d(w)))}function _(m,w){i.forRange("i",0,h,g=>{s.subschema({keyword:"contains",dataProp:g,dataPropType:e.Type.Num,compositeRule:!0},m),w()})}function d(m){i.code((0,t._)`${m}++`),p===void 0?i.if((0,t._)`${m} >= ${l}`,()=>i.assign(v,!0).break()):(i.if((0,t._)`${m} > ${p}`,()=>i.assign(v,!1).break()),l===1?i.assign(v,!0):i.if((0,t._)`${m} >= ${l}`,()=>i.assign(v,!0)))}}};return vn.default=n,vn}var zs={},So;function Vd(){return So||(So=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;const e=se(),r=he(),n=st();t.error={message:({params:{property:c,depsCount:u,deps:l}})=>{const p=u===1?"property":"properties";return(0,e.str)`must have ${p} ${l} when property ${c} is present`},params:({params:{property:c,depsCount:u,deps:l,missingProperty:p}})=>(0,e._)`{property: ${c},
6
+ missingProperty: ${p},
7
+ depsCount: ${u},
8
+ deps: ${l}}`};const s={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(c){const[u,l]=i(c);a(c,u),o(c,l)}};function i({schema:c}){const u={},l={};for(const p in c){if(p==="__proto__")continue;const b=Array.isArray(c[p])?u:l;b[p]=c[p]}return[u,l]}function a(c,u=c.schema){const{gen:l,data:p,it:b}=c;if(Object.keys(u).length===0)return;const y=l.let("missing");for(const h in u){const v=u[h];if(v.length===0)continue;const f=(0,n.propertyInData)(l,p,h,b.opts.ownProperties);c.setParams({property:h,depsCount:v.length,deps:v.join(", ")}),b.allErrors?l.if(f,()=>{for(const _ of v)(0,n.checkReportMissingProp)(c,_)}):(l.if((0,e._)`${f} && (${(0,n.checkMissingProp)(c,v,y)})`),(0,n.reportMissingProp)(c,y),l.else())}}t.validatePropertyDeps=a;function o(c,u=c.schema){const{gen:l,data:p,keyword:b,it:y}=c,h=l.name("valid");for(const v in u)(0,r.alwaysValidSchema)(y,u[v])||(l.if((0,n.propertyInData)(l,p,v,y.opts.ownProperties),()=>{const f=c.subschema({keyword:b,schemaProp:v},h);c.mergeValidEvaluated(f,h)},()=>l.var(h,!0)),c.ok(h))}t.validateSchemaDeps=o,t.default=s})(zs)),zs}var yn={},ko;function Fd(){if(ko)return yn;ko=1,Object.defineProperty(yn,"__esModule",{value:!0});const t=se(),e=he(),n={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:s})=>(0,t._)`{propertyName: ${s.propertyName}}`},code(s){const{gen:i,schema:a,data:o,it:c}=s;if((0,e.alwaysValidSchema)(c,a))return;const u=i.name("valid");i.forIn("key",o,l=>{s.setParams({propertyName:l}),s.subschema({keyword:"propertyNames",data:l,dataTypes:["string"],propertyName:l,compositeRule:!0},u),i.if((0,t.not)(u),()=>{s.error(!0),c.allErrors||i.break()})}),s.ok(u)}};return yn.default=n,yn}var bn={},Eo;function Ro(){if(Eo)return bn;Eo=1,Object.defineProperty(bn,"__esModule",{value:!0});const t=st(),e=se(),r=$t(),n=he(),i={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:a})=>(0,e._)`{additionalProperty: ${a.additionalProperty}}`},code(a){const{gen:o,schema:c,parentSchema:u,data:l,errsCount:p,it:b}=a;if(!p)throw new Error("ajv implementation error");const{allErrors:y,opts:h}=b;if(b.props=!0,h.removeAdditional!=="all"&&(0,n.alwaysValidSchema)(b,c))return;const v=(0,t.allSchemaProperties)(u.properties),f=(0,t.allSchemaProperties)(u.patternProperties);_(),a.ok((0,e._)`${p} === ${r.default.errors}`);function _(){o.forIn("key",l,$=>{!v.length&&!f.length?w($):o.if(d($),()=>w($))})}function d($){let k;if(v.length>8){const N=(0,n.schemaRefOrVal)(b,u.properties,"properties");k=(0,t.isOwnProperty)(o,N,$)}else v.length?k=(0,e.or)(...v.map(N=>(0,e._)`${$} === ${N}`)):k=e.nil;return f.length&&(k=(0,e.or)(k,...f.map(N=>(0,e._)`${(0,t.usePattern)(a,N)}.test(${$})`))),(0,e.not)(k)}function m($){o.code((0,e._)`delete ${l}[${$}]`)}function w($){if(h.removeAdditional==="all"||h.removeAdditional&&c===!1){m($);return}if(c===!1){a.setParams({additionalProperty:$}),a.error(),y||o.break();return}if(typeof c=="object"&&!(0,n.alwaysValidSchema)(b,c)){const k=o.name("valid");h.removeAdditional==="failing"?(g($,k,!1),o.if((0,e.not)(k),()=>{a.reset(),m($)})):(g($,k),y||o.if((0,e.not)(k),()=>o.break()))}}function g($,k,N){const Z={keyword:"additionalProperties",dataProp:$,dataPropType:n.Type.Str};N===!1&&Object.assign(Z,{compositeRule:!0,createErrors:!1,allErrors:!1}),a.subschema(Z,k)}}};return bn.default=i,bn}var wn={},Po;function Hd(){if(Po)return wn;Po=1,Object.defineProperty(wn,"__esModule",{value:!0});const t=Kr(),e=st(),r=he(),n=Ro(),s={keyword:"properties",type:"object",schemaType:"object",code(i){const{gen:a,schema:o,parentSchema:c,data:u,it:l}=i;l.opts.removeAdditional==="all"&&c.additionalProperties===void 0&&n.default.code(new t.KeywordCxt(l,n.default,"additionalProperties"));const p=(0,e.allSchemaProperties)(o);for(const f of p)l.definedProperties.add(f);l.opts.unevaluated&&p.length&&l.props!==!0&&(l.props=r.mergeEvaluated.props(a,(0,r.toHash)(p),l.props));const b=p.filter(f=>!(0,r.alwaysValidSchema)(l,o[f]));if(b.length===0)return;const y=a.name("valid");for(const f of b)h(f)?v(f):(a.if((0,e.propertyInData)(a,u,f,l.opts.ownProperties)),v(f),l.allErrors||a.else().var(y,!0),a.endIf()),i.it.definedProperties.add(f),i.ok(y);function h(f){return l.opts.useDefaults&&!l.compositeRule&&o[f].default!==void 0}function v(f){i.subschema({keyword:"properties",schemaProp:f,dataProp:f},y)}}};return wn.default=s,wn}var $n={},To;function Wd(){if(To)return $n;To=1,Object.defineProperty($n,"__esModule",{value:!0});const t=st(),e=se(),r=he(),n=he(),s={keyword:"patternProperties",type:"object",schemaType:"object",code(i){const{gen:a,schema:o,data:c,parentSchema:u,it:l}=i,{opts:p}=l,b=(0,t.allSchemaProperties)(o),y=b.filter(w=>(0,r.alwaysValidSchema)(l,o[w]));if(b.length===0||y.length===b.length&&(!l.opts.unevaluated||l.props===!0))return;const h=p.strictSchema&&!p.allowMatchingProperties&&u.properties,v=a.name("valid");l.props!==!0&&!(l.props instanceof e.Name)&&(l.props=(0,n.evaluatedPropsToName)(a,l.props));const{props:f}=l;_();function _(){for(const w of b)h&&d(w),l.allErrors?m(w):(a.var(v,!0),m(w),a.if(v))}function d(w){for(const g in h)new RegExp(w).test(g)&&(0,r.checkStrictMode)(l,`property ${g} matches pattern ${w} (use allowMatchingProperties)`)}function m(w){a.forIn("key",c,g=>{a.if((0,e._)`${(0,t.usePattern)(i,w)}.test(${g})`,()=>{const $=y.includes(w);$||i.subschema({keyword:"patternProperties",schemaProp:w,dataProp:g,dataPropType:n.Type.Str},v),l.opts.unevaluated&&f!==!0?a.assign((0,e._)`${f}[${g}]`,!0):!$&&!l.allErrors&&a.if((0,e.not)(v),()=>a.break())})})}}};return $n.default=s,$n}var Sn={},Co;function Kd(){if(Co)return Sn;Co=1,Object.defineProperty(Sn,"__esModule",{value:!0});const t=he(),e={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(r){const{gen:n,schema:s,it:i}=r;if((0,t.alwaysValidSchema)(i,s)){r.fail();return}const a=n.name("valid");r.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},a),r.failResult(a,()=>r.reset(),()=>r.error())},error:{message:"must NOT be valid"}};return Sn.default=e,Sn}var kn={},Oo;function Jd(){if(Oo)return kn;Oo=1,Object.defineProperty(kn,"__esModule",{value:!0});const e={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:st().validateUnion,error:{message:"must match a schema in anyOf"}};return kn.default=e,kn}var En={},Io;function Bd(){if(Io)return En;Io=1,Object.defineProperty(En,"__esModule",{value:!0});const t=se(),e=he(),n={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:s})=>(0,t._)`{passingSchemas: ${s.passing}}`},code(s){const{gen:i,schema:a,parentSchema:o,it:c}=s;if(!Array.isArray(a))throw new Error("ajv implementation error");if(c.opts.discriminator&&o.discriminator)return;const u=a,l=i.let("valid",!1),p=i.let("passing",null),b=i.name("_valid");s.setParams({passing:p}),i.block(y),s.result(l,()=>s.reset(),()=>s.error(!0));function y(){u.forEach((h,v)=>{let f;(0,e.alwaysValidSchema)(c,h)?i.var(b,!0):f=s.subschema({keyword:"oneOf",schemaProp:v,compositeRule:!0},b),v>0&&i.if((0,t._)`${b} && ${l}`).assign(l,!1).assign(p,(0,t._)`[${p}, ${v}]`).else(),i.if(b,()=>{i.assign(l,!0),i.assign(p,v),f&&s.mergeEvaluated(f,t.Name)})})}}};return En.default=n,En}var Rn={},No;function Gd(){if(No)return Rn;No=1,Object.defineProperty(Rn,"__esModule",{value:!0});const t=he(),e={keyword:"allOf",schemaType:"array",code(r){const{gen:n,schema:s,it:i}=r;if(!Array.isArray(s))throw new Error("ajv implementation error");const a=n.name("valid");s.forEach((o,c)=>{if((0,t.alwaysValidSchema)(i,o))return;const u=r.subschema({keyword:"allOf",schemaProp:c},a);r.ok(a),r.mergeEvaluated(u)})}};return Rn.default=e,Rn}var Pn={},Ao;function Yd(){if(Ao)return Pn;Ao=1,Object.defineProperty(Pn,"__esModule",{value:!0});const t=se(),e=he(),n={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:i})=>(0,t.str)`must match "${i.ifClause}" schema`,params:({params:i})=>(0,t._)`{failingKeyword: ${i.ifClause}}`},code(i){const{gen:a,parentSchema:o,it:c}=i;o.then===void 0&&o.else===void 0&&(0,e.checkStrictMode)(c,'"if" without "then" and "else" is ignored');const u=s(c,"then"),l=s(c,"else");if(!u&&!l)return;const p=a.let("valid",!0),b=a.name("_valid");if(y(),i.reset(),u&&l){const v=a.let("ifClause");i.setParams({ifClause:v}),a.if(b,h("then",v),h("else",v))}else u?a.if(b,h("then")):a.if((0,t.not)(b),h("else"));i.pass(p,()=>i.error(!0));function y(){const v=i.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},b);i.mergeEvaluated(v)}function h(v,f){return()=>{const _=i.subschema({keyword:v},b);a.assign(p,b),i.mergeValidEvaluated(_,p),f?a.assign(f,(0,t._)`${v}`):i.setParams({ifClause:v})}}}};function s(i,a){const o=i.schema[a];return o!==void 0&&!(0,e.alwaysValidSchema)(i,o)}return Pn.default=n,Pn}var Tn={},jo;function Xd(){if(jo)return Tn;jo=1,Object.defineProperty(Tn,"__esModule",{value:!0});const t=he(),e={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:r,parentSchema:n,it:s}){n.if===void 0&&(0,t.checkStrictMode)(s,`"${r}" without "if" is ignored`)}};return Tn.default=e,Tn}var zo;function Qd(){if(zo)return mn;zo=1,Object.defineProperty(mn,"__esModule",{value:!0});const t=go(),e=Ld(),r=yo(),n=Ud(),s=Dd(),i=Vd(),a=Fd(),o=Ro(),c=Hd(),u=Wd(),l=Kd(),p=Jd(),b=Bd(),y=Gd(),h=Yd(),v=Xd();function f(_=!1){const d=[l.default,p.default,b.default,y.default,h.default,v.default,a.default,o.default,i.default,c.default,u.default];return _?d.push(e.default,n.default):d.push(t.default,r.default),d.push(s.default),d}return mn.default=f,mn}var Cn={},On={},Mo;function ef(){if(Mo)return On;Mo=1,Object.defineProperty(On,"__esModule",{value:!0});const t=se(),r={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:n})=>(0,t.str)`must match format "${n}"`,params:({schemaCode:n})=>(0,t._)`{format: ${n}}`},code(n,s){const{gen:i,data:a,$data:o,schema:c,schemaCode:u,it:l}=n,{opts:p,errSchemaPath:b,schemaEnv:y,self:h}=l;if(!p.validateFormats)return;o?v():f();function v(){const _=i.scopeValue("formats",{ref:h.formats,code:p.code.formats}),d=i.const("fDef",(0,t._)`${_}[${u}]`),m=i.let("fType"),w=i.let("format");i.if((0,t._)`typeof ${d} == "object" && !(${d} instanceof RegExp)`,()=>i.assign(m,(0,t._)`${d}.type || "string"`).assign(w,(0,t._)`${d}.validate`),()=>i.assign(m,(0,t._)`"string"`).assign(w,d)),n.fail$data((0,t.or)(g(),$()));function g(){return p.strictSchema===!1?t.nil:(0,t._)`${u} && !${w}`}function $(){const k=y.$async?(0,t._)`(${d}.async ? await ${w}(${a}) : ${w}(${a}))`:(0,t._)`${w}(${a})`,N=(0,t._)`(typeof ${w} == "function" ? ${k} : ${w}.test(${a}))`;return(0,t._)`${w} && ${w} !== true && ${m} === ${s} && !${N}`}}function f(){const _=h.formats[c];if(!_){g();return}if(_===!0)return;const[d,m,w]=$(_);d===s&&n.pass(k());function g(){if(p.strictSchema===!1){h.logger.warn(N());return}throw new Error(N());function N(){return`unknown format "${c}" ignored in schema at path "${b}"`}}function $(N){const Z=N instanceof RegExp?(0,t.regexpCode)(N):p.code.formats?(0,t._)`${p.code.formats}${(0,t.getProperty)(c)}`:void 0,H=i.scopeValue("formats",{key:c,ref:N,code:Z});return typeof N=="object"&&!(N instanceof RegExp)?[N.type||"string",N.validate,(0,t._)`${H}.validate`]:["string",N,H]}function k(){if(typeof _=="object"&&!(_ instanceof RegExp)&&_.async){if(!y.$async)throw new Error("async format in sync schema");return(0,t._)`await ${w}(${a})`}return typeof m=="function"?(0,t._)`${w}(${a})`:(0,t._)`${w}.test(${a})`}}}};return On.default=r,On}var qo;function tf(){if(qo)return Cn;qo=1,Object.defineProperty(Cn,"__esModule",{value:!0});const e=[ef().default];return Cn.default=e,Cn}var qt={},Zo;function rf(){return Zo||(Zo=1,Object.defineProperty(qt,"__esModule",{value:!0}),qt.contentVocabulary=qt.metadataVocabulary=void 0,qt.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],qt.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]),qt}var xo;function nf(){if(xo)return Xr;xo=1,Object.defineProperty(Xr,"__esModule",{value:!0});const t=Pd(),e=xd(),r=Qd(),n=tf(),s=rf(),i=[t.default,e.default,(0,r.default)(),n.default,s.metadataVocabulary,s.contentVocabulary];return Xr.default=i,Xr}var In={},lr={},Lo;function sf(){if(Lo)return lr;Lo=1,Object.defineProperty(lr,"__esModule",{value:!0}),lr.DiscrError=void 0;var t;return(function(e){e.Tag="tag",e.Mapping="mapping"})(t||(lr.DiscrError=t={})),lr}var Uo;function af(){if(Uo)return In;Uo=1,Object.defineProperty(In,"__esModule",{value:!0});const t=se(),e=sf(),r=Is(),n=Gr(),s=he(),a={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:o,tagName:c}})=>o===e.DiscrError.Tag?`tag "${c}" must be string`:`value of tag "${c}" must be in oneOf`,params:({params:{discrError:o,tag:c,tagName:u}})=>(0,t._)`{error: ${o}, tag: ${u}, tagValue: ${c}}`},code(o){const{gen:c,data:u,schema:l,parentSchema:p,it:b}=o,{oneOf:y}=p;if(!b.opts.discriminator)throw new Error("discriminator: requires discriminator option");const h=l.propertyName;if(typeof h!="string")throw new Error("discriminator: requires propertyName");if(l.mapping)throw new Error("discriminator: mapping is not supported");if(!y)throw new Error("discriminator: requires oneOf keyword");const v=c.let("valid",!1),f=c.const("tag",(0,t._)`${u}${(0,t.getProperty)(h)}`);c.if((0,t._)`typeof ${f} == "string"`,()=>_(),()=>o.error(!1,{discrError:e.DiscrError.Tag,tag:f,tagName:h})),o.ok(v);function _(){const w=m();c.if(!1);for(const g in w)c.elseIf((0,t._)`${f} === ${g}`),c.assign(v,d(w[g]));c.else(),o.error(!1,{discrError:e.DiscrError.Mapping,tag:f,tagName:h}),c.endIf()}function d(w){const g=c.name("valid"),$=o.subschema({keyword:"oneOf",schemaProp:w},g);return o.mergeEvaluated($,t.Name),g}function m(){var w;const g={},$=N(p);let k=!0;for(let z=0;z<y.length;z++){let V=y[z];if(V?.$ref&&!(0,s.schemaHasRulesButRef)(V,b.self.RULES)){const G=V.$ref;if(V=r.resolveRef.call(b.self,b.schemaEnv.root,b.baseId,G),V instanceof r.SchemaEnv&&(V=V.schema),V===void 0)throw new n.default(b.opts.uriResolver,b.baseId,G)}const J=(w=V?.properties)===null||w===void 0?void 0:w[h];if(typeof J!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${h}"`);k=k&&($||N(V)),Z(J,z)}if(!k)throw new Error(`discriminator: "${h}" must be required`);return g;function N({required:z}){return Array.isArray(z)&&z.includes(h)}function Z(z,V){if(z.const)H(z.const,V);else if(z.enum)for(const J of z.enum)H(J,V);else throw new Error(`discriminator: "properties/${h}" must have "const" or "enum"`)}function H(z,V){if(typeof z!="string"||z in g)throw new Error(`discriminator: "${h}" values must be unique strings`);g[z]=V}}}};return In.default=a,In}const of={$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 Do;function Vo(){return Do||(Do=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv=void 0;const r=kd(),n=nf(),s=af(),i=of,a=["/properties"],o="http://json-schema.org/draft-07/schema";class c extends r.default{_addVocabularies(){super._addVocabularies(),n.default.forEach(h=>this.addVocabulary(h)),this.opts.discriminator&&this.addKeyword(s.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const h=this.opts.$data?this.$dataMetaSchema(i,a):i;this.addMetaSchema(h,o,!1),this.refs["http://json-schema.org/schema"]=o}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(o)?o:void 0)}}e.Ajv=c,t.exports=e=c,t.exports.Ajv=c,Object.defineProperty(e,"__esModule",{value:!0}),e.default=c;var u=Kr();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var l=se();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return l._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return l.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return l.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return l.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return l.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return l.CodeGen}});var p=Os();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return p.default}});var b=Gr();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return b.default}})})(Ur,Ur.exports)),Ur.exports}var Fo=Vo();const cf=Ft(Fo),uf=Object.freeze({status:"aborted"});function A(t,e,r){function n(o,c){var u;Object.defineProperty(o,"_zod",{value:o._zod??{},enumerable:!1}),(u=o._zod).traits??(u.traits=new Set),o._zod.traits.add(t),e(o,c);for(const l in a.prototype)l in o||Object.defineProperty(o,l,{value:a.prototype[l].bind(o)});o._zod.constr=a,o._zod.def=c}const s=r?.Parent??Object;class i extends s{}Object.defineProperty(i,"name",{value:t});function a(o){var c;const u=r?.Parent?new i:this;n(u,o),(c=u._zod).deferred??(c.deferred=[]);for(const l of u._zod.deferred)l();return u}return Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:o=>r?.Parent&&o instanceof r.Parent?!0:o?._zod?.traits?.has(t)}),Object.defineProperty(a,"name",{value:t}),a}class dr extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const Ho={};function kt(t){return Ho}function Wo(t){const e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,s])=>e.indexOf(+n)===-1).map(([n,s])=>s)}function lf(t,e){return typeof e=="bigint"?e.toString():e}function Ms(t){return{get value(){{const e=t();return Object.defineProperty(this,"value",{value:e}),e}}}}function qs(t){return t==null}function Zs(t){const e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function df(t,e){const r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=r>n?r:n,i=Number.parseInt(t.toFixed(s).replace(".","")),a=Number.parseInt(e.toFixed(s).replace(".",""));return i%a/10**s}function we(t,e,r){Object.defineProperty(t,e,{get(){{const n=r();return t[e]=n,n}},set(n){Object.defineProperty(t,e,{value:n})},configurable:!0})}function fr(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function hr(t){return JSON.stringify(t)}const Ko=Error.captureStackTrace?Error.captureStackTrace:(...t)=>{};function Nn(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}const ff=Ms(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function An(t){if(Nn(t)===!1)return!1;const e=t.constructor;if(e===void 0)return!0;const r=e.prototype;return!(Nn(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}const hf=new Set(["string","number","symbol"]);function pr(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Et(t,e,r){const n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function Q(t){const e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function pf(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}const mf={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]};function _f(t,e){const r={},n=t._zod.def;for(const s in e){if(!(s in n.shape))throw new Error(`Unrecognized key: "${s}"`);e[s]&&(r[s]=n.shape[s])}return Et(t,{...t._zod.def,shape:r,checks:[]})}function gf(t,e){const r={...t._zod.def.shape},n=t._zod.def;for(const s in e){if(!(s in n.shape))throw new Error(`Unrecognized key: "${s}"`);e[s]&&delete r[s]}return Et(t,{...t._zod.def,shape:r,checks:[]})}function vf(t,e){if(!An(e))throw new Error("Invalid input to extend: expected a plain object");const r={...t._zod.def,get shape(){const n={...t._zod.def.shape,...e};return fr(this,"shape",n),n},checks:[]};return Et(t,r)}function yf(t,e){return Et(t,{...t._zod.def,get shape(){const r={...t._zod.def.shape,...e._zod.def.shape};return fr(this,"shape",r),r},catchall:e._zod.def.catchall,checks:[]})}function bf(t,e,r){const n=e._zod.def.shape,s={...n};if(r)for(const i in r){if(!(i in n))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(s[i]=t?new t({type:"optional",innerType:n[i]}):n[i])}else for(const i in n)s[i]=t?new t({type:"optional",innerType:n[i]}):n[i];return Et(e,{...e._zod.def,shape:s,checks:[]})}function wf(t,e,r){const n=e._zod.def.shape,s={...n};if(r)for(const i in r){if(!(i in s))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(s[i]=new t({type:"nonoptional",innerType:n[i]}))}else for(const i in n)s[i]=new t({type:"nonoptional",innerType:n[i]});return Et(e,{...e._zod.def,shape:s,checks:[]})}function mr(t,e=0){for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function Zt(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function jn(t){return typeof t=="string"?t:t?.message}function Rt(t,e,r){const n={...t,path:t.path??[]};if(!t.message){const s=jn(t.inst?._zod.def?.error?.(t))??jn(e?.error?.(t))??jn(r.customError?.(t))??jn(r.localeError?.(t))??"Invalid input";n.message=s}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}function xs(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function _r(...t){const[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}const Jo=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),Object.defineProperty(t,"message",{get(){return JSON.stringify(e,lf,2)},enumerable:!0}),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},Bo=A("$ZodError",Jo),zn=A("$ZodError",Jo,{Parent:Error});function $f(t,e=r=>r.message){const r={},n=[];for(const s of t.issues)s.path.length>0?(r[s.path[0]]=r[s.path[0]]||[],r[s.path[0]].push(e(s))):n.push(e(s));return{formErrors:n,fieldErrors:r}}function Sf(t,e){const r=e||function(i){return i.message},n={_errors:[]},s=i=>{for(const a of i.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(o=>s({issues:o}));else if(a.code==="invalid_key")s({issues:a.issues});else if(a.code==="invalid_element")s({issues:a.issues});else if(a.path.length===0)n._errors.push(r(a));else{let o=n,c=0;for(;c<a.path.length;){const u=a.path[c];c===a.path.length-1?(o[u]=o[u]||{_errors:[]},o[u]._errors.push(r(a))):o[u]=o[u]||{_errors:[]},o=o[u],c++}}};return s(t),n}const Go=t=>(e,r,n,s)=>{const i=n?Object.assign(n,{async:!1}):{async:!1},a=e._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new dr;if(a.issues.length){const o=new(s?.Err??t)(a.issues.map(c=>Rt(c,i,kt())));throw Ko(o,s?.callee),o}return a.value},kf=Go(zn),Yo=t=>async(e,r,n,s)=>{const i=n?Object.assign(n,{async:!0}):{async:!0};let a=e._zod.run({value:r,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){const o=new(s?.Err??t)(a.issues.map(c=>Rt(c,i,kt())));throw Ko(o,s?.callee),o}return a.value},Ef=Yo(zn),Xo=t=>(e,r,n)=>{const s=n?{...n,async:!1}:{async:!1},i=e._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new dr;return i.issues.length?{success:!1,error:new(t??Bo)(i.issues.map(a=>Rt(a,s,kt())))}:{success:!0,data:i.value}},Ls=Xo(zn),Qo=t=>async(e,r,n)=>{const s=n?Object.assign(n,{async:!0}):{async:!0};let i=e._zod.run({value:r,issues:[]},s);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new t(i.issues.map(a=>Rt(a,s,kt())))}:{success:!0,data:i.value}},Us=Qo(zn),Rf=/^[cC][^\s-]{8,}$/,Pf=/^[0-9a-z]+$/,Tf=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Cf=/^[0-9a-vA-V]{20}$/,Of=/^[A-Za-z0-9]{27}$/,If=/^[a-zA-Z0-9_-]{21}$/,Nf=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Af=/^([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})$/,ec=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[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)$/,jf=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,zf="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Mf(){return new RegExp(zf,"u")}const qf=/^(?:(?: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])$/,Zf=/^(([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})$/,xf=/^((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])$/,Lf=/^(([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])$/,Uf=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,tc=/^[A-Za-z0-9_-]*$/,Df=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,Vf=/^\+(?:[0-9]){6,14}[0-9]$/,rc="(?:(?:\\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])))",Ff=new RegExp(`^${rc}$`);function nc(t){const e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Hf(t){return new RegExp(`^${nc(t)}$`)}function Wf(t){const e=nc({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-]\\d{2}:\\d{2})");const n=`${e}(?:${r.join("|")})`;return new RegExp(`^${rc}T(?:${n})$`)}const Kf=t=>{const e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},Jf=/^\d+$/,Bf=/^-?\d+(?:\.\d+)?/i,Gf=/true|false/i,Yf=/^[^A-Z]*$/,Xf=/^[^a-z]*$/,He=A("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),sc={number:"number",bigint:"bigint",object:"date"},ic=A("$ZodCheckLessThan",(t,e)=>{He.init(t,e);const r=sc[typeof e.value];t._zod.onattach.push(n=>{const s=n._zod.bag,i=(e.inclusive?s.maximum:s.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<i&&(e.inclusive?s.maximum=e.value:s.exclusiveMaximum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value<=e.value:n.value<e.value)||n.issues.push({origin:r,code:"too_big",maximum:e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),ac=A("$ZodCheckGreaterThan",(t,e)=>{He.init(t,e);const r=sc[typeof e.value];t._zod.onattach.push(n=>{const s=n._zod.bag,i=(e.inclusive?s.minimum:s.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>i&&(e.inclusive?s.minimum=e.value:s.exclusiveMinimum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value>=e.value:n.value>e.value)||n.issues.push({origin:r,code:"too_small",minimum:e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Qf=A("$ZodCheckMultipleOf",(t,e)=>{He.init(t,e),t._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):df(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),eh=A("$ZodCheckNumberFormat",(t,e)=>{He.init(t,e),e.format=e.format||"float64";const r=e.format?.includes("int"),n=r?"int":"number",[s,i]=mf[e.format];t._zod.onattach.push(a=>{const o=a._zod.bag;o.format=e.format,o.minimum=s,o.maximum=i,r&&(o.pattern=Jf)}),t._zod.check=a=>{const o=a.value;if(r){if(!Number.isInteger(o)){a.issues.push({expected:n,format:e.format,code:"invalid_type",input:o,inst:t});return}if(!Number.isSafeInteger(o)){o>0?a.issues.push({input:o,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort}):a.issues.push({input:o,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort});return}}o<s&&a.issues.push({origin:"number",input:o,code:"too_small",minimum:s,inclusive:!0,inst:t,continue:!e.abort}),o>i&&a.issues.push({origin:"number",input:o,code:"too_big",maximum:i,inst:t})}}),th=A("$ZodCheckMaxLength",(t,e)=>{var r;He.init(t,e),(r=t._zod.def).when??(r.when=n=>{const s=n.value;return!qs(s)&&s.length!==void 0}),t._zod.onattach.push(n=>{const s=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<s&&(n._zod.bag.maximum=e.maximum)}),t._zod.check=n=>{const s=n.value;if(s.length<=e.maximum)return;const a=xs(s);n.issues.push({origin:a,code:"too_big",maximum:e.maximum,inclusive:!0,input:s,inst:t,continue:!e.abort})}}),rh=A("$ZodCheckMinLength",(t,e)=>{var r;He.init(t,e),(r=t._zod.def).when??(r.when=n=>{const s=n.value;return!qs(s)&&s.length!==void 0}),t._zod.onattach.push(n=>{const s=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>s&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{const s=n.value;if(s.length>=e.minimum)return;const a=xs(s);n.issues.push({origin:a,code:"too_small",minimum:e.minimum,inclusive:!0,input:s,inst:t,continue:!e.abort})}}),nh=A("$ZodCheckLengthEquals",(t,e)=>{var r;He.init(t,e),(r=t._zod.def).when??(r.when=n=>{const s=n.value;return!qs(s)&&s.length!==void 0}),t._zod.onattach.push(n=>{const s=n._zod.bag;s.minimum=e.length,s.maximum=e.length,s.length=e.length}),t._zod.check=n=>{const s=n.value,i=s.length;if(i===e.length)return;const a=xs(s),o=i>e.length;n.issues.push({origin:a,...o?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),Mn=A("$ZodCheckStringFormat",(t,e)=>{var r,n;He.init(t,e),t._zod.onattach.push(s=>{const i=s._zod.bag;i.format=e.format,e.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=s=>{e.pattern.lastIndex=0,!e.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:e.format,input:s.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(n=t._zod).check??(n.check=()=>{})}),sh=A("$ZodCheckRegex",(t,e)=>{Mn.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),ih=A("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=Yf),Mn.init(t,e)}),ah=A("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=Xf),Mn.init(t,e)}),oh=A("$ZodCheckIncludes",(t,e)=>{He.init(t,e);const r=pr(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=n,t._zod.onattach.push(s=>{const i=s._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),t._zod.check=s=>{s.value.includes(e.includes,e.position)||s.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:s.value,inst:t,continue:!e.abort})}}),ch=A("$ZodCheckStartsWith",(t,e)=>{He.init(t,e);const r=new RegExp(`^${pr(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{const s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),t._zod.check=n=>{n.value.startsWith(e.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:n.value,inst:t,continue:!e.abort})}}),uh=A("$ZodCheckEndsWith",(t,e)=>{He.init(t,e);const r=new RegExp(`.*${pr(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{const s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),t._zod.check=n=>{n.value.endsWith(e.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:n.value,inst:t,continue:!e.abort})}}),lh=A("$ZodCheckOverwrite",(t,e)=>{He.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});class dh{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}const n=e.split(`
9
+ `).filter(a=>a),s=Math.min(...n.map(a=>a.length-a.trimStart().length)),i=n.map(a=>a.slice(s)).map(a=>" ".repeat(this.indent*2)+a);for(const a of i)this.content.push(a)}compile(){const e=Function,r=this?.args,s=[...(this?.content??[""]).map(i=>` ${i}`)];return new e(...r,s.join(`
10
+ `))}}const fh={major:4,minor:0,patch:0},$e=A("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=fh;const n=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(const s of n)for(const i of s._zod.onattach)i(t);if(n.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{const s=(i,a,o)=>{let c=mr(i),u;for(const l of a){if(l._zod.def.when){if(!l._zod.def.when(i))continue}else if(c)continue;const p=i.issues.length,b=l._zod.check(i);if(b instanceof Promise&&o?.async===!1)throw new dr;if(u||b instanceof Promise)u=(u??Promise.resolve()).then(async()=>{await b,i.issues.length!==p&&(c||(c=mr(i,p)))});else{if(i.issues.length===p)continue;c||(c=mr(i,p))}}return u?u.then(()=>i):i};t._zod.run=(i,a)=>{const o=t._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new dr;return o.then(c=>s(c,n,a))}return s(o,n,a)}}t["~standard"]={validate:s=>{try{const i=Ls(t,s);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return Us(t,s).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}}),Ds=A("$ZodString",(t,e)=>{$e.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??Kf(t._zod.bag),t._zod.parse=(r,n)=>{if(e.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:t}),r}}),Se=A("$ZodStringFormat",(t,e)=>{Mn.init(t,e),Ds.init(t,e)}),hh=A("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=Af),Se.init(t,e)}),ph=A("$ZodUUID",(t,e)=>{if(e.version){const n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(n===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=ec(n))}else e.pattern??(e.pattern=ec());Se.init(t,e)}),mh=A("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=jf),Se.init(t,e)}),_h=A("$ZodURL",(t,e)=>{Se.init(t,e),t._zod.check=r=>{try{const n=r.value,s=new URL(n),i=s.href;e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(s.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:Df.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort})),!n.endsWith("/")&&i.endsWith("/")?r.value=i.slice(0,-1):r.value=i;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),gh=A("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=Mf()),Se.init(t,e)}),vh=A("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=If),Se.init(t,e)}),yh=A("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=Rf),Se.init(t,e)}),bh=A("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=Pf),Se.init(t,e)}),wh=A("$ZodULID",(t,e)=>{e.pattern??(e.pattern=Tf),Se.init(t,e)}),$h=A("$ZodXID",(t,e)=>{e.pattern??(e.pattern=Cf),Se.init(t,e)}),Sh=A("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=Of),Se.init(t,e)}),kh=A("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=Wf(e)),Se.init(t,e)}),Eh=A("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=Ff),Se.init(t,e)}),Rh=A("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=Hf(e)),Se.init(t,e)}),Ph=A("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=Nf),Se.init(t,e)}),Th=A("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=qf),Se.init(t,e),t._zod.onattach.push(r=>{const n=r._zod.bag;n.format="ipv4"})}),Ch=A("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=Zf),Se.init(t,e),t._zod.onattach.push(r=>{const n=r._zod.bag;n.format="ipv6"}),t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}}),Oh=A("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=xf),Se.init(t,e)}),Ih=A("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=Lf),Se.init(t,e),t._zod.check=r=>{const[n,s]=r.value.split("/");try{if(!s)throw new Error;const i=Number(s);if(`${i}`!==s)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${n}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});function oc(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}const Nh=A("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=Uf),Se.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64"}),t._zod.check=r=>{oc(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});function Ah(t){if(!tc.test(t))return!1;const e=t.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return oc(r)}const jh=A("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=tc),Se.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64url"}),t._zod.check=r=>{Ah(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),zh=A("$ZodE164",(t,e)=>{e.pattern??(e.pattern=Vf),Se.init(t,e)});function Mh(t,e=null){try{const r=t.split(".");if(r.length!==3)return!1;const[n]=r;if(!n)return!1;const s=JSON.parse(atob(n));return!("typ"in s&&s?.typ!=="JWT"||!s.alg||e&&(!("alg"in s)||s.alg!==e))}catch{return!1}}const qh=A("$ZodJWT",(t,e)=>{Se.init(t,e),t._zod.check=r=>{Mh(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}}),cc=A("$ZodNumber",(t,e)=>{$e.init(t,e),t._zod.pattern=t._zod.bag.pattern??Bf,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}const s=r.value;if(typeof s=="number"&&!Number.isNaN(s)&&Number.isFinite(s))return r;const i=typeof s=="number"?Number.isNaN(s)?"NaN":Number.isFinite(s)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:s,inst:t,...i?{received:i}:{}}),r}}),Zh=A("$ZodNumber",(t,e)=>{eh.init(t,e),cc.init(t,e)}),xh=A("$ZodBoolean",(t,e)=>{$e.init(t,e),t._zod.pattern=Gf,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=!!r.value}catch{}const s=r.value;return typeof s=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:s,inst:t}),r}}),Lh=A("$ZodAny",(t,e)=>{$e.init(t,e),t._zod.parse=r=>r}),Uh=A("$ZodUnknown",(t,e)=>{$e.init(t,e),t._zod.parse=r=>r}),Dh=A("$ZodNever",(t,e)=>{$e.init(t,e),t._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)});function uc(t,e,r){t.issues.length&&e.issues.push(...Zt(r,t.issues)),e.value[r]=t.value}const Vh=A("$ZodArray",(t,e)=>{$e.init(t,e),t._zod.parse=(r,n)=>{const s=r.value;if(!Array.isArray(s))return r.issues.push({expected:"array",code:"invalid_type",input:s,inst:t}),r;r.value=Array(s.length);const i=[];for(let a=0;a<s.length;a++){const o=s[a],c=e.element._zod.run({value:o,issues:[]},n);c instanceof Promise?i.push(c.then(u=>uc(u,r,a))):uc(c,r,a)}return i.length?Promise.all(i).then(()=>r):r}});function qn(t,e,r){t.issues.length&&e.issues.push(...Zt(r,t.issues)),e.value[r]=t.value}function lc(t,e,r,n){t.issues.length?n[r]===void 0?r in n?e.value[r]=void 0:e.value[r]=t.value:e.issues.push(...Zt(r,t.issues)):t.value===void 0?r in n&&(e.value[r]=void 0):e.value[r]=t.value}const dc=A("$ZodObject",(t,e)=>{$e.init(t,e);const r=Ms(()=>{const p=Object.keys(e.shape);for(const y of p)if(!(e.shape[y]instanceof $e))throw new Error(`Invalid element at key "${y}": expected a Zod schema`);const b=pf(e.shape);return{shape:e.shape,keys:p,keySet:new Set(p),numKeys:p.length,optionalKeys:new Set(b)}});we(t._zod,"propValues",()=>{const p=e.shape,b={};for(const y in p){const h=p[y]._zod;if(h.values){b[y]??(b[y]=new Set);for(const v of h.values)b[y].add(v)}}return b});const n=p=>{const b=new dh(["shape","payload","ctx"]),y=r.value,h=d=>{const m=hr(d);return`shape[${m}]._zod.run({ value: input[${m}], issues: [] }, ctx)`};b.write("const input = payload.value;");const v=Object.create(null);let f=0;for(const d of y.keys)v[d]=`key_${f++}`;b.write("const newResult = {}");for(const d of y.keys)if(y.optionalKeys.has(d)){const m=v[d];b.write(`const ${m} = ${h(d)};`);const w=hr(d);b.write(`
11
+ if (${m}.issues.length) {
12
+ if (input[${w}] === undefined) {
13
+ if (${w} in input) {
14
+ newResult[${w}] = undefined;
15
+ }
16
+ } else {
17
+ payload.issues = payload.issues.concat(
18
+ ${m}.issues.map((iss) => ({
19
+ ...iss,
20
+ path: iss.path ? [${w}, ...iss.path] : [${w}],
21
+ }))
22
+ );
23
+ }
24
+ } else if (${m}.value === undefined) {
25
+ if (${w} in input) newResult[${w}] = undefined;
26
+ } else {
27
+ newResult[${w}] = ${m}.value;
28
+ }
29
+ `)}else{const m=v[d];b.write(`const ${m} = ${h(d)};`),b.write(`
30
+ if (${m}.issues.length) payload.issues = payload.issues.concat(${m}.issues.map(iss => ({
31
+ ...iss,
32
+ path: iss.path ? [${hr(d)}, ...iss.path] : [${hr(d)}]
33
+ })));`),b.write(`newResult[${hr(d)}] = ${m}.value`)}b.write("payload.value = newResult;"),b.write("return payload;");const _=b.compile();return(d,m)=>_(p,d,m)};let s;const i=Nn,a=!Ho.jitless,c=a&&ff.value,u=e.catchall;let l;t._zod.parse=(p,b)=>{l??(l=r.value);const y=p.value;if(!i(y))return p.issues.push({expected:"object",code:"invalid_type",input:y,inst:t}),p;const h=[];if(a&&c&&b?.async===!1&&b.jitless!==!0)s||(s=n(e.shape)),p=s(p,b);else{p.value={};const m=l.shape;for(const w of l.keys){const g=m[w],$=g._zod.run({value:y[w],issues:[]},b),k=g._zod.optin==="optional"&&g._zod.optout==="optional";$ instanceof Promise?h.push($.then(N=>k?lc(N,p,w,y):qn(N,p,w))):k?lc($,p,w,y):qn($,p,w)}}if(!u)return h.length?Promise.all(h).then(()=>p):p;const v=[],f=l.keySet,_=u._zod,d=_.def.type;for(const m of Object.keys(y)){if(f.has(m))continue;if(d==="never"){v.push(m);continue}const w=_.run({value:y[m],issues:[]},b);w instanceof Promise?h.push(w.then(g=>qn(g,p,m))):qn(w,p,m)}return v.length&&p.issues.push({code:"unrecognized_keys",keys:v,input:y,inst:t}),h.length?Promise.all(h).then(()=>p):p}});function fc(t,e,r,n){for(const s of t)if(s.issues.length===0)return e.value=s.value,e;return e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(s=>s.issues.map(i=>Rt(i,n,kt())))}),e}const hc=A("$ZodUnion",(t,e)=>{$e.init(t,e),we(t._zod,"optin",()=>e.options.some(r=>r._zod.optin==="optional")?"optional":void 0),we(t._zod,"optout",()=>e.options.some(r=>r._zod.optout==="optional")?"optional":void 0),we(t._zod,"values",()=>{if(e.options.every(r=>r._zod.values))return new Set(e.options.flatMap(r=>Array.from(r._zod.values)))}),we(t._zod,"pattern",()=>{if(e.options.every(r=>r._zod.pattern)){const r=e.options.map(n=>n._zod.pattern);return new RegExp(`^(${r.map(n=>Zs(n.source)).join("|")})$`)}}),t._zod.parse=(r,n)=>{let s=!1;const i=[];for(const a of e.options){const o=a._zod.run({value:r.value,issues:[]},n);if(o instanceof Promise)i.push(o),s=!0;else{if(o.issues.length===0)return o;i.push(o)}}return s?Promise.all(i).then(a=>fc(a,r,t,n)):fc(i,r,t,n)}}),Fh=A("$ZodDiscriminatedUnion",(t,e)=>{hc.init(t,e);const r=t._zod.parse;we(t._zod,"propValues",()=>{const s={};for(const i of e.options){const a=i._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(i)}"`);for(const[o,c]of Object.entries(a)){s[o]||(s[o]=new Set);for(const u of c)s[o].add(u)}}return s});const n=Ms(()=>{const s=e.options,i=new Map;for(const a of s){const o=a._zod.propValues[e.discriminator];if(!o||o.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(a)}"`);for(const c of o){if(i.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);i.set(c,a)}}return i});t._zod.parse=(s,i)=>{const a=s.value;if(!Nn(a))return s.issues.push({code:"invalid_type",expected:"object",input:a,inst:t}),s;const o=n.value.get(a?.[e.discriminator]);return o?o._zod.run(s,i):e.unionFallback?r(s,i):(s.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:a,path:[e.discriminator],inst:t}),s)}}),Hh=A("$ZodIntersection",(t,e)=>{$e.init(t,e),t._zod.parse=(r,n)=>{const s=r.value,i=e.left._zod.run({value:s,issues:[]},n),a=e.right._zod.run({value:s,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([c,u])=>pc(r,c,u)):pc(r,i,a)}});function Vs(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(An(t)&&An(e)){const r=Object.keys(e),n=Object.keys(t).filter(i=>r.indexOf(i)!==-1),s={...t,...e};for(const i of n){const a=Vs(t[i],e[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};s[i]=a.data}return{valid:!0,data:s}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let n=0;n<t.length;n++){const s=t[n],i=e[n],a=Vs(s,i);if(!a.valid)return{valid:!1,mergeErrorPath:[n,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function pc(t,e,r){if(e.issues.length&&t.issues.push(...e.issues),r.issues.length&&t.issues.push(...r.issues),mr(t))return t;const n=Vs(e.value,r.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return t.value=n.data,t}const Wh=A("$ZodRecord",(t,e)=>{$e.init(t,e),t._zod.parse=(r,n)=>{const s=r.value;if(!An(s))return r.issues.push({expected:"record",code:"invalid_type",input:s,inst:t}),r;const i=[];if(e.keyType._zod.values){const a=e.keyType._zod.values;r.value={};for(const c of a)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){const u=e.valueType._zod.run({value:s[c],issues:[]},n);u instanceof Promise?i.push(u.then(l=>{l.issues.length&&r.issues.push(...Zt(c,l.issues)),r.value[c]=l.value})):(u.issues.length&&r.issues.push(...Zt(c,u.issues)),r.value[c]=u.value)}let o;for(const c in s)a.has(c)||(o=o??[],o.push(c));o&&o.length>0&&r.issues.push({code:"unrecognized_keys",input:s,inst:t,keys:o})}else{r.value={};for(const a of Reflect.ownKeys(s)){if(a==="__proto__")continue;const o=e.keyType._zod.run({value:a,issues:[]},n);if(o instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(o.issues.length){r.issues.push({origin:"record",code:"invalid_key",issues:o.issues.map(u=>Rt(u,n,kt())),input:a,path:[a],inst:t}),r.value[o.value]=o.value;continue}const c=e.valueType._zod.run({value:s[a],issues:[]},n);c instanceof Promise?i.push(c.then(u=>{u.issues.length&&r.issues.push(...Zt(a,u.issues)),r.value[o.value]=u.value})):(c.issues.length&&r.issues.push(...Zt(a,c.issues)),r.value[o.value]=c.value)}}return i.length?Promise.all(i).then(()=>r):r}}),Kh=A("$ZodEnum",(t,e)=>{$e.init(t,e);const r=Wo(e.entries);t._zod.values=new Set(r),t._zod.pattern=new RegExp(`^(${r.filter(n=>hf.has(typeof n)).map(n=>typeof n=="string"?pr(n):n.toString()).join("|")})$`),t._zod.parse=(n,s)=>{const i=n.value;return t._zod.values.has(i)||n.issues.push({code:"invalid_value",values:r,input:i,inst:t}),n}}),Jh=A("$ZodLiteral",(t,e)=>{$e.init(t,e),t._zod.values=new Set(e.values),t._zod.pattern=new RegExp(`^(${e.values.map(r=>typeof r=="string"?pr(r):r?r.toString():String(r)).join("|")})$`),t._zod.parse=(r,n)=>{const s=r.value;return t._zod.values.has(s)||r.issues.push({code:"invalid_value",values:e.values,input:s,inst:t}),r}}),Bh=A("$ZodTransform",(t,e)=>{$e.init(t,e),t._zod.parse=(r,n)=>{const s=e.transform(r.value,r);if(n.async)return(s instanceof Promise?s:Promise.resolve(s)).then(a=>(r.value=a,r));if(s instanceof Promise)throw new dr;return r.value=s,r}}),Gh=A("$ZodOptional",(t,e)=>{$e.init(t,e),t._zod.optin="optional",t._zod.optout="optional",we(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),we(t._zod,"pattern",()=>{const r=e.innerType._zod.pattern;return r?new RegExp(`^(${Zs(r.source)})?$`):void 0}),t._zod.parse=(r,n)=>e.innerType._zod.optin==="optional"?e.innerType._zod.run(r,n):r.value===void 0?r:e.innerType._zod.run(r,n)}),Yh=A("$ZodNullable",(t,e)=>{$e.init(t,e),we(t._zod,"optin",()=>e.innerType._zod.optin),we(t._zod,"optout",()=>e.innerType._zod.optout),we(t._zod,"pattern",()=>{const r=e.innerType._zod.pattern;return r?new RegExp(`^(${Zs(r.source)}|null)$`):void 0}),we(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,n)=>r.value===null?r:e.innerType._zod.run(r,n)}),Xh=A("$ZodDefault",(t,e)=>{$e.init(t,e),t._zod.optin="optional",we(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(r.value===void 0)return r.value=e.defaultValue,r;const s=e.innerType._zod.run(r,n);return s instanceof Promise?s.then(i=>mc(i,e)):mc(s,e)}});function mc(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}const Qh=A("$ZodPrefault",(t,e)=>{$e.init(t,e),t._zod.optin="optional",we(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>(r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,n))}),ep=A("$ZodNonOptional",(t,e)=>{$e.init(t,e),we(t._zod,"values",()=>{const r=e.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),t._zod.parse=(r,n)=>{const s=e.innerType._zod.run(r,n);return s instanceof Promise?s.then(i=>_c(i,t)):_c(s,t)}});function _c(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}const tp=A("$ZodCatch",(t,e)=>{$e.init(t,e),t._zod.optin="optional",we(t._zod,"optout",()=>e.innerType._zod.optout),we(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{const s=e.innerType._zod.run(r,n);return s instanceof Promise?s.then(i=>(r.value=i.value,i.issues.length&&(r.value=e.catchValue({...r,error:{issues:i.issues.map(a=>Rt(a,n,kt()))},input:r.value}),r.issues=[]),r)):(r.value=s.value,s.issues.length&&(r.value=e.catchValue({...r,error:{issues:s.issues.map(i=>Rt(i,n,kt()))},input:r.value}),r.issues=[]),r)}}),rp=A("$ZodPipe",(t,e)=>{$e.init(t,e),we(t._zod,"values",()=>e.in._zod.values),we(t._zod,"optin",()=>e.in._zod.optin),we(t._zod,"optout",()=>e.out._zod.optout),t._zod.parse=(r,n)=>{const s=e.in._zod.run(r,n);return s instanceof Promise?s.then(i=>gc(i,e,n)):gc(s,e,n)}});function gc(t,e,r){return mr(t)?t:e.out._zod.run({value:t.value,issues:t.issues},r)}const np=A("$ZodReadonly",(t,e)=>{$e.init(t,e),we(t._zod,"propValues",()=>e.innerType._zod.propValues),we(t._zod,"values",()=>e.innerType._zod.values),we(t._zod,"optin",()=>e.innerType._zod.optin),we(t._zod,"optout",()=>e.innerType._zod.optout),t._zod.parse=(r,n)=>{const s=e.innerType._zod.run(r,n);return s instanceof Promise?s.then(vc):vc(s)}});function vc(t){return t.value=Object.freeze(t.value),t}const sp=A("$ZodCustom",(t,e)=>{He.init(t,e),$e.init(t,e),t._zod.parse=(r,n)=>r,t._zod.check=r=>{const n=r.value,s=e.fn(n);if(s instanceof Promise)return s.then(i=>yc(i,r,n,t));yc(s,r,n,t)}});function yc(t,e,r,n){if(!t){const s={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(s.params=n._zod.def.params),e.issues.push(_r(s))}}class bc{constructor(){this._map=new Map,this._idmap=new Map}add(e,...r){const n=r[0];if(this._map.set(e,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(e){const r=this._map.get(e);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(e),this}get(e){const r=e._zod.parent;if(r){const n={...this.get(r)??{}};return delete n.id,{...n,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}}function ip(){return new bc}const gr=ip();function ap(t,e){return new t({type:"string",...Q(e)})}function op(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...Q(e)})}function wc(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...Q(e)})}function cp(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...Q(e)})}function up(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Q(e)})}function lp(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Q(e)})}function dp(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Q(e)})}function $c(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...Q(e)})}function fp(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...Q(e)})}function hp(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...Q(e)})}function pp(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...Q(e)})}function mp(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...Q(e)})}function _p(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...Q(e)})}function gp(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...Q(e)})}function vp(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...Q(e)})}function yp(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...Q(e)})}function bp(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...Q(e)})}function wp(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Q(e)})}function $p(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Q(e)})}function Sp(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...Q(e)})}function kp(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...Q(e)})}function Ep(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...Q(e)})}function Rp(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...Q(e)})}function Pp(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Q(e)})}function Tp(t,e){return new t({type:"string",format:"date",check:"string_format",...Q(e)})}function Cp(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...Q(e)})}function Op(t,e){return new t({type:"string",format:"duration",check:"string_format",...Q(e)})}function Ip(t,e){return new t({type:"number",checks:[],...Q(e)})}function Np(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...Q(e)})}function Ap(t,e){return new t({type:"boolean",...Q(e)})}function jp(t){return new t({type:"any"})}function zp(t){return new t({type:"unknown"})}function Mp(t,e){return new t({type:"never",...Q(e)})}function Sc(t,e){return new ic({check:"less_than",...Q(e),value:t,inclusive:!1})}function Fs(t,e){return new ic({check:"less_than",...Q(e),value:t,inclusive:!0})}function kc(t,e){return new ac({check:"greater_than",...Q(e),value:t,inclusive:!1})}function Hs(t,e){return new ac({check:"greater_than",...Q(e),value:t,inclusive:!0})}function Ec(t,e){return new Qf({check:"multiple_of",...Q(e),value:t})}function Rc(t,e){return new th({check:"max_length",...Q(e),maximum:t})}function Zn(t,e){return new rh({check:"min_length",...Q(e),minimum:t})}function Pc(t,e){return new nh({check:"length_equals",...Q(e),length:t})}function qp(t,e){return new sh({check:"string_format",format:"regex",...Q(e),pattern:t})}function Zp(t){return new ih({check:"string_format",format:"lowercase",...Q(t)})}function xp(t){return new ah({check:"string_format",format:"uppercase",...Q(t)})}function Lp(t,e){return new oh({check:"string_format",format:"includes",...Q(e),includes:t})}function Up(t,e){return new ch({check:"string_format",format:"starts_with",...Q(e),prefix:t})}function Dp(t,e){return new uh({check:"string_format",format:"ends_with",...Q(e),suffix:t})}function vr(t){return new lh({check:"overwrite",tx:t})}function Vp(t){return vr(e=>e.normalize(t))}function Fp(){return vr(t=>t.trim())}function Hp(){return vr(t=>t.toLowerCase())}function Wp(){return vr(t=>t.toUpperCase())}function Kp(t,e,r){return new t({type:"array",element:e,...Q(r)})}function Jp(t,e,r){const n=Q(r);return n.abort??(n.abort=!0),new t({type:"custom",check:"custom",fn:e,...n})}function Bp(t,e,r){return new t({type:"custom",check:"custom",fn:e,...Q(r)})}class Tc{constructor(e){this.counter=0,this.metadataRegistry=e?.metadata??gr,this.target=e?.target??"draft-2020-12",this.unrepresentable=e?.unrepresentable??"throw",this.override=e?.override??(()=>{}),this.io=e?.io??"output",this.seen=new Map}process(e,r={path:[],schemaPath:[]}){var n;const s=e._zod.def,i={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},a=this.seen.get(e);if(a)return a.count++,r.schemaPath.includes(e)&&(a.cycle=r.path),a.schema;const o={schema:{},count:1,cycle:void 0,path:r.path};this.seen.set(e,o);const c=e._zod.toJSONSchema?.();if(c)o.schema=c;else{const p={...r,schemaPath:[...r.schemaPath,e],path:r.path},b=e._zod.parent;if(b)o.ref=b,this.process(b,p),this.seen.get(b).isParent=!0;else{const y=o.schema;switch(s.type){case"string":{const h=y;h.type="string";const{minimum:v,maximum:f,format:_,patterns:d,contentEncoding:m}=e._zod.bag;if(typeof v=="number"&&(h.minLength=v),typeof f=="number"&&(h.maxLength=f),_&&(h.format=i[_]??_,h.format===""&&delete h.format),m&&(h.contentEncoding=m),d&&d.size>0){const w=[...d];w.length===1?h.pattern=w[0].source:w.length>1&&(o.schema.allOf=[...w.map(g=>({...this.target==="draft-7"?{type:"string"}:{},pattern:g.source}))])}break}case"number":{const h=y,{minimum:v,maximum:f,format:_,multipleOf:d,exclusiveMaximum:m,exclusiveMinimum:w}=e._zod.bag;typeof _=="string"&&_.includes("int")?h.type="integer":h.type="number",typeof w=="number"&&(h.exclusiveMinimum=w),typeof v=="number"&&(h.minimum=v,typeof w=="number"&&(w>=v?delete h.minimum:delete h.exclusiveMinimum)),typeof m=="number"&&(h.exclusiveMaximum=m),typeof f=="number"&&(h.maximum=f,typeof m=="number"&&(m<=f?delete h.maximum:delete h.exclusiveMaximum)),typeof d=="number"&&(h.multipleOf=d);break}case"boolean":{const h=y;h.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema");break}case"null":{y.type="null";break}case"any":break;case"unknown":break;case"undefined":{if(this.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema");break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"never":{y.not={};break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{const h=y,{minimum:v,maximum:f}=e._zod.bag;typeof v=="number"&&(h.minItems=v),typeof f=="number"&&(h.maxItems=f),h.type="array",h.items=this.process(s.element,{...p,path:[...p.path,"items"]});break}case"object":{const h=y;h.type="object",h.properties={};const v=s.shape;for(const d in v)h.properties[d]=this.process(v[d],{...p,path:[...p.path,"properties",d]});const f=new Set(Object.keys(v)),_=new Set([...f].filter(d=>{const m=s.shape[d]._zod;return this.io==="input"?m.optin===void 0:m.optout===void 0}));_.size>0&&(h.required=Array.from(_)),s.catchall?._zod.def.type==="never"?h.additionalProperties=!1:s.catchall?s.catchall&&(h.additionalProperties=this.process(s.catchall,{...p,path:[...p.path,"additionalProperties"]})):this.io==="output"&&(h.additionalProperties=!1);break}case"union":{const h=y;h.anyOf=s.options.map((v,f)=>this.process(v,{...p,path:[...p.path,"anyOf",f]}));break}case"intersection":{const h=y,v=this.process(s.left,{...p,path:[...p.path,"allOf",0]}),f=this.process(s.right,{...p,path:[...p.path,"allOf",1]}),_=m=>"allOf"in m&&Object.keys(m).length===1,d=[..._(v)?v.allOf:[v],..._(f)?f.allOf:[f]];h.allOf=d;break}case"tuple":{const h=y;h.type="array";const v=s.items.map((d,m)=>this.process(d,{...p,path:[...p.path,"prefixItems",m]}));if(this.target==="draft-2020-12"?h.prefixItems=v:h.items=v,s.rest){const d=this.process(s.rest,{...p,path:[...p.path,"items"]});this.target==="draft-2020-12"?h.items=d:h.additionalItems=d}s.rest&&(h.items=this.process(s.rest,{...p,path:[...p.path,"items"]}));const{minimum:f,maximum:_}=e._zod.bag;typeof f=="number"&&(h.minItems=f),typeof _=="number"&&(h.maxItems=_);break}case"record":{const h=y;h.type="object",h.propertyNames=this.process(s.keyType,{...p,path:[...p.path,"propertyNames"]}),h.additionalProperties=this.process(s.valueType,{...p,path:[...p.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema");break}case"enum":{const h=y,v=Wo(s.entries);v.every(f=>typeof f=="number")&&(h.type="number"),v.every(f=>typeof f=="string")&&(h.type="string"),h.enum=v;break}case"literal":{const h=y,v=[];for(const f of s.values)if(f===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof f=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");v.push(Number(f))}else v.push(f);if(v.length!==0)if(v.length===1){const f=v[0];h.type=f===null?"null":typeof f,h.const=f}else v.every(f=>typeof f=="number")&&(h.type="number"),v.every(f=>typeof f=="string")&&(h.type="string"),v.every(f=>typeof f=="boolean")&&(h.type="string"),v.every(f=>f===null)&&(h.type="null"),h.enum=v;break}case"file":{const h=y,v={type:"string",format:"binary",contentEncoding:"binary"},{minimum:f,maximum:_,mime:d}=e._zod.bag;f!==void 0&&(v.minLength=f),_!==void 0&&(v.maxLength=_),d?d.length===1?(v.contentMediaType=d[0],Object.assign(h,v)):h.anyOf=d.map(m=>({...v,contentMediaType:m})):Object.assign(h,v);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{const h=this.process(s.innerType,p);y.anyOf=[h,{type:"null"}];break}case"nonoptional":{this.process(s.innerType,p),o.ref=s.innerType;break}case"success":{const h=y;h.type="boolean";break}case"default":{this.process(s.innerType,p),o.ref=s.innerType,y.default=JSON.parse(JSON.stringify(s.defaultValue));break}case"prefault":{this.process(s.innerType,p),o.ref=s.innerType,this.io==="input"&&(y._prefault=JSON.parse(JSON.stringify(s.defaultValue)));break}case"catch":{this.process(s.innerType,p),o.ref=s.innerType;let h;try{h=s.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}y.default=h;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{const h=y,v=e._zod.pattern;if(!v)throw new Error("Pattern not found in template literal");h.type="string",h.pattern=v.source;break}case"pipe":{const h=this.io==="input"?s.in._zod.def.type==="transform"?s.out:s.in:s.out;this.process(h,p),o.ref=h;break}case"readonly":{this.process(s.innerType,p),o.ref=s.innerType,y.readOnly=!0;break}case"promise":{this.process(s.innerType,p),o.ref=s.innerType;break}case"optional":{this.process(s.innerType,p),o.ref=s.innerType;break}case"lazy":{const h=e._zod.innerType;this.process(h,p),o.ref=h;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}}}}const u=this.metadataRegistry.get(e);return u&&Object.assign(o.schema,u),this.io==="input"&&Ae(e)&&(delete o.schema.examples,delete o.schema.default),this.io==="input"&&o.schema._prefault&&((n=o.schema).default??(n.default=o.schema._prefault)),delete o.schema._prefault,this.seen.get(e).schema}emit(e,r){const n={cycles:r?.cycles??"ref",reused:r?.reused??"inline",external:r?.external??void 0},s=this.seen.get(e);if(!s)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=l=>{const p=this.target==="draft-2020-12"?"$defs":"definitions";if(n.external){const v=n.external.registry.get(l[0])?.id,f=n.external.uri??(d=>d);if(v)return{ref:f(v)};const _=l[1].defId??l[1].schema.id??`schema${this.counter++}`;return l[1].defId=_,{defId:_,ref:`${f("__shared")}#/${p}/${_}`}}if(l[1]===s)return{ref:"#"};const y=`#/${p}/`,h=l[1].schema.id??`__schema${this.counter++}`;return{defId:h,ref:y+h}},a=l=>{if(l[1].schema.$ref)return;const p=l[1],{ref:b,defId:y}=i(l);p.def={...p.schema},y&&(p.defId=y);const h=p.schema;for(const v in h)delete h[v];h.$ref=b};if(n.cycles==="throw")for(const l of this.seen.entries()){const p=l[1];if(p.cycle)throw new Error(`Cycle detected: #/${p.cycle?.join("/")}/<root>
34
+
35
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const l of this.seen.entries()){const p=l[1];if(e===l[0]){a(l);continue}if(n.external){const y=n.external.registry.get(l[0])?.id;if(e!==l[0]&&y){a(l);continue}}if(this.metadataRegistry.get(l[0])?.id){a(l);continue}if(p.cycle){a(l);continue}if(p.count>1&&n.reused==="ref"){a(l);continue}}const o=(l,p)=>{const b=this.seen.get(l),y=b.def??b.schema,h={...y};if(b.ref===null)return;const v=b.ref;if(b.ref=null,v){o(v,p);const f=this.seen.get(v).schema;f.$ref&&p.target==="draft-7"?(y.allOf=y.allOf??[],y.allOf.push(f)):(Object.assign(y,f),Object.assign(y,h))}b.isParent||this.override({zodSchema:l,jsonSchema:y,path:b.path??[]})};for(const l of[...this.seen.entries()].reverse())o(l[0],{target:this.target});const c={};if(this.target==="draft-2020-12"?c.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?c.$schema="http://json-schema.org/draft-07/schema#":console.warn(`Invalid target: ${this.target}`),n.external?.uri){const l=n.external.registry.get(e)?.id;if(!l)throw new Error("Schema is missing an `id` property");c.$id=n.external.uri(l)}Object.assign(c,s.def);const u=n.external?.defs??{};for(const l of this.seen.entries()){const p=l[1];p.def&&p.defId&&(u[p.defId]=p.def)}n.external||Object.keys(u).length>0&&(this.target==="draft-2020-12"?c.$defs=u:c.definitions=u);try{return JSON.parse(JSON.stringify(c))}catch{throw new Error("Error converting schema to JSON.")}}}function Gp(t,e){if(t instanceof bc){const n=new Tc(e),s={};for(const o of t._idmap.entries()){const[c,u]=o;n.process(u)}const i={},a={registry:t,uri:e?.uri,defs:s};for(const o of t._idmap.entries()){const[c,u]=o;i[c]=n.emit(u,{...e,external:a})}if(Object.keys(s).length>0){const o=n.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[o]:s}}return{schemas:i}}const r=new Tc(e);return r.process(t),r.emit(t,e)}function Ae(t,e){const r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);const s=t._zod.def;switch(s.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return Ae(s.element,r);case"object":{for(const i in s.shape)if(Ae(s.shape[i],r))return!0;return!1}case"union":{for(const i of s.options)if(Ae(i,r))return!0;return!1}case"intersection":return Ae(s.left,r)||Ae(s.right,r);case"tuple":{for(const i of s.items)if(Ae(i,r))return!0;return!!(s.rest&&Ae(s.rest,r))}case"record":return Ae(s.keyType,r)||Ae(s.valueType,r);case"map":return Ae(s.keyType,r)||Ae(s.valueType,r);case"set":return Ae(s.valueType,r);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return Ae(s.innerType,r);case"lazy":return Ae(s.getter(),r);case"default":return Ae(s.innerType,r);case"prefault":return Ae(s.innerType,r);case"custom":return!1;case"transform":return!0;case"pipe":return Ae(s.in,r)||Ae(s.out,r);case"success":return!1;case"catch":return!1}throw new Error(`Unknown schema type: ${s.type}`)}const Yp=A("ZodISODateTime",(t,e)=>{kh.init(t,e),Te.init(t,e)});function Xp(t){return Pp(Yp,t)}const Qp=A("ZodISODate",(t,e)=>{Eh.init(t,e),Te.init(t,e)});function em(t){return Tp(Qp,t)}const tm=A("ZodISOTime",(t,e)=>{Rh.init(t,e),Te.init(t,e)});function rm(t){return Cp(tm,t)}const nm=A("ZodISODuration",(t,e)=>{Ph.init(t,e),Te.init(t,e)});function sm(t){return Op(nm,t)}const xn=A("ZodError",(t,e)=>{Bo.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>Sf(t,r)},flatten:{value:r=>$f(t,r)},addIssue:{value:r=>t.issues.push(r)},addIssues:{value:r=>t.issues.push(...r)},isEmpty:{get(){return t.issues.length===0}}})},{Parent:Error}),im=Go(xn),am=Yo(xn),om=Xo(xn),cm=Qo(xn),Pe=A("ZodType",(t,e)=>($e.init(t,e),t.def=e,Object.defineProperty(t,"_def",{value:e}),t.check=(...r)=>t.clone({...e,checks:[...e.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),t.clone=(r,n)=>Et(t,r,n),t.brand=()=>t,t.register=((r,n)=>(r.add(t,n),t)),t.parse=(r,n)=>im(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>om(t,r,n),t.parseAsync=async(r,n)=>am(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>cm(t,r,n),t.spa=t.safeParseAsync,t.refine=(r,n)=>t.check(e_(r,n)),t.superRefine=r=>t.check(t_(r)),t.overwrite=r=>t.check(vr(r)),t.optional=()=>ae(t),t.nullable=()=>Zc(t),t.nullish=()=>ae(Zc(t)),t.nonoptional=r=>Wm(t,r),t.array=()=>F(t),t.or=r=>Ce([t,r]),t.and=r=>Ws(t,r),t.transform=r=>Js(t,Mc(r)),t.default=r=>Vm(t,r),t.prefault=r=>Hm(t,r),t.catch=r=>Jm(t,r),t.pipe=r=>Js(t,r),t.readonly=()=>Ym(t),t.describe=r=>{const n=t.clone();return gr.add(n,{description:r}),n},Object.defineProperty(t,"description",{get(){return gr.get(t)?.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return gr.get(t);const n=t.clone();return gr.add(n,r[0]),n},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),Cc=A("_ZodString",(t,e)=>{Ds.init(t,e),Pe.init(t,e);const r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,t.regex=(...n)=>t.check(qp(...n)),t.includes=(...n)=>t.check(Lp(...n)),t.startsWith=(...n)=>t.check(Up(...n)),t.endsWith=(...n)=>t.check(Dp(...n)),t.min=(...n)=>t.check(Zn(...n)),t.max=(...n)=>t.check(Rc(...n)),t.length=(...n)=>t.check(Pc(...n)),t.nonempty=(...n)=>t.check(Zn(1,...n)),t.lowercase=n=>t.check(Zp(n)),t.uppercase=n=>t.check(xp(n)),t.trim=()=>t.check(Fp()),t.normalize=(...n)=>t.check(Vp(...n)),t.toLowerCase=()=>t.check(Hp()),t.toUpperCase=()=>t.check(Wp())}),um=A("ZodString",(t,e)=>{Ds.init(t,e),Cc.init(t,e),t.email=r=>t.check(op(lm,r)),t.url=r=>t.check($c(Ic,r)),t.jwt=r=>t.check(Rp(Rm,r)),t.emoji=r=>t.check(fp(fm,r)),t.guid=r=>t.check(wc(Oc,r)),t.uuid=r=>t.check(cp(Ln,r)),t.uuidv4=r=>t.check(up(Ln,r)),t.uuidv6=r=>t.check(lp(Ln,r)),t.uuidv7=r=>t.check(dp(Ln,r)),t.nanoid=r=>t.check(hp(hm,r)),t.guid=r=>t.check(wc(Oc,r)),t.cuid=r=>t.check(pp(pm,r)),t.cuid2=r=>t.check(mp(mm,r)),t.ulid=r=>t.check(_p(_m,r)),t.base64=r=>t.check(Sp(Sm,r)),t.base64url=r=>t.check(kp(km,r)),t.xid=r=>t.check(gp(gm,r)),t.ksuid=r=>t.check(vp(vm,r)),t.ipv4=r=>t.check(yp(ym,r)),t.ipv6=r=>t.check(bp(bm,r)),t.cidrv4=r=>t.check(wp(wm,r)),t.cidrv6=r=>t.check($p($m,r)),t.e164=r=>t.check(Ep(Em,r)),t.datetime=r=>t.check(Xp(r)),t.date=r=>t.check(em(r)),t.time=r=>t.check(rm(r)),t.duration=r=>t.check(sm(r))});function P(t){return ap(um,t)}const Te=A("ZodStringFormat",(t,e)=>{Se.init(t,e),Cc.init(t,e)}),lm=A("ZodEmail",(t,e)=>{mh.init(t,e),Te.init(t,e)}),Oc=A("ZodGUID",(t,e)=>{hh.init(t,e),Te.init(t,e)}),Ln=A("ZodUUID",(t,e)=>{ph.init(t,e),Te.init(t,e)}),Ic=A("ZodURL",(t,e)=>{_h.init(t,e),Te.init(t,e)});function dm(t){return $c(Ic,t)}const fm=A("ZodEmoji",(t,e)=>{gh.init(t,e),Te.init(t,e)}),hm=A("ZodNanoID",(t,e)=>{vh.init(t,e),Te.init(t,e)}),pm=A("ZodCUID",(t,e)=>{yh.init(t,e),Te.init(t,e)}),mm=A("ZodCUID2",(t,e)=>{bh.init(t,e),Te.init(t,e)}),_m=A("ZodULID",(t,e)=>{wh.init(t,e),Te.init(t,e)}),gm=A("ZodXID",(t,e)=>{$h.init(t,e),Te.init(t,e)}),vm=A("ZodKSUID",(t,e)=>{Sh.init(t,e),Te.init(t,e)}),ym=A("ZodIPv4",(t,e)=>{Th.init(t,e),Te.init(t,e)}),bm=A("ZodIPv6",(t,e)=>{Ch.init(t,e),Te.init(t,e)}),wm=A("ZodCIDRv4",(t,e)=>{Oh.init(t,e),Te.init(t,e)}),$m=A("ZodCIDRv6",(t,e)=>{Ih.init(t,e),Te.init(t,e)}),Sm=A("ZodBase64",(t,e)=>{Nh.init(t,e),Te.init(t,e)}),km=A("ZodBase64URL",(t,e)=>{jh.init(t,e),Te.init(t,e)}),Em=A("ZodE164",(t,e)=>{zh.init(t,e),Te.init(t,e)}),Rm=A("ZodJWT",(t,e)=>{qh.init(t,e),Te.init(t,e)}),Nc=A("ZodNumber",(t,e)=>{cc.init(t,e),Pe.init(t,e),t.gt=(n,s)=>t.check(kc(n,s)),t.gte=(n,s)=>t.check(Hs(n,s)),t.min=(n,s)=>t.check(Hs(n,s)),t.lt=(n,s)=>t.check(Sc(n,s)),t.lte=(n,s)=>t.check(Fs(n,s)),t.max=(n,s)=>t.check(Fs(n,s)),t.int=n=>t.check(Ac(n)),t.safe=n=>t.check(Ac(n)),t.positive=n=>t.check(kc(0,n)),t.nonnegative=n=>t.check(Hs(0,n)),t.negative=n=>t.check(Sc(0,n)),t.nonpositive=n=>t.check(Fs(0,n)),t.multipleOf=(n,s)=>t.check(Ec(n,s)),t.step=(n,s)=>t.check(Ec(n,s)),t.finite=()=>t;const r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});function ke(t){return Ip(Nc,t)}const Pm=A("ZodNumberFormat",(t,e)=>{Zh.init(t,e),Nc.init(t,e)});function Ac(t){return Np(Pm,t)}const Tm=A("ZodBoolean",(t,e)=>{xh.init(t,e),Pe.init(t,e)});function Ee(t){return Ap(Tm,t)}const Cm=A("ZodAny",(t,e)=>{Lh.init(t,e),Pe.init(t,e)});function Om(){return jp(Cm)}const Im=A("ZodUnknown",(t,e)=>{Uh.init(t,e),Pe.init(t,e)});function Oe(){return zp(Im)}const Nm=A("ZodNever",(t,e)=>{Dh.init(t,e),Pe.init(t,e)});function Am(t){return Mp(Nm,t)}const jm=A("ZodArray",(t,e)=>{Vh.init(t,e),Pe.init(t,e),t.element=e.element,t.min=(r,n)=>t.check(Zn(r,n)),t.nonempty=r=>t.check(Zn(1,r)),t.max=(r,n)=>t.check(Rc(r,n)),t.length=(r,n)=>t.check(Pc(r,n)),t.unwrap=()=>t.element});function F(t,e){return Kp(jm,t,e)}const jc=A("ZodObject",(t,e)=>{dc.init(t,e),Pe.init(t,e),we(t,"shape",()=>e.shape),t.keyof=()=>at(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:Oe()}),t.loose=()=>t.clone({...t._zod.def,catchall:Oe()}),t.strict=()=>t.clone({...t._zod.def,catchall:Am()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>vf(t,r),t.merge=r=>yf(t,r),t.pick=r=>_f(t,r),t.omit=r=>gf(t,r),t.partial=(...r)=>bf(qc,t,r[0]),t.required=(...r)=>wf(xc,t,r[0])});function W(t,e){const r={type:"object",get shape(){return fr(this,"shape",{...t}),this.shape},...Q(e)};return new jc(r)}function it(t,e){return new jc({type:"object",get shape(){return fr(this,"shape",{...t}),this.shape},catchall:Oe(),...Q(e)})}const zc=A("ZodUnion",(t,e)=>{hc.init(t,e),Pe.init(t,e),t.options=e.options});function Ce(t,e){return new zc({type:"union",options:t,...Q(e)})}const zm=A("ZodDiscriminatedUnion",(t,e)=>{zc.init(t,e),Fh.init(t,e)});function Mm(t,e,r){return new zm({type:"union",options:e,discriminator:t,...Q(r)})}const qm=A("ZodIntersection",(t,e)=>{Hh.init(t,e),Pe.init(t,e)});function Ws(t,e){return new qm({type:"intersection",left:t,right:e})}const Zm=A("ZodRecord",(t,e)=>{Wh.init(t,e),Pe.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function Ie(t,e,r){return new Zm({type:"record",keyType:t,valueType:e,...Q(r)})}const Ks=A("ZodEnum",(t,e)=>{Kh.init(t,e),Pe.init(t,e),t.enum=e.entries,t.options=Object.values(e.entries);const r=new Set(Object.keys(e.entries));t.extract=(n,s)=>{const i={};for(const a of n)if(r.has(a))i[a]=e.entries[a];else throw new Error(`Key ${a} not found in enum`);return new Ks({...e,checks:[],...Q(s),entries:i})},t.exclude=(n,s)=>{const i={...e.entries};for(const a of n)if(r.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new Ks({...e,checks:[],...Q(s),entries:i})}});function at(t,e){const r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new Ks({type:"enum",entries:r,...Q(e)})}const xm=A("ZodLiteral",(t,e)=>{Jh.init(t,e),Pe.init(t,e),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function re(t,e){return new xm({type:"literal",values:Array.isArray(t)?t:[t],...Q(e)})}const Lm=A("ZodTransform",(t,e)=>{Bh.init(t,e),Pe.init(t,e),t._zod.parse=(r,n)=>{r.addIssue=i=>{if(typeof i=="string")r.issues.push(_r(i,r.value,e));else{const a=i;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=t),a.continue??(a.continue=!0),r.issues.push(_r(a))}};const s=e.transform(r.value,r);return s instanceof Promise?s.then(i=>(r.value=i,r)):(r.value=s,r)}});function Mc(t){return new Lm({type:"transform",transform:t})}const qc=A("ZodOptional",(t,e)=>{Gh.init(t,e),Pe.init(t,e),t.unwrap=()=>t._zod.def.innerType});function ae(t){return new qc({type:"optional",innerType:t})}const Um=A("ZodNullable",(t,e)=>{Yh.init(t,e),Pe.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Zc(t){return new Um({type:"nullable",innerType:t})}const Dm=A("ZodDefault",(t,e)=>{Xh.init(t,e),Pe.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function Vm(t,e){return new Dm({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}const Fm=A("ZodPrefault",(t,e)=>{Qh.init(t,e),Pe.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Hm(t,e){return new Fm({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}const xc=A("ZodNonOptional",(t,e)=>{ep.init(t,e),Pe.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Wm(t,e){return new xc({type:"nonoptional",innerType:t,...Q(e)})}const Km=A("ZodCatch",(t,e)=>{tp.init(t,e),Pe.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function Jm(t,e){return new Km({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}const Bm=A("ZodPipe",(t,e)=>{rp.init(t,e),Pe.init(t,e),t.in=e.in,t.out=e.out});function Js(t,e){return new Bm({type:"pipe",in:t,out:e})}const Gm=A("ZodReadonly",(t,e)=>{np.init(t,e),Pe.init(t,e)});function Ym(t){return new Gm({type:"readonly",innerType:t})}const Lc=A("ZodCustom",(t,e)=>{sp.init(t,e),Pe.init(t,e)});function Xm(t){const e=new He({check:"custom"});return e._zod.check=t,e}function Qm(t,e){return Jp(Lc,t??(()=>!0),e)}function e_(t,e={}){return Bp(Lc,t,e)}function t_(t){const e=Xm(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(_r(n,r.value,e._zod.def));else{const s=n;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=e),s.continue??(s.continue=!e._zod.def.abort),r.issues.push(_r(s))}},t(r.value,r)));return e}function r_(t,e){return Js(Mc(t),e)}const n_={custom:"custom"},xt="2025-06-18",s_="2025-03-26",Bs=[xt,"2025-03-26","2024-11-05","2024-10-07"],yr="2.0",pt=Qm(t=>t!==null&&(typeof t=="object"||typeof t=="function")),Gs=Ce([P(),ke().int()]),Ys=P(),i_=it({progressToken:Gs.optional()}),ot=it({_meta:i_.optional()}),Ue=W({method:P(),params:ot.optional()}),Kt=it({_meta:Ie(P(),Oe()).optional()}),Qe=W({method:P(),params:Kt.optional()}),Ye=it({_meta:Ie(P(),Oe()).optional()}),br=Ce([P(),ke().int()]),Xs=W({jsonrpc:re(yr),id:br,...Ue.shape}).strict(),Qs=t=>Xs.safeParse(t).success,ei=W({jsonrpc:re(yr),...Qe.shape}).strict(),Uc=t=>ei.safeParse(t).success,ti=W({jsonrpc:re(yr),id:br,result:Ye}).strict(),Un=t=>ti.safeParse(t).success;E.ErrorCode=void 0,(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(E.ErrorCode||(E.ErrorCode={}));const ri=W({jsonrpc:re(yr),id:br,error:W({code:ke().int(),message:P(),data:ae(Oe())})}).strict(),Dc=t=>ri.safeParse(t).success,wr=Ce([Xs,ei,ti,ri]),Pt=Ye.strict(),Vc=Kt.extend({requestId:br,reason:P().optional()}),Dn=Qe.extend({method:re("notifications/cancelled"),params:Vc}),Fc=W({src:P(),mimeType:P().optional(),sizes:F(P()).optional()}),Jt=W({icons:F(Fc).optional()}),Lt=W({name:P(),title:P().optional()}),ni=Lt.extend({...Lt.shape,...Jt.shape,version:P(),websiteUrl:P().optional()}),a_=Ws(W({applyDefaults:Ee().optional()}),Ie(P(),Oe())),o_=r_(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,Ws(W({form:a_.optional(),url:pt.optional()}),Ie(P(),Oe()).optional())),Hc=W({experimental:Ie(P(),pt).optional(),sampling:W({context:pt.optional(),tools:pt.optional()}).optional(),elicitation:o_.optional(),roots:W({listChanged:Ee().optional()}).optional()}),Wc=ot.extend({protocolVersion:P(),capabilities:Hc,clientInfo:ni}),Vn=Ue.extend({method:re("initialize"),params:Wc}),c_=t=>Vn.safeParse(t).success,Kc=W({experimental:Ie(P(),pt).optional(),logging:pt.optional(),completions:pt.optional(),prompts:ae(W({listChanged:ae(Ee())})),resources:W({subscribe:Ee().optional(),listChanged:Ee().optional()}).optional(),tools:W({listChanged:Ee().optional()}).optional()}),si=Ye.extend({protocolVersion:P(),capabilities:Kc,serverInfo:ni,instructions:P().optional()}),Fn=Qe.extend({method:re("notifications/initialized")}),Jc=t=>Fn.safeParse(t).success,Hn=Ue.extend({method:re("ping")}),Bc=W({progress:ke(),total:ae(ke()),message:ae(P())}),Gc=W({...Kt.shape,...Bc.shape,progressToken:Gs}),Wn=Qe.extend({method:re("notifications/progress"),params:Gc}),Yc=ot.extend({cursor:Ys.optional()}),$r=Ue.extend({params:Yc.optional()}),Sr=Ye.extend({nextCursor:ae(Ys)}),ii=W({uri:P(),mimeType:ae(P()),_meta:Ie(P(),Oe()).optional()}),ai=ii.extend({text:P()}),oi=P().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),ci=ii.extend({blob:oi}),ui=W({...Lt.shape,...Jt.shape,uri:P(),description:ae(P()),mimeType:ae(P()),_meta:ae(it({}))}),Xc=W({...Lt.shape,...Jt.shape,uriTemplate:P(),description:ae(P()),mimeType:ae(P()),_meta:ae(it({}))}),Kn=$r.extend({method:re("resources/list")}),li=Sr.extend({resources:F(ui)}),Jn=$r.extend({method:re("resources/templates/list")}),di=Sr.extend({resourceTemplates:F(Xc)}),Bn=ot.extend({uri:P()}),Qc=Bn,Gn=Ue.extend({method:re("resources/read"),params:Qc}),fi=Ye.extend({contents:F(Ce([ai,ci]))}),eu=Qe.extend({method:re("notifications/resources/list_changed")}),tu=Bn,ru=Ue.extend({method:re("resources/subscribe"),params:tu}),nu=Bn,su=Ue.extend({method:re("resources/unsubscribe"),params:nu}),iu=Kt.extend({uri:P()}),au=Qe.extend({method:re("notifications/resources/updated"),params:iu}),ou=W({name:P(),description:ae(P()),required:ae(Ee())}),cu=W({...Lt.shape,...Jt.shape,description:ae(P()),arguments:ae(F(ou)),_meta:ae(it({}))}),Yn=$r.extend({method:re("prompts/list")}),hi=Sr.extend({prompts:F(cu)}),uu=ot.extend({name:P(),arguments:Ie(P(),P()).optional()}),Xn=Ue.extend({method:re("prompts/get"),params:uu}),pi=W({type:re("text"),text:P(),_meta:Ie(P(),Oe()).optional()}),mi=W({type:re("image"),data:oi,mimeType:P(),_meta:Ie(P(),Oe()).optional()}),_i=W({type:re("audio"),data:oi,mimeType:P(),_meta:Ie(P(),Oe()).optional()}),lu=W({type:re("tool_use"),name:P(),id:P(),input:W({}).passthrough(),_meta:ae(W({}).passthrough())}).passthrough(),du=W({type:re("resource"),resource:Ce([ai,ci]),_meta:Ie(P(),Oe()).optional()}),fu=ui.extend({type:re("resource_link")}),Qn=Ce([pi,mi,_i,fu,du]),hu=W({role:at(["user","assistant"]),content:Qn}),gi=Ye.extend({description:ae(P()),messages:F(hu)}),pu=Qe.extend({method:re("notifications/prompts/list_changed")}),mu=W({title:P().optional(),readOnlyHint:Ee().optional(),destructiveHint:Ee().optional(),idempotentHint:Ee().optional(),openWorldHint:Ee().optional()}),vi=W({...Lt.shape,...Jt.shape,description:P().optional(),inputSchema:W({type:re("object"),properties:Ie(P(),pt).optional(),required:F(P()).optional()}).catchall(Oe()),outputSchema:W({type:re("object"),properties:Ie(P(),pt).optional(),required:F(P()).optional()}).catchall(Oe()).optional(),annotations:ae(mu),_meta:Ie(P(),Oe()).optional()}),es=$r.extend({method:re("tools/list")}),yi=Sr.extend({tools:F(vi)}),ts=Ye.extend({content:F(Qn).default([]),structuredContent:Ie(P(),Oe()).optional(),isError:ae(Ee())}),u_=ts.or(Ye.extend({toolResult:Oe()})),_u=ot.extend({name:P(),arguments:ae(Ie(P(),Oe()))}),rs=Ue.extend({method:re("tools/call"),params:_u}),gu=Qe.extend({method:re("notifications/tools/list_changed")}),kr=at(["debug","info","notice","warning","error","critical","alert","emergency"]),vu=ot.extend({level:kr}),bi=Ue.extend({method:re("logging/setLevel"),params:vu}),yu=Kt.extend({level:kr,logger:P().optional(),data:Oe()}),bu=Qe.extend({method:re("notifications/message"),params:yu}),wu=W({name:P().optional()}),$u=W({hints:ae(F(wu)),costPriority:ae(ke().min(0).max(1)),speedPriority:ae(ke().min(0).max(1)),intelligencePriority:ae(ke().min(0).max(1))}),Su=W({mode:ae(at(["auto","required","none"]))}),ku=W({type:re("tool_result"),toolUseId:P().describe("The unique identifier for the corresponding tool call."),content:F(Qn).default([]),structuredContent:W({}).passthrough().optional(),isError:ae(Ee()),_meta:ae(W({}).passthrough())}).passthrough(),Er=Mm("type",[pi,mi,_i,lu,ku]),Eu=W({role:at(["user","assistant"]),content:Ce([Er,F(Er)]),_meta:ae(W({}).passthrough())}).passthrough(),Ru=ot.extend({messages:F(Eu),modelPreferences:$u.optional(),systemPrompt:P().optional(),includeContext:at(["none","thisServer","allServers"]).optional(),temperature:ke().optional(),maxTokens:ke().int(),stopSequences:F(P()).optional(),metadata:pt.optional(),tools:ae(F(vi)),toolChoice:ae(Su)}),Pu=Ue.extend({method:re("sampling/createMessage"),params:Ru}),wi=Ye.extend({model:P(),stopReason:ae(at(["endTurn","stopSequence","maxTokens","toolUse"]).or(P())),role:at(["user","assistant"]),content:Ce([Er,F(Er)])}),Tu=W({type:re("boolean"),title:P().optional(),description:P().optional(),default:Ee().optional()}),Cu=W({type:re("string"),title:P().optional(),description:P().optional(),minLength:ke().optional(),maxLength:ke().optional(),format:at(["email","uri","date","date-time"]).optional(),default:P().optional()}),Ou=W({type:at(["number","integer"]),title:P().optional(),description:P().optional(),minimum:ke().optional(),maximum:ke().optional(),default:ke().optional()}),Iu=W({type:re("string"),title:P().optional(),description:P().optional(),enum:F(P()),default:P().optional()}),Nu=W({type:re("string"),title:P().optional(),description:P().optional(),oneOf:F(W({const:P(),title:P()})),default:P().optional()}),Au=W({type:re("string"),title:P().optional(),description:P().optional(),enum:F(P()),enumNames:F(P()).optional(),default:P().optional()}),ju=Ce([Iu,Nu]),zu=W({type:re("array"),title:P().optional(),description:P().optional(),minItems:ke().optional(),maxItems:ke().optional(),items:W({type:re("string"),enum:F(P())}),default:F(P()).optional()}),Mu=W({type:re("array"),title:P().optional(),description:P().optional(),minItems:ke().optional(),maxItems:ke().optional(),items:W({anyOf:F(W({const:P(),title:P()}))}),default:F(P()).optional()}),qu=Ce([zu,Mu]),Zu=Ce([Au,ju,qu]),xu=Ce([Zu,Tu,Cu,Ou]),Lu=ot.extend({mode:re("form").optional(),message:P(),requestedSchema:W({type:re("object"),properties:Ie(P(),xu),required:F(P()).optional()})}),Uu=ot.extend({mode:re("url"),message:P(),elicitationId:P(),url:P().url()}),Du=Ce([Lu,Uu]),$i=Ue.extend({method:re("elicitation/create"),params:Du}),Vu=Kt.extend({elicitationId:P()}),Fu=Qe.extend({method:re("notifications/elicitation/complete"),params:Vu}),Rr=Ye.extend({action:at(["accept","decline","cancel"]),content:Ie(P(),Ce([P(),ke(),Ee(),F(P())])).optional()}),Si=W({type:re("ref/resource"),uri:P()}),l_=Si,Hu=W({type:re("ref/prompt"),name:P()}),Wu=ot.extend({ref:Ce([Hu,Si]),argument:W({name:P(),value:P()}),context:W({arguments:Ie(P(),P()).optional()}).optional()}),ns=Ue.extend({method:re("completion/complete"),params:Wu});function Ku(t){if(t.params.ref.type!=="ref/prompt")throw new TypeError(`Expected CompleteRequestPrompt, but got ${t.params.ref.type}`)}function Ju(t){if(t.params.ref.type!=="ref/resource")throw new TypeError(`Expected CompleteRequestResourceTemplate, but got ${t.params.ref.type}`)}const ki=Ye.extend({completion:it({values:F(P()).max(100),total:ae(ke().int()),hasMore:ae(Ee())})}),Bu=W({uri:P().startsWith("file://"),name:P().optional(),_meta:Ie(P(),Oe()).optional()}),Gu=Ue.extend({method:re("roots/list")}),Ei=Ye.extend({roots:F(Bu)}),Yu=Qe.extend({method:re("notifications/roots/list_changed")}),d_=Ce([Hn,Vn,ns,bi,Xn,Yn,Kn,Jn,Gn,ru,su,rs,es]),f_=Ce([Dn,Wn,Fn,Yu]),h_=Ce([Pt,wi,Rr,Ei]),p_=Ce([Hn,Pu,$i,Gu]),m_=Ce([Dn,Wn,bu,au,eu,gu,pu,Fu]),__=Ce([Pt,si,ki,gi,hi,li,di,fi,ts,yi]);class le extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}static fromError(e,r,n){if(e===E.ErrorCode.UrlElicitationRequired&&n){const s=n;if(s.elicitations)return new Xu(s.elicitations,r)}return new le(e,r,n)}}class Xu extends le{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(E.ErrorCode.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){var e,r;return(r=(e=this.data)===null||e===void 0?void 0:e.elicitations)!==null&&r!==void 0?r:[]}}const Qu=1e6,Ri=1e6,el=1e4,g_=1e6;class yt{static isTemplate(e){return/\{[^}\s]+\}/.test(e)}static validateLength(e,r,n){if(e.length>r)throw new Error(`${n} exceeds maximum length of ${r} characters (got ${e.length})`)}get variableNames(){return this.parts.flatMap(e=>typeof e=="string"?[]:e.names)}constructor(e){yt.validateLength(e,Qu,"Template"),this.template=e,this.parts=this.parse(e)}toString(){return this.template}parse(e){const r=[];let n="",s=0,i=0;for(;s<e.length;)if(e[s]==="{"){n&&(r.push(n),n="");const a=e.indexOf("}",s);if(a===-1)throw new Error("Unclosed template expression");if(i++,i>el)throw new Error(`Template contains too many expressions (max ${el})`);const o=e.slice(s+1,a),c=this.getOperator(o),u=o.includes("*"),l=this.getNames(o),p=l[0];for(const b of l)yt.validateLength(b,Ri,"Variable name");r.push({name:p,operator:c,names:l,exploded:u}),s=a+1}else n+=e[s],s++;return n&&r.push(n),r}getOperator(e){return["+","#",".","/","?","&"].find(n=>e.startsWith(n))||""}getNames(e){const r=this.getOperator(e);return e.slice(r.length).split(",").map(n=>n.replace("*","").trim()).filter(n=>n.length>0)}encodeValue(e,r){return yt.validateLength(e,Ri,"Variable value"),r==="+"||r==="#"?encodeURI(e):encodeURIComponent(e)}expandPart(e,r){if(e.operator==="?"||e.operator==="&"){const a=e.names.map(c=>{const u=r[c];if(u===void 0)return"";const l=Array.isArray(u)?u.map(p=>this.encodeValue(p,e.operator)).join(","):this.encodeValue(u.toString(),e.operator);return`${c}=${l}`}).filter(c=>c.length>0);return a.length===0?"":(e.operator==="?"?"?":"&")+a.join("&")}if(e.names.length>1){const a=e.names.map(o=>r[o]).filter(o=>o!==void 0);return a.length===0?"":a.map(o=>Array.isArray(o)?o[0]:o).join(",")}const n=r[e.name];if(n===void 0)return"";const i=(Array.isArray(n)?n:[n]).map(a=>this.encodeValue(a,e.operator));switch(e.operator){case"":return i.join(",");case"+":return i.join(",");case"#":return"#"+i.join(",");case".":return"."+i.join(".");case"/":return"/"+i.join("/");default:return i.join(",")}}expand(e){let r="",n=!1;for(const s of this.parts){if(typeof s=="string"){r+=s;continue}const i=this.expandPart(s,e);i&&((s.operator==="?"||s.operator==="&")&&n?r+=i.replace("?","&"):r+=i,(s.operator==="?"||s.operator==="&")&&(n=!0))}return r}escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}partToRegExp(e){const r=[];for(const i of e.names)yt.validateLength(i,Ri,"Variable name");if(e.operator==="?"||e.operator==="&"){for(let i=0;i<e.names.length;i++){const a=e.names[i],o=i===0?"\\"+e.operator:"&";r.push({pattern:o+this.escapeRegExp(a)+"=([^&]+)",name:a})}return r}let n;const s=e.name;switch(e.operator){case"":n=e.exploded?"([^/]+(?:,[^/]+)*)":"([^/,]+)";break;case"+":case"#":n="(.+)";break;case".":n="\\.([^/,]+)";break;case"/":n="/"+(e.exploded?"([^/]+(?:,[^/]+)*)":"([^/,]+)");break;default:n="([^/]+)"}return r.push({pattern:n,name:s}),r}match(e){yt.validateLength(e,Qu,"URI");let r="^";const n=[];for(const o of this.parts)if(typeof o=="string")r+=this.escapeRegExp(o);else{const c=this.partToRegExp(o);for(const{pattern:u,name:l}of c)r+=u,n.push({name:l,exploded:o.exploded})}r+="$",yt.validateLength(r,g_,"Generated regex pattern");const s=new RegExp(r),i=e.match(s);if(!i)return null;const a={};for(let o=0;o<n.length;o++){const{name:c,exploded:u}=n[o],l=i[o+1],p=c.replace("*","");u&&l.includes(",")?a[p]=l.split(","):a[p]=l}return a}}const ss=Symbol.for("mcp.completable");function v_(t,e){return Object.defineProperty(t,ss,{value:{complete:e},enumerable:!1,writable:!1,configurable:!1}),t}function tl(t){return!!t&&typeof t=="object"&&ss in t}function rl(t){const e=t[ss];return e?.complete}function y_(t){return t}E.McpZodTypeKind=void 0,(function(t){t.Completable="McpCompletable"})(E.McpZodTypeKind||(E.McpZodTypeKind={}));function b_(t){var e;return t.title!==void 0&&t.title!==""?t.title:!((e=t.annotations)===null||e===void 0)&&e.title?t.annotations.title:t.name}var pe;(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function r(s){throw new Error}t.assertNever=r,t.arrayToEnum=s=>{const i={};for(const a of s)i[a]=a;return i},t.getValidEnumValues=s=>{const i=t.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),a={};for(const o of i)a[o]=s[o];return t.objectValues(a)},t.objectValues=s=>t.objectKeys(s).map(function(i){return s[i]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const i=[];for(const a in s)Object.prototype.hasOwnProperty.call(s,a)&&i.push(a);return i},t.find=(s,i)=>{for(const a of s)if(i(a))return a},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function n(s,i=" | "){return s.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(pe||(pe={}));var nl;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(nl||(nl={}));const B=pe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Tt=t=>{switch(typeof t){case"undefined":return B.undefined;case"string":return B.string;case"number":return Number.isNaN(t)?B.nan:B.number;case"boolean":return B.boolean;case"function":return B.function;case"bigint":return B.bigint;case"symbol":return B.symbol;case"object":return Array.isArray(t)?B.array:t===null?B.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?B.promise:typeof Map<"u"&&t instanceof Map?B.map:typeof Set<"u"&&t instanceof Set?B.set:typeof Date<"u"&&t instanceof Date?B.date:B.object;default:return B.unknown}},x=pe.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class bt extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){const r=e||function(i){return i.message},n={_errors:[]},s=i=>{for(const a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(s);else if(a.code==="invalid_return_type")s(a.returnTypeError);else if(a.code==="invalid_arguments")s(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let o=n,c=0;for(;c<a.path.length;){const u=a.path[c];c===a.path.length-1?(o[u]=o[u]||{_errors:[]},o[u]._errors.push(r(a))):o[u]=o[u]||{_errors:[]},o=o[u],c++}}};return s(this),n}static assert(e){if(!(e instanceof bt))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,pe.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){const r={},n=[];for(const s of this.issues)if(s.path.length>0){const i=s.path[0];r[i]=r[i]||[],r[i].push(e(s))}else n.push(e(s));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}}bt.create=t=>new bt(t);const Pi=(t,e)=>{let r;switch(t.code){case x.invalid_type:t.received===B.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case x.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,pe.jsonStringifyReplacer)}`;break;case x.unrecognized_keys:r=`Unrecognized key(s) in object: ${pe.joinValues(t.keys,", ")}`;break;case x.invalid_union:r="Invalid input";break;case x.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${pe.joinValues(t.options)}`;break;case x.invalid_enum_value:r=`Invalid enum value. Expected ${pe.joinValues(t.options)}, received '${t.received}'`;break;case x.invalid_arguments:r="Invalid function arguments";break;case x.invalid_return_type:r="Invalid function return type";break;case x.invalid_date:r="Invalid date";break;case x.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:pe.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case x.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case x.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case x.custom:r="Invalid input";break;case x.invalid_intersection_types:r="Intersection results could not be merged";break;case x.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case x.not_finite:r="Number must be finite";break;default:r=e.defaultError,pe.assertNever(t)}return{message:r}};let w_=Pi;function $_(){return w_}const S_=t=>{const{data:e,path:r,errorMaps:n,issueData:s}=t,i=[...r,...s.path||[]],a={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let o="";const c=n.filter(u=>!!u).slice().reverse();for(const u of c)o=u(a,{data:e,defaultError:o}).message;return{...s,path:i,message:o}};function K(t,e){const r=$_(),n=S_({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Pi?void 0:Pi].filter(s=>!!s)});t.common.issues.push(n)}class Xe{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){const n=[];for(const s of r){if(s.status==="aborted")return ne;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){const n=[];for(const s of r){const i=await s.key,a=await s.value;n.push({key:i,value:a})}return Xe.mergeObjectSync(e,n)}static mergeObjectSync(e,r){const n={};for(const s of r){const{key:i,value:a}=s;if(i.status==="aborted"||a.status==="aborted")return ne;i.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||s.alwaysSet)&&(n[i.value]=a.value)}return{status:e.value,value:n}}}const ne=Object.freeze({status:"aborted"}),Pr=t=>({status:"dirty",value:t}),et=t=>({status:"valid",value:t}),sl=t=>t.status==="aborted",il=t=>t.status==="dirty",Bt=t=>t.status==="valid",is=t=>typeof Promise<"u"&&t instanceof Promise;var Y;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Y||(Y={}));class Ct{constructor(e,r,n,s){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const al=(t,e)=>{if(Bt(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new bt(t.common.issues);return this._error=r,this._error}}};function oe(t){if(!t)return{};const{errorMap:e,invalid_type_error:r,required_error:n,description:s}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(a,o)=>{const{message:c}=t;return a.code==="invalid_enum_value"?{message:c??o.defaultError}:typeof o.data>"u"?{message:c??n??o.defaultError}:a.code!=="invalid_type"?{message:o.defaultError}:{message:c??r??o.defaultError}},description:s}}class fe{get description(){return this._def.description}_getType(e){return Tt(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Tt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Xe,ctx:{common:e.parent.common,data:e.data,parsedType:Tt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const r=this._parse(e);if(is(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){const r=this._parse(e);return Promise.resolve(r)}parse(e,r){const n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){const n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Tt(e)},s=this._parseSync({data:e,path:n.path,parent:n});return al(n,s)}"~validate"(e){const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Tt(e)};if(!this["~standard"].async)try{const n=this._parseSync({data:e,path:[],parent:r});return Bt(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>Bt(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){const n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){const n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Tt(e)},s=this._parse({data:e,path:n.path,parent:n}),i=await(is(s)?s:Promise.resolve(s));return al(n,i)}refine(e,r){const n=s=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(s):r;return this._refinement((s,i)=>{const a=e(s),o=()=>i.addIssue({code:x.custom,...n(s)});return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(o(),!1)):a?!0:(o(),!1)})}refinement(e,r){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof r=="function"?r(n,s):r),!1))}_refinement(e){return new Xt({schema:this,typeName:L.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return It.create(this,this._def)}nullable(){return Qt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return mt.create(this)}promise(){return us.create(this,this._def)}or(e){return os.create([this,e],this._def)}and(e){return cs.create(this,e,this._def)}transform(e){return new Xt({...oe(this._def),schema:this,typeName:L.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const r=typeof e=="function"?e:()=>e;return new Oi({...oe(this._def),innerType:this,defaultValue:r,typeName:L.ZodDefault})}brand(){return new W_({typeName:L.ZodBranded,type:this,...oe(this._def)})}catch(e){const r=typeof e=="function"?e:()=>e;return new Ii({...oe(this._def),innerType:this,catchValue:r,typeName:L.ZodCatch})}describe(e){const r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Ni.create(this,e)}readonly(){return Ai.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const k_=/^c[^\s-]{8,}$/i,E_=/^[0-9a-z]+$/,R_=/^[0-9A-HJKMNP-TV-Z]{26}$/i,P_=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,T_=/^[a-z0-9_-]{21}$/i,C_=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,O_=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,I_=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,N_="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Ti;const A_=/^(?:(?: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])$/,j_=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,z_=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,M_=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,q_=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Z_=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ol="((\\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])))",x_=new RegExp(`^${ol}$`);function cl(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function L_(t){return new RegExp(`^${cl(t)}$`)}function U_(t){let e=`${ol}T${cl(t)}`;const r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function D_(t,e){return!!((e==="v4"||!e)&&A_.test(t)||(e==="v6"||!e)&&z_.test(t))}function V_(t,e){if(!C_.test(t))return!1;try{const[r]=t.split(".");if(!r)return!1;const n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),s=JSON.parse(atob(n));return!(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function F_(t,e){return!!((e==="v4"||!e)&&j_.test(t)||(e==="v6"||!e)&&M_.test(t))}class Ut extends fe{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==B.string){const i=this._getOrReturnCtx(e);return K(i,{code:x.invalid_type,expected:B.string,received:i.parsedType}),ne}const n=new Xe;let s;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(s=this._getOrReturnCtx(e,s),K(s,{code:x.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")e.data.length>i.value&&(s=this._getOrReturnCtx(e,s),K(s,{code:x.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){const a=e.data.length>i.value,o=e.data.length<i.value;(a||o)&&(s=this._getOrReturnCtx(e,s),a?K(s,{code:x.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):o&&K(s,{code:x.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")I_.test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"email",code:x.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Ti||(Ti=new RegExp(N_,"u")),Ti.test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"emoji",code:x.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")P_.test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"uuid",code:x.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")T_.test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"nanoid",code:x.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")k_.test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"cuid",code:x.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")E_.test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"cuid2",code:x.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")R_.test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"ulid",code:x.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),K(s,{validation:"url",code:x.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"regex",code:x.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(e,s),K(s,{code:x.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(s=this._getOrReturnCtx(e,s),K(s,{code:x.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(s=this._getOrReturnCtx(e,s),K(s,{code:x.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?U_(i).test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{code:x.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?x_.test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{code:x.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?L_(i).test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{code:x.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?O_.test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"duration",code:x.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?D_(e.data,i.version)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"ip",code:x.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?V_(e.data,i.alg)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"jwt",code:x.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?F_(e.data,i.version)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"cidr",code:x.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?q_.test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"base64",code:x.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?Z_.test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"base64url",code:x.invalid_string,message:i.message}),n.dirty()):pe.assertNever(i);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(s=>e.test(s),{validation:r,code:x.invalid_string,...Y.errToObj(n)})}_addCheck(e){return new Ut({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Y.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Y.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Y.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Y.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Y.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Y.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Y.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Y.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Y.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Y.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Y.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Y.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Y.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...Y.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...Y.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Y.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...Y.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...Y.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...Y.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...Y.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...Y.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...Y.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...Y.errToObj(r)})}nonempty(e){return this.min(1,Y.errToObj(e))}trim(){return new Ut({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ut({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ut({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}Ut.create=t=>new Ut({checks:[],typeName:L.ZodString,coerce:t?.coerce??!1,...oe(t)});function H_(t,e){const r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=r>n?r:n,i=Number.parseInt(t.toFixed(s).replace(".","")),a=Number.parseInt(e.toFixed(s).replace(".",""));return i%a/10**s}class Tr extends fe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==B.number){const i=this._getOrReturnCtx(e);return K(i,{code:x.invalid_type,expected:B.number,received:i.parsedType}),ne}let n;const s=new Xe;for(const i of this._def.checks)i.kind==="int"?pe.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),K(n,{code:x.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),K(n,{code:x.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),K(n,{code:x.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?H_(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),K(n,{code:x.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),K(n,{code:x.not_finite,message:i.message}),s.dirty()):pe.assertNever(i);return{status:s.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,Y.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Y.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Y.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Y.toString(r))}setLimit(e,r,n,s){return new Tr({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Y.toString(s)}]})}_addCheck(e){return new Tr({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Y.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Y.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Y.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:Y.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Y.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Y.toString(e)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&pe.isInteger(e.value))}get isFinite(){let e=null,r=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}}Tr.create=t=>new Tr({checks:[],typeName:L.ZodNumber,coerce:t?.coerce||!1,...oe(t)});class Cr extends fe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==B.bigint)return this._getInvalidInput(e);let n;const s=new Xe;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),K(n,{code:x.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),K(n,{code:x.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),K(n,{code:x.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):pe.assertNever(i);return{status:s.value,value:e.data}}_getInvalidInput(e){const r=this._getOrReturnCtx(e);return K(r,{code:x.invalid_type,expected:B.bigint,received:r.parsedType}),ne}gte(e,r){return this.setLimit("min",e,!0,Y.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Y.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Y.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Y.toString(r))}setLimit(e,r,n,s){return new Cr({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Y.toString(s)}]})}_addCheck(e){return new Cr({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Y.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Y.toString(r)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}Cr.create=t=>new Cr({checks:[],typeName:L.ZodBigInt,coerce:t?.coerce??!1,...oe(t)});class ul extends fe{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==B.boolean){const n=this._getOrReturnCtx(e);return K(n,{code:x.invalid_type,expected:B.boolean,received:n.parsedType}),ne}return et(e.data)}}ul.create=t=>new ul({typeName:L.ZodBoolean,coerce:t?.coerce||!1,...oe(t)});class as extends fe{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==B.date){const i=this._getOrReturnCtx(e);return K(i,{code:x.invalid_type,expected:B.date,received:i.parsedType}),ne}if(Number.isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return K(i,{code:x.invalid_date}),ne}const n=new Xe;let s;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(s=this._getOrReturnCtx(e,s),K(s,{code:x.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(s=this._getOrReturnCtx(e,s),K(s,{code:x.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):pe.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new as({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:Y.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:Y.toString(r)})}get minDate(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}}as.create=t=>new as({checks:[],coerce:t?.coerce||!1,typeName:L.ZodDate,...oe(t)});class ll extends fe{_parse(e){if(this._getType(e)!==B.symbol){const n=this._getOrReturnCtx(e);return K(n,{code:x.invalid_type,expected:B.symbol,received:n.parsedType}),ne}return et(e.data)}}ll.create=t=>new ll({typeName:L.ZodSymbol,...oe(t)});class dl extends fe{_parse(e){if(this._getType(e)!==B.undefined){const n=this._getOrReturnCtx(e);return K(n,{code:x.invalid_type,expected:B.undefined,received:n.parsedType}),ne}return et(e.data)}}dl.create=t=>new dl({typeName:L.ZodUndefined,...oe(t)});class fl extends fe{_parse(e){if(this._getType(e)!==B.null){const n=this._getOrReturnCtx(e);return K(n,{code:x.invalid_type,expected:B.null,received:n.parsedType}),ne}return et(e.data)}}fl.create=t=>new fl({typeName:L.ZodNull,...oe(t)});class hl extends fe{constructor(){super(...arguments),this._any=!0}_parse(e){return et(e.data)}}hl.create=t=>new hl({typeName:L.ZodAny,...oe(t)});class pl extends fe{constructor(){super(...arguments),this._unknown=!0}_parse(e){return et(e.data)}}pl.create=t=>new pl({typeName:L.ZodUnknown,...oe(t)});class Ot extends fe{_parse(e){const r=this._getOrReturnCtx(e);return K(r,{code:x.invalid_type,expected:B.never,received:r.parsedType}),ne}}Ot.create=t=>new Ot({typeName:L.ZodNever,...oe(t)});class ml extends fe{_parse(e){if(this._getType(e)!==B.undefined){const n=this._getOrReturnCtx(e);return K(n,{code:x.invalid_type,expected:B.void,received:n.parsedType}),ne}return et(e.data)}}ml.create=t=>new ml({typeName:L.ZodVoid,...oe(t)});class mt extends fe{_parse(e){const{ctx:r,status:n}=this._processInputParams(e),s=this._def;if(r.parsedType!==B.array)return K(r,{code:x.invalid_type,expected:B.array,received:r.parsedType}),ne;if(s.exactLength!==null){const a=r.data.length>s.exactLength.value,o=r.data.length<s.exactLength.value;(a||o)&&(K(r,{code:a?x.too_big:x.too_small,minimum:o?s.exactLength.value:void 0,maximum:a?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&r.data.length<s.minLength.value&&(K(r,{code:x.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&r.data.length>s.maxLength.value&&(K(r,{code:x.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((a,o)=>s.type._parseAsync(new Ct(r,a,r.path,o)))).then(a=>Xe.mergeArray(n,a));const i=[...r.data].map((a,o)=>s.type._parseSync(new Ct(r,a,r.path,o)));return Xe.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new mt({...this._def,minLength:{value:e,message:Y.toString(r)}})}max(e,r){return new mt({...this._def,maxLength:{value:e,message:Y.toString(r)}})}length(e,r){return new mt({...this._def,exactLength:{value:e,message:Y.toString(r)}})}nonempty(e){return this.min(1,e)}}mt.create=(t,e)=>new mt({type:t,minLength:null,maxLength:null,exactLength:null,typeName:L.ZodArray,...oe(e)});function Gt(t){if(t instanceof Ne){const e={};for(const r in t.shape){const n=t.shape[r];e[r]=It.create(Gt(n))}return new Ne({...t._def,shape:()=>e})}else return t instanceof mt?new mt({...t._def,type:Gt(t.element)}):t instanceof It?It.create(Gt(t.unwrap())):t instanceof Qt?Qt.create(Gt(t.unwrap())):t instanceof Dt?Dt.create(t.items.map(e=>Gt(e))):t}class Ne extends fe{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),r=pe.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==B.object){const u=this._getOrReturnCtx(e);return K(u,{code:x.invalid_type,expected:B.object,received:u.parsedType}),ne}const{status:n,ctx:s}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),o=[];if(!(this._def.catchall instanceof Ot&&this._def.unknownKeys==="strip"))for(const u in s.data)a.includes(u)||o.push(u);const c=[];for(const u of a){const l=i[u],p=s.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new Ct(s,p,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof Ot){const u=this._def.unknownKeys;if(u==="passthrough")for(const l of o)c.push({key:{status:"valid",value:l},value:{status:"valid",value:s.data[l]}});else if(u==="strict")o.length>0&&(K(s,{code:x.unrecognized_keys,keys:o}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const l of o){const p=s.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new Ct(s,p,s.path,l)),alwaysSet:l in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const u=[];for(const l of c){const p=await l.key,b=await l.value;u.push({key:p,value:b,alwaysSet:l.alwaysSet})}return u}).then(u=>Xe.mergeObjectSync(n,u)):Xe.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return Y.errToObj,new Ne({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{const s=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:Y.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new Ne({...this._def,unknownKeys:"strip"})}passthrough(){return new Ne({...this._def,unknownKeys:"passthrough"})}extend(e){return new Ne({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Ne({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:L.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new Ne({...this._def,catchall:e})}pick(e){const r={};for(const n of pe.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new Ne({...this._def,shape:()=>r})}omit(e){const r={};for(const n of pe.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new Ne({...this._def,shape:()=>r})}deepPartial(){return Gt(this)}partial(e){const r={};for(const n of pe.objectKeys(this.shape)){const s=this.shape[n];e&&!e[n]?r[n]=s:r[n]=s.optional()}return new Ne({...this._def,shape:()=>r})}required(e){const r={};for(const n of pe.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof It;)i=i._def.innerType;r[n]=i}return new Ne({...this._def,shape:()=>r})}keyof(){return yl(pe.objectKeys(this.shape))}}Ne.create=(t,e)=>new Ne({shape:()=>t,unknownKeys:"strip",catchall:Ot.create(),typeName:L.ZodObject,...oe(e)}),Ne.strictCreate=(t,e)=>new Ne({shape:()=>t,unknownKeys:"strict",catchall:Ot.create(),typeName:L.ZodObject,...oe(e)}),Ne.lazycreate=(t,e)=>new Ne({shape:t,unknownKeys:"strip",catchall:Ot.create(),typeName:L.ZodObject,...oe(e)});class os extends fe{_parse(e){const{ctx:r}=this._processInputParams(e),n=this._def.options;function s(i){for(const o of i)if(o.result.status==="valid")return o.result;for(const o of i)if(o.result.status==="dirty")return r.common.issues.push(...o.ctx.common.issues),o.result;const a=i.map(o=>new bt(o.ctx.common.issues));return K(r,{code:x.invalid_union,unionErrors:a}),ne}if(r.common.async)return Promise.all(n.map(async i=>{const a={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(s);{let i;const a=[];for(const c of n){const u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!i&&(i={result:l,ctx:u}),u.common.issues.length&&a.push(u.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;const o=a.map(c=>new bt(c));return K(r,{code:x.invalid_union,unionErrors:o}),ne}}get options(){return this._def.options}}os.create=(t,e)=>new os({options:t,typeName:L.ZodUnion,...oe(e)});function Ci(t,e){const r=Tt(t),n=Tt(e);if(t===e)return{valid:!0,data:t};if(r===B.object&&n===B.object){const s=pe.objectKeys(e),i=pe.objectKeys(t).filter(o=>s.indexOf(o)!==-1),a={...t,...e};for(const o of i){const c=Ci(t[o],e[o]);if(!c.valid)return{valid:!1};a[o]=c.data}return{valid:!0,data:a}}else if(r===B.array&&n===B.array){if(t.length!==e.length)return{valid:!1};const s=[];for(let i=0;i<t.length;i++){const a=t[i],o=e[i],c=Ci(a,o);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return r===B.date&&n===B.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class cs extends fe{_parse(e){const{status:r,ctx:n}=this._processInputParams(e),s=(i,a)=>{if(sl(i)||sl(a))return ne;const o=Ci(i.value,a.value);return o.valid?((il(i)||il(a))&&r.dirty(),{status:r.value,value:o.data}):(K(n,{code:x.invalid_intersection_types}),ne)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,a])=>s(i,a)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}cs.create=(t,e,r)=>new cs({left:t,right:e,typeName:L.ZodIntersection,...oe(r)});class Dt extends fe{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==B.array)return K(n,{code:x.invalid_type,expected:B.array,received:n.parsedType}),ne;if(n.data.length<this._def.items.length)return K(n,{code:x.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ne;!this._def.rest&&n.data.length>this._def.items.length&&(K(n,{code:x.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const i=[...n.data].map((a,o)=>{const c=this._def.items[o]||this._def.rest;return c?c._parse(new Ct(n,a,n.path,o)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>Xe.mergeArray(r,a)):Xe.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new Dt({...this._def,rest:e})}}Dt.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Dt({items:t,typeName:L.ZodTuple,rest:null,...oe(e)})};class _l extends fe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==B.map)return K(n,{code:x.invalid_type,expected:B.map,received:n.parsedType}),ne;const s=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([o,c],u)=>({key:s._parse(new Ct(n,o,n.path,[u,"key"])),value:i._parse(new Ct(n,c,n.path,[u,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const c of a){const u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return ne;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),o.set(u.value,l.value)}return{status:r.value,value:o}})}else{const o=new Map;for(const c of a){const u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return ne;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),o.set(u.value,l.value)}return{status:r.value,value:o}}}}_l.create=(t,e,r)=>new _l({valueType:e,keyType:t,typeName:L.ZodMap,...oe(r)});class Or extends fe{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==B.set)return K(n,{code:x.invalid_type,expected:B.set,received:n.parsedType}),ne;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(K(n,{code:x.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),r.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(K(n,{code:x.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),r.dirty());const i=this._def.valueType;function a(c){const u=new Set;for(const l of c){if(l.status==="aborted")return ne;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}const o=[...n.data.values()].map((c,u)=>i._parse(new Ct(n,c,n.path,u)));return n.common.async?Promise.all(o).then(c=>a(c)):a(o)}min(e,r){return new Or({...this._def,minSize:{value:e,message:Y.toString(r)}})}max(e,r){return new Or({...this._def,maxSize:{value:e,message:Y.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}}Or.create=(t,e)=>new Or({valueType:t,minSize:null,maxSize:null,typeName:L.ZodSet,...oe(e)});class gl extends fe{get schema(){return this._def.getter()}_parse(e){const{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}gl.create=(t,e)=>new gl({getter:t,typeName:L.ZodLazy,...oe(e)});class vl extends fe{_parse(e){if(e.data!==this._def.value){const r=this._getOrReturnCtx(e);return K(r,{received:r.data,code:x.invalid_literal,expected:this._def.value}),ne}return{status:"valid",value:e.data}}get value(){return this._def.value}}vl.create=(t,e)=>new vl({value:t,typeName:L.ZodLiteral,...oe(e)});function yl(t,e){return new Yt({values:t,typeName:L.ZodEnum,...oe(e)})}class Yt extends fe{_parse(e){if(typeof e.data!="string"){const r=this._getOrReturnCtx(e),n=this._def.values;return K(r,{expected:pe.joinValues(n),received:r.parsedType,code:x.invalid_type}),ne}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const r=this._getOrReturnCtx(e),n=this._def.values;return K(r,{received:r.data,code:x.invalid_enum_value,options:n}),ne}return et(e.data)}get options(){return this._def.values}get enum(){const e={};for(const r of this._def.values)e[r]=r;return e}get Values(){const e={};for(const r of this._def.values)e[r]=r;return e}get Enum(){const e={};for(const r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return Yt.create(e,{...this._def,...r})}exclude(e,r=this._def){return Yt.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}}Yt.create=yl;class bl extends fe{_parse(e){const r=pe.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==B.string&&n.parsedType!==B.number){const s=pe.objectValues(r);return K(n,{expected:pe.joinValues(s),received:n.parsedType,code:x.invalid_type}),ne}if(this._cache||(this._cache=new Set(pe.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const s=pe.objectValues(r);return K(n,{received:n.data,code:x.invalid_enum_value,options:s}),ne}return et(e.data)}get enum(){return this._def.values}}bl.create=(t,e)=>new bl({values:t,typeName:L.ZodNativeEnum,...oe(e)});class us extends fe{unwrap(){return this._def.type}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==B.promise&&r.common.async===!1)return K(r,{code:x.invalid_type,expected:B.promise,received:r.parsedType}),ne;const n=r.parsedType===B.promise?r.data:Promise.resolve(r.data);return et(n.then(s=>this._def.type.parseAsync(s,{path:r.path,errorMap:r.common.contextualErrorMap})))}}us.create=(t,e)=>new us({type:t,typeName:L.ZodPromise,...oe(e)});class Xt extends fe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===L.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:r,ctx:n}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:a=>{K(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){const a=s.transform(n.data,i);if(n.common.async)return Promise.resolve(a).then(async o=>{if(r.value==="aborted")return ne;const c=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return c.status==="aborted"?ne:c.status==="dirty"||r.value==="dirty"?Pr(c.value):c});{if(r.value==="aborted")return ne;const o=this._def.schema._parseSync({data:a,path:n.path,parent:n});return o.status==="aborted"?ne:o.status==="dirty"||r.value==="dirty"?Pr(o.value):o}}if(s.type==="refinement"){const a=o=>{const c=s.refinement(o,i);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?ne:(o.status==="dirty"&&r.dirty(),a(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?ne:(o.status==="dirty"&&r.dirty(),a(o.value).then(()=>({status:r.value,value:o.value}))))}if(s.type==="transform")if(n.common.async===!1){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Bt(a))return ne;const o=s.transform(a.value,i);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>Bt(a)?Promise.resolve(s.transform(a.value,i)).then(o=>({status:r.value,value:o})):ne);pe.assertNever(s)}}Xt.create=(t,e,r)=>new Xt({schema:t,typeName:L.ZodEffects,effect:e,...oe(r)}),Xt.createWithPreprocess=(t,e,r)=>new Xt({schema:e,effect:{type:"preprocess",transform:t},typeName:L.ZodEffects,...oe(r)});class It extends fe{_parse(e){return this._getType(e)===B.undefined?et(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}It.create=(t,e)=>new It({innerType:t,typeName:L.ZodOptional,...oe(e)});class Qt extends fe{_parse(e){return this._getType(e)===B.null?et(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Qt.create=(t,e)=>new Qt({innerType:t,typeName:L.ZodNullable,...oe(e)});class Oi extends fe{_parse(e){const{ctx:r}=this._processInputParams(e);let n=r.data;return r.parsedType===B.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}Oi.create=(t,e)=>new Oi({innerType:t,typeName:L.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...oe(e)});class Ii extends fe{_parse(e){const{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return is(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new bt(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new bt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Ii.create=(t,e)=>new Ii({innerType:t,typeName:L.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...oe(e)});class wl extends fe{_parse(e){if(this._getType(e)!==B.nan){const n=this._getOrReturnCtx(e);return K(n,{code:x.invalid_type,expected:B.nan,received:n.parsedType}),ne}return{status:"valid",value:e.data}}}wl.create=t=>new wl({typeName:L.ZodNaN,...oe(t)});class W_ extends fe{_parse(e){const{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}}class Ni extends fe{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?ne:i.status==="dirty"?(r.dirty(),Pr(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?ne:s.status==="dirty"?(r.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,r){return new Ni({in:e,out:r,typeName:L.ZodPipeline})}}class Ai extends fe{_parse(e){const r=this._def.innerType._parse(e),n=s=>(Bt(s)&&(s.value=Object.freeze(s.value)),s);return is(r)?r.then(s=>n(s)):n(r)}unwrap(){return this._def.innerType}}Ai.create=(t,e)=>new Ai({innerType:t,typeName:L.ZodReadonly,...oe(e)});var L;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(L||(L={})),Ot.create,mt.create;const K_=Ne.create;os.create,cs.create,Dt.create,Yt.create,us.create,It.create,Qt.create;const J_=A("ZodMiniType",(t,e)=>{if(!t._zod)throw new Error("Uninitialized schema in ZodMiniType.");$e.init(t,e),t.def=e,t.parse=(r,n)=>kf(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>Ls(t,r,n),t.parseAsync=async(r,n)=>Ef(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>Us(t,r,n),t.check=(...r)=>t.clone({...e,checks:[...e.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),t.clone=(r,n)=>Et(t,r,n),t.brand=()=>t,t.register=((r,n)=>(r.add(t,n),t))}),B_=A("ZodMiniObject",(t,e)=>{dc.init(t,e),J_.init(t,e),we(t,"shape",()=>e.shape)});function $l(t,e){const r={type:"object",get shape(){return fr(this,"shape",{...t}),this.shape},...Q(e)};return new B_(r)}function ct(t){return!!t._zod}function Ir(t){const e=Object.values(t);if(e.length===0)return $l({});const r=e.every(ct),n=e.every(s=>!ct(s));if(r)return $l(t);if(n)return K_(t);throw new Error("Mixed Zod versions detected in object shape.")}function ls(t,e){return ct(t)?Ls(t,e):t.safeParse(e)}async function ji(t,e){return ct(t)?await Us(t,e):await t.safeParseAsync(e)}function Nr(t){var e,r;if(!t)return;let n;if(ct(t)?n=(r=(e=t._zod)===null||e===void 0?void 0:e.def)===null||r===void 0?void 0:r.shape:n=t.shape,!!n){if(typeof n=="function")try{return n()}catch{return}return n}}function Ar(t){var e;if(t){if(typeof t=="object"){const r=t,n=t;if(!r._def&&!n._zod){const s=Object.values(t);if(s.length>0&&s.every(i=>typeof i=="object"&&i!==null&&(i._def!==void 0||i._zod!==void 0||typeof i.parse=="function")))return Ir(t)}}if(ct(t)){const n=(e=t._zod)===null||e===void 0?void 0:e.def;if(n&&(n.typeName==="object"||n.shape!==void 0))return t}else if(t.shape!==void 0)return t}}function zi(t){if(t&&typeof t=="object"){if("message"in t&&typeof t.message=="string")return t.message;if("issues"in t&&Array.isArray(t.issues)&&t.issues.length>0){const e=t.issues[0];if(e&&typeof e=="object"&&"message"in e)return String(e.message)}try{return JSON.stringify(t)}catch{return String(t)}}return String(t)}function G_(t){var e,r,n,s;if(ct(t))return(r=(e=t._zod)===null||e===void 0?void 0:e.def)===null||r===void 0?void 0:r.description;const i=t;return(n=t.description)!==null&&n!==void 0?n:(s=i._def)===null||s===void 0?void 0:s.description}function Y_(t){var e,r,n;if(ct(t))return((r=(e=t._zod)===null||e===void 0?void 0:e.def)===null||r===void 0?void 0:r.typeName)==="ZodOptional";const s=t;return typeof t.isOptional=="function"?t.isOptional():((n=s._def)===null||n===void 0?void 0:n.typeName)==="ZodOptional"}function Sl(t){var e;if(ct(t)){const a=(e=t._zod)===null||e===void 0?void 0:e.def;if(a){if(a.value!==void 0)return a.value;if(Array.isArray(a.values)&&a.values.length>0)return a.values[0]}}const n=t._def;if(n){if(n.value!==void 0)return n.value;if(Array.isArray(n.values)&&n.values.length>0)return n.values[0]}const s=t.value;if(s!==void 0)return s}const X_=Symbol("Let zodToJsonSchema decide on which parser to use"),kl={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},Q_=t=>typeof t=="string"?{...kl,name:t}:{...kl,...t},eg=t=>{const e=Q_(t),r=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([n,s])=>[s._def,{def:s._def,path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}};function El(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function ye(t,e,r,n,s){t[e]=r,El(t,e,n,s)}const Rl=(t,e)=>{let r=0;for(;r<t.length&&r<e.length&&t[r]===e[r];r++);return[(t.length-r).toString(),...e.slice(r)].join("/")};function We(t){if(t.target!=="openAi")return{};const e=[...t.basePath,t.definitionPath,t.openAiAnyTypeName];return t.flags.hasReferencedOpenAiAnyType=!0,{$ref:t.$refStrategy==="relative"?Rl(e,t.currentPath):e.join("/")}}function tg(t,e){const r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==L.ZodAny&&(r.items=me(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&ye(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&ye(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(ye(r,"minItems",t.exactLength.value,t.exactLength.message,e),ye(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}function rg(t,e){const r={type:"integer",format:"int64"};if(!t.checks)return r;for(const n of t.checks)switch(n.kind){case"min":e.target==="jsonSchema7"?n.inclusive?ye(r,"minimum",n.value,n.message,e):ye(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),ye(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?ye(r,"maximum",n.value,n.message,e):ye(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),ye(r,"maximum",n.value,n.message,e));break;case"multipleOf":ye(r,"multipleOf",n.value,n.message,e);break}return r}function ng(){return{type:"boolean"}}function Pl(t,e){return me(t.type._def,e)}const sg=(t,e)=>me(t.innerType._def,e);function Tl(t,e,r){const n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((s,i)=>Tl(t,e,s))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return ig(t,e)}}const ig=(t,e)=>{const r={type:"integer",format:"unix-time"};if(e.target==="openApi3")return r;for(const n of t.checks)switch(n.kind){case"min":ye(r,"minimum",n.value,n.message,e);break;case"max":ye(r,"maximum",n.value,n.message,e);break}return r};function ag(t,e){return{...me(t.innerType._def,e),default:t.defaultValue()}}function og(t,e){return e.effectStrategy==="input"?me(t.schema._def,e):We(e)}function cg(t){return{type:"string",enum:Array.from(t.values)}}const ug=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function lg(t,e){const r=[me(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),me(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(i=>!!i);let n=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0;const s=[];return r.forEach(i=>{if(ug(i))s.push(...i.allOf),i.unevaluatedProperties===void 0&&(n=void 0);else{let a=i;if("additionalProperties"in i&&i.additionalProperties===!1){const{additionalProperties:o,...c}=i;a=c}else n=void 0;s.push(a)}}),s.length?{allOf:s,...n}:void 0}function dg(t,e){const r=typeof t.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(t.value)?"array":"object"}:e.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[t.value]}:{type:r==="bigint"?"integer":r,const:t.value}}let Mi;const ut={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(Mi===void 0&&(Mi=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Mi),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function Cl(t,e){const r={type:"string"};if(t.checks)for(const n of t.checks)switch(n.kind){case"min":ye(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":ye(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"email":switch(e.emailStrategy){case"format:email":lt(r,"email",n.message,e);break;case"format:idn-email":lt(r,"idn-email",n.message,e);break;case"pattern:zod":De(r,ut.email,n.message,e);break}break;case"url":lt(r,"uri",n.message,e);break;case"uuid":lt(r,"uuid",n.message,e);break;case"regex":De(r,n.regex,n.message,e);break;case"cuid":De(r,ut.cuid,n.message,e);break;case"cuid2":De(r,ut.cuid2,n.message,e);break;case"startsWith":De(r,RegExp(`^${qi(n.value,e)}`),n.message,e);break;case"endsWith":De(r,RegExp(`${qi(n.value,e)}$`),n.message,e);break;case"datetime":lt(r,"date-time",n.message,e);break;case"date":lt(r,"date",n.message,e);break;case"time":lt(r,"time",n.message,e);break;case"duration":lt(r,"duration",n.message,e);break;case"length":ye(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),ye(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"includes":{De(r,RegExp(qi(n.value,e)),n.message,e);break}case"ip":{n.version!=="v6"&&lt(r,"ipv4",n.message,e),n.version!=="v4"&&lt(r,"ipv6",n.message,e);break}case"base64url":De(r,ut.base64url,n.message,e);break;case"jwt":De(r,ut.jwt,n.message,e);break;case"cidr":{n.version!=="v6"&&De(r,ut.ipv4Cidr,n.message,e),n.version!=="v4"&&De(r,ut.ipv6Cidr,n.message,e);break}case"emoji":De(r,ut.emoji(),n.message,e);break;case"ulid":{De(r,ut.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{lt(r,"binary",n.message,e);break}case"contentEncoding:base64":{ye(r,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{De(r,ut.base64,n.message,e);break}}break}case"nanoid":De(r,ut.nanoid,n.message,e)}return r}function qi(t,e){return e.patternStrategy==="escape"?hg(t):t}const fg=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function hg(t){let e="";for(let r=0;r<t.length;r++)fg.has(t[r])||(e+="\\"),e+=t[r];return e}function lt(t,e,r,n){t.format||t.anyOf?.some(s=>s.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format,...t.errorMessage&&n.errorMessages&&{errorMessage:{format:t.errorMessage.format}}}),delete t.format,t.errorMessage&&(delete t.errorMessage.format,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.anyOf.push({format:e,...r&&n.errorMessages&&{errorMessage:{format:r}}})):ye(t,"format",e,r,n)}function De(t,e,r,n){t.pattern||t.allOf?.some(s=>s.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern,...t.errorMessage&&n.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}}}),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.allOf.push({pattern:Ol(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):ye(t,"pattern",Ol(e,n),r,n)}function Ol(t,e){if(!e.applyRegexFlags||!t.flags)return t.source;const r={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},n=r.i?t.source.toLowerCase():t.source;let s="",i=!1,a=!1,o=!1;for(let c=0;c<n.length;c++){if(i){s+=n[c],i=!1;continue}if(r.i){if(a){if(n[c].match(/[a-z]/)){o?(s+=n[c],s+=`${n[c-2]}-${n[c]}`.toUpperCase(),o=!1):n[c+1]==="-"&&n[c+2]?.match(/[a-z]/)?(s+=n[c],o=!0):s+=`${n[c]}${n[c].toUpperCase()}`;continue}}else if(n[c].match(/[a-z]/)){s+=`[${n[c]}${n[c].toUpperCase()}]`;continue}}if(r.m){if(n[c]==="^"){s+=`(^|(?<=[\r
36
+ ]))`;continue}else if(n[c]==="$"){s+=`($|(?=[\r
37
+ ]))`;continue}}if(r.s&&n[c]==="."){s+=a?`${n[c]}\r
38
+ `:`[${n[c]}\r
39
+ ]`;continue}s+=n[c],n[c]==="\\"?i=!0:a&&n[c]==="]"?a=!1:!a&&n[c]==="["&&(a=!0)}try{new RegExp(s)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),t.source}return s}function Il(t,e){if(e.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),e.target==="openApi3"&&t.keyType?._def.typeName===L.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((n,s)=>({...n,[s]:me(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",s]})??We(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};const r={type:"object",additionalProperties:me(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??e.allowedAdditionalProperties};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===L.ZodString&&t.keyType._def.checks?.length){const{type:n,...s}=Cl(t.keyType._def,e);return{...r,propertyNames:s}}else{if(t.keyType?._def.typeName===L.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===L.ZodBranded&&t.keyType._def.type._def.typeName===L.ZodString&&t.keyType._def.type._def.checks?.length){const{type:n,...s}=Pl(t.keyType._def,e);return{...r,propertyNames:s}}}return r}function pg(t,e){if(e.mapStrategy==="record")return Il(t,e);const r=me(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||We(e),n=me(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||We(e);return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}function mg(t){const e=t.values,n=Object.keys(t.values).filter(i=>typeof e[e[i]]!="number").map(i=>e[i]),s=Array.from(new Set(n.map(i=>typeof i)));return{type:s.length===1?s[0]==="string"?"string":"number":["string","number"],enum:n}}function _g(t){return t.target==="openAi"?void 0:{not:We({...t,currentPath:[...t.currentPath,"not"]})}}function gg(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}const ds={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function vg(t,e){if(e.target==="openApi3")return Nl(t,e);const r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in ds&&(!n._def.checks||!n._def.checks.length))){const n=r.reduce((s,i)=>{const a=ds[i._def.typeName];return a&&!s.includes(a)?[...s,a]:s},[]);return{type:n.length>1?n:n[0]}}else if(r.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){const n=r.reduce((s,i)=>{const a=typeof i._def.value;switch(a){case"string":case"number":case"boolean":return[...s,a];case"bigint":return[...s,"integer"];case"object":if(i._def.value===null)return[...s,"null"];case"symbol":case"undefined":case"function":default:return s}},[]);if(n.length===r.length){const s=n.filter((i,a,o)=>o.indexOf(i)===a);return{type:s.length>1?s:s[0],enum:r.reduce((i,a)=>i.includes(a._def.value)?i:[...i,a._def.value],[])}}}else if(r.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,s)=>[...n,...s._def.values.filter(i=>!n.includes(i))],[])};return Nl(t,e)}const Nl=(t,e)=>{const r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,s)=>me(n._def,{...e,currentPath:[...e.currentPath,"anyOf",`${s}`]})).filter(n=>!!n&&(!e.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0};function yg(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return e.target==="openApi3"?{type:ds[t.innerType._def.typeName],nullable:!0}:{type:[ds[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){const n=me(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}const r=me(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function bg(t,e){const r={type:"number"};if(!t.checks)return r;for(const n of t.checks)switch(n.kind){case"int":r.type="integer",El(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?ye(r,"minimum",n.value,n.message,e):ye(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),ye(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?ye(r,"maximum",n.value,n.message,e):ye(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),ye(r,"maximum",n.value,n.message,e));break;case"multipleOf":ye(r,"multipleOf",n.value,n.message,e);break}return r}function wg(t,e){const r=e.target==="openAi",n={type:"object",properties:{}},s=[],i=t.shape();for(const o in i){let c=i[o];if(c===void 0||c._def===void 0)continue;let u=Sg(c);u&&r&&(c._def.typeName==="ZodOptional"&&(c=c._def.innerType),c.isNullable()||(c=c.nullable()),u=!1);const l=me(c._def,{...e,currentPath:[...e.currentPath,"properties",o],propertyPath:[...e.currentPath,"properties",o]});l!==void 0&&(n.properties[o]=l,u||s.push(o))}s.length&&(n.required=s);const a=$g(t,e);return a!==void 0&&(n.additionalProperties=a),n}function $g(t,e){if(t.catchall._def.typeName!=="ZodNever")return me(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(t.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function Sg(t){try{return t.isOptional()}catch{return!0}}const kg=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return me(t.innerType._def,e);const r=me(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:We(e)},r]}:We(e)},Eg=(t,e)=>{if(e.pipeStrategy==="input")return me(t.in._def,e);if(e.pipeStrategy==="output")return me(t.out._def,e);const r=me(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=me(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(s=>s!==void 0)}};function Rg(t,e){return me(t.type._def,e)}function Pg(t,e){const n={type:"array",uniqueItems:!0,items:me(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&ye(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&ye(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}function Tg(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>me(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:me(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>me(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}function Cg(t){return{not:We(t)}}function Og(t){return We(t)}const Ig=(t,e)=>me(t.innerType._def,e),Ng=(t,e,r)=>{switch(e){case L.ZodString:return Cl(t,r);case L.ZodNumber:return bg(t,r);case L.ZodObject:return wg(t,r);case L.ZodBigInt:return rg(t,r);case L.ZodBoolean:return ng();case L.ZodDate:return Tl(t,r);case L.ZodUndefined:return Cg(r);case L.ZodNull:return gg(r);case L.ZodArray:return tg(t,r);case L.ZodUnion:case L.ZodDiscriminatedUnion:return vg(t,r);case L.ZodIntersection:return lg(t,r);case L.ZodTuple:return Tg(t,r);case L.ZodRecord:return Il(t,r);case L.ZodLiteral:return dg(t,r);case L.ZodEnum:return cg(t);case L.ZodNativeEnum:return mg(t);case L.ZodNullable:return yg(t,r);case L.ZodOptional:return kg(t,r);case L.ZodMap:return pg(t,r);case L.ZodSet:return Pg(t,r);case L.ZodLazy:return()=>t.getter()._def;case L.ZodPromise:return Rg(t,r);case L.ZodNaN:case L.ZodNever:return _g(r);case L.ZodEffects:return og(t,r);case L.ZodAny:return We(r);case L.ZodUnknown:return Og(r);case L.ZodDefault:return ag(t,r);case L.ZodBranded:return Pl(t,r);case L.ZodReadonly:return Ig(t,r);case L.ZodCatch:return sg(t,r);case L.ZodPipeline:return Eg(t,r);case L.ZodFunction:case L.ZodVoid:case L.ZodSymbol:return;default:return(n=>{})()}};function me(t,e,r=!1){const n=e.seen.get(t);if(e.override){const o=e.override?.(t,e,n,r);if(o!==X_)return o}if(n&&!r){const o=Ag(n,e);if(o!==void 0)return o}const s={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,s);const i=Ng(t,t.typeName,e),a=typeof i=="function"?me(i(),e):i;if(a&&jg(t,e,a),e.postProcess){const o=e.postProcess(a,t,e);return s.jsonSchema=a,o}return s.jsonSchema=a,a}const Ag=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:Rl(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((r,n)=>e.currentPath[n]===r)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),We(e)):e.$refStrategy==="seen"?We(e):void 0}},jg=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r),zg=(t,e)=>{const r=eg(e);let n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((c,[u,l])=>({...c,[u]:me(l._def,{...r,currentPath:[...r.basePath,r.definitionPath,u]},!0)??We(r)}),{}):void 0;const s=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,i=me(t._def,s===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,s]},!1)??We(r),a=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;a!==void 0&&(i.title=a),r.flags.hasReferencedOpenAiAnyType&&(n||(n={}),n[r.openAiAnyTypeName]||(n[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:r.$refStrategy==="relative"?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}));const o=s===void 0?n?{...i,[r.definitionPath]:n}:i:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,s].join("/"),[r.definitionPath]:{...n,[s]:i}};return r.target==="jsonSchema7"?o.$schema="http://json-schema.org/draft-07/schema#":(r.target==="jsonSchema2019-09"||r.target==="openAi")&&(o.$schema="https://json-schema.org/draft/2019-09/schema#"),r.target==="openAi"&&("anyOf"in o||"oneOf"in o||"allOf"in o||"type"in o&&Array.isArray(o.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),o};function Mg(t){return!t||t==="jsonSchema7"||t==="draft-7"?"draft-7":t==="jsonSchema2019-09"||t==="draft-2020-12"?"draft-2020-12":"draft-7"}function Al(t,e){var r,n,s;return ct(t)?Gp(t,{target:Mg(e?.target),io:(r=e?.pipeStrategy)!==null&&r!==void 0?r:"input"}):zg(t,{strictUnions:(n=e?.strictUnions)!==null&&n!==void 0?n:!0,pipeStrategy:(s=e?.pipeStrategy)!==null&&s!==void 0?s:"input"})}function jl(t){const e=Nr(t),r=e?.method;if(!r)throw new Error("Schema is missing a method literal");const n=Sl(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function zl(t,e){const r=ls(t,e);if(!r.success)throw r.error;return r.data}const Ml=6e4;class Zi{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this.setNotificationHandler(Dn,r=>{const n=this._requestHandlerAbortControllers.get(r.params.requestId);n?.abort(r.params.reason)}),this.setNotificationHandler(Wn,r=>{this._onprogress(r)}),this.setRequestHandler(Hn,r=>({}))}_setupTimeout(e,r,n,s,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(s,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:s})}_resetTimeout(e){const r=this._timeoutInfo.get(e);if(!r)return!1;const n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),le.fromError(E.ErrorCode.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){const r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var r,n,s;this._transport=e;const i=(r=this.transport)===null||r===void 0?void 0:r.onclose;this._transport.onclose=()=>{i?.(),this._onclose()};const a=(n=this.transport)===null||n===void 0?void 0:n.onerror;this._transport.onerror=c=>{a?.(c),this._onerror(c)};const o=(s=this._transport)===null||s===void 0?void 0:s.onmessage;this._transport.onmessage=(c,u)=>{o?.(c,u),Un(c)||Dc(c)?this._onresponse(c):Qs(c)?this._onrequest(c,u):Uc(c)?this._onnotification(c):this._onerror(new Error(`Unknown message type: ${JSON.stringify(c)}`))},await this._transport.start()}_onclose(){var e;const r=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);const n=le.fromError(E.ErrorCode.ConnectionClosed,"Connection closed");for(const s of r.values())s(n)}_onerror(e){var r;(r=this.onerror)===null||r===void 0||r.call(this,e)}_onnotification(e){var r;const n=(r=this._notificationHandlers.get(e.method))!==null&&r!==void 0?r:this.fallbackNotificationHandler;n!==void 0&&Promise.resolve().then(()=>n(e)).catch(s=>this._onerror(new Error(`Uncaught error in notification handler: ${s}`)))}_onrequest(e,r){var n,s;const i=(n=this._requestHandlers.get(e.method))!==null&&n!==void 0?n:this.fallbackRequestHandler,a=this._transport;if(i===void 0){a?.send({jsonrpc:"2.0",id:e.id,error:{code:E.ErrorCode.MethodNotFound,message:"Method not found"}}).catch(u=>this._onerror(new Error(`Failed to send an error response: ${u}`)));return}const o=new AbortController;this._requestHandlerAbortControllers.set(e.id,o);const c={signal:o.signal,sessionId:a?.sessionId,_meta:(s=e.params)===null||s===void 0?void 0:s._meta,sendNotification:u=>this.notification(u,{relatedRequestId:e.id}),sendRequest:(u,l,p)=>this.request(u,l,{...p,relatedRequestId:e.id}),authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo};Promise.resolve().then(()=>i(e,c)).then(u=>{if(!o.signal.aborted)return a?.send({result:u,jsonrpc:"2.0",id:e.id})},u=>{var l;if(!o.signal.aborted)return a?.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(u.code)?u.code:E.ErrorCode.InternalError,message:(l=u.message)!==null&&l!==void 0?l:"Internal error",...u.data!==void 0&&{data:u.data}}})}).catch(u=>this._onerror(new Error(`Failed to send response: ${u}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){const{progressToken:r,...n}=e.params,s=Number(r),i=this._progressHandlers.get(s);if(!i){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}const a=this._responseHandlers.get(s),o=this._timeoutInfo.get(s);if(o&&a&&o.resetTimeoutOnProgress)try{this._resetTimeout(s)}catch(c){a(c);return}i(n)}_onresponse(e){const r=Number(e.id),n=this._responseHandlers.get(r);if(n===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),Un(e))n(e);else{const s=le.fromError(e.error.code,e.error.message,e.error.data);n(s)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}request(e,r,n){const{relatedRequestId:s,resumptionToken:i,onresumptiontoken:a}=n??{};return new Promise((o,c)=>{var u,l,p,b,y,h;if(!this._transport){c(new Error("Not connected"));return}((u=this._options)===null||u===void 0?void 0:u.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(l=n?.signal)===null||l===void 0||l.throwIfAborted();const v=this._requestMessageId++,f={...e,jsonrpc:"2.0",id:v};n?.onprogress&&(this._progressHandlers.set(v,n.onprogress),f.params={...e.params,_meta:{...((p=e.params)===null||p===void 0?void 0:p._meta)||{},progressToken:v}});const _=w=>{var g;this._responseHandlers.delete(v),this._progressHandlers.delete(v),this._cleanupTimeout(v),(g=this._transport)===null||g===void 0||g.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:v,reason:String(w)}},{relatedRequestId:s,resumptionToken:i,onresumptiontoken:a}).catch($=>this._onerror(new Error(`Failed to send cancellation: ${$}`))),c(w)};this._responseHandlers.set(v,w=>{var g;if(!(!((g=n?.signal)===null||g===void 0)&&g.aborted)){if(w instanceof Error)return c(w);try{const $=ls(r,w.result);$.success?o($.data):c($.error)}catch($){c($)}}}),(b=n?.signal)===null||b===void 0||b.addEventListener("abort",()=>{var w;_((w=n?.signal)===null||w===void 0?void 0:w.reason)});const d=(y=n?.timeout)!==null&&y!==void 0?y:Ml,m=()=>_(le.fromError(E.ErrorCode.RequestTimeout,"Request timed out",{timeout:d}));this._setupTimeout(v,d,n?.maxTotalTimeout,m,(h=n?.resetTimeoutOnProgress)!==null&&h!==void 0?h:!1),this._transport.send(f,{relatedRequestId:s,resumptionToken:i,onresumptiontoken:a}).catch(w=>{this._cleanupTimeout(v),c(w)})})}async notification(e,r){var n,s;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(e.method),((s=(n=this._options)===null||n===void 0?void 0:n.debouncedNotificationMethods)!==null&&s!==void 0?s:[]).includes(e.method)&&!e.params&&!r?.relatedRequestId){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var c;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;const u={...e,jsonrpc:"2.0"};(c=this._transport)===null||c===void 0||c.send(u,r).catch(l=>this._onerror(l))});return}const o={...e,jsonrpc:"2.0"};await this._transport.send(o,r)}setRequestHandler(e,r){const n=jl(e);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(s,i)=>{const a=zl(e,s);return Promise.resolve(r(a,i))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){const n=jl(e);this._notificationHandlers.set(n,s=>{const i=zl(e,s);return Promise.resolve(r(i))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}}function ql(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function xi(t,e){const r={...t};for(const n in e){const s=n,i=e[s];if(i===void 0)continue;const a=r[s];ql(a)&&ql(i)?r[s]={...a,...i}:r[s]=i}return r}var fs={exports:{}},Li={},Zl;function qg(){return Zl||(Zl=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.formatNames=t.fastFormats=t.fullFormats=void 0;function e(z,V){return{validate:z,compare:V}}t.fullFormats={date:e(i,a),time:e(c(!0),u),"date-time":e(b(!0),y),"iso-time":e(c(),l),"iso-date-time":e(b(),h),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:_,"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:H,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:m,int32:{type:"number",validate:$},int64:{type:"number",validate:k},float:{type:"number",validate:N},double:{type:"number",validate:N},password:!0,binary:!0},t.fastFormats={...t.fullFormats,date:e(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,a),time:e(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,u),"date-time":e(/^\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,y),"iso-time":e(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,l),"iso-date-time":e(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,h),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},t.formatNames=Object.keys(t.fullFormats);function r(z){return z%4===0&&(z%100!==0||z%400===0)}const n=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,s=[0,31,28,31,30,31,30,31,31,30,31,30,31];function i(z){const V=n.exec(z);if(!V)return!1;const J=+V[1],G=+V[2],ge=+V[3];return G>=1&&G<=12&&ge>=1&&ge<=(G===2&&r(J)?29:s[G])}function a(z,V){if(z&&V)return z>V?1:z<V?-1:0}const o=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function c(z){return function(J){const G=o.exec(J);if(!G)return!1;const ge=+G[1],Ve=+G[2],Fe=+G[3],be=G[4],ft=G[5]==="-"?-1:1,U=+(G[6]||0),C=+(G[7]||0);if(U>23||C>59||z&&!be)return!1;if(ge<=23&&Ve<=59&&Fe<60)return!0;const q=Ve-C*ft,I=ge-U*ft-(q<0?1:0);return(I===23||I===-1)&&(q===59||q===-1)&&Fe<61}}function u(z,V){if(!(z&&V))return;const J=new Date("2020-01-01T"+z).valueOf(),G=new Date("2020-01-01T"+V).valueOf();if(J&&G)return J-G}function l(z,V){if(!(z&&V))return;const J=o.exec(z),G=o.exec(V);if(J&&G)return z=J[1]+J[2]+J[3],V=G[1]+G[2]+G[3],z>V?1:z<V?-1:0}const p=/t|\s/i;function b(z){const V=c(z);return function(G){const ge=G.split(p);return ge.length===2&&i(ge[0])&&V(ge[1])}}function y(z,V){if(!(z&&V))return;const J=new Date(z).valueOf(),G=new Date(V).valueOf();if(J&&G)return J-G}function h(z,V){if(!(z&&V))return;const[J,G]=z.split(p),[ge,Ve]=V.split(p),Fe=a(J,ge);if(Fe!==void 0)return Fe||u(G,Ve)}const v=/\/|:/,f=/^(?:[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 _(z){return v.test(z)&&f.test(z)}const d=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function m(z){return d.lastIndex=0,d.test(z)}const w=-2147483648,g=2**31-1;function $(z){return Number.isInteger(z)&&z<=g&&z>=w}function k(z){return Number.isInteger(z)}function N(){return!0}const Z=/[^\\]\\Z/;function H(z){if(Z.test(z))return!1;try{return new RegExp(z),!0}catch{return!1}}})(Li)),Li}var Ui={},xl;function Zg(){return xl||(xl=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.formatLimitDefinition=void 0;const e=Vo(),r=se(),n=r.operators,s={formatMaximum:{okStr:"<=",ok:n.LTE,fail:n.GT},formatMinimum:{okStr:">=",ok:n.GTE,fail:n.LT},formatExclusiveMaximum:{okStr:"<",ok:n.LT,fail:n.GTE},formatExclusiveMinimum:{okStr:">",ok:n.GT,fail:n.LTE}},i={message:({keyword:o,schemaCode:c})=>(0,r.str)`should be ${s[o].okStr} ${c}`,params:({keyword:o,schemaCode:c})=>(0,r._)`{comparison: ${s[o].okStr}, limit: ${c}}`};t.formatLimitDefinition={keyword:Object.keys(s),type:"string",schemaType:"string",$data:!0,error:i,code(o){const{gen:c,data:u,schemaCode:l,keyword:p,it:b}=o,{opts:y,self:h}=b;if(!y.validateFormats)return;const v=new e.KeywordCxt(b,h.RULES.all.format.definition,"format");v.$data?f():_();function f(){const m=c.scopeValue("formats",{ref:h.formats,code:y.code.formats}),w=c.const("fmt",(0,r._)`${m}[${v.schemaCode}]`);o.fail$data((0,r.or)((0,r._)`typeof ${w} != "object"`,(0,r._)`${w} instanceof RegExp`,(0,r._)`typeof ${w}.compare != "function"`,d(w)))}function _(){const m=v.schema,w=h.formats[m];if(!w||w===!0)return;if(typeof w!="object"||w instanceof RegExp||typeof w.compare!="function")throw new Error(`"${p}": format "${m}" does not define "compare" function`);const g=c.scopeValue("formats",{key:m,ref:w,code:y.code.formats?(0,r._)`${y.code.formats}${(0,r.getProperty)(m)}`:void 0});o.fail$data(d(g))}function d(m){return(0,r._)`${m}.compare(${u}, ${l}) ${s[p].fail} 0`}},dependencies:["format"]};const a=o=>(o.addKeyword(t.formatLimitDefinition),o);t.default=a})(Ui)),Ui}var Ll;function xg(){return Ll||(Ll=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});const r=qg(),n=Zg(),s=se(),i=new s.Name("fullFormats"),a=new s.Name("fastFormats"),o=(u,l={keywords:!0})=>{if(Array.isArray(l))return c(u,l,r.fullFormats,i),u;const[p,b]=l.mode==="fast"?[r.fastFormats,a]:[r.fullFormats,i],y=l.formats||r.formatNames;return c(u,y,p,b),l.keywords&&(0,n.default)(u),u};o.get=(u,l="full")=>{const b=(l==="fast"?r.fastFormats:r.fullFormats)[u];if(!b)throw new Error(`Unknown format "${u}"`);return b};function c(u,l,p,b){var y,h;(y=(h=u.opts.code).formats)!==null&&y!==void 0||(h.formats=(0,s._)`require("ajv-formats/dist/formats").${b}`);for(const v of l)u.addFormat(v,p[v])}t.exports=e=o,Object.defineProperty(e,"__esModule",{value:!0}),e.default=o})(fs,fs.exports)),fs.exports}var Lg=xg();const Ug=Ft(Lg);function Dg(){const t=new Fo.Ajv({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return Ug(t),t}class Ul{constructor(e){this._ajv=e??Dg()}getValidator(e){var r;const n="$id"in e&&typeof e.$id=="string"?(r=this._ajv.getSchema(e.$id))!==null&&r!==void 0?r:this._ajv.compile(e):this._ajv.compile(e);return s=>n(s)?{valid:!0,data:s,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(n.errors)}}}function hs(t,e){if(!(!t||e===null||typeof e!="object")){if(t.type==="object"&&t.properties&&typeof t.properties=="object"){const r=e,n=t.properties;for(const s of Object.keys(n)){const i=n[s];r[s]===void 0&&Object.prototype.hasOwnProperty.call(i,"default")&&(r[s]=i.default),r[s]!==void 0&&hs(i,r[s])}}if(Array.isArray(t.anyOf))for(const r of t.anyOf)hs(r,e);if(Array.isArray(t.oneOf))for(const r of t.oneOf)hs(r,e)}}function Dl(t){if(!t)return{supportsFormMode:!1,supportsUrlMode:!1};const e=t.form!==void 0,r=t.url!==void 0;return{supportsFormMode:e||!e&&!r,supportsUrlMode:r}}class Vg extends Zi{constructor(e,r){var n,s;super(r),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._capabilities=(n=r?.capabilities)!==null&&n!==void 0?n:{},this._jsonSchemaValidator=(s=r?.jsonSchemaValidator)!==null&&s!==void 0?s:new Ul}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=xi(this._capabilities,e)}setRequestHandler(e,r){var n,s,i;const a=Nr(e),o=a?.method;if(!o)throw new Error("Schema is missing a method literal");let c;if(ct(o)){const l=o,p=(n=l._zod)===null||n===void 0?void 0:n.def;c=(s=p?.value)!==null&&s!==void 0?s:l.value}else{const l=o,p=l._def;c=(i=p?.value)!==null&&i!==void 0?i:l.value}if(typeof c!="string")throw new Error("Schema method literal must be a string");if(c==="elicitation/create"){const l=async(p,b)=>{var y,h,v;const f=ls($i,p);if(!f.success){const Z=f.error instanceof Error?f.error.message:String(f.error);throw new le(E.ErrorCode.InvalidParams,`Invalid elicitation request: ${Z}`)}const{params:_}=f.data,d=(y=_.mode)!==null&&y!==void 0?y:"form",{supportsFormMode:m,supportsUrlMode:w}=Dl(this._capabilities.elicitation);if(d==="form"&&!m)throw new le(E.ErrorCode.InvalidParams,"Client does not support form-mode elicitation requests");if(d==="url"&&!w)throw new le(E.ErrorCode.InvalidParams,"Client does not support URL-mode elicitation requests");const g=await Promise.resolve(r(p,b)),$=ls(Rr,g);if(!$.success){const Z=$.error instanceof Error?$.error.message:String($.error);throw new le(E.ErrorCode.InvalidParams,`Invalid elicitation result: ${Z}`)}const k=$.data,N=d==="form"?_.requestedSchema:void 0;if(d==="form"&&k.action==="accept"&&k.content&&N&&!((v=(h=this._capabilities.elicitation)===null||h===void 0?void 0:h.form)===null||v===void 0)&&v.applyDefaults)try{hs(N,k.content)}catch{}return k};return super.setRequestHandler(e,l)}return super.setRequestHandler(e,r)}assertCapability(e,r){var n;if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n[e]))throw new Error(`Server does not support ${e} (required for ${r})`)}async connect(e,r){if(await super.connect(e),e.sessionId===void 0)try{const n=await this.request({method:"initialize",params:{protocolVersion:xt,capabilities:this._capabilities,clientInfo:this._clientInfo}},si,r);if(n===void 0)throw new Error(`Server sent invalid initialize result: ${n}`);if(!Bs.includes(n.protocolVersion))throw new Error(`Server's protocol version is not supported: ${n.protocolVersion}`);this._serverCapabilities=n.capabilities,this._serverVersion=n.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(n.protocolVersion),this._instructions=n.instructions,await this.notification({method:"notifications/initialized"})}catch(n){throw this.close(),n}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){var r,n,s,i,a;switch(e){case"logging/setLevel":if(!(!((r=this._serverCapabilities)===null||r===void 0)&&r.logging))throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n.prompts))throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!(!((s=this._serverCapabilities)===null||s===void 0)&&s.resources))throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!(!((i=this._serverCapabilities)===null||i===void 0)&&i.tools))throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!(!((a=this._serverCapabilities)===null||a===void 0)&&a.completions))throw new Error(`Server does not support completions (required for ${e})`);break}}assertNotificationCapability(e){var r;switch(e){case"notifications/roots/list_changed":if(!(!((r=this._capabilities.roots)===null||r===void 0)&&r.listChanged))throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break}}async ping(e){return this.request({method:"ping"},Pt,e)}async complete(e,r){return this.request({method:"completion/complete",params:e},ki,r)}async setLoggingLevel(e,r){return this.request({method:"logging/setLevel",params:{level:e}},Pt,r)}async getPrompt(e,r){return this.request({method:"prompts/get",params:e},gi,r)}async listPrompts(e,r){return this.request({method:"prompts/list",params:e},hi,r)}async listResources(e,r){return this.request({method:"resources/list",params:e},li,r)}async listResourceTemplates(e,r){return this.request({method:"resources/templates/list",params:e},di,r)}async readResource(e,r){return this.request({method:"resources/read",params:e},fi,r)}async subscribeResource(e,r){return this.request({method:"resources/subscribe",params:e},Pt,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},Pt,r)}async callTool(e,r=ts,n){const s=await this.request({method:"tools/call",params:e},r,n),i=this.getToolOutputValidator(e.name);if(i){if(!s.structuredContent&&!s.isError)throw new le(E.ErrorCode.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(s.structuredContent)try{const a=i(s.structuredContent);if(!a.valid)throw new le(E.ErrorCode.InvalidParams,`Structured content does not match the tool's output schema: ${a.errorMessage}`)}catch(a){throw a instanceof le?a:new le(E.ErrorCode.InvalidParams,`Failed to validate structured content: ${a instanceof Error?a.message:String(a)}`)}}return s}cacheToolOutputSchemas(e){this._cachedToolOutputValidators.clear();for(const r of e)if(r.outputSchema){const n=this._jsonSchemaValidator.getValidator(r.outputSchema);this._cachedToolOutputValidators.set(r.name,n)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,r){const n=await this.request({method:"tools/list",params:e},yi,r);return this.cacheToolOutputSchemas(n.tools),n}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}let Di;Di=globalThis.crypto;async function Fg(t){return(await Di).getRandomValues(new Uint8Array(t))}async function Hg(t){const e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r=Math.pow(2,8)-Math.pow(2,8)%e.length;let n="";for(;n.length<t;){const s=await Fg(t-n.length);for(const i of s)i<r&&(n+=e[i%e.length])}return n}async function Wg(t){return await Hg(t)}async function Kg(t){const e=await(await Di).subtle.digest("SHA-256",new TextEncoder().encode(t));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function Jg(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;const e=await Wg(t),r=await Kg(e);return{code_verifier:e,code_challenge:r}}const Me=dm().superRefine((t,e)=>{if(!URL.canParse(t))return e.addIssue({code:n_.custom,message:"URL must be parseable",fatal:!0}),uf}).refine(t=>{const e=new URL(t);return e.protocol!=="javascript:"&&e.protocol!=="data:"&&e.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),Bg=it({resource:P().url(),authorization_servers:F(Me).optional(),jwks_uri:P().url().optional(),scopes_supported:F(P()).optional(),bearer_methods_supported:F(P()).optional(),resource_signing_alg_values_supported:F(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:Ee().optional(),authorization_details_types_supported:F(P()).optional(),dpop_signing_alg_values_supported:F(P()).optional(),dpop_bound_access_tokens_required:Ee().optional()}),Vi=it({issuer:P(),authorization_endpoint:Me,token_endpoint:Me,registration_endpoint:Me.optional(),scopes_supported:F(P()).optional(),response_types_supported:F(P()),response_modes_supported:F(P()).optional(),grant_types_supported:F(P()).optional(),token_endpoint_auth_methods_supported:F(P()).optional(),token_endpoint_auth_signing_alg_values_supported:F(P()).optional(),service_documentation:Me.optional(),revocation_endpoint:Me.optional(),revocation_endpoint_auth_methods_supported:F(P()).optional(),revocation_endpoint_auth_signing_alg_values_supported:F(P()).optional(),introspection_endpoint:P().optional(),introspection_endpoint_auth_methods_supported:F(P()).optional(),introspection_endpoint_auth_signing_alg_values_supported:F(P()).optional(),code_challenge_methods_supported:F(P()).optional(),client_id_metadata_document_supported:Ee().optional()}),Gg=it({issuer:P(),authorization_endpoint:Me,token_endpoint:Me,userinfo_endpoint:Me.optional(),jwks_uri:Me,registration_endpoint:Me.optional(),scopes_supported:F(P()).optional(),response_types_supported:F(P()),response_modes_supported:F(P()).optional(),grant_types_supported:F(P()).optional(),acr_values_supported:F(P()).optional(),subject_types_supported:F(P()),id_token_signing_alg_values_supported:F(P()),id_token_encryption_alg_values_supported:F(P()).optional(),id_token_encryption_enc_values_supported:F(P()).optional(),userinfo_signing_alg_values_supported:F(P()).optional(),userinfo_encryption_alg_values_supported:F(P()).optional(),userinfo_encryption_enc_values_supported:F(P()).optional(),request_object_signing_alg_values_supported:F(P()).optional(),request_object_encryption_alg_values_supported:F(P()).optional(),request_object_encryption_enc_values_supported:F(P()).optional(),token_endpoint_auth_methods_supported:F(P()).optional(),token_endpoint_auth_signing_alg_values_supported:F(P()).optional(),display_values_supported:F(P()).optional(),claim_types_supported:F(P()).optional(),claims_supported:F(P()).optional(),service_documentation:P().optional(),claims_locales_supported:F(P()).optional(),ui_locales_supported:F(P()).optional(),claims_parameter_supported:Ee().optional(),request_parameter_supported:Ee().optional(),request_uri_parameter_supported:Ee().optional(),require_request_uri_registration:Ee().optional(),op_policy_uri:Me.optional(),op_tos_uri:Me.optional(),client_id_metadata_document_supported:Ee().optional()}),Yg=W({...Gg.shape,...Vi.pick({code_challenge_methods_supported:!0}).shape}),Vl=W({access_token:P(),id_token:P().optional(),token_type:P(),expires_in:ke().optional(),scope:P().optional(),refresh_token:P().optional()}).strip(),Xg=W({error:P(),error_description:P().optional(),error_uri:P().optional()}),Fl=Me.optional().or(re("").transform(()=>{})),Qg=W({redirect_uris:F(Me),token_endpoint_auth_method:P().optional(),grant_types:F(P()).optional(),response_types:F(P()).optional(),client_name:P().optional(),client_uri:Me.optional(),logo_uri:Fl,scope:P().optional(),contacts:F(P()).optional(),tos_uri:Fl,policy_uri:P().optional(),jwks_uri:Me.optional(),jwks:Om().optional(),software_id:P().optional(),software_version:P().optional(),software_statement:P().optional()}).strip(),ev=W({client_id:P(),client_secret:P().optional(),client_id_issued_at:ke().optional(),client_secret_expires_at:ke().optional()}).strip(),tv=Qg.merge(ev);W({error:P(),error_description:P().optional()}).strip(),W({token:P(),token_type_hint:P().optional()}).strip();function rv(t){const e=typeof t=="string"?new URL(t):new URL(t.href);return e.hash="",e}function nv({requestedResource:t,configuredResource:e}){const r=typeof t=="string"?new URL(t):new URL(t.href),n=typeof e=="string"?new URL(e):new URL(e.href);if(r.origin!==n.origin||r.pathname.length<n.pathname.length)return!1;const s=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",i=n.pathname.endsWith("/")?n.pathname:n.pathname+"/";return s.startsWith(i)}class qe extends Error{constructor(e,r){super(e),this.errorUri=r,this.name=this.constructor.name}toResponseObject(){const e={error:this.errorCode,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}get errorCode(){return this.constructor.errorCode}}class Fi extends qe{}Fi.errorCode="invalid_request";class ps extends qe{}ps.errorCode="invalid_client";class ms extends qe{}ms.errorCode="invalid_grant";class _s extends qe{}_s.errorCode="unauthorized_client";class Hi extends qe{}Hi.errorCode="unsupported_grant_type";class Wi extends qe{}Wi.errorCode="invalid_scope";class Ki extends qe{}Ki.errorCode="access_denied";class er extends qe{}er.errorCode="server_error";class Ji extends qe{}Ji.errorCode="temporarily_unavailable";class Bi extends qe{}Bi.errorCode="unsupported_response_type";class Gi extends qe{}Gi.errorCode="unsupported_token_type";class Yi extends qe{}Yi.errorCode="invalid_token";class Xi extends qe{}Xi.errorCode="method_not_allowed";class Qi extends qe{}Qi.errorCode="too_many_requests";class gs extends qe{}gs.errorCode="invalid_client_metadata";class ea extends qe{}ea.errorCode="insufficient_scope";const sv={[Fi.errorCode]:Fi,[ps.errorCode]:ps,[ms.errorCode]:ms,[_s.errorCode]:_s,[Hi.errorCode]:Hi,[Wi.errorCode]:Wi,[Ki.errorCode]:Ki,[er.errorCode]:er,[Ji.errorCode]:Ji,[Bi.errorCode]:Bi,[Gi.errorCode]:Gi,[Yi.errorCode]:Yi,[Xi.errorCode]:Xi,[Qi.errorCode]:Qi,[gs.errorCode]:gs,[ea.errorCode]:ea};class tt extends Error{constructor(e){super(e??"Unauthorized")}}function iv(t){return["client_secret_basic","client_secret_post","none"].includes(t)}const ta="code",ra="S256";function na(t,e){const r=t.client_secret!==void 0;return e.length===0?r?"client_secret_post":"none":"token_endpoint_auth_method"in t&&t.token_endpoint_auth_method&&iv(t.token_endpoint_auth_method)&&e.includes(t.token_endpoint_auth_method)?t.token_endpoint_auth_method:r&&e.includes("client_secret_basic")?"client_secret_basic":r&&e.includes("client_secret_post")?"client_secret_post":e.includes("none")?"none":r?"client_secret_post":"none"}function Hl(t,e,r,n){const{client_id:s,client_secret:i}=e;switch(t){case"client_secret_basic":av(s,i,r);return;case"client_secret_post":ov(s,i,n);return;case"none":cv(s,n);return;default:throw new Error(`Unsupported client authentication method: ${t}`)}}function av(t,e,r){if(!e)throw new Error("client_secret_basic authentication requires a client_secret");const n=btoa(`${t}:${e}`);r.set("Authorization",`Basic ${n}`)}function ov(t,e,r){r.set("client_id",t),e&&r.set("client_secret",e)}function cv(t,e){e.set("client_id",t)}async function vs(t){const e=t instanceof Response?t.status:void 0,r=t instanceof Response?await t.text():t;try{const n=Xg.parse(JSON.parse(r)),{error:s,error_description:i,error_uri:a}=n,o=sv[s]||er;return new o(i||"",a)}catch(n){const s=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${n}. Raw body: ${r}`;return new er(s)}}async function Nt(t,e){var r,n;try{return await sa(t,e)}catch(s){if(s instanceof ps||s instanceof _s)return await((r=t.invalidateCredentials)===null||r===void 0?void 0:r.call(t,"all")),await sa(t,e);if(s instanceof ms)return await((n=t.invalidateCredentials)===null||n===void 0?void 0:n.call(t,"tokens")),await sa(t,e);throw s}}async function sa(t,{serverUrl:e,authorizationCode:r,scope:n,resourceMetadataUrl:s,fetchFn:i}){var a,o;let c,u;try{c=await Jl(e,{resourceMetadataUrl:s},i),c.authorization_servers&&c.authorization_servers.length>0&&(u=c.authorization_servers[0])}catch{}u||(u=new URL("/",e));const l=await Kl(e,t,c),p=await Xl(u,{fetchFn:i});let b=await Promise.resolve(t.clientInformation());if(!b){if(r!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");const _=p?.client_id_metadata_document_supported===!0,d=t.clientMetadataUrl;if(d&&!Wl(d))throw new gs(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${d}`);if(_&&d)b={client_id:d},await((a=t.saveClientInformation)===null||a===void 0?void 0:a.call(t,b));else{if(!t.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");const w=await rd(u,{metadata:p,clientMetadata:t.clientMetadata,fetchFn:i});await t.saveClientInformation(w),b=w}}if(r!==void 0){const _=await t.codeVerifier(),d=await ed(u,{metadata:p,clientInformation:b,authorizationCode:r,codeVerifier:_,redirectUri:t.redirectUrl,resource:l,addClientAuthentication:t.addClientAuthentication,fetchFn:i});return await t.saveTokens(d),"AUTHORIZED"}const y=await t.tokens();if(y?.refresh_token)try{const _=await td(u,{metadata:p,clientInformation:b,refreshToken:y.refresh_token,resource:l,addClientAuthentication:t.addClientAuthentication,fetchFn:i});return await t.saveTokens(_),"AUTHORIZED"}catch(_){if(!(!(_ instanceof qe)||_ instanceof er))throw _}const h=t.state?await t.state():void 0,{authorizationUrl:v,codeVerifier:f}=await Ql(u,{metadata:p,clientInformation:b,state:h,redirectUrl:t.redirectUrl,scope:n||((o=c?.scopes_supported)===null||o===void 0?void 0:o.join(" "))||t.clientMetadata.scope,resource:l});return await t.saveCodeVerifier(f),await t.redirectToAuthorization(v),"REDIRECT"}function Wl(t){if(!t)return!1;try{const e=new URL(t);return e.protocol==="https:"&&e.pathname!=="/"}catch{return!1}}async function Kl(t,e,r){const n=rv(t);if(e.validateResourceURL)return await e.validateResourceURL(n,r?.resource);if(r){if(!nv({requestedResource:n,configuredResource:r.resource}))throw new Error(`Protected resource ${r.resource} does not match expected ${n} (or origin)`);return new URL(r.resource)}}function jr(t){const e=t.headers.get("WWW-Authenticate");if(!e)return{};const[r,n]=e.split(" ");if(r.toLowerCase()!=="bearer"||!n)return{};const s=ia(t,"resource_metadata")||void 0;let i;if(s)try{i=new URL(s)}catch{}const a=ia(t,"scope")||void 0,o=ia(t,"error")||void 0;return{resourceMetadataUrl:i,scope:a,error:o}}function ia(t,e){const r=t.headers.get("WWW-Authenticate");if(!r)return null;const n=new RegExp(`${e}=(?:"([^"]+)"|([^\\s,]+))`),s=r.match(n);return s?s[1]||s[2]:null}function uv(t){const e=t.headers.get("WWW-Authenticate");if(!e)return;const[r,n]=e.split(" ");if(r.toLowerCase()!=="bearer"||!n)return;const i=/resource_metadata="([^"]*)"/.exec(e);if(i)try{return new URL(i[1])}catch{return}}async function Jl(t,e,r=fetch){const n=await Gl(t,"oauth-protected-resource",r,{protocolVersion:e?.protocolVersion,metadataUrl:e?.resourceMetadataUrl});if(!n||n.status===404)throw new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!n.ok)throw new Error(`HTTP ${n.status} trying to load well-known OAuth protected resource metadata.`);return Bg.parse(await n.json())}async function aa(t,e,r=fetch){try{return await r(t,{headers:e})}catch(n){if(n instanceof TypeError)return e?aa(t,void 0,r):void 0;throw n}}function lv(t,e="",r={}){return e.endsWith("/")&&(e=e.slice(0,-1)),r.prependPathname?`${e}/.well-known/${t}`:`/.well-known/${t}${e}`}async function Bl(t,e,r=fetch){return await aa(t,{"MCP-Protocol-Version":e},r)}function dv(t,e){return!t||t.status>=400&&t.status<500&&e!=="/"}async function Gl(t,e,r,n){var s,i;const a=new URL(t),o=(s=n?.protocolVersion)!==null&&s!==void 0?s:xt;let c;if(n?.metadataUrl)c=new URL(n.metadataUrl);else{const l=lv(e,a.pathname);c=new URL(l,(i=n?.metadataServerUrl)!==null&&i!==void 0?i:a),c.search=a.search}let u=await Bl(c,o,r);if(!n?.metadataUrl&&dv(u,a.pathname)){const l=new URL(`/.well-known/${e}`,a);u=await Bl(l,o,r)}return u}async function fv(t,{authorizationServerUrl:e,protocolVersion:r}={},n=fetch){typeof t=="string"&&(t=new URL(t)),e||(e=t),typeof e=="string"&&(e=new URL(e)),r??(r=xt);const s=await Gl(e,"oauth-authorization-server",n,{protocolVersion:r,metadataServerUrl:e});if(!(!s||s.status===404)){if(!s.ok)throw new Error(`HTTP ${s.status} trying to load well-known OAuth metadata`);return Vi.parse(await s.json())}}function Yl(t){const e=typeof t=="string"?new URL(t):t,r=e.pathname!=="/",n=[];if(!r)return n.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),n.push({url:new URL("/.well-known/openid-configuration",e.origin),type:"oidc"}),n;let s=e.pathname;return s.endsWith("/")&&(s=s.slice(0,-1)),n.push({url:new URL(`/.well-known/oauth-authorization-server${s}`,e.origin),type:"oauth"}),n.push({url:new URL(`/.well-known/openid-configuration${s}`,e.origin),type:"oidc"}),n.push({url:new URL(`${s}/.well-known/openid-configuration`,e.origin),type:"oidc"}),n}async function Xl(t,{fetchFn:e=fetch,protocolVersion:r=xt}={}){const n={"MCP-Protocol-Version":r,Accept:"application/json"},s=Yl(t);for(const{url:i,type:a}of s){const o=await aa(i,n,e);if(o){if(!o.ok){if(o.status>=400&&o.status<500)continue;throw new Error(`HTTP ${o.status} trying to load ${a==="oauth"?"OAuth":"OpenID provider"} metadata from ${i}`)}return a==="oauth"?Vi.parse(await o.json()):Yg.parse(await o.json())}}}async function Ql(t,{metadata:e,clientInformation:r,redirectUrl:n,scope:s,state:i,resource:a}){let o;if(e){if(o=new URL(e.authorization_endpoint),!e.response_types_supported.includes(ta))throw new Error(`Incompatible auth server: does not support response type ${ta}`);if(e.code_challenge_methods_supported&&!e.code_challenge_methods_supported.includes(ra))throw new Error(`Incompatible auth server: does not support code challenge method ${ra}`)}else o=new URL("/authorize",t);const c=await Jg(),u=c.code_verifier,l=c.code_challenge;return o.searchParams.set("response_type",ta),o.searchParams.set("client_id",r.client_id),o.searchParams.set("code_challenge",l),o.searchParams.set("code_challenge_method",ra),o.searchParams.set("redirect_uri",String(n)),i&&o.searchParams.set("state",i),s&&o.searchParams.set("scope",s),s?.includes("offline_access")&&o.searchParams.append("prompt","consent"),a&&o.searchParams.set("resource",a.href),{authorizationUrl:o,codeVerifier:u}}async function ed(t,{metadata:e,clientInformation:r,authorizationCode:n,codeVerifier:s,redirectUri:i,resource:a,addClientAuthentication:o,fetchFn:c}){var u;const l="authorization_code",p=e?.token_endpoint?new URL(e.token_endpoint):new URL("/token",t);if(e?.grant_types_supported&&!e.grant_types_supported.includes(l))throw new Error(`Incompatible auth server: does not support grant type ${l}`);const b=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"}),y=new URLSearchParams({grant_type:l,code:n,code_verifier:s,redirect_uri:String(i)});if(o)o(b,y,t,e);else{const v=(u=e?.token_endpoint_auth_methods_supported)!==null&&u!==void 0?u:[],f=na(r,v);Hl(f,r,b,y)}a&&y.set("resource",a.href);const h=await(c??fetch)(p,{method:"POST",headers:b,body:y});if(!h.ok)throw await vs(h);return Vl.parse(await h.json())}async function td(t,{metadata:e,clientInformation:r,refreshToken:n,resource:s,addClientAuthentication:i,fetchFn:a}){var o;const c="refresh_token";let u;if(e){if(u=new URL(e.token_endpoint),e.grant_types_supported&&!e.grant_types_supported.includes(c))throw new Error(`Incompatible auth server: does not support grant type ${c}`)}else u=new URL("/token",t);const l=new Headers({"Content-Type":"application/x-www-form-urlencoded"}),p=new URLSearchParams({grant_type:c,refresh_token:n});if(i)i(l,p,t,e);else{const y=(o=e?.token_endpoint_auth_methods_supported)!==null&&o!==void 0?o:[],h=na(r,y);Hl(h,r,l,p)}s&&p.set("resource",s.href);const b=await(a??fetch)(u,{method:"POST",headers:l,body:p});if(!b.ok)throw await vs(b);return Vl.parse({refresh_token:n,...await b.json()})}async function rd(t,{metadata:e,clientMetadata:r,fetchFn:n}){let s;if(e){if(!e.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");s=new URL(e.registration_endpoint)}else s=new URL("/register",t);const i=await(n??fetch)(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!i.ok)throw await vs(i);return tv.parse(await i.json())}class nd extends Error{constructor(e,r){super(e),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}}function oa(t){}function sd(t){if(typeof t=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");const{onEvent:e=oa,onError:r=oa,onRetry:n=oa,onComment:s}=t;let i="",a=!0,o,c="",u="";function l(v){const f=a?v.replace(/^\xEF\xBB\xBF/,""):v,[_,d]=hv(`${i}${f}`);for(const m of _)p(m);i=d,a=!1}function p(v){if(v===""){y();return}if(v.startsWith(":")){s&&s(v.slice(v.startsWith(": ")?2:1));return}const f=v.indexOf(":");if(f!==-1){const _=v.slice(0,f),d=v[f+1]===" "?2:1,m=v.slice(f+d);b(_,m,v);return}b(v,"",v)}function b(v,f,_){switch(v){case"event":u=f;break;case"data":c=`${c}${f}
40
+ `;break;case"id":o=f.includes("\0")?void 0:f;break;case"retry":/^\d+$/.test(f)?n(parseInt(f,10)):r(new nd(`Invalid \`retry\` value: "${f}"`,{type:"invalid-retry",value:f,line:_}));break;default:r(new nd(`Unknown field "${v.length>20?`${v.slice(0,20)}…`:v}"`,{type:"unknown-field",field:v,value:f,line:_}));break}}function y(){c.length>0&&e({id:o,event:u||void 0,data:c.endsWith(`
41
+ `)?c.slice(0,-1):c}),o=void 0,c="",u=""}function h(v={}){i&&v.consume&&p(i),a=!0,o=void 0,c="",u="",i=""}return{feed:l,reset:h}}function hv(t){const e=[];let r="",n=0;for(;n<t.length;){const s=t.indexOf("\r",n),i=t.indexOf(`
42
+ `,n);let a=-1;if(s!==-1&&i!==-1?a=Math.min(s,i):s!==-1?s===t.length-1?a=-1:a=s:i!==-1&&(a=i),a===-1){r=t.slice(n);break}else{const o=t.slice(n,a);e.push(o),n=a+1,t[n-1]==="\r"&&t[n]===`
43
+ `&&n++}}return[e,r]}class id extends Event{constructor(e,r){var n,s;super(e),this.code=(n=r?.code)!=null?n:void 0,this.message=(s=r?.message)!=null?s:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,r,n){return n(ad(this),r)}[Symbol.for("Deno.customInspect")](e,r){return e(ad(this),r)}}function pv(t){const e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function ca(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(ca).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${ca(t.cause)}`:t.message:`${t}`}function ad(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}var od=t=>{throw TypeError(t)},ua=(t,e,r)=>e.has(t)||od("Cannot "+r),ue=(t,e,r)=>(ua(t,e,"read from private field"),r?r.call(t):e.get(t)),je=(t,e,r)=>e.has(t)?od("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),Re=(t,e,r,n)=>(ua(t,e,"write to private field"),e.set(t,r),r),wt=(t,e,r)=>(ua(t,e,"access private method"),r),Ke,Vt,tr,ys,bs,zr,rr,Mr,At,nr,sr,ir,qr,dt,la,da,fa,cd,ha,pa,Zr,ma,_a;class ws extends EventTarget{constructor(e,r){var n,s;super(),je(this,dt),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,je(this,Ke),je(this,Vt),je(this,tr),je(this,ys),je(this,bs),je(this,zr),je(this,rr),je(this,Mr,null),je(this,At),je(this,nr),je(this,sr,null),je(this,ir,null),je(this,qr,null),je(this,da,async i=>{var a;ue(this,nr).reset();const{body:o,redirected:c,status:u,headers:l}=i;if(u===204){wt(this,dt,Zr).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(c?Re(this,tr,new URL(i.url)):Re(this,tr,void 0),u!==200){wt(this,dt,Zr).call(this,`Non-200 status code (${u})`,u);return}if(!(l.get("content-type")||"").startsWith("text/event-stream")){wt(this,dt,Zr).call(this,'Invalid content type, expected "text/event-stream"',u);return}if(ue(this,Ke)===this.CLOSED)return;Re(this,Ke,this.OPEN);const p=new Event("open");if((a=ue(this,qr))==null||a.call(this,p),this.dispatchEvent(p),typeof o!="object"||!o||!("getReader"in o)){wt(this,dt,Zr).call(this,"Invalid response body, expected a web ReadableStream",u),this.close();return}const b=new TextDecoder,y=o.getReader();let h=!0;do{const{done:v,value:f}=await y.read();f&&ue(this,nr).feed(b.decode(f,{stream:!v})),v&&(h=!1,ue(this,nr).reset(),wt(this,dt,ma).call(this))}while(h)}),je(this,fa,i=>{Re(this,At,void 0),!(i.name==="AbortError"||i.type==="aborted")&&wt(this,dt,ma).call(this,ca(i))}),je(this,ha,i=>{typeof i.id=="string"&&Re(this,Mr,i.id);const a=new MessageEvent(i.event||"message",{data:i.data,origin:ue(this,tr)?ue(this,tr).origin:ue(this,Vt).origin,lastEventId:i.id||""});ue(this,ir)&&(!i.event||i.event==="message")&&ue(this,ir).call(this,a),this.dispatchEvent(a)}),je(this,pa,i=>{Re(this,zr,i)}),je(this,_a,()=>{Re(this,rr,void 0),ue(this,Ke)===this.CONNECTING&&wt(this,dt,la).call(this)});try{if(e instanceof URL)Re(this,Vt,e);else if(typeof e=="string")Re(this,Vt,new URL(e,mv()));else throw new Error("Invalid URL")}catch{throw pv("An invalid or illegal string was specified")}Re(this,nr,sd({onEvent:ue(this,ha),onRetry:ue(this,pa)})),Re(this,Ke,this.CONNECTING),Re(this,zr,3e3),Re(this,bs,(n=r?.fetch)!=null?n:globalThis.fetch),Re(this,ys,(s=r?.withCredentials)!=null?s:!1),wt(this,dt,la).call(this)}get readyState(){return ue(this,Ke)}get url(){return ue(this,Vt).href}get withCredentials(){return ue(this,ys)}get onerror(){return ue(this,sr)}set onerror(e){Re(this,sr,e)}get onmessage(){return ue(this,ir)}set onmessage(e){Re(this,ir,e)}get onopen(){return ue(this,qr)}set onopen(e){Re(this,qr,e)}addEventListener(e,r,n){const s=r;super.addEventListener(e,s,n)}removeEventListener(e,r,n){const s=r;super.removeEventListener(e,s,n)}close(){ue(this,rr)&&clearTimeout(ue(this,rr)),ue(this,Ke)!==this.CLOSED&&(ue(this,At)&&ue(this,At).abort(),Re(this,Ke,this.CLOSED),Re(this,At,void 0))}}Ke=new WeakMap,Vt=new WeakMap,tr=new WeakMap,ys=new WeakMap,bs=new WeakMap,zr=new WeakMap,rr=new WeakMap,Mr=new WeakMap,At=new WeakMap,nr=new WeakMap,sr=new WeakMap,ir=new WeakMap,qr=new WeakMap,dt=new WeakSet,la=function(){Re(this,Ke,this.CONNECTING),Re(this,At,new AbortController),ue(this,bs)(ue(this,Vt),wt(this,dt,cd).call(this)).then(ue(this,da)).catch(ue(this,fa))},da=new WeakMap,fa=new WeakMap,cd=function(){var t;const e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...ue(this,Mr)?{"Last-Event-ID":ue(this,Mr)}:void 0},cache:"no-store",signal:(t=ue(this,At))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},ha=new WeakMap,pa=new WeakMap,Zr=function(t,e){var r;ue(this,Ke)!==this.CLOSED&&Re(this,Ke,this.CLOSED);const n=new id("error",{code:e,message:t});(r=ue(this,sr))==null||r.call(this,n),this.dispatchEvent(n)},ma=function(t,e){var r;if(ue(this,Ke)===this.CLOSED)return;Re(this,Ke,this.CONNECTING);const n=new id("error",{code:e,message:t});(r=ue(this,sr))==null||r.call(this,n),this.dispatchEvent(n),Re(this,rr,setTimeout(ue(this,_a),ue(this,zr)))},_a=new WeakMap,ws.CONNECTING=0,ws.OPEN=1,ws.CLOSED=2;function mv(){const t="document"in globalThis?globalThis.document:void 0;return t&&typeof t=="object"&&"baseURI"in t&&typeof t.baseURI=="string"?t.baseURI:void 0}function $s(t){return t?t instanceof Headers?Object.fromEntries(t.entries()):Array.isArray(t)?Object.fromEntries(t):{...t}:{}}function ga(t=fetch,e){return e?async(r,n)=>{const s={...e,...n,headers:n?.headers?{...$s(e.headers),...$s(n.headers)}:e.headers};return t(r,s)}:t}class ud extends Error{constructor(e,r,n){super(`SSE error: ${r}`),this.code=e,this.event=n}}class _v{constructor(e,r){this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._eventSourceInit=r?.eventSourceInit,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch,this._fetchWithInit=ga(r?.fetch,r?.requestInit)}async _authThenStart(){var e;if(!this._authProvider)throw new tt("No auth provider");let r;try{r=await Nt(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(n){throw(e=this.onerror)===null||e===void 0||e.call(this,n),n}if(r!=="AUTHORIZED")throw new tt;return await this._startOrAuth()}async _commonHeaders(){var e;const r={};if(this._authProvider){const n=await this._authProvider.tokens();n&&(r.Authorization=`Bearer ${n.access_token}`)}return this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion),new Headers({...r,...(e=this._requestInit)===null||e===void 0?void 0:e.headers})}_startOrAuth(){var e,r,n;const s=(n=(r=(e=this===null||this===void 0?void 0:this._eventSourceInit)===null||e===void 0?void 0:e.fetch)!==null&&r!==void 0?r:this._fetch)!==null&&n!==void 0?n:fetch;return new Promise((i,a)=>{this._eventSource=new ws(this._url.href,{...this._eventSourceInit,fetch:async(o,c)=>{const u=await this._commonHeaders();u.set("Accept","text/event-stream");const l=await s(o,{...c,headers:u});if(l.status===401&&l.headers.has("www-authenticate")){const{resourceMetadataUrl:p,scope:b}=jr(l);this._resourceMetadataUrl=p,this._scope=b}return l}}),this._abortController=new AbortController,this._eventSource.onerror=o=>{var c;if(o.code===401&&this._authProvider){this._authThenStart().then(i,a);return}const u=new ud(o.code,o.message,o);a(u),(c=this.onerror)===null||c===void 0||c.call(this,u)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",o=>{var c;const u=o;try{if(this._endpoint=new URL(u.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(l){a(l),(c=this.onerror)===null||c===void 0||c.call(this,l),this.close();return}i()}),this._eventSource.onmessage=o=>{var c,u;const l=o;let p;try{p=wr.parse(JSON.parse(l.data))}catch(b){(c=this.onerror)===null||c===void 0||c.call(this,b);return}(u=this.onmessage)===null||u===void 0||u.call(this,p)}})}async start(){if(this._eventSource)throw new Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");return await this._startOrAuth()}async finishAuth(e){if(!this._authProvider)throw new tt("No auth provider");if(await Nt(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new tt("Failed to authorize")}async close(){var e,r,n;(e=this._abortController)===null||e===void 0||e.abort(),(r=this._eventSource)===null||r===void 0||r.close(),(n=this.onclose)===null||n===void 0||n.call(this)}async send(e){var r,n,s;if(!this._endpoint)throw new Error("Not connected");try{const i=await this._commonHeaders();i.set("content-type","application/json");const a={...this._requestInit,method:"POST",headers:i,body:JSON.stringify(e),signal:(r=this._abortController)===null||r===void 0?void 0:r.signal},o=await((n=this._fetch)!==null&&n!==void 0?n:fetch)(this._endpoint,a);if(!o.ok){if(o.status===401&&this._authProvider){const{resourceMetadataUrl:u,scope:l}=jr(o);if(this._resourceMetadataUrl=u,this._scope=l,await Nt(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new tt;return this.send(e)}const c=await o.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${o.status}): ${c}`)}}catch(i){throw(s=this.onerror)===null||s===void 0||s.call(this,i),i}}setProtocolVersion(e){this._protocolVersion=e}}class gv extends TransformStream{constructor({onError:e,onRetry:r,onComment:n}={}){let s;super({start(i){s=sd({onEvent:a=>{i.enqueue(a)},onError(a){e==="terminate"?i.error(a):typeof e=="function"&&e(a)},onRetry:r,onComment:n})},transform(i){s.feed(i)}})}}const vv={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2};class ar extends Error{constructor(e,r){super(`Streamable HTTP error: ${r}`),this.code=e}}class yv{constructor(e,r){var n;this._hasCompletedAuthFlow=!1,this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch,this._fetchWithInit=ga(r?.fetch,r?.requestInit),this._sessionId=r?.sessionId,this._reconnectionOptions=(n=r?.reconnectionOptions)!==null&&n!==void 0?n:vv}async _authThenStart(){var e;if(!this._authProvider)throw new tt("No auth provider");let r;try{r=await Nt(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(n){throw(e=this.onerror)===null||e===void 0||e.call(this,n),n}if(r!=="AUTHORIZED")throw new tt;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){var e;const r={};if(this._authProvider){const s=await this._authProvider.tokens();s&&(r.Authorization=`Bearer ${s.access_token}`)}this._sessionId&&(r["mcp-session-id"]=this._sessionId),this._protocolVersion&&(r["mcp-protocol-version"]=this._protocolVersion);const n=$s((e=this._requestInit)===null||e===void 0?void 0:e.headers);return new Headers({...r,...n})}async _startOrAuthSse(e){var r,n,s;const{resumptionToken:i}=e;try{const a=await this._commonHeaders();a.set("Accept","text/event-stream"),i&&a.set("last-event-id",i);const o=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,{method:"GET",headers:a,signal:(n=this._abortController)===null||n===void 0?void 0:n.signal});if(!o.ok){if(o.status===401&&this._authProvider)return await this._authThenStart();if(o.status===405)return;throw new ar(o.status,`Failed to open SSE stream: ${o.statusText}`)}this._handleSseStream(o.body,e,!0)}catch(a){throw(s=this.onerror)===null||s===void 0||s.call(this,a),a}}_getNextReconnectionDelay(e){if(this._serverRetryMs!==void 0)return this._serverRetryMs;const r=this._reconnectionOptions.initialReconnectionDelay,n=this._reconnectionOptions.reconnectionDelayGrowFactor,s=this._reconnectionOptions.maxReconnectionDelay;return Math.min(r*Math.pow(n,e),s)}_scheduleReconnection(e,r=0){var n;const s=this._reconnectionOptions.maxRetries;if(s>0&&r>=s){(n=this.onerror)===null||n===void 0||n.call(this,new Error(`Maximum reconnection attempts (${s}) exceeded.`));return}const i=this._getNextReconnectionDelay(r);setTimeout(()=>{this._startOrAuthSse(e).catch(a=>{var o;(o=this.onerror)===null||o===void 0||o.call(this,new Error(`Failed to reconnect SSE stream: ${a instanceof Error?a.message:String(a)}`)),this._scheduleReconnection(e,r+1)})},i)}_handleSseStream(e,r,n){if(!e)return;const{onresumptiontoken:s,replayMessageId:i}=r;let a,o=!1;(async()=>{var u,l,p,b;try{const y=e.pipeThrough(new TextDecoderStream).pipeThrough(new gv({onRetry:v=>{this._serverRetryMs=v}})).getReader();for(;;){const{value:v,done:f}=await y.read();if(f)break;if(v.id&&(a=v.id,o=!0,s?.(v.id)),!v.event||v.event==="message")try{const _=wr.parse(JSON.parse(v.data));i!==void 0&&Un(_)&&(_.id=i),(u=this.onmessage)===null||u===void 0||u.call(this,_)}catch(_){(l=this.onerror)===null||l===void 0||l.call(this,_)}}(n||o)&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:a,onresumptiontoken:s,replayMessageId:i},0)}catch(y){if((p=this.onerror)===null||p===void 0||p.call(this,new Error(`SSE stream disconnected: ${y}`)),(n||o)&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:a,onresumptiontoken:s,replayMessageId:i},0)}catch(v){(b=this.onerror)===null||b===void 0||b.call(this,new Error(`Failed to reconnect: ${v instanceof Error?v.message:String(v)}`))}}})()}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(e){if(!this._authProvider)throw new tt("No auth provider");if(await Nt(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new tt("Failed to authorize")}async close(){var e,r;(e=this._abortController)===null||e===void 0||e.abort(),(r=this.onclose)===null||r===void 0||r.call(this)}async send(e,r){var n,s,i,a;try{const{resumptionToken:o,onresumptiontoken:c}=r||{};if(o){this._startOrAuthSse({resumptionToken:o,replayMessageId:Qs(e)?e.id:void 0}).catch(f=>{var _;return(_=this.onerror)===null||_===void 0?void 0:_.call(this,f)});return}const u=await this._commonHeaders();u.set("content-type","application/json"),u.set("accept","application/json, text/event-stream");const l={...this._requestInit,method:"POST",headers:u,body:JSON.stringify(e),signal:(n=this._abortController)===null||n===void 0?void 0:n.signal},p=await((s=this._fetch)!==null&&s!==void 0?s:fetch)(this._url,l),b=p.headers.get("mcp-session-id");if(b&&(this._sessionId=b),!p.ok){if(p.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new ar(401,"Server returned 401 after successful authentication");const{resourceMetadataUrl:_,scope:d}=jr(p);if(this._resourceMetadataUrl=_,this._scope=d,await Nt(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new tt;return this._hasCompletedAuthFlow=!0,this.send(e)}if(p.status===403&&this._authProvider){const{resourceMetadataUrl:_,scope:d,error:m}=jr(p);if(m==="insufficient_scope"){const w=p.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===w)throw new ar(403,"Server returned 403 after trying upscoping");if(d&&(this._scope=d),_&&(this._resourceMetadataUrl=_),this._lastUpscopingHeader=w??void 0,await Nt(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new tt;return this.send(e)}}const f=await p.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${p.status}): ${f}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,p.status===202){Jc(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(f=>{var _;return(_=this.onerror)===null||_===void 0?void 0:_.call(this,f)});return}const h=(Array.isArray(e)?e:[e]).filter(f=>"method"in f&&"id"in f&&f.id!==void 0).length>0,v=p.headers.get("content-type");if(h)if(v?.includes("text/event-stream"))this._handleSseStream(p.body,{onresumptiontoken:c},!1);else if(v?.includes("application/json")){const f=await p.json(),_=Array.isArray(f)?f.map(d=>wr.parse(d)):[wr.parse(f)];for(const d of _)(i=this.onmessage)===null||i===void 0||i.call(this,d)}else throw new ar(-1,`Unexpected content type: ${v}`)}catch(o){throw(a=this.onerror)===null||a===void 0||a.call(this,o),o}}get sessionId(){return this._sessionId}async terminateSession(){var e,r,n;if(this._sessionId)try{const s=await this._commonHeaders(),i={...this._requestInit,method:"DELETE",headers:s,signal:(e=this._abortController)===null||e===void 0?void 0:e.signal},a=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,i);if(!a.ok&&a.status!==405)throw new ar(a.status,`Failed to terminate session: ${a.statusText}`);this._sessionId=void 0}catch(s){throw(n=this.onerror)===null||n===void 0||n.call(this,s),s}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}async resumeStream(e,r){await this._startOrAuthSse({resumptionToken:e,onresumptiontoken:r?.onresumptiontoken})}}class bv extends Zi{constructor(e,r){var n,s;super(r),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(kr.options.map((i,a)=>[i,a])),this.isMessageIgnored=(i,a)=>{const o=this._loggingLevels.get(a);return o?this.LOG_LEVEL_SEVERITY.get(i)<this.LOG_LEVEL_SEVERITY.get(o):!1},this._capabilities=(n=r?.capabilities)!==null&&n!==void 0?n:{},this._instructions=r?.instructions,this._jsonSchemaValidator=(s=r?.jsonSchemaValidator)!==null&&s!==void 0?s:new Ul,this.setRequestHandler(Vn,i=>this._oninitialize(i)),this.setNotificationHandler(Fn,()=>{var i;return(i=this.oninitialized)===null||i===void 0?void 0:i.call(this)}),this._capabilities.logging&&this.setRequestHandler(bi,async(i,a)=>{var o;const c=a.sessionId||((o=a.requestInfo)===null||o===void 0?void 0:o.headers["mcp-session-id"])||void 0,{level:u}=i.params,l=kr.safeParse(u);return l.success&&this._loggingLevels.set(c,l.data),{}})}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=xi(this._capabilities,e)}assertCapabilityForMethod(e){var r,n,s;switch(e){case"sampling/createMessage":if(!(!((r=this._clientCapabilities)===null||r===void 0)&&r.sampling))throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!(!((n=this._clientCapabilities)===null||n===void 0)&&n.elicitation))throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!(!((s=this._clientCapabilities)===null||s===void 0)&&s.roots))throw new Error(`Client does not support listing roots (required for ${e})`);break}}assertNotificationCapability(e){var r,n;switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!(!((n=(r=this._clientCapabilities)===null||r===void 0?void 0:r.elicitation)===null||n===void 0)&&n.url))throw new Error(`Client does not support URL elicitation (required for ${e})`);break}}assertRequestHandlerCapability(e){switch(e){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break}}async _oninitialize(e){const r=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:Bs.includes(r)?r:xt,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},Pt)}async createMessage(e,r){var n,s;if((e.tools||e.toolChoice)&&!(!((s=(n=this._clientCapabilities)===null||n===void 0?void 0:n.sampling)===null||s===void 0)&&s.tools))throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){const i=e.messages[e.messages.length-1],a=Array.isArray(i.content)?i.content:[i.content],o=a.some(p=>p.type==="tool_result"),c=e.messages.length>1?e.messages[e.messages.length-2]:void 0,u=c?Array.isArray(c.content)?c.content:[c.content]:[],l=u.some(p=>p.type==="tool_use");if(o){if(a.some(p=>p.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!l)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(l){const p=new Set(u.filter(y=>y.type==="tool_use").map(y=>y.id)),b=new Set(a.filter(y=>y.type==="tool_result").map(y=>y.toolUseId));if(p.size!==b.size||![...p].every(y=>b.has(y)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.request({method:"sampling/createMessage",params:e},wi,r)}async elicitInput(e,r){var n,s,i,a,o;switch((n=e.mode)!==null&&n!==void 0?n:"form"){case"url":{if(!(!((i=(s=this._clientCapabilities)===null||s===void 0?void 0:s.elicitation)===null||i===void 0)&&i.url))throw new Error("Client does not support url elicitation.");const u=e;return this.request({method:"elicitation/create",params:u},Rr,r)}case"form":{if(!(!((o=(a=this._clientCapabilities)===null||a===void 0?void 0:a.elicitation)===null||o===void 0)&&o.form))throw new Error("Client does not support form elicitation.");const u=e.mode==="form"?e:{...e,mode:"form"},l=await this.request({method:"elicitation/create",params:u},Rr,r);if(l.action==="accept"&&l.content&&u.requestedSchema)try{const b=this._jsonSchemaValidator.getValidator(u.requestedSchema)(l.content);if(!b.valid)throw new le(E.ErrorCode.InvalidParams,`Elicitation response content does not match requested schema: ${b.errorMessage}`)}catch(p){throw p instanceof le?p:new le(E.ErrorCode.InternalError,`Error validating elicitation response: ${p instanceof Error?p.message:String(p)}`)}return l}}}createElicitationCompletionNotifier(e,r){var n,s;if(!(!((s=(n=this._clientCapabilities)===null||n===void 0?void 0:n.elicitation)===null||s===void 0)&&s.url))throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},r)}async listRoots(e,r){return this.request({method:"roots/list",params:e},Ei,r)}async sendLoggingMessage(e,r){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,r))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}const wv=/^[A-Za-z0-9._-]{1,128}$/;function $v(t){const e=[];if(t.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(t.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${t.length})`]};if(t.includes(" ")&&e.push("Tool name contains spaces, which may cause parsing issues"),t.includes(",")&&e.push("Tool name contains commas, which may cause parsing issues"),(t.startsWith("-")||t.endsWith("-"))&&e.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts"),(t.startsWith(".")||t.endsWith("."))&&e.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts"),!wv.test(t)){const r=t.split("").filter(n=>!/[A-Za-z0-9._-]/.test(n)).filter((n,s,i)=>i.indexOf(n)===s);return e.push(`Tool name contains invalid characters: ${r.map(n=>`"${n}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:e}}return{isValid:!0,warnings:e}}function Sv(t,e){if(e.length>0){console.warn(`Tool name validation warning for "${t}":`);for(const r of e)console.warn(` - ${r}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function ld(t){const e=$v(t);return Sv(t,e.warnings),e.isValid}class kv{constructor(e,r){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new bv(e,r)}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(jt(es)),this.server.assertCanSetRequestHandler(jt(rs)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(es,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,r])=>{const n={name:e,title:r.title,description:r.description,inputSchema:(()=>{const s=Ar(r.inputSchema);return s?Al(s,{strictUnions:!0,pipeStrategy:"input"}):Rv})(),annotations:r.annotations,_meta:r._meta};if(r.outputSchema){const s=Ar(r.outputSchema);s&&(n.outputSchema=Al(s,{strictUnions:!0,pipeStrategy:"output"}))}return n})})),this.server.setRequestHandler(rs,async(e,r)=>{const n=this._registeredTools[e.params.name];let s;try{if(!n)throw new le(E.ErrorCode.InvalidParams,`Tool ${e.params.name} not found`);if(!n.enabled)throw new le(E.ErrorCode.InvalidParams,`Tool ${e.params.name} disabled`);if(n.inputSchema){const i=n.callback,a=Ar(n.inputSchema),o=a??n.inputSchema,c=await ji(o,e.params.arguments);if(!c.success)throw new le(E.ErrorCode.InvalidParams,`Input validation error: Invalid arguments for tool ${e.params.name}: ${zi(c.error)}`);const u=c.data;s=await Promise.resolve(i(u,r))}else{const i=n.callback;s=await Promise.resolve(i(r))}if(n.outputSchema&&!s.isError){if(!s.structuredContent)throw new le(E.ErrorCode.InvalidParams,`Output validation error: Tool ${e.params.name} has an output schema but no structured content was provided`);const i=Ar(n.outputSchema),a=await ji(i,s.structuredContent);if(!a.success)throw new le(E.ErrorCode.InvalidParams,`Output validation error: Invalid structured content for tool ${e.params.name}: ${zi(a.error)}`)}}catch(i){if(i instanceof le&&i.code===E.ErrorCode.UrlElicitationRequired)throw i;return this.createToolError(i instanceof Error?i.message:String(i))}return s}),this._toolHandlersInitialized=!0)}createToolError(e){return{content:[{type:"text",text:e}],isError:!0}}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(jt(ns)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(ns,async e=>{switch(e.params.ref.type){case"ref/prompt":return Ku(e),this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return Ju(e),this.handleResourceCompletion(e,e.params.ref);default:throw new le(E.ErrorCode.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(e,r){const n=this._registeredPrompts[r.name];if(!n)throw new le(E.ErrorCode.InvalidParams,`Prompt ${r.name} not found`);if(!n.enabled)throw new le(E.ErrorCode.InvalidParams,`Prompt ${r.name} disabled`);if(!n.argsSchema)return xr;const s=Nr(n.argsSchema),i=s?.[e.params.argument.name];if(!tl(i))return xr;const a=rl(i);if(!a)return xr;const o=await a(e.params.argument.value,e.params.context);return fd(o)}async handleResourceCompletion(e,r){const n=Object.values(this._registeredResourceTemplates).find(a=>a.resourceTemplate.uriTemplate.toString()===r.uri);if(!n){if(this._registeredResources[r.uri])return xr;throw new le(E.ErrorCode.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}const s=n.resourceTemplate.completeCallback(e.params.argument.name);if(!s)return xr;const i=await s(e.params.argument.value,e.params.context);return fd(i)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(jt(Kn)),this.server.assertCanSetRequestHandler(jt(Jn)),this.server.assertCanSetRequestHandler(jt(Gn)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(Kn,async(e,r)=>{const n=Object.entries(this._registeredResources).filter(([i,a])=>a.enabled).map(([i,a])=>({uri:i,name:a.name,...a.metadata})),s=[];for(const i of Object.values(this._registeredResourceTemplates)){if(!i.resourceTemplate.listCallback)continue;const a=await i.resourceTemplate.listCallback(r);for(const o of a.resources)s.push({...i.metadata,...o})}return{resources:[...n,...s]}}),this.server.setRequestHandler(Jn,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([r,n])=>({name:r,uriTemplate:n.resourceTemplate.uriTemplate.toString(),...n.metadata}))})),this.server.setRequestHandler(Gn,async(e,r)=>{const n=new URL(e.params.uri),s=this._registeredResources[n.toString()];if(s){if(!s.enabled)throw new le(E.ErrorCode.InvalidParams,`Resource ${n} disabled`);return s.readCallback(n,r)}for(const i of Object.values(this._registeredResourceTemplates)){const a=i.resourceTemplate.uriTemplate.match(n.toString());if(a)return i.readCallback(n,a,r)}throw new le(E.ErrorCode.InvalidParams,`Resource ${n} not found`)}),this.setCompletionRequestHandler(),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(jt(Yn)),this.server.assertCanSetRequestHandler(jt(Xn)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(Yn,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,r])=>({name:e,title:r.title,description:r.description,arguments:r.argsSchema?Tv(r.argsSchema):void 0}))})),this.server.setRequestHandler(Xn,async(e,r)=>{const n=this._registeredPrompts[e.params.name];if(!n)throw new le(E.ErrorCode.InvalidParams,`Prompt ${e.params.name} not found`);if(!n.enabled)throw new le(E.ErrorCode.InvalidParams,`Prompt ${e.params.name} disabled`);if(n.argsSchema){const s=Ar(n.argsSchema),i=await ji(s,e.params.arguments);if(!i.success)throw new le(E.ErrorCode.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${zi(i.error)}`);const a=i.data,o=n.callback;return await Promise.resolve(o(a,r))}else{const s=n.callback;return await Promise.resolve(s(r))}}),this.setCompletionRequestHandler(),this._promptHandlersInitialized=!0)}resource(e,r,...n){let s;typeof n[0]=="object"&&(s=n.shift());const i=n[0];if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);const a=this._createRegisteredResource(e,void 0,r,s,i);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),a}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);const a=this._createRegisteredResourceTemplate(e,void 0,r,s,i);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),a}}registerResource(e,r,n,s){if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);const i=this._createRegisteredResource(e,n.title,r,n,s);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);const i=this._createRegisteredResourceTemplate(e,n.title,r,n,s);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}}_createRegisteredResource(e,r,n,s,i){const a={name:e,title:r,metadata:s,readCallback:i,enabled:!0,disable:()=>a.update({enabled:!1}),enable:()=>a.update({enabled:!0}),remove:()=>a.update({uri:null}),update:o=>{typeof o.uri<"u"&&o.uri!==n&&(delete this._registeredResources[n],o.uri&&(this._registeredResources[o.uri]=a)),typeof o.name<"u"&&(a.name=o.name),typeof o.title<"u"&&(a.title=o.title),typeof o.metadata<"u"&&(a.metadata=o.metadata),typeof o.callback<"u"&&(a.readCallback=o.callback),typeof o.enabled<"u"&&(a.enabled=o.enabled),this.sendResourceListChanged()}};return this._registeredResources[n]=a,a}_createRegisteredResourceTemplate(e,r,n,s,i){const a={resourceTemplate:n,title:r,metadata:s,readCallback:i,enabled:!0,disable:()=>a.update({enabled:!1}),enable:()=>a.update({enabled:!0}),remove:()=>a.update({name:null}),update:o=>{typeof o.name<"u"&&o.name!==e&&(delete this._registeredResourceTemplates[e],o.name&&(this._registeredResourceTemplates[o.name]=a)),typeof o.title<"u"&&(a.title=o.title),typeof o.template<"u"&&(a.resourceTemplate=o.template),typeof o.metadata<"u"&&(a.metadata=o.metadata),typeof o.callback<"u"&&(a.readCallback=o.callback),typeof o.enabled<"u"&&(a.enabled=o.enabled),this.sendResourceListChanged()}};return this._registeredResourceTemplates[e]=a,a}_createRegisteredPrompt(e,r,n,s,i){const a={title:r,description:n,argsSchema:s===void 0?void 0:Ir(s),callback:i,enabled:!0,disable:()=>a.update({enabled:!1}),enable:()=>a.update({enabled:!0}),remove:()=>a.update({name:null}),update:o=>{typeof o.name<"u"&&o.name!==e&&(delete this._registeredPrompts[e],o.name&&(this._registeredPrompts[o.name]=a)),typeof o.title<"u"&&(a.title=o.title),typeof o.description<"u"&&(a.description=o.description),typeof o.argsSchema<"u"&&(a.argsSchema=Ir(o.argsSchema)),typeof o.callback<"u"&&(a.callback=o.callback),typeof o.enabled<"u"&&(a.enabled=o.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[e]=a,a}_createRegisteredTool(e,r,n,s,i,a,o,c){ld(e);const u={title:r,description:n,inputSchema:dd(s),outputSchema:dd(i),annotations:a,_meta:o,callback:c,enabled:!0,disable:()=>u.update({enabled:!1}),enable:()=>u.update({enabled:!0}),remove:()=>u.update({name:null}),update:l=>{typeof l.name<"u"&&l.name!==e&&(typeof l.name=="string"&&ld(l.name),delete this._registeredTools[e],l.name&&(this._registeredTools[l.name]=u)),typeof l.title<"u"&&(u.title=l.title),typeof l.description<"u"&&(u.description=l.description),typeof l.paramsSchema<"u"&&(u.inputSchema=Ir(l.paramsSchema)),typeof l.callback<"u"&&(u.callback=l.callback),typeof l.annotations<"u"&&(u.annotations=l.annotations),typeof l._meta<"u"&&(u._meta=l._meta),typeof l.enabled<"u"&&(u.enabled=l.enabled),this.sendToolListChanged()}};return this._registeredTools[e]=u,this.setToolRequestHandlers(),this.sendToolListChanged(),u}tool(e,...r){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let n,s,i,a;if(typeof r[0]=="string"&&(n=r.shift()),r.length>1){const c=r[0];va(c)?(s=r.shift(),r.length>1&&typeof r[0]=="object"&&r[0]!==null&&!va(r[0])&&(a=r.shift())):typeof c=="object"&&c!==null&&(a=r.shift())}const o=r[0];return this._createRegisteredTool(e,void 0,n,s,i,a,void 0,o)}registerTool(e,r,n){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);const{title:s,description:i,inputSchema:a,outputSchema:o,annotations:c,_meta:u}=r;return this._createRegisteredTool(e,s,i,a,o,c,u,n)}prompt(e,...r){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let n;typeof r[0]=="string"&&(n=r.shift());let s;r.length>1&&(s=r.shift());const i=r[0],a=this._createRegisteredPrompt(e,void 0,n,s,i);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),a}registerPrompt(e,r,n){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);const{title:s,description:i,argsSchema:a}=r,o=this._createRegisteredPrompt(e,s,i,a,n);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),o}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(e,r){return this.server.sendLoggingMessage(e,r)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}}class Ev{constructor(e,r){this._callbacks=r,this._uriTemplate=typeof e=="string"?new yt(e):e}get uriTemplate(){return this._uriTemplate}get listCallback(){return this._callbacks.list}completeCallback(e){var r;return(r=this._callbacks.complete)===null||r===void 0?void 0:r[e]}}const Rv={type:"object",properties:{}};function va(t){return typeof t!="object"||t===null?!1:Object.keys(t).length===0||Object.values(t).some(Pv)}function Pv(t){return t!==null&&typeof t=="object"&&"parse"in t&&typeof t.parse=="function"&&"safeParse"in t&&typeof t.safeParse=="function"}function dd(t){if(t)return va(t)?Ir(t):t}function Tv(t){const e=Nr(t);return e?Object.entries(e).map(([r,n])=>{const s=G_(n),i=Y_(n);return{name:r,description:s,required:!i}}):[]}function jt(t){const e=Nr(t),r=e?.method;if(!r)throw new Error("Schema is missing a method literal");const n=Sl(r);if(typeof n=="string")return n;throw new Error("Schema method literal must be a string")}function fd(t){return{completion:{values:t.slice(0,100),total:t.length,hasMore:t.length>100}}}const xr={completion:{values:[],hasMore:!1}};E.Ajv=cf,E.AudioContentSchema=_i,E.BaseMetadataSchema=Lt,E.BlobResourceContentsSchema=ci,E.BooleanSchemaSchema=Tu,E.COMPLETABLE_SYMBOL=ss,E.CallToolRequestParamsSchema=_u,E.CallToolRequestSchema=rs,E.CallToolResultSchema=ts,E.CancelledNotificationParamsSchema=Vc,E.CancelledNotificationSchema=Dn,E.Client=Vg,E.ClientCapabilitiesSchema=Hc,E.ClientNotificationSchema=f_,E.ClientRequestSchema=d_,E.ClientResultSchema=h_,E.CompatibilityCallToolResultSchema=u_,E.CompleteRequestParamsSchema=Wu,E.CompleteRequestSchema=ns,E.CompleteResultSchema=ki,E.ContentBlockSchema=Qn,E.CreateMessageRequestParamsSchema=Ru,E.CreateMessageRequestSchema=Pu,E.CreateMessageResultSchema=wi,E.CursorSchema=Ys,E.DEFAULT_NEGOTIATED_PROTOCOL_VERSION=s_,E.DEFAULT_REQUEST_TIMEOUT_MSEC=Ml,E.ElicitRequestFormParamsSchema=Lu,E.ElicitRequestParamsSchema=Du,E.ElicitRequestSchema=$i,E.ElicitRequestURLParamsSchema=Uu,E.ElicitResultSchema=Rr,E.ElicitationCompleteNotificationParamsSchema=Vu,E.ElicitationCompleteNotificationSchema=Fu,E.EmbeddedResourceSchema=du,E.EmptyResultSchema=Pt,E.EnumSchemaSchema=Zu,E.GetPromptRequestParamsSchema=uu,E.GetPromptRequestSchema=Xn,E.GetPromptResultSchema=gi,E.IconSchema=Fc,E.IconsSchema=Jt,E.ImageContentSchema=mi,E.ImplementationSchema=ni,E.InitializeRequestParamsSchema=Wc,E.InitializeRequestSchema=Vn,E.InitializeResultSchema=si,E.InitializedNotificationSchema=Fn,E.JSONRPCErrorSchema=ri,E.JSONRPCMessageSchema=wr,E.JSONRPCNotificationSchema=ei,E.JSONRPCRequestSchema=Xs,E.JSONRPCResponseSchema=ti,E.JSONRPC_VERSION=yr,E.LATEST_PROTOCOL_VERSION=xt,E.LegacyTitledEnumSchemaSchema=Au,E.ListPromptsRequestSchema=Yn,E.ListPromptsResultSchema=hi,E.ListResourceTemplatesRequestSchema=Jn,E.ListResourceTemplatesResultSchema=di,E.ListResourcesRequestSchema=Kn,E.ListResourcesResultSchema=li,E.ListRootsRequestSchema=Gu,E.ListRootsResultSchema=Ei,E.ListToolsRequestSchema=es,E.ListToolsResultSchema=yi,E.LoggingLevelSchema=kr,E.LoggingMessageNotificationParamsSchema=yu,E.LoggingMessageNotificationSchema=bu,E.McpError=le,E.McpServer=kv,E.ModelHintSchema=wu,E.ModelPreferencesSchema=$u,E.MultiSelectEnumSchemaSchema=qu,E.NotificationSchema=Qe,E.NumberSchemaSchema=Ou,E.PaginatedRequestParamsSchema=Yc,E.PaginatedRequestSchema=$r,E.PaginatedResultSchema=Sr,E.PingRequestSchema=Hn,E.PrimitiveSchemaDefinitionSchema=xu,E.ProgressNotificationParamsSchema=Gc,E.ProgressNotificationSchema=Wn,E.ProgressSchema=Bc,E.ProgressTokenSchema=Gs,E.PromptArgumentSchema=ou,E.PromptListChangedNotificationSchema=pu,E.PromptMessageSchema=hu,E.PromptReferenceSchema=Hu,E.PromptSchema=cu,E.Protocol=Zi,E.ReadResourceRequestParamsSchema=Qc,E.ReadResourceRequestSchema=Gn,E.ReadResourceResultSchema=fi,E.RequestIdSchema=br,E.RequestSchema=Ue,E.ResourceContentsSchema=ii,E.ResourceLinkSchema=fu,E.ResourceListChangedNotificationSchema=eu,E.ResourceReferenceSchema=l_,E.ResourceRequestParamsSchema=Bn,E.ResourceSchema=ui,E.ResourceTemplate=Ev,E.ResourceTemplateReferenceSchema=Si,E.ResourceTemplateSchema=Xc,E.ResourceUpdatedNotificationParamsSchema=iu,E.ResourceUpdatedNotificationSchema=au,E.ResultSchema=Ye,E.RootSchema=Bu,E.RootsListChangedNotificationSchema=Yu,E.SSEClientTransport=_v,E.SUPPORTED_PROTOCOL_VERSIONS=Bs,E.SamplingMessageContentBlockSchema=Er,E.SamplingMessageSchema=Eu,E.ServerCapabilitiesSchema=Kc,E.ServerNotificationSchema=m_,E.ServerRequestSchema=p_,E.ServerResultSchema=__,E.SetLevelRequestParamsSchema=vu,E.SetLevelRequestSchema=bi,E.SingleSelectEnumSchemaSchema=ju,E.SseError=ud,E.StreamableHTTPClientTransport=yv,E.StreamableHTTPError=ar,E.StringSchemaSchema=Cu,E.SubscribeRequestParamsSchema=tu,E.SubscribeRequestSchema=ru,E.TextContentSchema=pi,E.TextResourceContentsSchema=ai,E.TitledMultiSelectEnumSchemaSchema=Mu,E.TitledSingleSelectEnumSchemaSchema=Nu,E.ToolAnnotationsSchema=mu,E.ToolChoiceSchema=Su,E.ToolListChangedNotificationSchema=gu,E.ToolResultContentSchema=ku,E.ToolSchema=vi,E.ToolUseContentSchema=lu,E.UnauthorizedError=tt,E.UnsubscribeRequestParamsSchema=nu,E.UnsubscribeRequestSchema=su,E.UntitledMultiSelectEnumSchemaSchema=zu,E.UntitledSingleSelectEnumSchemaSchema=Iu,E.UriTemplate=yt,E.UrlElicitationRequiredError=Xu,E.assertCompleteRequestPrompt=Ku,E.assertCompleteRequestResourceTemplate=Ju,E.auth=Nt,E.buildDiscoveryUrls=Yl,E.completable=v_,E.createFetchWithInit=ga,E.discoverAuthorizationServerMetadata=Xl,E.discoverOAuthMetadata=fv,E.discoverOAuthProtectedResourceMetadata=Jl,E.exchangeAuthorization=ed,E.extractResourceMetadataUrl=uv,E.extractWWWAuthenticateParams=jr,E.getCompleter=rl,E.getDisplayName=b_,E.getSupportedElicitationModes=Dl,E.isCompletable=tl,E.isHttpsUrl=Wl,E.isInitializeRequest=c_,E.isInitializedNotification=Jc,E.isJSONRPCError=Dc,E.isJSONRPCNotification=Uc,E.isJSONRPCRequest=Qs,E.isJSONRPCResponse=Un,E.mergeCapabilities=xi,E.normalizeHeaders=$s,E.parseErrorResponse=vs,E.refreshAuthorization=td,E.registerClient=rd,E.selectClientAuthMethod=na,E.selectResourceURL=Kl,E.startAuthorization=Ql,E.unwrapCompletable=y_,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})}));