@thegitai/cli 1.0.0-preview.54 → 1.0.0-preview.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +102 -0
- package/dist/bin/ai.js +5 -0
- package/dist/src/api/chat.js +2 -0
- package/dist/src/help-text.js +15 -0
- package/dist/src/mcp-client.js +335 -0
- package/dist/src/mcp-command.js +176 -0
- package/dist/src/mcp-config.js +123 -0
- package/dist/src/mcp-sdk.js +3 -0
- package/dist/src/mcp-types.js +26 -0
- package/dist/src/permissions.js +16 -3
- package/dist/src/session.js +2 -1
- package/dist/src/tool-executor.js +10 -3
- package/dist/src/ui/repl.js +32 -3
- package/dist/src/ui/slash-commands.js +1 -0
- package/dist/src/ui/tui/markdown-render.js +10 -9
- package/dist/src/ui/tui/text.js +31 -6
- package/dist/vendor/mcp/LICENSES.txt +414 -0
- package/dist/vendor/mcp/client.cjs +82 -0
- package/package.json +6 -6
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
var az=Object.create;var ai=Object.defineProperty;var cz=Object.getOwnPropertyDescriptor;var uz=Object.getOwnPropertyNames;var lz=Object.getPrototypeOf,dz=Object.prototype.hasOwnProperty;var $=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},ci=(e,t)=>{for(var r in t)ai(e,r,{get:t[r],enumerable:!0})},_m=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of uz(t))!dz.call(e,o)&&o!==r&&ai(e,o,{get:()=>t[o],enumerable:!(n=cz(t,o))||n.enumerable});return e};var mn=(e,t,r)=>(r=e!=null?az(lz(e)):{},_m(t||!e||!e.__esModule?ai(r,"default",{value:e,enumerable:!0}):r,e)),fz=e=>_m(ai({},"__esModule",{value:!0}),e);var Ko=$(te=>{"use strict";Object.defineProperty(te,"__esModule",{value:!0});te.regexpCode=te.getEsmExportName=te.getProperty=te.safeStringify=te.stringify=te.strConcat=te.addCodeArg=te.str=te._=te.nil=te._Code=te.Name=te.IDENTIFIER=te._CodeOrName=void 0;var Fo=class{};te._CodeOrName=Fo;te.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Dr=class extends Fo{constructor(t){if(super(),!te.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};te.Name=Dr;var ht=class extends Fo{constructor(t){super(),this._items=typeof t=="string"?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let t=this._items[0];return t===""||t==='""'}get str(){var t;return(t=this._str)!==null&&t!==void 0?t:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var t;return(t=this._names)!==null&&t!==void 0?t:this._names=this._items.reduce((r,n)=>(n instanceof Dr&&(r[n.str]=(r[n.str]||0)+1),r),{})}};te._Code=ht;te.nil=new ht("");function zv(e,...t){let r=[e[0]],n=0;for(;n<t.length;)_l(r,t[n]),r.push(e[++n]);return new ht(r)}te._=zv;var gl=new ht("+");function Pv(e,...t){let r=[Vo(e[0])],n=0;for(;n<t.length;)r.push(gl),_l(r,t[n]),r.push(gl,Vo(e[++n]));return hT(r),new ht(r)}te.str=Pv;function _l(e,t){t instanceof ht?e.push(...t._items):t instanceof Dr?e.push(t):e.push(yT(t))}te.addCodeArg=_l;function hT(e){let t=1;for(;t<e.length-1;){if(e[t]===gl){let r=gT(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function gT(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof Dr||e[e.length-1]!=='"'?void 0:typeof t!="string"?`${e.slice(0,-1)}${t}"`:t[0]==='"'?e.slice(0,-1)+t.slice(1):void 0;if(typeof t=="string"&&t[0]==='"'&&!(e instanceof Dr))return`"${e}${t.slice(1)}`}function _T(e,t){return t.emptyStr()?e:e.emptyStr()?t:Pv`${e}${t}`}te.strConcat=_T;function yT(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:Vo(Array.isArray(e)?e.join(","):e)}function vT(e){return new ht(Vo(e))}te.stringify=vT;function Vo(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}te.safeStringify=Vo;function $T(e){return typeof e=="string"&&te.IDENTIFIER.test(e)?new ht(`.${e}`):zv`[${e}]`}te.getProperty=$T;function wT(e){if(typeof e=="string"&&te.IDENTIFIER.test(e))return new ht(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}te.getEsmExportName=wT;function bT(e){return new ht(e.toString())}te.regexpCode=bT});var $l=$(et=>{"use strict";Object.defineProperty(et,"__esModule",{value:!0});et.ValueScope=et.ValueScopeName=et.Scope=et.varKinds=et.UsedValueState=void 0;var Qe=Ko(),yl=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}},la;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(la||(et.UsedValueState=la={}));et.varKinds={const:new Qe.Name("const"),let:new Qe.Name("let"),var:new Qe.Name("var")};var da=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof Qe.Name?t:this.name(t)}name(t){return new Qe.Name(this._newName(t))}_newName(t){let r=this._names[t]||this._nameGroup(t);return`${t}${r.index++}`}_nameGroup(t){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(t)||this._prefixes&&!this._prefixes.has(t))throw new Error(`CodeGen: prefix "${t}" is not allowed in this scope`);return this._names[t]={prefix:t,index:0}}};et.Scope=da;var fa=class extends Qe.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:r,itemIndex:n}){this.value=t,this.scopePath=(0,Qe._)`.${new Qe.Name(r)}[${n}]`}};et.ValueScopeName=fa;var ST=(0,Qe._)`\n`,vl=class extends da{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?ST:Qe.nil}}get(){return this._scope}name(t){return new fa(t,this._newName(t))}value(t,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let o=this.toName(t),{prefix:s}=o,i=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[s];if(a){let u=a.get(i);if(u)return u}else a=this._values[s]=new Map;a.set(i,o);let c=this._scope[s]||(this._scope[s]=[]),l=c.length;return c[l]=r.ref,o.setValue(r,{property:s,itemIndex:l}),o}getValue(t,r){let n=this._values[t];if(n)return n.get(r)}scopeRefs(t,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Qe._)`${t}${n.scopePath}`})}scopeCode(t=this._values,r,n){return this._reduceValues(t,o=>{if(o.value===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return o.value.code},r,n)}_reduceValues(t,r,n={},o){let s=Qe.nil;for(let i in t){let a=t[i];if(!a)continue;let c=n[i]=n[i]||new Map;a.forEach(l=>{if(c.has(l))return;c.set(l,la.Started);let u=r(l);if(u){let d=this.opts.es5?et.varKinds.var:et.varKinds.const;s=(0,Qe._)`${s}${d} ${l} = ${u};${this.opts._n}`}else if(u=o?.(l))s=(0,Qe._)`${s}${u}${this.opts._n}`;else throw new yl(l);c.set(l,la.Completed)})}return s}};et.ValueScope=vl});var V=$(L=>{"use strict";Object.defineProperty(L,"__esModule",{value:!0});L.or=L.and=L.not=L.CodeGen=L.operators=L.varKinds=L.ValueScopeName=L.ValueScope=L.Scope=L.Name=L.regexpCode=L.stringify=L.getProperty=L.nil=L.strConcat=L.str=L._=void 0;var J=Ko(),Et=$l(),yr=Ko();Object.defineProperty(L,"_",{enumerable:!0,get:function(){return yr._}});Object.defineProperty(L,"str",{enumerable:!0,get:function(){return yr.str}});Object.defineProperty(L,"strConcat",{enumerable:!0,get:function(){return yr.strConcat}});Object.defineProperty(L,"nil",{enumerable:!0,get:function(){return yr.nil}});Object.defineProperty(L,"getProperty",{enumerable:!0,get:function(){return yr.getProperty}});Object.defineProperty(L,"stringify",{enumerable:!0,get:function(){return yr.stringify}});Object.defineProperty(L,"regexpCode",{enumerable:!0,get:function(){return yr.regexpCode}});Object.defineProperty(L,"Name",{enumerable:!0,get:function(){return yr.Name}});var ga=$l();Object.defineProperty(L,"Scope",{enumerable:!0,get:function(){return ga.Scope}});Object.defineProperty(L,"ValueScope",{enumerable:!0,get:function(){return ga.ValueScope}});Object.defineProperty(L,"ValueScopeName",{enumerable:!0,get:function(){return ga.ValueScopeName}});Object.defineProperty(L,"varKinds",{enumerable:!0,get:function(){return ga.varKinds}});L.operators={GT:new J._Code(">"),GTE:new J._Code(">="),LT:new J._Code("<"),LTE:new J._Code("<="),EQ:new J._Code("==="),NEQ:new J._Code("!=="),NOT:new J._Code("!"),OR:new J._Code("||"),AND:new J._Code("&&"),ADD:new J._Code("+")};var tr=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},wl=class extends tr{constructor(t,r,n){super(),this.varKind=t,this.name=r,this.rhs=n}render({es5:t,_n:r}){let n=t?Et.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=An(this.rhs,t,r)),this}get names(){return this.rhs instanceof J._CodeOrName?this.rhs.names:{}}},pa=class extends tr{constructor(t,r,n){super(),this.lhs=t,this.rhs=r,this.sideEffects=n}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,r){if(!(this.lhs instanceof J.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=An(this.rhs,t,r),this}get names(){let t=this.lhs instanceof J.Name?{}:{...this.lhs.names};return ha(t,this.rhs)}},bl=class extends pa{constructor(t,r,n,o){super(t,n,o),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},Sl=class extends tr{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},xl=class extends tr{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},zl=class extends tr{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},Pl=class extends tr{constructor(t){super(),this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(t,r){return this.code=An(this.code,t,r),this}get names(){return this.code instanceof J._CodeOrName?this.code.names:{}}},Ho=class extends tr{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce((r,n)=>r+n.render(t),"")}optimizeNodes(){let{nodes:t}=this,r=t.length;for(;r--;){let n=t[r].optimizeNodes();Array.isArray(n)?t.splice(r,1,...n):n?t[r]=n:t.splice(r,1)}return t.length>0?this:void 0}optimizeNames(t,r){let{nodes:n}=this,o=n.length;for(;o--;){let s=n[o];s.optimizeNames(t,r)||(xT(t,s.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>Lr(t,r.names),{})}},rr=class extends Ho{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},kl=class extends Ho{},Nn=class extends rr{};Nn.kind="else";var Zr=class e extends rr{constructor(t,r){super(r),this.condition=t}render(t){let r=`if(${this.condition})`+super.render(t);return this.else&&(r+="else "+this.else.render(t)),r}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new Nn(n):n}if(r)return t===!1?r instanceof e?r:r.nodes:this.nodes.length?this:new e(kv(t),r instanceof e?[r]:r.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(t,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(t,r),!!(super.optimizeNames(t,r)||this.else))return this.condition=An(this.condition,t,r),this}get names(){let t=super.names;return ha(t,this.condition),this.else&&Lr(t,this.else.names),t}};Zr.kind="if";var Ur=class extends rr{};Ur.kind="for";var El=class extends Ur{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iteration=An(this.iteration,t,r),this}get names(){return Lr(super.names,this.iteration.names)}},Tl=class extends Ur{constructor(t,r,n,o){super(),this.varKind=t,this.name=r,this.from=n,this.to=o}render(t){let r=t.es5?Et.varKinds.var:this.varKind,{name:n,from:o,to:s}=this;return`for(${r} ${n}=${o}; ${n}<${s}; ${n}++)`+super.render(t)}get names(){let t=ha(super.names,this.from);return ha(t,this.to)}},ma=class extends Ur{constructor(t,r,n,o){super(),this.loop=t,this.varKind=r,this.name=n,this.iterable=o}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iterable=An(this.iterable,t,r),this}get names(){return Lr(super.names,this.iterable.names)}},Jo=class extends rr{constructor(t,r,n){super(),this.name=t,this.args=r,this.async=n}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}};Jo.kind="func";var Bo=class extends Ho{render(t){return"return "+super.render(t)}};Bo.kind="return";var Ol=class extends rr{render(t){let r="try"+super.render(t);return this.catch&&(r+=this.catch.render(t)),this.finally&&(r+=this.finally.render(t)),r}optimizeNodes(){var t,r;return super.optimizeNodes(),(t=this.catch)===null||t===void 0||t.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(t,r){var n,o;return super.optimizeNames(t,r),(n=this.catch)===null||n===void 0||n.optimizeNames(t,r),(o=this.finally)===null||o===void 0||o.optimizeNames(t,r),this}get names(){let t=super.names;return this.catch&&Lr(t,this.catch.names),this.finally&&Lr(t,this.finally.names),t}},Go=class extends rr{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};Go.kind="catch";var Wo=class extends rr{render(t){return"finally"+super.render(t)}};Wo.kind="finally";var Rl=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
2
|
+
`:""},this._extScope=t,this._scope=new Et.Scope({parent:t}),this._nodes=[new kl]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,r){let n=this._extScope.value(t,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(t,r){return this._extScope.getValue(t,r)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,r,n,o){let s=this._scope.toName(r);return n!==void 0&&o&&(this._constants[s.str]=n),this._leafNode(new wl(t,s,n)),s}const(t,r,n){return this._def(Et.varKinds.const,t,r,n)}let(t,r,n){return this._def(Et.varKinds.let,t,r,n)}var(t,r,n){return this._def(Et.varKinds.var,t,r,n)}assign(t,r,n){return this._leafNode(new pa(t,r,n))}add(t,r){return this._leafNode(new bl(t,L.operators.ADD,r))}code(t){return typeof t=="function"?t():t!==J.nil&&this._leafNode(new Pl(t)),this}object(...t){let r=["{"];for(let[n,o]of t)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0,J.addCodeArg)(r,o));return r.push("}"),new J._Code(r)}if(t,r,n){if(this._blockNode(new Zr(t)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new Zr(t))}else(){return this._elseNode(new Nn)}endIf(){return this._endBlockNode(Zr,Nn)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new El(t),r)}forRange(t,r,n,o,s=this.opts.es5?Et.varKinds.var:Et.varKinds.let){let i=this._scope.toName(t);return this._for(new Tl(s,i,r,n),()=>o(i))}forOf(t,r,n,o=Et.varKinds.const){let s=this._scope.toName(t);if(this.opts.es5){let i=r instanceof J.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,J._)`${i}.length`,a=>{this.var(s,(0,J._)`${i}[${a}]`),n(s)})}return this._for(new ma("of",o,s,r),()=>n(s))}forIn(t,r,n,o=this.opts.es5?Et.varKinds.var:Et.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,J._)`Object.keys(${r})`,n);let s=this._scope.toName(t);return this._for(new ma("in",o,s,r),()=>n(s))}endFor(){return this._endBlockNode(Ur)}label(t){return this._leafNode(new Sl(t))}break(t){return this._leafNode(new xl(t))}return(t){let r=new Bo;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Bo)}try(t,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new Ol;if(this._blockNode(o),this.code(t),r){let s=this.name("e");this._currNode=o.catch=new Go(s),r(s)}return n&&(this._currNode=o.finally=new Wo,this.code(n)),this._endBlockNode(Go,Wo)}throw(t){return this._leafNode(new zl(t))}block(t,r){return this._blockStarts.push(this._nodes.length),t&&this.code(t).endBlock(r),this}endBlock(t){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||t!==void 0&&n!==t)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${t} expected`);return this._nodes.length=r,this}func(t,r=J.nil,n,o){return this._blockNode(new Jo(t,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(Jo)}optimize(t=1){for(;t-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(t){return this._currNode.nodes.push(t),this}_blockNode(t){this._currNode.nodes.push(t),this._nodes.push(t)}_endBlockNode(t,r){let n=this._currNode;if(n instanceof t||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${t.kind}/${r.kind}`:t.kind}"`)}_elseNode(t){let r=this._currNode;if(!(r instanceof Zr))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=t,this}get _root(){return this._nodes[0]}get _currNode(){let t=this._nodes;return t[t.length-1]}set _currNode(t){let r=this._nodes;r[r.length-1]=t}};L.CodeGen=Rl;function Lr(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function ha(e,t){return t instanceof J._CodeOrName?Lr(e,t.names):e}function An(e,t,r){if(e instanceof J.Name)return n(e);if(!o(e))return e;return new J._Code(e._items.reduce((s,i)=>(i instanceof J.Name&&(i=n(i)),i instanceof J._Code?s.push(...i._items):s.push(i),s),[]));function n(s){let i=r[s.str];return i===void 0||t[s.str]!==1?s:(delete t[s.str],i)}function o(s){return s instanceof J._Code&&s._items.some(i=>i instanceof J.Name&&t[i.str]===1&&r[i.str]!==void 0)}}function xT(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function kv(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,J._)`!${Il(e)}`}L.not=kv;var zT=Ev(L.operators.AND);function PT(...e){return e.reduce(zT)}L.and=PT;var kT=Ev(L.operators.OR);function ET(...e){return e.reduce(kT)}L.or=ET;function Ev(e){return(t,r)=>t===J.nil?r:r===J.nil?t:(0,J._)`${Il(t)} ${e} ${Il(r)}`}function Il(e){return e instanceof J.Name?e:(0,J._)`(${e})`}});var G=$(K=>{"use strict";Object.defineProperty(K,"__esModule",{value:!0});K.checkStrictMode=K.getErrorPath=K.Type=K.useFunc=K.setEvaluated=K.evaluatedPropsToName=K.mergeEvaluated=K.eachItem=K.unescapeJsonPointer=K.escapeJsonPointer=K.escapeFragment=K.unescapeFragment=K.schemaRefOrVal=K.schemaHasRulesButRef=K.schemaHasRules=K.checkUnknownRules=K.alwaysValidSchema=K.toHash=void 0;var le=V(),TT=Ko();function OT(e){let t={};for(let r of e)t[r]=!0;return t}K.toHash=OT;function RT(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(Rv(e,t),!Iv(t,e.self.RULES.all))}K.alwaysValidSchema=RT;function Rv(e,t=e.schema){let{opts:r,self:n}=e;if(!r.strictSchema||typeof t=="boolean")return;let o=n.RULES.keywords;for(let s in t)o[s]||Av(e,`unknown keyword: "${s}"`)}K.checkUnknownRules=Rv;function Iv(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}K.schemaHasRules=Iv;function IT(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}K.schemaHasRulesButRef=IT;function CT({topSchemaRef:e,schemaPath:t},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,le._)`${r}`}return(0,le._)`${e}${t}${(0,le.getProperty)(n)}`}K.schemaRefOrVal=CT;function NT(e){return Cv(decodeURIComponent(e))}K.unescapeFragment=NT;function AT(e){return encodeURIComponent(Nl(e))}K.escapeFragment=AT;function Nl(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}K.escapeJsonPointer=Nl;function Cv(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}K.unescapeJsonPointer=Cv;function jT(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}K.eachItem=jT;function Tv({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(o,s,i,a)=>{let c=i===void 0?s:i instanceof le.Name?(s instanceof le.Name?e(o,s,i):t(o,s,i),i):s instanceof le.Name?(t(o,i,s),s):r(s,i);return a===le.Name&&!(c instanceof le.Name)?n(o,c):c}}K.mergeEvaluated={props:Tv({mergeNames:(e,t,r)=>e.if((0,le._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,le._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,le._)`${r} || {}`).code((0,le._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,le._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,le._)`${r} || {}`),Al(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:Nv}),items:Tv({mergeNames:(e,t,r)=>e.if((0,le._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,le._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,le._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,le._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function Nv(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",(0,le._)`{}`);return t!==void 0&&Al(e,r,t),r}K.evaluatedPropsToName=Nv;function Al(e,t,r){Object.keys(r).forEach(n=>e.assign((0,le._)`${t}${(0,le.getProperty)(n)}`,!0))}K.setEvaluated=Al;var Ov={};function qT(e,t){return e.scopeValue("func",{ref:t,code:Ov[t.code]||(Ov[t.code]=new TT._Code(t.code))})}K.useFunc=qT;var Cl;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Cl||(K.Type=Cl={}));function MT(e,t,r){if(e instanceof le.Name){let n=t===Cl.Num;return r?n?(0,le._)`"[" + ${e} + "]"`:(0,le._)`"['" + ${e} + "']"`:n?(0,le._)`"/" + ${e}`:(0,le._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,le.getProperty)(e).toString():"/"+Nl(e)}K.getErrorPath=MT;function Av(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,r===!0)throw new Error(t);e.self.logger.warn(t)}}K.checkStrictMode=Av});var nr=$(jl=>{"use strict";Object.defineProperty(jl,"__esModule",{value:!0});var Me=V(),DT={data:new Me.Name("data"),valCxt:new Me.Name("valCxt"),instancePath:new Me.Name("instancePath"),parentData:new Me.Name("parentData"),parentDataProperty:new Me.Name("parentDataProperty"),rootData:new Me.Name("rootData"),dynamicAnchors:new Me.Name("dynamicAnchors"),vErrors:new Me.Name("vErrors"),errors:new Me.Name("errors"),this:new Me.Name("this"),self:new Me.Name("self"),scope:new Me.Name("scope"),json:new Me.Name("json"),jsonPos:new Me.Name("jsonPos"),jsonLen:new Me.Name("jsonLen"),jsonPart:new Me.Name("jsonPart")};jl.default=DT});var Xo=$(De=>{"use strict";Object.defineProperty(De,"__esModule",{value:!0});De.extendErrors=De.resetErrorsCount=De.reportExtraError=De.reportError=De.keyword$DataError=De.keywordError=void 0;var W=V(),_a=G(),He=nr();De.keywordError={message:({keyword:e})=>(0,W.str)`must pass "${e}" keyword validation`};De.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,W.str)`"${e}" keyword must be ${t} ($data)`:(0,W.str)`"${e}" keyword is invalid ($data)`};function ZT(e,t=De.keywordError,r,n){let{it:o}=e,{gen:s,compositeRule:i,allErrors:a}=o,c=Mv(e,t,r);n??(i||a)?jv(s,c):qv(o,(0,W._)`[${c}]`)}De.reportError=ZT;function UT(e,t=De.keywordError,r){let{it:n}=e,{gen:o,compositeRule:s,allErrors:i}=n,a=Mv(e,t,r);jv(o,a),s||i||qv(n,He.default.vErrors)}De.reportExtraError=UT;function LT(e,t){e.assign(He.default.errors,t),e.if((0,W._)`${He.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,W._)`${He.default.vErrors}.length`,t),()=>e.assign(He.default.vErrors,null)))}De.resetErrorsCount=LT;function FT({gen:e,keyword:t,schemaValue:r,data:n,errsCount:o,it:s}){if(o===void 0)throw new Error("ajv implementation error");let i=e.name("err");e.forRange("i",o,He.default.errors,a=>{e.const(i,(0,W._)`${He.default.vErrors}[${a}]`),e.if((0,W._)`${i}.instancePath === undefined`,()=>e.assign((0,W._)`${i}.instancePath`,(0,W.strConcat)(He.default.instancePath,s.errorPath))),e.assign((0,W._)`${i}.schemaPath`,(0,W.str)`${s.errSchemaPath}/${t}`),s.opts.verbose&&(e.assign((0,W._)`${i}.schema`,r),e.assign((0,W._)`${i}.data`,n))})}De.extendErrors=FT;function jv(e,t){let r=e.const("err",t);e.if((0,W._)`${He.default.vErrors} === null`,()=>e.assign(He.default.vErrors,(0,W._)`[${r}]`),(0,W._)`${He.default.vErrors}.push(${r})`),e.code((0,W._)`${He.default.errors}++`)}function qv(e,t){let{gen:r,validateName:n,schemaEnv:o}=e;o.$async?r.throw((0,W._)`new ${e.ValidationError}(${t})`):(r.assign((0,W._)`${n}.errors`,t),r.return(!1))}var Fr={keyword:new W.Name("keyword"),schemaPath:new W.Name("schemaPath"),params:new W.Name("params"),propertyName:new W.Name("propertyName"),message:new W.Name("message"),schema:new W.Name("schema"),parentSchema:new W.Name("parentSchema")};function Mv(e,t,r){let{createErrors:n}=e.it;return n===!1?(0,W._)`{}`:VT(e,t,r)}function VT(e,t,r={}){let{gen:n,it:o}=e,s=[KT(o,r),HT(e,r)];return JT(e,t,s),n.object(...s)}function KT({errorPath:e},{instancePath:t}){let r=t?(0,W.str)`${e}${(0,_a.getErrorPath)(t,_a.Type.Str)}`:e;return[He.default.instancePath,(0,W.strConcat)(He.default.instancePath,r)]}function HT({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let o=n?t:(0,W.str)`${t}/${e}`;return r&&(o=(0,W.str)`${o}${(0,_a.getErrorPath)(r,_a.Type.Str)}`),[Fr.schemaPath,o]}function JT(e,{params:t,message:r},n){let{keyword:o,data:s,schemaValue:i,it:a}=e,{opts:c,propertyName:l,topSchemaRef:u,schemaPath:d}=a;n.push([Fr.keyword,o],[Fr.params,typeof t=="function"?t(e):t||(0,W._)`{}`]),c.messages&&n.push([Fr.message,typeof r=="function"?r(e):r]),c.verbose&&n.push([Fr.schema,i],[Fr.parentSchema,(0,W._)`${u}${d}`],[He.default.data,s]),l&&n.push([Fr.propertyName,l])}});var Zv=$(jn=>{"use strict";Object.defineProperty(jn,"__esModule",{value:!0});jn.boolOrEmptySchema=jn.topBoolOrEmptySchema=void 0;var BT=Xo(),GT=V(),WT=nr(),XT={message:"boolean schema is false"};function YT(e){let{gen:t,schema:r,validateName:n}=e;r===!1?Dv(e,!1):typeof r=="object"&&r.$async===!0?t.return(WT.default.data):(t.assign((0,GT._)`${n}.errors`,null),t.return(!0))}jn.topBoolOrEmptySchema=YT;function QT(e,t){let{gen:r,schema:n}=e;n===!1?(r.var(t,!1),Dv(e)):r.var(t,!0)}jn.boolOrEmptySchema=QT;function Dv(e,t){let{gen:r,data:n}=e,o={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,BT.reportError)(o,XT,void 0,t)}});var ql=$(qn=>{"use strict";Object.defineProperty(qn,"__esModule",{value:!0});qn.getRules=qn.isJSONType=void 0;var eO=["string","number","integer","boolean","null","object","array"],tO=new Set(eO);function rO(e){return typeof e=="string"&&tO.has(e)}qn.isJSONType=rO;function nO(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}qn.getRules=nO});var Ml=$(vr=>{"use strict";Object.defineProperty(vr,"__esModule",{value:!0});vr.shouldUseRule=vr.shouldUseGroup=vr.schemaHasRulesForType=void 0;function oO({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&Uv(e,n)}vr.schemaHasRulesForType=oO;function Uv(e,t){return t.rules.some(r=>Lv(e,r))}vr.shouldUseGroup=Uv;function Lv(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(n=>e[n]!==void 0))}vr.shouldUseRule=Lv});var Yo=$(Ze=>{"use strict";Object.defineProperty(Ze,"__esModule",{value:!0});Ze.reportTypeError=Ze.checkDataTypes=Ze.checkDataType=Ze.coerceAndCheckDataType=Ze.getJSONTypes=Ze.getSchemaTypes=Ze.DataType=void 0;var sO=ql(),iO=Ml(),aO=Xo(),D=V(),Fv=G(),Mn;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(Mn||(Ze.DataType=Mn={}));function cO(e){let t=Vv(e.type);if(t.includes("null")){if(e.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');e.nullable===!0&&t.push("null")}return t}Ze.getSchemaTypes=cO;function Vv(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(sO.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}Ze.getJSONTypes=Vv;function uO(e,t){let{gen:r,data:n,opts:o}=e,s=lO(t,o.coerceTypes),i=t.length>0&&!(s.length===0&&t.length===1&&(0,iO.schemaHasRulesForType)(e,t[0]));if(i){let a=Zl(t,n,o.strictNumbers,Mn.Wrong);r.if(a,()=>{s.length?dO(e,t,s):Ul(e)})}return i}Ze.coerceAndCheckDataType=uO;var Kv=new Set(["string","number","integer","boolean","null"]);function lO(e,t){return t?e.filter(r=>Kv.has(r)||t==="array"&&r==="array"):[]}function dO(e,t,r){let{gen:n,data:o,opts:s}=e,i=n.let("dataType",(0,D._)`typeof ${o}`),a=n.let("coerced",(0,D._)`undefined`);s.coerceTypes==="array"&&n.if((0,D._)`${i} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,(0,D._)`${o}[0]`).assign(i,(0,D._)`typeof ${o}`).if(Zl(t,o,s.strictNumbers),()=>n.assign(a,o))),n.if((0,D._)`${a} !== undefined`);for(let l of r)(Kv.has(l)||l==="array"&&s.coerceTypes==="array")&&c(l);n.else(),Ul(e),n.endIf(),n.if((0,D._)`${a} !== undefined`,()=>{n.assign(o,a),fO(e,a)});function c(l){switch(l){case"string":n.elseIf((0,D._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,D._)`"" + ${o}`).elseIf((0,D._)`${o} === null`).assign(a,(0,D._)`""`);return;case"number":n.elseIf((0,D._)`${i} == "boolean" || ${o} === null
|
|
3
|
+
|| (${i} == "string" && ${o} && ${o} == +${o})`).assign(a,(0,D._)`+${o}`);return;case"integer":n.elseIf((0,D._)`${i} === "boolean" || ${o} === null
|
|
4
|
+
|| (${i} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(a,(0,D._)`+${o}`);return;case"boolean":n.elseIf((0,D._)`${o} === "false" || ${o} === 0 || ${o} === null`).assign(a,!1).elseIf((0,D._)`${o} === "true" || ${o} === 1`).assign(a,!0);return;case"null":n.elseIf((0,D._)`${o} === "" || ${o} === 0 || ${o} === false`),n.assign(a,null);return;case"array":n.elseIf((0,D._)`${i} === "string" || ${i} === "number"
|
|
5
|
+
|| ${i} === "boolean" || ${o} === null`).assign(a,(0,D._)`[${o}]`)}}}function fO({gen:e,parentData:t,parentDataProperty:r},n){e.if((0,D._)`${t} !== undefined`,()=>e.assign((0,D._)`${t}[${r}]`,n))}function Dl(e,t,r,n=Mn.Correct){let o=n===Mn.Correct?D.operators.EQ:D.operators.NEQ,s;switch(e){case"null":return(0,D._)`${t} ${o} null`;case"array":s=(0,D._)`Array.isArray(${t})`;break;case"object":s=(0,D._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":s=i((0,D._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":s=i();break;default:return(0,D._)`typeof ${t} ${o} ${e}`}return n===Mn.Correct?s:(0,D.not)(s);function i(a=D.nil){return(0,D.and)((0,D._)`typeof ${t} == "number"`,a,r?(0,D._)`isFinite(${t})`:D.nil)}}Ze.checkDataType=Dl;function Zl(e,t,r,n){if(e.length===1)return Dl(e[0],t,r,n);let o,s=(0,Fv.toHash)(e);if(s.array&&s.object){let i=(0,D._)`typeof ${t} != "object"`;o=s.null?i:(0,D._)`!${t} || ${i}`,delete s.null,delete s.array,delete s.object}else o=D.nil;s.number&&delete s.integer;for(let i in s)o=(0,D.and)(o,Dl(i,t,r,n));return o}Ze.checkDataTypes=Zl;var pO={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,D._)`{type: ${e}}`:(0,D._)`{type: ${t}}`};function Ul(e){let t=mO(e);(0,aO.reportError)(t,pO)}Ze.reportTypeError=Ul;function mO(e){let{gen:t,data:r,schema:n}=e,o=(0,Fv.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:e}}});var Jv=$(ya=>{"use strict";Object.defineProperty(ya,"__esModule",{value:!0});ya.assignDefaults=void 0;var Dn=V(),hO=G();function gO(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let o in r)Hv(e,o,r[o].default);else t==="array"&&Array.isArray(n)&&n.forEach((o,s)=>Hv(e,s,o.default))}ya.assignDefaults=gO;function Hv(e,t,r){let{gen:n,compositeRule:o,data:s,opts:i}=e;if(r===void 0)return;let a=(0,Dn._)`${s}${(0,Dn.getProperty)(t)}`;if(o){(0,hO.checkStrictMode)(e,`default is ignored for: ${a}`);return}let c=(0,Dn._)`${a} === undefined`;i.useDefaults==="empty"&&(c=(0,Dn._)`${c} || ${a} === null || ${a} === ""`),n.if(c,(0,Dn._)`${a} = ${(0,Dn.stringify)(r)}`)}});var gt=$(ie=>{"use strict";Object.defineProperty(ie,"__esModule",{value:!0});ie.validateUnion=ie.validateArray=ie.usePattern=ie.callValidateCode=ie.schemaProperties=ie.allSchemaProperties=ie.noPropertyInData=ie.propertyInData=ie.isOwnProperty=ie.hasPropFunc=ie.reportMissingProp=ie.checkMissingProp=ie.checkReportMissingProp=void 0;var he=V(),Ll=G(),$r=nr(),_O=G();function yO(e,t){let{gen:r,data:n,it:o}=e;r.if(Vl(r,n,t,o.opts.ownProperties),()=>{e.setParams({missingProperty:(0,he._)`${t}`},!0),e.error()})}ie.checkReportMissingProp=yO;function vO({gen:e,data:t,it:{opts:r}},n,o){return(0,he.or)(...n.map(s=>(0,he.and)(Vl(e,t,s,r.ownProperties),(0,he._)`${o} = ${s}`)))}ie.checkMissingProp=vO;function $O(e,t){e.setParams({missingProperty:t},!0),e.error()}ie.reportMissingProp=$O;function Bv(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,he._)`Object.prototype.hasOwnProperty`})}ie.hasPropFunc=Bv;function Fl(e,t,r){return(0,he._)`${Bv(e)}.call(${t}, ${r})`}ie.isOwnProperty=Fl;function wO(e,t,r,n){let o=(0,he._)`${t}${(0,he.getProperty)(r)} !== undefined`;return n?(0,he._)`${o} && ${Fl(e,t,r)}`:o}ie.propertyInData=wO;function Vl(e,t,r,n){let o=(0,he._)`${t}${(0,he.getProperty)(r)} === undefined`;return n?(0,he.or)(o,(0,he.not)(Fl(e,t,r))):o}ie.noPropertyInData=Vl;function Gv(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}ie.allSchemaProperties=Gv;function bO(e,t){return Gv(t).filter(r=>!(0,Ll.alwaysValidSchema)(e,t[r]))}ie.schemaProperties=bO;function SO({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:s},it:i},a,c,l){let u=l?(0,he._)`${e}, ${t}, ${n}${o}`:t,d=[[$r.default.instancePath,(0,he.strConcat)($r.default.instancePath,s)],[$r.default.parentData,i.parentData],[$r.default.parentDataProperty,i.parentDataProperty],[$r.default.rootData,$r.default.rootData]];i.opts.dynamicRef&&d.push([$r.default.dynamicAnchors,$r.default.dynamicAnchors]);let m=(0,he._)`${u}, ${r.object(...d)}`;return c!==he.nil?(0,he._)`${a}.call(${c}, ${m})`:(0,he._)`${a}(${m})`}ie.callValidateCode=SO;var xO=(0,he._)`new RegExp`;function zO({gen:e,it:{opts:t}},r){let n=t.unicodeRegExp?"u":"",{regExp:o}=t.code,s=o(r,n);return e.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,he._)`${o.code==="new RegExp"?xO:(0,_O.useFunc)(e,o)}(${r}, ${n})`})}ie.usePattern=zO;function PO(e){let{gen:t,data:r,keyword:n,it:o}=e,s=t.name("valid");if(o.allErrors){let a=t.let("valid",!0);return i(()=>t.assign(a,!1)),a}return t.var(s,!0),i(()=>t.break()),s;function i(a){let c=t.const("len",(0,he._)`${r}.length`);t.forRange("i",0,c,l=>{e.subschema({keyword:n,dataProp:l,dataPropType:Ll.Type.Num},s),t.if((0,he.not)(s),a)})}}ie.validateArray=PO;function kO(e){let{gen:t,schema:r,keyword:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,Ll.alwaysValidSchema)(o,c))&&!o.opts.unevaluated)return;let i=t.let("valid",!1),a=t.name("_valid");t.block(()=>r.forEach((c,l)=>{let u=e.subschema({keyword:n,schemaProp:l,compositeRule:!0},a);t.assign(i,(0,he._)`${i} || ${a}`),e.mergeValidEvaluated(u,a)||t.if((0,he.not)(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}ie.validateUnion=kO});var Yv=$(Dt=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:!0});Dt.validateKeywordUsage=Dt.validSchemaType=Dt.funcKeywordCode=Dt.macroKeywordCode=void 0;var Je=V(),Vr=nr(),EO=gt(),TO=Xo();function OO(e,t){let{gen:r,keyword:n,schema:o,parentSchema:s,it:i}=e,a=t.macro.call(i.self,o,s,i),c=Xv(r,n,a);i.opts.validateSchema!==!1&&i.self.validateSchema(a,!0);let l=r.name("valid");e.subschema({schema:a,schemaPath:Je.nil,errSchemaPath:`${i.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},l),e.pass(l,()=>e.error(!0))}Dt.macroKeywordCode=OO;function RO(e,t){var r;let{gen:n,keyword:o,schema:s,parentSchema:i,$data:a,it:c}=e;CO(c,t);let l=!a&&t.compile?t.compile.call(c.self,s,i,c):t.validate,u=Xv(n,o,l),d=n.let("valid");e.block$data(d,m),e.ok((r=t.valid)!==null&&r!==void 0?r:d);function m(){if(t.errors===!1)h(),t.modifying&&Wv(e),g(()=>e.error());else{let y=t.async?p():f();t.modifying&&Wv(e),g(()=>IO(e,y))}}function p(){let y=n.let("ruleErrs",null);return n.try(()=>h((0,Je._)`await `),b=>n.assign(d,!1).if((0,Je._)`${b} instanceof ${c.ValidationError}`,()=>n.assign(y,(0,Je._)`${b}.errors`),()=>n.throw(b))),y}function f(){let y=(0,Je._)`${u}.errors`;return n.assign(y,null),h(Je.nil),y}function h(y=t.async?(0,Je._)`await `:Je.nil){let b=c.opts.passContext?Vr.default.this:Vr.default.self,x=!("compile"in t&&!a||t.schema===!1);n.assign(d,(0,Je._)`${y}${(0,EO.callValidateCode)(e,u,b,x)}`,t.modifying)}function g(y){var b;n.if((0,Je.not)((b=t.valid)!==null&&b!==void 0?b:d),y)}}Dt.funcKeywordCode=RO;function Wv(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0,Je._)`${n.parentData}[${n.parentDataProperty}]`))}function IO(e,t){let{gen:r}=e;r.if((0,Je._)`Array.isArray(${t})`,()=>{r.assign(Vr.default.vErrors,(0,Je._)`${Vr.default.vErrors} === null ? ${t} : ${Vr.default.vErrors}.concat(${t})`).assign(Vr.default.errors,(0,Je._)`${Vr.default.vErrors}.length`),(0,TO.extendErrors)(e)},()=>e.error())}function CO({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function Xv(e,t,r){if(r===void 0)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Je.stringify)(r)})}function NO(e,t,r=!1){return!t.length||t.some(n=>n==="array"?Array.isArray(e):n==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==n||r&&typeof e>"u")}Dt.validSchemaType=NO;function AO({schema:e,opts:t,self:r,errSchemaPath:n},o,s){if(Array.isArray(o.keyword)?!o.keyword.includes(s):o.keyword!==s)throw new Error("ajv implementation error");let i=o.dependencies;if(i?.some(a=>!Object.prototype.hasOwnProperty.call(e,a)))throw new Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(o.validateSchema&&!o.validateSchema(e[s])){let c=`keyword "${s}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}Dt.validateKeywordUsage=AO});var e0=$(wr=>{"use strict";Object.defineProperty(wr,"__esModule",{value:!0});wr.extendSubschemaMode=wr.extendSubschemaData=wr.getSubschema=void 0;var Zt=V(),Qv=G();function jO(e,{keyword:t,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:s,topSchemaRef:i}){if(t!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let a=e.schema[t];return r===void 0?{schema:a,schemaPath:(0,Zt._)`${e.schemaPath}${(0,Zt.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:(0,Zt._)`${e.schemaPath}${(0,Zt.getProperty)(t)}${(0,Zt.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,Qv.escapeFragment)(r)}`}}if(n!==void 0){if(o===void 0||s===void 0||i===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:o,topSchemaRef:i,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}wr.getSubschema=jO;function qO(e,t,{dataProp:r,dataPropType:n,data:o,dataTypes:s,propertyName:i}){if(o!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=t;if(r!==void 0){let{errorPath:l,dataPathArr:u,opts:d}=t,m=a.let("data",(0,Zt._)`${t.data}${(0,Zt.getProperty)(r)}`,!0);c(m),e.errorPath=(0,Zt.str)`${l}${(0,Qv.getErrorPath)(r,n,d.jsPropertySyntax)}`,e.parentDataProperty=(0,Zt._)`${r}`,e.dataPathArr=[...u,e.parentDataProperty]}if(o!==void 0){let l=o instanceof Zt.Name?o:a.let("data",o,!0);c(l),i!==void 0&&(e.propertyName=i)}s&&(e.dataTypes=s);function c(l){e.data=l,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,l]}}wr.extendSubschemaData=qO;function MO(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:s}){n!==void 0&&(e.compositeRule=n),o!==void 0&&(e.createErrors=o),s!==void 0&&(e.allErrors=s),e.jtdDiscriminator=t,e.jtdMetadata=r}wr.extendSubschemaMode=MO});var Qo=$((kV,t0)=>{"use strict";t0.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,o,s;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(o=n;o--!==0;)if(!e(t[o],r[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(s=Object.keys(t),n=s.length,n!==Object.keys(r).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[o]))return!1;for(o=n;o--!==0;){var i=s[o];if(!e(t[i],r[i]))return!1}return!0}return t!==t&&r!==r}});var n0=$((EV,r0)=>{"use strict";var br=r0.exports=function(e,t,r){typeof t=="function"&&(r=t,t={}),r=t.cb||r;var n=typeof r=="function"?r:r.pre||function(){},o=r.post||function(){};va(t,n,o,e,"",e)};br.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};br.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};br.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};br.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 va(e,t,r,n,o,s,i,a,c,l){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,o,s,i,a,c,l);for(var u in n){var d=n[u];if(Array.isArray(d)){if(u in br.arrayKeywords)for(var m=0;m<d.length;m++)va(e,t,r,d[m],o+"/"+u+"/"+m,s,o,u,n,m)}else if(u in br.propsKeywords){if(d&&typeof d=="object")for(var p in d)va(e,t,r,d[p],o+"/"+u+"/"+DO(p),s,o,u,n,p)}else(u in br.keywords||e.allKeys&&!(u in br.skipKeywords))&&va(e,t,r,d,o+"/"+u,s,o,u,n)}r(n,o,s,i,a,c,l)}}function DO(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var es=$(tt=>{"use strict";Object.defineProperty(tt,"__esModule",{value:!0});tt.getSchemaRefs=tt.resolveUrl=tt.normalizeId=tt._getFullPath=tt.getFullPath=tt.inlineRef=void 0;var ZO=G(),UO=Qo(),LO=n0(),FO=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function VO(e,t=!0){return typeof e=="boolean"?!0:t===!0?!Kl(e):t?o0(e)<=t:!1}tt.inlineRef=VO;var KO=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Kl(e){for(let t in e){if(KO.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(Kl)||typeof r=="object"&&Kl(r))return!0}return!1}function o0(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!FO.has(r)&&(typeof e[r]=="object"&&(0,ZO.eachItem)(e[r],n=>t+=o0(n)),t===1/0))return 1/0}return t}function s0(e,t="",r){r!==!1&&(t=Zn(t));let n=e.parse(t);return i0(e,n)}tt.getFullPath=s0;function i0(e,t){return e.serialize(t).split("#")[0]+"#"}tt._getFullPath=i0;var HO=/#\/?$/;function Zn(e){return e?e.replace(HO,""):""}tt.normalizeId=Zn;function JO(e,t,r){return r=Zn(r),e.resolve(t,r)}tt.resolveUrl=JO;var BO=/^[a-z_][-a-z0-9._]*$/i;function GO(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=Zn(e[r]||t),s={"":o},i=s0(n,o,!1),a={},c=new Set;return LO(e,{allKeys:!0},(d,m,p,f)=>{if(f===void 0)return;let h=i+m,g=s[f];typeof d[r]=="string"&&(g=y.call(this,d[r])),b.call(this,d.$anchor),b.call(this,d.$dynamicAnchor),s[m]=g;function y(x){let k=this.opts.uriResolver.resolve;if(x=Zn(g?k(g,x):x),c.has(x))throw u(x);c.add(x);let v=this.refs[x];return typeof v=="string"&&(v=this.refs[v]),typeof v=="object"?l(d,v.schema,x):x!==Zn(h)&&(x[0]==="#"?(l(d,a[x],x),a[x]=d):this.refs[x]=h),x}function b(x){if(typeof x=="string"){if(!BO.test(x))throw new Error(`invalid anchor "${x}"`);y.call(this,`#${x}`)}}}),a;function l(d,m,p){if(m!==void 0&&!UO(d,m))throw u(p)}function u(d){return new Error(`reference "${d}" resolves to more than one schema`)}}tt.getSchemaRefs=GO});var ns=$(Sr=>{"use strict";Object.defineProperty(Sr,"__esModule",{value:!0});Sr.getData=Sr.KeywordCxt=Sr.validateFunctionCode=void 0;var d0=Zv(),a0=Yo(),Jl=Ml(),$a=Yo(),WO=Jv(),rs=Yv(),Hl=e0(),O=V(),j=nr(),XO=es(),or=G(),ts=Xo();function YO(e){if(m0(e)&&(h0(e),p0(e))){tR(e);return}f0(e,()=>(0,d0.topBoolOrEmptySchema)(e))}Sr.validateFunctionCode=YO;function f0({gen:e,validateName:t,schema:r,schemaEnv:n,opts:o},s){o.code.es5?e.func(t,(0,O._)`${j.default.data}, ${j.default.valCxt}`,n.$async,()=>{e.code((0,O._)`"use strict"; ${c0(r,o)}`),eR(e,o),e.code(s)}):e.func(t,(0,O._)`${j.default.data}, ${QO(o)}`,n.$async,()=>e.code(c0(r,o)).code(s))}function QO(e){return(0,O._)`{${j.default.instancePath}="", ${j.default.parentData}, ${j.default.parentDataProperty}, ${j.default.rootData}=${j.default.data}${e.dynamicRef?(0,O._)`, ${j.default.dynamicAnchors}={}`:O.nil}}={}`}function eR(e,t){e.if(j.default.valCxt,()=>{e.var(j.default.instancePath,(0,O._)`${j.default.valCxt}.${j.default.instancePath}`),e.var(j.default.parentData,(0,O._)`${j.default.valCxt}.${j.default.parentData}`),e.var(j.default.parentDataProperty,(0,O._)`${j.default.valCxt}.${j.default.parentDataProperty}`),e.var(j.default.rootData,(0,O._)`${j.default.valCxt}.${j.default.rootData}`),t.dynamicRef&&e.var(j.default.dynamicAnchors,(0,O._)`${j.default.valCxt}.${j.default.dynamicAnchors}`)},()=>{e.var(j.default.instancePath,(0,O._)`""`),e.var(j.default.parentData,(0,O._)`undefined`),e.var(j.default.parentDataProperty,(0,O._)`undefined`),e.var(j.default.rootData,j.default.data),t.dynamicRef&&e.var(j.default.dynamicAnchors,(0,O._)`{}`)})}function tR(e){let{schema:t,opts:r,gen:n}=e;f0(e,()=>{r.$comment&&t.$comment&&_0(e),iR(e),n.let(j.default.vErrors,null),n.let(j.default.errors,0),r.unevaluated&&rR(e),g0(e),uR(e)})}function rR(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,O._)`${r}.evaluated`),t.if((0,O._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,O._)`${e.evaluated}.props`,(0,O._)`undefined`)),t.if((0,O._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,O._)`${e.evaluated}.items`,(0,O._)`undefined`))}function c0(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,O._)`/*# sourceURL=${r} */`:O.nil}function nR(e,t){if(m0(e)&&(h0(e),p0(e))){oR(e,t);return}(0,d0.boolOrEmptySchema)(e,t)}function p0({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function m0(e){return typeof e.schema!="boolean"}function oR(e,t){let{schema:r,gen:n,opts:o}=e;o.$comment&&r.$comment&&_0(e),aR(e),cR(e);let s=n.const("_errs",j.default.errors);g0(e,s),n.var(t,(0,O._)`${s} === ${j.default.errors}`)}function h0(e){(0,or.checkUnknownRules)(e),sR(e)}function g0(e,t){if(e.opts.jtd)return u0(e,[],!1,t);let r=(0,a0.getSchemaTypes)(e.schema),n=(0,a0.coerceAndCheckDataType)(e,r);u0(e,r,!n,t)}function sR(e){let{schema:t,errSchemaPath:r,opts:n,self:o}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,or.schemaHasRulesButRef)(t,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function iR(e){let{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,or.checkStrictMode)(e,"default is ignored in the schema root")}function aR(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,XO.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function cR(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function _0({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:o}){let s=r.$comment;if(o.$comment===!0)e.code((0,O._)`${j.default.self}.logger.log(${s})`);else if(typeof o.$comment=="function"){let i=(0,O.str)`${n}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code((0,O._)`${j.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function uR(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:o,opts:s}=e;r.$async?t.if((0,O._)`${j.default.errors} === 0`,()=>t.return(j.default.data),()=>t.throw((0,O._)`new ${o}(${j.default.vErrors})`)):(t.assign((0,O._)`${n}.errors`,j.default.vErrors),s.unevaluated&&lR(e),t.return((0,O._)`${j.default.errors} === 0`))}function lR({gen:e,evaluated:t,props:r,items:n}){r instanceof O.Name&&e.assign((0,O._)`${t}.props`,r),n instanceof O.Name&&e.assign((0,O._)`${t}.items`,n)}function u0(e,t,r,n){let{gen:o,schema:s,data:i,allErrors:a,opts:c,self:l}=e,{RULES:u}=l;if(s.$ref&&(c.ignoreKeywordsWithRef||!(0,or.schemaHasRulesButRef)(s,u))){o.block(()=>v0(e,"$ref",u.all.$ref.definition));return}c.jtd||dR(e,t),o.block(()=>{for(let m of u.rules)d(m);d(u.post)});function d(m){(0,Jl.shouldUseGroup)(s,m)&&(m.type?(o.if((0,$a.checkDataType)(m.type,i,c.strictNumbers)),l0(e,m),t.length===1&&t[0]===m.type&&r&&(o.else(),(0,$a.reportTypeError)(e)),o.endIf()):l0(e,m),a||o.if((0,O._)`${j.default.errors} === ${n||0}`))}}function l0(e,t){let{gen:r,schema:n,opts:{useDefaults:o}}=e;o&&(0,WO.assignDefaults)(e,t.type),r.block(()=>{for(let s of t.rules)(0,Jl.shouldUseRule)(n,s)&&v0(e,s.keyword,s.definition,t.type)})}function dR(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(fR(e,t),e.opts.allowUnionTypes||pR(e,t),mR(e,e.dataTypes))}function fR(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{y0(e.dataTypes,r)||Bl(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),gR(e,t)}}function pR(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&Bl(e,"use allowUnionTypes to allow union type keyword")}function mR(e,t){let r=e.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&(0,Jl.shouldUseRule)(e.schema,o)){let{type:s}=o.definition;s.length&&!s.some(i=>hR(t,i))&&Bl(e,`missing type "${s.join(",")}" for keyword "${n}"`)}}}function hR(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function y0(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function gR(e,t){let r=[];for(let n of e.dataTypes)y0(t,n)?r.push(n):t.includes("integer")&&n==="number"&&r.push("integer");e.dataTypes=r}function Bl(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,or.checkStrictMode)(e,t,e.opts.strictTypes)}var wa=class{constructor(t,r,n){if((0,rs.validateKeywordUsage)(t,r,n),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=n,this.data=t.data,this.schema=t.schema[n],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,or.schemaRefOrVal)(t,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=r,this.$data)this.schemaCode=t.gen.const("vSchema",$0(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,rs.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=t.gen.const("_errs",j.default.errors))}result(t,r,n){this.failResult((0,O.not)(t),r,n)}failResult(t,r,n){this.gen.if(t),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,r){this.failResult((0,O.not)(t),void 0,r)}fail(t){if(t===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(t),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);let{schemaCode:r}=this;this.fail((0,O._)`${r} !== undefined && (${(0,O.or)(this.invalid$data(),t)})`)}error(t,r,n){if(r){this.setParams(r),this._error(t,n),this.setParams({});return}this._error(t,n)}_error(t,r){(t?ts.reportExtraError:ts.reportError)(this,this.def.error,r)}$dataError(){(0,ts.reportError)(this,this.def.$dataError||ts.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,ts.resetErrorsCount)(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,r){r?Object.assign(this.params,t):this.params=t}block$data(t,r,n=O.nil){this.gen.block(()=>{this.check$data(t,n),r()})}check$data(t=O.nil,r=O.nil){if(!this.$data)return;let{gen:n,schemaCode:o,schemaType:s,def:i}=this;n.if((0,O.or)((0,O._)`${o} === undefined`,r)),t!==O.nil&&n.assign(t,!0),(s.length||i.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),t!==O.nil&&n.assign(t,!1)),n.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:n,def:o,it:s}=this;return(0,O.or)(i(),a());function i(){if(n.length){if(!(r instanceof O.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,O._)`${(0,$a.checkDataTypes)(c,r,s.opts.strictNumbers,$a.DataType.Wrong)}`}return O.nil}function a(){if(o.validateSchema){let c=t.scopeValue("validate$data",{ref:o.validateSchema});return(0,O._)`!${c}(${r})`}return O.nil}}subschema(t,r){let n=(0,Hl.getSubschema)(this.it,t);(0,Hl.extendSubschemaData)(n,this.it,t),(0,Hl.extendSubschemaMode)(n,t);let o={...this.it,...n,items:void 0,props:void 0};return nR(o,r),o}mergeEvaluated(t,r){let{it:n,gen:o}=this;n.opts.unevaluated&&(n.props!==!0&&t.props!==void 0&&(n.props=or.mergeEvaluated.props(o,t.props,n.props,r)),n.items!==!0&&t.items!==void 0&&(n.items=or.mergeEvaluated.items(o,t.items,n.items,r)))}mergeValidEvaluated(t,r){let{it:n,gen:o}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return o.if(r,()=>this.mergeEvaluated(t,O.Name)),!0}};Sr.KeywordCxt=wa;function v0(e,t,r,n){let o=new wa(e,r,t);"code"in r?r.code(o,n):o.$data&&r.validate?(0,rs.funcKeywordCode)(o,r):"macro"in r?(0,rs.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,rs.funcKeywordCode)(o,r)}var _R=/^\/(?:[^~]|~0|~1)*$/,yR=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function $0(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let o,s;if(e==="")return j.default.rootData;if(e[0]==="/"){if(!_R.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);o=e,s=j.default.rootData}else{let l=yR.exec(e);if(!l)throw new Error(`Invalid JSON-pointer: ${e}`);let u=+l[1];if(o=l[2],o==="#"){if(u>=t)throw new Error(c("property/index",u));return n[t-u]}if(u>t)throw new Error(c("data",u));if(s=r[t-u],!o)return s}let i=s,a=o.split("/");for(let l of a)l&&(s=(0,O._)`${s}${(0,O.getProperty)((0,or.unescapeJsonPointer)(l))}`,i=(0,O._)`${i} && ${s}`);return i;function c(l,u){return`Cannot access ${l} ${u} levels up, current level is ${t}`}}Sr.getData=$0});var ba=$(Wl=>{"use strict";Object.defineProperty(Wl,"__esModule",{value:!0});var Gl=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}};Wl.default=Gl});var os=$(Ql=>{"use strict";Object.defineProperty(Ql,"__esModule",{value:!0});var Xl=es(),Yl=class extends Error{constructor(t,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,Xl.resolveUrl)(t,r,n),this.missingSchema=(0,Xl.normalizeId)((0,Xl.getFullPath)(t,this.missingRef))}};Ql.default=Yl});var xa=$(_t=>{"use strict";Object.defineProperty(_t,"__esModule",{value:!0});_t.resolveSchema=_t.getCompilingSchema=_t.resolveRef=_t.compileSchema=_t.SchemaEnv=void 0;var Tt=V(),vR=ba(),Kr=nr(),Ot=es(),w0=G(),$R=ns(),Un=class{constructor(t){var r;this.refs={},this.dynamicAnchors={};let n;typeof t.schema=="object"&&(n=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=(r=t.baseId)!==null&&r!==void 0?r:(0,Ot.normalizeId)(n?.[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=n?.$async,this.refs={}}};_t.SchemaEnv=Un;function td(e){let t=b0.call(this,e);if(t)return t;let r=(0,Ot.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:s}=this.opts,i=new Tt.CodeGen(this.scope,{es5:n,lines:o,ownProperties:s}),a;e.$async&&(a=i.scopeValue("Error",{ref:vR.default,code:(0,Tt._)`require("ajv/dist/runtime/validation_error").default`}));let c=i.scopeName("validate");e.validateName=c;let l={gen:i,allErrors:this.opts.allErrors,data:Kr.default.data,parentData:Kr.default.parentData,parentDataProperty:Kr.default.parentDataProperty,dataNames:[Kr.default.data],dataPathArr:[Tt.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,Tt.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:Tt.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Tt._)`""`,opts:this.opts,self:this},u;try{this._compilations.add(e),(0,$R.validateFunctionCode)(l),i.optimize(this.opts.code.optimize);let d=i.toString();u=`${i.scopeRefs(Kr.default.scope)}return ${d}`,this.opts.code.process&&(u=this.opts.code.process(u,e));let p=new Function(`${Kr.default.self}`,`${Kr.default.scope}`,u)(this,this.scope.get());if(this.scope.value(c,{ref:p}),p.errors=null,p.schema=e.schema,p.schemaEnv=e,e.$async&&(p.$async=!0),this.opts.code.source===!0&&(p.source={validateName:c,validateCode:d,scopeValues:i._values}),this.opts.unevaluated){let{props:f,items:h}=l;p.evaluated={props:f instanceof Tt.Name?void 0:f,items:h instanceof Tt.Name?void 0:h,dynamicProps:f instanceof Tt.Name,dynamicItems:h instanceof Tt.Name},p.source&&(p.source.evaluated=(0,Tt.stringify)(p.evaluated))}return e.validate=p,e}catch(d){throw delete e.validate,delete e.validateName,u&&this.logger.error("Error compiling schema, function code:",u),d}finally{this._compilations.delete(e)}}_t.compileSchema=td;function wR(e,t,r){var n;r=(0,Ot.resolveUrl)(this.opts.uriResolver,t,r);let o=e.refs[r];if(o)return o;let s=xR.call(this,e,r);if(s===void 0){let i=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;i&&(s=new Un({schema:i,schemaId:a,root:e,baseId:t}))}if(s!==void 0)return e.refs[r]=bR.call(this,s)}_t.resolveRef=wR;function bR(e){return(0,Ot.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:td.call(this,e)}function b0(e){for(let t of this._compilations)if(SR(t,e))return t}_t.getCompilingSchema=b0;function SR(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function xR(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||Sa.call(this,e,t)}function Sa(e,t){let r=this.opts.uriResolver.parse(t),n=(0,Ot._getFullPath)(this.opts.uriResolver,r),o=(0,Ot.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===o)return ed.call(this,r,e);let s=(0,Ot.normalizeId)(n),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=Sa.call(this,e,i);return typeof a?.schema!="object"?void 0:ed.call(this,r,a)}if(typeof i?.schema=="object"){if(i.validate||td.call(this,i),s===(0,Ot.normalizeId)(t)){let{schema:a}=i,{schemaId:c}=this.opts,l=a[c];return l&&(o=(0,Ot.resolveUrl)(this.opts.uriResolver,o,l)),new Un({schema:a,schemaId:c,root:e,baseId:o})}return ed.call(this,r,i)}}_t.resolveSchema=Sa;var zR=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function ed(e,{baseId:t,schema:r,root:n}){var o;if(((o=e.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,w0.unescapeFragment)(a)];if(c===void 0)return;r=c;let l=typeof r=="object"&&r[this.opts.schemaId];!zR.has(a)&&l&&(t=(0,Ot.resolveUrl)(this.opts.uriResolver,t,l))}let s;if(typeof r!="boolean"&&r.$ref&&!(0,w0.schemaHasRulesButRef)(r,this.RULES)){let a=(0,Ot.resolveUrl)(this.opts.uriResolver,t,r.$ref);s=Sa.call(this,n,a)}let{schemaId:i}=this.opts;if(s=s||new Un({schema:r,schemaId:i,root:n,baseId:t}),s.schema!==s.root.schema)return s}});var S0=$((NV,PR)=>{PR.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var ad=$((AV,O0)=>{"use strict";var kR=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),nd=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),ER=RegExp.prototype.test.bind(/^\d*$/u),Hr=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),od=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),z0=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),sd=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),TR=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),rt=new Array(256);{let e="0123456789ABCDEF";for(let t=0;t<256;t++)rt[t]="%"+e[t>>4]+e[t&15]}function Ue(e){return e<2048?rt[192|e>>6]+rt[128|e&63]:e<65536?rt[224|e>>12]+rt[128|e>>6&63]+rt[128|e&63]:rt[240|e>>18]+rt[128|e>>12&63]+rt[128|e>>6&63]+rt[128|e&63]}function OR(e){let t="",r=0,n=0;for(n=0;n<e.length;n++)if(r=e[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n];break}for(n+=1;n<e.length;n++){if(r=e[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n]}return t}var RR=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),IR=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),CR=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),NR=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function AR(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++)if(!CR(e[t])){if(e[t]==="%"&&t+2<e.length&&Hr(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function x0(e){let t=-1,r=0,n=-1,o=0;for(let a=0;a<e.length;a++)e[a]==="0"?(n===-1&&(n=a),o++,o>r&&(r=o,t=n)):(n=-1,o=0);if(r<2)return e.join(":");let s=e.slice(0,t).join(":"),i=e.slice(t+r).join(":");return s+"::"+i}function jR(e){let t=e.indexOf("::");if(t!==-1&&e.indexOf("::",t+1)!==-1)return;let r=t===-1?e.split(":"):e.slice(0,t).split(":"),n=t===-1?[]:e.slice(t+2).split(":");t!==-1&&(r.length===1&&r[0]===""&&(r.length=0),n.length===1&&n[0]===""&&(n.length=0));let o=r.concat(n),s=0;for(let a=0;a<o.length;a++){let c=o[a];if(c==="")return;if(c.indexOf(".")!==-1){if(a!==o.length-1||t!==-1&&n.length===0||!nd(c))return;s+=2;continue}if(!RR(c))return;o[a]=parseInt(c,16).toString(16),s++}if(t===-1)return s!==8?void 0:x0(o);if(s>=8)return;let i=o.slice(0,r.length);for(let a=s;a<8;a++)i.push("0");for(let a=r.length;a<o.length;a++)i.push(o[a]);return x0(i)}function rd(e){let t=e[0]==="["&&e[e.length-1]==="]";if((e[0]==="["||e[e.length-1]==="]")&&!t)return{host:e,isIPV6:!1,error:!0};let n=t?e.slice(1,-1):e;if(t&&IR(n))return n=n.toLowerCase(),{host:`[${n}]`,escapedHost:n,isIPV6:!1,isIPVFuture:!0};if(qR(n,":")<2)return{host:e,isIPV6:!1,error:t};let o="",s=n.indexOf("%");if(s!==-1){let a=n.slice(s,s+3).toLowerCase()==="%25"?3:1;if(o=n.slice(s+a),!AR(o))return{host:e,isIPV6:!1,error:!0};n=n.slice(0,s)}let i=jR(n);return i===void 0?{host:e,isIPV6:!1,error:!0}:{host:i+(o?"%"+o:""),escapedHost:i+(o?"%25"+o:""),isIPV6:!0}}function qR(e,t){let r=0;for(let n=0;n<e.length;n++)e[n]===t&&r++;return r}function MR(e){let t=e,r=[],n=-1,o=0;for(;o=t.length;){if(o===1){if(t===".")break;if(t==="/"){r.push("/");break}else{r.push(t);break}}else if(o===2){if(t[0]==="."){if(t[1]===".")break;if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&(t[1]==="."||t[1]==="/")){r.push("/");break}}else if(o===3&&t==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."&&t[3]==="/"){t=t.slice(3),r.length!==0&&r.pop();continue}}if((n=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,n)),t=t.slice(n)}return r.join("")}var DR={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},ZR=/[@/?#:]/g,UR=/[@/?#]/g;function P0(e,t){let r=t?UR:ZR;return r.lastIndex=0,e.replace(r,n=>DR[n])}function k0(e,t=!1){if(e.indexOf("%")===-1)return e;let r="";for(let n=0;n<e.length;n++){if(e[n]==="%"&&n+2<e.length){let o=e.slice(n+1,n+3);if(Hr(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));t&&od(i)?r+=i:r+="%"+s,n+=2;continue}}r+=e[n]}return r}function LR(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(Hr(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));i!=="."&&od(i)?t+=i:t+="%"+s,r+=2;continue}}if(z0(n))t+=n;else{let o=e.charCodeAt(r);if(o<128)t+=T0(o)?n:rt[o];else if(o<55296||o>57343)t+=Ue(o);else if(o<=56319&&r+1<e.length){let s=e.charCodeAt(r+1);s>=56320&&s<=57343?(t+=Ue(65536+(o-55296<<10)+(s-56320)),r++):t+=Ue(65533)}else t+=Ue(65533)}}return t}function FR(e,t=!1){let r="",n=t&&e[0]!=="/";for(let o=0;o<e.length;o++){let s=e[o];if(s==="%"&&o+2<e.length){let i=e.slice(o+1,o+3);if(Hr(i)){r+="%"+i.toUpperCase(),o+=2;continue}}if(s==="/"&&(n=!1),z0(s)&&(s!==":"||!n))r+=s;else{let i=e.charCodeAt(o);if(i<128)r+=rt[i];else if(i<55296||i>57343)r+=Ue(i);else if(i<=56319&&o+1<e.length){let a=e.charCodeAt(o+1);a>=56320&&a<=57343?(r+=Ue(65536+(i-55296<<10)+(a-56320)),o++):r+=Ue(65533)}else r+=Ue(65533)}}return r}function id(e,t){let r="";for(let n=0;n<e.length;n++){let o=e[n];if(o==="%"&&n+2<e.length){let s=e.slice(n+1,n+3);if(Hr(s)){r+="%"+s.toUpperCase(),n+=2;continue}}if(t(o))r+=o;else{let s=e.charCodeAt(n);if(s<128)r+=rt[s];else if(s<55296||s>57343)r+=Ue(s);else if(s<=56319&&n+1<e.length){let i=e.charCodeAt(n+1);i>=56320&&i<=57343?(r+=Ue(65536+(s-55296<<10)+(i-56320)),n++):r+=Ue(65533)}else r+=Ue(65533)}}return r}function E0(e){return id(e,TR)}function VR(e){return id(e,sd)}function KR(e){return id(e,sd)}function T0(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===42||e===43||e===45||e===46||e===47||e===64||e===95}function HR(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(Hr(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));od(i)?t+=i:t+="%"+s,r+=2;continue}}if(sd(n))t+=n;else{let o=e.charCodeAt(r);if(o<128)t+=T0(o)?n:rt[o];else if(o<55296||o>57343)t+=Ue(o);else if(o<=56319&&r+1<e.length){let s=e.charCodeAt(r+1);s>=56320&&s<=57343?(t+=Ue(65536+(o-55296<<10)+(s-56320)),r++):t+=Ue(65533)}else t+=Ue(65533)}}return t}function JR(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let n=e.slice(r+1,r+3);if(Hr(n)){t+="%"+n.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function BR(e){let t=[];if(e.userinfo!==void 0&&(t.push(E0(e.userinfo)),t.push("@")),e.host!==void 0){let r=e.host;if(!nd(r)){let n=rd(r);n.isIPV6!==!0&&n.isIPVFuture!==!0&&(r=k0(r,!0),n=rd(r)),n.isIPV6===!0||n.isIPVFuture===!0?r=`[${n.escapedHost}]`:r=P0(r,!1)}t.push(r)}if(typeof e.port=="number"||typeof e.port=="string"){let r=String(e.port);if(!ER(r))throw new TypeError("URI port is malformed.");t.push(":"),t.push(r)}return t.length?t.join(""):void 0}O0.exports={nonSimpleDomain:NR,recomposeAuthority:BR,reescapeHostDelimiters:P0,normalizePercentEncoding:k0,normalizePathEncoding:LR,serializePathEncoding:FR,normalizeQueryFragmentEncoding:HR,encodeUserinfo:E0,encodeQuery:VR,encodeFragment:KR,escapePreservingEscapes:JR,removeDotSegments:MR,isIPv4:nd,isUUID:kR,normalizeIPv6:rd,stringArrayToHexStripped:OR}});var A0=$((jV,N0)=>{"use strict";var{isUUID:GR}=ad(),WR=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,XR=["http","https","ws","wss","urn","urn:uuid"];function YR(e){return XR.indexOf(e)!==-1}function cd(e){return e.secure===!0?!0:e.secure===!1?!1:e.scheme?e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S"):!1}function R0(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function I0(e){let t=String(e.scheme).toLowerCase()==="https";return(e.port===(t?443:80)||e.port==="")&&(e.port=void 0),e.path||(e.path="/"),e}function QR(e){return e.secure=cd(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function e1(e){if((e.port===(cd(e)?443:80)||e.port==="")&&(e.port=void 0),typeof e.secure=="boolean"&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){let t=e.resourceName.indexOf("?"),r=t===-1?e.resourceName:e.resourceName.slice(0,t);e.path=r&&r!=="/"?r:void 0,e.query=t===-1?void 0:e.resourceName.slice(t+1),e.resourceName=void 0}return e.fragment=void 0,e}function t1(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(WR);if(r&&r[0]===e.path){let n=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let o=`${n}:${t.nid||e.nid}`,s=ud(o);e.path=void 0,s&&(e=s.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function r1(e,t){if(e.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",n=e.nid.toLowerCase(),o=`${r}:${t.nid||n}`,s=ud(o);s&&(e=s.serialize(e,t));let i=e,a=e.nss;return i.path=`${n||t.nid}:${a}`,t.skipEscape=!0,i}function n1(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!GR(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function o1(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var C0={scheme:"http",domainHost:!0,parse:R0,serialize:I0},s1={scheme:"https",domainHost:C0.domainHost,parse:R0,serialize:I0},za={scheme:"ws",domainHost:!0,parse:QR,serialize:e1},i1={scheme:"wss",domainHost:za.domainHost,parse:za.parse,serialize:za.serialize},a1={scheme:"urn",parse:t1,serialize:r1,skipNormalize:!0},c1={scheme:"urn:uuid",parse:n1,serialize:o1,skipNormalize:!0},Pa={http:C0,https:s1,ws:za,wss:i1,urn:a1,"urn:uuid":c1};Object.setPrototypeOf(Pa,null);function ud(e){return e&&(Pa[e]||Pa[e.toLowerCase()])||void 0}N0.exports={wsIsSecure:cd,SCHEMES:Pa,isValidSchemeName:YR,getSchemeHandler:ud}});var md=$((qV,Ta)=>{"use strict";var{normalizeIPv6:Z0,removeDotSegments:is,recomposeAuthority:u1,normalizePercentEncoding:ld,normalizePathEncoding:l1,serializePathEncoding:j0,normalizeQueryFragmentEncoding:q0,encodeQuery:d1,encodeFragment:f1,reescapeHostDelimiters:p1,isIPv4:U0,nonSimpleDomain:m1}=ad(),{SCHEMES:L0,getSchemeHandler:dd}=A0(),F0=/^[A-Za-z][A-Za-z0-9+.-]*$/u,V0="URI scheme is malformed.";function M0(e){let t=unescape(String(e));if(!F0.test(t))throw new TypeError(V0);return t}function h1(e,t){return typeof e=="string"?e=S1(e,t):typeof e=="object"&&(e=Ea(Jr(e,t),t)),e}function g1(e,t,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},{parsed:o,malformedAuthorityOrPort:s,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:c,malformedScheme:l}=ka(e,n),{parsed:u,malformedAuthorityOrPort:d,malformedPercentEncoding:m,malformedSchemeSpecific:p,malformedHost:f,malformedScheme:h}=ka(t,n);if(s||d||i||m||a||p||c||f||l||h)throw new Error(o.error||u.error||"URI is malformed.");let g=K0(o,u,n,!0),y=dd(r&&r.scheme||g.scheme),b=g.host,x=b!==void 0&&b!==""&&(U0(b)||Z0(b).isIPV6);H0(g,r||{},y,x);let k=b&&b.indexOf("%")!==-1&&!new RegExp("\\P{ASCII}","u").test(b);if(g.error&&!k)throw new Error(g.error);return n.skipEscape=!0,Jr(g,n)}function K0(e,t,r,n){let o={};return n||(e=Ea(Jr(e,r),r),t=Ea(Jr(t,r),r)),r=r||{},!r.tolerant&&t.scheme?(o.scheme=t.scheme,o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=is(t.path||""),o.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=is(t.path||""),o.query=t.query):(t.path?(t.path[0]==="/"?o.path=is(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?o.path="/"+t.path:e.path?o.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:o.path=t.path,o.path=is(o.path)),o.query=t.query):(o.path=e.path,t.query!==void 0?o.query=t.query:o.query=e.query),o.userinfo=e.userinfo,o.host=e.host,o.port=e.port),o.scheme=e.scheme),o.fragment=t.fragment,o}function _1(e,t,r){let n=D0(e,r),o=D0(t,r);return n!==void 0&&o!==void 0&&n===o}function Jr(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},n=Object.assign({},t),o=[];r.scheme&&(r.scheme=M0(r.scheme));let s=dd(n.scheme||r.scheme);s&&s.serialize&&s.serialize(r,n);let i=r.userinfo!==void 0||r.host!==void 0||r.port!==void 0,a=!n.skipEscape&&r.scheme===void 0&&!i;r.path!==void 0&&(n.skipEscape?r.path=ld(r.path):r.path=j0(r.path,a)),n.reference!=="suffix"&&r.scheme&&(r.scheme=M0(r.scheme),o.push(r.scheme,":"));let c=u1(r);if(c!==void 0&&(n.reference!=="suffix"&&o.push("//"),o.push(c),r.path&&r.path[0]!=="/"&&o.push("/")),r.path!==void 0){let l=r.path;!n.absolutePath&&(!s||!s.absolutePath)&&(l=is(l)),a&&(l=j0(l,!0)),c===void 0&&l[0]==="/"&&l[1]==="/"&&(l="/%2F"+l.slice(2)),o.push(l)}return r.query!==void 0&&o.push("?",d1(r.query)),r.fragment!==void 0&&o.push("#",f1(r.fragment)),o.join("")}var y1=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,v1=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,$1=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function w1(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof e.port=="number"&&(e.port<0||e.port>65535))return"URI port is malformed."}function ss(e){if(e===void 0)return!1;let t=e.indexOf("%");for(;t!==-1;){if(t+2>=e.length||!/^[\da-f]{2}$/iu.test(e.slice(t+1,t+3)))return!0;t=e.indexOf("%",t+3)}return!1}function fd(e){return e[0]==="["&&e[e.length-1]==="]"}function b1(e){let t=e[4];return ss(e[3])||t!==void 0&&!fd(t)&&ss(t)||ss(e[6])||ss(e[7])||ss(e[8])}function H0(e,t,r,n){if(!t.unicodeSupport&&(!r||!r.unicodeSupport)&&e.host&&!fd(e.host)&&(t.domainHost||r&&r.domainHost)&&n===!1&&m1(e.host))try{e.host=new URL("http://"+e.host).hostname}catch(o){return e.error=e.error||"Host's domain name can not be converted to ASCII: "+o,!0}return!1}function ka(e,t){let r=Object.assign({},t),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=!1,s=!1,i=!1,a=!1,c=!1,l=!1,u=!1;r.reference==="suffix"&&(r.scheme?e=r.scheme+":"+e:e="//"+e);let d=e.match(v1);d!==null&&d[1].indexOf("\\")!==-1&&(n.error="URI authority must not contain a literal backslash.",o=!0);let m=e.match($1);if(m!==null){let f=m[1],h=f.replace(/[\t\n\r]/g,"");h.length>=2&&(h.slice(0,2)!=="//"?(n.error=n.error||"URI authority must not contain a literal backslash.",o=!0):f.length!==h.length&&(n.error=n.error||"URI authority introducer must not contain whitespace.",o=!0))}let p=e.match(y1);if(p){if(n.scheme=p[1],n.userinfo=p[3],n.host=p[4],n.port=parseInt(p[5],10),n.path=p[6]||"",n.query=p[7],n.fragment=p[8],n.scheme!==void 0){let g=unescape(n.scheme);F0.test(g)?n.scheme=g.toLowerCase():(n.error=n.error||V0,l=!0)}s=b1(p),s&&(n.error=n.error||"URI contains malformed percent-encoding."),isNaN(n.port)&&(n.port=p[5]);let f=w1(n,p);if(f!==void 0&&(n.error=n.error||f,o=!0),n.host)if(U0(n.host)===!1){let y=fd(n.host),b=n.host.indexOf("[")!==-1||n.host.indexOf("]")!==-1,x=Z0(n.host);u=x.isIPV6||x.isIPVFuture===!0,c=b&&(!y||x.error===!0),n.host=u?x.host:x.host.toLowerCase(),c&&(n.error=n.error||"URI host is malformed.",o=!0)}else u=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let h=dd(r.scheme||n.scheme);if(c||(a=H0(n,r,h,u)),e.indexOf("%")!==-1&&n.host!==void 0&&!c){let g=u?n.host:ld(n.host,!0);u||(g=ld(g.toLowerCase())),n.host=p1(g,u)}(!h||h&&!h.skipNormalize)&&(n.path&&(n.path=l1(n.path)),n.query&&(n.query=q0(n.query)),n.fragment&&(n.fragment=q0(n.fragment))),h&&h.parse&&(h.parse(n,r),h===L0.urn&&n.nid===void 0&&(i=!0))}else n.error=n.error||"URI can not be parsed.";return{parsed:n,malformedAuthorityOrPort:o,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:l}}function Ea(e,t){return ka(e,t).parsed}function S1(e,t){return J0(e,t).normalized}function J0(e,t){let{parsed:r,malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:s,malformedHost:i,malformedScheme:a}=ka(e,t);return{normalized:n||o||s||i||a?e:Jr(r,t),malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:s,malformedHost:i,malformedScheme:a}}function D0(e,t){if(typeof e!="string"&&typeof e!="object")return;let r;try{r=typeof e=="string"?e:Jr(e,t)}catch{return}let{normalized:n,malformedAuthorityOrPort:o,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:c}=J0(r,t);return o||s||i||a||c?void 0:n}var pd={SCHEMES:L0,normalize:h1,resolve:g1,resolveComponent:K0,equal:_1,serialize:Jr,parse:Ea};Ta.exports=pd;Ta.exports.default=pd;Ta.exports.fastUri=pd});var G0=$(hd=>{"use strict";Object.defineProperty(hd,"__esModule",{value:!0});var B0=md();B0.code='require("ajv/dist/runtime/uri").default';hd.default=B0});var n$=$(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});Ce.CodeGen=Ce.Name=Ce.nil=Ce.stringify=Ce.str=Ce._=Ce.KeywordCxt=void 0;var x1=ns();Object.defineProperty(Ce,"KeywordCxt",{enumerable:!0,get:function(){return x1.KeywordCxt}});var Ln=V();Object.defineProperty(Ce,"_",{enumerable:!0,get:function(){return Ln._}});Object.defineProperty(Ce,"str",{enumerable:!0,get:function(){return Ln.str}});Object.defineProperty(Ce,"stringify",{enumerable:!0,get:function(){return Ln.stringify}});Object.defineProperty(Ce,"nil",{enumerable:!0,get:function(){return Ln.nil}});Object.defineProperty(Ce,"Name",{enumerable:!0,get:function(){return Ln.Name}});Object.defineProperty(Ce,"CodeGen",{enumerable:!0,get:function(){return Ln.CodeGen}});var z1=ba(),e$=os(),P1=ql(),as=xa(),k1=V(),cs=es(),Oa=Yo(),_d=G(),W0=S0(),E1=G0(),t$=(e,t)=>new RegExp(e,t);t$.code="new RegExp";var T1=["removeAdditional","useDefaults","coerceTypes"],O1=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),R1={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."},I1={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},X0=200;function C1(e){var t,r,n,o,s,i,a,c,l,u,d,m,p,f,h,g,y,b,x,k,v,S,E,ne,M;let oe=e.strict,ct=(t=e.code)===null||t===void 0?void 0:t.optimize,qt=ct===!0||ct===void 0?1:ct||0,Jt=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:t$,Mt=(o=e.uriResolver)!==null&&o!==void 0?o:E1.default;return{strictSchema:(i=(s=e.strictSchema)!==null&&s!==void 0?s:oe)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=e.strictNumbers)!==null&&a!==void 0?a:oe)!==null&&c!==void 0?c:!0,strictTypes:(u=(l=e.strictTypes)!==null&&l!==void 0?l:oe)!==null&&u!==void 0?u:"log",strictTuples:(m=(d=e.strictTuples)!==null&&d!==void 0?d:oe)!==null&&m!==void 0?m:"log",strictRequired:(f=(p=e.strictRequired)!==null&&p!==void 0?p:oe)!==null&&f!==void 0?f:!1,code:e.code?{...e.code,optimize:qt,regExp:Jt}:{optimize:qt,regExp:Jt},loopRequired:(h=e.loopRequired)!==null&&h!==void 0?h:X0,loopEnum:(g=e.loopEnum)!==null&&g!==void 0?g:X0,meta:(y=e.meta)!==null&&y!==void 0?y:!0,messages:(b=e.messages)!==null&&b!==void 0?b:!0,inlineRefs:(x=e.inlineRefs)!==null&&x!==void 0?x:!0,schemaId:(k=e.schemaId)!==null&&k!==void 0?k:"$id",addUsedSchema:(v=e.addUsedSchema)!==null&&v!==void 0?v:!0,validateSchema:(S=e.validateSchema)!==null&&S!==void 0?S:!0,validateFormats:(E=e.validateFormats)!==null&&E!==void 0?E:!0,unicodeRegExp:(ne=e.unicodeRegExp)!==null&&ne!==void 0?ne:!0,int32range:(M=e.int32range)!==null&&M!==void 0?M:!0,uriResolver:Mt}}var us=class{constructor(t={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...C1(t)};let{es5:r,lines:n}=this.opts.code;this.scope=new k1.ValueScope({scope:{},prefixes:O1,es5:r,lines:n}),this.logger=D1(t.logger);let o=t.validateFormats;t.validateFormats=!1,this.RULES=(0,P1.getRules)(),Y0.call(this,R1,t,"NOT SUPPORTED"),Y0.call(this,I1,t,"DEPRECATED","warn"),this._metaOpts=q1.call(this),t.formats&&A1.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&j1.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),N1.call(this),t.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:n}=this.opts,o=W0;n==="id"&&(o={...W0},o.id=o.$id,delete o.$id),r&&t&&this.addMetaSchema(o,o[n],!1)}defaultMeta(){let{meta:t,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof t=="object"?t[r]||t:void 0}validate(t,r){let n;if(typeof t=="string"){if(n=this.getSchema(t),!n)throw new Error(`no schema with key or ref "${t}"`)}else n=this.compile(t);let o=n(r);return"$async"in n||(this.errors=n.errors),o}compile(t,r){let n=this._addSchema(t,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(t,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return o.call(this,t,r);async function o(u,d){await s.call(this,u.$schema);let m=this._addSchema(u,d);return m.validate||i.call(this,m)}async function s(u){u&&!this.getSchema(u)&&await o.call(this,{$ref:u},!0)}async function i(u){try{return this._compileSchemaEnv(u)}catch(d){if(!(d instanceof e$.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),i.call(this,u)}}function a({missingSchema:u,missingRef:d}){if(this.refs[u])throw new Error(`AnySchema ${u} is loaded but ${d} cannot be resolved`)}async function c(u){let d=await l.call(this,u);this.refs[u]||await s.call(this,d.$schema),this.refs[u]||this.addSchema(d,u,r)}async function l(u){let d=this._loading[u];if(d)return d;try{return await(this._loading[u]=n(u))}finally{delete this._loading[u]}}}addSchema(t,r,n,o=this.opts.validateSchema){if(Array.isArray(t)){for(let i of t)this.addSchema(i,void 0,n,o);return this}let s;if(typeof t=="object"){let{schemaId:i}=this.opts;if(s=t[i],s!==void 0&&typeof s!="string")throw new Error(`schema ${i} must be string`)}return r=(0,cs.normalizeId)(r||s),this._checkUnique(r),this.schemas[r]=this._addSchema(t,n,r,o,!0),this}addMetaSchema(t,r,n=this.opts.validateSchema){return this.addSchema(t,r,!0,n),this}validateSchema(t,r){if(typeof t=="boolean")return!0;let n;if(n=t.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let o=this.validate(n,t);if(!o&&r){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw new Error(s)}return o}getSchema(t){let r;for(;typeof(r=Q0.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:n}=this.opts,o=new as.SchemaEnv({schema:{},schemaId:n});if(r=as.resolveSchema.call(this,o,t),!r)return;this.refs[t]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(t){if(t instanceof RegExp)return this._removeAllSchemas(this.schemas,t),this._removeAllSchemas(this.refs,t),this;switch(typeof t){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=Q0.call(this,t);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[t],delete this.refs[t],this}case"object":{let r=t;this._cache.delete(r);let n=t[this.opts.schemaId];return n&&(n=(0,cs.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(t){for(let r of t)this.addKeyword(r);return this}addKeyword(t,r){let n;if(typeof t=="string")n=t,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof t=="object"&&r===void 0){if(r=t,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(U1.call(this,n,r),!r)return(0,_d.eachItem)(n,s=>gd.call(this,s)),this;F1.call(this,r);let o={...r,type:(0,Oa.getJSONTypes)(r.type),schemaType:(0,Oa.getJSONTypes)(r.schemaType)};return(0,_d.eachItem)(n,o.type.length===0?s=>gd.call(this,s,o):s=>o.type.forEach(i=>gd.call(this,s,o,i))),this}getKeyword(t){let r=this.RULES.all[t];return typeof r=="object"?r.definition:!!r}removeKeyword(t){let{RULES:r}=this;delete r.keywords[t],delete r.all[t];for(let n of r.rules){let o=n.rules.findIndex(s=>s.keyword===t);o>=0&&n.rules.splice(o,1)}return this}addFormat(t,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[t]=r,this}errorsText(t=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!t||t.length===0?"No errors":t.map(o=>`${n}${o.instancePath} ${o.message}`).reduce((o,s)=>o+r+s)}$dataMetaSchema(t,r){let n=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(let o of r){let s=o.split("/").slice(1),i=t;for(let a of s)i=i[a];for(let a in n){let c=n[a];if(typeof c!="object")continue;let{$data:l}=c.definition,u=i[a];l&&u&&(i[a]=r$(u))}}return t}_removeAllSchemas(t,r){for(let n in t){let o=t[n];(!r||r.test(n))&&(typeof o=="string"?delete t[n]:o&&!o.meta&&(this._cache.delete(o.schema),delete t[n]))}}_addSchema(t,r,n,o=this.opts.validateSchema,s=this.opts.addUsedSchema){let i,{schemaId:a}=this.opts;if(typeof t=="object")i=t[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof t!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(t);if(c!==void 0)return c;n=(0,cs.normalizeId)(i||n);let l=cs.getSchemaRefs.call(this,t,n);return c=new as.SchemaEnv({schema:t,schemaId:a,meta:r,baseId:n,localRefs:l}),this._cache.set(c.schema,c),s&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),o&&this.validateSchema(t,!0),c}_checkUnique(t){if(this.schemas[t]||this.refs[t])throw new Error(`schema with key or id "${t}" already exists`)}_compileSchemaEnv(t){if(t.meta?this._compileMetaSchema(t):as.compileSchema.call(this,t),!t.validate)throw new Error("ajv implementation error");return t.validate}_compileMetaSchema(t){let r=this.opts;this.opts=this._metaOpts;try{as.compileSchema.call(this,t)}finally{this.opts=r}}};us.ValidationError=z1.default;us.MissingRefError=e$.default;Ce.default=us;function Y0(e,t,r,n="error"){for(let o in e){let s=o;s in t&&this.logger[n](`${r}: option ${o}. ${e[s]}`)}}function Q0(e){return e=(0,cs.normalizeId)(e),this.schemas[e]||this.refs[e]}function N1(){let e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function A1(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function j1(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}function q1(){let e={...this.opts};for(let t of T1)delete e[t];return e}var M1={log(){},warn(){},error(){}};function D1(e){if(e===!1)return M1;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}var Z1=/^[a-z_$][a-z0-9_$:-]*$/i;function U1(e,t){let{RULES:r}=this;if((0,_d.eachItem)(e,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!Z1.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!t&&t.$data&&!("code"in t||"validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function gd(e,t,r){var n;let o=t?.post;if(r&&o)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,i=o?s.post:s.rules.find(({type:c})=>c===r);if(i||(i={type:r,rules:[]},s.rules.push(i)),s.keywords[e]=!0,!t)return;let a={keyword:e,definition:{...t,type:(0,Oa.getJSONTypes)(t.type),schemaType:(0,Oa.getJSONTypes)(t.schemaType)}};t.before?L1.call(this,i,a,t.before):i.rules.push(a),s.all[e]=a,(n=t.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function L1(e,t,r){let n=e.rules.findIndex(o=>o.keyword===r);n>=0?e.rules.splice(n,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function F1(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=r$(t)),e.validateSchema=this.compile(t,!0))}var V1={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function r$(e){return{anyOf:[e,V1]}}});var o$=$(yd=>{"use strict";Object.defineProperty(yd,"__esModule",{value:!0});var K1={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};yd.default=K1});var c$=$(Br=>{"use strict";Object.defineProperty(Br,"__esModule",{value:!0});Br.callRef=Br.getValidate=void 0;var H1=os(),s$=gt(),nt=V(),Fn=nr(),i$=xa(),Ra=G(),J1={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:n}=e,{baseId:o,schemaEnv:s,validateName:i,opts:a,self:c}=n,{root:l}=s;if((r==="#"||r==="#/")&&o===l.baseId)return d();let u=i$.resolveRef.call(c,l,o,r);if(u===void 0)throw new H1.default(n.opts.uriResolver,o,r);if(u instanceof i$.SchemaEnv)return m(u);return p(u);function d(){if(s===l)return Ia(e,i,s,s.$async);let f=t.scopeValue("root",{ref:l});return Ia(e,(0,nt._)`${f}.validate`,l,l.$async)}function m(f){let h=a$(e,f);Ia(e,h,f,f.$async)}function p(f){let h=t.scopeValue("schema",a.code.source===!0?{ref:f,code:(0,nt.stringify)(f)}:{ref:f}),g=t.name("valid"),y=e.subschema({schema:f,dataTypes:[],schemaPath:nt.nil,topSchemaRef:h,errSchemaPath:r},g);e.mergeEvaluated(y),e.ok(g)}}};function a$(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,nt._)`${r.scopeValue("wrapper",{ref:t})}.validate`}Br.getValidate=a$;function Ia(e,t,r,n){let{gen:o,it:s}=e,{allErrors:i,schemaEnv:a,opts:c}=s,l=c.passContext?Fn.default.this:nt.nil;n?u():d();function u(){if(!a.$async)throw new Error("async schema referenced by sync schema");let f=o.let("valid");o.try(()=>{o.code((0,nt._)`await ${(0,s$.callValidateCode)(e,t,l)}`),p(t),i||o.assign(f,!0)},h=>{o.if((0,nt._)`!(${h} instanceof ${s.ValidationError})`,()=>o.throw(h)),m(h),i||o.assign(f,!1)}),e.ok(f)}function d(){e.result((0,s$.callValidateCode)(e,t,l),()=>p(t),()=>m(t))}function m(f){let h=(0,nt._)`${f}.errors`;o.assign(Fn.default.vErrors,(0,nt._)`${Fn.default.vErrors} === null ? ${h} : ${Fn.default.vErrors}.concat(${h})`),o.assign(Fn.default.errors,(0,nt._)`${Fn.default.vErrors}.length`)}function p(f){var h;if(!s.opts.unevaluated)return;let g=(h=r?.validate)===null||h===void 0?void 0:h.evaluated;if(s.props!==!0)if(g&&!g.dynamicProps)g.props!==void 0&&(s.props=Ra.mergeEvaluated.props(o,g.props,s.props));else{let y=o.var("props",(0,nt._)`${f}.evaluated.props`);s.props=Ra.mergeEvaluated.props(o,y,s.props,nt.Name)}if(s.items!==!0)if(g&&!g.dynamicItems)g.items!==void 0&&(s.items=Ra.mergeEvaluated.items(o,g.items,s.items));else{let y=o.var("items",(0,nt._)`${f}.evaluated.items`);s.items=Ra.mergeEvaluated.items(o,y,s.items,nt.Name)}}}Br.callRef=Ia;Br.default=J1});var u$=$(vd=>{"use strict";Object.defineProperty(vd,"__esModule",{value:!0});var B1=o$(),G1=c$(),W1=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",B1.default,G1.default];vd.default=W1});var l$=$($d=>{"use strict";Object.defineProperty($d,"__esModule",{value:!0});var Ca=V(),xr=Ca.operators,Na={maximum:{okStr:"<=",ok:xr.LTE,fail:xr.GT},minimum:{okStr:">=",ok:xr.GTE,fail:xr.LT},exclusiveMaximum:{okStr:"<",ok:xr.LT,fail:xr.GTE},exclusiveMinimum:{okStr:">",ok:xr.GT,fail:xr.LTE}},X1={message:({keyword:e,schemaCode:t})=>(0,Ca.str)`must be ${Na[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,Ca._)`{comparison: ${Na[e].okStr}, limit: ${t}}`},Y1={keyword:Object.keys(Na),type:"number",schemaType:"number",$data:!0,error:X1,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,Ca._)`${r} ${Na[t].fail} ${n} || isNaN(${r})`)}};$d.default=Y1});var d$=$(wd=>{"use strict";Object.defineProperty(wd,"__esModule",{value:!0});var ls=V(),Q1={message:({schemaCode:e})=>(0,ls.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,ls._)`{multipleOf: ${e}}`},eI={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:Q1,code(e){let{gen:t,data:r,schemaCode:n,it:o}=e,s=o.opts.multipleOfPrecision,i=t.let("res"),a=s?(0,ls._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:(0,ls._)`${i} !== parseInt(${i})`;e.fail$data((0,ls._)`(${n} === 0 || (${i} = ${r}/${n}, ${a}))`)}};wd.default=eI});var p$=$(bd=>{"use strict";Object.defineProperty(bd,"__esModule",{value:!0});function f$(e){let t=e.length,r=0,n=0,o;for(;n<t;)r++,o=e.charCodeAt(n++),o>=55296&&o<=56319&&n<t&&(o=e.charCodeAt(n),(o&64512)===56320&&n++);return r}bd.default=f$;f$.code='require("ajv/dist/runtime/ucs2length").default'});var m$=$(Sd=>{"use strict";Object.defineProperty(Sd,"__esModule",{value:!0});var Gr=V(),tI=G(),rI=p$(),nI={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return(0,Gr.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,Gr._)`{limit: ${e}}`},oI={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:nI,code(e){let{keyword:t,data:r,schemaCode:n,it:o}=e,s=t==="maxLength"?Gr.operators.GT:Gr.operators.LT,i=o.opts.unicode===!1?(0,Gr._)`${r}.length`:(0,Gr._)`${(0,tI.useFunc)(e.gen,rI.default)}(${r})`;e.fail$data((0,Gr._)`${i} ${s} ${n}`)}};Sd.default=oI});var h$=$(xd=>{"use strict";Object.defineProperty(xd,"__esModule",{value:!0});var sI=gt(),iI=G(),Vn=V(),aI={message:({schemaCode:e})=>(0,Vn.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,Vn._)`{pattern: ${e}}`},cI={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:aI,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:s,it:i}=e,a=i.opts.unicodeRegExp?"u":"";if(n){let{regExp:c}=i.opts.code,l=c.code==="new RegExp"?(0,Vn._)`new RegExp`:(0,iI.useFunc)(t,c),u=t.let("valid");t.try(()=>t.assign(u,(0,Vn._)`${l}(${s}, ${a}).test(${r})`),()=>t.assign(u,!1)),e.fail$data((0,Vn._)`!${u}`)}else{let c=(0,sI.usePattern)(e,o);e.fail$data((0,Vn._)`!${c}.test(${r})`)}}};xd.default=cI});var g$=$(zd=>{"use strict";Object.defineProperty(zd,"__esModule",{value:!0});var ds=V(),uI={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return(0,ds.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,ds._)`{limit: ${e}}`},lI={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:uI,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxProperties"?ds.operators.GT:ds.operators.LT;e.fail$data((0,ds._)`Object.keys(${r}).length ${o} ${n}`)}};zd.default=lI});var _$=$(Pd=>{"use strict";Object.defineProperty(Pd,"__esModule",{value:!0});var fs=gt(),ps=V(),dI=G(),fI={message:({params:{missingProperty:e}})=>(0,ps.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,ps._)`{missingProperty: ${e}}`},pI={keyword:"required",type:"object",schemaType:"array",$data:!0,error:fI,code(e){let{gen:t,schema:r,schemaCode:n,data:o,$data:s,it:i}=e,{opts:a}=i;if(!s&&r.length===0)return;let c=r.length>=a.loopRequired;if(i.allErrors?l():u(),a.strictRequired){let p=e.parentSchema.properties,{definedProperties:f}=e.it;for(let h of r)if(p?.[h]===void 0&&!f.has(h)){let g=i.schemaEnv.baseId+i.errSchemaPath,y=`required property "${h}" is not defined at "${g}" (strictRequired)`;(0,dI.checkStrictMode)(i,y,i.opts.strictRequired)}}function l(){if(c||s)e.block$data(ps.nil,d);else for(let p of r)(0,fs.checkReportMissingProp)(e,p)}function u(){let p=t.let("missing");if(c||s){let f=t.let("valid",!0);e.block$data(f,()=>m(p,f)),e.ok(f)}else t.if((0,fs.checkMissingProp)(e,r,p)),(0,fs.reportMissingProp)(e,p),t.else()}function d(){t.forOf("prop",n,p=>{e.setParams({missingProperty:p}),t.if((0,fs.noPropertyInData)(t,o,p,a.ownProperties),()=>e.error())})}function m(p,f){e.setParams({missingProperty:p}),t.forOf(p,n,()=>{t.assign(f,(0,fs.propertyInData)(t,o,p,a.ownProperties)),t.if((0,ps.not)(f),()=>{e.error(),t.break()})},ps.nil)}}};Pd.default=pI});var y$=$(kd=>{"use strict";Object.defineProperty(kd,"__esModule",{value:!0});var ms=V(),mI={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return(0,ms.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,ms._)`{limit: ${e}}`},hI={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:mI,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxItems"?ms.operators.GT:ms.operators.LT;e.fail$data((0,ms._)`${r}.length ${o} ${n}`)}};kd.default=hI});var Aa=$(Ed=>{"use strict";Object.defineProperty(Ed,"__esModule",{value:!0});var v$=Qo();v$.code='require("ajv/dist/runtime/equal").default';Ed.default=v$});var $$=$(Od=>{"use strict";Object.defineProperty(Od,"__esModule",{value:!0});var Td=Yo(),Ne=V(),gI=G(),_I=Aa(),yI={message:({params:{i:e,j:t}})=>(0,Ne.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,Ne._)`{i: ${e}, j: ${t}}`},vI={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:yI,code(e){let{gen:t,data:r,$data:n,schema:o,parentSchema:s,schemaCode:i,it:a}=e;if(!n&&!o)return;let c=t.let("valid"),l=s.items?(0,Td.getSchemaTypes)(s.items):[];e.block$data(c,u,(0,Ne._)`${i} === false`),e.ok(c);function u(){let f=t.let("i",(0,Ne._)`${r}.length`),h=t.let("j");e.setParams({i:f,j:h}),t.assign(c,!0),t.if((0,Ne._)`${f} > 1`,()=>(d()?m:p)(f,h))}function d(){return l.length>0&&!l.some(f=>f==="object"||f==="array")}function m(f,h){let g=t.name("item"),y=(0,Td.checkDataTypes)(l,g,a.opts.strictNumbers,Td.DataType.Wrong),b=t.const("indices",(0,Ne._)`{}`);t.for((0,Ne._)`;${f}--;`,()=>{t.let(g,(0,Ne._)`${r}[${f}]`),t.if(y,(0,Ne._)`continue`),l.length>1&&t.if((0,Ne._)`typeof ${g} == "string"`,(0,Ne._)`${g} += "_"`),t.if((0,Ne._)`typeof ${b}[${g}] == "number"`,()=>{t.assign(h,(0,Ne._)`${b}[${g}]`),e.error(),t.assign(c,!1).break()}).code((0,Ne._)`${b}[${g}] = ${f}`)})}function p(f,h){let g=(0,gI.useFunc)(t,_I.default),y=t.name("outer");t.label(y).for((0,Ne._)`;${f}--;`,()=>t.for((0,Ne._)`${h} = ${f}; ${h}--;`,()=>t.if((0,Ne._)`${g}(${r}[${f}], ${r}[${h}])`,()=>{e.error(),t.assign(c,!1).break(y)})))}}};Od.default=vI});var w$=$(Id=>{"use strict";Object.defineProperty(Id,"__esModule",{value:!0});var Rd=V(),$I=G(),wI=Aa(),bI={message:"must be equal to constant",params:({schemaCode:e})=>(0,Rd._)`{allowedValue: ${e}}`},SI={keyword:"const",$data:!0,error:bI,code(e){let{gen:t,data:r,$data:n,schemaCode:o,schema:s}=e;n||s&&typeof s=="object"?e.fail$data((0,Rd._)`!${(0,$I.useFunc)(t,wI.default)}(${r}, ${o})`):e.fail((0,Rd._)`${s} !== ${r}`)}};Id.default=SI});var b$=$(Cd=>{"use strict";Object.defineProperty(Cd,"__esModule",{value:!0});var hs=V(),xI=G(),zI=Aa(),PI={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,hs._)`{allowedValues: ${e}}`},kI={keyword:"enum",schemaType:"array",$data:!0,error:PI,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:s,it:i}=e;if(!n&&o.length===0)throw new Error("enum must have non-empty array");let a=o.length>=i.opts.loopEnum,c,l=()=>c??(c=(0,xI.useFunc)(t,zI.default)),u;if(a||n)u=t.let("valid"),e.block$data(u,d);else{if(!Array.isArray(o))throw new Error("ajv implementation error");let p=t.const("vSchema",s);u=(0,hs.or)(...o.map((f,h)=>m(p,h)))}e.pass(u);function d(){t.assign(u,!1),t.forOf("v",s,p=>t.if((0,hs._)`${l()}(${r}, ${p})`,()=>t.assign(u,!0).break()))}function m(p,f){let h=o[f];return typeof h=="object"&&h!==null?(0,hs._)`${l()}(${r}, ${p}[${f}])`:(0,hs._)`${r} === ${h}`}}};Cd.default=kI});var S$=$(Nd=>{"use strict";Object.defineProperty(Nd,"__esModule",{value:!0});var EI=l$(),TI=d$(),OI=m$(),RI=h$(),II=g$(),CI=_$(),NI=y$(),AI=$$(),jI=w$(),qI=b$(),MI=[EI.default,TI.default,OI.default,RI.default,II.default,CI.default,NI.default,AI.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},jI.default,qI.default];Nd.default=MI});var jd=$(gs=>{"use strict";Object.defineProperty(gs,"__esModule",{value:!0});gs.validateAdditionalItems=void 0;var Wr=V(),Ad=G(),DI={message:({params:{len:e}})=>(0,Wr.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,Wr._)`{limit: ${e}}`},ZI={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:DI,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0,Ad.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}x$(e,n)}};function x$(e,t){let{gen:r,schema:n,data:o,keyword:s,it:i}=e;i.items=!0;let a=r.const("len",(0,Wr._)`${o}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,Wr._)`${a} <= ${t.length}`);else if(typeof n=="object"&&!(0,Ad.alwaysValidSchema)(i,n)){let l=r.var("valid",(0,Wr._)`${a} <= ${t.length}`);r.if((0,Wr.not)(l),()=>c(l)),e.ok(l)}function c(l){r.forRange("i",t.length,a,u=>{e.subschema({keyword:s,dataProp:u,dataPropType:Ad.Type.Num},l),i.allErrors||r.if((0,Wr.not)(l),()=>r.break())})}}gs.validateAdditionalItems=x$;gs.default=ZI});var qd=$(_s=>{"use strict";Object.defineProperty(_s,"__esModule",{value:!0});_s.validateTuple=void 0;var z$=V(),ja=G(),UI=gt(),LI={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return P$(e,"additionalItems",t);r.items=!0,!(0,ja.alwaysValidSchema)(r,t)&&e.ok((0,UI.validateArray)(e))}};function P$(e,t,r=e.schema){let{gen:n,parentSchema:o,data:s,keyword:i,it:a}=e;u(o),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=ja.mergeEvaluated.items(n,r.length,a.items));let c=n.name("valid"),l=n.const("len",(0,z$._)`${s}.length`);r.forEach((d,m)=>{(0,ja.alwaysValidSchema)(a,d)||(n.if((0,z$._)`${l} > ${m}`,()=>e.subschema({keyword:i,schemaProp:m,dataProp:m},c)),e.ok(c))});function u(d){let{opts:m,errSchemaPath:p}=a,f=r.length,h=f===d.minItems&&(f===d.maxItems||d[t]===!1);if(m.strictTuples&&!h){let g=`"${i}" is ${f}-tuple, but minItems or maxItems/${t} are not specified or different at path "${p}"`;(0,ja.checkStrictMode)(a,g,m.strictTuples)}}}_s.validateTuple=P$;_s.default=LI});var k$=$(Md=>{"use strict";Object.defineProperty(Md,"__esModule",{value:!0});var FI=qd(),VI={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,FI.validateTuple)(e,"items")};Md.default=VI});var T$=$(Dd=>{"use strict";Object.defineProperty(Dd,"__esModule",{value:!0});var E$=V(),KI=G(),HI=gt(),JI=jd(),BI={message:({params:{len:e}})=>(0,E$.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,E$._)`{limit: ${e}}`},GI={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:BI,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:o}=r;n.items=!0,!(0,KI.alwaysValidSchema)(n,t)&&(o?(0,JI.validateAdditionalItems)(e,o):e.ok((0,HI.validateArray)(e)))}};Dd.default=GI});var O$=$(Zd=>{"use strict";Object.defineProperty(Zd,"__esModule",{value:!0});var yt=V(),qa=G(),WI={message:({params:{min:e,max:t}})=>t===void 0?(0,yt.str)`must contain at least ${e} valid item(s)`:(0,yt.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,yt._)`{minContains: ${e}}`:(0,yt._)`{minContains: ${e}, maxContains: ${t}}`},XI={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:WI,code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:s}=e,i,a,{minContains:c,maxContains:l}=n;s.opts.next?(i=c===void 0?1:c,a=l):i=1;let u=t.const("len",(0,yt._)`${o}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){(0,qa.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,qa.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,qa.alwaysValidSchema)(s,r)){let h=(0,yt._)`${u} >= ${i}`;a!==void 0&&(h=(0,yt._)`${h} && ${u} <= ${a}`),e.pass(h);return}s.items=!0;let d=t.name("valid");a===void 0&&i===1?p(d,()=>t.if(d,()=>t.break())):i===0?(t.let(d,!0),a!==void 0&&t.if((0,yt._)`${o}.length > 0`,m)):(t.let(d,!1),m()),e.result(d,()=>e.reset());function m(){let h=t.name("_valid"),g=t.let("count",0);p(h,()=>t.if(h,()=>f(g)))}function p(h,g){t.forRange("i",0,u,y=>{e.subschema({keyword:"contains",dataProp:y,dataPropType:qa.Type.Num,compositeRule:!0},h),g()})}function f(h){t.code((0,yt._)`${h}++`),a===void 0?t.if((0,yt._)`${h} >= ${i}`,()=>t.assign(d,!0).break()):(t.if((0,yt._)`${h} > ${a}`,()=>t.assign(d,!1).break()),i===1?t.assign(d,!0):t.if((0,yt._)`${h} >= ${i}`,()=>t.assign(d,!0)))}}};Zd.default=XI});var C$=$(Ut=>{"use strict";Object.defineProperty(Ut,"__esModule",{value:!0});Ut.validateSchemaDeps=Ut.validatePropertyDeps=Ut.error=void 0;var Ud=V(),YI=G(),ys=gt();Ut.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let n=t===1?"property":"properties";return(0,Ud.str)`must have ${n} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>(0,Ud._)`{property: ${e},
|
|
6
|
+
missingProperty: ${n},
|
|
7
|
+
depsCount: ${t},
|
|
8
|
+
deps: ${r}}`};var QI={keyword:"dependencies",type:"object",schemaType:"object",error:Ut.error,code(e){let[t,r]=eC(e);R$(e,t),I$(e,r)}};function eC({schema:e}){let t={},r={};for(let n in e){if(n==="__proto__")continue;let o=Array.isArray(e[n])?t:r;o[n]=e[n]}return[t,r]}function R$(e,t=e.schema){let{gen:r,data:n,it:o}=e;if(Object.keys(t).length===0)return;let s=r.let("missing");for(let i in t){let a=t[i];if(a.length===0)continue;let c=(0,ys.propertyInData)(r,n,i,o.opts.ownProperties);e.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),o.allErrors?r.if(c,()=>{for(let l of a)(0,ys.checkReportMissingProp)(e,l)}):(r.if((0,Ud._)`${c} && (${(0,ys.checkMissingProp)(e,a,s)})`),(0,ys.reportMissingProp)(e,s),r.else())}}Ut.validatePropertyDeps=R$;function I$(e,t=e.schema){let{gen:r,data:n,keyword:o,it:s}=e,i=r.name("valid");for(let a in t)(0,YI.alwaysValidSchema)(s,t[a])||(r.if((0,ys.propertyInData)(r,n,a,s.opts.ownProperties),()=>{let c=e.subschema({keyword:o,schemaProp:a},i);e.mergeValidEvaluated(c,i)},()=>r.var(i,!0)),e.ok(i))}Ut.validateSchemaDeps=I$;Ut.default=QI});var A$=$(Ld=>{"use strict";Object.defineProperty(Ld,"__esModule",{value:!0});var N$=V(),tC=G(),rC={message:"property name must be valid",params:({params:e})=>(0,N$._)`{propertyName: ${e.propertyName}}`},nC={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:rC,code(e){let{gen:t,schema:r,data:n,it:o}=e;if((0,tC.alwaysValidSchema)(o,r))return;let s=t.name("valid");t.forIn("key",n,i=>{e.setParams({propertyName:i}),e.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},s),t.if((0,N$.not)(s),()=>{e.error(!0),o.allErrors||t.break()})}),e.ok(s)}};Ld.default=nC});var Vd=$(Fd=>{"use strict";Object.defineProperty(Fd,"__esModule",{value:!0});var Ma=gt(),Rt=V(),oC=nr(),Da=G(),sC={message:"must NOT have additional properties",params:({params:e})=>(0,Rt._)`{additionalProperty: ${e.additionalProperty}}`},iC={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:sC,code(e){let{gen:t,schema:r,parentSchema:n,data:o,errsCount:s,it:i}=e;if(!s)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&(0,Da.alwaysValidSchema)(i,r))return;let l=(0,Ma.allSchemaProperties)(n.properties),u=(0,Ma.allSchemaProperties)(n.patternProperties);d(),e.ok((0,Rt._)`${s} === ${oC.default.errors}`);function d(){t.forIn("key",o,g=>{!l.length&&!u.length?f(g):t.if(m(g),()=>f(g))})}function m(g){let y;if(l.length>8){let b=(0,Da.schemaRefOrVal)(i,n.properties,"properties");y=(0,Ma.isOwnProperty)(t,b,g)}else l.length?y=(0,Rt.or)(...l.map(b=>(0,Rt._)`${g} === ${b}`)):y=Rt.nil;return u.length&&(y=(0,Rt.or)(y,...u.map(b=>(0,Rt._)`${(0,Ma.usePattern)(e,b)}.test(${g})`))),(0,Rt.not)(y)}function p(g){t.code((0,Rt._)`delete ${o}[${g}]`)}function f(g){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){p(g);return}if(r===!1){e.setParams({additionalProperty:g}),e.error(),a||t.break();return}if(typeof r=="object"&&!(0,Da.alwaysValidSchema)(i,r)){let y=t.name("valid");c.removeAdditional==="failing"?(h(g,y,!1),t.if((0,Rt.not)(y),()=>{e.reset(),p(g)})):(h(g,y),a||t.if((0,Rt.not)(y),()=>t.break()))}}function h(g,y,b){let x={keyword:"additionalProperties",dataProp:g,dataPropType:Da.Type.Str};b===!1&&Object.assign(x,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(x,y)}}};Fd.default=iC});var M$=$(Hd=>{"use strict";Object.defineProperty(Hd,"__esModule",{value:!0});var aC=ns(),j$=gt(),Kd=G(),q$=Vd(),cC={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:s}=e;s.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&q$.default.code(new aC.KeywordCxt(s,q$.default,"additionalProperties"));let i=(0,j$.allSchemaProperties)(r);for(let d of i)s.definedProperties.add(d);s.opts.unevaluated&&i.length&&s.props!==!0&&(s.props=Kd.mergeEvaluated.props(t,(0,Kd.toHash)(i),s.props));let a=i.filter(d=>!(0,Kd.alwaysValidSchema)(s,r[d]));if(a.length===0)return;let c=t.name("valid");for(let d of a)l(d)?u(d):(t.if((0,j$.propertyInData)(t,o,d,s.opts.ownProperties)),u(d),s.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(d),e.ok(c);function l(d){return s.opts.useDefaults&&!s.compositeRule&&r[d].default!==void 0}function u(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};Hd.default=cC});var L$=$(Jd=>{"use strict";Object.defineProperty(Jd,"__esModule",{value:!0});var D$=gt(),Za=V(),Z$=G(),U$=G(),uC={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:o,it:s}=e,{opts:i}=s,a=(0,D$.allSchemaProperties)(r),c=a.filter(h=>(0,Z$.alwaysValidSchema)(s,r[h]));if(a.length===0||c.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let l=i.strictSchema&&!i.allowMatchingProperties&&o.properties,u=t.name("valid");s.props!==!0&&!(s.props instanceof Za.Name)&&(s.props=(0,U$.evaluatedPropsToName)(t,s.props));let{props:d}=s;m();function m(){for(let h of a)l&&p(h),s.allErrors?f(h):(t.var(u,!0),f(h),t.if(u))}function p(h){for(let g in l)new RegExp(h).test(g)&&(0,Z$.checkStrictMode)(s,`property ${g} matches pattern ${h} (use allowMatchingProperties)`)}function f(h){t.forIn("key",n,g=>{t.if((0,Za._)`${(0,D$.usePattern)(e,h)}.test(${g})`,()=>{let y=c.includes(h);y||e.subschema({keyword:"patternProperties",schemaProp:h,dataProp:g,dataPropType:U$.Type.Str},u),s.opts.unevaluated&&d!==!0?t.assign((0,Za._)`${d}[${g}]`,!0):!y&&!s.allErrors&&t.if((0,Za.not)(u),()=>t.break())})})}}};Jd.default=uC});var F$=$(Bd=>{"use strict";Object.defineProperty(Bd,"__esModule",{value:!0});var lC=G(),dC={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if((0,lC.alwaysValidSchema)(n,r)){e.fail();return}let o=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),e.failResult(o,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};Bd.default=dC});var V$=$(Gd=>{"use strict";Object.defineProperty(Gd,"__esModule",{value:!0});var fC=gt(),pC={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:fC.validateUnion,error:{message:"must match a schema in anyOf"}};Gd.default=pC});var K$=$(Wd=>{"use strict";Object.defineProperty(Wd,"__esModule",{value:!0});var Ua=V(),mC=G(),hC={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,Ua._)`{passingSchemas: ${e.passing}}`},gC={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:hC,code(e){let{gen:t,schema:r,parentSchema:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;let s=r,i=t.let("valid",!1),a=t.let("passing",null),c=t.name("_valid");e.setParams({passing:a}),t.block(l),e.result(i,()=>e.reset(),()=>e.error(!0));function l(){s.forEach((u,d)=>{let m;(0,mC.alwaysValidSchema)(o,u)?t.var(c,!0):m=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&t.if((0,Ua._)`${c} && ${i}`).assign(i,!1).assign(a,(0,Ua._)`[${a}, ${d}]`).else(),t.if(c,()=>{t.assign(i,!0),t.assign(a,d),m&&e.mergeEvaluated(m,Ua.Name)})})}}};Wd.default=gC});var H$=$(Xd=>{"use strict";Object.defineProperty(Xd,"__esModule",{value:!0});var _C=G(),yC={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");let o=t.name("valid");r.forEach((s,i)=>{if((0,_C.alwaysValidSchema)(n,s))return;let a=e.subschema({keyword:"allOf",schemaProp:i},o);e.ok(o),e.mergeEvaluated(a)})}};Xd.default=yC});var G$=$(Yd=>{"use strict";Object.defineProperty(Yd,"__esModule",{value:!0});var La=V(),B$=G(),vC={message:({params:e})=>(0,La.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,La._)`{failingKeyword: ${e.ifClause}}`},$C={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:vC,code(e){let{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,B$.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let o=J$(n,"then"),s=J$(n,"else");if(!o&&!s)return;let i=t.let("valid",!0),a=t.name("_valid");if(c(),e.reset(),o&&s){let u=t.let("ifClause");e.setParams({ifClause:u}),t.if(a,l("then",u),l("else",u))}else o?t.if(a,l("then")):t.if((0,La.not)(a),l("else"));e.pass(i,()=>e.error(!0));function c(){let u=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(u)}function l(u,d){return()=>{let m=e.subschema({keyword:u},a);t.assign(i,a),e.mergeValidEvaluated(m,i),d?t.assign(d,(0,La._)`${u}`):e.setParams({ifClause:u})}}}};function J$(e,t){let r=e.schema[t];return r!==void 0&&!(0,B$.alwaysValidSchema)(e,r)}Yd.default=$C});var W$=$(Qd=>{"use strict";Object.defineProperty(Qd,"__esModule",{value:!0});var wC=G(),bC={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,wC.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};Qd.default=bC});var X$=$(ef=>{"use strict";Object.defineProperty(ef,"__esModule",{value:!0});var SC=jd(),xC=k$(),zC=qd(),PC=T$(),kC=O$(),EC=C$(),TC=A$(),OC=Vd(),RC=M$(),IC=L$(),CC=F$(),NC=V$(),AC=K$(),jC=H$(),qC=G$(),MC=W$();function DC(e=!1){let t=[CC.default,NC.default,AC.default,jC.default,qC.default,MC.default,TC.default,OC.default,EC.default,RC.default,IC.default];return e?t.push(xC.default,PC.default):t.push(SC.default,zC.default),t.push(kC.default),t}ef.default=DC});var Y$=$(tf=>{"use strict";Object.defineProperty(tf,"__esModule",{value:!0});var Se=V(),ZC={message:({schemaCode:e})=>(0,Se.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,Se._)`{format: ${e}}`},UC={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:ZC,code(e,t){let{gen:r,data:n,$data:o,schema:s,schemaCode:i,it:a}=e,{opts:c,errSchemaPath:l,schemaEnv:u,self:d}=a;if(!c.validateFormats)return;o?m():p();function m(){let f=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),h=r.const("fDef",(0,Se._)`${f}[${i}]`),g=r.let("fType"),y=r.let("format");r.if((0,Se._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(g,(0,Se._)`${h}.type || "string"`).assign(y,(0,Se._)`${h}.validate`),()=>r.assign(g,(0,Se._)`"string"`).assign(y,h)),e.fail$data((0,Se.or)(b(),x()));function b(){return c.strictSchema===!1?Se.nil:(0,Se._)`${i} && !${y}`}function x(){let k=u.$async?(0,Se._)`(${h}.async ? await ${y}(${n}) : ${y}(${n}))`:(0,Se._)`${y}(${n})`,v=(0,Se._)`(typeof ${y} == "function" ? ${k} : ${y}.test(${n}))`;return(0,Se._)`${y} && ${y} !== true && ${g} === ${t} && !${v}`}}function p(){let f=d.formats[s];if(!f){b();return}if(f===!0)return;let[h,g,y]=x(f);h===t&&e.pass(k());function b(){if(c.strictSchema===!1){d.logger.warn(v());return}throw new Error(v());function v(){return`unknown format "${s}" ignored in schema at path "${l}"`}}function x(v){let S=v instanceof RegExp?(0,Se.regexpCode)(v):c.code.formats?(0,Se._)`${c.code.formats}${(0,Se.getProperty)(s)}`:void 0,E=r.scopeValue("formats",{key:s,ref:v,code:S});return typeof v=="object"&&!(v instanceof RegExp)?[v.type||"string",v.validate,(0,Se._)`${E}.validate`]:["string",v,E]}function k(){if(typeof f=="object"&&!(f instanceof RegExp)&&f.async){if(!u.$async)throw new Error("async format in sync schema");return(0,Se._)`await ${y}(${n})`}return typeof g=="function"?(0,Se._)`${y}(${n})`:(0,Se._)`${y}.test(${n})`}}}};tf.default=UC});var Q$=$(rf=>{"use strict";Object.defineProperty(rf,"__esModule",{value:!0});var LC=Y$(),FC=[LC.default];rf.default=FC});var ew=$(Kn=>{"use strict";Object.defineProperty(Kn,"__esModule",{value:!0});Kn.contentVocabulary=Kn.metadataVocabulary=void 0;Kn.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Kn.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var rw=$(nf=>{"use strict";Object.defineProperty(nf,"__esModule",{value:!0});var VC=u$(),KC=S$(),HC=X$(),JC=Q$(),tw=ew(),BC=[VC.default,KC.default,(0,HC.default)(),JC.default,tw.metadataVocabulary,tw.contentVocabulary];nf.default=BC});var ow=$(Fa=>{"use strict";Object.defineProperty(Fa,"__esModule",{value:!0});Fa.DiscrError=void 0;var nw;(function(e){e.Tag="tag",e.Mapping="mapping"})(nw||(Fa.DiscrError=nw={}))});var iw=$(sf=>{"use strict";Object.defineProperty(sf,"__esModule",{value:!0});var Hn=V(),of=ow(),sw=xa(),GC=os(),WC=G(),XC={message:({params:{discrError:e,tagName:t}})=>e===of.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,Hn._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},YC={keyword:"discriminator",type:"object",schemaType:"object",error:XC,code(e){let{gen:t,data:r,schema:n,parentSchema:o,it:s}=e,{oneOf:i}=o;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!i)throw new Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),l=t.const("tag",(0,Hn._)`${r}${(0,Hn.getProperty)(a)}`);t.if((0,Hn._)`typeof ${l} == "string"`,()=>u(),()=>e.error(!1,{discrError:of.DiscrError.Tag,tag:l,tagName:a})),e.ok(c);function u(){let p=m();t.if(!1);for(let f in p)t.elseIf((0,Hn._)`${l} === ${f}`),t.assign(c,d(p[f]));t.else(),e.error(!1,{discrError:of.DiscrError.Mapping,tag:l,tagName:a}),t.endIf()}function d(p){let f=t.name("valid"),h=e.subschema({keyword:"oneOf",schemaProp:p},f);return e.mergeEvaluated(h,Hn.Name),f}function m(){var p;let f={},h=y(o),g=!0;for(let k=0;k<i.length;k++){let v=i[k];if(v?.$ref&&!(0,WC.schemaHasRulesButRef)(v,s.self.RULES)){let E=v.$ref;if(v=sw.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,E),v instanceof sw.SchemaEnv&&(v=v.schema),v===void 0)throw new GC.default(s.opts.uriResolver,s.baseId,E)}let S=(p=v?.properties)===null||p===void 0?void 0:p[a];if(typeof S!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);g=g&&(h||y(v)),b(S,k)}if(!g)throw new Error(`discriminator: "${a}" must be required`);return f;function y({required:k}){return Array.isArray(k)&&k.includes(a)}function b(k,v){if(k.const)x(k.const,v);else if(k.enum)for(let S of k.enum)x(S,v);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function x(k,v){if(typeof k!="string"||k in f)throw new Error(`discriminator: "${a}" values must be unique strings`);f[k]=v}}}};sf.default=YC});var aw=$((z6,QC)=>{QC.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var uw=$((ge,af)=>{"use strict";Object.defineProperty(ge,"__esModule",{value:!0});ge.MissingRefError=ge.ValidationError=ge.CodeGen=ge.Name=ge.nil=ge.stringify=ge.str=ge._=ge.KeywordCxt=ge.Ajv=void 0;var eN=n$(),tN=rw(),rN=iw(),cw=aw(),nN=["/properties"],Va="http://json-schema.org/draft-07/schema",Jn=class extends eN.default{_addVocabularies(){super._addVocabularies(),tN.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(rN.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(cw,nN):cw;this.addMetaSchema(t,Va,!1),this.refs["http://json-schema.org/schema"]=Va}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Va)?Va:void 0)}};ge.Ajv=Jn;af.exports=ge=Jn;af.exports.Ajv=Jn;Object.defineProperty(ge,"__esModule",{value:!0});ge.default=Jn;var oN=ns();Object.defineProperty(ge,"KeywordCxt",{enumerable:!0,get:function(){return oN.KeywordCxt}});var Bn=V();Object.defineProperty(ge,"_",{enumerable:!0,get:function(){return Bn._}});Object.defineProperty(ge,"str",{enumerable:!0,get:function(){return Bn.str}});Object.defineProperty(ge,"stringify",{enumerable:!0,get:function(){return Bn.stringify}});Object.defineProperty(ge,"nil",{enumerable:!0,get:function(){return Bn.nil}});Object.defineProperty(ge,"Name",{enumerable:!0,get:function(){return Bn.Name}});Object.defineProperty(ge,"CodeGen",{enumerable:!0,get:function(){return Bn.CodeGen}});var sN=ba();Object.defineProperty(ge,"ValidationError",{enumerable:!0,get:function(){return sN.default}});var iN=os();Object.defineProperty(ge,"MissingRefError",{enumerable:!0,get:function(){return iN.default}})});var _w=$(Ft=>{"use strict";Object.defineProperty(Ft,"__esModule",{value:!0});Ft.formatNames=Ft.fastFormats=Ft.fullFormats=void 0;function Lt(e,t){return{validate:e,compare:t}}Ft.fullFormats={date:Lt(pw,df),time:Lt(uf(!0),ff),"date-time":Lt(lw(!0),hw),"iso-time":Lt(uf(),mw),"iso-date-time":Lt(lw(),gw),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:fN,"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:vN,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:pN,int32:{type:"number",validate:gN},int64:{type:"number",validate:_N},float:{type:"number",validate:fw},double:{type:"number",validate:fw},password:!0,binary:!0};Ft.fastFormats={...Ft.fullFormats,date:Lt(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,df),time:Lt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,ff),"date-time":Lt(/^\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,hw),"iso-time":Lt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,mw),"iso-date-time":Lt(/^\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,gw),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};Ft.formatNames=Object.keys(Ft.fullFormats);function aN(e){return e%4===0&&(e%100!==0||e%400===0)}var cN=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,uN=[0,31,28,31,30,31,30,31,31,30,31,30,31];function pw(e){let t=cN.exec(e);if(!t)return!1;let r=+t[1],n=+t[2],o=+t[3];return n>=1&&n<=12&&o>=1&&o<=(n===2&&aN(r)?29:uN[n])}function df(e,t){if(e&&t)return e>t?1:e<t?-1:0}var cf=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function uf(e){return function(r){let n=cf.exec(r);if(!n)return!1;let o=+n[1],s=+n[2],i=+n[3],a=n[4],c=n[5]==="-"?-1:1,l=+(n[6]||0),u=+(n[7]||0);if(l>23||u>59||e&&!a)return!1;if(o<=23&&s<=59&&i<60)return!0;let d=s-u*c,m=o-l*c-(d<0?1:0);return(m===23||m===-1)&&(d===59||d===-1)&&i<61}}function ff(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),n=new Date("2020-01-01T"+t).valueOf();if(r&&n)return r-n}function mw(e,t){if(!(e&&t))return;let r=cf.exec(e),n=cf.exec(t);if(r&&n)return e=r[1]+r[2]+r[3],t=n[1]+n[2]+n[3],e>t?1:e<t?-1:0}var lf=/t|\s/i;function lw(e){let t=uf(e);return function(n){let o=n.split(lf);return o.length===2&&pw(o[0])&&t(o[1])}}function hw(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),n=new Date(t).valueOf();if(r&&n)return r-n}function gw(e,t){if(!(e&&t))return;let[r,n]=e.split(lf),[o,s]=t.split(lf),i=df(r,o);if(i!==void 0)return i||ff(n,s)}var lN=/\/|:/,dN=/^(?:[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 fN(e){return lN.test(e)&&dN.test(e)}var dw=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function pN(e){return dw.lastIndex=0,dw.test(e)}var mN=-(2**31),hN=2**31-1;function gN(e){return Number.isInteger(e)&&e<=hN&&e>=mN}function _N(e){return Number.isInteger(e)}function fw(){return!0}var yN=/[^\\]\\Z/;function vN(e){if(yN.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var ws=$(re=>{"use strict";Object.defineProperty(re,"__esModule",{value:!0});re.regexpCode=re.getEsmExportName=re.getProperty=re.safeStringify=re.stringify=re.strConcat=re.addCodeArg=re.str=re._=re.nil=re._Code=re.Name=re.IDENTIFIER=re._CodeOrName=void 0;var vs=class{};re._CodeOrName=vs;re.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Xr=class extends vs{constructor(t){if(super(),!re.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};re.Name=Xr;var vt=class extends vs{constructor(t){super(),this._items=typeof t=="string"?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let t=this._items[0];return t===""||t==='""'}get str(){var t;return(t=this._str)!==null&&t!==void 0?t:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var t;return(t=this._names)!==null&&t!==void 0?t:this._names=this._items.reduce((r,n)=>(n instanceof Xr&&(r[n.str]=(r[n.str]||0)+1),r),{})}};re._Code=vt;re.nil=new vt("");function yw(e,...t){let r=[e[0]],n=0;for(;n<t.length;)mf(r,t[n]),r.push(e[++n]);return new vt(r)}re._=yw;var pf=new vt("+");function vw(e,...t){let r=[$s(e[0])],n=0;for(;n<t.length;)r.push(pf),mf(r,t[n]),r.push(pf,$s(e[++n]));return $N(r),new vt(r)}re.str=vw;function mf(e,t){t instanceof vt?e.push(...t._items):t instanceof Xr?e.push(t):e.push(SN(t))}re.addCodeArg=mf;function $N(e){let t=1;for(;t<e.length-1;){if(e[t]===pf){let r=wN(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function wN(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof Xr||e[e.length-1]!=='"'?void 0:typeof t!="string"?`${e.slice(0,-1)}${t}"`:t[0]==='"'?e.slice(0,-1)+t.slice(1):void 0;if(typeof t=="string"&&t[0]==='"'&&!(e instanceof Xr))return`"${e}${t.slice(1)}`}function bN(e,t){return t.emptyStr()?e:e.emptyStr()?t:vw`${e}${t}`}re.strConcat=bN;function SN(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:$s(Array.isArray(e)?e.join(","):e)}function xN(e){return new vt($s(e))}re.stringify=xN;function $s(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}re.safeStringify=$s;function zN(e){return typeof e=="string"&&re.IDENTIFIER.test(e)?new vt(`.${e}`):yw`[${e}]`}re.getProperty=zN;function PN(e){if(typeof e=="string"&&re.IDENTIFIER.test(e))return new vt(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}re.getEsmExportName=PN;function kN(e){return new vt(e.toString())}re.regexpCode=kN});var _f=$(st=>{"use strict";Object.defineProperty(st,"__esModule",{value:!0});st.ValueScope=st.ValueScopeName=st.Scope=st.varKinds=st.UsedValueState=void 0;var ot=ws(),hf=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}},Ka;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(Ka||(st.UsedValueState=Ka={}));st.varKinds={const:new ot.Name("const"),let:new ot.Name("let"),var:new ot.Name("var")};var Ha=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof ot.Name?t:this.name(t)}name(t){return new ot.Name(this._newName(t))}_newName(t){let r=this._names[t]||this._nameGroup(t);return`${t}${r.index++}`}_nameGroup(t){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(t)||this._prefixes&&!this._prefixes.has(t))throw new Error(`CodeGen: prefix "${t}" is not allowed in this scope`);return this._names[t]={prefix:t,index:0}}};st.Scope=Ha;var Ja=class extends ot.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:r,itemIndex:n}){this.value=t,this.scopePath=(0,ot._)`.${new ot.Name(r)}[${n}]`}};st.ValueScopeName=Ja;var EN=(0,ot._)`\n`,gf=class extends Ha{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?EN:ot.nil}}get(){return this._scope}name(t){return new Ja(t,this._newName(t))}value(t,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let o=this.toName(t),{prefix:s}=o,i=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[s];if(a){let u=a.get(i);if(u)return u}else a=this._values[s]=new Map;a.set(i,o);let c=this._scope[s]||(this._scope[s]=[]),l=c.length;return c[l]=r.ref,o.setValue(r,{property:s,itemIndex:l}),o}getValue(t,r){let n=this._values[t];if(n)return n.get(r)}scopeRefs(t,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,ot._)`${t}${n.scopePath}`})}scopeCode(t=this._values,r,n){return this._reduceValues(t,o=>{if(o.value===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return o.value.code},r,n)}_reduceValues(t,r,n={},o){let s=ot.nil;for(let i in t){let a=t[i];if(!a)continue;let c=n[i]=n[i]||new Map;a.forEach(l=>{if(c.has(l))return;c.set(l,Ka.Started);let u=r(l);if(u){let d=this.opts.es5?st.varKinds.var:st.varKinds.const;s=(0,ot._)`${s}${d} ${l} = ${u};${this.opts._n}`}else if(u=o?.(l))s=(0,ot._)`${s}${u}${this.opts._n}`;else throw new hf(l);c.set(l,Ka.Completed)})}return s}};st.ValueScope=gf});var U=$(F=>{"use strict";Object.defineProperty(F,"__esModule",{value:!0});F.or=F.and=F.not=F.CodeGen=F.operators=F.varKinds=F.ValueScopeName=F.ValueScope=F.Scope=F.Name=F.regexpCode=F.stringify=F.getProperty=F.nil=F.strConcat=F.str=F._=void 0;var B=ws(),It=_f(),zr=ws();Object.defineProperty(F,"_",{enumerable:!0,get:function(){return zr._}});Object.defineProperty(F,"str",{enumerable:!0,get:function(){return zr.str}});Object.defineProperty(F,"strConcat",{enumerable:!0,get:function(){return zr.strConcat}});Object.defineProperty(F,"nil",{enumerable:!0,get:function(){return zr.nil}});Object.defineProperty(F,"getProperty",{enumerable:!0,get:function(){return zr.getProperty}});Object.defineProperty(F,"stringify",{enumerable:!0,get:function(){return zr.stringify}});Object.defineProperty(F,"regexpCode",{enumerable:!0,get:function(){return zr.regexpCode}});Object.defineProperty(F,"Name",{enumerable:!0,get:function(){return zr.Name}});var Xa=_f();Object.defineProperty(F,"Scope",{enumerable:!0,get:function(){return Xa.Scope}});Object.defineProperty(F,"ValueScope",{enumerable:!0,get:function(){return Xa.ValueScope}});Object.defineProperty(F,"ValueScopeName",{enumerable:!0,get:function(){return Xa.ValueScopeName}});Object.defineProperty(F,"varKinds",{enumerable:!0,get:function(){return Xa.varKinds}});F.operators={GT:new B._Code(">"),GTE:new B._Code(">="),LT:new B._Code("<"),LTE:new B._Code("<="),EQ:new B._Code("==="),NEQ:new B._Code("!=="),NOT:new B._Code("!"),OR:new B._Code("||"),AND:new B._Code("&&"),ADD:new B._Code("+")};var sr=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},yf=class extends sr{constructor(t,r,n){super(),this.varKind=t,this.name=r,this.rhs=n}render({es5:t,_n:r}){let n=t?It.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=Wn(this.rhs,t,r)),this}get names(){return this.rhs instanceof B._CodeOrName?this.rhs.names:{}}},Ba=class extends sr{constructor(t,r,n){super(),this.lhs=t,this.rhs=r,this.sideEffects=n}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,r){if(!(this.lhs instanceof B.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=Wn(this.rhs,t,r),this}get names(){let t=this.lhs instanceof B.Name?{}:{...this.lhs.names};return Wa(t,this.rhs)}},vf=class extends Ba{constructor(t,r,n,o){super(t,n,o),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},$f=class extends sr{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},wf=class extends sr{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},bf=class extends sr{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},Sf=class extends sr{constructor(t){super(),this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(t,r){return this.code=Wn(this.code,t,r),this}get names(){return this.code instanceof B._CodeOrName?this.code.names:{}}},bs=class extends sr{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce((r,n)=>r+n.render(t),"")}optimizeNodes(){let{nodes:t}=this,r=t.length;for(;r--;){let n=t[r].optimizeNodes();Array.isArray(n)?t.splice(r,1,...n):n?t[r]=n:t.splice(r,1)}return t.length>0?this:void 0}optimizeNames(t,r){let{nodes:n}=this,o=n.length;for(;o--;){let s=n[o];s.optimizeNames(t,r)||(TN(t,s.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>en(t,r.names),{})}},ir=class extends bs{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},xf=class extends bs{},Gn=class extends ir{};Gn.kind="else";var Yr=class e extends ir{constructor(t,r){super(r),this.condition=t}render(t){let r=`if(${this.condition})`+super.render(t);return this.else&&(r+="else "+this.else.render(t)),r}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new Gn(n):n}if(r)return t===!1?r instanceof e?r:r.nodes:this.nodes.length?this:new e($w(t),r instanceof e?[r]:r.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(t,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(t,r),!!(super.optimizeNames(t,r)||this.else))return this.condition=Wn(this.condition,t,r),this}get names(){let t=super.names;return Wa(t,this.condition),this.else&&en(t,this.else.names),t}};Yr.kind="if";var Qr=class extends ir{};Qr.kind="for";var zf=class extends Qr{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iteration=Wn(this.iteration,t,r),this}get names(){return en(super.names,this.iteration.names)}},Pf=class extends Qr{constructor(t,r,n,o){super(),this.varKind=t,this.name=r,this.from=n,this.to=o}render(t){let r=t.es5?It.varKinds.var:this.varKind,{name:n,from:o,to:s}=this;return`for(${r} ${n}=${o}; ${n}<${s}; ${n}++)`+super.render(t)}get names(){let t=Wa(super.names,this.from);return Wa(t,this.to)}},Ga=class extends Qr{constructor(t,r,n,o){super(),this.loop=t,this.varKind=r,this.name=n,this.iterable=o}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iterable=Wn(this.iterable,t,r),this}get names(){return en(super.names,this.iterable.names)}},Ss=class extends ir{constructor(t,r,n){super(),this.name=t,this.args=r,this.async=n}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}};Ss.kind="func";var xs=class extends bs{render(t){return"return "+super.render(t)}};xs.kind="return";var kf=class extends ir{render(t){let r="try"+super.render(t);return this.catch&&(r+=this.catch.render(t)),this.finally&&(r+=this.finally.render(t)),r}optimizeNodes(){var t,r;return super.optimizeNodes(),(t=this.catch)===null||t===void 0||t.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(t,r){var n,o;return super.optimizeNames(t,r),(n=this.catch)===null||n===void 0||n.optimizeNames(t,r),(o=this.finally)===null||o===void 0||o.optimizeNames(t,r),this}get names(){let t=super.names;return this.catch&&en(t,this.catch.names),this.finally&&en(t,this.finally.names),t}},zs=class extends ir{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};zs.kind="catch";var Ps=class extends ir{render(t){return"finally"+super.render(t)}};Ps.kind="finally";var Ef=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
9
|
+
`:""},this._extScope=t,this._scope=new It.Scope({parent:t}),this._nodes=[new xf]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,r){let n=this._extScope.value(t,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(t,r){return this._extScope.getValue(t,r)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,r,n,o){let s=this._scope.toName(r);return n!==void 0&&o&&(this._constants[s.str]=n),this._leafNode(new yf(t,s,n)),s}const(t,r,n){return this._def(It.varKinds.const,t,r,n)}let(t,r,n){return this._def(It.varKinds.let,t,r,n)}var(t,r,n){return this._def(It.varKinds.var,t,r,n)}assign(t,r,n){return this._leafNode(new Ba(t,r,n))}add(t,r){return this._leafNode(new vf(t,F.operators.ADD,r))}code(t){return typeof t=="function"?t():t!==B.nil&&this._leafNode(new Sf(t)),this}object(...t){let r=["{"];for(let[n,o]of t)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0,B.addCodeArg)(r,o));return r.push("}"),new B._Code(r)}if(t,r,n){if(this._blockNode(new Yr(t)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new Yr(t))}else(){return this._elseNode(new Gn)}endIf(){return this._endBlockNode(Yr,Gn)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new zf(t),r)}forRange(t,r,n,o,s=this.opts.es5?It.varKinds.var:It.varKinds.let){let i=this._scope.toName(t);return this._for(new Pf(s,i,r,n),()=>o(i))}forOf(t,r,n,o=It.varKinds.const){let s=this._scope.toName(t);if(this.opts.es5){let i=r instanceof B.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,B._)`${i}.length`,a=>{this.var(s,(0,B._)`${i}[${a}]`),n(s)})}return this._for(new Ga("of",o,s,r),()=>n(s))}forIn(t,r,n,o=this.opts.es5?It.varKinds.var:It.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,B._)`Object.keys(${r})`,n);let s=this._scope.toName(t);return this._for(new Ga("in",o,s,r),()=>n(s))}endFor(){return this._endBlockNode(Qr)}label(t){return this._leafNode(new $f(t))}break(t){return this._leafNode(new wf(t))}return(t){let r=new xs;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(xs)}try(t,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new kf;if(this._blockNode(o),this.code(t),r){let s=this.name("e");this._currNode=o.catch=new zs(s),r(s)}return n&&(this._currNode=o.finally=new Ps,this.code(n)),this._endBlockNode(zs,Ps)}throw(t){return this._leafNode(new bf(t))}block(t,r){return this._blockStarts.push(this._nodes.length),t&&this.code(t).endBlock(r),this}endBlock(t){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||t!==void 0&&n!==t)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${t} expected`);return this._nodes.length=r,this}func(t,r=B.nil,n,o){return this._blockNode(new Ss(t,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(Ss)}optimize(t=1){for(;t-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(t){return this._currNode.nodes.push(t),this}_blockNode(t){this._currNode.nodes.push(t),this._nodes.push(t)}_endBlockNode(t,r){let n=this._currNode;if(n instanceof t||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${t.kind}/${r.kind}`:t.kind}"`)}_elseNode(t){let r=this._currNode;if(!(r instanceof Yr))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=t,this}get _root(){return this._nodes[0]}get _currNode(){let t=this._nodes;return t[t.length-1]}set _currNode(t){let r=this._nodes;r[r.length-1]=t}};F.CodeGen=Ef;function en(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function Wa(e,t){return t instanceof B._CodeOrName?en(e,t.names):e}function Wn(e,t,r){if(e instanceof B.Name)return n(e);if(!o(e))return e;return new B._Code(e._items.reduce((s,i)=>(i instanceof B.Name&&(i=n(i)),i instanceof B._Code?s.push(...i._items):s.push(i),s),[]));function n(s){let i=r[s.str];return i===void 0||t[s.str]!==1?s:(delete t[s.str],i)}function o(s){return s instanceof B._Code&&s._items.some(i=>i instanceof B.Name&&t[i.str]===1&&r[i.str]!==void 0)}}function TN(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function $w(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,B._)`!${Tf(e)}`}F.not=$w;var ON=ww(F.operators.AND);function RN(...e){return e.reduce(ON)}F.and=RN;var IN=ww(F.operators.OR);function CN(...e){return e.reduce(IN)}F.or=CN;function ww(e){return(t,r)=>t===B.nil?r:r===B.nil?t:(0,B._)`${Tf(t)} ${e} ${Tf(r)}`}function Tf(e){return e instanceof B.Name?e:(0,B._)`(${e})`}});var X=$(H=>{"use strict";Object.defineProperty(H,"__esModule",{value:!0});H.checkStrictMode=H.getErrorPath=H.Type=H.useFunc=H.setEvaluated=H.evaluatedPropsToName=H.mergeEvaluated=H.eachItem=H.unescapeJsonPointer=H.escapeJsonPointer=H.escapeFragment=H.unescapeFragment=H.schemaRefOrVal=H.schemaHasRulesButRef=H.schemaHasRules=H.checkUnknownRules=H.alwaysValidSchema=H.toHash=void 0;var de=U(),NN=ws();function AN(e){let t={};for(let r of e)t[r]=!0;return t}H.toHash=AN;function jN(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(xw(e,t),!zw(t,e.self.RULES.all))}H.alwaysValidSchema=jN;function xw(e,t=e.schema){let{opts:r,self:n}=e;if(!r.strictSchema||typeof t=="boolean")return;let o=n.RULES.keywords;for(let s in t)o[s]||Ew(e,`unknown keyword: "${s}"`)}H.checkUnknownRules=xw;function zw(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}H.schemaHasRules=zw;function qN(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}H.schemaHasRulesButRef=qN;function MN({topSchemaRef:e,schemaPath:t},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,de._)`${r}`}return(0,de._)`${e}${t}${(0,de.getProperty)(n)}`}H.schemaRefOrVal=MN;function DN(e){return Pw(decodeURIComponent(e))}H.unescapeFragment=DN;function ZN(e){return encodeURIComponent(Rf(e))}H.escapeFragment=ZN;function Rf(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}H.escapeJsonPointer=Rf;function Pw(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}H.unescapeJsonPointer=Pw;function UN(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}H.eachItem=UN;function bw({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(o,s,i,a)=>{let c=i===void 0?s:i instanceof de.Name?(s instanceof de.Name?e(o,s,i):t(o,s,i),i):s instanceof de.Name?(t(o,i,s),s):r(s,i);return a===de.Name&&!(c instanceof de.Name)?n(o,c):c}}H.mergeEvaluated={props:bw({mergeNames:(e,t,r)=>e.if((0,de._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,de._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,de._)`${r} || {}`).code((0,de._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,de._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,de._)`${r} || {}`),If(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:kw}),items:bw({mergeNames:(e,t,r)=>e.if((0,de._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,de._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,de._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,de._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function kw(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",(0,de._)`{}`);return t!==void 0&&If(e,r,t),r}H.evaluatedPropsToName=kw;function If(e,t,r){Object.keys(r).forEach(n=>e.assign((0,de._)`${t}${(0,de.getProperty)(n)}`,!0))}H.setEvaluated=If;var Sw={};function LN(e,t){return e.scopeValue("func",{ref:t,code:Sw[t.code]||(Sw[t.code]=new NN._Code(t.code))})}H.useFunc=LN;var Of;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Of||(H.Type=Of={}));function FN(e,t,r){if(e instanceof de.Name){let n=t===Of.Num;return r?n?(0,de._)`"[" + ${e} + "]"`:(0,de._)`"['" + ${e} + "']"`:n?(0,de._)`"/" + ${e}`:(0,de._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,de.getProperty)(e).toString():"/"+Rf(e)}H.getErrorPath=FN;function Ew(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,r===!0)throw new Error(t);e.self.logger.warn(t)}}H.checkStrictMode=Ew});var ar=$(Cf=>{"use strict";Object.defineProperty(Cf,"__esModule",{value:!0});var Le=U(),VN={data:new Le.Name("data"),valCxt:new Le.Name("valCxt"),instancePath:new Le.Name("instancePath"),parentData:new Le.Name("parentData"),parentDataProperty:new Le.Name("parentDataProperty"),rootData:new Le.Name("rootData"),dynamicAnchors:new Le.Name("dynamicAnchors"),vErrors:new Le.Name("vErrors"),errors:new Le.Name("errors"),this:new Le.Name("this"),self:new Le.Name("self"),scope:new Le.Name("scope"),json:new Le.Name("json"),jsonPos:new Le.Name("jsonPos"),jsonLen:new Le.Name("jsonLen"),jsonPart:new Le.Name("jsonPart")};Cf.default=VN});var ks=$(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.extendErrors=Fe.resetErrorsCount=Fe.reportExtraError=Fe.reportError=Fe.keyword$DataError=Fe.keywordError=void 0;var Y=U(),Ya=X(),Be=ar();Fe.keywordError={message:({keyword:e})=>(0,Y.str)`must pass "${e}" keyword validation`};Fe.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,Y.str)`"${e}" keyword must be ${t} ($data)`:(0,Y.str)`"${e}" keyword is invalid ($data)`};function KN(e,t=Fe.keywordError,r,n){let{it:o}=e,{gen:s,compositeRule:i,allErrors:a}=o,c=Rw(e,t,r);n??(i||a)?Tw(s,c):Ow(o,(0,Y._)`[${c}]`)}Fe.reportError=KN;function HN(e,t=Fe.keywordError,r){let{it:n}=e,{gen:o,compositeRule:s,allErrors:i}=n,a=Rw(e,t,r);Tw(o,a),s||i||Ow(n,Be.default.vErrors)}Fe.reportExtraError=HN;function JN(e,t){e.assign(Be.default.errors,t),e.if((0,Y._)`${Be.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,Y._)`${Be.default.vErrors}.length`,t),()=>e.assign(Be.default.vErrors,null)))}Fe.resetErrorsCount=JN;function BN({gen:e,keyword:t,schemaValue:r,data:n,errsCount:o,it:s}){if(o===void 0)throw new Error("ajv implementation error");let i=e.name("err");e.forRange("i",o,Be.default.errors,a=>{e.const(i,(0,Y._)`${Be.default.vErrors}[${a}]`),e.if((0,Y._)`${i}.instancePath === undefined`,()=>e.assign((0,Y._)`${i}.instancePath`,(0,Y.strConcat)(Be.default.instancePath,s.errorPath))),e.assign((0,Y._)`${i}.schemaPath`,(0,Y.str)`${s.errSchemaPath}/${t}`),s.opts.verbose&&(e.assign((0,Y._)`${i}.schema`,r),e.assign((0,Y._)`${i}.data`,n))})}Fe.extendErrors=BN;function Tw(e,t){let r=e.const("err",t);e.if((0,Y._)`${Be.default.vErrors} === null`,()=>e.assign(Be.default.vErrors,(0,Y._)`[${r}]`),(0,Y._)`${Be.default.vErrors}.push(${r})`),e.code((0,Y._)`${Be.default.errors}++`)}function Ow(e,t){let{gen:r,validateName:n,schemaEnv:o}=e;o.$async?r.throw((0,Y._)`new ${e.ValidationError}(${t})`):(r.assign((0,Y._)`${n}.errors`,t),r.return(!1))}var tn={keyword:new Y.Name("keyword"),schemaPath:new Y.Name("schemaPath"),params:new Y.Name("params"),propertyName:new Y.Name("propertyName"),message:new Y.Name("message"),schema:new Y.Name("schema"),parentSchema:new Y.Name("parentSchema")};function Rw(e,t,r){let{createErrors:n}=e.it;return n===!1?(0,Y._)`{}`:GN(e,t,r)}function GN(e,t,r={}){let{gen:n,it:o}=e,s=[WN(o,r),XN(e,r)];return YN(e,t,s),n.object(...s)}function WN({errorPath:e},{instancePath:t}){let r=t?(0,Y.str)`${e}${(0,Ya.getErrorPath)(t,Ya.Type.Str)}`:e;return[Be.default.instancePath,(0,Y.strConcat)(Be.default.instancePath,r)]}function XN({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let o=n?t:(0,Y.str)`${t}/${e}`;return r&&(o=(0,Y.str)`${o}${(0,Ya.getErrorPath)(r,Ya.Type.Str)}`),[tn.schemaPath,o]}function YN(e,{params:t,message:r},n){let{keyword:o,data:s,schemaValue:i,it:a}=e,{opts:c,propertyName:l,topSchemaRef:u,schemaPath:d}=a;n.push([tn.keyword,o],[tn.params,typeof t=="function"?t(e):t||(0,Y._)`{}`]),c.messages&&n.push([tn.message,typeof r=="function"?r(e):r]),c.verbose&&n.push([tn.schema,i],[tn.parentSchema,(0,Y._)`${u}${d}`],[Be.default.data,s]),l&&n.push([tn.propertyName,l])}});var Cw=$(Xn=>{"use strict";Object.defineProperty(Xn,"__esModule",{value:!0});Xn.boolOrEmptySchema=Xn.topBoolOrEmptySchema=void 0;var QN=ks(),eA=U(),tA=ar(),rA={message:"boolean schema is false"};function nA(e){let{gen:t,schema:r,validateName:n}=e;r===!1?Iw(e,!1):typeof r=="object"&&r.$async===!0?t.return(tA.default.data):(t.assign((0,eA._)`${n}.errors`,null),t.return(!0))}Xn.topBoolOrEmptySchema=nA;function oA(e,t){let{gen:r,schema:n}=e;n===!1?(r.var(t,!1),Iw(e)):r.var(t,!0)}Xn.boolOrEmptySchema=oA;function Iw(e,t){let{gen:r,data:n}=e,o={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,QN.reportError)(o,rA,void 0,t)}});var Nf=$(Yn=>{"use strict";Object.defineProperty(Yn,"__esModule",{value:!0});Yn.getRules=Yn.isJSONType=void 0;var sA=["string","number","integer","boolean","null","object","array"],iA=new Set(sA);function aA(e){return typeof e=="string"&&iA.has(e)}Yn.isJSONType=aA;function cA(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}Yn.getRules=cA});var Af=$(Pr=>{"use strict";Object.defineProperty(Pr,"__esModule",{value:!0});Pr.shouldUseRule=Pr.shouldUseGroup=Pr.schemaHasRulesForType=void 0;function uA({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&Nw(e,n)}Pr.schemaHasRulesForType=uA;function Nw(e,t){return t.rules.some(r=>Aw(e,r))}Pr.shouldUseGroup=Nw;function Aw(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(n=>e[n]!==void 0))}Pr.shouldUseRule=Aw});var Es=$(Ve=>{"use strict";Object.defineProperty(Ve,"__esModule",{value:!0});Ve.reportTypeError=Ve.checkDataTypes=Ve.checkDataType=Ve.coerceAndCheckDataType=Ve.getJSONTypes=Ve.getSchemaTypes=Ve.DataType=void 0;var lA=Nf(),dA=Af(),fA=ks(),Z=U(),jw=X(),Qn;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(Qn||(Ve.DataType=Qn={}));function pA(e){let t=qw(e.type);if(t.includes("null")){if(e.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');e.nullable===!0&&t.push("null")}return t}Ve.getSchemaTypes=pA;function qw(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(lA.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}Ve.getJSONTypes=qw;function mA(e,t){let{gen:r,data:n,opts:o}=e,s=hA(t,o.coerceTypes),i=t.length>0&&!(s.length===0&&t.length===1&&(0,dA.schemaHasRulesForType)(e,t[0]));if(i){let a=qf(t,n,o.strictNumbers,Qn.Wrong);r.if(a,()=>{s.length?gA(e,t,s):Mf(e)})}return i}Ve.coerceAndCheckDataType=mA;var Mw=new Set(["string","number","integer","boolean","null"]);function hA(e,t){return t?e.filter(r=>Mw.has(r)||t==="array"&&r==="array"):[]}function gA(e,t,r){let{gen:n,data:o,opts:s}=e,i=n.let("dataType",(0,Z._)`typeof ${o}`),a=n.let("coerced",(0,Z._)`undefined`);s.coerceTypes==="array"&&n.if((0,Z._)`${i} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,(0,Z._)`${o}[0]`).assign(i,(0,Z._)`typeof ${o}`).if(qf(t,o,s.strictNumbers),()=>n.assign(a,o))),n.if((0,Z._)`${a} !== undefined`);for(let l of r)(Mw.has(l)||l==="array"&&s.coerceTypes==="array")&&c(l);n.else(),Mf(e),n.endIf(),n.if((0,Z._)`${a} !== undefined`,()=>{n.assign(o,a),_A(e,a)});function c(l){switch(l){case"string":n.elseIf((0,Z._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,Z._)`"" + ${o}`).elseIf((0,Z._)`${o} === null`).assign(a,(0,Z._)`""`);return;case"number":n.elseIf((0,Z._)`${i} == "boolean" || ${o} === null
|
|
10
|
+
|| (${i} == "string" && ${o} && ${o} == +${o})`).assign(a,(0,Z._)`+${o}`);return;case"integer":n.elseIf((0,Z._)`${i} === "boolean" || ${o} === null
|
|
11
|
+
|| (${i} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(a,(0,Z._)`+${o}`);return;case"boolean":n.elseIf((0,Z._)`${o} === "false" || ${o} === 0 || ${o} === null`).assign(a,!1).elseIf((0,Z._)`${o} === "true" || ${o} === 1`).assign(a,!0);return;case"null":n.elseIf((0,Z._)`${o} === "" || ${o} === 0 || ${o} === false`),n.assign(a,null);return;case"array":n.elseIf((0,Z._)`${i} === "string" || ${i} === "number"
|
|
12
|
+
|| ${i} === "boolean" || ${o} === null`).assign(a,(0,Z._)`[${o}]`)}}}function _A({gen:e,parentData:t,parentDataProperty:r},n){e.if((0,Z._)`${t} !== undefined`,()=>e.assign((0,Z._)`${t}[${r}]`,n))}function jf(e,t,r,n=Qn.Correct){let o=n===Qn.Correct?Z.operators.EQ:Z.operators.NEQ,s;switch(e){case"null":return(0,Z._)`${t} ${o} null`;case"array":s=(0,Z._)`Array.isArray(${t})`;break;case"object":s=(0,Z._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":s=i((0,Z._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":s=i();break;default:return(0,Z._)`typeof ${t} ${o} ${e}`}return n===Qn.Correct?s:(0,Z.not)(s);function i(a=Z.nil){return(0,Z.and)((0,Z._)`typeof ${t} == "number"`,a,r?(0,Z._)`isFinite(${t})`:Z.nil)}}Ve.checkDataType=jf;function qf(e,t,r,n){if(e.length===1)return jf(e[0],t,r,n);let o,s=(0,jw.toHash)(e);if(s.array&&s.object){let i=(0,Z._)`typeof ${t} != "object"`;o=s.null?i:(0,Z._)`!${t} || ${i}`,delete s.null,delete s.array,delete s.object}else o=Z.nil;s.number&&delete s.integer;for(let i in s)o=(0,Z.and)(o,jf(i,t,r,n));return o}Ve.checkDataTypes=qf;var yA={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,Z._)`{type: ${e}}`:(0,Z._)`{type: ${t}}`};function Mf(e){let t=vA(e);(0,fA.reportError)(t,yA)}Ve.reportTypeError=Mf;function vA(e){let{gen:t,data:r,schema:n}=e,o=(0,jw.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:e}}});var Zw=$(Qa=>{"use strict";Object.defineProperty(Qa,"__esModule",{value:!0});Qa.assignDefaults=void 0;var eo=U(),$A=X();function wA(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let o in r)Dw(e,o,r[o].default);else t==="array"&&Array.isArray(n)&&n.forEach((o,s)=>Dw(e,s,o.default))}Qa.assignDefaults=wA;function Dw(e,t,r){let{gen:n,compositeRule:o,data:s,opts:i}=e;if(r===void 0)return;let a=(0,eo._)`${s}${(0,eo.getProperty)(t)}`;if(o){(0,$A.checkStrictMode)(e,`default is ignored for: ${a}`);return}let c=(0,eo._)`${a} === undefined`;i.useDefaults==="empty"&&(c=(0,eo._)`${c} || ${a} === null || ${a} === ""`),n.if(c,(0,eo._)`${a} = ${(0,eo.stringify)(r)}`)}});var $t=$(ae=>{"use strict";Object.defineProperty(ae,"__esModule",{value:!0});ae.validateUnion=ae.validateArray=ae.usePattern=ae.callValidateCode=ae.schemaProperties=ae.allSchemaProperties=ae.noPropertyInData=ae.propertyInData=ae.isOwnProperty=ae.hasPropFunc=ae.reportMissingProp=ae.checkMissingProp=ae.checkReportMissingProp=void 0;var _e=U(),Df=X(),kr=ar(),bA=X();function SA(e,t){let{gen:r,data:n,it:o}=e;r.if(Uf(r,n,t,o.opts.ownProperties),()=>{e.setParams({missingProperty:(0,_e._)`${t}`},!0),e.error()})}ae.checkReportMissingProp=SA;function xA({gen:e,data:t,it:{opts:r}},n,o){return(0,_e.or)(...n.map(s=>(0,_e.and)(Uf(e,t,s,r.ownProperties),(0,_e._)`${o} = ${s}`)))}ae.checkMissingProp=xA;function zA(e,t){e.setParams({missingProperty:t},!0),e.error()}ae.reportMissingProp=zA;function Uw(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,_e._)`Object.prototype.hasOwnProperty`})}ae.hasPropFunc=Uw;function Zf(e,t,r){return(0,_e._)`${Uw(e)}.call(${t}, ${r})`}ae.isOwnProperty=Zf;function PA(e,t,r,n){let o=(0,_e._)`${t}${(0,_e.getProperty)(r)} !== undefined`;return n?(0,_e._)`${o} && ${Zf(e,t,r)}`:o}ae.propertyInData=PA;function Uf(e,t,r,n){let o=(0,_e._)`${t}${(0,_e.getProperty)(r)} === undefined`;return n?(0,_e.or)(o,(0,_e.not)(Zf(e,t,r))):o}ae.noPropertyInData=Uf;function Lw(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}ae.allSchemaProperties=Lw;function kA(e,t){return Lw(t).filter(r=>!(0,Df.alwaysValidSchema)(e,t[r]))}ae.schemaProperties=kA;function EA({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:s},it:i},a,c,l){let u=l?(0,_e._)`${e}, ${t}, ${n}${o}`:t,d=[[kr.default.instancePath,(0,_e.strConcat)(kr.default.instancePath,s)],[kr.default.parentData,i.parentData],[kr.default.parentDataProperty,i.parentDataProperty],[kr.default.rootData,kr.default.rootData]];i.opts.dynamicRef&&d.push([kr.default.dynamicAnchors,kr.default.dynamicAnchors]);let m=(0,_e._)`${u}, ${r.object(...d)}`;return c!==_e.nil?(0,_e._)`${a}.call(${c}, ${m})`:(0,_e._)`${a}(${m})`}ae.callValidateCode=EA;var TA=(0,_e._)`new RegExp`;function OA({gen:e,it:{opts:t}},r){let n=t.unicodeRegExp?"u":"",{regExp:o}=t.code,s=o(r,n);return e.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,_e._)`${o.code==="new RegExp"?TA:(0,bA.useFunc)(e,o)}(${r}, ${n})`})}ae.usePattern=OA;function RA(e){let{gen:t,data:r,keyword:n,it:o}=e,s=t.name("valid");if(o.allErrors){let a=t.let("valid",!0);return i(()=>t.assign(a,!1)),a}return t.var(s,!0),i(()=>t.break()),s;function i(a){let c=t.const("len",(0,_e._)`${r}.length`);t.forRange("i",0,c,l=>{e.subschema({keyword:n,dataProp:l,dataPropType:Df.Type.Num},s),t.if((0,_e.not)(s),a)})}}ae.validateArray=RA;function IA(e){let{gen:t,schema:r,keyword:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,Df.alwaysValidSchema)(o,c))&&!o.opts.unevaluated)return;let i=t.let("valid",!1),a=t.name("_valid");t.block(()=>r.forEach((c,l)=>{let u=e.subschema({keyword:n,schemaProp:l,compositeRule:!0},a);t.assign(i,(0,_e._)`${i} || ${a}`),e.mergeValidEvaluated(u,a)||t.if((0,_e.not)(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}ae.validateUnion=IA});var Kw=$(Vt=>{"use strict";Object.defineProperty(Vt,"__esModule",{value:!0});Vt.validateKeywordUsage=Vt.validSchemaType=Vt.funcKeywordCode=Vt.macroKeywordCode=void 0;var Ge=U(),rn=ar(),CA=$t(),NA=ks();function AA(e,t){let{gen:r,keyword:n,schema:o,parentSchema:s,it:i}=e,a=t.macro.call(i.self,o,s,i),c=Vw(r,n,a);i.opts.validateSchema!==!1&&i.self.validateSchema(a,!0);let l=r.name("valid");e.subschema({schema:a,schemaPath:Ge.nil,errSchemaPath:`${i.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},l),e.pass(l,()=>e.error(!0))}Vt.macroKeywordCode=AA;function jA(e,t){var r;let{gen:n,keyword:o,schema:s,parentSchema:i,$data:a,it:c}=e;MA(c,t);let l=!a&&t.compile?t.compile.call(c.self,s,i,c):t.validate,u=Vw(n,o,l),d=n.let("valid");e.block$data(d,m),e.ok((r=t.valid)!==null&&r!==void 0?r:d);function m(){if(t.errors===!1)h(),t.modifying&&Fw(e),g(()=>e.error());else{let y=t.async?p():f();t.modifying&&Fw(e),g(()=>qA(e,y))}}function p(){let y=n.let("ruleErrs",null);return n.try(()=>h((0,Ge._)`await `),b=>n.assign(d,!1).if((0,Ge._)`${b} instanceof ${c.ValidationError}`,()=>n.assign(y,(0,Ge._)`${b}.errors`),()=>n.throw(b))),y}function f(){let y=(0,Ge._)`${u}.errors`;return n.assign(y,null),h(Ge.nil),y}function h(y=t.async?(0,Ge._)`await `:Ge.nil){let b=c.opts.passContext?rn.default.this:rn.default.self,x=!("compile"in t&&!a||t.schema===!1);n.assign(d,(0,Ge._)`${y}${(0,CA.callValidateCode)(e,u,b,x)}`,t.modifying)}function g(y){var b;n.if((0,Ge.not)((b=t.valid)!==null&&b!==void 0?b:d),y)}}Vt.funcKeywordCode=jA;function Fw(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0,Ge._)`${n.parentData}[${n.parentDataProperty}]`))}function qA(e,t){let{gen:r}=e;r.if((0,Ge._)`Array.isArray(${t})`,()=>{r.assign(rn.default.vErrors,(0,Ge._)`${rn.default.vErrors} === null ? ${t} : ${rn.default.vErrors}.concat(${t})`).assign(rn.default.errors,(0,Ge._)`${rn.default.vErrors}.length`),(0,NA.extendErrors)(e)},()=>e.error())}function MA({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function Vw(e,t,r){if(r===void 0)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Ge.stringify)(r)})}function DA(e,t,r=!1){return!t.length||t.some(n=>n==="array"?Array.isArray(e):n==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==n||r&&typeof e>"u")}Vt.validSchemaType=DA;function ZA({schema:e,opts:t,self:r,errSchemaPath:n},o,s){if(Array.isArray(o.keyword)?!o.keyword.includes(s):o.keyword!==s)throw new Error("ajv implementation error");let i=o.dependencies;if(i?.some(a=>!Object.prototype.hasOwnProperty.call(e,a)))throw new Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(o.validateSchema&&!o.validateSchema(e[s])){let c=`keyword "${s}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}Vt.validateKeywordUsage=ZA});var Jw=$(Er=>{"use strict";Object.defineProperty(Er,"__esModule",{value:!0});Er.extendSubschemaMode=Er.extendSubschemaData=Er.getSubschema=void 0;var Kt=U(),Hw=X();function UA(e,{keyword:t,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:s,topSchemaRef:i}){if(t!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let a=e.schema[t];return r===void 0?{schema:a,schemaPath:(0,Kt._)`${e.schemaPath}${(0,Kt.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:(0,Kt._)`${e.schemaPath}${(0,Kt.getProperty)(t)}${(0,Kt.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,Hw.escapeFragment)(r)}`}}if(n!==void 0){if(o===void 0||s===void 0||i===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:o,topSchemaRef:i,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}Er.getSubschema=UA;function LA(e,t,{dataProp:r,dataPropType:n,data:o,dataTypes:s,propertyName:i}){if(o!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=t;if(r!==void 0){let{errorPath:l,dataPathArr:u,opts:d}=t,m=a.let("data",(0,Kt._)`${t.data}${(0,Kt.getProperty)(r)}`,!0);c(m),e.errorPath=(0,Kt.str)`${l}${(0,Hw.getErrorPath)(r,n,d.jsPropertySyntax)}`,e.parentDataProperty=(0,Kt._)`${r}`,e.dataPathArr=[...u,e.parentDataProperty]}if(o!==void 0){let l=o instanceof Kt.Name?o:a.let("data",o,!0);c(l),i!==void 0&&(e.propertyName=i)}s&&(e.dataTypes=s);function c(l){e.data=l,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,l]}}Er.extendSubschemaData=LA;function FA(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:s}){n!==void 0&&(e.compositeRule=n),o!==void 0&&(e.createErrors=o),s!==void 0&&(e.allErrors=s),e.jtdDiscriminator=t,e.jtdMetadata=r}Er.extendSubschemaMode=FA});var Gw=$((U6,Bw)=>{"use strict";var Tr=Bw.exports=function(e,t,r){typeof t=="function"&&(r=t,t={}),r=t.cb||r;var n=typeof r=="function"?r:r.pre||function(){},o=r.post||function(){};ec(t,n,o,e,"",e)};Tr.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Tr.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Tr.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Tr.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 ec(e,t,r,n,o,s,i,a,c,l){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,o,s,i,a,c,l);for(var u in n){var d=n[u];if(Array.isArray(d)){if(u in Tr.arrayKeywords)for(var m=0;m<d.length;m++)ec(e,t,r,d[m],o+"/"+u+"/"+m,s,o,u,n,m)}else if(u in Tr.propsKeywords){if(d&&typeof d=="object")for(var p in d)ec(e,t,r,d[p],o+"/"+u+"/"+VA(p),s,o,u,n,p)}else(u in Tr.keywords||e.allKeys&&!(u in Tr.skipKeywords))&&ec(e,t,r,d,o+"/"+u,s,o,u,n)}r(n,o,s,i,a,c,l)}}function VA(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var Ts=$(it=>{"use strict";Object.defineProperty(it,"__esModule",{value:!0});it.getSchemaRefs=it.resolveUrl=it.normalizeId=it._getFullPath=it.getFullPath=it.inlineRef=void 0;var KA=X(),HA=Qo(),JA=Gw(),BA=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function GA(e,t=!0){return typeof e=="boolean"?!0:t===!0?!Lf(e):t?Ww(e)<=t:!1}it.inlineRef=GA;var WA=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Lf(e){for(let t in e){if(WA.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(Lf)||typeof r=="object"&&Lf(r))return!0}return!1}function Ww(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!BA.has(r)&&(typeof e[r]=="object"&&(0,KA.eachItem)(e[r],n=>t+=Ww(n)),t===1/0))return 1/0}return t}function Xw(e,t="",r){r!==!1&&(t=to(t));let n=e.parse(t);return Yw(e,n)}it.getFullPath=Xw;function Yw(e,t){return e.serialize(t).split("#")[0]+"#"}it._getFullPath=Yw;var XA=/#\/?$/;function to(e){return e?e.replace(XA,""):""}it.normalizeId=to;function YA(e,t,r){return r=to(r),e.resolve(t,r)}it.resolveUrl=YA;var QA=/^[a-z_][-a-z0-9._]*$/i;function ej(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=to(e[r]||t),s={"":o},i=Xw(n,o,!1),a={},c=new Set;return JA(e,{allKeys:!0},(d,m,p,f)=>{if(f===void 0)return;let h=i+m,g=s[f];typeof d[r]=="string"&&(g=y.call(this,d[r])),b.call(this,d.$anchor),b.call(this,d.$dynamicAnchor),s[m]=g;function y(x){let k=this.opts.uriResolver.resolve;if(x=to(g?k(g,x):x),c.has(x))throw u(x);c.add(x);let v=this.refs[x];return typeof v=="string"&&(v=this.refs[v]),typeof v=="object"?l(d,v.schema,x):x!==to(h)&&(x[0]==="#"?(l(d,a[x],x),a[x]=d):this.refs[x]=h),x}function b(x){if(typeof x=="string"){if(!QA.test(x))throw new Error(`invalid anchor "${x}"`);y.call(this,`#${x}`)}}}),a;function l(d,m,p){if(m!==void 0&&!HA(d,m))throw u(p)}function u(d){return new Error(`reference "${d}" resolves to more than one schema`)}}it.getSchemaRefs=ej});var Is=$(Or=>{"use strict";Object.defineProperty(Or,"__esModule",{value:!0});Or.getData=Or.KeywordCxt=Or.validateFunctionCode=void 0;var nb=Cw(),Qw=Es(),Vf=Af(),tc=Es(),tj=Zw(),Rs=Kw(),Ff=Jw(),R=U(),q=ar(),rj=Ts(),cr=X(),Os=ks();function nj(e){if(ib(e)&&(ab(e),sb(e))){ij(e);return}ob(e,()=>(0,nb.topBoolOrEmptySchema)(e))}Or.validateFunctionCode=nj;function ob({gen:e,validateName:t,schema:r,schemaEnv:n,opts:o},s){o.code.es5?e.func(t,(0,R._)`${q.default.data}, ${q.default.valCxt}`,n.$async,()=>{e.code((0,R._)`"use strict"; ${eb(r,o)}`),sj(e,o),e.code(s)}):e.func(t,(0,R._)`${q.default.data}, ${oj(o)}`,n.$async,()=>e.code(eb(r,o)).code(s))}function oj(e){return(0,R._)`{${q.default.instancePath}="", ${q.default.parentData}, ${q.default.parentDataProperty}, ${q.default.rootData}=${q.default.data}${e.dynamicRef?(0,R._)`, ${q.default.dynamicAnchors}={}`:R.nil}}={}`}function sj(e,t){e.if(q.default.valCxt,()=>{e.var(q.default.instancePath,(0,R._)`${q.default.valCxt}.${q.default.instancePath}`),e.var(q.default.parentData,(0,R._)`${q.default.valCxt}.${q.default.parentData}`),e.var(q.default.parentDataProperty,(0,R._)`${q.default.valCxt}.${q.default.parentDataProperty}`),e.var(q.default.rootData,(0,R._)`${q.default.valCxt}.${q.default.rootData}`),t.dynamicRef&&e.var(q.default.dynamicAnchors,(0,R._)`${q.default.valCxt}.${q.default.dynamicAnchors}`)},()=>{e.var(q.default.instancePath,(0,R._)`""`),e.var(q.default.parentData,(0,R._)`undefined`),e.var(q.default.parentDataProperty,(0,R._)`undefined`),e.var(q.default.rootData,q.default.data),t.dynamicRef&&e.var(q.default.dynamicAnchors,(0,R._)`{}`)})}function ij(e){let{schema:t,opts:r,gen:n}=e;ob(e,()=>{r.$comment&&t.$comment&&ub(e),dj(e),n.let(q.default.vErrors,null),n.let(q.default.errors,0),r.unevaluated&&aj(e),cb(e),mj(e)})}function aj(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,R._)`${r}.evaluated`),t.if((0,R._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,R._)`${e.evaluated}.props`,(0,R._)`undefined`)),t.if((0,R._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,R._)`${e.evaluated}.items`,(0,R._)`undefined`))}function eb(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,R._)`/*# sourceURL=${r} */`:R.nil}function cj(e,t){if(ib(e)&&(ab(e),sb(e))){uj(e,t);return}(0,nb.boolOrEmptySchema)(e,t)}function sb({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function ib(e){return typeof e.schema!="boolean"}function uj(e,t){let{schema:r,gen:n,opts:o}=e;o.$comment&&r.$comment&&ub(e),fj(e),pj(e);let s=n.const("_errs",q.default.errors);cb(e,s),n.var(t,(0,R._)`${s} === ${q.default.errors}`)}function ab(e){(0,cr.checkUnknownRules)(e),lj(e)}function cb(e,t){if(e.opts.jtd)return tb(e,[],!1,t);let r=(0,Qw.getSchemaTypes)(e.schema),n=(0,Qw.coerceAndCheckDataType)(e,r);tb(e,r,!n,t)}function lj(e){let{schema:t,errSchemaPath:r,opts:n,self:o}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,cr.schemaHasRulesButRef)(t,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function dj(e){let{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,cr.checkStrictMode)(e,"default is ignored in the schema root")}function fj(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,rj.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function pj(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function ub({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:o}){let s=r.$comment;if(o.$comment===!0)e.code((0,R._)`${q.default.self}.logger.log(${s})`);else if(typeof o.$comment=="function"){let i=(0,R.str)`${n}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code((0,R._)`${q.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function mj(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:o,opts:s}=e;r.$async?t.if((0,R._)`${q.default.errors} === 0`,()=>t.return(q.default.data),()=>t.throw((0,R._)`new ${o}(${q.default.vErrors})`)):(t.assign((0,R._)`${n}.errors`,q.default.vErrors),s.unevaluated&&hj(e),t.return((0,R._)`${q.default.errors} === 0`))}function hj({gen:e,evaluated:t,props:r,items:n}){r instanceof R.Name&&e.assign((0,R._)`${t}.props`,r),n instanceof R.Name&&e.assign((0,R._)`${t}.items`,n)}function tb(e,t,r,n){let{gen:o,schema:s,data:i,allErrors:a,opts:c,self:l}=e,{RULES:u}=l;if(s.$ref&&(c.ignoreKeywordsWithRef||!(0,cr.schemaHasRulesButRef)(s,u))){o.block(()=>db(e,"$ref",u.all.$ref.definition));return}c.jtd||gj(e,t),o.block(()=>{for(let m of u.rules)d(m);d(u.post)});function d(m){(0,Vf.shouldUseGroup)(s,m)&&(m.type?(o.if((0,tc.checkDataType)(m.type,i,c.strictNumbers)),rb(e,m),t.length===1&&t[0]===m.type&&r&&(o.else(),(0,tc.reportTypeError)(e)),o.endIf()):rb(e,m),a||o.if((0,R._)`${q.default.errors} === ${n||0}`))}}function rb(e,t){let{gen:r,schema:n,opts:{useDefaults:o}}=e;o&&(0,tj.assignDefaults)(e,t.type),r.block(()=>{for(let s of t.rules)(0,Vf.shouldUseRule)(n,s)&&db(e,s.keyword,s.definition,t.type)})}function gj(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(_j(e,t),e.opts.allowUnionTypes||yj(e,t),vj(e,e.dataTypes))}function _j(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{lb(e.dataTypes,r)||Kf(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),wj(e,t)}}function yj(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&Kf(e,"use allowUnionTypes to allow union type keyword")}function vj(e,t){let r=e.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&(0,Vf.shouldUseRule)(e.schema,o)){let{type:s}=o.definition;s.length&&!s.some(i=>$j(t,i))&&Kf(e,`missing type "${s.join(",")}" for keyword "${n}"`)}}}function $j(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function lb(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function wj(e,t){let r=[];for(let n of e.dataTypes)lb(t,n)?r.push(n):t.includes("integer")&&n==="number"&&r.push("integer");e.dataTypes=r}function Kf(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,cr.checkStrictMode)(e,t,e.opts.strictTypes)}var rc=class{constructor(t,r,n){if((0,Rs.validateKeywordUsage)(t,r,n),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=n,this.data=t.data,this.schema=t.schema[n],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,cr.schemaRefOrVal)(t,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=r,this.$data)this.schemaCode=t.gen.const("vSchema",fb(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,Rs.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=t.gen.const("_errs",q.default.errors))}result(t,r,n){this.failResult((0,R.not)(t),r,n)}failResult(t,r,n){this.gen.if(t),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,r){this.failResult((0,R.not)(t),void 0,r)}fail(t){if(t===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(t),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);let{schemaCode:r}=this;this.fail((0,R._)`${r} !== undefined && (${(0,R.or)(this.invalid$data(),t)})`)}error(t,r,n){if(r){this.setParams(r),this._error(t,n),this.setParams({});return}this._error(t,n)}_error(t,r){(t?Os.reportExtraError:Os.reportError)(this,this.def.error,r)}$dataError(){(0,Os.reportError)(this,this.def.$dataError||Os.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Os.resetErrorsCount)(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,r){r?Object.assign(this.params,t):this.params=t}block$data(t,r,n=R.nil){this.gen.block(()=>{this.check$data(t,n),r()})}check$data(t=R.nil,r=R.nil){if(!this.$data)return;let{gen:n,schemaCode:o,schemaType:s,def:i}=this;n.if((0,R.or)((0,R._)`${o} === undefined`,r)),t!==R.nil&&n.assign(t,!0),(s.length||i.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),t!==R.nil&&n.assign(t,!1)),n.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:n,def:o,it:s}=this;return(0,R.or)(i(),a());function i(){if(n.length){if(!(r instanceof R.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,R._)`${(0,tc.checkDataTypes)(c,r,s.opts.strictNumbers,tc.DataType.Wrong)}`}return R.nil}function a(){if(o.validateSchema){let c=t.scopeValue("validate$data",{ref:o.validateSchema});return(0,R._)`!${c}(${r})`}return R.nil}}subschema(t,r){let n=(0,Ff.getSubschema)(this.it,t);(0,Ff.extendSubschemaData)(n,this.it,t),(0,Ff.extendSubschemaMode)(n,t);let o={...this.it,...n,items:void 0,props:void 0};return cj(o,r),o}mergeEvaluated(t,r){let{it:n,gen:o}=this;n.opts.unevaluated&&(n.props!==!0&&t.props!==void 0&&(n.props=cr.mergeEvaluated.props(o,t.props,n.props,r)),n.items!==!0&&t.items!==void 0&&(n.items=cr.mergeEvaluated.items(o,t.items,n.items,r)))}mergeValidEvaluated(t,r){let{it:n,gen:o}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return o.if(r,()=>this.mergeEvaluated(t,R.Name)),!0}};Or.KeywordCxt=rc;function db(e,t,r,n){let o=new rc(e,r,t);"code"in r?r.code(o,n):o.$data&&r.validate?(0,Rs.funcKeywordCode)(o,r):"macro"in r?(0,Rs.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,Rs.funcKeywordCode)(o,r)}var bj=/^\/(?:[^~]|~0|~1)*$/,Sj=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function fb(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let o,s;if(e==="")return q.default.rootData;if(e[0]==="/"){if(!bj.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);o=e,s=q.default.rootData}else{let l=Sj.exec(e);if(!l)throw new Error(`Invalid JSON-pointer: ${e}`);let u=+l[1];if(o=l[2],o==="#"){if(u>=t)throw new Error(c("property/index",u));return n[t-u]}if(u>t)throw new Error(c("data",u));if(s=r[t-u],!o)return s}let i=s,a=o.split("/");for(let l of a)l&&(s=(0,R._)`${s}${(0,R.getProperty)((0,cr.unescapeJsonPointer)(l))}`,i=(0,R._)`${i} && ${s}`);return i;function c(l,u){return`Cannot access ${l} ${u} levels up, current level is ${t}`}}Or.getData=fb});var nc=$(Jf=>{"use strict";Object.defineProperty(Jf,"__esModule",{value:!0});var Hf=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}};Jf.default=Hf});var Cs=$(Wf=>{"use strict";Object.defineProperty(Wf,"__esModule",{value:!0});var Bf=Ts(),Gf=class extends Error{constructor(t,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,Bf.resolveUrl)(t,r,n),this.missingSchema=(0,Bf.normalizeId)((0,Bf.getFullPath)(t,this.missingRef))}};Wf.default=Gf});var sc=$(wt=>{"use strict";Object.defineProperty(wt,"__esModule",{value:!0});wt.resolveSchema=wt.getCompilingSchema=wt.resolveRef=wt.compileSchema=wt.SchemaEnv=void 0;var Ct=U(),xj=nc(),nn=ar(),Nt=Ts(),pb=X(),zj=Is(),ro=class{constructor(t){var r;this.refs={},this.dynamicAnchors={};let n;typeof t.schema=="object"&&(n=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=(r=t.baseId)!==null&&r!==void 0?r:(0,Nt.normalizeId)(n?.[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=n?.$async,this.refs={}}};wt.SchemaEnv=ro;function Yf(e){let t=mb.call(this,e);if(t)return t;let r=(0,Nt.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:s}=this.opts,i=new Ct.CodeGen(this.scope,{es5:n,lines:o,ownProperties:s}),a;e.$async&&(a=i.scopeValue("Error",{ref:xj.default,code:(0,Ct._)`require("ajv/dist/runtime/validation_error").default`}));let c=i.scopeName("validate");e.validateName=c;let l={gen:i,allErrors:this.opts.allErrors,data:nn.default.data,parentData:nn.default.parentData,parentDataProperty:nn.default.parentDataProperty,dataNames:[nn.default.data],dataPathArr:[Ct.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,Ct.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:Ct.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Ct._)`""`,opts:this.opts,self:this},u;try{this._compilations.add(e),(0,zj.validateFunctionCode)(l),i.optimize(this.opts.code.optimize);let d=i.toString();u=`${i.scopeRefs(nn.default.scope)}return ${d}`,this.opts.code.process&&(u=this.opts.code.process(u,e));let p=new Function(`${nn.default.self}`,`${nn.default.scope}`,u)(this,this.scope.get());if(this.scope.value(c,{ref:p}),p.errors=null,p.schema=e.schema,p.schemaEnv=e,e.$async&&(p.$async=!0),this.opts.code.source===!0&&(p.source={validateName:c,validateCode:d,scopeValues:i._values}),this.opts.unevaluated){let{props:f,items:h}=l;p.evaluated={props:f instanceof Ct.Name?void 0:f,items:h instanceof Ct.Name?void 0:h,dynamicProps:f instanceof Ct.Name,dynamicItems:h instanceof Ct.Name},p.source&&(p.source.evaluated=(0,Ct.stringify)(p.evaluated))}return e.validate=p,e}catch(d){throw delete e.validate,delete e.validateName,u&&this.logger.error("Error compiling schema, function code:",u),d}finally{this._compilations.delete(e)}}wt.compileSchema=Yf;function Pj(e,t,r){var n;r=(0,Nt.resolveUrl)(this.opts.uriResolver,t,r);let o=e.refs[r];if(o)return o;let s=Tj.call(this,e,r);if(s===void 0){let i=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;i&&(s=new ro({schema:i,schemaId:a,root:e,baseId:t}))}if(s!==void 0)return e.refs[r]=kj.call(this,s)}wt.resolveRef=Pj;function kj(e){return(0,Nt.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:Yf.call(this,e)}function mb(e){for(let t of this._compilations)if(Ej(t,e))return t}wt.getCompilingSchema=mb;function Ej(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function Tj(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||oc.call(this,e,t)}function oc(e,t){let r=this.opts.uriResolver.parse(t),n=(0,Nt._getFullPath)(this.opts.uriResolver,r),o=(0,Nt.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===o)return Xf.call(this,r,e);let s=(0,Nt.normalizeId)(n),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=oc.call(this,e,i);return typeof a?.schema!="object"?void 0:Xf.call(this,r,a)}if(typeof i?.schema=="object"){if(i.validate||Yf.call(this,i),s===(0,Nt.normalizeId)(t)){let{schema:a}=i,{schemaId:c}=this.opts,l=a[c];return l&&(o=(0,Nt.resolveUrl)(this.opts.uriResolver,o,l)),new ro({schema:a,schemaId:c,root:e,baseId:o})}return Xf.call(this,r,i)}}wt.resolveSchema=oc;var Oj=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Xf(e,{baseId:t,schema:r,root:n}){var o;if(((o=e.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,pb.unescapeFragment)(a)];if(c===void 0)return;r=c;let l=typeof r=="object"&&r[this.opts.schemaId];!Oj.has(a)&&l&&(t=(0,Nt.resolveUrl)(this.opts.uriResolver,t,l))}let s;if(typeof r!="boolean"&&r.$ref&&!(0,pb.schemaHasRulesButRef)(r,this.RULES)){let a=(0,Nt.resolveUrl)(this.opts.uriResolver,t,r.$ref);s=oc.call(this,n,a)}let{schemaId:i}=this.opts;if(s=s||new ro({schema:r,schemaId:i,root:n,baseId:t}),s.schema!==s.root.schema)return s}});var hb=$((J6,Rj)=>{Rj.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var _b=$(Qf=>{"use strict";Object.defineProperty(Qf,"__esModule",{value:!0});var gb=md();gb.code='require("ajv/dist/runtime/uri").default';Qf.default=gb});var zb=$(Ae=>{"use strict";Object.defineProperty(Ae,"__esModule",{value:!0});Ae.CodeGen=Ae.Name=Ae.nil=Ae.stringify=Ae.str=Ae._=Ae.KeywordCxt=void 0;var Ij=Is();Object.defineProperty(Ae,"KeywordCxt",{enumerable:!0,get:function(){return Ij.KeywordCxt}});var no=U();Object.defineProperty(Ae,"_",{enumerable:!0,get:function(){return no._}});Object.defineProperty(Ae,"str",{enumerable:!0,get:function(){return no.str}});Object.defineProperty(Ae,"stringify",{enumerable:!0,get:function(){return no.stringify}});Object.defineProperty(Ae,"nil",{enumerable:!0,get:function(){return no.nil}});Object.defineProperty(Ae,"Name",{enumerable:!0,get:function(){return no.Name}});Object.defineProperty(Ae,"CodeGen",{enumerable:!0,get:function(){return no.CodeGen}});var Cj=nc(),bb=Cs(),Nj=Nf(),Ns=sc(),Aj=U(),As=Ts(),ic=Es(),tp=X(),yb=hb(),jj=_b(),Sb=(e,t)=>new RegExp(e,t);Sb.code="new RegExp";var qj=["removeAdditional","useDefaults","coerceTypes"],Mj=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),Dj={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."},Zj={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},vb=200;function Uj(e){var t,r,n,o,s,i,a,c,l,u,d,m,p,f,h,g,y,b,x,k,v,S,E,ne,M;let oe=e.strict,ct=(t=e.code)===null||t===void 0?void 0:t.optimize,qt=ct===!0||ct===void 0?1:ct||0,Jt=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:Sb,Mt=(o=e.uriResolver)!==null&&o!==void 0?o:jj.default;return{strictSchema:(i=(s=e.strictSchema)!==null&&s!==void 0?s:oe)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=e.strictNumbers)!==null&&a!==void 0?a:oe)!==null&&c!==void 0?c:!0,strictTypes:(u=(l=e.strictTypes)!==null&&l!==void 0?l:oe)!==null&&u!==void 0?u:"log",strictTuples:(m=(d=e.strictTuples)!==null&&d!==void 0?d:oe)!==null&&m!==void 0?m:"log",strictRequired:(f=(p=e.strictRequired)!==null&&p!==void 0?p:oe)!==null&&f!==void 0?f:!1,code:e.code?{...e.code,optimize:qt,regExp:Jt}:{optimize:qt,regExp:Jt},loopRequired:(h=e.loopRequired)!==null&&h!==void 0?h:vb,loopEnum:(g=e.loopEnum)!==null&&g!==void 0?g:vb,meta:(y=e.meta)!==null&&y!==void 0?y:!0,messages:(b=e.messages)!==null&&b!==void 0?b:!0,inlineRefs:(x=e.inlineRefs)!==null&&x!==void 0?x:!0,schemaId:(k=e.schemaId)!==null&&k!==void 0?k:"$id",addUsedSchema:(v=e.addUsedSchema)!==null&&v!==void 0?v:!0,validateSchema:(S=e.validateSchema)!==null&&S!==void 0?S:!0,validateFormats:(E=e.validateFormats)!==null&&E!==void 0?E:!0,unicodeRegExp:(ne=e.unicodeRegExp)!==null&&ne!==void 0?ne:!0,int32range:(M=e.int32range)!==null&&M!==void 0?M:!0,uriResolver:Mt}}var js=class{constructor(t={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...Uj(t)};let{es5:r,lines:n}=this.opts.code;this.scope=new Aj.ValueScope({scope:{},prefixes:Mj,es5:r,lines:n}),this.logger=Jj(t.logger);let o=t.validateFormats;t.validateFormats=!1,this.RULES=(0,Nj.getRules)(),$b.call(this,Dj,t,"NOT SUPPORTED"),$b.call(this,Zj,t,"DEPRECATED","warn"),this._metaOpts=Kj.call(this),t.formats&&Fj.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&Vj.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),Lj.call(this),t.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:n}=this.opts,o=yb;n==="id"&&(o={...yb},o.id=o.$id,delete o.$id),r&&t&&this.addMetaSchema(o,o[n],!1)}defaultMeta(){let{meta:t,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof t=="object"?t[r]||t:void 0}validate(t,r){let n;if(typeof t=="string"){if(n=this.getSchema(t),!n)throw new Error(`no schema with key or ref "${t}"`)}else n=this.compile(t);let o=n(r);return"$async"in n||(this.errors=n.errors),o}compile(t,r){let n=this._addSchema(t,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(t,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return o.call(this,t,r);async function o(u,d){await s.call(this,u.$schema);let m=this._addSchema(u,d);return m.validate||i.call(this,m)}async function s(u){u&&!this.getSchema(u)&&await o.call(this,{$ref:u},!0)}async function i(u){try{return this._compileSchemaEnv(u)}catch(d){if(!(d instanceof bb.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),i.call(this,u)}}function a({missingSchema:u,missingRef:d}){if(this.refs[u])throw new Error(`AnySchema ${u} is loaded but ${d} cannot be resolved`)}async function c(u){let d=await l.call(this,u);this.refs[u]||await s.call(this,d.$schema),this.refs[u]||this.addSchema(d,u,r)}async function l(u){let d=this._loading[u];if(d)return d;try{return await(this._loading[u]=n(u))}finally{delete this._loading[u]}}}addSchema(t,r,n,o=this.opts.validateSchema){if(Array.isArray(t)){for(let i of t)this.addSchema(i,void 0,n,o);return this}let s;if(typeof t=="object"){let{schemaId:i}=this.opts;if(s=t[i],s!==void 0&&typeof s!="string")throw new Error(`schema ${i} must be string`)}return r=(0,As.normalizeId)(r||s),this._checkUnique(r),this.schemas[r]=this._addSchema(t,n,r,o,!0),this}addMetaSchema(t,r,n=this.opts.validateSchema){return this.addSchema(t,r,!0,n),this}validateSchema(t,r){if(typeof t=="boolean")return!0;let n;if(n=t.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let o=this.validate(n,t);if(!o&&r){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw new Error(s)}return o}getSchema(t){let r;for(;typeof(r=wb.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:n}=this.opts,o=new Ns.SchemaEnv({schema:{},schemaId:n});if(r=Ns.resolveSchema.call(this,o,t),!r)return;this.refs[t]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(t){if(t instanceof RegExp)return this._removeAllSchemas(this.schemas,t),this._removeAllSchemas(this.refs,t),this;switch(typeof t){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=wb.call(this,t);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[t],delete this.refs[t],this}case"object":{let r=t;this._cache.delete(r);let n=t[this.opts.schemaId];return n&&(n=(0,As.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(t){for(let r of t)this.addKeyword(r);return this}addKeyword(t,r){let n;if(typeof t=="string")n=t,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof t=="object"&&r===void 0){if(r=t,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(Gj.call(this,n,r),!r)return(0,tp.eachItem)(n,s=>ep.call(this,s)),this;Xj.call(this,r);let o={...r,type:(0,ic.getJSONTypes)(r.type),schemaType:(0,ic.getJSONTypes)(r.schemaType)};return(0,tp.eachItem)(n,o.type.length===0?s=>ep.call(this,s,o):s=>o.type.forEach(i=>ep.call(this,s,o,i))),this}getKeyword(t){let r=this.RULES.all[t];return typeof r=="object"?r.definition:!!r}removeKeyword(t){let{RULES:r}=this;delete r.keywords[t],delete r.all[t];for(let n of r.rules){let o=n.rules.findIndex(s=>s.keyword===t);o>=0&&n.rules.splice(o,1)}return this}addFormat(t,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[t]=r,this}errorsText(t=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!t||t.length===0?"No errors":t.map(o=>`${n}${o.instancePath} ${o.message}`).reduce((o,s)=>o+r+s)}$dataMetaSchema(t,r){let n=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(let o of r){let s=o.split("/").slice(1),i=t;for(let a of s)i=i[a];for(let a in n){let c=n[a];if(typeof c!="object")continue;let{$data:l}=c.definition,u=i[a];l&&u&&(i[a]=xb(u))}}return t}_removeAllSchemas(t,r){for(let n in t){let o=t[n];(!r||r.test(n))&&(typeof o=="string"?delete t[n]:o&&!o.meta&&(this._cache.delete(o.schema),delete t[n]))}}_addSchema(t,r,n,o=this.opts.validateSchema,s=this.opts.addUsedSchema){let i,{schemaId:a}=this.opts;if(typeof t=="object")i=t[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof t!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(t);if(c!==void 0)return c;n=(0,As.normalizeId)(i||n);let l=As.getSchemaRefs.call(this,t,n);return c=new Ns.SchemaEnv({schema:t,schemaId:a,meta:r,baseId:n,localRefs:l}),this._cache.set(c.schema,c),s&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),o&&this.validateSchema(t,!0),c}_checkUnique(t){if(this.schemas[t]||this.refs[t])throw new Error(`schema with key or id "${t}" already exists`)}_compileSchemaEnv(t){if(t.meta?this._compileMetaSchema(t):Ns.compileSchema.call(this,t),!t.validate)throw new Error("ajv implementation error");return t.validate}_compileMetaSchema(t){let r=this.opts;this.opts=this._metaOpts;try{Ns.compileSchema.call(this,t)}finally{this.opts=r}}};js.ValidationError=Cj.default;js.MissingRefError=bb.default;Ae.default=js;function $b(e,t,r,n="error"){for(let o in e){let s=o;s in t&&this.logger[n](`${r}: option ${o}. ${e[s]}`)}}function wb(e){return e=(0,As.normalizeId)(e),this.schemas[e]||this.refs[e]}function Lj(){let e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function Fj(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function Vj(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}function Kj(){let e={...this.opts};for(let t of qj)delete e[t];return e}var Hj={log(){},warn(){},error(){}};function Jj(e){if(e===!1)return Hj;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}var Bj=/^[a-z_$][a-z0-9_$:-]*$/i;function Gj(e,t){let{RULES:r}=this;if((0,tp.eachItem)(e,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!Bj.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!t&&t.$data&&!("code"in t||"validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function ep(e,t,r){var n;let o=t?.post;if(r&&o)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,i=o?s.post:s.rules.find(({type:c})=>c===r);if(i||(i={type:r,rules:[]},s.rules.push(i)),s.keywords[e]=!0,!t)return;let a={keyword:e,definition:{...t,type:(0,ic.getJSONTypes)(t.type),schemaType:(0,ic.getJSONTypes)(t.schemaType)}};t.before?Wj.call(this,i,a,t.before):i.rules.push(a),s.all[e]=a,(n=t.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function Wj(e,t,r){let n=e.rules.findIndex(o=>o.keyword===r);n>=0?e.rules.splice(n,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function Xj(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=xb(t)),e.validateSchema=this.compile(t,!0))}var Yj={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function xb(e){return{anyOf:[e,Yj]}}});var Pb=$(rp=>{"use strict";Object.defineProperty(rp,"__esModule",{value:!0});var Qj={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};rp.default=Qj});var Ob=$(on=>{"use strict";Object.defineProperty(on,"__esModule",{value:!0});on.callRef=on.getValidate=void 0;var eq=Cs(),kb=$t(),at=U(),oo=ar(),Eb=sc(),ac=X(),tq={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:n}=e,{baseId:o,schemaEnv:s,validateName:i,opts:a,self:c}=n,{root:l}=s;if((r==="#"||r==="#/")&&o===l.baseId)return d();let u=Eb.resolveRef.call(c,l,o,r);if(u===void 0)throw new eq.default(n.opts.uriResolver,o,r);if(u instanceof Eb.SchemaEnv)return m(u);return p(u);function d(){if(s===l)return cc(e,i,s,s.$async);let f=t.scopeValue("root",{ref:l});return cc(e,(0,at._)`${f}.validate`,l,l.$async)}function m(f){let h=Tb(e,f);cc(e,h,f,f.$async)}function p(f){let h=t.scopeValue("schema",a.code.source===!0?{ref:f,code:(0,at.stringify)(f)}:{ref:f}),g=t.name("valid"),y=e.subschema({schema:f,dataTypes:[],schemaPath:at.nil,topSchemaRef:h,errSchemaPath:r},g);e.mergeEvaluated(y),e.ok(g)}}};function Tb(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,at._)`${r.scopeValue("wrapper",{ref:t})}.validate`}on.getValidate=Tb;function cc(e,t,r,n){let{gen:o,it:s}=e,{allErrors:i,schemaEnv:a,opts:c}=s,l=c.passContext?oo.default.this:at.nil;n?u():d();function u(){if(!a.$async)throw new Error("async schema referenced by sync schema");let f=o.let("valid");o.try(()=>{o.code((0,at._)`await ${(0,kb.callValidateCode)(e,t,l)}`),p(t),i||o.assign(f,!0)},h=>{o.if((0,at._)`!(${h} instanceof ${s.ValidationError})`,()=>o.throw(h)),m(h),i||o.assign(f,!1)}),e.ok(f)}function d(){e.result((0,kb.callValidateCode)(e,t,l),()=>p(t),()=>m(t))}function m(f){let h=(0,at._)`${f}.errors`;o.assign(oo.default.vErrors,(0,at._)`${oo.default.vErrors} === null ? ${h} : ${oo.default.vErrors}.concat(${h})`),o.assign(oo.default.errors,(0,at._)`${oo.default.vErrors}.length`)}function p(f){var h;if(!s.opts.unevaluated)return;let g=(h=r?.validate)===null||h===void 0?void 0:h.evaluated;if(s.props!==!0)if(g&&!g.dynamicProps)g.props!==void 0&&(s.props=ac.mergeEvaluated.props(o,g.props,s.props));else{let y=o.var("props",(0,at._)`${f}.evaluated.props`);s.props=ac.mergeEvaluated.props(o,y,s.props,at.Name)}if(s.items!==!0)if(g&&!g.dynamicItems)g.items!==void 0&&(s.items=ac.mergeEvaluated.items(o,g.items,s.items));else{let y=o.var("items",(0,at._)`${f}.evaluated.items`);s.items=ac.mergeEvaluated.items(o,y,s.items,at.Name)}}}on.callRef=cc;on.default=tq});var Rb=$(np=>{"use strict";Object.defineProperty(np,"__esModule",{value:!0});var rq=Pb(),nq=Ob(),oq=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",rq.default,nq.default];np.default=oq});var Ib=$(op=>{"use strict";Object.defineProperty(op,"__esModule",{value:!0});var uc=U(),Rr=uc.operators,lc={maximum:{okStr:"<=",ok:Rr.LTE,fail:Rr.GT},minimum:{okStr:">=",ok:Rr.GTE,fail:Rr.LT},exclusiveMaximum:{okStr:"<",ok:Rr.LT,fail:Rr.GTE},exclusiveMinimum:{okStr:">",ok:Rr.GT,fail:Rr.LTE}},sq={message:({keyword:e,schemaCode:t})=>(0,uc.str)`must be ${lc[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,uc._)`{comparison: ${lc[e].okStr}, limit: ${t}}`},iq={keyword:Object.keys(lc),type:"number",schemaType:"number",$data:!0,error:sq,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,uc._)`${r} ${lc[t].fail} ${n} || isNaN(${r})`)}};op.default=iq});var Cb=$(sp=>{"use strict";Object.defineProperty(sp,"__esModule",{value:!0});var qs=U(),aq={message:({schemaCode:e})=>(0,qs.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,qs._)`{multipleOf: ${e}}`},cq={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:aq,code(e){let{gen:t,data:r,schemaCode:n,it:o}=e,s=o.opts.multipleOfPrecision,i=t.let("res"),a=s?(0,qs._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:(0,qs._)`${i} !== parseInt(${i})`;e.fail$data((0,qs._)`(${n} === 0 || (${i} = ${r}/${n}, ${a}))`)}};sp.default=cq});var Ab=$(ip=>{"use strict";Object.defineProperty(ip,"__esModule",{value:!0});function Nb(e){let t=e.length,r=0,n=0,o;for(;n<t;)r++,o=e.charCodeAt(n++),o>=55296&&o<=56319&&n<t&&(o=e.charCodeAt(n),(o&64512)===56320&&n++);return r}ip.default=Nb;Nb.code='require("ajv/dist/runtime/ucs2length").default'});var jb=$(ap=>{"use strict";Object.defineProperty(ap,"__esModule",{value:!0});var sn=U(),uq=X(),lq=Ab(),dq={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return(0,sn.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,sn._)`{limit: ${e}}`},fq={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:dq,code(e){let{keyword:t,data:r,schemaCode:n,it:o}=e,s=t==="maxLength"?sn.operators.GT:sn.operators.LT,i=o.opts.unicode===!1?(0,sn._)`${r}.length`:(0,sn._)`${(0,uq.useFunc)(e.gen,lq.default)}(${r})`;e.fail$data((0,sn._)`${i} ${s} ${n}`)}};ap.default=fq});var qb=$(cp=>{"use strict";Object.defineProperty(cp,"__esModule",{value:!0});var pq=$t(),mq=X(),so=U(),hq={message:({schemaCode:e})=>(0,so.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,so._)`{pattern: ${e}}`},gq={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:hq,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:s,it:i}=e,a=i.opts.unicodeRegExp?"u":"";if(n){let{regExp:c}=i.opts.code,l=c.code==="new RegExp"?(0,so._)`new RegExp`:(0,mq.useFunc)(t,c),u=t.let("valid");t.try(()=>t.assign(u,(0,so._)`${l}(${s}, ${a}).test(${r})`),()=>t.assign(u,!1)),e.fail$data((0,so._)`!${u}`)}else{let c=(0,pq.usePattern)(e,o);e.fail$data((0,so._)`!${c}.test(${r})`)}}};cp.default=gq});var Mb=$(up=>{"use strict";Object.defineProperty(up,"__esModule",{value:!0});var Ms=U(),_q={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return(0,Ms.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,Ms._)`{limit: ${e}}`},yq={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:_q,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxProperties"?Ms.operators.GT:Ms.operators.LT;e.fail$data((0,Ms._)`Object.keys(${r}).length ${o} ${n}`)}};up.default=yq});var Db=$(lp=>{"use strict";Object.defineProperty(lp,"__esModule",{value:!0});var Ds=$t(),Zs=U(),vq=X(),$q={message:({params:{missingProperty:e}})=>(0,Zs.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,Zs._)`{missingProperty: ${e}}`},wq={keyword:"required",type:"object",schemaType:"array",$data:!0,error:$q,code(e){let{gen:t,schema:r,schemaCode:n,data:o,$data:s,it:i}=e,{opts:a}=i;if(!s&&r.length===0)return;let c=r.length>=a.loopRequired;if(i.allErrors?l():u(),a.strictRequired){let p=e.parentSchema.properties,{definedProperties:f}=e.it;for(let h of r)if(p?.[h]===void 0&&!f.has(h)){let g=i.schemaEnv.baseId+i.errSchemaPath,y=`required property "${h}" is not defined at "${g}" (strictRequired)`;(0,vq.checkStrictMode)(i,y,i.opts.strictRequired)}}function l(){if(c||s)e.block$data(Zs.nil,d);else for(let p of r)(0,Ds.checkReportMissingProp)(e,p)}function u(){let p=t.let("missing");if(c||s){let f=t.let("valid",!0);e.block$data(f,()=>m(p,f)),e.ok(f)}else t.if((0,Ds.checkMissingProp)(e,r,p)),(0,Ds.reportMissingProp)(e,p),t.else()}function d(){t.forOf("prop",n,p=>{e.setParams({missingProperty:p}),t.if((0,Ds.noPropertyInData)(t,o,p,a.ownProperties),()=>e.error())})}function m(p,f){e.setParams({missingProperty:p}),t.forOf(p,n,()=>{t.assign(f,(0,Ds.propertyInData)(t,o,p,a.ownProperties)),t.if((0,Zs.not)(f),()=>{e.error(),t.break()})},Zs.nil)}}};lp.default=wq});var Zb=$(dp=>{"use strict";Object.defineProperty(dp,"__esModule",{value:!0});var Us=U(),bq={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return(0,Us.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,Us._)`{limit: ${e}}`},Sq={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:bq,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxItems"?Us.operators.GT:Us.operators.LT;e.fail$data((0,Us._)`${r}.length ${o} ${n}`)}};dp.default=Sq});var dc=$(fp=>{"use strict";Object.defineProperty(fp,"__esModule",{value:!0});var Ub=Qo();Ub.code='require("ajv/dist/runtime/equal").default';fp.default=Ub});var Lb=$(mp=>{"use strict";Object.defineProperty(mp,"__esModule",{value:!0});var pp=Es(),je=U(),xq=X(),zq=dc(),Pq={message:({params:{i:e,j:t}})=>(0,je.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,je._)`{i: ${e}, j: ${t}}`},kq={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:Pq,code(e){let{gen:t,data:r,$data:n,schema:o,parentSchema:s,schemaCode:i,it:a}=e;if(!n&&!o)return;let c=t.let("valid"),l=s.items?(0,pp.getSchemaTypes)(s.items):[];e.block$data(c,u,(0,je._)`${i} === false`),e.ok(c);function u(){let f=t.let("i",(0,je._)`${r}.length`),h=t.let("j");e.setParams({i:f,j:h}),t.assign(c,!0),t.if((0,je._)`${f} > 1`,()=>(d()?m:p)(f,h))}function d(){return l.length>0&&!l.some(f=>f==="object"||f==="array")}function m(f,h){let g=t.name("item"),y=(0,pp.checkDataTypes)(l,g,a.opts.strictNumbers,pp.DataType.Wrong),b=t.const("indices",(0,je._)`{}`);t.for((0,je._)`;${f}--;`,()=>{t.let(g,(0,je._)`${r}[${f}]`),t.if(y,(0,je._)`continue`),l.length>1&&t.if((0,je._)`typeof ${g} == "string"`,(0,je._)`${g} += "_"`),t.if((0,je._)`typeof ${b}[${g}] == "number"`,()=>{t.assign(h,(0,je._)`${b}[${g}]`),e.error(),t.assign(c,!1).break()}).code((0,je._)`${b}[${g}] = ${f}`)})}function p(f,h){let g=(0,xq.useFunc)(t,zq.default),y=t.name("outer");t.label(y).for((0,je._)`;${f}--;`,()=>t.for((0,je._)`${h} = ${f}; ${h}--;`,()=>t.if((0,je._)`${g}(${r}[${f}], ${r}[${h}])`,()=>{e.error(),t.assign(c,!1).break(y)})))}}};mp.default=kq});var Fb=$(gp=>{"use strict";Object.defineProperty(gp,"__esModule",{value:!0});var hp=U(),Eq=X(),Tq=dc(),Oq={message:"must be equal to constant",params:({schemaCode:e})=>(0,hp._)`{allowedValue: ${e}}`},Rq={keyword:"const",$data:!0,error:Oq,code(e){let{gen:t,data:r,$data:n,schemaCode:o,schema:s}=e;n||s&&typeof s=="object"?e.fail$data((0,hp._)`!${(0,Eq.useFunc)(t,Tq.default)}(${r}, ${o})`):e.fail((0,hp._)`${s} !== ${r}`)}};gp.default=Rq});var Vb=$(_p=>{"use strict";Object.defineProperty(_p,"__esModule",{value:!0});var Ls=U(),Iq=X(),Cq=dc(),Nq={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,Ls._)`{allowedValues: ${e}}`},Aq={keyword:"enum",schemaType:"array",$data:!0,error:Nq,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:s,it:i}=e;if(!n&&o.length===0)throw new Error("enum must have non-empty array");let a=o.length>=i.opts.loopEnum,c,l=()=>c??(c=(0,Iq.useFunc)(t,Cq.default)),u;if(a||n)u=t.let("valid"),e.block$data(u,d);else{if(!Array.isArray(o))throw new Error("ajv implementation error");let p=t.const("vSchema",s);u=(0,Ls.or)(...o.map((f,h)=>m(p,h)))}e.pass(u);function d(){t.assign(u,!1),t.forOf("v",s,p=>t.if((0,Ls._)`${l()}(${r}, ${p})`,()=>t.assign(u,!0).break()))}function m(p,f){let h=o[f];return typeof h=="object"&&h!==null?(0,Ls._)`${l()}(${r}, ${p}[${f}])`:(0,Ls._)`${r} === ${h}`}}};_p.default=Aq});var Kb=$(yp=>{"use strict";Object.defineProperty(yp,"__esModule",{value:!0});var jq=Ib(),qq=Cb(),Mq=jb(),Dq=qb(),Zq=Mb(),Uq=Db(),Lq=Zb(),Fq=Lb(),Vq=Fb(),Kq=Vb(),Hq=[jq.default,qq.default,Mq.default,Dq.default,Zq.default,Uq.default,Lq.default,Fq.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Vq.default,Kq.default];yp.default=Hq});var $p=$(Fs=>{"use strict";Object.defineProperty(Fs,"__esModule",{value:!0});Fs.validateAdditionalItems=void 0;var an=U(),vp=X(),Jq={message:({params:{len:e}})=>(0,an.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,an._)`{limit: ${e}}`},Bq={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Jq,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0,vp.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}Hb(e,n)}};function Hb(e,t){let{gen:r,schema:n,data:o,keyword:s,it:i}=e;i.items=!0;let a=r.const("len",(0,an._)`${o}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,an._)`${a} <= ${t.length}`);else if(typeof n=="object"&&!(0,vp.alwaysValidSchema)(i,n)){let l=r.var("valid",(0,an._)`${a} <= ${t.length}`);r.if((0,an.not)(l),()=>c(l)),e.ok(l)}function c(l){r.forRange("i",t.length,a,u=>{e.subschema({keyword:s,dataProp:u,dataPropType:vp.Type.Num},l),i.allErrors||r.if((0,an.not)(l),()=>r.break())})}}Fs.validateAdditionalItems=Hb;Fs.default=Bq});var wp=$(Vs=>{"use strict";Object.defineProperty(Vs,"__esModule",{value:!0});Vs.validateTuple=void 0;var Jb=U(),fc=X(),Gq=$t(),Wq={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return Bb(e,"additionalItems",t);r.items=!0,!(0,fc.alwaysValidSchema)(r,t)&&e.ok((0,Gq.validateArray)(e))}};function Bb(e,t,r=e.schema){let{gen:n,parentSchema:o,data:s,keyword:i,it:a}=e;u(o),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=fc.mergeEvaluated.items(n,r.length,a.items));let c=n.name("valid"),l=n.const("len",(0,Jb._)`${s}.length`);r.forEach((d,m)=>{(0,fc.alwaysValidSchema)(a,d)||(n.if((0,Jb._)`${l} > ${m}`,()=>e.subschema({keyword:i,schemaProp:m,dataProp:m},c)),e.ok(c))});function u(d){let{opts:m,errSchemaPath:p}=a,f=r.length,h=f===d.minItems&&(f===d.maxItems||d[t]===!1);if(m.strictTuples&&!h){let g=`"${i}" is ${f}-tuple, but minItems or maxItems/${t} are not specified or different at path "${p}"`;(0,fc.checkStrictMode)(a,g,m.strictTuples)}}}Vs.validateTuple=Bb;Vs.default=Wq});var Gb=$(bp=>{"use strict";Object.defineProperty(bp,"__esModule",{value:!0});var Xq=wp(),Yq={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,Xq.validateTuple)(e,"items")};bp.default=Yq});var Xb=$(Sp=>{"use strict";Object.defineProperty(Sp,"__esModule",{value:!0});var Wb=U(),Qq=X(),eM=$t(),tM=$p(),rM={message:({params:{len:e}})=>(0,Wb.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,Wb._)`{limit: ${e}}`},nM={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:rM,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:o}=r;n.items=!0,!(0,Qq.alwaysValidSchema)(n,t)&&(o?(0,tM.validateAdditionalItems)(e,o):e.ok((0,eM.validateArray)(e)))}};Sp.default=nM});var Yb=$(xp=>{"use strict";Object.defineProperty(xp,"__esModule",{value:!0});var bt=U(),pc=X(),oM={message:({params:{min:e,max:t}})=>t===void 0?(0,bt.str)`must contain at least ${e} valid item(s)`:(0,bt.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,bt._)`{minContains: ${e}}`:(0,bt._)`{minContains: ${e}, maxContains: ${t}}`},sM={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:oM,code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:s}=e,i,a,{minContains:c,maxContains:l}=n;s.opts.next?(i=c===void 0?1:c,a=l):i=1;let u=t.const("len",(0,bt._)`${o}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){(0,pc.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,pc.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,pc.alwaysValidSchema)(s,r)){let h=(0,bt._)`${u} >= ${i}`;a!==void 0&&(h=(0,bt._)`${h} && ${u} <= ${a}`),e.pass(h);return}s.items=!0;let d=t.name("valid");a===void 0&&i===1?p(d,()=>t.if(d,()=>t.break())):i===0?(t.let(d,!0),a!==void 0&&t.if((0,bt._)`${o}.length > 0`,m)):(t.let(d,!1),m()),e.result(d,()=>e.reset());function m(){let h=t.name("_valid"),g=t.let("count",0);p(h,()=>t.if(h,()=>f(g)))}function p(h,g){t.forRange("i",0,u,y=>{e.subschema({keyword:"contains",dataProp:y,dataPropType:pc.Type.Num,compositeRule:!0},h),g()})}function f(h){t.code((0,bt._)`${h}++`),a===void 0?t.if((0,bt._)`${h} >= ${i}`,()=>t.assign(d,!0).break()):(t.if((0,bt._)`${h} > ${a}`,()=>t.assign(d,!1).break()),i===1?t.assign(d,!0):t.if((0,bt._)`${h} >= ${i}`,()=>t.assign(d,!0)))}}};xp.default=sM});var tS=$(Ht=>{"use strict";Object.defineProperty(Ht,"__esModule",{value:!0});Ht.validateSchemaDeps=Ht.validatePropertyDeps=Ht.error=void 0;var zp=U(),iM=X(),Ks=$t();Ht.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let n=t===1?"property":"properties";return(0,zp.str)`must have ${n} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>(0,zp._)`{property: ${e},
|
|
13
|
+
missingProperty: ${n},
|
|
14
|
+
depsCount: ${t},
|
|
15
|
+
deps: ${r}}`};var aM={keyword:"dependencies",type:"object",schemaType:"object",error:Ht.error,code(e){let[t,r]=cM(e);Qb(e,t),eS(e,r)}};function cM({schema:e}){let t={},r={};for(let n in e){if(n==="__proto__")continue;let o=Array.isArray(e[n])?t:r;o[n]=e[n]}return[t,r]}function Qb(e,t=e.schema){let{gen:r,data:n,it:o}=e;if(Object.keys(t).length===0)return;let s=r.let("missing");for(let i in t){let a=t[i];if(a.length===0)continue;let c=(0,Ks.propertyInData)(r,n,i,o.opts.ownProperties);e.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),o.allErrors?r.if(c,()=>{for(let l of a)(0,Ks.checkReportMissingProp)(e,l)}):(r.if((0,zp._)`${c} && (${(0,Ks.checkMissingProp)(e,a,s)})`),(0,Ks.reportMissingProp)(e,s),r.else())}}Ht.validatePropertyDeps=Qb;function eS(e,t=e.schema){let{gen:r,data:n,keyword:o,it:s}=e,i=r.name("valid");for(let a in t)(0,iM.alwaysValidSchema)(s,t[a])||(r.if((0,Ks.propertyInData)(r,n,a,s.opts.ownProperties),()=>{let c=e.subschema({keyword:o,schemaProp:a},i);e.mergeValidEvaluated(c,i)},()=>r.var(i,!0)),e.ok(i))}Ht.validateSchemaDeps=eS;Ht.default=aM});var nS=$(Pp=>{"use strict";Object.defineProperty(Pp,"__esModule",{value:!0});var rS=U(),uM=X(),lM={message:"property name must be valid",params:({params:e})=>(0,rS._)`{propertyName: ${e.propertyName}}`},dM={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:lM,code(e){let{gen:t,schema:r,data:n,it:o}=e;if((0,uM.alwaysValidSchema)(o,r))return;let s=t.name("valid");t.forIn("key",n,i=>{e.setParams({propertyName:i}),e.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},s),t.if((0,rS.not)(s),()=>{e.error(!0),o.allErrors||t.break()})}),e.ok(s)}};Pp.default=dM});var Ep=$(kp=>{"use strict";Object.defineProperty(kp,"__esModule",{value:!0});var mc=$t(),At=U(),fM=ar(),hc=X(),pM={message:"must NOT have additional properties",params:({params:e})=>(0,At._)`{additionalProperty: ${e.additionalProperty}}`},mM={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:pM,code(e){let{gen:t,schema:r,parentSchema:n,data:o,errsCount:s,it:i}=e;if(!s)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&(0,hc.alwaysValidSchema)(i,r))return;let l=(0,mc.allSchemaProperties)(n.properties),u=(0,mc.allSchemaProperties)(n.patternProperties);d(),e.ok((0,At._)`${s} === ${fM.default.errors}`);function d(){t.forIn("key",o,g=>{!l.length&&!u.length?f(g):t.if(m(g),()=>f(g))})}function m(g){let y;if(l.length>8){let b=(0,hc.schemaRefOrVal)(i,n.properties,"properties");y=(0,mc.isOwnProperty)(t,b,g)}else l.length?y=(0,At.or)(...l.map(b=>(0,At._)`${g} === ${b}`)):y=At.nil;return u.length&&(y=(0,At.or)(y,...u.map(b=>(0,At._)`${(0,mc.usePattern)(e,b)}.test(${g})`))),(0,At.not)(y)}function p(g){t.code((0,At._)`delete ${o}[${g}]`)}function f(g){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){p(g);return}if(r===!1){e.setParams({additionalProperty:g}),e.error(),a||t.break();return}if(typeof r=="object"&&!(0,hc.alwaysValidSchema)(i,r)){let y=t.name("valid");c.removeAdditional==="failing"?(h(g,y,!1),t.if((0,At.not)(y),()=>{e.reset(),p(g)})):(h(g,y),a||t.if((0,At.not)(y),()=>t.break()))}}function h(g,y,b){let x={keyword:"additionalProperties",dataProp:g,dataPropType:hc.Type.Str};b===!1&&Object.assign(x,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(x,y)}}};kp.default=mM});var iS=$(Op=>{"use strict";Object.defineProperty(Op,"__esModule",{value:!0});var hM=Is(),oS=$t(),Tp=X(),sS=Ep(),gM={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:s}=e;s.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&sS.default.code(new hM.KeywordCxt(s,sS.default,"additionalProperties"));let i=(0,oS.allSchemaProperties)(r);for(let d of i)s.definedProperties.add(d);s.opts.unevaluated&&i.length&&s.props!==!0&&(s.props=Tp.mergeEvaluated.props(t,(0,Tp.toHash)(i),s.props));let a=i.filter(d=>!(0,Tp.alwaysValidSchema)(s,r[d]));if(a.length===0)return;let c=t.name("valid");for(let d of a)l(d)?u(d):(t.if((0,oS.propertyInData)(t,o,d,s.opts.ownProperties)),u(d),s.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(d),e.ok(c);function l(d){return s.opts.useDefaults&&!s.compositeRule&&r[d].default!==void 0}function u(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};Op.default=gM});var lS=$(Rp=>{"use strict";Object.defineProperty(Rp,"__esModule",{value:!0});var aS=$t(),gc=U(),cS=X(),uS=X(),_M={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:o,it:s}=e,{opts:i}=s,a=(0,aS.allSchemaProperties)(r),c=a.filter(h=>(0,cS.alwaysValidSchema)(s,r[h]));if(a.length===0||c.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let l=i.strictSchema&&!i.allowMatchingProperties&&o.properties,u=t.name("valid");s.props!==!0&&!(s.props instanceof gc.Name)&&(s.props=(0,uS.evaluatedPropsToName)(t,s.props));let{props:d}=s;m();function m(){for(let h of a)l&&p(h),s.allErrors?f(h):(t.var(u,!0),f(h),t.if(u))}function p(h){for(let g in l)new RegExp(h).test(g)&&(0,cS.checkStrictMode)(s,`property ${g} matches pattern ${h} (use allowMatchingProperties)`)}function f(h){t.forIn("key",n,g=>{t.if((0,gc._)`${(0,aS.usePattern)(e,h)}.test(${g})`,()=>{let y=c.includes(h);y||e.subschema({keyword:"patternProperties",schemaProp:h,dataProp:g,dataPropType:uS.Type.Str},u),s.opts.unevaluated&&d!==!0?t.assign((0,gc._)`${d}[${g}]`,!0):!y&&!s.allErrors&&t.if((0,gc.not)(u),()=>t.break())})})}}};Rp.default=_M});var dS=$(Ip=>{"use strict";Object.defineProperty(Ip,"__esModule",{value:!0});var yM=X(),vM={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if((0,yM.alwaysValidSchema)(n,r)){e.fail();return}let o=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),e.failResult(o,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};Ip.default=vM});var fS=$(Cp=>{"use strict";Object.defineProperty(Cp,"__esModule",{value:!0});var $M=$t(),wM={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:$M.validateUnion,error:{message:"must match a schema in anyOf"}};Cp.default=wM});var pS=$(Np=>{"use strict";Object.defineProperty(Np,"__esModule",{value:!0});var _c=U(),bM=X(),SM={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,_c._)`{passingSchemas: ${e.passing}}`},xM={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:SM,code(e){let{gen:t,schema:r,parentSchema:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;let s=r,i=t.let("valid",!1),a=t.let("passing",null),c=t.name("_valid");e.setParams({passing:a}),t.block(l),e.result(i,()=>e.reset(),()=>e.error(!0));function l(){s.forEach((u,d)=>{let m;(0,bM.alwaysValidSchema)(o,u)?t.var(c,!0):m=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&t.if((0,_c._)`${c} && ${i}`).assign(i,!1).assign(a,(0,_c._)`[${a}, ${d}]`).else(),t.if(c,()=>{t.assign(i,!0),t.assign(a,d),m&&e.mergeEvaluated(m,_c.Name)})})}}};Np.default=xM});var mS=$(Ap=>{"use strict";Object.defineProperty(Ap,"__esModule",{value:!0});var zM=X(),PM={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");let o=t.name("valid");r.forEach((s,i)=>{if((0,zM.alwaysValidSchema)(n,s))return;let a=e.subschema({keyword:"allOf",schemaProp:i},o);e.ok(o),e.mergeEvaluated(a)})}};Ap.default=PM});var _S=$(jp=>{"use strict";Object.defineProperty(jp,"__esModule",{value:!0});var yc=U(),gS=X(),kM={message:({params:e})=>(0,yc.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,yc._)`{failingKeyword: ${e.ifClause}}`},EM={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:kM,code(e){let{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,gS.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let o=hS(n,"then"),s=hS(n,"else");if(!o&&!s)return;let i=t.let("valid",!0),a=t.name("_valid");if(c(),e.reset(),o&&s){let u=t.let("ifClause");e.setParams({ifClause:u}),t.if(a,l("then",u),l("else",u))}else o?t.if(a,l("then")):t.if((0,yc.not)(a),l("else"));e.pass(i,()=>e.error(!0));function c(){let u=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(u)}function l(u,d){return()=>{let m=e.subschema({keyword:u},a);t.assign(i,a),e.mergeValidEvaluated(m,i),d?t.assign(d,(0,yc._)`${u}`):e.setParams({ifClause:u})}}}};function hS(e,t){let r=e.schema[t];return r!==void 0&&!(0,gS.alwaysValidSchema)(e,r)}jp.default=EM});var yS=$(qp=>{"use strict";Object.defineProperty(qp,"__esModule",{value:!0});var TM=X(),OM={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,TM.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};qp.default=OM});var vS=$(Mp=>{"use strict";Object.defineProperty(Mp,"__esModule",{value:!0});var RM=$p(),IM=Gb(),CM=wp(),NM=Xb(),AM=Yb(),jM=tS(),qM=nS(),MM=Ep(),DM=iS(),ZM=lS(),UM=dS(),LM=fS(),FM=pS(),VM=mS(),KM=_S(),HM=yS();function JM(e=!1){let t=[UM.default,LM.default,FM.default,VM.default,KM.default,HM.default,qM.default,MM.default,jM.default,DM.default,ZM.default];return e?t.push(IM.default,NM.default):t.push(RM.default,CM.default),t.push(AM.default),t}Mp.default=JM});var $S=$(Dp=>{"use strict";Object.defineProperty(Dp,"__esModule",{value:!0});var xe=U(),BM={message:({schemaCode:e})=>(0,xe.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,xe._)`{format: ${e}}`},GM={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:BM,code(e,t){let{gen:r,data:n,$data:o,schema:s,schemaCode:i,it:a}=e,{opts:c,errSchemaPath:l,schemaEnv:u,self:d}=a;if(!c.validateFormats)return;o?m():p();function m(){let f=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),h=r.const("fDef",(0,xe._)`${f}[${i}]`),g=r.let("fType"),y=r.let("format");r.if((0,xe._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(g,(0,xe._)`${h}.type || "string"`).assign(y,(0,xe._)`${h}.validate`),()=>r.assign(g,(0,xe._)`"string"`).assign(y,h)),e.fail$data((0,xe.or)(b(),x()));function b(){return c.strictSchema===!1?xe.nil:(0,xe._)`${i} && !${y}`}function x(){let k=u.$async?(0,xe._)`(${h}.async ? await ${y}(${n}) : ${y}(${n}))`:(0,xe._)`${y}(${n})`,v=(0,xe._)`(typeof ${y} == "function" ? ${k} : ${y}.test(${n}))`;return(0,xe._)`${y} && ${y} !== true && ${g} === ${t} && !${v}`}}function p(){let f=d.formats[s];if(!f){b();return}if(f===!0)return;let[h,g,y]=x(f);h===t&&e.pass(k());function b(){if(c.strictSchema===!1){d.logger.warn(v());return}throw new Error(v());function v(){return`unknown format "${s}" ignored in schema at path "${l}"`}}function x(v){let S=v instanceof RegExp?(0,xe.regexpCode)(v):c.code.formats?(0,xe._)`${c.code.formats}${(0,xe.getProperty)(s)}`:void 0,E=r.scopeValue("formats",{key:s,ref:v,code:S});return typeof v=="object"&&!(v instanceof RegExp)?[v.type||"string",v.validate,(0,xe._)`${E}.validate`]:["string",v,E]}function k(){if(typeof f=="object"&&!(f instanceof RegExp)&&f.async){if(!u.$async)throw new Error("async format in sync schema");return(0,xe._)`await ${y}(${n})`}return typeof g=="function"?(0,xe._)`${y}(${n})`:(0,xe._)`${y}.test(${n})`}}}};Dp.default=GM});var wS=$(Zp=>{"use strict";Object.defineProperty(Zp,"__esModule",{value:!0});var WM=$S(),XM=[WM.default];Zp.default=XM});var bS=$(io=>{"use strict";Object.defineProperty(io,"__esModule",{value:!0});io.contentVocabulary=io.metadataVocabulary=void 0;io.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];io.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var xS=$(Up=>{"use strict";Object.defineProperty(Up,"__esModule",{value:!0});var YM=Rb(),QM=Kb(),eD=vS(),tD=wS(),SS=bS(),rD=[YM.default,QM.default,(0,eD.default)(),tD.default,SS.metadataVocabulary,SS.contentVocabulary];Up.default=rD});var PS=$(vc=>{"use strict";Object.defineProperty(vc,"__esModule",{value:!0});vc.DiscrError=void 0;var zS;(function(e){e.Tag="tag",e.Mapping="mapping"})(zS||(vc.DiscrError=zS={}))});var ES=$(Fp=>{"use strict";Object.defineProperty(Fp,"__esModule",{value:!0});var ao=U(),Lp=PS(),kS=sc(),nD=Cs(),oD=X(),sD={message:({params:{discrError:e,tagName:t}})=>e===Lp.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,ao._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},iD={keyword:"discriminator",type:"object",schemaType:"object",error:sD,code(e){let{gen:t,data:r,schema:n,parentSchema:o,it:s}=e,{oneOf:i}=o;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!i)throw new Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),l=t.const("tag",(0,ao._)`${r}${(0,ao.getProperty)(a)}`);t.if((0,ao._)`typeof ${l} == "string"`,()=>u(),()=>e.error(!1,{discrError:Lp.DiscrError.Tag,tag:l,tagName:a})),e.ok(c);function u(){let p=m();t.if(!1);for(let f in p)t.elseIf((0,ao._)`${l} === ${f}`),t.assign(c,d(p[f]));t.else(),e.error(!1,{discrError:Lp.DiscrError.Mapping,tag:l,tagName:a}),t.endIf()}function d(p){let f=t.name("valid"),h=e.subschema({keyword:"oneOf",schemaProp:p},f);return e.mergeEvaluated(h,ao.Name),f}function m(){var p;let f={},h=y(o),g=!0;for(let k=0;k<i.length;k++){let v=i[k];if(v?.$ref&&!(0,oD.schemaHasRulesButRef)(v,s.self.RULES)){let E=v.$ref;if(v=kS.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,E),v instanceof kS.SchemaEnv&&(v=v.schema),v===void 0)throw new nD.default(s.opts.uriResolver,s.baseId,E)}let S=(p=v?.properties)===null||p===void 0?void 0:p[a];if(typeof S!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);g=g&&(h||y(v)),b(S,k)}if(!g)throw new Error(`discriminator: "${a}" must be required`);return f;function y({required:k}){return Array.isArray(k)&&k.includes(a)}function b(k,v){if(k.const)x(k.const,v);else if(k.enum)for(let S of k.enum)x(S,v);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function x(k,v){if(typeof k!="string"||k in f)throw new Error(`discriminator: "${a}" values must be unique strings`);f[k]=v}}}};Fp.default=iD});var TS=$((AK,aD)=>{aD.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var RS=$((ye,Vp)=>{"use strict";Object.defineProperty(ye,"__esModule",{value:!0});ye.MissingRefError=ye.ValidationError=ye.CodeGen=ye.Name=ye.nil=ye.stringify=ye.str=ye._=ye.KeywordCxt=ye.Ajv=void 0;var cD=zb(),uD=xS(),lD=ES(),OS=TS(),dD=["/properties"],$c="http://json-schema.org/draft-07/schema",co=class extends cD.default{_addVocabularies(){super._addVocabularies(),uD.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(lD.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(OS,dD):OS;this.addMetaSchema(t,$c,!1),this.refs["http://json-schema.org/schema"]=$c}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema($c)?$c:void 0)}};ye.Ajv=co;Vp.exports=ye=co;Vp.exports.Ajv=co;Object.defineProperty(ye,"__esModule",{value:!0});ye.default=co;var fD=Is();Object.defineProperty(ye,"KeywordCxt",{enumerable:!0,get:function(){return fD.KeywordCxt}});var uo=U();Object.defineProperty(ye,"_",{enumerable:!0,get:function(){return uo._}});Object.defineProperty(ye,"str",{enumerable:!0,get:function(){return uo.str}});Object.defineProperty(ye,"stringify",{enumerable:!0,get:function(){return uo.stringify}});Object.defineProperty(ye,"nil",{enumerable:!0,get:function(){return uo.nil}});Object.defineProperty(ye,"Name",{enumerable:!0,get:function(){return uo.Name}});Object.defineProperty(ye,"CodeGen",{enumerable:!0,get:function(){return uo.CodeGen}});var pD=nc();Object.defineProperty(ye,"ValidationError",{enumerable:!0,get:function(){return pD.default}});var mD=Cs();Object.defineProperty(ye,"MissingRefError",{enumerable:!0,get:function(){return mD.default}})});var IS=$(lo=>{"use strict";Object.defineProperty(lo,"__esModule",{value:!0});lo.formatLimitDefinition=void 0;var hD=RS(),jt=U(),Ir=jt.operators,wc={formatMaximum:{okStr:"<=",ok:Ir.LTE,fail:Ir.GT},formatMinimum:{okStr:">=",ok:Ir.GTE,fail:Ir.LT},formatExclusiveMaximum:{okStr:"<",ok:Ir.LT,fail:Ir.GTE},formatExclusiveMinimum:{okStr:">",ok:Ir.GT,fail:Ir.LTE}},gD={message:({keyword:e,schemaCode:t})=>(0,jt.str)`should be ${wc[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,jt._)`{comparison: ${wc[e].okStr}, limit: ${t}}`};lo.formatLimitDefinition={keyword:Object.keys(wc),type:"string",schemaType:"string",$data:!0,error:gD,code(e){let{gen:t,data:r,schemaCode:n,keyword:o,it:s}=e,{opts:i,self:a}=s;if(!i.validateFormats)return;let c=new hD.KeywordCxt(s,a.RULES.all.format.definition,"format");c.$data?l():u();function l(){let m=t.scopeValue("formats",{ref:a.formats,code:i.code.formats}),p=t.const("fmt",(0,jt._)`${m}[${c.schemaCode}]`);e.fail$data((0,jt.or)((0,jt._)`typeof ${p} != "object"`,(0,jt._)`${p} instanceof RegExp`,(0,jt._)`typeof ${p}.compare != "function"`,d(p)))}function u(){let m=c.schema,p=a.formats[m];if(!p||p===!0)return;if(typeof p!="object"||p instanceof RegExp||typeof p.compare!="function")throw new Error(`"${o}": format "${m}" does not define "compare" function`);let f=t.scopeValue("formats",{key:m,ref:p,code:i.code.formats?(0,jt._)`${i.code.formats}${(0,jt.getProperty)(m)}`:void 0});e.fail$data(d(f))}function d(m){return(0,jt._)`${m}.compare(${r}, ${n}) ${wc[o].fail} 0`}},dependencies:["format"]};var _D=e=>(e.addKeyword(lo.formatLimitDefinition),e);lo.default=_D});var jS=$((Hs,AS)=>{"use strict";Object.defineProperty(Hs,"__esModule",{value:!0});var fo=_w(),yD=IS(),Kp=U(),CS=new Kp.Name("fullFormats"),vD=new Kp.Name("fastFormats"),Hp=(e,t={keywords:!0})=>{if(Array.isArray(t))return NS(e,t,fo.fullFormats,CS),e;let[r,n]=t.mode==="fast"?[fo.fastFormats,vD]:[fo.fullFormats,CS],o=t.formats||fo.formatNames;return NS(e,o,r,n),t.keywords&&(0,yD.default)(e),e};Hp.get=(e,t="full")=>{let n=(t==="fast"?fo.fastFormats:fo.fullFormats)[e];if(!n)throw new Error(`Unknown format "${e}"`);return n};function NS(e,t,r,n){var o,s;(o=(s=e.opts.code).formats)!==null&&o!==void 0||(s.formats=(0,Kp._)`require("ajv-formats/dist/formats").${n}`);for(let i of t)e.addFormat(i,r[i])}AS.exports=Hs=Hp;Object.defineProperty(Hs,"__esModule",{value:!0});Hs.default=Hp});var KS=$((BK,VS)=>{VS.exports=FS;FS.sync=SD;var US=require("fs");function bD(e,t){var r=t.pathExt!==void 0?t.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n<r.length;n++){var o=r[n].toLowerCase();if(o&&e.substr(-o.length).toLowerCase()===o)return!0}return!1}function LS(e,t,r){return!e.isSymbolicLink()&&!e.isFile()?!1:bD(t,r)}function FS(e,t,r){US.stat(e,function(n,o){r(n,n?!1:LS(o,e,t))})}function SD(e,t){return LS(US.statSync(e),e,t)}});var WS=$((GK,GS)=>{GS.exports=JS;JS.sync=xD;var HS=require("fs");function JS(e,t,r){HS.stat(e,function(n,o){r(n,n?!1:BS(o,t))})}function xD(e,t){return BS(HS.statSync(e),t)}function BS(e,t){return e.isFile()&&zD(e,t)}function zD(e,t){var r=e.mode,n=e.uid,o=e.gid,s=t.uid!==void 0?t.uid:process.getuid&&process.getuid(),i=t.gid!==void 0?t.gid:process.getgid&&process.getgid(),a=parseInt("100",8),c=parseInt("010",8),l=parseInt("001",8),u=a|c,d=r&l||r&c&&o===i||r&a&&n===s||r&u&&s===0;return d}});var YS=$((XK,XS)=>{var WK=require("fs"),zc;process.platform==="win32"||global.TESTING_WINDOWS?zc=KS():zc=WS();XS.exports=Jp;Jp.sync=PD;function Jp(e,t,r){if(typeof t=="function"&&(r=t,t={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,o){Jp(e,t||{},function(s,i){s?o(s):n(i)})})}zc(e,t||{},function(n,o){n&&(n.code==="EACCES"||t&&t.ignoreErrors)&&(n=null,o=!1),r(n,o)})}function PD(e,t){try{return zc.sync(e,t||{})}catch(r){if(t&&t.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var sx=$((YK,ox)=>{var mo=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",QS=require("path"),kD=mo?";":":",ex=YS(),tx=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),rx=(e,t)=>{let r=t.colon||kD,n=e.match(/\//)||mo&&e.match(/\\/)?[""]:[...mo?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(r)],o=mo?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",s=mo?o.split(r):[""];return mo&&e.indexOf(".")!==-1&&s[0]!==""&&s.unshift(""),{pathEnv:n,pathExt:s,pathExtExe:o}},nx=(e,t,r)=>{typeof t=="function"&&(r=t,t={}),t||(t={});let{pathEnv:n,pathExt:o,pathExtExe:s}=rx(e,t),i=[],a=l=>new Promise((u,d)=>{if(l===n.length)return t.all&&i.length?u(i):d(tx(e));let m=n[l],p=/^".*"$/.test(m)?m.slice(1,-1):m,f=QS.join(p,e),h=!p&&/^\.[\\\/]/.test(e)?e.slice(0,2)+f:f;u(c(h,l,0))}),c=(l,u,d)=>new Promise((m,p)=>{if(d===o.length)return m(a(u+1));let f=o[d];ex(l+f,{pathExt:s},(h,g)=>{if(!h&&g)if(t.all)i.push(l+f);else return m(l+f);return m(c(l,u,d+1))})});return r?a(0).then(l=>r(null,l),r):a(0)},ED=(e,t)=>{t=t||{};let{pathEnv:r,pathExt:n,pathExtExe:o}=rx(e,t),s=[];for(let i=0;i<r.length;i++){let a=r[i],c=/^".*"$/.test(a)?a.slice(1,-1):a,l=QS.join(c,e),u=!c&&/^\.[\\\/]/.test(e)?e.slice(0,2)+l:l;for(let d=0;d<n.length;d++){let m=u+n[d];try{if(ex.sync(m,{pathExt:o}))if(t.all)s.push(m);else return m}catch{}}}if(t.all&&s.length)return s;if(t.nothrow)return null;throw tx(e)};ox.exports=nx;nx.sync=ED});var ax=$((QK,Bp)=>{"use strict";var ix=(e={})=>{let t=e.env||process.env;return(e.platform||process.platform)!=="win32"?"PATH":Object.keys(t).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};Bp.exports=ix;Bp.exports.default=ix});var dx=$((e3,lx)=>{"use strict";var cx=require("path"),TD=sx(),OD=ax();function ux(e,t){let r=e.options.env||process.env,n=process.cwd(),o=e.options.cwd!=null,s=o&&process.chdir!==void 0&&!process.chdir.disabled;if(s)try{process.chdir(e.options.cwd)}catch{}let i;try{i=TD.sync(e.command,{path:r[OD({env:r})],pathExt:t?cx.delimiter:void 0})}catch{}finally{s&&process.chdir(n)}return i&&(i=cx.resolve(o?e.options.cwd:"",i)),i}function RD(e){return ux(e)||ux(e,!0)}lx.exports=RD});var fx=$((t3,Wp)=>{"use strict";var Gp=/([()\][%!^"`<>&|;, *?])/g;function ID(e){return e=e.replace(Gp,"^$1"),e}function CD(e,t){return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),e=e.replace(/(?=(\\+?)?)\1$/,"$1$1"),e=`"${e}"`,e=e.replace(Gp,"^$1"),t&&(e=e.replace(Gp,"^$1")),e}Wp.exports.command=ID;Wp.exports.argument=CD});var mx=$((r3,px)=>{"use strict";px.exports=/^#!(.*)/});var gx=$((n3,hx)=>{"use strict";var ND=mx();hx.exports=(e="")=>{let t=e.match(ND);if(!t)return null;let[r,n]=t[0].replace(/#! ?/,"").split(" "),o=r.split("/").pop();return o==="env"?n:n?`${o} ${n}`:o}});var yx=$((o3,_x)=>{"use strict";var Xp=require("fs"),AD=gx();function jD(e){let r=Buffer.alloc(150),n;try{n=Xp.openSync(e,"r"),Xp.readSync(n,r,0,150,0),Xp.closeSync(n)}catch{}return AD(r.toString())}_x.exports=jD});var bx=$((s3,wx)=>{"use strict";var qD=require("path"),vx=dx(),$x=fx(),MD=yx(),DD=process.platform==="win32",ZD=/\.(?:com|exe)$/i,UD=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function LD(e){e.file=vx(e);let t=e.file&&MD(e.file);return t?(e.args.unshift(e.file),e.command=t,vx(e)):e.file}function FD(e){if(!DD)return e;let t=LD(e),r=!ZD.test(t);if(e.options.forceShell||r){let n=UD.test(t);e.command=qD.normalize(e.command),e.command=$x.command(e.command),e.args=e.args.map(s=>$x.argument(s,n));let o=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${o}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}function VD(e,t,r){t&&!Array.isArray(t)&&(r=t,t=null),t=t?t.slice(0):[],r=Object.assign({},r);let n={command:e,args:t,options:r,file:void 0,original:{command:e,args:t}};return r.shell?n:FD(n)}wx.exports=VD});var zx=$((i3,xx)=>{"use strict";var Yp=process.platform==="win32";function Qp(e,t){return Object.assign(new Error(`${t} ${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function KD(e,t){if(!Yp)return;let r=e.emit;e.emit=function(n,o){if(n==="exit"){let s=Sx(o,t);if(s)return r.call(e,"error",s)}return r.apply(e,arguments)}}function Sx(e,t){return Yp&&e===1&&!t.file?Qp(t.original,"spawn"):null}function HD(e,t){return Yp&&e===1&&!t.file?Qp(t.original,"spawnSync"):null}xx.exports={hookChildProcess:KD,verifyENOENT:Sx,verifyENOENTSync:HD,notFoundError:Qp}});var Ex=$((a3,ho)=>{"use strict";var Px=require("child_process"),em=bx(),tm=zx();function kx(e,t,r){let n=em(e,t,r),o=Px.spawn(n.command,n.args,n.options);return tm.hookChildProcess(o,n),o}function JD(e,t,r){let n=em(e,t,r),o=Px.spawnSync(n.command,n.args,n.options);return o.error=o.error||tm.verifyENOENTSync(o.status,n),o}ho.exports=kx;ho.exports.spawn=kx;ho.exports.sync=JD;ho.exports._parse=em;ho.exports._enoent=tm});var Ax=$(nm=>{"use strict";var Ix=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,XD=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,Cx=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,YD=/\\([\u000b\u0020-\u00ff])/g,QD=/([\\"])/g,Nx=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;nm.format=eZ;nm.parse=tZ;function eZ(e){if(!e||typeof e!="object")throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!Nx.test(r))throw new TypeError("invalid type");var n=r;if(t&&typeof t=="object")for(var o,s=Object.keys(t).sort(),i=0;i<s.length;i++){if(o=s[i],!Cx.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+nZ(t[o])}return n}function tZ(e){if(!e)throw new TypeError("argument string is required");var t=typeof e=="object"?rZ(e):e;if(typeof t!="string")throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=r!==-1?t.slice(0,r).trim():t.trim();if(!Nx.test(n))throw new TypeError("invalid media type");var o=new oZ(n.toLowerCase());if(r!==-1){var s,i,a;for(Ix.lastIndex=r;i=Ix.exec(t);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=i[0].length,s=i[1].toLowerCase(),a=i[2],a.charCodeAt(0)===34&&(a=a.slice(1,-1),a.indexOf("\\")!==-1&&(a=a.replace(YD,"$1"))),o.parameters[s]=a}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}function rZ(e){var t;if(typeof e.getHeader=="function"?t=e.getHeader("content-type"):typeof e.headers=="object"&&(t=e.headers&&e.headers["content-type"]),typeof t!="string")throw new TypeError("content-type header is missing from object");return t}function nZ(e){var t=String(e);if(Cx.test(t))return t;if(t.length>0&&!XD.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(QD,"\\$1")+'"'}function oZ(e){this.parameters=Object.create(null),this.type=e}});var MZ={};ci(MZ,{AjvJsonSchemaValidator:()=>po,Client:()=>xc,StdioClientTransport:()=>kc,StreamableHTTPClientTransport:()=>Cc,ToolListChangedNotificationSchema:()=>Uo,getDefaultEnvironment:()=>rm});module.exports=fz(MZ);var N={};ci(N,{BIGINT_FORMAT_RANGES:()=>fi,CONSTANT_CATCH:()=>Tm,Class:()=>jc,NUMBER_FORMAT_RANGES:()=>_o,aborted:()=>St,allowsEval:()=>Uc,assert:()=>_z,assertEqual:()=>pz,assertIs:()=>hz,assertNever:()=>gz,assertNotEqual:()=>mz,assignProp:()=>ut,attachSchema:()=>yo,base64ToUint8Array:()=>km,base64urlToUint8Array:()=>jz,cached:()=>yn,captureStackTrace:()=>li,cleanEnum:()=>Az,cleanRegex:()=>go,clone:()=>ft,cloneDef:()=>$z,codePointLength:()=>vo,constantCatch:()=>Om,createTransparentProxy:()=>Pz,defineLazy:()=>$m,defineLazyInternal:()=>Q,derived:()=>Zz,esc:()=>Dc,escapeRegex:()=>Wt,explicitlyAborted:()=>Vc,extend:()=>Tz,finalizeIssue:()=>xt,floatSafeRemainder:()=>Mc,getElementAtPath:()=>wz,getEnumValues:()=>gn,getLengthableOrigin:()=>$o,getParsedType:()=>zz,getSizableOrigin:()=>Pm,hexToUint8Array:()=>Mz,hide:()=>hi,installLazyProp:()=>Vz,isObject:()=>Ar,isPlainObject:()=>pr,issue:()=>$n,joinValues:()=>ui,jsonStringifyReplacer:()=>_n,members:()=>Hc,merge:()=>Rz,mergeDefs:()=>Gt,normalizeParams:()=>I,nullish:()=>qc,numKeys:()=>xz,objectClone:()=>yz,omit:()=>Ez,optionalKeys:()=>Fc,own:()=>fr,parsedType:()=>Kc,partial:()=>Iz,pick:()=>kz,prefixIssues:()=>Xt,primitiveTypes:()=>xm,promiseAllObject:()=>bz,propertyKeyTypes:()=>Lc,randomString:()=>Sz,rawShape:()=>vn,required:()=>Cz,safeExtend:()=>Oz,shallowClone:()=>Sm,sizeCaps:()=>mi,slugify:()=>Zc,stringifyPrimitive:()=>di,toZod:()=>vm,uint8ArrayToBase64:()=>Em,uint8ArrayToBase64url:()=>qz,uint8ArrayToHex:()=>Dz,unwrapMessage:()=>hn});function pz(e){return e}function mz(e){return e}function vm(){return e=>e}function hz(e){}function gz(e){throw new Error("Unexpected value in exhaustive check")}function _z(e){}function gn(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function ui(e,t="|"){return e.map(r=>di(r)).join(t)}function _n(e,t){return typeof t=="bigint"?t.toString():t}var Ac=class{constructor(t){this._getter=t,this._value=void 0}get value(){let t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}};function yn(e){return new Ac(e)}function qc(e){return e==null}function go(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Mc(e,t){let r=e/t,n=Math.round(r),o=4*Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-n)<o?0:r-n}var ym=Symbol("evaluating");function $m(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==ym)return n===void 0&&(n=ym,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function yz(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function ut(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function vn(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function Bt(e){return vn(e._zod.def)??e._zod.def.shape}function wm(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return ut(this,t,n),n},enumerable:!0,configurable:!0})}function bm(e,t,r){t in e?ut(e,t,r):e[t]=r}function Nr(e,t,r,n){let o=Bt(t);for(let s of r){let i=Object.getOwnPropertyDescriptor(o,s);i.enumerable&&(i.get?wm(e,s,()=>{let a=t._zod.def.shape[s];return n?n(a,s):a}):bm(e,s,n?n(i.value,s):i.value))}}function vz(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);n.enumerable&&(n.get?wm(e,r,()=>t[r]):bm(e,r,n.value))}}function Gt(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function $z(e){return Gt(e._zod.def)}function wz(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function bz(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let o={};for(let s=0;s<t.length;s++)o[t[s]]=n[s];return o})}function Sz(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function Dc(e){return JSON.stringify(e)}function Zc(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var li="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Ar(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Uc=yn(()=>{if(We.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function pr(e){if(Ar(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(Ar(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Sm(e){return pr(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function xz(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var zz=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},Lc=new Set(["string","number","symbol"]),xm=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Wt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ft(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function I(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Pz(e){let t;return new Proxy({},{get(r,n,o){return t??(t=e()),Reflect.get(t,n,o)},set(r,n,o,s){return t??(t=e()),Reflect.set(t,n,o,s)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,o){return t??(t=e()),Reflect.defineProperty(t,n,o)}})}function di(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Fc(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var _o={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]},fi={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function kz(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let s={};return Nr(s,e,pi(e,t)),ft(e,Gt(r,{shape:s,checks:[]}))}function pi(e,t){let r=Bt(e),n=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,o)?.enumerable)throw new Error(`Unrecognized key: "${String(o)}"`);t[o]&&n.push(o)}return n}function Ez(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let s=new Set(pi(e,t)),i={};return Nr(i,e,Reflect.ownKeys(Bt(e)).filter(a=>!s.has(a))),ft(e,Gt(r,{shape:i,checks:[]}))}function Tz(e,t){if(!pr(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=Bt(e);for(let s of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return ft(e,Gt(e._zod.def,{shape:zm(e,t)}))}function zm(e,t){let r={};return Nr(r,e,Reflect.ownKeys(Bt(e))),vz(r,t),r}function Oz(e,t){if(!pr(t))throw new Error("Invalid input to safeExtend: expected a plain object");return ft(e,Gt(e._zod.def,{shape:zm(e,t)}))}function Rz(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};Nr(r,e,Reflect.ownKeys(Bt(e))),Nr(r,t,Reflect.ownKeys(Bt(t)));let n=Gt(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return ft(e,n)}function Iz(e,t,r,n="partial"){let s=t._zod.def.checks;if(s&&s.length>0)throw new Error(`.${n}() cannot be used on object schemas containing refinements`);let a=r?new Set(pi(t,r)):void 0,c={};return Nr(c,t,Reflect.ownKeys(Bt(t)),e&&((l,u)=>a&&!a.has(u)?l:new e({type:"optional",innerType:l}))),ft(t,Gt(t._zod.def,{shape:c,checks:[]}))}function Cz(e,t,r){let n=r?new Set(pi(t,r)):void 0,o={};return Nr(o,t,Reflect.ownKeys(Bt(t)),(s,i)=>n&&!n.has(i)?s:new e({type:"nonoptional",innerType:s})),ft(t,Gt(t._zod.def,{shape:o}))}function St(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Vc(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function Xt(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function hn(e){return typeof e=="string"?e:e?.message}function mi(e){let t=[];for(let r of e??[]){let n=r._zod.def;if(!/_(length|size)$|_equals$/.test(n.check))break;let o=n.maximum??n.length??n.size;o>=0&&t.push([o,r])}return t}function yo(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}function xt(e,t,r){var n;let o=e.inst?._zod?.traits;o?.has("$ZodType")&&(o.has("$ZodCheck")?(n=e).schema??(n.schema=e.inst):e.schema=e.inst);let s=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,i=e.message?e.message:hn(e.inst?._zod.def?.error?.(e))??hn(s?.(e))??hn(t?.error?.(e))??hn(r.customError?.(e))??hn(r.localeError?.(e))??"Invalid input",a={};for(let c of Object.keys(e))c==="inst"||c==="schema"||c==="continue"||c==="input"||c==="__proto__"||(a[c]=e[c]);return a.path??(a.path=[]),a.message=i,t?.reportInput&&(a.input=e.input),a}function Pm(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}var Nz=/[\uD800-\uDBFF]/;function vo(e){let t=e.length;if(!Nz.test(e))return t;let r=t;for(let n=0;n<t-1;n++)(e.charCodeAt(n)&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320&&(r--,n++);return r}function $o(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Kc(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function $n(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function Az(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function km(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function Em(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function jz(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return km(t+r)}function qz(e){return Em(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Mz(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n/2]=Number.parseInt(t.slice(n,n+2),16);return r}function Dz(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var jc=class{constructor(...t){}};function Hc(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);n.get?Object.defineProperty(e,r,{...n,enumerable:!1}):Uz(e,r,n.value)}}function fr(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function hi(e,t,r){return fr(e,t,r,!1)}function Zz(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return fr(this,r,n(this))},set(o){fr(this,r,o)}})}return t}function Uz(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:fr(this,t,r.bind(this))},set(n){fr(this,t,n)}})}function Lz(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var Nc,dr=!1,Fz={configurable:!0,get(){dr=!0}};function Q(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&Nc!==e._zod){Nc=void 0;return}Nc=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,Fz);let o=dr;dr=!1;try{let s=r(this);return dr?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:s}),dr=dr||o,s}catch(s){throw delete this[t],dr=dr||o,s}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function Vz(e,t,r,n){let o=Lz(e,t);o&&Object.defineProperty(o,t,{configurable:!0,get(){let s={configurable:!0,writable:!0,enumerable:n,value:void 0};return Object.defineProperty(this,t,s),s.value=r(this),Object.defineProperty(this,t,s),s.value},set(s){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:n,value:s})}})}var Tm="~constantCatch";function Om(e){let t=()=>e;return t[Tm]=!0,t}var Rm,Bc=Object.freeze({status:"aborted"}),Jc={value:void 0,enumerable:!1},Im="captureStackTrace"in Error?Error:null;function Kz(e){let t=Im;if(t){let r=t.stackTraceLimit;if(typeof r=="number"){try{t.stackTraceLimit=0}catch{return Im=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function w(e,t,r,n){let o={};function s(m){this.def=m,this.constr=d,this.traits=new Set}s.prototype=o;let i=r,a=i&&new WeakSet;function c(m,p){if(m._zod){if(m._zod.traits.has(e))return}else{Jc.value=new s(p);try{Object.defineProperty(m,"_zod",Jc)}finally{Jc.value=void 0}}if(m._zod.traits.add(e),t(m,p),a){let h=Object.getPrototypeOf(m),g=m._zod.constr.prototype,y=h;for(;y&&y!==g;)y=Object.getPrototypeOf(y);let b=y??h;a.has(b)||(a.add(b),Hc(b,i))}let f=d.prototype;for(let h in f)Object.prototype.hasOwnProperty.call(f,h)&&(h in m||(m[h]=f[h].bind(m)))}let l=n?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(m){let p=n?.Parent?Kz(u):this;c(p,m);let f=p._zod.deferred;if(f){for(let g of f)g();p._zod.deferred=void 0}let h=globalThis.__zod_globalConfig?.postProcessor;return h&&h(p),p}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:m=>n?.Parent&&m instanceof n.Parent?!0:m?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var zt=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},wn=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(Rm=globalThis).__zod_globalConfig??(Rm.__zod_globalConfig={});var We=globalThis.__zod_globalConfig;function Xe(e){return e&&Object.assign(We,e),We}function Hz(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,_n,2)),e.message}function Jz(e){this._zod.message=e}var Bz={get:Hz,set:Jz,enumerable:!0,configurable:!0},Wc={value:void 0,enumerable:!1},Cm=new WeakSet([Object.prototype,Error.prototype]),Nm=(e,t)=>{e.name="$ZodError",Wc.value=t,Object.defineProperty(e,"issues",Wc),Wc.value=void 0,Object.defineProperty(e,"message",Bz);let r=Object.getPrototypeOf(e);Cm.has(r)||(Cm.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let n=()=>this.message;return Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0})}}))},Am=w("$ZodError",Nm),jm=w("$ZodError",Nm,void 0,{Parent:Error});function Gz(e,t,r){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0}):e[t]=r()),e[t]}function Xc(e,t=r=>r.message){let r={},n=[];for(let o of e.issues)o.path.length>0?Gz(r,o.path[0],()=>[]).push(t(o)):n.push(t(o));return{formErrors:n,fieldErrors:r}}function Yc(e,t=r=>r.message){let r={_errors:[]},n=(o,s=[])=>{for(let i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>n({issues:a},[...s,...i.path]));else if(i.code==="invalid_key")n({issues:i.issues},[...s,...i.path]);else if(i.code==="invalid_element")n({issues:i.issues},[...s,...i.path]);else{let a=[...s,...i.path];if(a.length===0)r._errors.push(t(i));else{let c=r,l=0;for(;l<a.length;){let u=a[l],d=l===a.length-1;if(u==="_errors"){d&&c._errors.push(t(i)),l++;continue}Object.prototype.hasOwnProperty.call(c,u)||Object.defineProperty(c,u,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let m=c[u];d&&m._errors.push(t(i)),c=m,l++}}}};return n(e),r}function gi(e,t){return{callee:t?.callee??e,Err:t?.Err}}var _i=e=>{let t=(r,n,o,s)=>{let i=o?{...o,async:!1}:{async:!1},a=r._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new zt;if(a.issues.length){let c=new(s?.Err??e)(a.issues.map(l=>xt(l,i,Xe())));throw li(c,s?.callee??t),c}return a.value};return t};var yi=e=>{let t=async(r,n,o,s)=>{let i=o?{...o,async:!0}:{async:!0},a=r._zod.run({value:n,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){let c=new(s?.Err??e)(a.issues.map(l=>xt(l,i,Xe())));throw li(c,s?.callee??t),c}return a.value};return t};var wo=e=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new zt;return s.issues.length?qm(e,s.issues,o):{success:!0,data:s.value}},Qc=wo(jm);function qm(e,t,r){let n;return{success:!1,get error(){return n||(n=new e(t.map(o=>xt(o,r,Xe()))),t=void 0,r=void 0),n},set error(o){n=o,t=void 0,r=void 0}}}var vi=e=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?qm(e,s.issues,o):{success:!0,data:s.value}};var Xz=Symbol.for("zod.compile.invalid"),Yz=Symbol.for("zod.compile.fallback"),$i=((e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==Xz)return!0;if(n.definite===!0&&r===void 0)return!1}return Qz(e,t,r)});function Qz(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,s;if(o?(n[Yz]=!0,s=o({value:t,issues:[]},n)):s=e._zod.run({value:t,issues:[]},n),s instanceof Promise)throw new zt;return s.issues.length===0}var wi=async(e,t,r)=>{let n=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},n);return o instanceof Promise&&(o=await o),o.issues.length===0},Mm=e=>{let t=_i(e),r=(n,o,s,i)=>{let a=s?{...s,direction:"backward"}:{direction:"backward"};return t(n,o,a,gi(r,i))};return r};var Dm=e=>{let t=_i(e),r=(n,o,s,i)=>t(n,o,s,gi(r,i));return r};var Zm=e=>{let t=yi(e),r=async(n,o,s,i)=>{let a=s?{...s,direction:"backward"}:{direction:"backward"};return await t(n,o,a,gi(r,i))};return r};var Um=e=>{let t=yi(e),r=async(n,o,s,i)=>await t(n,o,s,gi(r,i));return r};var Lm=e=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return wo(e)(t,r,o)};var Fm=e=>(t,r,n)=>wo(e)(t,r,n);var Vm=e=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return vi(e)(t,r,o)};var Km=e=>async(t,r,n)=>vi(e)(t,r,n);var Hm=/^[cC][0-9a-z]{6,}$/,Jm=/^[0-9a-z]+$/,Bm=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Gm=/^[0-9a-vA-V]{20}$/,Wm=/^[A-Za-z0-9]{27}$/,Xm=/^[a-zA-Z0-9_-]{21}$/;function Ym(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Qm=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var eh=/^([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})$/,tu=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;var th=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var eP="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function rh(){return new RegExp(eP,"u")}var nh=/^(?:(?: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])$/,oh=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var sh=/^((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])$/,ih=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ah=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ch=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var uh=/^https?$/,lh=/^\+[1-9]\d{6,14}$/;var dh="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))";function tP(e){return new RegExp(`^${e}$`)}var fh=tP(dh);function eu(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function ph(e){return new RegExp(`^${eu(e)}$`)}function mh(e){let t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${eu({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,n=e.local?`${r}|${eu({precision:e.precision})}`:r;return new RegExp(`^${dh}T(?:${n})$`)}var hh=/^[\s\S]{0,}$/;var gh=/^-?\d+n?$/,ru=/^-?\d+$/,bo=/^-?\d+(?:\.\d+)?$/,_h=/^(?:true|false)$/i,yh=/^null$/i;var vh=/^[^A-Z]*$/,$h=/^[^a-z]*$/;var Ee=w("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var nu=e=>{let t=e.value;return!qc(t)&&t.length!==void 0},bi={number:"number",bigint:"bigint",object:"date"},ou=w("$ZodCheckLessThan",(e,t)=>{Ee.init(e,t);let r=bi[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:bi[typeof n.value]??r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),su=w("$ZodCheckGreaterThan",(e,t)=>{Ee.init(e,t);let r=bi[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:bi[typeof n.value]??r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),wh=w("$ZodCheckMultipleOf",(e,t)=>{Ee.init(e,t),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):Mc(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),bh=w("$ZodCheckNumberFormat",(e,t)=>{Ee.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,s]=_o[t.format];e._zod.check=i=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}a<o&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),a>s&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}});var Sh=w("$ZodCheckMaxLength",(e,t)=>{var r;Ee.init(e,t),(r=e._zod.def).when??(r.when=nu),e._zod.check=n=>{let o=n.value,s=o.length;if((typeof o=="string"&&s>t.maximum?vo(o):s)<=t.maximum)return;let a=$o(o);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),xh=w("$ZodCheckMinLength",(e,t)=>{var r;Ee.init(e,t),(r=e._zod.def).when??(r.when=nu),e._zod.check=n=>{let o=n.value,s=o.length;if((typeof o=="string"&&s>=t.minimum&&s<t.minimum*2?vo(o):s)>=t.minimum)return;let a=$o(o);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),zh=w("$ZodCheckLengthEquals",(e,t)=>{var r;Ee.init(e,t),(r=e._zod.def).when??(r.when=nu),e._zod.check=n=>{let o=n.value,s=o.length,i=typeof o=="string"&&s>=t.length&&s<=t.length*2?vo(o):s;if(i===t.length)return;let a=$o(o),c=i>t.length;n.issues.push({origin:a,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),So=w("$ZodCheckStringFormat",(e,t)=>{var r,n;Ee.init(e,t),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),Ph=w("$ZodCheckRegex",(e,t)=>{So.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),kh=w("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=vh),So.init(e,t)}),Eh=w("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=$h),So.init(e,t)}),Th=w("$ZodCheckIncludes",(e,t)=>{Ee.init(e,t);let r=Wt(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position},}${r}`:r);t.pattern=n,e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Oh=w("$ZodCheckStartsWith",(e,t)=>{Ee.init(e,t);let r=new RegExp(`^${Wt(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Rh=w("$ZodCheckEndsWith",(e,t)=>{Ee.init(e,t);let r=new RegExp(`.*${Wt(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});var Ih=w("$ZodCheckOverwrite",(e,t)=>{Ee.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var Si=class{constructor(t=[],r={}){this.content=[],this.indent=0,this.args=t,this.closed=r}indented(t){this.indent+=1;try{t(this)}finally{this.indent-=1}}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let n=t.split(`
|
|
16
|
+
`).filter(i=>i),o=Math.min(...n.map(i=>i.length-i.trimStart().length)),s=n.map(i=>i.slice(o)).map(i=>" ".repeat(this.indent*2)+i);for(let i of s)this.content.push(i)}compile(){let t=Function,r=this?.content??[""];return new t(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
|
|
17
|
+
${r.join(`
|
|
18
|
+
`)}
|
|
19
|
+
};`)(...Object.values(this.closed))}};var Nh={major:4,minor:6,patch:6};var se=w("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Nh;let n=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...n??[]]:n?.length?[...n]:[];for(let s of o)for(let i of s._zod.onattach)i(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let s=(a,c,l)=>{if(a.memo)return a;let u=St(a),d;for(let m of c){if(m._zod.def.when){if(Vc(a)||!m._zod.def.when(a))continue}else if(u)continue;let p=a.issues.length,f=m._zod.check(a);if(f instanceof Promise&&l?.async===!1)throw new zt;if(d||f instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await f,a.issues.length!==p&&(yo(a.issues,p,e),u||(u=St(a,p)))});else{if(a.issues.length===p)continue;yo(a.issues,p,e),u||(u=St(a,p))}}return d?d.then(()=>a):a},i=(a,c,l)=>{if(St(a))return a.aborted=!0,a;let u=s(c,o,l);if(u instanceof Promise){if(l.async===!1)throw new zt;return u.then(d=>e._zod.parse(d,l))}return e._zod.parse(u,l)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){let u=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});return u instanceof Promise?u.then(d=>i(d,a,c)):i(u,a,c)}let l=e._zod.parse(a,c);if(l instanceof Promise){if(c.async===!1)throw new zt;return l.then(u=>s(u,o,c))}return s(l,o,c)}}},{get"~standard"(){return hi(this,"~standard",au(this))},set"~standard"(e){fr(this,"~standard",e)}}),Kh=(e,t)=>e.issues.length?{issues:e.issues.map(r=>xt(r,t,Xe()))}:{value:e.value};async function rP(e,t){let r={async:!0};return Kh(await e._zod.run({value:t,issues:[]},r),r)}function au(e){return{validate:t=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return Kh(n,r)}catch{}return rP(e,t)},vendor:"zod",version:1}}var ki=w("$ZodString",(e,t)=>{se.init(e,t),e._zod.pattern=t.pattern??hh,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),pe=w("$ZodStringFormat",(e,t)=>{So.init(e,t),ki.init(e,t)}),Hh=w("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=eh),pe.init(e,t)}),Jh=w("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=tu(n))}else t.pattern??(t.pattern=tu());pe.init(e,t)}),Bh=w("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=th),pe.init(e,t)}),Gh=1,zi=2;function Wh(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function nP(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?Wh(e)||zi:oP(e,t)}function oP(e,t){if(!t.normalize&&t.protocol?.source===uh.source&&!/^https?:\/\//i.test(e))return Gh;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse=="function")return r.parse(e)??zi}return new URL(e)}catch{return zi}}var sP=/[\t\n\r]/g;function Ah(e){return e.replace(sP,"")}function iP(e,t){return t.lastIndex=0,t.test(e.hostname)}function aP(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var Xh=w("$ZodURL",(e,t)=>{pe.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),o=nP(n,t);if(o===Gh){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===zi){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(o===!0){r.value=Ah(n);return}t.hostname&&!iP(o,t.hostname)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort}),t.protocol&&!aP(o,t.protocol)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort}),r.value=t.normalize?o.href:Ah(n);return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Yh=w("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=rh()),pe.init(e,t)}),Qh=w("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw new Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?Xm:Ym(t.length)),pe.init(e,t)}),eg=w("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Hm),pe.init(e,t)}),tg=w("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Jm),pe.init(e,t)}),rg=w("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Bm),pe.init(e,t)}),ng=w("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Gm),pe.init(e,t)}),og=w("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Wm),pe.init(e,t)}),sg=w("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=mh(t)),pe.init(e,t)}),ig=w("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=fh),pe.init(e,t)}),ag=w("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=ph(t)),pe.init(e,t)}),cg=w("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Qm),pe.init(e,t)}),ug=w("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=nh),pe.init(e,t)}),cP=/^[0-9a-fA-F:.]+$/;function lg(e){return cP.test(e)?Wh(`http://[${e}]`):!1}var dg=w("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=oh),pe.init(e,t),e._zod.check=r=>{lg(r.value)||r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var fg=w("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=sh),pe.init(e,t)});function uP(e){let t=e.split("/");if(t.length!==2)return!1;let[r,n]=t;if(!n)return!1;let o=Number(n);return`${o}`!==n||o<0||o>128?!1:lg(r)}var pg=w("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=ih),pe.init(e,t),e._zod.check=r=>{uP(r.value)||r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function mg(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var cu=/^[0-9a-zA-Z+/]*={0,2}$/,hg=w("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=cu),pe.init(e,t),e._zod.check=r=>{mg(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),Ei=/^[A-Za-z0-9_-]*$/;function lP(e){if(!Ei.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return mg(r)}var gg=w("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Ei),pe.init(e,t),e._zod.check=r=>{lP(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),_g=w("$ZodE164",(e,t)=>{t.pattern??(t.pattern=lh),pe.init(e,t)});function dP(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}var yg=w("$ZodJWT",(e,t)=>{pe.init(e,t),e._zod.check=r=>{dP(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var uu=w("$ZodNumber",(e,t)=>{se.init(e,t),e._zod.pattern=bo,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let s=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:String(o):void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),r}}),vg=w("$ZodNumberFormat",(e,t)=>{bh.init(e,t),uu.init(e,t)}),$g=w("$ZodBoolean",(e,t)=>{se.init(e,t),e._zod.pattern=_h,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}}),wg=w("$ZodBigInt",(e,t)=>{se.init(e,t),e._zod.pattern=gh,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}});var bg=w("$ZodNull",(e,t)=>{se.init(e,t),e._zod.pattern=yh,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),r}}),Sg=w("$ZodAny",(e,t)=>{se.init(e,t),e._zod.parse=r=>r}),xg=w("$ZodUnknown",(e,t)=>{se.init(e,t),e._zod.parse=r=>r}),zg=w("$ZodNever",(e,t)=>{se.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});var Pg=w("$ZodDate",(e,t)=>{se.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let o=r.value,s=o instanceof Date;return s&&!Number.isNaN(o.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:o,...s?{received:"Invalid Date"}:{},inst:e}),r}});function fP(e,t){let r=mi(e._zod.def.checks);if(!r.length)return;let n=Math.min(...r.map(s=>s[0])),o=e._zod.parse;e._zod.parse=(s,i)=>{let a=t(s.value);if(a>n&&!i?.skipChecks&&i?.direction!=="backward"){for(let[c,l]of mi(e._zod.def.checks))if(a>c&&l._zod.def.when(s)){let u=s.issues.length;return l._zod.check(s),s.issues[u].continue=!1,yo(s.issues,u,e),s}}return o(s,i)}}var pP=e=>Array.isArray(e)?e.length:-1;function jh(e,t,r){e.issues.length&&t.issues.push(...Xt(r,e.issues)),t.value[r]=e.value}var kg=w("$ZodArray",(e,t)=>{se.init(e,t);let r=We.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let s=n.value;if(!Array.isArray(s))return n.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),n;n.value=r?r.alloc(e,n,Array(s.length),o):Array(s.length);let i=[],a=o?.abortEarly;for(let c=0;c<s.length;c++){let l=s[c],u=t.element._zod.run({value:l,issues:[]},o);if(u instanceof Promise)i.push(u.then(d=>jh(d,n,c)));else if(jh(u,n,c),a&&u.issues.length!==0&&St(u))break}return i.length?Promise.all(i).then(()=>n):n},fP(e,pP)});function Pi(e,t,r,n,o,s){let i=r in n,a=s==="optional";if(!(!i&&a&&o==="optional")){if(e.issues.length){if(o!==void 0&&a&&!i)return;t.issues.push(...Xt(r,e.issues))}if(!i&&o===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?(i||o==="defaulted"&&!a)&&(t.value[r]=void 0):t.value[r]=e.value}}var mP=[];function Eg(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:mP,o=n.length?[...t,...n]:t;for(let i of o)if(!e.shape?.[i]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(i)}": expected a Zod schema`);let s=Fc(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(s)}}function Tg(e,t,r,n,o,s,i){let a=[],c=o.keySet,l=o.catchall._zod,u=l.def.type,d=l.optin,m=l.optout,p=0;for(let f in t){if(i&&r.issues.length!==p){if(St(r,p))break;p=r.issues.length}if(c.has(f))continue;if(f==="__proto__"){u==="never"&&a.push(f);continue}if(u==="never"){a.push(f);continue}let h=l.run({value:t[f],issues:[]},n);h instanceof Promise?e.push(h.then(g=>Pi(g,r,f,t,d,m))):Pi(h,r,f,t,d,m)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:s,continue:!0}),e.length?Promise.all(e).then(()=>r):r}var hP=w("$ZodObject",(e,t)=>{se.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),n=r?.get?r.get.raw:t.shape??{};if(n){let l=()=>{let u={...n};return Object.defineProperty(t,"shape",{value:u}),l.raw=u,u};l.raw=n,Object.defineProperty(t,"shape",{get:l})}let o=yn(()=>Eg(t));Q(e,"propValues",l=>{let u=l.def.shape,d={};for(let m in u){let p=u[m]._zod;if(p.values){Object.prototype.hasOwnProperty.call(d,m)||ut(d,m,new Set);for(let f of p.values)d[m].add(f);p.optin!==void 0&&d[m].add(void 0)}}return d});let s=Ar,i=t.catchall,a,c=We.memoizer;c?.attach(e),e._zod.parse=(l,u)=>{a??(a=o.value);let d=l.value;if(!s(d))return l.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),l;l.value=c?c.alloc(e,l,{},u):{};let m=[],p=a.shape,f=u?.abortEarly,h=l.issues.length;for(let g of a.allKeys){if(f&&l.issues.length!==h){if(St(l,h))break;h=l.issues.length}if(g==="__proto__")continue;let y=p[g],b=y._zod.optin,x=y._zod.optout,k=y._zod.run({value:d[g],issues:[]},u);k instanceof Promise?m.push(k.then(v=>Pi(v,l,g,d,b,x))):Pi(k,l,g,d,b,x)}return i?Tg(m,d,l,u,o.value,e,f===!0):m.length?Promise.all(m).then(()=>l):l}}),Og=w("$ZodObjectJIT",(e,t)=>{hP.init(e,t);let r=e._zod.parse,n=yn(()=>Eg(t)),o=We.memoizer,s=p=>{let f=n.value,h=f.symbolKeys,g=new Si(["payload","ctx"],{shape:p,inst:e,memo:o,syms:h}),y=v=>`shape[${v}]._zod.run({ value: input[${v}], issues: [] }, ctx)`,b=(v,S)=>`
|
|
20
|
+
let ${v}_ab = false;
|
|
21
|
+
for (let i = 0; i < ${v}.issues.length; i++) {
|
|
22
|
+
const iss = ${v}.issues[i];
|
|
23
|
+
iss.path = iss.path ? [${S}, ...iss.path] : [${S}];
|
|
24
|
+
payload.issues.push(iss);
|
|
25
|
+
if (iss.continue !== true) ${v}_ab = true;
|
|
26
|
+
}
|
|
27
|
+
if (${v}_ab && ctx && ctx.abortEarly) {
|
|
28
|
+
payload.value = newResult;
|
|
29
|
+
return payload;
|
|
30
|
+
}`;g.write("const input = payload.value;");let x=Object.create(null),k=0;for(let v of f.allKeys)x[v]=`key_${k++}`;g.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let v of f.allKeys){if(v==="__proto__")continue;let S=x[v],E=typeof v=="symbol"?`syms[${h.indexOf(v)}]`:Dc(v),ne=`${E} in input`,M=p[v],oe=M?._zod?.optin,ct=oe!==void 0,qt=M?._zod?.optout==="optional";if(g.write(`const ${S} = ${y(E)};`),ct&&qt){let Jt=oe==="optional"?`${S}_present`:`${S}.value !== undefined || ${S}_present`;g.write(`
|
|
31
|
+
const ${S}_present = ${ne};
|
|
32
|
+
if (!${S}.issues.length || ${S}_present) {
|
|
33
|
+
if (${S}.issues.length) {${b(S,E)}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (${Jt}) {
|
|
37
|
+
newResult[${E}] = ${S}.value;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
`)}else ct?(g.write(`
|
|
42
|
+
if (${S}.issues.length) {${b(S,E)}
|
|
43
|
+
}
|
|
44
|
+
`),oe==="defaulted"?g.write(`newResult[${E}] = ${S}.value;`):g.write(`
|
|
45
|
+
if (${S}.value !== undefined || ${ne}) {
|
|
46
|
+
newResult[${E}] = ${S}.value;
|
|
47
|
+
}
|
|
48
|
+
`)):g.write(`
|
|
49
|
+
const ${S}_present = ${ne};
|
|
50
|
+
if (${S}.issues.length) {${b(S,E)}
|
|
51
|
+
}
|
|
52
|
+
if (!${S}_present && !${S}.issues.length) {
|
|
53
|
+
payload.issues.push({
|
|
54
|
+
code: "invalid_type",
|
|
55
|
+
expected: "nonoptional",
|
|
56
|
+
input: undefined,
|
|
57
|
+
path: [${E}]
|
|
58
|
+
});
|
|
59
|
+
if (ctx && ctx.abortEarly) {
|
|
60
|
+
payload.value = newResult;
|
|
61
|
+
return payload;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (${S}_present) {
|
|
66
|
+
newResult[${E}] = ${S}.value;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
`)}return g.write("payload.value = newResult;"),g.write("return payload;"),g.compile()},i,a=Ar,c=!We.jitless,u=c&&Uc.value,d=t.catchall,m;e._zod.parse=(p,f)=>{m??(m=n.value);let h=p.value;return a(h)?c&&u&&f?.async===!1&&f.jitless!==!0?(i||(i=s(t.shape)),p=i(p,f),d?Tg([],h,p,f,m,e,f?.abortEarly===!0):p):r(p,f):(p.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),p)}});function qh(e,t,r,n){for(let s of e)if(s.issues.length===0)return t.value=s.value,t;let o=e.filter(s=>!St(s));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(s=>s.issues.map(i=>xt(i,n,Xe())))}),t)}var lu=w("$ZodUnion",(e,t)=>{se.init(e,t),Q(e,"optin",n=>n.def.options.some(o=>o._zod.optin==="defaulted")?"defaulted":n.def.options.some(o=>o._zod.optin!==void 0)?"optional":void 0),Q(e,"optout",n=>n.def.options.some(o=>o._zod.optout==="optional")?"optional":void 0),Q(e,"values",n=>{if(n.def.options.every(o=>o._zod.values))return new Set(n.def.options.flatMap(o=>Array.from(o._zod.values)))}),Q(e,"pattern",n=>{if(n.def.options.every(o=>o._zod.pattern)){let o=n.def.options.map(s=>s._zod.pattern);return new RegExp(`^(${o.map(s=>go(s.source)).join("|")})$`)}});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let s=!1,i=[];for(let a of t.options){let c=a._zod.run({value:n.value,issues:[]},o);if(c instanceof Promise)i.push(c),s=!0;else{if(c.issues.length===0)return c;i.push(c)}}return s?Promise.all(i).then(a=>qh(a,n,e,o)):qh(i,n,e,o)}});function gP(e){let t=new Map;for(let r of e.options){let n=r._zod.propValues?.[e.discriminator];if(!n||n.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(r)}"`);for(let o of n)if(t.has(o)){if(o!==void 0)throw new Error(`Duplicate discriminator value "${String(o)}"`);t.set(o,null)}else t.set(o,r)}return t}var Rg=w("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,lu.init(e,t);let r=e._zod.parse;Q(e,"propValues",o=>{let s={},i=0;for(let a of o.def.options){let c=a._zod.propValues;if(!c||Object.keys(c).length===0)throw new Error(`Invalid discriminated union option at index "${o.def.options.indexOf(a)}"`);c[o.def.discriminator]?.has(void 0)&&i++;for(let[l,u]of Object.entries(c)){Object.prototype.hasOwnProperty.call(s,l)||ut(s,l,new Set);for(let d of u)s[l].add(d)}}return!o.def.unionFallback&&i>1&&s[o.def.discriminator]?.delete(void 0),s}),t.options.forEach((o,s)=>{let i=vn(o._zod.def);if(i&&!Object.prototype.hasOwnProperty.call(i,t.discriminator))throw new Error(`Invalid discriminated union option at index "${s}"`)});let n=yn(()=>gP(t));e._zod.parse=(o,s)=>{let i=o.value;if(!Ar(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),o;let a=i?.[t.discriminator],c=n.value.get(a);return c&&(a!==void 0||s.direction!=="backward")?c._zod.run(o,s):t.unionFallback||s.direction==="backward"?r(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(n.value.keys()).filter(l=>n.value.get(l)!==null),input:i,path:[t.discriminator],inst:e}),o)}}),Ig=w("$ZodIntersection",(e,t)=>{se.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,s=t.left._zod.run({value:o,issues:[]},n),i=t.right._zod.run({value:o,issues:[]},n);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,l])=>Mh(r,c,l)):Mh(r,s,i)}});function iu(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(pr(e)&&pr(t)){let r=Object.keys(t),n=Object.keys(e).filter(s=>r.indexOf(s)!==-1),o={...e,...t};Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__;for(let s of n){if(s==="__proto__")continue;let i=iu(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],s=t[n],i=iu(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Mh(e,t,r){let n=new Map,o,s=new Map,i=(l,u)=>{let d;if(l.code==="unrecognized_keys"&&!l.path?.length)o??(o=l),d=l.keys;else if(l.code==="invalid_key"&&l.origin==="record"&&l.path?.length===1){let m=String(l.path[0]);s.has(m)||s.set(m,l),d=[m]}else return!1;for(let m of d)n.has(m)||n.set(m,{}),n.get(m)[u]=!0;return!0};for(let l of t.issues)i(l,"l")||e.issues.push(l);for(let l of r.issues)i(l,"r")||e.issues.push(l);let a=[...n].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(a.length){let l=o?a.filter(u=>o.keys.includes(u)):[];l.length&&e.issues.push({...o,keys:l});for(let u of a)!l.includes(u)&&s.has(u)&&e.issues.push(s.get(u))}let c=iu(t.value,r.value);if(!c.valid){if(St(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var Cg=w("$ZodRecord",(e,t)=>{se.init(e,t);let r=We.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let s=n.value;if(!pr(s))return n.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),n;let i=[],a=t.keyType._zod.values;if(a&&!t.partial){n.value=r?r.alloc(e,n,{},o):{};let c=new Set;for(let u of a)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){if(c.add(typeof u=="number"?u.toString():u),u==="__proto__")continue;let d=t.keyType._zod.run({value:u,issues:[]},o);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(d.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(f=>xt(f,o,Xe())),input:u,path:[u],inst:e});continue}let m=d.value;if(m==="__proto__")continue;let p=t.valueType._zod.run({value:s[u],issues:[]},o);p instanceof Promise?i.push(p.then(f=>{f.issues.length&&n.issues.push(...Xt(u,f.issues)),n.value[m]=f.value})):(p.issues.length&&n.issues.push(...Xt(u,p.issues)),n.value[m]=p.value)}let l;for(let u in s)if(!c.has(u))if(t.mode==="loose"){if(u==="__proto__")continue;n.value[u]=s[u]}else l=l??[],l.push(u);l&&l.length>0&&n.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:l,continue:!0})}else{n.value=r?r.alloc(e,n,{},o):{};let c;for(let l of Reflect.ownKeys(s)){if(l==="__proto__"||!Object.prototype.propertyIsEnumerable.call(s,l))continue;let u=t.keyType._zod.run({value:l,issues:[]},o);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof l=="string"&&bo.test(l)&&u.issues.length){let f=t.keyType._zod.run({value:Number(l),issues:[]},o);if(f instanceof Promise)throw new Error("Async schemas not supported in object keys currently");f.issues.length===0&&(u=f)}if(u.issues.length){t.mode==="loose"?n.value[l]=s[l]:a?(c=c??[],c.push(l)):n.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(f=>xt(f,o,Xe())),input:l,path:[l],inst:e});continue}let m=u.value;if(m==="__proto__")continue;let p=t.valueType._zod.run({value:s[l],issues:[]},o);p instanceof Promise?i.push(p.then(f=>{f.issues.length&&n.issues.push(...Xt(l,f.issues)),n.value[m]=f.value})):(p.issues.length&&n.issues.push(...Xt(l,p.issues)),n.value[m]=p.value)}c&&c.length>0&&n.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:c,continue:!0})}return i.length?Promise.all(i).then(()=>n):n}});var Ng=w("$ZodEnum",(e,t)=>{se.init(e,t);let r=gn(t.entries),n=new Set(r);e._zod.values=n,Q(e,"pattern",o=>{let s=gn(o.def.entries).filter(i=>Lc.has(typeof i));return new RegExp(s.length?`^(${s.map(i=>Wt(i.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,s)=>{let i=o.value;return n.has(i)||o.issues.push({code:"invalid_value",values:r,input:i,inst:e}),o}}),Ag=w("$ZodLiteral",(e,t)=>{se.init(e,t);let r=new Set(t.values);e._zod.values=r,Q(e,"pattern",n=>{let o=n.def.values;return new RegExp(o.length?`^(${o.map(s=>typeof s=="string"?Wt(s):s?Wt(s.toString()):String(s)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(n,o)=>{let s=n.value;return r.has(s)||n.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),n}});var jg=w("$ZodTransform",(e,t)=>{se.init(e,t),e._zod.optin="optional",We.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new wn(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(r.value=i,r));if(o instanceof Promise)throw new zt;return r.value=o,r}});function Dh(e,t){return e.value=t.issues.length?void 0:t.value,e}var du=w("$ZodOptional",(e,t)=>{se.init(e,t),Q(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",Q(e,"values",r=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),Q(e,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${go(n.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let o=t.innerType._zod.run({value:r.value,issues:[]},n);return o instanceof Promise?o.then(s=>Dh(r,s)):Dh(r,o)}return t.innerType._zod.run(r,n)}}),qg=w("$ZodExactOptional",(e,t)=>{du.init(e,t),Q(e,"values",r=>r.def.innerType._zod.values),Q(e,"pattern",r=>r.def.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),Mg=w("$ZodNullable",(e,t)=>{se.init(e,t),Q(e,"optin",r=>r.def.innerType._zod.optin),Q(e,"optout",r=>r.def.innerType._zod.optout),Q(e,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${go(n.source)}|null)$`):void 0}),Q(e,"values",r=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),Dg=w("$ZodDefault",(e,t)=>{se.init(e,t),e._zod.optin="defaulted",Q(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>Zh(s,t)):Zh(o,t)}});function Zh(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Zg=w("$ZodPrefault",(e,t)=>{se.init(e,t),e._zod.optin="defaulted",Q(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),Ug=w("$ZodNonOptional",(e,t)=>{se.init(e,t),Q(e,"values",r=>{let n=r.def.innerType._zod.values;return n?new Set([...n].filter(o=>o!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>Uh(s,e)):Uh(o,e)}});function Uh(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}function Lh(e,t,r,n){return t.issues.length?(e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map(o=>xt(o,n,Xe()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var Lg=w("$ZodCatch",(e,t)=>{se.init(e,t),Q(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),Q(e,"optout",r=>r.def.innerType._zod.optout),Q(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run({value:r.value,issues:[]},n);return o instanceof Promise?o.then(s=>Lh(r,s,t,n)):Lh(r,o,t,n)}});var fu=w("$ZodPipe",(e,t)=>{se.init(e,t),Q(e,"values",r=>r.def.in._zod.values),Q(e,"optin",r=>r.def.in._zod.optin),Q(e,"optout",r=>r.def.out._zod.optout),Q(e,"propValues",r=>r.def.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let s=t.out._zod.run(r,n);return s instanceof Promise?s.then(i=>xi(i,t.in,n)):xi(s,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(s=>xi(s,t.out,n)):xi(o,t.out,n)}});function xi(e,t,r){return e.issues.some(n=>n.code!=="unrecognized_keys")?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}var Fg=w("$ZodPreprocess",(e,t)=>{fu.init(e,t)}),Vg=w("$ZodReadonly",(e,t)=>{se.init(e,t),Q(e,"propValues",r=>r.def.innerType._zod.propValues),Q(e,"values",r=>r.def.innerType._zod.values),Q(e,"optin",r=>r.def.innerType?._zod?.optin),Q(e,"optout",r=>r.def.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(Fh):Fh(o)}});function Fh(e){return e.memo||(e.value=Object.freeze(e.value)),e}var Kg=w("$ZodCustom",(e,t)=>{Ee.init(e,t),se.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(s=>Vh(s,r,n,e));Vh(o,r,n,e)}});function Vh(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push($n(o))}}var mu=class extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}},hu="~memo",Hg=[];function Jg(e){return e!==null&&typeof e=="object"}function pu(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}var Bg=new WeakMap,xo=0,Ri=1,zo=2;function Ii(e,t,r){let n=Bg.get(e);if(n!==void 0)return n?zo:xo;if(t.has(e))return zo;t.add(e);let o=xo,s=u=>{if(o!==zo&&u?._zod){let d=Ii(u,t,r);d>o&&(o=d)}},i=(u,d)=>{let m=xo;for(let p of Reflect.ownKeys(u)){let f=Object.getOwnPropertyDescriptor(u,p);if(d&&!f.enumerable)continue;let h=f.get?Ri:f.value?._zod?Ii(f.value,t,r):xo;h>m&&(m=h)}return m},a=u=>{u>o&&(o=u)},c=e._zod.def,l=c.type;switch(l){case"object":{let u=vn(c);a(u?i(u,!0):Ri),s(c.catchall);break}case"array":s(c.element);break;case"tuple":for(let u of c.items)s(u);s(c.rest);break;case"record":case"map":s(c.keyType),s(c.valueType);break;case"set":s(c.valueType);break;case"union":for(let u of c.options)s(u);break;case"intersection":s(c.left),s(c.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":s(c.innerType);break;case"pipe":s(c.in),s(c.out);break;case"function":s(c.input),s(c.output);break;case"lazy":{let u=c._cachedInner??(r?e._zod.innerType:void 0);a(u?Ii(u,t,!1):Ri);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let u in c){let d=Object.getOwnPropertyDescriptor(c,u);if(!d||d.get)continue;let m=d.value;if(!(!m||typeof m!="object")){if(m._zod)s(m);else if(Array.isArray(m))for(let p of m)s(p)}}}return t.delete(e),_P(e,o)}function _P(e,t){return t!==Ri&&Bg.set(e,t===zo),t}function yP(e,t){let r=e.buckets.get(t);return r||(r=new WeakMap,e.buckets.set(t,r)),r}var Ti,Oi=[],vP={alloc(e,t,r){let n=Ti;if(!n)return r;Ti=void 0;let o={value:r,issues:null};return n.set(t.value,o),Oi.push(o),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,n=(o,s)=>{if(s.direction!=="backward"&&$P(s,o.value))throw new mu;return r(o,s)};e._zod.parse=n,e._zod.run===r&&(e._zod.run=n)})},attach(e){var t;let r,n=!1,o,s;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let i=e._zod.parse,a=(c,l)=>{if(r===void 0){let y=Ii(e,new Set,!1);if(y===xo)return e._zod.parse=i,e._zod.run===a&&(e._zod.run=i),i(c,l);y===zo||n?r=!0:n=!0}let u=c.value;if(!Jg(u))return i(c,l);let d=l[hu];d||(d={buckets:new WeakMap,backEdges:void 0},l[hu]=d);let m;o===l?m=s:(m=yP(d,e),o=l,s=m);let p=m.get(u);if(p)return c.value=p.value,p.issues?p.issues.length&&c.issues.push(...pu(p.issues)):(c.memo=!0,d.backEdges??(d.backEdges=new WeakSet),d.backEdges.add(p.value)),c;Ti=m;let f=Oi.length,h=i(c,l);Ti=void 0;let g=Oi.length>f?Oi.pop():void 0;return h instanceof Promise?h.then(y=>(g&&(g.issues=y.issues.length?pu(y.issues):Hg),y)):(g&&(g.issues=h.issues.length?pu(h.issues):Hg),h)};e._zod.parse=a,e._zod.run===i&&(e._zod.run=a)})}};function gu(){return vP}function $P(e,t){let r=e[hu]?.backEdges;return r!==void 0&&Jg(t)&&r.has(t)}var wP=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(s){return e[s]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};function o(s,i){return s==="number"&&typeof i=="number"&&!Number.isFinite(i)?String(i):n[s]??s}return s=>{switch(s.code){case"invalid_type":{let i=o(s.expected),a=Kc(s.input),c=o(a,s.input);return`Invalid input: expected ${i}, received ${c}`}case"invalid_value":return s.values.length===1?`Invalid input: expected ${di(s.values[0])}`:`Invalid option: expected one of ${ui(s.values,"|")}`;case"too_big":{let i=s.exact?"exactly ":s.inclusive?"<=":"<",a=t(s.origin);return a?`Too big: expected ${s.origin??"value"} to have ${i}${s.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${s.origin??"value"} to be ${i}${s.maximum.toString()}`}case"too_small":{let i=s.exact?"exactly ":s.inclusive?">=":">",a=t(s.origin);return a?`Too small: expected ${s.origin} to have ${i}${s.minimum.toString()} ${a.unit}`:`Too small: expected ${s.origin} to be ${i}${s.minimum.toString()}`}case"invalid_format":{let i=s;return i.format==="starts_with"?`Invalid string: must start with "${i.prefix}"`:i.format==="ends_with"?`Invalid string: must end with "${i.suffix}"`:i.format==="includes"?`Invalid string: must include "${i.includes}"`:i.format==="regex"?`Invalid string: must match pattern ${i.pattern}`:`Invalid ${r[i.format]??s.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${s.divisor}`;case"unrecognized_keys":return`Unrecognized key${s.keys.length>1?"s":""}: ${ui(s.keys,", ")}`;case"invalid_key":return`Invalid key in ${s.origin}`;case"invalid_union":return s.options&&Array.isArray(s.options)&&s.options.length>0?`Invalid discriminator value. Expected ${s.options.map(a=>`'${a}'`).join(" | ")}`:s.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${s.origin}`;default:return"Invalid input"}}};function Gg(){return{localeError:wP()}}var Wg;var _u=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let o={...n,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function Xg(){return new _u}(Wg=globalThis).__zod_globalRegistry??(Wg.__zod_globalRegistry=Xg());var mr=globalThis.__zod_globalRegistry;function Ci(e){return e.checks&&(e.checks=[...e.checks]),e}function Yg(e,t){return new e(Ci({type:"string",...I(t)}))}function Qg(e,t){return new e(Ci({type:"string",coerce:!0,...I(t)}))}function e_(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...I(t)})}function t_(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...I(t)})}function r_(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...I(t)})}function n_(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...I(t)})}function o_(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...I(t)})}function s_(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...I(t)})}function yu(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...I(t)})}function i_(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...I(t)})}function a_(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...I(t)})}function c_(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...I(t)})}function u_(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...I(t)})}function l_(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...I(t)})}function d_(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...I(t)})}function f_(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...I(t)})}function p_(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...I(t)})}function m_(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...I(t)})}function h_(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...I(t)})}function g_(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...I(t)})}function __(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...I(t)})}function y_(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...I(t)})}function v_(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...I(t)})}function $_(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...I(t)})}function Ni(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...I(t)})}function Ai(e,t){return new e({type:"string",format:"date",check:"string_format",...I(t)})}function ji(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...I(t)})}function qi(e,t){return new e({type:"string",format:"duration",check:"string_format",...I(t)})}function w_(e,t){return new e(Ci({type:"number",checks:[],...I(t)}))}function b_(e,t){return new e(Ci({type:"number",coerce:!0,checks:[],...I(t)}))}function S_(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...I(t)})}function x_(e,t){return new e({type:"boolean",...I(t)})}function z_(e,t){return new e({type:"boolean",coerce:!0,...I(t)})}function P_(e,t){return new e({type:"bigint",coerce:!0,...I(t)})}function k_(e,t){return new e({type:"null",...I(t)})}function E_(e){return new e({type:"any"})}function T_(e){return new e({type:"unknown"})}function O_(e,t){return new e({type:"never",...I(t)})}function R_(e,t){return new e({type:"date",coerce:!0,...I(t)})}function Sn(e,t){return new ou({check:"less_than",...I(t),value:e,inclusive:!1})}function Yt(e,t){return new ou({check:"less_than",...I(t),value:e,inclusive:!0})}function xn(e,t){return new su({check:"greater_than",...I(t),value:e,inclusive:!1})}function Qt(e,t){return new su({check:"greater_than",...I(t),value:e,inclusive:!0})}function Po(e,t){return new wh({check:"multiple_of",...I(t),value:e})}function Mi(e,t){return new Sh({check:"max_length",...I(t),maximum:e})}function zn(e,t){return new xh({check:"min_length",...I(t),minimum:e})}function Di(e,t){return new zh({check:"length_equals",...I(t),length:e})}function vu(e,t){return new Ph({check:"string_format",format:"regex",...I(t),pattern:e})}function $u(e){return new kh({check:"string_format",format:"lowercase",...I(e)})}function wu(e){return new Eh({check:"string_format",format:"uppercase",...I(e)})}function bu(e,t){return new Th({check:"string_format",format:"includes",...I(t),includes:e})}function Su(e,t){return new Oh({check:"string_format",format:"starts_with",...I(t),prefix:e})}function xu(e,t){return new Rh({check:"string_format",format:"ends_with",...I(t),suffix:e})}function hr(e){return new Ih({check:"overwrite",tx:e})}function zu(e){return hr(t=>t.normalize(e))}function Pu(){return hr(e=>e.trim())}function ku(){return hr(e=>e.toLowerCase())}function Eu(){return hr(e=>e.toUpperCase())}function Tu(){return hr(e=>Zc(e))}function I_(e,t,r){return new e({type:"array",element:t,...I(r)})}function C_(e,t,r){let n=I(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function N_(e,t,r){return new e({type:"custom",check:"custom",fn:t,...I(r)})}function A_(e,t){let r=bP(n=>(n.addIssue=o=>{if(typeof o=="string")n.issues.push($n(o,n.value,r._zod.def));else{let s=o;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),"input"in s||(s.input=n.value),s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),n.issues.push($n(s))}},e(n.value,n)),t);return r}function bP(e,t){let r=new Ee({check:"custom",...I(t)});return r._zod.check=e,r}function ko(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))Object.prototype.propertyIsEnumerable.call(r,n)&&ut(e,n,r[n]);return e}function Ru(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??mr,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function Pt(e,t,r,n,o){let s=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:n.path,message:o}):t.unrepresentable;if(s==="any")return!1;if(s===void 0||s==="throw")throw new Error(o);return Object.assign(r,s),!0}function be(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,s=t.seen.get(e);if(s)return s.count++,r.schemaPath.includes(e)&&(s.cycle=r.path),s.schema;let i={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,i),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{let u={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,u);else{let m=i.schema,p=t.processors[o.type];if(!p)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);p(e,t,m,u)}let d=e._zod.parent;d&&(i.ref||(i.ref=d),be(d,t,u),t.seen.get(d).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&ko(i.schema,c),t.io==="input"&&Ke(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&"_prefault"in i.schema&&((n=i.schema).default??(n.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function j_(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Iu(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let n=new Map;for(let i of e.seen.entries()){let a=e.metadataRegistry.get(i[0])?.id;if(a){let c=n.get(a);if(c&&c!==i[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(a,i[0])}}let o=i=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(i[0])?.id,m=e.external.uri??(f=>f);if(d)return{ref:m(d)};let p=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=p,{defId:p,ref:`${m("__shared")}#/${a}/${j_(p)}`}}let c="#",l=`${c}/${a}/`;if(i[1]===r&&!i[1].schema.id)return{ref:c};let u=i[1].schema.id??`__schema${e.counter++}`;return{defId:u,ref:l+j_(u)}},s=i=>{if(i[1].schema.$ref)return;let a=i[1],{ref:c,defId:l}=o(i);a.def={...a.schema},l&&(a.defId=l);let u=a.schema;for(let d in u)delete u[d];u.$ref=c};if(e.cycles==="throw")for(let i of e.seen.entries()){let a=i[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
|
|
70
|
+
|
|
71
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of e.seen.entries()){let a=i[1];if(t===i[0]){s(i);continue}if(e.external){let l=e.external.registry.get(i[0])?.id;if(t!==i[0]&&l){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(a.cycle){s(i);continue}a.count>1&&e.reused==="ref"&&s(i)}e.external&&(e.sharedDefsExtractedFor=e.external)}function D_(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let n of t){if(!n||typeof n!="object")return;D_(n);let o=Object.keys(n);if(o.length!==1||o[0]!=="type")return;let s=n.type;for(let i of Array.isArray(s)?s:[s]){if(typeof i!="string")return;r.includes(i)||r.push(i)}}delete e.anyOf,e.type=r.length===1?r[0]:r}var Z_=new Set(["type","properties","required","additionalProperties"]),q_=["oneOf","anyOf"];function M_(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function Ou(e){let t=[];for(let s of e){if(typeof s!="object"||s.type!=="object")return null;for(let i in s)if(!Z_.has(i))return null;t.push(s)}let r={},n=new Set;for(let s of t){for(let i in s.properties){if(Object.prototype.hasOwnProperty.call(r,i))continue;let a=[];for(let l of t){let u=l.properties?.[i]??M_(l);u!=null&&(a.some(d=>JSON.stringify(d)===JSON.stringify(u))||a.push(u))}let c=a.length===1?a[0]:Ou(a)??{allOf:a};ut(r,i,c)}for(let i of s.required??[])n.add(i)}let o={type:"object",properties:r};if(n.size&&(o.required=[...n]),t.every(s=>s.additionalProperties===!1))o.additionalProperties=!1;else{let s=[];for(let i of t){let a=M_(i);a&&!s.some(c=>JSON.stringify(c)===JSON.stringify(a))&&s.push(a)}s.length===1?o.additionalProperties=s[0]:s.length>1&&(o.additionalProperties={allOf:s})}return o}function SP(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of Z_)if(o in e)return;let r=t.filter(o=>q_.some(s=>Array.isArray(o[s]))),n=null;if(!r.length)n=Ou(t);else{let o=r[0],s=q_.find(c=>Array.isArray(o[c]));if(Object.keys(o).length!==1)return;let i=t.filter(c=>c!==o),a=o[s].map(c=>Ou([...i,c]));if(a.some(c=>!c))return;n={[s]:a}}n&&(delete e.allOf,ko(e,n))}function Cu(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=a=>{let c=e.seen.get(a);if(c.ref===null)return;let l=c.def??c.schema,u={...l},d=c.ref;if(c.ref=null,d){n(d);let p=e.seen.get(d),f=p.schema;if(f.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(l.allOf=l.allOf??[],l.allOf.push(f)):ko(l,f),ko(l,u),a._zod.parent===d)for(let g in l)g==="$ref"||g==="allOf"||g in u||delete l[g];if(f.$ref&&p.def)for(let g in l)g==="$ref"||g==="allOf"||g in p.def&&JSON.stringify(l[g])===JSON.stringify(p.def[g])&&delete l[g]}let m=a._zod.parent;if(m&&m!==d){n(m);let p=e.seen.get(m);if(p?.schema.$ref&&(l.$ref=p.schema.$ref,p.def))for(let f in l)f==="$ref"||f==="allOf"||f in p.def&&JSON.stringify(l[f])===JSON.stringify(p.def[f])&&delete l[f]}e.override({zodSchema:a,jsonSchema:l,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())n(a[0]);if(e.target!=="openapi-3.0")for(let a of e.seen.entries())D_(a[1].def??a[1].schema);for(let a of e.deferred)a();if(e.intersections.length){let a=new Map;for(let c of e.seen.values())for(let l of[c.schema,c.def]){let u=l?.allOf;if(!Array.isArray(u))continue;let d=a.get(u);d?d.push(l):a.set(u,[l])}for(let c of e.intersections)for(let l of a.get(c)??[])SP(l)}}let o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}ko(o,r.defId?r.schema:r.def??r.schema);let s=e.metadataRegistry.get(t)?.id;s!==void 0&&o.id===s&&delete o.id;let i=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let a of e.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,ut(i,c.defId,c.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Eo(t,"input",e.processors),output:Eo(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Ke(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return Ke(n.element,r);if(n.type==="set")return Ke(n.valueType,r);if(n.type==="lazy")return Ke(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault"||n.type==="catch")return Ke(n.innerType,r);if(n.type==="intersection")return Ke(n.left,r)||Ke(n.right,r);if(n.type==="record"||n.type==="map")return Ke(n.keyType,r)||Ke(n.valueType,r);if(n.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Ke(n.in,r)||Ke(n.out,r);if(n.type==="object"){for(let o in n.shape)if(Ke(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(Ke(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(Ke(o,r))return!0;return!!(n.rest&&Ke(n.rest,r))}return!1}var U_=(e,t={})=>r=>{let n=Ru({...r,processors:t});return be(e,n),Iu(n,e),Cu(n,e)},Eo=(e,t,r={})=>n=>{let{libraryOptions:o,target:s}=n??{},i=Ru({...o??{},target:s,io:t,processors:r});return be(e,i),Iu(i,e),Cu(i,e)};var Pn=(e,t,r)=>{(e[t]===void 0||r>e[t])&&(e[t]=r)},kn=(e,t,r)=>{(e[t]===void 0||r<e[t])&&(e[t]=r)},L_=(e,t)=>{Pn(e,"minimum",t),kn(e,"maximum",t)},H_=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},J_=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},B_=(e,t)=>{e.mime=e.mime?e.mime.filter(r=>t.includes(r)):[...t]},G_=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},F_=(e,t)=>Pn(e,"minimum",t.minimum),V_=(e,t)=>kn(e,"maximum",t.maximum),K_=e=>(t,r)=>{G_(t,r.format);let[n,o]=e[r.format];Pn(t,"minimum",n),kn(t,"maximum",o)},xP={greater_than:(e,t)=>Pn(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>kn(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>H_(e,t.value),number_format:K_(_o),bigint_format:K_(fi),min_length:F_,max_length:V_,length_equals:(e,t)=>L_(e,t.length),min_size:F_,max_size:V_,size_equals:(e,t)=>L_(e,t.size),string_format:(e,t)=>{G_(e,t.format),t.pattern&&J_(e,t.pattern),(t.format==="base64"||t.format==="base64url")&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>B_(e,t.mime)};function Te(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let s of n)xP[s._zod.def.check]?.(t,s._zod.def);let o=e._zod.bag;o.minimum!==void 0&&Pn(t,"minimum",o.minimum),o.exclusiveMinimum!==void 0&&Pn(t,"exclusiveMinimum",o.exclusiveMinimum),o.maximum!==void 0&&kn(t,"maximum",o.maximum),o.exclusiveMaximum!==void 0&&kn(t,"exclusiveMaximum",o.exclusiveMaximum),o.multipleOf!==void 0&&H_(t,o.multipleOf),o.format!==void 0&&(t.format??(t.format=o.format),o.format.includes("int")&&(t.isInt=!0)),o.mime&&B_(t,o.mime);for(let s of o.patterns??[])J_(t,s);return t}var zP={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},PP=new Map([[cu,ah],[Ei,ch]]),W_=e=>PP.get(e)??e,X_=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:s,maximum:i,format:a,patterns:c,contentEncoding:l,laxFormat:u}=Te(e);if(typeof s=="number"&&(o.minLength=s),typeof i=="number"&&(o.maxLength=i),a&&(o.format=zP[a]??a,o.format===""&&delete o.format,(a==="time"||u)&&delete o.format),l&&(o.contentEncoding=l),c&&c.size>0){let d=[...c].map(W_);d.length===1?o.pattern=d[0].source:d.length>1&&(o.allOf=[...d.map(m=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))])}},Y_=(e,t,r,n)=>{let o=r,{minimum:s,maximum:i,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=Te(e);o.type=u?"integer":"number";let d=typeof l=="number"&&l>=(s??Number.NEGATIVE_INFINITY),m=typeof c=="number"&&c<=(i??Number.POSITIVE_INFINITY),p=t.target==="draft-04"||t.target==="openapi-3.0";if(d?p?(o.minimum=l,o.exclusiveMinimum=!0):o.exclusiveMinimum=l:typeof s=="number"&&(o.minimum=s),m?p?(o.maximum=c,o.exclusiveMaximum=!0):o.exclusiveMaximum=c:typeof i=="number"&&(o.maximum=i),a){let f=new Set;for(let y of a)Number.isFinite(y)&&y!==0?f.add(Math.abs(y)):Pt(e,t,o,n,`A multipleOf divisor of ${y} cannot be represented in JSON Schema`);let[h,...g]=f;h!==void 0&&(o.multipleOf=h),g.length&&(o.allOf=[...o.allOf??[],...g.map(y=>({multipleOf:y}))])}},Q_=(e,t,r,n)=>{r.type="boolean"},ey=(e,t,r,n)=>{Pt(e,t,r,n,"BigInt cannot be represented in JSON Schema")};var ty=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"};var ry=(e,t,r,n)=>{r.not={}},ny=(e,t,r,n)=>{},oy=(e,t,r,n)=>{},sy=(e,t,r,n)=>{Pt(e,t,r,n,"Date cannot be represented in JSON Schema")},iy=(e,t,r,n)=>{let o=e._zod.def,s=gn(o.entries);if(s.length===0){r.not={};return}s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),r.enum=s},ay=(e,t,r,n)=>{let o=e._zod.def;if(o.values.length===0){r.not={};return}let s=[];for(let i of o.values)if(i===void 0){if(Pt(e,t,r,n,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof i=="bigint"){if(Pt(e,t,r,n,"BigInt literals cannot be represented in JSON Schema"))return;s.push(Number(i))}else s.push(i);if(s.length!==0)if(s.length===1){let i=s[0];r.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[i]:r.const=i}else s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),s.every(i=>typeof i=="boolean")&&(r.type="boolean"),s.every(i=>i===null)&&(r.type="null"),r.enum=s};var cy=(e,t,r,n)=>{Pt(e,t,r,n,"Custom types cannot be represented in JSON Schema")};var uy=(e,t,r,n)=>{Pt(e,t,r,n,"Transforms cannot be represented in JSON Schema")};var ly=(e,t,r,n)=>{let o=r,s=e._zod.def,{minimum:i,maximum:a}=Te(e);typeof i=="number"&&(o.minItems=i),typeof a=="number"&&(o.maxItems=a),o.type="array",o.items=be(s.element,t,{...n,path:[...n.path,"items"]})};function Zi(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?Zi(t.out):t.type==="catch"?Zi(t.innerType):e._zod.optin}var dy=(e,t,r,n)=>{let o=r,s=e._zod.def,i=s.shape;if(Object.getOwnPropertySymbols(i).length&&Pt(e,t,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let l in i)ut(o.properties,l,be(i[l],t,{...n,path:[...n.path,"properties",l]}));let c=[];for(let l of Object.keys(i)){let u=s.shape[l];(t.io==="input"?Zi(u)===void 0:u._zod.optout===void 0)&&c.push(l)}c.length>0&&(o.required=c),s.catchall?._zod.def.type==="never"?o.additionalProperties=!1:s.catchall?s.catchall&&(o.additionalProperties=be(s.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},fy=(e,t,r,n)=>{let o=e._zod.def,s=o.inclusive===!1,i=o.options.map((a,c)=>be(a,t,{...n,path:[...n.path,s?"oneOf":"anyOf",c]}));s?r.oneOf=i:r.anyOf=i},py=(e,t,r,n)=>{let o=e._zod.def,s=be(o.left,t,{...n,path:[...n.path,"allOf",0]}),i=be(o.right,t,{...n,path:[...n.path,"allOf",1]}),a=l=>"allOf"in l&&Object.keys(l).length===1,c=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];r.allOf=c,t.intersections.push(c)};function Nu(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let f=e.get(t)?.def;if(!f)return t;let h=Nu(e,f,r);return h===f?t:h}for(let f of["anyOf","oneOf"]){let h=t[f];if(!Array.isArray(h))continue;let g=h.map(y=>Nu(e,y,r));g.some((y,b)=>y!==h[b])&&(t={...t,[f]:g})}let n=Array.isArray(t.type)?t.type:[t.type],o=!n.includes("string")&&n.some(f=>f==="number"||f==="integer"),s=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!s?.some(f=>typeof f=="number"))return t;let{minimum:i,maximum:a,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:m,...p}=t;return p.enum?p.enum=p.enum.map(f=>typeof f=="number"?String(f):f):typeof p.const=="number"&&(p.const=String(p.const)),o&&(p.type="string",s||(p.pattern=(n.includes("number")?bo:ru).source)),p}var Au=new WeakMap;function kP(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let r=new Map;for(let n of Au.get(e)??[]){let o=e.seen.get(n),s=(o?.def??o?.schema)?.propertyNames;if(!s||s===!0||r.has(s))continue;let i=Nu(t,s,new Set);i!==s&&r.set(s,i)}if(r.size)for(let n of e.seen.values())for(let o of[n.schema,n.def]){let s=o&&r.get(o.propertyNames);s&&(o.propertyNames=s)}}var my=(e,t,r,n)=>{let o=r,s=e._zod.def;o.type="object";let i=s.keyType,a=Te(i).patterns;if(s.mode==="loose"&&a&&a.size>0){let u=be(s.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let d of a)ut(o.patternProperties,W_(d).source,u)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=be(s.keyType,t,{...n,path:[...n.path,"propertyNames"]});let u=Au.get(t);u||(u=[],Au.set(t,u),t.deferred.push(()=>kP(t))),u.push(e)}o.additionalProperties=be(s.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let c=i._zod.values,l=t.io==="input"&&Zi(s.valueType)!==void 0;if(c&&!s.partial&&!l){let u=[...c].filter(d=>typeof d=="string"||typeof d=="number");u.length>0&&(o.required=u.map(String))}},hy=(e,t,r,n)=>{let o=e._zod.def,s=be(o.innerType,t,n),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=o.innerType,r.nullable=!0):r.anyOf=[s,{type:"null"}]},gy=(e,t,r,n)=>{let o=e._zod.def;be(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType},ju=Symbol();function _y(e,t,r,n,o){let s=!1,i=JSON.stringify(e,(a,c)=>typeof c!="bigint"?c:(s=!0,null));return s?(Pt(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),ju):JSON.parse(i)}var yy=(e,t,r,n)=>{let o=e._zod.def;be(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType;let i=_y(o.defaultValue,e,t,r,n);i!==ju&&(r.default=i)},vy=(e,t,r,n)=>{let o=e._zod.def;be(o.innerType,t,n);let s=t.seen.get(e);if(s.ref=o.innerType,t.io!=="input")return;let i=_y(o.defaultValue,e,t,r,n);i!==ju&&(r._prefault=i)},$y=(e,t,r,n)=>{let o=e._zod.def;be(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType;let i;try{i=o.catchValue(void 0)}catch{Pt(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=i},wy=(e,t,r,n)=>{let o=e._zod.def,s=o.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?s?o.out:o.in:o.out;be(i,t,n);let a=t.seen.get(e);a.ref=i},by=(e,t,r,n)=>{let o=e._zod.def;be(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType,r.readOnly=!0};var qu=(e,t,r,n)=>{let o=e._zod.def;be(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType};function Ui(e){return!!e._zod}function kt(e,t){return Ui(e)?Qc(e,t):e.safeParse(t)}function Li(e){if(!e)return;let t;if(Ui(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function Fi(e){if(Ui(e)){let s=e._zod?.def;if(s){if(s.value!==void 0)return s.value;if(Array.isArray(s.values)&&s.values.length>0)return s.values[0]}}let r=e._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let n=e.value;if(n!==void 0)return n}var Sy=new WeakSet([Object.prototype,Error.prototype]);function Vi(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let n=r(this);return Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0})}})}var qP=(e,t)=>{Am.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);Sy.has(r)||(Sy.add(r),Vi(r,"format",n=>o=>Yc(n,o)),Vi(r,"flatten",n=>o=>Xc(n,o)),Vi(r,"addIssue",n=>o=>{n.issues.push(o),n.message=JSON.stringify(n.issues,_n,2)}),Vi(r,"addIssues",n=>o=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,_n,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))};var lt=w("ZodError",qP,void 0,{Parent:Error});var xy=_i(lt),zy=yi(lt),Py=wo(lt),ky=vi(lt),Ey=Mm(lt),Ty=Dm(lt),Oy=Zm(lt),Ry=Um(lt),Iy=Lm(lt),Cy=Fm(lt),Ny=Vm(lt),Ay=Km(lt);function DP(){We.localeError||Xe(Gg())}function Hi(){We.memoizer||Xe({memoizer:gu()})}var ce=w("ZodType",(e,t)=>(DP(),se.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(N.mergeDefs(t,{checks:[...t.checks??[],...e.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return ft(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Pk(e,t))},superRefine(e,t){return this.check(kk(e,t))},overwrite(e){return this.check(hr(e))},optional(){return $e(this)},exactOptional(){return mk(this)},nullable(){return My(this)},nullish(){return $e(My(this))},nonoptional(e){return $k(this,e)},array(){return z(this)},or(e){return me([this,e])},and(e){return Bi(this,e)},transform(e){return Dy(this,Gy(e))},default(e){return _k(this,e)},prefault(e){return vk(this,e)},catch(e){return bk(this,e)},pipe(e){return Dy(this,e)},readonly(){return zk(this)},describe(e){let t=this.clone();return mr.add(t,{description:e}),t},meta(...e){if(e.length===0)return mr.get(this);let t=this.clone();return mr.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return N.hide(this,"~standard",{...au(this),jsonSchema:{input:Eo(this,"input"),output:Eo(this,"output")}})},set"~standard"(e){N.own(this,"~standard",e)},parse:function e(t,r){return xy(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await zy(this,t,r,{callee:e})},safeParse(e,t){return Py(this,e,t)},async safeParseAsync(e,t){return ky(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){N.own(this,"spa",e)},validate(e,t){return $i(this,e,t)},validateAsync(e,t){return wi(this,e,t)},encode:function e(t,r){return Ey(this,t,r,{callee:e})},decode:function e(t,r){return Ty(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await Oy(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await Ry(this,t,r,{callee:e})},safeEncode(e,t){return Iy(this,e,t)},safeDecode(e,t){return Cy(this,e,t)},async safeEncodeAsync(e,t){return Ny(this,e,t)},async safeDecodeAsync(e,t){return Ay(this,e,t)},toJSONSchema(e){return U_(this,{})(e)},get description(){return mr.get(this)?.description},get _def(){return this._zod.def}}),Zy=w("_ZodString",(e,t)=>{ki.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,o)=>X_(e,r,n,o)},N.derived({format:e=>Te(e).format??null,minLength:e=>Te(e).minimum??null,maxLength:e=>Te(e).maximum??null},{regex(...e){return this.check(vu(...e))},includes(...e){return this.check(bu(...e))},startsWith(...e){return this.check(Su(...e))},endsWith(...e){return this.check(xu(...e))},min(...e){return this.check(zn(...e))},max(...e){return this.check(Mi(...e))},length(...e){return this.check(Di(...e))},nonempty(...e){return this.check(zn(1,...e))},lowercase(e){return this.check($u(e))},uppercase(e){return this.check(wu(e))},trim(){return this.check(Pu())},normalize(...e){return this.check(zu(...e))},toLowerCase(){return this.check(ku())},toUpperCase(){return this.check(Eu())},slugify(){return this.check(Tu())}})),Du=w("ZodString",(e,t)=>{ki.init(e,t),Zy.init(e,t)},{email(e){return this.check(e_(ZP,e))},url(e){return this.check(yu(Uy,e))},jwt(e){return this.check($_(rk,e))},emoji(e){return this.check(i_(LP,e))},guid(e){return this.check(t_(UP,e))},uuid(e){return this.check(r_(Ki,e))},uuidv4(e){return this.check(n_(Ki,e))},uuidv6(e){return this.check(o_(Ki,e))},uuidv7(e){return this.check(s_(Ki,e))},nanoid(e){return this.check(a_(FP,e))},cuid(e){return this.check(c_(VP,e))},cuid2(e){return this.check(u_(KP,e))},ulid(e){return this.check(l_(HP,e))},base64(e){return this.check(__(QP,e))},base64url(e){return this.check(y_(ek,e))},xid(e){return this.check(d_(JP,e))},ksuid(e){return this.check(f_(BP,e))},ipv4(e){return this.check(p_(GP,e))},ipv6(e){return this.check(m_(WP,e))},cidrv4(e){return this.check(h_(XP,e))},cidrv6(e){return this.check(g_(YP,e))},e164(e){return this.check(v_(tk,e))},datetime(e){return this.check(Ni(To,e))},date(e){return this.check(Ai(Oo,e))},time(e){return this.check(ji(Ro,e))},duration(e){return this.check(qi(Io,e))}});function _(e){return Yg(Du,e)}var we=w("ZodStringFormat",(e,t)=>{pe.init(e,t),Zy.init(e,t)}),To=w("ZodISODateTime",(e,t)=>{sg.init(e,t),we.init(e,t)}),Oo=w("ZodISODate",(e,t)=>{ig.init(e,t),we.init(e,t)}),Ro=w("ZodISOTime",(e,t)=>{ag.init(e,t),we.init(e,t)}),Io=w("ZodISODuration",(e,t)=>{cg.init(e,t),we.init(e,t)}),ZP=w("ZodEmail",(e,t)=>{Bh.init(e,t),we.init(e,t)});var UP=w("ZodGUID",(e,t)=>{Hh.init(e,t),we.init(e,t)});var Ki=w("ZodUUID",(e,t)=>{Jh.init(e,t),we.init(e,t)});var Uy=w("ZodURL",(e,t)=>{Xh.init(e,t),we.init(e,t)});function Ly(e){return yu(Uy,e)}var LP=w("ZodEmoji",(e,t)=>{Yh.init(e,t),we.init(e,t)});var FP=w("ZodNanoID",(e,t)=>{Qh.init(e,t),we.init(e,t)});var VP=w("ZodCUID",(e,t)=>{eg.init(e,t),we.init(e,t)});var KP=w("ZodCUID2",(e,t)=>{tg.init(e,t),we.init(e,t)});var HP=w("ZodULID",(e,t)=>{rg.init(e,t),we.init(e,t)});var JP=w("ZodXID",(e,t)=>{ng.init(e,t),we.init(e,t)});var BP=w("ZodKSUID",(e,t)=>{og.init(e,t),we.init(e,t)});var GP=w("ZodIPv4",(e,t)=>{ug.init(e,t),we.init(e,t)});var WP=w("ZodIPv6",(e,t)=>{dg.init(e,t),we.init(e,t)});var XP=w("ZodCIDRv4",(e,t)=>{fg.init(e,t),we.init(e,t)});var YP=w("ZodCIDRv6",(e,t)=>{pg.init(e,t),we.init(e,t)});var QP=w("ZodBase64",(e,t)=>{hg.init(e,t),we.init(e,t)});var ek=w("ZodBase64URL",(e,t)=>{gg.init(e,t),we.init(e,t)});var tk=w("ZodE164",(e,t)=>{_g.init(e,t),we.init(e,t)});var rk=w("ZodJWT",(e,t)=>{yg.init(e,t),we.init(e,t)});var Ji=w("ZodNumber",(e,t)=>{uu.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Y_(e,r,n,o),e.isFinite=!0},N.derived({minValue:e=>{let{minimum:t,exclusiveMinimum:r}=Te(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:e=>{let{maximum:t,exclusiveMaximum:r}=Te(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:e=>{let{isInt:t,multipleOf:r}=Te(e);return!!t||!!r?.some(Number.isSafeInteger)},format:e=>Te(e).format??null},{gt(e,t){return this.check(xn(e,t))},gte(e,t){return this.check(Qt(e,t))},min(e,t){return this.check(Qt(e,t))},lt(e,t){return this.check(Sn(e,t))},lte(e,t){return this.check(Yt(e,t))},max(e,t){return this.check(Yt(e,t))},int(e){return this.check(jy(e))},safe(e){return this.check(jy(e))},positive(e){return this.check(xn(0,e))},nonnegative(e){return this.check(Qt(0,e))},negative(e){return this.check(Sn(0,e))},nonpositive(e){return this.check(Yt(0,e))},multipleOf(e,t){return this.check(Po(e,t))},step(e,t){return this.check(Po(e,t))},finite(){return this}}));function ee(e){return w_(Ji,e)}var nk=w("ZodNumberFormat",(e,t)=>{vg.init(e,t),Ji.init(e,t)});function jy(e){return S_(nk,e)}var Zu=w("ZodBoolean",(e,t)=>{$g.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Q_(e,r,n,o)});function ue(e){return x_(Zu,e)}var Fy=w("ZodBigInt",(e,t)=>{wg.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ey(e,r,n,o)},N.derived({minValue:e=>Te(e).minimum??null,maxValue:e=>Te(e).maximum??null,format:e=>Te(e).format??null},{gte(e,t){return this.check(Qt(e,t))},min(e,t){return this.check(Qt(e,t))},gt(e,t){return this.check(xn(e,t))},lt(e,t){return this.check(Sn(e,t))},lte(e,t){return this.check(Yt(e,t))},max(e,t){return this.check(Yt(e,t))},positive(e){return this.check(xn(BigInt(0),e))},negative(e){return this.check(Sn(BigInt(0),e))},nonpositive(e){return this.check(Yt(BigInt(0),e))},nonnegative(e){return this.check(Qt(BigInt(0),e))},multipleOf(e,t){return this.check(Po(e,t))}}));var ok=w("ZodNull",(e,t)=>{bg.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ty(e,r,n,o)});function Vy(e){return k_(ok,e)}var sk=w("ZodAny",(e,t)=>{Sg.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ny(e,r,n,o)});function Ky(){return E_(sk)}var ik=w("ZodUnknown",(e,t)=>{xg.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,o)=>oy(e,r,n,o)});function ve(){return T_(ik)}var ak=w("ZodNever",(e,t)=>{zg.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ry(e,r,n,o)});function ck(e){return O_(ak,e)}var Hy=w("ZodDate",(e,t)=>{Pg.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,o)=>sy(e,r,n,o),e.min=(r,n)=>e.check(Qt(r,n)),e.max=(r,n)=>e.check(Yt(r,n))},N.derived({minDate:e=>{let{minimum:t}=Te(e);return t?new Date(t):null},maxDate:e=>{let{maximum:t}=Te(e);return t?new Date(t):null}},{}));var uk=w("ZodArray",(e,t)=>{Hi(),kg.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ly(e,r,n,o),e.element=t.element},{min(e,t){return this.check(zn(e,t))},nonempty(e){return this.check(zn(1,e))},max(e,t){return this.check(Mi(e,t))},length(e,t){return this.check(Di(e,t))},unwrap(){return this.element}});function z(e,t){return I_(uk,e,t)}var Jy=w("ZodObject",(e,t)=>{Hi(),Og.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,o)=>dy(e,r,n,o),N.installLazyProp(e,"shape",r=>r._zod.def.shape,!1)},{keyof(){return Ye(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(N.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(N.mergeDefs(this._zod.def,{catchall:ve()}))},loose(){return this.clone(N.mergeDefs(this._zod.def,{catchall:ve()}))},strict(){return this.clone(N.mergeDefs(this._zod.def,{catchall:ck()}))},strip(){return this.clone(N.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return N.extend(this,e)},safeExtend(e){return N.safeExtend(this,e)},merge(e){return N.merge(this,e)},pick(e){return N.pick(this,e)},omit(e){return N.omit(this,e)},partial(...e){return N.partial(Wy,this,e[0])},exactPartial(...e){return N.partial(Xy,this,e[0],"exactPartial")},required(...e){return N.required(Yy,this,e[0])}});function P(e,t){let r={type:"object",shape:e??{},...N.normalizeParams(t)};return new Jy(r)}function Pe(e,t){return new Jy({type:"object",shape:e,catchall:ve(),...N.normalizeParams(t)})}var By=w("ZodUnion",(e,t)=>{lu.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fy(e,r,n,o),e.options=t.options});function me(e,t){return new By({type:"union",options:e,...N.normalizeParams(t)})}var lk=w("ZodDiscriminatedUnion",(e,t)=>{By.init(e,t),Rg.init(e,t)});function Uu(e,t,r){return new lk({type:"union",options:t,discriminator:e,...N.normalizeParams(r)})}var dk=w("ZodIntersection",(e,t)=>{Ig.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,o)=>py(e,r,n,o)});function Bi(e,t){return new dk({type:"intersection",left:e,right:t})}var qy=w("ZodRecord",(e,t)=>{Hi(),Cg.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,o)=>my(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function fe(e,t,r){return!t||!t._zod?new qy({type:"record",keyType:_(),valueType:e,...N.normalizeParams(t)}):new qy({type:"record",keyType:e,valueType:t,...N.normalizeParams(r)})}var Mu=w("ZodEnum",(e,t)=>{Ng.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(n,o,s)=>iy(e,n,o,s),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let s={};for(let i of n)if(r.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new Mu({...t,checks:[],...N.normalizeParams(o),entries:s})},e.exclude=(n,o)=>{let s={...t.entries};for(let i of n)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new Mu({...t,checks:[],...N.normalizeParams(o),entries:s})}});function Ye(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Mu({type:"enum",entries:r,...N.normalizeParams(t)})}var fk=w("ZodLiteral",(e,t)=>{Ag.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ay(e,r,n,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function T(e,t){return new fk({type:"literal",values:Array.isArray(e)?e:[e],...N.normalizeParams(t)})}var pk=w("ZodTransform",(e,t)=>{Hi(),jg.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,o)=>uy(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new wn(e.constructor.name);r.addIssue=s=>{if(typeof s=="string")r.issues.push(N.issue(s,r.value,t));else{let i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),"input"in i||(i.input=r.value),i.inst??(i.inst=e),r.issues.push(N.issue(i))}};let o=t.transform(r.value,r);return o instanceof Promise?o.then(s=>(r.value=s,r)):(r.value=o,r)}});function Gy(e){return new pk({type:"transform",transform:e})}var Wy=w("ZodOptional",(e,t)=>{du.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,o)=>qu(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function $e(e){return new Wy({type:"optional",innerType:e})}var Xy=w("ZodExactOptional",(e,t)=>{qg.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,o)=>qu(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function mk(e){return new Xy({type:"optional",innerType:e})}var hk=w("ZodNullable",(e,t)=>{Mg.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,o)=>hy(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function My(e){return new hk({type:"nullable",innerType:e})}var gk=w("ZodDefault",(e,t)=>{Dg.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,o)=>yy(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function _k(e,t){return new gk({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():N.shallowClone(t)}})}var yk=w("ZodPrefault",(e,t)=>{Zg.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,o)=>vy(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function vk(e,t){return new yk({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():N.shallowClone(t)}})}var Yy=w("ZodNonOptional",(e,t)=>{Ug.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,o)=>gy(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function $k(e,t){return new Yy({type:"nonoptional",innerType:e,...N.normalizeParams(t)})}var wk=w("ZodCatch",(e,t)=>{Lg.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$y(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function bk(e,t){return new wk({type:"catch",innerType:e,catchValue:typeof t=="function"?t:N.constantCatch(t)})}var Qy=w("ZodPipe",(e,t)=>{fu.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wy(e,r,n,o),e.in=t.in,e.out=t.out});function Dy(e,t){return new Qy({type:"pipe",in:e,out:t})}var Sk=w("ZodPreprocess",(e,t)=>{Qy.init(e,t),Fg.init(e,t)}),xk=w("ZodReadonly",(e,t)=>{Vg.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,o)=>by(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function zk(e){return new xk({type:"readonly",innerType:e})}var ev=w("ZodCustom",(e,t)=>{Kg.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,o)=>cy(e,r,n,o)});function tv(e,t){return C_(ev,e??(()=>!0),t)}function Pk(e,t={}){return N_(ev,e,t)}function kk(e,t){return A_(e,t)}function Lu(e,t){return new Sk({type:"pipe",in:Gy(e),out:t})}var nv={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};var rv;rv||(rv={});var Gi={};ci(Gi,{ZodISODate:()=>Oo,ZodISODateTime:()=>To,ZodISODuration:()=>Io,ZodISOTime:()=>Ro,date:()=>Ok,datetime:()=>Tk,duration:()=>Ik,time:()=>Rk});function Tk(e){return Ni(To,e)}function Ok(e){return Ai(Oo,e)}function Rk(e){return ji(Ro,e)}function Ik(e){return qi(Io,e)}var Wi={};ci(Wi,{bigint:()=>jk,boolean:()=>Ak,date:()=>qk,number:()=>Nk,string:()=>Ck});function Ck(e){return Qg(Du,e)}function Nk(e){return b_(Ji,e)}function Ak(e){return z_(Zu,e)}function jk(e){return P_(Fy,e)}function qk(e){return R_(Hy,e)}var On="2025-11-25";var ov=[On,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],gr="io.modelcontextprotocol/related-task",Yi="2.0",ke=tv(e=>e!==null&&(typeof e=="object"||typeof e=="function")),sv=me([_(),ee().int()]),iv=_(),PL=Pe({ttl:ee().optional(),pollInterval:ee().optional()}),Dk=P({ttl:ee().optional()}),Zk=P({taskId:_()}),Vu=Pe({progressToken:sv.optional(),[gr]:Zk.optional()}),dt=P({_meta:Vu.optional()}),Co=dt.extend({task:Dk.optional()}),av=e=>Co.safeParse(e).success,Oe=P({method:_(),params:dt.loose().optional()}),pt=P({_meta:Vu.optional()}),mt=P({method:_(),params:pt.loose().optional()}),Re=Pe({_meta:Vu.optional()}),Qi=me([_(),ee().int()]),cv=P({jsonrpc:T(Yi),id:Qi,...Oe.shape}).strict(),No=e=>cv.safeParse(e).success,uv=P({jsonrpc:T(Yi),...mt.shape}).strict(),lv=e=>uv.safeParse(e).success,Ku=P({jsonrpc:T(Yi),id:Qi,result:Re}).strict(),jr=e=>Ku.safeParse(e).success;var A;(function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(A||(A={}));var Hu=P({jsonrpc:T(Yi),id:Qi.optional(),error:P({code:ee().int(),message:_(),data:ve().optional()})}).strict();var dv=e=>Hu.safeParse(e).success;var Rn=me([cv,uv,Ku,Hu]),kL=me([Ku,Hu]),qr=Re.strict(),Uk=pt.extend({requestId:Qi.optional(),reason:_().optional()}),ea=mt.extend({method:T("notifications/cancelled"),params:Uk}),Lk=P({src:_(),mimeType:_().optional(),sizes:z(_()).optional(),theme:Ye(["light","dark"]).optional()}),Ao=P({icons:z(Lk).optional()}),Tn=P({name:_(),title:_().optional()}),fv=Tn.extend({...Tn.shape,...Ao.shape,version:_(),websiteUrl:_().optional(),description:_().optional()}),Fk=Bi(P({applyDefaults:ue().optional()}),fe(_(),ve())),Vk=Lu(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Bi(P({form:Fk.optional(),url:ke.optional()}),fe(_(),ve()).optional())),Kk=Pe({list:ke.optional(),cancel:ke.optional(),requests:Pe({sampling:Pe({createMessage:ke.optional()}).optional(),elicitation:Pe({create:ke.optional()}).optional()}).optional()}),Hk=Pe({list:ke.optional(),cancel:ke.optional(),requests:Pe({tools:Pe({call:ke.optional()}).optional()}).optional()}),Jk=P({experimental:fe(_(),ke).optional(),sampling:P({context:ke.optional(),tools:ke.optional()}).optional(),elicitation:Vk.optional(),roots:P({listChanged:ue().optional()}).optional(),tasks:Kk.optional(),extensions:fe(_(),ke).optional()}),Bk=dt.extend({protocolVersion:_(),capabilities:Jk,clientInfo:fv}),Gk=Oe.extend({method:T("initialize"),params:Bk});var Wk=P({experimental:fe(_(),ke).optional(),logging:ke.optional(),completions:ke.optional(),prompts:P({listChanged:ue().optional()}).optional(),resources:P({subscribe:ue().optional(),listChanged:ue().optional()}).optional(),tools:P({listChanged:ue().optional()}).optional(),tasks:Hk.optional(),extensions:fe(_(),ke).optional()}),Ju=Re.extend({protocolVersion:_(),capabilities:Wk,serverInfo:fv,instructions:_().optional()}),pv=mt.extend({method:T("notifications/initialized"),params:pt.optional()}),mv=e=>pv.safeParse(e).success,ta=Oe.extend({method:T("ping"),params:dt.optional()}),Xk=P({progress:ee(),total:$e(ee()),message:$e(_())}),Yk=P({...pt.shape,...Xk.shape,progressToken:sv}),ra=mt.extend({method:T("notifications/progress"),params:Yk}),Qk=dt.extend({cursor:iv.optional()}),jo=Oe.extend({params:Qk.optional()}),qo=Re.extend({nextCursor:iv.optional()}),eE=Ye(["working","input_required","completed","failed","cancelled"]),Mo=P({taskId:_(),status:eE,ttl:me([ee(),Vy()]),createdAt:_(),lastUpdatedAt:_(),pollInterval:$e(ee()),statusMessage:$e(_())}),Mr=Re.extend({task:Mo}),tE=pt.merge(Mo),Do=mt.extend({method:T("notifications/tasks/status"),params:tE}),na=Oe.extend({method:T("tasks/get"),params:dt.extend({taskId:_()})}),oa=Re.merge(Mo),sa=Oe.extend({method:T("tasks/result"),params:dt.extend({taskId:_()})}),EL=Re.loose(),ia=jo.extend({method:T("tasks/list")}),aa=qo.extend({tasks:z(Mo)}),ca=Oe.extend({method:T("tasks/cancel"),params:dt.extend({taskId:_()})}),hv=Re.merge(Mo),gv=P({uri:_(),mimeType:$e(_()),_meta:fe(_(),ve()).optional()}),_v=gv.extend({text:_()}),Bu=_().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),yv=gv.extend({blob:Bu}),Zo=Ye(["user","assistant"]),In=P({audience:z(Zo).optional(),priority:ee().min(0).max(1).optional(),lastModified:Gi.datetime({offset:!0}).optional()}),vv=P({...Tn.shape,...Ao.shape,uri:_(),description:$e(_()),mimeType:$e(_()),size:$e(ee()),annotations:In.optional(),_meta:$e(Pe({}))}),rE=P({...Tn.shape,...Ao.shape,uriTemplate:_(),description:$e(_()),mimeType:$e(_()),annotations:In.optional(),_meta:$e(Pe({}))}),nE=jo.extend({method:T("resources/list")}),Gu=qo.extend({resources:z(vv)}),oE=jo.extend({method:T("resources/templates/list")}),Wu=qo.extend({resourceTemplates:z(rE)}),Xu=dt.extend({uri:_()}),sE=Xu,iE=Oe.extend({method:T("resources/read"),params:sE}),Yu=Re.extend({contents:z(me([_v,yv]))}),Qu=mt.extend({method:T("notifications/resources/list_changed"),params:pt.optional()}),aE=Xu,cE=Oe.extend({method:T("resources/subscribe"),params:aE}),uE=Xu,lE=Oe.extend({method:T("resources/unsubscribe"),params:uE}),dE=pt.extend({uri:_()}),fE=mt.extend({method:T("notifications/resources/updated"),params:dE}),pE=P({name:_(),description:$e(_()),required:$e(ue())}),mE=P({...Tn.shape,...Ao.shape,description:$e(_()),arguments:$e(z(pE)),_meta:$e(Pe({}))}),hE=jo.extend({method:T("prompts/list")}),el=qo.extend({prompts:z(mE)}),gE=dt.extend({name:_(),arguments:fe(_(),_()).optional()}),_E=Oe.extend({method:T("prompts/get"),params:gE}),tl=P({type:T("text"),text:_(),annotations:In.optional(),_meta:fe(_(),ve()).optional()}),rl=P({type:T("image"),data:Bu,mimeType:_(),annotations:In.optional(),_meta:fe(_(),ve()).optional()}),nl=P({type:T("audio"),data:Bu,mimeType:_(),annotations:In.optional(),_meta:fe(_(),ve()).optional()}),yE=P({type:T("tool_use"),name:_(),id:_(),input:fe(_(),ve()),_meta:fe(_(),ve()).optional()}),vE=P({type:T("resource"),resource:me([_v,yv]),annotations:In.optional(),_meta:fe(_(),ve()).optional()}),$E=vv.extend({type:T("resource_link")}),ol=me([tl,rl,nl,$E,vE]),wE=P({role:Zo,content:ol}),sl=Re.extend({description:_().optional(),messages:z(wE)}),il=mt.extend({method:T("notifications/prompts/list_changed"),params:pt.optional()}),bE=P({title:_().optional(),readOnlyHint:ue().optional(),destructiveHint:ue().optional(),idempotentHint:ue().optional(),openWorldHint:ue().optional()}),SE=P({taskSupport:Ye(["required","optional","forbidden"]).optional()}),$v=P({...Tn.shape,...Ao.shape,description:_().optional(),inputSchema:P({type:T("object"),properties:fe(_(),ke).optional(),required:z(_()).optional()}).catchall(ve()),outputSchema:P({type:T("object"),properties:fe(_(),ke).optional(),required:z(_()).optional()}).catchall(ve()).optional(),annotations:bE.optional(),execution:SE.optional(),_meta:fe(_(),ve()).optional()}),xE=jo.extend({method:T("tools/list")}),al=qo.extend({tools:z($v)}),Cn=Re.extend({content:z(ol).default([]),structuredContent:fe(_(),ve()).optional(),isError:ue().optional()}),TL=Cn.or(Re.extend({toolResult:ve()})),zE=Co.extend({name:_(),arguments:fe(_(),ve()).optional()}),PE=Oe.extend({method:T("tools/call"),params:zE}),Uo=mt.extend({method:T("notifications/tools/list_changed"),params:pt.optional()}),wv=P({autoRefresh:ue().default(!0),debounceMs:ee().int().nonnegative().default(300)}),bv=Ye(["debug","info","notice","warning","error","critical","alert","emergency"]),kE=dt.extend({level:bv}),EE=Oe.extend({method:T("logging/setLevel"),params:kE}),TE=pt.extend({level:bv,logger:_().optional(),data:ve()}),OE=mt.extend({method:T("notifications/message"),params:TE}),RE=P({name:_().optional()}),IE=P({hints:z(RE).optional(),costPriority:ee().min(0).max(1).optional(),speedPriority:ee().min(0).max(1).optional(),intelligencePriority:ee().min(0).max(1).optional()}),CE=P({mode:Ye(["auto","required","none"]).optional()}),NE=P({type:T("tool_result"),toolUseId:_().describe("The unique identifier for the corresponding tool call."),content:z(ol).default([]),structuredContent:P({}).loose().optional(),isError:ue().optional(),_meta:fe(_(),ve()).optional()}),AE=Uu("type",[tl,rl,nl]),Xi=Uu("type",[tl,rl,nl,yE,NE]),jE=P({role:Zo,content:me([Xi,z(Xi)]),_meta:fe(_(),ve()).optional()}),qE=Co.extend({messages:z(jE),modelPreferences:IE.optional(),systemPrompt:_().optional(),includeContext:Ye(["none","thisServer","allServers"]).optional(),temperature:ee().optional(),maxTokens:ee().int(),stopSequences:z(_()).optional(),metadata:ke.optional(),tools:z($v).optional(),toolChoice:CE.optional()}),cl=Oe.extend({method:T("sampling/createMessage"),params:qE}),ul=Re.extend({model:_(),stopReason:$e(Ye(["endTurn","stopSequence","maxTokens"]).or(_())),role:Zo,content:AE}),ll=Re.extend({model:_(),stopReason:$e(Ye(["endTurn","stopSequence","maxTokens","toolUse"]).or(_())),role:Zo,content:me([Xi,z(Xi)])}),ME=P({type:T("boolean"),title:_().optional(),description:_().optional(),default:ue().optional()}),DE=P({type:T("string"),title:_().optional(),description:_().optional(),minLength:ee().optional(),maxLength:ee().optional(),format:Ye(["email","uri","date","date-time"]).optional(),default:_().optional()}),ZE=P({type:Ye(["number","integer"]),title:_().optional(),description:_().optional(),minimum:ee().optional(),maximum:ee().optional(),default:ee().optional()}),UE=P({type:T("string"),title:_().optional(),description:_().optional(),enum:z(_()),default:_().optional()}),LE=P({type:T("string"),title:_().optional(),description:_().optional(),oneOf:z(P({const:_(),title:_()})),default:_().optional()}),FE=P({type:T("string"),title:_().optional(),description:_().optional(),enum:z(_()),enumNames:z(_()).optional(),default:_().optional()}),VE=me([UE,LE]),KE=P({type:T("array"),title:_().optional(),description:_().optional(),minItems:ee().optional(),maxItems:ee().optional(),items:P({type:T("string"),enum:z(_())}),default:z(_()).optional()}),HE=P({type:T("array"),title:_().optional(),description:_().optional(),minItems:ee().optional(),maxItems:ee().optional(),items:P({anyOf:z(P({const:_(),title:_()}))}),default:z(_()).optional()}),JE=me([KE,HE]),BE=me([FE,VE,JE]),GE=me([BE,ME,DE,ZE]),WE=Co.extend({mode:T("form").optional(),message:_(),requestedSchema:P({type:T("object"),properties:fe(_(),GE),required:z(_()).optional()})}),XE=Co.extend({mode:T("url"),message:_(),elicitationId:_(),url:_().url()}),YE=me([WE,XE]),dl=Oe.extend({method:T("elicitation/create"),params:YE}),QE=pt.extend({elicitationId:_()}),eT=mt.extend({method:T("notifications/elicitation/complete"),params:QE}),fl=Re.extend({action:Ye(["accept","decline","cancel"]),content:Lu(e=>e===null?void 0:e,fe(_(),me([_(),ee(),ue(),z(_())])).optional())}),tT=P({type:T("ref/resource"),uri:_()});var rT=P({type:T("ref/prompt"),name:_()}),nT=dt.extend({ref:me([rT,tT]),argument:P({name:_(),value:_()}),context:P({arguments:fe(_(),_()).optional()}).optional()}),oT=Oe.extend({method:T("completion/complete"),params:nT});var pl=Re.extend({completion:Pe({values:z(_()).max(100),total:$e(ee().int()),hasMore:$e(ue())})}),sT=P({uri:_().startsWith("file://"),name:_().optional(),_meta:fe(_(),ve()).optional()}),iT=Oe.extend({method:T("roots/list"),params:dt.optional()}),aT=Re.extend({roots:z(sT)}),cT=mt.extend({method:T("notifications/roots/list_changed"),params:pt.optional()}),OL=me([ta,Gk,oT,EE,_E,hE,nE,oE,iE,cE,lE,PE,xE,na,sa,ia,ca]),RL=me([ea,ra,pv,cT,Do]),IL=me([qr,ul,ll,fl,aT,oa,aa,Mr]),CL=me([ta,cl,dl,iT,na,sa,ia,ca]),NL=me([ea,ra,OE,fE,Qu,Uo,il,Do,eT]),AL=me([qr,Ju,pl,sl,el,Gu,Wu,Yu,Cn,al,oa,aa,Mr]),C=class e extends Error{constructor(t,r,n){super(`MCP error ${t}: ${r}`),this.code=t,this.data=n,this.name="McpError"}static fromError(t,r,n){if(t===A.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new Fu(o.elicitations,r)}return new e(t,r,n)}},Fu=class extends C{constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(A.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}};function _r(e){return e==="completed"||e==="failed"||e==="cancelled"}var mF=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function ml(e){let r=Li(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=Fi(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function hl(e,t){let r=kt(e,t);if(!r.success)throw r.error;return r.data}var mT=6e4,ua=class{constructor(t){this._options=t,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(ea,r=>{this._oncancel(r)}),this.setNotificationHandler(ra,r=>{this._onprogress(r)}),this.setRequestHandler(ta,r=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(na,async(r,n)=>{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new C(A.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(sa,async(r,n)=>{let o=async()=>{let s=r.params.taskId;if(!await this._taskStore.getTask(s,n.sessionId))throw new C(A.InvalidParams,`Task not found: ${s}`);if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(s,n.sessionId);){if(a.type==="response"||a.type==="error"){let c=a.message,l=c.id,u=this._requestResolvers.get(l);if(u)if(this._requestResolvers.delete(l),a.type==="response")u(c);else{let d=c,m=new C(d.error.code,d.error.message,d.error.data);u(m)}else{let d=a.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${l}`))}continue}await this._transport?.send(a.message,{relatedRequestId:n.requestId})}}let i=await this._taskStore.getTask(s,n.sessionId);if(!i)throw new C(A.InvalidParams,`Task not found: ${s}`);if(!_r(i.status))return await this._waitForTaskUpdate(s,n.signal,n.sessionId),await o();if(_r(i.status)){let a=await this._taskStore.getTaskResult(s,n.sessionId);return this._clearTaskQueue(s,n.sessionId),{...a,_meta:{...a._meta,[gr]:{taskId:s}}}}return await o()};return await o()}),this.setRequestHandler(ia,async(r,n)=>{try{let{tasks:o,nextCursor:s}=await this._taskStore.listTasks(r.params?.cursor,n.sessionId);return{tasks:o,nextCursor:s,_meta:{}}}catch(o){throw new C(A.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(ca,async(r,n)=>{try{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new C(A.InvalidParams,`Task not found: ${r.params.taskId}`);if(_r(o.status))throw new C(A.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId,n.sessionId);let s=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!s)throw new C(A.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...s}}catch(o){throw o instanceof C?o:new C(A.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}}))}async _oncancel(t){if(!t.params.requestId)return;this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,r,n,o,s=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(o,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:s,onTimeout:o})}_resetTimeout(t){let r=this._timeoutInfo.get(t);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(t),C.fromError(A.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(t){let r=this._timeoutInfo.get(t);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(t))}async connect(t){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=t;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=s=>{n?.(s),this._onerror(s)};let o=this._transport?.onmessage;this._transport.onmessage=(s,i)=>{o?.(s,i),jr(s)||dv(s)?this._onresponse(s):No(s)?this._onrequest(s,i):lv(s)?this._onnotification(s):this._onerror(new Error(`Unknown message type: ${JSON.stringify(s)}`))},await this._transport.start()}_onclose(){let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let n of this._timeoutInfo.values())clearTimeout(n.timeoutId);this._timeoutInfo.clear();for(let n of this._requestHandlerAbortControllers.values())n.abort();this._requestHandlerAbortControllers.clear();let r=C.fromError(A.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of t.values())n(r)}_onerror(t){this.onerror?.(t)}_onnotification(t){let r=this._notificationHandlers.get(t.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(t)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(t,r){let n=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,o=this._transport,s=t.params?._meta?.[gr]?.taskId,i=o?.sessionId,a=this._taskStore,c=!0,l;if(s&&a&&this._taskMessageQueue&&i!==void 0&&(c=!1,l=(async()=>{if(!await a.getTask(s,i))throw new C(A.InvalidParams,`Task not found: ${s}`);c=!0})()),n===void 0){let f={jsonrpc:"2.0",id:t.id,error:{code:A.MethodNotFound,message:"Method not found"}};if(s&&l){let h={type:"error",message:f,timestamp:Date.now()};l.then(()=>this._enqueueTaskMessage(s,h,i),()=>o?.send(f)).catch(g=>this._onerror(new Error(`Failed to send an error response: ${g}`)))}else s&&this._taskMessageQueue?this._enqueueTaskMessage(s,{type:"error",message:f,timestamp:Date.now()},o?.sessionId).catch(h=>this._onerror(new Error(`Failed to enqueue error response: ${h}`))):o?.send(f).catch(h=>this._onerror(new Error(`Failed to send an error response: ${h}`)));return}let u=new AbortController;this._requestHandlerAbortControllers.set(t.id,u);let d=av(t.params)?t.params.task:void 0,m=this._taskStore?this.requestTaskStore(t,o?.sessionId):void 0,p={signal:u.signal,sessionId:o?.sessionId,_meta:t.params?._meta,sendNotification:async f=>{if(u.signal.aborted)return;let h={relatedRequestId:t.id};s&&(h.relatedTask={taskId:s}),await this.notification(f,h)},sendRequest:async(f,h,g)=>{if(u.signal.aborted)throw new C(A.ConnectionClosed,"Request was cancelled");let y={...g,relatedRequestId:t.id};s&&!y.relatedTask&&(y.relatedTask={taskId:s});let b=y.relatedTask?.taskId??s;return b&&m&&await m.updateTaskStatus(b,"input_required"),await this.request(f,h,y)},authInfo:r?.authInfo,requestId:t.id,requestInfo:r?.requestInfo,taskId:s,taskStore:m,taskRequestedTtl:d?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};(l??Promise.resolve()).then(()=>{if(l&&u.signal.aborted)throw new C(A.ConnectionClosed,"Request was cancelled");d&&this.assertTaskHandlerCapability(t.method)}).then(()=>n(t,p)).then(async f=>{if(u.signal.aborted)return;let h={result:f,jsonrpc:"2.0",id:t.id};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"response",message:h,timestamp:Date.now()},o?.sessionId):await o?.send(h)},async f=>{if(u.signal.aborted)return;let h={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(f.code)?f.code:A.InternalError,message:f.message??"Internal error",...f.data!==void 0&&{data:f.data}}};s&&this._taskMessageQueue&&c?await this._enqueueTaskMessage(s,{type:"error",message:h,timestamp:Date.now()},o?.sessionId):await o?.send(h)}).catch(f=>this._onerror(new Error(`Failed to send response: ${f}`))).finally(()=>{this._requestHandlerAbortControllers.get(t.id)===u&&this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){let{progressToken:r,...n}=t.params,o=Number(r),s=this._progressHandlers.get(o);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}let i=this._responseHandlers.get(o),a=this._timeoutInfo.get(o);if(a&&i&&a.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(c){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),i(c);return}s(n)}_onresponse(t){let r=Number(t.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),jr(t))n(t);else{let i=new C(t.error.code,t.error.message,t.error.data);n(i)}return}let o=this._responseHandlers.get(r);if(o===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let s=!1;if(jr(t)&&t.result&&typeof t.result=="object"){let i=t.result;if(i.task&&typeof i.task=="object"){let a=i.task;typeof a.taskId=="string"&&(s=!0,this._taskProgressTokens.set(a.taskId,r))}}if(s||this._progressHandlers.delete(r),jr(t))o(t);else{let i=C.fromError(t.error.code,t.error.message,t.error.data);o(i)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(t,r,n){let{task:o}=n??{};if(!o){try{yield{type:"result",result:await this.request(t,r,n)}}catch(i){yield{type:"error",error:i instanceof C?i:new C(A.InternalError,String(i))}}return}let s;try{let i=await this.request(t,Mr,n);if(i.task)s=i.task.taskId,yield{type:"taskCreated",task:i.task};else throw new C(A.InternalError,"Task creation did not return a task");for(;;){let a=await this.getTask({taskId:s},n);if(yield{type:"taskStatus",task:a},_r(a.status)){a.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:s},r,n)}:a.status==="failed"?yield{type:"error",error:new C(A.InternalError,`Task ${s} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new C(A.InternalError,`Task ${s} was cancelled`)});return}if(a.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:s},r,n)};return}let c=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(l=>setTimeout(l,c)),n?.signal?.throwIfAborted()}}catch(i){yield{type:"error",error:i instanceof C?i:new C(A.InternalError,String(i))}}}request(t,r,n){let{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i,task:a,relatedTask:c}=n??{};return new Promise((l,u)=>{let d=b=>{u(b)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method),a&&this.assertTaskCapability(t.method)}catch(b){d(b);return}n?.signal?.throwIfAborted();let m=this._requestMessageId++,p={...t,jsonrpc:"2.0",id:m};n?.onprogress&&(this._progressHandlers.set(m,n.onprogress),p.params={...t.params,_meta:{...t.params?._meta||{},progressToken:m}}),a&&(p.params={...p.params,task:a}),c&&(p.params={...p.params,_meta:{...p.params?._meta||{},[gr]:c}});let f=b=>{this._responseHandlers.delete(m),this._progressHandlers.delete(m),this._cleanupTimeout(m),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:m,reason:String(b)}},{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i}).catch(k=>this._onerror(new Error(`Failed to send cancellation: ${k}`)));let x=b instanceof C?b:new C(A.RequestTimeout,String(b));u(x)};this._responseHandlers.set(m,b=>{if(!n?.signal?.aborted){if(b instanceof Error)return u(b);try{let x=kt(r,b.result);x.success?l(x.data):u(x.error)}catch(x){u(x)}}}),n?.signal?.addEventListener("abort",()=>{f(n?.signal?.reason)});let h=n?.timeout??mT,g=()=>f(C.fromError(A.RequestTimeout,"Request timed out",{timeout:h}));this._setupTimeout(m,h,n?.maxTotalTimeout,g,n?.resetTimeoutOnProgress??!1);let y=c?.taskId;if(y){let b=x=>{let k=this._responseHandlers.get(m);k?k(x):this._onerror(new Error(`Response handler missing for side-channeled request ${m}`))};this._requestResolvers.set(m,b),this._enqueueTaskMessage(y,{type:"request",message:p,timestamp:Date.now()}).catch(x=>{this._cleanupTimeout(m),u(x)})}else this._transport.send(p,{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i}).catch(b=>{this._cleanupTimeout(m),u(b)})})}async getTask(t,r){return this.request({method:"tasks/get",params:t},oa,r)}async getTaskResult(t,r,n){return this.request({method:"tasks/result",params:t},r,n)}async listTasks(t,r){return this.request({method:"tasks/list",params:t},aa,r)}async cancelTask(t,r){return this.request({method:"tasks/cancel",params:t},hv,r)}async notification(t,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);let n=r?.relatedTask?.taskId;if(n){let a={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...t.params?._meta||{},[gr]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:a,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;let a={...t,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[gr]:r.relatedTask}}}),this._transport?.send(a,r).catch(c=>this._onerror(c))});return}let i={...t,jsonrpc:"2.0"};r?.relatedTask&&(i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[gr]:r.relatedTask}}}),await this._transport.send(i,r)}setRequestHandler(t,r){let n=ml(t);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(o,s)=>{let i=hl(t,o);return Promise.resolve(r(i,s))})}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw new Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,r){let n=ml(t);this._notificationHandlers.set(n,o=>{let s=hl(t,o);return Promise.resolve(r(s))})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}_cleanupTaskProgressHandler(t){let r=this._taskProgressTokens.get(t);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(t))}async _enqueueTaskMessage(t,r,n){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let o=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,r,n??this._transport?.sessionId,o)}async _clearTaskQueue(t,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(t,r);for(let o of n)if(o.type==="request"&&No(o.message)){let s=o.message.id,i=this._requestResolvers.get(s);i?(i(new C(A.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(s)):this._onerror(new Error(`Resolver missing for request ${s} during task ${t} cleanup`))}}}async _waitForTaskUpdate(t,r,n){let o=this._options?.defaultTaskPollInterval??1e3;try{let s=await this._taskStore?.getTask(t,n);s?.pollInterval&&(o=s.pollInterval)}catch{}return new Promise((s,i)=>{if(r.aborted){i(new C(A.InvalidRequest,"Request cancelled"));return}let a=setTimeout(s,o);r.addEventListener("abort",()=>{clearTimeout(a),i(new C(A.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async o=>{if(!t)throw new Error("No request provided");return await n.createTask(o,t.id,{method:t.method,params:t.params},r)},getTask:async o=>{let s=await n.getTask(o,r);if(!s)throw new C(A.InvalidParams,"Failed to retrieve task: Task not found");return s},storeTaskResult:async(o,s,i)=>{await n.storeTaskResult(o,s,i,r);let a=await n.getTask(o,r);if(a){let c=Do.parse({method:"notifications/tasks/status",params:a});await this.notification(c),_r(a.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>n.getTaskResult(o,r),updateTaskStatus:async(o,s,i)=>{let a=await n.getTask(o,r);if(!a)throw new C(A.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(_r(a.status))throw new C(A.InvalidParams,`Cannot update task "${o}" from terminal status "${a.status}" to "${s}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(o,s,i,r);let c=await n.getTask(o,r);if(c){let l=Do.parse({method:"notifications/tasks/status",params:c});await this.notification(l),_r(c.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>n.listTasks(o,r)}}};function Sv(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function xv(e,t){let r={...e};for(let n in t){let o=n,s=t[o];if(s===void 0)continue;let i=r[o];Sv(i)&&Sv(s)?r[o]={...i,...s}:r[o]=s}return r}var qS=mn(uw(),1),MS=mn(jS(),1);function $D(){let e=new qS.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,MS.default)(e),e}var po=class{constructor(t){this._ajv=t??$D()}getValidator(t){let r="$id"in t&&typeof t.$id=="string"?this._ajv.getSchema(t.$id)??this._ajv.compile(t):this._ajv.compile(t);return n=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var bc=class{constructor(t){this._client=t}async*callToolStream(t,r=Cn,n){let o=this._client,s={...n,task:n?.task??(o.isToolTask(t.name)?{}:void 0)},i=o.requestStream({method:"tools/call",params:t},r,s),a=o.getToolOutputValidator(t.name);for await(let c of i){if(c.type==="result"&&a){let l=c.result;if(!l.structuredContent&&!l.isError){yield{type:"error",error:new C(A.InvalidRequest,`Tool ${t.name} has an output schema but did not return structured content`)};return}if(l.structuredContent)try{let u=a(l.structuredContent);if(!u.valid){yield{type:"error",error:new C(A.InvalidParams,`Structured content does not match the tool's output schema: ${u.errorMessage}`)};return}}catch(u){if(u instanceof C){yield{type:"error",error:u};return}yield{type:"error",error:new C(A.InvalidParams,`Failed to validate structured content: ${u instanceof Error?u.message:String(u)}`)};return}}yield c}}async getTask(t,r){return this._client.getTask({taskId:t},r)}async getTaskResult(t,r,n){return this._client.getTaskResult({taskId:t},r,n)}async listTasks(t,r){return this._client.listTasks(t?{cursor:t}:void 0,r)}async cancelTask(t,r){return this._client.cancelTask({taskId:t},r)}requestStream(t,r,n){return this._client.requestStream(t,r,n)}};function DS(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!e.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${t})`);break;default:break}}function ZS(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!e.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!e.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${t})`);break;default:break}}function Sc(e,t){if(!(!e||t===null||typeof t!="object")){if(e.type==="object"&&e.properties&&typeof e.properties=="object"){let r=t,n=e.properties;for(let o of Object.keys(n)){let s=n[o];r[o]===void 0&&Object.prototype.hasOwnProperty.call(s,"default")&&(r[o]=s.default),r[o]!==void 0&&Sc(s,r[o])}}if(Array.isArray(e.anyOf))for(let r of e.anyOf)typeof r!="boolean"&&Sc(r,t);if(Array.isArray(e.oneOf))for(let r of e.oneOf)typeof r!="boolean"&&Sc(r,t)}}function wD(e){if(!e)return{supportsFormMode:!1,supportsUrlMode:!1};let t=e.form!==void 0,r=e.url!==void 0;return{supportsFormMode:t||!t&&!r,supportsUrlMode:r}}var xc=class extends ua{constructor(t,r){super(r),this._clientInfo=t,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._listChangedDebounceTimers=new Map,this._capabilities=r?.capabilities??{},this._jsonSchemaValidator=r?.jsonSchemaValidator??new po,r?.listChanged&&(this._pendingListChangedConfig=r.listChanged)}_setupListChangedHandlers(t){t.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler("tools",Uo,t.tools,async()=>(await this.listTools()).tools),t.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler("prompts",il,t.prompts,async()=>(await this.listPrompts()).prompts),t.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler("resources",Qu,t.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new bc(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=xv(this._capabilities,t)}setRequestHandler(t,r){let o=Li(t)?.method;if(!o)throw new Error("Schema is missing a method literal");let s=Fi(o);if(typeof s!="string")throw new Error("Schema method literal must be a string");let i=s;if(i==="elicitation/create"){let a=async(c,l)=>{let u=kt(dl,c);if(!u.success){let b=u.error instanceof Error?u.error.message:String(u.error);throw new C(A.InvalidParams,`Invalid elicitation request: ${b}`)}let{params:d}=u.data;d.mode=d.mode??"form";let{supportsFormMode:m,supportsUrlMode:p}=wD(this._capabilities.elicitation);if(d.mode==="form"&&!m)throw new C(A.InvalidParams,"Client does not support form-mode elicitation requests");if(d.mode==="url"&&!p)throw new C(A.InvalidParams,"Client does not support URL-mode elicitation requests");let f=await Promise.resolve(r(c,l));if(d.task){let b=kt(Mr,f);if(!b.success){let x=b.error instanceof Error?b.error.message:String(b.error);throw new C(A.InvalidParams,`Invalid task creation result: ${x}`)}return b.data}let h=kt(fl,f);if(!h.success){let b=h.error instanceof Error?h.error.message:String(h.error);throw new C(A.InvalidParams,`Invalid elicitation result: ${b}`)}let g=h.data,y=d.mode==="form"?d.requestedSchema:void 0;if(d.mode==="form"&&g.action==="accept"&&g.content&&y&&this._capabilities.elicitation?.form?.applyDefaults)try{Sc(y,g.content)}catch{}return g};return super.setRequestHandler(t,a)}if(i==="sampling/createMessage"){let a=async(c,l)=>{let u=kt(cl,c);if(!u.success){let g=u.error instanceof Error?u.error.message:String(u.error);throw new C(A.InvalidParams,`Invalid sampling request: ${g}`)}let{params:d}=u.data,m=await Promise.resolve(r(c,l));if(d.task){let g=kt(Mr,m);if(!g.success){let y=g.error instanceof Error?g.error.message:String(g.error);throw new C(A.InvalidParams,`Invalid task creation result: ${y}`)}return g.data}let f=d.tools||d.toolChoice?ll:ul,h=kt(f,m);if(!h.success){let g=h.error instanceof Error?h.error.message:String(h.error);throw new C(A.InvalidParams,`Invalid sampling result: ${g}`)}return h.data};return super.setRequestHandler(t,a)}return super.setRequestHandler(t,r)}assertCapability(t,r){if(!this._serverCapabilities?.[t])throw new Error(`Server does not support ${t} (required for ${r})`)}async connect(t,r){if(await super.connect(t),t.sessionId===void 0)try{let n=await this.request({method:"initialize",params:{protocolVersion:On,capabilities:this._capabilities,clientInfo:this._clientInfo}},Ju,r);if(n===void 0)throw new Error(`Server sent invalid initialize result: ${n}`);if(!ov.includes(n.protocolVersion))throw new Error(`Server's protocol version is not supported: ${n.protocolVersion}`);this._serverCapabilities=n.capabilities,this._serverVersion=n.serverInfo,t.setProtocolVersion&&t.setProtocolVersion(n.protocolVersion),this._instructions=n.instructions,await this.notification({method:"notifications/initialized"}),this._pendingListChangedConfig&&(this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0)}catch(n){throw this.close(),n}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(t){switch(t){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw new Error(`Server does not support prompts (required for ${t})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!this._serverCapabilities?.resources)throw new Error(`Server does not support resources (required for ${t})`);if(t==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${t})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw new Error(`Server does not support tools (required for ${t})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw new Error(`Server does not support completions (required for ${t})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(t){switch(t){case"notifications/roots/list_changed":if(!this._capabilities.roots?.listChanged)throw new Error(`Client does not support roots list changed notifications (required for ${t})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(t){if(this._capabilities)switch(t){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${t})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${t})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${t})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Client does not support tasks capability (required for ${t})`);break;case"ping":break}}assertTaskCapability(t){DS(this._serverCapabilities?.tasks?.requests,t,"Server")}assertTaskHandlerCapability(t){this._capabilities&&ZS(this._capabilities.tasks?.requests,t,"Client")}async ping(t){return this.request({method:"ping"},qr,t)}async complete(t,r){return this.request({method:"completion/complete",params:t},pl,r)}async setLoggingLevel(t,r){return this.request({method:"logging/setLevel",params:{level:t}},qr,r)}async getPrompt(t,r){return this.request({method:"prompts/get",params:t},sl,r)}async listPrompts(t,r){return this.request({method:"prompts/list",params:t},el,r)}async listResources(t,r){return this.request({method:"resources/list",params:t},Gu,r)}async listResourceTemplates(t,r){return this.request({method:"resources/templates/list",params:t},Wu,r)}async readResource(t,r){return this.request({method:"resources/read",params:t},Yu,r)}async subscribeResource(t,r){return this.request({method:"resources/subscribe",params:t},qr,r)}async unsubscribeResource(t,r){return this.request({method:"resources/unsubscribe",params:t},qr,r)}async callTool(t,r=Cn,n){if(this.isToolTaskRequired(t.name))throw new C(A.InvalidRequest,`Tool "${t.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);let o=await this.request({method:"tools/call",params:t},r,n),s=this.getToolOutputValidator(t.name);if(s){if(!o.structuredContent&&!o.isError)throw new C(A.InvalidRequest,`Tool ${t.name} has an output schema but did not return structured content`);if(o.structuredContent)try{let i=s(o.structuredContent);if(!i.valid)throw new C(A.InvalidParams,`Structured content does not match the tool's output schema: ${i.errorMessage}`)}catch(i){throw i instanceof C?i:new C(A.InvalidParams,`Failed to validate structured content: ${i instanceof Error?i.message:String(i)}`)}}return o}isToolTask(t){return this._serverCapabilities?.tasks?.requests?.tools?.call?this._cachedKnownTaskTools.has(t):!1}isToolTaskRequired(t){return this._cachedRequiredTaskTools.has(t)}cacheToolMetadata(t){this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(let r of t){if(r.outputSchema){let o=this._jsonSchemaValidator.getValidator(r.outputSchema);this._cachedToolOutputValidators.set(r.name,o)}let n=r.execution?.taskSupport;(n==="required"||n==="optional")&&this._cachedKnownTaskTools.add(r.name),n==="required"&&this._cachedRequiredTaskTools.add(r.name)}}getToolOutputValidator(t){return this._cachedToolOutputValidators.get(t)}async listTools(t,r){let n=await this.request({method:"tools/list",params:t},al,r);return this.cacheToolMetadata(n.tools),n}_setupListChangedHandler(t,r,n,o){let s=wv.safeParse(n);if(!s.success)throw new Error(`Invalid ${t} listChanged options: ${s.error.message}`);if(typeof n.onChanged!="function")throw new Error(`Invalid ${t} listChanged options: onChanged must be a function`);let{autoRefresh:i,debounceMs:a}=s.data,{onChanged:c}=n,l=async()=>{if(!i){c(null,null);return}try{let d=await o();c(null,d)}catch(d){let m=d instanceof Error?d:new Error(String(d));c(m,null)}},u=()=>{if(a){let d=this._listChangedDebounceTimers.get(t);d&&clearTimeout(d);let m=setTimeout(l,a);this._listChangedDebounceTimers.set(t,m)}else l()};this.setNotificationHandler(r,u)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};var Ox=mn(Ex(),1),Ec=mn(require("node:process"),1),Rx=require("node:stream");var BD=10*1024*1024,Pc=class{constructor(t){this._maxBufferSize=t?.maxBufferSize??BD}append(t){if((this._buffer?.length??0)+t.length>this._maxBufferSize)throw this.clear(),new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,t]):t}readMessage(){if(!this._buffer)return null;let t=this._buffer.indexOf(`
|
|
72
|
+
`);if(t===-1)return null;let r=this._buffer.toString("utf8",0,t).replace(/\r$/,"");return this._buffer=this._buffer.subarray(t+1),GD(r)}clear(){this._buffer=void 0}};function GD(e){return Rn.parse(JSON.parse(e))}function Tx(e){return JSON.stringify(e)+`
|
|
73
|
+
`}var WD=Ec.default.platform==="win32"?["APPDATA","HOMEDRIVE","HOMEPATH","LOCALAPPDATA","PATH","PROCESSOR_ARCHITECTURE","SYSTEMDRIVE","SYSTEMROOT","TEMP","USERNAME","USERPROFILE","PROGRAMFILES"]:["HOME","LOGNAME","PATH","SHELL","TERM","USER"];function rm(){let e={};for(let t of WD){let r=Ec.default.env[t];r!==void 0&&(r.startsWith("()")||(e[t]=r))}return e}var kc=class{constructor(t){this._stderrStream=null,this._serverParams=t,this._readBuffer=new Pc({maxBufferSize:t.maxBufferSize}),(t.stderr==="pipe"||t.stderr==="overlapped")&&(this._stderrStream=new Rx.PassThrough)}async start(){if(this._process)throw new Error("StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise((t,r)=>{this._process=(0,Ox.default)(this._serverParams.command,this._serverParams.args??[],{env:{...rm(),...this._serverParams.env},stdio:["pipe","pipe",this._serverParams.stderr??"inherit"],shell:!1,windowsHide:Ec.default.platform==="win32",cwd:this._serverParams.cwd}),this._process.on("error",n=>{r(n),this.onerror?.(n)}),this._process.on("spawn",()=>{t()}),this._process.on("close",n=>{this._process=void 0,this.onclose?.()}),this._process.stdin?.on("error",n=>{this.onerror?.(n)}),this._process.stdout?.on("data",n=>{try{this._readBuffer.append(n),this.processReadBuffer()}catch(o){this.onerror?.(o),this.close().catch(()=>{})}}),this._process.stdout?.on("error",n=>{this.onerror?.(n)}),this._stderrStream&&this._process.stderr&&this._process.stderr.pipe(this._stderrStream)})}get stderr(){return this._stderrStream?this._stderrStream:this._process?.stderr??null}get pid(){return this._process?.pid??null}processReadBuffer(){for(;;)try{let t=this._readBuffer.readMessage();if(t===null)break;this.onmessage?.(t)}catch(t){this.onerror?.(t)}}async close(){if(this._process){let t=this._process;this._process=void 0;let r=new Promise(n=>{t.once("close",()=>{n()})});try{t.stdin?.end()}catch{}if(await Promise.race([r,new Promise(n=>setTimeout(n,2e3).unref())]),t.exitCode===null){try{t.kill("SIGTERM")}catch{}await Promise.race([r,new Promise(n=>setTimeout(n,2e3).unref())])}if(t.exitCode===null)try{t.kill("SIGKILL")}catch{}}this._readBuffer.clear()}send(t){return new Promise(r=>{if(!this._process?.stdin)throw new Error("Not connected");let n=Tx(t);this._process.stdin.write(n)?r():this._process.stdin.once("drain",r)})}};var jx=mn(Ax(),1);function qx(e){if(e)try{return jx.default.parse(e).type}catch{let t=(e.split(";",1)[0]??"").trim().toLowerCase();return t===""||e.slice(t.length).includes(",")?void 0:t}}function Tc(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}function Mx(e=fetch,t){return t?async(r,n)=>{let o={...t,...n,headers:n?.headers?{...Tc(t.headers),...Tc(n.headers)}:t.headers};return e(r,o)}:e}var sZ=5,iZ=[301,302,303,307,308];function aZ(e,t){return e.protocol===t.protocol&&e.hostname===t.hostname&&e.port===t.port?!0:e.hostname===t.hostname&&e.protocol==="http:"&&e.port===""&&t.protocol==="https:"&&t.port===""}function Dx(e,t){let r=iZ.includes(e.status)?e.headers.get("location"):null;try{return r?new URL(r,t):void 0}catch{return}}function Oc(e,t,r,n,o=0){let s=Dx(n,t),i=n.status===307||n.status===308||(r?.method??"GET").toUpperCase()==="GET";if(!s||o===sZ||!i)return;let a=new URL(t);if(!((s.username||s.password)&&(s.username!==a.username||s.password!==a.password)||!aZ(a,s)))return Promise.resolve(n.body?.cancel()).then(()=>e(s,{...r,redirect:"manual"})).then(l=>Oc(e,s,r,l,o+1)??l)}var Zx=new WeakSet;function om(e){let t=(r,n)=>(e??fetch)(r,n);return Zx.add(t),t}function cn(e=fetch){return Zx.has(e)?e:(t,r)=>r?.redirect==="error"||r?.redirect==="manual"?e(t,r):Promise.resolve(e(t,{...r,redirect:"manual"})).then(n=>Oc(e,t,r,n)??n)}function Rc(e,t){if(e.type==="opaqueredirect")return"Redirect not followed: this runtime does not expose the redirect target";let r=e.url||t,n=Dx(e,r);if(n)return n.username=n.password=n.search=n.hash="",n.protocol==="http:"&&new URL(r).protocol==="https:"?(n.protocol="https:",`Redirect to plain http not followed; try ${n.href} instead`):`Redirect to ${n.href} not followed`}var sm;sm=globalThis.crypto?.webcrypto??globalThis.crypto??import("node:crypto").then(e=>e.webcrypto);async function cZ(e){return(await sm).getRandomValues(new Uint8Array(e))}async function uZ(e){let t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r=Math.pow(2,8)-Math.pow(2,8)%t.length,n="";for(;n.length<e;){let o=await cZ(e-n.length);for(let s of o)s<r&&(n+=t[s%t.length])}return n}async function lZ(e){return await uZ(e)}async function dZ(e){let t=await(await sm).subtle.digest("SHA-256",new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function im(e){if(e||(e=43),e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;let t=await lZ(e),r=await dZ(t);return{code_verifier:t,code_challenge:r}}var qe=Ly().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:nv.custom,message:"URL must be parseable",fatal:!0}),Bc}).refine(e=>{let t=new URL(e);return t.protocol!=="javascript:"&&t.protocol!=="data:"&&t.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),Lx=Pe({resource:_().url(),authorization_servers:z(qe).optional(),jwks_uri:_().url().optional(),scopes_supported:z(_()).optional(),bearer_methods_supported:z(_()).optional(),resource_signing_alg_values_supported:z(_()).optional(),resource_name:_().optional(),resource_documentation:_().optional(),resource_policy_uri:_().url().optional(),resource_tos_uri:_().url().optional(),tls_client_certificate_bound_access_tokens:ue().optional(),authorization_details_types_supported:z(_()).optional(),dpop_signing_alg_values_supported:z(_()).optional(),dpop_bound_access_tokens_required:ue().optional()}),am=Pe({issuer:_(),authorization_endpoint:qe,token_endpoint:qe,registration_endpoint:qe.optional(),scopes_supported:z(_()).optional(),response_types_supported:z(_()),response_modes_supported:z(_()).optional(),grant_types_supported:z(_()).optional(),token_endpoint_auth_methods_supported:z(_()).optional(),token_endpoint_auth_signing_alg_values_supported:z(_()).optional(),service_documentation:qe.optional(),revocation_endpoint:qe.optional(),revocation_endpoint_auth_methods_supported:z(_()).optional(),revocation_endpoint_auth_signing_alg_values_supported:z(_()).optional(),introspection_endpoint:_().optional(),introspection_endpoint_auth_methods_supported:z(_()).optional(),introspection_endpoint_auth_signing_alg_values_supported:z(_()).optional(),code_challenge_methods_supported:z(_()).optional(),client_id_metadata_document_supported:ue().optional()}),fZ=Pe({issuer:_(),authorization_endpoint:qe,token_endpoint:qe,userinfo_endpoint:qe.optional(),jwks_uri:qe,registration_endpoint:qe.optional(),scopes_supported:z(_()).optional(),response_types_supported:z(_()),response_modes_supported:z(_()).optional(),grant_types_supported:z(_()).optional(),acr_values_supported:z(_()).optional(),subject_types_supported:z(_()),id_token_signing_alg_values_supported:z(_()),id_token_encryption_alg_values_supported:z(_()).optional(),id_token_encryption_enc_values_supported:z(_()).optional(),userinfo_signing_alg_values_supported:z(_()).optional(),userinfo_encryption_alg_values_supported:z(_()).optional(),userinfo_encryption_enc_values_supported:z(_()).optional(),request_object_signing_alg_values_supported:z(_()).optional(),request_object_encryption_alg_values_supported:z(_()).optional(),request_object_encryption_enc_values_supported:z(_()).optional(),token_endpoint_auth_methods_supported:z(_()).optional(),token_endpoint_auth_signing_alg_values_supported:z(_()).optional(),display_values_supported:z(_()).optional(),claim_types_supported:z(_()).optional(),claims_supported:z(_()).optional(),service_documentation:_().optional(),claims_locales_supported:z(_()).optional(),ui_locales_supported:z(_()).optional(),claims_parameter_supported:ue().optional(),request_parameter_supported:ue().optional(),request_uri_parameter_supported:ue().optional(),require_request_uri_registration:ue().optional(),op_policy_uri:qe.optional(),op_tos_uri:qe.optional(),client_id_metadata_document_supported:ue().optional()}),Fx=P({...fZ.shape,...am.pick({code_challenge_methods_supported:!0}).shape}),Vx=P({access_token:_(),id_token:_().optional(),token_type:_(),expires_in:Wi.number().optional(),scope:_().optional(),refresh_token:_().optional(),issuer:_().optional().catch(void 0)}).strip(),Kx=P({error:_(),error_description:_().optional(),error_uri:_().optional()}),Ux=qe.optional().or(T("").transform(()=>{})),pZ=P({redirect_uris:z(qe),token_endpoint_auth_method:_().optional(),grant_types:z(_()).optional(),response_types:z(_()).optional(),client_name:_().optional(),client_uri:qe.optional(),logo_uri:Ux,scope:_().optional(),contacts:z(_()).optional(),tos_uri:Ux,policy_uri:_().optional(),jwks_uri:qe.optional(),jwks:Ky().optional(),software_id:_().optional(),software_version:_().optional(),software_statement:_().optional()}).strip(),mZ=P({client_id:_(),client_secret:_().optional(),client_id_issued_at:ee().optional(),client_secret_expires_at:ee().optional(),issuer:_().optional().catch(void 0)}).strip(),Hx=pZ.merge(mZ),g3=P({error:_(),error_description:_().optional()}).strip(),_3=P({token:_(),token_type_hint:_().optional()}).strip();function Jx(e){let t=typeof e=="string"?new URL(e):new URL(e.href);return t.hash="",t}function Bx({requestedResource:e,configuredResource:t}){let r=typeof e=="string"?new URL(e):new URL(e.href),n=typeof t=="string"?new URL(t):new URL(t.href);if(r.origin!==n.origin||r.pathname.length<n.pathname.length)return!1;let o=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",s=n.pathname.endsWith("/")?n.pathname:n.pathname+"/";return o.startsWith(s)}var ze=class extends Error{constructor(t,r){super(t),this.errorUri=r,this.name=this.constructor.name}toResponseObject(){let t={error:this.errorCode,error_description:this.message};return this.errorUri&&(t.error_uri=this.errorUri),t}get errorCode(){return this.constructor.errorCode}},Js=class extends ze{};Js.errorCode="invalid_request";var un=class extends ze{};un.errorCode="invalid_client";var ln=class extends ze{};ln.errorCode="invalid_grant";var dn=class extends ze{};dn.errorCode="unauthorized_client";var Bs=class extends ze{};Bs.errorCode="unsupported_grant_type";var Gs=class extends ze{};Gs.errorCode="invalid_scope";var Ws=class extends ze{};Ws.errorCode="access_denied";var ur=class extends ze{};ur.errorCode="server_error";var Xs=class extends ze{};Xs.errorCode="temporarily_unavailable";var Ys=class extends ze{};Ys.errorCode="unsupported_response_type";var Qs=class extends ze{};Qs.errorCode="unsupported_token_type";var ei=class extends ze{};ei.errorCode="invalid_token";var ti=class extends ze{};ti.errorCode="method_not_allowed";var ri=class extends ze{};ri.errorCode="too_many_requests";var fn=class extends ze{};fn.errorCode="invalid_client_metadata";var ni=class extends ze{};ni.errorCode="insufficient_scope";var oi=class extends ze{};oi.errorCode="invalid_target";var Gx={[Js.errorCode]:Js,[un.errorCode]:un,[ln.errorCode]:ln,[dn.errorCode]:dn,[Bs.errorCode]:Bs,[Gs.errorCode]:Gs,[Ws.errorCode]:Ws,[ur.errorCode]:ur,[Xs.errorCode]:Xs,[Ys.errorCode]:Ys,[Qs.errorCode]:Qs,[ei.errorCode]:ei,[ti.errorCode]:ti,[ri.errorCode]:ri,[fn.errorCode]:fn,[ni.errorCode]:ni,[oi.errorCode]:oi};var lr=class extends Error{constructor(t){super(t??"Unauthorized")}};function hZ(e){return["client_secret_basic","client_secret_post","none"].includes(e)}var cm="code",um="S256";function gZ(e,t){let r=e.client_secret!==void 0;return"token_endpoint_auth_method"in e&&e.token_endpoint_auth_method&&hZ(e.token_endpoint_auth_method)&&(t.length===0||t.includes(e.token_endpoint_auth_method))?e.token_endpoint_auth_method:t.length===0?r?"client_secret_basic":"none":r&&t.includes("client_secret_basic")?"client_secret_basic":r&&t.includes("client_secret_post")?"client_secret_post":t.includes("none")?"none":r?"client_secret_post":"none"}function _Z(e,t,r,n){let{client_id:o,client_secret:s}=t;switch(e){case"client_secret_basic":yZ(o,s,r);return;case"client_secret_post":vZ(o,s,n);return;case"none":$Z(o,n);return;default:throw new Error(`Unsupported client authentication method: ${e}`)}}function yZ(e,t,r){if(!t)throw new Error("client_secret_basic authentication requires a client_secret");let n=btoa(`${e}:${t}`);r.set("Authorization",`Basic ${n}`)}function vZ(e,t,r){r.set("client_id",e),t&&r.set("client_secret",t)}function $Z(e,t){t.set("client_id",e)}async function Xx(e){let t=e instanceof Response?e.status:void 0,r=e instanceof Response?await e.text():e;try{let n=Kx.parse(JSON.parse(r)),{error:o,error_description:s,error_uri:i}=n,a=Gx[o]||ur;return new a(s||"",i)}catch(n){let o=e instanceof Response?Rc(e,e.url):void 0,s=`${t?`HTTP ${t}: `:""}${o??`Invalid OAuth error response: ${n}. Raw body: ${r}`}`;return new ur(s)}}function wZ(e,t){let[r,n]=[e,t];try{[r,n]=[new URL(e).href,new URL(t).href]}catch{}return r===n||r.endsWith("/")&&r.slice(0,-1)===n||n.endsWith("/")&&n.slice(0,-1)===r}function fm(e,t){if(e)return typeof e.issuer!="string"?e.issuer==null?e:{...e,issuer:void 0}:wZ(e.issuer,t)?e:void 0}var bZ=Vx.omit({issuer:!0}),SZ=Hx.omit({issuer:!0});function Yx(e,t){return new Error(`OAuth client information is bound to authorization server ${e.issuer} and is not presented to ${t}. Clear the stored client information, or correct \`expectedIssuer\`, if the authorization server has moved.`)}async function si(e,t){try{return await lm(e,t)}catch(r){if(r instanceof un||r instanceof dn)return await e.invalidateCredentials?.("all"),await lm(e,t);if(r instanceof ln)return await e.invalidateCredentials?.("tokens"),await lm(e,t);throw r}}async function lm(e,{serverUrl:t,authorizationCode:r,scope:n,resourceMetadataUrl:o,fetchFn:s}){let i=await e.discoveryState?.(),a,c,l,u=o;if(!u&&i?.resourceMetadataUrl&&(u=new URL(i.resourceMetadataUrl)),i?.authorizationServerUrl){if(c=i.authorizationServerUrl,a=i.resourceMetadata,l=i.authorizationServerMetadata??await ez(c,{fetchFn:s}),!a)try{a=await Qx(t,{resourceMetadataUrl:u},s)}catch{}(l!==i.authorizationServerMetadata||a!==i.resourceMetadata)&&await e.saveDiscoveryState?.({authorizationServerUrl:String(c),resourceMetadataUrl:u?.toString(),resourceMetadata:a,authorizationServerMetadata:l})}else{let M=await OZ(t,{resourceMetadataUrl:u,fetchFn:s});c=M.authorizationServerUrl,l=M.authorizationServerMetadata,a=M.resourceMetadata,await e.saveDiscoveryState?.({authorizationServerUrl:String(c),resourceMetadataUrl:u?.toString(),resourceMetadata:a,authorizationServerMetadata:l})}let d=String(c),m=await zZ(t,e,a),p=m&&a&&!e.validateResourceURL?a.resource:m,f=n||a?.scopes_supported?.join(" ")||e.clientMetadata.scope,h=await Promise.resolve(e.clientInformation()),g=fm(h,d),y=e.saveClientInformation!==void 0&&!!e.redirectUrl;if(h&&!g&&!y)throw Yx(h,d);let b=g?.issuer==null?g:void 0,x=async()=>{try{b&&await e.saveClientInformation?.({...b,issuer:d})}catch{}};if(!g){if(r!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");let M=l?.client_id_metadata_document_supported===!0,oe=e.clientMetadataUrl;if(oe&&!xZ(oe))throw new fn(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${oe}`);if(M&&oe)g={client_id:oe,issuer:d},await e.saveClientInformation?.(g);else{if(!e.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");g={...await AZ(c,{metadata:l,clientMetadata:e.clientMetadata,scope:f,fetchFn:s}),issuer:d},await e.saveClientInformation(g)}}let k=!e.redirectUrl;if(r!==void 0||k){let M=await NZ(e,c,{metadata:l,resource:p,authorizationCode:r,fetchFn:s});return await x(),await e.saveTokens({...M,issuer:d}),"AUTHORIZED"}let v=fm(await e.tokens(),d);if(v?.refresh_token&&v.issuer==null&&console.warn("[mcp-sdk] stored OAuth tokens have no 'issuer' property (saved by an earlier version, or by a provider that does not keep it) and are used as-is; make sure your OAuthClientProvider stores what saveTokens() and saveClientInformation() receive unchanged."),v?.refresh_token)try{let M=await CZ(c,{metadata:l,clientInformation:g,refreshToken:v.refresh_token,resource:p,addClientAuthentication:e.addClientAuthentication,fetchFn:s});return await x(),await e.saveTokens({...M,issuer:d}),"AUTHORIZED"}catch(M){if(!(!(M instanceof ze)||M instanceof ur))throw M}let S=e.state?await e.state():void 0,{authorizationUrl:E,codeVerifier:ne}=await RZ(c,{metadata:l,clientInformation:g,state:S,redirectUrl:e.redirectUrl,scope:f,resource:p});return await e.saveCodeVerifier(ne),await e.redirectToAuthorization(E),"REDIRECT"}function xZ(e){if(!e)return!1;try{let t=new URL(e);return t.protocol==="https:"&&t.pathname!=="/"}catch{return!1}}async function zZ(e,t,r){let n=Jx(e);if(t.validateResourceURL)return await t.validateResourceURL(n,r?.resource);if(r){if(!Bx({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 pm(e){let t=e.headers.get("WWW-Authenticate");if(!t)return{};let[r,n]=t.split(" ");if(r.toLowerCase()!=="bearer"||!n)return{};let o=dm(e,"resource_metadata")||void 0,s;if(o)try{s=new URL(o)}catch{}let i=dm(e,"scope")||void 0,a=dm(e,"error")||void 0;return{resourceMetadataUrl:s,scope:i,error:a}}function dm(e,t){let r=e.headers.get("WWW-Authenticate");if(!r)return null;let n=new RegExp(`${t}=(?:"([^"]+)"|([^\\s,]+))`),o=r.match(n);return o?o[1]||o[2]:null}async function Qx(e,t,r=fetch){let n=await EZ(e,"oauth-protected-resource",r,{protocolVersion:t?.protocolVersion,metadataUrl:t?.resourceMetadataUrl});if(!n||n.status===404)throw await n?.body?.cancel(),new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!n.ok)throw await n.body?.cancel(),new Error(`HTTP ${n.status} trying to load well-known OAuth protected resource metadata.`);return Lx.parse(await n.json())}async function mm(e,t,r=fetch){try{return await cn(r)(e,{headers:t})}catch(n){if(n instanceof TypeError)return t?mm(e,void 0,r):void 0;throw n}}function PZ(e,t="",r={}){return t.endsWith("/")&&(t=t.slice(0,-1)),r.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}async function Wx(e,t,r=fetch){return await mm(e,{"MCP-Protocol-Version":t},r)}function kZ(e,t){return!e||!e.ok&&e.status<500&&t!=="/"}async function EZ(e,t,r,n){let o=new URL(e),s=n?.protocolVersion??On,i;if(n?.metadataUrl)i=new URL(n.metadataUrl);else{let c=PZ(t,o.pathname);i=new URL(c,n?.metadataServerUrl??o),i.search=o.search}let a=await Wx(i,s,r);if(!n?.metadataUrl&&kZ(a,o.pathname)){let c=new URL(`/.well-known/${t}`,o);a=await Wx(c,s,r)}return a}function TZ(e){let t=typeof e=="string"?new URL(e):e,r=t.pathname!=="/",n=[];if(!r)return n.push({url:new URL("/.well-known/oauth-authorization-server",t.origin),type:"oauth"}),n.push({url:new URL("/.well-known/openid-configuration",t.origin),type:"oidc"}),n;let o=t.pathname;return o.endsWith("/")&&(o=o.slice(0,-1)),n.push({url:new URL(`/.well-known/oauth-authorization-server${o}`,t.origin),type:"oauth"}),n.push({url:new URL(`/.well-known/openid-configuration${o}`,t.origin),type:"oidc"}),n.push({url:new URL(`${o}/.well-known/openid-configuration`,t.origin),type:"oidc"}),n}async function ez(e,{fetchFn:t=fetch,protocolVersion:r=On}={}){let n={"MCP-Protocol-Version":r,Accept:"application/json"},o=TZ(e);for(let{url:s,type:i}of o){let a=await mm(s,n,t);if(a){if(!a.ok){if(await a.body?.cancel(),a.status<500)continue;throw new Error(`HTTP ${a.status} trying to load ${i==="oauth"?"OAuth":"OpenID provider"} metadata from ${s}`)}return i==="oauth"?am.parse(await a.json()):Fx.parse(await a.json())}}}async function OZ(e,t){let r,n;try{r=await Qx(e,{resourceMetadataUrl:t?.resourceMetadataUrl},t?.fetchFn),r.authorization_servers&&r.authorization_servers.length>0&&(n=r.authorization_servers[0])}catch{}n||(n=String(new URL("/",e)));let o=await ez(n,{fetchFn:t?.fetchFn});return{authorizationServerUrl:n,authorizationServerMetadata:o,resourceMetadata:r}}function tz(e){return typeof e=="string"?e:e.href}async function RZ(e,{metadata:t,clientInformation:r,redirectUrl:n,scope:o,state:s,resource:i}){let a;if(t){if(a=new URL(t.authorization_endpoint),!t.response_types_supported.includes(cm))throw new Error(`Incompatible auth server: does not support response type ${cm}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(um))throw new Error(`Incompatible auth server: does not support code challenge method ${um}`)}else a=new URL("/authorize",e);let c=await im(),l=c.code_verifier,u=c.code_challenge;return a.searchParams.set("response_type",cm),a.searchParams.set("client_id",r.client_id),a.searchParams.set("code_challenge",u),a.searchParams.set("code_challenge_method",um),a.searchParams.set("redirect_uri",String(n)),s&&a.searchParams.set("state",s),o&&a.searchParams.set("scope",o),o?.includes("offline_access")&&a.searchParams.append("prompt","consent"),i&&a.searchParams.set("resource",tz(i)),{authorizationUrl:a,codeVerifier:l}}function IZ(e,t,r){return new URLSearchParams({grant_type:"authorization_code",code:e,code_verifier:t,redirect_uri:String(r)})}async function rz(e,{metadata:t,tokenRequestParams:r,clientInformation:n,addClientAuthentication:o,resource:s,fetchFn:i}){let a=t?.token_endpoint?new URL(t.token_endpoint):new URL("/token",e),c=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});if(s&&r.set("resource",tz(s)),o)await o(c,r,a,t);else if(n){let u=t?.token_endpoint_auth_methods_supported??[],d=gZ(n,u);_Z(d,n,c,r)}let l=await cn(i??fetch)(a,{method:"POST",headers:c,body:r});if(!l.ok)throw await Xx(l);return bZ.parse(await l.json())}async function CZ(e,{metadata:t,clientInformation:r,refreshToken:n,resource:o,addClientAuthentication:s,fetchFn:i}){let a=new URLSearchParams({grant_type:"refresh_token",refresh_token:n}),c=await rz(e,{metadata:t,tokenRequestParams:a,clientInformation:r,addClientAuthentication:s,resource:o,fetchFn:i});return{refresh_token:n,...c}}async function NZ(e,t,{metadata:r,resource:n,authorizationCode:o,fetchFn:s}={}){let i=async()=>{let u=await e.clientInformation(),d=fm(u,String(t));if(u&&!d)throw Yx(u,String(t));return d},a=await i(),c=e.clientMetadata.scope,l;if(e.prepareTokenRequest&&(l=await e.prepareTokenRequest(c)),!l){if(!o)throw new Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!e.redirectUrl)throw new Error("redirectUrl is required for authorization_code flow");let u=await e.codeVerifier();l=IZ(o,u,e.redirectUrl)}return a??(a=await i()),rz(t,{metadata:r,tokenRequestParams:l,clientInformation:a,addClientAuthentication:e.addClientAuthentication,resource:n,fetchFn:s})}async function AZ(e,{metadata:t,clientMetadata:r,scope:n,fetchFn:o}){let s;if(t){if(!t.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");s=new URL(t.registration_endpoint)}else s=new URL("/register",e);let i=await cn(o??fetch)(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...r,...n!==void 0?{scope:n}:{}})});if(!i.ok)throw await Xx(i);return SZ.parse(await i.json())}var ii=class extends Error{constructor(t,r){super(t),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}},nz=10,jZ=13,pn=32;function hm(e){}function iz(e){if(typeof e=="function")throw new TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");let{onEvent:t=hm,onError:r=hm,onRetry:n=hm,onComment:o,maxBufferSize:s}=e,i=[],a=0,c=!0,l,u="",d=0,m,p=!1;function f(v){if(p)throw new Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(c&&(c=!1,v.charCodeAt(0)===239&&v.charCodeAt(1)===187&&v.charCodeAt(2)===191&&(v=v.slice(3))),i.length===0){let ne=g(v);ne!==""&&(i.push(ne),a=ne.length),h();return}if(v.indexOf(`
|
|
74
|
+
`)===-1&&v.indexOf("\r")===-1){i.push(v),a+=v.length,h();return}i.push(v);let S=i.join("");i.length=0,a=0;let E=g(S);E!==""&&(i.push(E),a=E.length),h()}function h(){s!==void 0&&(a+u.length<=s||(p=!0,i.length=0,a=0,l=void 0,u="",d=0,m=void 0,r(new ii(`Buffered data exceeded max buffer size of ${s} characters`,{type:"max-buffer-size-exceeded"}))))}function g(v){let S=0;if(v.indexOf("\r")===-1){let E=v.indexOf(`
|
|
75
|
+
`,S);for(;E!==-1;){if(S===E){d>0&&t({id:l,event:m,data:u}),l=void 0,u="",d=0,m=void 0,S=E+1,E=v.indexOf(`
|
|
76
|
+
`,S);continue}let ne=v.charCodeAt(S);if(oz(v,S,ne)){let M=v.charCodeAt(S+5)===pn?S+6:S+5,oe=v.slice(M,E);if(d===0&&v.charCodeAt(E+1)===nz){t({id:l,event:m,data:oe}),l=void 0,u="",m=void 0,S=E+2,E=v.indexOf(`
|
|
77
|
+
`,S);continue}u=d===0?oe:`${u}
|
|
78
|
+
${oe}`,d++}else sz(v,S,ne)?m=v.slice(v.charCodeAt(S+6)===pn?S+7:S+6,E)||void 0:y(v,S,E);S=E+1,E=v.indexOf(`
|
|
79
|
+
`,S)}return v.slice(S)}for(;S<v.length;){let E=v.indexOf("\r",S),ne=v.indexOf(`
|
|
80
|
+
`,S),M=-1;if(E!==-1&&ne!==-1?M=E<ne?E:ne:E!==-1?E===v.length-1?M=-1:M=E:ne!==-1&&(M=ne),M===-1)break;y(v,S,M),S=M+1,v.charCodeAt(S-1)===jZ&&v.charCodeAt(S)===nz&&S++}return v.slice(S)}function y(v,S,E){if(S===E){x();return}let ne=v.charCodeAt(S);if(oz(v,S,ne)){let Mt=v.charCodeAt(S+5)===pn?S+6:S+5,gm=v.slice(Mt,E);u=d===0?gm:`${u}
|
|
81
|
+
${gm}`,d++;return}if(sz(v,S,ne)){m=v.slice(v.charCodeAt(S+6)===pn?S+7:S+6,E)||void 0;return}if(ne===105&&v.charCodeAt(S+1)===100&&v.charCodeAt(S+2)===58){let Mt=v.slice(v.charCodeAt(S+3)===pn?S+4:S+3,E);Mt.includes("\0")||(l=Mt);return}if(ne===58){if(o){let Mt=v.slice(S,E);o(Mt.slice(v.charCodeAt(S+1)===pn?2:1))}return}let M=v.slice(S,E),oe=M.indexOf(":");if(oe===-1){b(M,"",M);return}let ct=M.slice(0,oe),qt=M.charCodeAt(oe+1)===pn?2:1,Jt=M.slice(oe+qt);b(ct,Jt,M)}function b(v,S,E){switch(v){case"event":m=S||void 0;break;case"data":u=d===0?S:`${u}
|
|
82
|
+
${S}`,d++;break;case"id":S.includes("\0")||(l=S);break;case"retry":/^\d+$/.test(S)?n(parseInt(S,10)):r(new ii(`Invalid \`retry\` value: "${S}"`,{type:"invalid-retry",value:S,line:E}));break;default:r(new ii(`Unknown field "${v.length>20?`${v.slice(0,20)}\u2026`:v}"`,{type:"unknown-field",field:v,value:S,line:E}));break}}function x(){d>0&&t({id:l,event:m,data:u}),l=void 0,u="",d=0,m=void 0}function k(v={}){if(v.consume&&i.length>0){let S=i.join("");y(S,0,S.length)}c=!0,l=void 0,u="",d=0,m=void 0,i.length=0,a=0,p=!1}return{feed:f,reset:k}}function oz(e,t,r){return r===100&&e.charCodeAt(t+1)===97&&e.charCodeAt(t+2)===116&&e.charCodeAt(t+3)===97&&e.charCodeAt(t+4)===58}function sz(e,t,r){return r===101&&e.charCodeAt(t+1)===118&&e.charCodeAt(t+2)===101&&e.charCodeAt(t+3)===110&&e.charCodeAt(t+4)===116&&e.charCodeAt(t+5)===58}var Ic=class extends TransformStream{constructor({onError:t,onRetry:r,onComment:n,maxBufferSize:o}={}){let s;super({start(i){s=iz({onEvent:a=>{i.enqueue(a)},onError(a){typeof t=="function"&&t(a),(t==="terminate"||a.type==="max-buffer-size-exceeded")&&i.error(a)},onRetry:r,onComment:n,maxBufferSize:o})},transform(i){s.feed(i)}})}};var qZ={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},Cr=class extends Error{constructor(t,r){super(`Streamable HTTP error: ${r}`),this.code=t}},Cc=class{constructor(t,r){this._hasCompletedAuthFlow=!1,this._url=t,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch,this._fetchWithInit=Mx(r?.fetch,r?.requestInit),this._followRedirects=r?.redirectPolicy==="follow",this._followRedirects&&(this._fetch=om(this._fetch),this._fetchWithInit=om(this._fetchWithInit)),this._sessionId=r?.sessionId,this._reconnectionOptions=r?.reconnectionOptions??qZ}_unfollowedRedirect(t,r){let n=Rc(t,r);return n&&!this._followRedirects?`${n} (redirectPolicy: 'same-origin')`:n}async _authThenStart(){if(!this._authProvider)throw new lr("No auth provider");let t;try{t=await si(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(r){throw this.onerror?.(r),r}if(t!=="AUTHORIZED")throw new lr;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){let t={};if(this._authProvider){let n=await this._authProvider.tokens();n&&(t.Authorization=`Bearer ${n.access_token}`)}this._sessionId&&(t["mcp-session-id"]=this._sessionId),this._protocolVersion&&(t["mcp-protocol-version"]=this._protocolVersion);let r=Tc(this._requestInit?.headers);return new Headers({...t,...r})}async _startOrAuthSse(t){let{resumptionToken:r}=t;try{let n=await this._commonHeaders();n.set("Accept","text/event-stream"),r&&n.set("last-event-id",r);let o=this._fetch??fetch,s={method:"GET",headers:n,signal:this._abortController?.signal},i=await o(this._url,this._followRedirects?s:{...s,redirect:"manual"}),a=this._followRedirects?void 0:Oc(o,this._url,s,i);if(a&&(i=await a),!i.ok){if(await i.body?.cancel(),i.status===401&&this._authProvider)return await this._authThenStart();if(i.status===405)return;throw new Cr(i.status,`Failed to open SSE stream: ${this._unfollowedRedirect(i,this._url)??i.statusText}`)}this._handleSseStream(i.body,t,!0)}catch(n){throw this.onerror?.(n),n}}_getNextReconnectionDelay(t){if(this._serverRetryMs!==void 0)return this._serverRetryMs;let r=this._reconnectionOptions.initialReconnectionDelay,n=this._reconnectionOptions.reconnectionDelayGrowFactor,o=this._reconnectionOptions.maxReconnectionDelay;return Math.min(r*Math.pow(n,t),o)}_scheduleReconnection(t,r=0){let n=this._reconnectionOptions.maxRetries;if(r>=n){this.onerror?.(new Error(`Maximum reconnection attempts (${n}) exceeded.`));return}let o=this._getNextReconnectionDelay(r);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(t).catch(s=>{this.onerror?.(new Error(`Failed to reconnect SSE stream: ${s instanceof Error?s.message:String(s)}`)),this._scheduleReconnection(t,r+1)})},o)}_handleSseStream(t,r,n){if(!t)return;let{onresumptiontoken:o,replayMessageId:s}=r,i,a=!1,c=!1;(async()=>{try{let u=t.pipeThrough(new TextDecoderStream).pipeThrough(new Ic({onRetry:p=>{this._serverRetryMs=p}})).getReader();for(;;){let{value:p,done:f}=await u.read();if(f)break;if(p.id&&(i=p.id,a=!0,o?.(p.id)),!!p.data&&(!p.event||p.event==="message"))try{let h=Rn.parse(JSON.parse(p.data));jr(h)&&(c=!0,s!==void 0&&(h.id=s)),this.onmessage?.(h)}catch(h){this.onerror?.(h)}}(n||a)&&!c&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:i,onresumptiontoken:o,replayMessageId:s},0)}catch(u){if(this.onerror?.(new Error(`SSE stream disconnected: ${u}`)),(n||a)&&!c&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:i,onresumptiontoken:o,replayMessageId:s},0)}catch(p){this.onerror?.(new Error(`Failed to reconnect: ${p instanceof Error?p.message:String(p)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(t){if(!this._authProvider)throw new lr("No auth provider");if(await si(this._authProvider,{serverUrl:this._url,authorizationCode:t,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new lr("Failed to authorize")}async close(){this._reconnectionTimeout&&(clearTimeout(this._reconnectionTimeout),this._reconnectionTimeout=void 0),this._abortController?.abort(),this.onclose?.()}async send(t,r){try{let{resumptionToken:n,onresumptiontoken:o}=r||{};if(n){this._startOrAuthSse({resumptionToken:n,replayMessageId:No(t)?t.id:void 0}).catch(p=>this.onerror?.(p));return}let s=await this._commonHeaders();s.set("content-type","application/json"),s.set("accept","application/json, text/event-stream");let i={...this._requestInit,method:"POST",headers:s,body:JSON.stringify(t),signal:this._abortController?.signal},a=await cn(this._fetch??fetch)(this._url,i),c=a.headers.get("mcp-session-id");if(c&&(this._sessionId=c),!a.ok){let p=await a.text().catch(()=>null);if(a.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new Cr(401,"Server returned 401 after successful authentication");let{resourceMetadataUrl:f,scope:h}=pm(a);if(this._resourceMetadataUrl=f,this._scope=h,await si(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new lr;return this._hasCompletedAuthFlow=!0,this.send(t)}if(a.status===403&&this._authProvider){let{resourceMetadataUrl:f,scope:h,error:g}=pm(a);if(g==="insufficient_scope"){let y=a.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===y)throw new Cr(403,"Server returned 403 after trying upscoping");if(h&&(this._scope=h),f&&(this._resourceMetadataUrl=f),this._lastUpscopingHeader=y??void 0,await si(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new lr;return this.send(t)}}throw new Cr(a.status,`Error POSTing to endpoint: ${this._unfollowedRedirect(a,this._url)??p}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,a.status===202){await a.body?.cancel(),mv(t)&&this._startOrAuthSse({resumptionToken:void 0}).catch(p=>this.onerror?.(p));return}let u=(Array.isArray(t)?t:[t]).filter(p=>"method"in p&&"id"in p&&p.id!==void 0).length>0,d=a.headers.get("content-type"),m=qx(d);if(u)if(m==="text/event-stream")this._handleSseStream(a.body,{onresumptiontoken:o},!1);else if(m==="application/json"){let p=await a.json(),f=Array.isArray(p)?p.map(h=>Rn.parse(h)):[Rn.parse(p)];for(let h of f)this.onmessage?.(h)}else throw await a.body?.cancel(),new Cr(-1,`Unexpected content type: ${d}`);else await a.body?.cancel()}catch(n){throw this.onerror?.(n),n}}get sessionId(){return this._sessionId}async terminateSession(){if(this._sessionId)try{let t=await this._commonHeaders(),r={...this._requestInit,method:"DELETE",headers:t,signal:this._abortController?.signal},n=await cn(this._fetch??fetch)(this._url,r);if(await n.body?.cancel(),!n.ok&&n.status!==405)throw new Cr(n.status,`Failed to terminate session: ${this._unfollowedRedirect(n,this._url)??n.statusText}`);this._sessionId=void 0}catch(t){throw this.onerror?.(t),t}}setProtocolVersion(t){this._protocolVersion=t}get protocolVersion(){return this._protocolVersion}async resumeStream(t,r){await this._startOrAuthSse({resumptionToken:t,onresumptiontoken:r?.onresumptiontoken})}};0&&(module.exports={AjvJsonSchemaValidator,Client,StdioClientTransport,StreamableHTTPClientTransport,ToolListChangedNotificationSchema,getDefaultEnvironment});
|