UNPKG

revenuecat-mcp

Version:

MCP server exposing complete RevenueCat v2 REST API for IDE integration with AI agents

123 lines 289 kB
#!/usr/bin/env node
"use strict";var Hp=Object.create;var oi=Object.defineProperty;var Jp=Object.getOwnPropertyDescriptor;var Gp=Object.getOwnPropertyNames;var Wp=Object.getPrototypeOf,Zp=Object.prototype.hasOwnProperty;var w=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Yp=(t,e)=>{for(var r in e)oi(t,r,{get:e[r],enumerable:!0})},Xp=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Gp(e))!Zp.call(t,s)&&s!==r&&oi(t,s,{get:()=>e[s],enumerable:!(n=Jp(e,s))||n.enumerable});return t};var mn=(t,e,r)=>(r=t!=null?Hp(Wp(t)):{},Xp(e||!t||!t.__esModule?oi(r,"default",{value:t,enumerable:!0}):r,t));var Dr=w(G=>{"use strict";Object.defineProperty(G,"__esModule",{value:!0});G.regexpCode=G.getEsmExportName=G.getProperty=G.safeStringify=G.stringify=G.strConcat=G.addCodeArg=G.str=G._=G.nil=G._Code=G.Name=G.IDENTIFIER=G._CodeOrName=void 0;var qr=class{};G._CodeOrName=qr;G.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Ft=class extends qr{constructor(e){if(super(),!G.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};G.Name=Ft;var Re=class extends qr{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof Ft&&(r[n.str]=(r[n.str]||0)+1),r),{})}};G._Code=Re;G.nil=new Re("");function Dc(t,...e){let r=[t[0]],n=0;for(;n<e.length;)vi(r,e[n]),r.push(t[++n]);return new Re(r)}G._=Dc;var _i=new Re("+");function Lc(t,...e){let r=[Ar(t[0])],n=0;for(;n<e.length;)r.push(_i),vi(r,e[n]),r.push(_i,Ar(t[++n]));return eg(r),new Re(r)}G.str=Lc;function vi(t,e){e instanceof Re?t.push(...e._items):e instanceof Ft?t.push(e):t.push(ng(e))}G.addCodeArg=vi;function eg(t){let e=1;for(;e<t.length-1;){if(t[e]===_i){let r=tg(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function tg(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof Ft||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof Ft))return`"${t}${e.slice(1)}`}function rg(t,e){return e.emptyStr()?t:t.emptyStr()?e:Lc`${t}${e}`}G.strConcat=rg;function ng(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:Ar(Array.isArray(t)?t.join(","):t)}function sg(t){return new Re(Ar(t))}G.stringify=sg;function Ar(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}G.safeStringify=Ar;function ig(t){return typeof t=="string"&&G.IDENTIFIER.test(t)?new Re(`.${t}`):Dc`[${t}]`}G.getProperty=ig;function og(t){if(typeof t=="string"&&G.IDENTIFIER.test(t))return new Re(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}G.getEsmExportName=og;function ag(t){return new Re(t.toString())}G.regexpCode=ag});var Si=w(xe=>{"use strict";Object.defineProperty(xe,"__esModule",{value:!0});xe.ValueScope=xe.ValueScopeName=xe.Scope=xe.varKinds=xe.UsedValueState=void 0;var $e=Dr(),bi=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Dn;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Dn||(xe.UsedValueState=Dn={}));xe.varKinds={const:new $e.Name("const"),let:new $e.Name("let"),var:new $e.Name("var")};var Ln=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof $e.Name?e:this.name(e)}name(e){return new $e.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};xe.Scope=Ln;var Mn=class extends $e.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,$e._)`.${new $e.Name(r)}[${n}]`}};xe.ValueScopeName=Mn;var cg=(0,$e._)`\n`,wi=class extends Ln{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?cg:$e.nil}}get(){return this._scope}name(e){return new Mn(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let s=this.toName(e),{prefix:i}=s,o=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[i];if(a){let l=a.get(o);if(l)return l}else a=this._values[i]=new Map;a.set(o,s);let c=this._scope[i]||(this._scope[i]=[]),u=c.length;return c[u]=r.ref,s.setValue(r,{property:i,itemIndex:u}),s}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,$e._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,s=>{if(s.value===void 0)throw new Error(`CodeGen: name "${s}" has no value`);return s.value.code},r,n)}_reduceValues(e,r,n={},s){let i=$e.nil;for(let o in e){let a=e[o];if(!a)continue;let c=n[o]=n[o]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,Dn.Started);let l=r(u);if(l){let d=this.opts.es5?xe.varKinds.var:xe.varKinds.const;i=(0,$e._)`${i}${d} ${u} = ${l};${this.opts._n}`}else if(l=s?.(u))i=(0,$e._)`${i}${l}${this.opts._n}`;else throw new bi(u);c.set(u,Dn.Completed)})}return i}};xe.ValueScope=wi});var z=w(U=>{"use strict";Object.defineProperty(U,"__esModule",{value:!0});U.or=U.and=U.not=U.CodeGen=U.operators=U.varKinds=U.ValueScopeName=U.ValueScope=U.Scope=U.Name=U.regexpCode=U.stringify=U.getProperty=U.nil=U.strConcat=U.str=U._=void 0;var H=Dr(),Ve=Si(),vt=Dr();Object.defineProperty(U,"_",{enumerable:!0,get:function(){return vt._}});Object.defineProperty(U,"str",{enumerable:!0,get:function(){return vt.str}});Object.defineProperty(U,"strConcat",{enumerable:!0,get:function(){return vt.strConcat}});Object.defineProperty(U,"nil",{enumerable:!0,get:function(){return vt.nil}});Object.defineProperty(U,"getProperty",{enumerable:!0,get:function(){return vt.getProperty}});Object.defineProperty(U,"stringify",{enumerable:!0,get:function(){return vt.stringify}});Object.defineProperty(U,"regexpCode",{enumerable:!0,get:function(){return vt.regexpCode}});Object.defineProperty(U,"Name",{enumerable:!0,get:function(){return vt.Name}});var Fn=Si();Object.defineProperty(U,"Scope",{enumerable:!0,get:function(){return Fn.Scope}});Object.defineProperty(U,"ValueScope",{enumerable:!0,get:function(){return Fn.ValueScope}});Object.defineProperty(U,"ValueScopeName",{enumerable:!0,get:function(){return Fn.ValueScopeName}});Object.defineProperty(U,"varKinds",{enumerable:!0,get:function(){return Fn.varKinds}});U.operators={GT:new H._Code(">"),GTE:new H._Code(">="),LT:new H._Code("<"),LTE:new H._Code("<="),EQ:new H._Code("==="),NEQ:new H._Code("!=="),NOT:new H._Code("!"),OR:new H._Code("||"),AND:new H._Code("&&"),ADD:new H._Code("+")};var ct=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},$i=class extends ct{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?Ve.varKinds.var:this.varKind,s=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${s};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=pr(this.rhs,e,r)),this}get names(){return this.rhs instanceof H._CodeOrName?this.rhs.names:{}}},Vn=class extends ct{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof H.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=pr(this.rhs,e,r),this}get names(){let e=this.lhs instanceof H.Name?{}:{...this.lhs.names};return zn(e,this.rhs)}},xi=class extends Vn{constructor(e,r,n,s){super(e,n,s),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},Ei=class extends ct{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},ki=class extends ct{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},Oi=class extends ct{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},Ti=class extends ct{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=pr(this.code,e,r),this}get names(){return this.code instanceof H._CodeOrName?this.code.names:{}}},Lr=class extends ct{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,s=n.length;for(;s--;){let i=n[s];i.optimizeNames(e,r)||(ug(e,i.names),n.splice(s,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>Ht(e,r.names),{})}},ut=class extends Lr{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},Pi=class extends Lr{},fr=class extends ut{};fr.kind="else";var Bt=class t extends ut{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new fr(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(Mc(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=pr(this.condition,e,r),this}get names(){let e=super.names;return zn(e,this.condition),this.else&&Ht(e,this.else.names),e}};Bt.kind="if";var Kt=class extends ut{};Kt.kind="for";var ji=class extends Kt{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=pr(this.iteration,e,r),this}get names(){return Ht(super.names,this.iteration.names)}},Ni=class extends Kt{constructor(e,r,n,s){super(),this.varKind=e,this.name=r,this.from=n,this.to=s}render(e){let r=e.es5?Ve.varKinds.var:this.varKind,{name:n,from:s,to:i}=this;return`for(${r} ${n}=${s}; ${n}<${i}; ${n}++)`+super.render(e)}get names(){let e=zn(super.names,this.from);return zn(e,this.to)}},Un=class extends Kt{constructor(e,r,n,s){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=s}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=pr(this.iterable,e,r),this}get names(){return Ht(super.names,this.iterable.names)}},Mr=class extends ut{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};Mr.kind="func";var Vr=class extends Lr{render(e){return"return "+super.render(e)}};Vr.kind="return";var Ri=class extends ut{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,s;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(s=this.finally)===null||s===void 0||s.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&Ht(e,this.catch.names),this.finally&&Ht(e,this.finally.names),e}},Ur=class extends ut{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};Ur.kind="catch";var zr=class extends ut{render(e){return"finally"+super.render(e)}};zr.kind="finally";var Ci=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
`:""},this._extScope=e,this._scope=new Ve.Scope({parent:e}),this._nodes=[new Pi]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let n=this._extScope.value(e,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,n,s){let i=this._scope.toName(r);return n!==void 0&&s&&(this._constants[i.str]=n),this._leafNode(new $i(e,i,n)),i}const(e,r,n){return this._def(Ve.varKinds.const,e,r,n)}let(e,r,n){return this._def(Ve.varKinds.let,e,r,n)}var(e,r,n){return this._def(Ve.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new Vn(e,r,n))}add(e,r){return this._leafNode(new xi(e,U.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==H.nil&&this._leafNode(new Ti(e)),this}object(...e){let r=["{"];for(let[n,s]of e)r.length>1&&r.push(","),r.push(n),(n!==s||this.opts.es5)&&(r.push(":"),(0,H.addCodeArg)(r,s));return r.push("}"),new H._Code(r)}if(e,r,n){if(this._blockNode(new Bt(e)),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(e){return this._elseNode(new Bt(e))}else(){return this._elseNode(new fr)}endIf(){return this._endBlockNode(Bt,fr)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new ji(e),r)}forRange(e,r,n,s,i=this.opts.es5?Ve.varKinds.var:Ve.varKinds.let){let o=this._scope.toName(e);return this._for(new Ni(i,o,r,n),()=>s(o))}forOf(e,r,n,s=Ve.varKinds.const){let i=this._scope.toName(e);if(this.opts.es5){let o=r instanceof H.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,H._)`${o}.length`,a=>{this.var(i,(0,H._)`${o}[${a}]`),n(i)})}return this._for(new Un("of",s,i,r),()=>n(i))}forIn(e,r,n,s=this.opts.es5?Ve.varKinds.var:Ve.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,H._)`Object.keys(${r})`,n);let i=this._scope.toName(e);return this._for(new Un("in",s,i,r),()=>n(i))}endFor(){return this._endBlockNode(Kt)}label(e){return this._leafNode(new Ei(e))}break(e){return this._leafNode(new ki(e))}return(e){let r=new Vr;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Vr)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let s=new Ri;if(this._blockNode(s),this.code(e),r){let i=this.name("e");this._currNode=s.catch=new Ur(i),r(i)}return n&&(this._currNode=s.finally=new zr,this.code(n)),this._endBlockNode(Ur,zr)}throw(e){return this._leafNode(new Oi(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){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||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=H.nil,n,s){return this._blockNode(new Mr(e,r,n)),s&&this.code(s).endFunc(),this}endFunc(){return this._endBlockNode(Mr)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let n=this._currNode;if(n instanceof e||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof Bt))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};U.CodeGen=Ci;function Ht(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function zn(t,e){return e instanceof H._CodeOrName?Ht(t,e.names):t}function pr(t,e,r){if(t instanceof H.Name)return n(t);if(!s(t))return t;return new H._Code(t._items.reduce((i,o)=>(o instanceof H.Name&&(o=n(o)),o instanceof H._Code?i.push(...o._items):i.push(o),i),[]));function n(i){let o=r[i.str];return o===void 0||e[i.str]!==1?i:(delete e[i.str],o)}function s(i){return i instanceof H._Code&&i._items.some(o=>o instanceof H.Name&&e[o.str]===1&&r[o.str]!==void 0)}}function ug(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function Mc(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,H._)`!${Ii(t)}`}U.not=Mc;var lg=Vc(U.operators.AND);function dg(...t){return t.reduce(lg)}U.and=dg;var fg=Vc(U.operators.OR);function pg(...t){return t.reduce(fg)}U.or=pg;function Vc(t){return(e,r)=>e===H.nil?r:r===H.nil?e:(0,H._)`${Ii(e)} ${t} ${Ii(r)}`}function Ii(t){return t instanceof H.Name?t:(0,H._)`(${t})`}});var W=w(F=>{"use strict";Object.defineProperty(F,"__esModule",{value:!0});F.checkStrictMode=F.getErrorPath=F.Type=F.useFunc=F.setEvaluated=F.evaluatedPropsToName=F.mergeEvaluated=F.eachItem=F.unescapeJsonPointer=F.escapeJsonPointer=F.escapeFragment=F.unescapeFragment=F.schemaRefOrVal=F.schemaHasRulesButRef=F.schemaHasRules=F.checkUnknownRules=F.alwaysValidSchema=F.toHash=void 0;var X=z(),hg=Dr();function mg(t){let e={};for(let r of t)e[r]=!0;return e}F.toHash=mg;function gg(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(Fc(t,e),!Bc(e,t.self.RULES.all))}F.alwaysValidSchema=gg;function Fc(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let s=n.RULES.keywords;for(let i in e)s[i]||Jc(t,`unknown keyword: "${i}"`)}F.checkUnknownRules=Fc;function Bc(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}F.schemaHasRules=Bc;function yg(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}F.schemaHasRulesButRef=yg;function _g({topSchemaRef:t,schemaPath:e},r,n,s){if(!s){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,X._)`${r}`}return(0,X._)`${t}${e}${(0,X.getProperty)(n)}`}F.schemaRefOrVal=_g;function vg(t){return Kc(decodeURIComponent(t))}F.unescapeFragment=vg;function bg(t){return encodeURIComponent(Ai(t))}F.escapeFragment=bg;function Ai(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}F.escapeJsonPointer=Ai;function Kc(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}F.unescapeJsonPointer=Kc;function wg(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}F.eachItem=wg;function Uc({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(s,i,o,a)=>{let c=o===void 0?i:o instanceof X.Name?(i instanceof X.Name?t(s,i,o):e(s,i,o),o):i instanceof X.Name?(e(s,o,i),i):r(i,o);return a===X.Name&&!(c instanceof X.Name)?n(s,c):c}}F.mergeEvaluated={props:Uc({mergeNames:(t,e,r)=>t.if((0,X._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,X._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,X._)`${r} || {}`).code((0,X._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,X._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,X._)`${r} || {}`),Di(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:Hc}),items:Uc({mergeNames:(t,e,r)=>t.if((0,X._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,X._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,X._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,X._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function Hc(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,X._)`{}`);return e!==void 0&&Di(t,r,e),r}F.evaluatedPropsToName=Hc;function Di(t,e,r){Object.keys(r).forEach(n=>t.assign((0,X._)`${e}${(0,X.getProperty)(n)}`,!0))}F.setEvaluated=Di;var zc={};function Sg(t,e){return t.scopeValue("func",{ref:e,code:zc[e.code]||(zc[e.code]=new hg._Code(e.code))})}F.useFunc=Sg;var qi;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(qi||(F.Type=qi={}));function $g(t,e,r){if(t instanceof X.Name){let n=e===qi.Num;return r?n?(0,X._)`"[" + ${t} + "]"`:(0,X._)`"['" + ${t} + "']"`:n?(0,X._)`"/" + ${t}`:(0,X._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,X.getProperty)(t).toString():"/"+Ai(t)}F.getErrorPath=$g;function Jc(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}F.checkStrictMode=Jc});var lt=w(Li=>{"use strict";Object.defineProperty(Li,"__esModule",{value:!0});var he=z(),xg={data:new he.Name("data"),valCxt:new he.Name("valCxt"),instancePath:new he.Name("instancePath"),parentData:new he.Name("parentData"),parentDataProperty:new he.Name("parentDataProperty"),rootData:new he.Name("rootData"),dynamicAnchors:new he.Name("dynamicAnchors"),vErrors:new he.Name("vErrors"),errors:new he.Name("errors"),this:new he.Name("this"),self:new he.Name("self"),scope:new he.Name("scope"),json:new he.Name("json"),jsonPos:new he.Name("jsonPos"),jsonLen:new he.Name("jsonLen"),jsonPart:new he.Name("jsonPart")};Li.default=xg});var Fr=w(me=>{"use strict";Object.defineProperty(me,"__esModule",{value:!0});me.extendErrors=me.resetErrorsCount=me.reportExtraError=me.reportError=me.keyword$DataError=me.keywordError=void 0;var J=z(),Bn=W(),_e=lt();me.keywordError={message:({keyword:t})=>(0,J.str)`must pass "${t}" keyword validation`};me.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,J.str)`"${t}" keyword must be ${e} ($data)`:(0,J.str)`"${t}" keyword is invalid ($data)`};function Eg(t,e=me.keywordError,r,n){let{it:s}=t,{gen:i,compositeRule:o,allErrors:a}=s,c=Zc(t,e,r);n??(o||a)?Gc(i,c):Wc(s,(0,J._)`[${c}]`)}me.reportError=Eg;function kg(t,e=me.keywordError,r){let{it:n}=t,{gen:s,compositeRule:i,allErrors:o}=n,a=Zc(t,e,r);Gc(s,a),i||o||Wc(n,_e.default.vErrors)}me.reportExtraError=kg;function Og(t,e){t.assign(_e.default.errors,e),t.if((0,J._)`${_e.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,J._)`${_e.default.vErrors}.length`,e),()=>t.assign(_e.default.vErrors,null)))}me.resetErrorsCount=Og;function Tg({gen:t,keyword:e,schemaValue:r,data:n,errsCount:s,it:i}){if(s===void 0)throw new Error("ajv implementation error");let o=t.name("err");t.forRange("i",s,_e.default.errors,a=>{t.const(o,(0,J._)`${_e.default.vErrors}[${a}]`),t.if((0,J._)`${o}.instancePath === undefined`,()=>t.assign((0,J._)`${o}.instancePath`,(0,J.strConcat)(_e.default.instancePath,i.errorPath))),t.assign((0,J._)`${o}.schemaPath`,(0,J.str)`${i.errSchemaPath}/${e}`),i.opts.verbose&&(t.assign((0,J._)`${o}.schema`,r),t.assign((0,J._)`${o}.data`,n))})}me.extendErrors=Tg;function Gc(t,e){let r=t.const("err",e);t.if((0,J._)`${_e.default.vErrors} === null`,()=>t.assign(_e.default.vErrors,(0,J._)`[${r}]`),(0,J._)`${_e.default.vErrors}.push(${r})`),t.code((0,J._)`${_e.default.errors}++`)}function Wc(t,e){let{gen:r,validateName:n,schemaEnv:s}=t;s.$async?r.throw((0,J._)`new ${t.ValidationError}(${e})`):(r.assign((0,J._)`${n}.errors`,e),r.return(!1))}var Jt={keyword:new J.Name("keyword"),schemaPath:new J.Name("schemaPath"),params:new J.Name("params"),propertyName:new J.Name("propertyName"),message:new J.Name("message"),schema:new J.Name("schema"),parentSchema:new J.Name("parentSchema")};function Zc(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,J._)`{}`:Pg(t,e,r)}function Pg(t,e,r={}){let{gen:n,it:s}=t,i=[jg(s,r),Ng(t,r)];return Rg(t,e,i),n.object(...i)}function jg({errorPath:t},{instancePath:e}){let r=e?(0,J.str)`${t}${(0,Bn.getErrorPath)(e,Bn.Type.Str)}`:t;return[_e.default.instancePath,(0,J.strConcat)(_e.default.instancePath,r)]}function Ng({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let s=n?e:(0,J.str)`${e}/${t}`;return r&&(s=(0,J.str)`${s}${(0,Bn.getErrorPath)(r,Bn.Type.Str)}`),[Jt.schemaPath,s]}function Rg(t,{params:e,message:r},n){let{keyword:s,data:i,schemaValue:o,it:a}=t,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;n.push([Jt.keyword,s],[Jt.params,typeof e=="function"?e(t):e||(0,J._)`{}`]),c.messages&&n.push([Jt.message,typeof r=="function"?r(t):r]),c.verbose&&n.push([Jt.schema,o],[Jt.parentSchema,(0,J._)`${l}${d}`],[_e.default.data,i]),u&&n.push([Jt.propertyName,u])}});var Xc=w(hr=>{"use strict";Object.defineProperty(hr,"__esModule",{value:!0});hr.boolOrEmptySchema=hr.topBoolOrEmptySchema=void 0;var Cg=Fr(),Ig=z(),qg=lt(),Ag={message:"boolean schema is false"};function Dg(t){let{gen:e,schema:r,validateName:n}=t;r===!1?Yc(t,!1):typeof r=="object"&&r.$async===!0?e.return(qg.default.data):(e.assign((0,Ig._)`${n}.errors`,null),e.return(!0))}hr.topBoolOrEmptySchema=Dg;function Lg(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),Yc(t)):r.var(e,!0)}hr.boolOrEmptySchema=Lg;function Yc(t,e){let{gen:r,data:n}=t,s={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,Cg.reportError)(s,Ag,void 0,e)}});var Mi=w(mr=>{"use strict";Object.defineProperty(mr,"__esModule",{value:!0});mr.getRules=mr.isJSONType=void 0;var Mg=["string","number","integer","boolean","null","object","array"],Vg=new Set(Mg);function Ug(t){return typeof t=="string"&&Vg.has(t)}mr.isJSONType=Ug;function zg(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}mr.getRules=zg});var Vi=w(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.shouldUseRule=bt.shouldUseGroup=bt.schemaHasRulesForType=void 0;function Fg({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&Qc(t,n)}bt.schemaHasRulesForType=Fg;function Qc(t,e){return e.rules.some(r=>eu(t,r))}bt.shouldUseGroup=Qc;function eu(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}bt.shouldUseRule=eu});var Br=w(ge=>{"use strict";Object.defineProperty(ge,"__esModule",{value:!0});ge.reportTypeError=ge.checkDataTypes=ge.checkDataType=ge.coerceAndCheckDataType=ge.getJSONTypes=ge.getSchemaTypes=ge.DataType=void 0;var Bg=Mi(),Kg=Vi(),Hg=Fr(),M=z(),tu=W(),gr;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(gr||(ge.DataType=gr={}));function Jg(t){let e=ru(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}ge.getSchemaTypes=Jg;function ru(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(Bg.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}ge.getJSONTypes=ru;function Gg(t,e){let{gen:r,data:n,opts:s}=t,i=Wg(e,s.coerceTypes),o=e.length>0&&!(i.length===0&&e.length===1&&(0,Kg.schemaHasRulesForType)(t,e[0]));if(o){let a=zi(e,n,s.strictNumbers,gr.Wrong);r.if(a,()=>{i.length?Zg(t,e,i):Fi(t)})}return o}ge.coerceAndCheckDataType=Gg;var nu=new Set(["string","number","integer","boolean","null"]);function Wg(t,e){return e?t.filter(r=>nu.has(r)||e==="array"&&r==="array"):[]}function Zg(t,e,r){let{gen:n,data:s,opts:i}=t,o=n.let("dataType",(0,M._)`typeof ${s}`),a=n.let("coerced",(0,M._)`undefined`);i.coerceTypes==="array"&&n.if((0,M._)`${o} == 'object' && Array.isArray(${s}) && ${s}.length == 1`,()=>n.assign(s,(0,M._)`${s}[0]`).assign(o,(0,M._)`typeof ${s}`).if(zi(e,s,i.strictNumbers),()=>n.assign(a,s))),n.if((0,M._)`${a} !== undefined`);for(let u of r)(nu.has(u)||u==="array"&&i.coerceTypes==="array")&&c(u);n.else(),Fi(t),n.endIf(),n.if((0,M._)`${a} !== undefined`,()=>{n.assign(s,a),Yg(t,a)});function c(u){switch(u){case"string":n.elseIf((0,M._)`${o} == "number" || ${o} == "boolean"`).assign(a,(0,M._)`"" + ${s}`).elseIf((0,M._)`${s} === null`).assign(a,(0,M._)`""`);return;case"number":n.elseIf((0,M._)`${o} == "boolean" || ${s} === null
              || (${o} == "string" && ${s} && ${s} == +${s})`).assign(a,(0,M._)`+${s}`);return;case"integer":n.elseIf((0,M._)`${o} === "boolean" || ${s} === null
              || (${o} === "string" && ${s} && ${s} == +${s} && !(${s} % 1))`).assign(a,(0,M._)`+${s}`);return;case"boolean":n.elseIf((0,M._)`${s} === "false" || ${s} === 0 || ${s} === null`).assign(a,!1).elseIf((0,M._)`${s} === "true" || ${s} === 1`).assign(a,!0);return;case"null":n.elseIf((0,M._)`${s} === "" || ${s} === 0 || ${s} === false`),n.assign(a,null);return;case"array":n.elseIf((0,M._)`${o} === "string" || ${o} === "number"
              || ${o} === "boolean" || ${s} === null`).assign(a,(0,M._)`[${s}]`)}}}function Yg({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,M._)`${e} !== undefined`,()=>t.assign((0,M._)`${e}[${r}]`,n))}function Ui(t,e,r,n=gr.Correct){let s=n===gr.Correct?M.operators.EQ:M.operators.NEQ,i;switch(t){case"null":return(0,M._)`${e} ${s} null`;case"array":i=(0,M._)`Array.isArray(${e})`;break;case"object":i=(0,M._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":i=o((0,M._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":i=o();break;default:return(0,M._)`typeof ${e} ${s} ${t}`}return n===gr.Correct?i:(0,M.not)(i);function o(a=M.nil){return(0,M.and)((0,M._)`typeof ${e} == "number"`,a,r?(0,M._)`isFinite(${e})`:M.nil)}}ge.checkDataType=Ui;function zi(t,e,r,n){if(t.length===1)return Ui(t[0],e,r,n);let s,i=(0,tu.toHash)(t);if(i.array&&i.object){let o=(0,M._)`typeof ${e} != "object"`;s=i.null?o:(0,M._)`!${e} || ${o}`,delete i.null,delete i.array,delete i.object}else s=M.nil;i.number&&delete i.integer;for(let o in i)s=(0,M.and)(s,Ui(o,e,r,n));return s}ge.checkDataTypes=zi;var Xg={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,M._)`{type: ${t}}`:(0,M._)`{type: ${e}}`};function Fi(t){let e=Qg(t);(0,Hg.reportError)(e,Xg)}ge.reportTypeError=Fi;function Qg(t){let{gen:e,data:r,schema:n}=t,s=(0,tu.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:s,schemaValue:s,parentSchema:n,params:{},it:t}}});var iu=w(Kn=>{"use strict";Object.defineProperty(Kn,"__esModule",{value:!0});Kn.assignDefaults=void 0;var yr=z(),ey=W();function ty(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let s in r)su(t,s,r[s].default);else e==="array"&&Array.isArray(n)&&n.forEach((s,i)=>su(t,i,s.default))}Kn.assignDefaults=ty;function su(t,e,r){let{gen:n,compositeRule:s,data:i,opts:o}=t;if(r===void 0)return;let a=(0,yr._)`${i}${(0,yr.getProperty)(e)}`;if(s){(0,ey.checkStrictMode)(t,`default is ignored for: ${a}`);return}let c=(0,yr._)`${a} === undefined`;o.useDefaults==="empty"&&(c=(0,yr._)`${c} || ${a} === null || ${a} === ""`),n.if(c,(0,yr._)`${a} = ${(0,yr.stringify)(r)}`)}});var Ce=w(Y=>{"use strict";Object.defineProperty(Y,"__esModule",{value:!0});Y.validateUnion=Y.validateArray=Y.usePattern=Y.callValidateCode=Y.schemaProperties=Y.allSchemaProperties=Y.noPropertyInData=Y.propertyInData=Y.isOwnProperty=Y.hasPropFunc=Y.reportMissingProp=Y.checkMissingProp=Y.checkReportMissingProp=void 0;var Q=z(),Bi=W(),wt=lt(),ry=W();function ny(t,e){let{gen:r,data:n,it:s}=t;r.if(Hi(r,n,e,s.opts.ownProperties),()=>{t.setParams({missingProperty:(0,Q._)`${e}`},!0),t.error()})}Y.checkReportMissingProp=ny;function sy({gen:t,data:e,it:{opts:r}},n,s){return(0,Q.or)(...n.map(i=>(0,Q.and)(Hi(t,e,i,r.ownProperties),(0,Q._)`${s} = ${i}`)))}Y.checkMissingProp=sy;function iy(t,e){t.setParams({missingProperty:e},!0),t.error()}Y.reportMissingProp=iy;function ou(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,Q._)`Object.prototype.hasOwnProperty`})}Y.hasPropFunc=ou;function Ki(t,e,r){return(0,Q._)`${ou(t)}.call(${e}, ${r})`}Y.isOwnProperty=Ki;function oy(t,e,r,n){let s=(0,Q._)`${e}${(0,Q.getProperty)(r)} !== undefined`;return n?(0,Q._)`${s} && ${Ki(t,e,r)}`:s}Y.propertyInData=oy;function Hi(t,e,r,n){let s=(0,Q._)`${e}${(0,Q.getProperty)(r)} === undefined`;return n?(0,Q.or)(s,(0,Q.not)(Ki(t,e,r))):s}Y.noPropertyInData=Hi;function au(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}Y.allSchemaProperties=au;function ay(t,e){return au(e).filter(r=>!(0,Bi.alwaysValidSchema)(t,e[r]))}Y.schemaProperties=ay;function cy({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:s,errorPath:i},it:o},a,c,u){let l=u?(0,Q._)`${t}, ${e}, ${n}${s}`:e,d=[[wt.default.instancePath,(0,Q.strConcat)(wt.default.instancePath,i)],[wt.default.parentData,o.parentData],[wt.default.parentDataProperty,o.parentDataProperty],[wt.default.rootData,wt.default.rootData]];o.opts.dynamicRef&&d.push([wt.default.dynamicAnchors,wt.default.dynamicAnchors]);let y=(0,Q._)`${l}, ${r.object(...d)}`;return c!==Q.nil?(0,Q._)`${a}.call(${c}, ${y})`:(0,Q._)`${a}(${y})`}Y.callValidateCode=cy;var uy=(0,Q._)`new RegExp`;function ly({gen:t,it:{opts:e}},r){let n=e.unicodeRegExp?"u":"",{regExp:s}=e.code,i=s(r,n);return t.scopeValue("pattern",{key:i.toString(),ref:i,code:(0,Q._)`${s.code==="new RegExp"?uy:(0,ry.useFunc)(t,s)}(${r}, ${n})`})}Y.usePattern=ly;function dy(t){let{gen:e,data:r,keyword:n,it:s}=t,i=e.name("valid");if(s.allErrors){let a=e.let("valid",!0);return o(()=>e.assign(a,!1)),a}return e.var(i,!0),o(()=>e.break()),i;function o(a){let c=e.const("len",(0,Q._)`${r}.length`);e.forRange("i",0,c,u=>{t.subschema({keyword:n,dataProp:u,dataPropType:Bi.Type.Num},i),e.if((0,Q.not)(i),a)})}}Y.validateArray=dy;function fy(t){let{gen:e,schema:r,keyword:n,it:s}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,Bi.alwaysValidSchema)(s,c))&&!s.opts.unevaluated)return;let o=e.let("valid",!1),a=e.name("_valid");e.block(()=>r.forEach((c,u)=>{let l=t.subschema({keyword:n,schemaProp:u,compositeRule:!0},a);e.assign(o,(0,Q._)`${o} || ${a}`),t.mergeValidEvaluated(l,a)||e.if((0,Q.not)(o))})),t.result(o,()=>t.reset(),()=>t.error(!0))}Y.validateUnion=fy});var lu=w(Ze=>{"use strict";Object.defineProperty(Ze,"__esModule",{value:!0});Ze.validateKeywordUsage=Ze.validSchemaType=Ze.funcKeywordCode=Ze.macroKeywordCode=void 0;var ve=z(),Gt=lt(),py=Ce(),hy=Fr();function my(t,e){let{gen:r,keyword:n,schema:s,parentSchema:i,it:o}=t,a=e.macro.call(o.self,s,i,o),c=uu(r,n,a);o.opts.validateSchema!==!1&&o.self.validateSchema(a,!0);let u=r.name("valid");t.subschema({schema:a,schemaPath:ve.nil,errSchemaPath:`${o.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),t.pass(u,()=>t.error(!0))}Ze.macroKeywordCode=my;function gy(t,e){var r;let{gen:n,keyword:s,schema:i,parentSchema:o,$data:a,it:c}=t;_y(c,e);let u=!a&&e.compile?e.compile.call(c.self,i,o,c):e.validate,l=uu(n,s,u),d=n.let("valid");t.block$data(d,y),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function y(){if(e.errors===!1)m(),e.modifying&&cu(t),g(()=>t.error());else{let _=e.async?h():f();e.modifying&&cu(t),g(()=>yy(t,_))}}function h(){let _=n.let("ruleErrs",null);return n.try(()=>m((0,ve._)`await `),b=>n.assign(d,!1).if((0,ve._)`${b} instanceof ${c.ValidationError}`,()=>n.assign(_,(0,ve._)`${b}.errors`),()=>n.throw(b))),_}function f(){let _=(0,ve._)`${l}.errors`;return n.assign(_,null),m(ve.nil),_}function m(_=e.async?(0,ve._)`await `:ve.nil){let b=c.opts.passContext?Gt.default.this:Gt.default.self,S=!("compile"in e&&!a||e.schema===!1);n.assign(d,(0,ve._)`${_}${(0,py.callValidateCode)(t,l,b,S)}`,e.modifying)}function g(_){var b;n.if((0,ve.not)((b=e.valid)!==null&&b!==void 0?b:d),_)}}Ze.funcKeywordCode=gy;function cu(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,ve._)`${n.parentData}[${n.parentDataProperty}]`))}function yy(t,e){let{gen:r}=t;r.if((0,ve._)`Array.isArray(${e})`,()=>{r.assign(Gt.default.vErrors,(0,ve._)`${Gt.default.vErrors} === null ? ${e} : ${Gt.default.vErrors}.concat(${e})`).assign(Gt.default.errors,(0,ve._)`${Gt.default.vErrors}.length`),(0,hy.extendErrors)(t)},()=>t.error())}function _y({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function uu(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,ve.stringify)(r)})}function vy(t,e,r=!1){return!e.length||e.some(n=>n==="array"?Array.isArray(t):n==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==n||r&&typeof t>"u")}Ze.validSchemaType=vy;function by({schema:t,opts:e,self:r,errSchemaPath:n},s,i){if(Array.isArray(s.keyword)?!s.keyword.includes(i):s.keyword!==i)throw new Error("ajv implementation error");let o=s.dependencies;if(o?.some(a=>!Object.prototype.hasOwnProperty.call(t,a)))throw new Error(`parent schema must have dependencies of ${i}: ${o.join(",")}`);if(s.validateSchema&&!s.validateSchema(t[i])){let c=`keyword "${i}" value is invalid at path "${n}": `+r.errorsText(s.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}Ze.validateKeywordUsage=by});var fu=w(St=>{"use strict";Object.defineProperty(St,"__esModule",{value:!0});St.extendSubschemaMode=St.extendSubschemaData=St.getSubschema=void 0;var Ye=z(),du=W();function wy(t,{keyword:e,schemaProp:r,schema:n,schemaPath:s,errSchemaPath:i,topSchemaRef:o}){if(e!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let a=t.schema[e];return r===void 0?{schema:a,schemaPath:(0,Ye._)`${t.schemaPath}${(0,Ye.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,Ye._)`${t.schemaPath}${(0,Ye.getProperty)(e)}${(0,Ye.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,du.escapeFragment)(r)}`}}if(n!==void 0){if(s===void 0||i===void 0||o===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:s,topSchemaRef:o,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')}St.getSubschema=wy;function Sy(t,e,{dataProp:r,dataPropType:n,data:s,dataTypes:i,propertyName:o}){if(s!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=e;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=e,y=a.let("data",(0,Ye._)`${e.data}${(0,Ye.getProperty)(r)}`,!0);c(y),t.errorPath=(0,Ye.str)`${u}${(0,du.getErrorPath)(r,n,d.jsPropertySyntax)}`,t.parentDataProperty=(0,Ye._)`${r}`,t.dataPathArr=[...l,t.parentDataProperty]}if(s!==void 0){let u=s instanceof Ye.Name?s:a.let("data",s,!0);c(u),o!==void 0&&(t.propertyName=o)}i&&(t.dataTypes=i);function c(u){t.data=u,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,u]}}St.extendSubschemaData=Sy;function $y(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:s,allErrors:i}){n!==void 0&&(t.compositeRule=n),s!==void 0&&(t.createErrors=s),i!==void 0&&(t.allErrors=i),t.jtdDiscriminator=e,t.jtdMetadata=r}St.extendSubschemaMode=$y});var Ji=w((iO,pu)=>{"use strict";pu.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,s,i;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(s=n;s--!==0;)if(!t(e[s],r[s]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(i=Object.keys(e),n=i.length,n!==Object.keys(r).length)return!1;for(s=n;s--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[s]))return!1;for(s=n;s--!==0;){var o=i[s];if(!t(e[o],r[o]))return!1}return!0}return e!==e&&r!==r}});var mu=w((oO,hu)=>{"use strict";var $t=hu.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var n=typeof r=="function"?r:r.pre||function(){},s=r.post||function(){};Hn(e,n,s,t,"",t)};$t.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};$t.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};$t.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};$t.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function Hn(t,e,r,n,s,i,o,a,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,s,i,o,a,c,u);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in $t.arrayKeywords)for(var y=0;y<d.length;y++)Hn(t,e,r,d[y],s+"/"+l+"/"+y,i,s,l,n,y)}else if(l in $t.propsKeywords){if(d&&typeof d=="object")for(var h in d)Hn(t,e,r,d[h],s+"/"+l+"/"+xy(h),i,s,l,n,h)}else(l in $t.keywords||t.allKeys&&!(l in $t.skipKeywords))&&Hn(t,e,r,d,s+"/"+l,i,s,l,n)}r(n,s,i,o,a,c,u)}}function xy(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var Kr=w(Ee=>{"use strict";Object.defineProperty(Ee,"__esModule",{value:!0});Ee.getSchemaRefs=Ee.resolveUrl=Ee.normalizeId=Ee._getFullPath=Ee.getFullPath=Ee.inlineRef=void 0;var Ey=W(),ky=Ji(),Oy=mu(),Ty=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function Py(t,e=!0){return typeof t=="boolean"?!0:e===!0?!Gi(t):e?gu(t)<=e:!1}Ee.inlineRef=Py;var jy=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Gi(t){for(let e in t){if(jy.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(Gi)||typeof r=="object"&&Gi(r))return!0}return!1}function gu(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!Ty.has(r)&&(typeof t[r]=="object"&&(0,Ey.eachItem)(t[r],n=>e+=gu(n)),e===1/0))return 1/0}return e}function yu(t,e="",r){r!==!1&&(e=_r(e));let n=t.parse(e);return _u(t,n)}Ee.getFullPath=yu;function _u(t,e){return t.serialize(e).split("#")[0]+"#"}Ee._getFullPath=_u;var Ny=/#\/?$/;function _r(t){return t?t.replace(Ny,""):""}Ee.normalizeId=_r;function Ry(t,e,r){return r=_r(r),t.resolve(e,r)}Ee.resolveUrl=Ry;var Cy=/^[a-z_][-a-z0-9._]*$/i;function Iy(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,s=_r(t[r]||e),i={"":s},o=yu(n,s,!1),a={},c=new Set;return Oy(t,{allKeys:!0},(d,y,h,f)=>{if(f===void 0)return;let m=o+y,g=i[f];typeof d[r]=="string"&&(g=_.call(this,d[r])),b.call(this,d.$anchor),b.call(this,d.$dynamicAnchor),i[y]=g;function _(S){let $=this.opts.uriResolver.resolve;if(S=_r(g?$(g,S):S),c.has(S))throw l(S);c.add(S);let E=this.refs[S];return typeof E=="string"&&(E=this.refs[E]),typeof E=="object"?u(d,E.schema,S):S!==_r(m)&&(S[0]==="#"?(u(d,a[S],S),a[S]=d):this.refs[S]=m),S}function b(S){if(typeof S=="string"){if(!Cy.test(S))throw new Error(`invalid anchor "${S}"`);_.call(this,`#${S}`)}}}),a;function u(d,y,h){if(y!==void 0&&!ky(d,y))throw l(h)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Ee.getSchemaRefs=Iy});var Gr=w(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0});xt.getData=xt.KeywordCxt=xt.validateFunctionCode=void 0;var $u=Xc(),vu=Br(),Zi=Vi(),Jn=Br(),qy=iu(),Jr=lu(),Wi=fu(),P=z(),I=lt(),Ay=Kr(),dt=W(),Hr=Fr();function Dy(t){if(ku(t)&&(Ou(t),Eu(t))){Vy(t);return}xu(t,()=>(0,$u.topBoolOrEmptySchema)(t))}xt.validateFunctionCode=Dy;function xu({gen:t,validateName:e,schema:r,schemaEnv:n,opts:s},i){s.code.es5?t.func(e,(0,P._)`${I.default.data}, ${I.default.valCxt}`,n.$async,()=>{t.code((0,P._)`"use strict"; ${bu(r,s)}`),My(t,s),t.code(i)}):t.func(e,(0,P._)`${I.default.data}, ${Ly(s)}`,n.$async,()=>t.code(bu(r,s)).code(i))}function Ly(t){return(0,P._)`{${I.default.instancePath}="", ${I.default.parentData}, ${I.default.parentDataProperty}, ${I.default.rootData}=${I.default.data}${t.dynamicRef?(0,P._)`, ${I.default.dynamicAnchors}={}`:P.nil}}={}`}function My(t,e){t.if(I.default.valCxt,()=>{t.var(I.default.instancePath,(0,P._)`${I.default.valCxt}.${I.default.instancePath}`),t.var(I.default.parentData,(0,P._)`${I.default.valCxt}.${I.default.parentData}`),t.var(I.default.parentDataProperty,(0,P._)`${I.default.valCxt}.${I.default.parentDataProperty}`),t.var(I.default.rootData,(0,P._)`${I.default.valCxt}.${I.default.rootData}`),e.dynamicRef&&t.var(I.default.dynamicAnchors,(0,P._)`${I.default.valCxt}.${I.default.dynamicAnchors}`)},()=>{t.var(I.default.instancePath,(0,P._)`""`),t.var(I.default.parentData,(0,P._)`undefined`),t.var(I.default.parentDataProperty,(0,P._)`undefined`),t.var(I.default.rootData,I.default.data),e.dynamicRef&&t.var(I.default.dynamicAnchors,(0,P._)`{}`)})}function Vy(t){let{schema:e,opts:r,gen:n}=t;xu(t,()=>{r.$comment&&e.$comment&&Pu(t),Ky(t),n.let(I.default.vErrors,null),n.let(I.default.errors,0),r.unevaluated&&Uy(t),Tu(t),Gy(t)})}function Uy(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,P._)`${r}.evaluated`),e.if((0,P._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,P._)`${t.evaluated}.props`,(0,P._)`undefined`)),e.if((0,P._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,P._)`${t.evaluated}.items`,(0,P._)`undefined`))}function bu(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,P._)`/*# sourceURL=${r} */`:P.nil}function zy(t,e){if(ku(t)&&(Ou(t),Eu(t))){Fy(t,e);return}(0,$u.boolOrEmptySchema)(t,e)}function Eu({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function ku(t){return typeof t.schema!="boolean"}function Fy(t,e){let{schema:r,gen:n,opts:s}=t;s.$comment&&r.$comment&&Pu(t),Hy(t),Jy(t);let i=n.const("_errs",I.default.errors);Tu(t,i),n.var(e,(0,P._)`${i} === ${I.default.errors}`)}function Ou(t){(0,dt.checkUnknownRules)(t),By(t)}function Tu(t,e){if(t.opts.jtd)return wu(t,[],!1,e);let r=(0,vu.getSchemaTypes)(t.schema),n=(0,vu.coerceAndCheckDataType)(t,r);wu(t,r,!n,e)}function By(t){let{schema:e,errSchemaPath:r,opts:n,self:s}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,dt.schemaHasRulesButRef)(e,s.RULES)&&s.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function Ky(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,dt.checkStrictMode)(t,"default is ignored in the schema root")}function Hy(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,Ay.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function Jy(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function Pu({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:s}){let i=r.$comment;if(s.$comment===!0)t.code((0,P._)`${I.default.self}.logger.log(${i})`);else if(typeof s.$comment=="function"){let o=(0,P.str)`${n}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,P._)`${I.default.self}.opts.$comment(${i}, ${o}, ${a}.schema)`)}}function Gy(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:s,opts:i}=t;r.$async?e.if((0,P._)`${I.default.errors} === 0`,()=>e.return(I.default.data),()=>e.throw((0,P._)`new ${s}(${I.default.vErrors})`)):(e.assign((0,P._)`${n}.errors`,I.default.vErrors),i.unevaluated&&Wy(t),e.return((0,P._)`${I.default.errors} === 0`))}function Wy({gen:t,evaluated:e,props:r,items:n}){r instanceof P.Name&&t.assign((0,P._)`${e}.props`,r),n instanceof P.Name&&t.assign((0,P._)`${e}.items`,n)}function wu(t,e,r,n){let{gen:s,schema:i,data:o,allErrors:a,opts:c,self:u}=t,{RULES:l}=u;if(i.$ref&&(c.ignoreKeywordsWithRef||!(0,dt.schemaHasRulesButRef)(i,l))){s.block(()=>Nu(t,"$ref",l.all.$ref.definition));return}c.jtd||Zy(t,e),s.block(()=>{for(let y of l.rules)d(y);d(l.post)});function d(y){(0,Zi.shouldUseGroup)(i,y)&&(y.type?(s.if((0,Jn.checkDataType)(y.type,o,c.strictNumbers)),Su(t,y),e.length===1&&e[0]===y.type&&r&&(s.else(),(0,Jn.reportTypeError)(t)),s.endIf()):Su(t,y),a||s.if((0,P._)`${I.default.errors} === ${n||0}`))}}function Su(t,e){let{gen:r,schema:n,opts:{useDefaults:s}}=t;s&&(0,qy.assignDefaults)(t,e.type),r.block(()=>{for(let i of e.rules)(0,Zi.shouldUseRule)(n,i)&&Nu(t,i.keyword,i.definition,e.type)})}function Zy(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(Yy(t,e),t.opts.allowUnionTypes||Xy(t,e),Qy(t,t.dataTypes))}function Yy(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{ju(t.dataTypes,r)||Yi(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),t_(t,e)}}function Xy(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&Yi(t,"use allowUnionTypes to allow union type keyword")}function Qy(t,e){let r=t.self.RULES.all;for(let n in r){let s=r[n];if(typeof s=="object"&&(0,Zi.shouldUseRule)(t.schema,s)){let{type:i}=s.definition;i.length&&!i.some(o=>e_(e,o))&&Yi(t,`missing type "${i.join(",")}" for keyword "${n}"`)}}}function e_(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function ju(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function t_(t,e){let r=[];for(let n of t.dataTypes)ju(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function Yi(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,dt.checkStrictMode)(t,e,t.opts.strictTypes)}var Gn=class{constructor(e,r,n){if((0,Jr.validateKeywordUsage)(e,r,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,dt.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",Ru(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,Jr.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=e.gen.const("_errs",I.default.errors))}result(e,r,n){this.failResult((0,P.not)(e),r,n)}failResult(e,r,n){this.gen.if(e),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,P.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,P._)`${r} !== undefined && (${(0,P.or)(this.invalid$data(),e)})`)}error(e,r,n){if(r){this.setParams(r),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,r){(e?Hr.reportExtraError:Hr.reportError)(this,this.def.error,r)}$dataError(){(0,Hr.reportError)(this,this.def.$dataError||Hr.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Hr.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,n=P.nil){this.gen.block(()=>{this.check$data(e,n),r()})}check$data(e=P.nil,r=P.nil){if(!this.$data)return;let{gen:n,schemaCode:s,schemaType:i,def:o}=this;n.if((0,P.or)((0,P._)`${s} === undefined`,r)),e!==P.nil&&n.assign(e,!0),(i.length||o.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==P.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:n,def:s,it:i}=this;return(0,P.or)(o(),a());function o(){if(n.length){if(!(r instanceof P.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,P._)`${(0,Jn.checkDataTypes)(c,r,i.opts.strictNumbers,Jn.DataType.Wrong)}`}return P.nil}function a(){if(s.validateSchema){let c=e.scopeValue("validate$data",{ref:s.validateSchema});return(0,P._)`!${c}(${r})`}return P.nil}}subschema(e,r){let n=(0,Wi.getSubschema)(this.it,e);(0,Wi.extendSubschemaData)(n,this.it,e),(0,Wi.extendSubschemaMode)(n,e);let s={...this.it,...n,items:void 0,props:void 0};return zy(s,r),s}mergeEvaluated(e,r){let{it:n,gen:s}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=dt.mergeEvaluated.props(s,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=dt.mergeEvaluated.items(s,e.items,n.items,r)))}mergeValidEvaluated(e,r){let{it:n,gen:s}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return s.if(r,()=>this.mergeEvaluated(e,P.Name)),!0}};xt.KeywordCxt=Gn;function Nu(t,e,r,n){let s=new Gn(t,r,e);"code"in r?r.code(s,n):s.$data&&r.validate?(0,Jr.funcKeywordCode)(s,r):"macro"in r?(0,Jr.macroKeywordCode)(s,r):(r.compile||r.validate)&&(0,Jr.funcKeywordCode)(s,r)}var r_=/^\/(?:[^~]|~0|~1)*$/,n_=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Ru(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let s,i;if(t==="")return I.default.rootData;if(t[0]==="/"){if(!r_.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);s=t,i=I.default.rootData}else{let u=n_.exec(t);if(!u)throw new Error(`Invalid JSON-pointer: ${t}`);let l=+u[1];if(s=u[2],s==="#"){if(l>=e)throw new Error(c("property/index",l));return n[e-l]}if(l>e)throw new Error(c("data",l));if(i=r[e-l],!s)return i}let o=i,a=s.split("/");for(let u of a)u&&(i=(0,P._)`${i}${(0,P.getProperty)((0,dt.unescapeJsonPointer)(u))}`,o=(0,P._)`${o} && ${i}`);return o;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${e}`}}xt.getData=Ru});var Wn=w(Qi=>{"use strict";Object.defineProperty(Qi,"__esModule",{value:!0});var Xi=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};Qi.default=Xi});var Wr=w(ro=>{"use strict";Object.defineProperty(ro,"__esModule",{value:!0});var eo=Kr(),to=class extends Error{constructor(e,r,n,s){super(s||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,eo.resolveUrl)(e,r,n),this.missingSchema=(0,eo.normalizeId)((0,eo.getFullPath)(e,this.missingRef))}};ro.default=to});var Yn=w(Ie=>{"use strict";Object.defineProperty(Ie,"__esModule",{value:!0});Ie.resolveSchema=Ie.getCompilingSchema=Ie.resolveRef=Ie.compileSchema=Ie.SchemaEnv=void 0;var Ue=z(),s_=Wn(),Wt=lt(),ze=Kr(),Cu=W(),i_=Gr(),vr=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let n;typeof e.schema=="object"&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,ze.normalizeId)(n?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={}}};Ie.SchemaEnv=vr;function so(t){let e=Iu.call(this,t);if(e)return e;let r=(0,ze.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:s}=this.opts.code,{ownProperties:i}=this.opts,o=new Ue.CodeGen(this.scope,{es5:n,lines:s,ownProperties:i}),a;t.$async&&(a=o.scopeValue("Error",{ref:s_.default,code:(0,Ue._)`require("ajv/dist/runtime/validation_error").default`}));let c=o.scopeName("validate");t.validateName=c;let u={gen:o,allErrors:this.opts.allErrors,data:Wt.default.data,parentData:Wt.default.parentData,parentDataProperty:Wt.default.parentDataProperty,dataNames:[Wt.default.data],dataPathArr:[Ue.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:o.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,Ue.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:Ue.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Ue._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(t),(0,i_.validateFunctionCode)(u),o.optimize(this.opts.code.optimize);let d=o.toString();l=`${o.scopeRefs(Wt.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,t));let h=new Function(`${Wt.default.self}`,`${Wt.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:h}),h.errors=null,h.schema=t.schema,h.schemaEnv=t,t.$async&&(h.$async=!0),this.opts.code.source===!0&&(h.source={validateName:c,validateCode:d,scopeValues:o._values}),this.opts.unevaluated){let{props:f,items:m}=u;h.evaluated={props:f instanceof Ue.Name?void 0:f,items:m instanceof Ue.Name?void 0:m,dynamicProps:f instanceof Ue.Name,dynamicItems:m instanceof Ue.Name},h.source&&(h.source.evaluated=(0,Ue.stringify)(h.evaluated))}return t.validate=h,t}catch(d){throw delete t.validate,delete t.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(t)}}Ie.compileSchema=so;function o_(t,e,r){var n;r=(0,ze.resolveUrl)(this.opts.uriResolver,e,r);let s=t.refs[r];if(s)return s;let i=u_.call(this,t,r);if(i===void 0){let o=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;o&&(i=new vr({schema:o,schemaId:a,root:t,baseId:e}))}if(i!==void 0)return t.refs[r]=a_.call(this,i)}Ie.resolveRef=o_;function a_(t){return(0,ze.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:so.call(this,t)}function Iu(t){for(let e of this._compilations)if(c_(e,t))return e}Ie.getCompilingSchema=Iu;function c_(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function u_(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||Zn.call(this,t,e)}function Zn(t,e){let r=this.opts.uriResolver.parse(e),n=(0,ze._getFullPath)(this.opts.uriResolver,r),s=(0,ze.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===s)return no.call(this,r,t);let i=(0,ze.normalizeId)(n),o=this.refs[i]||this.schemas[i];if(typeof o=="string"){let a=Zn.call(this,t,o);return typeof a?.schema!="object"?void 0:no.call(this,r,a)}if(typeof o?.schema=="object"){if(o.validate||so.call(this,o),i===(0,ze.normalizeId)(e)){let{schema:a}=o,{schemaId:c}=this.opts,u=a[c];return u&&(s=(0,ze.resolveUrl)(this.opts.uriResolver,s,u)),new vr({schema:a,schemaId:c,root:t,baseId:s})}return no.call(this,r,o)}}Ie.resolveSchema=Zn;var l_=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function no(t,{baseId:e,schema:r,root:n}){var s;if(((s=t.fragment)===null||s===void 0?void 0:s[0])!=="/")return;for(let a of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,Cu.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!l_.has(a)&&u&&(e=(0,ze.resolveUrl)(this.opts.uriResolver,e,u))}let i;if(typeof r!="boolean"&&r.$ref&&!(0,Cu.schemaHasRulesButRef)(r,this.RULES)){let a=(0,ze.resolveUrl)(this.opts.uriResolver,e,r.$ref);i=Zn.call(this,n,a)}let{schemaId:o}=this.opts;if(i=i||new vr({schema:r,schemaId:o,root:n,baseId:e}),i.schema!==i.root.schema)return i}});var qu=w((fO,d_)=>{d_.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 Du=w((pO,Au)=>{"use strict";var f_={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};Au.exports={HEX:f_}});var Ku=w((hO,Bu)=>{"use strict";var{HEX:p_}=Du(),h_=/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u;function Uu(t){if(Fu(t,".")<3)return{host:t,isIPV4:!1};let e=t.match(h_)||[],[r]=e;return r?{host:g_(r,"."),isIPV4:!0}:{host:t,isIPV4:!1}}function io(t,e=!1){let r="",n=!0;for(let s of t){if(p_[s]===void 0)return;s!=="0"&&n===!0&&(n=!1),n||(r+=s)}return e&&r.length===0&&(r="0"),r}function m_(t){let e=0,r={error:!1,address:"",zone:""},n=[],s=[],i=!1,o=!1,a=!1;function c(){if(s.length){if(i===!1){let u=io(s);if(u!==void 0)n.push(u);else return r.error=!0,!1}s.length=0}return!0}for(let u=0;u<t.length;u++){let l=t[u];if(!(l==="["||l==="]"))if(l===":"){if(o===!0&&(a=!0),!c())break;if(e++,n.push(":"),e>7){r.error=!0;break}u-1>=0&&t[u-1]===":"&&(o=!0);continue}else if(l==="%"){if(!c())break;i=!0}else{s.push(l);continue}}return s.length&&(i?r.zone=s.join(""):a?n.push(s.join("")):n.push(io(s))),r.address=n.join(""),r}function zu(t){if(Fu(t,":")<2)return{host:t,isIPV6:!1};let e=m_(t);if(e.error)return{host:t,isIPV6:!1};{let r=e.address,n=e.address;return e.zone&&(r+="%"+e.zone,n+="%25"+e.zone),{host:r,escapedHost:n,isIPV6:!0}}}function g_(t,e){let r="",n=!0,s=t.length;for(let i=0;i<s;i++){let o=t[i];o==="0"&&n?(i+1<=s&&t[i+1]===e||i+1===s)&&(r+=o,n=!1):(o===e?n=!0:n=!1,r+=o)}return r}function Fu(t,e){let r=0;for(let n=0;n<t.length;n++)t[n]===e&&r++;return r}var Lu=/^\.\.?\//u,Mu=/^\/\.(?:\/|$)/u,Vu=/^\/\.\.(?:\/|$)/u,y_=/^\/?(?:.|\n)*?(?=\/|$)/u;function __(t){let e=[];for(;t.length;)if(t.match(Lu))t=t.replace(Lu,"");else if(t.match(Mu))t=t.replace(Mu,"/");else if(t.match(Vu))t=t.replace(Vu,"/"),e.pop();else if(t==="."||t==="..")t="";else{let r=t.match(y_);if(r){let n=r[0];t=t.slice(n.length),e.push(n)}else throw new Error("Unexpected dot segment condition")}return e.join("")}function v_(t,e){let r=e!==!0?escape:unescape;return t.scheme!==void 0&&(t.scheme=r(t.scheme)),t.userinfo!==void 0&&(t.userinfo=r(t.userinfo)),t.host!==void 0&&(t.host=r(t.host)),t.path!==void 0&&(t.path=r(t.path)),t.query!==void 0&&(t.query=r(t.query)),t.fragment!==void 0&&(t.fragment=r(t.fragment)),t}function b_(t){let e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let r=unescape(t.host),n=Uu(r);if(n.isIPV4)r=n.host;else{let s=zu(n.host);s.isIPV6===!0?r=`[${s.escapedHost}]`:r=t.host}e.push(r)}return(typeof t.port=="number"||typeof t.port=="string")&&(e.push(":"),e.push(String(t.port))),e.length?e.join(""):void 0}Bu.exports={recomposeAuthority:b_,normalizeComponentEncoding:v_,removeDotSegments:__,normalizeIPv4:Uu,normalizeIPv6:zu,stringArrayToHexStripped:io}});var Yu=w((mO,Zu)=>{"use strict";var w_=/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu,S_=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;function Hu(t){return typeof t.secure=="boolean"?t.secure:String(t.scheme).toLowerCase()==="wss"}function Ju(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function Gu(t){let e=String(t.scheme).toLowerCase()==="https";return(t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function $_(t){return t.secure=Hu(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function x_(t){if((t.port===(Hu(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let[e,r]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=r,t.resourceName=void 0}return t.fragment=void 0,t}function E_(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(S_);if(r){let n=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let s=`${n}:${e.nid||t.nid}`,i=oo[s];t.path=void 0,i&&(t=i.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function k_(t,e){let r=e.scheme||t.scheme||"urn",n=t.nid.toLowerCase(),s=`${r}:${e.nid||n}`,i=oo[s];i&&(t=i.serialize(t,e));let o=t,a=t.nss;return o.path=`${n||e.nid}:${a}`,e.skipEscape=!0,o}function O_(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!w_.test(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function T_(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var Wu={scheme:"http",domainHost:!0,parse:Ju,serialize:Gu},P_={scheme:"https",domainHost:Wu.domainHost,parse:Ju,serialize:Gu},Xn={scheme:"ws",domainHost:!0,parse:$_,serialize:x_},j_={scheme:"wss",domainHost:Xn.domainHost,parse:Xn.parse,serialize:Xn.serialize},N_={scheme:"urn",parse:E_,serialize:k_,skipNormalize:!0},R_={scheme:"urn:uuid",parse:O_,serialize:T_,skipNormalize:!0},oo={http:Wu,https:P_,ws:Xn,wss:j_,urn:N_,"urn:uuid":R_};Zu.exports=oo});var Qu=w((gO,es)=>{"use strict";var{normalizeIPv6:C_,normalizeIPv4:I_,removeDotSegments:Zr,recomposeAuthority:q_,normalizeComponentEncoding:Qn}=Ku(),ao=Yu();function A_(t,e){return typeof t=="string"?t=Xe(ft(t,e),e):typeof t=="object"&&(t=ft(Xe(t,e),e)),t}function D_(t,e,r){let n=Object.assign({scheme:"null"},r),s=Xu(ft(t,n),ft(e,n),n,!0);return Xe(s,{...n,skipEscape:!0})}function Xu(t,e,r,n){let s={};return n||(t=ft(Xe(t,r),r),e=ft(Xe(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(s.scheme=e.scheme,s.userinfo=e.userinfo,s.host=e.host,s.port=e.port,s.path=Zr(e.path||""),s.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(s.userinfo=e.userinfo,s.host=e.host,s.port=e.port,s.path=Zr(e.path||""),s.query=e.query):(e.path?(e.path.charAt(0)==="/"?s.path=Zr(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?s.path="/"+e.path:t.path?s.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:s.path=e.path,s.path=Zr(s.path)),s.query=e.query):(s.path=t.path,e.query!==void 0?s.query=e.query:s.query=t.query),s.userinfo=t.userinfo,s.host=t.host,s.port=t.port),s.scheme=t.scheme),s.fragment=e.fragment,s}function L_(t,e,r){return typeof t=="string"?(t=unescape(t),t=Xe(Qn(ft(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=Xe(Qn(t,!0),{...r,skipEscape:!0})),typeof e=="string"?(e=unescape(e),e=Xe(Qn(ft(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=Xe(Qn(e,!0),{...r,skipEscape:!0})),t.toLowerCase()===e.toLowerCase()}function Xe(t,e){let r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},n=Object.assign({},e),s=[],i=ao[(n.scheme||r.scheme||"").toLowerCase()];i&&i.serialize&&i.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&s.push(r.scheme,":");let o=q_(r);if(o!==void 0&&(n.reference!=="suffix"&&s.push("//"),s.push(o),r.path&&r.path.charAt(0)!=="/"&&s.push("/")),r.path!==void 0){let a=r.path;!n.absolutePath&&(!i||!i.absolutePath)&&(a=Zr(a)),o===void 0&&(a=a.replace(/^\/\//u,"/%2F")),s.push(a)}return r.query!==void 0&&s.push("?",r.query),r.fragment!==void 0&&s.push("#",r.fragment),s.join("")}var M_=Array.from({length:127},(t,e)=>/[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(e)));function V_(t){let e=0;for(let r=0,n=t.length;r<n;++r)if(e=t.charCodeAt(r),e>126||M_[e])return!0;return!1}var U_=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function ft(t,e){let r=Object.assign({},e),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},s=t.indexOf("%")!==-1,i=!1;r.reference==="suffix"&&(t=(r.scheme?r.scheme+":":"")+"//"+t);let o=t.match(U_);if(o){if(n.scheme=o[1],n.userinfo=o[3],n.host=o[4],n.port=parseInt(o[5],10),n.path=o[6]||"",n.query=o[7],n.fragment=o[8],isNaN(n.port)&&(n.port=o[5]),n.host){let c=I_(n.host);if(c.isIPV4===!1){let u=C_(c.host);n.host=u.host.toLowerCase(),i=u.isIPV6}else n.host=c.host,i=!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 a=ao[(r.scheme||n.scheme||"").toLowerCase()];if(!r.unicodeSupport&&(!a||!a.unicodeSupport)&&n.host&&(r.domainHost||a&&a.domainHost)&&i===!1&&V_(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(c){n.error=n.error||"Host's domain name can not be converted to ASCII: "+c}(!a||a&&!a.skipNormalize)&&(s&&n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),s&&n.host!==void 0&&(n.host=unescape(n.host)),n.path&&(n.path=escape(unescape(n.path))),n.fragment&&(n.fragment=encodeURI(decodeURIComponent(n.fragment)))),a&&a.parse&&a.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return n}var co={SCHEMES:ao,normalize:A_,resolve:D_,resolveComponents:Xu,equal:L_,serialize:Xe,parse:ft};es.exports=co;es.exports.default=co;es.exports.fastUri=co});var tl=w(uo=>{"use strict";Object.defineProperty(uo,"__esModule",{value:!0});var el=Qu();el.code='require("ajv/dist/runtime/uri").default';uo.default=el});var ul=w(le=>{"use strict";Object.defineProperty(le,"__esModule",{value:!0});le.CodeGen=le.Name=le.nil=le.stringify=le.str=le._=le.KeywordCxt=void 0;var z_=Gr();Object.defineProperty(le,"KeywordCxt",{enumerable:!0,get:function(){return z_.KeywordCxt}});var br=z();Object.defineProperty(le,"_",{enumerable:!0,get:function(){return br._}});Object.defineProperty(le,"str",{enumerable:!0,get:function(){return br.str}});Object.defineProperty(le,"stringify",{enumerable:!0,get:function(){return br.stringify}});Object.defineProperty(le,"nil",{enumerable:!0,get:function(){return br.nil}});Object.defineProperty(le,"Name",{enumerable:!0,get:function(){return br.Name}});Object.defineProperty(le,"CodeGen",{enumerable:!0,get:function(){return br.CodeGen}});var F_=Wn(),ol=Wr(),B_=Mi(),Yr=Yn(),K_=z(),Xr=Kr(),ts=Br(),fo=W(),rl=qu(),H_=tl(),al=(t,e)=>new RegExp(t,e);al.code="new RegExp";var J_=["removeAdditional","useDefaults","coerceTypes"],G_=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),W_={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."},Z_={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},nl=200;function Y_(t){var e,r,n,s,i,o,a,c,u,l,d,y,h,f,m,g,_,b,S,$,E,j,q,K,R;let Z=t.strict,se=(e=t.code)===null||e===void 0?void 0:e.optimize,te=se===!0||se===void 0?1:se||0,ae=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:al,ie=(s=t.uriResolver)!==null&&s!==void 0?s:H_.default;return{strictSchema:(o=(i=t.strictSchema)!==null&&i!==void 0?i:Z)!==null&&o!==void 0?o:!0,strictNumbers:(c=(a=t.strictNumbers)!==null&&a!==void 0?a:Z)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=t.strictTypes)!==null&&u!==void 0?u:Z)!==null&&l!==void 0?l:"log",strictTuples:(y=(d=t.strictTuples)!==null&&d!==void 0?d:Z)!==null&&y!==void 0?y:"log",strictRequired:(f=(h=t.strictRequired)!==null&&h!==void 0?h:Z)!==null&&f!==void 0?f:!1,code:t.code?{...t.code,optimize:te,regExp:ae}:{optimize:te,regExp:ae},loopRequired:(m=t.loopRequired)!==null&&m!==void 0?m:nl,loopEnum:(g=t.loopEnum)!==null&&g!==void 0?g:nl,meta:(_=t.meta)!==null&&_!==void 0?_:!0,messages:(b=t.messages)!==null&&b!==void 0?b:!0,inlineRefs:(S=t.inlineRefs)!==null&&S!==void 0?S:!0,schemaId:($=t.schemaId)!==null&&$!==void 0?$:"$id",addUsedSchema:(E=t.addUsedSchema)!==null&&E!==void 0?E:!0,validateSchema:(j=t.validateSchema)!==null&&j!==void 0?j:!0,validateFormats:(q=t.validateFormats)!==null&&q!==void 0?q:!0,unicodeRegExp:(K=t.unicodeRegExp)!==null&&K!==void 0?K:!0,int32range:(R=t.int32range)!==null&&R!==void 0?R:!0,uriResolver:ie}}var Qr=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...Y_(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new K_.ValueScope({scope:{},prefixes:G_,es5:r,lines:n}),this.logger=nv(e.logger);let s=e.validateFormats;e.validateFormats=!1,this.RULES=(0,B_.getRules)(),sl.call(this,W_,e,"NOT SUPPORTED"),sl.call(this,Z_,e,"DEPRECATED","warn"),this._metaOpts=tv.call(this),e.formats&&Q_.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&ev.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),X_.call(this),e.validateFormats=s}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,s=rl;n==="id"&&(s={...rl},s.id=s.$id,delete s.$id),r&&e&&this.addMetaSchema(s,s[n],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let s=n(r);return"$async"in n||(this.errors=n.errors),s}compile(e,r){let n=this._addSchema(e,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return s.call(this,e,r);async function s(l,d){await i.call(this,l.$schema);let y=this._addSchema(l,d);return y.validate||o.call(this,y)}async function i(l){l&&!this.getSchema(l)&&await s.call(this,{$ref:l},!0)}async function o(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof ol.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),o.call(this,l)}}function a({missingSchema:l,missingRef:d}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${d} cannot be resolved`)}async function c(l){let d=await u.call(this,l);this.refs[l]||await i.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,r)}async function u(l){let d=this._loading[l];if(d)return d;try{return await(this._loading[l]=n(l))}finally{delete this._loading[l]}}}addSchema(e,r,n,s=this.opts.validateSchema){if(Array.isArray(e)){for(let o of e)this.addSchema(o,void 0,n,s);return this}let i;if(typeof e=="object"){let{schemaId:o}=this.opts;if(i=e[o],i!==void 0&&typeof i!="string")throw new Error(`schema ${o} must be string`)}return r=(0,Xr.normalizeId)(r||i),this._checkUnique(r),this.schemas[r]=this._addSchema(e,n,r,s,!0),this}addMetaSchema(e,r,n=this.opts.validateSchema){return this.addSchema(e,r,!0,n),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let n;if(n=e.$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 s=this.validate(n,e);if(!s&&r){let i="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(i);else throw new Error(i)}return s}getSchema(e){let r;for(;typeof(r=il.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,s=new Yr.SchemaEnv({schema:{},schemaId:n});if(r=Yr.resolveSchema.call(this,s,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=il.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let n=e[this.opts.schemaId];return n&&(n=(0,Xr.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let n;if(typeof e=="string")n=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof e=="object"&&r===void 0){if(r=e,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(iv.call(this,n,r),!r)return(0,fo.eachItem)(n,i=>lo.call(this,i)),this;av.call(this,r);let s={...r,type:(0,ts.getJSONTypes)(r.type),schemaType:(0,ts.getJSONTypes)(r.schemaType)};return(0,fo.eachItem)(n,s.type.length===0?i=>lo.call(this,i,s):i=>s.type.forEach(o=>lo.call(this,i,s,o))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let n of r.rules){let s=n.rules.findIndex(i=>i.keyword===e);s>=0&&n.rules.splice(s,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!e||e.length===0?"No errors":e.map(s=>`${n}${s.instancePath} ${s.message}`).reduce((s,i)=>s+r+i)}$dataMetaSchema(e,r){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let s of r){let i=s.split("/").slice(1),o=e;for(let a of i)o=o[a];for(let a in n){let c=n[a];if(typeof c!="object")continue;let{$data:u}=c.definition,l=o[a];u&&l&&(o[a]=cl(l))}}return e}_removeAllSchemas(e,r){for(let n in e){let s=e[n];(!r||r.test(n))&&(typeof s=="string"?delete e[n]:s&&!s.meta&&(this._cache.delete(s.schema),delete e[n]))}}_addSchema(e,r,n,s=this.opts.validateSchema,i=this.opts.addUsedSchema){let o,{schemaId:a}=this.opts;if(typeof e=="object")o=e[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(e);if(c!==void 0)return c;n=(0,Xr.normalizeId)(o||n);let u=Xr.getSchemaRefs.call(this,e,n);return c=new Yr.SchemaEnv({schema:e,schemaId:a,meta:r,baseId:n,localRefs:u}),this._cache.set(c.schema,c),i&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),s&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):Yr.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{Yr.compileSchema.call(this,e)}finally{this.opts=r}}};Qr.ValidationError=F_.default;Qr.MissingRefError=ol.default;le.default=Qr;function sl(t,e,r,n="error"){for(let s in t){let i=s;i in e&&this.logger[n](`${r}: option ${s}. ${t[i]}`)}}function il(t){return t=(0,Xr.normalizeId)(t),this.schemas[t]||this.refs[t]}function X_(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function Q_(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function ev(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function tv(){let t={...this.opts};for(let e of J_)delete t[e];return t}var rv={log(){},warn(){},error(){}};function nv(t){if(t===!1)return rv;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var sv=/^[a-z_$][a-z0-9_$:-]*$/i;function iv(t,e){let{RULES:r}=this;if((0,fo.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!sv.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function lo(t,e,r){var n;let s=e?.post;if(r&&s)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:i}=this,o=s?i.post:i.rules.find(({type:c})=>c===r);if(o||(o={type:r,rules:[]},i.rules.push(o)),i.keywords[t]=!0,!e)return;let a={keyword:t,definition:{...e,type:(0,ts.getJSONTypes)(e.type),schemaType:(0,ts.getJSONTypes)(e.schemaType)}};e.before?ov.call(this,o,a,e.before):o.rules.push(a),i.all[t]=a,(n=e.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function ov(t,e,r){let n=t.rules.findIndex(s=>s.keyword===r);n>=0?t.rules.splice(n,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function av(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=cl(e)),t.validateSchema=this.compile(e,!0))}var cv={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function cl(t){return{anyOf:[t,cv]}}});var ll=w(po=>{"use strict";Object.defineProperty(po,"__esModule",{value:!0});var uv={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};po.default=uv});var hl=w(Zt=>{"use strict";Object.defineProperty(Zt,"__esModule",{value:!0});Zt.callRef=Zt.getValidate=void 0;var lv=Wr(),dl=Ce(),ke=z(),wr=lt(),fl=Yn(),rs=W(),dv={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:n}=t,{baseId:s,schemaEnv:i,validateName:o,opts:a,self:c}=n,{root:u}=i;if((r==="#"||r==="#/")&&s===u.baseId)return d();let l=fl.resolveRef.call(c,u,s,r);if(l===void 0)throw new lv.default(n.opts.uriResolver,s,r);if(l instanceof fl.SchemaEnv)return y(l);return h(l);function d(){if(i===u)return ns(t,o,i,i.$async);let f=e.scopeValue("root",{ref:u});return ns(t,(0,ke._)`${f}.validate`,u,u.$async)}function y(f){let m=pl(t,f);ns(t,m,f,f.$async)}function h(f){let m=e.scopeValue("schema",a.code.source===!0?{ref:f,code:(0,ke.stringify)(f)}:{ref:f}),g=e.name("valid"),_=t.subschema({schema:f,dataTypes:[],schemaPath:ke.nil,topSchemaRef:m,errSchemaPath:r},g);t.mergeEvaluated(_),t.ok(g)}}};function pl(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,ke._)`${r.scopeValue("wrapper",{ref:e})}.validate`}Zt.getValidate=pl;function ns(t,e,r,n){let{gen:s,it:i}=t,{allErrors:o,schemaEnv:a,opts:c}=i,u=c.passContext?wr.default.this:ke.nil;n?l():d();function l(){if(!a.$async)throw new Error("async schema referenced by sync schema");let f=s.let("valid");s.try(()=>{s.code((0,ke._)`await ${(0,dl.callValidateCode)(t,e,u)}`),h(e),o||s.assign(f,!0)},m=>{s.if((0,ke._)`!(${m} instanceof ${i.ValidationError})`,()=>s.throw(m)),y(m),o||s.assign(f,!1)}),t.ok(f)}function d(){t.result((0,dl.callValidateCode)(t,e,u),()=>h(e),()=>y(e))}function y(f){let m=(0,ke._)`${f}.errors`;s.assign(wr.default.vErrors,(0,ke._)`${wr.default.vErrors} === null ? ${m} : ${wr.default.vErrors}.concat(${m})`),s.assign(wr.default.errors,(0,ke._)`${wr.default.vErrors}.length`)}function h(f){var m;if(!i.opts.unevaluated)return;let g=(m=r?.validate)===null||m===void 0?void 0:m.evaluated;if(i.props!==!0)if(g&&!g.dynamicProps)g.props!==void 0&&(i.props=rs.mergeEvaluated.props(s,g.props,i.props));else{let _=s.var("props",(0,ke._)`${f}.evaluated.props`);i.props=rs.mergeEvaluated.props(s,_,i.props,ke.Name)}if(i.items!==!0)if(g&&!g.dynamicItems)g.items!==void 0&&(i.items=rs.mergeEvaluated.items(s,g.items,i.items));else{let _=s.var("items",(0,ke._)`${f}.evaluated.items`);i.items=rs.mergeEvaluated.items(s,_,i.items,ke.Name)}}}Zt.callRef=ns;Zt.default=dv});var ml=w(ho=>{"use strict";Object.defineProperty(ho,"__esModule",{value:!0});var fv=ll(),pv=hl(),hv=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",fv.default,pv.default];ho.default=hv});var gl=w(mo=>{"use strict";Object.defineProperty(mo,"__esModule",{value:!0});var ss=z(),Et=ss.operators,is={maximum:{okStr:"<=",ok:Et.LTE,fail:Et.GT},minimum:{okStr:">=",ok:Et.GTE,fail:Et.LT},exclusiveMaximum:{okStr:"<",ok:Et.LT,fail:Et.GTE},exclusiveMinimum:{okStr:">",ok:Et.GT,fail:Et.LTE}},mv={message:({keyword:t,schemaCode:e})=>(0,ss.str)`must be ${is[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,ss._)`{comparison: ${is[t].okStr}, limit: ${e}}`},gv={keyword:Object.keys(is),type:"number",schemaType:"number",$data:!0,error:mv,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,ss._)`${r} ${is[e].fail} ${n} || isNaN(${r})`)}};mo.default=gv});var yl=w(go=>{"use strict";Object.defineProperty(go,"__esModule",{value:!0});var en=z(),yv={message:({schemaCode:t})=>(0,en.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,en._)`{multipleOf: ${t}}`},_v={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:yv,code(t){let{gen:e,data:r,schemaCode:n,it:s}=t,i=s.opts.multipleOfPrecision,o=e.let("res"),a=i?(0,en._)`Math.abs(Math.round(${o}) - ${o}) > 1e-${i}`:(0,en._)`${o} !== parseInt(${o})`;t.fail$data((0,en._)`(${n} === 0 || (${o} = ${r}/${n}, ${a}))`)}};go.default=_v});var vl=w(yo=>{"use strict";Object.defineProperty(yo,"__esModule",{value:!0});function _l(t){let e=t.length,r=0,n=0,s;for(;n<e;)r++,s=t.charCodeAt(n++),s>=55296&&s<=56319&&n<e&&(s=t.charCodeAt(n),(s&64512)===56320&&n++);return r}yo.default=_l;_l.code='require("ajv/dist/runtime/ucs2length").default'});var bl=w(_o=>{"use strict";Object.defineProperty(_o,"__esModule",{value:!0});var Yt=z(),vv=W(),bv=vl(),wv={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,Yt.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,Yt._)`{limit: ${t}}`},Sv={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:wv,code(t){let{keyword:e,data:r,schemaCode:n,it:s}=t,i=e==="maxLength"?Yt.operators.GT:Yt.operators.LT,o=s.opts.unicode===!1?(0,Yt._)`${r}.length`:(0,Yt._)`${(0,vv.useFunc)(t.gen,bv.default)}(${r})`;t.fail$data((0,Yt._)`${o} ${i} ${n}`)}};_o.default=Sv});var wl=w(vo=>{"use strict";Object.defineProperty(vo,"__esModule",{value:!0});var $v=Ce(),os=z(),xv={message:({schemaCode:t})=>(0,os.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,os._)`{pattern: ${t}}`},Ev={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:xv,code(t){let{data:e,$data:r,schema:n,schemaCode:s,it:i}=t,o=i.opts.unicodeRegExp?"u":"",a=r?(0,os._)`(new RegExp(${s}, ${o}))`:(0,$v.usePattern)(t,n);t.fail$data((0,os._)`!${a}.test(${e})`)}};vo.default=Ev});var Sl=w(bo=>{"use strict";Object.defineProperty(bo,"__esModule",{value:!0});var tn=z(),kv={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,tn.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,tn._)`{limit: ${t}}`},Ov={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:kv,code(t){let{keyword:e,data:r,schemaCode:n}=t,s=e==="maxProperties"?tn.operators.GT:tn.operators.LT;t.fail$data((0,tn._)`Object.keys(${r}).length ${s} ${n}`)}};bo.default=Ov});var $l=w(wo=>{"use strict";Object.defineProperty(wo,"__esModule",{value:!0});var rn=Ce(),nn=z(),Tv=W(),Pv={message:({params:{missingProperty:t}})=>(0,nn.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,nn._)`{missingProperty: ${t}}`},jv={keyword:"required",type:"object",schemaType:"array",$data:!0,error:Pv,code(t){let{gen:e,schema:r,schemaCode:n,data:s,$data:i,it:o}=t,{opts:a}=o;if(!i&&r.length===0)return;let c=r.length>=a.loopRequired;if(o.allErrors?u():l(),a.strictRequired){let h=t.parentSchema.properties,{definedProperties:f}=t.it;for(let m of r)if(h?.[m]===void 0&&!f.has(m)){let g=o.schemaEnv.baseId+o.errSchemaPath,_=`required property "${m}" is not defined at "${g}" (strictRequired)`;(0,Tv.checkStrictMode)(o,_,o.opts.strictRequired)}}function u(){if(c||i)t.block$data(nn.nil,d);else for(let h of r)(0,rn.checkReportMissingProp)(t,h)}function l(){let h=e.let("missing");if(c||i){let f=e.let("valid",!0);t.block$data(f,()=>y(h,f)),t.ok(f)}else e.if((0,rn.checkMissingProp)(t,r,h)),(0,rn.reportMissingProp)(t,h),e.else()}function d(){e.forOf("prop",n,h=>{t.setParams({missingProperty:h}),e.if((0,rn.noPropertyInData)(e,s,h,a.ownProperties),()=>t.error())})}function y(h,f){t.setParams({missingProperty:h}),e.forOf(h,n,()=>{e.assign(f,(0,rn.propertyInData)(e,s,h,a.ownProperties)),e.if((0,nn.not)(f),()=>{t.error(),e.break()})},nn.nil)}}};wo.default=jv});var xl=w(So=>{"use strict";Object.defineProperty(So,"__esModule",{value:!0});var sn=z(),Nv={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,sn.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,sn._)`{limit: ${t}}`},Rv={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:Nv,code(t){let{keyword:e,data:r,schemaCode:n}=t,s=e==="maxItems"?sn.operators.GT:sn.operators.LT;t.fail$data((0,sn._)`${r}.length ${s} ${n}`)}};So.default=Rv});var as=w($o=>{"use strict";Object.defineProperty($o,"__esModule",{value:!0});var El=Ji();El.code='require("ajv/dist/runtime/equal").default';$o.default=El});var kl=w(Eo=>{"use strict";Object.defineProperty(Eo,"__esModule",{value:!0});var xo=Br(),de=z(),Cv=W(),Iv=as(),qv={message:({params:{i:t,j:e}})=>(0,de.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,de._)`{i: ${t}, j: ${e}}`},Av={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:qv,code(t){let{gen:e,data:r,$data:n,schema:s,parentSchema:i,schemaCode:o,it:a}=t;if(!n&&!s)return;let c=e.let("valid"),u=i.items?(0,xo.getSchemaTypes)(i.items):[];t.block$data(c,l,(0,de._)`${o} === false`),t.ok(c);function l(){let f=e.let("i",(0,de._)`${r}.length`),m=e.let("j");t.setParams({i:f,j:m}),e.assign(c,!0),e.if((0,de._)`${f} > 1`,()=>(d()?y:h)(f,m))}function d(){return u.length>0&&!u.some(f=>f==="object"||f==="array")}function y(f,m){let g=e.name("item"),_=(0,xo.checkDataTypes)(u,g,a.opts.strictNumbers,xo.DataType.Wrong),b=e.const("indices",(0,de._)`{}`);e.for((0,de._)`;${f}--;`,()=>{e.let(g,(0,de._)`${r}[${f}]`),e.if(_,(0,de._)`continue`),u.length>1&&e.if((0,de._)`typeof ${g} == "string"`,(0,de._)`${g} += "_"`),e.if((0,de._)`typeof ${b}[${g}] == "number"`,()=>{e.assign(m,(0,de._)`${b}[${g}]`),t.error(),e.assign(c,!1).break()}).code((0,de._)`${b}[${g}] = ${f}`)})}function h(f,m){let g=(0,Cv.useFunc)(e,Iv.default),_=e.name("outer");e.label(_).for((0,de._)`;${f}--;`,()=>e.for((0,de._)`${m} = ${f}; ${m}--;`,()=>e.if((0,de._)`${g}(${r}[${f}], ${r}[${m}])`,()=>{t.error(),e.assign(c,!1).break(_)})))}}};Eo.default=Av});var Ol=w(Oo=>{"use strict";Object.defineProperty(Oo,"__esModule",{value:!0});var ko=z(),Dv=W(),Lv=as(),Mv={message:"must be equal to constant",params:({schemaCode:t})=>(0,ko._)`{allowedValue: ${t}}`},Vv={keyword:"const",$data:!0,error:Mv,code(t){let{gen:e,data:r,$data:n,schemaCode:s,schema:i}=t;n||i&&typeof i=="object"?t.fail$data((0,ko._)`!${(0,Dv.useFunc)(e,Lv.default)}(${r}, ${s})`):t.fail((0,ko._)`${i} !== ${r}`)}};Oo.default=Vv});var Tl=w(To=>{"use strict";Object.defineProperty(To,"__esModule",{value:!0});var on=z(),Uv=W(),zv=as(),Fv={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,on._)`{allowedValues: ${t}}`},Bv={keyword:"enum",schemaType:"array",$data:!0,error:Fv,code(t){let{gen:e,data:r,$data:n,schema:s,schemaCode:i,it:o}=t;if(!n&&s.length===0)throw new Error("enum must have non-empty array");let a=s.length>=o.opts.loopEnum,c,u=()=>c??(c=(0,Uv.useFunc)(e,zv.default)),l;if(a||n)l=e.let("valid"),t.block$data(l,d);else{if(!Array.isArray(s))throw new Error("ajv implementation error");let h=e.const("vSchema",i);l=(0,on.or)(...s.map((f,m)=>y(h,m)))}t.pass(l);function d(){e.assign(l,!1),e.forOf("v",i,h=>e.if((0,on._)`${u()}(${r}, ${h})`,()=>e.assign(l,!0).break()))}function y(h,f){let m=s[f];return typeof m=="object"&&m!==null?(0,on._)`${u()}(${r}, ${h}[${f}])`:(0,on._)`${r} === ${m}`}}};To.default=Bv});var Pl=w(Po=>{"use strict";Object.defineProperty(Po,"__esModule",{value:!0});var Kv=gl(),Hv=yl(),Jv=bl(),Gv=wl(),Wv=Sl(),Zv=$l(),Yv=xl(),Xv=kl(),Qv=Ol(),eb=Tl(),tb=[Kv.default,Hv.default,Jv.default,Gv.default,Wv.default,Zv.default,Yv.default,Xv.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Qv.default,eb.default];Po.default=tb});var No=w(an=>{"use strict";Object.defineProperty(an,"__esModule",{value:!0});an.validateAdditionalItems=void 0;var Xt=z(),jo=W(),rb={message:({params:{len:t}})=>(0,Xt.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Xt._)`{limit: ${t}}`},nb={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:rb,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,jo.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}jl(t,n)}};function jl(t,e){let{gen:r,schema:n,data:s,keyword:i,it:o}=t;o.items=!0;let a=r.const("len",(0,Xt._)`${s}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,Xt._)`${a} <= ${e.length}`);else if(typeof n=="object"&&!(0,jo.alwaysValidSchema)(o,n)){let u=r.var("valid",(0,Xt._)`${a} <= ${e.length}`);r.if((0,Xt.not)(u),()=>c(u)),t.ok(u)}function c(u){r.forRange("i",e.length,a,l=>{t.subschema({keyword:i,dataProp:l,dataPropType:jo.Type.Num},u),o.allErrors||r.if((0,Xt.not)(u),()=>r.break())})}}an.validateAdditionalItems=jl;an.default=nb});var Ro=w(cn=>{"use strict";Object.defineProperty(cn,"__esModule",{value:!0});cn.validateTuple=void 0;var Nl=z(),cs=W(),sb=Ce(),ib={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return Rl(t,"additionalItems",e);r.items=!0,!(0,cs.alwaysValidSchema)(r,e)&&t.ok((0,sb.validateArray)(t))}};function Rl(t,e,r=t.schema){let{gen:n,parentSchema:s,data:i,keyword:o,it:a}=t;l(s),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=cs.mergeEvaluated.items(n,r.length,a.items));let c=n.name("valid"),u=n.const("len",(0,Nl._)`${i}.length`);r.forEach((d,y)=>{(0,cs.alwaysValidSchema)(a,d)||(n.if((0,Nl._)`${u} > ${y}`,()=>t.subschema({keyword:o,schemaProp:y,dataProp:y},c)),t.ok(c))});function l(d){let{opts:y,errSchemaPath:h}=a,f=r.length,m=f===d.minItems&&(f===d.maxItems||d[e]===!1);if(y.strictTuples&&!m){let g=`"${o}" is ${f}-tuple, but minItems or maxItems/${e} are not specified or different at path "${h}"`;(0,cs.checkStrictMode)(a,g,y.strictTuples)}}}cn.validateTuple=Rl;cn.default=ib});var Cl=w(Co=>{"use strict";Object.defineProperty(Co,"__esModule",{value:!0});var ob=Ro(),ab={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,ob.validateTuple)(t,"items")};Co.default=ab});var ql=w(Io=>{"use strict";Object.defineProperty(Io,"__esModule",{value:!0});var Il=z(),cb=W(),ub=Ce(),lb=No(),db={message:({params:{len:t}})=>(0,Il.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Il._)`{limit: ${t}}`},fb={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:db,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:s}=r;n.items=!0,!(0,cb.alwaysValidSchema)(n,e)&&(s?(0,lb.validateAdditionalItems)(t,s):t.ok((0,ub.validateArray)(t)))}};Io.default=fb});var Al=w(qo=>{"use strict";Object.defineProperty(qo,"__esModule",{value:!0});var qe=z(),us=W(),pb={message:({params:{min:t,max:e}})=>e===void 0?(0,qe.str)`must contain at least ${t} valid item(s)`:(0,qe.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,qe._)`{minContains: ${t}}`:(0,qe._)`{minContains: ${t}, maxContains: ${e}}`},hb={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:pb,code(t){let{gen:e,schema:r,parentSchema:n,data:s,it:i}=t,o,a,{minContains:c,maxContains:u}=n;i.opts.next?(o=c===void 0?1:c,a=u):o=1;let l=e.const("len",(0,qe._)`${s}.length`);if(t.setParams({min:o,max:a}),a===void 0&&o===0){(0,us.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&o>a){(0,us.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,us.alwaysValidSchema)(i,r)){let m=(0,qe._)`${l} >= ${o}`;a!==void 0&&(m=(0,qe._)`${m} && ${l} <= ${a}`),t.pass(m);return}i.items=!0;let d=e.name("valid");a===void 0&&o===1?h(d,()=>e.if(d,()=>e.break())):o===0?(e.let(d,!0),a!==void 0&&e.if((0,qe._)`${s}.length > 0`,y)):(e.let(d,!1),y()),t.result(d,()=>t.reset());function y(){let m=e.name("_valid"),g=e.let("count",0);h(m,()=>e.if(m,()=>f(g)))}function h(m,g){e.forRange("i",0,l,_=>{t.subschema({keyword:"contains",dataProp:_,dataPropType:us.Type.Num,compositeRule:!0},m),g()})}function f(m){e.code((0,qe._)`${m}++`),a===void 0?e.if((0,qe._)`${m} >= ${o}`,()=>e.assign(d,!0).break()):(e.if((0,qe._)`${m} > ${a}`,()=>e.assign(d,!1).break()),o===1?e.assign(d,!0):e.if((0,qe._)`${m} >= ${o}`,()=>e.assign(d,!0)))}}};qo.default=hb});var Ml=w(Qe=>{"use strict";Object.defineProperty(Qe,"__esModule",{value:!0});Qe.validateSchemaDeps=Qe.validatePropertyDeps=Qe.error=void 0;var Ao=z(),mb=W(),un=Ce();Qe.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return(0,Ao.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0,Ao._)`{property: ${t},
    missingProperty: ${n},
    depsCount: ${e},
    deps: ${r}}`};var gb={keyword:"dependencies",type:"object",schemaType:"object",error:Qe.error,code(t){let[e,r]=yb(t);Dl(t,e),Ll(t,r)}};function yb({schema:t}){let e={},r={};for(let n in t){if(n==="__proto__")continue;let s=Array.isArray(t[n])?e:r;s[n]=t[n]}return[e,r]}function Dl(t,e=t.schema){let{gen:r,data:n,it:s}=t;if(Object.keys(e).length===0)return;let i=r.let("missing");for(let o in e){let a=e[o];if(a.length===0)continue;let c=(0,un.propertyInData)(r,n,o,s.opts.ownProperties);t.setParams({property:o,depsCount:a.length,deps:a.join(", ")}),s.allErrors?r.if(c,()=>{for(let u of a)(0,un.checkReportMissingProp)(t,u)}):(r.if((0,Ao._)`${c} && (${(0,un.checkMissingProp)(t,a,i)})`),(0,un.reportMissingProp)(t,i),r.else())}}Qe.validatePropertyDeps=Dl;function Ll(t,e=t.schema){let{gen:r,data:n,keyword:s,it:i}=t,o=r.name("valid");for(let a in e)(0,mb.alwaysValidSchema)(i,e[a])||(r.if((0,un.propertyInData)(r,n,a,i.opts.ownProperties),()=>{let c=t.subschema({keyword:s,schemaProp:a},o);t.mergeValidEvaluated(c,o)},()=>r.var(o,!0)),t.ok(o))}Qe.validateSchemaDeps=Ll;Qe.default=gb});var Ul=w(Do=>{"use strict";Object.defineProperty(Do,"__esModule",{value:!0});var Vl=z(),_b=W(),vb={message:"property name must be valid",params:({params:t})=>(0,Vl._)`{propertyName: ${t.propertyName}}`},bb={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:vb,code(t){let{gen:e,schema:r,data:n,it:s}=t;if((0,_b.alwaysValidSchema)(s,r))return;let i=e.name("valid");e.forIn("key",n,o=>{t.setParams({propertyName:o}),t.subschema({keyword:"propertyNames",data:o,dataTypes:["string"],propertyName:o,compositeRule:!0},i),e.if((0,Vl.not)(i),()=>{t.error(!0),s.allErrors||e.break()})}),t.ok(i)}};Do.default=bb});var Mo=w(Lo=>{"use strict";Object.defineProperty(Lo,"__esModule",{value:!0});var ls=Ce(),Fe=z(),wb=lt(),ds=W(),Sb={message:"must NOT have additional properties",params:({params:t})=>(0,Fe._)`{additionalProperty: ${t.additionalProperty}}`},$b={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Sb,code(t){let{gen:e,schema:r,parentSchema:n,data:s,errsCount:i,it:o}=t;if(!i)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=o;if(o.props=!0,c.removeAdditional!=="all"&&(0,ds.alwaysValidSchema)(o,r))return;let u=(0,ls.allSchemaProperties)(n.properties),l=(0,ls.allSchemaProperties)(n.patternProperties);d(),t.ok((0,Fe._)`${i} === ${wb.default.errors}`);function d(){e.forIn("key",s,g=>{!u.length&&!l.length?f(g):e.if(y(g),()=>f(g))})}function y(g){let _;if(u.length>8){let b=(0,ds.schemaRefOrVal)(o,n.properties,"properties");_=(0,ls.isOwnProperty)(e,b,g)}else u.length?_=(0,Fe.or)(...u.map(b=>(0,Fe._)`${g} === ${b}`)):_=Fe.nil;return l.length&&(_=(0,Fe.or)(_,...l.map(b=>(0,Fe._)`${(0,ls.usePattern)(t,b)}.test(${g})`))),(0,Fe.not)(_)}function h(g){e.code((0,Fe._)`delete ${s}[${g}]`)}function f(g){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){h(g);return}if(r===!1){t.setParams({additionalProperty:g}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,ds.alwaysValidSchema)(o,r)){let _=e.name("valid");c.removeAdditional==="failing"?(m(g,_,!1),e.if((0,Fe.not)(_),()=>{t.reset(),h(g)})):(m(g,_),a||e.if((0,Fe.not)(_),()=>e.break()))}}function m(g,_,b){let S={keyword:"additionalProperties",dataProp:g,dataPropType:ds.Type.Str};b===!1&&Object.assign(S,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(S,_)}}};Lo.default=$b});var Bl=w(Uo=>{"use strict";Object.defineProperty(Uo,"__esModule",{value:!0});var xb=Gr(),zl=Ce(),Vo=W(),Fl=Mo(),Eb={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:n,data:s,it:i}=t;i.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&Fl.default.code(new xb.KeywordCxt(i,Fl.default,"additionalProperties"));let o=(0,zl.allSchemaProperties)(r);for(let d of o)i.definedProperties.add(d);i.opts.unevaluated&&o.length&&i.props!==!0&&(i.props=Vo.mergeEvaluated.props(e,(0,Vo.toHash)(o),i.props));let a=o.filter(d=>!(0,Vo.alwaysValidSchema)(i,r[d]));if(a.length===0)return;let c=e.name("valid");for(let d of a)u(d)?l(d):(e.if((0,zl.propertyInData)(e,s,d,i.opts.ownProperties)),l(d),i.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(c);function u(d){return i.opts.useDefaults&&!i.compositeRule&&r[d].default!==void 0}function l(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};Uo.default=Eb});var Gl=w(zo=>{"use strict";Object.defineProperty(zo,"__esModule",{value:!0});var Kl=Ce(),fs=z(),Hl=W(),Jl=W(),kb={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:n,parentSchema:s,it:i}=t,{opts:o}=i,a=(0,Kl.allSchemaProperties)(r),c=a.filter(m=>(0,Hl.alwaysValidSchema)(i,r[m]));if(a.length===0||c.length===a.length&&(!i.opts.unevaluated||i.props===!0))return;let u=o.strictSchema&&!o.allowMatchingProperties&&s.properties,l=e.name("valid");i.props!==!0&&!(i.props instanceof fs.Name)&&(i.props=(0,Jl.evaluatedPropsToName)(e,i.props));let{props:d}=i;y();function y(){for(let m of a)u&&h(m),i.allErrors?f(m):(e.var(l,!0),f(m),e.if(l))}function h(m){for(let g in u)new RegExp(m).test(g)&&(0,Hl.checkStrictMode)(i,`property ${g} matches pattern ${m} (use allowMatchingProperties)`)}function f(m){e.forIn("key",n,g=>{e.if((0,fs._)`${(0,Kl.usePattern)(t,m)}.test(${g})`,()=>{let _=c.includes(m);_||t.subschema({keyword:"patternProperties",schemaProp:m,dataProp:g,dataPropType:Jl.Type.Str},l),i.opts.unevaluated&&d!==!0?e.assign((0,fs._)`${d}[${g}]`,!0):!_&&!i.allErrors&&e.if((0,fs.not)(l),()=>e.break())})})}}};zo.default=kb});var Wl=w(Fo=>{"use strict";Object.defineProperty(Fo,"__esModule",{value:!0});var Ob=W(),Tb={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,Ob.alwaysValidSchema)(n,r)){t.fail();return}let s=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},s),t.failResult(s,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};Fo.default=Tb});var Zl=w(Bo=>{"use strict";Object.defineProperty(Bo,"__esModule",{value:!0});var Pb=Ce(),jb={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Pb.validateUnion,error:{message:"must match a schema in anyOf"}};Bo.default=jb});var Yl=w(Ko=>{"use strict";Object.defineProperty(Ko,"__esModule",{value:!0});var ps=z(),Nb=W(),Rb={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,ps._)`{passingSchemas: ${t.passing}}`},Cb={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Rb,code(t){let{gen:e,schema:r,parentSchema:n,it:s}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(s.opts.discriminator&&n.discriminator)return;let i=r,o=e.let("valid",!1),a=e.let("passing",null),c=e.name("_valid");t.setParams({passing:a}),e.block(u),t.result(o,()=>t.reset(),()=>t.error(!0));function u(){i.forEach((l,d)=>{let y;(0,Nb.alwaysValidSchema)(s,l)?e.var(c,!0):y=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&e.if((0,ps._)`${c} && ${o}`).assign(o,!1).assign(a,(0,ps._)`[${a}, ${d}]`).else(),e.if(c,()=>{e.assign(o,!0),e.assign(a,d),y&&t.mergeEvaluated(y,ps.Name)})})}}};Ko.default=Cb});var Xl=w(Ho=>{"use strict";Object.defineProperty(Ho,"__esModule",{value:!0});var Ib=W(),qb={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let s=e.name("valid");r.forEach((i,o)=>{if((0,Ib.alwaysValidSchema)(n,i))return;let a=t.subschema({keyword:"allOf",schemaProp:o},s);t.ok(s),t.mergeEvaluated(a)})}};Ho.default=qb});var td=w(Jo=>{"use strict";Object.defineProperty(Jo,"__esModule",{value:!0});var hs=z(),ed=W(),Ab={message:({params:t})=>(0,hs.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,hs._)`{failingKeyword: ${t.ifClause}}`},Db={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Ab,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,ed.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let s=Ql(n,"then"),i=Ql(n,"else");if(!s&&!i)return;let o=e.let("valid",!0),a=e.name("_valid");if(c(),t.reset(),s&&i){let l=e.let("ifClause");t.setParams({ifClause:l}),e.if(a,u("then",l),u("else",l))}else s?e.if(a,u("then")):e.if((0,hs.not)(a),u("else"));t.pass(o,()=>t.error(!0));function c(){let l=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(l)}function u(l,d){return()=>{let y=t.subschema({keyword:l},a);e.assign(o,a),t.mergeValidEvaluated(y,o),d?e.assign(d,(0,hs._)`${l}`):t.setParams({ifClause:l})}}}};function Ql(t,e){let r=t.schema[e];return r!==void 0&&!(0,ed.alwaysValidSchema)(t,r)}Jo.default=Db});var rd=w(Go=>{"use strict";Object.defineProperty(Go,"__esModule",{value:!0});var Lb=W(),Mb={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,Lb.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};Go.default=Mb});var nd=w(Wo=>{"use strict";Object.defineProperty(Wo,"__esModule",{value:!0});var Vb=No(),Ub=Cl(),zb=Ro(),Fb=ql(),Bb=Al(),Kb=Ml(),Hb=Ul(),Jb=Mo(),Gb=Bl(),Wb=Gl(),Zb=Wl(),Yb=Zl(),Xb=Yl(),Qb=Xl(),ew=td(),tw=rd();function rw(t=!1){let e=[Zb.default,Yb.default,Xb.default,Qb.default,ew.default,tw.default,Hb.default,Jb.default,Kb.default,Gb.default,Wb.default];return t?e.push(Ub.default,Fb.default):e.push(Vb.default,zb.default),e.push(Bb.default),e}Wo.default=rw});var sd=w(Zo=>{"use strict";Object.defineProperty(Zo,"__esModule",{value:!0});var re=z(),nw={message:({schemaCode:t})=>(0,re.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,re._)`{format: ${t}}`},sw={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:nw,code(t,e){let{gen:r,data:n,$data:s,schema:i,schemaCode:o,it:a}=t,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=a;if(!c.validateFormats)return;s?y():h();function y(){let f=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),m=r.const("fDef",(0,re._)`${f}[${o}]`),g=r.let("fType"),_=r.let("format");r.if((0,re._)`typeof ${m} == "object" && !(${m} instanceof RegExp)`,()=>r.assign(g,(0,re._)`${m}.type || "string"`).assign(_,(0,re._)`${m}.validate`),()=>r.assign(g,(0,re._)`"string"`).assign(_,m)),t.fail$data((0,re.or)(b(),S()));function b(){return c.strictSchema===!1?re.nil:(0,re._)`${o} && !${_}`}function S(){let $=l.$async?(0,re._)`(${m}.async ? await ${_}(${n}) : ${_}(${n}))`:(0,re._)`${_}(${n})`,E=(0,re._)`(typeof ${_} == "function" ? ${$} : ${_}.test(${n}))`;return(0,re._)`${_} && ${_} !== true && ${g} === ${e} && !${E}`}}function h(){let f=d.formats[i];if(!f){b();return}if(f===!0)return;let[m,g,_]=S(f);m===e&&t.pass($());function b(){if(c.strictSchema===!1){d.logger.warn(E());return}throw new Error(E());function E(){return`unknown format "${i}" ignored in schema at path "${u}"`}}function S(E){let j=E instanceof RegExp?(0,re.regexpCode)(E):c.code.formats?(0,re._)`${c.code.formats}${(0,re.getProperty)(i)}`:void 0,q=r.scopeValue("formats",{key:i,ref:E,code:j});return typeof E=="object"&&!(E instanceof RegExp)?[E.type||"string",E.validate,(0,re._)`${q}.validate`]:["string",E,q]}function $(){if(typeof f=="object"&&!(f instanceof RegExp)&&f.async){if(!l.$async)throw new Error("async format in sync schema");return(0,re._)`await ${_}(${n})`}return typeof g=="function"?(0,re._)`${_}(${n})`:(0,re._)`${_}.test(${n})`}}}};Zo.default=sw});var id=w(Yo=>{"use strict";Object.defineProperty(Yo,"__esModule",{value:!0});var iw=sd(),ow=[iw.default];Yo.default=ow});var od=w(Sr=>{"use strict";Object.defineProperty(Sr,"__esModule",{value:!0});Sr.contentVocabulary=Sr.metadataVocabulary=void 0;Sr.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Sr.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var cd=w(Xo=>{"use strict";Object.defineProperty(Xo,"__esModule",{value:!0});var aw=ml(),cw=Pl(),uw=nd(),lw=id(),ad=od(),dw=[aw.default,cw.default,(0,uw.default)(),lw.default,ad.metadataVocabulary,ad.contentVocabulary];Xo.default=dw});var ld=w(ms=>{"use strict";Object.defineProperty(ms,"__esModule",{value:!0});ms.DiscrError=void 0;var ud;(function(t){t.Tag="tag",t.Mapping="mapping"})(ud||(ms.DiscrError=ud={}))});var fd=w(ea=>{"use strict";Object.defineProperty(ea,"__esModule",{value:!0});var $r=z(),Qo=ld(),dd=Yn(),fw=Wr(),pw=W(),hw={message:({params:{discrError:t,tagName:e}})=>t===Qo.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,$r._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},mw={keyword:"discriminator",type:"object",schemaType:"object",error:hw,code(t){let{gen:e,data:r,schema:n,parentSchema:s,it:i}=t,{oneOf:o}=s;if(!i.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(!o)throw new Error("discriminator: requires oneOf keyword");let c=e.let("valid",!1),u=e.const("tag",(0,$r._)`${r}${(0,$r.getProperty)(a)}`);e.if((0,$r._)`typeof ${u} == "string"`,()=>l(),()=>t.error(!1,{discrError:Qo.DiscrError.Tag,tag:u,tagName:a})),t.ok(c);function l(){let h=y();e.if(!1);for(let f in h)e.elseIf((0,$r._)`${u} === ${f}`),e.assign(c,d(h[f]));e.else(),t.error(!1,{discrError:Qo.DiscrError.Mapping,tag:u,tagName:a}),e.endIf()}function d(h){let f=e.name("valid"),m=t.subschema({keyword:"oneOf",schemaProp:h},f);return t.mergeEvaluated(m,$r.Name),f}function y(){var h;let f={},m=_(s),g=!0;for(let $=0;$<o.length;$++){let E=o[$];if(E?.$ref&&!(0,pw.schemaHasRulesButRef)(E,i.self.RULES)){let q=E.$ref;if(E=dd.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,q),E instanceof dd.SchemaEnv&&(E=E.schema),E===void 0)throw new fw.default(i.opts.uriResolver,i.baseId,q)}let j=(h=E?.properties)===null||h===void 0?void 0:h[a];if(typeof j!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);g=g&&(m||_(E)),b(j,$)}if(!g)throw new Error(`discriminator: "${a}" must be required`);return f;function _({required:$}){return Array.isArray($)&&$.includes(a)}function b($,E){if($.const)S($.const,E);else if($.enum)for(let j of $.enum)S(j,E);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function S($,E){if(typeof $!="string"||$ in f)throw new Error(`discriminator: "${a}" values must be unique strings`);f[$]=E}}}};ea.default=mw});var pd=w((sT,gw)=>{gw.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 md=w((ee,ta)=>{"use strict";Object.defineProperty(ee,"__esModule",{value:!0});ee.MissingRefError=ee.ValidationError=ee.CodeGen=ee.Name=ee.nil=ee.stringify=ee.str=ee._=ee.KeywordCxt=ee.Ajv=void 0;var yw=ul(),_w=cd(),vw=fd(),hd=pd(),bw=["/properties"],gs="http://json-schema.org/draft-07/schema",xr=class extends yw.default{_addVocabularies(){super._addVocabularies(),_w.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(vw.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(hd,bw):hd;this.addMetaSchema(e,gs,!1),this.refs["http://json-schema.org/schema"]=gs}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(gs)?gs:void 0)}};ee.Ajv=xr;ta.exports=ee=xr;ta.exports.Ajv=xr;Object.defineProperty(ee,"__esModule",{value:!0});ee.default=xr;var ww=Gr();Object.defineProperty(ee,"KeywordCxt",{enumerable:!0,get:function(){return ww.KeywordCxt}});var Er=z();Object.defineProperty(ee,"_",{enumerable:!0,get:function(){return Er._}});Object.defineProperty(ee,"str",{enumerable:!0,get:function(){return Er.str}});Object.defineProperty(ee,"stringify",{enumerable:!0,get:function(){return Er.stringify}});Object.defineProperty(ee,"nil",{enumerable:!0,get:function(){return Er.nil}});Object.defineProperty(ee,"Name",{enumerable:!0,get:function(){return Er.Name}});Object.defineProperty(ee,"CodeGen",{enumerable:!0,get:function(){return Er.CodeGen}});var Sw=Wn();Object.defineProperty(ee,"ValidationError",{enumerable:!0,get:function(){return Sw.default}});var $w=Wr();Object.defineProperty(ee,"MissingRefError",{enumerable:!0,get:function(){return $w.default}})});var wd=w((dP,Iw)=>{Iw.exports={name:"dotenv",version:"16.5.0",description:"Loads environment variables from .env file",main:"lib/main.js",types:"lib/main.d.ts",exports:{".":{types:"./lib/main.d.ts",require:"./lib/main.js",default:"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},scripts:{"dts-check":"tsc --project tests/types/tsconfig.json",lint:"standard",pretest:"npm run lint && npm run dts-check",test:"tap run --allow-empty-coverage --disable-coverage --timeout=60000","test:coverage":"tap run --show-full-coverage --timeout=60000 --coverage-report=lcov",prerelease:"npm test",release:"standard-version"},repository:{type:"git",url:"git://github.com/motdotla/dotenv.git"},homepage:"https://github.com/motdotla/dotenv#readme",funding:"https://dotenvx.com",keywords:["dotenv","env",".env","environment","variables","config","settings"],readmeFilename:"README.md",license:"BSD-2-Clause",devDependencies:{"@types/node":"^18.11.3",decache:"^4.6.2",sinon:"^14.0.1",standard:"^17.0.0","standard-version":"^9.5.0",tap:"^19.2.0",typescript:"^4.8.4"},engines:{node:">=12"},browser:{fs:!1}}});var kd=w((fP,pt)=>{var sa=require("fs"),ia=require("path"),qw=require("os"),Aw=require("crypto"),Dw=wd(),$d=Dw.version,Lw=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function Mw(t){let e={},r=t.toString();r=r.replace(/\r\n?/mg,`
`);let n;for(;(n=Lw.exec(r))!=null;){let s=n[1],i=n[2]||"";i=i.trim();let o=i[0];i=i.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),o==='"'&&(i=i.replace(/\\n/g,`
`),i=i.replace(/\\r/g,"\r")),e[s]=i}return e}function Vw(t){let e=Ed(t),r=oe.configDotenv({path:e});if(!r.parsed){let o=new Error(`MISSING_DATA: Cannot parse ${e} for an unknown reason`);throw o.code="MISSING_DATA",o}let n=xd(t).split(","),s=n.length,i;for(let o=0;o<s;o++)try{let a=n[o].trim(),c=zw(r,a);i=oe.decrypt(c.ciphertext,c.key);break}catch(a){if(o+1>=s)throw a}return oe.parse(i)}function Uw(t){console.log(`[dotenv@${$d}][WARN] ${t}`)}function ln(t){console.log(`[dotenv@${$d}][DEBUG] ${t}`)}function xd(t){return t&&t.DOTENV_KEY&&t.DOTENV_KEY.length>0?t.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function zw(t,e){let r;try{r=new URL(e)}catch(a){if(a.code==="ERR_INVALID_URL"){let c=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw c.code="INVALID_DOTENV_KEY",c}throw a}let n=r.password;if(!n){let a=new Error("INVALID_DOTENV_KEY: Missing key part");throw a.code="INVALID_DOTENV_KEY",a}let s=r.searchParams.get("environment");if(!s){let a=new Error("INVALID_DOTENV_KEY: Missing environment part");throw a.code="INVALID_DOTENV_KEY",a}let i=`DOTENV_VAULT_${s.toUpperCase()}`,o=t.parsed[i];if(!o){let a=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${i} in your .env.vault file.`);throw a.code="NOT_FOUND_DOTENV_ENVIRONMENT",a}return{ciphertext:o,key:n}}function Ed(t){let e=null;if(t&&t.path&&t.path.length>0)if(Array.isArray(t.path))for(let r of t.path)sa.existsSync(r)&&(e=r.endsWith(".vault")?r:`${r}.vault`);else e=t.path.endsWith(".vault")?t.path:`${t.path}.vault`;else e=ia.resolve(process.cwd(),".env.vault");return sa.existsSync(e)?e:null}function Sd(t){return t[0]==="~"?ia.join(qw.homedir(),t.slice(1)):t}function Fw(t){!!(t&&t.debug)&&ln("Loading env from encrypted .env.vault");let r=oe._parseVault(t),n=process.env;return t&&t.processEnv!=null&&(n=t.processEnv),oe.populate(n,r,t),{parsed:r}}function Bw(t){let e=ia.resolve(process.cwd(),".env"),r="utf8",n=!!(t&&t.debug);t&&t.encoding?r=t.encoding:n&&ln("No encoding is specified. UTF-8 is used by default");let s=[e];if(t&&t.path)if(!Array.isArray(t.path))s=[Sd(t.path)];else{s=[];for(let c of t.path)s.push(Sd(c))}let i,o={};for(let c of s)try{let u=oe.parse(sa.readFileSync(c,{encoding:r}));oe.populate(o,u,t)}catch(u){n&&ln(`Failed to load ${c} ${u.message}`),i=u}let a=process.env;return t&&t.processEnv!=null&&(a=t.processEnv),oe.populate(a,o,t),i?{parsed:o,error:i}:{parsed:o}}function Kw(t){if(xd(t).length===0)return oe.configDotenv(t);let e=Ed(t);return e?oe._configVault(t):(Uw(`You set DOTENV_KEY but you are missing a .env.vault file at ${e}. Did you forget to build it?`),oe.configDotenv(t))}function Hw(t,e){let r=Buffer.from(e.slice(-64),"hex"),n=Buffer.from(t,"base64"),s=n.subarray(0,12),i=n.subarray(-16);n=n.subarray(12,-16);try{let o=Aw.createDecipheriv("aes-256-gcm",r,s);return o.setAuthTag(i),`${o.update(n)}${o.final()}`}catch(o){let a=o instanceof RangeError,c=o.message==="Invalid key length",u=o.message==="Unsupported state or unable to authenticate data";if(a||c){let l=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw l.code="INVALID_DOTENV_KEY",l}else if(u){let l=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw l.code="DECRYPTION_FAILED",l}else throw o}}function Jw(t,e,r={}){let n=!!(r&&r.debug),s=!!(r&&r.override);if(typeof e!="object"){let i=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw i.code="OBJECT_REQUIRED",i}for(let i of Object.keys(e))Object.prototype.hasOwnProperty.call(t,i)?(s===!0&&(t[i]=e[i]),n&&ln(s===!0?`"${i}" is already defined and WAS overwritten`:`"${i}" is already defined and was NOT overwritten`)):t[i]=e[i]}var oe={configDotenv:Bw,_configVault:Fw,_parseVault:Vw,config:Kw,decrypt:Hw,parse:Mw,populate:Jw};pt.exports.configDotenv=oe.configDotenv;pt.exports._configVault=oe._configVault;pt.exports._parseVault=oe._parseVault;pt.exports.config=oe.config;pt.exports.decrypt=oe.decrypt;pt.exports.parse=oe.parse;pt.exports.populate=oe.populate;pt.exports=oe});var Pd=w((pP,Td)=>{"use strict";var Gw=require("util");function Od(t,e,r,n,s){let i=`The following variables were defined in ${r} but are not present in the environment:
  ${n.join(", ")}
Make sure to add them to ${e} or directly to the environment.`,o=t?"":`If you expect any of these variables to be empty, you can use the allowEmptyValues option:
require('dotenv-safe').config({
  allowEmptyValues: true
});`,a=s?`Also, the following error was thrown when trying to read variables from  ${e}:
${s.message}`:"";Error.call(this),this.name=this.constructor.name,this.missing=n,this.example=this.sample=r,this.message=[i,o,a].filter(Boolean).join(`

`),Error.captureStackTrace(this,this.constructor)}Gw.inherits(Od,Error);Td.exports=Od});var jd=w((hP,ca)=>{"use strict";var oa=kd(),Ww=require("fs"),aa=Pd();function Zw(t,e){return t.filter(r=>e.indexOf(r)<0)}function Yw(t){let e={};return Object.keys(t).forEach(r=>{t[r]&&(e[r]=t[r])}),e}ca.exports={config:function(t={}){let e=oa.config(t),r=t.example||t.sample||".env.example",n=t.allowEmptyValues||!1,s=n?process.env:Yw(process.env),i=oa.parse(Ww.readFileSync(r)),o=Zw(Object.keys(i),Object.keys(s));if(o.length>0)throw new aa(n,t.path||".env",r,o,e.error);let a=Object.keys(i).reduce((l,d)=>(l[d]=process.env[d],l),{}),c=e.error?{error:e.error}:{},u={parsed:e.error?{}:e.parsed,required:a};return Object.assign(u,c)},parse:oa.parse,MissingEnvVarsError:aa};ca.exports.MissingEnvVarsError=aa});var la=w((gP,qd)=>{"use strict";var dn=t=>t&&typeof t.message=="string",ua=t=>{if(!t)return;let e=t.cause;if(typeof e=="function"){let r=t.cause();return dn(r)?r:void 0}else return dn(e)?e:void 0},Cd=(t,e)=>{if(!dn(t))return"";let r=t.stack||"";if(e.has(t))return r+`
causes have become circular...`;let n=ua(t);return n?(e.add(t),r+`
caused by: `+Cd(n,e)):r},Xw=t=>Cd(t,new Set),Id=(t,e,r)=>{if(!dn(t))return"";let n=r?"":t.message||"";if(e.has(t))return n+": ...";let s=ua(t);if(s){e.add(t);let i=typeof t.cause=="function";return n+(i?"":": ")+Id(s,e,i)}else return n},Qw=t=>Id(t,new Set);qd.exports={isErrorLike:dn,getErrorCause:ua,stackWithCauses:Xw,messageWithCauses:Qw}});var da=w((yP,Dd)=>{"use strict";var e0=Symbol("circular-ref-tag"),Fs=Symbol("pino-raw-err-ref"),Ad=Object.create({},{type:{enumerable:!0,writable:!0,value:void 0},message:{enumerable:!0,writable:!0,value:void 0},stack:{enumerable:!0,writable:!0,value:void 0},aggregateErrors:{enumerable:!0,writable:!0,value:void 0},raw:{enumerable:!1,get:function(){return this[Fs]},set:function(t){this[Fs]=t}}});Object.defineProperty(Ad,Fs,{writable:!0,value:{}});Dd.exports={pinoErrProto:Ad,pinoErrorSymbols:{seen:e0,rawSymbol:Fs}}});var Vd=w((_P,Md)=>{"use strict";Md.exports=pa;var{messageWithCauses:t0,stackWithCauses:r0,isErrorLike:Ld}=la(),{pinoErrProto:n0,pinoErrorSymbols:s0}=da(),{seen:fa}=s0,{toString:i0}=Object.prototype;function pa(t){if(!Ld(t))return t;t[fa]=void 0;let e=Object.create(n0);e.type=i0.call(t.constructor)==="[object Function]"?t.constructor.name:t.name,e.message=t0(t),e.stack=r0(t),Array.isArray(t.errors)&&(e.aggregateErrors=t.errors.map(r=>pa(r)));for(let r in t)if(e[r]===void 0){let n=t[r];Ld(n)?r!=="cause"&&!Object.prototype.hasOwnProperty.call(n,fa)&&(e[r]=pa(n)):e[r]=n}return delete t[fa],e.raw=t,e}});var zd=w((vP,Ud)=>{"use strict";Ud.exports=Ks;var{isErrorLike:ha}=la(),{pinoErrProto:o0,pinoErrorSymbols:a0}=da(),{seen:Bs}=a0,{toString:c0}=Object.prototype;function Ks(t){if(!ha(t))return t;t[Bs]=void 0;let e=Object.create(o0);e.type=c0.call(t.constructor)==="[object Function]"?t.constructor.name:t.name,e.message=t.message,e.stack=t.stack,Array.isArray(t.errors)&&(e.aggregateErrors=t.errors.map(r=>Ks(r))),ha(t.cause)&&!Object.prototype.hasOwnProperty.call(t.cause,Bs)&&(e.cause=Ks(t.cause));for(let r in t)if(e[r]===void 0){let n=t[r];ha(n)?Object.prototype.hasOwnProperty.call(n,Bs)||(e[r]=Ks(n)):e[r]=n}return delete t[Bs],e.raw=t,e}});var Hd=w((bP,Kd)=>{"use strict";Kd.exports={mapHttpRequest:u0,reqSerializer:Bd};var ma=Symbol("pino-raw-req-ref"),Fd=Object.create({},{id:{enumerable:!0,writable:!0,value:""},method:{enumerable:!0,writable:!0,value:""},url:{enumerable:!0,writable:!0,value:""},query:{enumerable:!0,writable:!0,value:""},params:{enumerable:!0,writable:!0,value:""},headers:{enumerable:!0,writable:!0,value:{}},remoteAddress:{enumerable:!0,writable:!0,value:""},remotePort:{enumerable:!0,writable:!0,value:""},raw:{enumerable:!1,get:function(){return this[ma]},set:function(t){this[ma]=t}}});Object.defineProperty(Fd,ma,{writable:!0,value:{}});function Bd(t){let e=t.info||t.socket,r=Object.create(Fd);if(r.id=typeof t.id=="function"?t.id():t.id||(t.info?t.info.id:void 0),r.method=t.method,t.originalUrl)r.url=t.originalUrl;else{let n=t.path;r.url=typeof n=="string"?n:t.url?t.url.path||t.url:void 0}return t.query&&(r.query=t.query),t.params&&(r.params=t.params),r.headers=t.headers,r.remoteAddress=e&&e.remoteAddress,r.remotePort=e&&e.remotePort,r.raw=t.raw||t,r}function u0(t){return{req:Bd(t)}}});var Zd=w((wP,Wd)=>{"use strict";Wd.exports={mapHttpResponse:l0,resSerializer:Gd};var ga=Symbol("pino-raw-res-ref"),Jd=Object.create({},{statusCode:{enumerable:!0,writable:!0,value:0},headers:{enumerable:!0,writable:!0,value:""},raw:{enumerable:!1,get:function(){return this[ga]},set:function(t){this[ga]=t}}});Object.defineProperty(Jd,ga,{writable:!0,value:{}});function Gd(t){let e=Object.create(Jd);return e.statusCode=t.headersSent?t.statusCode:null,e.headers=t.getHeaders?t.getHeaders():t._headers,e.raw=t,e}function l0(t){return{res:Gd(t)}}});var _a=w((SP,Yd)=>{"use strict";var ya=Vd(),d0=zd(),Hs=Hd(),Js=Zd();Yd.exports={err:ya,errWithCause:d0,mapHttpRequest:Hs.mapHttpRequest,mapHttpResponse:Js.mapHttpResponse,req:Hs.reqSerializer,res:Js.resSerializer,wrapErrorSerializer:function(e){return e===ya?e:function(n){return e(ya(n))}},wrapRequestSerializer:function(e){return e===Hs.reqSerializer?e:function(n){return e(Hs.reqSerializer(n))}},wrapResponseSerializer:function(e){return e===Js.resSerializer?e:function(n){return e(Js.resSerializer(n))}}}});var va=w(($P,Xd)=>{"use strict";function f0(t,e){return e}Xd.exports=function(){let e=Error.prepareStackTrace;Error.prepareStackTrace=f0;let r=new Error().stack;if(Error.prepareStackTrace=e,!Array.isArray(r))return;let n=r.slice(2),s=[];for(let i of n)i&&s.push(i.getFileName());return s}});var ef=w((xP,Qd)=>{"use strict";Qd.exports=p0;function p0(t={}){let{ERR_PATHS_MUST_BE_STRINGS:e=()=>"fast-redact - Paths must be (non-empty) strings",ERR_INVALID_PATH:r=n=>`fast-redact \u2013 Invalid path (${n})`}=t;return function({paths:s}){s.forEach(i=>{if(typeof i!="string")throw Error(e());try{if(/〇/.test(i))throw Error();let o=(i[0]==="["?"":".")+i.replace(/^\*/,"\u3007").replace(/\.\*/g,".\u3007").replace(/\[\*\]/g,"[\u3007]");if(/\n|\r|;/.test(o)||/\/\*/.test(o))throw Error();Function(`
            'use strict'
            const o = new Proxy({}, { get: () => o, set: () => { throw Error() } });
            const \u3007 = null;
            o${o}
            if ([o${o}].length !== 1) throw Error()`)()}catch{throw Error(r(i))}})}}});var Gs=w((EP,tf)=>{"use strict";tf.exports=/[^.[\]]+|\[((?:.)*?)\]/g});var nf=w((kP,rf)=>{"use strict";var h0=Gs();rf.exports=m0;function m0({paths:t}){let e=[];var r=0;let n=t.reduce(function(s,i,o){var a=i.match(h0).map(l=>l.replace(/'|"|`/g,""));let c=i[0]==="[";a=a.map(l=>l[0]==="["?l.substr(1,l.length-2):l);let u=a.indexOf("*");if(u>-1){let l=a.slice(0,u),d=l.join("."),y=a.slice(u+1,a.length),h=y.length>0;r++,e.push({before:l,beforeStr:d,after:y,nested:h})}else s[i]={path:a,val:void 0,precensored:!1,circle:"",escPath:JSON.stringify(i),leadingBracket:c};return s},{});return{wildcards:e,wcLen:r,secret:n}}});var of=w((OP,sf)=>{"use strict";var g0=Gs();sf.exports=y0;function y0({secret:t,serialize:e,wcLen:r,strict:n,isCensorFct:s,censorFctTakesPath:i},o){let a=Function("o",`
    if (typeof o !== 'object' || o == null) {
      ${w0(n,e)}
    }
    const { censor, secret } = this
    const originalSecret = {}
    const secretKeys = Object.keys(secret)
    for (var i = 0; i < secretKeys.length; i++) {
      originalSecret[secretKeys[i]] = secret[secretKeys[i]]
    }

    ${_0(t,s,i)}
    this.compileRestore()
    ${v0(r>0,s,i)}
    this.secret = originalSecret
    ${b0(e)}
  `).bind(o);return a.state=o,e===!1&&(a.restore=c=>o.restore(c)),a}function _0(t,e,r){return Object.keys(t).map(n=>{let{escPath:s,leadingBracket:i,path:o}=t[n],a=i?1:0,c=i?"":".",u=[];for(var l;(l=g0.exec(n))!==null;){let[,f]=l,{index:m,input:g}=l;m>a&&u.push(g.substring(0,m-(f?0:1)))}var d=u.map(f=>`o${c}${f}`).join(" && ");d.length===0?d+=`o${c}${n} != null`:d+=` && o${c}${n} != null`;let y=`
      switch (true) {
        ${u.reverse().map(f=>`
          case o${c}${f} === censor:
            secret[${s}].circle = ${JSON.stringify(f)}
            break
        `).join(`
`)}
      }
    `,h=r?`val, ${JSON.stringify(o)}`:"val";return`
      if (${d}) {
        const val = o${c}${n}
        if (val === censor) {
          secret[${s}].precensored = true
        } else {
          secret[${s}].val = val
          o${c}${n} = ${e?`censor(${h})`:"censor"}
          ${y}
        }
      }
    `}).join(`
`)}function v0(t,e,r){return t===!0?`
    {
      const { wildcards, wcLen, groupRedact, nestedRedact } = this
      for (var i = 0; i < wcLen; i++) {
        const { before, beforeStr, after, nested } = wildcards[i]
        if (nested === true) {
          secret[beforeStr] = secret[beforeStr] || []
          nestedRedact(secret[beforeStr], o, before, after, censor, ${e}, ${r})
        } else secret[beforeStr] = groupRedact(o, before, censor, ${e}, ${r})
      }
    }
  `:""}function b0(t){return t===!1?"return o":`
    var s = this.serialize(o)
    this.restore(o)
    return s
  `}function w0(t,e){return t===!0?"throw Error('fast-redact: primitives cannot be redacted')":e===!1?"return o":"return this.serialize(o)"}});var wa=w((TP,uf)=>{"use strict";uf.exports={groupRedact:$0,groupRestore:S0,nestedRedact:E0,nestedRestore:x0};function S0({keys:t,values:e,target:r}){if(r==null||typeof r=="string")return;let n=t.length;for(var s=0;s<n;s++){let i=t[s];r[i]=e[s]}}function $0(t,e,r,n,s){let i=af(t,e);if(i==null||typeof i=="string")return{keys:null,values:null,target:i,flat:!0};let o=Object.keys(i),a=o.length,c=e.length,u=s?[...e]:void 0,l=new Array(a);for(var d=0;d<a;d++){let y=o[d];l[d]=i[y],s?(u[c]=y,i[y]=r(i[y],u)):n?i[y]=r(i[y]):i[y]=r}return{keys:o,values:l,target:i,flat:!0}}function x0(t){for(let e=0;e<t.length;e++){let{target:r,path:n,value:s}=t[e],i=r;for(let o=n.length-1;o>0;o--)i=i[n[o]];i[n[0]]=s}}function E0(t,e,r,n,s,i,o){let a=af(e,r);if(a==null)return;let c=Object.keys(a),u=c.length;for(var l=0;l<u;l++){let d=c[l];k0(t,a,d,r,n,s,i,o)}return t}function ba(t,e){return t!=null?"hasOwn"in Object?Object.hasOwn(t,e):Object.prototype.hasOwnProperty.call(t,e):!1}function k0(t,e,r,n,s,i,o,a){let c=s.length,u=c-1,l=r;var d=-1,y,h,f,m=null,g=null,_,b,S=!1,$=0,E=0,j=O0();if(f=y=e[r],typeof y=="object"){for(;y!=null&&++d<c&&(E+=1,r=s[d],m=f,!(r!=="*"&&!g&&!(typeof y=="object"&&r in y)));)if(!(r==="*"&&(g==="*"&&(S=!0),g=r,d!==u))){if(g){let K=Object.keys(y);for(var q=0;q<K.length;q++){let R=K[q];if(b=y[R],_=r==="*",S)j=ht(j,R,E),$=d,f=cf(b,$-1,r,n,s,i,o,a,l,y,h,f,_,R,d,u,j,t,e[l],E+1);else if(_||typeof b=="object"&&b!==null&&r in b){if(_?f=b:f=b[r],h=d!==u?f:o?a?i(f,[...n,l,...s]):i(f):i,_){let Z=fn(ht(j,R,E),f,e[l]);t.push(Z),y[R]=h}else if(b[r]!==h)if(h===void 0&&i!==void 0||ba(b,r)&&h===f)j=ht(j,R,E);else{j=ht(j,R,E);let Z=fn(ht(j,r,E+1),f,e[l]);t.push(Z),b[r]=h}}}g=null}else{if(f=y[r],j=ht(j,r,E),h=d!==u?f:o?a?i(f,[...n,l,...s]):i(f):i,!(ba(y,r)&&h===f||h===void 0&&i!==void 0)){let K=fn(j,f,e[l]);t.push(K),y[r]=h}y=y[r]}if(typeof y!="object")break}}}function af(t,e){for(var r=-1,n=e.length,s=t;s!=null&&++r<n;)s=s[e[r]];return s}function cf(t,e,r,n,s,i,o,a,c,u,l,d,y,h,f,m,g,_,b,S){if(e===0&&(y||typeof t=="object"&&t!==null&&r in t)){if(y?d=t:d=t[r],l=f!==m?d:o?a?i(d,[...n,c,...s]):i(d):i,y){let $=fn(g,d,b);_.push($),u[h]=l}else if(t[r]!==l){if(!(l===void 0&&i!==void 0||ba(t,r)&&l===d)){let $=fn(ht(g,r,S+1),d,b);_.push($),t[r]=l}}}for(let $ in t)typeof t[$]=="object"&&(g=ht(g,$,S),cf(t[$],e-1,r,n,s,i,o,a,c,u,l,d,y,h,f,m,g,_,b,S+1))}function O0(){return{parent:null,key:null,children:[],depth:0}}function ht(t,e,r){if(t.depth===r)return ht(t.parent,e,r);var n={parent:t,key:e,depth:r,children:[]};return t.children.push(n),n}function fn(t,e,r){let n=t,s=[];do s.push(n.key),n=n.parent;while(n.parent!=null);return{path:s,value:e,target:r}}});var df=w((PP,lf)=>{"use strict";var{groupRestore:T0,nestedRestore:P0}=wa();lf.exports=j0;function j0(){return function(){if(this.restore){this.restore.state.secret=this.secret;return}let{secret:e,wcLen:r}=this,n=Object.keys(e),s=N0(e,n),i=r>0,o=i?{secret:e,groupRestore:T0,nestedRestore:P0}:{secret:e};this.restore=Function("o",R0(s,n,i)).bind(o),this.restore.state=o}}function N0(t,e){return e.map(r=>{let{circle:n,escPath:s,leadingBracket:i}=t[r],a=n?`o.${n} = secret[${s}].val`:`o${i?"":"."}${r} = secret[${s}].val`,c=`secret[${s}].val = undefined`;return`
      if (secret[${s}].val !== undefined) {
        try { ${a} } catch (e) {}
        ${c}
      }
    `}).join("")}function R0(t,e,r){return`
    const secret = this.secret
    ${r===!0?`
    const keys = Object.keys(secret)
    const len = keys.length
    for (var i = len - 1; i >= ${e.length}; i--) {
      const k = keys[i]
      const o = secret[k]
      if (o) {
        if (o.flat === true) this.groupRestore(o)
        else this.nestedRestore(o)
        secret[k] = null
      }
    }
  `:""}
    ${t}
    return o
  `}});var pf=w((jP,ff)=>{"use strict";ff.exports=C0;function C0(t){let{secret:e,censor:r,compileRestore:n,serialize:s,groupRedact:i,nestedRedact:o,wildcards:a,wcLen:c}=t,u=[{secret:e,censor:r,compileRestore:n}];return s!==!1&&u.push({serialize:s}),c>0&&u.push({groupRedact:i,nestedRedact:o,wildcards:a,wcLen:c}),Object.assign(...u)}});var gf=w((NP,mf)=>{"use strict";var hf=ef(),I0=nf(),q0=of(),A0=df(),{groupRedact:D0,nestedRedact:L0}=wa(),M0=pf(),V0=Gs(),U0=hf(),Sa=t=>t;Sa.restore=Sa;var z0="[REDACTED]";$a.rx=V0;$a.validator=hf;mf.exports=$a;function $a(t={}){let e=Array.from(new Set(t.paths||[])),r="serialize"in t&&(t.serialize===!1||typeof t.serialize=="function")?t.serialize:JSON.stringify,n=t.remove;if(n===!0&&r!==JSON.stringify)throw Error("fast-redact \u2013 remove option may only be set when serializer is JSON.stringify");let s=n===!0?void 0:"censor"in t?t.censor:z0,i=typeof s=="function",o=i&&s.length>1;if(e.length===0)return r||Sa;U0({paths:e,serialize:r,censor:s});let{wildcards:a,wcLen:c,secret:u}=I0({paths:e,censor:s}),l=A0(),d="strict"in t?t.strict:!0;return q0({secret:u,wcLen:c,serialize:r,strict:d,isCensorFct:i,censorFctTakesPath:o},M0({secret:u,censor:s,compileRestore:l,serialize:r,groupRedact:D0,nestedRedact:L0,wildcards:a,wcLen:c}))}});var Or=w((RP,yf)=>{"use strict";var F0=Symbol("pino.setLevel"),B0=Symbol("pino.getLevel"),K0=Symbol("pino.levelVal"),H0=Symbol("pino.levelComp"),J0=Symbol("pino.useLevelLabels"),G0=Symbol("pino.useOnlyCustomLevels"),W0=Symbol("pino.mixin"),Z0=Symbol("pino.lsCache"),Y0=Symbol("pino.chindings"),X0=Symbol("pino.asJson"),Q0=Symbol("pino.write"),eS=Symbol("pino.redactFmt"),tS=Symbol("pino.time"),rS=Symbol("pino.timeSliceIndex"),nS=Symbol("pino.stream"),sS=Symbol("pino.stringify"),iS=Symbol("pino.stringifySafe"),oS=Symbol("pino.stringifiers"),aS=Symbol("pino.end"),cS=Symbol("pino.formatOpts"),uS=Symbol("pino.messageKey"),lS=Symbol("pino.errorKey"),dS=Symbol("pino.nestedKey"),fS=Symbol("pino.nestedKeyStr"),pS=Symbol("pino.mixinMergeStrategy"),hS=Symbol("pino.msgPrefix"),mS=Symbol("pino.wildcardFirst"),gS=Symbol.for("pino.serializers"),yS=Symbol.for("pino.formatters"),_S=Symbol.for("pino.hooks"),vS=Symbol.for("pino.metadata");yf.exports={setLevelSym:F0,getLevelSym:B0,levelValSym:K0,levelCompSym:H0,useLevelLabelsSym:J0,mixinSym:W0,lsCacheSym:Z0,chindingsSym:Y0,asJsonSym:X0,writeSym:Q0,serializersSym:gS,redactFmtSym:eS,timeSym:tS,timeSliceIndexSym:rS,streamSym:nS,stringifySym:sS,stringifySafeSym:iS,stringifiersSym:oS,endSym:aS,formatOptsSym:cS,messageKeySym:uS,errorKeySym:lS,nestedKeySym:dS,wildcardFirstSym:mS,needsMetadataGsym:vS,useOnlyCustomLevelsSym:G0,formattersSym:yS,hooksSym:_S,nestedKeyStrSym:fS,mixinMergeStrategySym:pS,msgPrefixSym:hS}});var ka=w((CP,wf)=>{"use strict";var Ea=gf(),{redactFmtSym:bS,wildcardFirstSym:Ws}=Or(),{rx:xa,validator:wS}=Ea,_f=wS({ERR_PATHS_MUST_BE_STRINGS:()=>"pino \u2013 redacted paths must be strings",ERR_INVALID_PATH:t=>`pino \u2013 redact paths array contains an invalid path (${t})`}),vf="[Redacted]",bf=!1;function SS(t,e){let{paths:r,censor:n}=$S(t),s=r.reduce((a,c)=>{xa.lastIndex=0;let u=xa.exec(c),l=xa.exec(c),d=u[1]!==void 0?u[1].replace(/^(?:"|'|`)(.*)(?:"|'|`)$/,"$1"):u[0];if(d==="*"&&(d=Ws),l===null)return a[d]=null,a;if(a[d]===null)return a;let{index:y}=l,h=`${c.substr(y,c.length-1)}`;return a[d]=a[d]||[],d!==Ws&&a[d].length===0&&a[d].push(...a[Ws]||[]),d===Ws&&Object.keys(a).forEach(function(f){a[f]&&a[f].push(h)}),a[d].push(h),a},{}),i={[bS]:Ea({paths:r,censor:n,serialize:e,strict:bf})},o=(...a)=>e(typeof n=="function"?n(...a):n);return[...Object.keys(s),...Object.getOwnPropertySymbols(s)].reduce((a,c)=>{if(s[c]===null)a[c]=u=>o(u,[c]);else{let u=typeof n=="function"?(l,d)=>n(l,[c,...d]):n;a[c]=Ea({paths:s[c],censor:u,serialize:e,strict:bf})}return a},i)}function $S(t){if(Array.isArray(t))return t={paths:t,censor:vf},_f(t),t;let{paths:e,censor:r=vf,remove:n}=t;if(Array.isArray(e)===!1)throw Error("pino \u2013 redact must contain an array of strings");return n===!0&&(r=void 0),_f({paths:e,censor:r}),{paths:e,censor:r}}wf.exports=SS});var $f=w((IP,Sf)=>{"use strict";var xS=()=>"",ES=()=>`,"time":${Date.now()}`,kS=()=>`,"time":${Math.round(Date.now()/1e3)}`,OS=()=>`,"time":"${new Date(Date.now()).toISOString()}"`;Sf.exports={nullTime:xS,epochTime:ES,unixTime:kS,isoTime:OS}});var Ef=w((qP,xf)=>{"use strict";function TS(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}xf.exports=PS;function PS(t,e,r){var n=r&&r.stringify||TS,s=1;if(typeof t=="object"&&t!==null){var i=e.length+s;if(i===1)return t;var o=new Array(i);o[0]=n(t);for(var a=1;a<i;a++)o[a]=n(e[a]);return o.join(" ")}if(typeof t!="string")return t;var c=e.length;if(c===0)return t;for(var u="",l=1-s,d=-1,y=t&&t.length||0,h=0;h<y;){if(t.charCodeAt(h)===37&&h+1<y){switch(d=d>-1?d:0,t.charCodeAt(h+1)){case 100:case 102:if(l>=c||e[l]==null)break;d<h&&(u+=t.slice(d,h)),u+=Number(e[l]),d=h+2,h++;break;case 105:if(l>=c||e[l]==null)break;d<h&&(u+=t.slice(d,h)),u+=Math.floor(Number(e[l])),d=h+2,h++;break;case 79:case 111:case 106:if(l>=c||e[l]===void 0)break;d<h&&(u+=t.slice(d,h));var f=typeof e[l];if(f==="string"){u+="'"+e[l]+"'",d=h+2,h++;break}if(f==="function"){u+=e[l].name||"<anonymous>",d=h+2,h++;break}u+=n(e[l]),d=h+2,h++;break;case 115:if(l>=c)break;d<h&&(u+=t.slice(d,h)),u+=String(e[l]),d=h+2,h++;break;case 37:d<h&&(u+=t.slice(d,h)),u+="%",d=h+2,h++,l--;break}++l}++h}return d===-1?t:(d<y&&(u+=t.slice(d)),u)}});var Ta=w((AP,Oa)=>{"use strict";if(typeof SharedArrayBuffer<"u"&&typeof Atomics<"u"){let e=function(r){if((r>0&&r<1/0)===!1)throw typeof r!="number"&&typeof r!="bigint"?TypeError("sleep: ms must be a number"):RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity");Atomics.wait(t,0,0,Number(r))},t=new Int32Array(new SharedArrayBuffer(4));Oa.exports=e}else{let t=function(e){if((e>0&&e<1/0)===!1)throw typeof e!="number"&&typeof e!="bigint"?TypeError("sleep: ms must be a number"):RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity");let n=Date.now()+Number(e);for(;n>Date.now(););};Oa.exports=t}});var Cf=w((DP,Rf)=>{"use strict";var ne=require("fs"),jS=require("events"),NS=require("util").inherits,kf=require("path"),ja=Ta(),RS=require("assert"),Zs=100,Ys=Buffer.allocUnsafe(0),CS=16*1024,Of="buffer",Tf="utf8",[IS,qS]=(process.versions.node||"0.0").split(".").map(Number),AS=IS>=22&&qS>=7;function Pf(t,e){e._opening=!0,e._writing=!0,e._asyncDrainScheduled=!1;function r(i,o){if(i){e._reopening=!1,e._writing=!1,e._opening=!1,e.sync?process.nextTick(()=>{e.listenerCount("error")>0&&e.emit("error",i)}):e.emit("error",i);return}let a=e._reopening;e.fd=o,e.file=t,e._reopening=!1,e._opening=!1,e._writing=!1,e.sync?process.nextTick(()=>e.emit("ready")):e.emit("ready"),!e.destroyed&&(!e._writing&&e._len>e.minLength||e._flushPending?e._actualWrite():a&&process.nextTick(()=>e.emit("drain")))}let n=e.append?"a":"w",s=e.mode;if(e.sync)try{e.mkdir&&ne.mkdirSync(kf.dirname(t),{recursive:!0});let i=ne.openSync(t,n,s);r(null,i)}catch(i){throw r(i),i}else e.mkdir?ne.mkdir(kf.dirname(t),{recursive:!0},i=>{if(i)return r(i);ne.open(t,n,s,r)}):ne.open(t,n,s,r)}function Be(t){if(!(this instanceof Be))return new Be(t);let{fd:e,dest:r,minLength:n,maxLength:s,maxWrite:i,periodicFlush:o,sync:a,append:c=!0,mkdir:u,retryEAGAIN:l,fsync:d,contentMode:y,mode:h}=t||{};e=e||r,this._len=0,this.fd=-1,this._bufs=[],this._lens=[],this._writing=!1,this._ending=!1,this._reopening=!1,this._asyncDrainScheduled=!1,this._flushPending=!1,this._hwm=Math.max(n||0,16387),this.file=null,this.destroyed=!1,this.minLength=n||0,this.maxLength=s||0,this.maxWrite=i||CS,this._periodicFlush=o||0,this._periodicFlushTimer=void 0,this.sync=a||!1,this.writable=!0,this._fsync=d||!1,this.append=c||!1,this.mode=h,this.retryEAGAIN=l||(()=>!0),this.mkdir=u||!1;let f,m;if(y===Of)this._writingBuf=Ys,this.write=MS,this.flush=US,this.flushSync=FS,this._actualWrite=KS,f=()=>ne.writeSync(this.fd,this._writingBuf),m=()=>ne.write(this.fd,this._writingBuf,this.release);else if(y===void 0||y===Tf)this._writingBuf="",this.write=LS,this.flush=VS,this.flushSync=zS,this._actualWrite=BS,f=()=>ne.writeSync(this.fd,this._writingBuf,"utf8"),m=()=>ne.write(this.fd,this._writingBuf,"utf8",this.release);else throw new Error(`SonicBoom supports "${Tf}" and "${Of}", but passed ${y}`);if(typeof e=="number")this.fd=e,process.nextTick(()=>this.emit("ready"));else if(typeof e=="string")Pf(e,this);else throw new Error("SonicBoom supports only file descriptors and files");if(this.minLength>=this.maxWrite)throw new Error(`minLength should be smaller than maxWrite (${this.maxWrite})`);this.release=(g,_)=>{if(g){if((g.code==="EAGAIN"||g.code==="EBUSY")&&this.retryEAGAIN(g,this._writingBuf.length,this._len-this._writingBuf.length))if(this.sync)try{ja(Zs),this.release(void 0,0)}catch($){this.release($)}else setTimeout(m,Zs);else this._writing=!1,this.emit("error",g);return}this.emit("write",_);let b=Pa(this._writingBuf,this._len,_);if(this._len=b.len,this._writingBuf=b.writingBuf,this._writingBuf.length){if(!this.sync){m();return}try{do{let $=f(),E=Pa(this._writingBuf,this._len,$);this._len=E.len,this._writingBuf=E.writingBuf}while(this._writingBuf.length)}catch($){this.release($);return}}this._fsync&&ne.fsyncSync(this.fd);let S=this._len;this._reopening?(this._writing=!1,this._reopening=!1,this.reopen()):S>this.minLength?this._actualWrite():this._ending?S>0?this._actualWrite():(this._writing=!1,Xs(this)):(this._writing=!1,this.sync?this._asyncDrainScheduled||(this._asyncDrainScheduled=!0,process.nextTick(DS,this)):this.emit("drain"))},this.on("newListener",function(g){g==="drain"&&(this._asyncDrainScheduled=!1)}),this._periodicFlush!==0&&(this._periodicFlushTimer=setInterval(()=>this.flush(null),this._periodicFlush),this._periodicFlushTimer.unref())}function Pa(t,e,r){return typeof t=="string"&&Buffer.byteLength(t)!==r&&(r=Buffer.from(t).subarray(0,r).toString().length),e=Math.max(e-r,0),t=t.slice(r),{writingBuf:t,len:e}}function DS(t){t.listenerCount("drain")>0&&(t._asyncDrainScheduled=!1,t.emit("drain"))}NS(Be,jS);function jf(t,e){return t.length===0?Ys:t.length===1?t[0]:Buffer.concat(t,e)}function LS(t){if(this.destroyed)throw new Error("SonicBoom destroyed");let e=this._len+t.length,r=this._bufs;return this.maxLength&&e>this.maxLength?(this.emit("drop",t),this._len<this._hwm):(r.length===0||r[r.length-1].length+t.length>this.maxWrite?r.push(""+t):r[r.length-1]+=t,this._len=e,!this._writing&&this._len>=this.minLength&&this._actualWrite(),this._len<this._hwm)}function MS(t){if(this.destroyed)throw new Error("SonicBoom destroyed");let e=this._len+t.length,r=this._bufs,n=this._lens;return this.maxLength&&e>this.maxLength?(this.emit("drop",t),this._len<this._hwm):(r.length===0||n[n.length-1]+t.length>this.maxWrite?(r.push([t]),n.push(t.length)):(r[r.length-1].push(t),n[n.length-1]+=t.length),this._len=e,!this._writing&&this._len>=this.minLength&&this._actualWrite(),this._len<this._hwm)}function Nf(t){this._flushPending=!0;let e=()=>{if(this._fsync)this._flushPending=!1,t();else try{ne.fsync(this.fd,n=>{this._flushPending=!1,t(n)})}catch(n){t(n)}this.off("error",r)},r=n=>{this._flushPending=!1,t(n),this.off("drain",e)};this.once("drain",e),this.once("error",r)}function VS(t){if(t!=null&&typeof t!="function")throw new Error("flush cb must be a function");if(this.destroyed){let e=new Error("SonicBoom destroyed");if(t){t(e);return}throw e}if(this.minLength<=0){t?.();return}t&&Nf.call(this,t),!this._writing&&(this._bufs.length===0&&this._bufs.push(""),this._actualWrite())}function US(t){if(t!=null&&typeof t!="function")throw new Error("flush cb must be a function");if(this.destroyed){let e=new Error("SonicBoom destroyed");if(t){t(e);return}throw e}if(this.minLength<=0){t?.();return}t&&Nf.call(this,t),!this._writing&&(this._bufs.length===0&&(this._bufs.push([]),this._lens.push(0)),this._actualWrite())}Be.prototype.reopen=function(t){if(this.destroyed)throw new Error("SonicBoom destroyed");if(this._opening){this.once("ready",()=>{this.reopen(t)});return}if(this._ending)return;if(!this.file)throw new Error("Unable to reopen a file descriptor, you must pass a file to SonicBoom");if(t&&(this.file=t),this._reopening=!0,this._writing)return;let e=this.fd;this.once("ready",()=>{e!==this.fd&&ne.close(e,r=>{if(r)return this.emit("error",r)})}),Pf(this.file,this)};Be.prototype.end=function(){if(this.destroyed)throw new Error("SonicBoom destroyed");if(this._opening){this.once("ready",()=>{this.end()});return}this._ending||(this._ending=!0,!this._writing&&(this._len>0&&this.fd>=0?this._actualWrite():Xs(this)))};function zS(){if(this.destroyed)throw new Error("SonicBoom destroyed");if(this.fd<0)throw new Error("sonic boom is not ready yet");!this._writing&&this._writingBuf.length>0&&(this._bufs.unshift(this._writingBuf),this._writingBuf="");let t="";for(;this._bufs.length||t;){t.length<=0&&(t=this._bufs[0]);try{let e=ne.writeSync(this.fd,t,"utf8"),r=Pa(t,this._len,e);t=r.writingBuf,this._len=r.len,t.length<=0&&this._bufs.shift()}catch(e){if((e.code==="EAGAIN"||e.code==="EBUSY")&&!this.retryEAGAIN(e,t.length,this._len-t.length))throw e;ja(Zs)}}try{ne.fsyncSync(this.fd)}catch{}}function FS(){if(this.destroyed)throw new Error("SonicBoom destroyed");if(this.fd<0)throw new Error("sonic boom is not ready yet");!this._writing&&this._writingBuf.length>0&&(this._bufs.unshift([this._writingBuf]),this._writingBuf=Ys);let t=Ys;for(;this._bufs.length||t.length;){t.length<=0&&(t=jf(this._bufs[0],this._lens[0]));try{let e=ne.writeSync(this.fd,t);t=t.subarray(e),this._len=Math.max(this._len-e,0),t.length<=0&&(this._bufs.shift(),this._lens.shift())}catch(e){if((e.code==="EAGAIN"||e.code==="EBUSY")&&!this.retryEAGAIN(e,t.length,this._len-t.length))throw e;ja(Zs)}}}Be.prototype.destroy=function(){this.destroyed||Xs(this)};function BS(){let t=this.release;if(this._writing=!0,this._writingBuf=this._writingBuf||this._bufs.shift()||"",this.sync)try{let e=ne.writeSync(this.fd,this._writingBuf,"utf8");t(null,e)}catch(e){t(e)}else ne.write(this.fd,this._writingBuf,"utf8",t)}function KS(){let t=this.release;if(this._writing=!0,this._writingBuf=this._writingBuf.length?this._writingBuf:jf(this._bufs.shift(),this._lens.shift()),this.sync)try{let e=ne.writeSync(this.fd,this._writingBuf);t(null,e)}catch(e){t(e)}else AS&&(this._writingBuf=Buffer.from(this._writingBuf)),ne.write(this.fd,this._writingBuf,t)}function Xs(t){if(t.fd===-1){t.once("ready",Xs.bind(null,t));return}t._periodicFlushTimer!==void 0&&clearInterval(t._periodicFlushTimer),t.destroyed=!0,t._bufs=[],t._lens=[],RS(typeof t.fd=="number",`sonic.fd must be a number, got ${typeof t.fd}`);try{ne.fsync(t.fd,e)}catch{}function e(){t.fd!==1&&t.fd!==2?ne.close(t.fd,r):r()}function r(n){if(n){t.emit("error",n);return}t._ending&&!t._writing&&t.emit("finish"),t.emit("close")}}Be.SonicBoom=Be;Be.default=Be;Rf.exports=Be});var Na=w((LP,Lf)=>{"use strict";var Ke={exit:[],beforeExit:[]},If={exit:GS,beforeExit:WS},Tr;function HS(){Tr===void 0&&(Tr=new FinalizationRegistry(ZS))}function JS(t){Ke[t].length>0||process.on(t,If[t])}function qf(t){Ke[t].length>0||(process.removeListener(t,If[t]),Ke.exit.length===0&&Ke.beforeExit.length===0&&(Tr=void 0))}function GS(){Af("exit")}function WS(){Af("beforeExit")}function Af(t){for(let e of Ke[t]){let r=e.deref(),n=e.fn;r!==void 0&&n(r,t)}Ke[t]=[]}function ZS(t){for(let e of["exit","beforeExit"]){let r=Ke[e].indexOf(t);Ke[e].splice(r,r+1),qf(e)}}function Df(t,e,r){if(e===void 0)throw new Error("the object can't be undefined");JS(t);let n=new WeakRef(e);n.fn=r,HS(),Tr.register(e,n),Ke[t].push(n)}function YS(t,e){Df("exit",t,e)}function XS(t,e){Df("beforeExit",t,e)}function QS(t){if(Tr!==void 0){Tr.unregister(t);for(let e of["exit","beforeExit"])Ke[e]=Ke[e].filter(r=>{let n=r.deref();return n&&n!==t}),qf(e)}}Lf.exports={register:YS,registerBeforeExit:XS,unregister:QS}});var Mf=w((MP,e$)=>{e$.exports={name:"thread-stream",version:"3.1.0",description:"A streaming way to send data to a Node.js Worker Thread",main:"index.js",types:"index.d.ts",dependencies:{"real-require":"^0.2.0"},devDependencies:{"@types/node":"^20.1.0","@types/tap":"^15.0.0","@yao-pkg/pkg":"^5.11.5",desm:"^1.3.0",fastbench:"^1.0.1",husky:"^9.0.6","pino-elasticsearch":"^8.0.0","sonic-boom":"^4.0.1",standard:"^17.0.0",tap:"^16.2.0","ts-node":"^10.8.0",typescript:"^5.3.2","why-is-node-running":"^2.2.2"},scripts:{build:"tsc --noEmit",test:'standard && npm run build && npm run transpile && tap "test/**/*.test.*js" && tap --ts test/*.test.*ts',"test:ci":"standard && npm run transpile && npm run test:ci:js && npm run test:ci:ts","test:ci:js":'tap --no-check-coverage --timeout=120 --coverage-report=lcovonly "test/**/*.test.*js"',"test:ci:ts":'tap --ts --no-check-coverage --coverage-report=lcovonly "test/**/*.test.*ts"',"test:yarn":'npm run transpile && tap "test/**/*.test.js" --no-check-coverage',transpile:"sh ./test/ts/transpile.sh",prepare:"husky install"},standard:{ignore:["test/ts/**/*","test/syntax-error.mjs"]},repository:{type:"git",url:"git+https://github.com/mcollina/thread-stream.git"},keywords:["worker","thread","threads","stream"],author:"Matteo Collina <hello@matteocollina.com>",license:"MIT",bugs:{url:"https://github.com/mcollina/thread-stream/issues"},homepage:"https://github.com/mcollina/thread-stream#readme"}});var Uf=w((VP,Vf)=>{"use strict";function t$(t,e,r,n,s){let i=Date.now()+n,o=Atomics.load(t,e);if(o===r){s(null,"ok");return}let a=o,c=u=>{Date.now()>i?s(null,"timed-out"):setTimeout(()=>{a=o,o=Atomics.load(t,e),o===a?c(u>=1e3?1e3:u*2):o===r?s(null,"ok"):s(null,"not-equal")},u)};c(1)}function r$(t,e,r,n,s){let i=Date.now()+n,o=Atomics.load(t,e);if(o!==r){s(null,"ok");return}let a=c=>{Date.now()>i?s(null,"timed-out"):setTimeout(()=>{o=Atomics.load(t,e),o!==r?s(null,"ok"):a(c>=1e3?1e3:c*2)},c)};a(1)}Vf.exports={wait:t$,waitDiff:r$}});var Ff=w((UP,zf)=>{"use strict";zf.exports={WRITE_INDEX:4,READ_INDEX:8}});var Gf=w((zP,Jf)=>{"use strict";var{version:n$}=Mf(),{EventEmitter:s$}=require("events"),{Worker:i$}=require("worker_threads"),{join:o$}=require("path"),{pathToFileURL:a$}=require("url"),{wait:c$}=Uf(),{WRITE_INDEX:Oe,READ_INDEX:et}=Ff(),u$=require("buffer"),l$=require("assert"),v=Symbol("kImpl"),d$=u$.constants.MAX_STRING_LENGTH,pn=class{constructor(e){this._value=e}deref(){return this._value}},ei=class{register(){}unregister(){}},f$=process.env.NODE_V8_COVERAGE?ei:global.FinalizationRegistry||ei,p$=process.env.NODE_V8_COVERAGE?pn:global.WeakRef||pn,Bf=new f$(t=>{t.exited||t.terminate()});function h$(t,e){let{filename:r,workerData:n}=e,i=("__bundlerPathsOverrides"in globalThis?globalThis.__bundlerPathsOverrides:{})["thread-stream-worker"]||o$(__dirname,"lib","worker.js"),o=new i$(i,{...e.workerOpts,trackUnmanagedFds:!1,workerData:{filename:r.indexOf("file://")===0?r:a$(r).href,dataBuf:t[v].dataBuf,stateBuf:t[v].stateBuf,workerData:{$context:{threadStreamVersion:n$},...n}}});return o.stream=new pn(t),o.on("message",m$),o.on("exit",Hf),Bf.register(t,o),o}function Kf(t){l$(!t[v].sync),t[v].needDrain&&(t[v].needDrain=!1,t.emit("drain"))}function Qs(t){let e=Atomics.load(t[v].state,Oe),r=t[v].data.length-e;if(r>0){if(t[v].buf.length===0){t[v].flushing=!1,t[v].ending?Aa(t):t[v].needDrain&&process.nextTick(Kf,t);return}let n=t[v].buf.slice(0,r),s=Buffer.byteLength(n);s<=r?(t[v].buf=t[v].buf.slice(r),ti(t,n,Qs.bind(null,t))):t.flush(()=>{if(!t.destroyed){for(Atomics.store(t[v].state,et,0),Atomics.store(t[v].state,Oe,0);s>t[v].data.length;)r=r/2,n=t[v].buf.slice(0,r),s=Buffer.byteLength(n);t[v].buf=t[v].buf.slice(r),ti(t,n,Qs.bind(null,t))}})}else if(r===0){if(e===0&&t[v].buf.length===0)return;t.flush(()=>{Atomics.store(t[v].state,et,0),Atomics.store(t[v].state,Oe,0),Qs(t)})}else tt(t,new Error("overwritten"))}function m$(t){let e=this.stream.deref();if(e===void 0){this.exited=!0,this.terminate();return}switch(t.code){case"READY":this.stream=new p$(e),e.flush(()=>{e[v].ready=!0,e.emit("ready")});break;case"ERROR":tt(e,t.err);break;case"EVENT":Array.isArray(t.args)?e.emit(t.name,...t.args):e.emit(t.name,t.args);break;case"WARNING":process.emitWarning(t.err);break;default:tt(e,new Error("this should not happen: "+t.code))}}function Hf(t){let e=this.stream.deref();e!==void 0&&(Bf.unregister(e),e.worker.exited=!0,e.worker.off("exit",Hf),tt(e,t!==0?new Error("the worker thread exited"):null))}var Ca=class extends s${constructor(e={}){if(super(),e.bufferSize<4)throw new Error("bufferSize must at least fit a 4-byte utf-8 char");this[v]={},this[v].stateBuf=new SharedArrayBuffer(128),this[v].state=new Int32Array(this[v].stateBuf),this[v].dataBuf=new SharedArrayBuffer(e.bufferSize||4*1024*1024),this[v].data=Buffer.from(this[v].dataBuf),this[v].sync=e.sync||!1,this[v].ending=!1,this[v].ended=!1,this[v].needDrain=!1,this[v].destroyed=!1,this[v].flushing=!1,this[v].ready=!1,this[v].finished=!1,this[v].errored=null,this[v].closed=!1,this[v].buf="",this.worker=h$(this,e),this.on("message",(r,n)=>{this.worker.postMessage(r,n)})}write(e){if(this[v].destroyed)return Ia(this,new Error("the worker has exited")),!1;if(this[v].ending)return Ia(this,new Error("the worker is ending")),!1;if(this[v].flushing&&this[v].buf.length+e.length>=d$)try{Ra(this),this[v].flushing=!0}catch(r){return tt(this,r),!1}if(this[v].buf+=e,this[v].sync)try{return Ra(this),!0}catch(r){return tt(this,r),!1}return this[v].flushing||(this[v].flushing=!0,setImmediate(Qs,this)),this[v].needDrain=this[v].data.length-this[v].buf.length-Atomics.load(this[v].state,Oe)<=0,!this[v].needDrain}end(){this[v].destroyed||(this[v].ending=!0,Aa(this))}flush(e){if(this[v].destroyed){typeof e=="function"&&process.nextTick(e,new Error("the worker has exited"));return}let r=Atomics.load(this[v].state,Oe);c$(this[v].state,et,r,1/0,(n,s)=>{if(n){tt(this,n),process.nextTick(e,n);return}if(s==="not-equal"){this.flush(e);return}process.nextTick(e)})}flushSync(){this[v].destroyed||(Ra(this),qa(this))}unref(){this.worker.unref()}ref(){this.worker.ref()}get ready(){return this[v].ready}get destroyed(){return this[v].destroyed}get closed(){return this[v].closed}get writable(){return!this[v].destroyed&&!this[v].ending}get writableEnded(){return this[v].ending}get writableFinished(){return this[v].finished}get writableNeedDrain(){return this[v].needDrain}get writableObjectMode(){return!1}get writableErrored(){return this[v].errored}};function Ia(t,e){setImmediate(()=>{t.emit("error",e)})}function tt(t,e){t[v].destroyed||(t[v].destroyed=!0,e&&(t[v].errored=e,Ia(t,e)),t.worker.exited?setImmediate(()=>{t[v].closed=!0,t.emit("close")}):t.worker.terminate().catch(()=>{}).then(()=>{t[v].closed=!0,t.emit("close")}))}function ti(t,e,r){let n=Atomics.load(t[v].state,Oe),s=Buffer.byteLength(e);return t[v].data.write(e,n),Atomics.store(t[v].state,Oe,n+s),Atomics.notify(t[v].state,Oe),r(),!0}function Aa(t){if(!(t[v].ended||!t[v].ending||t[v].flushing)){t[v].ended=!0;try{t.flushSync();let e=Atomics.load(t[v].state,et);Atomics.store(t[v].state,Oe,-1),Atomics.notify(t[v].state,Oe);let r=0;for(;e!==-1;){if(Atomics.wait(t[v].state,et,e,1e3),e=Atomics.load(t[v].state,et),e===-2){tt(t,new Error("end() failed"));return}if(++r===10){tt(t,new Error("end() took too long (10s)"));return}}process.nextTick(()=>{t[v].finished=!0,t.emit("finish")})}catch(e){tt(t,e)}}}function Ra(t){let e=()=>{t[v].ending?Aa(t):t[v].needDrain&&process.nextTick(Kf,t)};for(t[v].flushing=!1;t[v].buf.length!==0;){let r=Atomics.load(t[v].state,Oe),n=t[v].data.length-r;if(n===0){qa(t),Atomics.store(t[v].state,et,0),Atomics.store(t[v].state,Oe,0);continue}else if(n<0)throw new Error("overwritten");let s=t[v].buf.slice(0,n),i=Buffer.byteLength(s);if(i<=n)t[v].buf=t[v].buf.slice(n),ti(t,s,e);else{for(qa(t),Atomics.store(t[v].state,et,0),Atomics.store(t[v].state,Oe,0);i>t[v].buf.length;)n=n/2,s=t[v].buf.slice(0,n),i=Buffer.byteLength(s);t[v].buf=t[v].buf.slice(n),ti(t,s,e)}}}function qa(t){if(t[v].flushing)throw new Error("unable to flush while flushing");let e=Atomics.load(t[v].state,Oe),r=0;for(;;){let n=Atomics.load(t[v].state,et);if(n===-2)throw Error("_flushSync failed");if(n!==e)Atomics.wait(t[v].state,et,n,1e3);else break;if(++r===10)throw new Error("_flushSync took too long (10s)")}}Jf.exports=Ca});var Ma=w((FP,Wf)=>{"use strict";var{createRequire:g$}=require("module"),y$=va(),{join:Da,isAbsolute:_$,sep:v$}=require("node:path"),b$=Ta(),La=Na(),w$=Gf();function S$(t){La.register(t,x$),La.registerBeforeExit(t,E$),t.on("close",function(){La.unregister(t)})}function $$(t,e,r,n){let s=new w$({filename:t,workerData:e,workerOpts:r,sync:n});s.on("ready",i),s.on("close",function(){process.removeListener("exit",o)}),process.on("exit",o);function i(){process.removeListener("exit",o),s.unref(),r.autoEnd!==!1&&S$(s)}function o(){s.closed||(s.flushSync(),b$(100),s.end())}return s}function x$(t){t.ref(),t.flushSync(),t.end(),t.once("close",function(){t.unref()})}function E$(t){t.flushSync()}function k$(t){let{pipeline:e,targets:r,levels:n,dedupe:s,worker:i={},caller:o=y$(),sync:a=!1}=t,c={...t.options},u=typeof o=="string"?[o]:o,l="__bundlerPathsOverrides"in globalThis?globalThis.__bundlerPathsOverrides:{},d=t.target;if(d&&r)throw new Error("only one of target or targets can be specified");return r?(d=l["pino-worker"]||Da(__dirname,"worker.js"),c.targets=r.filter(h=>h.target).map(h=>({...h,target:y(h.target)})),c.pipelines=r.filter(h=>h.pipeline).map(h=>h.pipeline.map(f=>({...f,level:h.level,target:y(f.target)})))):e&&(d=l["pino-worker"]||Da(__dirname,"worker.js"),c.pipelines=[e.map(h=>({...h,target:y(h.target)}))]),n&&(c.levels=n),s&&(c.dedupe=s),c.pinoWillSendConfig=!0,$$(y(d),c,i,a);function y(h){if(h=l[h]||h,_$(h)||h.indexOf("file://")===0)return h;if(h==="pino/file")return Da(__dirname,"..","file.js");let f;for(let m of u)try{let g=m==="node:repl"?process.cwd()+v$:m;f=g$(g).resolve(h);break}catch{continue}if(!f)throw new Error(`unable to determine transport target for "${h}"`);return f}}Wf.exports=k$});var si=w((BP,op)=>{"use strict";var Zf=Ef(),{mapHttpRequest:O$,mapHttpResponse:T$}=_a(),Ua=Cf(),Yf=Na(),{lsCacheSym:P$,chindingsSym:ep,writeSym:Xf,serializersSym:tp,formatOptsSym:Qf,endSym:j$,stringifiersSym:rp,stringifySym:np,stringifySafeSym:za,wildcardFirstSym:sp,nestedKeySym:N$,formattersSym:ip,messageKeySym:R$,errorKeySym:C$,nestedKeyStrSym:I$,msgPrefixSym:ri}=Or(),{isMainThread:q$}=require("worker_threads"),A$=Ma();function Pr(){}function D$(t,e){if(!e)return r;return function(...s){e.call(this,s,r,t)};function r(n,...s){if(typeof n=="object"){let i=n;n!==null&&(n.method&&n.headers&&n.socket?n=O$(n):typeof n.setHeader=="function"&&(n=T$(n)));let o;i===null&&s.length===0?o=[null]:(i=s.shift(),o=s),typeof this[ri]=="string"&&i!==void 0&&i!==null&&(i=this[ri]+i),this[Xf](n,Zf(i,o,this[Qf]),t)}else{let i=n===void 0?s.shift():n;typeof this[ri]=="string"&&i!==void 0&&i!==null&&(i=this[ri]+i),this[Xf](null,Zf(i,s,this[Qf]),t)}}}function Va(t){let e="",r=0,n=!1,s=255,i=t.length;if(i>100)return JSON.stringify(t);for(var o=0;o<i&&s>=32;o++)s=t.charCodeAt(o),(s===34||s===92)&&(e+=t.slice(r,o)+"\\",r=o,n=!0);return n?e+=t.slice(r):e=t,s<32?JSON.stringify(t):'"'+e+'"'}function L$(t,e,r,n){let s=this[np],i=this[za],o=this[rp],a=this[j$],c=this[ep],u=this[tp],l=this[ip],d=this[R$],y=this[C$],h=this[P$][r]+n;h=h+c;let f;l.log&&(t=l.log(t));let m=o[sp],g="";for(let b in t)if(f=t[b],Object.prototype.hasOwnProperty.call(t,b)&&f!==void 0){u[b]?f=u[b](f):b===y&&u.err&&(f=u.err(f));let S=o[b]||m;switch(typeof f){case"undefined":case"function":continue;case"number":Number.isFinite(f)===!1&&(f=null);case"boolean":S&&(f=S(f));break;case"string":f=(S||Va)(f);break;default:f=(S||s)(f,i)}if(f===void 0)continue;let $=Va(b);g+=","+$+":"+f}let _="";if(e!==void 0){f=u[d]?u[d](e):e;let b=o[d]||m;switch(typeof f){case"function":break;case"number":Number.isFinite(f)===!1&&(f=null);case"boolean":b&&(f=b(f)),_=',"'+d+'":'+f;break;case"string":f=(b||Va)(f),_=',"'+d+'":'+f;break;default:f=(b||s)(f,i),_=',"'+d+'":'+f}}return this[N$]&&g?h+this[I$]+g.slice(1)+"}"+_+a:h+g+_+a}function M$(t,e){let r,n=t[ep],s=t[np],i=t[za],o=t[rp],a=o[sp],c=t[tp],u=t[ip].bindings;e=u(e);for(let l in e)if(r=e[l],(l!=="level"&&l!=="serializers"&&l!=="formatters"&&l!=="customLevels"&&e.hasOwnProperty(l)&&r!==void 0)===!0){if(r=c[l]?c[l](r):r,r=(o[l]||a||s)(r,i),r===void 0)continue;n+=',"'+l+'":'+r}return n}function V$(t){return t.write!==t.constructor.prototype.write}function ni(t){let e=new Ua(t);return e.on("error",r),!t.sync&&q$&&(Yf.register(e,U$),e.on("close",function(){Yf.unregister(e)})),e;function r(n){if(n.code==="EPIPE"){e.write=Pr,e.end=Pr,e.flushSync=Pr,e.destroy=Pr;return}e.removeListener("error",r),e.emit("error",n)}}function U$(t,e){t.destroyed||(e==="beforeExit"?(t.flush(),t.on("drain",function(){t.end()})):t.flushSync())}function z$(t){return function(r,n,s={},i){if(typeof s=="string")i=ni({dest:s}),s={};else if(typeof i=="string"){if(s&&s.transport)throw Error("only one of option.transport or stream can be specified");i=ni({dest:i})}else if(s instanceof Ua||s.writable||s._writableState)i=s,s={};else if(s.transport){if(s.transport instanceof Ua||s.transport.writable||s.transport._writableState)throw Error("option.transport do not allow stream, please pass to option directly. e.g. pino(transport)");if(s.transport.targets&&s.transport.targets.length&&s.formatters&&typeof s.formatters.level=="function")throw Error("option.transport.targets do not allow custom level formatters");let c;s.customLevels&&(c=s.useOnlyCustomLevels?s.customLevels:Object.assign({},s.levels,s.customLevels)),i=A$({caller:n,...s.transport,levels:c})}if(s=Object.assign({},t,s),s.serializers=Object.assign({},t.serializers,s.serializers),s.formatters=Object.assign({},t.formatters,s.formatters),s.prettyPrint)throw new Error("prettyPrint option is no longer supported, see the pino-pretty package (https://github.com/pinojs/pino-pretty)");let{enabled:o,onChild:a}=s;return o===!1&&(s.level="silent"),a||(s.onChild=Pr),i||(V$(process.stdout)?i=process.stdout:i=ni({fd:process.stdout.fd||1})),{opts:s,stream:i}}}function F$(t,e){try{return JSON.stringify(t)}catch{try{return(e||this[za])(t)}catch{return'"[unable to serialize, circular reference is too complex to analyze]"'}}}function B$(t,e,r){return{level:t,bindings:e,log:r}}function K$(t){let e=Number(t);return typeof t=="string"&&Number.isFinite(e)?e:t===void 0?1:t}op.exports={noop:Pr,buildSafeSonicBoom:ni,asChindings:M$,asJson:L$,genLog:D$,createArgsNormalizer:z$,stringify:F$,buildFormatters:B$,normalizeDestFileDescriptor:K$}});var ii=w((KP,ap)=>{var H$={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},J$={ASC:"ASC",DESC:"DESC"};ap.exports={DEFAULT_LEVELS:H$,SORTING_ORDER:J$}});var Ka=w((HP,dp)=>{"use strict";var{lsCacheSym:G$,levelValSym:Fa,useOnlyCustomLevelsSym:W$,streamSym:Z$,formattersSym:Y$,hooksSym:X$,levelCompSym:cp}=Or(),{noop:Q$,genLog:er}=si(),{DEFAULT_LEVELS:rt,SORTING_ORDER:up}=ii(),lp={fatal:t=>{let e=er(rt.fatal,t);return function(...r){let n=this[Z$];if(e.call(this,...r),typeof n.flushSync=="function")try{n.flushSync()}catch{}}},error:t=>er(rt.error,t),warn:t=>er(rt.warn,t),info:t=>er(rt.info,t),debug:t=>er(rt.debug,t),trace:t=>er(rt.trace,t)},Ba=Object.keys(rt).reduce((t,e)=>(t[rt[e]]=e,t),{}),ex=Object.keys(Ba).reduce((t,e)=>(t[e]='{"level":'+Number(e),t),{});function tx(t){let e=t[Y$].level,{labels:r}=t.levels,n={};for(let s in r){let i=e(r[s],Number(s));n[s]=JSON.stringify(i).slice(0,-1)}return t[G$]=n,t}function rx(t,e){if(e)return!1;switch(t){case"fatal":case"error":case"warn":case"info":case"debug":case"trace":return!0;default:return!1}}function nx(t){let{labels:e,values:r}=this.levels;if(typeof t=="number"){if(e[t]===void 0)throw Error("unknown level value"+t);t=e[t]}if(r[t]===void 0)throw Error("unknown level "+t);let n=this[Fa],s=this[Fa]=r[t],i=this[W$],o=this[cp],a=this[X$].logMethod;for(let c in r){if(o(r[c],s)===!1){this[c]=Q$;continue}this[c]=rx(c,i)?lp[c](a):er(r[c],a)}this.emit("level-change",t,s,e[n],n,this)}function sx(t){let{levels:e,levelVal:r}=this;return e&&e.labels?e.labels[r]:""}function ix(t){let{values:e}=this.levels,r=e[t];return r!==void 0&&this[cp](r,this[Fa])}function ox(t,e,r){return t===up.DESC?e<=r:e>=r}function ax(t){return typeof t=="string"?ox.bind(null,t):t}function cx(t=null,e=!1){let r=t?Object.keys(t).reduce((i,o)=>(i[t[o]]=o,i),{}):null,n=Object.assign(Object.create(Object.prototype,{Infinity:{value:"silent"}}),e?null:Ba,r),s=Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),e?null:rt,t);return{labels:n,values:s}}function ux(t,e,r){if(typeof t=="number"){if(![].concat(Object.keys(e||{}).map(i=>e[i]),r?[]:Object.keys(Ba).map(i=>+i),1/0).includes(t))throw Error(`default level:${t} must be included in custom levels`);return}let n=Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),r?null:rt,e);if(!(t in n))throw Error(`default level:${t} must be included in custom levels`)}function lx(t,e){let{labels:r,values:n}=t;for(let s in e){if(s in n)throw Error("levels cannot be overridden");if(e[s]in r)throw Error("pre-existing level values cannot be used for new levels")}}function dx(t){if(typeof t!="function"&&!(typeof t=="string"&&Object.values(up).includes(t)))throw new Error('Levels comparison should be one of "ASC", "DESC" or "function" type')}dp.exports={initialLsCache:ex,genLsCache:tx,levelMethods:lp,getLevel:sx,setLevel:nx,isLevelEnabled:ix,mappings:cx,assertNoLevelCollisions:lx,assertDefaultLevelFound:ux,genLevelComparison:ax,assertLevelComparison:dx}});var Ha=w((JP,fp)=>{"use strict";fp.exports={version:"9.7.0"}});var $p=w((WP,Sp)=>{"use strict";var{EventEmitter:fx}=require("node:events"),{lsCacheSym:px,levelValSym:hx,setLevelSym:Ga,getLevelSym:pp,chindingsSym:Wa,parsedChindingsSym:mx,mixinSym:gx,asJsonSym:_p,writeSym:yx,mixinMergeStrategySym:_x,timeSym:vx,timeSliceIndexSym:bx,streamSym:vp,serializersSym:tr,formattersSym:Ja,errorKeySym:wx,messageKeySym:Sx,useOnlyCustomLevelsSym:$x,needsMetadataGsym:xx,redactFmtSym:Ex,stringifySym:kx,formatOptsSym:Ox,stringifiersSym:Tx,msgPrefixSym:hp,hooksSym:Px}=Or(),{getLevel:jx,setLevel:Nx,isLevelEnabled:Rx,mappings:Cx,initialLsCache:Ix,genLsCache:qx,assertNoLevelCollisions:Ax}=Ka(),{asChindings:bp,asJson:Dx,buildFormatters:mp,stringify:gp}=si(),{version:Lx}=Ha(),Mx=ka(),Vx=class{},wp={constructor:Vx,child:Ux,bindings:zx,setBindings:Fx,flush:Jx,isLevelEnabled:Rx,version:Lx,get level(){return this[pp]()},set level(t){this[Ga](t)},get levelVal(){return this[hx]},set levelVal(t){throw Error("levelVal is read-only")},[px]:Ix,[yx]:Kx,[_p]:Dx,[pp]:jx,[Ga]:Nx};Object.setPrototypeOf(wp,fx.prototype);Sp.exports=function(){return Object.create(wp)};var yp=t=>t;function Ux(t,e){if(!t)throw Error("missing bindings for child Pino");e=e||{};let r=this[tr],n=this[Ja],s=Object.create(this);if(e.hasOwnProperty("serializers")===!0){s[tr]=Object.create(null);for(let l in r)s[tr][l]=r[l];let c=Object.getOwnPropertySymbols(r);for(var i=0;i<c.length;i++){let l=c[i];s[tr][l]=r[l]}for(let l in e.serializers)s[tr][l]=e.serializers[l];let u=Object.getOwnPropertySymbols(e.serializers);for(var o=0;o<u.length;o++){let l=u[o];s[tr][l]=e.serializers[l]}}else s[tr]=r;if(e.hasOwnProperty("formatters")){let{level:c,bindings:u,log:l}=e.formatters;s[Ja]=mp(c||n.level,u||yp,l||n.log)}else s[Ja]=mp(n.level,yp,n.log);if(e.hasOwnProperty("customLevels")===!0&&(Ax(this.levels,e.customLevels),s.levels=Cx(e.customLevels,s[$x]),qx(s)),typeof e.redact=="object"&&e.redact!==null||Array.isArray(e.redact)){s.redact=e.redact;let c=Mx(s.redact,gp),u={stringify:c[Ex]};s[kx]=gp,s[Tx]=c,s[Ox]=u}typeof e.msgPrefix=="string"&&(s[hp]=(this[hp]||"")+e.msgPrefix),s[Wa]=bp(s,t);let a=e.level||this.level;return s[Ga](a),this.onChild(s),s}function zx(){let e=`{${this[Wa].substr(1)}}`,r=JSON.parse(e);return delete r.pid,delete r.hostname,r}function Fx(t){let e=bp(this,t);this[Wa]=e,delete this[mx]}function Bx(t,e){return Object.assign(e,t)}function Kx(t,e,r){let n=this[vx](),s=this[gx],i=this[wx],o=this[Sx],a=this[_x]||Bx,c,u=this[Px].streamWrite;t==null?c={}:t instanceof Error?(c={[i]:t},e===void 0&&(e=t.message)):(c=t,e===void 0&&t[o]===void 0&&t[i]&&(e=t[i].message)),s&&(c=a(c,s(c,r,this)));let l=this[_p](c,e,r,n),d=this[vp];d[xx]===!0&&(d.lastLevel=r,d.lastObj=c,d.lastMsg=e,d.lastTime=n.slice(this[bx]),d.lastLogger=this),d.write(u?u(l):l)}function Hx(){}function Jx(t){if(t!=null&&typeof t!="function")throw Error("callback must be a function");let e=this[vp];typeof e.flush=="function"?e.flush(t||Hx):t&&t()}});var Op=w((Qa,kp)=>{"use strict";var{hasOwnProperty:hn}=Object.prototype,nr=Xa();nr.configure=Xa;nr.stringify=nr;nr.default=nr;Qa.stringify=nr;Qa.configure=Xa;kp.exports=nr;var Gx=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function kt(t){return t.length<5e3&&!Gx.test(t)?`"${t}"`:JSON.stringify(t)}function Za(t,e){if(t.length>200||e)return t.sort(e);for(let r=1;r<t.length;r++){let n=t[r],s=r;for(;s!==0&&t[s-1]>n;)t[s]=t[s-1],s--;t[s]=n}return t}var Wx=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function Ya(t){return Wx.call(t)!==void 0&&t.length!==0}function xp(t,e,r){t.length<r&&(r=t.length);let n=e===","?"":" ",s=`"0":${n}${t[0]}`;for(let i=1;i<r;i++)s+=`${e}"${i}":${n}${t[i]}`;return s}function Zx(t){if(hn.call(t,"circularValue")){let e=t.circularValue;if(typeof e=="string")return`"${e}"`;if(e==null)return e;if(e===Error||e===TypeError)return{toString(){throw new TypeError("Converting circular structure to JSON")}};throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined')}return'"[Circular]"'}function Yx(t){let e;if(hn.call(t,"deterministic")&&(e=t.deterministic,typeof e!="boolean"&&typeof e!="function"))throw new TypeError('The "deterministic" argument must be of type boolean or comparator function');return e===void 0?!0:e}function Xx(t,e){let r;if(hn.call(t,e)&&(r=t[e],typeof r!="boolean"))throw new TypeError(`The "${e}" argument must be of type boolean`);return r===void 0?!0:r}function Ep(t,e){let r;if(hn.call(t,e)){if(r=t[e],typeof r!="number")throw new TypeError(`The "${e}" argument must be of type number`);if(!Number.isInteger(r))throw new TypeError(`The "${e}" argument must be an integer`);if(r<1)throw new RangeError(`The "${e}" argument must be >= 1`)}return r===void 0?1/0:r}function rr(t){return t===1?"1 item":`${t} items`}function Qx(t){let e=new Set;for(let r of t)(typeof r=="string"||typeof r=="number")&&e.add(String(r));return e}function eE(t){if(hn.call(t,"strict")){let e=t.strict;if(typeof e!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(e)return r=>{let n=`Object can not safely be stringified. Received type ${typeof r}`;throw typeof r!="function"&&(n+=` (${r.toString()})`),new Error(n)}}}function Xa(t){t={...t};let e=eE(t);e&&(t.bigint===void 0&&(t.bigint=!1),"circularValue"in t||(t.circularValue=Error));let r=Zx(t),n=Xx(t,"bigint"),s=Yx(t),i=typeof s=="function"?s:void 0,o=Ep(t,"maximumDepth"),a=Ep(t,"maximumBreadth");function c(h,f,m,g,_,b){let S=f[h];switch(typeof S=="object"&&S!==null&&typeof S.toJSON=="function"&&(S=S.toJSON(h)),S=g.call(f,h,S),typeof S){case"string":return kt(S);case"object":{if(S===null)return"null";if(m.indexOf(S)!==-1)return r;let $="",E=",",j=b;if(Array.isArray(S)){if(S.length===0)return"[]";if(o<m.length+1)return'"[Array]"';m.push(S),_!==""&&(b+=_,$+=`
${b}`,E=`,
${b}`);let te=Math.min(S.length,a),ae=0;for(;ae<te-1;ae++){let nt=c(String(ae),S,m,g,_,b);$+=nt!==void 0?nt:"null",$+=E}let ie=c(String(ae),S,m,g,_,b);if($+=ie!==void 0?ie:"null",S.length-1>a){let nt=S.length-a-1;$+=`${E}"... ${rr(nt)} not stringified"`}return _!==""&&($+=`
${j}`),m.pop(),`[${$}]`}let q=Object.keys(S),K=q.length;if(K===0)return"{}";if(o<m.length+1)return'"[Object]"';let R="",Z="";_!==""&&(b+=_,E=`,
${b}`,R=" ");let se=Math.min(K,a);s&&!Ya(S)&&(q=Za(q,i)),m.push(S);for(let te=0;te<se;te++){let ae=q[te],ie=c(ae,S,m,g,_,b);ie!==void 0&&($+=`${Z}${kt(ae)}:${R}${ie}`,Z=E)}if(K>a){let te=K-a;$+=`${Z}"...":${R}"${rr(te)} not stringified"`,Z=E}return _!==""&&Z.length>1&&($=`
${b}${$}
${j}`),m.pop(),`{${$}}`}case"number":return isFinite(S)?String(S):e?e(S):"null";case"boolean":return S===!0?"true":"false";case"undefined":return;case"bigint":if(n)return String(S);default:return e?e(S):void 0}}function u(h,f,m,g,_,b){switch(typeof f=="object"&&f!==null&&typeof f.toJSON=="function"&&(f=f.toJSON(h)),typeof f){case"string":return kt(f);case"object":{if(f===null)return"null";if(m.indexOf(f)!==-1)return r;let S=b,$="",E=",";if(Array.isArray(f)){if(f.length===0)return"[]";if(o<m.length+1)return'"[Array]"';m.push(f),_!==""&&(b+=_,$+=`
${b}`,E=`,
${b}`);let K=Math.min(f.length,a),R=0;for(;R<K-1;R++){let se=u(String(R),f[R],m,g,_,b);$+=se!==void 0?se:"null",$+=E}let Z=u(String(R),f[R],m,g,_,b);if($+=Z!==void 0?Z:"null",f.length-1>a){let se=f.length-a-1;$+=`${E}"... ${rr(se)} not stringified"`}return _!==""&&($+=`
${S}`),m.pop(),`[${$}]`}m.push(f);let j="";_!==""&&(b+=_,E=`,
${b}`,j=" ");let q="";for(let K of g){let R=u(K,f[K],m,g,_,b);R!==void 0&&($+=`${q}${kt(K)}:${j}${R}`,q=E)}return _!==""&&q.length>1&&($=`
${b}${$}
${S}`),m.pop(),`{${$}}`}case"number":return isFinite(f)?String(f):e?e(f):"null";case"boolean":return f===!0?"true":"false";case"undefined":return;case"bigint":if(n)return String(f);default:return e?e(f):void 0}}function l(h,f,m,g,_){switch(typeof f){case"string":return kt(f);case"object":{if(f===null)return"null";if(typeof f.toJSON=="function"){if(f=f.toJSON(h),typeof f!="object")return l(h,f,m,g,_);if(f===null)return"null"}if(m.indexOf(f)!==-1)return r;let b=_;if(Array.isArray(f)){if(f.length===0)return"[]";if(o<m.length+1)return'"[Array]"';m.push(f),_+=g;let R=`
${_}`,Z=`,
${_}`,se=Math.min(f.length,a),te=0;for(;te<se-1;te++){let ie=l(String(te),f[te],m,g,_);R+=ie!==void 0?ie:"null",R+=Z}let ae=l(String(te),f[te],m,g,_);if(R+=ae!==void 0?ae:"null",f.length-1>a){let ie=f.length-a-1;R+=`${Z}"... ${rr(ie)} not stringified"`}return R+=`
${b}`,m.pop(),`[${R}]`}let S=Object.keys(f),$=S.length;if($===0)return"{}";if(o<m.length+1)return'"[Object]"';_+=g;let E=`,
${_}`,j="",q="",K=Math.min($,a);Ya(f)&&(j+=xp(f,E,a),S=S.slice(f.length),K-=f.length,q=E),s&&(S=Za(S,i)),m.push(f);for(let R=0;R<K;R++){let Z=S[R],se=l(Z,f[Z],m,g,_);se!==void 0&&(j+=`${q}${kt(Z)}: ${se}`,q=E)}if($>a){let R=$-a;j+=`${q}"...": "${rr(R)} not stringified"`,q=E}return q!==""&&(j=`
${_}${j}
${b}`),m.pop(),`{${j}}`}case"number":return isFinite(f)?String(f):e?e(f):"null";case"boolean":return f===!0?"true":"false";case"undefined":return;case"bigint":if(n)return String(f);default:return e?e(f):void 0}}function d(h,f,m){switch(typeof f){case"string":return kt(f);case"object":{if(f===null)return"null";if(typeof f.toJSON=="function"){if(f=f.toJSON(h),typeof f!="object")return d(h,f,m);if(f===null)return"null"}if(m.indexOf(f)!==-1)return r;let g="",_=f.length!==void 0;if(_&&Array.isArray(f)){if(f.length===0)return"[]";if(o<m.length+1)return'"[Array]"';m.push(f);let j=Math.min(f.length,a),q=0;for(;q<j-1;q++){let R=d(String(q),f[q],m);g+=R!==void 0?R:"null",g+=","}let K=d(String(q),f[q],m);if(g+=K!==void 0?K:"null",f.length-1>a){let R=f.length-a-1;g+=`,"... ${rr(R)} not stringified"`}return m.pop(),`[${g}]`}let b=Object.keys(f),S=b.length;if(S===0)return"{}";if(o<m.length+1)return'"[Object]"';let $="",E=Math.min(S,a);_&&Ya(f)&&(g+=xp(f,",",a),b=b.slice(f.length),E-=f.length,$=","),s&&(b=Za(b,i)),m.push(f);for(let j=0;j<E;j++){let q=b[j],K=d(q,f[q],m);K!==void 0&&(g+=`${$}${kt(q)}:${K}`,$=",")}if(S>a){let j=S-a;g+=`${$}"...":"${rr(j)} not stringified"`}return m.pop(),`{${g}}`}case"number":return isFinite(f)?String(f):e?e(f):"null";case"boolean":return f===!0?"true":"false";case"undefined":return;case"bigint":if(n)return String(f);default:return e?e(f):void 0}}function y(h,f,m){if(arguments.length>1){let g="";if(typeof m=="number"?g=" ".repeat(Math.min(m,10)):typeof m=="string"&&(g=m.slice(0,10)),f!=null){if(typeof f=="function")return c("",{"":h},[],f,g,"");if(Array.isArray(f))return u("",h,[],Qx(f),g,"")}if(g.length!==0)return l("",h,[],g,"")}return d("",h,[])}return y}});var jp=w((ZP,Pp)=>{"use strict";var ec=Symbol.for("pino.metadata"),{DEFAULT_LEVELS:Tp}=ii(),tE=Tp.info;function rE(t,e){let r=0;t=t||[],e=e||{dedupe:!1};let n=Object.create(Tp);n.silent=1/0,e.levels&&typeof e.levels=="object"&&Object.keys(e.levels).forEach(d=>{n[d]=e.levels[d]});let s={write:i,add:c,emit:o,flushSync:a,end:u,minLevel:0,streams:[],clone:l,[ec]:!0,streamLevels:n};return Array.isArray(t)?t.forEach(c,s):c.call(s,t),t=null,s;function i(d){let y,h=this.lastLevel,{streams:f}=this,m=0,g;for(let _=sE(f.length,e.dedupe);oE(_,f.length,e.dedupe);_=iE(_,e.dedupe))if(y=f[_],y.level<=h){if(m!==0&&m!==y.level)break;if(g=y.stream,g[ec]){let{lastTime:b,lastMsg:S,lastObj:$,lastLogger:E}=this;g.lastLevel=h,g.lastTime=b,g.lastMsg=S,g.lastObj=$,g.lastLogger=E}g.write(d),e.dedupe&&(m=y.level)}else if(!e.dedupe)break}function o(...d){for(let{stream:y}of this.streams)typeof y.emit=="function"&&y.emit(...d)}function a(){for(let{stream:d}of this.streams)typeof d.flushSync=="function"&&d.flushSync()}function c(d){if(!d)return s;let y=typeof d.write=="function"||d.stream,h=d.write?d:d.stream;if(!y)throw Error("stream object needs to implement either StreamEntry or DestinationStream interface");let{streams:f,streamLevels:m}=this,g;typeof d.levelVal=="number"?g=d.levelVal:typeof d.level=="string"?g=m[d.level]:typeof d.level=="number"?g=d.level:g=tE;let _={stream:h,level:g,levelVal:void 0,id:r++};return f.unshift(_),f.sort(nE),this.minLevel=f[0].level,s}function u(){for(let{stream:d}of this.streams)typeof d.flushSync=="function"&&d.flushSync(),d.end()}function l(d){let y=new Array(this.streams.length);for(let h=0;h<y.length;h++)y[h]={level:d,stream:this.streams[h].stream};return{write:i,add:c,minLevel:d,streams:y,clone:l,emit:o,flushSync:a,[ec]:!0}}}function nE(t,e){return t.level-e.level}function sE(t,e){return e?t-1:0}function iE(t,e){return e?t-1:t+1}function oE(t,e,r){return r?t>=0:t<e}Pp.exports=rE});var Bp=w((YP,Ae)=>{"use strict";var aE=require("node:os"),Lp=_a(),cE=va(),uE=ka(),Mp=$f(),lE=$p(),Vp=Or(),{configure:dE}=Op(),{assertDefaultLevelFound:fE,mappings:Up,genLsCache:pE,genLevelComparison:hE,assertLevelComparison:mE}=Ka(),{DEFAULT_LEVELS:zp,SORTING_ORDER:gE}=ii(),{createArgsNormalizer:yE,asChindings:_E,buildSafeSonicBoom:Np,buildFormatters:vE,stringify:tc,normalizeDestFileDescriptor:Rp,noop:bE}=si(),{version:wE}=Ha(),{chindingsSym:Cp,redactFmtSym:SE,serializersSym:Ip,timeSym:$E,timeSliceIndexSym:xE,streamSym:EE,stringifySym:qp,stringifySafeSym:rc,stringifiersSym:Ap,setLevelSym:kE,endSym:OE,formatOptsSym:TE,messageKeySym:PE,errorKeySym:jE,nestedKeySym:NE,mixinSym:RE,levelCompSym:CE,useOnlyCustomLevelsSym:IE,formattersSym:Dp,hooksSym:qE,nestedKeyStrSym:AE,mixinMergeStrategySym:DE,msgPrefixSym:LE}=Vp,{epochTime:Fp,nullTime:ME}=Mp,{pid:VE}=process,UE=aE.hostname(),zE=Lp.err,FE={level:"info",levelComparison:gE.ASC,levels:zp,messageKey:"msg",errorKey:"err",nestedKey:null,enabled:!0,base:{pid:VE,hostname:UE},serializers:Object.assign(Object.create(null),{err:zE}),formatters:Object.assign(Object.create(null),{bindings(t){return t},level(t,e){return{level:e}}}),hooks:{logMethod:void 0,streamWrite:void 0},timestamp:Fp,name:void 0,redact:null,customLevels:null,useOnlyCustomLevels:!1,depthLimit:5,edgeLimit:100},BE=yE(FE),KE=Object.assign(Object.create(null),Lp);function nc(...t){let e={},{opts:r,stream:n}=BE(e,cE(),...t);r.level&&typeof r.level=="string"&&zp[r.level.toLowerCase()]!==void 0&&(r.level=r.level.toLowerCase());let{redact:s,crlf:i,serializers:o,timestamp:a,messageKey:c,errorKey:u,nestedKey:l,base:d,name:y,level:h,customLevels:f,levelComparison:m,mixin:g,mixinMergeStrategy:_,useOnlyCustomLevels:b,formatters:S,hooks:$,depthLimit:E,edgeLimit:j,onChild:q,msgPrefix:K}=r,R=dE({maximumDepth:E,maximumBreadth:j}),Z=vE(S.level,S.bindings,S.log),se=tc.bind({[rc]:R}),te=s?uE(s,se):{},ae=s?{stringify:te[SE]}:{stringify:se},ie="}"+(i?`\r
`:`
`),nt=_E.bind(null,{[Cp]:"",[Ip]:o,[Ap]:te,[qp]:tc,[rc]:R,[Dp]:Z}),A="";d!==null&&(y===void 0?A=nt(d):A=nt(Object.assign({},d,{name:y})));let D=a instanceof Function?a:a?Fp:ME,ye=D().indexOf(":")+1;if(b&&!f)throw Error("customLevels is required if useOnlyCustomLevels is set true");if(g&&typeof g!="function")throw Error(`Unknown mixin type "${typeof g}" - expected "function"`);if(K&&typeof K!="string")throw Error(`Unknown msgPrefix type "${typeof K}" - expected "string"`);fE(h,f,b);let fe=Up(f,b);typeof n.emit=="function"&&n.emit("message",{code:"PINO_CONFIG",config:{levels:fe,messageKey:c,errorKey:u}}),mE(m);let jr=hE(m);return Object.assign(e,{levels:fe,[CE]:jr,[IE]:b,[EE]:n,[$E]:D,[xE]:ye,[qp]:tc,[rc]:R,[Ap]:te,[OE]:ie,[TE]:ae,[PE]:c,[jE]:u,[NE]:l,[AE]:l?`,${JSON.stringify(l)}:{`:"",[Ip]:o,[RE]:g,[DE]:_,[Cp]:A,[Dp]:Z,[qE]:$,silent:bE,onChild:q,[LE]:K}),Object.setPrototypeOf(e,lE()),pE(e),e[kE](h),e}Ae.exports=nc;Ae.exports.destination=(t=process.stdout.fd)=>typeof t=="object"?(t.dest=Rp(t.dest||process.stdout.fd),Np(t)):Np({dest:Rp(t),minLength:0});Ae.exports.transport=Ma();Ae.exports.multistream=jp();Ae.exports.levels=Up();Ae.exports.stdSerializers=KE;Ae.exports.stdTimeFunctions=Object.assign({},Mp);Ae.exports.symbols=Vp;Ae.exports.version=wE;Ae.exports.default=nc;Ae.exports.pino=nc});var yi=mn(require("node:process"),1);var p={};Yp(p,{BRAND:()=>xh,DIRTY:()=>Ot,EMPTY_PATH:()=>rh,INVALID:()=>N,NEVER:()=>cm,OK:()=>pe,ParseStatus:()=>ce,Schema:()=>V,ZodAny:()=>yt,ZodArray:()=>at,ZodBigInt:()=>Pt,ZodBoolean:()=>jt,ZodBranded:()=>Rr,ZodCatch:()=>Ut,ZodDate:()=>Nt,ZodDefault:()=>Vt,ZodDiscriminatedUnion:()=>_n,ZodEffects:()=>Ne,ZodEnum:()=>Lt,ZodError:()=>be,ZodFirstPartyTypeKind:()=>C,ZodFunction:()=>bn,ZodIntersection:()=>qt,ZodIssueCode:()=>x,ZodLazy:()=>At,ZodLiteral:()=>Dt,ZodMap:()=>ur,ZodNaN:()=>dr,ZodNativeEnum:()=>Mt,ZodNever:()=>De,ZodNull:()=>Ct,ZodNullable:()=>Ge,ZodNumber:()=>Tt,ZodObject:()=>we,ZodOptional:()=>Pe,ZodParsedType:()=>O,ZodPipeline:()=>Cr,ZodPromise:()=>_t,ZodReadonly:()=>zt,ZodRecord:()=>vn,ZodSchema:()=>V,ZodSet:()=>lr,ZodString:()=>gt,ZodSymbol:()=>ar,ZodTransformer:()=>Ne,ZodTuple:()=>Je,ZodType:()=>V,ZodUndefined:()=>Rt,ZodUnion:()=>It,ZodUnknown:()=>ot,ZodVoid:()=>cr,addIssueToContext:()=>k,any:()=>Ch,array:()=>Dh,bigint:()=>Th,boolean:()=>mc,coerce:()=>am,custom:()=>fc,date:()=>Ph,datetimeRegex:()=>lc,defaultErrorMap:()=>st,discriminatedUnion:()=>Uh,effect:()=>Qh,enum:()=>Zh,function:()=>Jh,getErrorMap:()=>sr,getParsedType:()=>He,instanceof:()=>kh,intersection:()=>zh,isAborted:()=>gn,isAsync:()=>ir,isDirty:()=>yn,isValid:()=>mt,late:()=>Eh,lazy:()=>Gh,literal:()=>Wh,makeIssue:()=>Nr,map:()=>Kh,nan:()=>Oh,nativeEnum:()=>Yh,never:()=>qh,null:()=>Rh,nullable:()=>tm,number:()=>hc,object:()=>Lh,objectUtil:()=>ai,oboolean:()=>om,onumber:()=>im,optional:()=>em,ostring:()=>sm,pipeline:()=>nm,preprocess:()=>rm,promise:()=>Xh,quotelessJson:()=>Qp,record:()=>Bh,set:()=>Hh,setErrorMap:()=>th,strictObject:()=>Mh,string:()=>pc,symbol:()=>jh,transformer:()=>Qh,tuple:()=>Fh,undefined:()=>Nh,union:()=>Vh,unknown:()=>Ih,util:()=>B,void:()=>Ah});var B;(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function r(s){throw new Error}t.assertNever=r,t.arrayToEnum=s=>{let i={};for(let o of s)i[o]=o;return i},t.getValidEnumValues=s=>{let i=t.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),o={};for(let a of i)o[a]=s[a];return t.objectValues(o)},t.objectValues=s=>t.objectKeys(s).map(function(i){return s[i]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let i=[];for(let o in s)Object.prototype.hasOwnProperty.call(s,o)&&i.push(o);return i},t.find=(s,i)=>{for(let o of s)if(i(o))return o},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function n(s,i=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(B||(B={}));var ai;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(ai||(ai={}));var O=B.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),He=t=>{switch(typeof t){case"undefined":return O.undefined;case"string":return O.string;case"number":return Number.isNaN(t)?O.nan:O.number;case"boolean":return O.boolean;case"function":return O.function;case"bigint":return O.bigint;case"symbol":return O.symbol;case"object":return Array.isArray(t)?O.array:t===null?O.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?O.promise:typeof Map<"u"&&t instanceof Map?O.map:typeof Set<"u"&&t instanceof Set?O.set:typeof Date<"u"&&t instanceof Date?O.date:O.object;default:return O.unknown}};var x=B.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Qp=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),be=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(i){return i.message},n={_errors:[]},s=i=>{for(let o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)n._errors.push(r(o));else{let a=n,c=0;for(;c<o.path.length;){let u=o.path[c];c===o.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(o))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return s(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,B.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let s of this.issues)s.path.length>0?(r[s.path[0]]=r[s.path[0]]||[],r[s.path[0]].push(e(s))):n.push(e(s));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};be.create=t=>new be(t);var eh=(t,e)=>{let r;switch(t.code){case x.invalid_type:t.received===O.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case x.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,B.jsonStringifyReplacer)}`;break;case x.unrecognized_keys:r=`Unrecognized key(s) in object: ${B.joinValues(t.keys,", ")}`;break;case x.invalid_union:r="Invalid input";break;case x.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${B.joinValues(t.options)}`;break;case x.invalid_enum_value:r=`Invalid enum value. Expected ${B.joinValues(t.options)}, received '${t.received}'`;break;case x.invalid_arguments:r="Invalid function arguments";break;case x.invalid_return_type:r="Invalid function return type";break;case x.invalid_date:r="Invalid date";break;case x.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:B.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case x.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case x.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case x.custom:r="Invalid input";break;case x.invalid_intersection_types:r="Intersection results could not be merged";break;case x.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case x.not_finite:r="Number must be finite";break;default:r=e.defaultError,B.assertNever(t)}return{message:r}},st=eh;var ic=st;function th(t){ic=t}function sr(){return ic}var Nr=t=>{let{data:e,path:r,errorMaps:n,issueData:s}=t,i=[...r,...s.path||[]],o={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let a="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)a=u(o,{data:e,defaultError:a}).message;return{...s,path:i,message:a}},rh=[];function k(t,e){let r=sr(),n=Nr({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===st?void 0:st].filter(s=>!!s)});t.common.issues.push(n)}var ce=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let s of r){if(s.status==="aborted")return N;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let s of r){let i=await s.key,o=await s.value;n.push({key:i,value:o})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let s of r){let{key:i,value:o}=s;if(i.status==="aborted"||o.status==="aborted")return N;i.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(n[i.value]=o.value)}return{status:e.value,value:n}}},N=Object.freeze({status:"aborted"}),Ot=t=>({status:"dirty",value:t}),pe=t=>({status:"valid",value:t}),gn=t=>t.status==="aborted",yn=t=>t.status==="dirty",mt=t=>t.status==="valid",ir=t=>typeof Promise<"u"&&t instanceof Promise;var T;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(T||(T={}));var je=class{constructor(e,r,n,s){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},oc=(t,e)=>{if(mt(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new be(t.common.issues);return this._error=r,this._error}}};function L(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:s}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(o,a)=>{let{message:c}=t;return o.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??n??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:s}}var V=class{get description(){return this._def.description}_getType(e){return He(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:He(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ce,ctx:{common:e.parent.common,data:e.data,parsedType:He(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(ir(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:He(e)},s=this._parseSync({data:e,path:n.path,parent:n});return oc(n,s)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:He(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return mt(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>mt(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:He(e)},s=this._parse({data:e,path:n.path,parent:n}),i=await(ir(s)?s:Promise.resolve(s));return oc(n,i)}refine(e,r){let n=s=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(s):r;return this._refinement((s,i)=>{let o=e(s),a=()=>i.addIssue({code:x.custom,...n(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(e,r){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof r=="function"?r(n,s):r),!1))}_refinement(e){return new Ne({schema:this,typeName:C.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Pe.create(this,this._def)}nullable(){return Ge.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return at.create(this)}promise(){return _t.create(this,this._def)}or(e){return It.create([this,e],this._def)}and(e){return qt.create(this,e,this._def)}transform(e){return new Ne({...L(this._def),schema:this,typeName:C.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Vt({...L(this._def),innerType:this,defaultValue:r,typeName:C.ZodDefault})}brand(){return new Rr({typeName:C.ZodBranded,type:this,...L(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Ut({...L(this._def),innerType:this,catchValue:r,typeName:C.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Cr.create(this,e)}readonly(){return zt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},nh=/^c[^\s-]{8,}$/i,sh=/^[0-9a-z]+$/,ih=/^[0-9A-HJKMNP-TV-Z]{26}$/i,oh=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,ah=/^[a-z0-9_-]{21}$/i,ch=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,uh=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,lh=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,dh="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",ci,fh=/^(?:(?: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])$/,ph=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,hh=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,mh=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,gh=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,yh=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,cc="((\\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])))",_h=new RegExp(`^${cc}$`);function uc(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function vh(t){return new RegExp(`^${uc(t)}$`)}function lc(t){let e=`${cc}T${uc(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function bh(t,e){return!!((e==="v4"||!e)&&fh.test(t)||(e==="v6"||!e)&&hh.test(t))}function wh(t,e){if(!ch.test(t))return!1;try{let[r]=t.split("."),n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),s=JSON.parse(atob(n));return!(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function Sh(t,e){return!!((e==="v4"||!e)&&ph.test(t)||(e==="v6"||!e)&&mh.test(t))}var gt=class t extends V{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==O.string){let i=this._getOrReturnCtx(e);return k(i,{code:x.invalid_type,expected:O.string,received:i.parsedType}),N}let n=new ce,s;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(s=this._getOrReturnCtx(e,s),k(s,{code:x.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")e.data.length>i.value&&(s=this._getOrReturnCtx(e,s),k(s,{code:x.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let o=e.data.length>i.value,a=e.data.length<i.value;(o||a)&&(s=this._getOrReturnCtx(e,s),o?k(s,{code:x.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&k(s,{code:x.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")lh.test(e.data)||(s=this._getOrReturnCtx(e,s),k(s,{validation:"email",code:x.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")ci||(ci=new RegExp(dh,"u")),ci.test(e.data)||(s=this._getOrReturnCtx(e,s),k(s,{validation:"emoji",code:x.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")oh.test(e.data)||(s=this._getOrReturnCtx(e,s),k(s,{validation:"uuid",code:x.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")ah.test(e.data)||(s=this._getOrReturnCtx(e,s),k(s,{validation:"nanoid",code:x.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")nh.test(e.data)||(s=this._getOrReturnCtx(e,s),k(s,{validation:"cuid",code:x.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")sh.test(e.data)||(s=this._getOrReturnCtx(e,s),k(s,{validation:"cuid2",code:x.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")ih.test(e.data)||(s=this._getOrReturnCtx(e,s),k(s,{validation:"ulid",code:x.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),k(s,{validation:"url",code:x.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),k(s,{validation:"regex",code:x.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(e,s),k(s,{code:x.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(s=this._getOrReturnCtx(e,s),k(s,{code:x.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(s=this._getOrReturnCtx(e,s),k(s,{code:x.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?lc(i).test(e.data)||(s=this._getOrReturnCtx(e,s),k(s,{code:x.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?_h.test(e.data)||(s=this._getOrReturnCtx(e,s),k(s,{code:x.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?vh(i).test(e.data)||(s=this._getOrReturnCtx(e,s),k(s,{code:x.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?uh.test(e.data)||(s=this._getOrReturnCtx(e,s),k(s,{validation:"duration",code:x.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?bh(e.data,i.version)||(s=this._getOrReturnCtx(e,s),k(s,{validation:"ip",code:x.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?wh(e.data,i.alg)||(s=this._getOrReturnCtx(e,s),k(s,{validation:"jwt",code:x.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?Sh(e.data,i.version)||(s=this._getOrReturnCtx(e,s),k(s,{validation:"cidr",code:x.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?gh.test(e.data)||(s=this._getOrReturnCtx(e,s),k(s,{validation:"base64",code:x.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?yh.test(e.data)||(s=this._getOrReturnCtx(e,s),k(s,{validation:"base64url",code:x.invalid_string,message:i.message}),n.dirty()):B.assertNever(i);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(s=>e.test(s),{validation:r,code:x.invalid_string,...T.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...T.errToObj(e)})}url(e){return this._addCheck({kind:"url",...T.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...T.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...T.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...T.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...T.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...T.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...T.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...T.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...T.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...T.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...T.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...T.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...T.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...T.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...T.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...T.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...T.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...T.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...T.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...T.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...T.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...T.errToObj(r)})}nonempty(e){return this.min(1,T.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};gt.create=t=>new gt({checks:[],typeName:C.ZodString,coerce:t?.coerce??!1,...L(t)});function $h(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=r>n?r:n,i=Number.parseInt(t.toFixed(s).replace(".","")),o=Number.parseInt(e.toFixed(s).replace(".",""));return i%o/10**s}var Tt=class t extends V{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==O.number){let i=this._getOrReturnCtx(e);return k(i,{code:x.invalid_type,expected:O.number,received:i.parsedType}),N}let n,s=new ce;for(let i of this._def.checks)i.kind==="int"?B.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),k(n,{code:x.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),k(n,{code:x.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),k(n,{code:x.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?$h(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),k(n,{code:x.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),k(n,{code:x.not_finite,message:i.message}),s.dirty()):B.assertNever(i);return{status:s.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,T.toString(r))}gt(e,r){return this.setLimit("min",e,!1,T.toString(r))}lte(e,r){return this.setLimit("max",e,!0,T.toString(r))}lt(e,r){return this.setLimit("max",e,!1,T.toString(r))}setLimit(e,r,n,s){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:T.toString(s)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:T.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:T.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:T.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:T.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:T.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:T.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:T.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:T.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:T.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&B.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};Tt.create=t=>new Tt({checks:[],typeName:C.ZodNumber,coerce:t?.coerce||!1,...L(t)});var Pt=class t extends V{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==O.bigint)return this._getInvalidInput(e);let n,s=new ce;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),k(n,{code:x.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),k(n,{code:x.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),k(n,{code:x.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):B.assertNever(i);return{status:s.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return k(r,{code:x.invalid_type,expected:O.bigint,received:r.parsedType}),N}gte(e,r){return this.setLimit("min",e,!0,T.toString(r))}gt(e,r){return this.setLimit("min",e,!1,T.toString(r))}lte(e,r){return this.setLimit("max",e,!0,T.toString(r))}lt(e,r){return this.setLimit("max",e,!1,T.toString(r))}setLimit(e,r,n,s){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:T.toString(s)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:T.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:T.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:T.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:T.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:T.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Pt.create=t=>new Pt({checks:[],typeName:C.ZodBigInt,coerce:t?.coerce??!1,...L(t)});var jt=class extends V{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==O.boolean){let n=this._getOrReturnCtx(e);return k(n,{code:x.invalid_type,expected:O.boolean,received:n.parsedType}),N}return pe(e.data)}};jt.create=t=>new jt({typeName:C.ZodBoolean,coerce:t?.coerce||!1,...L(t)});var Nt=class t extends V{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==O.date){let i=this._getOrReturnCtx(e);return k(i,{code:x.invalid_type,expected:O.date,received:i.parsedType}),N}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return k(i,{code:x.invalid_date}),N}let n=new ce,s;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(s=this._getOrReturnCtx(e,s),k(s,{code:x.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(s=this._getOrReturnCtx(e,s),k(s,{code:x.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):B.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:T.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:T.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};Nt.create=t=>new Nt({checks:[],coerce:t?.coerce||!1,typeName:C.ZodDate,...L(t)});var ar=class extends V{_parse(e){if(this._getType(e)!==O.symbol){let n=this._getOrReturnCtx(e);return k(n,{code:x.invalid_type,expected:O.symbol,received:n.parsedType}),N}return pe(e.data)}};ar.create=t=>new ar({typeName:C.ZodSymbol,...L(t)});var Rt=class extends V{_parse(e){if(this._getType(e)!==O.undefined){let n=this._getOrReturnCtx(e);return k(n,{code:x.invalid_type,expected:O.undefined,received:n.parsedType}),N}return pe(e.data)}};Rt.create=t=>new Rt({typeName:C.ZodUndefined,...L(t)});var Ct=class extends V{_parse(e){if(this._getType(e)!==O.null){let n=this._getOrReturnCtx(e);return k(n,{code:x.invalid_type,expected:O.null,received:n.parsedType}),N}return pe(e.data)}};Ct.create=t=>new Ct({typeName:C.ZodNull,...L(t)});var yt=class extends V{constructor(){super(...arguments),this._any=!0}_parse(e){return pe(e.data)}};yt.create=t=>new yt({typeName:C.ZodAny,...L(t)});var ot=class extends V{constructor(){super(...arguments),this._unknown=!0}_parse(e){return pe(e.data)}};ot.create=t=>new ot({typeName:C.ZodUnknown,...L(t)});var De=class extends V{_parse(e){let r=this._getOrReturnCtx(e);return k(r,{code:x.invalid_type,expected:O.never,received:r.parsedType}),N}};De.create=t=>new De({typeName:C.ZodNever,...L(t)});var cr=class extends V{_parse(e){if(this._getType(e)!==O.undefined){let n=this._getOrReturnCtx(e);return k(n,{code:x.invalid_type,expected:O.void,received:n.parsedType}),N}return pe(e.data)}};cr.create=t=>new cr({typeName:C.ZodVoid,...L(t)});var at=class t extends V{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),s=this._def;if(r.parsedType!==O.array)return k(r,{code:x.invalid_type,expected:O.array,received:r.parsedType}),N;if(s.exactLength!==null){let o=r.data.length>s.exactLength.value,a=r.data.length<s.exactLength.value;(o||a)&&(k(r,{code:o?x.too_big:x.too_small,minimum:a?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&r.data.length<s.minLength.value&&(k(r,{code:x.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&r.data.length>s.maxLength.value&&(k(r,{code:x.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((o,a)=>s.type._parseAsync(new je(r,o,r.path,a)))).then(o=>ce.mergeArray(n,o));let i=[...r.data].map((o,a)=>s.type._parseSync(new je(r,o,r.path,a)));return ce.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:T.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:T.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:T.toString(r)}})}nonempty(e){return this.min(1,e)}};at.create=(t,e)=>new at({type:t,minLength:null,maxLength:null,exactLength:null,typeName:C.ZodArray,...L(e)});function or(t){if(t instanceof we){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=Pe.create(or(n))}return new we({...t._def,shape:()=>e})}else return t instanceof at?new at({...t._def,type:or(t.element)}):t instanceof Pe?Pe.create(or(t.unwrap())):t instanceof Ge?Ge.create(or(t.unwrap())):t instanceof Je?Je.create(t.items.map(e=>or(e))):t}var we=class t extends V{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=B.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==O.object){let u=this._getOrReturnCtx(e);return k(u,{code:x.invalid_type,expected:O.object,received:u.parsedType}),N}let{status:n,ctx:s}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof De&&this._def.unknownKeys==="strip"))for(let u in s.data)o.includes(u)||a.push(u);let c=[];for(let u of o){let l=i[u],d=s.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new je(s,d,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof De){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of a)c.push({key:{status:"valid",value:l},value:{status:"valid",value:s.data[l]}});else if(u==="strict")a.length>0&&(k(s,{code:x.unrecognized_keys,keys:a}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let l of a){let d=s.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new je(s,d,s.path,l)),alwaysSet:l in s.data})}}return s.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let d=await l.key,y=await l.value;u.push({key:d,value:y,alwaysSet:l.alwaysSet})}return u}).then(u=>ce.mergeObjectSync(n,u)):ce.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return T.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let s=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:T.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:C.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of B.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of B.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return or(this)}partial(e){let r={};for(let n of B.objectKeys(this.shape)){let s=this.shape[n];e&&!e[n]?r[n]=s:r[n]=s.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of B.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof Pe;)i=i._def.innerType;r[n]=i}return new t({...this._def,shape:()=>r})}keyof(){return dc(B.objectKeys(this.shape))}};we.create=(t,e)=>new we({shape:()=>t,unknownKeys:"strip",catchall:De.create(),typeName:C.ZodObject,...L(e)});we.strictCreate=(t,e)=>new we({shape:()=>t,unknownKeys:"strict",catchall:De.create(),typeName:C.ZodObject,...L(e)});we.lazycreate=(t,e)=>new we({shape:t,unknownKeys:"strip",catchall:De.create(),typeName:C.ZodObject,...L(e)});var It=class extends V{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function s(i){for(let a of i)if(a.result.status==="valid")return a.result;for(let a of i)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let o=i.map(a=>new be(a.ctx.common.issues));return k(r,{code:x.invalid_union,unionErrors:o}),N}if(r.common.async)return Promise.all(n.map(async i=>{let o={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:o}),ctx:o}})).then(s);{let i,o=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!i&&(i={result:l,ctx:u}),u.common.issues.length&&o.push(u.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let a=o.map(c=>new be(c));return k(r,{code:x.invalid_union,unionErrors:a}),N}}get options(){return this._def.options}};It.create=(t,e)=>new It({options:t,typeName:C.ZodUnion,...L(e)});var it=t=>t instanceof At?it(t.schema):t instanceof Ne?it(t.innerType()):t instanceof Dt?[t.value]:t instanceof Lt?t.options:t instanceof Mt?B.objectValues(t.enum):t instanceof Vt?it(t._def.innerType):t instanceof Rt?[void 0]:t instanceof Ct?[null]:t instanceof Pe?[void 0,...it(t.unwrap())]:t instanceof Ge?[null,...it(t.unwrap())]:t instanceof Rr||t instanceof zt?it(t.unwrap()):t instanceof Ut?it(t._def.innerType):[],_n=class t extends V{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==O.object)return k(r,{code:x.invalid_type,expected:O.object,received:r.parsedType}),N;let n=this.discriminator,s=r.data[n],i=this.optionsMap.get(s);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(k(r,{code:x.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),N)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let s=new Map;for(let i of r){let o=it(i.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of o){if(s.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);s.set(a,i)}}return new t({typeName:C.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:s,...L(n)})}};function ui(t,e){let r=He(t),n=He(e);if(t===e)return{valid:!0,data:t};if(r===O.object&&n===O.object){let s=B.objectKeys(e),i=B.objectKeys(t).filter(a=>s.indexOf(a)!==-1),o={...t,...e};for(let a of i){let c=ui(t[a],e[a]);if(!c.valid)return{valid:!1};o[a]=c.data}return{valid:!0,data:o}}else if(r===O.array&&n===O.array){if(t.length!==e.length)return{valid:!1};let s=[];for(let i=0;i<t.length;i++){let o=t[i],a=e[i],c=ui(o,a);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return r===O.date&&n===O.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var qt=class extends V{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),s=(i,o)=>{if(gn(i)||gn(o))return N;let a=ui(i.value,o.value);return a.valid?((yn(i)||yn(o))&&r.dirty(),{status:r.value,value:a.data}):(k(n,{code:x.invalid_intersection_types}),N)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,o])=>s(i,o)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};qt.create=(t,e,r)=>new qt({left:t,right:e,typeName:C.ZodIntersection,...L(r)});var Je=class t extends V{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==O.array)return k(n,{code:x.invalid_type,expected:O.array,received:n.parsedType}),N;if(n.data.length<this._def.items.length)return k(n,{code:x.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),N;!this._def.rest&&n.data.length>this._def.items.length&&(k(n,{code:x.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((o,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new je(n,o,n.path,a)):null}).filter(o=>!!o);return n.common.async?Promise.all(i).then(o=>ce.mergeArray(r,o)):ce.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Je.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Je({items:t,typeName:C.ZodTuple,rest:null,...L(e)})};var vn=class t extends V{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==O.object)return k(n,{code:x.invalid_type,expected:O.object,received:n.parsedType}),N;let s=[],i=this._def.keyType,o=this._def.valueType;for(let a in n.data)s.push({key:i._parse(new je(n,a,n.path,a)),value:o._parse(new je(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?ce.mergeObjectAsync(r,s):ce.mergeObjectSync(r,s)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof V?new t({keyType:e,valueType:r,typeName:C.ZodRecord,...L(n)}):new t({keyType:gt.create(),valueType:e,typeName:C.ZodRecord,...L(r)})}},ur=class extends V{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==O.map)return k(n,{code:x.invalid_type,expected:O.map,received:n.parsedType}),N;let s=this._def.keyType,i=this._def.valueType,o=[...n.data.entries()].map(([a,c],u)=>({key:s._parse(new je(n,a,n.path,[u,"key"])),value:i._parse(new je(n,c,n.path,[u,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of o){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return N;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let c of o){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return N;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}}}};ur.create=(t,e,r)=>new ur({valueType:e,keyType:t,typeName:C.ZodMap,...L(r)});var lr=class t extends V{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==O.set)return k(n,{code:x.invalid_type,expected:O.set,received:n.parsedType}),N;let s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(k(n,{code:x.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),r.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(k(n,{code:x.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),r.dirty());let i=this._def.valueType;function o(c){let u=new Set;for(let l of c){if(l.status==="aborted")return N;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let a=[...n.data.values()].map((c,u)=>i._parse(new je(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>o(c)):o(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:T.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:T.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};lr.create=(t,e)=>new lr({valueType:t,minSize:null,maxSize:null,typeName:C.ZodSet,...L(e)});var bn=class t extends V{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==O.function)return k(r,{code:x.invalid_type,expected:O.function,received:r.parsedType}),N;function n(a,c){return Nr({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,sr(),st].filter(u=>!!u),issueData:{code:x.invalid_arguments,argumentsError:c}})}function s(a,c){return Nr({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,sr(),st].filter(u=>!!u),issueData:{code:x.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},o=r.data;if(this._def.returns instanceof _t){let a=this;return pe(async function(...c){let u=new be([]),l=await a._def.args.parseAsync(c,i).catch(h=>{throw u.addIssue(n(c,h)),u}),d=await Reflect.apply(o,this,l);return await a._def.returns._def.type.parseAsync(d,i).catch(h=>{throw u.addIssue(s(d,h)),u})})}else{let a=this;return pe(function(...c){let u=a._def.args.safeParse(c,i);if(!u.success)throw new be([n(c,u.error)]);let l=Reflect.apply(o,this,u.data),d=a._def.returns.safeParse(l,i);if(!d.success)throw new be([s(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Je.create(e).rest(ot.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||Je.create([]).rest(ot.create()),returns:r||ot.create(),typeName:C.ZodFunction,...L(n)})}},At=class extends V{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};At.create=(t,e)=>new At({getter:t,typeName:C.ZodLazy,...L(e)});var Dt=class extends V{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return k(r,{received:r.data,code:x.invalid_literal,expected:this._def.value}),N}return{status:"valid",value:e.data}}get value(){return this._def.value}};Dt.create=(t,e)=>new Dt({value:t,typeName:C.ZodLiteral,...L(e)});function dc(t,e){return new Lt({values:t,typeName:C.ZodEnum,...L(e)})}var Lt=class t extends V{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return k(r,{expected:B.joinValues(n),received:r.parsedType,code:x.invalid_type}),N}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return k(r,{received:r.data,code:x.invalid_enum_value,options:n}),N}return pe(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};Lt.create=dc;var Mt=class extends V{_parse(e){let r=B.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==O.string&&n.parsedType!==O.number){let s=B.objectValues(r);return k(n,{expected:B.joinValues(s),received:n.parsedType,code:x.invalid_type}),N}if(this._cache||(this._cache=new Set(B.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let s=B.objectValues(r);return k(n,{received:n.data,code:x.invalid_enum_value,options:s}),N}return pe(e.data)}get enum(){return this._def.values}};Mt.create=(t,e)=>new Mt({values:t,typeName:C.ZodNativeEnum,...L(e)});var _t=class extends V{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==O.promise&&r.common.async===!1)return k(r,{code:x.invalid_type,expected:O.promise,received:r.parsedType}),N;let n=r.parsedType===O.promise?r.data:Promise.resolve(r.data);return pe(n.then(s=>this._def.type.parseAsync(s,{path:r.path,errorMap:r.common.contextualErrorMap})))}};_t.create=(t,e)=>new _t({type:t,typeName:C.ZodPromise,...L(e)});var Ne=class extends V{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===C.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:o=>{k(n,o),o.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){let o=s.transform(n.data,i);if(n.common.async)return Promise.resolve(o).then(async a=>{if(r.value==="aborted")return N;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?N:c.status==="dirty"?Ot(c.value):r.value==="dirty"?Ot(c.value):c});{if(r.value==="aborted")return N;let a=this._def.schema._parseSync({data:o,path:n.path,parent:n});return a.status==="aborted"?N:a.status==="dirty"?Ot(a.value):r.value==="dirty"?Ot(a.value):a}}if(s.type==="refinement"){let o=a=>{let c=s.refinement(a,i);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?N:(a.status==="dirty"&&r.dirty(),o(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?N:(a.status==="dirty"&&r.dirty(),o(a.value).then(()=>({status:r.value,value:a.value}))))}if(s.type==="transform")if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!mt(o))return N;let a=s.transform(o.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>mt(o)?Promise.resolve(s.transform(o.value,i)).then(a=>({status:r.value,value:a})):N);B.assertNever(s)}};Ne.create=(t,e,r)=>new Ne({schema:t,typeName:C.ZodEffects,effect:e,...L(r)});Ne.createWithPreprocess=(t,e,r)=>new Ne({schema:e,effect:{type:"preprocess",transform:t},typeName:C.ZodEffects,...L(r)});var Pe=class extends V{_parse(e){return this._getType(e)===O.undefined?pe(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Pe.create=(t,e)=>new Pe({innerType:t,typeName:C.ZodOptional,...L(e)});var Ge=class extends V{_parse(e){return this._getType(e)===O.null?pe(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ge.create=(t,e)=>new Ge({innerType:t,typeName:C.ZodNullable,...L(e)});var Vt=class extends V{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===O.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Vt.create=(t,e)=>new Vt({innerType:t,typeName:C.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...L(e)});var Ut=class extends V{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return ir(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new be(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new be(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Ut.create=(t,e)=>new Ut({innerType:t,typeName:C.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...L(e)});var dr=class extends V{_parse(e){if(this._getType(e)!==O.nan){let n=this._getOrReturnCtx(e);return k(n,{code:x.invalid_type,expected:O.nan,received:n.parsedType}),N}return{status:"valid",value:e.data}}};dr.create=t=>new dr({typeName:C.ZodNaN,...L(t)});var xh=Symbol("zod_brand"),Rr=class extends V{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},Cr=class t extends V{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?N:i.status==="dirty"?(r.dirty(),Ot(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?N:s.status==="dirty"?(r.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:C.ZodPipeline})}},zt=class extends V{_parse(e){let r=this._def.innerType._parse(e),n=s=>(mt(s)&&(s.value=Object.freeze(s.value)),s);return ir(r)?r.then(s=>n(s)):n(r)}unwrap(){return this._def.innerType}};zt.create=(t,e)=>new zt({innerType:t,typeName:C.ZodReadonly,...L(e)});function ac(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function fc(t,e={},r){return t?yt.create().superRefine((n,s)=>{let i=t(n);if(i instanceof Promise)return i.then(o=>{if(!o){let a=ac(e,n),c=a.fatal??r??!0;s.addIssue({code:"custom",...a,fatal:c})}});if(!i){let o=ac(e,n),a=o.fatal??r??!0;s.addIssue({code:"custom",...o,fatal:a})}}):yt.create()}var Eh={object:we.lazycreate},C;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(C||(C={}));var kh=(t,e={message:`Input not instance of ${t.name}`})=>fc(r=>r instanceof t,e),pc=gt.create,hc=Tt.create,Oh=dr.create,Th=Pt.create,mc=jt.create,Ph=Nt.create,jh=ar.create,Nh=Rt.create,Rh=Ct.create,Ch=yt.create,Ih=ot.create,qh=De.create,Ah=cr.create,Dh=at.create,Lh=we.create,Mh=we.strictCreate,Vh=It.create,Uh=_n.create,zh=qt.create,Fh=Je.create,Bh=vn.create,Kh=ur.create,Hh=lr.create,Jh=bn.create,Gh=At.create,Wh=Dt.create,Zh=Lt.create,Yh=Mt.create,Xh=_t.create,Qh=Ne.create,em=Pe.create,tm=Ge.create,rm=Ne.createWithPreprocess,nm=Cr.create,sm=()=>pc().optional(),im=()=>hc().optional(),om=()=>mc().optional(),am={string:t=>gt.create({...t,coerce:!0}),number:t=>Tt.create({...t,coerce:!0}),boolean:t=>jt.create({...t,coerce:!0}),bigint:t=>Pt.create({...t,coerce:!0}),date:t=>Nt.create({...t,coerce:!0})};var cm=N;var li="2025-03-26",gc=[li,"2024-11-05","2024-10-07"],wn="2.0",yc=p.union([p.string(),p.number().int()]),_c=p.string(),um=p.object({progressToken:p.optional(yc)}).passthrough(),Le=p.object({_meta:p.optional(um)}).passthrough(),Te=p.object({method:p.string(),params:p.optional(Le)}),Ir=p.object({_meta:p.optional(p.object({}).passthrough())}).passthrough(),We=p.object({method:p.string(),params:p.optional(Ir)}),Me=p.object({_meta:p.optional(p.object({}).passthrough())}).passthrough(),Sn=p.union([p.string(),p.number().int()]),vc=p.object({jsonrpc:p.literal(wn),id:Sn}).merge(Te).strict(),bc=t=>vc.safeParse(t).success,wc=p.object({jsonrpc:p.literal(wn)}).merge(We).strict(),Sc=t=>wc.safeParse(t).success,$c=p.object({jsonrpc:p.literal(wn),id:Sn,result:Me}).strict(),di=t=>$c.safeParse(t).success,ue;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError"})(ue||(ue={}));var xc=p.object({jsonrpc:p.literal(wn),id:Sn,error:p.object({code:p.number().int(),message:p.string(),data:p.optional(p.unknown())})}).strict(),Ec=t=>xc.safeParse(t).success,kc=p.union([vc,wc,$c,xc]),$n=Me.strict(),xn=We.extend({method:p.literal("notifications/cancelled"),params:Ir.extend({requestId:Sn,reason:p.string().optional()})}),Oc=p.object({name:p.string(),version:p.string()}).passthrough(),lm=p.object({experimental:p.optional(p.object({}).passthrough()),sampling:p.optional(p.object({}).passthrough()),roots:p.optional(p.object({listChanged:p.optional(p.boolean())}).passthrough())}).passthrough(),fi=Te.extend({method:p.literal("initialize"),params:Le.extend({protocolVersion:p.string(),capabilities:lm,clientInfo:Oc})});var dm=p.object({experimental:p.optional(p.object({}).passthrough()),logging:p.optional(p.object({}).passthrough()),completions:p.optional(p.object({}).passthrough()),prompts:p.optional(p.object({listChanged:p.optional(p.boolean())}).passthrough()),resources:p.optional(p.object({subscribe:p.optional(p.boolean()),listChanged:p.optional(p.boolean())}).passthrough()),tools:p.optional(p.object({listChanged:p.optional(p.boolean())}).passthrough())}).passthrough(),fm=Me.extend({protocolVersion:p.string(),capabilities:dm,serverInfo:Oc,instructions:p.optional(p.string())}),pi=We.extend({method:p.literal("notifications/initialized")});var En=Te.extend({method:p.literal("ping")}),pm=p.object({progress:p.number(),total:p.optional(p.number()),message:p.optional(p.string())}).passthrough(),kn=We.extend({method:p.literal("notifications/progress"),params:Ir.merge(pm).extend({progressToken:yc})}),On=Te.extend({params:Le.extend({cursor:p.optional(_c)}).optional()}),Tn=Me.extend({nextCursor:p.optional(_c)}),Tc=p.object({uri:p.string(),mimeType:p.optional(p.string())}).passthrough(),Pc=Tc.extend({text:p.string()}),jc=Tc.extend({blob:p.string().base64()}),hm=p.object({uri:p.string(),name:p.string(),description:p.optional(p.string()),mimeType:p.optional(p.string())}).passthrough(),mm=p.object({uriTemplate:p.string(),name:p.string(),description:p.optional(p.string()),mimeType:p.optional(p.string())}).passthrough(),gm=On.extend({method:p.literal("resources/list")}),ym=Tn.extend({resources:p.array(hm)}),_m=On.extend({method:p.literal("resources/templates/list")}),vm=Tn.extend({resourceTemplates:p.array(mm)}),bm=Te.extend({method:p.literal("resources/read"),params:Le.extend({uri:p.string()})}),wm=Me.extend({contents:p.array(p.union([Pc,jc]))}),Sm=We.extend({method:p.literal("notifications/resources/list_changed")}),$m=Te.extend({method:p.literal("resources/subscribe"),params:Le.extend({uri:p.string()})}),xm=Te.extend({method:p.literal("resources/unsubscribe"),params:Le.extend({uri:p.string()})}),Em=We.extend({method:p.literal("notifications/resources/updated"),params:Ir.extend({uri:p.string()})}),km=p.object({name:p.string(),description:p.optional(p.string()),required:p.optional(p.boolean())}).passthrough(),Om=p.object({name:p.string(),description:p.optional(p.string()),arguments:p.optional(p.array(km))}).passthrough(),Tm=On.extend({method:p.literal("prompts/list")}),Pm=Tn.extend({prompts:p.array(Om)}),jm=Te.extend({method:p.literal("prompts/get"),params:Le.extend({name:p.string(),arguments:p.optional(p.record(p.string()))})}),Pn=p.object({type:p.literal("text"),text:p.string()}).passthrough(),jn=p.object({type:p.literal("image"),data:p.string().base64(),mimeType:p.string()}).passthrough(),Nn=p.object({type:p.literal("audio"),data:p.string().base64(),mimeType:p.string()}).passthrough(),Nc=p.object({type:p.literal("resource"),resource:p.union([Pc,jc])}).passthrough(),Nm=p.object({role:p.enum(["user","assistant"]),content:p.union([Pn,jn,Nn,Nc])}).passthrough(),Rm=Me.extend({description:p.optional(p.string()),messages:p.array(Nm)}),Cm=We.extend({method:p.literal("notifications/prompts/list_changed")}),Im=p.object({title:p.optional(p.string()),readOnlyHint:p.optional(p.boolean()),destructiveHint:p.optional(p.boolean()),idempotentHint:p.optional(p.boolean()),openWorldHint:p.optional(p.boolean())}).passthrough(),qm=p.object({name:p.string(),description:p.optional(p.string()),inputSchema:p.object({type:p.literal("object"),properties:p.optional(p.object({}).passthrough()),required:p.optional(p.array(p.string()))}).passthrough(),outputSchema:p.optional(p.object({type:p.literal("object"),properties:p.optional(p.object({}).passthrough()),required:p.optional(p.array(p.string()))}).passthrough()),annotations:p.optional(Im)}).passthrough(),Am=On.extend({method:p.literal("tools/list")}),Dm=Tn.extend({tools:p.array(qm)}),Rc=Me.extend({content:p.array(p.union([Pn,jn,Nn,Nc])).default([]),structuredContent:p.object({}).passthrough().optional(),isError:p.optional(p.boolean())}),Ek=Rc.or(Me.extend({toolResult:p.unknown()})),hi=Te.extend({method:p.literal("tools/call"),params:Le.extend({name:p.string(),arguments:p.optional(p.record(p.unknown()))})}),Lm=We.extend({method:p.literal("notifications/tools/list_changed")}),Cc=p.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),Mm=Te.extend({method:p.literal("logging/setLevel"),params:Le.extend({level:Cc})}),Vm=We.extend({method:p.literal("notifications/message"),params:Ir.extend({level:Cc,logger:p.optional(p.string()),data:p.unknown()})}),Um=p.object({name:p.string().optional()}).passthrough(),zm=p.object({hints:p.optional(p.array(Um)),costPriority:p.optional(p.number().min(0).max(1)),speedPriority:p.optional(p.number().min(0).max(1)),intelligencePriority:p.optional(p.number().min(0).max(1))}).passthrough(),Fm=p.object({role:p.enum(["user","assistant"]),content:p.union([Pn,jn,Nn])}).passthrough(),Bm=Te.extend({method:p.literal("sampling/createMessage"),params:Le.extend({messages:p.array(Fm),systemPrompt:p.optional(p.string()),includeContext:p.optional(p.enum(["none","thisServer","allServers"])),temperature:p.optional(p.number()),maxTokens:p.number().int(),stopSequences:p.optional(p.array(p.string())),metadata:p.optional(p.object({}).passthrough()),modelPreferences:p.optional(zm)})}),mi=Me.extend({model:p.string(),stopReason:p.optional(p.enum(["endTurn","stopSequence","maxTokens"]).or(p.string())),role:p.enum(["user","assistant"]),content:p.discriminatedUnion("type",[Pn,jn,Nn])}),Km=p.object({type:p.literal("ref/resource"),uri:p.string()}).passthrough(),Hm=p.object({type:p.literal("ref/prompt"),name:p.string()}).passthrough(),Jm=Te.extend({method:p.literal("completion/complete"),params:Le.extend({ref:p.union([Hm,Km]),argument:p.object({name:p.string(),value:p.string()}).passthrough()})}),Gm=Me.extend({completion:p.object({values:p.array(p.string()).max(100),total:p.optional(p.number().int()),hasMore:p.optional(p.boolean())}).passthrough()}),Wm=p.object({uri:p.string().startsWith("file://"),name:p.optional(p.string())}).passthrough(),Zm=Te.extend({method:p.literal("roots/list")}),gi=Me.extend({roots:p.array(Wm)}),Ym=We.extend({method:p.literal("notifications/roots/list_changed")}),kk=p.union([En,fi,Jm,Mm,jm,Tm,gm,_m,bm,$m,xm,hi,Am]),Ok=p.union([xn,kn,pi,Ym]),Tk=p.union([$n,mi,gi]),Pk=p.union([En,Bm,Zm]),jk=p.union([xn,kn,Vm,Em,Sm,Lm,Cm]),Nk=p.union([$n,fm,Gm,Rm,Pm,ym,vm,wm,Rc,Dm]),Se=class extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}};var Rn=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
`);if(e===-1)return null;let r=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),Xm(r)}clear(){this._buffer=void 0}};function Xm(t){return kc.parse(JSON.parse(t))}function Ic(t){return JSON.stringify(t)+`
`}var Cn=class{constructor(e=yi.default.stdin,r=yi.default.stdout){this._stdin=e,this._stdout=r,this._readBuffer=new Rn,this._started=!1,this._ondata=n=>{this._readBuffer.append(n),this.processReadBuffer()},this._onerror=n=>{var s;(s=this.onerror)===null||s===void 0||s.call(this,n)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(var e,r;;)try{let n=this._readBuffer.readMessage();if(n===null)break;(e=this.onmessage)===null||e===void 0||e.call(this,n)}catch(n){(r=this.onerror)===null||r===void 0||r.call(this,n)}}async close(){var e;this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),(e=this.onclose)===null||e===void 0||e.call(this)}send(e){return new Promise(r=>{let n=Ic(e);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};var Qm=6e4,In=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this.setNotificationHandler(xn,r=>{let n=this._requestHandlerAbortControllers.get(r.params.requestId);n?.abort(r.params.reason)}),this.setNotificationHandler(kn,r=>{this._onprogress(r)}),this.setRequestHandler(En,r=>({}))}_setupTimeout(e,r,n,s,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(s,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:s})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),new Se(ue.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){this._transport=e,this._transport.onclose=()=>{this._onclose()},this._transport.onerror=r=>{this._onerror(r)},this._transport.onmessage=(r,n)=>{di(r)||Ec(r)?this._onresponse(r):bc(r)?this._onrequest(r,n):Sc(r)?this._onnotification(r):this._onerror(new Error(`Unknown message type: ${JSON.stringify(r)}`))},await this._transport.start()}_onclose(){var e;let r=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);let n=new Se(ue.ConnectionClosed,"Connection closed");for(let s of r.values())s(n)}_onerror(e){var r;(r=this.onerror)===null||r===void 0||r.call(this,e)}_onnotification(e){var r;let n=(r=this._notificationHandlers.get(e.method))!==null&&r!==void 0?r:this.fallbackNotificationHandler;n!==void 0&&Promise.resolve().then(()=>n(e)).catch(s=>this._onerror(new Error(`Uncaught error in notification handler: ${s}`)))}_onrequest(e,r){var n,s,i,o;let a=(n=this._requestHandlers.get(e.method))!==null&&n!==void 0?n:this.fallbackRequestHandler;if(a===void 0){(s=this._transport)===null||s===void 0||s.send({jsonrpc:"2.0",id:e.id,error:{code:ue.MethodNotFound,message:"Method not found"}}).catch(l=>this._onerror(new Error(`Failed to send an error response: ${l}`)));return}let c=new AbortController;this._requestHandlerAbortControllers.set(e.id,c);let u={signal:c.signal,sessionId:(i=this._transport)===null||i===void 0?void 0:i.sessionId,_meta:(o=e.params)===null||o===void 0?void 0:o._meta,sendNotification:l=>this.notification(l,{relatedRequestId:e.id}),sendRequest:(l,d,y)=>this.request(l,d,{...y,relatedRequestId:e.id}),authInfo:r?.authInfo,requestId:e.id};Promise.resolve().then(()=>a(e,u)).then(l=>{var d;if(!c.signal.aborted)return(d=this._transport)===null||d===void 0?void 0:d.send({result:l,jsonrpc:"2.0",id:e.id})},l=>{var d,y;if(!c.signal.aborted)return(d=this._transport)===null||d===void 0?void 0:d.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(l.code)?l.code:ue.InternalError,message:(y=l.message)!==null&&y!==void 0?y:"Internal error"}})}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...n}=e.params,s=Number(r),i=this._progressHandlers.get(s);if(!i){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let o=this._responseHandlers.get(s),a=this._timeoutInfo.get(s);if(a&&o&&a.resetTimeoutOnProgress)try{this._resetTimeout(s)}catch(c){o(c);return}i(n)}_onresponse(e){let r=Number(e.id),n=this._responseHandlers.get(r);if(n===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),di(e))n(e);else{let s=new Se(e.error.code,e.error.message,e.error.data);n(s)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}request(e,r,n){let{relatedRequestId:s,resumptionToken:i,onresumptiontoken:o}=n??{};return new Promise((a,c)=>{var u,l,d,y,h,f;if(!this._transport){c(new Error("Not connected"));return}((u=this._options)===null||u===void 0?void 0:u.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(l=n?.signal)===null||l===void 0||l.throwIfAborted();let m=this._requestMessageId++,g={...e,jsonrpc:"2.0",id:m};n?.onprogress&&(this._progressHandlers.set(m,n.onprogress),g.params={...e.params,_meta:{...((d=e.params)===null||d===void 0?void 0:d._meta)||{},progressToken:m}});let _=$=>{var E;this._responseHandlers.delete(m),this._progressHandlers.delete(m),this._cleanupTimeout(m),(E=this._transport)===null||E===void 0||E.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:m,reason:String($)}},{relatedRequestId:s,resumptionToken:i,onresumptiontoken:o}).catch(j=>this._onerror(new Error(`Failed to send cancellation: ${j}`))),c($)};this._responseHandlers.set(m,$=>{var E;if(!(!((E=n?.signal)===null||E===void 0)&&E.aborted)){if($ instanceof Error)return c($);try{let j=r.parse($.result);a(j)}catch(j){c(j)}}}),(y=n?.signal)===null||y===void 0||y.addEventListener("abort",()=>{var $;_(($=n?.signal)===null||$===void 0?void 0:$.reason)});let b=(h=n?.timeout)!==null&&h!==void 0?h:Qm,S=()=>_(new Se(ue.RequestTimeout,"Request timed out",{timeout:b}));this._setupTimeout(m,b,n?.maxTotalTimeout,S,(f=n?.resetTimeoutOnProgress)!==null&&f!==void 0?f:!1),this._transport.send(g,{relatedRequestId:s,resumptionToken:i,onresumptiontoken:o}).catch($=>{this._cleanupTimeout(m),c($)})})}async notification(e,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let n={...e,jsonrpc:"2.0"};await this._transport.send(n,r)}setRequestHandler(e,r){let n=e.shape.method.value;this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(s,i)=>Promise.resolve(r(e.parse(s),i)))}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){this._notificationHandlers.set(e.shape.method.value,n=>Promise.resolve(r(e.parse(n))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function qc(t,e){return Object.entries(e).reduce((r,[n,s])=>(s&&typeof s=="object"?r[n]=r[n]?{...r[n],...s}:s:r[n]=s,r),{...t})}var qn=class extends In{constructor(e,r){var n;super(r),this._serverInfo=e,this._capabilities=(n=r?.capabilities)!==null&&n!==void 0?n:{},this._instructions=r?.instructions,this.setRequestHandler(fi,s=>this._oninitialize(s)),this.setNotificationHandler(pi,()=>{var s;return(s=this.oninitialized)===null||s===void 0?void 0:s.call(this)})}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=qc(this._capabilities,e)}assertCapabilityForMethod(e){var r,n;switch(e){case"sampling/createMessage":if(!(!((r=this._clientCapabilities)===null||r===void 0)&&r.sampling))throw new Error(`Client does not support sampling (required for ${e})`);break;case"roots/list":if(!(!((n=this._clientCapabilities)===null||n===void 0)&&n.roots))throw new Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Server does not support sampling (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"ping":case"initialize":break}}async _oninitialize(e){let r=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:gc.includes(r)?r:li,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},$n)}async createMessage(e,r){return this.request({method:"sampling/createMessage",params:e},mi,r)}async listRoots(e,r){return this.request({method:"roots/list",params:e},gi,r)}async sendLoggingMessage(e){return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};var An=class{constructor(e,r){this.config=e,this.logger=r}async retry(e,r=3){for(let n=1;n<=r;n++)try{return await e()}catch(s){if(n===r||!this.isRetryableError(s))throw s;let i=Math.min(200*Math.pow(2,n-1),2e3);this.logger.warn({attempt:n,maxAttempts:r,delay:i},"Request failed, retrying"),await new Promise(o=>setTimeout(o,i))}throw new Error("Max attempts exceeded")}isRetryableError(e){return e.message&&e.message.includes("HTTP 4")?!1:!!(e.message&&(e.message.includes("HTTP 5")||e.name==="TypeError"||e.name==="AbortError"||e.code==="ECONNRESET"||e.code==="ENOTFOUND"||e.code==="ECONNREFUSED"))}async request(e,r,n,s){let i=`${this.config.revenueCatApiUrl}${r}`;if(s){let a=new URLSearchParams(s).toString();i+=`?${a}`}let o=crypto.randomUUID();return this.logger.info({requestId:o,method:e,url:i},"HTTP request started"),this.retry(async()=>{let a=await fetch(i,{method:e,headers:{Authorization:`Bearer ${this.config.revenueCatSecretKey}`,"Content-Type":"application/json","X-Request-ID":o},body:n?JSON.stringify(n):void 0});if(!a.ok){let u=await a.text();throw this.logger.error({requestId:o,status:a.status,error:u},"HTTP request failed"),new Error(`HTTP ${a.status}: ${u}`)}let c=await a.json();return this.logger.info({requestId:o},"HTTP request completed"),c})}};function Ac(t){return t.message?.includes("HTTP 400")?new Se(ue.InvalidParams,"Validation error",t.message):t.message?.includes("HTTP 401")?new Se(ue.InvalidRequest,"Unauthenticated"):t.message?.includes("HTTP 403")?new Se(ue.InvalidRequest,"Forbidden"):t.message?.includes("HTTP 404")?new Se(ue.InvalidParams,"Not found"):t.message?.includes("HTTP 429")?new Se(ue.InvalidRequest,"Rate limited"):new Se(ue.InternalError,"Internal server error")}var _d=mn(md(),1);var kr={type:"object",properties:{id:{type:"string",minLength:1}},required:["id"],additionalProperties:!1},ys={type:"object",properties:{project_id:{type:"string",minLength:1},id:{type:"string",minLength:1}},required:["project_id","id"],additionalProperties:!1},ra={type:"object",properties:{cursor:{type:"string",minLength:1,nullable:!0}},required:[],additionalProperties:!1},gd={type:"object",properties:{project_id:{type:"string",minLength:1},cursor:{type:"string",minLength:1,nullable:!0}},required:["project_id"],additionalProperties:!1},xw={type:"object",properties:{project_id:{type:"string",minLength:1},name:{type:"string",minLength:1},description:{type:"string",nullable:!0},is_default:{type:"boolean",nullable:!0},packages:{type:"array",items:{type:"string",minLength:1},nullable:!0}},required:["project_id","name"],additionalProperties:!1},Ew={type:"object",properties:{project_id:{type:"string",minLength:1},id:{type:"string",minLength:1},name:{type:"string",minLength:1,nullable:!0},description:{type:"string",nullable:!0},is_default:{type:"boolean",nullable:!0},packages:{type:"array",items:{type:"string",minLength:1},nullable:!0}},required:["project_id","id"],additionalProperties:!1},kw={type:"object",properties:{identifier:{type:"string",minLength:1},name:{type:"string",minLength:1},description:{type:"string",nullable:!0},product_identifiers:{type:"array",items:{type:"string",minLength:1},nullable:!0}},required:["identifier","name"],additionalProperties:!1},Ow={type:"object",properties:{id:{type:"string",minLength:1},identifier:{type:"string",minLength:1,nullable:!0},name:{type:"string",minLength:1,nullable:!0},description:{type:"string",nullable:!0},product_identifiers:{type:"array",items:{type:"string",minLength:1},nullable:!0}},required:["id"],additionalProperties:!1},Tw={type:"object",properties:{project_id:{type:"string",minLength:1},identifier:{type:"string",minLength:1},name:{type:"string",minLength:1},description:{type:"string",nullable:!0},type:{type:"string",enum:["subscription","non_consumable","consumable"]},store_identifiers:{type:"object",additionalProperties:{type:"string",minLength:1},nullable:!0}},required:["project_id","identifier","name","type"],additionalProperties:!1},Pw={type:"object",properties:{project_id:{type:"string",minLength:1},id:{type:"string",minLength:1},identifier:{type:"string",minLength:1,nullable:!0},name:{type:"string",minLength:1,nullable:!0},description:{type:"string",nullable:!0},type:{type:"string",enum:["subscription","non_consumable","consumable"],nullable:!0},store_identifiers:{type:"object",additionalProperties:{type:"string",minLength:1},nullable:!0}},required:["project_id","id"],additionalProperties:!1},jw={type:"object",properties:{identifier:{type:"string",minLength:1},name:{type:"string",minLength:1},position:{type:"number",minimum:0,nullable:!0},product_identifiers:{type:"array",items:{type:"string",minLength:1},nullable:!0}},required:["identifier","name"],additionalProperties:!1},Nw={type:"object",properties:{id:{type:"string",minLength:1},identifier:{type:"string",minLength:1,nullable:!0},name:{type:"string",minLength:1,nullable:!0},position:{type:"number",minimum:0,nullable:!0},product_identifiers:{type:"array",items:{type:"string",minLength:1},nullable:!0}},required:["id"],additionalProperties:!1},Rw={type:"object",properties:{name:{type:"string",minLength:1},description:{type:"string",nullable:!0},status:{type:"string",enum:["active","inactive","completed"],nullable:!0},treatment_group_percentage:{type:"number",minimum:0,maximum:100}},required:["name","treatment_group_percentage"],additionalProperties:!1},Cw={type:"object",properties:{id:{type:"string",minLength:1},name:{type:"string",minLength:1,nullable:!0},description:{type:"string",nullable:!0},status:{type:"string",enum:["active","inactive","completed"],nullable:!0},treatment_group_percentage:{type:"number",minimum:0,maximum:100,nullable:!0}},required:["id"],additionalProperties:!1},yd={CreateOffering:xw,GetOffering:ys,UpdateOffering:Ew,DeleteOffering:ys,ListOfferings:gd,CreateEntitlement:kw,GetEntitlement:kr,UpdateEntitlement:Ow,DeleteEntitlement:kr,ListEntitlements:ra,CreateProduct:Tw,GetProduct:ys,UpdateProduct:Pw,DeleteProduct:ys,ListProducts:gd,CreatePackage:jw,GetPackage:kr,UpdatePackage:Nw,DeletePackage:kr,ListPackages:ra,CreatePriceExperiment:Rw,GetPriceExperiment:kr,UpdatePriceExperiment:Cw,DeletePriceExperiment:kr,ListPriceExperiments:ra};var Qt=class extends Error{constructor(e,r,n){super(`Validation failed for field '${e}': ${r}`),this.field=e,this.message=r,this.value=n,this.name="ValidationError"}},na=class t{constructor(){this.validators=new Map,this.ajv=new _d.default({allErrors:!0,verbose:!0,strict:!1,removeAdditional:!0}),this.compileValidators()}compileValidators(){for(let[e,r]of Object.entries(yd))try{let n=this.ajv.compile(r);this.validators.set(e,n)}catch(n){throw new Error(`Failed to compile validator for ${e}: ${n}`)}}validateToolArguments(e,r){let n=this.validators.get(e);if(!n)throw new Qt("tool",`Unknown tool: ${e}`,e);if(!r||typeof r!="object"||Array.isArray(r))throw new Qt("args","Arguments must be a non-null object",r);if(!n(r)){let o=(n.errors||[])[0];if(o){let c=(o.instancePath||o.schemaPath||"unknown").replace(/^\//,"")||o.keyword||"unknown",u=o.message||"Invalid value";throw o.keyword==="required"?u=`Missing required field: ${o.params?.missingProperty||"unknown"}`:o.keyword==="minLength"?u=`Must be at least ${o.params?.limit||1} characters long`:o.keyword==="type"?u=`Must be of type ${o.params?.type||"unknown"}`:o.keyword==="enum"?u=`Must be one of: ${o.params?.allowedValues?.join(", ")||"allowed values"}`:o.keyword==="minimum"?u=`Must be at least ${o.params?.limit||0}`:o.keyword==="maximum"&&(u=`Must be at most ${o.params?.limit||100}`),new Qt(c,u,o.data)}else throw new Qt("unknown","Validation failed",r)}return r}static toMcpError(e){return{code:ue.InvalidRequest,message:`Input validation failed: ${e.message}`,name:"ValidationError",data:{field:e.field,value:e.value}}}validateOrThrowMcpError(e,r){try{return this.validateToolArguments(e,r)}catch(n){throw n instanceof Qt?t.toMcpError(n):n}}},vd=new na;var _s=class{constructor(e){this.client=e}async execute(e,r){return this.client.request("POST",`/projects/${e}/offerings`,r)}};var vs=class{constructor(e){this.client=e}async execute(e,r){return this.client.request("GET",`/projects/${e}/offerings/${r}`)}};var bs=class{constructor(e){this.client=e}async execute(e,r,n){return this.client.request("PATCH",`/projects/${e}/offerings/${r}`,n)}};var ws=class{constructor(e){this.client=e}async execute(e,r){return this.client.request("DELETE",`/projects/${e}/offerings/${r}`)}};var Ss=class{constructor(e){this.client=e}async execute(e,r){let n=r?{cursor:r}:void 0;return this.client.request("GET",`/projects/${e}/offerings`,void 0,n)}};var $s=class{constructor(e){this.client=e}async execute(e){return this.client.request("POST","/entitlements",e)}};var xs=class{constructor(e){this.client=e}async execute(e){return this.client.request("GET",`/entitlements/${e}`)}};var Es=class{constructor(e){this.client=e}async execute(e,r){return this.client.request("PATCH",`/entitlements/${e}`,r)}};var ks=class{constructor(e){this.client=e}async execute(e){return this.client.request("DELETE",`/entitlements/${e}`)}};var Os=class{constructor(e){this.client=e}async execute(e){let r=e?{cursor:e}:void 0;return this.client.request("GET","/entitlements",void 0,r)}};var Ts=class{constructor(e){this.client=e}async execute(e,r){return this.client.request("POST",`/projects/${e}/products`,r)}};var Ps=class{constructor(e){this.client=e}async execute(e,r){return this.client.request("GET",`/projects/${e}/products/${r}`)}};var js=class{constructor(e){this.client=e}async execute(e,r,n){return this.client.request("PATCH",`/projects/${e}/products/${r}`,n)}};var Ns=class{constructor(e){this.client=e}async execute(e,r){return this.client.request("DELETE",`/projects/${e}/products/${r}`)}};var Rs=class{constructor(e){this.client=e}async execute(e,r){let n=r?{cursor:r}:void 0;return this.client.request("GET",`/projects/${e}/products`,void 0,n)}};var Cs=class{constructor(e){this.client=e}async execute(e){return this.client.request("POST","/packages",e)}};var Is=class{constructor(e){this.client=e}async execute(e){return this.client.request("GET",`/packages/${e}`)}};var qs=class{constructor(e){this.client=e}async execute(e,r){return this.client.request("PUT",`/packages/${e}`,r)}};var As=class{constructor(e){this.client=e}async execute(e){await this.client.request("DELETE",`/packages/${e}`)}};var Ds=class{constructor(e){this.client=e}async execute(e){let r=e?{cursor:e}:void 0;return this.client.request("GET","/packages",void 0,r)}};var Ls=class{constructor(e){this.client=e}async execute(e){return this.client.request("POST","/price-experiments",e)}};var Ms=class{constructor(e){this.client=e}async execute(e){return this.client.request("GET",`/price-experiments/${e}`)}};var Vs=class{constructor(e){this.client=e}async execute(e,r){return this.client.request("PUT",`/price-experiments/${e}`,r)}};var Us=class{constructor(e){this.client=e}async execute(e){await this.client.request("DELETE",`/price-experiments/${e}`)}};var zs=class{constructor(e){this.client=e}async execute(e){let r=e?{cursor:e}:void 0;return this.client.request("GET","/price-experiments",void 0,r)}};function bd(t,e){let r=new An(t,e),n=new _s(r),s=new vs(r),i=new bs(r),o=new ws(r),a=new Ss(r),c=new $s(r),u=new xs(r),l=new Es(r),d=new ks(r),y=new Os(r),h=new Ts(r),f=new Ps(r),m=new js(r),g=new Ns(r),_=new Rs(r),b=new Cs(r),S=new Is(r),$=new qs(r),E=new As(r),j=new Ds(r),q=new Ls(r),K=new Ms(r),R=new Vs(r),Z=new Us(r),se=new zs(r),te=new qn({name:"revenuecat-mcp",version:"1.0.0"},{capabilities:{tools:{CreateOffering:{description:"Create a new offering",inputSchema:{type:"object",properties:{project_id:{type:"string",description:"The project ID"},name:{type:"string",description:"Name of the offering"},description:{type:"string",description:"Description of the offering"},is_default:{type:"boolean",description:"Whether this is the default offering"},packages:{type:"array",items:{type:"string"},description:"Package IDs to include"}},required:["project_id","name"]}},GetOffering:{description:"Get an offering by ID",inputSchema:{type:"object",properties:{project_id:{type:"string",description:"The project ID"},id:{type:"string",description:"The offering ID"}},required:["project_id","id"]}},UpdateOffering:{description:"Update an existing offering",inputSchema:{type:"object",properties:{project_id:{type:"string",description:"The project ID"},id:{type:"string",description:"The offering ID"},name:{type:"string",description:"Name of the offering"},description:{type:"string",description:"Description of the offering"},is_default:{type:"boolean",description:"Whether this is the default offering"},packages:{type:"array",items:{type:"string"},description:"Package IDs to include"}},required:["project_id","id"]}},DeleteOffering:{description:"Delete an offering by ID",inputSchema:{type:"object",properties:{project_id:{type:"string",description:"The project ID"},id:{type:"string",description:"The offering ID"}},required:["project_id","id"]}},ListOfferings:{description:"List all offerings with optional pagination",inputSchema:{type:"object",properties:{project_id:{type:"string",description:"The project ID"},cursor:{type:"string",description:"Pagination cursor for next page"}},required:["project_id"]}},CreateEntitlement:{description:"Create a new entitlement",inputSchema:{type:"object",properties:{identifier:{type:"string",description:"Unique identifier for the entitlement"},name:{type:"string",description:"Name of the entitlement"},description:{type:"string",description:"Description of the entitlement"},product_identifiers:{type:"array",items:{type:"string"},description:"Product identifiers"}},required:["identifier","name"]}},GetEntitlement:{description:"Get an entitlement by ID",inputSchema:{type:"object",properties:{id:{type:"string",description:"The entitlement ID"}},required:["id"]}},UpdateEntitlement:{description:"Update an existing entitlement",inputSchema:{type:"object",properties:{id:{type:"string",description:"The entitlement ID"},identifier:{type:"string",description:"Unique identifier for the entitlement"},name:{type:"string",description:"Name of the entitlement"},description:{type:"string",description:"Description of the entitlement"},product_identifiers:{type:"array",items:{type:"string"},description:"Product identifiers"}},required:["id"]}},DeleteEntitlement:{description:"Delete an entitlement by ID",inputSchema:{type:"object",properties:{id:{type:"string",description:"The entitlement ID"}},required:["id"]}},ListEntitlements:{description:"List all entitlements with optional pagination",inputSchema:{type:"object",properties:{cursor:{type:"string",description:"Pagination cursor for next page"}},required:[]}},CreateProduct:{description:"Create a new product",inputSchema:{type:"object",properties:{project_id:{type:"string",description:"The project ID"},identifier:{type:"string",description:"Unique identifier for the product"},name:{type:"string",description:"Name of the product"},description:{type:"string",description:"Description of the product"},type:{type:"string",enum:["subscription","non_consumable","consumable"],description:"Product type"},store_identifiers:{type:"object",description:"Store-specific identifiers"}},required:["project_id","identifier","name","type"]}},GetProduct:{description:"Get a product by ID",inputSchema:{type:"object",properties:{project_id:{type:"string",description:"The project ID"},id:{type:"string",description:"The product ID"}},required:["project_id","id"]}},UpdateProduct:{description:"Update an existing product",inputSchema:{type:"object",properties:{project_id:{type:"string",description:"The project ID"},id:{type:"string",description:"The product ID"},identifier:{type:"string",description:"Unique identifier for the product"},name:{type:"string",description:"Name of the product"},description:{type:"string",description:"Description of the product"},type:{type:"string",enum:["subscription","non_consumable","consumable"],description:"Product type"},store_identifiers:{type:"object",description:"Store-specific identifiers"}},required:["project_id","id"]}},DeleteProduct:{description:"Delete a product by ID",inputSchema:{type:"object",properties:{project_id:{type:"string",description:"The project ID"},id:{type:"string",description:"The product ID"}},required:["project_id","id"]}},ListProducts:{description:"List all products with optional pagination",inputSchema:{type:"object",properties:{project_id:{type:"string",description:"The project ID"},cursor:{type:"string",description:"Pagination cursor for next page"}},required:["project_id"]}},CreatePackage:{description:"Create a new package",inputSchema:{type:"object",properties:{identifier:{type:"string",description:"Unique identifier for the package"},name:{type:"string",description:"Name of the package"},position:{type:"number",description:"Position of the package"},product_identifiers:{type:"array",items:{type:"string"},description:"Product identifiers"}},required:["identifier","name"]}},GetPackage:{description:"Get a package by ID",inputSchema:{type:"object",properties:{id:{type:"string",description:"The package ID"}},required:["id"]}},UpdatePackage:{description:"Update an existing package",inputSchema:{type:"object",properties:{id:{type:"string",description:"The package ID"},identifier:{type:"string",description:"Unique identifier for the package"},name:{type:"string",description:"Name of the package"},position:{type:"number",description:"Position of the package"},product_identifiers:{type:"array",items:{type:"string"},description:"Product identifiers"}},required:["id"]}},DeletePackage:{description:"Delete a package by ID",inputSchema:{type:"object",properties:{id:{type:"string",description:"The package ID"}},required:["id"]}},ListPackages:{description:"List all packages with optional pagination",inputSchema:{type:"object",properties:{cursor:{type:"string",description:"Pagination cursor for next page"}},required:[]}},CreatePriceExperiment:{description:"Create a new price experiment",inputSchema:{type:"object",properties:{name:{type:"string",description:"Name of the price experiment"},description:{type:"string",description:"Description of the price experiment"},status:{type:"string",enum:["active","inactive","completed"],description:"Status of the experiment"},treatment_group_percentage:{type:"number",description:"Treatment group percentage"}},required:["name","treatment_group_percentage"]}},GetPriceExperiment:{description:"Get a price experiment by ID",inputSchema:{type:"object",properties:{id:{type:"string",description:"The price experiment ID"}},required:["id"]}},UpdatePriceExperiment:{description:"Update an existing price experiment",inputSchema:{type:"object",properties:{id:{type:"string",description:"The price experiment ID"},name:{type:"string",description:"Name of the price experiment"},description:{type:"string",description:"Description of the price experiment"},status:{type:"string",enum:["active","inactive","completed"],description:"Status of the experiment"},treatment_group_percentage:{type:"number",description:"Treatment group percentage"}},required:["id"]}},DeletePriceExperiment:{description:"Delete a price experiment by ID",inputSchema:{type:"object",properties:{id:{type:"string",description:"The price experiment ID"}},required:["id"]}},ListPriceExperiments:{description:"List all price experiments with optional pagination",inputSchema:{type:"object",properties:{cursor:{type:"string",description:"Pagination cursor for next page"}},required:[]}}}}});return te.setRequestHandler(hi,async ae=>{let{name:ie,arguments:nt}=ae.params;e.info({tool:ie},"Tool called");try{let A=vd.validateOrThrowMcpError(ie,nt);switch(ie){case"CreateOffering":{let{project_id:D,...ye}=A,fe=await n.execute(D,ye);return{content:[{type:"text",text:JSON.stringify(fe,null,2)}]}}case"GetOffering":{let D=await s.execute(A.project_id,A.id);return{content:[{type:"text",text:JSON.stringify(D,null,2)}]}}case"UpdateOffering":{let{project_id:D,id:ye,...fe}=A,jr=await i.execute(D,ye,fe);return{content:[{type:"text",text:JSON.stringify(jr,null,2)}]}}case"DeleteOffering":return await o.execute(A.project_id,A.id),{content:[{type:"text",text:JSON.stringify({success:!0,message:`Offering ${A.id} deleted successfully`},null,2)}]};case"ListOfferings":{let D=await a.execute(A.project_id,A.cursor);return{content:[{type:"text",text:JSON.stringify(D,null,2)}]}}case"CreateEntitlement":{let D=await c.execute(A);return{content:[{type:"text",text:JSON.stringify(D,null,2)}]}}case"GetEntitlement":{let D=await u.execute(A.id);return{content:[{type:"text",text:JSON.stringify(D,null,2)}]}}case"UpdateEntitlement":{let{id:D,...ye}=A,fe=await l.execute(D,ye);return{content:[{type:"text",text:JSON.stringify(fe,null,2)}]}}case"DeleteEntitlement":return await d.execute(A.id),{content:[{type:"text",text:JSON.stringify({success:!0,message:`Entitlement ${A.id} deleted successfully`},null,2)}]};case"ListEntitlements":{let D=await y.execute(A.cursor);return{content:[{type:"text",text:JSON.stringify(D,null,2)}]}}case"CreateProduct":{let{project_id:D,...ye}=A,fe=await h.execute(D,ye);return{content:[{type:"text",text:JSON.stringify(fe,null,2)}]}}case"GetProduct":{let D=await f.execute(A.project_id,A.id);return{content:[{type:"text",text:JSON.stringify(D,null,2)}]}}case"UpdateProduct":{let{project_id:D,id:ye,...fe}=A,jr=await m.execute(D,ye,fe);return{content:[{type:"text",text:JSON.stringify(jr,null,2)}]}}case"DeleteProduct":return await g.execute(A.project_id,A.id),{content:[{type:"text",text:JSON.stringify({success:!0,message:`Product ${A.id} deleted successfully`},null,2)}]};case"ListProducts":{let D=await _.execute(A.project_id,A.cursor);return{content:[{type:"text",text:JSON.stringify(D,null,2)}]}}case"CreatePackage":{let D=await b.execute(A);return{content:[{type:"text",text:JSON.stringify(D,null,2)}]}}case"GetPackage":{let D=await S.execute(A.id);return{content:[{type:"text",text:JSON.stringify(D,null,2)}]}}case"UpdatePackage":{let{id:D,...ye}=A,fe=await $.execute(D,ye);return{content:[{type:"text",text:JSON.stringify(fe,null,2)}]}}case"DeletePackage":return await E.execute(A.id),{content:[{type:"text",text:JSON.stringify({success:!0,message:`Package ${A.id} deleted successfully`},null,2)}]};case"ListPackages":{let D=await j.execute(A.cursor);return{content:[{type:"text",text:JSON.stringify(D,null,2)}]}}case"CreatePriceExperiment":{let D=await q.execute(A);return{content:[{type:"text",text:JSON.stringify(D,null,2)}]}}case"GetPriceExperiment":{let D=await K.execute(A.id);return{content:[{type:"text",text:JSON.stringify(D,null,2)}]}}case"UpdatePriceExperiment":{let{id:D,...ye}=A,fe=await R.execute(D,ye);return{content:[{type:"text",text:JSON.stringify(fe,null,2)}]}}case"DeletePriceExperiment":return await Z.execute(A.id),{content:[{type:"text",text:JSON.stringify({success:!0,message:`PriceExperiment ${A.id} deleted successfully`},null,2)}]};case"ListPriceExperiments":{let D=await se.execute(A.cursor);return{content:[{type:"text",text:JSON.stringify(D,null,2)}]}}default:throw new Error(`Unknown tool: ${ie}`)}}catch(A){throw e.error({error:"Tool execution failed",tool:ie},"Tool execution failed"),Ac(A)}}),te}var Nd=mn(jd(),1);function Rd(){return(0,Nd.config)({allowEmptyValues:!1,example:".env.example"}),{revenueCatSecretKey:process.env.REVENUECAT_SECRET_KEY,revenueCatApiUrl:process.env.RC_API_URL||"https://api.revenuecat.com/v2",logLevel:process.env.LOG_LEVEL||"info"}}var sc=mn(Bp(),1);function Kp(t){return(0,sc.default)({level:t?.logLevel||"info",timestamp:sc.default.stdTimeFunctions.isoTime,redact:["config.revenueCatSecretKey","config.secret","config.token","secret","token","key"]})}async function HE(){try{let t=Rd(),e=Kp(),r=bd(t,e),n=new Cn;await r.connect(n),e.info("MCP RevenueCat server started")}catch(t){console.error("Failed to start server:",t),process.exit(1)}}HE().catch(console.error);