@layerzerolabs/verify-contract 1.1.4 → 1.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cli/index.js CHANGED
@@ -16,11 +16,11 @@
16
16
  */
17
17
  (function(){"use strict";var t="input is invalid type";var r="finalize already called";var i=typeof window==="object";var n=i?window:{};if(n.JS_SHA3_NO_WINDOW){i=false}var s=!i&&typeof self==="object";var o=!n.JS_SHA3_NO_NODE_JS&&typeof process==="object"&&process.versions&&process.versions.node;if(o){n=global}else if(s){n=self}var a=!n.JS_SHA3_NO_COMMON_JS&&"object"==="object"&&e.exports;var l=typeof define==="function"&&define.amd;var u=!n.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer!=="undefined";var c="0123456789abcdef".split("");var h=[31,7936,2031616,520093696];var d=[4,1024,262144,67108864];var p=[1,256,65536,16777216];var m=[6,1536,393216,100663296];var g=[0,8,16,24];var y=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648];var _=[224,256,384,512];var v=[128,256];var b=["hex","buffer","arrayBuffer","array","digest"];var x={128:168,256:136};if(n.JS_SHA3_NO_NODE_JS||!Array.isArray){Array.isArray=function(e){return Object.prototype.toString.call(e)==="[object Array]"}}if(u&&(n.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)){ArrayBuffer.isView=function(e){return typeof e==="object"&&e.buffer&&e.buffer.constructor===ArrayBuffer}}var createOutputMethod=function(e,t,r){return function(i){return new Keccak(e,t,e).update(i)[r]()}};var createShakeOutputMethod=function(e,t,r){return function(i,n){return new Keccak(e,t,n).update(i)[r]()}};var createCshakeOutputMethod=function(e,t,r){return function(t,i,n,s){return w["cshake"+e].update(t,i,n,s)[r]()}};var createKmacOutputMethod=function(e,t,r){return function(t,i,n,s){return w["kmac"+e].update(t,i,n,s)[r]()}};var createOutputMethods=function(e,t,r,i){for(var n=0;n<b.length;++n){var s=b[n];e[s]=t(r,i,s)}return e};var createMethod=function(e,t){var r=createOutputMethod(e,t,"hex");r.create=function(){return new Keccak(e,t,e)};r.update=function(e){return r.create().update(e)};return createOutputMethods(r,createOutputMethod,e,t)};var createShakeMethod=function(e,t){var r=createShakeOutputMethod(e,t,"hex");r.create=function(r){return new Keccak(e,t,r)};r.update=function(e,t){return r.create(t).update(e)};return createOutputMethods(r,createShakeOutputMethod,e,t)};var createCshakeMethod=function(e,t){var r=x[e];var i=createCshakeOutputMethod(e,t,"hex");i.create=function(i,n,s){if(!n&&!s){return w["shake"+e].create(i)}else{return new Keccak(e,t,i).bytepad([n,s],r)}};i.update=function(e,t,r,n){return i.create(t,r,n).update(e)};return createOutputMethods(i,createCshakeOutputMethod,e,t)};var createKmacMethod=function(e,t){var r=x[e];var i=createKmacOutputMethod(e,t,"hex");i.create=function(i,n,s){return new Kmac(e,t,n).bytepad(["KMAC",s],r).bytepad([i],r)};i.update=function(e,t,r,n){return i.create(e,r,n).update(t)};return createOutputMethods(i,createKmacOutputMethod,e,t)};var T=[{name:"keccak",padding:p,bits:_,createMethod:createMethod},{name:"sha3",padding:m,bits:_,createMethod:createMethod},{name:"shake",padding:h,bits:v,createMethod:createShakeMethod},{name:"cshake",padding:d,bits:v,createMethod:createCshakeMethod},{name:"kmac",padding:d,bits:v,createMethod:createKmacMethod}];var w={},S=[];for(var E=0;E<T.length;++E){var A=T[E];var C=A.bits;for(var N=0;N<C.length;++N){var O=A.name+"_"+C[N];S.push(O);w[O]=A.createMethod(C[N],A.padding);if(A.name!=="sha3"){var R=A.name+C[N];S.push(R);w[R]=w[O]}}}function Keccak(e,t,r){this.blocks=[];this.s=[];this.padding=t;this.outputBits=r;this.reset=true;this.finalized=false;this.block=0;this.start=0;this.blockCount=1600-(e<<1)>>5;this.byteCount=this.blockCount<<2;this.outputBlocks=r>>5;this.extraBytes=(r&31)>>3;for(var i=0;i<50;++i){this.s[i]=0}}Keccak.prototype.update=function(e){if(this.finalized){throw new Error(r)}var i,n=typeof e;if(n!=="string"){if(n==="object"){if(e===null){throw new Error(t)}else if(u&&e.constructor===ArrayBuffer){e=new Uint8Array(e)}else if(!Array.isArray(e)){if(!u||!ArrayBuffer.isView(e)){throw new Error(t)}}}else{throw new Error(t)}i=true}var s=this.blocks,o=this.byteCount,a=e.length,l=this.blockCount,c=0,h=this.s,d,p;while(c<a){if(this.reset){this.reset=false;s[0]=this.block;for(d=1;d<l+1;++d){s[d]=0}}if(i){for(d=this.start;c<a&&d<o;++c){s[d>>2]|=e[c]<<g[d++&3]}}else{for(d=this.start;c<a&&d<o;++c){p=e.charCodeAt(c);if(p<128){s[d>>2]|=p<<g[d++&3]}else if(p<2048){s[d>>2]|=(192|p>>6)<<g[d++&3];s[d>>2]|=(128|p&63)<<g[d++&3]}else if(p<55296||p>=57344){s[d>>2]|=(224|p>>12)<<g[d++&3];s[d>>2]|=(128|p>>6&63)<<g[d++&3];s[d>>2]|=(128|p&63)<<g[d++&3]}else{p=65536+((p&1023)<<10|e.charCodeAt(++c)&1023);s[d>>2]|=(240|p>>18)<<g[d++&3];s[d>>2]|=(128|p>>12&63)<<g[d++&3];s[d>>2]|=(128|p>>6&63)<<g[d++&3];s[d>>2]|=(128|p&63)<<g[d++&3]}}}this.lastByteIndex=d;if(d>=o){this.start=d-o;this.block=s[l];for(d=0;d<l;++d){h[d]^=s[d]}f(h);this.reset=true}else{this.start=d}}return this};Keccak.prototype.encode=function(e,t){var r=e&255,i=1;var n=[r];e=e>>8;r=e&255;while(r>0){n.unshift(r);e=e>>8;r=e&255;++i}if(t){n.push(i)}else{n.unshift(i)}this.update(n);return n.length};Keccak.prototype.encodeString=function(e){var r,i=typeof e;if(i!=="string"){if(i==="object"){if(e===null){throw new Error(t)}else if(u&&e.constructor===ArrayBuffer){e=new Uint8Array(e)}else if(!Array.isArray(e)){if(!u||!ArrayBuffer.isView(e)){throw new Error(t)}}}else{throw new Error(t)}r=true}var n=0,s=e.length;if(r){n=s}else{for(var o=0;o<e.length;++o){var a=e.charCodeAt(o);if(a<128){n+=1}else if(a<2048){n+=2}else if(a<55296||a>=57344){n+=3}else{a=65536+((a&1023)<<10|e.charCodeAt(++o)&1023);n+=4}}}n+=this.encode(n*8);this.update(e);return n};Keccak.prototype.bytepad=function(e,t){var r=this.encode(t);for(var i=0;i<e.length;++i){r+=this.encodeString(e[i])}var n=t-r%t;var s=[];s.length=n;this.update(s);return this};Keccak.prototype.finalize=function(){if(this.finalized){return}this.finalized=true;var e=this.blocks,t=this.lastByteIndex,r=this.blockCount,i=this.s;e[t>>2]|=this.padding[t&3];if(this.lastByteIndex===this.byteCount){e[0]=e[r];for(t=1;t<r+1;++t){e[t]=0}}e[r-1]|=2147483648;for(t=0;t<r;++t){i[t]^=e[t]}f(i)};Keccak.prototype.toString=Keccak.prototype.hex=function(){this.finalize();var e=this.blockCount,t=this.s,r=this.outputBlocks,i=this.extraBytes,n=0,s=0;var o="",a;while(s<r){for(n=0;n<e&&s<r;++n,++s){a=t[n];o+=c[a>>4&15]+c[a&15]+c[a>>12&15]+c[a>>8&15]+c[a>>20&15]+c[a>>16&15]+c[a>>28&15]+c[a>>24&15]}if(s%e===0){f(t);n=0}}if(i){a=t[n];o+=c[a>>4&15]+c[a&15];if(i>1){o+=c[a>>12&15]+c[a>>8&15]}if(i>2){o+=c[a>>20&15]+c[a>>16&15]}}return o};Keccak.prototype.arrayBuffer=function(){this.finalize();var e=this.blockCount,t=this.s,r=this.outputBlocks,i=this.extraBytes,n=0,s=0;var o=this.outputBits>>3;var a;if(i){a=new ArrayBuffer(r+1<<2)}else{a=new ArrayBuffer(o)}var l=new Uint32Array(a);while(s<r){for(n=0;n<e&&s<r;++n,++s){l[s]=t[n]}if(s%e===0){f(t)}}if(i){l[n]=t[n];a=a.slice(0,o)}return a};Keccak.prototype.buffer=Keccak.prototype.arrayBuffer;Keccak.prototype.digest=Keccak.prototype.array=function(){this.finalize();var e=this.blockCount,t=this.s,r=this.outputBlocks,i=this.extraBytes,n=0,s=0;var o=[],a,l;while(s<r){for(n=0;n<e&&s<r;++n,++s){a=s<<2;l=t[n];o[a]=l&255;o[a+1]=l>>8&255;o[a+2]=l>>16&255;o[a+3]=l>>24&255}if(s%e===0){f(t)}}if(i){a=s<<2;l=t[n];o[a]=l&255;if(i>1){o[a+1]=l>>8&255}if(i>2){o[a+2]=l>>16&255}}return o};function Kmac(e,t,r){Keccak.call(this,e,t,r)}Kmac.prototype=new Keccak;Kmac.prototype.finalize=function(){this.encode(this.outputBits,true);return Keccak.prototype.finalize.call(this)};var f=function(e){var t,r,i,n,s,o,a,l,u,c,h,d,p,m,g,_,v,b,x,T,w,S,E,A,C,N,O,R,k,P,L,I,M,D,F,j,B,U,H,z,K,V,q,Z,G,$,W,Y,J,Q,X,ee,te,re,ie,ne,se,oe,ae,le,ue,ce,he;for(i=0;i<48;i+=2){n=e[0]^e[10]^e[20]^e[30]^e[40];s=e[1]^e[11]^e[21]^e[31]^e[41];o=e[2]^e[12]^e[22]^e[32]^e[42];a=e[3]^e[13]^e[23]^e[33]^e[43];l=e[4]^e[14]^e[24]^e[34]^e[44];u=e[5]^e[15]^e[25]^e[35]^e[45];c=e[6]^e[16]^e[26]^e[36]^e[46];h=e[7]^e[17]^e[27]^e[37]^e[47];d=e[8]^e[18]^e[28]^e[38]^e[48];p=e[9]^e[19]^e[29]^e[39]^e[49];t=d^(o<<1|a>>>31);r=p^(a<<1|o>>>31);e[0]^=t;e[1]^=r;e[10]^=t;e[11]^=r;e[20]^=t;e[21]^=r;e[30]^=t;e[31]^=r;e[40]^=t;e[41]^=r;t=n^(l<<1|u>>>31);r=s^(u<<1|l>>>31);e[2]^=t;e[3]^=r;e[12]^=t;e[13]^=r;e[22]^=t;e[23]^=r;e[32]^=t;e[33]^=r;e[42]^=t;e[43]^=r;t=o^(c<<1|h>>>31);r=a^(h<<1|c>>>31);e[4]^=t;e[5]^=r;e[14]^=t;e[15]^=r;e[24]^=t;e[25]^=r;e[34]^=t;e[35]^=r;e[44]^=t;e[45]^=r;t=l^(d<<1|p>>>31);r=u^(p<<1|d>>>31);e[6]^=t;e[7]^=r;e[16]^=t;e[17]^=r;e[26]^=t;e[27]^=r;e[36]^=t;e[37]^=r;e[46]^=t;e[47]^=r;t=c^(n<<1|s>>>31);r=h^(s<<1|n>>>31);e[8]^=t;e[9]^=r;e[18]^=t;e[19]^=r;e[28]^=t;e[29]^=r;e[38]^=t;e[39]^=r;e[48]^=t;e[49]^=r;m=e[0];g=e[1];$=e[11]<<4|e[10]>>>28;W=e[10]<<4|e[11]>>>28;R=e[20]<<3|e[21]>>>29;k=e[21]<<3|e[20]>>>29;le=e[31]<<9|e[30]>>>23;ue=e[30]<<9|e[31]>>>23;V=e[40]<<18|e[41]>>>14;q=e[41]<<18|e[40]>>>14;D=e[2]<<1|e[3]>>>31;F=e[3]<<1|e[2]>>>31;_=e[13]<<12|e[12]>>>20;v=e[12]<<12|e[13]>>>20;Y=e[22]<<10|e[23]>>>22;J=e[23]<<10|e[22]>>>22;P=e[33]<<13|e[32]>>>19;L=e[32]<<13|e[33]>>>19;ce=e[42]<<2|e[43]>>>30;he=e[43]<<2|e[42]>>>30;re=e[5]<<30|e[4]>>>2;ie=e[4]<<30|e[5]>>>2;j=e[14]<<6|e[15]>>>26;B=e[15]<<6|e[14]>>>26;b=e[25]<<11|e[24]>>>21;x=e[24]<<11|e[25]>>>21;Q=e[34]<<15|e[35]>>>17;X=e[35]<<15|e[34]>>>17;I=e[45]<<29|e[44]>>>3;M=e[44]<<29|e[45]>>>3;A=e[6]<<28|e[7]>>>4;C=e[7]<<28|e[6]>>>4;ne=e[17]<<23|e[16]>>>9;se=e[16]<<23|e[17]>>>9;U=e[26]<<25|e[27]>>>7;H=e[27]<<25|e[26]>>>7;T=e[36]<<21|e[37]>>>11;w=e[37]<<21|e[36]>>>11;ee=e[47]<<24|e[46]>>>8;te=e[46]<<24|e[47]>>>8;Z=e[8]<<27|e[9]>>>5;G=e[9]<<27|e[8]>>>5;N=e[18]<<20|e[19]>>>12;O=e[19]<<20|e[18]>>>12;oe=e[29]<<7|e[28]>>>25;ae=e[28]<<7|e[29]>>>25;z=e[38]<<8|e[39]>>>24;K=e[39]<<8|e[38]>>>24;S=e[48]<<14|e[49]>>>18;E=e[49]<<14|e[48]>>>18;e[0]=m^~_&b;e[1]=g^~v&x;e[10]=A^~N&R;e[11]=C^~O&k;e[20]=D^~j&U;e[21]=F^~B&H;e[30]=Z^~$&Y;e[31]=G^~W&J;e[40]=re^~ne&oe;e[41]=ie^~se&ae;e[2]=_^~b&T;e[3]=v^~x&w;e[12]=N^~R&P;e[13]=O^~k&L;e[22]=j^~U&z;e[23]=B^~H&K;e[32]=$^~Y&Q;e[33]=W^~J&X;e[42]=ne^~oe&le;e[43]=se^~ae&ue;e[4]=b^~T&S;e[5]=x^~w&E;e[14]=R^~P&I;e[15]=k^~L&M;e[24]=U^~z&V;e[25]=H^~K&q;e[34]=Y^~Q&ee;e[35]=J^~X&te;e[44]=oe^~le&ce;e[45]=ae^~ue&he;e[6]=T^~S&m;e[7]=w^~E&g;e[16]=P^~I&A;e[17]=L^~M&C;e[26]=z^~V&D;e[27]=K^~q&F;e[36]=Q^~ee&Z;e[37]=X^~te&G;e[46]=le^~ce&re;e[47]=ue^~he&ie;e[8]=S^~m&_;e[9]=E^~g&v;e[18]=I^~A&N;e[19]=M^~C&O;e[28]=V^~D&j;e[29]=q^~F&B;e[38]=ee^~Z&$;e[39]=te^~G&W;e[48]=ce^~re&ne;e[49]=he^~ie&se;e[0]^=y[i];e[1]^=y[i+1]}};if(a){e.exports=w}else{for(E=0;E<S.length;++E){n[S[E]]=w[S[E]]}if(l){define((function(){return w}))}}})()},2820:(e,t)=>{t.stringify=function stringify(e){if("undefined"==typeof e)return e;if(e&&Buffer.isBuffer(e))return JSON.stringify(":base64:"+e.toString("base64"));if(e&&e.toJSON)e=e.toJSON();if(e&&"object"===typeof e){var t="";var r=Array.isArray(e);t=r?"[":"{";var i=true;for(var n in e){var s="function"==typeof e[n]||!r&&"undefined"===typeof e[n];if(Object.hasOwnProperty.call(e,n)&&!s){if(!i)t+=",";i=false;if(r){if(e[n]==undefined)t+="null";else t+=stringify(e[n])}else if(e[n]!==void 0){t+=stringify(n)+":"+stringify(e[n])}}}t+=r?"]":"}";return t}else if("string"===typeof e){return JSON.stringify(/^:/.test(e)?":"+e:e)}else if("undefined"===typeof e){return"null"}else return JSON.stringify(e)};t.parse=function(e){return JSON.parse(e,(function(e,t){if("string"===typeof t){if(/^:base64:/.test(t))return Buffer.from(t.substring(8),"base64");else return/^:/.test(t)?t.substring(1):t}return t}))}},1531:(e,t,r)=>{"use strict";const i=r(2361);const n=r(2820);const loadStore=e=>{const t={redis:"@keyv/redis",rediss:"@keyv/redis",mongodb:"@keyv/mongo",mongo:"@keyv/mongo",sqlite:"@keyv/sqlite",postgresql:"@keyv/postgres",postgres:"@keyv/postgres",mysql:"@keyv/mysql",etcd:"@keyv/etcd",offline:"@keyv/offline",tiered:"@keyv/tiered"};if(e.adapter||e.uri){const r=e.adapter||/^[^:+]*/.exec(e.uri)[0];return new(require(t[r]))(e)}return new Map};const s=["sqlite","postgres","mysql","mongo","redis","tiered"];class Keyv extends i{constructor(e,{emitErrors:t=true,...r}={}){super();this.opts={namespace:"keyv",serialize:n.stringify,deserialize:n.parse,...typeof e==="string"?{uri:e}:e,...r};if(!this.opts.store){const e={...this.opts};this.opts.store=loadStore(e)}if(this.opts.compression){const e=this.opts.compression;this.opts.serialize=e.serialize.bind(e);this.opts.deserialize=e.deserialize.bind(e)}if(typeof this.opts.store.on==="function"&&t){this.opts.store.on("error",(e=>this.emit("error",e)))}this.opts.store.namespace=this.opts.namespace;const generateIterator=e=>async function*(){for await(const[t,r]of typeof e==="function"?e(this.opts.store.namespace):e){const e=await this.opts.deserialize(r);if(this.opts.store.namespace&&!t.includes(this.opts.store.namespace)){continue}if(typeof e.expires==="number"&&Date.now()>e.expires){this.delete(t);continue}yield[this._getKeyUnprefix(t),e.value]}};if(typeof this.opts.store[Symbol.iterator]==="function"&&this.opts.store instanceof Map){this.iterator=generateIterator(this.opts.store)}else if(typeof this.opts.store.iterator==="function"&&this.opts.store.opts&&this._checkIterableAdaptar()){this.iterator=generateIterator(this.opts.store.iterator.bind(this.opts.store))}}_checkIterableAdaptar(){return s.includes(this.opts.store.opts.dialect)||s.findIndex((e=>this.opts.store.opts.url.includes(e)))>=0}_getKeyPrefix(e){return`${this.opts.namespace}:${e}`}_getKeyPrefixArray(e){return e.map((e=>`${this.opts.namespace}:${e}`))}_getKeyUnprefix(e){return e.split(":").splice(1).join(":")}get(e,t){const{store:r}=this.opts;const i=Array.isArray(e);const n=i?this._getKeyPrefixArray(e):this._getKeyPrefix(e);if(i&&r.getMany===undefined){const e=[];for(const i of n){e.push(Promise.resolve().then((()=>r.get(i))).then((e=>typeof e==="string"?this.opts.deserialize(e):this.opts.compression?this.opts.deserialize(e):e)).then((e=>{if(e===undefined||e===null){return undefined}if(typeof e.expires==="number"&&Date.now()>e.expires){return this.delete(i).then((()=>undefined))}return t&&t.raw?e:e.value})))}return Promise.allSettled(e).then((e=>{const t=[];for(const r of e){t.push(r.value)}return t}))}return Promise.resolve().then((()=>i?r.getMany(n):r.get(n))).then((e=>typeof e==="string"?this.opts.deserialize(e):this.opts.compression?this.opts.deserialize(e):e)).then((r=>{if(r===undefined||r===null){return undefined}if(i){const i=[];for(let n of r){if(typeof n==="string"){n=this.opts.deserialize(n)}if(n===undefined||n===null){i.push(undefined);continue}if(typeof n.expires==="number"&&Date.now()>n.expires){this.delete(e).then((()=>undefined));i.push(undefined)}else{i.push(t&&t.raw?n:n.value)}}return i}if(typeof r.expires==="number"&&Date.now()>r.expires){return this.delete(e).then((()=>undefined))}return t&&t.raw?r:r.value}))}set(e,t,r){const i=this._getKeyPrefix(e);if(typeof r==="undefined"){r=this.opts.ttl}if(r===0){r=undefined}const{store:n}=this.opts;return Promise.resolve().then((()=>{const e=typeof r==="number"?Date.now()+r:null;if(typeof t==="symbol"){this.emit("error","symbol cannot be serialized")}t={value:t,expires:e};return this.opts.serialize(t)})).then((e=>n.set(i,e,r))).then((()=>true))}delete(e){const{store:t}=this.opts;if(Array.isArray(e)){const r=this._getKeyPrefixArray(e);if(t.deleteMany===undefined){const e=[];for(const i of r){e.push(t.delete(i))}return Promise.allSettled(e).then((e=>e.every((e=>e.value===true))))}return Promise.resolve().then((()=>t.deleteMany(r)))}const r=this._getKeyPrefix(e);return Promise.resolve().then((()=>t.delete(r)))}clear(){const{store:e}=this.opts;return Promise.resolve().then((()=>e.clear()))}has(e){const t=this._getKeyPrefix(e);const{store:r}=this.opts;return Promise.resolve().then((async()=>{if(typeof r.has==="function"){return r.has(t)}const e=await r.get(t);return e!==undefined}))}disconnect(){const{store:e}=this.opts;if(typeof e.disconnect==="function"){return e.disconnect()}}}e.exports=Keyv},6287:e=>{"use strict";function Kuler(e,t){if(t)return new Kuler(e).style(t);if(!(this instanceof Kuler))return new Kuler(e);this.text=e}Kuler.prototype.prefix="[";Kuler.prototype.suffix="m";Kuler.prototype.hex=function hex(e){e=e[0]==="#"?e.substring(1):e;if(e.length===3){e=e.split("");e[5]=e[2];e[4]=e[2];e[3]=e[1];e[2]=e[1];e[1]=e[0];e=e.join("")}var t=e.substring(0,2),r=e.substring(2,4),i=e.substring(4,6);return[parseInt(t,16),parseInt(r,16),parseInt(i,16)]};Kuler.prototype.rgb=function rgb(e,t,r){var i=e/255*5,n=t/255*5,s=r/255*5;return this.ansi(i,n,s)};Kuler.prototype.ansi=function ansi(e,t,r){var i=Math.round(e),n=Math.round(t),s=Math.round(r);return 16+i*36+n*6+s};Kuler.prototype.reset=function reset(){return this.prefix+"39;49"+this.suffix};Kuler.prototype.style=function style(e){return this.prefix+"38;5;"+this.rgb.apply(this,this.hex(e))+this.suffix+this.text+this.reset()};e.exports=Kuler},9748:(e,t,r)=>{"use strict";const i=r(3791);e.exports=i((e=>{e.message=`\t${e.message}`;return e}))},6811:(e,t,r)=>{"use strict";const{Colorizer:i}=r(3848);const{Padder:n}=r(7033);const{configs:s,MESSAGE:o}=r(3937);class CliFormat{constructor(e={}){if(!e.levels){e.levels=s.cli.levels}this.colorizer=new i(e);this.padder=new n(e);this.options=e}transform(e,t){this.colorizer.transform(this.padder.transform(e,t),t);e[o]=`${e.level}:${e.message}`;return e}}e.exports=e=>new CliFormat(e);e.exports.Format=CliFormat},3848:(e,t,r)=>{"use strict";const i=r(9256);const{LEVEL:n,MESSAGE:s}=r(3937);i.enabled=true;const o=/\s+/;class Colorizer{constructor(e={}){if(e.colors){this.addColors(e.colors)}this.options=e}static addColors(e){const t=Object.keys(e).reduce(((t,r)=>{t[r]=o.test(e[r])?e[r].split(o):e[r];return t}),{});Colorizer.allColors=Object.assign({},Colorizer.allColors||{},t);return Colorizer.allColors}addColors(e){return Colorizer.addColors(e)}colorize(e,t,r){if(typeof r==="undefined"){r=t}if(!Array.isArray(Colorizer.allColors[e])){return i[Colorizer.allColors[e]](r)}for(let t=0,n=Colorizer.allColors[e].length;t<n;t++){r=i[Colorizer.allColors[e][t]](r)}return r}transform(e,t){if(t.all&&typeof e[s]==="string"){e[s]=this.colorize(e[n],e.level,e[s])}if(t.level||t.all||!t.message){e.level=this.colorize(e[n],e.level)}if(t.all||t.message){e.message=this.colorize(e[n],e.level,e.message)}return e}}e.exports=e=>new Colorizer(e);e.exports.Colorizer=e.exports.Format=Colorizer},7315:(e,t,r)=>{"use strict";const i=r(3791);function cascade(e){if(!e.every(isValidFormat)){return}return t=>{let r=t;for(let t=0;t<e.length;t++){r=e[t].transform(r,e[t].options);if(!r){return false}}return r}}function isValidFormat(e){if(typeof e.transform!=="function"){throw new Error(["No transform function found on format. Did you create a format instance?","const myFormat = format(formatFn);","const instance = myFormat();"].join("\n"))}return true}e.exports=(...e)=>{const t=i(cascade(e));const r=t();r.Format=t.Format;return r};e.exports.cascade=cascade},2397:(e,t,r)=>{"use strict";const i=r(3791);const{LEVEL:n,MESSAGE:s}=r(3937);e.exports=i(((e,{stack:t,cause:r})=>{if(e instanceof Error){const i=Object.assign({},e,{level:e.level,[n]:e[n]||e.level,message:e.message,[s]:e[s]||e.message});if(t)i.stack=e.stack;if(r)i.cause=e.cause;return i}if(!(e.message instanceof Error))return e;const i=e.message;Object.assign(e,i);e.message=i.message;e[s]=i.message;if(t)e.stack=i.stack;if(r)e.cause=i.cause;return e}))},3791:e=>{"use strict";class InvalidFormatError extends Error{constructor(e){super(`Format functions must be synchronous taking a two arguments: (info, opts)\nFound: ${e.toString().split("\n")[0]}\n`);Error.captureStackTrace(this,InvalidFormatError)}}e.exports=e=>{if(e.length>2){throw new InvalidFormatError(e)}function Format(e={}){this.options=e}Format.prototype.transform=e;function createFormatWrap(e){return new Format(e)}createFormatWrap.Format=Format;return createFormatWrap}},2955:(e,t,r)=>{"use strict";const i=t.format=r(3791);t.levels=r(3180);function exposeFormat(e,t){Object.defineProperty(i,e,{get(){return t()},configurable:true})}exposeFormat("align",(function(){return r(9748)}));exposeFormat("errors",(function(){return r(2397)}));exposeFormat("cli",(function(){return r(6811)}));exposeFormat("combine",(function(){return r(7315)}));exposeFormat("colorize",(function(){return r(3848)}));exposeFormat("json",(function(){return r(5669)}));exposeFormat("label",(function(){return r(6941)}));exposeFormat("logstash",(function(){return r(4772)}));exposeFormat("metadata",(function(){return r(9760)}));exposeFormat("ms",(function(){return r(4734)}));exposeFormat("padLevels",(function(){return r(7033)}));exposeFormat("prettyPrint",(function(){return r(6182)}));exposeFormat("printf",(function(){return r(1843)}));exposeFormat("simple",(function(){return r(5313)}));exposeFormat("splat",(function(){return r(7081)}));exposeFormat("timestamp",(function(){return r(8381)}));exposeFormat("uncolorize",(function(){return r(6420)}))},5669:(e,t,r)=>{"use strict";const i=r(3791);const{MESSAGE:n}=r(3937);const s=r(7560);function replacer(e,t){if(typeof t==="bigint")return t.toString();return t}e.exports=i(((e,t)=>{const r=s.configure(t);e[n]=r(e,t.replacer||replacer,t.space);return e}))},6941:(e,t,r)=>{"use strict";const i=r(3791);e.exports=i(((e,t)=>{if(t.message){e.message=`[${t.label}] ${e.message}`;return e}e.label=t.label;return e}))},3180:(e,t,r)=>{"use strict";const{Colorizer:i}=r(3848);e.exports=e=>{i.addColors(e.colors||e);return e}},4772:(e,t,r)=>{"use strict";const i=r(3791);const{MESSAGE:n}=r(3937);const s=r(7560);e.exports=i((e=>{const t={};if(e.message){t["@message"]=e.message;delete e.message}if(e.timestamp){t["@timestamp"]=e.timestamp;delete e.timestamp}t["@fields"]=e;e[n]=s(t);return e}))},9760:(e,t,r)=>{"use strict";const i=r(3791);function fillExcept(e,t,r){const i=t.reduce(((t,r)=>{t[r]=e[r];delete e[r];return t}),{});const n=Object.keys(e).reduce(((t,r)=>{t[r]=e[r];delete e[r];return t}),{});Object.assign(e,i,{[r]:n});return e}function fillWith(e,t,r){e[r]=t.reduce(((t,r)=>{t[r]=e[r];delete e[r];return t}),{});return e}e.exports=i(((e,t={})=>{let r="metadata";if(t.key){r=t.key}let i=[];if(!t.fillExcept&&!t.fillWith){i.push("level");i.push("message")}if(t.fillExcept){i=t.fillExcept}if(i.length>0){return fillExcept(e,i,r)}if(t.fillWith){return fillWith(e,t.fillWith,r)}return e}))},4734:function(e,t,r){"use strict";const i=r(3791);const n=r(9983);e.exports=i((e=>{const t=+new Date;this.diff=t-(this.prevTime||t);this.prevTime=t;e.ms=`+${n(this.diff)}`;return e}))},9983:e=>{var t=1e3;var r=t*60;var i=r*60;var n=i*24;var s=n*7;var o=n*365.25;e.exports=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0){return parse(e)}else if(r==="number"&&isFinite(e)){return t.long?fmtLong(e):fmtShort(e)}throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function parse(e){e=String(e);if(e.length>100){return}var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!a){return}var l=parseFloat(a[1]);var u=(a[2]||"ms").toLowerCase();switch(u){case"years":case"year":case"yrs":case"yr":case"y":return l*o;case"weeks":case"week":case"w":return l*s;case"days":case"day":case"d":return l*n;case"hours":case"hour":case"hrs":case"hr":case"h":return l*i;case"minutes":case"minute":case"mins":case"min":case"m":return l*r;case"seconds":case"second":case"secs":case"sec":case"s":return l*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return l;default:return undefined}}function fmtShort(e){var s=Math.abs(e);if(s>=n){return Math.round(e/n)+"d"}if(s>=i){return Math.round(e/i)+"h"}if(s>=r){return Math.round(e/r)+"m"}if(s>=t){return Math.round(e/t)+"s"}return e+"ms"}function fmtLong(e){var s=Math.abs(e);if(s>=n){return plural(e,s,n,"day")}if(s>=i){return plural(e,s,i,"hour")}if(s>=r){return plural(e,s,r,"minute")}if(s>=t){return plural(e,s,t,"second")}return e+" ms"}function plural(e,t,r,i){var n=t>=r*1.5;return Math.round(e/r)+" "+i+(n?"s":"")}},7033:(e,t,r)=>{"use strict";const{configs:i,LEVEL:n,MESSAGE:s}=r(3937);class Padder{constructor(e={levels:i.npm.levels}){this.paddings=Padder.paddingForLevels(e.levels,e.filler);this.options=e}static getLongestLevel(e){const t=Object.keys(e).map((e=>e.length));return Math.max(...t)}static paddingForLevel(e,t,r){const i=r+1-e.length;const n=Math.floor(i/t.length);const s=`${t}${t.repeat(n)}`;return s.slice(0,i)}static paddingForLevels(e,t=" "){const r=Padder.getLongestLevel(e);return Object.keys(e).reduce(((e,i)=>{e[i]=Padder.paddingForLevel(i,t,r);return e}),{})}transform(e,t){e.message=`${this.paddings[e[n]]}${e.message}`;if(e[s]){e[s]=`${this.paddings[e[n]]}${e[s]}`}return e}}e.exports=e=>new Padder(e);e.exports.Padder=e.exports.Format=Padder},6182:(e,t,r)=>{"use strict";const i=r(3837).inspect;const n=r(3791);const{LEVEL:s,MESSAGE:o,SPLAT:a}=r(3937);e.exports=n(((e,t={})=>{const r=Object.assign({},e);delete r[s];delete r[o];delete r[a];e[o]=i(r,false,t.depth||null,t.colorize);return e}))},1843:(e,t,r)=>{"use strict";const{MESSAGE:i}=r(3937);class Printf{constructor(e){this.template=e}transform(e){e[i]=this.template(e);return e}}e.exports=e=>new Printf(e);e.exports.Printf=e.exports.Format=Printf},5313:(e,t,r)=>{"use strict";const i=r(3791);const{MESSAGE:n}=r(3937);const s=r(7560);e.exports=i((e=>{const t=s(Object.assign({},e,{level:undefined,message:undefined,splat:undefined}));const r=e.padding&&e.padding[e.level]||"";if(t!=="{}"){e[n]=`${e.level}:${r} ${e.message} ${t}`}else{e[n]=`${e.level}:${r} ${e.message}`}return e}))},7081:(e,t,r)=>{"use strict";const i=r(3837);const{SPLAT:n}=r(3937);const s=/%[scdjifoO%]/g;const o=/%%/g;class Splatter{constructor(e){this.options=e}_splat(e,t){const r=e.message;const s=e[n]||e.splat||[];const a=r.match(o);const l=a&&a.length||0;const u=t.length-l;const c=u-s.length;const h=c<0?s.splice(c,-1*c):[];const d=h.length;if(d){for(let t=0;t<d;t++){Object.assign(e,h[t])}}e.message=i.format(r,...s);return e}transform(e){const t=e.message;const r=e[n]||e.splat;if(!r||!r.length){return e}const i=t&&t.match&&t.match(s);if(!i&&(r||r.length)){const t=r.length>1?r.splice(0):r;const i=t.length;if(i){for(let r=0;r<i;r++){Object.assign(e,t[r])}}return e}if(i){return this._splat(e,i)}return e}}e.exports=e=>new Splatter(e)},8381:(e,t,r)=>{"use strict";const i=r(4513);const n=r(3791);e.exports=n(((e,t={})=>{if(t.format){e.timestamp=typeof t.format==="function"?t.format():i.format(new Date,t.format)}if(!e.timestamp){e.timestamp=(new Date).toISOString()}if(t.alias){e[t.alias]=e.timestamp}return e}))},6420:(e,t,r)=>{"use strict";const i=r(9256);const n=r(3791);const{MESSAGE:s}=r(3937);e.exports=n(((e,t)=>{if(t.level!==false){e.level=i.strip(e.level)}if(t.message!==false){e.message=i.strip(String(e.message))}if(t.raw!==false&&e[s]){e[s]=i.strip(String(e[s]))}return e}))},2610:e=>{"use strict";const t=["aborted","complete","headers","httpVersion","httpVersionMinor","httpVersionMajor","method","rawHeaders","rawTrailers","setTimeout","socket","statusCode","statusMessage","trailers","url"];e.exports=(e,r)=>{if(r._readableState.autoDestroy){throw new Error("The second stream must have the `autoDestroy` option set to `false`")}const i=new Set(Object.keys(e).concat(t));const n={};for(const t of i){if(t in r){continue}n[t]={get(){const r=e[t];const i=typeof r==="function";return i?r.bind(e):r},set(r){e[t]=r},enumerable:true,configurable:false}}Object.defineProperties(r,n);e.once("aborted",(()=>{r.destroy();r.emit("aborted")}));e.once("close",(()=>{if(e.complete){if(r.readable){r.once("end",(()=>{r.emit("close")}))}else{r.emit("close")}}else{r.emit("close")}}));return r}},4118:(e,t,r)=>{"use strict";var i=r(2743);e.exports=function one(e){var t=0,r;function onetime(){if(t)return r;t=1;r=e.apply(this,arguments);e=null;return r}onetime.displayName=i(e);return onetime}},9273:e=>{"use strict";class QuickLRU{constructor(e={}){if(!(e.maxSize&&e.maxSize>0)){throw new TypeError("`maxSize` must be a number greater than 0")}this.maxSize=e.maxSize;this.onEviction=e.onEviction;this.cache=new Map;this.oldCache=new Map;this._size=0}_set(e,t){this.cache.set(e,t);this._size++;if(this._size>=this.maxSize){this._size=0;if(typeof this.onEviction==="function"){for(const[e,t]of this.oldCache.entries()){this.onEviction(e,t)}}this.oldCache=this.cache;this.cache=new Map}}get(e){if(this.cache.has(e)){return this.cache.get(e)}if(this.oldCache.has(e)){const t=this.oldCache.get(e);this.oldCache.delete(e);this._set(e,t);return t}}set(e,t){if(this.cache.has(e)){this.cache.set(e,t)}else{this._set(e,t)}return this}has(e){return this.cache.has(e)||this.oldCache.has(e)}peek(e){if(this.cache.has(e)){return this.cache.get(e)}if(this.oldCache.has(e)){return this.oldCache.get(e)}}delete(e){const t=this.cache.delete(e);if(t){this._size--}return this.oldCache.delete(e)||t}clear(){this.cache.clear();this.oldCache.clear();this._size=0}*keys(){for(const[e]of this){yield e}}*values(){for(const[,e]of this){yield e}}*[Symbol.iterator](){for(const e of this.cache){yield e}for(const e of this.oldCache){const[t]=e;if(!this.cache.has(t)){yield e}}}get size(){let e=0;for(const t of this.oldCache.keys()){if(!this.cache.has(t)){e++}}return Math.min(this._size+e,this.maxSize)}}e.exports=QuickLRU},7214:e=>{"use strict";const t={};function createErrorType(e,r,i){if(!i){i=Error}function getMessage(e,t,i){if(typeof r==="string"){return r}else{return r(e,t,i)}}class NodeError extends i{constructor(e,t,r){super(getMessage(e,t,r))}}NodeError.prototype.name=i.name;NodeError.prototype.code=e;t[e]=NodeError}function oneOf(e,t){if(Array.isArray(e)){const r=e.length;e=e.map((e=>String(e)));if(r>2){return`one of ${t} ${e.slice(0,r-1).join(", ")}, or `+e[r-1]}else if(r===2){return`one of ${t} ${e[0]} or ${e[1]}`}else{return`of ${t} ${e[0]}`}}else{return`of ${t} ${String(e)}`}}function startsWith(e,t,r){return e.substr(!r||r<0?0:+r,t.length)===t}function endsWith(e,t,r){if(r===undefined||r>e.length){r=e.length}return e.substring(r-t.length,r)===t}function includes(e,t,r){if(typeof r!=="number"){r=0}if(r+t.length>e.length){return false}else{return e.indexOf(t,r)!==-1}}createErrorType("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError);createErrorType("ERR_INVALID_ARG_TYPE",(function(e,t,r){let i;if(typeof t==="string"&&startsWith(t,"not ")){i="must not be";t=t.replace(/^not /,"")}else{i="must be"}let n;if(endsWith(e," argument")){n=`The ${e} ${i} ${oneOf(t,"type")}`}else{const r=includes(e,".")?"property":"argument";n=`The "${e}" ${r} ${i} ${oneOf(t,"type")}`}n+=`. Received type ${typeof r}`;return n}),TypeError);createErrorType("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");createErrorType("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"}));createErrorType("ERR_STREAM_PREMATURE_CLOSE","Premature close");createErrorType("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"}));createErrorType("ERR_MULTIPLE_CALLBACK","Callback called multiple times");createErrorType("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");createErrorType("ERR_STREAM_WRITE_AFTER_END","write after end");createErrorType("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);createErrorType("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError);createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");e.exports.q=t},1359:(e,t,r)=>{"use strict";var i=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=Duplex;var n=r(1433);var s=r(6993);r(4124)(Duplex,n);{var o=i(s.prototype);for(var a=0;a<o.length;a++){var l=o[a];if(!Duplex.prototype[l])Duplex.prototype[l]=s.prototype[l]}}function Duplex(e){if(!(this instanceof Duplex))return new Duplex(e);n.call(this,e);s.call(this,e);this.allowHalfOpen=true;if(e){if(e.readable===false)this.readable=false;if(e.writable===false)this.writable=false;if(e.allowHalfOpen===false){this.allowHalfOpen=false;this.once("end",onend)}}}Object.defineProperty(Duplex.prototype,"writableHighWaterMark",{enumerable:false,get:function get(){return this._writableState.highWaterMark}});Object.defineProperty(Duplex.prototype,"writableBuffer",{enumerable:false,get:function get(){return this._writableState&&this._writableState.getBuffer()}});Object.defineProperty(Duplex.prototype,"writableLength",{enumerable:false,get:function get(){return this._writableState.length}});function onend(){if(this._writableState.ended)return;process.nextTick(onEndNT,this)}function onEndNT(e){e.end()}Object.defineProperty(Duplex.prototype,"destroyed",{enumerable:false,get:function get(){if(this._readableState===undefined||this._writableState===undefined){return false}return this._readableState.destroyed&&this._writableState.destroyed},set:function set(e){if(this._readableState===undefined||this._writableState===undefined){return}this._readableState.destroyed=e;this._writableState.destroyed=e}})},1542:(e,t,r)=>{"use strict";e.exports=PassThrough;var i=r(4415);r(4124)(PassThrough,i);function PassThrough(e){if(!(this instanceof PassThrough))return new PassThrough(e);i.call(this,e)}PassThrough.prototype._transform=function(e,t,r){r(null,e)}},1433:(e,t,r)=>{"use strict";e.exports=Readable;var i;Readable.ReadableState=ReadableState;var n=r(2361).EventEmitter;var s=function EElistenerCount(e,t){return e.listeners(t).length};var o=r(2387);var a=r(4300).Buffer;var l=(typeof global!=="undefined"?global:typeof window!=="undefined"?window:typeof self!=="undefined"?self:{}).Uint8Array||function(){};function _uint8ArrayToBuffer(e){return a.from(e)}function _isUint8Array(e){return a.isBuffer(e)||e instanceof l}var u=r(3837);var c;if(u&&u.debuglog){c=u.debuglog("stream")}else{c=function debug(){}}var h=r(2746);var d=r(7049);var p=r(9948),m=p.getHighWaterMark;var g=r(7214).q,y=g.ERR_INVALID_ARG_TYPE,_=g.ERR_STREAM_PUSH_AFTER_EOF,v=g.ERR_METHOD_NOT_IMPLEMENTED,b=g.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;var x;var T;var w;r(4124)(Readable,o);var S=d.errorOrDestroy;var E=["error","close","destroy","pause","resume"];function prependListener(e,t,r){if(typeof e.prependListener==="function")return e.prependListener(t,r);if(!e._events||!e._events[t])e.on(t,r);else if(Array.isArray(e._events[t]))e._events[t].unshift(r);else e._events[t]=[r,e._events[t]]}function ReadableState(e,t,n){i=i||r(1359);e=e||{};if(typeof n!=="boolean")n=t instanceof i;this.objectMode=!!e.objectMode;if(n)this.objectMode=this.objectMode||!!e.readableObjectMode;this.highWaterMark=m(this,e,"readableHighWaterMark",n);this.buffer=new h;this.length=0;this.pipes=null;this.pipesCount=0;this.flowing=null;this.ended=false;this.endEmitted=false;this.reading=false;this.sync=true;this.needReadable=false;this.emittedReadable=false;this.readableListening=false;this.resumeScheduled=false;this.paused=true;this.emitClose=e.emitClose!==false;this.autoDestroy=!!e.autoDestroy;this.destroyed=false;this.defaultEncoding=e.defaultEncoding||"utf8";this.awaitDrain=0;this.readingMore=false;this.decoder=null;this.encoding=null;if(e.encoding){if(!x)x=r(4841).s;this.decoder=new x(e.encoding);this.encoding=e.encoding}}function Readable(e){i=i||r(1359);if(!(this instanceof Readable))return new Readable(e);var t=this instanceof i;this._readableState=new ReadableState(e,this,t);this.readable=true;if(e){if(typeof e.read==="function")this._read=e.read;if(typeof e.destroy==="function")this._destroy=e.destroy}o.call(this)}Object.defineProperty(Readable.prototype,"destroyed",{enumerable:false,get:function get(){if(this._readableState===undefined){return false}return this._readableState.destroyed},set:function set(e){if(!this._readableState){return}this._readableState.destroyed=e}});Readable.prototype.destroy=d.destroy;Readable.prototype._undestroy=d.undestroy;Readable.prototype._destroy=function(e,t){t(e)};Readable.prototype.push=function(e,t){var r=this._readableState;var i;if(!r.objectMode){if(typeof e==="string"){t=t||r.defaultEncoding;if(t!==r.encoding){e=a.from(e,t);t=""}i=true}}else{i=true}return readableAddChunk(this,e,t,false,i)};Readable.prototype.unshift=function(e){return readableAddChunk(this,e,null,true,false)};function readableAddChunk(e,t,r,i,n){c("readableAddChunk",t);var s=e._readableState;if(t===null){s.reading=false;onEofChunk(e,s)}else{var o;if(!n)o=chunkInvalid(s,t);if(o){S(e,o)}else if(s.objectMode||t&&t.length>0){if(typeof t!=="string"&&!s.objectMode&&Object.getPrototypeOf(t)!==a.prototype){t=_uint8ArrayToBuffer(t)}if(i){if(s.endEmitted)S(e,new b);else addChunk(e,s,t,true)}else if(s.ended){S(e,new _)}else if(s.destroyed){return false}else{s.reading=false;if(s.decoder&&!r){t=s.decoder.write(t);if(s.objectMode||t.length!==0)addChunk(e,s,t,false);else maybeReadMore(e,s)}else{addChunk(e,s,t,false)}}}else if(!i){s.reading=false;maybeReadMore(e,s)}}return!s.ended&&(s.length<s.highWaterMark||s.length===0)}function addChunk(e,t,r,i){if(t.flowing&&t.length===0&&!t.sync){t.awaitDrain=0;e.emit("data",r)}else{t.length+=t.objectMode?1:r.length;if(i)t.buffer.unshift(r);else t.buffer.push(r);if(t.needReadable)emitReadable(e)}maybeReadMore(e,t)}function chunkInvalid(e,t){var r;if(!_isUint8Array(t)&&typeof t!=="string"&&t!==undefined&&!e.objectMode){r=new y("chunk",["string","Buffer","Uint8Array"],t)}return r}Readable.prototype.isPaused=function(){return this._readableState.flowing===false};Readable.prototype.setEncoding=function(e){if(!x)x=r(4841).s;var t=new x(e);this._readableState.decoder=t;this._readableState.encoding=this._readableState.decoder.encoding;var i=this._readableState.buffer.head;var n="";while(i!==null){n+=t.write(i.data);i=i.next}this._readableState.buffer.clear();if(n!=="")this._readableState.buffer.push(n);this._readableState.length=n.length;return this};var A=1073741824;function computeNewHighWaterMark(e){if(e>=A){e=A}else{e--;e|=e>>>1;e|=e>>>2;e|=e>>>4;e|=e>>>8;e|=e>>>16;e++}return e}function howMuchToRead(e,t){if(e<=0||t.length===0&&t.ended)return 0;if(t.objectMode)return 1;if(e!==e){if(t.flowing&&t.length)return t.buffer.head.data.length;else return t.length}if(e>t.highWaterMark)t.highWaterMark=computeNewHighWaterMark(e);if(e<=t.length)return e;if(!t.ended){t.needReadable=true;return 0}return t.length}Readable.prototype.read=function(e){c("read",e);e=parseInt(e,10);var t=this._readableState;var r=e;if(e!==0)t.emittedReadable=false;if(e===0&&t.needReadable&&((t.highWaterMark!==0?t.length>=t.highWaterMark:t.length>0)||t.ended)){c("read: emitReadable",t.length,t.ended);if(t.length===0&&t.ended)endReadable(this);else emitReadable(this);return null}e=howMuchToRead(e,t);if(e===0&&t.ended){if(t.length===0)endReadable(this);return null}var i=t.needReadable;c("need readable",i);if(t.length===0||t.length-e<t.highWaterMark){i=true;c("length less than watermark",i)}if(t.ended||t.reading){i=false;c("reading or ended",i)}else if(i){c("do read");t.reading=true;t.sync=true;if(t.length===0)t.needReadable=true;this._read(t.highWaterMark);t.sync=false;if(!t.reading)e=howMuchToRead(r,t)}var n;if(e>0)n=fromList(e,t);else n=null;if(n===null){t.needReadable=t.length<=t.highWaterMark;e=0}else{t.length-=e;t.awaitDrain=0}if(t.length===0){if(!t.ended)t.needReadable=true;if(r!==e&&t.ended)endReadable(this)}if(n!==null)this.emit("data",n);return n};function onEofChunk(e,t){c("onEofChunk");if(t.ended)return;if(t.decoder){var r=t.decoder.end();if(r&&r.length){t.buffer.push(r);t.length+=t.objectMode?1:r.length}}t.ended=true;if(t.sync){emitReadable(e)}else{t.needReadable=false;if(!t.emittedReadable){t.emittedReadable=true;emitReadable_(e)}}}function emitReadable(e){var t=e._readableState;c("emitReadable",t.needReadable,t.emittedReadable);t.needReadable=false;if(!t.emittedReadable){c("emitReadable",t.flowing);t.emittedReadable=true;process.nextTick(emitReadable_,e)}}function emitReadable_(e){var t=e._readableState;c("emitReadable_",t.destroyed,t.length,t.ended);if(!t.destroyed&&(t.length||t.ended)){e.emit("readable");t.emittedReadable=false}t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark;flow(e)}function maybeReadMore(e,t){if(!t.readingMore){t.readingMore=true;process.nextTick(maybeReadMore_,e,t)}}function maybeReadMore_(e,t){while(!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&t.length===0)){var r=t.length;c("maybeReadMore read 0");e.read(0);if(r===t.length)break}t.readingMore=false}Readable.prototype._read=function(e){S(this,new v("_read()"))};Readable.prototype.pipe=function(e,t){var r=this;var i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e);break}i.pipesCount+=1;c("pipe count=%d opts=%j",i.pipesCount,t);var n=(!t||t.end!==false)&&e!==process.stdout&&e!==process.stderr;var o=n?onend:unpipe;if(i.endEmitted)process.nextTick(o);else r.once("end",o);e.on("unpipe",onunpipe);function onunpipe(e,t){c("onunpipe");if(e===r){if(t&&t.hasUnpiped===false){t.hasUnpiped=true;cleanup()}}}function onend(){c("onend");e.end()}var a=pipeOnDrain(r);e.on("drain",a);var l=false;function cleanup(){c("cleanup");e.removeListener("close",onclose);e.removeListener("finish",onfinish);e.removeListener("drain",a);e.removeListener("error",onerror);e.removeListener("unpipe",onunpipe);r.removeListener("end",onend);r.removeListener("end",unpipe);r.removeListener("data",ondata);l=true;if(i.awaitDrain&&(!e._writableState||e._writableState.needDrain))a()}r.on("data",ondata);function ondata(t){c("ondata");var n=e.write(t);c("dest.write",n);if(n===false){if((i.pipesCount===1&&i.pipes===e||i.pipesCount>1&&indexOf(i.pipes,e)!==-1)&&!l){c("false write response, pause",i.awaitDrain);i.awaitDrain++}r.pause()}}function onerror(t){c("onerror",t);unpipe();e.removeListener("error",onerror);if(s(e,"error")===0)S(e,t)}prependListener(e,"error",onerror);function onclose(){e.removeListener("finish",onfinish);unpipe()}e.once("close",onclose);function onfinish(){c("onfinish");e.removeListener("close",onclose);unpipe()}e.once("finish",onfinish);function unpipe(){c("unpipe");r.unpipe(e)}e.emit("pipe",r);if(!i.flowing){c("pipe resume");r.resume()}return e};function pipeOnDrain(e){return function pipeOnDrainFunctionResult(){var t=e._readableState;c("pipeOnDrain",t.awaitDrain);if(t.awaitDrain)t.awaitDrain--;if(t.awaitDrain===0&&s(e,"data")){t.flowing=true;flow(e)}}}Readable.prototype.unpipe=function(e){var t=this._readableState;var r={hasUnpiped:false};if(t.pipesCount===0)return this;if(t.pipesCount===1){if(e&&e!==t.pipes)return this;if(!e)e=t.pipes;t.pipes=null;t.pipesCount=0;t.flowing=false;if(e)e.emit("unpipe",this,r);return this}if(!e){var i=t.pipes;var n=t.pipesCount;t.pipes=null;t.pipesCount=0;t.flowing=false;for(var s=0;s<n;s++)i[s].emit("unpipe",this,{hasUnpiped:false});return this}var o=indexOf(t.pipes,e);if(o===-1)return this;t.pipes.splice(o,1);t.pipesCount-=1;if(t.pipesCount===1)t.pipes=t.pipes[0];e.emit("unpipe",this,r);return this};Readable.prototype.on=function(e,t){var r=o.prototype.on.call(this,e,t);var i=this._readableState;if(e==="data"){i.readableListening=this.listenerCount("readable")>0;if(i.flowing!==false)this.resume()}else if(e==="readable"){if(!i.endEmitted&&!i.readableListening){i.readableListening=i.needReadable=true;i.flowing=false;i.emittedReadable=false;c("on readable",i.length,i.reading);if(i.length){emitReadable(this)}else if(!i.reading){process.nextTick(nReadingNextTick,this)}}}return r};Readable.prototype.addListener=Readable.prototype.on;Readable.prototype.removeListener=function(e,t){var r=o.prototype.removeListener.call(this,e,t);if(e==="readable"){process.nextTick(updateReadableListening,this)}return r};Readable.prototype.removeAllListeners=function(e){var t=o.prototype.removeAllListeners.apply(this,arguments);if(e==="readable"||e===undefined){process.nextTick(updateReadableListening,this)}return t};function updateReadableListening(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0;if(t.resumeScheduled&&!t.paused){t.flowing=true}else if(e.listenerCount("data")>0){e.resume()}}function nReadingNextTick(e){c("readable nexttick read 0");e.read(0)}Readable.prototype.resume=function(){var e=this._readableState;if(!e.flowing){c("resume");e.flowing=!e.readableListening;resume(this,e)}e.paused=false;return this};function resume(e,t){if(!t.resumeScheduled){t.resumeScheduled=true;process.nextTick(resume_,e,t)}}function resume_(e,t){c("resume",t.reading);if(!t.reading){e.read(0)}t.resumeScheduled=false;e.emit("resume");flow(e);if(t.flowing&&!t.reading)e.read(0)}Readable.prototype.pause=function(){c("call pause flowing=%j",this._readableState.flowing);if(this._readableState.flowing!==false){c("pause");this._readableState.flowing=false;this.emit("pause")}this._readableState.paused=true;return this};function flow(e){var t=e._readableState;c("flow",t.flowing);while(t.flowing&&e.read()!==null);}Readable.prototype.wrap=function(e){var t=this;var r=this._readableState;var i=false;e.on("end",(function(){c("wrapped end");if(r.decoder&&!r.ended){var e=r.decoder.end();if(e&&e.length)t.push(e)}t.push(null)}));e.on("data",(function(n){c("wrapped data");if(r.decoder)n=r.decoder.write(n);if(r.objectMode&&(n===null||n===undefined))return;else if(!r.objectMode&&(!n||!n.length))return;var s=t.push(n);if(!s){i=true;e.pause()}}));for(var n in e){if(this[n]===undefined&&typeof e[n]==="function"){this[n]=function methodWrap(t){return function methodWrapReturnFunction(){return e[t].apply(e,arguments)}}(n)}}for(var s=0;s<E.length;s++){e.on(E[s],this.emit.bind(this,E[s]))}this._read=function(t){c("wrapped _read",t);if(i){i=false;e.resume()}};return this};if(typeof Symbol==="function"){Readable.prototype[Symbol.asyncIterator]=function(){if(T===undefined){T=r(3306)}return T(this)}}Object.defineProperty(Readable.prototype,"readableHighWaterMark",{enumerable:false,get:function get(){return this._readableState.highWaterMark}});Object.defineProperty(Readable.prototype,"readableBuffer",{enumerable:false,get:function get(){return this._readableState&&this._readableState.buffer}});Object.defineProperty(Readable.prototype,"readableFlowing",{enumerable:false,get:function get(){return this._readableState.flowing},set:function set(e){if(this._readableState){this._readableState.flowing=e}}});Readable._fromList=fromList;Object.defineProperty(Readable.prototype,"readableLength",{enumerable:false,get:function get(){return this._readableState.length}});function fromList(e,t){if(t.length===0)return null;var r;if(t.objectMode)r=t.buffer.shift();else if(!e||e>=t.length){if(t.decoder)r=t.buffer.join("");else if(t.buffer.length===1)r=t.buffer.first();else r=t.buffer.concat(t.length);t.buffer.clear()}else{r=t.buffer.consume(e,t.decoder)}return r}function endReadable(e){var t=e._readableState;c("endReadable",t.endEmitted);if(!t.endEmitted){t.ended=true;process.nextTick(endReadableNT,t,e)}}function endReadableNT(e,t){c("endReadableNT",e.endEmitted,e.length);if(!e.endEmitted&&e.length===0){e.endEmitted=true;t.readable=false;t.emit("end");if(e.autoDestroy){var r=t._writableState;if(!r||r.autoDestroy&&r.finished){t.destroy()}}}}if(typeof Symbol==="function"){Readable.from=function(e,t){if(w===undefined){w=r(9082)}return w(Readable,e,t)}}function indexOf(e,t){for(var r=0,i=e.length;r<i;r++){if(e[r]===t)return r}return-1}},4415:(e,t,r)=>{"use strict";e.exports=Transform;var i=r(7214).q,n=i.ERR_METHOD_NOT_IMPLEMENTED,s=i.ERR_MULTIPLE_CALLBACK,o=i.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=i.ERR_TRANSFORM_WITH_LENGTH_0;var l=r(1359);r(4124)(Transform,l);function afterTransform(e,t){var r=this._transformState;r.transforming=false;var i=r.writecb;if(i===null){return this.emit("error",new s)}r.writechunk=null;r.writecb=null;if(t!=null)this.push(t);i(e);var n=this._readableState;n.reading=false;if(n.needReadable||n.length<n.highWaterMark){this._read(n.highWaterMark)}}function Transform(e){if(!(this instanceof Transform))return new Transform(e);l.call(this,e);this._transformState={afterTransform:afterTransform.bind(this),needTransform:false,transforming:false,writecb:null,writechunk:null,writeencoding:null};this._readableState.needReadable=true;this._readableState.sync=false;if(e){if(typeof e.transform==="function")this._transform=e.transform;if(typeof e.flush==="function")this._flush=e.flush}this.on("prefinish",prefinish)}function prefinish(){var e=this;if(typeof this._flush==="function"&&!this._readableState.destroyed){this._flush((function(t,r){done(e,t,r)}))}else{done(this,null,null)}}Transform.prototype.push=function(e,t){this._transformState.needTransform=false;return l.prototype.push.call(this,e,t)};Transform.prototype._transform=function(e,t,r){r(new n("_transform()"))};Transform.prototype._write=function(e,t,r){var i=this._transformState;i.writecb=r;i.writechunk=e;i.writeencoding=t;if(!i.transforming){var n=this._readableState;if(i.needTransform||n.needReadable||n.length<n.highWaterMark)this._read(n.highWaterMark)}};Transform.prototype._read=function(e){var t=this._transformState;if(t.writechunk!==null&&!t.transforming){t.transforming=true;this._transform(t.writechunk,t.writeencoding,t.afterTransform)}else{t.needTransform=true}};Transform.prototype._destroy=function(e,t){l.prototype._destroy.call(this,e,(function(e){t(e)}))};function done(e,t,r){if(t)return e.emit("error",t);if(r!=null)e.push(r);if(e._writableState.length)throw new a;if(e._transformState.transforming)throw new o;return e.push(null)}},6993:(e,t,r)=>{"use strict";e.exports=Writable;function WriteReq(e,t,r){this.chunk=e;this.encoding=t;this.callback=r;this.next=null}function CorkedRequest(e){var t=this;this.next=null;this.entry=null;this.finish=function(){onCorkedFinish(t,e)}}var i;Writable.WritableState=WritableState;var n={deprecate:r(5278)};var s=r(2387);var o=r(4300).Buffer;var a=(typeof global!=="undefined"?global:typeof window!=="undefined"?window:typeof self!=="undefined"?self:{}).Uint8Array||function(){};function _uint8ArrayToBuffer(e){return o.from(e)}function _isUint8Array(e){return o.isBuffer(e)||e instanceof a}var l=r(7049);var u=r(9948),c=u.getHighWaterMark;var h=r(7214).q,d=h.ERR_INVALID_ARG_TYPE,p=h.ERR_METHOD_NOT_IMPLEMENTED,m=h.ERR_MULTIPLE_CALLBACK,g=h.ERR_STREAM_CANNOT_PIPE,y=h.ERR_STREAM_DESTROYED,_=h.ERR_STREAM_NULL_VALUES,v=h.ERR_STREAM_WRITE_AFTER_END,b=h.ERR_UNKNOWN_ENCODING;var x=l.errorOrDestroy;r(4124)(Writable,s);function nop(){}function WritableState(e,t,n){i=i||r(1359);e=e||{};if(typeof n!=="boolean")n=t instanceof i;this.objectMode=!!e.objectMode;if(n)this.objectMode=this.objectMode||!!e.writableObjectMode;this.highWaterMark=c(this,e,"writableHighWaterMark",n);this.finalCalled=false;this.needDrain=false;this.ending=false;this.ended=false;this.finished=false;this.destroyed=false;var s=e.decodeStrings===false;this.decodeStrings=!s;this.defaultEncoding=e.defaultEncoding||"utf8";this.length=0;this.writing=false;this.corked=0;this.sync=true;this.bufferProcessing=false;this.onwrite=function(e){onwrite(t,e)};this.writecb=null;this.writelen=0;this.bufferedRequest=null;this.lastBufferedRequest=null;this.pendingcb=0;this.prefinished=false;this.errorEmitted=false;this.emitClose=e.emitClose!==false;this.autoDestroy=!!e.autoDestroy;this.bufferedRequestCount=0;this.corkedRequestsFree=new CorkedRequest(this)}WritableState.prototype.getBuffer=function getBuffer(){var e=this.bufferedRequest;var t=[];while(e){t.push(e);e=e.next}return t};(function(){try{Object.defineProperty(WritableState.prototype,"buffer",{get:n.deprecate((function writableStateBufferGetter(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer "+"instead.","DEP0003")})}catch(e){}})();var T;if(typeof Symbol==="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]==="function"){T=Function.prototype[Symbol.hasInstance];Object.defineProperty(Writable,Symbol.hasInstance,{value:function value(e){if(T.call(this,e))return true;if(this!==Writable)return false;return e&&e._writableState instanceof WritableState}})}else{T=function realHasInstance(e){return e instanceof this}}function Writable(e){i=i||r(1359);var t=this instanceof i;if(!t&&!T.call(Writable,this))return new Writable(e);this._writableState=new WritableState(e,this,t);this.writable=true;if(e){if(typeof e.write==="function")this._write=e.write;if(typeof e.writev==="function")this._writev=e.writev;if(typeof e.destroy==="function")this._destroy=e.destroy;if(typeof e.final==="function")this._final=e.final}s.call(this)}Writable.prototype.pipe=function(){x(this,new g)};function writeAfterEnd(e,t){var r=new v;x(e,r);process.nextTick(t,r)}function validChunk(e,t,r,i){var n;if(r===null){n=new _}else if(typeof r!=="string"&&!t.objectMode){n=new d("chunk",["string","Buffer"],r)}if(n){x(e,n);process.nextTick(i,n);return false}return true}Writable.prototype.write=function(e,t,r){var i=this._writableState;var n=false;var s=!i.objectMode&&_isUint8Array(e);if(s&&!o.isBuffer(e)){e=_uint8ArrayToBuffer(e)}if(typeof t==="function"){r=t;t=null}if(s)t="buffer";else if(!t)t=i.defaultEncoding;if(typeof r!=="function")r=nop;if(i.ending)writeAfterEnd(this,r);else if(s||validChunk(this,i,e,r)){i.pendingcb++;n=writeOrBuffer(this,i,s,e,t,r)}return n};Writable.prototype.cork=function(){this._writableState.corked++};Writable.prototype.uncork=function(){var e=this._writableState;if(e.corked){e.corked--;if(!e.writing&&!e.corked&&!e.bufferProcessing&&e.bufferedRequest)clearBuffer(this,e)}};Writable.prototype.setDefaultEncoding=function setDefaultEncoding(e){if(typeof e==="string")e=e.toLowerCase();if(!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new b(e);this._writableState.defaultEncoding=e;return this};Object.defineProperty(Writable.prototype,"writableBuffer",{enumerable:false,get:function get(){return this._writableState&&this._writableState.getBuffer()}});function decodeChunk(e,t,r){if(!e.objectMode&&e.decodeStrings!==false&&typeof t==="string"){t=o.from(t,r)}return t}Object.defineProperty(Writable.prototype,"writableHighWaterMark",{enumerable:false,get:function get(){return this._writableState.highWaterMark}});function writeOrBuffer(e,t,r,i,n,s){if(!r){var o=decodeChunk(t,i,n);if(i!==o){r=true;n="buffer";i=o}}var a=t.objectMode?1:i.length;t.length+=a;var l=t.length<t.highWaterMark;if(!l)t.needDrain=true;if(t.writing||t.corked){var u=t.lastBufferedRequest;t.lastBufferedRequest={chunk:i,encoding:n,isBuf:r,callback:s,next:null};if(u){u.next=t.lastBufferedRequest}else{t.bufferedRequest=t.lastBufferedRequest}t.bufferedRequestCount+=1}else{doWrite(e,t,false,a,i,n,s)}return l}function doWrite(e,t,r,i,n,s,o){t.writelen=i;t.writecb=o;t.writing=true;t.sync=true;if(t.destroyed)t.onwrite(new y("write"));else if(r)e._writev(n,t.onwrite);else e._write(n,s,t.onwrite);t.sync=false}function onwriteError(e,t,r,i,n){--t.pendingcb;if(r){process.nextTick(n,i);process.nextTick(finishMaybe,e,t);e._writableState.errorEmitted=true;x(e,i)}else{n(i);e._writableState.errorEmitted=true;x(e,i);finishMaybe(e,t)}}function onwriteStateUpdate(e){e.writing=false;e.writecb=null;e.length-=e.writelen;e.writelen=0}function onwrite(e,t){var r=e._writableState;var i=r.sync;var n=r.writecb;if(typeof n!=="function")throw new m;onwriteStateUpdate(r);if(t)onwriteError(e,r,i,t,n);else{var s=needFinish(r)||e.destroyed;if(!s&&!r.corked&&!r.bufferProcessing&&r.bufferedRequest){clearBuffer(e,r)}if(i){process.nextTick(afterWrite,e,r,s,n)}else{afterWrite(e,r,s,n)}}}function afterWrite(e,t,r,i){if(!r)onwriteDrain(e,t);t.pendingcb--;i();finishMaybe(e,t)}function onwriteDrain(e,t){if(t.length===0&&t.needDrain){t.needDrain=false;e.emit("drain")}}function clearBuffer(e,t){t.bufferProcessing=true;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var i=t.bufferedRequestCount;var n=new Array(i);var s=t.corkedRequestsFree;s.entry=r;var o=0;var a=true;while(r){n[o]=r;if(!r.isBuf)a=false;r=r.next;o+=1}n.allBuffers=a;doWrite(e,t,true,t.length,n,"",s.finish);t.pendingcb++;t.lastBufferedRequest=null;if(s.next){t.corkedRequestsFree=s.next;s.next=null}else{t.corkedRequestsFree=new CorkedRequest(t)}t.bufferedRequestCount=0}else{while(r){var l=r.chunk;var u=r.encoding;var c=r.callback;var h=t.objectMode?1:l.length;doWrite(e,t,false,h,l,u,c);r=r.next;t.bufferedRequestCount--;if(t.writing){break}}if(r===null)t.lastBufferedRequest=null}t.bufferedRequest=r;t.bufferProcessing=false}Writable.prototype._write=function(e,t,r){r(new p("_write()"))};Writable.prototype._writev=null;Writable.prototype.end=function(e,t,r){var i=this._writableState;if(typeof e==="function"){r=e;e=null;t=null}else if(typeof t==="function"){r=t;t=null}if(e!==null&&e!==undefined)this.write(e,t);if(i.corked){i.corked=1;this.uncork()}if(!i.ending)endWritable(this,i,r);return this};Object.defineProperty(Writable.prototype,"writableLength",{enumerable:false,get:function get(){return this._writableState.length}});function needFinish(e){return e.ending&&e.length===0&&e.bufferedRequest===null&&!e.finished&&!e.writing}function callFinal(e,t){e._final((function(r){t.pendingcb--;if(r){x(e,r)}t.prefinished=true;e.emit("prefinish");finishMaybe(e,t)}))}function prefinish(e,t){if(!t.prefinished&&!t.finalCalled){if(typeof e._final==="function"&&!t.destroyed){t.pendingcb++;t.finalCalled=true;process.nextTick(callFinal,e,t)}else{t.prefinished=true;e.emit("prefinish")}}}function finishMaybe(e,t){var r=needFinish(t);if(r){prefinish(e,t);if(t.pendingcb===0){t.finished=true;e.emit("finish");if(t.autoDestroy){var i=e._readableState;if(!i||i.autoDestroy&&i.endEmitted){e.destroy()}}}}return r}function endWritable(e,t,r){t.ending=true;finishMaybe(e,t);if(r){if(t.finished)process.nextTick(r);else e.once("finish",r)}t.ended=true;e.writable=false}function onCorkedFinish(e,t,r){var i=e.entry;e.entry=null;while(i){var n=i.callback;t.pendingcb--;n(r);i=i.next}t.corkedRequestsFree.next=e}Object.defineProperty(Writable.prototype,"destroyed",{enumerable:false,get:function get(){if(this._writableState===undefined){return false}return this._writableState.destroyed},set:function set(e){if(!this._writableState){return}this._writableState.destroyed=e}});Writable.prototype.destroy=l.destroy;Writable.prototype._undestroy=l.undestroy;Writable.prototype._destroy=function(e,t){t(e)}},3306:(e,t,r)=>{"use strict";var i;function _defineProperty(e,t,r){t=_toPropertyKey(t);if(t in e){Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true})}else{e[t]=r}return e}function _toPropertyKey(e){var t=_toPrimitive(e,"string");return typeof t==="symbol"?t:String(t)}function _toPrimitive(e,t){if(typeof e!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==undefined){var i=r.call(e,t||"default");if(typeof i!=="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var n=r(6080);var s=Symbol("lastResolve");var o=Symbol("lastReject");var a=Symbol("error");var l=Symbol("ended");var u=Symbol("lastPromise");var c=Symbol("handlePromise");var h=Symbol("stream");function createIterResult(e,t){return{value:e,done:t}}function readAndResolve(e){var t=e[s];if(t!==null){var r=e[h].read();if(r!==null){e[u]=null;e[s]=null;e[o]=null;t(createIterResult(r,false))}}}function onReadable(e){process.nextTick(readAndResolve,e)}function wrapForNext(e,t){return function(r,i){e.then((function(){if(t[l]){r(createIterResult(undefined,true));return}t[c](r,i)}),i)}}var d=Object.getPrototypeOf((function(){}));var p=Object.setPrototypeOf((i={get stream(){return this[h]},next:function next(){var e=this;var t=this[a];if(t!==null){return Promise.reject(t)}if(this[l]){return Promise.resolve(createIterResult(undefined,true))}if(this[h].destroyed){return new Promise((function(t,r){process.nextTick((function(){if(e[a]){r(e[a])}else{t(createIterResult(undefined,true))}}))}))}var r=this[u];var i;if(r){i=new Promise(wrapForNext(r,this))}else{var n=this[h].read();if(n!==null){return Promise.resolve(createIterResult(n,false))}i=new Promise(this[c])}this[u]=i;return i}},_defineProperty(i,Symbol.asyncIterator,(function(){return this})),_defineProperty(i,"return",(function _return(){var e=this;return new Promise((function(t,r){e[h].destroy(null,(function(e){if(e){r(e);return}t(createIterResult(undefined,true))}))}))})),i),d);var m=function createReadableStreamAsyncIterator(e){var t;var r=Object.create(p,(t={},_defineProperty(t,h,{value:e,writable:true}),_defineProperty(t,s,{value:null,writable:true}),_defineProperty(t,o,{value:null,writable:true}),_defineProperty(t,a,{value:null,writable:true}),_defineProperty(t,l,{value:e._readableState.endEmitted,writable:true}),_defineProperty(t,c,{value:function value(e,t){var i=r[h].read();if(i){r[u]=null;r[s]=null;r[o]=null;e(createIterResult(i,false))}else{r[s]=e;r[o]=t}},writable:true}),t));r[u]=null;n(e,(function(e){if(e&&e.code!=="ERR_STREAM_PREMATURE_CLOSE"){var t=r[o];if(t!==null){r[u]=null;r[s]=null;r[o]=null;t(e)}r[a]=e;return}var i=r[s];if(i!==null){r[u]=null;r[s]=null;r[o]=null;i(createIterResult(undefined,true))}r[l]=true}));e.on("readable",onReadable.bind(null,r));return r};e.exports=m},2746:(e,t,r)=>{"use strict";function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _defineProperty(e,t,r){t=_toPropertyKey(t);if(t in e){Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true})}else{e[t]=r}return e}function _classCallCheck(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||false;i.configurable=true;if("value"in i)i.writable=true;Object.defineProperty(e,_toPropertyKey(i.key),i)}}function _createClass(e,t,r){if(t)_defineProperties(e.prototype,t);if(r)_defineProperties(e,r);Object.defineProperty(e,"prototype",{writable:false});return e}function _toPropertyKey(e){var t=_toPrimitive(e,"string");return typeof t==="symbol"?t:String(t)}function _toPrimitive(e,t){if(typeof e!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==undefined){var i=r.call(e,t||"default");if(typeof i!=="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var i=r(4300),n=i.Buffer;var s=r(3837),o=s.inspect;var a=o&&o.custom||"inspect";function copyBuffer(e,t,r){n.prototype.copy.call(e,t,r)}e.exports=function(){function BufferList(){_classCallCheck(this,BufferList);this.head=null;this.tail=null;this.length=0}_createClass(BufferList,[{key:"push",value:function push(e){var t={data:e,next:null};if(this.length>0)this.tail.next=t;else this.head=t;this.tail=t;++this.length}},{key:"unshift",value:function unshift(e){var t={data:e,next:this.head};if(this.length===0)this.tail=t;this.head=t;++this.length}},{key:"shift",value:function shift(){if(this.length===0)return;var e=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;--this.length;return e}},{key:"clear",value:function clear(){this.head=this.tail=null;this.length=0}},{key:"join",value:function join(e){if(this.length===0)return"";var t=this.head;var r=""+t.data;while(t=t.next)r+=e+t.data;return r}},{key:"concat",value:function concat(e){if(this.length===0)return n.alloc(0);var t=n.allocUnsafe(e>>>0);var r=this.head;var i=0;while(r){copyBuffer(r.data,t,i);i+=r.data.length;r=r.next}return t}},{key:"consume",value:function consume(e,t){var r;if(e<this.head.data.length){r=this.head.data.slice(0,e);this.head.data=this.head.data.slice(e)}else if(e===this.head.data.length){r=this.shift()}else{r=t?this._getString(e):this._getBuffer(e)}return r}},{key:"first",value:function first(){return this.head.data}},{key:"_getString",value:function _getString(e){var t=this.head;var r=1;var i=t.data;e-=i.length;while(t=t.next){var n=t.data;var s=e>n.length?n.length:e;if(s===n.length)i+=n;else i+=n.slice(0,e);e-=s;if(e===0){if(s===n.length){++r;if(t.next)this.head=t.next;else this.head=this.tail=null}else{this.head=t;t.data=n.slice(s)}break}++r}this.length-=r;return i}},{key:"_getBuffer",value:function _getBuffer(e){var t=n.allocUnsafe(e);var r=this.head;var i=1;r.data.copy(t);e-=r.data.length;while(r=r.next){var s=r.data;var o=e>s.length?s.length:e;s.copy(t,t.length-e,0,o);e-=o;if(e===0){if(o===s.length){++i;if(r.next)this.head=r.next;else this.head=this.tail=null}else{this.head=r;r.data=s.slice(o)}break}++i}this.length-=i;return t}},{key:a,value:function value(e,t){return o(this,_objectSpread(_objectSpread({},t),{},{depth:0,customInspect:false}))}}]);return BufferList}()},7049:e=>{"use strict";function destroy(e,t){var r=this;var i=this._readableState&&this._readableState.destroyed;var n=this._writableState&&this._writableState.destroyed;if(i||n){if(t){t(e)}else if(e){if(!this._writableState){process.nextTick(emitErrorNT,this,e)}else if(!this._writableState.errorEmitted){this._writableState.errorEmitted=true;process.nextTick(emitErrorNT,this,e)}}return this}if(this._readableState){this._readableState.destroyed=true}if(this._writableState){this._writableState.destroyed=true}this._destroy(e||null,(function(e){if(!t&&e){if(!r._writableState){process.nextTick(emitErrorAndCloseNT,r,e)}else if(!r._writableState.errorEmitted){r._writableState.errorEmitted=true;process.nextTick(emitErrorAndCloseNT,r,e)}else{process.nextTick(emitCloseNT,r)}}else if(t){process.nextTick(emitCloseNT,r);t(e)}else{process.nextTick(emitCloseNT,r)}}));return this}function emitErrorAndCloseNT(e,t){emitErrorNT(e,t);emitCloseNT(e)}function emitCloseNT(e){if(e._writableState&&!e._writableState.emitClose)return;if(e._readableState&&!e._readableState.emitClose)return;e.emit("close")}function undestroy(){if(this._readableState){this._readableState.destroyed=false;this._readableState.reading=false;this._readableState.ended=false;this._readableState.endEmitted=false}if(this._writableState){this._writableState.destroyed=false;this._writableState.ended=false;this._writableState.ending=false;this._writableState.finalCalled=false;this._writableState.prefinished=false;this._writableState.finished=false;this._writableState.errorEmitted=false}}function emitErrorNT(e,t){e.emit("error",t)}function errorOrDestroy(e,t){var r=e._readableState;var i=e._writableState;if(r&&r.autoDestroy||i&&i.autoDestroy)e.destroy(t);else e.emit("error",t)}e.exports={destroy:destroy,undestroy:undestroy,errorOrDestroy:errorOrDestroy}},6080:(e,t,r)=>{"use strict";var i=r(7214).q.ERR_STREAM_PREMATURE_CLOSE;function once(e){var t=false;return function(){if(t)return;t=true;for(var r=arguments.length,i=new Array(r),n=0;n<r;n++){i[n]=arguments[n]}e.apply(this,i)}}function noop(){}function isRequest(e){return e.setHeader&&typeof e.abort==="function"}function eos(e,t,r){if(typeof t==="function")return eos(e,null,t);if(!t)t={};r=once(r||noop);var n=t.readable||t.readable!==false&&e.readable;var s=t.writable||t.writable!==false&&e.writable;var o=function onlegacyfinish(){if(!e.writable)l()};var a=e._writableState&&e._writableState.finished;var l=function onfinish(){s=false;a=true;if(!n)r.call(e)};var u=e._readableState&&e._readableState.endEmitted;var c=function onend(){n=false;u=true;if(!s)r.call(e)};var h=function onerror(t){r.call(e,t)};var d=function onclose(){var t;if(n&&!u){if(!e._readableState||!e._readableState.ended)t=new i;return r.call(e,t)}if(s&&!a){if(!e._writableState||!e._writableState.ended)t=new i;return r.call(e,t)}};var p=function onrequest(){e.req.on("finish",l)};if(isRequest(e)){e.on("complete",l);e.on("abort",d);if(e.req)p();else e.on("request",p)}else if(s&&!e._writableState){e.on("end",o);e.on("close",o)}e.on("end",c);e.on("finish",l);if(t.error!==false)e.on("error",h);e.on("close",d);return function(){e.removeListener("complete",l);e.removeListener("abort",d);e.removeListener("request",p);if(e.req)e.req.removeListener("finish",l);e.removeListener("end",o);e.removeListener("close",o);e.removeListener("finish",l);e.removeListener("end",c);e.removeListener("error",h);e.removeListener("close",d)}}e.exports=eos},9082:(e,t,r)=>{"use strict";function asyncGeneratorStep(e,t,r,i,n,s,o){try{var a=e[s](o);var l=a.value}catch(e){r(e);return}if(a.done){t(l)}else{Promise.resolve(l).then(i,n)}}function _asyncToGenerator(e){return function(){var t=this,r=arguments;return new Promise((function(i,n){var s=e.apply(t,r);function _next(e){asyncGeneratorStep(s,i,n,_next,_throw,"next",e)}function _throw(e){asyncGeneratorStep(s,i,n,_next,_throw,"throw",e)}_next(undefined)}))}}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _defineProperty(e,t,r){t=_toPropertyKey(t);if(t in e){Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true})}else{e[t]=r}return e}function _toPropertyKey(e){var t=_toPrimitive(e,"string");return typeof t==="symbol"?t:String(t)}function _toPrimitive(e,t){if(typeof e!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==undefined){var i=r.call(e,t||"default");if(typeof i!=="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var i=r(7214).q.ERR_INVALID_ARG_TYPE;function from(e,t,r){var n;if(t&&typeof t.next==="function"){n=t}else if(t&&t[Symbol.asyncIterator])n=t[Symbol.asyncIterator]();else if(t&&t[Symbol.iterator])n=t[Symbol.iterator]();else throw new i("iterable",["Iterable"],t);var s=new e(_objectSpread({objectMode:true},r));var o=false;s._read=function(){if(!o){o=true;next()}};function next(){return _next2.apply(this,arguments)}function _next2(){_next2=_asyncToGenerator((function*(){try{var e=yield n.next(),t=e.value,r=e.done;if(r){s.push(null)}else if(s.push(yield t)){next()}else{o=false}}catch(e){s.destroy(e)}}));return _next2.apply(this,arguments)}return s}e.exports=from},6989:(e,t,r)=>{"use strict";var i;function once(e){var t=false;return function(){if(t)return;t=true;e.apply(void 0,arguments)}}var n=r(7214).q,s=n.ERR_MISSING_ARGS,o=n.ERR_STREAM_DESTROYED;function noop(e){if(e)throw e}function isRequest(e){return e.setHeader&&typeof e.abort==="function"}function destroyer(e,t,n,s){s=once(s);var a=false;e.on("close",(function(){a=true}));if(i===undefined)i=r(6080);i(e,{readable:t,writable:n},(function(e){if(e)return s(e);a=true;s()}));var l=false;return function(t){if(a)return;if(l)return;l=true;if(isRequest(e))return e.abort();if(typeof e.destroy==="function")return e.destroy();s(t||new o("pipe"))}}function call(e){e()}function pipe(e,t){return e.pipe(t)}function popCallback(e){if(!e.length)return noop;if(typeof e[e.length-1]!=="function")return noop;return e.pop()}function pipeline(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}var i=popCallback(t);if(Array.isArray(t[0]))t=t[0];if(t.length<2){throw new s("streams")}var n;var o=t.map((function(e,r){var s=r<t.length-1;var a=r>0;return destroyer(e,s,a,(function(e){if(!n)n=e;if(e)o.forEach(call);if(s)return;o.forEach(call);i(n)}))}));return t.reduce(pipe)}e.exports=pipeline},9948:(e,t,r)=>{"use strict";var i=r(7214).q.ERR_INVALID_OPT_VALUE;function highWaterMarkFrom(e,t,r){return e.highWaterMark!=null?e.highWaterMark:t?e[r]:null}function getHighWaterMark(e,t,r,n){var s=highWaterMarkFrom(t,n,r);if(s!=null){if(!(isFinite(s)&&Math.floor(s)===s)||s<0){var o=n?r:"highWaterMark";throw new i(o,s)}return Math.floor(s)}return e.objectMode?16:16*1024}e.exports={getHighWaterMark:getHighWaterMark}},2387:(e,t,r)=>{e.exports=r(2781)},1642:(e,t,r)=>{var i=r(2781);if(process.env.READABLE_STREAM==="disable"&&i){e.exports=i.Readable;Object.assign(e.exports,i);e.exports.Stream=i}else{t=e.exports=r(1433);t.Stream=i||t;t.Readable=t;t.Writable=r(6993);t.Duplex=r(1359);t.Transform=r(4415);t.PassThrough=r(1542);t.finished=r(6080);t.pipeline=r(6989)}},6624:(e,t,r)=>{"use strict";const i=r(4404);e.exports=(e={},t=i.connect)=>new Promise(((r,i)=>{let n=false;let s;const callback=async()=>{await o;s.off("timeout",onTimeout);s.off("error",i);if(e.resolveSocket){r({alpnProtocol:s.alpnProtocol,socket:s,timeout:n});if(n){await Promise.resolve();s.emit("timeout")}}else{s.destroy();r({alpnProtocol:s.alpnProtocol,timeout:n})}};const onTimeout=async()=>{n=true;callback()};const o=(async()=>{try{s=await t(e,callback);s.on("error",i);s.once("timeout",onTimeout)}catch(e){i(e)}})()}))},1867:(e,t,r)=>{
18
18
  /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
19
- var i=r(4300);var n=i.Buffer;function copyProps(e,t){for(var r in e){t[r]=e[r]}}if(n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow){e.exports=i}else{copyProps(i,t);t.Buffer=SafeBuffer}function SafeBuffer(e,t,r){return n(e,t,r)}SafeBuffer.prototype=Object.create(n.prototype);copyProps(n,SafeBuffer);SafeBuffer.from=function(e,t,r){if(typeof e==="number"){throw new TypeError("Argument must not be a number")}return n(e,t,r)};SafeBuffer.alloc=function(e,t,r){if(typeof e!=="number"){throw new TypeError("Argument must be a number")}var i=n(e);if(t!==undefined){if(typeof r==="string"){i.fill(t,r)}else{i.fill(t)}}else{i.fill(0)}return i};SafeBuffer.allocUnsafe=function(e){if(typeof e!=="number"){throw new TypeError("Argument must be a number")}return n(e)};SafeBuffer.allocUnsafeSlow=function(e){if(typeof e!=="number"){throw new TypeError("Argument must be a number")}return i.SlowBuffer(e)}},7560:(e,t)=>{"use strict";const{hasOwnProperty:r}=Object.prototype;const i=configure();i.configure=configure;i.stringify=i;i.default=i;t.stringify=i;t.configure=configure;e.exports=i;const n=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?:[^\ud800-\udbff]|^)[\udc00-\udfff]/;function strEscape(e){if(e.length<5e3&&!n.test(e)){return`"${e}"`}return JSON.stringify(e)}function insertSort(e){if(e.length>200){return e.sort()}for(let t=1;t<e.length;t++){const r=e[t];let i=t;while(i!==0&&e[i-1]>r){e[i]=e[i-1];i--}e[i]=r}return e}const s=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function isTypedArrayWithEntries(e){return s.call(e)!==undefined&&e.length!==0}function stringifyTypedArray(e,t,r){if(e.length<r){r=e.length}const i=t===","?"":" ";let n=`"0":${i}${e[0]}`;for(let s=1;s<r;s++){n+=`${t}"${s}":${i}${e[s]}`}return n}function getCircularValueOption(e){if(r.call(e,"circularValue")){const t=e.circularValue;if(typeof t==="string"){return`"${t}"`}if(t==null){return t}if(t===Error||t===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 getBooleanOption(e,t){let i;if(r.call(e,t)){i=e[t];if(typeof i!=="boolean"){throw new TypeError(`The "${t}" argument must be of type boolean`)}}return i===undefined?true:i}function getPositiveIntegerOption(e,t){let i;if(r.call(e,t)){i=e[t];if(typeof i!=="number"){throw new TypeError(`The "${t}" argument must be of type number`)}if(!Number.isInteger(i)){throw new TypeError(`The "${t}" argument must be an integer`)}if(i<1){throw new RangeError(`The "${t}" argument must be >= 1`)}}return i===undefined?Infinity:i}function getItemCount(e){if(e===1){return"1 item"}return`${e} items`}function getUniqueReplacerSet(e){const t=new Set;for(const r of e){if(typeof r==="string"||typeof r==="number"){t.add(String(r))}}return t}function getStrictOption(e){if(r.call(e,"strict")){const t=e.strict;if(typeof t!=="boolean"){throw new TypeError('The "strict" argument must be of type boolean')}if(t){return e=>{let t=`Object can not safely be stringified. Received type ${typeof e}`;if(typeof e!=="function")t+=` (${e.toString()})`;throw new Error(t)}}}}function configure(e){e={...e};const t=getStrictOption(e);if(t){if(e.bigint===undefined){e.bigint=false}if(!("circularValue"in e)){e.circularValue=Error}}const r=getCircularValueOption(e);const i=getBooleanOption(e,"bigint");const n=getBooleanOption(e,"deterministic");const s=getPositiveIntegerOption(e,"maximumDepth");const o=getPositiveIntegerOption(e,"maximumBreadth");function stringifyFnReplacer(e,a,l,u,c,h){let d=a[e];if(typeof d==="object"&&d!==null&&typeof d.toJSON==="function"){d=d.toJSON(e)}d=u.call(a,e,d);switch(typeof d){case"string":return strEscape(d);case"object":{if(d===null){return"null"}if(l.indexOf(d)!==-1){return r}let e="";let t=",";const i=h;if(Array.isArray(d)){if(d.length===0){return"[]"}if(s<l.length+1){return'"[Array]"'}l.push(d);if(c!==""){h+=c;e+=`\n${h}`;t=`,\n${h}`}const r=Math.min(d.length,o);let n=0;for(;n<r-1;n++){const r=stringifyFnReplacer(String(n),d,l,u,c,h);e+=r!==undefined?r:"null";e+=t}const a=stringifyFnReplacer(String(n),d,l,u,c,h);e+=a!==undefined?a:"null";if(d.length-1>o){const r=d.length-o-1;e+=`${t}"... ${getItemCount(r)} not stringified"`}if(c!==""){e+=`\n${i}`}l.pop();return`[${e}]`}let a=Object.keys(d);const p=a.length;if(p===0){return"{}"}if(s<l.length+1){return'"[Object]"'}let m="";let g="";if(c!==""){h+=c;t=`,\n${h}`;m=" "}const y=Math.min(p,o);if(n&&!isTypedArrayWithEntries(d)){a=insertSort(a)}l.push(d);for(let r=0;r<y;r++){const i=a[r];const n=stringifyFnReplacer(i,d,l,u,c,h);if(n!==undefined){e+=`${g}${strEscape(i)}:${m}${n}`;g=t}}if(p>o){const r=p-o;e+=`${g}"...":${m}"${getItemCount(r)} not stringified"`;g=t}if(c!==""&&g.length>1){e=`\n${h}${e}\n${i}`}l.pop();return`{${e}}`}case"number":return isFinite(d)?String(d):t?t(d):"null";case"boolean":return d===true?"true":"false";case"undefined":return undefined;case"bigint":if(i){return String(d)}default:return t?t(d):undefined}}function stringifyArrayReplacer(e,n,a,l,u,c){if(typeof n==="object"&&n!==null&&typeof n.toJSON==="function"){n=n.toJSON(e)}switch(typeof n){case"string":return strEscape(n);case"object":{if(n===null){return"null"}if(a.indexOf(n)!==-1){return r}const e=c;let t="";let i=",";if(Array.isArray(n)){if(n.length===0){return"[]"}if(s<a.length+1){return'"[Array]"'}a.push(n);if(u!==""){c+=u;t+=`\n${c}`;i=`,\n${c}`}const r=Math.min(n.length,o);let h=0;for(;h<r-1;h++){const e=stringifyArrayReplacer(String(h),n[h],a,l,u,c);t+=e!==undefined?e:"null";t+=i}const d=stringifyArrayReplacer(String(h),n[h],a,l,u,c);t+=d!==undefined?d:"null";if(n.length-1>o){const e=n.length-o-1;t+=`${i}"... ${getItemCount(e)} not stringified"`}if(u!==""){t+=`\n${e}`}a.pop();return`[${t}]`}a.push(n);let h="";if(u!==""){c+=u;i=`,\n${c}`;h=" "}let d="";for(const e of l){const r=stringifyArrayReplacer(e,n[e],a,l,u,c);if(r!==undefined){t+=`${d}${strEscape(e)}:${h}${r}`;d=i}}if(u!==""&&d.length>1){t=`\n${c}${t}\n${e}`}a.pop();return`{${t}}`}case"number":return isFinite(n)?String(n):t?t(n):"null";case"boolean":return n===true?"true":"false";case"undefined":return undefined;case"bigint":if(i){return String(n)}default:return t?t(n):undefined}}function stringifyIndent(e,a,l,u,c){switch(typeof a){case"string":return strEscape(a);case"object":{if(a===null){return"null"}if(typeof a.toJSON==="function"){a=a.toJSON(e);if(typeof a!=="object"){return stringifyIndent(e,a,l,u,c)}if(a===null){return"null"}}if(l.indexOf(a)!==-1){return r}const t=c;if(Array.isArray(a)){if(a.length===0){return"[]"}if(s<l.length+1){return'"[Array]"'}l.push(a);c+=u;let e=`\n${c}`;const r=`,\n${c}`;const i=Math.min(a.length,o);let n=0;for(;n<i-1;n++){const t=stringifyIndent(String(n),a[n],l,u,c);e+=t!==undefined?t:"null";e+=r}const h=stringifyIndent(String(n),a[n],l,u,c);e+=h!==undefined?h:"null";if(a.length-1>o){const t=a.length-o-1;e+=`${r}"... ${getItemCount(t)} not stringified"`}e+=`\n${t}`;l.pop();return`[${e}]`}let i=Object.keys(a);const h=i.length;if(h===0){return"{}"}if(s<l.length+1){return'"[Object]"'}c+=u;const d=`,\n${c}`;let p="";let m="";let g=Math.min(h,o);if(isTypedArrayWithEntries(a)){p+=stringifyTypedArray(a,d,o);i=i.slice(a.length);g-=a.length;m=d}if(n){i=insertSort(i)}l.push(a);for(let e=0;e<g;e++){const t=i[e];const r=stringifyIndent(t,a[t],l,u,c);if(r!==undefined){p+=`${m}${strEscape(t)}: ${r}`;m=d}}if(h>o){const e=h-o;p+=`${m}"...": "${getItemCount(e)} not stringified"`;m=d}if(m!==""){p=`\n${c}${p}\n${t}`}l.pop();return`{${p}}`}case"number":return isFinite(a)?String(a):t?t(a):"null";case"boolean":return a===true?"true":"false";case"undefined":return undefined;case"bigint":if(i){return String(a)}default:return t?t(a):undefined}}function stringifySimple(e,a,l){switch(typeof a){case"string":return strEscape(a);case"object":{if(a===null){return"null"}if(typeof a.toJSON==="function"){a=a.toJSON(e);if(typeof a!=="object"){return stringifySimple(e,a,l)}if(a===null){return"null"}}if(l.indexOf(a)!==-1){return r}let t="";if(Array.isArray(a)){if(a.length===0){return"[]"}if(s<l.length+1){return'"[Array]"'}l.push(a);const e=Math.min(a.length,o);let r=0;for(;r<e-1;r++){const e=stringifySimple(String(r),a[r],l);t+=e!==undefined?e:"null";t+=","}const i=stringifySimple(String(r),a[r],l);t+=i!==undefined?i:"null";if(a.length-1>o){const e=a.length-o-1;t+=`,"... ${getItemCount(e)} not stringified"`}l.pop();return`[${t}]`}let i=Object.keys(a);const u=i.length;if(u===0){return"{}"}if(s<l.length+1){return'"[Object]"'}let c="";let h=Math.min(u,o);if(isTypedArrayWithEntries(a)){t+=stringifyTypedArray(a,",",o);i=i.slice(a.length);h-=a.length;c=","}if(n){i=insertSort(i)}l.push(a);for(let e=0;e<h;e++){const r=i[e];const n=stringifySimple(r,a[r],l);if(n!==undefined){t+=`${c}${strEscape(r)}:${n}`;c=","}}if(u>o){const e=u-o;t+=`${c}"...":"${getItemCount(e)} not stringified"`}l.pop();return`{${t}}`}case"number":return isFinite(a)?String(a):t?t(a):"null";case"boolean":return a===true?"true":"false";case"undefined":return undefined;case"bigint":if(i){return String(a)}default:return t?t(a):undefined}}function stringify(e,t,r){if(arguments.length>1){let i="";if(typeof r==="number"){i=" ".repeat(Math.min(r,10))}else if(typeof r==="string"){i=r.slice(0,10)}if(t!=null){if(typeof t==="function"){return stringifyFnReplacer("",{"":e},[],t,i,"")}if(Array.isArray(t)){return stringifyArrayReplacer("",e,[],getUniqueReplacerSet(t),i,"")}}if(i.length!==0){return stringifyIndent("",e,[],i,"")}}return stringifySimple("",e,[])}return stringify}},8679:(e,t,r)=>{"use strict";var i=r(8542);var n=Array.prototype.concat;var s=Array.prototype.slice;var o=e.exports=function swizzle(e){var t=[];for(var r=0,o=e.length;r<o;r++){var a=e[r];if(i(a)){t=n.call(t,s.call(a))}else{t.push(a)}}return t};o.wrap=function(e){return function(){return e(o(arguments))}}},8542:e=>{e.exports=function isArrayish(e){if(!e||typeof e==="string"){return false}return e instanceof Array||Array.isArray(e)||e.length>=0&&(e.splice instanceof Function||Object.getOwnPropertyDescriptor(e,e.length-1)&&e.constructor.name!=="String")}},5315:(e,t)=>{t.get=function(e){var r=Error.stackTraceLimit;Error.stackTraceLimit=Infinity;var i={};var n=Error.prepareStackTrace;Error.prepareStackTrace=function(e,t){return t};Error.captureStackTrace(i,e||t.get);var s=i.stack;Error.prepareStackTrace=n;Error.stackTraceLimit=r;return s};t.parse=function(e){if(!e.stack){return[]}var t=this;var r=e.stack.split("\n").slice(1);return r.map((function(e){if(e.match(/^\s*[-]{4,}$/)){return t._createParsedCallSite({fileName:e,lineNumber:null,functionName:null,typeName:null,methodName:null,columnNumber:null,native:null})}var r=e.match(/at (?:(.+)\s+\()?(?:(.+?):(\d+)(?::(\d+))?|([^)]+))\)?/);if(!r){return}var i=null;var n=null;var s=null;var o=null;var a=null;var l=r[5]==="native";if(r[1]){s=r[1];var u=s.lastIndexOf(".");if(s[u-1]==".")u--;if(u>0){i=s.substr(0,u);n=s.substr(u+1);var c=i.indexOf(".Module");if(c>0){s=s.substr(c+1);i=i.substr(0,c)}}o=null}if(n){o=i;a=n}if(n==="<anonymous>"){a=null;s=null}var h={fileName:r[2]||null,lineNumber:parseInt(r[3],10)||null,functionName:s,typeName:o,methodName:a,columnNumber:parseInt(r[4],10)||null,native:l};return t._createParsedCallSite(h)})).filter((function(e){return!!e}))};function CallSite(e){for(var t in e){this[t]=e[t]}}var r=["this","typeName","functionName","methodName","fileName","lineNumber","columnNumber","function","evalOrigin"];var i=["topLevel","eval","native","constructor"];r.forEach((function(e){CallSite.prototype[e]=null;CallSite.prototype["get"+e[0].toUpperCase()+e.substr(1)]=function(){return this[e]}}));i.forEach((function(e){CallSite.prototype[e]=false;CallSite.prototype["is"+e[0].toUpperCase()+e.substr(1)]=function(){return this[e]}}));t._createParsedCallSite=function(e){return new CallSite(e)}},4841:(e,t,r)=>{"use strict";var i=r(1867).Buffer;var n=i.isEncoding||function(e){e=""+e;switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return true;default:return false}};function _normalizeEncoding(e){if(!e)return"utf8";var t;while(true){switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase();t=true}}}function normalizeEncoding(e){var t=_normalizeEncoding(e);if(typeof t!=="string"&&(i.isEncoding===n||!n(e)))throw new Error("Unknown encoding: "+e);return t||e}t.s=StringDecoder;function StringDecoder(e){this.encoding=normalizeEncoding(e);var t;switch(this.encoding){case"utf16le":this.text=utf16Text;this.end=utf16End;t=4;break;case"utf8":this.fillLast=utf8FillLast;t=4;break;case"base64":this.text=base64Text;this.end=base64End;t=3;break;default:this.write=simpleWrite;this.end=simpleEnd;return}this.lastNeed=0;this.lastTotal=0;this.lastChar=i.allocUnsafe(t)}StringDecoder.prototype.write=function(e){if(e.length===0)return"";var t;var r;if(this.lastNeed){t=this.fillLast(e);if(t===undefined)return"";r=this.lastNeed;this.lastNeed=0}else{r=0}if(r<e.length)return t?t+this.text(e,r):this.text(e,r);return t||""};StringDecoder.prototype.end=utf8End;StringDecoder.prototype.text=utf8Text;StringDecoder.prototype.fillLast=function(e){if(this.lastNeed<=e.length){e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed);return this.lastChar.toString(this.encoding,0,this.lastTotal)}e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length);this.lastNeed-=e.length};function utf8CheckByte(e){if(e<=127)return 0;else if(e>>5===6)return 2;else if(e>>4===14)return 3;else if(e>>3===30)return 4;return e>>6===2?-1:-2}function utf8CheckIncomplete(e,t,r){var i=t.length-1;if(i<r)return 0;var n=utf8CheckByte(t[i]);if(n>=0){if(n>0)e.lastNeed=n-1;return n}if(--i<r||n===-2)return 0;n=utf8CheckByte(t[i]);if(n>=0){if(n>0)e.lastNeed=n-2;return n}if(--i<r||n===-2)return 0;n=utf8CheckByte(t[i]);if(n>=0){if(n>0){if(n===2)n=0;else e.lastNeed=n-3}return n}return 0}function utf8CheckExtraBytes(e,t,r){if((t[0]&192)!==128){e.lastNeed=0;return"�"}if(e.lastNeed>1&&t.length>1){if((t[1]&192)!==128){e.lastNeed=1;return"�"}if(e.lastNeed>2&&t.length>2){if((t[2]&192)!==128){e.lastNeed=2;return"�"}}}}function utf8FillLast(e){var t=this.lastTotal-this.lastNeed;var r=utf8CheckExtraBytes(this,e,t);if(r!==undefined)return r;if(this.lastNeed<=e.length){e.copy(this.lastChar,t,0,this.lastNeed);return this.lastChar.toString(this.encoding,0,this.lastTotal)}e.copy(this.lastChar,t,0,e.length);this.lastNeed-=e.length}function utf8Text(e,t){var r=utf8CheckIncomplete(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var i=e.length-(r-this.lastNeed);e.copy(this.lastChar,0,i);return e.toString("utf8",t,i)}function utf8End(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed)return t+"�";return t}function utf16Text(e,t){if((e.length-t)%2===0){var r=e.toString("utf16le",t);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319){this.lastNeed=2;this.lastTotal=4;this.lastChar[0]=e[e.length-2];this.lastChar[1]=e[e.length-1];return r.slice(0,-1)}}return r}this.lastNeed=1;this.lastTotal=2;this.lastChar[0]=e[e.length-1];return e.toString("utf16le",t,e.length-1)}function utf16End(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function base64Text(e,t){var r=(e.length-t)%3;if(r===0)return e.toString("base64",t);this.lastNeed=3-r;this.lastTotal=3;if(r===1){this.lastChar[0]=e[e.length-1]}else{this.lastChar[0]=e[e.length-2];this.lastChar[1]=e[e.length-1]}return e.toString("base64",t,e.length-r)}function base64End(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed)return t+this.lastChar.toString("base64",0,3-this.lastNeed);return t}function simpleWrite(e){return e.toString(this.encoding)}function simpleEnd(e){return e&&e.length?this.write(e):""}},9318:(e,t,r)=>{"use strict";const i=r(2037);const n=r(6224);const s=r(1621);const{env:o}=process;let a;if(s("no-color")||s("no-colors")||s("color=false")||s("color=never")){a=0}else if(s("color")||s("colors")||s("color=true")||s("color=always")){a=1}if("FORCE_COLOR"in o){if(o.FORCE_COLOR==="true"){a=1}else if(o.FORCE_COLOR==="false"){a=0}else{a=o.FORCE_COLOR.length===0?1:Math.min(parseInt(o.FORCE_COLOR,10),3)}}function translateLevel(e){if(e===0){return false}return{level:e,hasBasic:true,has256:e>=2,has16m:e>=3}}function supportsColor(e,t){if(a===0){return 0}if(s("color=16m")||s("color=full")||s("color=truecolor")){return 3}if(s("color=256")){return 2}if(e&&!t&&a===undefined){return 0}const r=a||0;if(o.TERM==="dumb"){return r}if(process.platform==="win32"){const e=i.release().split(".");if(Number(e[0])>=10&&Number(e[2])>=10586){return Number(e[2])>=14931?3:2}return 1}if("CI"in o){if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some((e=>e in o))||o.CI_NAME==="codeship"){return 1}return r}if("TEAMCITY_VERSION"in o){return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(o.TEAMCITY_VERSION)?1:0}if(o.COLORTERM==="truecolor"){return 3}if("TERM_PROGRAM"in o){const e=parseInt((o.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(o.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(o.TERM)){return 2}if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(o.TERM)){return 1}if("COLORTERM"in o){return 1}return r}function getSupportLevel(e){const t=supportsColor(e,e&&e.isTTY);return translateLevel(t)}e.exports={supportsColor:getSupportLevel,stdout:translateLevel(supportsColor(true,n.isatty(1))),stderr:translateLevel(supportsColor(true,n.isatty(2)))}},7014:e=>{"use strict";e.exports=function hex(e){for(var t=0,r=0;t<e.length;r=e.charCodeAt(t++)+((r<<5)-r));var i=Math.floor(Math.abs(Math.sin(r)*1e4%1*16777216)).toString(16);return"#"+Array(6-i.length+1).join("0")+i}},1416:(e,t)=>{"use strict";t.levels={error:0,warn:1,help:2,data:3,info:4,debug:5,prompt:6,verbose:7,input:8,silly:9};t.colors={error:"red",warn:"yellow",help:"cyan",data:"grey",info:"green",debug:"blue",prompt:"grey",verbose:"cyan",input:"grey",silly:"magenta"}},7113:(e,t,r)=>{"use strict";Object.defineProperty(t,"cli",{value:r(1416)});Object.defineProperty(t,"npm",{value:r(3568)});Object.defineProperty(t,"syslog",{value:r(6990)})},3568:(e,t)=>{"use strict";t.levels={error:0,warn:1,info:2,http:3,verbose:4,debug:5,silly:6};t.colors={error:"red",warn:"yellow",info:"green",http:"green",verbose:"cyan",debug:"blue",silly:"magenta"}},6990:(e,t)=>{"use strict";t.levels={emerg:0,alert:1,crit:2,error:3,warning:4,notice:5,info:6,debug:7};t.colors={emerg:"red",alert:"yellow",crit:"red",error:"red",warning:"red",notice:"yellow",info:"green",debug:"blue"}},3937:(e,t,r)=>{"use strict";Object.defineProperty(t,"LEVEL",{value:Symbol.for("level")});Object.defineProperty(t,"MESSAGE",{value:Symbol.for("message")});Object.defineProperty(t,"SPLAT",{value:Symbol.for("splat")});Object.defineProperty(t,"configs",{value:r(7113)})},5278:(e,t,r)=>{e.exports=r(3837).deprecate},7281:(e,t,r)=>{"use strict";const i=r(3837);const n=r(6993);const{LEVEL:s}=r(3937);const o=e.exports=function TransportStream(e={}){n.call(this,{objectMode:true,highWaterMark:e.highWaterMark});this.format=e.format;this.level=e.level;this.handleExceptions=e.handleExceptions;this.handleRejections=e.handleRejections;this.silent=e.silent;if(e.log)this.log=e.log;if(e.logv)this.logv=e.logv;if(e.close)this.close=e.close;this.once("pipe",(e=>{this.levels=e.levels;this.parent=e}));this.once("unpipe",(e=>{if(e===this.parent){this.parent=null;if(this.close){this.close()}}}))};i.inherits(o,n);o.prototype._write=function _write(e,t,r){if(this.silent||e.exception===true&&!this.handleExceptions){return r(null)}const i=this.level||this.parent&&this.parent.level;if(!i||this.levels[i]>=this.levels[e[s]]){if(e&&!this.format){return this.log(e,r)}let t;let i;try{i=this.format.transform(Object.assign({},e),this.format.options)}catch(e){t=e}if(t||!i){r();if(t)throw t;return}return this.log(i,r)}this._writableState.sync=false;return r(null)};o.prototype._writev=function _writev(e,t){if(this.logv){const r=e.filter(this._accept,this);if(!r.length){return t(null)}return this.logv(r,t)}for(let r=0;r<e.length;r++){if(!this._accept(e[r]))continue;if(e[r].chunk&&!this.format){this.log(e[r].chunk,e[r].callback);continue}let i;let n;try{n=this.format.transform(Object.assign({},e[r].chunk),this.format.options)}catch(e){i=e}if(i||!n){e[r].callback();if(i){t(null);throw i}}else{this.log(n,e[r].callback)}}return t(null)};o.prototype._accept=function _accept(e){const t=e.chunk;if(this.silent){return false}const r=this.level||this.parent&&this.parent.level;if(t.exception===true||!r||this.levels[r]>=this.levels[t[s]]){if(this.handleExceptions||t.exception!==true){return true}}return false};o.prototype._nop=function _nop(){return void undefined};e.exports.LegacyTransportStream=r(6201)},6201:(e,t,r)=>{"use strict";const i=r(3837);const{LEVEL:n}=r(3937);const s=r(7281);const o=e.exports=function LegacyTransportStream(e={}){s.call(this,e);if(!e.transport||typeof e.transport.log!=="function"){throw new Error("Invalid transport, must be an object with a log method.")}this.transport=e.transport;this.level=this.level||e.transport.level;this.handleExceptions=this.handleExceptions||e.transport.handleExceptions;this._deprecated();function transportError(e){this.emit("error",e,this.transport)}if(!this.transport.__winstonError){this.transport.__winstonError=transportError.bind(this);this.transport.on("error",this.transport.__winstonError)}};i.inherits(o,s);o.prototype._write=function _write(e,t,r){if(this.silent||e.exception===true&&!this.handleExceptions){return r(null)}if(!this.level||this.levels[this.level]>=this.levels[e[n]]){this.transport.log(e[n],e.message,e,this._nop)}r(null)};o.prototype._writev=function _writev(e,t){for(let t=0;t<e.length;t++){if(this._accept(e[t])){this.transport.log(e[t].chunk[n],e[t].chunk.message,e[t].chunk,this._nop);e[t].callback()}}return t(null)};o.prototype._deprecated=function _deprecated(){console.error([`${this.transport.name} is a legacy winston transport. Consider upgrading: `,"- Upgrade docs: https://github.com/winstonjs/winston/blob/master/UPGRADE-3.0.md"].join("\n"))};o.prototype.close=function close(){if(this.transport.close){this.transport.close()}if(this.transport.__winstonError){this.transport.removeListener("error",this.transport.__winstonError);this.transport.__winstonError=null}}},4158:(e,t,r)=>{"use strict";const i=r(2955);const{warn:n}=r(8043);t.version=r(2561).version;t.transports=r(7804);t.config=r(4325);t.addColors=i.levels;t.format=i.format;t.createLogger=r(2878);t.Logger=r(5234);t.ExceptionHandler=r(7891);t.RejectionHandler=r(1080);t.Container=r(7184);t.Transport=r(7281);t.loggers=new t.Container;const s=t.createLogger();Object.keys(t.config.npm.levels).concat(["log","query","stream","add","remove","clear","profile","startTimer","handleExceptions","unhandleExceptions","handleRejections","unhandleRejections","configure","child"]).forEach((e=>t[e]=(...t)=>s[e](...t)));Object.defineProperty(t,"level",{get(){return s.level},set(e){s.level=e}});Object.defineProperty(t,"exceptions",{get(){return s.exceptions}});["exitOnError"].forEach((e=>{Object.defineProperty(t,e,{get(){return s[e]},set(t){s[e]=t}})}));Object.defineProperty(t,"default",{get(){return{exceptionHandlers:s.exceptionHandlers,rejectionHandlers:s.rejectionHandlers,transports:s.transports}}});n.deprecated(t,"setLevels");n.forFunctions(t,"useFormat",["cli"]);n.forProperties(t,"useFormat",["padLevels","stripColors"]);n.forFunctions(t,"deprecated",["addRewriter","addFilter","clone","extend"]);n.forProperties(t,"deprecated",["emitErrs","levelLength"])},8043:(e,t,r)=>{"use strict";const{format:i}=r(3837);t.warn={deprecated(e){return()=>{throw new Error(i("{ %s } was removed in winston@3.0.0.",e))}},useFormat(e){return()=>{throw new Error([i("{ %s } was removed in winston@3.0.0.",e),"Use a custom winston.format = winston.format(function) instead."].join("\n"))}},forFunctions(e,r,i){i.forEach((i=>{e[i]=t.warn[r](i)}))},forProperties(e,r,i){i.forEach((i=>{const n=t.warn[r](i);Object.defineProperty(e,i,{get:n,set:n})}))}}},4325:(e,t,r)=>{"use strict";const i=r(2955);const{configs:n}=r(3937);t.cli=i.levels(n.cli);t.npm=i.levels(n.npm);t.syslog=i.levels(n.syslog);t.addColors=i.levels},7184:(e,t,r)=>{"use strict";const i=r(2878);e.exports=class Container{constructor(e={}){this.loggers=new Map;this.options=e}add(e,t){if(!this.loggers.has(e)){t=Object.assign({},t||this.options);const r=t.transports||this.options.transports;if(r){t.transports=Array.isArray(r)?r.slice():[r]}else{t.transports=[]}const n=i(t);n.on("close",(()=>this._delete(e)));this.loggers.set(e,n)}return this.loggers.get(e)}get(e,t){return this.add(e,t)}has(e){return!!this.loggers.has(e)}close(e){if(e){return this._removeLogger(e)}this.loggers.forEach(((e,t)=>this._removeLogger(t)))}_removeLogger(e){if(!this.loggers.has(e)){return}const t=this.loggers.get(e);t.close();this._delete(e)}_delete(e){this.loggers.delete(e)}}},2878:(e,t,r)=>{"use strict";const{LEVEL:i}=r(3937);const n=r(4325);const s=r(5234);const o=r(3170)("winston:create-logger");function isLevelEnabledFunctionName(e){return"is"+e.charAt(0).toUpperCase()+e.slice(1)+"Enabled"}e.exports=function(e={}){e.levels=e.levels||n.npm.levels;class DerivedLogger extends s{constructor(e){super(e)}}const t=new DerivedLogger(e);Object.keys(e.levels).forEach((function(e){o('Define prototype method for "%s"',e);if(e==="log"){console.warn('Level "log" not defined: conflicts with the method "log". Use a different level name.');return}DerivedLogger.prototype[e]=function(...r){const n=this||t;if(r.length===1){const[s]=r;const o=s&&s.message&&s||{message:s};o.level=o[i]=e;n._addDefaultMeta(o);n.write(o);return this||t}if(r.length===0){n.log(e,"");return n}return n.log(e,...r)};DerivedLogger.prototype[isLevelEnabledFunctionName(e)]=function(){return(this||t).isLevelEnabled(e)}}));return t}},7891:(e,t,r)=>{"use strict";const i=r(2037);const n=r(1216);const s=r(3170)("winston:exception");const o=r(4118);const a=r(5315);const l=r(6268);e.exports=class ExceptionHandler{constructor(e){if(!e){throw new Error("Logger is required to handle exceptions")}this.logger=e;this.handlers=new Map}handle(...e){e.forEach((e=>{if(Array.isArray(e)){return e.forEach((e=>this._addHandler(e)))}this._addHandler(e)}));if(!this.catcher){this.catcher=this._uncaughtException.bind(this);process.on("uncaughtException",this.catcher)}}unhandle(){if(this.catcher){process.removeListener("uncaughtException",this.catcher);this.catcher=false;Array.from(this.handlers.values()).forEach((e=>this.logger.unpipe(e)))}}getAllInfo(e){let t=null;if(e){t=typeof e==="string"?e:e.message}return{error:e,level:"error",message:[`uncaughtException: ${t||"(no error message)"}`,e&&e.stack||" No stack trace"].join("\n"),stack:e&&e.stack,exception:true,date:(new Date).toString(),process:this.getProcessInfo(),os:this.getOsInfo(),trace:this.getTrace(e)}}getProcessInfo(){return{pid:process.pid,uid:process.getuid?process.getuid():null,gid:process.getgid?process.getgid():null,cwd:process.cwd(),execPath:process.execPath,version:process.version,argv:process.argv,memoryUsage:process.memoryUsage()}}getOsInfo(){return{loadavg:i.loadavg(),uptime:i.uptime()}}getTrace(e){const t=e?a.parse(e):a.get();return t.map((e=>({column:e.getColumnNumber(),file:e.getFileName(),function:e.getFunctionName(),line:e.getLineNumber(),method:e.getMethodName(),native:e.isNative()})))}_addHandler(e){if(!this.handlers.has(e)){e.handleExceptions=true;const t=new l(e);this.handlers.set(e,t);this.logger.pipe(t)}}_uncaughtException(e){const t=this.getAllInfo(e);const r=this._getExceptionHandlers();let i=typeof this.logger.exitOnError==="function"?this.logger.exitOnError(e):this.logger.exitOnError;let a;if(!r.length&&i){console.warn("winston: exitOnError cannot be true with no exception handlers.");console.warn("winston: not exiting process.");i=false}function gracefulExit(){s("doExit",i);s("process._exiting",process._exiting);if(i&&!process._exiting){if(a){clearTimeout(a)}process.exit(1)}}if(!r||r.length===0){return process.nextTick(gracefulExit)}n(r,((e,t)=>{const r=o(t);const i=e.transport||e;function onDone(e){return()=>{s(e);r()}}i._ending=true;i.once("finish",onDone("finished"));i.once("error",onDone("error"))}),(()=>i&&gracefulExit()));this.logger.log(t);if(i){a=setTimeout(gracefulExit,3e3)}}_getExceptionHandlers(){return this.logger.transports.filter((e=>{const t=e.transport||e;return t.handleExceptions}))}}},6268:(e,t,r)=>{"use strict";const{Writable:i}=r(1642);e.exports=class ExceptionStream extends i{constructor(e){super({objectMode:true});if(!e){throw new Error("ExceptionStream requires a TransportStream instance.")}this.handleExceptions=true;this.transport=e}_write(e,t,r){if(e.exception){return this.transport.log(e,r)}r();return true}}},5234:(e,t,r)=>{"use strict";const{Stream:i,Transform:n}=r(1642);const s=r(1216);const{LEVEL:o,SPLAT:a}=r(3937);const l=r(1554);const u=r(7891);const c=r(1080);const h=r(6201);const d=r(6959);const{warn:p}=r(8043);const m=r(4325);const g=/%[scdjifoO%]/g;class Logger extends n{constructor(e){super({objectMode:true});this.configure(e)}child(e){const t=this;return Object.create(t,{write:{value:function(r){const i=Object.assign({},e,r);if(r instanceof Error){i.stack=r.stack;i.message=r.message}t.write(i)}}})}configure({silent:e,format:t,defaultMeta:i,levels:n,level:s="info",exitOnError:o=true,transports:a,colors:l,emitErrs:h,formatters:d,padLevels:p,rewriters:g,stripColors:y,exceptionHandlers:_,rejectionHandlers:v}={}){if(this.transports.length){this.clear()}this.silent=e;this.format=t||this.format||r(5669)();this.defaultMeta=i||null;this.levels=n||this.levels||m.npm.levels;this.level=s;if(this.exceptions){this.exceptions.unhandle()}if(this.rejections){this.rejections.unhandle()}this.exceptions=new u(this);this.rejections=new c(this);this.profilers={};this.exitOnError=o;if(a){a=Array.isArray(a)?a:[a];a.forEach((e=>this.add(e)))}if(l||h||d||p||g||y){throw new Error(["{ colors, emitErrs, formatters, padLevels, rewriters, stripColors } were removed in winston@3.0.0.","Use a custom winston.format(function) instead.","See: https://github.com/winstonjs/winston/tree/master/UPGRADE-3.0.md"].join("\n"))}if(_){this.exceptions.handle(_)}if(v){this.rejections.handle(v)}}isLevelEnabled(e){const t=getLevelValue(this.levels,e);if(t===null){return false}const r=getLevelValue(this.levels,this.level);if(r===null){return false}if(!this.transports||this.transports.length===0){return r>=t}const i=this.transports.findIndex((e=>{let i=getLevelValue(this.levels,e.level);if(i===null){i=r}return i>=t}));return i!==-1}log(e,t,...r){if(arguments.length===1){e[o]=e.level;this._addDefaultMeta(e);this.write(e);return this}if(arguments.length===2){if(t&&typeof t==="object"){t[o]=t.level=e;this._addDefaultMeta(t);this.write(t);return this}t={[o]:e,level:e,message:t};this._addDefaultMeta(t);this.write(t);return this}const[i]=r;if(typeof i==="object"&&i!==null){const n=t&&t.match&&t.match(g);if(!n){const n=Object.assign({},this.defaultMeta,i,{[o]:e,[a]:r,level:e,message:t});if(i.message)n.message=`${n.message} ${i.message}`;if(i.stack)n.stack=i.stack;this.write(n);return this}}this.write(Object.assign({},this.defaultMeta,{[o]:e,[a]:r,level:e,message:t}));return this}_transform(e,t,r){if(this.silent){return r()}if(!e[o]){e[o]=e.level}if(!this.levels[e[o]]&&this.levels[e[o]]!==0){console.error("[winston] Unknown logger level: %s",e[o])}if(!this._readableState.pipes){console.error("[winston] Attempt to write logs with no transports, which can increase memory usage: %j",e)}try{this.push(this.format.transform(e,this.format.options))}finally{this._writableState.sync=false;r()}}_final(e){const t=this.transports.slice();s(t,((e,t)=>{if(!e||e.finished)return setImmediate(t);e.once("finish",t);e.end()}),e)}add(e){const t=!l(e)||e.log.length>2?new h({transport:e}):e;if(!t._writableState||!t._writableState.objectMode){throw new Error("Transports must WritableStreams in objectMode. Set { objectMode: true }.")}this._onEvent("error",t);this._onEvent("warn",t);this.pipe(t);if(e.handleExceptions){this.exceptions.handle()}if(e.handleRejections){this.rejections.handle()}return this}remove(e){if(!e)return this;let t=e;if(!l(e)||e.log.length>2){t=this.transports.filter((t=>t.transport===e))[0]}if(t){this.unpipe(t)}return this}clear(){this.unpipe();return this}close(){this.exceptions.unhandle();this.rejections.unhandle();this.clear();this.emit("close");return this}setLevels(){p.deprecated("setLevels")}query(e,t){if(typeof e==="function"){t=e;e={}}e=e||{};const r={};const i=Object.assign({},e.query||{});function queryTransport(t,r){if(e.query&&typeof t.formatQuery==="function"){e.query=t.formatQuery(i)}t.query(e,((i,n)=>{if(i){return r(i)}if(typeof t.formatResults==="function"){n=t.formatResults(n,e.format)}r(null,n)}))}function addResults(e,t){queryTransport(e,((i,n)=>{if(t){n=i||n;if(n){r[e.name]=n}t()}t=null}))}s(this.transports.filter((e=>!!e.query)),addResults,(()=>t(null,r)))}stream(e={}){const t=new i;const r=[];t._streams=r;t.destroy=()=>{let e=r.length;while(e--){r[e].destroy()}};this.transports.filter((e=>!!e.stream)).forEach((i=>{const n=i.stream(e);if(!n){return}r.push(n);n.on("log",(e=>{e.transport=e.transport||[];e.transport.push(i.name);t.emit("log",e)}));n.on("error",(e=>{e.transport=e.transport||[];e.transport.push(i.name);t.emit("error",e)}))}));return t}startTimer(){return new d(this)}profile(e,...t){const r=Date.now();if(this.profilers[e]){const i=this.profilers[e];delete this.profilers[e];if(typeof t[t.length-2]==="function"){console.warn("Callback function no longer supported as of winston@3.0.0");t.pop()}const n=typeof t[t.length-1]==="object"?t.pop():{};n.level=n.level||"info";n.durationMs=r-i;n.message=n.message||e;return this.write(n)}this.profilers[e]=r;return this}handleExceptions(...e){console.warn("Deprecated: .handleExceptions() will be removed in winston@4. Use .exceptions.handle()");this.exceptions.handle(...e)}unhandleExceptions(...e){console.warn("Deprecated: .unhandleExceptions() will be removed in winston@4. Use .exceptions.unhandle()");this.exceptions.unhandle(...e)}cli(){throw new Error(["Logger.cli() was removed in winston@3.0.0","Use a custom winston.formats.cli() instead.","See: https://github.com/winstonjs/winston/tree/master/UPGRADE-3.0.md"].join("\n"))}_onEvent(e,t){function transportEvent(r){if(e==="error"&&!this.transports.includes(t)){this.add(t)}this.emit(e,r,t)}if(!t["__winston"+e]){t["__winston"+e]=transportEvent.bind(this);t.on(e,t["__winston"+e])}}_addDefaultMeta(e){if(this.defaultMeta){Object.assign(e,this.defaultMeta)}}}function getLevelValue(e,t){const r=e[t];if(!r&&r!==0){return null}return r}Object.defineProperty(Logger.prototype,"transports",{configurable:false,enumerable:true,get(){const{pipes:e}=this._readableState;return!Array.isArray(e)?[e].filter(Boolean):e}});e.exports=Logger},6959:e=>{"use strict";e.exports=class Profiler{constructor(e){if(!e){throw new Error("Logger is required for profiling.")}this.logger=e;this.start=Date.now()}done(...e){if(typeof e[e.length-1]==="function"){console.warn("Callback function no longer supported as of winston@3.0.0");e.pop()}const t=typeof e[e.length-1]==="object"?e.pop():{};t.level=t.level||"info";t.durationMs=Date.now()-this.start;return this.logger.write(t)}}},1080:(e,t,r)=>{"use strict";const i=r(2037);const n=r(1216);const s=r(3170)("winston:rejection");const o=r(4118);const a=r(5315);const l=r(6268);e.exports=class RejectionHandler{constructor(e){if(!e){throw new Error("Logger is required to handle rejections")}this.logger=e;this.handlers=new Map}handle(...e){e.forEach((e=>{if(Array.isArray(e)){return e.forEach((e=>this._addHandler(e)))}this._addHandler(e)}));if(!this.catcher){this.catcher=this._unhandledRejection.bind(this);process.on("unhandledRejection",this.catcher)}}unhandle(){if(this.catcher){process.removeListener("unhandledRejection",this.catcher);this.catcher=false;Array.from(this.handlers.values()).forEach((e=>this.logger.unpipe(e)))}}getAllInfo(e){let t=null;if(e){t=typeof e==="string"?e:e.message}return{error:e,level:"error",message:[`unhandledRejection: ${t||"(no error message)"}`,e&&e.stack||" No stack trace"].join("\n"),stack:e&&e.stack,exception:true,date:(new Date).toString(),process:this.getProcessInfo(),os:this.getOsInfo(),trace:this.getTrace(e)}}getProcessInfo(){return{pid:process.pid,uid:process.getuid?process.getuid():null,gid:process.getgid?process.getgid():null,cwd:process.cwd(),execPath:process.execPath,version:process.version,argv:process.argv,memoryUsage:process.memoryUsage()}}getOsInfo(){return{loadavg:i.loadavg(),uptime:i.uptime()}}getTrace(e){const t=e?a.parse(e):a.get();return t.map((e=>({column:e.getColumnNumber(),file:e.getFileName(),function:e.getFunctionName(),line:e.getLineNumber(),method:e.getMethodName(),native:e.isNative()})))}_addHandler(e){if(!this.handlers.has(e)){e.handleRejections=true;const t=new l(e);this.handlers.set(e,t);this.logger.pipe(t)}}_unhandledRejection(e){const t=this.getAllInfo(e);const r=this._getRejectionHandlers();let i=typeof this.logger.exitOnError==="function"?this.logger.exitOnError(e):this.logger.exitOnError;let a;if(!r.length&&i){console.warn("winston: exitOnError cannot be true with no rejection handlers.");console.warn("winston: not exiting process.");i=false}function gracefulExit(){s("doExit",i);s("process._exiting",process._exiting);if(i&&!process._exiting){if(a){clearTimeout(a)}process.exit(1)}}if(!r||r.length===0){return process.nextTick(gracefulExit)}n(r,((e,t)=>{const r=o(t);const i=e.transport||e;function onDone(e){return()=>{s(e);r()}}i._ending=true;i.once("finish",onDone("finished"));i.once("error",onDone("error"))}),(()=>i&&gracefulExit()));this.logger.log(t);if(i){a=setTimeout(gracefulExit,3e3)}}_getRejectionHandlers(){return this.logger.transports.filter((e=>{const t=e.transport||e;return t.handleRejections}))}}},1965:(e,t,r)=>{"use strict";const i=r(7147);const{StringDecoder:n}=r(1576);const{Stream:s}=r(1642);function noop(){}e.exports=(e,t)=>{const r=Buffer.alloc(64*1024);const o=new n("utf8");const a=new s;let l="";let u=0;let c=0;if(e.start===-1){delete e.start}a.readable=true;a.destroy=()=>{a.destroyed=true;a.emit("end");a.emit("close")};i.open(e.file,"a+","0644",((n,s)=>{if(n){if(!t){a.emit("error",n)}else{t(n)}a.destroy();return}(function read(){if(a.destroyed){i.close(s,noop);return}return i.read(s,r,0,r.length,u,((i,n)=>{if(i){if(!t){a.emit("error",i)}else{t(i)}a.destroy();return}if(!n){if(l){if(e.start==null||c>e.start){if(!t){a.emit("line",l)}else{t(null,l)}}c++;l=""}return setTimeout(read,1e3)}let s=o.write(r.slice(0,n));if(!t){a.emit("data",s)}s=(l+s).split(/\n+/);const h=s.length-1;let d=0;for(;d<h;d++){if(e.start==null||c>e.start){if(!t){a.emit("line",s[d])}else{t(null,s[d])}}c++}l=s[h];u+=n;return read()}))})()}));if(!t){return a}return a.destroy}},7501:(e,t,r)=>{"use strict";const i=r(2037);const{LEVEL:n,MESSAGE:s}=r(3937);const o=r(7281);e.exports=class Console extends o{constructor(e={}){super(e);this.name=e.name||"console";this.stderrLevels=this._stringArrayToSet(e.stderrLevels);this.consoleWarnLevels=this._stringArrayToSet(e.consoleWarnLevels);this.eol=typeof e.eol==="string"?e.eol:i.EOL;this.setMaxListeners(30)}log(e,t){setImmediate((()=>this.emit("logged",e)));if(this.stderrLevels[e[n]]){if(console._stderr){console._stderr.write(`${e[s]}${this.eol}`)}else{console.error(e[s])}if(t){t()}return}else if(this.consoleWarnLevels[e[n]]){if(console._stderr){console._stderr.write(`${e[s]}${this.eol}`)}else{console.warn(e[s])}if(t){t()}return}if(console._stdout){console._stdout.write(`${e[s]}${this.eol}`)}else{console.log(e[s])}if(t){t()}}_stringArrayToSet(e,t){if(!e)return{};t=t||"Cannot make set from type other than Array of string elements";if(!Array.isArray(e)){throw new Error(t)}return e.reduce(((e,r)=>{if(typeof r!=="string"){throw new Error(t)}e[r]=true;return e}),{})}}},2478:(e,t,r)=>{"use strict";const i=r(7147);const n=r(1017);const s=r(9619);const o=r(9796);const{MESSAGE:a}=r(3937);const{Stream:l,PassThrough:u}=r(1642);const c=r(7281);const h=r(3170)("winston:file");const d=r(2037);const p=r(1965);e.exports=class File extends c{constructor(e={}){super(e);this.name=e.name||"file";function throwIf(t,...r){r.slice(1).forEach((r=>{if(e[r]){throw new Error(`Cannot set ${r} and ${t} together`)}}))}this._stream=new u;this._stream.setMaxListeners(30);this._onError=this._onError.bind(this);if(e.filename||e.dirname){throwIf("filename or dirname","stream");this._basename=this.filename=e.filename?n.basename(e.filename):"winston.log";this.dirname=e.dirname||n.dirname(e.filename);this.options=e.options||{flags:"a"}}else if(e.stream){console.warn("options.stream will be removed in winston@4. Use winston.transports.Stream");throwIf("stream","filename","maxsize");this._dest=this._stream.pipe(this._setupStream(e.stream));this.dirname=n.dirname(this._dest.path)}else{throw new Error("Cannot log to file without filename or stream.")}this.maxsize=e.maxsize||null;this.rotationFormat=e.rotationFormat||false;this.zippedArchive=e.zippedArchive||false;this.maxFiles=e.maxFiles||null;this.eol=typeof e.eol==="string"?e.eol:d.EOL;this.tailable=e.tailable||false;this.lazy=e.lazy||false;this._size=0;this._pendingSize=0;this._created=0;this._drain=false;this._opening=false;this._ending=false;this._fileExist=false;if(this.dirname)this._createLogDirIfNotExist(this.dirname);if(!this.lazy)this.open()}finishIfEnding(){if(this._ending){if(this._opening){this.once("open",(()=>{this._stream.once("finish",(()=>this.emit("finish")));setImmediate((()=>this._stream.end()))}))}else{this._stream.once("finish",(()=>this.emit("finish")));setImmediate((()=>this._stream.end()))}}}log(e,t=(()=>{})){if(this.silent){t();return true}if(this._drain){this._stream.once("drain",(()=>{this._drain=false;this.log(e,t)}));return}if(this._rotate){this._stream.once("rotate",(()=>{this._rotate=false;this.log(e,t)}));return}if(this.lazy){if(!this._fileExist){if(!this._opening){this.open()}this.once("open",(()=>{this._fileExist=true;this.log(e,t);return}));return}if(this._needsNewFile(this._pendingSize)){this._dest.once("close",(()=>{if(!this._opening){this.open()}this.once("open",(()=>{this.log(e,t);return}));return}));return}}const r=`${e[a]}${this.eol}`;const i=Buffer.byteLength(r);function logged(){this._size+=i;this._pendingSize-=i;h("logged %s %s",this._size,r);this.emit("logged",e);if(this._rotate){return}if(this._opening){return}if(!this._needsNewFile()){return}if(this.lazy){this._endStream((()=>{this.emit("fileclosed")}));return}this._rotate=true;this._endStream((()=>this._rotateFile()))}this._pendingSize+=i;if(this._opening&&!this.rotatedWhileOpening&&this._needsNewFile(this._size+this._pendingSize)){this.rotatedWhileOpening=true}const n=this._stream.write(r,logged.bind(this));if(!n){this._drain=true;this._stream.once("drain",(()=>{this._drain=false;t()}))}else{t()}h("written",n,this._drain);this.finishIfEnding();return n}query(e,t){if(typeof e==="function"){t=e;e={}}e=normalizeQuery(e);const r=n.join(this.dirname,this.filename);let s="";let o=[];let a=0;const l=i.createReadStream(r,{encoding:"utf8"});l.on("error",(e=>{if(l.readable){l.destroy()}if(!t){return}return e.code!=="ENOENT"?t(e):t(null,o)}));l.on("data",(t=>{t=(s+t).split(/\n+/);const r=t.length-1;let i=0;for(;i<r;i++){if(!e.start||a>=e.start){add(t[i])}a++}s=t[r]}));l.on("close",(()=>{if(s){add(s,true)}if(e.order==="desc"){o=o.reverse()}if(t)t(null,o)}));function add(e,t){try{const t=JSON.parse(e);if(check(t)){push(t)}}catch(e){if(!t){l.emit("error",e)}}}function push(t){if(e.rows&&o.length>=e.rows&&e.order!=="desc"){if(l.readable){l.destroy()}return}if(e.fields){t=e.fields.reduce(((e,r)=>{e[r]=t[r];return e}),{})}if(e.order==="desc"){if(o.length>=e.rows){o.shift()}}o.push(t)}function check(t){if(!t){return}if(typeof t!=="object"){return}const r=new Date(t.timestamp);if(e.from&&r<e.from||e.until&&r>e.until||e.level&&e.level!==t.level){return}return true}function normalizeQuery(e){e=e||{};e.rows=e.rows||e.limit||10;e.start=e.start||0;e.until=e.until||new Date;if(typeof e.until!=="object"){e.until=new Date(e.until)}e.from=e.from||e.until-24*60*60*1e3;if(typeof e.from!=="object"){e.from=new Date(e.from)}e.order=e.order||"desc";return e}}stream(e={}){const t=n.join(this.dirname,this.filename);const r=new l;const i={file:t,start:e.start};r.destroy=p(i,((e,t)=>{if(e){return r.emit("error",e)}try{r.emit("data",t);t=JSON.parse(t);r.emit("log",t)}catch(e){r.emit("error",e)}}));return r}open(){if(!this.filename)return;if(this._opening)return;this._opening=true;this.stat(((e,t)=>{if(e){return this.emit("error",e)}h("stat done: %s { size: %s }",this.filename,t);this._size=t;this._dest=this._createStream(this._stream);this._opening=false;this.once("open",(()=>{if(this._stream.eventNames().includes("rotate")){this._stream.emit("rotate")}else{this._rotate=false}}))}))}stat(e){const t=this._getFile();const r=n.join(this.dirname,t);i.stat(r,((i,n)=>{if(i&&i.code==="ENOENT"){h("ENOENT ok",r);this.filename=t;return e(null,0)}if(i){h(`err ${i.code} ${r}`);return e(i)}if(!n||this._needsNewFile(n.size)){return this._incFile((()=>this.stat(e)))}this.filename=t;e(null,n.size)}))}close(e){if(!this._stream){return}this._stream.end((()=>{if(e){e()}this.emit("flush");this.emit("closed")}))}_needsNewFile(e){e=e||this._size;return this.maxsize&&e>=this.maxsize}_onError(e){this.emit("error",e)}_setupStream(e){e.on("error",this._onError);return e}_cleanupStream(e){e.removeListener("error",this._onError);e.destroy();return e}_rotateFile(){this._incFile((()=>this.open()))}_endStream(e=(()=>{})){if(this._dest){this._stream.unpipe(this._dest);this._dest.end((()=>{this._cleanupStream(this._dest);e()}))}else{e()}}_createStream(e){const t=n.join(this.dirname,this.filename);h("create stream start",t,this.options);const r=i.createWriteStream(t,this.options).on("error",(e=>h(e))).on("close",(()=>h("close",r.path,r.bytesWritten))).on("open",(()=>{h("file open ok",t);this.emit("open",t);e.pipe(r);if(this.rotatedWhileOpening){this._stream=new u;this._stream.setMaxListeners(30);this._rotateFile();this.rotatedWhileOpening=false;this._cleanupStream(r);e.end()}}));h("create stream ok",t);if(this.zippedArchive){const e=o.createGzip();e.pipe(r);return e}return r}_incFile(e){h("_incFile",this.filename);const t=n.extname(this._basename);const r=n.basename(this._basename,t);if(!this.tailable){this._created+=1;this._checkMaxFilesIncrementing(t,r,e)}else{this._checkMaxFilesTailable(t,r,e)}}_getFile(){const e=n.extname(this._basename);const t=n.basename(this._basename,e);const r=this.rotationFormat?this.rotationFormat():this._created;const i=!this.tailable&&this._created?`${t}${r}${e}`:`${t}${e}`;return this.zippedArchive&&!this.tailable?`${i}.gz`:i}_checkMaxFilesIncrementing(e,t,r){if(!this.maxFiles||this._created<this.maxFiles){return setImmediate(r)}const s=this._created-this.maxFiles;const o=s!==0?s:"";const a=this.zippedArchive?".gz":"";const l=`${t}${o}${e}${a}`;const u=n.join(this.dirname,l);i.unlink(u,r)}_checkMaxFilesTailable(e,t,r){const o=[];if(!this.maxFiles){return}const a=this.zippedArchive?".gz":"";for(let r=this.maxFiles-1;r>1;r--){o.push(function(r,s){let o=`${t}${r-1}${e}${a}`;const l=n.join(this.dirname,o);i.exists(l,(u=>{if(!u){return s(null)}o=`${t}${r}${e}${a}`;i.rename(l,n.join(this.dirname,o),s)}))}.bind(this,r))}s(o,(()=>{i.rename(n.join(this.dirname,`${t}${e}`),n.join(this.dirname,`${t}1${e}${a}`),r)}))}_createLogDirIfNotExist(e){if(!i.existsSync(e)){i.mkdirSync(e,{recursive:true})}}}},8028:(e,t,r)=>{"use strict";const i=r(3685);const n=r(5687);const{Stream:s}=r(1642);const o=r(7281);const a=r(7560);e.exports=class Http extends o{constructor(e={}){super(e);this.options=e;this.name=e.name||"http";this.ssl=!!e.ssl;this.host=e.host||"localhost";this.port=e.port;this.auth=e.auth;this.path=e.path||"";this.agent=e.agent;this.headers=e.headers||{};this.headers["content-type"]="application/json";this.batch=e.batch||false;this.batchInterval=e.batchInterval||5e3;this.batchCount=e.batchCount||10;this.batchOptions=[];this.batchTimeoutID=-1;this.batchCallback={};if(!this.port){this.port=this.ssl?443:80}}log(e,t){this._request(e,null,null,((t,r)=>{if(r&&r.statusCode!==200){t=new Error(`Invalid HTTP Status Code: ${r.statusCode}`)}if(t){this.emit("warn",t)}else{this.emit("logged",e)}}));if(t){setImmediate(t)}}query(e,t){if(typeof e==="function"){t=e;e={}}e={method:"query",params:this.normalizeQuery(e)};const r=e.params.auth||null;delete e.params.auth;const i=e.params.path||null;delete e.params.path;this._request(e,r,i,((e,r,i)=>{if(r&&r.statusCode!==200){e=new Error(`Invalid HTTP Status Code: ${r.statusCode}`)}if(e){return t(e)}if(typeof i==="string"){try{i=JSON.parse(i)}catch(e){return t(e)}}t(null,i)}))}stream(e={}){const t=new s;e={method:"stream",params:e};const r=e.params.path||null;delete e.params.path;const i=e.params.auth||null;delete e.params.auth;let n="";const o=this._request(e,i,r);t.destroy=()=>o.destroy();o.on("data",(e=>{e=(n+e).split(/\n+/);const r=e.length-1;let i=0;for(;i<r;i++){try{t.emit("log",JSON.parse(e[i]))}catch(e){t.emit("error",e)}}n=e[r]}));o.on("error",(e=>t.emit("error",e)));return t}_request(e,t,r,i){e=e||{};t=t||this.auth;r=r||this.path||"";if(this.batch){this._doBatch(e,i,t,r)}else{this._doRequest(e,i,t,r)}}_doBatch(e,t,r,i){this.batchOptions.push(e);if(this.batchOptions.length===1){const e=this;this.batchCallback=t;this.batchTimeoutID=setTimeout((function(){e.batchTimeoutID=-1;e._doBatchRequest(e.batchCallback,r,i)}),this.batchInterval)}if(this.batchOptions.length===this.batchCount){this._doBatchRequest(this.batchCallback,r,i)}}_doBatchRequest(e,t,r){if(this.batchTimeoutID>0){clearTimeout(this.batchTimeoutID);this.batchTimeoutID=-1}const i=this.batchOptions.slice();this.batchOptions=[];this._doRequest(i,e,t,r)}_doRequest(e,t,r,s){const o=Object.assign({},this.headers);if(r&&r.bearer){o.Authorization=`Bearer ${r.bearer}`}const l=(this.ssl?n:i).request({...this.options,method:"POST",host:this.host,port:this.port,path:`/${s.replace(/^\//,"")}`,headers:o,auth:r&&r.username&&r.password?`${r.username}:${r.password}`:"",agent:this.agent});l.on("error",t);l.on("response",(e=>e.on("end",(()=>t(null,e))).resume()));l.end(Buffer.from(a(e,this.options.replacer),"utf8"))}}},7804:(e,t,r)=>{"use strict";Object.defineProperty(t,"Console",{configurable:true,enumerable:true,get(){return r(7501)}});Object.defineProperty(t,"File",{configurable:true,enumerable:true,get(){return r(2478)}});Object.defineProperty(t,"Http",{configurable:true,enumerable:true,get(){return r(8028)}});Object.defineProperty(t,"Stream",{configurable:true,enumerable:true,get(){return r(4747)}})},4747:(e,t,r)=>{"use strict";const i=r(1554);const{MESSAGE:n}=r(3937);const s=r(2037);const o=r(7281);e.exports=class Stream extends o{constructor(e={}){super(e);if(!e.stream||!i(e.stream)){throw new Error("options.stream is required.")}this._stream=e.stream;this._stream.setMaxListeners(Infinity);this.isObjectMode=e.stream._writableState.objectMode;this.eol=typeof e.eol==="string"?e.eol:s.EOL}log(e,t){setImmediate((()=>this.emit("logged",e)));if(this.isObjectMode){this._stream.write(e);if(t){t()}return}this._stream.write(`${e[n]}${this.eol}`);if(t){t()}return}}},9892:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.ZodError=t.quotelessJson=t.ZodIssueCode=void 0;const i=r(3985);t.ZodIssueCode=i.util.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"]);const quotelessJson=e=>{const t=JSON.stringify(e,null,2);return t.replace(/"([^"]+)":/g,"$1:")};t.quotelessJson=quotelessJson;class ZodError extends Error{constructor(e){super();this.issues=[];this.addIssue=e=>{this.issues=[...this.issues,e]};this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;if(Object.setPrototypeOf){Object.setPrototypeOf(this,t)}else{this.__proto__=t}this.name="ZodError";this.issues=e}get errors(){return this.issues}format(e){const t=e||function(e){return e.message};const r={_errors:[]};const processError=e=>{for(const i of e.issues){if(i.code==="invalid_union"){i.unionErrors.map(processError)}else if(i.code==="invalid_return_type"){processError(i.returnTypeError)}else if(i.code==="invalid_arguments"){processError(i.argumentsError)}else if(i.path.length===0){r._errors.push(t(i))}else{let e=r;let n=0;while(n<i.path.length){const r=i.path[n];const s=n===i.path.length-1;if(!s){e[r]=e[r]||{_errors:[]}}else{e[r]=e[r]||{_errors:[]};e[r]._errors.push(t(i))}e=e[r];n++}}}};processError(this);return r}toString(){return this.message}get message(){return JSON.stringify(this.issues,i.util.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=(e=>e.message)){const t={};const r=[];for(const i of this.issues){if(i.path.length>0){t[i.path[0]]=t[i.path[0]]||[];t[i.path[0]].push(e(i))}else{r.push(e(i))}}return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}t.ZodError=ZodError;ZodError.create=e=>{const t=new ZodError(e);return t}},9566:function(e,t,r){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.getErrorMap=t.setErrorMap=t.defaultErrorMap=void 0;const n=i(r(468));t.defaultErrorMap=n.default;let s=n.default;function setErrorMap(e){s=e}t.setErrorMap=setErrorMap;function getErrorMap(){return s}t.getErrorMap=getErrorMap},9906:function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){if(i===undefined)i=r;Object.defineProperty(e,i,{enumerable:true,get:function(){return t[r]}})}:function(e,t,r,i){if(i===undefined)i=r;e[i]=t[r]});var n=this&&this.__exportStar||function(e,t){for(var r in e)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r))i(t,e,r)};Object.defineProperty(t,"__esModule",{value:true});n(r(9566),t);n(r(888),t);n(r(9449),t);n(r(3985),t);n(r(9335),t);n(r(9892),t)},2513:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.errorUtil=void 0;var r;(function(e){e.errToObj=e=>typeof e==="string"?{message:e}:e||{};e.toString=e=>typeof e==="string"?e:e===null||e===void 0?void 0:e.message})(r=t.errorUtil||(t.errorUtil={}))},888:function(e,t,r){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.isAsync=t.isValid=t.isDirty=t.isAborted=t.OK=t.DIRTY=t.INVALID=t.ParseStatus=t.addIssueToContext=t.EMPTY_PATH=t.makeIssue=void 0;const n=r(9566);const s=i(r(468));const makeIssue=e=>{const{data:t,path:r,errorMaps:i,issueData:n}=e;const s=[...r,...n.path||[]];const o={...n,path:s};let a="";const l=i.filter((e=>!!e)).slice().reverse();for(const e of l){a=e(o,{data:t,defaultError:a}).message}return{...n,path:s,message:n.message||a}};t.makeIssue=makeIssue;t.EMPTY_PATH=[];function addIssueToContext(e,r){const i=(0,t.makeIssue)({issueData:r,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,(0,n.getErrorMap)(),s.default].filter((e=>!!e))});e.common.issues.push(i)}t.addIssueToContext=addIssueToContext;class ParseStatus{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(e,r){const i=[];for(const n of r){if(n.status==="aborted")return t.INVALID;if(n.status==="dirty")e.dirty();i.push(n.value)}return{status:e.value,value:i}}static async mergeObjectAsync(e,t){const r=[];for(const e of t){r.push({key:await e.key,value:await e.value})}return ParseStatus.mergeObjectSync(e,r)}static mergeObjectSync(e,r){const i={};for(const n of r){const{key:r,value:s}=n;if(r.status==="aborted")return t.INVALID;if(s.status==="aborted")return t.INVALID;if(r.status==="dirty")e.dirty();if(s.status==="dirty")e.dirty();if(typeof s.value!=="undefined"||n.alwaysSet){i[r.value]=s.value}}return{status:e.value,value:i}}}t.ParseStatus=ParseStatus;t.INVALID=Object.freeze({status:"aborted"});const DIRTY=e=>({status:"dirty",value:e});t.DIRTY=DIRTY;const OK=e=>({status:"valid",value:e});t.OK=OK;const isAborted=e=>e.status==="aborted";t.isAborted=isAborted;const isDirty=e=>e.status==="dirty";t.isDirty=isDirty;const isValid=e=>e.status==="valid";t.isValid=isValid;const isAsync=e=>typeof Promise!=="undefined"&&e instanceof Promise;t.isAsync=isAsync},9449:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true})},3985:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.getParsedType=t.ZodParsedType=t.objectUtil=t.util=void 0;var r;(function(e){e.assertEqual=e=>e;function assertIs(e){}e.assertIs=assertIs;function assertNever(e){throw new Error}e.assertNever=assertNever;e.arrayToEnum=e=>{const t={};for(const r of e){t[r]=r}return t};e.getValidEnumValues=t=>{const r=e.objectKeys(t).filter((e=>typeof t[t[e]]!=="number"));const i={};for(const e of r){i[e]=t[e]}return e.objectValues(i)};e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]}));e.objectKeys=typeof Object.keys==="function"?e=>Object.keys(e):e=>{const t=[];for(const r in e){if(Object.prototype.hasOwnProperty.call(e,r)){t.push(r)}}return t};e.find=(e,t)=>{for(const r of e){if(t(r))return r}return undefined};e.isInteger=typeof Number.isInteger==="function"?e=>Number.isInteger(e):e=>typeof e==="number"&&isFinite(e)&&Math.floor(e)===e;function joinValues(e,t=" | "){return e.map((e=>typeof e==="string"?`'${e}'`:e)).join(t)}e.joinValues=joinValues;e.jsonStringifyReplacer=(e,t)=>{if(typeof t==="bigint"){return t.toString()}return t}})(r=t.util||(t.util={}));var i;(function(e){e.mergeShapes=(e,t)=>({...e,...t})})(i=t.objectUtil||(t.objectUtil={}));t.ZodParsedType=r.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);const getParsedType=e=>{const r=typeof e;switch(r){case"undefined":return t.ZodParsedType.undefined;case"string":return t.ZodParsedType.string;case"number":return isNaN(e)?t.ZodParsedType.nan:t.ZodParsedType.number;case"boolean":return t.ZodParsedType.boolean;case"function":return t.ZodParsedType.function;case"bigint":return t.ZodParsedType.bigint;case"symbol":return t.ZodParsedType.symbol;case"object":if(Array.isArray(e)){return t.ZodParsedType.array}if(e===null){return t.ZodParsedType.null}if(e.then&&typeof e.then==="function"&&e.catch&&typeof e.catch==="function"){return t.ZodParsedType.promise}if(typeof Map!=="undefined"&&e instanceof Map){return t.ZodParsedType.map}if(typeof Set!=="undefined"&&e instanceof Set){return t.ZodParsedType.set}if(typeof Date!=="undefined"&&e instanceof Date){return t.ZodParsedType.date}return t.ZodParsedType.object;default:return t.ZodParsedType.unknown}};t.getParsedType=getParsedType},3301:function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){if(i===undefined)i=r;Object.defineProperty(e,i,{enumerable:true,get:function(){return t[r]}})}:function(e,t,r,i){if(i===undefined)i=r;e[i]=t[r]});var n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t});var s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)if(r!=="default"&&Object.prototype.hasOwnProperty.call(e,r))i(t,e,r);n(t,e);return t};var o=this&&this.__exportStar||function(e,t){for(var r in e)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r))i(t,e,r)};Object.defineProperty(t,"__esModule",{value:true});t.z=void 0;const a=s(r(9906));t.z=a;o(r(9906),t);t["default"]=a},468:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const i=r(3985);const n=r(9892);const errorMap=(e,t)=>{let r;switch(e.code){case n.ZodIssueCode.invalid_type:if(e.received===i.ZodParsedType.undefined){r="Required"}else{r=`Expected ${e.expected}, received ${e.received}`}break;case n.ZodIssueCode.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,i.util.jsonStringifyReplacer)}`;break;case n.ZodIssueCode.unrecognized_keys:r=`Unrecognized key(s) in object: ${i.util.joinValues(e.keys,", ")}`;break;case n.ZodIssueCode.invalid_union:r=`Invalid input`;break;case n.ZodIssueCode.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${i.util.joinValues(e.options)}`;break;case n.ZodIssueCode.invalid_enum_value:r=`Invalid enum value. Expected ${i.util.joinValues(e.options)}, received '${e.received}'`;break;case n.ZodIssueCode.invalid_arguments:r=`Invalid function arguments`;break;case n.ZodIssueCode.invalid_return_type:r=`Invalid function return type`;break;case n.ZodIssueCode.invalid_date:r=`Invalid date`;break;case n.ZodIssueCode.invalid_string:if(typeof e.validation==="object"){if("includes"in e.validation){r=`Invalid input: must include "${e.validation.includes}"`;if(typeof e.validation.position==="number"){r=`${r} at one or more positions greater than or equal to ${e.validation.position}`}}else if("startsWith"in e.validation){r=`Invalid input: must start with "${e.validation.startsWith}"`}else if("endsWith"in e.validation){r=`Invalid input: must end with "${e.validation.endsWith}"`}else{i.util.assertNever(e.validation)}}else if(e.validation!=="regex"){r=`Invalid ${e.validation}`}else{r="Invalid"}break;case n.ZodIssueCode.too_small:if(e.type==="array")r=`Array must contain ${e.exact?"exactly":e.inclusive?`at least`:`more than`} ${e.minimum} element(s)`;else if(e.type==="string")r=`String must contain ${e.exact?"exactly":e.inclusive?`at least`:`over`} ${e.minimum} character(s)`;else if(e.type==="number")r=`Number must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${e.minimum}`;else if(e.type==="date")r=`Date must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${new Date(Number(e.minimum))}`;else r="Invalid input";break;case n.ZodIssueCode.too_big:if(e.type==="array")r=`Array must contain ${e.exact?`exactly`:e.inclusive?`at most`:`less than`} ${e.maximum} element(s)`;else if(e.type==="string")r=`String must contain ${e.exact?`exactly`:e.inclusive?`at most`:`under`} ${e.maximum} character(s)`;else if(e.type==="number")r=`Number must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`;else if(e.type==="bigint")r=`BigInt must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`;else if(e.type==="date")r=`Date must be ${e.exact?`exactly`:e.inclusive?`smaller than or equal to`:`smaller than`} ${new Date(Number(e.maximum))}`;else r="Invalid input";break;case n.ZodIssueCode.custom:r=`Invalid input`;break;case n.ZodIssueCode.invalid_intersection_types:r=`Intersection results could not be merged`;break;case n.ZodIssueCode.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case n.ZodIssueCode.not_finite:r="Number must be finite";break;default:r=t.defaultError;i.util.assertNever(e)}return{message:r}};t["default"]=errorMap},9335:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.discriminatedUnion=t.date=t.boolean=t.bigint=t.array=t.any=t.coerce=t.ZodFirstPartyTypeKind=t.late=t.ZodSchema=t.Schema=t.custom=t.ZodPipeline=t.ZodBranded=t.BRAND=t.ZodNaN=t.ZodCatch=t.ZodDefault=t.ZodNullable=t.ZodOptional=t.ZodTransformer=t.ZodEffects=t.ZodPromise=t.ZodNativeEnum=t.ZodEnum=t.ZodLiteral=t.ZodLazy=t.ZodFunction=t.ZodSet=t.ZodMap=t.ZodRecord=t.ZodTuple=t.ZodIntersection=t.ZodDiscriminatedUnion=t.ZodUnion=t.ZodObject=t.ZodArray=t.ZodVoid=t.ZodNever=t.ZodUnknown=t.ZodAny=t.ZodNull=t.ZodUndefined=t.ZodSymbol=t.ZodDate=t.ZodBoolean=t.ZodBigInt=t.ZodNumber=t.ZodString=t.ZodType=void 0;t.NEVER=t["void"]=t.unknown=t.union=t.undefined=t.tuple=t.transformer=t.symbol=t.string=t.strictObject=t.set=t.record=t.promise=t.preprocess=t.pipeline=t.ostring=t.optional=t.onumber=t.oboolean=t.object=t.number=t.nullable=t["null"]=t.never=t.nativeEnum=t.nan=t.map=t.literal=t.lazy=t.intersection=t["instanceof"]=t["function"]=t["enum"]=t.effect=void 0;const i=r(9566);const n=r(2513);const s=r(888);const o=r(3985);const a=r(9892);class ParseInputLazyPath{constructor(e,t,r,i){this._cachedPath=[];this.parent=e;this.data=t;this._path=r;this._key=i}get path(){if(!this._cachedPath.length){if(this._key instanceof Array){this._cachedPath.push(...this._path,...this._key)}else{this._cachedPath.push(...this._path,this._key)}}return this._cachedPath}}const handleResult=(e,t)=>{if((0,s.isValid)(t)){return{success:true,data:t.value}}else{if(!e.common.issues.length){throw new Error("Validation failed but no issues detected.")}return{success:false,get error(){if(this._error)return this._error;const t=new a.ZodError(e.common.issues);this._error=t;return this._error}}}};function processCreateParams(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:i,description:n}=e;if(t&&(r||i)){throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`)}if(t)return{errorMap:t,description:n};const customMap=(e,t)=>{if(e.code!=="invalid_type")return{message:t.defaultError};if(typeof t.data==="undefined"){return{message:i!==null&&i!==void 0?i:t.defaultError}}return{message:r!==null&&r!==void 0?r:t.defaultError}};return{errorMap:customMap,description:n}}class ZodType{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.isNullable=this.isNullable.bind(this);this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return(0,o.getParsedType)(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:(0,o.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new s.ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:(0,o.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if((0,s.isAsync)(t)){throw new Error("Synchronous parse encountered promise.")}return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){var r;const i={common:{issues:[],async:(r=t===null||t===void 0?void 0:t.async)!==null&&r!==void 0?r:false,contextualErrorMap:t===null||t===void 0?void 0:t.errorMap},path:(t===null||t===void 0?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,o.getParsedType)(e)};const n=this._parseSync({data:e,path:i.path,parent:i});return handleResult(i,n)}async parseAsync(e,t){const r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){const r={common:{issues:[],contextualErrorMap:t===null||t===void 0?void 0:t.errorMap,async:true},path:(t===null||t===void 0?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,o.getParsedType)(e)};const i=this._parse({data:e,path:r.path,parent:r});const n=await((0,s.isAsync)(i)?i:Promise.resolve(i));return handleResult(r,n)}refine(e,t){const getIssueProperties=e=>{if(typeof t==="string"||typeof t==="undefined"){return{message:t}}else if(typeof t==="function"){return t(e)}else{return t}};return this._refinement(((t,r)=>{const i=e(t);const setError=()=>r.addIssue({code:a.ZodIssueCode.custom,...getIssueProperties(t)});if(typeof Promise!=="undefined"&&i instanceof Promise){return i.then((e=>{if(!e){setError();return false}else{return true}}))}if(!i){setError();return false}else{return true}}))}refinement(e,t){return this._refinement(((r,i)=>{if(!e(r)){i.addIssue(typeof t==="function"?t(r,i):t);return false}else{return true}}))}_refinement(e){return new ZodEffects({schema:this,typeName:y.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return ZodOptional.create(this,this._def)}nullable(){return ZodNullable.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ZodArray.create(this,this._def)}promise(){return ZodPromise.create(this,this._def)}or(e){return ZodUnion.create([this,e],this._def)}and(e){return ZodIntersection.create(this,e,this._def)}transform(e){return new ZodEffects({...processCreateParams(this._def),schema:this,typeName:y.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e==="function"?e:()=>e;return new ZodDefault({...processCreateParams(this._def),innerType:this,defaultValue:t,typeName:y.ZodDefault})}brand(){return new ZodBranded({typeName:y.ZodBranded,type:this,...processCreateParams(this._def)})}catch(e){const t=typeof e==="function"?e:()=>e;return new ZodCatch({...processCreateParams(this._def),innerType:this,catchValue:t,typeName:y.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return ZodPipeline.create(this,e)}isOptional(){return this.safeParse(undefined).success}isNullable(){return this.safeParse(null).success}}t.ZodType=ZodType;t.Schema=ZodType;t.ZodSchema=ZodType;const l=/^c[^\s-]{8,}$/i;const u=/^[a-z][a-z0-9]*$/;const c=/[0-9A-HJKMNP-TV-Z]{26}/;const h=/^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i;const d=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\])|(\[IPv6:(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))\])|([A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])*(\.[A-Za-z]{2,})+))$/;const p=/^(\p{Extended_Pictographic}|\p{Emoji_Component})+$/u;const m=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/;const g=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;const datetimeRegex=e=>{if(e.precision){if(e.offset){return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`)}else{return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}Z$`)}}else if(e.precision===0){if(e.offset){return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$`)}else{return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$`)}}else{if(e.offset){return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$`)}else{return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$`)}}};function isValidIP(e,t){if((t==="v4"||!t)&&m.test(e)){return true}if((t==="v6"||!t)&&g.test(e)){return true}return false}class ZodString extends ZodType{constructor(){super(...arguments);this._regex=(e,t,r)=>this.refinement((t=>e.test(t)),{validation:t,code:a.ZodIssueCode.invalid_string,...n.errorUtil.errToObj(r)});this.nonempty=e=>this.min(1,n.errorUtil.errToObj(e));this.trim=()=>new ZodString({...this._def,checks:[...this._def.checks,{kind:"trim"}]});this.toLowerCase=()=>new ZodString({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]});this.toUpperCase=()=>new ZodString({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}_parse(e){if(this._def.coerce){e.data=String(e.data)}const t=this._getType(e);if(t!==o.ZodParsedType.string){const t=this._getOrReturnCtx(e);(0,s.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.string,received:t.parsedType});return s.INVALID}const r=new s.ParseStatus;let i=undefined;for(const t of this._def.checks){if(t.kind==="min"){if(e.data.length<t.value){i=this._getOrReturnCtx(e,i);(0,s.addIssueToContext)(i,{code:a.ZodIssueCode.too_small,minimum:t.value,type:"string",inclusive:true,exact:false,message:t.message});r.dirty()}}else if(t.kind==="max"){if(e.data.length>t.value){i=this._getOrReturnCtx(e,i);(0,s.addIssueToContext)(i,{code:a.ZodIssueCode.too_big,maximum:t.value,type:"string",inclusive:true,exact:false,message:t.message});r.dirty()}}else if(t.kind==="length"){const n=e.data.length>t.value;const o=e.data.length<t.value;if(n||o){i=this._getOrReturnCtx(e,i);if(n){(0,s.addIssueToContext)(i,{code:a.ZodIssueCode.too_big,maximum:t.value,type:"string",inclusive:true,exact:true,message:t.message})}else if(o){(0,s.addIssueToContext)(i,{code:a.ZodIssueCode.too_small,minimum:t.value,type:"string",inclusive:true,exact:true,message:t.message})}r.dirty()}}else if(t.kind==="email"){if(!d.test(e.data)){i=this._getOrReturnCtx(e,i);(0,s.addIssueToContext)(i,{validation:"email",code:a.ZodIssueCode.invalid_string,message:t.message});r.dirty()}}else if(t.kind==="emoji"){if(!p.test(e.data)){i=this._getOrReturnCtx(e,i);(0,s.addIssueToContext)(i,{validation:"emoji",code:a.ZodIssueCode.invalid_string,message:t.message});r.dirty()}}else if(t.kind==="uuid"){if(!h.test(e.data)){i=this._getOrReturnCtx(e,i);(0,s.addIssueToContext)(i,{validation:"uuid",code:a.ZodIssueCode.invalid_string,message:t.message});r.dirty()}}else if(t.kind==="cuid"){if(!l.test(e.data)){i=this._getOrReturnCtx(e,i);(0,s.addIssueToContext)(i,{validation:"cuid",code:a.ZodIssueCode.invalid_string,message:t.message});r.dirty()}}else if(t.kind==="cuid2"){if(!u.test(e.data)){i=this._getOrReturnCtx(e,i);(0,s.addIssueToContext)(i,{validation:"cuid2",code:a.ZodIssueCode.invalid_string,message:t.message});r.dirty()}}else if(t.kind==="ulid"){if(!c.test(e.data)){i=this._getOrReturnCtx(e,i);(0,s.addIssueToContext)(i,{validation:"ulid",code:a.ZodIssueCode.invalid_string,message:t.message});r.dirty()}}else if(t.kind==="url"){try{new URL(e.data)}catch(n){i=this._getOrReturnCtx(e,i);(0,s.addIssueToContext)(i,{validation:"url",code:a.ZodIssueCode.invalid_string,message:t.message});r.dirty()}}else if(t.kind==="regex"){t.regex.lastIndex=0;const n=t.regex.test(e.data);if(!n){i=this._getOrReturnCtx(e,i);(0,s.addIssueToContext)(i,{validation:"regex",code:a.ZodIssueCode.invalid_string,message:t.message});r.dirty()}}else if(t.kind==="trim"){e.data=e.data.trim()}else if(t.kind==="includes"){if(!e.data.includes(t.value,t.position)){i=this._getOrReturnCtx(e,i);(0,s.addIssueToContext)(i,{code:a.ZodIssueCode.invalid_string,validation:{includes:t.value,position:t.position},message:t.message});r.dirty()}}else if(t.kind==="toLowerCase"){e.data=e.data.toLowerCase()}else if(t.kind==="toUpperCase"){e.data=e.data.toUpperCase()}else if(t.kind==="startsWith"){if(!e.data.startsWith(t.value)){i=this._getOrReturnCtx(e,i);(0,s.addIssueToContext)(i,{code:a.ZodIssueCode.invalid_string,validation:{startsWith:t.value},message:t.message});r.dirty()}}else if(t.kind==="endsWith"){if(!e.data.endsWith(t.value)){i=this._getOrReturnCtx(e,i);(0,s.addIssueToContext)(i,{code:a.ZodIssueCode.invalid_string,validation:{endsWith:t.value},message:t.message});r.dirty()}}else if(t.kind==="datetime"){const n=datetimeRegex(t);if(!n.test(e.data)){i=this._getOrReturnCtx(e,i);(0,s.addIssueToContext)(i,{code:a.ZodIssueCode.invalid_string,validation:"datetime",message:t.message});r.dirty()}}else if(t.kind==="ip"){if(!isValidIP(e.data,t.version)){i=this._getOrReturnCtx(e,i);(0,s.addIssueToContext)(i,{validation:"ip",code:a.ZodIssueCode.invalid_string,message:t.message});r.dirty()}}else{o.util.assertNever(t)}}return{status:r.value,value:e.data}}_addCheck(e){return new ZodString({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...n.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",...n.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...n.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...n.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...n.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...n.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...n.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...n.errorUtil.errToObj(e)})}datetime(e){var t;if(typeof e==="string"){return this._addCheck({kind:"datetime",precision:null,offset:false,message:e})}return this._addCheck({kind:"datetime",precision:typeof(e===null||e===void 0?void 0:e.precision)==="undefined"?null:e===null||e===void 0?void 0:e.precision,offset:(t=e===null||e===void 0?void 0:e.offset)!==null&&t!==void 0?t:false,...n.errorUtil.errToObj(e===null||e===void 0?void 0:e.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...n.errorUtil.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t===null||t===void 0?void 0:t.position,...n.errorUtil.errToObj(t===null||t===void 0?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...n.errorUtil.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...n.errorUtil.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...n.errorUtil.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...n.errorUtil.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...n.errorUtil.errToObj(t)})}get isDatetime(){return!!this._def.checks.find((e=>e.kind==="datetime"))}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 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 minLength(){let e=null;for(const t of this._def.checks){if(t.kind==="min"){if(e===null||t.value>e)e=t.value}}return e}get maxLength(){let e=null;for(const t of this._def.checks){if(t.kind==="max"){if(e===null||t.value<e)e=t.value}}return e}}t.ZodString=ZodString;ZodString.create=e=>{var t;return new ZodString({checks:[],typeName:y.ZodString,coerce:(t=e===null||e===void 0?void 0:e.coerce)!==null&&t!==void 0?t:false,...processCreateParams(e)})};function floatSafeRemainder(e,t){const r=(e.toString().split(".")[1]||"").length;const i=(t.toString().split(".")[1]||"").length;const n=r>i?r:i;const s=parseInt(e.toFixed(n).replace(".",""));const o=parseInt(t.toFixed(n).replace(".",""));return s%o/Math.pow(10,n)}class ZodNumber extends ZodType{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)}const t=this._getType(e);if(t!==o.ZodParsedType.number){const t=this._getOrReturnCtx(e);(0,s.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.number,received:t.parsedType});return s.INVALID}let r=undefined;const i=new s.ParseStatus;for(const t of this._def.checks){if(t.kind==="int"){if(!o.util.isInteger(e.data)){r=this._getOrReturnCtx(e,r);(0,s.addIssueToContext)(r,{code:a.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:t.message});i.dirty()}}else if(t.kind==="min"){const n=t.inclusive?e.data<t.value:e.data<=t.value;if(n){r=this._getOrReturnCtx(e,r);(0,s.addIssueToContext)(r,{code:a.ZodIssueCode.too_small,minimum:t.value,type:"number",inclusive:t.inclusive,exact:false,message:t.message});i.dirty()}}else if(t.kind==="max"){const n=t.inclusive?e.data>t.value:e.data>=t.value;if(n){r=this._getOrReturnCtx(e,r);(0,s.addIssueToContext)(r,{code:a.ZodIssueCode.too_big,maximum:t.value,type:"number",inclusive:t.inclusive,exact:false,message:t.message});i.dirty()}}else if(t.kind==="multipleOf"){if(floatSafeRemainder(e.data,t.value)!==0){r=this._getOrReturnCtx(e,r);(0,s.addIssueToContext)(r,{code:a.ZodIssueCode.not_multiple_of,multipleOf:t.value,message:t.message});i.dirty()}}else if(t.kind==="finite"){if(!Number.isFinite(e.data)){r=this._getOrReturnCtx(e,r);(0,s.addIssueToContext)(r,{code:a.ZodIssueCode.not_finite,message:t.message});i.dirty()}}else{o.util.assertNever(t)}}return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,true,n.errorUtil.toString(t))}gt(e,t){return this.setLimit("min",e,false,n.errorUtil.toString(t))}lte(e,t){return this.setLimit("max",e,true,n.errorUtil.toString(t))}lt(e,t){return this.setLimit("max",e,false,n.errorUtil.toString(t))}setLimit(e,t,r,i){return new ZodNumber({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:n.errorUtil.toString(i)}]})}_addCheck(e){return new ZodNumber({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:n.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:false,message:n.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:false,message:n.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:true,message:n.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:true,message:n.errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:n.errorUtil.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:n.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:true,value:Number.MIN_SAFE_INTEGER,message:n.errorUtil.toString(e)})._addCheck({kind:"max",inclusive:true,value:Number.MAX_SAFE_INTEGER,message:n.errorUtil.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks){if(t.kind==="min"){if(e===null||t.value>e)e=t.value}}return e}get maxValue(){let e=null;for(const t of this._def.checks){if(t.kind==="max"){if(e===null||t.value<e)e=t.value}}return e}get isInt(){return!!this._def.checks.find((e=>e.kind==="int"||e.kind==="multipleOf"&&o.util.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf"){return true}else if(r.kind==="min"){if(t===null||r.value>t)t=r.value}else if(r.kind==="max"){if(e===null||r.value<e)e=r.value}}return Number.isFinite(t)&&Number.isFinite(e)}}t.ZodNumber=ZodNumber;ZodNumber.create=e=>new ZodNumber({checks:[],typeName:y.ZodNumber,coerce:(e===null||e===void 0?void 0:e.coerce)||false,...processCreateParams(e)});class ZodBigInt extends ZodType{constructor(){super(...arguments);this.min=this.gte;this.max=this.lte}_parse(e){if(this._def.coerce){e.data=BigInt(e.data)}const t=this._getType(e);if(t!==o.ZodParsedType.bigint){const t=this._getOrReturnCtx(e);(0,s.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.bigint,received:t.parsedType});return s.INVALID}let r=undefined;const i=new s.ParseStatus;for(const t of this._def.checks){if(t.kind==="min"){const n=t.inclusive?e.data<t.value:e.data<=t.value;if(n){r=this._getOrReturnCtx(e,r);(0,s.addIssueToContext)(r,{code:a.ZodIssueCode.too_small,type:"bigint",minimum:t.value,inclusive:t.inclusive,message:t.message});i.dirty()}}else if(t.kind==="max"){const n=t.inclusive?e.data>t.value:e.data>=t.value;if(n){r=this._getOrReturnCtx(e,r);(0,s.addIssueToContext)(r,{code:a.ZodIssueCode.too_big,type:"bigint",maximum:t.value,inclusive:t.inclusive,message:t.message});i.dirty()}}else if(t.kind==="multipleOf"){if(e.data%t.value!==BigInt(0)){r=this._getOrReturnCtx(e,r);(0,s.addIssueToContext)(r,{code:a.ZodIssueCode.not_multiple_of,multipleOf:t.value,message:t.message});i.dirty()}}else{o.util.assertNever(t)}}return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,true,n.errorUtil.toString(t))}gt(e,t){return this.setLimit("min",e,false,n.errorUtil.toString(t))}lte(e,t){return this.setLimit("max",e,true,n.errorUtil.toString(t))}lt(e,t){return this.setLimit("max",e,false,n.errorUtil.toString(t))}setLimit(e,t,r,i){return new ZodBigInt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:n.errorUtil.toString(i)}]})}_addCheck(e){return new ZodBigInt({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:false,message:n.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:false,message:n.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:true,message:n.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:true,message:n.errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:n.errorUtil.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks){if(t.kind==="min"){if(e===null||t.value>e)e=t.value}}return e}get maxValue(){let e=null;for(const t of this._def.checks){if(t.kind==="max"){if(e===null||t.value<e)e=t.value}}return e}}t.ZodBigInt=ZodBigInt;ZodBigInt.create=e=>{var t;return new ZodBigInt({checks:[],typeName:y.ZodBigInt,coerce:(t=e===null||e===void 0?void 0:e.coerce)!==null&&t!==void 0?t:false,...processCreateParams(e)})};class ZodBoolean extends ZodType{_parse(e){if(this._def.coerce){e.data=Boolean(e.data)}const t=this._getType(e);if(t!==o.ZodParsedType.boolean){const t=this._getOrReturnCtx(e);(0,s.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.boolean,received:t.parsedType});return s.INVALID}return(0,s.OK)(e.data)}}t.ZodBoolean=ZodBoolean;ZodBoolean.create=e=>new ZodBoolean({typeName:y.ZodBoolean,coerce:(e===null||e===void 0?void 0:e.coerce)||false,...processCreateParams(e)});class ZodDate extends ZodType{_parse(e){if(this._def.coerce){e.data=new Date(e.data)}const t=this._getType(e);if(t!==o.ZodParsedType.date){const t=this._getOrReturnCtx(e);(0,s.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.date,received:t.parsedType});return s.INVALID}if(isNaN(e.data.getTime())){const t=this._getOrReturnCtx(e);(0,s.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_date});return s.INVALID}const r=new s.ParseStatus;let i=undefined;for(const t of this._def.checks){if(t.kind==="min"){if(e.data.getTime()<t.value){i=this._getOrReturnCtx(e,i);(0,s.addIssueToContext)(i,{code:a.ZodIssueCode.too_small,message:t.message,inclusive:true,exact:false,minimum:t.value,type:"date"});r.dirty()}}else if(t.kind==="max"){if(e.data.getTime()>t.value){i=this._getOrReturnCtx(e,i);(0,s.addIssueToContext)(i,{code:a.ZodIssueCode.too_big,message:t.message,inclusive:true,exact:false,maximum:t.value,type:"date"});r.dirty()}}else{o.util.assertNever(t)}}return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ZodDate({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:n.errorUtil.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:n.errorUtil.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks){if(t.kind==="min"){if(e===null||t.value>e)e=t.value}}return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks){if(t.kind==="max"){if(e===null||t.value<e)e=t.value}}return e!=null?new Date(e):null}}t.ZodDate=ZodDate;ZodDate.create=e=>new ZodDate({checks:[],coerce:(e===null||e===void 0?void 0:e.coerce)||false,typeName:y.ZodDate,...processCreateParams(e)});class ZodSymbol extends ZodType{_parse(e){const t=this._getType(e);if(t!==o.ZodParsedType.symbol){const t=this._getOrReturnCtx(e);(0,s.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.symbol,received:t.parsedType});return s.INVALID}return(0,s.OK)(e.data)}}t.ZodSymbol=ZodSymbol;ZodSymbol.create=e=>new ZodSymbol({typeName:y.ZodSymbol,...processCreateParams(e)});class ZodUndefined extends ZodType{_parse(e){const t=this._getType(e);if(t!==o.ZodParsedType.undefined){const t=this._getOrReturnCtx(e);(0,s.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.undefined,received:t.parsedType});return s.INVALID}return(0,s.OK)(e.data)}}t.ZodUndefined=ZodUndefined;ZodUndefined.create=e=>new ZodUndefined({typeName:y.ZodUndefined,...processCreateParams(e)});class ZodNull extends ZodType{_parse(e){const t=this._getType(e);if(t!==o.ZodParsedType.null){const t=this._getOrReturnCtx(e);(0,s.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.null,received:t.parsedType});return s.INVALID}return(0,s.OK)(e.data)}}t.ZodNull=ZodNull;ZodNull.create=e=>new ZodNull({typeName:y.ZodNull,...processCreateParams(e)});class ZodAny extends ZodType{constructor(){super(...arguments);this._any=true}_parse(e){return(0,s.OK)(e.data)}}t.ZodAny=ZodAny;ZodAny.create=e=>new ZodAny({typeName:y.ZodAny,...processCreateParams(e)});class ZodUnknown extends ZodType{constructor(){super(...arguments);this._unknown=true}_parse(e){return(0,s.OK)(e.data)}}t.ZodUnknown=ZodUnknown;ZodUnknown.create=e=>new ZodUnknown({typeName:y.ZodUnknown,...processCreateParams(e)});class ZodNever extends ZodType{_parse(e){const t=this._getOrReturnCtx(e);(0,s.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.never,received:t.parsedType});return s.INVALID}}t.ZodNever=ZodNever;ZodNever.create=e=>new ZodNever({typeName:y.ZodNever,...processCreateParams(e)});class ZodVoid extends ZodType{_parse(e){const t=this._getType(e);if(t!==o.ZodParsedType.undefined){const t=this._getOrReturnCtx(e);(0,s.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.void,received:t.parsedType});return s.INVALID}return(0,s.OK)(e.data)}}t.ZodVoid=ZodVoid;ZodVoid.create=e=>new ZodVoid({typeName:y.ZodVoid,...processCreateParams(e)});class ZodArray extends ZodType{_parse(e){const{ctx:t,status:r}=this._processInputParams(e);const i=this._def;if(t.parsedType!==o.ZodParsedType.array){(0,s.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.array,received:t.parsedType});return s.INVALID}if(i.exactLength!==null){const e=t.data.length>i.exactLength.value;const n=t.data.length<i.exactLength.value;if(e||n){(0,s.addIssueToContext)(t,{code:e?a.ZodIssueCode.too_big:a.ZodIssueCode.too_small,minimum:n?i.exactLength.value:undefined,maximum:e?i.exactLength.value:undefined,type:"array",inclusive:true,exact:true,message:i.exactLength.message});r.dirty()}}if(i.minLength!==null){if(t.data.length<i.minLength.value){(0,s.addIssueToContext)(t,{code:a.ZodIssueCode.too_small,minimum:i.minLength.value,type:"array",inclusive:true,exact:false,message:i.minLength.message});r.dirty()}}if(i.maxLength!==null){if(t.data.length>i.maxLength.value){(0,s.addIssueToContext)(t,{code:a.ZodIssueCode.too_big,maximum:i.maxLength.value,type:"array",inclusive:true,exact:false,message:i.maxLength.message});r.dirty()}}if(t.common.async){return Promise.all([...t.data].map(((e,r)=>i.type._parseAsync(new ParseInputLazyPath(t,e,t.path,r))))).then((e=>s.ParseStatus.mergeArray(r,e)))}const n=[...t.data].map(((e,r)=>i.type._parseSync(new ParseInputLazyPath(t,e,t.path,r))));return s.ParseStatus.mergeArray(r,n)}get element(){return this._def.type}min(e,t){return new ZodArray({...this._def,minLength:{value:e,message:n.errorUtil.toString(t)}})}max(e,t){return new ZodArray({...this._def,maxLength:{value:e,message:n.errorUtil.toString(t)}})}length(e,t){return new ZodArray({...this._def,exactLength:{value:e,message:n.errorUtil.toString(t)}})}nonempty(e){return this.min(1,e)}}t.ZodArray=ZodArray;ZodArray.create=(e,t)=>new ZodArray({type:e,minLength:null,maxLength:null,exactLength:null,typeName:y.ZodArray,...processCreateParams(t)});function deepPartialify(e){if(e instanceof ZodObject){const t={};for(const r in e.shape){const i=e.shape[r];t[r]=ZodOptional.create(deepPartialify(i))}return new ZodObject({...e._def,shape:()=>t})}else if(e instanceof ZodArray){return new ZodArray({...e._def,type:deepPartialify(e.element)})}else if(e instanceof ZodOptional){return ZodOptional.create(deepPartialify(e.unwrap()))}else if(e instanceof ZodNullable){return ZodNullable.create(deepPartialify(e.unwrap()))}else if(e instanceof ZodTuple){return ZodTuple.create(e.items.map((e=>deepPartialify(e))))}else{return e}}class ZodObject extends ZodType{constructor(){super(...arguments);this._cached=null;this.nonstrict=this.passthrough;this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape();const t=o.util.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){const t=this._getType(e);if(t!==o.ZodParsedType.object){const t=this._getOrReturnCtx(e);(0,s.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.object,received:t.parsedType});return s.INVALID}const{status:r,ctx:i}=this._processInputParams(e);const{shape:n,keys:l}=this._getCached();const u=[];if(!(this._def.catchall instanceof ZodNever&&this._def.unknownKeys==="strip")){for(const e in i.data){if(!l.includes(e)){u.push(e)}}}const c=[];for(const e of l){const t=n[e];const r=i.data[e];c.push({key:{status:"valid",value:e},value:t._parse(new ParseInputLazyPath(i,r,i.path,e)),alwaysSet:e in i.data})}if(this._def.catchall instanceof ZodNever){const e=this._def.unknownKeys;if(e==="passthrough"){for(const e of u){c.push({key:{status:"valid",value:e},value:{status:"valid",value:i.data[e]}})}}else if(e==="strict"){if(u.length>0){(0,s.addIssueToContext)(i,{code:a.ZodIssueCode.unrecognized_keys,keys:u});r.dirty()}}else if(e==="strip"){}else{throw new Error(`Internal ZodObject error: invalid unknownKeys value.`)}}else{const e=this._def.catchall;for(const t of u){const r=i.data[t];c.push({key:{status:"valid",value:t},value:e._parse(new ParseInputLazyPath(i,r,i.path,t)),alwaysSet:t in i.data})}}if(i.common.async){return Promise.resolve().then((async()=>{const e=[];for(const t of c){const r=await t.key;e.push({key:r,value:await t.value,alwaysSet:t.alwaysSet})}return e})).then((e=>s.ParseStatus.mergeObjectSync(r,e)))}else{return s.ParseStatus.mergeObjectSync(r,c)}}get shape(){return this._def.shape()}strict(e){n.errorUtil.errToObj;return new ZodObject({...this._def,unknownKeys:"strict",...e!==undefined?{errorMap:(t,r)=>{var i,s,o,a;const l=(o=(s=(i=this._def).errorMap)===null||s===void 0?void 0:s.call(i,t,r).message)!==null&&o!==void 0?o:r.defaultError;if(t.code==="unrecognized_keys")return{message:(a=n.errorUtil.errToObj(e).message)!==null&&a!==void 0?a:l};return{message:l}}}:{}})}strip(){return new ZodObject({...this._def,unknownKeys:"strip"})}passthrough(){return new ZodObject({...this._def,unknownKeys:"passthrough"})}extend(e){return new ZodObject({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){const t=new ZodObject({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:y.ZodObject});return t}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ZodObject({...this._def,catchall:e})}pick(e){const t={};o.util.objectKeys(e).forEach((r=>{if(e[r]&&this.shape[r]){t[r]=this.shape[r]}}));return new ZodObject({...this._def,shape:()=>t})}omit(e){const t={};o.util.objectKeys(this.shape).forEach((r=>{if(!e[r]){t[r]=this.shape[r]}}));return new ZodObject({...this._def,shape:()=>t})}deepPartial(){return deepPartialify(this)}partial(e){const t={};o.util.objectKeys(this.shape).forEach((r=>{const i=this.shape[r];if(e&&!e[r]){t[r]=i}else{t[r]=i.optional()}}));return new ZodObject({...this._def,shape:()=>t})}required(e){const t={};o.util.objectKeys(this.shape).forEach((r=>{if(e&&!e[r]){t[r]=this.shape[r]}else{const e=this.shape[r];let i=e;while(i instanceof ZodOptional){i=i._def.innerType}t[r]=i}}));return new ZodObject({...this._def,shape:()=>t})}keyof(){return createZodEnum(o.util.objectKeys(this.shape))}}t.ZodObject=ZodObject;ZodObject.create=(e,t)=>new ZodObject({shape:()=>e,unknownKeys:"strip",catchall:ZodNever.create(),typeName:y.ZodObject,...processCreateParams(t)});ZodObject.strictCreate=(e,t)=>new ZodObject({shape:()=>e,unknownKeys:"strict",catchall:ZodNever.create(),typeName:y.ZodObject,...processCreateParams(t)});ZodObject.lazycreate=(e,t)=>new ZodObject({shape:e,unknownKeys:"strip",catchall:ZodNever.create(),typeName:y.ZodObject,...processCreateParams(t)});class ZodUnion extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e);const r=this._def.options;function handleResults(e){for(const t of e){if(t.result.status==="valid"){return t.result}}for(const r of e){if(r.result.status==="dirty"){t.common.issues.push(...r.ctx.common.issues);return r.result}}const r=e.map((e=>new a.ZodError(e.ctx.common.issues)));(0,s.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_union,unionErrors:r});return s.INVALID}if(t.common.async){return Promise.all(r.map((async e=>{const r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}}))).then(handleResults)}else{let e=undefined;const i=[];for(const n of r){const r={...t,common:{...t.common,issues:[]},parent:null};const s=n._parseSync({data:t.data,path:t.path,parent:r});if(s.status==="valid"){return s}else if(s.status==="dirty"&&!e){e={result:s,ctx:r}}if(r.common.issues.length){i.push(r.common.issues)}}if(e){t.common.issues.push(...e.ctx.common.issues);return e.result}const n=i.map((e=>new a.ZodError(e)));(0,s.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_union,unionErrors:n});return s.INVALID}}get options(){return this._def.options}}t.ZodUnion=ZodUnion;ZodUnion.create=(e,t)=>new ZodUnion({options:e,typeName:y.ZodUnion,...processCreateParams(t)});const getDiscriminator=e=>{if(e instanceof ZodLazy){return getDiscriminator(e.schema)}else if(e instanceof ZodEffects){return getDiscriminator(e.innerType())}else if(e instanceof ZodLiteral){return[e.value]}else if(e instanceof ZodEnum){return e.options}else if(e instanceof ZodNativeEnum){return Object.keys(e.enum)}else if(e instanceof ZodDefault){return getDiscriminator(e._def.innerType)}else if(e instanceof ZodUndefined){return[undefined]}else if(e instanceof ZodNull){return[null]}else{return null}};class ZodDiscriminatedUnion extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==o.ZodParsedType.object){(0,s.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.object,received:t.parsedType});return s.INVALID}const r=this.discriminator;const i=t.data[r];const n=this.optionsMap.get(i);if(!n){(0,s.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]});return s.INVALID}if(t.common.async){return n._parseAsync({data:t.data,path:t.path,parent:t})}else{return n._parseSync({data:t.data,path:t.path,parent:t})}}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){const i=new Map;for(const r of t){const t=getDiscriminator(r.shape[e]);if(!t){throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`)}for(const n of t){if(i.has(n)){throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(n)}`)}i.set(n,r)}}return new ZodDiscriminatedUnion({typeName:y.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...processCreateParams(r)})}}t.ZodDiscriminatedUnion=ZodDiscriminatedUnion;function mergeValues(e,t){const r=(0,o.getParsedType)(e);const i=(0,o.getParsedType)(t);if(e===t){return{valid:true,data:e}}else if(r===o.ZodParsedType.object&&i===o.ZodParsedType.object){const r=o.util.objectKeys(t);const i=o.util.objectKeys(e).filter((e=>r.indexOf(e)!==-1));const n={...e,...t};for(const r of i){const i=mergeValues(e[r],t[r]);if(!i.valid){return{valid:false}}n[r]=i.data}return{valid:true,data:n}}else if(r===o.ZodParsedType.array&&i===o.ZodParsedType.array){if(e.length!==t.length){return{valid:false}}const r=[];for(let i=0;i<e.length;i++){const n=e[i];const s=t[i];const o=mergeValues(n,s);if(!o.valid){return{valid:false}}r.push(o.data)}return{valid:true,data:r}}else if(r===o.ZodParsedType.date&&i===o.ZodParsedType.date&&+e===+t){return{valid:true,data:e}}else{return{valid:false}}}class ZodIntersection extends ZodType{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);const handleParsed=(e,i)=>{if((0,s.isAborted)(e)||(0,s.isAborted)(i)){return s.INVALID}const n=mergeValues(e.value,i.value);if(!n.valid){(0,s.addIssueToContext)(r,{code:a.ZodIssueCode.invalid_intersection_types});return s.INVALID}if((0,s.isDirty)(e)||(0,s.isDirty)(i)){t.dirty()}return{status:t.value,value:n.data}};if(r.common.async){return Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then((([e,t])=>handleParsed(e,t)))}else{return handleParsed(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}}t.ZodIntersection=ZodIntersection;ZodIntersection.create=(e,t,r)=>new ZodIntersection({left:e,right:t,typeName:y.ZodIntersection,...processCreateParams(r)});class ZodTuple extends ZodType{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==o.ZodParsedType.array){(0,s.addIssueToContext)(r,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.array,received:r.parsedType});return s.INVALID}if(r.data.length<this._def.items.length){(0,s.addIssueToContext)(r,{code:a.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:true,exact:false,type:"array"});return s.INVALID}const i=this._def.rest;if(!i&&r.data.length>this._def.items.length){(0,s.addIssueToContext)(r,{code:a.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:true,exact:false,type:"array"});t.dirty()}const n=[...r.data].map(((e,t)=>{const i=this._def.items[t]||this._def.rest;if(!i)return null;return i._parse(new ParseInputLazyPath(r,e,r.path,t))})).filter((e=>!!e));if(r.common.async){return Promise.all(n).then((e=>s.ParseStatus.mergeArray(t,e)))}else{return s.ParseStatus.mergeArray(t,n)}}get items(){return this._def.items}rest(e){return new ZodTuple({...this._def,rest:e})}}t.ZodTuple=ZodTuple;ZodTuple.create=(e,t)=>{if(!Array.isArray(e)){throw new Error("You must pass an array of schemas to z.tuple([ ... ])")}return new ZodTuple({items:e,typeName:y.ZodTuple,rest:null,...processCreateParams(t)})};class ZodRecord extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==o.ZodParsedType.object){(0,s.addIssueToContext)(r,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.object,received:r.parsedType});return s.INVALID}const i=[];const n=this._def.keyType;const l=this._def.valueType;for(const e in r.data){i.push({key:n._parse(new ParseInputLazyPath(r,e,r.path,e)),value:l._parse(new ParseInputLazyPath(r,r.data[e],r.path,e))})}if(r.common.async){return s.ParseStatus.mergeObjectAsync(t,i)}else{return s.ParseStatus.mergeObjectSync(t,i)}}get element(){return this._def.valueType}static create(e,t,r){if(t instanceof ZodType){return new ZodRecord({keyType:e,valueType:t,typeName:y.ZodRecord,...processCreateParams(r)})}return new ZodRecord({keyType:ZodString.create(),valueType:e,typeName:y.ZodRecord,...processCreateParams(t)})}}t.ZodRecord=ZodRecord;class ZodMap extends ZodType{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==o.ZodParsedType.map){(0,s.addIssueToContext)(r,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.map,received:r.parsedType});return s.INVALID}const i=this._def.keyType;const n=this._def.valueType;const l=[...r.data.entries()].map((([e,t],s)=>({key:i._parse(new ParseInputLazyPath(r,e,r.path,[s,"key"])),value:n._parse(new ParseInputLazyPath(r,t,r.path,[s,"value"]))})));if(r.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const r of l){const i=await r.key;const n=await r.value;if(i.status==="aborted"||n.status==="aborted"){return s.INVALID}if(i.status==="dirty"||n.status==="dirty"){t.dirty()}e.set(i.value,n.value)}return{status:t.value,value:e}}))}else{const e=new Map;for(const r of l){const i=r.key;const n=r.value;if(i.status==="aborted"||n.status==="aborted"){return s.INVALID}if(i.status==="dirty"||n.status==="dirty"){t.dirty()}e.set(i.value,n.value)}return{status:t.value,value:e}}}}t.ZodMap=ZodMap;ZodMap.create=(e,t,r)=>new ZodMap({valueType:t,keyType:e,typeName:y.ZodMap,...processCreateParams(r)});class ZodSet extends ZodType{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==o.ZodParsedType.set){(0,s.addIssueToContext)(r,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.set,received:r.parsedType});return s.INVALID}const i=this._def;if(i.minSize!==null){if(r.data.size<i.minSize.value){(0,s.addIssueToContext)(r,{code:a.ZodIssueCode.too_small,minimum:i.minSize.value,type:"set",inclusive:true,exact:false,message:i.minSize.message});t.dirty()}}if(i.maxSize!==null){if(r.data.size>i.maxSize.value){(0,s.addIssueToContext)(r,{code:a.ZodIssueCode.too_big,maximum:i.maxSize.value,type:"set",inclusive:true,exact:false,message:i.maxSize.message});t.dirty()}}const n=this._def.valueType;function finalizeSet(e){const r=new Set;for(const i of e){if(i.status==="aborted")return s.INVALID;if(i.status==="dirty")t.dirty();r.add(i.value)}return{status:t.value,value:r}}const l=[...r.data.values()].map(((e,t)=>n._parse(new ParseInputLazyPath(r,e,r.path,t))));if(r.common.async){return Promise.all(l).then((e=>finalizeSet(e)))}else{return finalizeSet(l)}}min(e,t){return new ZodSet({...this._def,minSize:{value:e,message:n.errorUtil.toString(t)}})}max(e,t){return new ZodSet({...this._def,maxSize:{value:e,message:n.errorUtil.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}t.ZodSet=ZodSet;ZodSet.create=(e,t)=>new ZodSet({valueType:e,minSize:null,maxSize:null,typeName:y.ZodSet,...processCreateParams(t)});class ZodFunction extends ZodType{constructor(){super(...arguments);this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==o.ZodParsedType.function){(0,s.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.function,received:t.parsedType});return s.INVALID}function makeArgsIssue(e,r){return(0,s.makeIssue)({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,(0,i.getErrorMap)(),i.defaultErrorMap].filter((e=>!!e)),issueData:{code:a.ZodIssueCode.invalid_arguments,argumentsError:r}})}function makeReturnsIssue(e,r){return(0,s.makeIssue)({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,(0,i.getErrorMap)(),i.defaultErrorMap].filter((e=>!!e)),issueData:{code:a.ZodIssueCode.invalid_return_type,returnTypeError:r}})}const r={errorMap:t.common.contextualErrorMap};const n=t.data;if(this._def.returns instanceof ZodPromise){return(0,s.OK)((async(...e)=>{const t=new a.ZodError([]);const i=await this._def.args.parseAsync(e,r).catch((r=>{t.addIssue(makeArgsIssue(e,r));throw t}));const s=await n(...i);const o=await this._def.returns._def.type.parseAsync(s,r).catch((e=>{t.addIssue(makeReturnsIssue(s,e));throw t}));return o}))}else{return(0,s.OK)(((...e)=>{const t=this._def.args.safeParse(e,r);if(!t.success){throw new a.ZodError([makeArgsIssue(e,t.error)])}const i=n(...t.data);const s=this._def.returns.safeParse(i,r);if(!s.success){throw new a.ZodError([makeReturnsIssue(i,s.error)])}return s.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ZodFunction({...this._def,args:ZodTuple.create(e).rest(ZodUnknown.create())})}returns(e){return new ZodFunction({...this._def,returns:e})}implement(e){const t=this.parse(e);return t}strictImplement(e){const t=this.parse(e);return t}static create(e,t,r){return new ZodFunction({args:e?e:ZodTuple.create([]).rest(ZodUnknown.create()),returns:t||ZodUnknown.create(),typeName:y.ZodFunction,...processCreateParams(r)})}}t.ZodFunction=ZodFunction;class ZodLazy extends ZodType{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);const r=this._def.getter();return r._parse({data:t.data,path:t.path,parent:t})}}t.ZodLazy=ZodLazy;ZodLazy.create=(e,t)=>new ZodLazy({getter:e,typeName:y.ZodLazy,...processCreateParams(t)});class ZodLiteral extends ZodType{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);(0,s.addIssueToContext)(t,{received:t.data,code:a.ZodIssueCode.invalid_literal,expected:this._def.value});return s.INVALID}return{status:"valid",value:e.data}}get value(){return this._def.value}}t.ZodLiteral=ZodLiteral;ZodLiteral.create=(e,t)=>new ZodLiteral({value:e,typeName:y.ZodLiteral,...processCreateParams(t)});function createZodEnum(e,t){return new ZodEnum({values:e,typeName:y.ZodEnum,...processCreateParams(t)})}class ZodEnum extends ZodType{_parse(e){if(typeof e.data!=="string"){const t=this._getOrReturnCtx(e);const r=this._def.values;(0,s.addIssueToContext)(t,{expected:o.util.joinValues(r),received:t.parsedType,code:a.ZodIssueCode.invalid_type});return s.INVALID}if(this._def.values.indexOf(e.data)===-1){const t=this._getOrReturnCtx(e);const r=this._def.values;(0,s.addIssueToContext)(t,{received:t.data,code:a.ZodIssueCode.invalid_enum_value,options:r});return s.INVALID}return(0,s.OK)(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values){e[t]=t}return e}get Values(){const e={};for(const t of this._def.values){e[t]=t}return e}get Enum(){const e={};for(const t of this._def.values){e[t]=t}return e}extract(e){return ZodEnum.create(e)}exclude(e){return ZodEnum.create(this.options.filter((t=>!e.includes(t))))}}t.ZodEnum=ZodEnum;ZodEnum.create=createZodEnum;class ZodNativeEnum extends ZodType{_parse(e){const t=o.util.getValidEnumValues(this._def.values);const r=this._getOrReturnCtx(e);if(r.parsedType!==o.ZodParsedType.string&&r.parsedType!==o.ZodParsedType.number){const e=o.util.objectValues(t);(0,s.addIssueToContext)(r,{expected:o.util.joinValues(e),received:r.parsedType,code:a.ZodIssueCode.invalid_type});return s.INVALID}if(t.indexOf(e.data)===-1){const e=o.util.objectValues(t);(0,s.addIssueToContext)(r,{received:r.data,code:a.ZodIssueCode.invalid_enum_value,options:e});return s.INVALID}return(0,s.OK)(e.data)}get enum(){return this._def.values}}t.ZodNativeEnum=ZodNativeEnum;ZodNativeEnum.create=(e,t)=>new ZodNativeEnum({values:e,typeName:y.ZodNativeEnum,...processCreateParams(t)});class ZodPromise extends ZodType{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==o.ZodParsedType.promise&&t.common.async===false){(0,s.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.promise,received:t.parsedType});return s.INVALID}const r=t.parsedType===o.ZodParsedType.promise?t.data:Promise.resolve(t.data);return(0,s.OK)(r.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}t.ZodPromise=ZodPromise;ZodPromise.create=(e,t)=>new ZodPromise({type:e,typeName:y.ZodPromise,...processCreateParams(t)});class ZodEffects extends ZodType{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===y.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);const i=this._def.effect||null;if(i.type==="preprocess"){const e=i.transform(r.data);if(r.common.async){return Promise.resolve(e).then((e=>this._def.schema._parseAsync({data:e,path:r.path,parent:r})))}else{return this._def.schema._parseSync({data:e,path:r.path,parent:r})}}const n={addIssue:e=>{(0,s.addIssueToContext)(r,e);if(e.fatal){t.abort()}else{t.dirty()}},get path(){return r.path}};n.addIssue=n.addIssue.bind(n);if(i.type==="refinement"){const executeRefinement=e=>{const t=i.refinement(e,n);if(r.common.async){return Promise.resolve(t)}if(t instanceof Promise){throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.")}return e};if(r.common.async===false){const e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(e.status==="aborted")return s.INVALID;if(e.status==="dirty")t.dirty();executeRefinement(e.value);return{status:t.value,value:e.value}}else{return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((e=>{if(e.status==="aborted")return s.INVALID;if(e.status==="dirty")t.dirty();return executeRefinement(e.value).then((()=>({status:t.value,value:e.value})))}))}}if(i.type==="transform"){if(r.common.async===false){const e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!(0,s.isValid)(e))return e;const o=i.transform(e.value,n);if(o instanceof Promise){throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`)}return{status:t.value,value:o}}else{return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((e=>{if(!(0,s.isValid)(e))return e;return Promise.resolve(i.transform(e.value,n)).then((e=>({status:t.value,value:e})))}))}}o.util.assertNever(i)}}t.ZodEffects=ZodEffects;t.ZodTransformer=ZodEffects;ZodEffects.create=(e,t,r)=>new ZodEffects({schema:e,typeName:y.ZodEffects,effect:t,...processCreateParams(r)});ZodEffects.createWithPreprocess=(e,t,r)=>new ZodEffects({schema:t,effect:{type:"preprocess",transform:e},typeName:y.ZodEffects,...processCreateParams(r)});class ZodOptional extends ZodType{_parse(e){const t=this._getType(e);if(t===o.ZodParsedType.undefined){return(0,s.OK)(undefined)}return this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}t.ZodOptional=ZodOptional;ZodOptional.create=(e,t)=>new ZodOptional({innerType:e,typeName:y.ZodOptional,...processCreateParams(t)});class ZodNullable extends ZodType{_parse(e){const t=this._getType(e);if(t===o.ZodParsedType.null){return(0,s.OK)(null)}return this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}t.ZodNullable=ZodNullable;ZodNullable.create=(e,t)=>new ZodNullable({innerType:e,typeName:y.ZodNullable,...processCreateParams(t)});class ZodDefault extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;if(t.parsedType===o.ZodParsedType.undefined){r=this._def.defaultValue()}return this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}t.ZodDefault=ZodDefault;ZodDefault.create=(e,t)=>new ZodDefault({innerType:e,typeName:y.ZodDefault,defaultValue:typeof t.default==="function"?t.default:()=>t.default,...processCreateParams(t)});class ZodCatch extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e);const r={...t,common:{...t.common,issues:[]}};const i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});if((0,s.isAsync)(i)){return i.then((e=>({status:"valid",value:e.status==="valid"?e.value:this._def.catchValue({get error(){return new a.ZodError(r.common.issues)},input:r.data})})))}else{return{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new a.ZodError(r.common.issues)},input:r.data})}}}removeCatch(){return this._def.innerType}}t.ZodCatch=ZodCatch;ZodCatch.create=(e,t)=>new ZodCatch({innerType:e,typeName:y.ZodCatch,catchValue:typeof t.catch==="function"?t.catch:()=>t.catch,...processCreateParams(t)});class ZodNaN extends ZodType{_parse(e){const t=this._getType(e);if(t!==o.ZodParsedType.nan){const t=this._getOrReturnCtx(e);(0,s.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.nan,received:t.parsedType});return s.INVALID}return{status:"valid",value:e.data}}}t.ZodNaN=ZodNaN;ZodNaN.create=e=>new ZodNaN({typeName:y.ZodNaN,...processCreateParams(e)});t.BRAND=Symbol("zod_brand");class ZodBranded extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e);const r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}t.ZodBranded=ZodBranded;class ZodPipeline extends ZodType{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.common.async){const handleAsync=async()=>{const e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});if(e.status==="aborted")return s.INVALID;if(e.status==="dirty"){t.dirty();return(0,s.DIRTY)(e.value)}else{return this._def.out._parseAsync({data:e.value,path:r.path,parent:r})}};return handleAsync()}else{const e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});if(e.status==="aborted")return s.INVALID;if(e.status==="dirty"){t.dirty();return{status:"dirty",value:e.value}}else{return this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}}static create(e,t){return new ZodPipeline({in:e,out:t,typeName:y.ZodPipeline})}}t.ZodPipeline=ZodPipeline;const custom=(e,t={},r)=>{if(e)return ZodAny.create().superRefine(((i,n)=>{var s,o;if(!e(i)){const e=typeof t==="function"?t(i):typeof t==="string"?{message:t}:t;const a=(o=(s=e.fatal)!==null&&s!==void 0?s:r)!==null&&o!==void 0?o:true;const l=typeof e==="string"?{message:e}:e;n.addIssue({code:"custom",...l,fatal:a})}}));return ZodAny.create()};t.custom=custom;t.late={object:ZodObject.lazycreate};var y;(function(e){e["ZodString"]="ZodString";e["ZodNumber"]="ZodNumber";e["ZodNaN"]="ZodNaN";e["ZodBigInt"]="ZodBigInt";e["ZodBoolean"]="ZodBoolean";e["ZodDate"]="ZodDate";e["ZodSymbol"]="ZodSymbol";e["ZodUndefined"]="ZodUndefined";e["ZodNull"]="ZodNull";e["ZodAny"]="ZodAny";e["ZodUnknown"]="ZodUnknown";e["ZodNever"]="ZodNever";e["ZodVoid"]="ZodVoid";e["ZodArray"]="ZodArray";e["ZodObject"]="ZodObject";e["ZodUnion"]="ZodUnion";e["ZodDiscriminatedUnion"]="ZodDiscriminatedUnion";e["ZodIntersection"]="ZodIntersection";e["ZodTuple"]="ZodTuple";e["ZodRecord"]="ZodRecord";e["ZodMap"]="ZodMap";e["ZodSet"]="ZodSet";e["ZodFunction"]="ZodFunction";e["ZodLazy"]="ZodLazy";e["ZodLiteral"]="ZodLiteral";e["ZodEnum"]="ZodEnum";e["ZodEffects"]="ZodEffects";e["ZodNativeEnum"]="ZodNativeEnum";e["ZodOptional"]="ZodOptional";e["ZodNullable"]="ZodNullable";e["ZodDefault"]="ZodDefault";e["ZodCatch"]="ZodCatch";e["ZodPromise"]="ZodPromise";e["ZodBranded"]="ZodBranded";e["ZodPipeline"]="ZodPipeline"})(y=t.ZodFirstPartyTypeKind||(t.ZodFirstPartyTypeKind={}));class Class{constructor(...e){}}const instanceOfType=(e,r={message:`Input not instance of ${e.name}`})=>(0,t.custom)((t=>t instanceof e),r);t["instanceof"]=instanceOfType;const _=ZodString.create;t.string=_;const v=ZodNumber.create;t.number=v;const b=ZodNaN.create;t.nan=b;const x=ZodBigInt.create;t.bigint=x;const T=ZodBoolean.create;t.boolean=T;const w=ZodDate.create;t.date=w;const S=ZodSymbol.create;t.symbol=S;const E=ZodUndefined.create;t.undefined=E;const A=ZodNull.create;t["null"]=A;const C=ZodAny.create;t.any=C;const N=ZodUnknown.create;t.unknown=N;const O=ZodNever.create;t.never=O;const R=ZodVoid.create;t["void"]=R;const k=ZodArray.create;t.array=k;const P=ZodObject.create;t.object=P;const L=ZodObject.strictCreate;t.strictObject=L;const I=ZodUnion.create;t.union=I;const M=ZodDiscriminatedUnion.create;t.discriminatedUnion=M;const D=ZodIntersection.create;t.intersection=D;const F=ZodTuple.create;t.tuple=F;const j=ZodRecord.create;t.record=j;const B=ZodMap.create;t.map=B;const U=ZodSet.create;t.set=U;const H=ZodFunction.create;t["function"]=H;const z=ZodLazy.create;t.lazy=z;const K=ZodLiteral.create;t.literal=K;const V=ZodEnum.create;t["enum"]=V;const q=ZodNativeEnum.create;t.nativeEnum=q;const Z=ZodPromise.create;t.promise=Z;const G=ZodEffects.create;t.effect=G;t.transformer=G;const $=ZodOptional.create;t.optional=$;const W=ZodNullable.create;t.nullable=W;const Y=ZodEffects.createWithPreprocess;t.preprocess=Y;const J=ZodPipeline.create;t.pipeline=J;const ostring=()=>_().optional();t.ostring=ostring;const onumber=()=>v().optional();t.onumber=onumber;const oboolean=()=>T().optional();t.oboolean=oboolean;t.coerce={string:e=>ZodString.create({...e,coerce:true}),number:e=>ZodNumber.create({...e,coerce:true}),boolean:e=>ZodBoolean.create({...e,coerce:true}),bigint:e=>ZodBigInt.create({...e,coerce:true}),date:e=>ZodDate.create({...e,coerce:true})};t.NEVER=s.INVALID},3718:function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){if(i===undefined)i=r;var n=Object.getOwnPropertyDescriptor(t,r);if(!n||("get"in n?!t.__esModule:n.writable||n.configurable)){n={enumerable:true,get:function(){return t[r]}}}Object.defineProperty(e,i,n)}:function(e,t,r,i){if(i===undefined)i=r;e[i]=t[r]});var n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t});var s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)if(r!=="default"&&Object.prototype.hasOwnProperty.call(e,r))i(t,e,r);n(t,e);return t};var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.getContructorABIFromSource=t.encodeContructorArguments=void 0;const a=o(r(9491));const l=r(3831);const u=r(3301);const c=s(r(4834));const encodeContructorArguments=(e,t)=>{if(t==null||t.length===0)return undefined;const r=e.flatMap((e=>{const t=h.safeParse(e);if(!t.success)return[];return[t.data]})).at(0);(0,a.default)(r!=null,`Missing constructor fragment`);const i=r.inputs.map((({type:e})=>e));const n=l.defaultAbiCoder.encode(i,t);return n.slice(2)};t.encodeContructorArguments=encodeContructorArguments;const getContructorABIFromSource=e=>{try{const t=c.parse(e);let r;c.visit(t,{FunctionDefinition:e=>{if(e.isConstructor)r=e}});(0,a.default)(r!=null,`Could not find constructor definition`);const i=[{type:"constructor",inputs:r.parameters.map((({typeName:e},t)=>{(0,a.default)(e!=null,`Missing a type definition for constructor parameter at position ${t}`);return{type:getTypeFromTypeName(e)}}))}];return i}catch(e){throw new Error(`Could not get an ABI from contract source: ${e}`)}};t.getContructorABIFromSource=getContructorABIFromSource;const getTypeFromTypeName=e=>{switch(e.type){case"ElementaryTypeName":return e.name;case"ArrayTypeName":return`${getTypeFromTypeName(e.baseTypeName)}[]`;default:throw new Error(`Only primitive and array types are currently supported when constructing ABI from contract source, got ${e.type}`)}};const h=u.z.object({inputs:u.z.array(u.z.object({type:u.z.string()})),type:u.z.literal("constructor")})},6348:function(e,t,r){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.parseNetworksConfig=void 0;const n=r(2413);const s=i(r(9491));const o=r(8989);const a=i(r(8818));const parseNetworksConfig=(e,t)=>Object.entries(t!==null&&t!==void 0?t:{}).reduce(((t,[r,i])=>{if(i==null)return t;const l=i.apiUrl||getScanApiUrlFromEnv(r)||(0,n.getDefaultScanApiUrl)(r);(0,s.default)(l,o.COLORS.error`Missing scan API URL for network ${o.COLORS.default(r)}
19
+ var i=r(4300);var n=i.Buffer;function copyProps(e,t){for(var r in e){t[r]=e[r]}}if(n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow){e.exports=i}else{copyProps(i,t);t.Buffer=SafeBuffer}function SafeBuffer(e,t,r){return n(e,t,r)}SafeBuffer.prototype=Object.create(n.prototype);copyProps(n,SafeBuffer);SafeBuffer.from=function(e,t,r){if(typeof e==="number"){throw new TypeError("Argument must not be a number")}return n(e,t,r)};SafeBuffer.alloc=function(e,t,r){if(typeof e!=="number"){throw new TypeError("Argument must be a number")}var i=n(e);if(t!==undefined){if(typeof r==="string"){i.fill(t,r)}else{i.fill(t)}}else{i.fill(0)}return i};SafeBuffer.allocUnsafe=function(e){if(typeof e!=="number"){throw new TypeError("Argument must be a number")}return n(e)};SafeBuffer.allocUnsafeSlow=function(e){if(typeof e!=="number"){throw new TypeError("Argument must be a number")}return i.SlowBuffer(e)}},7560:(e,t)=>{"use strict";const{hasOwnProperty:r}=Object.prototype;const i=configure();i.configure=configure;i.stringify=i;i.default=i;t.stringify=i;t.configure=configure;e.exports=i;const n=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?:[^\ud800-\udbff]|^)[\udc00-\udfff]/;function strEscape(e){if(e.length<5e3&&!n.test(e)){return`"${e}"`}return JSON.stringify(e)}function insertSort(e){if(e.length>200){return e.sort()}for(let t=1;t<e.length;t++){const r=e[t];let i=t;while(i!==0&&e[i-1]>r){e[i]=e[i-1];i--}e[i]=r}return e}const s=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function isTypedArrayWithEntries(e){return s.call(e)!==undefined&&e.length!==0}function stringifyTypedArray(e,t,r){if(e.length<r){r=e.length}const i=t===","?"":" ";let n=`"0":${i}${e[0]}`;for(let s=1;s<r;s++){n+=`${t}"${s}":${i}${e[s]}`}return n}function getCircularValueOption(e){if(r.call(e,"circularValue")){const t=e.circularValue;if(typeof t==="string"){return`"${t}"`}if(t==null){return t}if(t===Error||t===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 getBooleanOption(e,t){let i;if(r.call(e,t)){i=e[t];if(typeof i!=="boolean"){throw new TypeError(`The "${t}" argument must be of type boolean`)}}return i===undefined?true:i}function getPositiveIntegerOption(e,t){let i;if(r.call(e,t)){i=e[t];if(typeof i!=="number"){throw new TypeError(`The "${t}" argument must be of type number`)}if(!Number.isInteger(i)){throw new TypeError(`The "${t}" argument must be an integer`)}if(i<1){throw new RangeError(`The "${t}" argument must be >= 1`)}}return i===undefined?Infinity:i}function getItemCount(e){if(e===1){return"1 item"}return`${e} items`}function getUniqueReplacerSet(e){const t=new Set;for(const r of e){if(typeof r==="string"||typeof r==="number"){t.add(String(r))}}return t}function getStrictOption(e){if(r.call(e,"strict")){const t=e.strict;if(typeof t!=="boolean"){throw new TypeError('The "strict" argument must be of type boolean')}if(t){return e=>{let t=`Object can not safely be stringified. Received type ${typeof e}`;if(typeof e!=="function")t+=` (${e.toString()})`;throw new Error(t)}}}}function configure(e){e={...e};const t=getStrictOption(e);if(t){if(e.bigint===undefined){e.bigint=false}if(!("circularValue"in e)){e.circularValue=Error}}const r=getCircularValueOption(e);const i=getBooleanOption(e,"bigint");const n=getBooleanOption(e,"deterministic");const s=getPositiveIntegerOption(e,"maximumDepth");const o=getPositiveIntegerOption(e,"maximumBreadth");function stringifyFnReplacer(e,a,l,u,c,h){let d=a[e];if(typeof d==="object"&&d!==null&&typeof d.toJSON==="function"){d=d.toJSON(e)}d=u.call(a,e,d);switch(typeof d){case"string":return strEscape(d);case"object":{if(d===null){return"null"}if(l.indexOf(d)!==-1){return r}let e="";let t=",";const i=h;if(Array.isArray(d)){if(d.length===0){return"[]"}if(s<l.length+1){return'"[Array]"'}l.push(d);if(c!==""){h+=c;e+=`\n${h}`;t=`,\n${h}`}const r=Math.min(d.length,o);let n=0;for(;n<r-1;n++){const r=stringifyFnReplacer(String(n),d,l,u,c,h);e+=r!==undefined?r:"null";e+=t}const a=stringifyFnReplacer(String(n),d,l,u,c,h);e+=a!==undefined?a:"null";if(d.length-1>o){const r=d.length-o-1;e+=`${t}"... ${getItemCount(r)} not stringified"`}if(c!==""){e+=`\n${i}`}l.pop();return`[${e}]`}let a=Object.keys(d);const p=a.length;if(p===0){return"{}"}if(s<l.length+1){return'"[Object]"'}let m="";let g="";if(c!==""){h+=c;t=`,\n${h}`;m=" "}const y=Math.min(p,o);if(n&&!isTypedArrayWithEntries(d)){a=insertSort(a)}l.push(d);for(let r=0;r<y;r++){const i=a[r];const n=stringifyFnReplacer(i,d,l,u,c,h);if(n!==undefined){e+=`${g}${strEscape(i)}:${m}${n}`;g=t}}if(p>o){const r=p-o;e+=`${g}"...":${m}"${getItemCount(r)} not stringified"`;g=t}if(c!==""&&g.length>1){e=`\n${h}${e}\n${i}`}l.pop();return`{${e}}`}case"number":return isFinite(d)?String(d):t?t(d):"null";case"boolean":return d===true?"true":"false";case"undefined":return undefined;case"bigint":if(i){return String(d)}default:return t?t(d):undefined}}function stringifyArrayReplacer(e,n,a,l,u,c){if(typeof n==="object"&&n!==null&&typeof n.toJSON==="function"){n=n.toJSON(e)}switch(typeof n){case"string":return strEscape(n);case"object":{if(n===null){return"null"}if(a.indexOf(n)!==-1){return r}const e=c;let t="";let i=",";if(Array.isArray(n)){if(n.length===0){return"[]"}if(s<a.length+1){return'"[Array]"'}a.push(n);if(u!==""){c+=u;t+=`\n${c}`;i=`,\n${c}`}const r=Math.min(n.length,o);let h=0;for(;h<r-1;h++){const e=stringifyArrayReplacer(String(h),n[h],a,l,u,c);t+=e!==undefined?e:"null";t+=i}const d=stringifyArrayReplacer(String(h),n[h],a,l,u,c);t+=d!==undefined?d:"null";if(n.length-1>o){const e=n.length-o-1;t+=`${i}"... ${getItemCount(e)} not stringified"`}if(u!==""){t+=`\n${e}`}a.pop();return`[${t}]`}a.push(n);let h="";if(u!==""){c+=u;i=`,\n${c}`;h=" "}let d="";for(const e of l){const r=stringifyArrayReplacer(e,n[e],a,l,u,c);if(r!==undefined){t+=`${d}${strEscape(e)}:${h}${r}`;d=i}}if(u!==""&&d.length>1){t=`\n${c}${t}\n${e}`}a.pop();return`{${t}}`}case"number":return isFinite(n)?String(n):t?t(n):"null";case"boolean":return n===true?"true":"false";case"undefined":return undefined;case"bigint":if(i){return String(n)}default:return t?t(n):undefined}}function stringifyIndent(e,a,l,u,c){switch(typeof a){case"string":return strEscape(a);case"object":{if(a===null){return"null"}if(typeof a.toJSON==="function"){a=a.toJSON(e);if(typeof a!=="object"){return stringifyIndent(e,a,l,u,c)}if(a===null){return"null"}}if(l.indexOf(a)!==-1){return r}const t=c;if(Array.isArray(a)){if(a.length===0){return"[]"}if(s<l.length+1){return'"[Array]"'}l.push(a);c+=u;let e=`\n${c}`;const r=`,\n${c}`;const i=Math.min(a.length,o);let n=0;for(;n<i-1;n++){const t=stringifyIndent(String(n),a[n],l,u,c);e+=t!==undefined?t:"null";e+=r}const h=stringifyIndent(String(n),a[n],l,u,c);e+=h!==undefined?h:"null";if(a.length-1>o){const t=a.length-o-1;e+=`${r}"... ${getItemCount(t)} not stringified"`}e+=`\n${t}`;l.pop();return`[${e}]`}let i=Object.keys(a);const h=i.length;if(h===0){return"{}"}if(s<l.length+1){return'"[Object]"'}c+=u;const d=`,\n${c}`;let p="";let m="";let g=Math.min(h,o);if(isTypedArrayWithEntries(a)){p+=stringifyTypedArray(a,d,o);i=i.slice(a.length);g-=a.length;m=d}if(n){i=insertSort(i)}l.push(a);for(let e=0;e<g;e++){const t=i[e];const r=stringifyIndent(t,a[t],l,u,c);if(r!==undefined){p+=`${m}${strEscape(t)}: ${r}`;m=d}}if(h>o){const e=h-o;p+=`${m}"...": "${getItemCount(e)} not stringified"`;m=d}if(m!==""){p=`\n${c}${p}\n${t}`}l.pop();return`{${p}}`}case"number":return isFinite(a)?String(a):t?t(a):"null";case"boolean":return a===true?"true":"false";case"undefined":return undefined;case"bigint":if(i){return String(a)}default:return t?t(a):undefined}}function stringifySimple(e,a,l){switch(typeof a){case"string":return strEscape(a);case"object":{if(a===null){return"null"}if(typeof a.toJSON==="function"){a=a.toJSON(e);if(typeof a!=="object"){return stringifySimple(e,a,l)}if(a===null){return"null"}}if(l.indexOf(a)!==-1){return r}let t="";if(Array.isArray(a)){if(a.length===0){return"[]"}if(s<l.length+1){return'"[Array]"'}l.push(a);const e=Math.min(a.length,o);let r=0;for(;r<e-1;r++){const e=stringifySimple(String(r),a[r],l);t+=e!==undefined?e:"null";t+=","}const i=stringifySimple(String(r),a[r],l);t+=i!==undefined?i:"null";if(a.length-1>o){const e=a.length-o-1;t+=`,"... ${getItemCount(e)} not stringified"`}l.pop();return`[${t}]`}let i=Object.keys(a);const u=i.length;if(u===0){return"{}"}if(s<l.length+1){return'"[Object]"'}let c="";let h=Math.min(u,o);if(isTypedArrayWithEntries(a)){t+=stringifyTypedArray(a,",",o);i=i.slice(a.length);h-=a.length;c=","}if(n){i=insertSort(i)}l.push(a);for(let e=0;e<h;e++){const r=i[e];const n=stringifySimple(r,a[r],l);if(n!==undefined){t+=`${c}${strEscape(r)}:${n}`;c=","}}if(u>o){const e=u-o;t+=`${c}"...":"${getItemCount(e)} not stringified"`}l.pop();return`{${t}}`}case"number":return isFinite(a)?String(a):t?t(a):"null";case"boolean":return a===true?"true":"false";case"undefined":return undefined;case"bigint":if(i){return String(a)}default:return t?t(a):undefined}}function stringify(e,t,r){if(arguments.length>1){let i="";if(typeof r==="number"){i=" ".repeat(Math.min(r,10))}else if(typeof r==="string"){i=r.slice(0,10)}if(t!=null){if(typeof t==="function"){return stringifyFnReplacer("",{"":e},[],t,i,"")}if(Array.isArray(t)){return stringifyArrayReplacer("",e,[],getUniqueReplacerSet(t),i,"")}}if(i.length!==0){return stringifyIndent("",e,[],i,"")}}return stringifySimple("",e,[])}return stringify}},8679:(e,t,r)=>{"use strict";var i=r(8542);var n=Array.prototype.concat;var s=Array.prototype.slice;var o=e.exports=function swizzle(e){var t=[];for(var r=0,o=e.length;r<o;r++){var a=e[r];if(i(a)){t=n.call(t,s.call(a))}else{t.push(a)}}return t};o.wrap=function(e){return function(){return e(o(arguments))}}},8542:e=>{e.exports=function isArrayish(e){if(!e||typeof e==="string"){return false}return e instanceof Array||Array.isArray(e)||e.length>=0&&(e.splice instanceof Function||Object.getOwnPropertyDescriptor(e,e.length-1)&&e.constructor.name!=="String")}},5315:(e,t)=>{t.get=function(e){var r=Error.stackTraceLimit;Error.stackTraceLimit=Infinity;var i={};var n=Error.prepareStackTrace;Error.prepareStackTrace=function(e,t){return t};Error.captureStackTrace(i,e||t.get);var s=i.stack;Error.prepareStackTrace=n;Error.stackTraceLimit=r;return s};t.parse=function(e){if(!e.stack){return[]}var t=this;var r=e.stack.split("\n").slice(1);return r.map((function(e){if(e.match(/^\s*[-]{4,}$/)){return t._createParsedCallSite({fileName:e,lineNumber:null,functionName:null,typeName:null,methodName:null,columnNumber:null,native:null})}var r=e.match(/at (?:(.+)\s+\()?(?:(.+?):(\d+)(?::(\d+))?|([^)]+))\)?/);if(!r){return}var i=null;var n=null;var s=null;var o=null;var a=null;var l=r[5]==="native";if(r[1]){s=r[1];var u=s.lastIndexOf(".");if(s[u-1]==".")u--;if(u>0){i=s.substr(0,u);n=s.substr(u+1);var c=i.indexOf(".Module");if(c>0){s=s.substr(c+1);i=i.substr(0,c)}}o=null}if(n){o=i;a=n}if(n==="<anonymous>"){a=null;s=null}var h={fileName:r[2]||null,lineNumber:parseInt(r[3],10)||null,functionName:s,typeName:o,methodName:a,columnNumber:parseInt(r[4],10)||null,native:l};return t._createParsedCallSite(h)})).filter((function(e){return!!e}))};function CallSite(e){for(var t in e){this[t]=e[t]}}var r=["this","typeName","functionName","methodName","fileName","lineNumber","columnNumber","function","evalOrigin"];var i=["topLevel","eval","native","constructor"];r.forEach((function(e){CallSite.prototype[e]=null;CallSite.prototype["get"+e[0].toUpperCase()+e.substr(1)]=function(){return this[e]}}));i.forEach((function(e){CallSite.prototype[e]=false;CallSite.prototype["is"+e[0].toUpperCase()+e.substr(1)]=function(){return this[e]}}));t._createParsedCallSite=function(e){return new CallSite(e)}},4841:(e,t,r)=>{"use strict";var i=r(1867).Buffer;var n=i.isEncoding||function(e){e=""+e;switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return true;default:return false}};function _normalizeEncoding(e){if(!e)return"utf8";var t;while(true){switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase();t=true}}}function normalizeEncoding(e){var t=_normalizeEncoding(e);if(typeof t!=="string"&&(i.isEncoding===n||!n(e)))throw new Error("Unknown encoding: "+e);return t||e}t.s=StringDecoder;function StringDecoder(e){this.encoding=normalizeEncoding(e);var t;switch(this.encoding){case"utf16le":this.text=utf16Text;this.end=utf16End;t=4;break;case"utf8":this.fillLast=utf8FillLast;t=4;break;case"base64":this.text=base64Text;this.end=base64End;t=3;break;default:this.write=simpleWrite;this.end=simpleEnd;return}this.lastNeed=0;this.lastTotal=0;this.lastChar=i.allocUnsafe(t)}StringDecoder.prototype.write=function(e){if(e.length===0)return"";var t;var r;if(this.lastNeed){t=this.fillLast(e);if(t===undefined)return"";r=this.lastNeed;this.lastNeed=0}else{r=0}if(r<e.length)return t?t+this.text(e,r):this.text(e,r);return t||""};StringDecoder.prototype.end=utf8End;StringDecoder.prototype.text=utf8Text;StringDecoder.prototype.fillLast=function(e){if(this.lastNeed<=e.length){e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed);return this.lastChar.toString(this.encoding,0,this.lastTotal)}e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length);this.lastNeed-=e.length};function utf8CheckByte(e){if(e<=127)return 0;else if(e>>5===6)return 2;else if(e>>4===14)return 3;else if(e>>3===30)return 4;return e>>6===2?-1:-2}function utf8CheckIncomplete(e,t,r){var i=t.length-1;if(i<r)return 0;var n=utf8CheckByte(t[i]);if(n>=0){if(n>0)e.lastNeed=n-1;return n}if(--i<r||n===-2)return 0;n=utf8CheckByte(t[i]);if(n>=0){if(n>0)e.lastNeed=n-2;return n}if(--i<r||n===-2)return 0;n=utf8CheckByte(t[i]);if(n>=0){if(n>0){if(n===2)n=0;else e.lastNeed=n-3}return n}return 0}function utf8CheckExtraBytes(e,t,r){if((t[0]&192)!==128){e.lastNeed=0;return"�"}if(e.lastNeed>1&&t.length>1){if((t[1]&192)!==128){e.lastNeed=1;return"�"}if(e.lastNeed>2&&t.length>2){if((t[2]&192)!==128){e.lastNeed=2;return"�"}}}}function utf8FillLast(e){var t=this.lastTotal-this.lastNeed;var r=utf8CheckExtraBytes(this,e,t);if(r!==undefined)return r;if(this.lastNeed<=e.length){e.copy(this.lastChar,t,0,this.lastNeed);return this.lastChar.toString(this.encoding,0,this.lastTotal)}e.copy(this.lastChar,t,0,e.length);this.lastNeed-=e.length}function utf8Text(e,t){var r=utf8CheckIncomplete(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var i=e.length-(r-this.lastNeed);e.copy(this.lastChar,0,i);return e.toString("utf8",t,i)}function utf8End(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed)return t+"�";return t}function utf16Text(e,t){if((e.length-t)%2===0){var r=e.toString("utf16le",t);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319){this.lastNeed=2;this.lastTotal=4;this.lastChar[0]=e[e.length-2];this.lastChar[1]=e[e.length-1];return r.slice(0,-1)}}return r}this.lastNeed=1;this.lastTotal=2;this.lastChar[0]=e[e.length-1];return e.toString("utf16le",t,e.length-1)}function utf16End(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function base64Text(e,t){var r=(e.length-t)%3;if(r===0)return e.toString("base64",t);this.lastNeed=3-r;this.lastTotal=3;if(r===1){this.lastChar[0]=e[e.length-1]}else{this.lastChar[0]=e[e.length-2];this.lastChar[1]=e[e.length-1]}return e.toString("base64",t,e.length-r)}function base64End(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed)return t+this.lastChar.toString("base64",0,3-this.lastNeed);return t}function simpleWrite(e){return e.toString(this.encoding)}function simpleEnd(e){return e&&e.length?this.write(e):""}},9318:(e,t,r)=>{"use strict";const i=r(2037);const n=r(6224);const s=r(1621);const{env:o}=process;let a;if(s("no-color")||s("no-colors")||s("color=false")||s("color=never")){a=0}else if(s("color")||s("colors")||s("color=true")||s("color=always")){a=1}if("FORCE_COLOR"in o){if(o.FORCE_COLOR==="true"){a=1}else if(o.FORCE_COLOR==="false"){a=0}else{a=o.FORCE_COLOR.length===0?1:Math.min(parseInt(o.FORCE_COLOR,10),3)}}function translateLevel(e){if(e===0){return false}return{level:e,hasBasic:true,has256:e>=2,has16m:e>=3}}function supportsColor(e,t){if(a===0){return 0}if(s("color=16m")||s("color=full")||s("color=truecolor")){return 3}if(s("color=256")){return 2}if(e&&!t&&a===undefined){return 0}const r=a||0;if(o.TERM==="dumb"){return r}if(process.platform==="win32"){const e=i.release().split(".");if(Number(e[0])>=10&&Number(e[2])>=10586){return Number(e[2])>=14931?3:2}return 1}if("CI"in o){if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some((e=>e in o))||o.CI_NAME==="codeship"){return 1}return r}if("TEAMCITY_VERSION"in o){return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(o.TEAMCITY_VERSION)?1:0}if(o.COLORTERM==="truecolor"){return 3}if("TERM_PROGRAM"in o){const e=parseInt((o.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(o.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(o.TERM)){return 2}if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(o.TERM)){return 1}if("COLORTERM"in o){return 1}return r}function getSupportLevel(e){const t=supportsColor(e,e&&e.isTTY);return translateLevel(t)}e.exports={supportsColor:getSupportLevel,stdout:translateLevel(supportsColor(true,n.isatty(1))),stderr:translateLevel(supportsColor(true,n.isatty(2)))}},7014:e=>{"use strict";e.exports=function hex(e){for(var t=0,r=0;t<e.length;r=e.charCodeAt(t++)+((r<<5)-r));var i=Math.floor(Math.abs(Math.sin(r)*1e4%1*16777216)).toString(16);return"#"+Array(6-i.length+1).join("0")+i}},1416:(e,t)=>{"use strict";t.levels={error:0,warn:1,help:2,data:3,info:4,debug:5,prompt:6,verbose:7,input:8,silly:9};t.colors={error:"red",warn:"yellow",help:"cyan",data:"grey",info:"green",debug:"blue",prompt:"grey",verbose:"cyan",input:"grey",silly:"magenta"}},7113:(e,t,r)=>{"use strict";Object.defineProperty(t,"cli",{value:r(1416)});Object.defineProperty(t,"npm",{value:r(3568)});Object.defineProperty(t,"syslog",{value:r(6990)})},3568:(e,t)=>{"use strict";t.levels={error:0,warn:1,info:2,http:3,verbose:4,debug:5,silly:6};t.colors={error:"red",warn:"yellow",info:"green",http:"green",verbose:"cyan",debug:"blue",silly:"magenta"}},6990:(e,t)=>{"use strict";t.levels={emerg:0,alert:1,crit:2,error:3,warning:4,notice:5,info:6,debug:7};t.colors={emerg:"red",alert:"yellow",crit:"red",error:"red",warning:"red",notice:"yellow",info:"green",debug:"blue"}},3937:(e,t,r)=>{"use strict";Object.defineProperty(t,"LEVEL",{value:Symbol.for("level")});Object.defineProperty(t,"MESSAGE",{value:Symbol.for("message")});Object.defineProperty(t,"SPLAT",{value:Symbol.for("splat")});Object.defineProperty(t,"configs",{value:r(7113)})},5278:(e,t,r)=>{e.exports=r(3837).deprecate},7281:(e,t,r)=>{"use strict";const i=r(3837);const n=r(6993);const{LEVEL:s}=r(3937);const o=e.exports=function TransportStream(e={}){n.call(this,{objectMode:true,highWaterMark:e.highWaterMark});this.format=e.format;this.level=e.level;this.handleExceptions=e.handleExceptions;this.handleRejections=e.handleRejections;this.silent=e.silent;if(e.log)this.log=e.log;if(e.logv)this.logv=e.logv;if(e.close)this.close=e.close;this.once("pipe",(e=>{this.levels=e.levels;this.parent=e}));this.once("unpipe",(e=>{if(e===this.parent){this.parent=null;if(this.close){this.close()}}}))};i.inherits(o,n);o.prototype._write=function _write(e,t,r){if(this.silent||e.exception===true&&!this.handleExceptions){return r(null)}const i=this.level||this.parent&&this.parent.level;if(!i||this.levels[i]>=this.levels[e[s]]){if(e&&!this.format){return this.log(e,r)}let t;let i;try{i=this.format.transform(Object.assign({},e),this.format.options)}catch(e){t=e}if(t||!i){r();if(t)throw t;return}return this.log(i,r)}this._writableState.sync=false;return r(null)};o.prototype._writev=function _writev(e,t){if(this.logv){const r=e.filter(this._accept,this);if(!r.length){return t(null)}return this.logv(r,t)}for(let r=0;r<e.length;r++){if(!this._accept(e[r]))continue;if(e[r].chunk&&!this.format){this.log(e[r].chunk,e[r].callback);continue}let i;let n;try{n=this.format.transform(Object.assign({},e[r].chunk),this.format.options)}catch(e){i=e}if(i||!n){e[r].callback();if(i){t(null);throw i}}else{this.log(n,e[r].callback)}}return t(null)};o.prototype._accept=function _accept(e){const t=e.chunk;if(this.silent){return false}const r=this.level||this.parent&&this.parent.level;if(t.exception===true||!r||this.levels[r]>=this.levels[t[s]]){if(this.handleExceptions||t.exception!==true){return true}}return false};o.prototype._nop=function _nop(){return void undefined};e.exports.LegacyTransportStream=r(6201)},6201:(e,t,r)=>{"use strict";const i=r(3837);const{LEVEL:n}=r(3937);const s=r(7281);const o=e.exports=function LegacyTransportStream(e={}){s.call(this,e);if(!e.transport||typeof e.transport.log!=="function"){throw new Error("Invalid transport, must be an object with a log method.")}this.transport=e.transport;this.level=this.level||e.transport.level;this.handleExceptions=this.handleExceptions||e.transport.handleExceptions;this._deprecated();function transportError(e){this.emit("error",e,this.transport)}if(!this.transport.__winstonError){this.transport.__winstonError=transportError.bind(this);this.transport.on("error",this.transport.__winstonError)}};i.inherits(o,s);o.prototype._write=function _write(e,t,r){if(this.silent||e.exception===true&&!this.handleExceptions){return r(null)}if(!this.level||this.levels[this.level]>=this.levels[e[n]]){this.transport.log(e[n],e.message,e,this._nop)}r(null)};o.prototype._writev=function _writev(e,t){for(let t=0;t<e.length;t++){if(this._accept(e[t])){this.transport.log(e[t].chunk[n],e[t].chunk.message,e[t].chunk,this._nop);e[t].callback()}}return t(null)};o.prototype._deprecated=function _deprecated(){console.error([`${this.transport.name} is a legacy winston transport. Consider upgrading: `,"- Upgrade docs: https://github.com/winstonjs/winston/blob/master/UPGRADE-3.0.md"].join("\n"))};o.prototype.close=function close(){if(this.transport.close){this.transport.close()}if(this.transport.__winstonError){this.transport.removeListener("error",this.transport.__winstonError);this.transport.__winstonError=null}}},4158:(e,t,r)=>{"use strict";const i=r(2955);const{warn:n}=r(8043);t.version=r(2561).version;t.transports=r(7804);t.config=r(4325);t.addColors=i.levels;t.format=i.format;t.createLogger=r(2878);t.Logger=r(5234);t.ExceptionHandler=r(7891);t.RejectionHandler=r(1080);t.Container=r(7184);t.Transport=r(7281);t.loggers=new t.Container;const s=t.createLogger();Object.keys(t.config.npm.levels).concat(["log","query","stream","add","remove","clear","profile","startTimer","handleExceptions","unhandleExceptions","handleRejections","unhandleRejections","configure","child"]).forEach((e=>t[e]=(...t)=>s[e](...t)));Object.defineProperty(t,"level",{get(){return s.level},set(e){s.level=e}});Object.defineProperty(t,"exceptions",{get(){return s.exceptions}});["exitOnError"].forEach((e=>{Object.defineProperty(t,e,{get(){return s[e]},set(t){s[e]=t}})}));Object.defineProperty(t,"default",{get(){return{exceptionHandlers:s.exceptionHandlers,rejectionHandlers:s.rejectionHandlers,transports:s.transports}}});n.deprecated(t,"setLevels");n.forFunctions(t,"useFormat",["cli"]);n.forProperties(t,"useFormat",["padLevels","stripColors"]);n.forFunctions(t,"deprecated",["addRewriter","addFilter","clone","extend"]);n.forProperties(t,"deprecated",["emitErrs","levelLength"])},8043:(e,t,r)=>{"use strict";const{format:i}=r(3837);t.warn={deprecated(e){return()=>{throw new Error(i("{ %s } was removed in winston@3.0.0.",e))}},useFormat(e){return()=>{throw new Error([i("{ %s } was removed in winston@3.0.0.",e),"Use a custom winston.format = winston.format(function) instead."].join("\n"))}},forFunctions(e,r,i){i.forEach((i=>{e[i]=t.warn[r](i)}))},forProperties(e,r,i){i.forEach((i=>{const n=t.warn[r](i);Object.defineProperty(e,i,{get:n,set:n})}))}}},4325:(e,t,r)=>{"use strict";const i=r(2955);const{configs:n}=r(3937);t.cli=i.levels(n.cli);t.npm=i.levels(n.npm);t.syslog=i.levels(n.syslog);t.addColors=i.levels},7184:(e,t,r)=>{"use strict";const i=r(2878);e.exports=class Container{constructor(e={}){this.loggers=new Map;this.options=e}add(e,t){if(!this.loggers.has(e)){t=Object.assign({},t||this.options);const r=t.transports||this.options.transports;if(r){t.transports=Array.isArray(r)?r.slice():[r]}else{t.transports=[]}const n=i(t);n.on("close",(()=>this._delete(e)));this.loggers.set(e,n)}return this.loggers.get(e)}get(e,t){return this.add(e,t)}has(e){return!!this.loggers.has(e)}close(e){if(e){return this._removeLogger(e)}this.loggers.forEach(((e,t)=>this._removeLogger(t)))}_removeLogger(e){if(!this.loggers.has(e)){return}const t=this.loggers.get(e);t.close();this._delete(e)}_delete(e){this.loggers.delete(e)}}},2878:(e,t,r)=>{"use strict";const{LEVEL:i}=r(3937);const n=r(4325);const s=r(5234);const o=r(3170)("winston:create-logger");function isLevelEnabledFunctionName(e){return"is"+e.charAt(0).toUpperCase()+e.slice(1)+"Enabled"}e.exports=function(e={}){e.levels=e.levels||n.npm.levels;class DerivedLogger extends s{constructor(e){super(e)}}const t=new DerivedLogger(e);Object.keys(e.levels).forEach((function(e){o('Define prototype method for "%s"',e);if(e==="log"){console.warn('Level "log" not defined: conflicts with the method "log". Use a different level name.');return}DerivedLogger.prototype[e]=function(...r){const n=this||t;if(r.length===1){const[s]=r;const o=s&&s.message&&s||{message:s};o.level=o[i]=e;n._addDefaultMeta(o);n.write(o);return this||t}if(r.length===0){n.log(e,"");return n}return n.log(e,...r)};DerivedLogger.prototype[isLevelEnabledFunctionName(e)]=function(){return(this||t).isLevelEnabled(e)}}));return t}},7891:(e,t,r)=>{"use strict";const i=r(2037);const n=r(1216);const s=r(3170)("winston:exception");const o=r(4118);const a=r(5315);const l=r(6268);e.exports=class ExceptionHandler{constructor(e){if(!e){throw new Error("Logger is required to handle exceptions")}this.logger=e;this.handlers=new Map}handle(...e){e.forEach((e=>{if(Array.isArray(e)){return e.forEach((e=>this._addHandler(e)))}this._addHandler(e)}));if(!this.catcher){this.catcher=this._uncaughtException.bind(this);process.on("uncaughtException",this.catcher)}}unhandle(){if(this.catcher){process.removeListener("uncaughtException",this.catcher);this.catcher=false;Array.from(this.handlers.values()).forEach((e=>this.logger.unpipe(e)))}}getAllInfo(e){let t=null;if(e){t=typeof e==="string"?e:e.message}return{error:e,level:"error",message:[`uncaughtException: ${t||"(no error message)"}`,e&&e.stack||" No stack trace"].join("\n"),stack:e&&e.stack,exception:true,date:(new Date).toString(),process:this.getProcessInfo(),os:this.getOsInfo(),trace:this.getTrace(e)}}getProcessInfo(){return{pid:process.pid,uid:process.getuid?process.getuid():null,gid:process.getgid?process.getgid():null,cwd:process.cwd(),execPath:process.execPath,version:process.version,argv:process.argv,memoryUsage:process.memoryUsage()}}getOsInfo(){return{loadavg:i.loadavg(),uptime:i.uptime()}}getTrace(e){const t=e?a.parse(e):a.get();return t.map((e=>({column:e.getColumnNumber(),file:e.getFileName(),function:e.getFunctionName(),line:e.getLineNumber(),method:e.getMethodName(),native:e.isNative()})))}_addHandler(e){if(!this.handlers.has(e)){e.handleExceptions=true;const t=new l(e);this.handlers.set(e,t);this.logger.pipe(t)}}_uncaughtException(e){const t=this.getAllInfo(e);const r=this._getExceptionHandlers();let i=typeof this.logger.exitOnError==="function"?this.logger.exitOnError(e):this.logger.exitOnError;let a;if(!r.length&&i){console.warn("winston: exitOnError cannot be true with no exception handlers.");console.warn("winston: not exiting process.");i=false}function gracefulExit(){s("doExit",i);s("process._exiting",process._exiting);if(i&&!process._exiting){if(a){clearTimeout(a)}process.exit(1)}}if(!r||r.length===0){return process.nextTick(gracefulExit)}n(r,((e,t)=>{const r=o(t);const i=e.transport||e;function onDone(e){return()=>{s(e);r()}}i._ending=true;i.once("finish",onDone("finished"));i.once("error",onDone("error"))}),(()=>i&&gracefulExit()));this.logger.log(t);if(i){a=setTimeout(gracefulExit,3e3)}}_getExceptionHandlers(){return this.logger.transports.filter((e=>{const t=e.transport||e;return t.handleExceptions}))}}},6268:(e,t,r)=>{"use strict";const{Writable:i}=r(1642);e.exports=class ExceptionStream extends i{constructor(e){super({objectMode:true});if(!e){throw new Error("ExceptionStream requires a TransportStream instance.")}this.handleExceptions=true;this.transport=e}_write(e,t,r){if(e.exception){return this.transport.log(e,r)}r();return true}}},5234:(e,t,r)=>{"use strict";const{Stream:i,Transform:n}=r(1642);const s=r(1216);const{LEVEL:o,SPLAT:a}=r(3937);const l=r(1554);const u=r(7891);const c=r(1080);const h=r(6201);const d=r(6959);const{warn:p}=r(8043);const m=r(4325);const g=/%[scdjifoO%]/g;class Logger extends n{constructor(e){super({objectMode:true});this.configure(e)}child(e){const t=this;return Object.create(t,{write:{value:function(r){const i=Object.assign({},e,r);if(r instanceof Error){i.stack=r.stack;i.message=r.message}t.write(i)}}})}configure({silent:e,format:t,defaultMeta:i,levels:n,level:s="info",exitOnError:o=true,transports:a,colors:l,emitErrs:h,formatters:d,padLevels:p,rewriters:g,stripColors:y,exceptionHandlers:_,rejectionHandlers:v}={}){if(this.transports.length){this.clear()}this.silent=e;this.format=t||this.format||r(5669)();this.defaultMeta=i||null;this.levels=n||this.levels||m.npm.levels;this.level=s;if(this.exceptions){this.exceptions.unhandle()}if(this.rejections){this.rejections.unhandle()}this.exceptions=new u(this);this.rejections=new c(this);this.profilers={};this.exitOnError=o;if(a){a=Array.isArray(a)?a:[a];a.forEach((e=>this.add(e)))}if(l||h||d||p||g||y){throw new Error(["{ colors, emitErrs, formatters, padLevels, rewriters, stripColors } were removed in winston@3.0.0.","Use a custom winston.format(function) instead.","See: https://github.com/winstonjs/winston/tree/master/UPGRADE-3.0.md"].join("\n"))}if(_){this.exceptions.handle(_)}if(v){this.rejections.handle(v)}}isLevelEnabled(e){const t=getLevelValue(this.levels,e);if(t===null){return false}const r=getLevelValue(this.levels,this.level);if(r===null){return false}if(!this.transports||this.transports.length===0){return r>=t}const i=this.transports.findIndex((e=>{let i=getLevelValue(this.levels,e.level);if(i===null){i=r}return i>=t}));return i!==-1}log(e,t,...r){if(arguments.length===1){e[o]=e.level;this._addDefaultMeta(e);this.write(e);return this}if(arguments.length===2){if(t&&typeof t==="object"){t[o]=t.level=e;this._addDefaultMeta(t);this.write(t);return this}t={[o]:e,level:e,message:t};this._addDefaultMeta(t);this.write(t);return this}const[i]=r;if(typeof i==="object"&&i!==null){const n=t&&t.match&&t.match(g);if(!n){const n=Object.assign({},this.defaultMeta,i,{[o]:e,[a]:r,level:e,message:t});if(i.message)n.message=`${n.message} ${i.message}`;if(i.stack)n.stack=i.stack;this.write(n);return this}}this.write(Object.assign({},this.defaultMeta,{[o]:e,[a]:r,level:e,message:t}));return this}_transform(e,t,r){if(this.silent){return r()}if(!e[o]){e[o]=e.level}if(!this.levels[e[o]]&&this.levels[e[o]]!==0){console.error("[winston] Unknown logger level: %s",e[o])}if(!this._readableState.pipes){console.error("[winston] Attempt to write logs with no transports, which can increase memory usage: %j",e)}try{this.push(this.format.transform(e,this.format.options))}finally{this._writableState.sync=false;r()}}_final(e){const t=this.transports.slice();s(t,((e,t)=>{if(!e||e.finished)return setImmediate(t);e.once("finish",t);e.end()}),e)}add(e){const t=!l(e)||e.log.length>2?new h({transport:e}):e;if(!t._writableState||!t._writableState.objectMode){throw new Error("Transports must WritableStreams in objectMode. Set { objectMode: true }.")}this._onEvent("error",t);this._onEvent("warn",t);this.pipe(t);if(e.handleExceptions){this.exceptions.handle()}if(e.handleRejections){this.rejections.handle()}return this}remove(e){if(!e)return this;let t=e;if(!l(e)||e.log.length>2){t=this.transports.filter((t=>t.transport===e))[0]}if(t){this.unpipe(t)}return this}clear(){this.unpipe();return this}close(){this.exceptions.unhandle();this.rejections.unhandle();this.clear();this.emit("close");return this}setLevels(){p.deprecated("setLevels")}query(e,t){if(typeof e==="function"){t=e;e={}}e=e||{};const r={};const i=Object.assign({},e.query||{});function queryTransport(t,r){if(e.query&&typeof t.formatQuery==="function"){e.query=t.formatQuery(i)}t.query(e,((i,n)=>{if(i){return r(i)}if(typeof t.formatResults==="function"){n=t.formatResults(n,e.format)}r(null,n)}))}function addResults(e,t){queryTransport(e,((i,n)=>{if(t){n=i||n;if(n){r[e.name]=n}t()}t=null}))}s(this.transports.filter((e=>!!e.query)),addResults,(()=>t(null,r)))}stream(e={}){const t=new i;const r=[];t._streams=r;t.destroy=()=>{let e=r.length;while(e--){r[e].destroy()}};this.transports.filter((e=>!!e.stream)).forEach((i=>{const n=i.stream(e);if(!n){return}r.push(n);n.on("log",(e=>{e.transport=e.transport||[];e.transport.push(i.name);t.emit("log",e)}));n.on("error",(e=>{e.transport=e.transport||[];e.transport.push(i.name);t.emit("error",e)}))}));return t}startTimer(){return new d(this)}profile(e,...t){const r=Date.now();if(this.profilers[e]){const i=this.profilers[e];delete this.profilers[e];if(typeof t[t.length-2]==="function"){console.warn("Callback function no longer supported as of winston@3.0.0");t.pop()}const n=typeof t[t.length-1]==="object"?t.pop():{};n.level=n.level||"info";n.durationMs=r-i;n.message=n.message||e;return this.write(n)}this.profilers[e]=r;return this}handleExceptions(...e){console.warn("Deprecated: .handleExceptions() will be removed in winston@4. Use .exceptions.handle()");this.exceptions.handle(...e)}unhandleExceptions(...e){console.warn("Deprecated: .unhandleExceptions() will be removed in winston@4. Use .exceptions.unhandle()");this.exceptions.unhandle(...e)}cli(){throw new Error(["Logger.cli() was removed in winston@3.0.0","Use a custom winston.formats.cli() instead.","See: https://github.com/winstonjs/winston/tree/master/UPGRADE-3.0.md"].join("\n"))}_onEvent(e,t){function transportEvent(r){if(e==="error"&&!this.transports.includes(t)){this.add(t)}this.emit(e,r,t)}if(!t["__winston"+e]){t["__winston"+e]=transportEvent.bind(this);t.on(e,t["__winston"+e])}}_addDefaultMeta(e){if(this.defaultMeta){Object.assign(e,this.defaultMeta)}}}function getLevelValue(e,t){const r=e[t];if(!r&&r!==0){return null}return r}Object.defineProperty(Logger.prototype,"transports",{configurable:false,enumerable:true,get(){const{pipes:e}=this._readableState;return!Array.isArray(e)?[e].filter(Boolean):e}});e.exports=Logger},6959:e=>{"use strict";e.exports=class Profiler{constructor(e){if(!e){throw new Error("Logger is required for profiling.")}this.logger=e;this.start=Date.now()}done(...e){if(typeof e[e.length-1]==="function"){console.warn("Callback function no longer supported as of winston@3.0.0");e.pop()}const t=typeof e[e.length-1]==="object"?e.pop():{};t.level=t.level||"info";t.durationMs=Date.now()-this.start;return this.logger.write(t)}}},1080:(e,t,r)=>{"use strict";const i=r(2037);const n=r(1216);const s=r(3170)("winston:rejection");const o=r(4118);const a=r(5315);const l=r(6268);e.exports=class RejectionHandler{constructor(e){if(!e){throw new Error("Logger is required to handle rejections")}this.logger=e;this.handlers=new Map}handle(...e){e.forEach((e=>{if(Array.isArray(e)){return e.forEach((e=>this._addHandler(e)))}this._addHandler(e)}));if(!this.catcher){this.catcher=this._unhandledRejection.bind(this);process.on("unhandledRejection",this.catcher)}}unhandle(){if(this.catcher){process.removeListener("unhandledRejection",this.catcher);this.catcher=false;Array.from(this.handlers.values()).forEach((e=>this.logger.unpipe(e)))}}getAllInfo(e){let t=null;if(e){t=typeof e==="string"?e:e.message}return{error:e,level:"error",message:[`unhandledRejection: ${t||"(no error message)"}`,e&&e.stack||" No stack trace"].join("\n"),stack:e&&e.stack,exception:true,date:(new Date).toString(),process:this.getProcessInfo(),os:this.getOsInfo(),trace:this.getTrace(e)}}getProcessInfo(){return{pid:process.pid,uid:process.getuid?process.getuid():null,gid:process.getgid?process.getgid():null,cwd:process.cwd(),execPath:process.execPath,version:process.version,argv:process.argv,memoryUsage:process.memoryUsage()}}getOsInfo(){return{loadavg:i.loadavg(),uptime:i.uptime()}}getTrace(e){const t=e?a.parse(e):a.get();return t.map((e=>({column:e.getColumnNumber(),file:e.getFileName(),function:e.getFunctionName(),line:e.getLineNumber(),method:e.getMethodName(),native:e.isNative()})))}_addHandler(e){if(!this.handlers.has(e)){e.handleRejections=true;const t=new l(e);this.handlers.set(e,t);this.logger.pipe(t)}}_unhandledRejection(e){const t=this.getAllInfo(e);const r=this._getRejectionHandlers();let i=typeof this.logger.exitOnError==="function"?this.logger.exitOnError(e):this.logger.exitOnError;let a;if(!r.length&&i){console.warn("winston: exitOnError cannot be true with no rejection handlers.");console.warn("winston: not exiting process.");i=false}function gracefulExit(){s("doExit",i);s("process._exiting",process._exiting);if(i&&!process._exiting){if(a){clearTimeout(a)}process.exit(1)}}if(!r||r.length===0){return process.nextTick(gracefulExit)}n(r,((e,t)=>{const r=o(t);const i=e.transport||e;function onDone(e){return()=>{s(e);r()}}i._ending=true;i.once("finish",onDone("finished"));i.once("error",onDone("error"))}),(()=>i&&gracefulExit()));this.logger.log(t);if(i){a=setTimeout(gracefulExit,3e3)}}_getRejectionHandlers(){return this.logger.transports.filter((e=>{const t=e.transport||e;return t.handleRejections}))}}},1965:(e,t,r)=>{"use strict";const i=r(7147);const{StringDecoder:n}=r(1576);const{Stream:s}=r(1642);function noop(){}e.exports=(e,t)=>{const r=Buffer.alloc(64*1024);const o=new n("utf8");const a=new s;let l="";let u=0;let c=0;if(e.start===-1){delete e.start}a.readable=true;a.destroy=()=>{a.destroyed=true;a.emit("end");a.emit("close")};i.open(e.file,"a+","0644",((n,s)=>{if(n){if(!t){a.emit("error",n)}else{t(n)}a.destroy();return}(function read(){if(a.destroyed){i.close(s,noop);return}return i.read(s,r,0,r.length,u,((i,n)=>{if(i){if(!t){a.emit("error",i)}else{t(i)}a.destroy();return}if(!n){if(l){if(e.start==null||c>e.start){if(!t){a.emit("line",l)}else{t(null,l)}}c++;l=""}return setTimeout(read,1e3)}let s=o.write(r.slice(0,n));if(!t){a.emit("data",s)}s=(l+s).split(/\n+/);const h=s.length-1;let d=0;for(;d<h;d++){if(e.start==null||c>e.start){if(!t){a.emit("line",s[d])}else{t(null,s[d])}}c++}l=s[h];u+=n;return read()}))})()}));if(!t){return a}return a.destroy}},7501:(e,t,r)=>{"use strict";const i=r(2037);const{LEVEL:n,MESSAGE:s}=r(3937);const o=r(7281);e.exports=class Console extends o{constructor(e={}){super(e);this.name=e.name||"console";this.stderrLevels=this._stringArrayToSet(e.stderrLevels);this.consoleWarnLevels=this._stringArrayToSet(e.consoleWarnLevels);this.eol=typeof e.eol==="string"?e.eol:i.EOL;this.setMaxListeners(30)}log(e,t){setImmediate((()=>this.emit("logged",e)));if(this.stderrLevels[e[n]]){if(console._stderr){console._stderr.write(`${e[s]}${this.eol}`)}else{console.error(e[s])}if(t){t()}return}else if(this.consoleWarnLevels[e[n]]){if(console._stderr){console._stderr.write(`${e[s]}${this.eol}`)}else{console.warn(e[s])}if(t){t()}return}if(console._stdout){console._stdout.write(`${e[s]}${this.eol}`)}else{console.log(e[s])}if(t){t()}}_stringArrayToSet(e,t){if(!e)return{};t=t||"Cannot make set from type other than Array of string elements";if(!Array.isArray(e)){throw new Error(t)}return e.reduce(((e,r)=>{if(typeof r!=="string"){throw new Error(t)}e[r]=true;return e}),{})}}},2478:(e,t,r)=>{"use strict";const i=r(7147);const n=r(1017);const s=r(9619);const o=r(9796);const{MESSAGE:a}=r(3937);const{Stream:l,PassThrough:u}=r(1642);const c=r(7281);const h=r(3170)("winston:file");const d=r(2037);const p=r(1965);e.exports=class File extends c{constructor(e={}){super(e);this.name=e.name||"file";function throwIf(t,...r){r.slice(1).forEach((r=>{if(e[r]){throw new Error(`Cannot set ${r} and ${t} together`)}}))}this._stream=new u;this._stream.setMaxListeners(30);this._onError=this._onError.bind(this);if(e.filename||e.dirname){throwIf("filename or dirname","stream");this._basename=this.filename=e.filename?n.basename(e.filename):"winston.log";this.dirname=e.dirname||n.dirname(e.filename);this.options=e.options||{flags:"a"}}else if(e.stream){console.warn("options.stream will be removed in winston@4. Use winston.transports.Stream");throwIf("stream","filename","maxsize");this._dest=this._stream.pipe(this._setupStream(e.stream));this.dirname=n.dirname(this._dest.path)}else{throw new Error("Cannot log to file without filename or stream.")}this.maxsize=e.maxsize||null;this.rotationFormat=e.rotationFormat||false;this.zippedArchive=e.zippedArchive||false;this.maxFiles=e.maxFiles||null;this.eol=typeof e.eol==="string"?e.eol:d.EOL;this.tailable=e.tailable||false;this.lazy=e.lazy||false;this._size=0;this._pendingSize=0;this._created=0;this._drain=false;this._opening=false;this._ending=false;this._fileExist=false;if(this.dirname)this._createLogDirIfNotExist(this.dirname);if(!this.lazy)this.open()}finishIfEnding(){if(this._ending){if(this._opening){this.once("open",(()=>{this._stream.once("finish",(()=>this.emit("finish")));setImmediate((()=>this._stream.end()))}))}else{this._stream.once("finish",(()=>this.emit("finish")));setImmediate((()=>this._stream.end()))}}}log(e,t=(()=>{})){if(this.silent){t();return true}if(this._drain){this._stream.once("drain",(()=>{this._drain=false;this.log(e,t)}));return}if(this._rotate){this._stream.once("rotate",(()=>{this._rotate=false;this.log(e,t)}));return}if(this.lazy){if(!this._fileExist){if(!this._opening){this.open()}this.once("open",(()=>{this._fileExist=true;this.log(e,t);return}));return}if(this._needsNewFile(this._pendingSize)){this._dest.once("close",(()=>{if(!this._opening){this.open()}this.once("open",(()=>{this.log(e,t);return}));return}));return}}const r=`${e[a]}${this.eol}`;const i=Buffer.byteLength(r);function logged(){this._size+=i;this._pendingSize-=i;h("logged %s %s",this._size,r);this.emit("logged",e);if(this._rotate){return}if(this._opening){return}if(!this._needsNewFile()){return}if(this.lazy){this._endStream((()=>{this.emit("fileclosed")}));return}this._rotate=true;this._endStream((()=>this._rotateFile()))}this._pendingSize+=i;if(this._opening&&!this.rotatedWhileOpening&&this._needsNewFile(this._size+this._pendingSize)){this.rotatedWhileOpening=true}const n=this._stream.write(r,logged.bind(this));if(!n){this._drain=true;this._stream.once("drain",(()=>{this._drain=false;t()}))}else{t()}h("written",n,this._drain);this.finishIfEnding();return n}query(e,t){if(typeof e==="function"){t=e;e={}}e=normalizeQuery(e);const r=n.join(this.dirname,this.filename);let s="";let o=[];let a=0;const l=i.createReadStream(r,{encoding:"utf8"});l.on("error",(e=>{if(l.readable){l.destroy()}if(!t){return}return e.code!=="ENOENT"?t(e):t(null,o)}));l.on("data",(t=>{t=(s+t).split(/\n+/);const r=t.length-1;let i=0;for(;i<r;i++){if(!e.start||a>=e.start){add(t[i])}a++}s=t[r]}));l.on("close",(()=>{if(s){add(s,true)}if(e.order==="desc"){o=o.reverse()}if(t)t(null,o)}));function add(e,t){try{const t=JSON.parse(e);if(check(t)){push(t)}}catch(e){if(!t){l.emit("error",e)}}}function push(t){if(e.rows&&o.length>=e.rows&&e.order!=="desc"){if(l.readable){l.destroy()}return}if(e.fields){t=e.fields.reduce(((e,r)=>{e[r]=t[r];return e}),{})}if(e.order==="desc"){if(o.length>=e.rows){o.shift()}}o.push(t)}function check(t){if(!t){return}if(typeof t!=="object"){return}const r=new Date(t.timestamp);if(e.from&&r<e.from||e.until&&r>e.until||e.level&&e.level!==t.level){return}return true}function normalizeQuery(e){e=e||{};e.rows=e.rows||e.limit||10;e.start=e.start||0;e.until=e.until||new Date;if(typeof e.until!=="object"){e.until=new Date(e.until)}e.from=e.from||e.until-24*60*60*1e3;if(typeof e.from!=="object"){e.from=new Date(e.from)}e.order=e.order||"desc";return e}}stream(e={}){const t=n.join(this.dirname,this.filename);const r=new l;const i={file:t,start:e.start};r.destroy=p(i,((e,t)=>{if(e){return r.emit("error",e)}try{r.emit("data",t);t=JSON.parse(t);r.emit("log",t)}catch(e){r.emit("error",e)}}));return r}open(){if(!this.filename)return;if(this._opening)return;this._opening=true;this.stat(((e,t)=>{if(e){return this.emit("error",e)}h("stat done: %s { size: %s }",this.filename,t);this._size=t;this._dest=this._createStream(this._stream);this._opening=false;this.once("open",(()=>{if(this._stream.eventNames().includes("rotate")){this._stream.emit("rotate")}else{this._rotate=false}}))}))}stat(e){const t=this._getFile();const r=n.join(this.dirname,t);i.stat(r,((i,n)=>{if(i&&i.code==="ENOENT"){h("ENOENT ok",r);this.filename=t;return e(null,0)}if(i){h(`err ${i.code} ${r}`);return e(i)}if(!n||this._needsNewFile(n.size)){return this._incFile((()=>this.stat(e)))}this.filename=t;e(null,n.size)}))}close(e){if(!this._stream){return}this._stream.end((()=>{if(e){e()}this.emit("flush");this.emit("closed")}))}_needsNewFile(e){e=e||this._size;return this.maxsize&&e>=this.maxsize}_onError(e){this.emit("error",e)}_setupStream(e){e.on("error",this._onError);return e}_cleanupStream(e){e.removeListener("error",this._onError);e.destroy();return e}_rotateFile(){this._incFile((()=>this.open()))}_endStream(e=(()=>{})){if(this._dest){this._stream.unpipe(this._dest);this._dest.end((()=>{this._cleanupStream(this._dest);e()}))}else{e()}}_createStream(e){const t=n.join(this.dirname,this.filename);h("create stream start",t,this.options);const r=i.createWriteStream(t,this.options).on("error",(e=>h(e))).on("close",(()=>h("close",r.path,r.bytesWritten))).on("open",(()=>{h("file open ok",t);this.emit("open",t);e.pipe(r);if(this.rotatedWhileOpening){this._stream=new u;this._stream.setMaxListeners(30);this._rotateFile();this.rotatedWhileOpening=false;this._cleanupStream(r);e.end()}}));h("create stream ok",t);if(this.zippedArchive){const e=o.createGzip();e.pipe(r);return e}return r}_incFile(e){h("_incFile",this.filename);const t=n.extname(this._basename);const r=n.basename(this._basename,t);if(!this.tailable){this._created+=1;this._checkMaxFilesIncrementing(t,r,e)}else{this._checkMaxFilesTailable(t,r,e)}}_getFile(){const e=n.extname(this._basename);const t=n.basename(this._basename,e);const r=this.rotationFormat?this.rotationFormat():this._created;const i=!this.tailable&&this._created?`${t}${r}${e}`:`${t}${e}`;return this.zippedArchive&&!this.tailable?`${i}.gz`:i}_checkMaxFilesIncrementing(e,t,r){if(!this.maxFiles||this._created<this.maxFiles){return setImmediate(r)}const s=this._created-this.maxFiles;const o=s!==0?s:"";const a=this.zippedArchive?".gz":"";const l=`${t}${o}${e}${a}`;const u=n.join(this.dirname,l);i.unlink(u,r)}_checkMaxFilesTailable(e,t,r){const o=[];if(!this.maxFiles){return}const a=this.zippedArchive?".gz":"";for(let r=this.maxFiles-1;r>1;r--){o.push(function(r,s){let o=`${t}${r-1}${e}${a}`;const l=n.join(this.dirname,o);i.exists(l,(u=>{if(!u){return s(null)}o=`${t}${r}${e}${a}`;i.rename(l,n.join(this.dirname,o),s)}))}.bind(this,r))}s(o,(()=>{i.rename(n.join(this.dirname,`${t}${e}`),n.join(this.dirname,`${t}1${e}${a}`),r)}))}_createLogDirIfNotExist(e){if(!i.existsSync(e)){i.mkdirSync(e,{recursive:true})}}}},8028:(e,t,r)=>{"use strict";const i=r(3685);const n=r(5687);const{Stream:s}=r(1642);const o=r(7281);const a=r(7560);e.exports=class Http extends o{constructor(e={}){super(e);this.options=e;this.name=e.name||"http";this.ssl=!!e.ssl;this.host=e.host||"localhost";this.port=e.port;this.auth=e.auth;this.path=e.path||"";this.agent=e.agent;this.headers=e.headers||{};this.headers["content-type"]="application/json";this.batch=e.batch||false;this.batchInterval=e.batchInterval||5e3;this.batchCount=e.batchCount||10;this.batchOptions=[];this.batchTimeoutID=-1;this.batchCallback={};if(!this.port){this.port=this.ssl?443:80}}log(e,t){this._request(e,null,null,((t,r)=>{if(r&&r.statusCode!==200){t=new Error(`Invalid HTTP Status Code: ${r.statusCode}`)}if(t){this.emit("warn",t)}else{this.emit("logged",e)}}));if(t){setImmediate(t)}}query(e,t){if(typeof e==="function"){t=e;e={}}e={method:"query",params:this.normalizeQuery(e)};const r=e.params.auth||null;delete e.params.auth;const i=e.params.path||null;delete e.params.path;this._request(e,r,i,((e,r,i)=>{if(r&&r.statusCode!==200){e=new Error(`Invalid HTTP Status Code: ${r.statusCode}`)}if(e){return t(e)}if(typeof i==="string"){try{i=JSON.parse(i)}catch(e){return t(e)}}t(null,i)}))}stream(e={}){const t=new s;e={method:"stream",params:e};const r=e.params.path||null;delete e.params.path;const i=e.params.auth||null;delete e.params.auth;let n="";const o=this._request(e,i,r);t.destroy=()=>o.destroy();o.on("data",(e=>{e=(n+e).split(/\n+/);const r=e.length-1;let i=0;for(;i<r;i++){try{t.emit("log",JSON.parse(e[i]))}catch(e){t.emit("error",e)}}n=e[r]}));o.on("error",(e=>t.emit("error",e)));return t}_request(e,t,r,i){e=e||{};t=t||this.auth;r=r||this.path||"";if(this.batch){this._doBatch(e,i,t,r)}else{this._doRequest(e,i,t,r)}}_doBatch(e,t,r,i){this.batchOptions.push(e);if(this.batchOptions.length===1){const e=this;this.batchCallback=t;this.batchTimeoutID=setTimeout((function(){e.batchTimeoutID=-1;e._doBatchRequest(e.batchCallback,r,i)}),this.batchInterval)}if(this.batchOptions.length===this.batchCount){this._doBatchRequest(this.batchCallback,r,i)}}_doBatchRequest(e,t,r){if(this.batchTimeoutID>0){clearTimeout(this.batchTimeoutID);this.batchTimeoutID=-1}const i=this.batchOptions.slice();this.batchOptions=[];this._doRequest(i,e,t,r)}_doRequest(e,t,r,s){const o=Object.assign({},this.headers);if(r&&r.bearer){o.Authorization=`Bearer ${r.bearer}`}const l=(this.ssl?n:i).request({...this.options,method:"POST",host:this.host,port:this.port,path:`/${s.replace(/^\//,"")}`,headers:o,auth:r&&r.username&&r.password?`${r.username}:${r.password}`:"",agent:this.agent});l.on("error",t);l.on("response",(e=>e.on("end",(()=>t(null,e))).resume()));l.end(Buffer.from(a(e,this.options.replacer),"utf8"))}}},7804:(e,t,r)=>{"use strict";Object.defineProperty(t,"Console",{configurable:true,enumerable:true,get(){return r(7501)}});Object.defineProperty(t,"File",{configurable:true,enumerable:true,get(){return r(2478)}});Object.defineProperty(t,"Http",{configurable:true,enumerable:true,get(){return r(8028)}});Object.defineProperty(t,"Stream",{configurable:true,enumerable:true,get(){return r(4747)}})},4747:(e,t,r)=>{"use strict";const i=r(1554);const{MESSAGE:n}=r(3937);const s=r(2037);const o=r(7281);e.exports=class Stream extends o{constructor(e={}){super(e);if(!e.stream||!i(e.stream)){throw new Error("options.stream is required.")}this._stream=e.stream;this._stream.setMaxListeners(Infinity);this.isObjectMode=e.stream._writableState.objectMode;this.eol=typeof e.eol==="string"?e.eol:s.EOL}log(e,t){setImmediate((()=>this.emit("logged",e)));if(this.isObjectMode){this._stream.write(e);if(t){t()}return}this._stream.write(`${e[n]}${this.eol}`);if(t){t()}return}}},9892:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.ZodError=t.quotelessJson=t.ZodIssueCode=void 0;const i=r(3985);t.ZodIssueCode=i.util.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"]);const quotelessJson=e=>{const t=JSON.stringify(e,null,2);return t.replace(/"([^"]+)":/g,"$1:")};t.quotelessJson=quotelessJson;class ZodError extends Error{constructor(e){super();this.issues=[];this.addIssue=e=>{this.issues=[...this.issues,e]};this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;if(Object.setPrototypeOf){Object.setPrototypeOf(this,t)}else{this.__proto__=t}this.name="ZodError";this.issues=e}get errors(){return this.issues}format(e){const t=e||function(e){return e.message};const r={_errors:[]};const processError=e=>{for(const i of e.issues){if(i.code==="invalid_union"){i.unionErrors.map(processError)}else if(i.code==="invalid_return_type"){processError(i.returnTypeError)}else if(i.code==="invalid_arguments"){processError(i.argumentsError)}else if(i.path.length===0){r._errors.push(t(i))}else{let e=r;let n=0;while(n<i.path.length){const r=i.path[n];const s=n===i.path.length-1;if(!s){e[r]=e[r]||{_errors:[]}}else{e[r]=e[r]||{_errors:[]};e[r]._errors.push(t(i))}e=e[r];n++}}}};processError(this);return r}toString(){return this.message}get message(){return JSON.stringify(this.issues,i.util.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=(e=>e.message)){const t={};const r=[];for(const i of this.issues){if(i.path.length>0){t[i.path[0]]=t[i.path[0]]||[];t[i.path[0]].push(e(i))}else{r.push(e(i))}}return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}t.ZodError=ZodError;ZodError.create=e=>{const t=new ZodError(e);return t}},9566:function(e,t,r){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.getErrorMap=t.setErrorMap=t.defaultErrorMap=void 0;const n=i(r(468));t.defaultErrorMap=n.default;let s=n.default;function setErrorMap(e){s=e}t.setErrorMap=setErrorMap;function getErrorMap(){return s}t.getErrorMap=getErrorMap},9906:function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){if(i===undefined)i=r;Object.defineProperty(e,i,{enumerable:true,get:function(){return t[r]}})}:function(e,t,r,i){if(i===undefined)i=r;e[i]=t[r]});var n=this&&this.__exportStar||function(e,t){for(var r in e)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r))i(t,e,r)};Object.defineProperty(t,"__esModule",{value:true});n(r(9566),t);n(r(888),t);n(r(9449),t);n(r(3985),t);n(r(9335),t);n(r(9892),t)},2513:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.errorUtil=void 0;var r;(function(e){e.errToObj=e=>typeof e==="string"?{message:e}:e||{};e.toString=e=>typeof e==="string"?e:e===null||e===void 0?void 0:e.message})(r=t.errorUtil||(t.errorUtil={}))},888:function(e,t,r){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.isAsync=t.isValid=t.isDirty=t.isAborted=t.OK=t.DIRTY=t.INVALID=t.ParseStatus=t.addIssueToContext=t.EMPTY_PATH=t.makeIssue=void 0;const n=r(9566);const s=i(r(468));const makeIssue=e=>{const{data:t,path:r,errorMaps:i,issueData:n}=e;const s=[...r,...n.path||[]];const o={...n,path:s};let a="";const l=i.filter((e=>!!e)).slice().reverse();for(const e of l){a=e(o,{data:t,defaultError:a}).message}return{...n,path:s,message:n.message||a}};t.makeIssue=makeIssue;t.EMPTY_PATH=[];function addIssueToContext(e,r){const i=(0,t.makeIssue)({issueData:r,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,(0,n.getErrorMap)(),s.default].filter((e=>!!e))});e.common.issues.push(i)}t.addIssueToContext=addIssueToContext;class ParseStatus{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(e,r){const i=[];for(const n of r){if(n.status==="aborted")return t.INVALID;if(n.status==="dirty")e.dirty();i.push(n.value)}return{status:e.value,value:i}}static async mergeObjectAsync(e,t){const r=[];for(const e of t){r.push({key:await e.key,value:await e.value})}return ParseStatus.mergeObjectSync(e,r)}static mergeObjectSync(e,r){const i={};for(const n of r){const{key:r,value:s}=n;if(r.status==="aborted")return t.INVALID;if(s.status==="aborted")return t.INVALID;if(r.status==="dirty")e.dirty();if(s.status==="dirty")e.dirty();if(typeof s.value!=="undefined"||n.alwaysSet){i[r.value]=s.value}}return{status:e.value,value:i}}}t.ParseStatus=ParseStatus;t.INVALID=Object.freeze({status:"aborted"});const DIRTY=e=>({status:"dirty",value:e});t.DIRTY=DIRTY;const OK=e=>({status:"valid",value:e});t.OK=OK;const isAborted=e=>e.status==="aborted";t.isAborted=isAborted;const isDirty=e=>e.status==="dirty";t.isDirty=isDirty;const isValid=e=>e.status==="valid";t.isValid=isValid;const isAsync=e=>typeof Promise!=="undefined"&&e instanceof Promise;t.isAsync=isAsync},9449:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true})},3985:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.getParsedType=t.ZodParsedType=t.objectUtil=t.util=void 0;var r;(function(e){e.assertEqual=e=>e;function assertIs(e){}e.assertIs=assertIs;function assertNever(e){throw new Error}e.assertNever=assertNever;e.arrayToEnum=e=>{const t={};for(const r of e){t[r]=r}return t};e.getValidEnumValues=t=>{const r=e.objectKeys(t).filter((e=>typeof t[t[e]]!=="number"));const i={};for(const e of r){i[e]=t[e]}return e.objectValues(i)};e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]}));e.objectKeys=typeof Object.keys==="function"?e=>Object.keys(e):e=>{const t=[];for(const r in e){if(Object.prototype.hasOwnProperty.call(e,r)){t.push(r)}}return t};e.find=(e,t)=>{for(const r of e){if(t(r))return r}return undefined};e.isInteger=typeof Number.isInteger==="function"?e=>Number.isInteger(e):e=>typeof e==="number"&&isFinite(e)&&Math.floor(e)===e;function joinValues(e,t=" | "){return e.map((e=>typeof e==="string"?`'${e}'`:e)).join(t)}e.joinValues=joinValues;e.jsonStringifyReplacer=(e,t)=>{if(typeof t==="bigint"){return t.toString()}return t}})(r=t.util||(t.util={}));var i;(function(e){e.mergeShapes=(e,t)=>({...e,...t})})(i=t.objectUtil||(t.objectUtil={}));t.ZodParsedType=r.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);const getParsedType=e=>{const r=typeof e;switch(r){case"undefined":return t.ZodParsedType.undefined;case"string":return t.ZodParsedType.string;case"number":return isNaN(e)?t.ZodParsedType.nan:t.ZodParsedType.number;case"boolean":return t.ZodParsedType.boolean;case"function":return t.ZodParsedType.function;case"bigint":return t.ZodParsedType.bigint;case"symbol":return t.ZodParsedType.symbol;case"object":if(Array.isArray(e)){return t.ZodParsedType.array}if(e===null){return t.ZodParsedType.null}if(e.then&&typeof e.then==="function"&&e.catch&&typeof e.catch==="function"){return t.ZodParsedType.promise}if(typeof Map!=="undefined"&&e instanceof Map){return t.ZodParsedType.map}if(typeof Set!=="undefined"&&e instanceof Set){return t.ZodParsedType.set}if(typeof Date!=="undefined"&&e instanceof Date){return t.ZodParsedType.date}return t.ZodParsedType.object;default:return t.ZodParsedType.unknown}};t.getParsedType=getParsedType},3301:function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){if(i===undefined)i=r;Object.defineProperty(e,i,{enumerable:true,get:function(){return t[r]}})}:function(e,t,r,i){if(i===undefined)i=r;e[i]=t[r]});var n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t});var s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)if(r!=="default"&&Object.prototype.hasOwnProperty.call(e,r))i(t,e,r);n(t,e);return t};var o=this&&this.__exportStar||function(e,t){for(var r in e)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r))i(t,e,r)};Object.defineProperty(t,"__esModule",{value:true});t.z=void 0;const a=s(r(9906));t.z=a;o(r(9906),t);t["default"]=a},468:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const i=r(3985);const n=r(9892);const errorMap=(e,t)=>{let r;switch(e.code){case n.ZodIssueCode.invalid_type:if(e.received===i.ZodParsedType.undefined){r="Required"}else{r=`Expected ${e.expected}, received ${e.received}`}break;case n.ZodIssueCode.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,i.util.jsonStringifyReplacer)}`;break;case n.ZodIssueCode.unrecognized_keys:r=`Unrecognized key(s) in object: ${i.util.joinValues(e.keys,", ")}`;break;case n.ZodIssueCode.invalid_union:r=`Invalid input`;break;case n.ZodIssueCode.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${i.util.joinValues(e.options)}`;break;case n.ZodIssueCode.invalid_enum_value:r=`Invalid enum value. Expected ${i.util.joinValues(e.options)}, received '${e.received}'`;break;case n.ZodIssueCode.invalid_arguments:r=`Invalid function arguments`;break;case n.ZodIssueCode.invalid_return_type:r=`Invalid function return type`;break;case n.ZodIssueCode.invalid_date:r=`Invalid date`;break;case n.ZodIssueCode.invalid_string:if(typeof e.validation==="object"){if("includes"in e.validation){r=`Invalid input: must include "${e.validation.includes}"`;if(typeof e.validation.position==="number"){r=`${r} at one or more positions greater than or equal to ${e.validation.position}`}}else if("startsWith"in e.validation){r=`Invalid input: must start with "${e.validation.startsWith}"`}else if("endsWith"in e.validation){r=`Invalid input: must end with "${e.validation.endsWith}"`}else{i.util.assertNever(e.validation)}}else if(e.validation!=="regex"){r=`Invalid ${e.validation}`}else{r="Invalid"}break;case n.ZodIssueCode.too_small:if(e.type==="array")r=`Array must contain ${e.exact?"exactly":e.inclusive?`at least`:`more than`} ${e.minimum} element(s)`;else if(e.type==="string")r=`String must contain ${e.exact?"exactly":e.inclusive?`at least`:`over`} ${e.minimum} character(s)`;else if(e.type==="number")r=`Number must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${e.minimum}`;else if(e.type==="date")r=`Date must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${new Date(Number(e.minimum))}`;else r="Invalid input";break;case n.ZodIssueCode.too_big:if(e.type==="array")r=`Array must contain ${e.exact?`exactly`:e.inclusive?`at most`:`less than`} ${e.maximum} element(s)`;else if(e.type==="string")r=`String must contain ${e.exact?`exactly`:e.inclusive?`at most`:`under`} ${e.maximum} character(s)`;else if(e.type==="number")r=`Number must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`;else if(e.type==="bigint")r=`BigInt must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`;else if(e.type==="date")r=`Date must be ${e.exact?`exactly`:e.inclusive?`smaller than or equal to`:`smaller than`} ${new Date(Number(e.maximum))}`;else r="Invalid input";break;case n.ZodIssueCode.custom:r=`Invalid input`;break;case n.ZodIssueCode.invalid_intersection_types:r=`Intersection results could not be merged`;break;case n.ZodIssueCode.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case n.ZodIssueCode.not_finite:r="Number must be finite";break;default:r=t.defaultError;i.util.assertNever(e)}return{message:r}};t["default"]=errorMap},9335:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.discriminatedUnion=t.date=t.boolean=t.bigint=t.array=t.any=t.coerce=t.ZodFirstPartyTypeKind=t.late=t.ZodSchema=t.Schema=t.custom=t.ZodPipeline=t.ZodBranded=t.BRAND=t.ZodNaN=t.ZodCatch=t.ZodDefault=t.ZodNullable=t.ZodOptional=t.ZodTransformer=t.ZodEffects=t.ZodPromise=t.ZodNativeEnum=t.ZodEnum=t.ZodLiteral=t.ZodLazy=t.ZodFunction=t.ZodSet=t.ZodMap=t.ZodRecord=t.ZodTuple=t.ZodIntersection=t.ZodDiscriminatedUnion=t.ZodUnion=t.ZodObject=t.ZodArray=t.ZodVoid=t.ZodNever=t.ZodUnknown=t.ZodAny=t.ZodNull=t.ZodUndefined=t.ZodSymbol=t.ZodDate=t.ZodBoolean=t.ZodBigInt=t.ZodNumber=t.ZodString=t.ZodType=void 0;t.NEVER=t["void"]=t.unknown=t.union=t.undefined=t.tuple=t.transformer=t.symbol=t.string=t.strictObject=t.set=t.record=t.promise=t.preprocess=t.pipeline=t.ostring=t.optional=t.onumber=t.oboolean=t.object=t.number=t.nullable=t["null"]=t.never=t.nativeEnum=t.nan=t.map=t.literal=t.lazy=t.intersection=t["instanceof"]=t["function"]=t["enum"]=t.effect=void 0;const i=r(9566);const n=r(2513);const s=r(888);const o=r(3985);const a=r(9892);class ParseInputLazyPath{constructor(e,t,r,i){this._cachedPath=[];this.parent=e;this.data=t;this._path=r;this._key=i}get path(){if(!this._cachedPath.length){if(this._key instanceof Array){this._cachedPath.push(...this._path,...this._key)}else{this._cachedPath.push(...this._path,this._key)}}return this._cachedPath}}const handleResult=(e,t)=>{if((0,s.isValid)(t)){return{success:true,data:t.value}}else{if(!e.common.issues.length){throw new Error("Validation failed but no issues detected.")}return{success:false,get error(){if(this._error)return this._error;const t=new a.ZodError(e.common.issues);this._error=t;return this._error}}}};function processCreateParams(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:i,description:n}=e;if(t&&(r||i)){throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`)}if(t)return{errorMap:t,description:n};const customMap=(e,t)=>{if(e.code!=="invalid_type")return{message:t.defaultError};if(typeof t.data==="undefined"){return{message:i!==null&&i!==void 0?i:t.defaultError}}return{message:r!==null&&r!==void 0?r:t.defaultError}};return{errorMap:customMap,description:n}}class ZodType{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.isNullable=this.isNullable.bind(this);this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return(0,o.getParsedType)(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:(0,o.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new s.ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:(0,o.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if((0,s.isAsync)(t)){throw new Error("Synchronous parse encountered promise.")}return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){var r;const i={common:{issues:[],async:(r=t===null||t===void 0?void 0:t.async)!==null&&r!==void 0?r:false,contextualErrorMap:t===null||t===void 0?void 0:t.errorMap},path:(t===null||t===void 0?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,o.getParsedType)(e)};const n=this._parseSync({data:e,path:i.path,parent:i});return handleResult(i,n)}async parseAsync(e,t){const r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){const r={common:{issues:[],contextualErrorMap:t===null||t===void 0?void 0:t.errorMap,async:true},path:(t===null||t===void 0?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,o.getParsedType)(e)};const i=this._parse({data:e,path:r.path,parent:r});const n=await((0,s.isAsync)(i)?i:Promise.resolve(i));return handleResult(r,n)}refine(e,t){const getIssueProperties=e=>{if(typeof t==="string"||typeof t==="undefined"){return{message:t}}else if(typeof t==="function"){return t(e)}else{return t}};return this._refinement(((t,r)=>{const i=e(t);const setError=()=>r.addIssue({code:a.ZodIssueCode.custom,...getIssueProperties(t)});if(typeof Promise!=="undefined"&&i instanceof Promise){return i.then((e=>{if(!e){setError();return false}else{return true}}))}if(!i){setError();return false}else{return true}}))}refinement(e,t){return this._refinement(((r,i)=>{if(!e(r)){i.addIssue(typeof t==="function"?t(r,i):t);return false}else{return true}}))}_refinement(e){return new ZodEffects({schema:this,typeName:y.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return ZodOptional.create(this,this._def)}nullable(){return ZodNullable.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ZodArray.create(this,this._def)}promise(){return ZodPromise.create(this,this._def)}or(e){return ZodUnion.create([this,e],this._def)}and(e){return ZodIntersection.create(this,e,this._def)}transform(e){return new ZodEffects({...processCreateParams(this._def),schema:this,typeName:y.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e==="function"?e:()=>e;return new ZodDefault({...processCreateParams(this._def),innerType:this,defaultValue:t,typeName:y.ZodDefault})}brand(){return new ZodBranded({typeName:y.ZodBranded,type:this,...processCreateParams(this._def)})}catch(e){const t=typeof e==="function"?e:()=>e;return new ZodCatch({...processCreateParams(this._def),innerType:this,catchValue:t,typeName:y.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return ZodPipeline.create(this,e)}isOptional(){return this.safeParse(undefined).success}isNullable(){return this.safeParse(null).success}}t.ZodType=ZodType;t.Schema=ZodType;t.ZodSchema=ZodType;const l=/^c[^\s-]{8,}$/i;const u=/^[a-z][a-z0-9]*$/;const c=/[0-9A-HJKMNP-TV-Z]{26}/;const h=/^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i;const d=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\])|(\[IPv6:(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))\])|([A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])*(\.[A-Za-z]{2,})+))$/;const p=/^(\p{Extended_Pictographic}|\p{Emoji_Component})+$/u;const m=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/;const g=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;const datetimeRegex=e=>{if(e.precision){if(e.offset){return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`)}else{return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}Z$`)}}else if(e.precision===0){if(e.offset){return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$`)}else{return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$`)}}else{if(e.offset){return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$`)}else{return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$`)}}};function isValidIP(e,t){if((t==="v4"||!t)&&m.test(e)){return true}if((t==="v6"||!t)&&g.test(e)){return true}return false}class ZodString extends ZodType{constructor(){super(...arguments);this._regex=(e,t,r)=>this.refinement((t=>e.test(t)),{validation:t,code:a.ZodIssueCode.invalid_string,...n.errorUtil.errToObj(r)});this.nonempty=e=>this.min(1,n.errorUtil.errToObj(e));this.trim=()=>new ZodString({...this._def,checks:[...this._def.checks,{kind:"trim"}]});this.toLowerCase=()=>new ZodString({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]});this.toUpperCase=()=>new ZodString({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}_parse(e){if(this._def.coerce){e.data=String(e.data)}const t=this._getType(e);if(t!==o.ZodParsedType.string){const t=this._getOrReturnCtx(e);(0,s.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.string,received:t.parsedType});return s.INVALID}const r=new s.ParseStatus;let i=undefined;for(const t of this._def.checks){if(t.kind==="min"){if(e.data.length<t.value){i=this._getOrReturnCtx(e,i);(0,s.addIssueToContext)(i,{code:a.ZodIssueCode.too_small,minimum:t.value,type:"string",inclusive:true,exact:false,message:t.message});r.dirty()}}else if(t.kind==="max"){if(e.data.length>t.value){i=this._getOrReturnCtx(e,i);(0,s.addIssueToContext)(i,{code:a.ZodIssueCode.too_big,maximum:t.value,type:"string",inclusive:true,exact:false,message:t.message});r.dirty()}}else if(t.kind==="length"){const n=e.data.length>t.value;const o=e.data.length<t.value;if(n||o){i=this._getOrReturnCtx(e,i);if(n){(0,s.addIssueToContext)(i,{code:a.ZodIssueCode.too_big,maximum:t.value,type:"string",inclusive:true,exact:true,message:t.message})}else if(o){(0,s.addIssueToContext)(i,{code:a.ZodIssueCode.too_small,minimum:t.value,type:"string",inclusive:true,exact:true,message:t.message})}r.dirty()}}else if(t.kind==="email"){if(!d.test(e.data)){i=this._getOrReturnCtx(e,i);(0,s.addIssueToContext)(i,{validation:"email",code:a.ZodIssueCode.invalid_string,message:t.message});r.dirty()}}else if(t.kind==="emoji"){if(!p.test(e.data)){i=this._getOrReturnCtx(e,i);(0,s.addIssueToContext)(i,{validation:"emoji",code:a.ZodIssueCode.invalid_string,message:t.message});r.dirty()}}else if(t.kind==="uuid"){if(!h.test(e.data)){i=this._getOrReturnCtx(e,i);(0,s.addIssueToContext)(i,{validation:"uuid",code:a.ZodIssueCode.invalid_string,message:t.message});r.dirty()}}else if(t.kind==="cuid"){if(!l.test(e.data)){i=this._getOrReturnCtx(e,i);(0,s.addIssueToContext)(i,{validation:"cuid",code:a.ZodIssueCode.invalid_string,message:t.message});r.dirty()}}else if(t.kind==="cuid2"){if(!u.test(e.data)){i=this._getOrReturnCtx(e,i);(0,s.addIssueToContext)(i,{validation:"cuid2",code:a.ZodIssueCode.invalid_string,message:t.message});r.dirty()}}else if(t.kind==="ulid"){if(!c.test(e.data)){i=this._getOrReturnCtx(e,i);(0,s.addIssueToContext)(i,{validation:"ulid",code:a.ZodIssueCode.invalid_string,message:t.message});r.dirty()}}else if(t.kind==="url"){try{new URL(e.data)}catch(n){i=this._getOrReturnCtx(e,i);(0,s.addIssueToContext)(i,{validation:"url",code:a.ZodIssueCode.invalid_string,message:t.message});r.dirty()}}else if(t.kind==="regex"){t.regex.lastIndex=0;const n=t.regex.test(e.data);if(!n){i=this._getOrReturnCtx(e,i);(0,s.addIssueToContext)(i,{validation:"regex",code:a.ZodIssueCode.invalid_string,message:t.message});r.dirty()}}else if(t.kind==="trim"){e.data=e.data.trim()}else if(t.kind==="includes"){if(!e.data.includes(t.value,t.position)){i=this._getOrReturnCtx(e,i);(0,s.addIssueToContext)(i,{code:a.ZodIssueCode.invalid_string,validation:{includes:t.value,position:t.position},message:t.message});r.dirty()}}else if(t.kind==="toLowerCase"){e.data=e.data.toLowerCase()}else if(t.kind==="toUpperCase"){e.data=e.data.toUpperCase()}else if(t.kind==="startsWith"){if(!e.data.startsWith(t.value)){i=this._getOrReturnCtx(e,i);(0,s.addIssueToContext)(i,{code:a.ZodIssueCode.invalid_string,validation:{startsWith:t.value},message:t.message});r.dirty()}}else if(t.kind==="endsWith"){if(!e.data.endsWith(t.value)){i=this._getOrReturnCtx(e,i);(0,s.addIssueToContext)(i,{code:a.ZodIssueCode.invalid_string,validation:{endsWith:t.value},message:t.message});r.dirty()}}else if(t.kind==="datetime"){const n=datetimeRegex(t);if(!n.test(e.data)){i=this._getOrReturnCtx(e,i);(0,s.addIssueToContext)(i,{code:a.ZodIssueCode.invalid_string,validation:"datetime",message:t.message});r.dirty()}}else if(t.kind==="ip"){if(!isValidIP(e.data,t.version)){i=this._getOrReturnCtx(e,i);(0,s.addIssueToContext)(i,{validation:"ip",code:a.ZodIssueCode.invalid_string,message:t.message});r.dirty()}}else{o.util.assertNever(t)}}return{status:r.value,value:e.data}}_addCheck(e){return new ZodString({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...n.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",...n.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...n.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...n.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...n.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...n.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...n.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...n.errorUtil.errToObj(e)})}datetime(e){var t;if(typeof e==="string"){return this._addCheck({kind:"datetime",precision:null,offset:false,message:e})}return this._addCheck({kind:"datetime",precision:typeof(e===null||e===void 0?void 0:e.precision)==="undefined"?null:e===null||e===void 0?void 0:e.precision,offset:(t=e===null||e===void 0?void 0:e.offset)!==null&&t!==void 0?t:false,...n.errorUtil.errToObj(e===null||e===void 0?void 0:e.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...n.errorUtil.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t===null||t===void 0?void 0:t.position,...n.errorUtil.errToObj(t===null||t===void 0?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...n.errorUtil.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...n.errorUtil.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...n.errorUtil.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...n.errorUtil.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...n.errorUtil.errToObj(t)})}get isDatetime(){return!!this._def.checks.find((e=>e.kind==="datetime"))}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 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 minLength(){let e=null;for(const t of this._def.checks){if(t.kind==="min"){if(e===null||t.value>e)e=t.value}}return e}get maxLength(){let e=null;for(const t of this._def.checks){if(t.kind==="max"){if(e===null||t.value<e)e=t.value}}return e}}t.ZodString=ZodString;ZodString.create=e=>{var t;return new ZodString({checks:[],typeName:y.ZodString,coerce:(t=e===null||e===void 0?void 0:e.coerce)!==null&&t!==void 0?t:false,...processCreateParams(e)})};function floatSafeRemainder(e,t){const r=(e.toString().split(".")[1]||"").length;const i=(t.toString().split(".")[1]||"").length;const n=r>i?r:i;const s=parseInt(e.toFixed(n).replace(".",""));const o=parseInt(t.toFixed(n).replace(".",""));return s%o/Math.pow(10,n)}class ZodNumber extends ZodType{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)}const t=this._getType(e);if(t!==o.ZodParsedType.number){const t=this._getOrReturnCtx(e);(0,s.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.number,received:t.parsedType});return s.INVALID}let r=undefined;const i=new s.ParseStatus;for(const t of this._def.checks){if(t.kind==="int"){if(!o.util.isInteger(e.data)){r=this._getOrReturnCtx(e,r);(0,s.addIssueToContext)(r,{code:a.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:t.message});i.dirty()}}else if(t.kind==="min"){const n=t.inclusive?e.data<t.value:e.data<=t.value;if(n){r=this._getOrReturnCtx(e,r);(0,s.addIssueToContext)(r,{code:a.ZodIssueCode.too_small,minimum:t.value,type:"number",inclusive:t.inclusive,exact:false,message:t.message});i.dirty()}}else if(t.kind==="max"){const n=t.inclusive?e.data>t.value:e.data>=t.value;if(n){r=this._getOrReturnCtx(e,r);(0,s.addIssueToContext)(r,{code:a.ZodIssueCode.too_big,maximum:t.value,type:"number",inclusive:t.inclusive,exact:false,message:t.message});i.dirty()}}else if(t.kind==="multipleOf"){if(floatSafeRemainder(e.data,t.value)!==0){r=this._getOrReturnCtx(e,r);(0,s.addIssueToContext)(r,{code:a.ZodIssueCode.not_multiple_of,multipleOf:t.value,message:t.message});i.dirty()}}else if(t.kind==="finite"){if(!Number.isFinite(e.data)){r=this._getOrReturnCtx(e,r);(0,s.addIssueToContext)(r,{code:a.ZodIssueCode.not_finite,message:t.message});i.dirty()}}else{o.util.assertNever(t)}}return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,true,n.errorUtil.toString(t))}gt(e,t){return this.setLimit("min",e,false,n.errorUtil.toString(t))}lte(e,t){return this.setLimit("max",e,true,n.errorUtil.toString(t))}lt(e,t){return this.setLimit("max",e,false,n.errorUtil.toString(t))}setLimit(e,t,r,i){return new ZodNumber({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:n.errorUtil.toString(i)}]})}_addCheck(e){return new ZodNumber({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:n.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:false,message:n.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:false,message:n.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:true,message:n.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:true,message:n.errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:n.errorUtil.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:n.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:true,value:Number.MIN_SAFE_INTEGER,message:n.errorUtil.toString(e)})._addCheck({kind:"max",inclusive:true,value:Number.MAX_SAFE_INTEGER,message:n.errorUtil.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks){if(t.kind==="min"){if(e===null||t.value>e)e=t.value}}return e}get maxValue(){let e=null;for(const t of this._def.checks){if(t.kind==="max"){if(e===null||t.value<e)e=t.value}}return e}get isInt(){return!!this._def.checks.find((e=>e.kind==="int"||e.kind==="multipleOf"&&o.util.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf"){return true}else if(r.kind==="min"){if(t===null||r.value>t)t=r.value}else if(r.kind==="max"){if(e===null||r.value<e)e=r.value}}return Number.isFinite(t)&&Number.isFinite(e)}}t.ZodNumber=ZodNumber;ZodNumber.create=e=>new ZodNumber({checks:[],typeName:y.ZodNumber,coerce:(e===null||e===void 0?void 0:e.coerce)||false,...processCreateParams(e)});class ZodBigInt extends ZodType{constructor(){super(...arguments);this.min=this.gte;this.max=this.lte}_parse(e){if(this._def.coerce){e.data=BigInt(e.data)}const t=this._getType(e);if(t!==o.ZodParsedType.bigint){const t=this._getOrReturnCtx(e);(0,s.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.bigint,received:t.parsedType});return s.INVALID}let r=undefined;const i=new s.ParseStatus;for(const t of this._def.checks){if(t.kind==="min"){const n=t.inclusive?e.data<t.value:e.data<=t.value;if(n){r=this._getOrReturnCtx(e,r);(0,s.addIssueToContext)(r,{code:a.ZodIssueCode.too_small,type:"bigint",minimum:t.value,inclusive:t.inclusive,message:t.message});i.dirty()}}else if(t.kind==="max"){const n=t.inclusive?e.data>t.value:e.data>=t.value;if(n){r=this._getOrReturnCtx(e,r);(0,s.addIssueToContext)(r,{code:a.ZodIssueCode.too_big,type:"bigint",maximum:t.value,inclusive:t.inclusive,message:t.message});i.dirty()}}else if(t.kind==="multipleOf"){if(e.data%t.value!==BigInt(0)){r=this._getOrReturnCtx(e,r);(0,s.addIssueToContext)(r,{code:a.ZodIssueCode.not_multiple_of,multipleOf:t.value,message:t.message});i.dirty()}}else{o.util.assertNever(t)}}return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,true,n.errorUtil.toString(t))}gt(e,t){return this.setLimit("min",e,false,n.errorUtil.toString(t))}lte(e,t){return this.setLimit("max",e,true,n.errorUtil.toString(t))}lt(e,t){return this.setLimit("max",e,false,n.errorUtil.toString(t))}setLimit(e,t,r,i){return new ZodBigInt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:n.errorUtil.toString(i)}]})}_addCheck(e){return new ZodBigInt({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:false,message:n.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:false,message:n.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:true,message:n.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:true,message:n.errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:n.errorUtil.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks){if(t.kind==="min"){if(e===null||t.value>e)e=t.value}}return e}get maxValue(){let e=null;for(const t of this._def.checks){if(t.kind==="max"){if(e===null||t.value<e)e=t.value}}return e}}t.ZodBigInt=ZodBigInt;ZodBigInt.create=e=>{var t;return new ZodBigInt({checks:[],typeName:y.ZodBigInt,coerce:(t=e===null||e===void 0?void 0:e.coerce)!==null&&t!==void 0?t:false,...processCreateParams(e)})};class ZodBoolean extends ZodType{_parse(e){if(this._def.coerce){e.data=Boolean(e.data)}const t=this._getType(e);if(t!==o.ZodParsedType.boolean){const t=this._getOrReturnCtx(e);(0,s.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.boolean,received:t.parsedType});return s.INVALID}return(0,s.OK)(e.data)}}t.ZodBoolean=ZodBoolean;ZodBoolean.create=e=>new ZodBoolean({typeName:y.ZodBoolean,coerce:(e===null||e===void 0?void 0:e.coerce)||false,...processCreateParams(e)});class ZodDate extends ZodType{_parse(e){if(this._def.coerce){e.data=new Date(e.data)}const t=this._getType(e);if(t!==o.ZodParsedType.date){const t=this._getOrReturnCtx(e);(0,s.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.date,received:t.parsedType});return s.INVALID}if(isNaN(e.data.getTime())){const t=this._getOrReturnCtx(e);(0,s.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_date});return s.INVALID}const r=new s.ParseStatus;let i=undefined;for(const t of this._def.checks){if(t.kind==="min"){if(e.data.getTime()<t.value){i=this._getOrReturnCtx(e,i);(0,s.addIssueToContext)(i,{code:a.ZodIssueCode.too_small,message:t.message,inclusive:true,exact:false,minimum:t.value,type:"date"});r.dirty()}}else if(t.kind==="max"){if(e.data.getTime()>t.value){i=this._getOrReturnCtx(e,i);(0,s.addIssueToContext)(i,{code:a.ZodIssueCode.too_big,message:t.message,inclusive:true,exact:false,maximum:t.value,type:"date"});r.dirty()}}else{o.util.assertNever(t)}}return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ZodDate({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:n.errorUtil.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:n.errorUtil.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks){if(t.kind==="min"){if(e===null||t.value>e)e=t.value}}return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks){if(t.kind==="max"){if(e===null||t.value<e)e=t.value}}return e!=null?new Date(e):null}}t.ZodDate=ZodDate;ZodDate.create=e=>new ZodDate({checks:[],coerce:(e===null||e===void 0?void 0:e.coerce)||false,typeName:y.ZodDate,...processCreateParams(e)});class ZodSymbol extends ZodType{_parse(e){const t=this._getType(e);if(t!==o.ZodParsedType.symbol){const t=this._getOrReturnCtx(e);(0,s.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.symbol,received:t.parsedType});return s.INVALID}return(0,s.OK)(e.data)}}t.ZodSymbol=ZodSymbol;ZodSymbol.create=e=>new ZodSymbol({typeName:y.ZodSymbol,...processCreateParams(e)});class ZodUndefined extends ZodType{_parse(e){const t=this._getType(e);if(t!==o.ZodParsedType.undefined){const t=this._getOrReturnCtx(e);(0,s.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.undefined,received:t.parsedType});return s.INVALID}return(0,s.OK)(e.data)}}t.ZodUndefined=ZodUndefined;ZodUndefined.create=e=>new ZodUndefined({typeName:y.ZodUndefined,...processCreateParams(e)});class ZodNull extends ZodType{_parse(e){const t=this._getType(e);if(t!==o.ZodParsedType.null){const t=this._getOrReturnCtx(e);(0,s.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.null,received:t.parsedType});return s.INVALID}return(0,s.OK)(e.data)}}t.ZodNull=ZodNull;ZodNull.create=e=>new ZodNull({typeName:y.ZodNull,...processCreateParams(e)});class ZodAny extends ZodType{constructor(){super(...arguments);this._any=true}_parse(e){return(0,s.OK)(e.data)}}t.ZodAny=ZodAny;ZodAny.create=e=>new ZodAny({typeName:y.ZodAny,...processCreateParams(e)});class ZodUnknown extends ZodType{constructor(){super(...arguments);this._unknown=true}_parse(e){return(0,s.OK)(e.data)}}t.ZodUnknown=ZodUnknown;ZodUnknown.create=e=>new ZodUnknown({typeName:y.ZodUnknown,...processCreateParams(e)});class ZodNever extends ZodType{_parse(e){const t=this._getOrReturnCtx(e);(0,s.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.never,received:t.parsedType});return s.INVALID}}t.ZodNever=ZodNever;ZodNever.create=e=>new ZodNever({typeName:y.ZodNever,...processCreateParams(e)});class ZodVoid extends ZodType{_parse(e){const t=this._getType(e);if(t!==o.ZodParsedType.undefined){const t=this._getOrReturnCtx(e);(0,s.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.void,received:t.parsedType});return s.INVALID}return(0,s.OK)(e.data)}}t.ZodVoid=ZodVoid;ZodVoid.create=e=>new ZodVoid({typeName:y.ZodVoid,...processCreateParams(e)});class ZodArray extends ZodType{_parse(e){const{ctx:t,status:r}=this._processInputParams(e);const i=this._def;if(t.parsedType!==o.ZodParsedType.array){(0,s.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.array,received:t.parsedType});return s.INVALID}if(i.exactLength!==null){const e=t.data.length>i.exactLength.value;const n=t.data.length<i.exactLength.value;if(e||n){(0,s.addIssueToContext)(t,{code:e?a.ZodIssueCode.too_big:a.ZodIssueCode.too_small,minimum:n?i.exactLength.value:undefined,maximum:e?i.exactLength.value:undefined,type:"array",inclusive:true,exact:true,message:i.exactLength.message});r.dirty()}}if(i.minLength!==null){if(t.data.length<i.minLength.value){(0,s.addIssueToContext)(t,{code:a.ZodIssueCode.too_small,minimum:i.minLength.value,type:"array",inclusive:true,exact:false,message:i.minLength.message});r.dirty()}}if(i.maxLength!==null){if(t.data.length>i.maxLength.value){(0,s.addIssueToContext)(t,{code:a.ZodIssueCode.too_big,maximum:i.maxLength.value,type:"array",inclusive:true,exact:false,message:i.maxLength.message});r.dirty()}}if(t.common.async){return Promise.all([...t.data].map(((e,r)=>i.type._parseAsync(new ParseInputLazyPath(t,e,t.path,r))))).then((e=>s.ParseStatus.mergeArray(r,e)))}const n=[...t.data].map(((e,r)=>i.type._parseSync(new ParseInputLazyPath(t,e,t.path,r))));return s.ParseStatus.mergeArray(r,n)}get element(){return this._def.type}min(e,t){return new ZodArray({...this._def,minLength:{value:e,message:n.errorUtil.toString(t)}})}max(e,t){return new ZodArray({...this._def,maxLength:{value:e,message:n.errorUtil.toString(t)}})}length(e,t){return new ZodArray({...this._def,exactLength:{value:e,message:n.errorUtil.toString(t)}})}nonempty(e){return this.min(1,e)}}t.ZodArray=ZodArray;ZodArray.create=(e,t)=>new ZodArray({type:e,minLength:null,maxLength:null,exactLength:null,typeName:y.ZodArray,...processCreateParams(t)});function deepPartialify(e){if(e instanceof ZodObject){const t={};for(const r in e.shape){const i=e.shape[r];t[r]=ZodOptional.create(deepPartialify(i))}return new ZodObject({...e._def,shape:()=>t})}else if(e instanceof ZodArray){return new ZodArray({...e._def,type:deepPartialify(e.element)})}else if(e instanceof ZodOptional){return ZodOptional.create(deepPartialify(e.unwrap()))}else if(e instanceof ZodNullable){return ZodNullable.create(deepPartialify(e.unwrap()))}else if(e instanceof ZodTuple){return ZodTuple.create(e.items.map((e=>deepPartialify(e))))}else{return e}}class ZodObject extends ZodType{constructor(){super(...arguments);this._cached=null;this.nonstrict=this.passthrough;this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape();const t=o.util.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){const t=this._getType(e);if(t!==o.ZodParsedType.object){const t=this._getOrReturnCtx(e);(0,s.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.object,received:t.parsedType});return s.INVALID}const{status:r,ctx:i}=this._processInputParams(e);const{shape:n,keys:l}=this._getCached();const u=[];if(!(this._def.catchall instanceof ZodNever&&this._def.unknownKeys==="strip")){for(const e in i.data){if(!l.includes(e)){u.push(e)}}}const c=[];for(const e of l){const t=n[e];const r=i.data[e];c.push({key:{status:"valid",value:e},value:t._parse(new ParseInputLazyPath(i,r,i.path,e)),alwaysSet:e in i.data})}if(this._def.catchall instanceof ZodNever){const e=this._def.unknownKeys;if(e==="passthrough"){for(const e of u){c.push({key:{status:"valid",value:e},value:{status:"valid",value:i.data[e]}})}}else if(e==="strict"){if(u.length>0){(0,s.addIssueToContext)(i,{code:a.ZodIssueCode.unrecognized_keys,keys:u});r.dirty()}}else if(e==="strip"){}else{throw new Error(`Internal ZodObject error: invalid unknownKeys value.`)}}else{const e=this._def.catchall;for(const t of u){const r=i.data[t];c.push({key:{status:"valid",value:t},value:e._parse(new ParseInputLazyPath(i,r,i.path,t)),alwaysSet:t in i.data})}}if(i.common.async){return Promise.resolve().then((async()=>{const e=[];for(const t of c){const r=await t.key;e.push({key:r,value:await t.value,alwaysSet:t.alwaysSet})}return e})).then((e=>s.ParseStatus.mergeObjectSync(r,e)))}else{return s.ParseStatus.mergeObjectSync(r,c)}}get shape(){return this._def.shape()}strict(e){n.errorUtil.errToObj;return new ZodObject({...this._def,unknownKeys:"strict",...e!==undefined?{errorMap:(t,r)=>{var i,s,o,a;const l=(o=(s=(i=this._def).errorMap)===null||s===void 0?void 0:s.call(i,t,r).message)!==null&&o!==void 0?o:r.defaultError;if(t.code==="unrecognized_keys")return{message:(a=n.errorUtil.errToObj(e).message)!==null&&a!==void 0?a:l};return{message:l}}}:{}})}strip(){return new ZodObject({...this._def,unknownKeys:"strip"})}passthrough(){return new ZodObject({...this._def,unknownKeys:"passthrough"})}extend(e){return new ZodObject({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){const t=new ZodObject({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:y.ZodObject});return t}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ZodObject({...this._def,catchall:e})}pick(e){const t={};o.util.objectKeys(e).forEach((r=>{if(e[r]&&this.shape[r]){t[r]=this.shape[r]}}));return new ZodObject({...this._def,shape:()=>t})}omit(e){const t={};o.util.objectKeys(this.shape).forEach((r=>{if(!e[r]){t[r]=this.shape[r]}}));return new ZodObject({...this._def,shape:()=>t})}deepPartial(){return deepPartialify(this)}partial(e){const t={};o.util.objectKeys(this.shape).forEach((r=>{const i=this.shape[r];if(e&&!e[r]){t[r]=i}else{t[r]=i.optional()}}));return new ZodObject({...this._def,shape:()=>t})}required(e){const t={};o.util.objectKeys(this.shape).forEach((r=>{if(e&&!e[r]){t[r]=this.shape[r]}else{const e=this.shape[r];let i=e;while(i instanceof ZodOptional){i=i._def.innerType}t[r]=i}}));return new ZodObject({...this._def,shape:()=>t})}keyof(){return createZodEnum(o.util.objectKeys(this.shape))}}t.ZodObject=ZodObject;ZodObject.create=(e,t)=>new ZodObject({shape:()=>e,unknownKeys:"strip",catchall:ZodNever.create(),typeName:y.ZodObject,...processCreateParams(t)});ZodObject.strictCreate=(e,t)=>new ZodObject({shape:()=>e,unknownKeys:"strict",catchall:ZodNever.create(),typeName:y.ZodObject,...processCreateParams(t)});ZodObject.lazycreate=(e,t)=>new ZodObject({shape:e,unknownKeys:"strip",catchall:ZodNever.create(),typeName:y.ZodObject,...processCreateParams(t)});class ZodUnion extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e);const r=this._def.options;function handleResults(e){for(const t of e){if(t.result.status==="valid"){return t.result}}for(const r of e){if(r.result.status==="dirty"){t.common.issues.push(...r.ctx.common.issues);return r.result}}const r=e.map((e=>new a.ZodError(e.ctx.common.issues)));(0,s.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_union,unionErrors:r});return s.INVALID}if(t.common.async){return Promise.all(r.map((async e=>{const r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}}))).then(handleResults)}else{let e=undefined;const i=[];for(const n of r){const r={...t,common:{...t.common,issues:[]},parent:null};const s=n._parseSync({data:t.data,path:t.path,parent:r});if(s.status==="valid"){return s}else if(s.status==="dirty"&&!e){e={result:s,ctx:r}}if(r.common.issues.length){i.push(r.common.issues)}}if(e){t.common.issues.push(...e.ctx.common.issues);return e.result}const n=i.map((e=>new a.ZodError(e)));(0,s.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_union,unionErrors:n});return s.INVALID}}get options(){return this._def.options}}t.ZodUnion=ZodUnion;ZodUnion.create=(e,t)=>new ZodUnion({options:e,typeName:y.ZodUnion,...processCreateParams(t)});const getDiscriminator=e=>{if(e instanceof ZodLazy){return getDiscriminator(e.schema)}else if(e instanceof ZodEffects){return getDiscriminator(e.innerType())}else if(e instanceof ZodLiteral){return[e.value]}else if(e instanceof ZodEnum){return e.options}else if(e instanceof ZodNativeEnum){return Object.keys(e.enum)}else if(e instanceof ZodDefault){return getDiscriminator(e._def.innerType)}else if(e instanceof ZodUndefined){return[undefined]}else if(e instanceof ZodNull){return[null]}else{return null}};class ZodDiscriminatedUnion extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==o.ZodParsedType.object){(0,s.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.object,received:t.parsedType});return s.INVALID}const r=this.discriminator;const i=t.data[r];const n=this.optionsMap.get(i);if(!n){(0,s.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]});return s.INVALID}if(t.common.async){return n._parseAsync({data:t.data,path:t.path,parent:t})}else{return n._parseSync({data:t.data,path:t.path,parent:t})}}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){const i=new Map;for(const r of t){const t=getDiscriminator(r.shape[e]);if(!t){throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`)}for(const n of t){if(i.has(n)){throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(n)}`)}i.set(n,r)}}return new ZodDiscriminatedUnion({typeName:y.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...processCreateParams(r)})}}t.ZodDiscriminatedUnion=ZodDiscriminatedUnion;function mergeValues(e,t){const r=(0,o.getParsedType)(e);const i=(0,o.getParsedType)(t);if(e===t){return{valid:true,data:e}}else if(r===o.ZodParsedType.object&&i===o.ZodParsedType.object){const r=o.util.objectKeys(t);const i=o.util.objectKeys(e).filter((e=>r.indexOf(e)!==-1));const n={...e,...t};for(const r of i){const i=mergeValues(e[r],t[r]);if(!i.valid){return{valid:false}}n[r]=i.data}return{valid:true,data:n}}else if(r===o.ZodParsedType.array&&i===o.ZodParsedType.array){if(e.length!==t.length){return{valid:false}}const r=[];for(let i=0;i<e.length;i++){const n=e[i];const s=t[i];const o=mergeValues(n,s);if(!o.valid){return{valid:false}}r.push(o.data)}return{valid:true,data:r}}else if(r===o.ZodParsedType.date&&i===o.ZodParsedType.date&&+e===+t){return{valid:true,data:e}}else{return{valid:false}}}class ZodIntersection extends ZodType{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);const handleParsed=(e,i)=>{if((0,s.isAborted)(e)||(0,s.isAborted)(i)){return s.INVALID}const n=mergeValues(e.value,i.value);if(!n.valid){(0,s.addIssueToContext)(r,{code:a.ZodIssueCode.invalid_intersection_types});return s.INVALID}if((0,s.isDirty)(e)||(0,s.isDirty)(i)){t.dirty()}return{status:t.value,value:n.data}};if(r.common.async){return Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then((([e,t])=>handleParsed(e,t)))}else{return handleParsed(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}}t.ZodIntersection=ZodIntersection;ZodIntersection.create=(e,t,r)=>new ZodIntersection({left:e,right:t,typeName:y.ZodIntersection,...processCreateParams(r)});class ZodTuple extends ZodType{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==o.ZodParsedType.array){(0,s.addIssueToContext)(r,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.array,received:r.parsedType});return s.INVALID}if(r.data.length<this._def.items.length){(0,s.addIssueToContext)(r,{code:a.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:true,exact:false,type:"array"});return s.INVALID}const i=this._def.rest;if(!i&&r.data.length>this._def.items.length){(0,s.addIssueToContext)(r,{code:a.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:true,exact:false,type:"array"});t.dirty()}const n=[...r.data].map(((e,t)=>{const i=this._def.items[t]||this._def.rest;if(!i)return null;return i._parse(new ParseInputLazyPath(r,e,r.path,t))})).filter((e=>!!e));if(r.common.async){return Promise.all(n).then((e=>s.ParseStatus.mergeArray(t,e)))}else{return s.ParseStatus.mergeArray(t,n)}}get items(){return this._def.items}rest(e){return new ZodTuple({...this._def,rest:e})}}t.ZodTuple=ZodTuple;ZodTuple.create=(e,t)=>{if(!Array.isArray(e)){throw new Error("You must pass an array of schemas to z.tuple([ ... ])")}return new ZodTuple({items:e,typeName:y.ZodTuple,rest:null,...processCreateParams(t)})};class ZodRecord extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==o.ZodParsedType.object){(0,s.addIssueToContext)(r,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.object,received:r.parsedType});return s.INVALID}const i=[];const n=this._def.keyType;const l=this._def.valueType;for(const e in r.data){i.push({key:n._parse(new ParseInputLazyPath(r,e,r.path,e)),value:l._parse(new ParseInputLazyPath(r,r.data[e],r.path,e))})}if(r.common.async){return s.ParseStatus.mergeObjectAsync(t,i)}else{return s.ParseStatus.mergeObjectSync(t,i)}}get element(){return this._def.valueType}static create(e,t,r){if(t instanceof ZodType){return new ZodRecord({keyType:e,valueType:t,typeName:y.ZodRecord,...processCreateParams(r)})}return new ZodRecord({keyType:ZodString.create(),valueType:e,typeName:y.ZodRecord,...processCreateParams(t)})}}t.ZodRecord=ZodRecord;class ZodMap extends ZodType{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==o.ZodParsedType.map){(0,s.addIssueToContext)(r,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.map,received:r.parsedType});return s.INVALID}const i=this._def.keyType;const n=this._def.valueType;const l=[...r.data.entries()].map((([e,t],s)=>({key:i._parse(new ParseInputLazyPath(r,e,r.path,[s,"key"])),value:n._parse(new ParseInputLazyPath(r,t,r.path,[s,"value"]))})));if(r.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const r of l){const i=await r.key;const n=await r.value;if(i.status==="aborted"||n.status==="aborted"){return s.INVALID}if(i.status==="dirty"||n.status==="dirty"){t.dirty()}e.set(i.value,n.value)}return{status:t.value,value:e}}))}else{const e=new Map;for(const r of l){const i=r.key;const n=r.value;if(i.status==="aborted"||n.status==="aborted"){return s.INVALID}if(i.status==="dirty"||n.status==="dirty"){t.dirty()}e.set(i.value,n.value)}return{status:t.value,value:e}}}}t.ZodMap=ZodMap;ZodMap.create=(e,t,r)=>new ZodMap({valueType:t,keyType:e,typeName:y.ZodMap,...processCreateParams(r)});class ZodSet extends ZodType{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==o.ZodParsedType.set){(0,s.addIssueToContext)(r,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.set,received:r.parsedType});return s.INVALID}const i=this._def;if(i.minSize!==null){if(r.data.size<i.minSize.value){(0,s.addIssueToContext)(r,{code:a.ZodIssueCode.too_small,minimum:i.minSize.value,type:"set",inclusive:true,exact:false,message:i.minSize.message});t.dirty()}}if(i.maxSize!==null){if(r.data.size>i.maxSize.value){(0,s.addIssueToContext)(r,{code:a.ZodIssueCode.too_big,maximum:i.maxSize.value,type:"set",inclusive:true,exact:false,message:i.maxSize.message});t.dirty()}}const n=this._def.valueType;function finalizeSet(e){const r=new Set;for(const i of e){if(i.status==="aborted")return s.INVALID;if(i.status==="dirty")t.dirty();r.add(i.value)}return{status:t.value,value:r}}const l=[...r.data.values()].map(((e,t)=>n._parse(new ParseInputLazyPath(r,e,r.path,t))));if(r.common.async){return Promise.all(l).then((e=>finalizeSet(e)))}else{return finalizeSet(l)}}min(e,t){return new ZodSet({...this._def,minSize:{value:e,message:n.errorUtil.toString(t)}})}max(e,t){return new ZodSet({...this._def,maxSize:{value:e,message:n.errorUtil.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}t.ZodSet=ZodSet;ZodSet.create=(e,t)=>new ZodSet({valueType:e,minSize:null,maxSize:null,typeName:y.ZodSet,...processCreateParams(t)});class ZodFunction extends ZodType{constructor(){super(...arguments);this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==o.ZodParsedType.function){(0,s.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.function,received:t.parsedType});return s.INVALID}function makeArgsIssue(e,r){return(0,s.makeIssue)({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,(0,i.getErrorMap)(),i.defaultErrorMap].filter((e=>!!e)),issueData:{code:a.ZodIssueCode.invalid_arguments,argumentsError:r}})}function makeReturnsIssue(e,r){return(0,s.makeIssue)({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,(0,i.getErrorMap)(),i.defaultErrorMap].filter((e=>!!e)),issueData:{code:a.ZodIssueCode.invalid_return_type,returnTypeError:r}})}const r={errorMap:t.common.contextualErrorMap};const n=t.data;if(this._def.returns instanceof ZodPromise){return(0,s.OK)((async(...e)=>{const t=new a.ZodError([]);const i=await this._def.args.parseAsync(e,r).catch((r=>{t.addIssue(makeArgsIssue(e,r));throw t}));const s=await n(...i);const o=await this._def.returns._def.type.parseAsync(s,r).catch((e=>{t.addIssue(makeReturnsIssue(s,e));throw t}));return o}))}else{return(0,s.OK)(((...e)=>{const t=this._def.args.safeParse(e,r);if(!t.success){throw new a.ZodError([makeArgsIssue(e,t.error)])}const i=n(...t.data);const s=this._def.returns.safeParse(i,r);if(!s.success){throw new a.ZodError([makeReturnsIssue(i,s.error)])}return s.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ZodFunction({...this._def,args:ZodTuple.create(e).rest(ZodUnknown.create())})}returns(e){return new ZodFunction({...this._def,returns:e})}implement(e){const t=this.parse(e);return t}strictImplement(e){const t=this.parse(e);return t}static create(e,t,r){return new ZodFunction({args:e?e:ZodTuple.create([]).rest(ZodUnknown.create()),returns:t||ZodUnknown.create(),typeName:y.ZodFunction,...processCreateParams(r)})}}t.ZodFunction=ZodFunction;class ZodLazy extends ZodType{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);const r=this._def.getter();return r._parse({data:t.data,path:t.path,parent:t})}}t.ZodLazy=ZodLazy;ZodLazy.create=(e,t)=>new ZodLazy({getter:e,typeName:y.ZodLazy,...processCreateParams(t)});class ZodLiteral extends ZodType{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);(0,s.addIssueToContext)(t,{received:t.data,code:a.ZodIssueCode.invalid_literal,expected:this._def.value});return s.INVALID}return{status:"valid",value:e.data}}get value(){return this._def.value}}t.ZodLiteral=ZodLiteral;ZodLiteral.create=(e,t)=>new ZodLiteral({value:e,typeName:y.ZodLiteral,...processCreateParams(t)});function createZodEnum(e,t){return new ZodEnum({values:e,typeName:y.ZodEnum,...processCreateParams(t)})}class ZodEnum extends ZodType{_parse(e){if(typeof e.data!=="string"){const t=this._getOrReturnCtx(e);const r=this._def.values;(0,s.addIssueToContext)(t,{expected:o.util.joinValues(r),received:t.parsedType,code:a.ZodIssueCode.invalid_type});return s.INVALID}if(this._def.values.indexOf(e.data)===-1){const t=this._getOrReturnCtx(e);const r=this._def.values;(0,s.addIssueToContext)(t,{received:t.data,code:a.ZodIssueCode.invalid_enum_value,options:r});return s.INVALID}return(0,s.OK)(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values){e[t]=t}return e}get Values(){const e={};for(const t of this._def.values){e[t]=t}return e}get Enum(){const e={};for(const t of this._def.values){e[t]=t}return e}extract(e){return ZodEnum.create(e)}exclude(e){return ZodEnum.create(this.options.filter((t=>!e.includes(t))))}}t.ZodEnum=ZodEnum;ZodEnum.create=createZodEnum;class ZodNativeEnum extends ZodType{_parse(e){const t=o.util.getValidEnumValues(this._def.values);const r=this._getOrReturnCtx(e);if(r.parsedType!==o.ZodParsedType.string&&r.parsedType!==o.ZodParsedType.number){const e=o.util.objectValues(t);(0,s.addIssueToContext)(r,{expected:o.util.joinValues(e),received:r.parsedType,code:a.ZodIssueCode.invalid_type});return s.INVALID}if(t.indexOf(e.data)===-1){const e=o.util.objectValues(t);(0,s.addIssueToContext)(r,{received:r.data,code:a.ZodIssueCode.invalid_enum_value,options:e});return s.INVALID}return(0,s.OK)(e.data)}get enum(){return this._def.values}}t.ZodNativeEnum=ZodNativeEnum;ZodNativeEnum.create=(e,t)=>new ZodNativeEnum({values:e,typeName:y.ZodNativeEnum,...processCreateParams(t)});class ZodPromise extends ZodType{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==o.ZodParsedType.promise&&t.common.async===false){(0,s.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.promise,received:t.parsedType});return s.INVALID}const r=t.parsedType===o.ZodParsedType.promise?t.data:Promise.resolve(t.data);return(0,s.OK)(r.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}t.ZodPromise=ZodPromise;ZodPromise.create=(e,t)=>new ZodPromise({type:e,typeName:y.ZodPromise,...processCreateParams(t)});class ZodEffects extends ZodType{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===y.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);const i=this._def.effect||null;if(i.type==="preprocess"){const e=i.transform(r.data);if(r.common.async){return Promise.resolve(e).then((e=>this._def.schema._parseAsync({data:e,path:r.path,parent:r})))}else{return this._def.schema._parseSync({data:e,path:r.path,parent:r})}}const n={addIssue:e=>{(0,s.addIssueToContext)(r,e);if(e.fatal){t.abort()}else{t.dirty()}},get path(){return r.path}};n.addIssue=n.addIssue.bind(n);if(i.type==="refinement"){const executeRefinement=e=>{const t=i.refinement(e,n);if(r.common.async){return Promise.resolve(t)}if(t instanceof Promise){throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.")}return e};if(r.common.async===false){const e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(e.status==="aborted")return s.INVALID;if(e.status==="dirty")t.dirty();executeRefinement(e.value);return{status:t.value,value:e.value}}else{return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((e=>{if(e.status==="aborted")return s.INVALID;if(e.status==="dirty")t.dirty();return executeRefinement(e.value).then((()=>({status:t.value,value:e.value})))}))}}if(i.type==="transform"){if(r.common.async===false){const e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!(0,s.isValid)(e))return e;const o=i.transform(e.value,n);if(o instanceof Promise){throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`)}return{status:t.value,value:o}}else{return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((e=>{if(!(0,s.isValid)(e))return e;return Promise.resolve(i.transform(e.value,n)).then((e=>({status:t.value,value:e})))}))}}o.util.assertNever(i)}}t.ZodEffects=ZodEffects;t.ZodTransformer=ZodEffects;ZodEffects.create=(e,t,r)=>new ZodEffects({schema:e,typeName:y.ZodEffects,effect:t,...processCreateParams(r)});ZodEffects.createWithPreprocess=(e,t,r)=>new ZodEffects({schema:t,effect:{type:"preprocess",transform:e},typeName:y.ZodEffects,...processCreateParams(r)});class ZodOptional extends ZodType{_parse(e){const t=this._getType(e);if(t===o.ZodParsedType.undefined){return(0,s.OK)(undefined)}return this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}t.ZodOptional=ZodOptional;ZodOptional.create=(e,t)=>new ZodOptional({innerType:e,typeName:y.ZodOptional,...processCreateParams(t)});class ZodNullable extends ZodType{_parse(e){const t=this._getType(e);if(t===o.ZodParsedType.null){return(0,s.OK)(null)}return this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}t.ZodNullable=ZodNullable;ZodNullable.create=(e,t)=>new ZodNullable({innerType:e,typeName:y.ZodNullable,...processCreateParams(t)});class ZodDefault extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;if(t.parsedType===o.ZodParsedType.undefined){r=this._def.defaultValue()}return this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}t.ZodDefault=ZodDefault;ZodDefault.create=(e,t)=>new ZodDefault({innerType:e,typeName:y.ZodDefault,defaultValue:typeof t.default==="function"?t.default:()=>t.default,...processCreateParams(t)});class ZodCatch extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e);const r={...t,common:{...t.common,issues:[]}};const i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});if((0,s.isAsync)(i)){return i.then((e=>({status:"valid",value:e.status==="valid"?e.value:this._def.catchValue({get error(){return new a.ZodError(r.common.issues)},input:r.data})})))}else{return{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new a.ZodError(r.common.issues)},input:r.data})}}}removeCatch(){return this._def.innerType}}t.ZodCatch=ZodCatch;ZodCatch.create=(e,t)=>new ZodCatch({innerType:e,typeName:y.ZodCatch,catchValue:typeof t.catch==="function"?t.catch:()=>t.catch,...processCreateParams(t)});class ZodNaN extends ZodType{_parse(e){const t=this._getType(e);if(t!==o.ZodParsedType.nan){const t=this._getOrReturnCtx(e);(0,s.addIssueToContext)(t,{code:a.ZodIssueCode.invalid_type,expected:o.ZodParsedType.nan,received:t.parsedType});return s.INVALID}return{status:"valid",value:e.data}}}t.ZodNaN=ZodNaN;ZodNaN.create=e=>new ZodNaN({typeName:y.ZodNaN,...processCreateParams(e)});t.BRAND=Symbol("zod_brand");class ZodBranded extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e);const r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}t.ZodBranded=ZodBranded;class ZodPipeline extends ZodType{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.common.async){const handleAsync=async()=>{const e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});if(e.status==="aborted")return s.INVALID;if(e.status==="dirty"){t.dirty();return(0,s.DIRTY)(e.value)}else{return this._def.out._parseAsync({data:e.value,path:r.path,parent:r})}};return handleAsync()}else{const e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});if(e.status==="aborted")return s.INVALID;if(e.status==="dirty"){t.dirty();return{status:"dirty",value:e.value}}else{return this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}}static create(e,t){return new ZodPipeline({in:e,out:t,typeName:y.ZodPipeline})}}t.ZodPipeline=ZodPipeline;const custom=(e,t={},r)=>{if(e)return ZodAny.create().superRefine(((i,n)=>{var s,o;if(!e(i)){const e=typeof t==="function"?t(i):typeof t==="string"?{message:t}:t;const a=(o=(s=e.fatal)!==null&&s!==void 0?s:r)!==null&&o!==void 0?o:true;const l=typeof e==="string"?{message:e}:e;n.addIssue({code:"custom",...l,fatal:a})}}));return ZodAny.create()};t.custom=custom;t.late={object:ZodObject.lazycreate};var y;(function(e){e["ZodString"]="ZodString";e["ZodNumber"]="ZodNumber";e["ZodNaN"]="ZodNaN";e["ZodBigInt"]="ZodBigInt";e["ZodBoolean"]="ZodBoolean";e["ZodDate"]="ZodDate";e["ZodSymbol"]="ZodSymbol";e["ZodUndefined"]="ZodUndefined";e["ZodNull"]="ZodNull";e["ZodAny"]="ZodAny";e["ZodUnknown"]="ZodUnknown";e["ZodNever"]="ZodNever";e["ZodVoid"]="ZodVoid";e["ZodArray"]="ZodArray";e["ZodObject"]="ZodObject";e["ZodUnion"]="ZodUnion";e["ZodDiscriminatedUnion"]="ZodDiscriminatedUnion";e["ZodIntersection"]="ZodIntersection";e["ZodTuple"]="ZodTuple";e["ZodRecord"]="ZodRecord";e["ZodMap"]="ZodMap";e["ZodSet"]="ZodSet";e["ZodFunction"]="ZodFunction";e["ZodLazy"]="ZodLazy";e["ZodLiteral"]="ZodLiteral";e["ZodEnum"]="ZodEnum";e["ZodEffects"]="ZodEffects";e["ZodNativeEnum"]="ZodNativeEnum";e["ZodOptional"]="ZodOptional";e["ZodNullable"]="ZodNullable";e["ZodDefault"]="ZodDefault";e["ZodCatch"]="ZodCatch";e["ZodPromise"]="ZodPromise";e["ZodBranded"]="ZodBranded";e["ZodPipeline"]="ZodPipeline"})(y=t.ZodFirstPartyTypeKind||(t.ZodFirstPartyTypeKind={}));class Class{constructor(...e){}}const instanceOfType=(e,r={message:`Input not instance of ${e.name}`})=>(0,t.custom)((t=>t instanceof e),r);t["instanceof"]=instanceOfType;const _=ZodString.create;t.string=_;const v=ZodNumber.create;t.number=v;const b=ZodNaN.create;t.nan=b;const x=ZodBigInt.create;t.bigint=x;const T=ZodBoolean.create;t.boolean=T;const w=ZodDate.create;t.date=w;const S=ZodSymbol.create;t.symbol=S;const E=ZodUndefined.create;t.undefined=E;const A=ZodNull.create;t["null"]=A;const C=ZodAny.create;t.any=C;const N=ZodUnknown.create;t.unknown=N;const O=ZodNever.create;t.never=O;const R=ZodVoid.create;t["void"]=R;const k=ZodArray.create;t.array=k;const P=ZodObject.create;t.object=P;const L=ZodObject.strictCreate;t.strictObject=L;const I=ZodUnion.create;t.union=I;const M=ZodDiscriminatedUnion.create;t.discriminatedUnion=M;const D=ZodIntersection.create;t.intersection=D;const F=ZodTuple.create;t.tuple=F;const j=ZodRecord.create;t.record=j;const B=ZodMap.create;t.map=B;const U=ZodSet.create;t.set=U;const H=ZodFunction.create;t["function"]=H;const z=ZodLazy.create;t.lazy=z;const K=ZodLiteral.create;t.literal=K;const V=ZodEnum.create;t["enum"]=V;const q=ZodNativeEnum.create;t.nativeEnum=q;const Z=ZodPromise.create;t.promise=Z;const G=ZodEffects.create;t.effect=G;t.transformer=G;const $=ZodOptional.create;t.optional=$;const W=ZodNullable.create;t.nullable=W;const Y=ZodEffects.createWithPreprocess;t.preprocess=Y;const J=ZodPipeline.create;t.pipeline=J;const ostring=()=>_().optional();t.ostring=ostring;const onumber=()=>v().optional();t.onumber=onumber;const oboolean=()=>T().optional();t.oboolean=oboolean;t.coerce={string:e=>ZodString.create({...e,coerce:true}),number:e=>ZodNumber.create({...e,coerce:true}),boolean:e=>ZodBoolean.create({...e,coerce:true}),bigint:e=>ZodBigInt.create({...e,coerce:true}),date:e=>ZodDate.create({...e,coerce:true})};t.NEVER=s.INVALID},3718:function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){if(i===undefined)i=r;var n=Object.getOwnPropertyDescriptor(t,r);if(!n||("get"in n?!t.__esModule:n.writable||n.configurable)){n={enumerable:true,get:function(){return t[r]}}}Object.defineProperty(e,i,n)}:function(e,t,r,i){if(i===undefined)i=r;e[i]=t[r]});var n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t});var s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)if(r!=="default"&&Object.prototype.hasOwnProperty.call(e,r))i(t,e,r);n(t,e);return t};var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.getContructorABIFromSource=t.encodeContructorArguments=void 0;const a=o(r(9491));const l=r(3831);const u=s(r(4834));const encodeContructorArguments=(e,t)=>{if(t==null||t.length===0)return undefined;const r=new l.Interface(e);const i=r.encodeDeploy(t);return i.slice(2)};t.encodeContructorArguments=encodeContructorArguments;const getContructorABIFromSource=e=>{try{const t=u.parse(e);let r;u.visit(t,{FunctionDefinition:e=>{if(e.isConstructor)r=e}});(0,a.default)(r!=null,`Could not find constructor definition`);const i=[{type:"constructor",inputs:r.parameters.map((({typeName:e},t)=>{(0,a.default)(e!=null,`Missing a type definition for constructor parameter at position ${t}`);return{type:getTypeFromTypeName(e)}}))}];return i}catch(e){throw new Error(`Could not get an ABI from contract source: ${e}`)}};t.getContructorABIFromSource=getContructorABIFromSource;const getTypeFromTypeName=e=>{switch(e.type){case"ElementaryTypeName":return e.name;case"ArrayTypeName":return`${getTypeFromTypeName(e.baseTypeName)}[]`;default:throw new Error(`Only primitive and array types are currently supported when constructing ABI from contract source, got ${e.type}`)}}},6348:function(e,t,r){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.parseNetworksConfig=void 0;const n=r(2413);const s=i(r(9491));const o=r(8989);const a=i(r(8818));const parseNetworksConfig=(e,t)=>Object.entries(t!==null&&t!==void 0?t:{}).reduce(((t,[r,i])=>{if(i==null)return t;const l=i.apiUrl||getScanApiUrlFromEnv(r)||(0,n.getDefaultScanApiUrl)(r);(0,s.default)(l,o.COLORS.error`Missing scan API URL for network ${o.COLORS.default(r)}
20
20
 
21
21
  Please provide the API URL:
22
22
 
23
23
  - As an apiUrl config parameter in ${r} config
24
24
  - As a SCAN_API_URL_${r} enviornment variable
25
25
  - As a SCAN_API_URL_${normalizeNetworkName(r)} enviornment variable
26
- `);const u=i.apiKey||getScanApiKeyFromEnv(r);if(!u){e.debug(`Could not find scan API key for network ${a.default.bold(r)}\n \nPlease provide the API key:\n\n- As an apiKey config parameter in ${r} config\n- As a SCAN_API_KEY_${r} enviornment variable\n- As a SCAN_API_KEY_${normalizeNetworkName(r)} enviornment variable`)}const c=i.browserUrl||getScanBrowserUrlFromEnv(r)||(0,n.tryGetScanBrowserUrlFromScanUrl)(l);if(!c){e.debug(`Could not find scan browser URL key for network ${a.default.bold(r)}\n\n Browser URL is used to display a link to the verified contract\n after successful verification.\n \n Please provide the browser URL:\n \n - As an browserUrl config parameter in ${r} config\n - As a SCAN_BROWSER_URL_${r} enviornment variable\n - As a SCAN_BROWSER_URL_${normalizeNetworkName(r)} enviornment variable`)}return{...t,[r]:{apiUrl:l,apiKey:u,browserUrl:c}}}),{});t.parseNetworksConfig=parseNetworksConfig;const getScanApiUrlFromEnv=e=>{var t,r;return((t=process.env[`SCAN_API_URL_${e}`])===null||t===void 0?void 0:t.trim())||((r=process.env[`SCAN_API_URL_${normalizeNetworkName(e)}`])===null||r===void 0?void 0:r.trim())};const getScanBrowserUrlFromEnv=e=>{var t,r;return((t=process.env[`SCAN_BROWSER_URL_${e}`])===null||t===void 0?void 0:t.trim())||((r=process.env[`SCAN_BROWSER_URL_${normalizeNetworkName(e)}`])===null||r===void 0?void 0:r.trim())};const getScanApiKeyFromEnv=e=>{var t,r;return((t=process.env[`SCAN_API_KEY_${e}`])===null||t===void 0?void 0:t.trim())||((r=process.env[`SCAN_API_KEY_${normalizeNetworkName(e)}`])===null||r===void 0?void 0:r.trim())};const normalizeNetworkName=e=>e.toUpperCase().replaceAll("-","_")},7364:function(e,t,r){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.createVerification=void 0;const n=r(3301);const s=r(824);const o=i(r(2361));const a=i(r(1391));class Verification extends o.default{constructor(e){super();this.props=e}async verify(){try{const e=await this.__submit();if(isAlreadyVerifiedResult(e.result)){return{alreadyVerified:true}}if(e.status!==1){throw new Error(`Verification failed with result "${e.result}", status ${e.status} (${e.message})`)}const t=e.result;if(t==null){throw new Error(`Missing GUID from the response: ${e}`)}return await this.__poll(t)}catch(e){throw new Error(`Verification error: ${e}`)}}async __submit(){const e=createVerificationRequest(this.props);return await(0,s.retry)((async()=>{const t=await submitRequest(this.props.apiUrl,e);if(isApiRateLimitedResult(t.result)){throw new Error(`API Rate limit has been exceeded`)}return t}),3,(async(e,t)=>{this.emit("retry",e,t);await(0,s.sleep)(2e3)}))}async __poll(e){while(true){this.emit("poll",e);const t=await checkGuid(this.props.apiUrl,e);if(t.status===1)return{alreadyVerified:false};if(isAlreadyVerifiedResult(t.result))return{alreadyVerified:true};if(isPendingResult(t.result)){await(0,s.sleep)(1e4);continue}if(isApiRateLimitedResult(t.result)){await(0,s.sleep)(1e4);continue}throw new Error(`Verification failed with result "${t.result}", status ${t.status} (${t.message})`)}}}const createVerification=e=>new Verification(e);t.createVerification=createVerification;const isPendingResult=e=>!!(e===null||e===void 0?void 0:e.match(/Pending/gi));const isAlreadyVerifiedResult=e=>!!(e===null||e===void 0?void 0:e.match(/already verified/gi));const isApiRateLimitedResult=e=>!!(e===null||e===void 0?void 0:e.match(/rate/));const submitRequest=async(e,t)=>{try{const r=await(0,a.default)(e,{method:"POST",form:t,headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}}).json();return l.parse(r)}catch(e){throw new Error(`Failed to submit verification request: ${e}`)}};const checkGuid=async(e,t)=>{const r=new URL(e);r.searchParams.set("module","contract");r.searchParams.set("action","checkverifystatus");r.searchParams.set("guid",t);try{const e=await(0,a.default)(r).json();return l.parse(e)}catch(e){throw new Error(`Failed to check verification status: ${e}`)}};const createVerificationRequest=({apiKey:e,address:t,contractName:r,constructorArguments:i,compilerVersion:n,optimizerRuns:s=0,sourceCode:o,evmVersion:a,licenseType:l})=>{const u={action:"verifysourcecode",module:"contract",codeformat:"solidity-standard-json-input",contractaddress:t,contractname:r,compilerversion:`v${n}`,optimizationUsed:s>0?"1":"0",sourceCode:o};if(e!=null)u.apikey=e;if(s!=null)u.runs=String(s);if(i!=null)u.constructorArguements=i;if(a!=null)u.evmversion=a;if(l!=null)u.licenseType=String(l);return u};const l=n.z.object({status:n.z.coerce.number().nullish(),message:n.z.string().nullish(),result:n.z.string().nullish()})},8194:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isFile=t.isDirectory=void 0;const i=r(7147);const isDirectory=e=>{try{return(0,i.lstatSync)(e).isDirectory()}catch(e){return false}};t.isDirectory=isDirectory;const isFile=e=>{try{return(0,i.lstatSync)(e).isFile()}catch(e){return false}};t.isFile=isFile},4963:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.findLicenseType=t.LicenseType=void 0;var r;(function(e){e[e["None"]=1]="None";e[e["Unlicense"]=2]="Unlicense";e[e["MIT"]=3]="MIT";e[e["GNU-GPLv2"]=4]="GNU-GPLv2";e[e["GNU-GPLv3"]=5]="GNU-GPLv3";e[e["GNU-LGPLv2.1"]=6]="GNU-LGPLv2.1";e[e["GNU-LGPLv3"]=7]="GNU-LGPLv3";e[e["BSD-2-Clause"]=8]="BSD-2-Clause";e[e["BSD-3-Clause"]=9]="BSD-3-Clause";e[e["MPL-2.0"]=10]="MPL-2.0";e[e["OSL-3.0"]=11]="OSL-3.0";e[e["Apache-2.0"]=12]="Apache-2.0";e[e["GNU-AGPLv3"]=13]="GNU-AGPLv3";e[e["BUSL-1.1"]=14]="BUSL-1.1"})(r||(t.LicenseType=r={}));const findLicenseType=e=>{const t=e.match(/\/\/\s*SPDX-License-Identifier\:\s*(.*)\s*/i);const i=t===null||t===void 0?void 0:t[1];if(i==null)return r.None;if(!(i in r)){console.warn("Found unknown SPDX license identifier: %s",i)}return r[i]};t.findLicenseType=findLicenseType},8989:function(e,t,r){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.createRecordLogger=t.anonymizeValue=t.COLORS=t.createLogger=void 0;const n=i(r(8818));const s=i(r(4158));const createLogger=e=>s.default.createLogger({level:e,format:s.default.format.cli(),transports:[new s.default.transports.Console]});t.createLogger=createLogger;t.COLORS={default:n.default.white,error:n.default.red,success:n.default.green,palette:[n.default.magenta,n.default.cyan,n.default.yellow,n.default.blue,n.default.magentaBright,n.default.cyanBright,n.default.blueBright]};const anonymizeValue=e=>{const t=Math.min(Math.max(0,e.length-2),4);const r=e.length-t;const i=e.slice(0,t);const n=Array.from({length:r}).fill("*").join("");return`${i}${n}`};t.anonymizeValue=anonymizeValue;const createRecordLogger=(e,t="\t")=>r=>{e.info("");Object.entries(r).forEach((([r,i])=>{if(Array.isArray(i)){e.info(`${r}:`);i.forEach((r=>{e.info(`${t}\t- ${n.default.bold(formatLoggableValue(r))}`)}))}else{e.info(`${r}:${t}${n.default.bold(formatLoggableValue(i))}`)}}))};t.createRecordLogger=createRecordLogger;const formatLoggableValue=e=>{if(e==null)return"-";switch(typeof e){case"boolean":return e?o:a;default:return String(e)}};const o=t.COLORS.success`✓`;const a=t.COLORS.error`⚠`},824:function(e,t,r){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.retry=t.sleep=void 0;const n=i(r(9491));const sleep=e=>new Promise((t=>{setTimeout(t,e)}));t.sleep=sleep;const retry=async(e,t,r)=>{(0,n.default)(t>0,`Number of attempts for retry must be larger than 0, got ${t}`);for(let i=0;i<t-1;i++){try{return await e()}catch(e){await(r===null||r===void 0?void 0:r(e,i))}}return e()};t.retry=retry},2953:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.DeploymentSchema=t.MetadataSchema=t.MinimalAbiSchema=t.SourcesSchema=t.OptimizerSchema=void 0;const i=r(3301);t.OptimizerSchema=i.z.object({enabled:i.z.boolean().optional(),runs:i.z.number().optional()});t.SourcesSchema=i.z.record(i.z.string(),i.z.object({content:i.z.string()}));t.MinimalAbiSchema=i.z.array(i.z.object({type:i.z.string(),inputs:i.z.array(i.z.object({type:i.z.string().optional()})).optional()}));t.MetadataSchema=i.z.object({language:i.z.string(),compiler:i.z.object({version:i.z.string()}),settings:i.z.object({compilationTarget:i.z.record(i.z.string(),i.z.string()),evmVersion:i.z.string(),optimizer:i.z.object({enabled:i.z.boolean().optional(),runs:i.z.number().optional()})}),sources:i.z.record(i.z.string(),i.z.object({content:i.z.string()}))});t.DeploymentSchema=i.z.object({address:i.z.string(),abi:t.MinimalAbiSchema,args:i.z.array(i.z.any()),solcInputHash:i.z.string(),metadata:i.z.string().transform(((e,t)=>{try{return JSON.parse(e)}catch(e){t.addIssue({code:"custom",message:"Invalid JSON"});return i.z.NEVER}})).pipe(t.MetadataSchema),bytecode:i.z.string(),deployedBytecode:i.z.string()})},2413:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.tryCreateScanContractUrl=t.tryGetScanBrowserUrlFromScanUrl=t.getDefaultScanApiUrl=void 0;const getDefaultScanApiUrl=e=>r.get(e);t.getDefaultScanApiUrl=getDefaultScanApiUrl;const tryGetScanBrowserUrlFromScanUrl=e=>{try{const t=new URL(e);if(!t.hostname.startsWith("api.")&&!t.hostname.startsWith("api-"))return undefined;t.hostname=t.hostname.replace(/^api[.-]/,"");t.pathname="/";return t.toString()}catch(e){return undefined}};t.tryGetScanBrowserUrlFromScanUrl=tryGetScanBrowserUrlFromScanUrl;const tryCreateScanContractUrl=(e,t)=>{try{const r=new URL(e);r.pathname=`/address/${t}`;return r.toString()}catch(e){return undefined}};t.tryCreateScanContractUrl=tryCreateScanContractUrl;const r=new Map([["avalanche","https://api.snowtrace.io/api"],["avalanche-mainnet","https://api.snowtrace.io/api"],["fuji","https://api-testnet.snowtrace.io/api"],["avalanche-testnet","https://api-testnet.snowtrace.io/api"],["arbitrum","https://api.arbiscan.io/api"],["arbitrum-goerli","https://api-goerli.arbiscan.io/api"],["bsc","https://api.bscscan.com/api"],["bsc-testnet","https://api-testnet.bscscan.com/api"],["ethereum","https://api.etherscan.io/api"],["ethereum-goerli","https://api-goerli.etherscan.io/api"],["goerli","https://api-goerli.etherscan.io/api"],["fantom","https://api.ftmscan.com/api"],["fantom-testnet","https://api-testnet.ftmscan.com/api"],["kava","https://kavascan.com/api"],["kava-mainnet","https://kavascan.com/api"],["kava-testnet","https://testnet.kavascan.com/api"],["polygon","https://api.polygonscan.com/api"],["mumbai","https://api-testnet.polygonscan.com/api"],["optimism","https://api-optimistic.etherscan.io/api"],["optimism-goerli","https://api-goerli-optimistic.etherscan.io/api"],["gnosis","https://api.gnosisscan.io/api"],["zkpolygon","https://api-zkevm.polygonscan.com/api"],["zkpolygon-mainnet","https://api-zkevm.polygonscan.com/api"],["base","https://api.basescan.org/api"],["base-mainnet","https://api.basescan.org/api"],["base-goerli","https://api-goerli.basescan.org/api"],["linea","https://api.lineascan.build/api"],["linea-mainnet","https://api.lineascan.build/api"],["zkconsensys","https://api.lineascan.build/api"],["zkconsensys-mainnet","https://api.lineascan.build/api"],["moonbeam","https://api-moonbeam.moonscan.io/api"],["moonbeam-testnet","https://api-moonbase.moonscan.io/api"]])},4367:function(e,t,r){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.parseFilterConfig=t.parsePathsConfig=void 0;const n=i(r(1017));const parsePathsConfig=e=>{var t;return{deployments:(t=e===null||e===void 0?void 0:e.deployments)!==null&&t!==void 0?t:n.default.resolve(process.cwd(),"deployments")}};t.parsePathsConfig=parsePathsConfig;const parseFilterConfig=e=>{if(e==null)return()=>true;switch(typeof e){case"boolean":return()=>e;case"string":return t=>t===e;case"function":return e;case"object":if(Array.isArray(e)){const t=new Set(e);return e=>t.has(e)}if(e instanceof RegExp){return t=>e.test(t)}default:throw new TypeError(`Invalid verify configuration: expected string, string[], boolean, function or a RegExp, got ${e}`)}};t.parseFilterConfig=parseFilterConfig},2066:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.extractSolcInputFromMetadata=void 0;const extractSolcInputFromMetadata=e=>{const{compilationTarget:t,...r}=e.settings;const i=Object.entries(e.sources).reduce(((e,[t,r])=>({...e,[t]:{content:r.content}})),{});return{language:e.language,settings:r,sources:i}};t.extractSolcInputFromMetadata=extractSolcInputFromMetadata},8584:function(e,t,r){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.verifyTarget=t.verifyNonTarget=void 0;const n=r(6348);const s=r(1017);const o=r(4963);const a=r(7364);const l=i(r(8818));const u=r(8989);const c=r(2413);const h=r(2953);const d=r(2066);const p=r(3718);const m=r(4367);const g=r(8194);const y=r(7147);const verifyNonTarget=async(e,t)=>{const r=(0,n.parseNetworksConfig)(t,e.networks);const i=(0,m.parsePathsConfig)(e.paths);const a=(0,u.createRecordLogger)(t);const l=createVerifyAll(t);const c=createLogVerificationResult(a);const y=e.contracts.flatMap((e=>{var n;const{address:l,network:c,contractName:m,deployment:y}=e;t.info(`Collectiong information for contract ${m} on network ${c}`);const _=r[c];if(_==null){t.info(`No network configured for contract ${m} on network ${c}`);return[]}const v=`${(0,s.basename)(y,".json")}.json`;const b=(0,s.resolve)(i.deployments,c,v);if(!(0,g.isFile)(b)){t.error(u.COLORS.error`Deployment file ${b} does not exist or is not a file`);return[]}const x=require(b);const T=h.DeploymentSchema.safeParse(x);if(!T.success){t.error(u.COLORS.error`No network configured for contract ${m} on network ${c}`);return[]}const w=T.data;const S=(0,s.basename)(m,".sol");const E=w.metadata.sources[m];if(E==null){t.error(u.COLORS.error`Missing source for contract ${m} for network ${c} in ${v}`);return[]}const A=(0,o.findLicenseType)(E.content);const C=(0,p.getContructorABIFromSource)(E.content);const N=(0,p.encodeContructorArguments)(C,e.constructorArguments);const O=(0,d.extractSolcInputFromMetadata)(w.metadata);const R={apiUrl:_.apiUrl,apiKey:_.apiKey,address:l,contractName:`${m}:${S}`,constructorArguments:N,licenseType:A,compilerVersion:w.metadata.compiler.version,sourceCode:JSON.stringify(O),evmVersion:w.metadata.settings.evmVersion,optimizerRuns:(n=w.metadata.settings.optimizer)===null||n===void 0?void 0:n.runs};a({Contract:m,Network:c,Address:R.address,License:R.licenseType,Arguments:e.constructorArguments?JSON.stringify(e.constructorArguments):undefined,Sources:Object.keys(w.metadata.sources),"Scan URL":R.apiUrl,"Scan API Key":R.apiKey?(0,u.anonymizeValue)(R.apiKey):undefined});return[{networkName:c,networkConfig:_,submitProps:R}]}));if(y.length===0){t.warn("No contracts match the verification criteria, exiting");return[]}if(e.dryRun){t.debug("Dry run enabled, exiting");return[]}const _=await Promise.all(l(y));_.forEach(c);return _};t.verifyNonTarget=verifyNonTarget;const verifyTarget=async(e,t)=>{const r=(0,m.parseFilterConfig)(e.filter);const i=(0,n.parseNetworksConfig)(t,e.networks);const a=(0,m.parsePathsConfig)(e.paths);const l=(0,u.createRecordLogger)(t);const c=createVerifyAll(t);const _=createLogVerificationResult(l);if(!(0,g.isDirectory)(a.deployments)){throw new Error(`Path ${a.deployments} is not a directory`)}const v=new Set((0,y.readdirSync)(a.deployments));const b=Object.entries(i);t.debug("Verifying deployments for following networks:");b.forEach((([e,r])=>{t.debug(`\t\t- ${e} (API URL ${r.apiUrl})`)}));const x=b.flatMap((([e,i])=>{t.info(`Collecting deployments for ${e}...`);if(!v.has(e)){t.warn(`Could not find deployment for network ${e} in ${a.deployments}`);return[]}const n=(0,s.resolve)(a.deployments,e);const c=(0,y.readdirSync)(n).filter((e=>e.endsWith(".json")));return c.flatMap((a=>{var c;t.info(`Inspecting deployment file ${a} on network ${e}`);const m=(0,s.resolve)(n,a);const g=require(m);const y=h.DeploymentSchema.safeParse(g);if(!y.success){throw new Error(`Error parsing deployment file ${a} on network ${e}: ${y.error}`)}const _=y.data;const v=(0,s.basename)(a,".json");const b=_.metadata.settings.compilationTarget;const x=Object.keys(b).find((e=>b[e]===v));if(x==null){t.error(u.COLORS.error`Could not find contract ${v} in the deployment file ${a} for network ${e}`);return[]}const T=r(v,x,e);if(!T){t.debug(`No contracts to verify in ${a} on network ${e}, skipping`);return[]}const w=_.metadata.sources[x];if(w==null){t.error(u.COLORS.error`Could not find source for ${v} (${x})`);return[]}const S=(0,o.findLicenseType)(w.content);const E=(0,p.encodeContructorArguments)(_.abi,_.args);const A=(0,d.extractSolcInputFromMetadata)(_.metadata);const C={apiUrl:i.apiUrl,apiKey:i.apiKey,address:_.address,contractName:`${x}:${v}`,constructorArguments:E,licenseType:S,compilerVersion:_.metadata.compiler.version,sourceCode:JSON.stringify(A),evmVersion:_.metadata.settings.evmVersion,optimizerRuns:(c=_.metadata.settings.optimizer)===null||c===void 0?void 0:c.runs};l({Contract:v,Network:e,Address:_.address,License:C.licenseType,Arguments:JSON.stringify(_.args),Sources:Object.keys(_.metadata.sources),"Scan URL":C.apiUrl,"Scan API Key":C.apiKey?(0,u.anonymizeValue)(C.apiKey):undefined});return{submitProps:C,networkName:e,networkConfig:i}}))}));if(x.length===0){t.warn("No contracts match the verification criteria, exiting");return[]}if(e.dryRun){t.debug("Dry run enabled, exiting");return[]}const T=await Promise.all(c(x));T.forEach(_);return T};t.verifyTarget=verifyTarget;const createVerifyAll=e=>t=>t.map((async(r,i)=>{const{submitProps:n}=r;const s=u.COLORS.palette[i%u.COLORS.palette.length];const o=`[${i+1}/${t.length}]`;const c=l.default.bold(n.contractName);const h=l.default.bold(r.networkName);e.info(s`Verifying contract ${c} for network ${h} ${o}`);try{const t=(0,a.createVerification)(n);t.on("poll",(t=>{e.info(s`Polling for verification status of ${c} for network ${h} (GUID ${t}) ${o}`)}));t.on("retry",((t,r)=>{e.info(s`Retrying failed verification attempt of ${c} for network ${h} (attempt ${r+1}) ${o}`)}));const i=await t.verify();return{artifact:r,result:i}}catch(t){e.error(u.COLORS.error`Problem verifying contract ${c} for network ${h} ${o}: ${t} `);return{artifact:r,error:t}}}));const createLogVerificationResult=e=>({artifact:t,response:r,error:i})=>{const n=l.default.bold(t.submitProps.contractName);const s=l.default.bold(t.networkName);const o=t.networkConfig.browserUrl?(0,c.tryCreateScanContractUrl)(t.networkConfig.browserUrl,t.submitProps.address):undefined;e({Contract:n,Network:s,Result:i==null,"Was verified":r===null||r===void 0?void 0:r.alreadyVerified,"Contract URL":o,Error:i?u.COLORS.error(i):undefined})}},9491:e=>{"use strict";e.exports=require("assert")},4300:e=>{"use strict";e.exports=require("buffer")},2081:e=>{"use strict";e.exports=require("child_process")},2361:e=>{"use strict";e.exports=require("events")},7147:e=>{"use strict";e.exports=require("fs")},3685:e=>{"use strict";e.exports=require("http")},5158:e=>{"use strict";e.exports=require("http2")},5687:e=>{"use strict";e.exports=require("https")},1808:e=>{"use strict";e.exports=require("net")},2037:e=>{"use strict";e.exports=require("os")},1017:e=>{"use strict";e.exports=require("path")},7282:e=>{"use strict";e.exports=require("process")},2781:e=>{"use strict";e.exports=require("stream")},1576:e=>{"use strict";e.exports=require("string_decoder")},4404:e=>{"use strict";e.exports=require("tls")},6224:e=>{"use strict";e.exports=require("tty")},7310:e=>{"use strict";e.exports=require("url")},3837:e=>{"use strict";e.exports=require("util")},9796:e=>{"use strict";e.exports=require("zlib")},4379:(e,t,r)=>{const{Argument:i}=r(9414);const{Command:n}=r(552);const{CommanderError:s,InvalidArgumentError:o}=r(2625);const{Help:a}=r(5153);const{Option:l}=r(6558);t=e.exports=new n;t.program=t;t.Argument=i;t.Command=n;t.CommanderError=s;t.Help=a;t.InvalidArgumentError=o;t.InvalidOptionArgumentError=o;t.Option=l},9414:(e,t,r)=>{const{InvalidArgumentError:i}=r(2625);class Argument{constructor(e,t){this.description=t||"";this.variadic=false;this.parseArg=undefined;this.defaultValue=undefined;this.defaultValueDescription=undefined;this.argChoices=undefined;switch(e[0]){case"<":this.required=true;this._name=e.slice(1,-1);break;case"[":this.required=false;this._name=e.slice(1,-1);break;default:this.required=true;this._name=e;break}if(this._name.length>3&&this._name.slice(-3)==="..."){this.variadic=true;this._name=this._name.slice(0,-3)}}name(){return this._name}_concatValue(e,t){if(t===this.defaultValue||!Array.isArray(t)){return[e]}return t.concat(e)}default(e,t){this.defaultValue=e;this.defaultValueDescription=t;return this}argParser(e){this.parseArg=e;return this}choices(e){this.argChoices=e.slice();this.parseArg=(e,t)=>{if(!this.argChoices.includes(e)){throw new i(`Allowed choices are ${this.argChoices.join(", ")}.`)}if(this.variadic){return this._concatValue(e,t)}return e};return this}argRequired(){this.required=true;return this}argOptional(){this.required=false;return this}}function humanReadableArgName(e){const t=e.name()+(e.variadic===true?"...":"");return e.required?"<"+t+">":"["+t+"]"}t.Argument=Argument;t.humanReadableArgName=humanReadableArgName},552:(e,t,r)=>{const i=r(2361).EventEmitter;const n=r(2081);const s=r(1017);const o=r(7147);const a=r(7282);const{Argument:l,humanReadableArgName:u}=r(9414);const{CommanderError:c}=r(2625);const{Help:h}=r(5153);const{Option:d,splitOptionFlags:p,DualOptions:m}=r(6558);const{suggestSimilar:g}=r(7592);class Command extends i{constructor(e){super();this.commands=[];this.options=[];this.parent=null;this._allowUnknownOption=false;this._allowExcessArguments=true;this._args=[];this.args=[];this.rawArgs=[];this.processedArgs=[];this._scriptPath=null;this._name=e||"";this._optionValues={};this._optionValueSources={};this._storeOptionsAsProperties=false;this._actionHandler=null;this._executableHandler=false;this._executableFile=null;this._executableDir=null;this._defaultCommandName=null;this._exitCallback=null;this._aliases=[];this._combineFlagAndOptionalValue=true;this._description="";this._summary="";this._argsDescription=undefined;this._enablePositionalOptions=false;this._passThroughOptions=false;this._lifeCycleHooks={};this._showHelpAfterError=false;this._showSuggestionAfterError=true;this._outputConfiguration={writeOut:e=>a.stdout.write(e),writeErr:e=>a.stderr.write(e),getOutHelpWidth:()=>a.stdout.isTTY?a.stdout.columns:undefined,getErrHelpWidth:()=>a.stderr.isTTY?a.stderr.columns:undefined,outputError:(e,t)=>t(e)};this._hidden=false;this._hasHelpOption=true;this._helpFlags="-h, --help";this._helpDescription="display help for command";this._helpShortFlag="-h";this._helpLongFlag="--help";this._addImplicitHelpCommand=undefined;this._helpCommandName="help";this._helpCommandnameAndArgs="help [command]";this._helpCommandDescription="display help for command";this._helpConfiguration={}}copyInheritedSettings(e){this._outputConfiguration=e._outputConfiguration;this._hasHelpOption=e._hasHelpOption;this._helpFlags=e._helpFlags;this._helpDescription=e._helpDescription;this._helpShortFlag=e._helpShortFlag;this._helpLongFlag=e._helpLongFlag;this._helpCommandName=e._helpCommandName;this._helpCommandnameAndArgs=e._helpCommandnameAndArgs;this._helpCommandDescription=e._helpCommandDescription;this._helpConfiguration=e._helpConfiguration;this._exitCallback=e._exitCallback;this._storeOptionsAsProperties=e._storeOptionsAsProperties;this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue;this._allowExcessArguments=e._allowExcessArguments;this._enablePositionalOptions=e._enablePositionalOptions;this._showHelpAfterError=e._showHelpAfterError;this._showSuggestionAfterError=e._showSuggestionAfterError;return this}command(e,t,r){let i=t;let n=r;if(typeof i==="object"&&i!==null){n=i;i=null}n=n||{};const[,s,o]=e.match(/([^ ]+) *(.*)/);const a=this.createCommand(s);if(i){a.description(i);a._executableHandler=true}if(n.isDefault)this._defaultCommandName=a._name;a._hidden=!!(n.noHelp||n.hidden);a._executableFile=n.executableFile||null;if(o)a.arguments(o);this.commands.push(a);a.parent=this;a.copyInheritedSettings(this);if(i)return this;return a}createCommand(e){return new Command(e)}createHelp(){return Object.assign(new h,this.configureHelp())}configureHelp(e){if(e===undefined)return this._helpConfiguration;this._helpConfiguration=e;return this}configureOutput(e){if(e===undefined)return this._outputConfiguration;Object.assign(this._outputConfiguration,e);return this}showHelpAfterError(e=true){if(typeof e!=="string")e=!!e;this._showHelpAfterError=e;return this}showSuggestionAfterError(e=true){this._showSuggestionAfterError=!!e;return this}addCommand(e,t){if(!e._name){throw new Error(`Command passed to .addCommand() must have a name\n- specify the name in Command constructor or using .name()`)}t=t||{};if(t.isDefault)this._defaultCommandName=e._name;if(t.noHelp||t.hidden)e._hidden=true;this.commands.push(e);e.parent=this;return this}createArgument(e,t){return new l(e,t)}argument(e,t,r,i){const n=this.createArgument(e,t);if(typeof r==="function"){n.default(i).argParser(r)}else{n.default(r)}this.addArgument(n);return this}arguments(e){e.trim().split(/ +/).forEach((e=>{this.argument(e)}));return this}addArgument(e){const t=this._args.slice(-1)[0];if(t&&t.variadic){throw new Error(`only the last argument can be variadic '${t.name()}'`)}if(e.required&&e.defaultValue!==undefined&&e.parseArg===undefined){throw new Error(`a default value for a required argument is never used: '${e.name()}'`)}this._args.push(e);return this}addHelpCommand(e,t){if(e===false){this._addImplicitHelpCommand=false}else{this._addImplicitHelpCommand=true;if(typeof e==="string"){this._helpCommandName=e.split(" ")[0];this._helpCommandnameAndArgs=e}this._helpCommandDescription=t||this._helpCommandDescription}return this}_hasImplicitHelpCommand(){if(this._addImplicitHelpCommand===undefined){return this.commands.length&&!this._actionHandler&&!this._findCommand("help")}return this._addImplicitHelpCommand}hook(e,t){const r=["preSubcommand","preAction","postAction"];if(!r.includes(e)){throw new Error(`Unexpected value for event passed to hook : '${e}'.\nExpecting one of '${r.join("', '")}'`)}if(this._lifeCycleHooks[e]){this._lifeCycleHooks[e].push(t)}else{this._lifeCycleHooks[e]=[t]}return this}exitOverride(e){if(e){this._exitCallback=e}else{this._exitCallback=e=>{if(e.code!=="commander.executeSubCommandAsync"){throw e}else{}}}return this}_exit(e,t,r){if(this._exitCallback){this._exitCallback(new c(e,t,r))}a.exit(e)}action(e){const listener=t=>{const r=this._args.length;const i=t.slice(0,r);if(this._storeOptionsAsProperties){i[r]=this}else{i[r]=this.opts()}i.push(this);return e.apply(this,i)};this._actionHandler=listener;return this}createOption(e,t){return new d(e,t)}addOption(e){const t=e.name();const r=e.attributeName();if(e.negate){const t=e.long.replace(/^--no-/,"--");if(!this._findOption(t)){this.setOptionValueWithSource(r,e.defaultValue===undefined?true:e.defaultValue,"default")}}else if(e.defaultValue!==undefined){this.setOptionValueWithSource(r,e.defaultValue,"default")}this.options.push(e);const handleOptionValue=(t,i,n)=>{if(t==null&&e.presetArg!==undefined){t=e.presetArg}const s=this.getOptionValue(r);if(t!==null&&e.parseArg){try{t=e.parseArg(t,s)}catch(e){if(e.code==="commander.invalidArgument"){const t=`${i} ${e.message}`;this.error(t,{exitCode:e.exitCode,code:e.code})}throw e}}else if(t!==null&&e.variadic){t=e._concatValue(t,s)}if(t==null){if(e.negate){t=false}else if(e.isBoolean()||e.optional){t=true}else{t=""}}this.setOptionValueWithSource(r,t,n)};this.on("option:"+t,(t=>{const r=`error: option '${e.flags}' argument '${t}' is invalid.`;handleOptionValue(t,r,"cli")}));if(e.envVar){this.on("optionEnv:"+t,(t=>{const r=`error: option '${e.flags}' value '${t}' from env '${e.envVar}' is invalid.`;handleOptionValue(t,r,"env")}))}return this}_optionEx(e,t,r,i,n){if(typeof t==="object"&&t instanceof d){throw new Error("To add an Option object use addOption() instead of option() or requiredOption()")}const s=this.createOption(t,r);s.makeOptionMandatory(!!e.mandatory);if(typeof i==="function"){s.default(n).argParser(i)}else if(i instanceof RegExp){const e=i;i=(t,r)=>{const i=e.exec(t);return i?i[0]:r};s.default(n).argParser(i)}else{s.default(i)}return this.addOption(s)}option(e,t,r,i){return this._optionEx({},e,t,r,i)}requiredOption(e,t,r,i){return this._optionEx({mandatory:true},e,t,r,i)}combineFlagAndOptionalValue(e=true){this._combineFlagAndOptionalValue=!!e;return this}allowUnknownOption(e=true){this._allowUnknownOption=!!e;return this}allowExcessArguments(e=true){this._allowExcessArguments=!!e;return this}enablePositionalOptions(e=true){this._enablePositionalOptions=!!e;return this}passThroughOptions(e=true){this._passThroughOptions=!!e;if(!!this.parent&&e&&!this.parent._enablePositionalOptions){throw new Error("passThroughOptions can not be used without turning on enablePositionalOptions for parent command(s)")}return this}storeOptionsAsProperties(e=true){this._storeOptionsAsProperties=!!e;if(this.options.length){throw new Error("call .storeOptionsAsProperties() before adding options")}return this}getOptionValue(e){if(this._storeOptionsAsProperties){return this[e]}return this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,undefined)}setOptionValueWithSource(e,t,r){if(this._storeOptionsAsProperties){this[e]=t}else{this._optionValues[e]=t}this._optionValueSources[e]=r;return this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;getCommandAndParents(this).forEach((r=>{if(r.getOptionValueSource(e)!==undefined){t=r.getOptionValueSource(e)}}));return t}_prepareUserArgs(e,t){if(e!==undefined&&!Array.isArray(e)){throw new Error("first parameter to parse must be array or undefined")}t=t||{};if(e===undefined){e=a.argv;if(a.versions&&a.versions.electron){t.from="electron"}}this.rawArgs=e.slice();let r;switch(t.from){case undefined:case"node":this._scriptPath=e[1];r=e.slice(2);break;case"electron":if(a.defaultApp){this._scriptPath=e[1];r=e.slice(2)}else{r=e.slice(1)}break;case"user":r=e.slice(0);break;default:throw new Error(`unexpected parse option { from: '${t.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);this._name=this._name||"program";return r}parse(e,t){const r=this._prepareUserArgs(e,t);this._parseCommand([],r);return this}async parseAsync(e,t){const r=this._prepareUserArgs(e,t);await this._parseCommand([],r);return this}_executeSubCommand(e,t){t=t.slice();let r=false;const i=[".js",".ts",".tsx",".mjs",".cjs"];function findFile(e,t){const r=s.resolve(e,t);if(o.existsSync(r))return r;if(i.includes(s.extname(t)))return undefined;const n=i.find((e=>o.existsSync(`${r}${e}`)));if(n)return`${r}${n}`;return undefined}this._checkForMissingMandatoryOptions();this._checkForConflictingOptions();let l=e._executableFile||`${this._name}-${e._name}`;let u=this._executableDir||"";if(this._scriptPath){let e;try{e=o.realpathSync(this._scriptPath)}catch(t){e=this._scriptPath}u=s.resolve(s.dirname(e),u)}if(u){let t=findFile(u,l);if(!t&&!e._executableFile&&this._scriptPath){const r=s.basename(this._scriptPath,s.extname(this._scriptPath));if(r!==this._name){t=findFile(u,`${r}-${e._name}`)}}l=t||l}r=i.includes(s.extname(l));let h;if(a.platform!=="win32"){if(r){t.unshift(l);t=incrementNodeInspectorPort(a.execArgv).concat(t);h=n.spawn(a.argv[0],t,{stdio:"inherit"})}else{h=n.spawn(l,t,{stdio:"inherit"})}}else{t.unshift(l);t=incrementNodeInspectorPort(a.execArgv).concat(t);h=n.spawn(a.execPath,t,{stdio:"inherit"})}if(!h.killed){const e=["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"];e.forEach((e=>{a.on(e,(()=>{if(h.killed===false&&h.exitCode===null){h.kill(e)}}))}))}const d=this._exitCallback;if(!d){h.on("close",a.exit.bind(a))}else{h.on("close",(()=>{d(new c(a.exitCode||0,"commander.executeSubCommandAsync","(close)"))}))}h.on("error",(t=>{if(t.code==="ENOENT"){const t=u?`searched for local subcommand relative to directory '${u}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory";const r=`'${l}' does not exist\n - if '${e._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead\n - if the default executable name is not suitable, use the executableFile option to supply a custom name or path\n - ${t}`;throw new Error(r)}else if(t.code==="EACCES"){throw new Error(`'${l}' not executable`)}if(!d){a.exit(1)}else{const e=new c(1,"commander.executeSubCommandAsync","(error)");e.nestedError=t;d(e)}}));this.runningCommand=h}_dispatchSubcommand(e,t,r){const i=this._findCommand(e);if(!i)this.help({error:true});let n;n=this._chainOrCallSubCommandHook(n,i,"preSubcommand");n=this._chainOrCall(n,(()=>{if(i._executableHandler){this._executeSubCommand(i,t.concat(r))}else{return i._parseCommand(t,r)}}));return n}_dispatchHelpCommand(e){if(!e){this.help()}const t=this._findCommand(e);if(t&&!t._executableHandler){t.help()}return this._dispatchSubcommand(e,[],[this._helpLongFlag])}_checkNumberOfArguments(){this._args.forEach(((e,t)=>{if(e.required&&this.args[t]==null){this.missingArgument(e.name())}}));if(this._args.length>0&&this._args[this._args.length-1].variadic){return}if(this.args.length>this._args.length){this._excessArguments(this.args)}}_processArguments(){const myParseArg=(e,t,r)=>{let i=t;if(t!==null&&e.parseArg){try{i=e.parseArg(t,r)}catch(r){if(r.code==="commander.invalidArgument"){const i=`error: command-argument value '${t}' is invalid for argument '${e.name()}'. ${r.message}`;this.error(i,{exitCode:r.exitCode,code:r.code})}throw r}}return i};this._checkNumberOfArguments();const e=[];this._args.forEach(((t,r)=>{let i=t.defaultValue;if(t.variadic){if(r<this.args.length){i=this.args.slice(r);if(t.parseArg){i=i.reduce(((e,r)=>myParseArg(t,r,e)),t.defaultValue)}}else if(i===undefined){i=[]}}else if(r<this.args.length){i=this.args[r];if(t.parseArg){i=myParseArg(t,i,t.defaultValue)}}e[r]=i}));this.processedArgs=e}_chainOrCall(e,t){if(e&&e.then&&typeof e.then==="function"){return e.then((()=>t()))}return t()}_chainOrCallHooks(e,t){let r=e;const i=[];getCommandAndParents(this).reverse().filter((e=>e._lifeCycleHooks[t]!==undefined)).forEach((e=>{e._lifeCycleHooks[t].forEach((t=>{i.push({hookedCommand:e,callback:t})}))}));if(t==="postAction"){i.reverse()}i.forEach((e=>{r=this._chainOrCall(r,(()=>e.callback(e.hookedCommand,this)))}));return r}_chainOrCallSubCommandHook(e,t,r){let i=e;if(this._lifeCycleHooks[r]!==undefined){this._lifeCycleHooks[r].forEach((e=>{i=this._chainOrCall(i,(()=>e(this,t)))}))}return i}_parseCommand(e,t){const r=this.parseOptions(t);this._parseOptionsEnv();this._parseOptionsImplied();e=e.concat(r.operands);t=r.unknown;this.args=e.concat(t);if(e&&this._findCommand(e[0])){return this._dispatchSubcommand(e[0],e.slice(1),t)}if(this._hasImplicitHelpCommand()&&e[0]===this._helpCommandName){return this._dispatchHelpCommand(e[1])}if(this._defaultCommandName){outputHelpIfRequested(this,t);return this._dispatchSubcommand(this._defaultCommandName,e,t)}if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName){this.help({error:true})}outputHelpIfRequested(this,r.unknown);this._checkForMissingMandatoryOptions();this._checkForConflictingOptions();const checkForUnknownOptions=()=>{if(r.unknown.length>0){this.unknownOption(r.unknown[0])}};const i=`command:${this.name()}`;if(this._actionHandler){checkForUnknownOptions();this._processArguments();let r;r=this._chainOrCallHooks(r,"preAction");r=this._chainOrCall(r,(()=>this._actionHandler(this.processedArgs)));if(this.parent){r=this._chainOrCall(r,(()=>{this.parent.emit(i,e,t)}))}r=this._chainOrCallHooks(r,"postAction");return r}if(this.parent&&this.parent.listenerCount(i)){checkForUnknownOptions();this._processArguments();this.parent.emit(i,e,t)}else if(e.length){if(this._findCommand("*")){return this._dispatchSubcommand("*",e,t)}if(this.listenerCount("command:*")){this.emit("command:*",e,t)}else if(this.commands.length){this.unknownCommand()}else{checkForUnknownOptions();this._processArguments()}}else if(this.commands.length){checkForUnknownOptions();this.help({error:true})}else{checkForUnknownOptions();this._processArguments()}}_findCommand(e){if(!e)return undefined;return this.commands.find((t=>t._name===e||t._aliases.includes(e)))}_findOption(e){return this.options.find((t=>t.is(e)))}_checkForMissingMandatoryOptions(){for(let e=this;e;e=e.parent){e.options.forEach((t=>{if(t.mandatory&&e.getOptionValue(t.attributeName())===undefined){e.missingMandatoryOptionValue(t)}}))}}_checkForConflictingLocalOptions(){const e=this.options.filter((e=>{const t=e.attributeName();if(this.getOptionValue(t)===undefined){return false}return this.getOptionValueSource(t)!=="default"}));const t=e.filter((e=>e.conflictsWith.length>0));t.forEach((t=>{const r=e.find((e=>t.conflictsWith.includes(e.attributeName())));if(r){this._conflictingOption(t,r)}}))}_checkForConflictingOptions(){for(let e=this;e;e=e.parent){e._checkForConflictingLocalOptions()}}parseOptions(e){const t=[];const r=[];let i=t;const n=e.slice();function maybeOption(e){return e.length>1&&e[0]==="-"}let s=null;while(n.length){const e=n.shift();if(e==="--"){if(i===r)i.push(e);i.push(...n);break}if(s&&!maybeOption(e)){this.emit(`option:${s.name()}`,e);continue}s=null;if(maybeOption(e)){const t=this._findOption(e);if(t){if(t.required){const e=n.shift();if(e===undefined)this.optionMissingArgument(t);this.emit(`option:${t.name()}`,e)}else if(t.optional){let e=null;if(n.length>0&&!maybeOption(n[0])){e=n.shift()}this.emit(`option:${t.name()}`,e)}else{this.emit(`option:${t.name()}`)}s=t.variadic?t:null;continue}}if(e.length>2&&e[0]==="-"&&e[1]!=="-"){const t=this._findOption(`-${e[1]}`);if(t){if(t.required||t.optional&&this._combineFlagAndOptionalValue){this.emit(`option:${t.name()}`,e.slice(2))}else{this.emit(`option:${t.name()}`);n.unshift(`-${e.slice(2)}`)}continue}}if(/^--[^=]+=/.test(e)){const t=e.indexOf("=");const r=this._findOption(e.slice(0,t));if(r&&(r.required||r.optional)){this.emit(`option:${r.name()}`,e.slice(t+1));continue}}if(maybeOption(e)){i=r}if((this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&r.length===0){if(this._findCommand(e)){t.push(e);if(n.length>0)r.push(...n);break}else if(e===this._helpCommandName&&this._hasImplicitHelpCommand()){t.push(e);if(n.length>0)t.push(...n);break}else if(this._defaultCommandName){r.push(e);if(n.length>0)r.push(...n);break}}if(this._passThroughOptions){i.push(e);if(n.length>0)i.push(...n);break}i.push(e)}return{operands:t,unknown:r}}opts(){if(this._storeOptionsAsProperties){const e={};const t=this.options.length;for(let r=0;r<t;r++){const t=this.options[r].attributeName();e[t]=t===this._versionOptionName?this._version:this[t]}return e}return this._optionValues}optsWithGlobals(){return getCommandAndParents(this).reduce(((e,t)=>Object.assign(e,t.opts())),{})}error(e,t){this._outputConfiguration.outputError(`${e}\n`,this._outputConfiguration.writeErr);if(typeof this._showHelpAfterError==="string"){this._outputConfiguration.writeErr(`${this._showHelpAfterError}\n`)}else if(this._showHelpAfterError){this._outputConfiguration.writeErr("\n");this.outputHelp({error:true})}const r=t||{};const i=r.exitCode||1;const n=r.code||"commander.error";this._exit(i,n,e)}_parseOptionsEnv(){this.options.forEach((e=>{if(e.envVar&&e.envVar in a.env){const t=e.attributeName();if(this.getOptionValue(t)===undefined||["default","config","env"].includes(this.getOptionValueSource(t))){if(e.required||e.optional){this.emit(`optionEnv:${e.name()}`,a.env[e.envVar])}else{this.emit(`optionEnv:${e.name()}`)}}}}))}_parseOptionsImplied(){const e=new m(this.options);const hasCustomOptionValue=e=>this.getOptionValue(e)!==undefined&&!["default","implied"].includes(this.getOptionValueSource(e));this.options.filter((t=>t.implied!==undefined&&hasCustomOptionValue(t.attributeName())&&e.valueFromOption(this.getOptionValue(t.attributeName()),t))).forEach((e=>{Object.keys(e.implied).filter((e=>!hasCustomOptionValue(e))).forEach((t=>{this.setOptionValueWithSource(t,e.implied[t],"implied")}))}))}missingArgument(e){const t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){const t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){const t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){const findBestOptionFromValue=e=>{const t=e.attributeName();const r=this.getOptionValue(t);const i=this.options.find((e=>e.negate&&t===e.attributeName()));const n=this.options.find((e=>!e.negate&&t===e.attributeName()));if(i&&(i.presetArg===undefined&&r===false||i.presetArg!==undefined&&r===i.presetArg)){return i}return n||e};const getErrorMessage=e=>{const t=findBestOptionFromValue(e);const r=t.attributeName();const i=this.getOptionValueSource(r);if(i==="env"){return`environment variable '${t.envVar}'`}return`option '${t.flags}'`};const r=`error: ${getErrorMessage(e)} cannot be used with ${getErrorMessage(t)}`;this.error(r,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let r=[];let i=this;do{const e=i.createHelp().visibleOptions(i).filter((e=>e.long)).map((e=>e.long));r=r.concat(e);i=i.parent}while(i&&!i._enablePositionalOptions);t=g(e,r)}const r=`error: unknown option '${e}'${t}`;this.error(r,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;const t=this._args.length;const r=t===1?"":"s";const i=this.parent?` for '${this.name()}'`:"";const n=`error: too many arguments${i}. Expected ${t} argument${r} but got ${e.length}.`;this.error(n,{code:"commander.excessArguments"})}unknownCommand(){const e=this.args[0];let t="";if(this._showSuggestionAfterError){const r=[];this.createHelp().visibleCommands(this).forEach((e=>{r.push(e.name());if(e.alias())r.push(e.alias())}));t=g(e,r)}const r=`error: unknown command '${e}'${t}`;this.error(r,{code:"commander.unknownCommand"})}version(e,t,r){if(e===undefined)return this._version;this._version=e;t=t||"-V, --version";r=r||"output the version number";const i=this.createOption(t,r);this._versionOptionName=i.attributeName();this.options.push(i);this.on("option:"+i.name(),(()=>{this._outputConfiguration.writeOut(`${e}\n`);this._exit(0,"commander.version",e)}));return this}description(e,t){if(e===undefined&&t===undefined)return this._description;this._description=e;if(t){this._argsDescription=t}return this}summary(e){if(e===undefined)return this._summary;this._summary=e;return this}alias(e){if(e===undefined)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler){t=this.commands[this.commands.length-1]}if(e===t._name)throw new Error("Command alias can't be the same as its name");t._aliases.push(e);return this}aliases(e){if(e===undefined)return this._aliases;e.forEach((e=>this.alias(e)));return this}usage(e){if(e===undefined){if(this._usage)return this._usage;const e=this._args.map((e=>u(e)));return[].concat(this.options.length||this._hasHelpOption?"[options]":[],this.commands.length?"[command]":[],this._args.length?e:[]).join(" ")}this._usage=e;return this}name(e){if(e===undefined)return this._name;this._name=e;return this}nameFromFilename(e){this._name=s.basename(e,s.extname(e));return this}executableDir(e){if(e===undefined)return this._executableDir;this._executableDir=e;return this}helpInformation(e){const t=this.createHelp();if(t.helpWidth===undefined){t.helpWidth=e&&e.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()}return t.formatHelp(this,t)}_getHelpContext(e){e=e||{};const t={error:!!e.error};let r;if(t.error){r=e=>this._outputConfiguration.writeErr(e)}else{r=e=>this._outputConfiguration.writeOut(e)}t.write=e.write||r;t.command=this;return t}outputHelp(e){let t;if(typeof e==="function"){t=e;e=undefined}const r=this._getHelpContext(e);getCommandAndParents(this).reverse().forEach((e=>e.emit("beforeAllHelp",r)));this.emit("beforeHelp",r);let i=this.helpInformation(r);if(t){i=t(i);if(typeof i!=="string"&&!Buffer.isBuffer(i)){throw new Error("outputHelp callback must return a string or a Buffer")}}r.write(i);this.emit(this._helpLongFlag);this.emit("afterHelp",r);getCommandAndParents(this).forEach((e=>e.emit("afterAllHelp",r)))}helpOption(e,t){if(typeof e==="boolean"){this._hasHelpOption=e;return this}this._helpFlags=e||this._helpFlags;this._helpDescription=t||this._helpDescription;const r=p(this._helpFlags);this._helpShortFlag=r.shortFlag;this._helpLongFlag=r.longFlag;return this}help(e){this.outputHelp(e);let t=a.exitCode||0;if(t===0&&e&&typeof e!=="function"&&e.error){t=1}this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){const r=["beforeAll","before","after","afterAll"];if(!r.includes(e)){throw new Error(`Unexpected value for position to addHelpText.\nExpecting one of '${r.join("', '")}'`)}const i=`${e}Help`;this.on(i,(e=>{let r;if(typeof t==="function"){r=t({error:e.error,command:e.command})}else{r=t}if(r){e.write(`${r}\n`)}}));return this}}function outputHelpIfRequested(e,t){const r=e._hasHelpOption&&t.find((t=>t===e._helpLongFlag||t===e._helpShortFlag));if(r){e.outputHelp();e._exit(0,"commander.helpDisplayed","(outputHelp)")}}function incrementNodeInspectorPort(e){return e.map((e=>{if(!e.startsWith("--inspect")){return e}let t;let r="127.0.0.1";let i="9229";let n;if((n=e.match(/^(--inspect(-brk)?)$/))!==null){t=n[1]}else if((n=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null){t=n[1];if(/^\d+$/.test(n[3])){i=n[3]}else{r=n[3]}}else if((n=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null){t=n[1];r=n[3];i=n[4]}if(t&&i!=="0"){return`${t}=${r}:${parseInt(i)+1}`}return e}))}function getCommandAndParents(e){const t=[];for(let r=e;r;r=r.parent){t.push(r)}return t}t.Command=Command},2625:(e,t)=>{class CommanderError extends Error{constructor(e,t,r){super(r);Error.captureStackTrace(this,this.constructor);this.name=this.constructor.name;this.code=t;this.exitCode=e;this.nestedError=undefined}}class InvalidArgumentError extends CommanderError{constructor(e){super(1,"commander.invalidArgument",e);Error.captureStackTrace(this,this.constructor);this.name=this.constructor.name}}t.CommanderError=CommanderError;t.InvalidArgumentError=InvalidArgumentError},5153:(e,t,r)=>{const{humanReadableArgName:i}=r(9414);class Help{constructor(){this.helpWidth=undefined;this.sortSubcommands=false;this.sortOptions=false;this.showGlobalOptions=false}visibleCommands(e){const t=e.commands.filter((e=>!e._hidden));if(e._hasImplicitHelpCommand()){const[,r,i]=e._helpCommandnameAndArgs.match(/([^ ]+) *(.*)/);const n=e.createCommand(r).helpOption(false);n.description(e._helpCommandDescription);if(i)n.arguments(i);t.push(n)}if(this.sortSubcommands){t.sort(((e,t)=>e.name().localeCompare(t.name())))}return t}compareOptions(e,t){const getSortKey=e=>e.short?e.short.replace(/^-/,""):e.long.replace(/^--/,"");return getSortKey(e).localeCompare(getSortKey(t))}visibleOptions(e){const t=e.options.filter((e=>!e.hidden));const r=e._hasHelpOption&&e._helpShortFlag&&!e._findOption(e._helpShortFlag);const i=e._hasHelpOption&&!e._findOption(e._helpLongFlag);if(r||i){let n;if(!r){n=e.createOption(e._helpLongFlag,e._helpDescription)}else if(!i){n=e.createOption(e._helpShortFlag,e._helpDescription)}else{n=e.createOption(e._helpFlags,e._helpDescription)}t.push(n)}if(this.sortOptions){t.sort(this.compareOptions)}return t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];const t=[];for(let r=e.parent;r;r=r.parent){const e=r.options.filter((e=>!e.hidden));t.push(...e)}if(this.sortOptions){t.sort(this.compareOptions)}return t}visibleArguments(e){if(e._argsDescription){e._args.forEach((t=>{t.description=t.description||e._argsDescription[t.name()]||""}))}if(e._args.find((e=>e.description))){return e._args}return[]}subcommandTerm(e){const t=e._args.map((e=>i(e))).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce(((e,r)=>Math.max(e,t.subcommandTerm(r).length)),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce(((e,r)=>Math.max(e,t.optionTerm(r).length)),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce(((e,r)=>Math.max(e,t.optionTerm(r).length)),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce(((e,r)=>Math.max(e,t.argumentTerm(r).length)),0)}commandUsage(e){let t=e._name;if(e._aliases[0]){t=t+"|"+e._aliases[0]}let r="";for(let t=e.parent;t;t=t.parent){r=t.name()+" "+r}return r+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){const t=[];if(e.argChoices){t.push(`choices: ${e.argChoices.map((e=>JSON.stringify(e))).join(", ")}`)}if(e.defaultValue!==undefined){const r=e.required||e.optional||e.isBoolean()&&typeof e.defaultValue==="boolean";if(r){t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`)}}if(e.presetArg!==undefined&&e.optional){t.push(`preset: ${JSON.stringify(e.presetArg)}`)}if(e.envVar!==undefined){t.push(`env: ${e.envVar}`)}if(t.length>0){return`${e.description} (${t.join(", ")})`}return e.description}argumentDescription(e){const t=[];if(e.argChoices){t.push(`choices: ${e.argChoices.map((e=>JSON.stringify(e))).join(", ")}`)}if(e.defaultValue!==undefined){t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`)}if(t.length>0){const r=`(${t.join(", ")})`;if(e.description){return`${e.description} ${r}`}return r}return e.description}formatHelp(e,t){const r=t.padWidth(e,t);const i=t.helpWidth||80;const n=2;const s=2;function formatItem(e,o){if(o){const a=`${e.padEnd(r+s)}${o}`;return t.wrap(a,i-n,r+s)}return e}function formatList(e){return e.join("\n").replace(/^/gm," ".repeat(n))}let o=[`Usage: ${t.commandUsage(e)}`,""];const a=t.commandDescription(e);if(a.length>0){o=o.concat([t.wrap(a,i,0),""])}const l=t.visibleArguments(e).map((e=>formatItem(t.argumentTerm(e),t.argumentDescription(e))));if(l.length>0){o=o.concat(["Arguments:",formatList(l),""])}const u=t.visibleOptions(e).map((e=>formatItem(t.optionTerm(e),t.optionDescription(e))));if(u.length>0){o=o.concat(["Options:",formatList(u),""])}if(this.showGlobalOptions){const r=t.visibleGlobalOptions(e).map((e=>formatItem(t.optionTerm(e),t.optionDescription(e))));if(r.length>0){o=o.concat(["Global Options:",formatList(r),""])}}const c=t.visibleCommands(e).map((e=>formatItem(t.subcommandTerm(e),t.subcommandDescription(e))));if(c.length>0){o=o.concat(["Commands:",formatList(c),""])}return o.join("\n")}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}wrap(e,t,r,i=40){const n=" \\f\\t\\v   -    \ufeff";const s=new RegExp(`[\\n][${n}]+`);if(e.match(s))return e;const o=t-r;if(o<i)return e;const a=e.slice(0,r);const l=e.slice(r).replace("\r\n","\n");const u=" ".repeat(r);const c="​";const h=`\\s${c}`;const d=new RegExp(`\n|.{1,${o-1}}([${h}]|$)|[^${h}]+?([${h}]|$)`,"g");const p=l.match(d)||[];return a+p.map(((e,t)=>{if(e==="\n")return"";return(t>0?u:"")+e.trimEnd()})).join("\n")}}t.Help=Help},6558:(e,t,r)=>{const{InvalidArgumentError:i}=r(2625);class Option{constructor(e,t){this.flags=e;this.description=t||"";this.required=e.includes("<");this.optional=e.includes("[");this.variadic=/\w\.\.\.[>\]]$/.test(e);this.mandatory=false;const r=splitOptionFlags(e);this.short=r.shortFlag;this.long=r.longFlag;this.negate=false;if(this.long){this.negate=this.long.startsWith("--no-")}this.defaultValue=undefined;this.defaultValueDescription=undefined;this.presetArg=undefined;this.envVar=undefined;this.parseArg=undefined;this.hidden=false;this.argChoices=undefined;this.conflictsWith=[];this.implied=undefined}default(e,t){this.defaultValue=e;this.defaultValueDescription=t;return this}preset(e){this.presetArg=e;return this}conflicts(e){this.conflictsWith=this.conflictsWith.concat(e);return this}implies(e){let t=e;if(typeof e==="string"){t={[e]:true}}this.implied=Object.assign(this.implied||{},t);return this}env(e){this.envVar=e;return this}argParser(e){this.parseArg=e;return this}makeOptionMandatory(e=true){this.mandatory=!!e;return this}hideHelp(e=true){this.hidden=!!e;return this}_concatValue(e,t){if(t===this.defaultValue||!Array.isArray(t)){return[e]}return t.concat(e)}choices(e){this.argChoices=e.slice();this.parseArg=(e,t)=>{if(!this.argChoices.includes(e)){throw new i(`Allowed choices are ${this.argChoices.join(", ")}.`)}if(this.variadic){return this._concatValue(e,t)}return e};return this}name(){if(this.long){return this.long.replace(/^--/,"")}return this.short.replace(/^-/,"")}attributeName(){return camelcase(this.name().replace(/^no-/,""))}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class DualOptions{constructor(e){this.positiveOptions=new Map;this.negativeOptions=new Map;this.dualOptions=new Set;e.forEach((e=>{if(e.negate){this.negativeOptions.set(e.attributeName(),e)}else{this.positiveOptions.set(e.attributeName(),e)}}));this.negativeOptions.forEach(((e,t)=>{if(this.positiveOptions.has(t)){this.dualOptions.add(t)}}))}valueFromOption(e,t){const r=t.attributeName();if(!this.dualOptions.has(r))return true;const i=this.negativeOptions.get(r).presetArg;const n=i!==undefined?i:false;return t.negate===(n===e)}}function camelcase(e){return e.split("-").reduce(((e,t)=>e+t[0].toUpperCase()+t.slice(1)))}function splitOptionFlags(e){let t;let r;const i=e.split(/[ |,]+/);if(i.length>1&&!/^[[<]/.test(i[1]))t=i.shift();r=i.shift();if(!t&&/^-[^-]$/.test(r)){t=r;r=undefined}return{shortFlag:t,longFlag:r}}t.Option=Option;t.splitOptionFlags=splitOptionFlags;t.DualOptions=DualOptions},7592:(e,t)=>{const r=3;function editDistance(e,t){if(Math.abs(e.length-t.length)>r)return Math.max(e.length,t.length);const i=[];for(let t=0;t<=e.length;t++){i[t]=[t]}for(let e=0;e<=t.length;e++){i[0][e]=e}for(let r=1;r<=t.length;r++){for(let n=1;n<=e.length;n++){let s=1;if(e[n-1]===t[r-1]){s=0}else{s=1}i[n][r]=Math.min(i[n-1][r]+1,i[n][r-1]+1,i[n-1][r-1]+s);if(n>1&&r>1&&e[n-1]===t[r-2]&&e[n-2]===t[r-1]){i[n][r]=Math.min(i[n][r],i[n-2][r-2]+1)}}}return i[e.length][t.length]}function suggestSimilar(e,t){if(!t||t.length===0)return"";t=Array.from(new Set(t));const i=e.startsWith("--");if(i){e=e.slice(2);t=t.map((e=>e.slice(2)))}let n=[];let s=r;const o=.4;t.forEach((t=>{if(t.length<=1)return;const r=editDistance(e,t);const i=Math.max(e.length,t.length);const a=(i-r)/i;if(a>o){if(r<s){s=r;n=[t]}else if(r===s){n.push(t)}}}));n.sort(((e,t)=>e.localeCompare(t)));if(i){n=n.map((e=>`--${e}`))}if(n.length>1){return`\n(Did you mean one of ${n.join(", ")}?)`}if(n.length===1){return`\n(Did you mean ${n[0]}?)`}return""}t.suggestSimilar=suggestSimilar},1391:(e,t,r)=>{"use strict";r.r(t);r.d(t,{AbortError:()=>AbortError,CacheError:()=>CacheError,CancelError:()=>types_CancelError,HTTPError:()=>HTTPError,MaxRedirectsError:()=>MaxRedirectsError,Options:()=>Options,ParseError:()=>ParseError,ReadError:()=>ReadError,RequestError:()=>RequestError,RetryError:()=>RetryError,TimeoutError:()=>TimeoutError,UploadError:()=>UploadError,calculateRetryDelay:()=>te,create:()=>Re,default:()=>Le,got:()=>Pe,isResponseOk:()=>isResponseOk,parseBody:()=>parseBody,parseLinkHeader:()=>parseLinkHeader});const i=["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function isTypedArrayName(e){return i.includes(e)}const n=["Function","Generator","AsyncGenerator","GeneratorFunction","AsyncGeneratorFunction","AsyncFunction","Observable","Array","Buffer","Blob","Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","WeakRef","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","FormData","URLSearchParams","HTMLElement","NaN",...i];function isObjectTypeName(e){return n.includes(e)}const s=["null","undefined","string","number","bigint","boolean","symbol"];function isPrimitiveTypeName(e){return s.includes(e)}function isOfType(e){return t=>typeof t===e}const{toString:o}=Object.prototype;const getObjectType=e=>{const t=o.call(e).slice(8,-1);if(/HTML\w+Element/.test(t)&&is.domElement(e)){return"HTMLElement"}if(isObjectTypeName(t)){return t}return undefined};const isObjectOfType=e=>t=>getObjectType(t)===e;function is(e){if(e===null){return"null"}switch(typeof e){case"undefined":{return"undefined"}case"string":{return"string"}case"number":{return Number.isNaN(e)?"NaN":"number"}case"boolean":{return"boolean"}case"function":{return"Function"}case"bigint":{return"bigint"}case"symbol":{return"symbol"}default:}if(is.observable(e)){return"Observable"}if(is.array(e)){return"Array"}if(is.buffer(e)){return"Buffer"}const t=getObjectType(e);if(t){return t}if(e instanceof String||e instanceof Boolean||e instanceof Number){throw new TypeError("Please don't use object wrappers for primitive types")}return"Object"}is.undefined=isOfType("undefined");is.string=isOfType("string");const a=isOfType("number");is.number=e=>a(e)&&!is.nan(e);is.positiveNumber=e=>is.number(e)&&e>0;is.negativeNumber=e=>is.number(e)&&e<0;is.bigint=isOfType("bigint");is.function_=isOfType("function");is.null_=e=>e===null;is.class_=e=>is.function_(e)&&e.toString().startsWith("class ");is.boolean=e=>e===true||e===false;is.symbol=isOfType("symbol");is.numericString=e=>is.string(e)&&!is.emptyStringOrWhitespace(e)&&!Number.isNaN(Number(e));is.array=(e,t)=>{if(!Array.isArray(e)){return false}if(!is.function_(t)){return true}return e.every((e=>t(e)))};is.buffer=e=>e?.constructor?.isBuffer?.(e)??false;is.blob=e=>isObjectOfType("Blob")(e);is.nullOrUndefined=e=>is.null_(e)||is.undefined(e);is.object=e=>!is.null_(e)&&(typeof e==="object"||is.function_(e));is.iterable=e=>is.function_(e?.[Symbol.iterator]);is.asyncIterable=e=>is.function_(e?.[Symbol.asyncIterator]);is.generator=e=>is.iterable(e)&&is.function_(e?.next)&&is.function_(e?.throw);is.asyncGenerator=e=>is.asyncIterable(e)&&is.function_(e.next)&&is.function_(e.throw);is.nativePromise=e=>isObjectOfType("Promise")(e);const hasPromiseApi=e=>is.function_(e?.then)&&is.function_(e?.catch);is.promise=e=>is.nativePromise(e)||hasPromiseApi(e);is.generatorFunction=isObjectOfType("GeneratorFunction");is.asyncGeneratorFunction=e=>getObjectType(e)==="AsyncGeneratorFunction";is.asyncFunction=e=>getObjectType(e)==="AsyncFunction";is.boundFunction=e=>is.function_(e)&&!e.hasOwnProperty("prototype");is.regExp=isObjectOfType("RegExp");is.date=isObjectOfType("Date");is.error=isObjectOfType("Error");is.map=e=>isObjectOfType("Map")(e);is.set=e=>isObjectOfType("Set")(e);is.weakMap=e=>isObjectOfType("WeakMap")(e);is.weakSet=e=>isObjectOfType("WeakSet")(e);is.weakRef=e=>isObjectOfType("WeakRef")(e);is.int8Array=isObjectOfType("Int8Array");is.uint8Array=isObjectOfType("Uint8Array");is.uint8ClampedArray=isObjectOfType("Uint8ClampedArray");is.int16Array=isObjectOfType("Int16Array");is.uint16Array=isObjectOfType("Uint16Array");is.int32Array=isObjectOfType("Int32Array");is.uint32Array=isObjectOfType("Uint32Array");is.float32Array=isObjectOfType("Float32Array");is.float64Array=isObjectOfType("Float64Array");is.bigInt64Array=isObjectOfType("BigInt64Array");is.bigUint64Array=isObjectOfType("BigUint64Array");is.arrayBuffer=isObjectOfType("ArrayBuffer");is.sharedArrayBuffer=isObjectOfType("SharedArrayBuffer");is.dataView=isObjectOfType("DataView");is.enumCase=(e,t)=>Object.values(t).includes(e);is.directInstanceOf=(e,t)=>Object.getPrototypeOf(e)===t.prototype;is.urlInstance=e=>isObjectOfType("URL")(e);is.urlString=e=>{if(!is.string(e)){return false}try{new URL(e);return true}catch{return false}};is.truthy=e=>Boolean(e);is.falsy=e=>!e;is.nan=e=>Number.isNaN(e);is.primitive=e=>is.null_(e)||isPrimitiveTypeName(typeof e);is.integer=e=>Number.isInteger(e);is.safeInteger=e=>Number.isSafeInteger(e);is.plainObject=e=>{if(typeof e!=="object"||e===null){return false}const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)};is.typedArray=e=>isTypedArrayName(getObjectType(e));const isValidLength=e=>is.safeInteger(e)&&e>=0;is.arrayLike=e=>!is.nullOrUndefined(e)&&!is.function_(e)&&isValidLength(e.length);is.tupleLike=(e,t)=>{if(is.array(t)&&is.array(e)&&t.length===e.length){return t.every(((t,r)=>t(e[r])))}return false};is.inRange=(e,t)=>{if(is.number(t)){return e>=Math.min(0,t)&&e<=Math.max(t,0)}if(is.array(t)&&t.length===2){return e>=Math.min(...t)&&e<=Math.max(...t)}throw new TypeError(`Invalid range: ${JSON.stringify(t)}`)};const l=1;const u=["innerHTML","ownerDocument","style","attributes","nodeValue"];is.domElement=e=>is.object(e)&&e.nodeType===l&&is.string(e.nodeName)&&!is.plainObject(e)&&u.every((t=>t in e));is.observable=e=>{if(!e){return false}if(e===e[Symbol.observable]?.()){return true}if(e===e["@@observable"]?.()){return true}return false};is.nodeStream=e=>is.object(e)&&is.function_(e.pipe)&&!is.observable(e);is.infinite=e=>e===Number.POSITIVE_INFINITY||e===Number.NEGATIVE_INFINITY;const isAbsoluteMod2=e=>t=>is.integer(t)&&Math.abs(t%2)===e;is.evenInteger=isAbsoluteMod2(0);is.oddInteger=isAbsoluteMod2(1);is.emptyArray=e=>is.array(e)&&e.length===0;is.nonEmptyArray=e=>is.array(e)&&e.length>0;is.emptyString=e=>is.string(e)&&e.length===0;const isWhiteSpaceString=e=>is.string(e)&&!/\S/.test(e);is.emptyStringOrWhitespace=e=>is.emptyString(e)||isWhiteSpaceString(e);is.nonEmptyString=e=>is.string(e)&&e.length>0;is.nonEmptyStringAndNotWhitespace=e=>is.string(e)&&!is.emptyStringOrWhitespace(e);is.emptyObject=e=>is.object(e)&&!is.map(e)&&!is.set(e)&&Object.keys(e).length===0;is.nonEmptyObject=e=>is.object(e)&&!is.map(e)&&!is.set(e)&&Object.keys(e).length>0;is.emptySet=e=>is.set(e)&&e.size===0;is.nonEmptySet=e=>is.set(e)&&e.size>0;is.emptyMap=e=>is.map(e)&&e.size===0;is.nonEmptyMap=e=>is.map(e)&&e.size>0;is.propertyKey=e=>is.any([is.string,is.number,is.symbol],e);is.formData=e=>isObjectOfType("FormData")(e);is.urlSearchParams=e=>isObjectOfType("URLSearchParams")(e);const predicateOnArray=(e,t,r)=>{if(!is.function_(t)){throw new TypeError(`Invalid predicate: ${JSON.stringify(t)}`)}if(r.length===0){throw new TypeError("Invalid number of values")}return e.call(r,t)};is.any=(e,...t)=>{const r=is.array(e)?e:[e];return r.some((e=>predicateOnArray(Array.prototype.some,e,t)))};is.all=(e,...t)=>predicateOnArray(Array.prototype.every,e,t);const assertType=(e,t,r,i={})=>{if(!e){const{multipleValues:e}=i;const n=e?`received values of types ${[...new Set(r.map((e=>`\`${is(e)}\``)))].join(", ")}`:`received value of type \`${is(r)}\``;throw new TypeError(`Expected value which is \`${t}\`, ${n}.`)}};const c={undefined:e=>assertType(is.undefined(e),"undefined",e),string:e=>assertType(is.string(e),"string",e),number:e=>assertType(is.number(e),"number",e),positiveNumber:e=>assertType(is.positiveNumber(e),"positive number",e),negativeNumber:e=>assertType(is.negativeNumber(e),"negative number",e),bigint:e=>assertType(is.bigint(e),"bigint",e),function_:e=>assertType(is.function_(e),"Function",e),null_:e=>assertType(is.null_(e),"null",e),class_:e=>assertType(is.class_(e),"Class",e),boolean:e=>assertType(is.boolean(e),"boolean",e),symbol:e=>assertType(is.symbol(e),"symbol",e),numericString:e=>assertType(is.numericString(e),"string with a number",e),array:(e,t)=>{const r=assertType;r(is.array(e),"Array",e);if(t){e.forEach(t)}},buffer:e=>assertType(is.buffer(e),"Buffer",e),blob:e=>assertType(is.blob(e),"Blob",e),nullOrUndefined:e=>assertType(is.nullOrUndefined(e),"null or undefined",e),object:e=>assertType(is.object(e),"Object",e),iterable:e=>assertType(is.iterable(e),"Iterable",e),asyncIterable:e=>assertType(is.asyncIterable(e),"AsyncIterable",e),generator:e=>assertType(is.generator(e),"Generator",e),asyncGenerator:e=>assertType(is.asyncGenerator(e),"AsyncGenerator",e),nativePromise:e=>assertType(is.nativePromise(e),"native Promise",e),promise:e=>assertType(is.promise(e),"Promise",e),generatorFunction:e=>assertType(is.generatorFunction(e),"GeneratorFunction",e),asyncGeneratorFunction:e=>assertType(is.asyncGeneratorFunction(e),"AsyncGeneratorFunction",e),asyncFunction:e=>assertType(is.asyncFunction(e),"AsyncFunction",e),boundFunction:e=>assertType(is.boundFunction(e),"Function",e),regExp:e=>assertType(is.regExp(e),"RegExp",e),date:e=>assertType(is.date(e),"Date",e),error:e=>assertType(is.error(e),"Error",e),map:e=>assertType(is.map(e),"Map",e),set:e=>assertType(is.set(e),"Set",e),weakMap:e=>assertType(is.weakMap(e),"WeakMap",e),weakSet:e=>assertType(is.weakSet(e),"WeakSet",e),weakRef:e=>assertType(is.weakRef(e),"WeakRef",e),int8Array:e=>assertType(is.int8Array(e),"Int8Array",e),uint8Array:e=>assertType(is.uint8Array(e),"Uint8Array",e),uint8ClampedArray:e=>assertType(is.uint8ClampedArray(e),"Uint8ClampedArray",e),int16Array:e=>assertType(is.int16Array(e),"Int16Array",e),uint16Array:e=>assertType(is.uint16Array(e),"Uint16Array",e),int32Array:e=>assertType(is.int32Array(e),"Int32Array",e),uint32Array:e=>assertType(is.uint32Array(e),"Uint32Array",e),float32Array:e=>assertType(is.float32Array(e),"Float32Array",e),float64Array:e=>assertType(is.float64Array(e),"Float64Array",e),bigInt64Array:e=>assertType(is.bigInt64Array(e),"BigInt64Array",e),bigUint64Array:e=>assertType(is.bigUint64Array(e),"BigUint64Array",e),arrayBuffer:e=>assertType(is.arrayBuffer(e),"ArrayBuffer",e),sharedArrayBuffer:e=>assertType(is.sharedArrayBuffer(e),"SharedArrayBuffer",e),dataView:e=>assertType(is.dataView(e),"DataView",e),enumCase:(e,t)=>assertType(is.enumCase(e,t),"EnumCase",e),urlInstance:e=>assertType(is.urlInstance(e),"URL",e),urlString:e=>assertType(is.urlString(e),"string with a URL",e),truthy:e=>assertType(is.truthy(e),"truthy",e),falsy:e=>assertType(is.falsy(e),"falsy",e),nan:e=>assertType(is.nan(e),"NaN",e),primitive:e=>assertType(is.primitive(e),"primitive",e),integer:e=>assertType(is.integer(e),"integer",e),safeInteger:e=>assertType(is.safeInteger(e),"integer",e),plainObject:e=>assertType(is.plainObject(e),"plain object",e),typedArray:e=>assertType(is.typedArray(e),"TypedArray",e),arrayLike:e=>assertType(is.arrayLike(e),"array-like",e),tupleLike:(e,t)=>assertType(is.tupleLike(e,t),"tuple-like",e),domElement:e=>assertType(is.domElement(e),"HTMLElement",e),observable:e=>assertType(is.observable(e),"Observable",e),nodeStream:e=>assertType(is.nodeStream(e),"Node.js Stream",e),infinite:e=>assertType(is.infinite(e),"infinite number",e),emptyArray:e=>assertType(is.emptyArray(e),"empty array",e),nonEmptyArray:e=>assertType(is.nonEmptyArray(e),"non-empty array",e),emptyString:e=>assertType(is.emptyString(e),"empty string",e),emptyStringOrWhitespace:e=>assertType(is.emptyStringOrWhitespace(e),"empty string or whitespace",e),nonEmptyString:e=>assertType(is.nonEmptyString(e),"non-empty string",e),nonEmptyStringAndNotWhitespace:e=>assertType(is.nonEmptyStringAndNotWhitespace(e),"non-empty string and not whitespace",e),emptyObject:e=>assertType(is.emptyObject(e),"empty object",e),nonEmptyObject:e=>assertType(is.nonEmptyObject(e),"non-empty object",e),emptySet:e=>assertType(is.emptySet(e),"empty set",e),nonEmptySet:e=>assertType(is.nonEmptySet(e),"non-empty set",e),emptyMap:e=>assertType(is.emptyMap(e),"empty map",e),nonEmptyMap:e=>assertType(is.nonEmptyMap(e),"non-empty map",e),propertyKey:e=>assertType(is.propertyKey(e),"PropertyKey",e),formData:e=>assertType(is.formData(e),"FormData",e),urlSearchParams:e=>assertType(is.urlSearchParams(e),"URLSearchParams",e),evenInteger:e=>assertType(is.evenInteger(e),"even integer",e),oddInteger:e=>assertType(is.oddInteger(e),"odd integer",e),directInstanceOf:(e,t)=>assertType(is.directInstanceOf(e,t),"T",e),inRange:(e,t)=>assertType(is.inRange(e,t),"in range",e),any:(e,...t)=>assertType(is.any(e,...t),"predicate returns truthy for any value",t,{multipleValues:true}),all:(e,...t)=>assertType(is.all(e,...t),"predicate returns truthy for all values",t,{multipleValues:true})};Object.defineProperties(is,{class:{value:is.class_},function:{value:is.function_},null:{value:is.null_}});Object.defineProperties(c,{class:{value:c.class_},function:{value:c.function_},null:{value:c.null_}});const h=is;const d=require("node:events");class CancelError extends Error{constructor(e){super(e||"Promise was canceled");this.name="CancelError"}get isCanceled(){return true}}class PCancelable{static fn(e){return(...t)=>new PCancelable(((r,i,n)=>{t.push(n);e(...t).then(r,i)}))}constructor(e){this._cancelHandlers=[];this._isPending=true;this._isCanceled=false;this._rejectOnCancel=true;this._promise=new Promise(((t,r)=>{this._reject=r;const onResolve=e=>{if(!this._isCanceled||!onCancel.shouldReject){this._isPending=false;t(e)}};const onReject=e=>{this._isPending=false;r(e)};const onCancel=e=>{if(!this._isPending){throw new Error("The `onCancel` handler was attached after the promise settled.")}this._cancelHandlers.push(e)};Object.defineProperties(onCancel,{shouldReject:{get:()=>this._rejectOnCancel,set:e=>{this._rejectOnCancel=e}}});e(onResolve,onReject,onCancel)}))}then(e,t){return this._promise.then(e,t)}catch(e){return this._promise.catch(e)}finally(e){return this._promise.finally(e)}cancel(e){if(!this._isPending||this._isCanceled){return}this._isCanceled=true;if(this._cancelHandlers.length>0){try{for(const e of this._cancelHandlers){e()}}catch(e){this._reject(e);return}}if(this._rejectOnCancel){this._reject(new CancelError(e))}}get isCanceled(){return this._isCanceled}}Object.setPrototypeOf(PCancelable.prototype,Promise.prototype);function isRequest(e){return h.object(e)&&"_onResponse"in e}class RequestError extends Error{constructor(e,t,r){super(e);Object.defineProperty(this,"input",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"code",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"stack",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"response",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"request",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"timings",{enumerable:true,configurable:true,writable:true,value:void 0});Error.captureStackTrace(this,this.constructor);this.name="RequestError";this.code=t.code??"ERR_GOT_REQUEST_ERROR";this.input=t.input;if(isRequest(r)){Object.defineProperty(this,"request",{enumerable:false,value:r});Object.defineProperty(this,"response",{enumerable:false,value:r.response});this.options=r.options}else{this.options=r}this.timings=this.request?.timings;if(h.string(t.stack)&&h.string(this.stack)){const e=this.stack.indexOf(this.message)+this.message.length;const r=this.stack.slice(e).split("\n").reverse();const i=t.stack.slice(t.stack.indexOf(t.message)+t.message.length).split("\n").reverse();while(i.length>0&&i[0]===r[0]){r.shift()}this.stack=`${this.stack.slice(0,e)}${r.reverse().join("\n")}${i.reverse().join("\n")}`}}}class MaxRedirectsError extends RequestError{constructor(e){super(`Redirected ${e.options.maxRedirects} times. Aborting.`,{},e);this.name="MaxRedirectsError";this.code="ERR_TOO_MANY_REDIRECTS"}}class HTTPError extends RequestError{constructor(e){super(`Response code ${e.statusCode} (${e.statusMessage})`,{},e.request);this.name="HTTPError";this.code="ERR_NON_2XX_3XX_RESPONSE"}}class CacheError extends RequestError{constructor(e,t){super(e.message,e,t);this.name="CacheError";this.code=this.code==="ERR_GOT_REQUEST_ERROR"?"ERR_CACHE_ACCESS":this.code}}class UploadError extends RequestError{constructor(e,t){super(e.message,e,t);this.name="UploadError";this.code=this.code==="ERR_GOT_REQUEST_ERROR"?"ERR_UPLOAD":this.code}}class TimeoutError extends RequestError{constructor(e,t,r){super(e.message,e,r);Object.defineProperty(this,"timings",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"event",{enumerable:true,configurable:true,writable:true,value:void 0});this.name="TimeoutError";this.event=e.event;this.timings=t}}class ReadError extends RequestError{constructor(e,t){super(e.message,e,t);this.name="ReadError";this.code=this.code==="ERR_GOT_REQUEST_ERROR"?"ERR_READING_RESPONSE_STREAM":this.code}}class RetryError extends RequestError{constructor(e){super("Retrying",{},e);this.name="RetryError";this.code="ERR_RETRYING"}}class AbortError extends RequestError{constructor(e){super("This operation was aborted.",{},e);this.code="ERR_ABORTED";this.name="AbortError"}}const p=require("node:process");const m=require("node:buffer");const g=require("node:stream");const y=require("node:url");const _=require("node:http");var v=r(2361);var b=r(3837);var x=r(6214);const timer=e=>{if(e.timings){return e.timings}const t={start:Date.now(),socket:undefined,lookup:undefined,connect:undefined,secureConnect:undefined,upload:undefined,response:undefined,end:undefined,error:undefined,abort:undefined,phases:{wait:undefined,dns:undefined,tcp:undefined,tls:undefined,request:undefined,firstByte:undefined,download:undefined,total:undefined}};e.timings=t;const handleError=e=>{e.once(v.errorMonitor,(()=>{t.error=Date.now();t.phases.total=t.error-t.start}))};handleError(e);const onAbort=()=>{t.abort=Date.now();t.phases.total=t.abort-t.start};e.prependOnceListener("abort",onAbort);const onSocket=e=>{t.socket=Date.now();t.phases.wait=t.socket-t.start;if(b.types.isProxy(e)){return}const lookupListener=()=>{t.lookup=Date.now();t.phases.dns=t.lookup-t.socket};e.prependOnceListener("lookup",lookupListener);x(e,{connect:()=>{t.connect=Date.now();if(t.lookup===undefined){e.removeListener("lookup",lookupListener);t.lookup=t.connect;t.phases.dns=t.lookup-t.socket}t.phases.tcp=t.connect-t.lookup},secureConnect:()=>{t.secureConnect=Date.now();t.phases.tls=t.secureConnect-t.connect}})};if(e.socket){onSocket(e.socket)}else{e.prependOnceListener("socket",onSocket)}const onUpload=()=>{t.upload=Date.now();t.phases.request=t.upload-(t.secureConnect??t.connect)};if(e.writableFinished){onUpload()}else{e.prependOnceListener("finish",onUpload)}e.prependOnceListener("response",(r=>{t.response=Date.now();t.phases.firstByte=t.response-t.upload;r.timings=t;handleError(r);r.prependOnceListener("end",(()=>{e.off("abort",onAbort);r.off("aborted",onAbort);if(t.phases.total){return}t.end=Date.now();t.phases.download=t.end-t.response;t.phases.total=t.end-t.start}));r.prependOnceListener("aborted",onAbort)}));return t};const T=timer;const w=require("node:crypto");const S="text/plain";const E="us-ascii";const testParameter=(e,t)=>t.some((t=>t instanceof RegExp?t.test(e):t===e));const A=new Set(["https:","http:","file:"]);const hasCustomProtocol=e=>{try{const{protocol:t}=new URL(e);return t.endsWith(":")&&!A.has(t)}catch{return false}};const normalizeDataURL=(e,{stripHash:t})=>{const r=/^data:(?<type>[^,]*?),(?<data>[^#]*?)(?:#(?<hash>.*))?$/.exec(e);if(!r){throw new Error(`Invalid URL: ${e}`)}let{type:i,data:n,hash:s}=r.groups;const o=i.split(";");s=t?"":s;let a=false;if(o[o.length-1]==="base64"){o.pop();a=true}const l=o.shift()?.toLowerCase()??"";const u=o.map((e=>{let[t,r=""]=e.split("=").map((e=>e.trim()));if(t==="charset"){r=r.toLowerCase();if(r===E){return""}}return`${t}${r?`=${r}`:""}`})).filter(Boolean);const c=[...u];if(a){c.push("base64")}if(c.length>0||l&&l!==S){c.unshift(l)}return`data:${c.join(";")},${a?n.trim():n}${s?`#${s}`:""}`};function normalizeUrl(e,t){t={defaultProtocol:"http",normalizeProtocol:true,forceHttp:false,forceHttps:false,stripAuthentication:true,stripHash:false,stripTextFragment:true,stripWWW:true,removeQueryParameters:[/^utm_\w+/i],removeTrailingSlash:true,removeSingleSlash:true,removeDirectoryIndex:false,removeExplicitPort:false,sortQueryParameters:true,...t};if(typeof t.defaultProtocol==="string"&&!t.defaultProtocol.endsWith(":")){t.defaultProtocol=`${t.defaultProtocol}:`}e=e.trim();if(/^data:/i.test(e)){return normalizeDataURL(e,t)}if(hasCustomProtocol(e)){return e}const r=e.startsWith("//");const i=!r&&/^\.*\//.test(e);if(!i){e=e.replace(/^(?!(?:\w+:)?\/\/)|^\/\//,t.defaultProtocol)}const n=new URL(e);if(t.forceHttp&&t.forceHttps){throw new Error("The `forceHttp` and `forceHttps` options cannot be used together")}if(t.forceHttp&&n.protocol==="https:"){n.protocol="http:"}if(t.forceHttps&&n.protocol==="http:"){n.protocol="https:"}if(t.stripAuthentication){n.username="";n.password=""}if(t.stripHash){n.hash=""}else if(t.stripTextFragment){n.hash=n.hash.replace(/#?:~:text.*?$/i,"")}if(n.pathname){const e=/\b[a-z][a-z\d+\-.]{1,50}:\/\//g;let t=0;let r="";for(;;){const i=e.exec(n.pathname);if(!i){break}const s=i[0];const o=i.index;const a=n.pathname.slice(t,o);r+=a.replace(/\/{2,}/g,"/");r+=s;t=o+s.length}const i=n.pathname.slice(t,n.pathname.length);r+=i.replace(/\/{2,}/g,"/");n.pathname=r}if(n.pathname){try{n.pathname=decodeURI(n.pathname)}catch{}}if(t.removeDirectoryIndex===true){t.removeDirectoryIndex=[/^index\.[a-z]+$/]}if(Array.isArray(t.removeDirectoryIndex)&&t.removeDirectoryIndex.length>0){let e=n.pathname.split("/");const r=e[e.length-1];if(testParameter(r,t.removeDirectoryIndex)){e=e.slice(0,-1);n.pathname=e.slice(1).join("/")+"/"}}if(n.hostname){n.hostname=n.hostname.replace(/\.$/,"");if(t.stripWWW&&/^www\.(?!www\.)[a-z\-\d]{1,63}\.[a-z.\-\d]{2,63}$/.test(n.hostname)){n.hostname=n.hostname.replace(/^www\./,"")}}if(Array.isArray(t.removeQueryParameters)){for(const e of[...n.searchParams.keys()]){if(testParameter(e,t.removeQueryParameters)){n.searchParams.delete(e)}}}if(!Array.isArray(t.keepQueryParameters)&&t.removeQueryParameters===true){n.search=""}if(Array.isArray(t.keepQueryParameters)&&t.keepQueryParameters.length>0){for(const e of[...n.searchParams.keys()]){if(!testParameter(e,t.keepQueryParameters)){n.searchParams.delete(e)}}}if(t.sortQueryParameters){n.searchParams.sort();try{n.search=decodeURIComponent(n.search)}catch{}}if(t.removeTrailingSlash){n.pathname=n.pathname.replace(/\/$/,"")}if(t.removeExplicitPort&&n.port){n.port=""}const s=e;e=n.toString();if(!t.removeSingleSlash&&n.pathname==="/"&&!s.endsWith("/")&&n.hash===""){e=e.replace(/\/$/,"")}if((t.removeTrailingSlash||n.pathname==="/")&&n.hash===""&&t.removeSingleSlash){e=e.replace(/\/$/,"")}if(r&&!t.normalizeProtocol){e=e.replace(/^http:\/\//,"//")}if(t.stripProtocol){e=e.replace(/^(?:https?:)?\/\//,"")}return e}var C=r(1766);var N=r(1002);function lowercaseKeys(e){return Object.fromEntries(Object.entries(e).map((([e,t])=>[e.toLowerCase(),t])))}class Response extends g.Readable{statusCode;headers;body;url;constructor({statusCode:e,headers:t,body:r,url:i}){if(typeof e!=="number"){throw new TypeError("Argument `statusCode` should be a number")}if(typeof t!=="object"){throw new TypeError("Argument `headers` should be an object")}if(!(r instanceof Uint8Array)){throw new TypeError("Argument `body` should be a buffer")}if(typeof i!=="string"){throw new TypeError("Argument `url` should be a string")}super({read(){this.push(r);this.push(null)}});this.statusCode=e;this.headers=lowercaseKeys(t);this.body=r;this.url=i}}var O=r(1531);const R=["aborted","complete","headers","httpVersion","httpVersionMinor","httpVersionMajor","method","rawHeaders","rawTrailers","setTimeout","socket","statusCode","statusMessage","trailers","url"];function mimicResponse(e,t){if(t._readableState.autoDestroy){throw new Error("The second stream must have the `autoDestroy` option set to `false`")}const r=new Set([...Object.keys(e),...R]);const i={};for(const n of r){if(n in t){continue}i[n]={get(){const t=e[n];const r=typeof t==="function";return r?t.bind(e):t},set(t){e[n]=t},enumerable:true,configurable:false}}Object.defineProperties(t,i);e.once("aborted",(()=>{t.destroy();t.emit("aborted")}));e.once("close",(()=>{if(e.complete){if(t.readable){t.once("end",(()=>{t.emit("close")}))}else{t.emit("close")}}else{t.emit("close")}}));return t}class types_RequestError extends Error{constructor(e){super(e.message);Object.assign(this,e)}}class types_CacheError extends Error{constructor(e){super(e.message);Object.assign(this,e)}}class CacheableRequest{constructor(e,t){this.hooks=new Map;this.request=()=>(e,t)=>{let r;if(typeof e==="string"){r=normalizeUrlObject(y.parse(e));e={}}else if(e instanceof y.URL){r=normalizeUrlObject(y.parse(e.toString()));e={}}else{const[t,...i]=(e.path??"").split("?");const n=i.length>0?`?${i.join("?")}`:"";r=normalizeUrlObject({...e,pathname:t,search:n})}e={headers:{},method:"GET",cache:true,strictTtl:false,automaticFailover:false,...e,...urlObjectToRequestOptions(r)};e.headers=Object.fromEntries(k(e.headers).map((([e,t])=>[e.toLowerCase(),t])));const i=new d;const n=normalizeUrl(y.format(r),{stripWWW:false,removeTrailingSlash:false,stripAuthentication:false});let s=`${e.method}:${n}`;if(e.body&&e.method!==undefined&&["POST","PATCH","PUT"].includes(e.method)){if(e.body instanceof g.Readable){e.cache=false}else{s+=`:${w.createHash("md5").update(e.body).digest("hex")}`}}let o=false;let a=false;const makeRequest=e=>{a=true;let r=false;let requestErrorCallback=()=>{};const n=new Promise((e=>{requestErrorCallback=()=>{if(!r){r=true;e()}}}));const handler=async r=>{if(o){r.status=r.statusCode;const t=N.fromObject(o.cachePolicy).revalidatedPolicy(e,r);if(!t.modified){r.resume();await new Promise((e=>{r.once("end",e)}));const e=convertHeaders(t.policy.responseHeaders());r=new Response({statusCode:o.statusCode,headers:e,body:o.body,url:o.url});r.cachePolicy=t.policy;r.fromCache=true}}if(!r.fromCache){r.cachePolicy=new N(e,r,e);r.fromCache=false}let a;if(e.cache&&r.cachePolicy.storable()){a=cloneResponse(r);(async()=>{try{const t=C.buffer(r);await Promise.race([n,new Promise((e=>r.once("end",e))),new Promise((e=>r.once("close",e)))]);const i=await t;let a={url:r.url,statusCode:r.fromCache?o.statusCode:r.statusCode,body:i,cachePolicy:r.cachePolicy.toObject()};let l=e.strictTtl?r.cachePolicy.timeToLive():undefined;if(e.maxTtl){l=l?Math.min(l,e.maxTtl):e.maxTtl}if(this.hooks.size>0){for(const e of this.hooks.keys()){a=await this.runHook(e,a,r)}}await this.cache.set(s,a,l)}catch(e){i.emit("error",new types_CacheError(e))}})()}else if(e.cache&&o){(async()=>{try{await this.cache.delete(s)}catch(e){i.emit("error",new types_CacheError(e))}})()}i.emit("response",a??r);if(typeof t==="function"){t(a??r)}};try{const t=this.cacheRequest(e,handler);t.once("error",requestErrorCallback);t.once("abort",requestErrorCallback);t.once("destroy",requestErrorCallback);i.emit("request",t)}catch(e){i.emit("error",new types_RequestError(e))}};(async()=>{const get=async e=>{await Promise.resolve();const r=e.cache?await this.cache.get(s):undefined;if(r===undefined&&!e.forceRefresh){makeRequest(e);return}const n=N.fromObject(r.cachePolicy);if(n.satisfiesWithoutRevalidation(e)&&!e.forceRefresh){const e=convertHeaders(n.responseHeaders());const s=new Response({statusCode:r.statusCode,headers:e,body:r.body,url:r.url});s.cachePolicy=n;s.fromCache=true;i.emit("response",s);if(typeof t==="function"){t(s)}}else if(n.satisfiesWithoutRevalidation(e)&&Date.now()>=n.timeToLive()&&e.forceRefresh){await this.cache.delete(s);e.headers=n.revalidationHeaders(e);makeRequest(e)}else{o=r;e.headers=n.revalidationHeaders(e);makeRequest(e)}};const errorHandler=e=>i.emit("error",new types_CacheError(e));if(this.cache instanceof O){const e=this.cache;e.once("error",errorHandler);i.on("error",(()=>e.removeListener("error",errorHandler)));i.on("response",(()=>e.removeListener("error",errorHandler)))}try{await get(e)}catch(t){if(e.automaticFailover&&!a){makeRequest(e)}i.emit("error",new types_CacheError(t))}})();return i};this.addHook=(e,t)=>{if(!this.hooks.has(e)){this.hooks.set(e,t)}};this.removeHook=e=>this.hooks.delete(e);this.getHook=e=>this.hooks.get(e);this.runHook=async(e,...t)=>this.hooks.get(e)?.(...t);if(t instanceof O){this.cache=t}else if(typeof t==="string"){this.cache=new O({uri:t,namespace:"cacheable-request"})}else{this.cache=new O({store:t,namespace:"cacheable-request"})}this.request=this.request.bind(this);this.cacheRequest=e}}const k=Object.entries;const cloneResponse=e=>{const t=new g.PassThrough({autoDestroy:false});mimicResponse(e,t);return e.pipe(t)};const urlObjectToRequestOptions=e=>{const t={...e};t.path=`${e.pathname||"/"}${e.search||""}`;delete t.pathname;delete t.search;return t};const normalizeUrlObject=e=>({protocol:e.protocol,auth:e.auth,hostname:e.hostname||e.host||"localhost",port:e.port,pathname:e.pathname,search:e.search});const convertHeaders=e=>{const t=[];for(const r of Object.keys(e)){t[r.toLowerCase()]=e[r]}return t};const P=CacheableRequest;const L="onResponse";var I=r(2391);const isFunction=e=>typeof e==="function";const isFormData=e=>Boolean(e&&isFunction(e.constructor)&&e[Symbol.toStringTag]==="FormData"&&isFunction(e.append)&&isFunction(e.getAll)&&isFunction(e.entries)&&isFunction(e[Symbol.iterator]));const isAsyncIterable=e=>isFunction(e[Symbol.asyncIterator]);async function*readStream(e){const t=e.getReader();while(true){const{done:e,value:r}=await t.read();if(e){break}yield r}}const getStreamIterator=e=>{if(isAsyncIterable(e)){return e}if(isFunction(e.getReader)){return readStream(e)}throw new TypeError("Unsupported data source: Expected either ReadableStream or async iterable.")};const M="abcdefghijklmnopqrstuvwxyz0123456789";function createBoundary(){let e=16;let t="";while(e--){t+=M[Math.random()*M.length<<0]}return t}const normalizeValue=e=>String(e).replace(/\r|\n/g,((e,t,r)=>{if(e==="\r"&&r[t+1]!=="\n"||e==="\n"&&r[t-1]!=="\r"){return"\r\n"}return e}));const getType=e=>Object.prototype.toString.call(e).slice(8,-1).toLowerCase();function isPlainObject(e){if(getType(e)!=="object"){return false}const t=Object.getPrototypeOf(e);if(t===null||t===undefined){return true}const r=t.constructor&&t.constructor.toString();return r===Object.toString()}function getProperty(e,t){if(typeof t==="string"){for(const[r,i]of Object.entries(e)){if(t.toLowerCase()===r.toLowerCase()){return i}}}return undefined}const proxyHeaders=e=>new Proxy(e,{get:(e,t)=>getProperty(e,t),has:(e,t)=>getProperty(e,t)!==undefined});const escapeName=e=>String(e).replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/"/g,"%22");const isFile=e=>Boolean(e&&typeof e==="object"&&isFunction(e.constructor)&&e[Symbol.toStringTag]==="File"&&isFunction(e.stream)&&e.name!=null);const D=null&&isFile;var F=undefined&&undefined.__classPrivateFieldSet||function(e,t,r,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof t==="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(e,r):n?n.value=r:t.set(e,r),r};var j=undefined&&undefined.__classPrivateFieldGet||function(e,t,r,i){if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof t==="function"?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?i:r==="a"?i.call(e):i?i.value:t.get(e)};var B,U,H,z,K,V,q,Z,G,$,W;const Y={enableAdditionalHeaders:false};const J={writable:false,configurable:false};class FormDataEncoder{constructor(e,t,r){B.add(this);U.set(this,"\r\n");H.set(this,void 0);z.set(this,void 0);K.set(this,"-".repeat(2));V.set(this,new TextEncoder);q.set(this,void 0);Z.set(this,void 0);G.set(this,void 0);if(!isFormData(e)){throw new TypeError("Expected first argument to be a FormData instance.")}let i;if(isPlainObject(t)){r=t}else{i=t}if(!i){i=createBoundary()}if(typeof i!=="string"){throw new TypeError("Expected boundary argument to be a string.")}if(r&&!isPlainObject(r)){throw new TypeError("Expected options argument to be an object.")}F(this,Z,Array.from(e.entries()),"f");F(this,G,{...Y,...r},"f");F(this,H,j(this,V,"f").encode(j(this,U,"f")),"f");F(this,z,j(this,H,"f").byteLength,"f");this.boundary=`form-data-boundary-${i}`;this.contentType=`multipart/form-data; boundary=${this.boundary}`;F(this,q,j(this,V,"f").encode(`${j(this,K,"f")}${this.boundary}${j(this,K,"f")}${j(this,U,"f").repeat(2)}`),"f");const n={"Content-Type":this.contentType};const s=j(this,B,"m",W).call(this);if(s){this.contentLength=s;n["Content-Length"]=s}this.headers=proxyHeaders(Object.freeze(n));Object.defineProperties(this,{boundary:J,contentType:J,contentLength:J,headers:J})}getContentLength(){return this.contentLength==null?undefined:Number(this.contentLength)}*values(){for(const[e,t]of j(this,Z,"f")){const r=isFile(t)?t:j(this,V,"f").encode(normalizeValue(t));yield j(this,B,"m",$).call(this,e,r);yield r;yield j(this,H,"f")}yield j(this,q,"f")}async*encode(){for(const e of this.values()){if(isFile(e)){yield*getStreamIterator(e.stream())}else{yield e}}}[(U=new WeakMap,H=new WeakMap,z=new WeakMap,K=new WeakMap,V=new WeakMap,q=new WeakMap,Z=new WeakMap,G=new WeakMap,B=new WeakSet,$=function _FormDataEncoder_getFieldHeader(e,t){let r="";r+=`${j(this,K,"f")}${this.boundary}${j(this,U,"f")}`;r+=`Content-Disposition: form-data; name="${escapeName(e)}"`;if(isFile(t)){r+=`; filename="${escapeName(t.name)}"${j(this,U,"f")}`;r+=`Content-Type: ${t.type||"application/octet-stream"}`}const i=isFile(t)?t.size:t.byteLength;if(j(this,G,"f").enableAdditionalHeaders===true&&i!=null&&!isNaN(i)){r+=`${j(this,U,"f")}Content-Length: ${isFile(t)?t.size:t.byteLength}`}return j(this,V,"f").encode(`${r}${j(this,U,"f").repeat(2)}`)},W=function _FormDataEncoder_getContentLength(){let e=0;for(const[t,r]of j(this,Z,"f")){const i=isFile(r)?r:j(this,V,"f").encode(normalizeValue(r));const n=isFile(i)?i.size:i.byteLength;if(n==null||isNaN(n)){return undefined}e+=j(this,B,"m",$).call(this,t,i).byteLength;e+=n;e+=j(this,z,"f")}return String(e+j(this,q,"f").byteLength)},Symbol.iterator)](){return this.values()}[Symbol.asyncIterator](){return this.encode()}}const Q=require("node:util");function is_form_data_isFormData(e){return h.nodeStream(e)&&h.function_(e.getBoundary)}async function getBodySize(e,t){if(t&&"content-length"in t){return Number(t["content-length"])}if(!e){return 0}if(h.string(e)){return m.Buffer.byteLength(e)}if(h.buffer(e)){return e.length}if(is_form_data_isFormData(e)){return(0,Q.promisify)(e.getLength.bind(e))()}return undefined}function proxyEvents(e,t,r){const i={};for(const n of r){const eventFunction=(...e)=>{t.emit(n,...e)};i[n]=eventFunction;e.on(n,eventFunction)}return()=>{for(const[t,r]of Object.entries(i)){e.off(t,r)}}}const X=require("node:net");function unhandle(){const e=[];return{once(t,r,i){t.once(r,i);e.push({origin:t,event:r,fn:i})},unhandleAll(){for(const t of e){const{origin:e,event:r,fn:i}=t;e.removeListener(r,i)}e.length=0}}}const ee=Symbol("reentry");const noop=()=>{};class timed_out_TimeoutError extends Error{constructor(e,t){super(`Timeout awaiting '${t}' for ${e}ms`);Object.defineProperty(this,"event",{enumerable:true,configurable:true,writable:true,value:t});Object.defineProperty(this,"code",{enumerable:true,configurable:true,writable:true,value:void 0});this.name="TimeoutError";this.code="ETIMEDOUT"}}function timedOut(e,t,r){if(ee in e){return noop}e[ee]=true;const i=[];const{once:n,unhandleAll:s}=unhandle();const addTimeout=(e,t,r)=>{const n=setTimeout(t,e,e,r);n.unref?.();const cancel=()=>{clearTimeout(n)};i.push(cancel);return cancel};const{host:o,hostname:a}=r;const timeoutHandler=(t,r)=>{e.destroy(new timed_out_TimeoutError(t,r))};const cancelTimeouts=()=>{for(const e of i){e()}s()};e.once("error",(t=>{cancelTimeouts();if(e.listenerCount("error")===0){throw t}}));if(typeof t.request!=="undefined"){const r=addTimeout(t.request,timeoutHandler,"request");n(e,"response",(e=>{n(e,"end",r)}))}if(typeof t.socket!=="undefined"){const{socket:r}=t;const socketTimeoutHandler=()=>{timeoutHandler(r,"socket")};e.setTimeout(r,socketTimeoutHandler);i.push((()=>{e.removeListener("timeout",socketTimeoutHandler)}))}const l=typeof t.lookup!=="undefined";const u=typeof t.connect!=="undefined";const c=typeof t.secureConnect!=="undefined";const h=typeof t.send!=="undefined";if(l||u||c||h){n(e,"socket",(i=>{const{socketPath:s}=e;if(i.connecting){const e=Boolean(s??X.isIP(a??o??"")!==0);if(l&&!e&&typeof i.address().address==="undefined"){const e=addTimeout(t.lookup,timeoutHandler,"lookup");n(i,"lookup",e)}if(u){const timeConnect=()=>addTimeout(t.connect,timeoutHandler,"connect");if(e){n(i,"connect",timeConnect())}else{n(i,"lookup",(e=>{if(e===null){n(i,"connect",timeConnect())}}))}}if(c&&r.protocol==="https:"){n(i,"connect",(()=>{const e=addTimeout(t.secureConnect,timeoutHandler,"secureConnect");n(i,"secureConnect",e)}))}}if(h){const timeRequest=()=>addTimeout(t.send,timeoutHandler,"send");if(i.connecting){n(i,"connect",(()=>{n(e,"upload-complete",timeRequest())}))}else{n(e,"upload-complete",timeRequest())}}}))}if(typeof t.response!=="undefined"){n(e,"upload-complete",(()=>{const r=addTimeout(t.response,timeoutHandler,"response");n(e,"response",r)}))}if(typeof t.read!=="undefined"){n(e,"response",(e=>{const r=addTimeout(t.read,timeoutHandler,"read");n(e,"end",r)}))}return cancelTimeouts}function urlToOptions(e){e=e;const t={protocol:e.protocol,hostname:h.string(e.hostname)&&e.hostname.startsWith("[")?e.hostname.slice(1,-1):e.hostname,host:e.host,hash:e.hash,search:e.search,pathname:e.pathname,href:e.href,path:`${e.pathname||""}${e.search||""}`};if(h.string(e.port)&&e.port.length>0){t.port=Number(e.port)}if(e.username||e.password){t.auth=`${e.username||""}:${e.password||""}`}return t}class WeakableMap{constructor(){Object.defineProperty(this,"weakMap",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"map",{enumerable:true,configurable:true,writable:true,value:void 0});this.weakMap=new WeakMap;this.map=new Map}set(e,t){if(typeof e==="object"){this.weakMap.set(e,t)}else{this.map.set(e,t)}}get(e){if(typeof e==="object"){return this.weakMap.get(e)}return this.map.get(e)}has(e){if(typeof e==="object"){return this.weakMap.has(e)}return this.map.has(e)}}const calculateRetryDelay=({attemptCount:e,retryOptions:t,error:r,retryAfter:i,computedValue:n})=>{if(r.name==="RetryError"){return 1}if(e>t.limit){return 0}const s=t.methods.includes(r.options.method);const o=t.errorCodes.includes(r.code);const a=r.response&&t.statusCodes.includes(r.response.statusCode);if(!s||!o&&!a){return 0}if(r.response){if(i){if(i>n){return 0}return i}if(r.response.statusCode===413){return 0}}const l=Math.random()*t.noise;return Math.min(2**(e-1)*1e3,t.backoffLimit)+l};const te=calculateRetryDelay;const re=require("node:tls");const ie=require("node:https");const ne=require("node:dns");const se=require("node:os");const{Resolver:oe}=ne.promises;const ae=Symbol("cacheableLookupCreateConnection");const le=Symbol("cacheableLookupInstance");const ue=Symbol("expires");const ce=typeof ne.ALL==="number";const verifyAgent=e=>{if(!(e&&typeof e.createConnection==="function")){throw new Error("Expected an Agent instance as the first argument")}};const map4to6=e=>{for(const t of e){if(t.family===6){continue}t.address=`::ffff:${t.address}`;t.family=6}};const getIfaceInfo=()=>{let e=false;let t=false;for(const r of Object.values(se.networkInterfaces())){for(const i of r){if(i.internal){continue}if(i.family==="IPv6"){t=true}else{e=true}if(e&&t){return{has4:e,has6:t}}}}return{has4:e,has6:t}};const isIterable=e=>Symbol.iterator in e;const ignoreNoResultErrors=e=>e.catch((e=>{if(e.code==="ENODATA"||e.code==="ENOTFOUND"||e.code==="ENOENT"){return[]}throw e}));const he={ttl:true};const de={all:true};const fe={all:true,family:4};const pe={all:true,family:6};class CacheableLookup{constructor({cache:e=new Map,maxTtl:t=Infinity,fallbackDuration:r=3600,errorTtl:i=.15,resolver:n=new oe,lookup:s=ne.lookup}={}){this.maxTtl=t;this.errorTtl=i;this._cache=e;this._resolver=n;this._dnsLookup=s&&(0,Q.promisify)(s);this.stats={cache:0,query:0};if(this._resolver instanceof oe){this._resolve4=this._resolver.resolve4.bind(this._resolver);this._resolve6=this._resolver.resolve6.bind(this._resolver)}else{this._resolve4=(0,Q.promisify)(this._resolver.resolve4.bind(this._resolver));this._resolve6=(0,Q.promisify)(this._resolver.resolve6.bind(this._resolver))}this._iface=getIfaceInfo();this._pending={};this._nextRemovalTime=false;this._hostnamesToFallback=new Set;this.fallbackDuration=r;if(r>0){const e=setInterval((()=>{this._hostnamesToFallback.clear()}),r*1e3);if(e.unref){e.unref()}this._fallbackInterval=e}this.lookup=this.lookup.bind(this);this.lookupAsync=this.lookupAsync.bind(this)}set servers(e){this.clear();this._resolver.setServers(e)}get servers(){return this._resolver.getServers()}lookup(e,t,r){if(typeof t==="function"){r=t;t={}}else if(typeof t==="number"){t={family:t}}if(!r){throw new Error("Callback must be a function.")}this.lookupAsync(e,t).then((e=>{if(t.all){r(null,e)}else{r(null,e.address,e.family,e.expires,e.ttl,e.source)}}),r)}async lookupAsync(e,t={}){if(typeof t==="number"){t={family:t}}let r=await this.query(e);if(t.family===6){const e=r.filter((e=>e.family===6));if(t.hints&ne.V4MAPPED){if(ce&&t.hints&ne.ALL||e.length===0){map4to6(r)}else{r=e}}else{r=e}}else if(t.family===4){r=r.filter((e=>e.family===4))}if(t.hints&ne.ADDRCONFIG){const{_iface:e}=this;r=r.filter((t=>t.family===6?e.has6:e.has4))}if(r.length===0){const t=new Error(`cacheableLookup ENOTFOUND ${e}`);t.code="ENOTFOUND";t.hostname=e;throw t}if(t.all){return r}return r[0]}async query(e){let t="cache";let r=await this._cache.get(e);if(r){this.stats.cache++}if(!r){const i=this._pending[e];if(i){this.stats.cache++;r=await i}else{t="query";const i=this.queryAndCache(e);this._pending[e]=i;this.stats.query++;try{r=await i}finally{delete this._pending[e]}}}r=r.map((e=>({...e,source:t})));return r}async _resolve(e){const[t,r]=await Promise.all([ignoreNoResultErrors(this._resolve4(e,he)),ignoreNoResultErrors(this._resolve6(e,he))]);let i=0;let n=0;let s=0;const o=Date.now();for(const e of t){e.family=4;e.expires=o+e.ttl*1e3;i=Math.max(i,e.ttl)}for(const e of r){e.family=6;e.expires=o+e.ttl*1e3;n=Math.max(n,e.ttl)}if(t.length>0){if(r.length>0){s=Math.min(i,n)}else{s=i}}else{s=n}return{entries:[...t,...r],cacheTtl:s}}async _lookup(e){try{const[t,r]=await Promise.all([ignoreNoResultErrors(this._dnsLookup(e,fe)),ignoreNoResultErrors(this._dnsLookup(e,pe))]);return{entries:[...t,...r],cacheTtl:0}}catch{return{entries:[],cacheTtl:0}}}async _set(e,t,r){if(this.maxTtl>0&&r>0){r=Math.min(r,this.maxTtl)*1e3;t[ue]=Date.now()+r;try{await this._cache.set(e,t,r)}catch(e){this.lookupAsync=async()=>{const t=new Error("Cache Error. Please recreate the CacheableLookup instance.");t.cause=e;throw t}}if(isIterable(this._cache)){this._tick(r)}}}async queryAndCache(e){if(this._hostnamesToFallback.has(e)){return this._dnsLookup(e,de)}let t=await this._resolve(e);if(t.entries.length===0&&this._dnsLookup){t=await this._lookup(e);if(t.entries.length!==0&&this.fallbackDuration>0){this._hostnamesToFallback.add(e)}}const r=t.entries.length===0?this.errorTtl:t.cacheTtl;await this._set(e,t.entries,r);return t.entries}_tick(e){const t=this._nextRemovalTime;if(!t||e<t){clearTimeout(this._removalTimeout);this._nextRemovalTime=e;this._removalTimeout=setTimeout((()=>{this._nextRemovalTime=false;let e=Infinity;const t=Date.now();for(const[r,i]of this._cache){const n=i[ue];if(t>=n){this._cache.delete(r)}else if(n<e){e=n}}if(e!==Infinity){this._tick(e-t)}}),e);if(this._removalTimeout.unref){this._removalTimeout.unref()}}}install(e){verifyAgent(e);if(ae in e){throw new Error("CacheableLookup has been already installed")}e[ae]=e.createConnection;e[le]=this;e.createConnection=(t,r)=>{if(!("lookup"in t)){t.lookup=this.lookup}return e[ae](t,r)}}uninstall(e){verifyAgent(e);if(e[ae]){if(e[le]!==this){throw new Error("The agent is not owned by this CacheableLookup instance")}e.createConnection=e[ae];delete e[ae];delete e[le]}}updateInterfaceInfo(){const{_iface:e}=this;this._iface=getIfaceInfo();if(e.has4&&!this._iface.has4||e.has6&&!this._iface.has6){this._cache.clear()}}clear(e){if(e){this._cache.delete(e);return}this._cache.clear()}}var me=r(4645);function parseLinkHeader(e){const t=[];const r=e.split(",");for(const i of r){const[r,...n]=i.split(";");const s=r.trim();if(s[0]!=="<"||s[s.length-1]!==">"){throw new Error(`Invalid format of the Link header reference: ${s}`)}const o=s.slice(1,-1);const a={};if(n.length===0){throw new Error(`Unexpected end of Link header parameters: ${n.join(";")}`)}for(const t of n){const r=t.trim();const i=r.indexOf("=");if(i===-1){throw new Error(`Failed to parse Link header: ${e}`)}const n=r.slice(0,i).trim();const s=r.slice(i+1).trim();a[n]=s}t.push({reference:o,parameters:a})}return t}const[ge,ye]=p.versions.node.split(".").map(Number);function validateSearchParameters(e){for(const t in e){const r=e[t];c.any([h.string,h.number,h.boolean,h.null_,h.undefined],r)}}const _e=new Map;let ve;const getGlobalDnsCache=()=>{if(ve){return ve}ve=new CacheableLookup;return ve};const be={request:undefined,agent:{http:undefined,https:undefined,http2:undefined},h2session:undefined,decompress:true,timeout:{connect:undefined,lookup:undefined,read:undefined,request:undefined,response:undefined,secureConnect:undefined,send:undefined,socket:undefined},prefixUrl:"",body:undefined,form:undefined,json:undefined,cookieJar:undefined,ignoreInvalidCookies:false,searchParams:undefined,dnsLookup:undefined,dnsCache:undefined,context:{},hooks:{init:[],beforeRequest:[],beforeError:[],beforeRedirect:[],beforeRetry:[],afterResponse:[]},followRedirect:true,maxRedirects:10,cache:undefined,throwHttpErrors:true,username:"",password:"",http2:false,allowGetBody:false,headers:{"user-agent":"got (https://github.com/sindresorhus/got)"},methodRewriting:false,dnsLookupIpVersion:undefined,parseJson:JSON.parse,stringifyJson:JSON.stringify,retry:{limit:2,methods:["GET","PUT","HEAD","DELETE","OPTIONS","TRACE"],statusCodes:[408,413,429,500,502,503,504,521,522,524],errorCodes:["ETIMEDOUT","ECONNRESET","EADDRINUSE","ECONNREFUSED","EPIPE","ENOTFOUND","ENETUNREACH","EAI_AGAIN"],maxRetryAfter:undefined,calculateDelay:({computedValue:e})=>e,backoffLimit:Number.POSITIVE_INFINITY,noise:100},localAddress:undefined,method:"GET",createConnection:undefined,cacheOptions:{shared:undefined,cacheHeuristic:undefined,immutableMinTimeToLive:undefined,ignoreCargoCult:undefined},https:{alpnProtocols:undefined,rejectUnauthorized:undefined,checkServerIdentity:undefined,certificateAuthority:undefined,key:undefined,certificate:undefined,passphrase:undefined,pfx:undefined,ciphers:undefined,honorCipherOrder:undefined,minVersion:undefined,maxVersion:undefined,signatureAlgorithms:undefined,tlsSessionLifetime:undefined,dhparam:undefined,ecdhCurve:undefined,certificateRevocationLists:undefined},encoding:undefined,resolveBodyOnly:false,isStream:false,responseType:"text",url:undefined,pagination:{transform(e){if(e.request.options.responseType==="json"){return e.body}return JSON.parse(e.body)},paginate({response:e}){const t=e.headers.link;if(typeof t!=="string"||t.trim()===""){return false}const r=parseLinkHeader(t);const i=r.find((e=>e.parameters.rel==="next"||e.parameters.rel==='"next"'));if(i){return{url:new y.URL(i.reference,e.url)}}return false},filter:()=>true,shouldContinue:()=>true,countLimit:Number.POSITIVE_INFINITY,backoff:0,requestLimit:1e4,stackAllItems:false},setHost:true,maxHeaderSize:undefined,signal:undefined,enableUnixSockets:true};const cloneInternals=e=>{const{hooks:t,retry:r}=e;const i={...e,context:{...e.context},cacheOptions:{...e.cacheOptions},https:{...e.https},agent:{...e.agent},headers:{...e.headers},retry:{...r,errorCodes:[...r.errorCodes],methods:[...r.methods],statusCodes:[...r.statusCodes]},timeout:{...e.timeout},hooks:{init:[...t.init],beforeRequest:[...t.beforeRequest],beforeError:[...t.beforeError],beforeRedirect:[...t.beforeRedirect],beforeRetry:[...t.beforeRetry],afterResponse:[...t.afterResponse]},searchParams:e.searchParams?new y.URLSearchParams(e.searchParams):undefined,pagination:{...e.pagination}};if(i.url!==undefined){i.prefixUrl=""}return i};const cloneRaw=e=>{const{hooks:t,retry:r}=e;const i={...e};if(h.object(e.context)){i.context={...e.context}}if(h.object(e.cacheOptions)){i.cacheOptions={...e.cacheOptions}}if(h.object(e.https)){i.https={...e.https}}if(h.object(e.cacheOptions)){i.cacheOptions={...i.cacheOptions}}if(h.object(e.agent)){i.agent={...e.agent}}if(h.object(e.headers)){i.headers={...e.headers}}if(h.object(r)){i.retry={...r};if(h.array(r.errorCodes)){i.retry.errorCodes=[...r.errorCodes]}if(h.array(r.methods)){i.retry.methods=[...r.methods]}if(h.array(r.statusCodes)){i.retry.statusCodes=[...r.statusCodes]}}if(h.object(e.timeout)){i.timeout={...e.timeout}}if(h.object(t)){i.hooks={...t};if(h.array(t.init)){i.hooks.init=[...t.init]}if(h.array(t.beforeRequest)){i.hooks.beforeRequest=[...t.beforeRequest]}if(h.array(t.beforeError)){i.hooks.beforeError=[...t.beforeError]}if(h.array(t.beforeRedirect)){i.hooks.beforeRedirect=[...t.beforeRedirect]}if(h.array(t.beforeRetry)){i.hooks.beforeRetry=[...t.beforeRetry]}if(h.array(t.afterResponse)){i.hooks.afterResponse=[...t.afterResponse]}}if(h.object(e.pagination)){i.pagination={...e.pagination}}return i};const getHttp2TimeoutOption=e=>{const t=[e.timeout.socket,e.timeout.connect,e.timeout.lookup,e.timeout.request,e.timeout.secureConnect].filter((e=>typeof e==="number"));if(t.length>0){return Math.min(...t)}return undefined};const init=(e,t,r)=>{const i=e.hooks?.init;if(i){for(const e of i){e(t,r)}}};class Options{constructor(e,t,r){Object.defineProperty(this,"_unixOptions",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_internals",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_merging",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_init",{enumerable:true,configurable:true,writable:true,value:void 0});c.any([h.string,h.urlInstance,h.object,h.undefined],e);c.any([h.object,h.undefined],t);c.any([h.object,h.undefined],r);if(e instanceof Options||t instanceof Options){throw new TypeError("The defaults must be passed as the third argument")}this._internals=cloneInternals(r?._internals??r??be);this._init=[...r?._init??[]];this._merging=false;this._unixOptions=undefined;try{if(h.plainObject(e)){try{this.merge(e);this.merge(t)}finally{this.url=e.url}}else{try{this.merge(t)}finally{if(t?.url!==undefined){if(e===undefined){this.url=t.url}else{throw new TypeError("The `url` option is mutually exclusive with the `input` argument")}}else if(e!==undefined){this.url=e}}}}catch(e){e.options=this;throw e}}merge(e){if(!e){return}if(e instanceof Options){for(const t of e._init){this.merge(t)}return}e=cloneRaw(e);init(this,e,this);init(e,e,this);this._merging=true;if("isStream"in e){this.isStream=e.isStream}try{let t=false;for(const r in e){if(r==="mutableDefaults"||r==="handlers"){continue}if(r==="url"){continue}if(!(r in this)){throw new Error(`Unexpected option: ${r}`)}this[r]=e[r];t=true}if(t){this._init.push(e)}}finally{this._merging=false}}get request(){return this._internals.request}set request(e){c.any([h.function_,h.undefined],e);this._internals.request=e}get agent(){return this._internals.agent}set agent(e){c.plainObject(e);for(const t in e){if(!(t in this._internals.agent)){throw new TypeError(`Unexpected agent option: ${t}`)}c.any([h.object,h.undefined],e[t])}if(this._merging){Object.assign(this._internals.agent,e)}else{this._internals.agent={...e}}}get h2session(){return this._internals.h2session}set h2session(e){this._internals.h2session=e}get decompress(){return this._internals.decompress}set decompress(e){c.boolean(e);this._internals.decompress=e}get timeout(){return this._internals.timeout}set timeout(e){c.plainObject(e);for(const t in e){if(!(t in this._internals.timeout)){throw new Error(`Unexpected timeout option: ${t}`)}c.any([h.number,h.undefined],e[t])}if(this._merging){Object.assign(this._internals.timeout,e)}else{this._internals.timeout={...e}}}get prefixUrl(){return this._internals.prefixUrl}set prefixUrl(e){c.any([h.string,h.urlInstance],e);if(e===""){this._internals.prefixUrl="";return}e=e.toString();if(!e.endsWith("/")){e+="/"}if(this._internals.prefixUrl&&this._internals.url){const{href:t}=this._internals.url;this._internals.url.href=e+t.slice(this._internals.prefixUrl.length)}this._internals.prefixUrl=e}get body(){return this._internals.body}set body(e){c.any([h.string,h.buffer,h.nodeStream,h.generator,h.asyncGenerator,isFormData,h.undefined],e);if(h.nodeStream(e)){c.truthy(e.readable)}if(e!==undefined){c.undefined(this._internals.form);c.undefined(this._internals.json)}this._internals.body=e}get form(){return this._internals.form}set form(e){c.any([h.plainObject,h.undefined],e);if(e!==undefined){c.undefined(this._internals.body);c.undefined(this._internals.json)}this._internals.form=e}get json(){return this._internals.json}set json(e){if(e!==undefined){c.undefined(this._internals.body);c.undefined(this._internals.form)}this._internals.json=e}get url(){return this._internals.url}set url(e){c.any([h.string,h.urlInstance,h.undefined],e);if(e===undefined){this._internals.url=undefined;return}if(h.string(e)&&e.startsWith("/")){throw new Error("`url` must not start with a slash")}const t=`${this.prefixUrl}${e.toString()}`;const r=new y.URL(t);this._internals.url=r;if(r.protocol==="unix:"){r.href=`http://unix${r.pathname}${r.search}`}if(r.protocol!=="http:"&&r.protocol!=="https:"){const e=new Error(`Unsupported protocol: ${r.protocol}`);e.code="ERR_UNSUPPORTED_PROTOCOL";throw e}if(this._internals.username){r.username=this._internals.username;this._internals.username=""}if(this._internals.password){r.password=this._internals.password;this._internals.password=""}if(this._internals.searchParams){r.search=this._internals.searchParams.toString();this._internals.searchParams=undefined}if(r.hostname==="unix"){if(!this._internals.enableUnixSockets){throw new Error("Using UNIX domain sockets but option `enableUnixSockets` is not enabled")}const e=/(?<socketPath>.+?):(?<path>.+)/.exec(`${r.pathname}${r.search}`);if(e?.groups){const{socketPath:t,path:r}=e.groups;this._unixOptions={socketPath:t,path:r,host:""}}else{this._unixOptions=undefined}return}this._unixOptions=undefined}get cookieJar(){return this._internals.cookieJar}set cookieJar(e){c.any([h.object,h.undefined],e);if(e===undefined){this._internals.cookieJar=undefined;return}let{setCookie:t,getCookieString:r}=e;c.function_(t);c.function_(r);if(t.length===4&&r.length===0){t=(0,Q.promisify)(t.bind(e));r=(0,Q.promisify)(r.bind(e));this._internals.cookieJar={setCookie:t,getCookieString:r}}else{this._internals.cookieJar=e}}get signal(){return this._internals.signal}set signal(e){c.object(e);this._internals.signal=e}get ignoreInvalidCookies(){return this._internals.ignoreInvalidCookies}set ignoreInvalidCookies(e){c.boolean(e);this._internals.ignoreInvalidCookies=e}get searchParams(){if(this._internals.url){return this._internals.url.searchParams}if(this._internals.searchParams===undefined){this._internals.searchParams=new y.URLSearchParams}return this._internals.searchParams}set searchParams(e){c.any([h.string,h.object,h.undefined],e);const t=this._internals.url;if(e===undefined){this._internals.searchParams=undefined;if(t){t.search=""}return}const r=this.searchParams;let i;if(h.string(e)){i=new y.URLSearchParams(e)}else if(e instanceof y.URLSearchParams){i=e}else{validateSearchParameters(e);i=new y.URLSearchParams;for(const t in e){const n=e[t];if(n===null){i.append(t,"")}else if(n===undefined){r.delete(t)}else{i.append(t,n)}}}if(this._merging){for(const e of i.keys()){r.delete(e)}for(const[e,t]of i){r.append(e,t)}}else if(t){t.search=r.toString()}else{this._internals.searchParams=r}}get searchParameters(){throw new Error("The `searchParameters` option does not exist. Use `searchParams` instead.")}set searchParameters(e){throw new Error("The `searchParameters` option does not exist. Use `searchParams` instead.")}get dnsLookup(){return this._internals.dnsLookup}set dnsLookup(e){c.any([h.function_,h.undefined],e);this._internals.dnsLookup=e}get dnsCache(){return this._internals.dnsCache}set dnsCache(e){c.any([h.object,h.boolean,h.undefined],e);if(e===true){this._internals.dnsCache=getGlobalDnsCache()}else if(e===false){this._internals.dnsCache=undefined}else{this._internals.dnsCache=e}}get context(){return this._internals.context}set context(e){c.object(e);if(this._merging){Object.assign(this._internals.context,e)}else{this._internals.context={...e}}}get hooks(){return this._internals.hooks}set hooks(e){c.object(e);for(const t in e){if(!(t in this._internals.hooks)){throw new Error(`Unexpected hook event: ${t}`)}const r=t;const i=e[r];c.any([h.array,h.undefined],i);if(i){for(const e of i){c.function_(e)}}if(this._merging){if(i){this._internals.hooks[r].push(...i)}}else{if(!i){throw new Error(`Missing hook event: ${t}`)}this._internals.hooks[t]=[...i]}}}get followRedirect(){return this._internals.followRedirect}set followRedirect(e){c.boolean(e);this._internals.followRedirect=e}get followRedirects(){throw new TypeError("The `followRedirects` option does not exist. Use `followRedirect` instead.")}set followRedirects(e){throw new TypeError("The `followRedirects` option does not exist. Use `followRedirect` instead.")}get maxRedirects(){return this._internals.maxRedirects}set maxRedirects(e){c.number(e);this._internals.maxRedirects=e}get cache(){return this._internals.cache}set cache(e){c.any([h.object,h.string,h.boolean,h.undefined],e);if(e===true){this._internals.cache=_e}else if(e===false){this._internals.cache=undefined}else{this._internals.cache=e}}get throwHttpErrors(){return this._internals.throwHttpErrors}set throwHttpErrors(e){c.boolean(e);this._internals.throwHttpErrors=e}get username(){const e=this._internals.url;const t=e?e.username:this._internals.username;return decodeURIComponent(t)}set username(e){c.string(e);const t=this._internals.url;const r=encodeURIComponent(e);if(t){t.username=r}else{this._internals.username=r}}get password(){const e=this._internals.url;const t=e?e.password:this._internals.password;return decodeURIComponent(t)}set password(e){c.string(e);const t=this._internals.url;const r=encodeURIComponent(e);if(t){t.password=r}else{this._internals.password=r}}get http2(){return this._internals.http2}set http2(e){c.boolean(e);this._internals.http2=e}get allowGetBody(){return this._internals.allowGetBody}set allowGetBody(e){c.boolean(e);this._internals.allowGetBody=e}get headers(){return this._internals.headers}set headers(e){c.plainObject(e);if(this._merging){Object.assign(this._internals.headers,lowercaseKeys(e))}else{this._internals.headers=lowercaseKeys(e)}}get methodRewriting(){return this._internals.methodRewriting}set methodRewriting(e){c.boolean(e);this._internals.methodRewriting=e}get dnsLookupIpVersion(){return this._internals.dnsLookupIpVersion}set dnsLookupIpVersion(e){if(e!==undefined&&e!==4&&e!==6){throw new TypeError(`Invalid DNS lookup IP version: ${e}`)}this._internals.dnsLookupIpVersion=e}get parseJson(){return this._internals.parseJson}set parseJson(e){c.function_(e);this._internals.parseJson=e}get stringifyJson(){return this._internals.stringifyJson}set stringifyJson(e){c.function_(e);this._internals.stringifyJson=e}get retry(){return this._internals.retry}set retry(e){c.plainObject(e);c.any([h.function_,h.undefined],e.calculateDelay);c.any([h.number,h.undefined],e.maxRetryAfter);c.any([h.number,h.undefined],e.limit);c.any([h.array,h.undefined],e.methods);c.any([h.array,h.undefined],e.statusCodes);c.any([h.array,h.undefined],e.errorCodes);c.any([h.number,h.undefined],e.noise);if(e.noise&&Math.abs(e.noise)>100){throw new Error(`The maximum acceptable retry noise is +/- 100ms, got ${e.noise}`)}for(const t in e){if(!(t in this._internals.retry)){throw new Error(`Unexpected retry option: ${t}`)}}if(this._merging){Object.assign(this._internals.retry,e)}else{this._internals.retry={...e}}const{retry:t}=this._internals;t.methods=[...new Set(t.methods.map((e=>e.toUpperCase())))];t.statusCodes=[...new Set(t.statusCodes)];t.errorCodes=[...new Set(t.errorCodes)]}get localAddress(){return this._internals.localAddress}set localAddress(e){c.any([h.string,h.undefined],e);this._internals.localAddress=e}get method(){return this._internals.method}set method(e){c.string(e);this._internals.method=e.toUpperCase()}get createConnection(){return this._internals.createConnection}set createConnection(e){c.any([h.function_,h.undefined],e);this._internals.createConnection=e}get cacheOptions(){return this._internals.cacheOptions}set cacheOptions(e){c.plainObject(e);c.any([h.boolean,h.undefined],e.shared);c.any([h.number,h.undefined],e.cacheHeuristic);c.any([h.number,h.undefined],e.immutableMinTimeToLive);c.any([h.boolean,h.undefined],e.ignoreCargoCult);for(const t in e){if(!(t in this._internals.cacheOptions)){throw new Error(`Cache option \`${t}\` does not exist`)}}if(this._merging){Object.assign(this._internals.cacheOptions,e)}else{this._internals.cacheOptions={...e}}}get https(){return this._internals.https}set https(e){c.plainObject(e);c.any([h.boolean,h.undefined],e.rejectUnauthorized);c.any([h.function_,h.undefined],e.checkServerIdentity);c.any([h.string,h.object,h.array,h.undefined],e.certificateAuthority);c.any([h.string,h.object,h.array,h.undefined],e.key);c.any([h.string,h.object,h.array,h.undefined],e.certificate);c.any([h.string,h.undefined],e.passphrase);c.any([h.string,h.buffer,h.array,h.undefined],e.pfx);c.any([h.array,h.undefined],e.alpnProtocols);c.any([h.string,h.undefined],e.ciphers);c.any([h.string,h.buffer,h.undefined],e.dhparam);c.any([h.string,h.undefined],e.signatureAlgorithms);c.any([h.string,h.undefined],e.minVersion);c.any([h.string,h.undefined],e.maxVersion);c.any([h.boolean,h.undefined],e.honorCipherOrder);c.any([h.number,h.undefined],e.tlsSessionLifetime);c.any([h.string,h.undefined],e.ecdhCurve);c.any([h.string,h.buffer,h.array,h.undefined],e.certificateRevocationLists);for(const t in e){if(!(t in this._internals.https)){throw new Error(`HTTPS option \`${t}\` does not exist`)}}if(this._merging){Object.assign(this._internals.https,e)}else{this._internals.https={...e}}}get encoding(){return this._internals.encoding}set encoding(e){if(e===null){throw new TypeError("To get a Buffer, set `options.responseType` to `buffer` instead")}c.any([h.string,h.undefined],e);this._internals.encoding=e}get resolveBodyOnly(){return this._internals.resolveBodyOnly}set resolveBodyOnly(e){c.boolean(e);this._internals.resolveBodyOnly=e}get isStream(){return this._internals.isStream}set isStream(e){c.boolean(e);this._internals.isStream=e}get responseType(){return this._internals.responseType}set responseType(e){if(e===undefined){this._internals.responseType="text";return}if(e!=="text"&&e!=="buffer"&&e!=="json"){throw new Error(`Invalid \`responseType\` option: ${e}`)}this._internals.responseType=e}get pagination(){return this._internals.pagination}set pagination(e){c.object(e);if(this._merging){Object.assign(this._internals.pagination,e)}else{this._internals.pagination=e}}get auth(){throw new Error("Parameter `auth` is deprecated. Use `username` / `password` instead.")}set auth(e){throw new Error("Parameter `auth` is deprecated. Use `username` / `password` instead.")}get setHost(){return this._internals.setHost}set setHost(e){c.boolean(e);this._internals.setHost=e}get maxHeaderSize(){return this._internals.maxHeaderSize}set maxHeaderSize(e){c.any([h.number,h.undefined],e);this._internals.maxHeaderSize=e}get enableUnixSockets(){return this._internals.enableUnixSockets}set enableUnixSockets(e){c.boolean(e);this._internals.enableUnixSockets=e}toJSON(){return{...this._internals}}[Symbol.for("nodejs.util.inspect.custom")](e,t){return(0,Q.inspect)(this._internals,t)}createNativeRequestOptions(){const e=this._internals;const t=e.url;let r;if(t.protocol==="https:"){r=e.http2?e.agent:e.agent.https}else{r=e.agent.http}const{https:i}=e;let{pfx:n}=i;if(h.array(n)&&h.plainObject(n[0])){n=n.map((e=>({buf:e.buffer,passphrase:e.passphrase})))}return{...e.cacheOptions,...this._unixOptions,ALPNProtocols:i.alpnProtocols,ca:i.certificateAuthority,cert:i.certificate,key:i.key,passphrase:i.passphrase,pfx:i.pfx,rejectUnauthorized:i.rejectUnauthorized,checkServerIdentity:i.checkServerIdentity??re.checkServerIdentity,ciphers:i.ciphers,honorCipherOrder:i.honorCipherOrder,minVersion:i.minVersion,maxVersion:i.maxVersion,sigalgs:i.signatureAlgorithms,sessionTimeout:i.tlsSessionLifetime,dhparam:i.dhparam,ecdhCurve:i.ecdhCurve,crl:i.certificateRevocationLists,lookup:e.dnsLookup??e.dnsCache?.lookup,family:e.dnsLookupIpVersion,agent:r,setHost:e.setHost,method:e.method,maxHeaderSize:e.maxHeaderSize,localAddress:e.localAddress,headers:e.headers,createConnection:e.createConnection,timeout:e.http2?getHttp2TimeoutOption(e):undefined,h2session:e.h2session}}getRequestFunction(){const e=this._internals.url;const{request:t}=this._internals;if(!t&&e){return this.getFallbackRequestFunction()}return t}getFallbackRequestFunction(){const e=this._internals.url;if(!e){return}if(e.protocol==="https:"){if(this._internals.http2){if(ge<15||ge===15&&ye<10){const e=new Error("To use the `http2` option, install Node.js 15.10.0 or above");e.code="EUNSUPPORTED";throw e}return me.auto}return ie.request}return _.request}freeze(){const e=this._internals;Object.freeze(e);Object.freeze(e.hooks);Object.freeze(e.hooks.afterResponse);Object.freeze(e.hooks.beforeError);Object.freeze(e.hooks.beforeRedirect);Object.freeze(e.hooks.beforeRequest);Object.freeze(e.hooks.beforeRetry);Object.freeze(e.hooks.init);Object.freeze(e.https);Object.freeze(e.cacheOptions);Object.freeze(e.agent);Object.freeze(e.headers);Object.freeze(e.timeout);Object.freeze(e.retry);Object.freeze(e.retry.errorCodes);Object.freeze(e.retry.methods);Object.freeze(e.retry.statusCodes)}}const isResponseOk=e=>{const{statusCode:t}=e;const r=e.request.options.followRedirect?299:399;return t>=200&&t<=r||t===304};class ParseError extends RequestError{constructor(e,t){const{options:r}=t.request;super(`${e.message} in "${r.url.toString()}"`,e,t.request);this.name="ParseError";this.code="ERR_BODY_PARSE_FAILURE"}}const parseBody=(e,t,r,i)=>{const{rawBody:n}=e;try{if(t==="text"){return n.toString(i)}if(t==="json"){return n.length===0?"":r(n.toString(i))}if(t==="buffer"){return n}}catch(t){throw new ParseError(t,e)}throw new ParseError({message:`Unknown body type '${t}'`,name:"Error"},e)};function isClientRequest(e){return e.writable&&!e.writableEnded}const xe=isClientRequest;function isUnixSocketURL(e){return e.protocol==="unix:"||e.hostname==="unix"}const{buffer:Te}=C;const we=h.string(p.versions.brotli);const Se=new Set(["GET","HEAD"]);const Ee=new WeakableMap;const Ae=new Set([300,301,302,303,304,307,308]);const Ce=["socket","connect","continue","information","upgrade"];const core_noop=()=>{};class Request extends g.Duplex{constructor(e,t,r){super({autoDestroy:false,highWaterMark:0});Object.defineProperty(this,"constructor",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_noPipe",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"options",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"response",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"requestUrl",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"redirectUrls",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"retryCount",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_stopRetry",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_downloadedSize",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_uploadedSize",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_stopReading",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_pipedServerResponses",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_request",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_responseSize",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_bodySize",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_unproxyEvents",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_isFromCache",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_cannotHaveBody",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_triggerRead",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_cancelTimeouts",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_removeListeners",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_nativeResponse",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_flushed",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_aborted",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_requestInitialized",{enumerable:true,configurable:true,writable:true,value:void 0});this._downloadedSize=0;this._uploadedSize=0;this._stopReading=false;this._pipedServerResponses=new Set;this._cannotHaveBody=false;this._unproxyEvents=core_noop;this._triggerRead=false;this._cancelTimeouts=core_noop;this._removeListeners=core_noop;this._jobs=[];this._flushed=false;this._requestInitialized=false;this._aborted=false;this.redirectUrls=[];this.retryCount=0;this._stopRetry=core_noop;this.on("pipe",(e=>{if(e?.headers){Object.assign(this.options.headers,e.headers)}}));this.on("newListener",(e=>{if(e==="retry"&&this.listenerCount("retry")>0){throw new Error("A retry listener has been attached already.")}}));try{this.options=new Options(e,t,r);if(!this.options.url){if(this.options.prefixUrl===""){throw new TypeError("Missing `url` property")}this.options.url=""}this.requestUrl=this.options.url}catch(e){const{options:t}=e;if(t){this.options=t}this.flush=async()=>{this.flush=async()=>{};this.destroy(e)};return}const{body:i}=this.options;if(h.nodeStream(i)){i.once("error",(e=>{if(this._flushed){this._beforeError(new UploadError(e,this))}else{this.flush=async()=>{this.flush=async()=>{};this._beforeError(new UploadError(e,this))}}}))}if(this.options.signal){const abort=()=>{this.destroy(new AbortError(this))};if(this.options.signal.aborted){abort()}else{this.options.signal.addEventListener("abort",abort);this._removeListeners=()=>{this.options.signal.removeEventListener("abort",abort)}}}}async flush(){if(this._flushed){return}this._flushed=true;try{await this._finalizeBody();if(this.destroyed){return}await this._makeRequest();if(this.destroyed){this._request?.destroy();return}for(const e of this._jobs){e()}this._jobs.length=0;this._requestInitialized=true}catch(e){this._beforeError(e)}}_beforeError(e){if(this._stopReading){return}const{response:t,options:r}=this;const i=this.retryCount+(e.name==="RetryError"?0:1);this._stopReading=true;if(!(e instanceof RequestError)){e=new RequestError(e.message,e,this)}const n=e;void(async()=>{if(t?.readable&&!t.rawBody&&!this._request?.socket?.destroyed){t.setEncoding(this.readableEncoding);const e=await this._setRawBody(t);if(e){t.body=t.rawBody.toString()}}if(this.listenerCount("retry")!==0){let s;try{let e;if(t&&"retry-after"in t.headers){e=Number(t.headers["retry-after"]);if(Number.isNaN(e)){e=Date.parse(t.headers["retry-after"])-Date.now();if(e<=0){e=1}}else{e*=1e3}}const o=r.retry;s=await o.calculateDelay({attemptCount:i,retryOptions:o,error:n,retryAfter:e,computedValue:te({attemptCount:i,retryOptions:o,error:n,retryAfter:e,computedValue:o.maxRetryAfter??r.timeout.request??Number.POSITIVE_INFINITY})})}catch(e){void this._error(new RequestError(e.message,e,this));return}if(s){await new Promise((e=>{const t=setTimeout(e,s);this._stopRetry=()=>{clearTimeout(t);e()}}));if(this.destroyed){return}try{for(const e of this.options.hooks.beforeRetry){await e(n,this.retryCount+1)}}catch(t){void this._error(new RequestError(t.message,e,this));return}if(this.destroyed){return}this.destroy();this.emit("retry",this.retryCount+1,e,(e=>{const t=new Request(r.url,e,r);t.retryCount=this.retryCount+1;p.nextTick((()=>{void t.flush()}));return t}));return}}void this._error(n)})()}_read(){this._triggerRead=true;const{response:e}=this;if(e&&!this._stopReading){if(e.readableLength){this._triggerRead=false}let t;while((t=e.read())!==null){this._downloadedSize+=t.length;const e=this.downloadProgress;if(e.percent<1){this.emit("downloadProgress",e)}this.push(t)}}}_write(e,t,r){const write=()=>{this._writeRequest(e,t,r)};if(this._requestInitialized){write()}else{this._jobs.push(write)}}_final(e){const endRequest=()=>{if(!this._request||this._request.destroyed){e();return}this._request.end((t=>{if(this._request._writableState?.errored){return}if(!t){this._bodySize=this._uploadedSize;this.emit("uploadProgress",this.uploadProgress);this._request.emit("upload-complete")}e(t)}))};if(this._requestInitialized){endRequest()}else{this._jobs.push(endRequest)}}_destroy(e,t){this._stopReading=true;this.flush=async()=>{};this._stopRetry();this._cancelTimeouts();this._removeListeners();if(this.options){const{body:e}=this.options;if(h.nodeStream(e)){e.destroy()}}if(this._request){this._request.destroy()}if(e!==null&&!h.undefined(e)&&!(e instanceof RequestError)){e=new RequestError(e.message,e,this)}t(e)}pipe(e,t){if(e instanceof _.ServerResponse){this._pipedServerResponses.add(e)}return super.pipe(e,t)}unpipe(e){if(e instanceof _.ServerResponse){this._pipedServerResponses.delete(e)}super.unpipe(e);return this}async _finalizeBody(){const{options:e}=this;const{headers:t}=e;const r=!h.undefined(e.form);const i=!h.undefined(e.json);const n=!h.undefined(e.body);const s=Se.has(e.method)&&!(e.method==="GET"&&e.allowGetBody);this._cannotHaveBody=s;if(r||i||n){if(s){throw new TypeError(`The \`${e.method}\` method cannot be used with a body`)}const i=!h.string(t["content-type"]);if(n){if(isFormData(e.body)){const r=new FormDataEncoder(e.body);if(i){t["content-type"]=r.headers["Content-Type"]}if("Content-Length"in r.headers){t["content-length"]=r.headers["Content-Length"]}e.body=r.encode()}if(is_form_data_isFormData(e.body)&&i){t["content-type"]=`multipart/form-data; boundary=${e.body.getBoundary()}`}}else if(r){if(i){t["content-type"]="application/x-www-form-urlencoded"}const{form:r}=e;e.form=undefined;e.body=new y.URLSearchParams(r).toString()}else{if(i){t["content-type"]="application/json"}const{json:r}=e;e.json=undefined;e.body=e.stringifyJson(r)}const o=await getBodySize(e.body,e.headers);if(h.undefined(t["content-length"])&&h.undefined(t["transfer-encoding"])&&!s&&!h.undefined(o)){t["content-length"]=String(o)}}if(e.responseType==="json"&&!("accept"in e.headers)){e.headers.accept="application/json"}this._bodySize=Number(t["content-length"])||undefined}async _onResponseBase(e){if(this.isAborted){return}const{options:t}=this;const{url:r}=t;this._nativeResponse=e;if(t.decompress){e=I(e)}const i=e.statusCode;const n=e;n.statusMessage=n.statusMessage??_.STATUS_CODES[i];n.url=t.url.toString();n.requestUrl=this.requestUrl;n.redirectUrls=this.redirectUrls;n.request=this;n.isFromCache=this._nativeResponse.fromCache??false;n.ip=this.ip;n.retryCount=this.retryCount;n.ok=isResponseOk(n);this._isFromCache=n.isFromCache;this._responseSize=Number(e.headers["content-length"])||undefined;this.response=n;e.once("end",(()=>{this._responseSize=this._downloadedSize;this.emit("downloadProgress",this.downloadProgress)}));e.once("error",(t=>{this._aborted=true;e.destroy();this._beforeError(new ReadError(t,this))}));e.once("aborted",(()=>{this._aborted=true;this._beforeError(new ReadError({name:"Error",message:"The server aborted pending request",code:"ECONNRESET"},this))}));this.emit("downloadProgress",this.downloadProgress);const s=e.headers["set-cookie"];if(h.object(t.cookieJar)&&s){let e=s.map((async e=>t.cookieJar.setCookie(e,r.toString())));if(t.ignoreInvalidCookies){e=e.map((async e=>{try{await e}catch{}}))}try{await Promise.all(e)}catch(e){this._beforeError(e);return}}if(this.isAborted){return}if(t.followRedirect&&e.headers.location&&Ae.has(i)){e.resume();this._cancelTimeouts();this._unproxyEvents();if(this.redirectUrls.length>=t.maxRedirects){this._beforeError(new MaxRedirectsError(this));return}this._request=undefined;const s=new Options(undefined,undefined,this.options);const o=i===303&&s.method!=="GET"&&s.method!=="HEAD";const a=i!==307&&i!==308;const l=s.methodRewriting&&a;if(o||l){s.method="GET";s.body=undefined;s.json=undefined;s.form=undefined;delete s.headers["content-length"]}try{const t=m.Buffer.from(e.headers.location,"binary").toString();const i=new y.URL(t,r);if(!isUnixSocketURL(r)&&isUnixSocketURL(i)){this._beforeError(new RequestError("Cannot redirect to UNIX socket",{},this));return}if(i.hostname!==r.hostname||i.port!==r.port){if("host"in s.headers){delete s.headers.host}if("cookie"in s.headers){delete s.headers.cookie}if("authorization"in s.headers){delete s.headers.authorization}if(s.username||s.password){s.username="";s.password=""}}else{i.username=s.username;i.password=s.password}this.redirectUrls.push(i);s.prefixUrl="";s.url=i;for(const e of s.hooks.beforeRedirect){await e(s,n)}this.emit("redirect",s,n);this.options=s;await this._makeRequest()}catch(e){this._beforeError(e);return}return}if(t.isStream&&t.throwHttpErrors&&!isResponseOk(n)){this._beforeError(new HTTPError(n));return}e.on("readable",(()=>{if(this._triggerRead){this._read()}}));this.on("resume",(()=>{e.resume()}));this.on("pause",(()=>{e.pause()}));e.once("end",(()=>{this.push(null)}));if(this._noPipe){const t=await this._setRawBody();if(t){this.emit("response",e)}return}this.emit("response",e);for(const r of this._pipedServerResponses){if(r.headersSent){continue}for(const i in e.headers){const n=t.decompress?i!=="content-encoding":true;const s=e.headers[i];if(n){r.setHeader(i,s)}}r.statusCode=i}}async _setRawBody(e=this){if(e.readableEnded){return false}try{const t=await Te(e);if(!this.isAborted){this.response.rawBody=t;return true}}catch{}return false}async _onResponse(e){try{await this._onResponseBase(e)}catch(e){this._beforeError(e)}}_onRequest(e){const{options:t}=this;const{timeout:r,url:i}=t;T(e);if(this.options.http2){e.setTimeout(0)}this._cancelTimeouts=timedOut(e,r,i);const n=t.cache?"cacheableResponse":"response";e.once(n,(e=>{void this._onResponse(e)}));e.once("error",(t=>{this._aborted=true;e.destroy();t=t instanceof timed_out_TimeoutError?new TimeoutError(t,this.timings,this):new RequestError(t.message,t,this);this._beforeError(t)}));this._unproxyEvents=proxyEvents(e,this,Ce);this._request=e;this.emit("uploadProgress",this.uploadProgress);this._sendBody();this.emit("request",e)}async _asyncWrite(e){return new Promise(((t,r)=>{super.write(e,(e=>{if(e){r(e);return}t()}))}))}_sendBody(){const{body:e}=this.options;const t=this.redirectUrls.length===0?this:this._request??this;if(h.nodeStream(e)){e.pipe(t)}else if(h.generator(e)||h.asyncGenerator(e)){(async()=>{try{for await(const t of e){await this._asyncWrite(t)}super.end()}catch(e){this._beforeError(e)}})()}else if(!h.undefined(e)){this._writeRequest(e,undefined,(()=>{}));t.end()}else if(this._cannotHaveBody||this._noPipe){t.end()}}_prepareCache(e){if(!Ee.has(e)){const t=new P(((e,t)=>{const r=e._request(e,t);if(h.promise(r)){r.once=(e,t)=>{if(e==="error"){(async()=>{try{await r}catch(e){t(e)}})()}else if(e==="abort"){(async()=>{try{const e=await r;e.once("abort",t)}catch{}})()}else{throw new Error(`Unknown HTTP2 promise event: ${e}`)}return r}}return r}),e);Ee.set(e,t.request())}}async _createCacheableRequest(e,t){return new Promise(((r,i)=>{Object.assign(t,urlToOptions(e));let n;const s=Ee.get(t.cache)(t,(async e=>{e._readableState.autoDestroy=false;if(n){const fix=()=>{if(e.req){e.complete=e.req.res.complete}};e.prependOnceListener("end",fix);fix();(await n).emit("cacheableResponse",e)}r(e)}));s.once("error",i);s.once("request",(async e=>{n=e;r(n)}))}))}async _makeRequest(){const{options:e}=this;const{headers:t,username:r,password:i}=e;const n=e.cookieJar;for(const e in t){if(h.undefined(t[e])){delete t[e]}else if(h.null_(t[e])){throw new TypeError(`Use \`undefined\` instead of \`null\` to delete the \`${e}\` header`)}}if(e.decompress&&h.undefined(t["accept-encoding"])){t["accept-encoding"]=we?"gzip, deflate, br":"gzip, deflate"}if(r||i){const e=m.Buffer.from(`${r}:${i}`).toString("base64");t.authorization=`Basic ${e}`}if(n){const r=await n.getCookieString(e.url.toString());if(h.nonEmptyString(r)){t.cookie=r}}e.prefixUrl="";let s;for(const t of e.hooks.beforeRequest){const r=await t(e);if(!h.undefined(r)){s=()=>r;break}}if(!s){s=e.getRequestFunction()}const o=e.url;this._requestOptions=e.createNativeRequestOptions();if(e.cache){this._requestOptions._request=s;this._requestOptions.cache=e.cache;this._requestOptions.body=e.body;this._prepareCache(e.cache)}const a=e.cache?this._createCacheableRequest:s;try{let t=a(o,this._requestOptions);if(h.promise(t)){t=await t}if(h.undefined(t)){t=e.getFallbackRequestFunction()(o,this._requestOptions);if(h.promise(t)){t=await t}}if(xe(t)){this._onRequest(t)}else if(this.writable){this.once("finish",(()=>{void this._onResponse(t)}));this._sendBody()}else{void this._onResponse(t)}}catch(e){if(e instanceof types_CacheError){throw new CacheError(e,this)}throw e}}async _error(e){try{if(e instanceof HTTPError&&!this.options.throwHttpErrors){}else{for(const t of this.options.hooks.beforeError){e=await t(e)}}}catch(t){e=new RequestError(t.message,t,this)}this.destroy(e)}_writeRequest(e,t,r){if(!this._request||this._request.destroyed){return}this._request.write(e,t,(i=>{if(!i&&!this._request.destroyed){this._uploadedSize+=m.Buffer.byteLength(e,t);const r=this.uploadProgress;if(r.percent<1){this.emit("uploadProgress",r)}}r(i)}))}get ip(){return this.socket?.remoteAddress}get isAborted(){return this._aborted}get socket(){return this._request?.socket??undefined}get downloadProgress(){let e;if(this._responseSize){e=this._downloadedSize/this._responseSize}else if(this._responseSize===this._downloadedSize){e=1}else{e=0}return{percent:e,transferred:this._downloadedSize,total:this._responseSize}}get uploadProgress(){let e;if(this._bodySize){e=this._uploadedSize/this._bodySize}else if(this._bodySize===this._uploadedSize){e=1}else{e=0}return{percent:e,transferred:this._uploadedSize,total:this._bodySize}}get timings(){return this._request?.timings}get isFromCache(){return this._isFromCache}get reusedSocket(){return this._request?.reusedSocket}}class types_CancelError extends RequestError{constructor(e){super("Promise was canceled",{},e);this.name="CancelError";this.code="ERR_CANCELED"}get isCanceled(){return true}}const Ne=["request","response","redirect","uploadProgress","downloadProgress"];function asPromise(e){let t;let r;let i;const n=new d.EventEmitter;const s=new PCancelable(((o,a,l)=>{l((()=>{t.destroy()}));l.shouldReject=false;l((()=>{a(new types_CancelError(t))}));const makeRequest=u=>{l((()=>{}));const c=e??new Request(undefined,undefined,i);c.retryCount=u;c._noPipe=true;t=c;c.once("response",(async e=>{const t=(e.headers["content-encoding"]??"").toLowerCase();const i=t==="gzip"||t==="deflate"||t==="br";const{options:n}=c;if(i&&!n.decompress){e.body=e.rawBody}else{try{e.body=parseBody(e,n.responseType,n.parseJson,n.encoding)}catch(t){e.body=e.rawBody.toString();if(isResponseOk(e)){c._beforeError(t);return}}}try{const t=n.hooks.afterResponse;for(const[r,i]of t.entries()){e=await i(e,(async e=>{n.merge(e);n.prefixUrl="";if(e.url){n.url=e.url}n.hooks.afterResponse=n.hooks.afterResponse.slice(0,r);throw new RetryError(c)}));if(!(h.object(e)&&h.number(e.statusCode)&&!h.nullOrUndefined(e.body))){throw new TypeError("The `afterResponse` hook returned an invalid value")}}}catch(e){c._beforeError(e);return}r=e;if(!isResponseOk(e)){c._beforeError(new HTTPError(e));return}c.destroy();o(c.options.resolveBodyOnly?e.body:e)}));const onError=e=>{if(s.isCanceled){return}const{options:t}=c;if(e instanceof HTTPError&&!t.throwHttpErrors){const{response:t}=e;c.destroy();o(c.options.resolveBodyOnly?t.body:t);return}a(e)};c.once("error",onError);const d=c.options?.body;c.once("retry",((t,r)=>{e=undefined;const n=c.options.body;if(d===n&&h.nodeStream(n)){r.message="Cannot retry with consumed body stream";onError(r);return}i=c.options;makeRequest(t)}));proxyEvents(c,n,Ne);if(h.undefined(e)){void c.flush()}};makeRequest(0)}));s.on=(e,t)=>{n.on(e,t);return s};s.off=(e,t)=>{n.off(e,t);return s};const shortcut=e=>{const t=(async()=>{await s;const{options:t}=r.request;return parseBody(r,e,t.parseJson,t.encoding)})();Object.defineProperties(t,Object.getOwnPropertyDescriptors(s));return t};s.json=()=>{if(t.options){const{headers:e}=t.options;if(!t.writableFinished&&!("accept"in e)){e.accept="application/json"}}return shortcut("json")};s.buffer=()=>shortcut("buffer");s.text=()=>shortcut("text");return s}const delay=async e=>new Promise((t=>{setTimeout(t,e)}));const isGotInstance=e=>h.function_(e);const Oe=["get","post","put","patch","head","delete"];const create=e=>{e={options:new Options(undefined,undefined,e.options),handlers:[...e.handlers],mutableDefaults:e.mutableDefaults};Object.defineProperty(e,"mutableDefaults",{enumerable:true,configurable:false,writable:false});const got=(t,r,i=e.options)=>{const n=new Request(t,r,i);let s;const lastHandler=e=>{n.options=e;n._noPipe=!e.isStream;void n.flush();if(e.isStream){return n}if(!s){s=asPromise(n)}return s};let o=0;const iterateHandlers=t=>{const r=e.handlers[o++]??lastHandler;const i=r(t,iterateHandlers);if(h.promise(i)&&!n.options.isStream){if(!s){s=asPromise(n)}if(i!==s){const e=Object.getOwnPropertyDescriptors(s);for(const t in e){if(t in i){delete e[t]}}Object.defineProperties(i,e);i.cancel=s.cancel}}return i};return iterateHandlers(n.options)};got.extend=(...t)=>{const r=new Options(undefined,undefined,e.options);const i=[...e.handlers];let n;for(const e of t){if(isGotInstance(e)){r.merge(e.defaults.options);i.push(...e.defaults.handlers);n=e.defaults.mutableDefaults}else{r.merge(e);if(e.handlers){i.push(...e.handlers)}n=e.mutableDefaults}}return create({options:r,handlers:i,mutableDefaults:Boolean(n)})};const paginateEach=async function*(t,r){let i=new Options(t,r,e.options);i.resolveBodyOnly=false;const{pagination:n}=i;c.function_(n.transform);c.function_(n.shouldContinue);c.function_(n.filter);c.function_(n.paginate);c.number(n.countLimit);c.number(n.requestLimit);c.number(n.backoff);const s=[];let{countLimit:o}=n;let a=0;while(a<n.requestLimit){if(a!==0){await delay(n.backoff)}const e=await got(undefined,undefined,i);const t=await n.transform(e);const r=[];c.array(t);for(const e of t){if(n.filter({item:e,currentItems:r,allItems:s})){if(!n.shouldContinue({item:e,currentItems:r,allItems:s})){return}yield e;if(n.stackAllItems){s.push(e)}r.push(e);if(--o<=0){return}}}const l=n.paginate({response:e,currentItems:r,allItems:s});if(l===false){return}if(l===e.request.options){i=e.request.options}else{i.merge(l);c.any([h.urlInstance,h.undefined],l.url);if(l.url!==undefined){i.prefixUrl="";i.url=l.url}}a++}};got.paginate=paginateEach;got.paginate.all=async(e,t)=>{const r=[];for await(const i of paginateEach(e,t)){r.push(i)}return r};got.paginate.each=paginateEach;got.stream=(e,t)=>got(e,{...t,isStream:true});for(const e of Oe){got[e]=(t,r)=>got(t,{...r,method:e});got.stream[e]=(t,r)=>got(t,{...r,method:e,isStream:true})}if(!e.mutableDefaults){Object.freeze(e.handlers);e.options.freeze()}Object.defineProperty(got,"defaults",{value:e,writable:false,configurable:false,enumerable:true});return got};const Re=create;const ke={options:new Options,handlers:[],mutableDefaults:false};const Pe=Re(ke);const Le=Pe},2561:e=>{"use strict";e.exports={version:"3.10.0"}}};var t={};function __nccwpck_require__(r){var i=t[r];if(i!==undefined){return i.exports}var n=t[r]={id:r,loaded:false,exports:{}};var s=true;try{e[r].call(n.exports,n,n.exports,__nccwpck_require__);s=false}finally{if(s)delete t[r]}n.loaded=true;return n.exports}(()=>{__nccwpck_require__.d=(e,t)=>{for(var r in t){if(__nccwpck_require__.o(t,r)&&!__nccwpck_require__.o(e,r)){Object.defineProperty(e,r,{enumerable:true,get:t[r]})}}}})();(()=>{__nccwpck_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})();(()=>{__nccwpck_require__.r=e=>{if(typeof Symbol!=="undefined"&&Symbol.toStringTag){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}Object.defineProperty(e,"__esModule",{value:true})}})();(()=>{__nccwpck_require__.nmd=e=>{e.paths=[];if(!e.children)e.children=[];return e}})();if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var r={};(()=>{"use strict";var e=r;Object.defineProperty(e,"__esModule",{value:true});const t=__nccwpck_require__(4379);const i=__nccwpck_require__(8584);const n=__nccwpck_require__(8989);const s=new t.Option("-l,--log-level <level>","Log level").choices(["error","warn","info","http","verbose","debug","silly"]).default("info");const o=new t.Option("-d,--deployments <path>","Path to the deployments folder");const a=new t.Option("--dry-run","Do not verify anything, just output the verifications that would be performed");const l=new t.Option("-n,--network <network name>","Network to verify").makeOptionMandatory();const u=new t.Option("-u,--api-url <url>","Scan API URL (fully qualified, with protocol and path)");const c=new t.Option("-k,--api-key <key>","Scan API Key");const h=new t.Command("non-target").description("Verifies a contract that does not have its own deployment file, i.e. has not been a target of a deployment").addOption(s).addOption(a).addOption(o).addOption(l).addOption(u).addOption(c).requiredOption("--address <address>","Contract address to verify").requiredOption("--name <contract name>","Fully qualified contract name to verify, e.g. contracts/MyToken.sol").requiredOption("--deployment <deployment file name>","Deployment file name, e.g. MyOtherToken.json").option("--arguments <constructor arguments>",'JSON encoded array of constructor arguments, e.g. [1234, "0x0"]',(e=>{try{const t=JSON.parse(e);if(!Array.isArray(t)){throw new Error(`Constructor arguments must be an array, got ${t}`)}}catch(e){throw new t.InvalidOptionArgumentError(`Malformed constructor arguments specified: ${e}`)}})).action((async e=>{const t=(0,n.createLogger)(e.logLevel);const r={dryRun:e.dryRun,paths:{deployments:e.deployments},networks:{[e.network]:{apiUrl:e.apiUrl,apiKey:e.apiKey}},contracts:[{network:e.network,address:e.address,contractName:e.name,deployment:e.deployment,constructorArguments:e.arguments}]};try{await(0,i.verifyNonTarget)(r,t)}catch(e){t.error(n.COLORS.error`The verification script exited with an error: ${e}`);process.exit(1)}}));const d=new t.Command("target").description("Verifies contracts that have been a part of a deployment, i.e. have their own deployment files").addOption(s).addOption(a).addOption(o).addOption(l).addOption(u).addOption(c).option("-c,--contracts <contract names>","Comma-separated list of case-sensitive contract names to verify",(e=>(e===null||e===void 0?void 0:e.trim())?e.split(",").map((e=>e.trim())):undefined)).action((async e=>{const t=(0,n.createLogger)(e.logLevel);const r={dryRun:e.dryRun,paths:{deployments:e.deployments},networks:{[e.network]:{apiUrl:e.apiUrl,apiKey:e.apiKey}},filter:e.contracts};try{await(0,i.verifyTarget)(r,t)}catch(e){t.error(n.COLORS.error`The verification script exited with an error: ${e}`);process.exit(1)}}));new t.Command("lz-verify-contract").description("Verify a set of contracts based on hardhat-deploy outputs").addCommand(h).addCommand(d,{isDefault:true}).parseAsync()})();module.exports=r})();
26
+ `);const u=i.apiKey||getScanApiKeyFromEnv(r);if(!u){e.debug(`Could not find scan API key for network ${a.default.bold(r)}\n \nPlease provide the API key:\n\n- As an apiKey config parameter in ${r} config\n- As a SCAN_API_KEY_${r} enviornment variable\n- As a SCAN_API_KEY_${normalizeNetworkName(r)} enviornment variable`)}const c=i.browserUrl||getScanBrowserUrlFromEnv(r)||(0,n.tryGetScanBrowserUrlFromScanUrl)(l);if(!c){e.debug(`Could not find scan browser URL key for network ${a.default.bold(r)}\n\n Browser URL is used to display a link to the verified contract\n after successful verification.\n \n Please provide the browser URL:\n \n - As an browserUrl config parameter in ${r} config\n - As a SCAN_BROWSER_URL_${r} enviornment variable\n - As a SCAN_BROWSER_URL_${normalizeNetworkName(r)} enviornment variable`)}return{...t,[r]:{apiUrl:l,apiKey:u,browserUrl:c}}}),{});t.parseNetworksConfig=parseNetworksConfig;const getScanApiUrlFromEnv=e=>{var t,r;return((t=process.env[`SCAN_API_URL_${e}`])===null||t===void 0?void 0:t.trim())||((r=process.env[`SCAN_API_URL_${normalizeNetworkName(e)}`])===null||r===void 0?void 0:r.trim())};const getScanBrowserUrlFromEnv=e=>{var t,r;return((t=process.env[`SCAN_BROWSER_URL_${e}`])===null||t===void 0?void 0:t.trim())||((r=process.env[`SCAN_BROWSER_URL_${normalizeNetworkName(e)}`])===null||r===void 0?void 0:r.trim())};const getScanApiKeyFromEnv=e=>{var t,r;return((t=process.env[`SCAN_API_KEY_${e}`])===null||t===void 0?void 0:t.trim())||((r=process.env[`SCAN_API_KEY_${normalizeNetworkName(e)}`])===null||r===void 0?void 0:r.trim())};const normalizeNetworkName=e=>e.toUpperCase().replaceAll("-","_")},7364:function(e,t,r){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.createVerification=void 0;const n=r(3301);const s=r(824);const o=i(r(2361));const a=i(r(1391));class Verification extends o.default{constructor(e){super();this.props=e}async verify(){try{const e=await this.__submit();if(isAlreadyVerifiedResult(e.result)){return{alreadyVerified:true}}if(e.status!==1){throw new Error(`Verification failed with result "${e.result}", status ${e.status} (${e.message})`)}const t=e.result;if(t==null){throw new Error(`Missing GUID from the response: ${e}`)}return await this.__poll(t)}catch(e){throw new Error(`Verification error: ${e}`)}}async __submit(){const e=createVerificationRequest(this.props);return await(0,s.retry)((async()=>{const t=await submitRequest(this.props.apiUrl,e);if(isApiRateLimitedResult(t.result)){throw new Error(`API Rate limit has been exceeded`)}return t}),3,(async(e,t)=>{this.emit("retry",e,t);await(0,s.sleep)(2e3)}))}async __poll(e){while(true){this.emit("poll",e);const t=await checkGuid(this.props.apiUrl,e);if(t.status===1)return{alreadyVerified:false};if(isAlreadyVerifiedResult(t.result))return{alreadyVerified:true};if(isPendingResult(t.result)){await(0,s.sleep)(1e4);continue}if(isApiRateLimitedResult(t.result)){await(0,s.sleep)(1e4);continue}throw new Error(`Verification failed with result "${t.result}", status ${t.status} (${t.message})`)}}}const createVerification=e=>new Verification(e);t.createVerification=createVerification;const isPendingResult=e=>!!(e===null||e===void 0?void 0:e.match(/Pending/gi));const isAlreadyVerifiedResult=e=>!!(e===null||e===void 0?void 0:e.match(/already verified/gi));const isApiRateLimitedResult=e=>!!(e===null||e===void 0?void 0:e.match(/rate/));const submitRequest=async(e,t)=>{try{const r=await(0,a.default)(e,{method:"POST",form:t,headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}}).json();return l.parse(r)}catch(e){throw new Error(`Failed to submit verification request: ${e}`)}};const checkGuid=async(e,t)=>{const r=new URL(e);r.searchParams.set("module","contract");r.searchParams.set("action","checkverifystatus");r.searchParams.set("guid",t);try{const e=await(0,a.default)(r).json();return l.parse(e)}catch(e){throw new Error(`Failed to check verification status: ${e}`)}};const createVerificationRequest=({apiKey:e,address:t,contractName:r,constructorArguments:i,compilerVersion:n,optimizerRuns:s=0,sourceCode:o,evmVersion:a,licenseType:l})=>{const u={action:"verifysourcecode",module:"contract",codeformat:"solidity-standard-json-input",contractaddress:t,contractname:r,compilerversion:`v${n}`,optimizationUsed:s>0?"1":"0",sourceCode:o};if(e!=null)u.apikey=e;if(s!=null)u.runs=String(s);if(i!=null)u.constructorArguements=i;if(a!=null)u.evmversion=a;if(l!=null)u.licenseType=String(l);return u};const l=n.z.object({status:n.z.coerce.number().nullish(),message:n.z.string().nullish(),result:n.z.string().nullish()})},8194:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isFile=t.isDirectory=void 0;const i=r(7147);const isDirectory=e=>{try{return(0,i.lstatSync)(e).isDirectory()}catch(e){return false}};t.isDirectory=isDirectory;const isFile=e=>{try{return(0,i.lstatSync)(e).isFile()}catch(e){return false}};t.isFile=isFile},4963:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.findLicenseType=t.LicenseType=void 0;var r;(function(e){e[e["None"]=1]="None";e[e["Unlicense"]=2]="Unlicense";e[e["MIT"]=3]="MIT";e[e["GNU-GPLv2"]=4]="GNU-GPLv2";e[e["GNU-GPLv3"]=5]="GNU-GPLv3";e[e["GNU-LGPLv2.1"]=6]="GNU-LGPLv2.1";e[e["GNU-LGPLv3"]=7]="GNU-LGPLv3";e[e["BSD-2-Clause"]=8]="BSD-2-Clause";e[e["BSD-3-Clause"]=9]="BSD-3-Clause";e[e["MPL-2.0"]=10]="MPL-2.0";e[e["OSL-3.0"]=11]="OSL-3.0";e[e["Apache-2.0"]=12]="Apache-2.0";e[e["GNU-AGPLv3"]=13]="GNU-AGPLv3";e[e["BUSL-1.1"]=14]="BUSL-1.1"})(r||(t.LicenseType=r={}));const findLicenseType=e=>{const t=e.match(/\/\/\s*SPDX-License-Identifier\:\s*(.*)\s*/i);const i=t===null||t===void 0?void 0:t[1];if(i==null)return r.None;if(!(i in r)){console.warn("Found unknown SPDX license identifier: %s",i)}return r[i]};t.findLicenseType=findLicenseType},8989:function(e,t,r){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.createRecordLogger=t.anonymizeValue=t.COLORS=t.createLogger=void 0;const n=i(r(8818));const s=i(r(4158));const createLogger=e=>s.default.createLogger({level:e,format:s.default.format.cli(),transports:[new s.default.transports.Console]});t.createLogger=createLogger;t.COLORS={default:n.default.white,error:n.default.red,success:n.default.green,palette:[n.default.magenta,n.default.cyan,n.default.yellow,n.default.blue,n.default.magentaBright,n.default.cyanBright,n.default.blueBright]};const anonymizeValue=e=>{const t=Math.min(Math.max(0,e.length-2),4);const r=e.length-t;const i=e.slice(0,t);const n=Array.from({length:r}).fill("*").join("");return`${i}${n}`};t.anonymizeValue=anonymizeValue;const createRecordLogger=(e,t="\t")=>r=>{e.info("");Object.entries(r).forEach((([r,i])=>{if(Array.isArray(i)){e.info(`${r}:`);i.forEach((r=>{e.info(`${t}\t- ${n.default.bold(formatLoggableValue(r))}`)}))}else{e.info(`${r}:${t}${n.default.bold(formatLoggableValue(i))}`)}}))};t.createRecordLogger=createRecordLogger;const formatLoggableValue=e=>{if(e==null)return"-";switch(typeof e){case"boolean":return e?o:a;default:return String(e)}};const o=t.COLORS.success`✓`;const a=t.COLORS.error`⚠`},824:function(e,t,r){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.retry=t.sleep=void 0;const n=i(r(9491));const sleep=e=>new Promise((t=>{setTimeout(t,e)}));t.sleep=sleep;const retry=async(e,t,r)=>{(0,n.default)(t>0,`Number of attempts for retry must be larger than 0, got ${t}`);for(let i=0;i<t-1;i++){try{return await e()}catch(e){await(r===null||r===void 0?void 0:r(e,i))}}return e()};t.retry=retry},2953:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.DeploymentSchema=t.MetadataSchema=t.MinimalAbiSchema=t.SourcesSchema=t.OptimizerSchema=void 0;const i=r(3301);t.OptimizerSchema=i.z.object({enabled:i.z.boolean().optional(),runs:i.z.number().optional()});t.SourcesSchema=i.z.record(i.z.string(),i.z.object({content:i.z.string()}));t.MinimalAbiSchema=i.z.array(i.z.record(i.z.string(),i.z.any()));t.MetadataSchema=i.z.object({language:i.z.string(),compiler:i.z.object({version:i.z.string()}),settings:i.z.object({compilationTarget:i.z.record(i.z.string(),i.z.string()),evmVersion:i.z.string(),optimizer:i.z.object({enabled:i.z.boolean().optional(),runs:i.z.number().optional()})}),sources:i.z.record(i.z.string(),i.z.object({content:i.z.string()}))});t.DeploymentSchema=i.z.object({address:i.z.string(),abi:t.MinimalAbiSchema,args:i.z.array(i.z.any()),solcInputHash:i.z.string(),metadata:i.z.string().transform(((e,t)=>{try{return JSON.parse(e)}catch(e){t.addIssue({code:"custom",message:"Invalid JSON"});return i.z.NEVER}})).pipe(t.MetadataSchema),bytecode:i.z.string(),deployedBytecode:i.z.string()})},2413:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.tryCreateScanContractUrl=t.tryGetScanBrowserUrlFromScanUrl=t.getDefaultScanApiUrl=void 0;const getDefaultScanApiUrl=e=>r.get(e);t.getDefaultScanApiUrl=getDefaultScanApiUrl;const tryGetScanBrowserUrlFromScanUrl=e=>{try{const t=new URL(e);if(!t.hostname.startsWith("api.")&&!t.hostname.startsWith("api-"))return undefined;t.hostname=t.hostname.replace(/^api[.-]/,"");t.pathname="/";return t.toString()}catch(e){return undefined}};t.tryGetScanBrowserUrlFromScanUrl=tryGetScanBrowserUrlFromScanUrl;const tryCreateScanContractUrl=(e,t)=>{try{const r=new URL(e);r.pathname=`/address/${t}`;return r.toString()}catch(e){return undefined}};t.tryCreateScanContractUrl=tryCreateScanContractUrl;const r=new Map([["avalanche","https://api.snowtrace.io/api"],["avalanche-mainnet","https://api.snowtrace.io/api"],["fuji","https://api-testnet.snowtrace.io/api"],["avalanche-testnet","https://api-testnet.snowtrace.io/api"],["arbitrum","https://api.arbiscan.io/api"],["arbitrum-goerli","https://api-goerli.arbiscan.io/api"],["bsc","https://api.bscscan.com/api"],["bsc-testnet","https://api-testnet.bscscan.com/api"],["ethereum","https://api.etherscan.io/api"],["ethereum-goerli","https://api-goerli.etherscan.io/api"],["goerli","https://api-goerli.etherscan.io/api"],["fantom","https://api.ftmscan.com/api"],["fantom-testnet","https://api-testnet.ftmscan.com/api"],["kava","https://kavascan.com/api"],["kava-mainnet","https://kavascan.com/api"],["kava-testnet","https://testnet.kavascan.com/api"],["polygon","https://api.polygonscan.com/api"],["mumbai","https://api-testnet.polygonscan.com/api"],["optimism","https://api-optimistic.etherscan.io/api"],["optimism-goerli","https://api-goerli-optimistic.etherscan.io/api"],["gnosis","https://api.gnosisscan.io/api"],["zkpolygon","https://api-zkevm.polygonscan.com/api"],["zkpolygon-mainnet","https://api-zkevm.polygonscan.com/api"],["base","https://api.basescan.org/api"],["base-mainnet","https://api.basescan.org/api"],["base-goerli","https://api-goerli.basescan.org/api"],["linea","https://api.lineascan.build/api"],["linea-mainnet","https://api.lineascan.build/api"],["zkconsensys","https://api.lineascan.build/api"],["zkconsensys-mainnet","https://api.lineascan.build/api"],["moonbeam","https://api-moonbeam.moonscan.io/api"],["moonbeam-testnet","https://api-moonbase.moonscan.io/api"]])},4367:function(e,t,r){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.parseFilterConfig=t.parsePathsConfig=void 0;const n=i(r(1017));const parsePathsConfig=e=>{var t;return{deployments:(t=e===null||e===void 0?void 0:e.deployments)!==null&&t!==void 0?t:n.default.resolve(process.cwd(),"deployments")}};t.parsePathsConfig=parsePathsConfig;const parseFilterConfig=e=>{if(e==null)return()=>true;switch(typeof e){case"boolean":return()=>e;case"string":return t=>t===e;case"function":return e;case"object":if(Array.isArray(e)){const t=new Set(e);return e=>t.has(e)}if(e instanceof RegExp){return t=>e.test(t)}default:throw new TypeError(`Invalid verify configuration: expected string, string[], boolean, function or a RegExp, got ${e}`)}};t.parseFilterConfig=parseFilterConfig},2066:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.extractSolcInputFromMetadata=void 0;const extractSolcInputFromMetadata=e=>{const{compilationTarget:t,...r}=e.settings;const i=Object.entries(e.sources).reduce(((e,[t,r])=>({...e,[t]:{content:r.content}})),{});return{language:e.language,settings:r,sources:i}};t.extractSolcInputFromMetadata=extractSolcInputFromMetadata},8584:function(e,t,r){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.verifyTarget=t.verifyNonTarget=void 0;const n=r(6348);const s=r(1017);const o=r(4963);const a=r(7364);const l=i(r(8818));const u=r(8989);const c=r(2413);const h=r(2953);const d=r(2066);const p=r(3718);const m=r(4367);const g=r(8194);const y=r(7147);const verifyNonTarget=async(e,t)=>{const r=(0,n.parseNetworksConfig)(t,e.networks);const i=(0,m.parsePathsConfig)(e.paths);const a=(0,u.createRecordLogger)(t);const l=createVerifyAll(t);const c=createLogVerificationResult(a);const y=e.contracts.flatMap((e=>{var n;const{address:l,network:c,contractName:m,deployment:y}=e;t.info(`Collectiong information for contract ${m} on network ${c}`);const _=r[c];if(_==null){t.info(`No network configured for contract ${m} on network ${c}`);return[]}const v=`${(0,s.basename)(y,".json")}.json`;const b=(0,s.resolve)(i.deployments,c,v);if(!(0,g.isFile)(b)){t.error(u.COLORS.error`Deployment file ${b} does not exist or is not a file`);return[]}const x=require(b);const T=h.DeploymentSchema.safeParse(x);if(!T.success){t.error(u.COLORS.error`No network configured for contract ${m} on network ${c}`);return[]}const w=T.data;const S=(0,s.basename)(m,".sol");const E=w.metadata.sources[m];if(E==null){t.error(u.COLORS.error`Missing source for contract ${m} for network ${c} in ${v}`);return[]}const A=(0,o.findLicenseType)(E.content);const C=(0,p.getContructorABIFromSource)(E.content);const N=(0,p.encodeContructorArguments)(C,e.constructorArguments);const O=(0,d.extractSolcInputFromMetadata)(w.metadata);const R={apiUrl:_.apiUrl,apiKey:_.apiKey,address:l,contractName:`${m}:${S}`,constructorArguments:N,licenseType:A,compilerVersion:w.metadata.compiler.version,sourceCode:JSON.stringify(O),evmVersion:w.metadata.settings.evmVersion,optimizerRuns:(n=w.metadata.settings.optimizer)===null||n===void 0?void 0:n.runs};a({Contract:m,Network:c,Address:R.address,License:R.licenseType,Arguments:e.constructorArguments?JSON.stringify(e.constructorArguments):undefined,Sources:Object.keys(w.metadata.sources),"Scan URL":R.apiUrl,"Scan API Key":R.apiKey?(0,u.anonymizeValue)(R.apiKey):undefined});return[{networkName:c,networkConfig:_,submitProps:R}]}));if(y.length===0){t.warn("No contracts match the verification criteria, exiting");return[]}if(e.dryRun){t.debug("Dry run enabled, exiting");return[]}const _=await Promise.all(l(y));_.forEach(c);return _};t.verifyNonTarget=verifyNonTarget;const verifyTarget=async(e,t)=>{const r=(0,m.parseFilterConfig)(e.filter);const i=(0,n.parseNetworksConfig)(t,e.networks);const a=(0,m.parsePathsConfig)(e.paths);const l=(0,u.createRecordLogger)(t);const c=createVerifyAll(t);const _=createLogVerificationResult(l);if(!(0,g.isDirectory)(a.deployments)){throw new Error(`Path ${a.deployments} is not a directory`)}const v=new Set((0,y.readdirSync)(a.deployments));const b=Object.entries(i);t.debug("Verifying deployments for following networks:");b.forEach((([e,r])=>{t.debug(`\t\t- ${e} (API URL ${r.apiUrl})`)}));const x=b.flatMap((([e,i])=>{t.info(`Collecting deployments for ${e}...`);if(!v.has(e)){t.warn(`Could not find deployment for network ${e} in ${a.deployments}`);return[]}const n=(0,s.resolve)(a.deployments,e);const c=(0,y.readdirSync)(n).filter((e=>e.endsWith(".json")));return c.flatMap((a=>{var c;t.info(`Inspecting deployment file ${a} on network ${e}`);const m=(0,s.resolve)(n,a);const g=require(m);const y=h.DeploymentSchema.safeParse(g);if(!y.success){throw new Error(`Error parsing deployment file ${a} on network ${e}: ${y.error}`)}const _=y.data;const v=(0,s.basename)(a,".json");const b=_.metadata.settings.compilationTarget;const x=Object.keys(b).find((e=>b[e]===v));if(x==null){t.error(u.COLORS.error`Could not find contract ${v} in the deployment file ${a} for network ${e}`);return[]}const T=r(v,x,e);if(!T){t.debug(`No contracts to verify in ${a} on network ${e}, skipping`);return[]}const w=_.metadata.sources[x];if(w==null){t.error(u.COLORS.error`Could not find source for ${v} (${x})`);return[]}const S=(0,o.findLicenseType)(w.content);const E=(0,p.encodeContructorArguments)(_.abi,_.args);const A=(0,d.extractSolcInputFromMetadata)(_.metadata);const C={apiUrl:i.apiUrl,apiKey:i.apiKey,address:_.address,contractName:`${x}:${v}`,constructorArguments:E,licenseType:S,compilerVersion:_.metadata.compiler.version,sourceCode:JSON.stringify(A),evmVersion:_.metadata.settings.evmVersion,optimizerRuns:(c=_.metadata.settings.optimizer)===null||c===void 0?void 0:c.runs};l({Contract:v,Network:e,Address:_.address,License:C.licenseType,Arguments:JSON.stringify(_.args),Sources:Object.keys(_.metadata.sources),"Scan URL":C.apiUrl,"Scan API Key":C.apiKey?(0,u.anonymizeValue)(C.apiKey):undefined});return{submitProps:C,networkName:e,networkConfig:i}}))}));if(x.length===0){t.warn("No contracts match the verification criteria, exiting");return[]}if(e.dryRun){t.debug("Dry run enabled, exiting");return[]}const T=await Promise.all(c(x));T.forEach(_);return T};t.verifyTarget=verifyTarget;const createVerifyAll=e=>t=>t.map((async(r,i)=>{const{submitProps:n}=r;const s=u.COLORS.palette[i%u.COLORS.palette.length];const o=`[${i+1}/${t.length}]`;const c=l.default.bold(n.contractName);const h=l.default.bold(r.networkName);e.info(s`Verifying contract ${c} for network ${h} ${o}`);try{const t=(0,a.createVerification)(n);t.on("poll",(t=>{e.info(s`Polling for verification status of ${c} for network ${h} (GUID ${t}) ${o}`)}));t.on("retry",((t,r)=>{e.info(s`Retrying failed verification attempt of ${c} for network ${h} (attempt ${r+1}) ${o}`)}));const i=await t.verify();return{artifact:r,result:i}}catch(t){e.error(u.COLORS.error`Problem verifying contract ${c} for network ${h} ${o}: ${t} `);return{artifact:r,error:t}}}));const createLogVerificationResult=e=>({artifact:t,response:r,error:i})=>{const n=l.default.bold(t.submitProps.contractName);const s=l.default.bold(t.networkName);const o=t.networkConfig.browserUrl?(0,c.tryCreateScanContractUrl)(t.networkConfig.browserUrl,t.submitProps.address):undefined;e({Contract:n,Network:s,Result:i==null,"Was verified":r===null||r===void 0?void 0:r.alreadyVerified,"Contract URL":o,Error:i?u.COLORS.error(i):undefined})}},9491:e=>{"use strict";e.exports=require("assert")},4300:e=>{"use strict";e.exports=require("buffer")},2081:e=>{"use strict";e.exports=require("child_process")},2361:e=>{"use strict";e.exports=require("events")},7147:e=>{"use strict";e.exports=require("fs")},3685:e=>{"use strict";e.exports=require("http")},5158:e=>{"use strict";e.exports=require("http2")},5687:e=>{"use strict";e.exports=require("https")},1808:e=>{"use strict";e.exports=require("net")},2037:e=>{"use strict";e.exports=require("os")},1017:e=>{"use strict";e.exports=require("path")},7282:e=>{"use strict";e.exports=require("process")},2781:e=>{"use strict";e.exports=require("stream")},1576:e=>{"use strict";e.exports=require("string_decoder")},4404:e=>{"use strict";e.exports=require("tls")},6224:e=>{"use strict";e.exports=require("tty")},7310:e=>{"use strict";e.exports=require("url")},3837:e=>{"use strict";e.exports=require("util")},9796:e=>{"use strict";e.exports=require("zlib")},4379:(e,t,r)=>{const{Argument:i}=r(9414);const{Command:n}=r(552);const{CommanderError:s,InvalidArgumentError:o}=r(2625);const{Help:a}=r(5153);const{Option:l}=r(6558);t=e.exports=new n;t.program=t;t.Argument=i;t.Command=n;t.CommanderError=s;t.Help=a;t.InvalidArgumentError=o;t.InvalidOptionArgumentError=o;t.Option=l},9414:(e,t,r)=>{const{InvalidArgumentError:i}=r(2625);class Argument{constructor(e,t){this.description=t||"";this.variadic=false;this.parseArg=undefined;this.defaultValue=undefined;this.defaultValueDescription=undefined;this.argChoices=undefined;switch(e[0]){case"<":this.required=true;this._name=e.slice(1,-1);break;case"[":this.required=false;this._name=e.slice(1,-1);break;default:this.required=true;this._name=e;break}if(this._name.length>3&&this._name.slice(-3)==="..."){this.variadic=true;this._name=this._name.slice(0,-3)}}name(){return this._name}_concatValue(e,t){if(t===this.defaultValue||!Array.isArray(t)){return[e]}return t.concat(e)}default(e,t){this.defaultValue=e;this.defaultValueDescription=t;return this}argParser(e){this.parseArg=e;return this}choices(e){this.argChoices=e.slice();this.parseArg=(e,t)=>{if(!this.argChoices.includes(e)){throw new i(`Allowed choices are ${this.argChoices.join(", ")}.`)}if(this.variadic){return this._concatValue(e,t)}return e};return this}argRequired(){this.required=true;return this}argOptional(){this.required=false;return this}}function humanReadableArgName(e){const t=e.name()+(e.variadic===true?"...":"");return e.required?"<"+t+">":"["+t+"]"}t.Argument=Argument;t.humanReadableArgName=humanReadableArgName},552:(e,t,r)=>{const i=r(2361).EventEmitter;const n=r(2081);const s=r(1017);const o=r(7147);const a=r(7282);const{Argument:l,humanReadableArgName:u}=r(9414);const{CommanderError:c}=r(2625);const{Help:h}=r(5153);const{Option:d,splitOptionFlags:p,DualOptions:m}=r(6558);const{suggestSimilar:g}=r(7592);class Command extends i{constructor(e){super();this.commands=[];this.options=[];this.parent=null;this._allowUnknownOption=false;this._allowExcessArguments=true;this._args=[];this.args=[];this.rawArgs=[];this.processedArgs=[];this._scriptPath=null;this._name=e||"";this._optionValues={};this._optionValueSources={};this._storeOptionsAsProperties=false;this._actionHandler=null;this._executableHandler=false;this._executableFile=null;this._executableDir=null;this._defaultCommandName=null;this._exitCallback=null;this._aliases=[];this._combineFlagAndOptionalValue=true;this._description="";this._summary="";this._argsDescription=undefined;this._enablePositionalOptions=false;this._passThroughOptions=false;this._lifeCycleHooks={};this._showHelpAfterError=false;this._showSuggestionAfterError=true;this._outputConfiguration={writeOut:e=>a.stdout.write(e),writeErr:e=>a.stderr.write(e),getOutHelpWidth:()=>a.stdout.isTTY?a.stdout.columns:undefined,getErrHelpWidth:()=>a.stderr.isTTY?a.stderr.columns:undefined,outputError:(e,t)=>t(e)};this._hidden=false;this._hasHelpOption=true;this._helpFlags="-h, --help";this._helpDescription="display help for command";this._helpShortFlag="-h";this._helpLongFlag="--help";this._addImplicitHelpCommand=undefined;this._helpCommandName="help";this._helpCommandnameAndArgs="help [command]";this._helpCommandDescription="display help for command";this._helpConfiguration={}}copyInheritedSettings(e){this._outputConfiguration=e._outputConfiguration;this._hasHelpOption=e._hasHelpOption;this._helpFlags=e._helpFlags;this._helpDescription=e._helpDescription;this._helpShortFlag=e._helpShortFlag;this._helpLongFlag=e._helpLongFlag;this._helpCommandName=e._helpCommandName;this._helpCommandnameAndArgs=e._helpCommandnameAndArgs;this._helpCommandDescription=e._helpCommandDescription;this._helpConfiguration=e._helpConfiguration;this._exitCallback=e._exitCallback;this._storeOptionsAsProperties=e._storeOptionsAsProperties;this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue;this._allowExcessArguments=e._allowExcessArguments;this._enablePositionalOptions=e._enablePositionalOptions;this._showHelpAfterError=e._showHelpAfterError;this._showSuggestionAfterError=e._showSuggestionAfterError;return this}command(e,t,r){let i=t;let n=r;if(typeof i==="object"&&i!==null){n=i;i=null}n=n||{};const[,s,o]=e.match(/([^ ]+) *(.*)/);const a=this.createCommand(s);if(i){a.description(i);a._executableHandler=true}if(n.isDefault)this._defaultCommandName=a._name;a._hidden=!!(n.noHelp||n.hidden);a._executableFile=n.executableFile||null;if(o)a.arguments(o);this.commands.push(a);a.parent=this;a.copyInheritedSettings(this);if(i)return this;return a}createCommand(e){return new Command(e)}createHelp(){return Object.assign(new h,this.configureHelp())}configureHelp(e){if(e===undefined)return this._helpConfiguration;this._helpConfiguration=e;return this}configureOutput(e){if(e===undefined)return this._outputConfiguration;Object.assign(this._outputConfiguration,e);return this}showHelpAfterError(e=true){if(typeof e!=="string")e=!!e;this._showHelpAfterError=e;return this}showSuggestionAfterError(e=true){this._showSuggestionAfterError=!!e;return this}addCommand(e,t){if(!e._name){throw new Error(`Command passed to .addCommand() must have a name\n- specify the name in Command constructor or using .name()`)}t=t||{};if(t.isDefault)this._defaultCommandName=e._name;if(t.noHelp||t.hidden)e._hidden=true;this.commands.push(e);e.parent=this;return this}createArgument(e,t){return new l(e,t)}argument(e,t,r,i){const n=this.createArgument(e,t);if(typeof r==="function"){n.default(i).argParser(r)}else{n.default(r)}this.addArgument(n);return this}arguments(e){e.trim().split(/ +/).forEach((e=>{this.argument(e)}));return this}addArgument(e){const t=this._args.slice(-1)[0];if(t&&t.variadic){throw new Error(`only the last argument can be variadic '${t.name()}'`)}if(e.required&&e.defaultValue!==undefined&&e.parseArg===undefined){throw new Error(`a default value for a required argument is never used: '${e.name()}'`)}this._args.push(e);return this}addHelpCommand(e,t){if(e===false){this._addImplicitHelpCommand=false}else{this._addImplicitHelpCommand=true;if(typeof e==="string"){this._helpCommandName=e.split(" ")[0];this._helpCommandnameAndArgs=e}this._helpCommandDescription=t||this._helpCommandDescription}return this}_hasImplicitHelpCommand(){if(this._addImplicitHelpCommand===undefined){return this.commands.length&&!this._actionHandler&&!this._findCommand("help")}return this._addImplicitHelpCommand}hook(e,t){const r=["preSubcommand","preAction","postAction"];if(!r.includes(e)){throw new Error(`Unexpected value for event passed to hook : '${e}'.\nExpecting one of '${r.join("', '")}'`)}if(this._lifeCycleHooks[e]){this._lifeCycleHooks[e].push(t)}else{this._lifeCycleHooks[e]=[t]}return this}exitOverride(e){if(e){this._exitCallback=e}else{this._exitCallback=e=>{if(e.code!=="commander.executeSubCommandAsync"){throw e}else{}}}return this}_exit(e,t,r){if(this._exitCallback){this._exitCallback(new c(e,t,r))}a.exit(e)}action(e){const listener=t=>{const r=this._args.length;const i=t.slice(0,r);if(this._storeOptionsAsProperties){i[r]=this}else{i[r]=this.opts()}i.push(this);return e.apply(this,i)};this._actionHandler=listener;return this}createOption(e,t){return new d(e,t)}addOption(e){const t=e.name();const r=e.attributeName();if(e.negate){const t=e.long.replace(/^--no-/,"--");if(!this._findOption(t)){this.setOptionValueWithSource(r,e.defaultValue===undefined?true:e.defaultValue,"default")}}else if(e.defaultValue!==undefined){this.setOptionValueWithSource(r,e.defaultValue,"default")}this.options.push(e);const handleOptionValue=(t,i,n)=>{if(t==null&&e.presetArg!==undefined){t=e.presetArg}const s=this.getOptionValue(r);if(t!==null&&e.parseArg){try{t=e.parseArg(t,s)}catch(e){if(e.code==="commander.invalidArgument"){const t=`${i} ${e.message}`;this.error(t,{exitCode:e.exitCode,code:e.code})}throw e}}else if(t!==null&&e.variadic){t=e._concatValue(t,s)}if(t==null){if(e.negate){t=false}else if(e.isBoolean()||e.optional){t=true}else{t=""}}this.setOptionValueWithSource(r,t,n)};this.on("option:"+t,(t=>{const r=`error: option '${e.flags}' argument '${t}' is invalid.`;handleOptionValue(t,r,"cli")}));if(e.envVar){this.on("optionEnv:"+t,(t=>{const r=`error: option '${e.flags}' value '${t}' from env '${e.envVar}' is invalid.`;handleOptionValue(t,r,"env")}))}return this}_optionEx(e,t,r,i,n){if(typeof t==="object"&&t instanceof d){throw new Error("To add an Option object use addOption() instead of option() or requiredOption()")}const s=this.createOption(t,r);s.makeOptionMandatory(!!e.mandatory);if(typeof i==="function"){s.default(n).argParser(i)}else if(i instanceof RegExp){const e=i;i=(t,r)=>{const i=e.exec(t);return i?i[0]:r};s.default(n).argParser(i)}else{s.default(i)}return this.addOption(s)}option(e,t,r,i){return this._optionEx({},e,t,r,i)}requiredOption(e,t,r,i){return this._optionEx({mandatory:true},e,t,r,i)}combineFlagAndOptionalValue(e=true){this._combineFlagAndOptionalValue=!!e;return this}allowUnknownOption(e=true){this._allowUnknownOption=!!e;return this}allowExcessArguments(e=true){this._allowExcessArguments=!!e;return this}enablePositionalOptions(e=true){this._enablePositionalOptions=!!e;return this}passThroughOptions(e=true){this._passThroughOptions=!!e;if(!!this.parent&&e&&!this.parent._enablePositionalOptions){throw new Error("passThroughOptions can not be used without turning on enablePositionalOptions for parent command(s)")}return this}storeOptionsAsProperties(e=true){this._storeOptionsAsProperties=!!e;if(this.options.length){throw new Error("call .storeOptionsAsProperties() before adding options")}return this}getOptionValue(e){if(this._storeOptionsAsProperties){return this[e]}return this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,undefined)}setOptionValueWithSource(e,t,r){if(this._storeOptionsAsProperties){this[e]=t}else{this._optionValues[e]=t}this._optionValueSources[e]=r;return this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;getCommandAndParents(this).forEach((r=>{if(r.getOptionValueSource(e)!==undefined){t=r.getOptionValueSource(e)}}));return t}_prepareUserArgs(e,t){if(e!==undefined&&!Array.isArray(e)){throw new Error("first parameter to parse must be array or undefined")}t=t||{};if(e===undefined){e=a.argv;if(a.versions&&a.versions.electron){t.from="electron"}}this.rawArgs=e.slice();let r;switch(t.from){case undefined:case"node":this._scriptPath=e[1];r=e.slice(2);break;case"electron":if(a.defaultApp){this._scriptPath=e[1];r=e.slice(2)}else{r=e.slice(1)}break;case"user":r=e.slice(0);break;default:throw new Error(`unexpected parse option { from: '${t.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);this._name=this._name||"program";return r}parse(e,t){const r=this._prepareUserArgs(e,t);this._parseCommand([],r);return this}async parseAsync(e,t){const r=this._prepareUserArgs(e,t);await this._parseCommand([],r);return this}_executeSubCommand(e,t){t=t.slice();let r=false;const i=[".js",".ts",".tsx",".mjs",".cjs"];function findFile(e,t){const r=s.resolve(e,t);if(o.existsSync(r))return r;if(i.includes(s.extname(t)))return undefined;const n=i.find((e=>o.existsSync(`${r}${e}`)));if(n)return`${r}${n}`;return undefined}this._checkForMissingMandatoryOptions();this._checkForConflictingOptions();let l=e._executableFile||`${this._name}-${e._name}`;let u=this._executableDir||"";if(this._scriptPath){let e;try{e=o.realpathSync(this._scriptPath)}catch(t){e=this._scriptPath}u=s.resolve(s.dirname(e),u)}if(u){let t=findFile(u,l);if(!t&&!e._executableFile&&this._scriptPath){const r=s.basename(this._scriptPath,s.extname(this._scriptPath));if(r!==this._name){t=findFile(u,`${r}-${e._name}`)}}l=t||l}r=i.includes(s.extname(l));let h;if(a.platform!=="win32"){if(r){t.unshift(l);t=incrementNodeInspectorPort(a.execArgv).concat(t);h=n.spawn(a.argv[0],t,{stdio:"inherit"})}else{h=n.spawn(l,t,{stdio:"inherit"})}}else{t.unshift(l);t=incrementNodeInspectorPort(a.execArgv).concat(t);h=n.spawn(a.execPath,t,{stdio:"inherit"})}if(!h.killed){const e=["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"];e.forEach((e=>{a.on(e,(()=>{if(h.killed===false&&h.exitCode===null){h.kill(e)}}))}))}const d=this._exitCallback;if(!d){h.on("close",a.exit.bind(a))}else{h.on("close",(()=>{d(new c(a.exitCode||0,"commander.executeSubCommandAsync","(close)"))}))}h.on("error",(t=>{if(t.code==="ENOENT"){const t=u?`searched for local subcommand relative to directory '${u}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory";const r=`'${l}' does not exist\n - if '${e._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead\n - if the default executable name is not suitable, use the executableFile option to supply a custom name or path\n - ${t}`;throw new Error(r)}else if(t.code==="EACCES"){throw new Error(`'${l}' not executable`)}if(!d){a.exit(1)}else{const e=new c(1,"commander.executeSubCommandAsync","(error)");e.nestedError=t;d(e)}}));this.runningCommand=h}_dispatchSubcommand(e,t,r){const i=this._findCommand(e);if(!i)this.help({error:true});let n;n=this._chainOrCallSubCommandHook(n,i,"preSubcommand");n=this._chainOrCall(n,(()=>{if(i._executableHandler){this._executeSubCommand(i,t.concat(r))}else{return i._parseCommand(t,r)}}));return n}_dispatchHelpCommand(e){if(!e){this.help()}const t=this._findCommand(e);if(t&&!t._executableHandler){t.help()}return this._dispatchSubcommand(e,[],[this._helpLongFlag])}_checkNumberOfArguments(){this._args.forEach(((e,t)=>{if(e.required&&this.args[t]==null){this.missingArgument(e.name())}}));if(this._args.length>0&&this._args[this._args.length-1].variadic){return}if(this.args.length>this._args.length){this._excessArguments(this.args)}}_processArguments(){const myParseArg=(e,t,r)=>{let i=t;if(t!==null&&e.parseArg){try{i=e.parseArg(t,r)}catch(r){if(r.code==="commander.invalidArgument"){const i=`error: command-argument value '${t}' is invalid for argument '${e.name()}'. ${r.message}`;this.error(i,{exitCode:r.exitCode,code:r.code})}throw r}}return i};this._checkNumberOfArguments();const e=[];this._args.forEach(((t,r)=>{let i=t.defaultValue;if(t.variadic){if(r<this.args.length){i=this.args.slice(r);if(t.parseArg){i=i.reduce(((e,r)=>myParseArg(t,r,e)),t.defaultValue)}}else if(i===undefined){i=[]}}else if(r<this.args.length){i=this.args[r];if(t.parseArg){i=myParseArg(t,i,t.defaultValue)}}e[r]=i}));this.processedArgs=e}_chainOrCall(e,t){if(e&&e.then&&typeof e.then==="function"){return e.then((()=>t()))}return t()}_chainOrCallHooks(e,t){let r=e;const i=[];getCommandAndParents(this).reverse().filter((e=>e._lifeCycleHooks[t]!==undefined)).forEach((e=>{e._lifeCycleHooks[t].forEach((t=>{i.push({hookedCommand:e,callback:t})}))}));if(t==="postAction"){i.reverse()}i.forEach((e=>{r=this._chainOrCall(r,(()=>e.callback(e.hookedCommand,this)))}));return r}_chainOrCallSubCommandHook(e,t,r){let i=e;if(this._lifeCycleHooks[r]!==undefined){this._lifeCycleHooks[r].forEach((e=>{i=this._chainOrCall(i,(()=>e(this,t)))}))}return i}_parseCommand(e,t){const r=this.parseOptions(t);this._parseOptionsEnv();this._parseOptionsImplied();e=e.concat(r.operands);t=r.unknown;this.args=e.concat(t);if(e&&this._findCommand(e[0])){return this._dispatchSubcommand(e[0],e.slice(1),t)}if(this._hasImplicitHelpCommand()&&e[0]===this._helpCommandName){return this._dispatchHelpCommand(e[1])}if(this._defaultCommandName){outputHelpIfRequested(this,t);return this._dispatchSubcommand(this._defaultCommandName,e,t)}if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName){this.help({error:true})}outputHelpIfRequested(this,r.unknown);this._checkForMissingMandatoryOptions();this._checkForConflictingOptions();const checkForUnknownOptions=()=>{if(r.unknown.length>0){this.unknownOption(r.unknown[0])}};const i=`command:${this.name()}`;if(this._actionHandler){checkForUnknownOptions();this._processArguments();let r;r=this._chainOrCallHooks(r,"preAction");r=this._chainOrCall(r,(()=>this._actionHandler(this.processedArgs)));if(this.parent){r=this._chainOrCall(r,(()=>{this.parent.emit(i,e,t)}))}r=this._chainOrCallHooks(r,"postAction");return r}if(this.parent&&this.parent.listenerCount(i)){checkForUnknownOptions();this._processArguments();this.parent.emit(i,e,t)}else if(e.length){if(this._findCommand("*")){return this._dispatchSubcommand("*",e,t)}if(this.listenerCount("command:*")){this.emit("command:*",e,t)}else if(this.commands.length){this.unknownCommand()}else{checkForUnknownOptions();this._processArguments()}}else if(this.commands.length){checkForUnknownOptions();this.help({error:true})}else{checkForUnknownOptions();this._processArguments()}}_findCommand(e){if(!e)return undefined;return this.commands.find((t=>t._name===e||t._aliases.includes(e)))}_findOption(e){return this.options.find((t=>t.is(e)))}_checkForMissingMandatoryOptions(){for(let e=this;e;e=e.parent){e.options.forEach((t=>{if(t.mandatory&&e.getOptionValue(t.attributeName())===undefined){e.missingMandatoryOptionValue(t)}}))}}_checkForConflictingLocalOptions(){const e=this.options.filter((e=>{const t=e.attributeName();if(this.getOptionValue(t)===undefined){return false}return this.getOptionValueSource(t)!=="default"}));const t=e.filter((e=>e.conflictsWith.length>0));t.forEach((t=>{const r=e.find((e=>t.conflictsWith.includes(e.attributeName())));if(r){this._conflictingOption(t,r)}}))}_checkForConflictingOptions(){for(let e=this;e;e=e.parent){e._checkForConflictingLocalOptions()}}parseOptions(e){const t=[];const r=[];let i=t;const n=e.slice();function maybeOption(e){return e.length>1&&e[0]==="-"}let s=null;while(n.length){const e=n.shift();if(e==="--"){if(i===r)i.push(e);i.push(...n);break}if(s&&!maybeOption(e)){this.emit(`option:${s.name()}`,e);continue}s=null;if(maybeOption(e)){const t=this._findOption(e);if(t){if(t.required){const e=n.shift();if(e===undefined)this.optionMissingArgument(t);this.emit(`option:${t.name()}`,e)}else if(t.optional){let e=null;if(n.length>0&&!maybeOption(n[0])){e=n.shift()}this.emit(`option:${t.name()}`,e)}else{this.emit(`option:${t.name()}`)}s=t.variadic?t:null;continue}}if(e.length>2&&e[0]==="-"&&e[1]!=="-"){const t=this._findOption(`-${e[1]}`);if(t){if(t.required||t.optional&&this._combineFlagAndOptionalValue){this.emit(`option:${t.name()}`,e.slice(2))}else{this.emit(`option:${t.name()}`);n.unshift(`-${e.slice(2)}`)}continue}}if(/^--[^=]+=/.test(e)){const t=e.indexOf("=");const r=this._findOption(e.slice(0,t));if(r&&(r.required||r.optional)){this.emit(`option:${r.name()}`,e.slice(t+1));continue}}if(maybeOption(e)){i=r}if((this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&r.length===0){if(this._findCommand(e)){t.push(e);if(n.length>0)r.push(...n);break}else if(e===this._helpCommandName&&this._hasImplicitHelpCommand()){t.push(e);if(n.length>0)t.push(...n);break}else if(this._defaultCommandName){r.push(e);if(n.length>0)r.push(...n);break}}if(this._passThroughOptions){i.push(e);if(n.length>0)i.push(...n);break}i.push(e)}return{operands:t,unknown:r}}opts(){if(this._storeOptionsAsProperties){const e={};const t=this.options.length;for(let r=0;r<t;r++){const t=this.options[r].attributeName();e[t]=t===this._versionOptionName?this._version:this[t]}return e}return this._optionValues}optsWithGlobals(){return getCommandAndParents(this).reduce(((e,t)=>Object.assign(e,t.opts())),{})}error(e,t){this._outputConfiguration.outputError(`${e}\n`,this._outputConfiguration.writeErr);if(typeof this._showHelpAfterError==="string"){this._outputConfiguration.writeErr(`${this._showHelpAfterError}\n`)}else if(this._showHelpAfterError){this._outputConfiguration.writeErr("\n");this.outputHelp({error:true})}const r=t||{};const i=r.exitCode||1;const n=r.code||"commander.error";this._exit(i,n,e)}_parseOptionsEnv(){this.options.forEach((e=>{if(e.envVar&&e.envVar in a.env){const t=e.attributeName();if(this.getOptionValue(t)===undefined||["default","config","env"].includes(this.getOptionValueSource(t))){if(e.required||e.optional){this.emit(`optionEnv:${e.name()}`,a.env[e.envVar])}else{this.emit(`optionEnv:${e.name()}`)}}}}))}_parseOptionsImplied(){const e=new m(this.options);const hasCustomOptionValue=e=>this.getOptionValue(e)!==undefined&&!["default","implied"].includes(this.getOptionValueSource(e));this.options.filter((t=>t.implied!==undefined&&hasCustomOptionValue(t.attributeName())&&e.valueFromOption(this.getOptionValue(t.attributeName()),t))).forEach((e=>{Object.keys(e.implied).filter((e=>!hasCustomOptionValue(e))).forEach((t=>{this.setOptionValueWithSource(t,e.implied[t],"implied")}))}))}missingArgument(e){const t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){const t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){const t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){const findBestOptionFromValue=e=>{const t=e.attributeName();const r=this.getOptionValue(t);const i=this.options.find((e=>e.negate&&t===e.attributeName()));const n=this.options.find((e=>!e.negate&&t===e.attributeName()));if(i&&(i.presetArg===undefined&&r===false||i.presetArg!==undefined&&r===i.presetArg)){return i}return n||e};const getErrorMessage=e=>{const t=findBestOptionFromValue(e);const r=t.attributeName();const i=this.getOptionValueSource(r);if(i==="env"){return`environment variable '${t.envVar}'`}return`option '${t.flags}'`};const r=`error: ${getErrorMessage(e)} cannot be used with ${getErrorMessage(t)}`;this.error(r,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let r=[];let i=this;do{const e=i.createHelp().visibleOptions(i).filter((e=>e.long)).map((e=>e.long));r=r.concat(e);i=i.parent}while(i&&!i._enablePositionalOptions);t=g(e,r)}const r=`error: unknown option '${e}'${t}`;this.error(r,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;const t=this._args.length;const r=t===1?"":"s";const i=this.parent?` for '${this.name()}'`:"";const n=`error: too many arguments${i}. Expected ${t} argument${r} but got ${e.length}.`;this.error(n,{code:"commander.excessArguments"})}unknownCommand(){const e=this.args[0];let t="";if(this._showSuggestionAfterError){const r=[];this.createHelp().visibleCommands(this).forEach((e=>{r.push(e.name());if(e.alias())r.push(e.alias())}));t=g(e,r)}const r=`error: unknown command '${e}'${t}`;this.error(r,{code:"commander.unknownCommand"})}version(e,t,r){if(e===undefined)return this._version;this._version=e;t=t||"-V, --version";r=r||"output the version number";const i=this.createOption(t,r);this._versionOptionName=i.attributeName();this.options.push(i);this.on("option:"+i.name(),(()=>{this._outputConfiguration.writeOut(`${e}\n`);this._exit(0,"commander.version",e)}));return this}description(e,t){if(e===undefined&&t===undefined)return this._description;this._description=e;if(t){this._argsDescription=t}return this}summary(e){if(e===undefined)return this._summary;this._summary=e;return this}alias(e){if(e===undefined)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler){t=this.commands[this.commands.length-1]}if(e===t._name)throw new Error("Command alias can't be the same as its name");t._aliases.push(e);return this}aliases(e){if(e===undefined)return this._aliases;e.forEach((e=>this.alias(e)));return this}usage(e){if(e===undefined){if(this._usage)return this._usage;const e=this._args.map((e=>u(e)));return[].concat(this.options.length||this._hasHelpOption?"[options]":[],this.commands.length?"[command]":[],this._args.length?e:[]).join(" ")}this._usage=e;return this}name(e){if(e===undefined)return this._name;this._name=e;return this}nameFromFilename(e){this._name=s.basename(e,s.extname(e));return this}executableDir(e){if(e===undefined)return this._executableDir;this._executableDir=e;return this}helpInformation(e){const t=this.createHelp();if(t.helpWidth===undefined){t.helpWidth=e&&e.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()}return t.formatHelp(this,t)}_getHelpContext(e){e=e||{};const t={error:!!e.error};let r;if(t.error){r=e=>this._outputConfiguration.writeErr(e)}else{r=e=>this._outputConfiguration.writeOut(e)}t.write=e.write||r;t.command=this;return t}outputHelp(e){let t;if(typeof e==="function"){t=e;e=undefined}const r=this._getHelpContext(e);getCommandAndParents(this).reverse().forEach((e=>e.emit("beforeAllHelp",r)));this.emit("beforeHelp",r);let i=this.helpInformation(r);if(t){i=t(i);if(typeof i!=="string"&&!Buffer.isBuffer(i)){throw new Error("outputHelp callback must return a string or a Buffer")}}r.write(i);this.emit(this._helpLongFlag);this.emit("afterHelp",r);getCommandAndParents(this).forEach((e=>e.emit("afterAllHelp",r)))}helpOption(e,t){if(typeof e==="boolean"){this._hasHelpOption=e;return this}this._helpFlags=e||this._helpFlags;this._helpDescription=t||this._helpDescription;const r=p(this._helpFlags);this._helpShortFlag=r.shortFlag;this._helpLongFlag=r.longFlag;return this}help(e){this.outputHelp(e);let t=a.exitCode||0;if(t===0&&e&&typeof e!=="function"&&e.error){t=1}this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){const r=["beforeAll","before","after","afterAll"];if(!r.includes(e)){throw new Error(`Unexpected value for position to addHelpText.\nExpecting one of '${r.join("', '")}'`)}const i=`${e}Help`;this.on(i,(e=>{let r;if(typeof t==="function"){r=t({error:e.error,command:e.command})}else{r=t}if(r){e.write(`${r}\n`)}}));return this}}function outputHelpIfRequested(e,t){const r=e._hasHelpOption&&t.find((t=>t===e._helpLongFlag||t===e._helpShortFlag));if(r){e.outputHelp();e._exit(0,"commander.helpDisplayed","(outputHelp)")}}function incrementNodeInspectorPort(e){return e.map((e=>{if(!e.startsWith("--inspect")){return e}let t;let r="127.0.0.1";let i="9229";let n;if((n=e.match(/^(--inspect(-brk)?)$/))!==null){t=n[1]}else if((n=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null){t=n[1];if(/^\d+$/.test(n[3])){i=n[3]}else{r=n[3]}}else if((n=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null){t=n[1];r=n[3];i=n[4]}if(t&&i!=="0"){return`${t}=${r}:${parseInt(i)+1}`}return e}))}function getCommandAndParents(e){const t=[];for(let r=e;r;r=r.parent){t.push(r)}return t}t.Command=Command},2625:(e,t)=>{class CommanderError extends Error{constructor(e,t,r){super(r);Error.captureStackTrace(this,this.constructor);this.name=this.constructor.name;this.code=t;this.exitCode=e;this.nestedError=undefined}}class InvalidArgumentError extends CommanderError{constructor(e){super(1,"commander.invalidArgument",e);Error.captureStackTrace(this,this.constructor);this.name=this.constructor.name}}t.CommanderError=CommanderError;t.InvalidArgumentError=InvalidArgumentError},5153:(e,t,r)=>{const{humanReadableArgName:i}=r(9414);class Help{constructor(){this.helpWidth=undefined;this.sortSubcommands=false;this.sortOptions=false;this.showGlobalOptions=false}visibleCommands(e){const t=e.commands.filter((e=>!e._hidden));if(e._hasImplicitHelpCommand()){const[,r,i]=e._helpCommandnameAndArgs.match(/([^ ]+) *(.*)/);const n=e.createCommand(r).helpOption(false);n.description(e._helpCommandDescription);if(i)n.arguments(i);t.push(n)}if(this.sortSubcommands){t.sort(((e,t)=>e.name().localeCompare(t.name())))}return t}compareOptions(e,t){const getSortKey=e=>e.short?e.short.replace(/^-/,""):e.long.replace(/^--/,"");return getSortKey(e).localeCompare(getSortKey(t))}visibleOptions(e){const t=e.options.filter((e=>!e.hidden));const r=e._hasHelpOption&&e._helpShortFlag&&!e._findOption(e._helpShortFlag);const i=e._hasHelpOption&&!e._findOption(e._helpLongFlag);if(r||i){let n;if(!r){n=e.createOption(e._helpLongFlag,e._helpDescription)}else if(!i){n=e.createOption(e._helpShortFlag,e._helpDescription)}else{n=e.createOption(e._helpFlags,e._helpDescription)}t.push(n)}if(this.sortOptions){t.sort(this.compareOptions)}return t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];const t=[];for(let r=e.parent;r;r=r.parent){const e=r.options.filter((e=>!e.hidden));t.push(...e)}if(this.sortOptions){t.sort(this.compareOptions)}return t}visibleArguments(e){if(e._argsDescription){e._args.forEach((t=>{t.description=t.description||e._argsDescription[t.name()]||""}))}if(e._args.find((e=>e.description))){return e._args}return[]}subcommandTerm(e){const t=e._args.map((e=>i(e))).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce(((e,r)=>Math.max(e,t.subcommandTerm(r).length)),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce(((e,r)=>Math.max(e,t.optionTerm(r).length)),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce(((e,r)=>Math.max(e,t.optionTerm(r).length)),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce(((e,r)=>Math.max(e,t.argumentTerm(r).length)),0)}commandUsage(e){let t=e._name;if(e._aliases[0]){t=t+"|"+e._aliases[0]}let r="";for(let t=e.parent;t;t=t.parent){r=t.name()+" "+r}return r+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){const t=[];if(e.argChoices){t.push(`choices: ${e.argChoices.map((e=>JSON.stringify(e))).join(", ")}`)}if(e.defaultValue!==undefined){const r=e.required||e.optional||e.isBoolean()&&typeof e.defaultValue==="boolean";if(r){t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`)}}if(e.presetArg!==undefined&&e.optional){t.push(`preset: ${JSON.stringify(e.presetArg)}`)}if(e.envVar!==undefined){t.push(`env: ${e.envVar}`)}if(t.length>0){return`${e.description} (${t.join(", ")})`}return e.description}argumentDescription(e){const t=[];if(e.argChoices){t.push(`choices: ${e.argChoices.map((e=>JSON.stringify(e))).join(", ")}`)}if(e.defaultValue!==undefined){t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`)}if(t.length>0){const r=`(${t.join(", ")})`;if(e.description){return`${e.description} ${r}`}return r}return e.description}formatHelp(e,t){const r=t.padWidth(e,t);const i=t.helpWidth||80;const n=2;const s=2;function formatItem(e,o){if(o){const a=`${e.padEnd(r+s)}${o}`;return t.wrap(a,i-n,r+s)}return e}function formatList(e){return e.join("\n").replace(/^/gm," ".repeat(n))}let o=[`Usage: ${t.commandUsage(e)}`,""];const a=t.commandDescription(e);if(a.length>0){o=o.concat([t.wrap(a,i,0),""])}const l=t.visibleArguments(e).map((e=>formatItem(t.argumentTerm(e),t.argumentDescription(e))));if(l.length>0){o=o.concat(["Arguments:",formatList(l),""])}const u=t.visibleOptions(e).map((e=>formatItem(t.optionTerm(e),t.optionDescription(e))));if(u.length>0){o=o.concat(["Options:",formatList(u),""])}if(this.showGlobalOptions){const r=t.visibleGlobalOptions(e).map((e=>formatItem(t.optionTerm(e),t.optionDescription(e))));if(r.length>0){o=o.concat(["Global Options:",formatList(r),""])}}const c=t.visibleCommands(e).map((e=>formatItem(t.subcommandTerm(e),t.subcommandDescription(e))));if(c.length>0){o=o.concat(["Commands:",formatList(c),""])}return o.join("\n")}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}wrap(e,t,r,i=40){const n=" \\f\\t\\v   -    \ufeff";const s=new RegExp(`[\\n][${n}]+`);if(e.match(s))return e;const o=t-r;if(o<i)return e;const a=e.slice(0,r);const l=e.slice(r).replace("\r\n","\n");const u=" ".repeat(r);const c="​";const h=`\\s${c}`;const d=new RegExp(`\n|.{1,${o-1}}([${h}]|$)|[^${h}]+?([${h}]|$)`,"g");const p=l.match(d)||[];return a+p.map(((e,t)=>{if(e==="\n")return"";return(t>0?u:"")+e.trimEnd()})).join("\n")}}t.Help=Help},6558:(e,t,r)=>{const{InvalidArgumentError:i}=r(2625);class Option{constructor(e,t){this.flags=e;this.description=t||"";this.required=e.includes("<");this.optional=e.includes("[");this.variadic=/\w\.\.\.[>\]]$/.test(e);this.mandatory=false;const r=splitOptionFlags(e);this.short=r.shortFlag;this.long=r.longFlag;this.negate=false;if(this.long){this.negate=this.long.startsWith("--no-")}this.defaultValue=undefined;this.defaultValueDescription=undefined;this.presetArg=undefined;this.envVar=undefined;this.parseArg=undefined;this.hidden=false;this.argChoices=undefined;this.conflictsWith=[];this.implied=undefined}default(e,t){this.defaultValue=e;this.defaultValueDescription=t;return this}preset(e){this.presetArg=e;return this}conflicts(e){this.conflictsWith=this.conflictsWith.concat(e);return this}implies(e){let t=e;if(typeof e==="string"){t={[e]:true}}this.implied=Object.assign(this.implied||{},t);return this}env(e){this.envVar=e;return this}argParser(e){this.parseArg=e;return this}makeOptionMandatory(e=true){this.mandatory=!!e;return this}hideHelp(e=true){this.hidden=!!e;return this}_concatValue(e,t){if(t===this.defaultValue||!Array.isArray(t)){return[e]}return t.concat(e)}choices(e){this.argChoices=e.slice();this.parseArg=(e,t)=>{if(!this.argChoices.includes(e)){throw new i(`Allowed choices are ${this.argChoices.join(", ")}.`)}if(this.variadic){return this._concatValue(e,t)}return e};return this}name(){if(this.long){return this.long.replace(/^--/,"")}return this.short.replace(/^-/,"")}attributeName(){return camelcase(this.name().replace(/^no-/,""))}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class DualOptions{constructor(e){this.positiveOptions=new Map;this.negativeOptions=new Map;this.dualOptions=new Set;e.forEach((e=>{if(e.negate){this.negativeOptions.set(e.attributeName(),e)}else{this.positiveOptions.set(e.attributeName(),e)}}));this.negativeOptions.forEach(((e,t)=>{if(this.positiveOptions.has(t)){this.dualOptions.add(t)}}))}valueFromOption(e,t){const r=t.attributeName();if(!this.dualOptions.has(r))return true;const i=this.negativeOptions.get(r).presetArg;const n=i!==undefined?i:false;return t.negate===(n===e)}}function camelcase(e){return e.split("-").reduce(((e,t)=>e+t[0].toUpperCase()+t.slice(1)))}function splitOptionFlags(e){let t;let r;const i=e.split(/[ |,]+/);if(i.length>1&&!/^[[<]/.test(i[1]))t=i.shift();r=i.shift();if(!t&&/^-[^-]$/.test(r)){t=r;r=undefined}return{shortFlag:t,longFlag:r}}t.Option=Option;t.splitOptionFlags=splitOptionFlags;t.DualOptions=DualOptions},7592:(e,t)=>{const r=3;function editDistance(e,t){if(Math.abs(e.length-t.length)>r)return Math.max(e.length,t.length);const i=[];for(let t=0;t<=e.length;t++){i[t]=[t]}for(let e=0;e<=t.length;e++){i[0][e]=e}for(let r=1;r<=t.length;r++){for(let n=1;n<=e.length;n++){let s=1;if(e[n-1]===t[r-1]){s=0}else{s=1}i[n][r]=Math.min(i[n-1][r]+1,i[n][r-1]+1,i[n-1][r-1]+s);if(n>1&&r>1&&e[n-1]===t[r-2]&&e[n-2]===t[r-1]){i[n][r]=Math.min(i[n][r],i[n-2][r-2]+1)}}}return i[e.length][t.length]}function suggestSimilar(e,t){if(!t||t.length===0)return"";t=Array.from(new Set(t));const i=e.startsWith("--");if(i){e=e.slice(2);t=t.map((e=>e.slice(2)))}let n=[];let s=r;const o=.4;t.forEach((t=>{if(t.length<=1)return;const r=editDistance(e,t);const i=Math.max(e.length,t.length);const a=(i-r)/i;if(a>o){if(r<s){s=r;n=[t]}else if(r===s){n.push(t)}}}));n.sort(((e,t)=>e.localeCompare(t)));if(i){n=n.map((e=>`--${e}`))}if(n.length>1){return`\n(Did you mean one of ${n.join(", ")}?)`}if(n.length===1){return`\n(Did you mean ${n[0]}?)`}return""}t.suggestSimilar=suggestSimilar},1391:(e,t,r)=>{"use strict";r.r(t);r.d(t,{AbortError:()=>AbortError,CacheError:()=>CacheError,CancelError:()=>types_CancelError,HTTPError:()=>HTTPError,MaxRedirectsError:()=>MaxRedirectsError,Options:()=>Options,ParseError:()=>ParseError,ReadError:()=>ReadError,RequestError:()=>RequestError,RetryError:()=>RetryError,TimeoutError:()=>TimeoutError,UploadError:()=>UploadError,calculateRetryDelay:()=>te,create:()=>Re,default:()=>Le,got:()=>Pe,isResponseOk:()=>isResponseOk,parseBody:()=>parseBody,parseLinkHeader:()=>parseLinkHeader});const i=["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function isTypedArrayName(e){return i.includes(e)}const n=["Function","Generator","AsyncGenerator","GeneratorFunction","AsyncGeneratorFunction","AsyncFunction","Observable","Array","Buffer","Blob","Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","WeakRef","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","FormData","URLSearchParams","HTMLElement","NaN",...i];function isObjectTypeName(e){return n.includes(e)}const s=["null","undefined","string","number","bigint","boolean","symbol"];function isPrimitiveTypeName(e){return s.includes(e)}function isOfType(e){return t=>typeof t===e}const{toString:o}=Object.prototype;const getObjectType=e=>{const t=o.call(e).slice(8,-1);if(/HTML\w+Element/.test(t)&&is.domElement(e)){return"HTMLElement"}if(isObjectTypeName(t)){return t}return undefined};const isObjectOfType=e=>t=>getObjectType(t)===e;function is(e){if(e===null){return"null"}switch(typeof e){case"undefined":{return"undefined"}case"string":{return"string"}case"number":{return Number.isNaN(e)?"NaN":"number"}case"boolean":{return"boolean"}case"function":{return"Function"}case"bigint":{return"bigint"}case"symbol":{return"symbol"}default:}if(is.observable(e)){return"Observable"}if(is.array(e)){return"Array"}if(is.buffer(e)){return"Buffer"}const t=getObjectType(e);if(t){return t}if(e instanceof String||e instanceof Boolean||e instanceof Number){throw new TypeError("Please don't use object wrappers for primitive types")}return"Object"}is.undefined=isOfType("undefined");is.string=isOfType("string");const a=isOfType("number");is.number=e=>a(e)&&!is.nan(e);is.positiveNumber=e=>is.number(e)&&e>0;is.negativeNumber=e=>is.number(e)&&e<0;is.bigint=isOfType("bigint");is.function_=isOfType("function");is.null_=e=>e===null;is.class_=e=>is.function_(e)&&e.toString().startsWith("class ");is.boolean=e=>e===true||e===false;is.symbol=isOfType("symbol");is.numericString=e=>is.string(e)&&!is.emptyStringOrWhitespace(e)&&!Number.isNaN(Number(e));is.array=(e,t)=>{if(!Array.isArray(e)){return false}if(!is.function_(t)){return true}return e.every((e=>t(e)))};is.buffer=e=>e?.constructor?.isBuffer?.(e)??false;is.blob=e=>isObjectOfType("Blob")(e);is.nullOrUndefined=e=>is.null_(e)||is.undefined(e);is.object=e=>!is.null_(e)&&(typeof e==="object"||is.function_(e));is.iterable=e=>is.function_(e?.[Symbol.iterator]);is.asyncIterable=e=>is.function_(e?.[Symbol.asyncIterator]);is.generator=e=>is.iterable(e)&&is.function_(e?.next)&&is.function_(e?.throw);is.asyncGenerator=e=>is.asyncIterable(e)&&is.function_(e.next)&&is.function_(e.throw);is.nativePromise=e=>isObjectOfType("Promise")(e);const hasPromiseApi=e=>is.function_(e?.then)&&is.function_(e?.catch);is.promise=e=>is.nativePromise(e)||hasPromiseApi(e);is.generatorFunction=isObjectOfType("GeneratorFunction");is.asyncGeneratorFunction=e=>getObjectType(e)==="AsyncGeneratorFunction";is.asyncFunction=e=>getObjectType(e)==="AsyncFunction";is.boundFunction=e=>is.function_(e)&&!e.hasOwnProperty("prototype");is.regExp=isObjectOfType("RegExp");is.date=isObjectOfType("Date");is.error=isObjectOfType("Error");is.map=e=>isObjectOfType("Map")(e);is.set=e=>isObjectOfType("Set")(e);is.weakMap=e=>isObjectOfType("WeakMap")(e);is.weakSet=e=>isObjectOfType("WeakSet")(e);is.weakRef=e=>isObjectOfType("WeakRef")(e);is.int8Array=isObjectOfType("Int8Array");is.uint8Array=isObjectOfType("Uint8Array");is.uint8ClampedArray=isObjectOfType("Uint8ClampedArray");is.int16Array=isObjectOfType("Int16Array");is.uint16Array=isObjectOfType("Uint16Array");is.int32Array=isObjectOfType("Int32Array");is.uint32Array=isObjectOfType("Uint32Array");is.float32Array=isObjectOfType("Float32Array");is.float64Array=isObjectOfType("Float64Array");is.bigInt64Array=isObjectOfType("BigInt64Array");is.bigUint64Array=isObjectOfType("BigUint64Array");is.arrayBuffer=isObjectOfType("ArrayBuffer");is.sharedArrayBuffer=isObjectOfType("SharedArrayBuffer");is.dataView=isObjectOfType("DataView");is.enumCase=(e,t)=>Object.values(t).includes(e);is.directInstanceOf=(e,t)=>Object.getPrototypeOf(e)===t.prototype;is.urlInstance=e=>isObjectOfType("URL")(e);is.urlString=e=>{if(!is.string(e)){return false}try{new URL(e);return true}catch{return false}};is.truthy=e=>Boolean(e);is.falsy=e=>!e;is.nan=e=>Number.isNaN(e);is.primitive=e=>is.null_(e)||isPrimitiveTypeName(typeof e);is.integer=e=>Number.isInteger(e);is.safeInteger=e=>Number.isSafeInteger(e);is.plainObject=e=>{if(typeof e!=="object"||e===null){return false}const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)};is.typedArray=e=>isTypedArrayName(getObjectType(e));const isValidLength=e=>is.safeInteger(e)&&e>=0;is.arrayLike=e=>!is.nullOrUndefined(e)&&!is.function_(e)&&isValidLength(e.length);is.tupleLike=(e,t)=>{if(is.array(t)&&is.array(e)&&t.length===e.length){return t.every(((t,r)=>t(e[r])))}return false};is.inRange=(e,t)=>{if(is.number(t)){return e>=Math.min(0,t)&&e<=Math.max(t,0)}if(is.array(t)&&t.length===2){return e>=Math.min(...t)&&e<=Math.max(...t)}throw new TypeError(`Invalid range: ${JSON.stringify(t)}`)};const l=1;const u=["innerHTML","ownerDocument","style","attributes","nodeValue"];is.domElement=e=>is.object(e)&&e.nodeType===l&&is.string(e.nodeName)&&!is.plainObject(e)&&u.every((t=>t in e));is.observable=e=>{if(!e){return false}if(e===e[Symbol.observable]?.()){return true}if(e===e["@@observable"]?.()){return true}return false};is.nodeStream=e=>is.object(e)&&is.function_(e.pipe)&&!is.observable(e);is.infinite=e=>e===Number.POSITIVE_INFINITY||e===Number.NEGATIVE_INFINITY;const isAbsoluteMod2=e=>t=>is.integer(t)&&Math.abs(t%2)===e;is.evenInteger=isAbsoluteMod2(0);is.oddInteger=isAbsoluteMod2(1);is.emptyArray=e=>is.array(e)&&e.length===0;is.nonEmptyArray=e=>is.array(e)&&e.length>0;is.emptyString=e=>is.string(e)&&e.length===0;const isWhiteSpaceString=e=>is.string(e)&&!/\S/.test(e);is.emptyStringOrWhitespace=e=>is.emptyString(e)||isWhiteSpaceString(e);is.nonEmptyString=e=>is.string(e)&&e.length>0;is.nonEmptyStringAndNotWhitespace=e=>is.string(e)&&!is.emptyStringOrWhitespace(e);is.emptyObject=e=>is.object(e)&&!is.map(e)&&!is.set(e)&&Object.keys(e).length===0;is.nonEmptyObject=e=>is.object(e)&&!is.map(e)&&!is.set(e)&&Object.keys(e).length>0;is.emptySet=e=>is.set(e)&&e.size===0;is.nonEmptySet=e=>is.set(e)&&e.size>0;is.emptyMap=e=>is.map(e)&&e.size===0;is.nonEmptyMap=e=>is.map(e)&&e.size>0;is.propertyKey=e=>is.any([is.string,is.number,is.symbol],e);is.formData=e=>isObjectOfType("FormData")(e);is.urlSearchParams=e=>isObjectOfType("URLSearchParams")(e);const predicateOnArray=(e,t,r)=>{if(!is.function_(t)){throw new TypeError(`Invalid predicate: ${JSON.stringify(t)}`)}if(r.length===0){throw new TypeError("Invalid number of values")}return e.call(r,t)};is.any=(e,...t)=>{const r=is.array(e)?e:[e];return r.some((e=>predicateOnArray(Array.prototype.some,e,t)))};is.all=(e,...t)=>predicateOnArray(Array.prototype.every,e,t);const assertType=(e,t,r,i={})=>{if(!e){const{multipleValues:e}=i;const n=e?`received values of types ${[...new Set(r.map((e=>`\`${is(e)}\``)))].join(", ")}`:`received value of type \`${is(r)}\``;throw new TypeError(`Expected value which is \`${t}\`, ${n}.`)}};const c={undefined:e=>assertType(is.undefined(e),"undefined",e),string:e=>assertType(is.string(e),"string",e),number:e=>assertType(is.number(e),"number",e),positiveNumber:e=>assertType(is.positiveNumber(e),"positive number",e),negativeNumber:e=>assertType(is.negativeNumber(e),"negative number",e),bigint:e=>assertType(is.bigint(e),"bigint",e),function_:e=>assertType(is.function_(e),"Function",e),null_:e=>assertType(is.null_(e),"null",e),class_:e=>assertType(is.class_(e),"Class",e),boolean:e=>assertType(is.boolean(e),"boolean",e),symbol:e=>assertType(is.symbol(e),"symbol",e),numericString:e=>assertType(is.numericString(e),"string with a number",e),array:(e,t)=>{const r=assertType;r(is.array(e),"Array",e);if(t){e.forEach(t)}},buffer:e=>assertType(is.buffer(e),"Buffer",e),blob:e=>assertType(is.blob(e),"Blob",e),nullOrUndefined:e=>assertType(is.nullOrUndefined(e),"null or undefined",e),object:e=>assertType(is.object(e),"Object",e),iterable:e=>assertType(is.iterable(e),"Iterable",e),asyncIterable:e=>assertType(is.asyncIterable(e),"AsyncIterable",e),generator:e=>assertType(is.generator(e),"Generator",e),asyncGenerator:e=>assertType(is.asyncGenerator(e),"AsyncGenerator",e),nativePromise:e=>assertType(is.nativePromise(e),"native Promise",e),promise:e=>assertType(is.promise(e),"Promise",e),generatorFunction:e=>assertType(is.generatorFunction(e),"GeneratorFunction",e),asyncGeneratorFunction:e=>assertType(is.asyncGeneratorFunction(e),"AsyncGeneratorFunction",e),asyncFunction:e=>assertType(is.asyncFunction(e),"AsyncFunction",e),boundFunction:e=>assertType(is.boundFunction(e),"Function",e),regExp:e=>assertType(is.regExp(e),"RegExp",e),date:e=>assertType(is.date(e),"Date",e),error:e=>assertType(is.error(e),"Error",e),map:e=>assertType(is.map(e),"Map",e),set:e=>assertType(is.set(e),"Set",e),weakMap:e=>assertType(is.weakMap(e),"WeakMap",e),weakSet:e=>assertType(is.weakSet(e),"WeakSet",e),weakRef:e=>assertType(is.weakRef(e),"WeakRef",e),int8Array:e=>assertType(is.int8Array(e),"Int8Array",e),uint8Array:e=>assertType(is.uint8Array(e),"Uint8Array",e),uint8ClampedArray:e=>assertType(is.uint8ClampedArray(e),"Uint8ClampedArray",e),int16Array:e=>assertType(is.int16Array(e),"Int16Array",e),uint16Array:e=>assertType(is.uint16Array(e),"Uint16Array",e),int32Array:e=>assertType(is.int32Array(e),"Int32Array",e),uint32Array:e=>assertType(is.uint32Array(e),"Uint32Array",e),float32Array:e=>assertType(is.float32Array(e),"Float32Array",e),float64Array:e=>assertType(is.float64Array(e),"Float64Array",e),bigInt64Array:e=>assertType(is.bigInt64Array(e),"BigInt64Array",e),bigUint64Array:e=>assertType(is.bigUint64Array(e),"BigUint64Array",e),arrayBuffer:e=>assertType(is.arrayBuffer(e),"ArrayBuffer",e),sharedArrayBuffer:e=>assertType(is.sharedArrayBuffer(e),"SharedArrayBuffer",e),dataView:e=>assertType(is.dataView(e),"DataView",e),enumCase:(e,t)=>assertType(is.enumCase(e,t),"EnumCase",e),urlInstance:e=>assertType(is.urlInstance(e),"URL",e),urlString:e=>assertType(is.urlString(e),"string with a URL",e),truthy:e=>assertType(is.truthy(e),"truthy",e),falsy:e=>assertType(is.falsy(e),"falsy",e),nan:e=>assertType(is.nan(e),"NaN",e),primitive:e=>assertType(is.primitive(e),"primitive",e),integer:e=>assertType(is.integer(e),"integer",e),safeInteger:e=>assertType(is.safeInteger(e),"integer",e),plainObject:e=>assertType(is.plainObject(e),"plain object",e),typedArray:e=>assertType(is.typedArray(e),"TypedArray",e),arrayLike:e=>assertType(is.arrayLike(e),"array-like",e),tupleLike:(e,t)=>assertType(is.tupleLike(e,t),"tuple-like",e),domElement:e=>assertType(is.domElement(e),"HTMLElement",e),observable:e=>assertType(is.observable(e),"Observable",e),nodeStream:e=>assertType(is.nodeStream(e),"Node.js Stream",e),infinite:e=>assertType(is.infinite(e),"infinite number",e),emptyArray:e=>assertType(is.emptyArray(e),"empty array",e),nonEmptyArray:e=>assertType(is.nonEmptyArray(e),"non-empty array",e),emptyString:e=>assertType(is.emptyString(e),"empty string",e),emptyStringOrWhitespace:e=>assertType(is.emptyStringOrWhitespace(e),"empty string or whitespace",e),nonEmptyString:e=>assertType(is.nonEmptyString(e),"non-empty string",e),nonEmptyStringAndNotWhitespace:e=>assertType(is.nonEmptyStringAndNotWhitespace(e),"non-empty string and not whitespace",e),emptyObject:e=>assertType(is.emptyObject(e),"empty object",e),nonEmptyObject:e=>assertType(is.nonEmptyObject(e),"non-empty object",e),emptySet:e=>assertType(is.emptySet(e),"empty set",e),nonEmptySet:e=>assertType(is.nonEmptySet(e),"non-empty set",e),emptyMap:e=>assertType(is.emptyMap(e),"empty map",e),nonEmptyMap:e=>assertType(is.nonEmptyMap(e),"non-empty map",e),propertyKey:e=>assertType(is.propertyKey(e),"PropertyKey",e),formData:e=>assertType(is.formData(e),"FormData",e),urlSearchParams:e=>assertType(is.urlSearchParams(e),"URLSearchParams",e),evenInteger:e=>assertType(is.evenInteger(e),"even integer",e),oddInteger:e=>assertType(is.oddInteger(e),"odd integer",e),directInstanceOf:(e,t)=>assertType(is.directInstanceOf(e,t),"T",e),inRange:(e,t)=>assertType(is.inRange(e,t),"in range",e),any:(e,...t)=>assertType(is.any(e,...t),"predicate returns truthy for any value",t,{multipleValues:true}),all:(e,...t)=>assertType(is.all(e,...t),"predicate returns truthy for all values",t,{multipleValues:true})};Object.defineProperties(is,{class:{value:is.class_},function:{value:is.function_},null:{value:is.null_}});Object.defineProperties(c,{class:{value:c.class_},function:{value:c.function_},null:{value:c.null_}});const h=is;const d=require("node:events");class CancelError extends Error{constructor(e){super(e||"Promise was canceled");this.name="CancelError"}get isCanceled(){return true}}class PCancelable{static fn(e){return(...t)=>new PCancelable(((r,i,n)=>{t.push(n);e(...t).then(r,i)}))}constructor(e){this._cancelHandlers=[];this._isPending=true;this._isCanceled=false;this._rejectOnCancel=true;this._promise=new Promise(((t,r)=>{this._reject=r;const onResolve=e=>{if(!this._isCanceled||!onCancel.shouldReject){this._isPending=false;t(e)}};const onReject=e=>{this._isPending=false;r(e)};const onCancel=e=>{if(!this._isPending){throw new Error("The `onCancel` handler was attached after the promise settled.")}this._cancelHandlers.push(e)};Object.defineProperties(onCancel,{shouldReject:{get:()=>this._rejectOnCancel,set:e=>{this._rejectOnCancel=e}}});e(onResolve,onReject,onCancel)}))}then(e,t){return this._promise.then(e,t)}catch(e){return this._promise.catch(e)}finally(e){return this._promise.finally(e)}cancel(e){if(!this._isPending||this._isCanceled){return}this._isCanceled=true;if(this._cancelHandlers.length>0){try{for(const e of this._cancelHandlers){e()}}catch(e){this._reject(e);return}}if(this._rejectOnCancel){this._reject(new CancelError(e))}}get isCanceled(){return this._isCanceled}}Object.setPrototypeOf(PCancelable.prototype,Promise.prototype);function isRequest(e){return h.object(e)&&"_onResponse"in e}class RequestError extends Error{constructor(e,t,r){super(e);Object.defineProperty(this,"input",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"code",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"stack",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"response",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"request",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"timings",{enumerable:true,configurable:true,writable:true,value:void 0});Error.captureStackTrace(this,this.constructor);this.name="RequestError";this.code=t.code??"ERR_GOT_REQUEST_ERROR";this.input=t.input;if(isRequest(r)){Object.defineProperty(this,"request",{enumerable:false,value:r});Object.defineProperty(this,"response",{enumerable:false,value:r.response});this.options=r.options}else{this.options=r}this.timings=this.request?.timings;if(h.string(t.stack)&&h.string(this.stack)){const e=this.stack.indexOf(this.message)+this.message.length;const r=this.stack.slice(e).split("\n").reverse();const i=t.stack.slice(t.stack.indexOf(t.message)+t.message.length).split("\n").reverse();while(i.length>0&&i[0]===r[0]){r.shift()}this.stack=`${this.stack.slice(0,e)}${r.reverse().join("\n")}${i.reverse().join("\n")}`}}}class MaxRedirectsError extends RequestError{constructor(e){super(`Redirected ${e.options.maxRedirects} times. Aborting.`,{},e);this.name="MaxRedirectsError";this.code="ERR_TOO_MANY_REDIRECTS"}}class HTTPError extends RequestError{constructor(e){super(`Response code ${e.statusCode} (${e.statusMessage})`,{},e.request);this.name="HTTPError";this.code="ERR_NON_2XX_3XX_RESPONSE"}}class CacheError extends RequestError{constructor(e,t){super(e.message,e,t);this.name="CacheError";this.code=this.code==="ERR_GOT_REQUEST_ERROR"?"ERR_CACHE_ACCESS":this.code}}class UploadError extends RequestError{constructor(e,t){super(e.message,e,t);this.name="UploadError";this.code=this.code==="ERR_GOT_REQUEST_ERROR"?"ERR_UPLOAD":this.code}}class TimeoutError extends RequestError{constructor(e,t,r){super(e.message,e,r);Object.defineProperty(this,"timings",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"event",{enumerable:true,configurable:true,writable:true,value:void 0});this.name="TimeoutError";this.event=e.event;this.timings=t}}class ReadError extends RequestError{constructor(e,t){super(e.message,e,t);this.name="ReadError";this.code=this.code==="ERR_GOT_REQUEST_ERROR"?"ERR_READING_RESPONSE_STREAM":this.code}}class RetryError extends RequestError{constructor(e){super("Retrying",{},e);this.name="RetryError";this.code="ERR_RETRYING"}}class AbortError extends RequestError{constructor(e){super("This operation was aborted.",{},e);this.code="ERR_ABORTED";this.name="AbortError"}}const p=require("node:process");const m=require("node:buffer");const g=require("node:stream");const y=require("node:url");const _=require("node:http");var v=r(2361);var b=r(3837);var x=r(6214);const timer=e=>{if(e.timings){return e.timings}const t={start:Date.now(),socket:undefined,lookup:undefined,connect:undefined,secureConnect:undefined,upload:undefined,response:undefined,end:undefined,error:undefined,abort:undefined,phases:{wait:undefined,dns:undefined,tcp:undefined,tls:undefined,request:undefined,firstByte:undefined,download:undefined,total:undefined}};e.timings=t;const handleError=e=>{e.once(v.errorMonitor,(()=>{t.error=Date.now();t.phases.total=t.error-t.start}))};handleError(e);const onAbort=()=>{t.abort=Date.now();t.phases.total=t.abort-t.start};e.prependOnceListener("abort",onAbort);const onSocket=e=>{t.socket=Date.now();t.phases.wait=t.socket-t.start;if(b.types.isProxy(e)){return}const lookupListener=()=>{t.lookup=Date.now();t.phases.dns=t.lookup-t.socket};e.prependOnceListener("lookup",lookupListener);x(e,{connect:()=>{t.connect=Date.now();if(t.lookup===undefined){e.removeListener("lookup",lookupListener);t.lookup=t.connect;t.phases.dns=t.lookup-t.socket}t.phases.tcp=t.connect-t.lookup},secureConnect:()=>{t.secureConnect=Date.now();t.phases.tls=t.secureConnect-t.connect}})};if(e.socket){onSocket(e.socket)}else{e.prependOnceListener("socket",onSocket)}const onUpload=()=>{t.upload=Date.now();t.phases.request=t.upload-(t.secureConnect??t.connect)};if(e.writableFinished){onUpload()}else{e.prependOnceListener("finish",onUpload)}e.prependOnceListener("response",(r=>{t.response=Date.now();t.phases.firstByte=t.response-t.upload;r.timings=t;handleError(r);r.prependOnceListener("end",(()=>{e.off("abort",onAbort);r.off("aborted",onAbort);if(t.phases.total){return}t.end=Date.now();t.phases.download=t.end-t.response;t.phases.total=t.end-t.start}));r.prependOnceListener("aborted",onAbort)}));return t};const T=timer;const w=require("node:crypto");const S="text/plain";const E="us-ascii";const testParameter=(e,t)=>t.some((t=>t instanceof RegExp?t.test(e):t===e));const A=new Set(["https:","http:","file:"]);const hasCustomProtocol=e=>{try{const{protocol:t}=new URL(e);return t.endsWith(":")&&!A.has(t)}catch{return false}};const normalizeDataURL=(e,{stripHash:t})=>{const r=/^data:(?<type>[^,]*?),(?<data>[^#]*?)(?:#(?<hash>.*))?$/.exec(e);if(!r){throw new Error(`Invalid URL: ${e}`)}let{type:i,data:n,hash:s}=r.groups;const o=i.split(";");s=t?"":s;let a=false;if(o[o.length-1]==="base64"){o.pop();a=true}const l=o.shift()?.toLowerCase()??"";const u=o.map((e=>{let[t,r=""]=e.split("=").map((e=>e.trim()));if(t==="charset"){r=r.toLowerCase();if(r===E){return""}}return`${t}${r?`=${r}`:""}`})).filter(Boolean);const c=[...u];if(a){c.push("base64")}if(c.length>0||l&&l!==S){c.unshift(l)}return`data:${c.join(";")},${a?n.trim():n}${s?`#${s}`:""}`};function normalizeUrl(e,t){t={defaultProtocol:"http",normalizeProtocol:true,forceHttp:false,forceHttps:false,stripAuthentication:true,stripHash:false,stripTextFragment:true,stripWWW:true,removeQueryParameters:[/^utm_\w+/i],removeTrailingSlash:true,removeSingleSlash:true,removeDirectoryIndex:false,removeExplicitPort:false,sortQueryParameters:true,...t};if(typeof t.defaultProtocol==="string"&&!t.defaultProtocol.endsWith(":")){t.defaultProtocol=`${t.defaultProtocol}:`}e=e.trim();if(/^data:/i.test(e)){return normalizeDataURL(e,t)}if(hasCustomProtocol(e)){return e}const r=e.startsWith("//");const i=!r&&/^\.*\//.test(e);if(!i){e=e.replace(/^(?!(?:\w+:)?\/\/)|^\/\//,t.defaultProtocol)}const n=new URL(e);if(t.forceHttp&&t.forceHttps){throw new Error("The `forceHttp` and `forceHttps` options cannot be used together")}if(t.forceHttp&&n.protocol==="https:"){n.protocol="http:"}if(t.forceHttps&&n.protocol==="http:"){n.protocol="https:"}if(t.stripAuthentication){n.username="";n.password=""}if(t.stripHash){n.hash=""}else if(t.stripTextFragment){n.hash=n.hash.replace(/#?:~:text.*?$/i,"")}if(n.pathname){const e=/\b[a-z][a-z\d+\-.]{1,50}:\/\//g;let t=0;let r="";for(;;){const i=e.exec(n.pathname);if(!i){break}const s=i[0];const o=i.index;const a=n.pathname.slice(t,o);r+=a.replace(/\/{2,}/g,"/");r+=s;t=o+s.length}const i=n.pathname.slice(t,n.pathname.length);r+=i.replace(/\/{2,}/g,"/");n.pathname=r}if(n.pathname){try{n.pathname=decodeURI(n.pathname)}catch{}}if(t.removeDirectoryIndex===true){t.removeDirectoryIndex=[/^index\.[a-z]+$/]}if(Array.isArray(t.removeDirectoryIndex)&&t.removeDirectoryIndex.length>0){let e=n.pathname.split("/");const r=e[e.length-1];if(testParameter(r,t.removeDirectoryIndex)){e=e.slice(0,-1);n.pathname=e.slice(1).join("/")+"/"}}if(n.hostname){n.hostname=n.hostname.replace(/\.$/,"");if(t.stripWWW&&/^www\.(?!www\.)[a-z\-\d]{1,63}\.[a-z.\-\d]{2,63}$/.test(n.hostname)){n.hostname=n.hostname.replace(/^www\./,"")}}if(Array.isArray(t.removeQueryParameters)){for(const e of[...n.searchParams.keys()]){if(testParameter(e,t.removeQueryParameters)){n.searchParams.delete(e)}}}if(!Array.isArray(t.keepQueryParameters)&&t.removeQueryParameters===true){n.search=""}if(Array.isArray(t.keepQueryParameters)&&t.keepQueryParameters.length>0){for(const e of[...n.searchParams.keys()]){if(!testParameter(e,t.keepQueryParameters)){n.searchParams.delete(e)}}}if(t.sortQueryParameters){n.searchParams.sort();try{n.search=decodeURIComponent(n.search)}catch{}}if(t.removeTrailingSlash){n.pathname=n.pathname.replace(/\/$/,"")}if(t.removeExplicitPort&&n.port){n.port=""}const s=e;e=n.toString();if(!t.removeSingleSlash&&n.pathname==="/"&&!s.endsWith("/")&&n.hash===""){e=e.replace(/\/$/,"")}if((t.removeTrailingSlash||n.pathname==="/")&&n.hash===""&&t.removeSingleSlash){e=e.replace(/\/$/,"")}if(r&&!t.normalizeProtocol){e=e.replace(/^http:\/\//,"//")}if(t.stripProtocol){e=e.replace(/^(?:https?:)?\/\//,"")}return e}var C=r(1766);var N=r(1002);function lowercaseKeys(e){return Object.fromEntries(Object.entries(e).map((([e,t])=>[e.toLowerCase(),t])))}class Response extends g.Readable{statusCode;headers;body;url;constructor({statusCode:e,headers:t,body:r,url:i}){if(typeof e!=="number"){throw new TypeError("Argument `statusCode` should be a number")}if(typeof t!=="object"){throw new TypeError("Argument `headers` should be an object")}if(!(r instanceof Uint8Array)){throw new TypeError("Argument `body` should be a buffer")}if(typeof i!=="string"){throw new TypeError("Argument `url` should be a string")}super({read(){this.push(r);this.push(null)}});this.statusCode=e;this.headers=lowercaseKeys(t);this.body=r;this.url=i}}var O=r(1531);const R=["aborted","complete","headers","httpVersion","httpVersionMinor","httpVersionMajor","method","rawHeaders","rawTrailers","setTimeout","socket","statusCode","statusMessage","trailers","url"];function mimicResponse(e,t){if(t._readableState.autoDestroy){throw new Error("The second stream must have the `autoDestroy` option set to `false`")}const r=new Set([...Object.keys(e),...R]);const i={};for(const n of r){if(n in t){continue}i[n]={get(){const t=e[n];const r=typeof t==="function";return r?t.bind(e):t},set(t){e[n]=t},enumerable:true,configurable:false}}Object.defineProperties(t,i);e.once("aborted",(()=>{t.destroy();t.emit("aborted")}));e.once("close",(()=>{if(e.complete){if(t.readable){t.once("end",(()=>{t.emit("close")}))}else{t.emit("close")}}else{t.emit("close")}}));return t}class types_RequestError extends Error{constructor(e){super(e.message);Object.assign(this,e)}}class types_CacheError extends Error{constructor(e){super(e.message);Object.assign(this,e)}}class CacheableRequest{constructor(e,t){this.hooks=new Map;this.request=()=>(e,t)=>{let r;if(typeof e==="string"){r=normalizeUrlObject(y.parse(e));e={}}else if(e instanceof y.URL){r=normalizeUrlObject(y.parse(e.toString()));e={}}else{const[t,...i]=(e.path??"").split("?");const n=i.length>0?`?${i.join("?")}`:"";r=normalizeUrlObject({...e,pathname:t,search:n})}e={headers:{},method:"GET",cache:true,strictTtl:false,automaticFailover:false,...e,...urlObjectToRequestOptions(r)};e.headers=Object.fromEntries(k(e.headers).map((([e,t])=>[e.toLowerCase(),t])));const i=new d;const n=normalizeUrl(y.format(r),{stripWWW:false,removeTrailingSlash:false,stripAuthentication:false});let s=`${e.method}:${n}`;if(e.body&&e.method!==undefined&&["POST","PATCH","PUT"].includes(e.method)){if(e.body instanceof g.Readable){e.cache=false}else{s+=`:${w.createHash("md5").update(e.body).digest("hex")}`}}let o=false;let a=false;const makeRequest=e=>{a=true;let r=false;let requestErrorCallback=()=>{};const n=new Promise((e=>{requestErrorCallback=()=>{if(!r){r=true;e()}}}));const handler=async r=>{if(o){r.status=r.statusCode;const t=N.fromObject(o.cachePolicy).revalidatedPolicy(e,r);if(!t.modified){r.resume();await new Promise((e=>{r.once("end",e)}));const e=convertHeaders(t.policy.responseHeaders());r=new Response({statusCode:o.statusCode,headers:e,body:o.body,url:o.url});r.cachePolicy=t.policy;r.fromCache=true}}if(!r.fromCache){r.cachePolicy=new N(e,r,e);r.fromCache=false}let a;if(e.cache&&r.cachePolicy.storable()){a=cloneResponse(r);(async()=>{try{const t=C.buffer(r);await Promise.race([n,new Promise((e=>r.once("end",e))),new Promise((e=>r.once("close",e)))]);const i=await t;let a={url:r.url,statusCode:r.fromCache?o.statusCode:r.statusCode,body:i,cachePolicy:r.cachePolicy.toObject()};let l=e.strictTtl?r.cachePolicy.timeToLive():undefined;if(e.maxTtl){l=l?Math.min(l,e.maxTtl):e.maxTtl}if(this.hooks.size>0){for(const e of this.hooks.keys()){a=await this.runHook(e,a,r)}}await this.cache.set(s,a,l)}catch(e){i.emit("error",new types_CacheError(e))}})()}else if(e.cache&&o){(async()=>{try{await this.cache.delete(s)}catch(e){i.emit("error",new types_CacheError(e))}})()}i.emit("response",a??r);if(typeof t==="function"){t(a??r)}};try{const t=this.cacheRequest(e,handler);t.once("error",requestErrorCallback);t.once("abort",requestErrorCallback);t.once("destroy",requestErrorCallback);i.emit("request",t)}catch(e){i.emit("error",new types_RequestError(e))}};(async()=>{const get=async e=>{await Promise.resolve();const r=e.cache?await this.cache.get(s):undefined;if(r===undefined&&!e.forceRefresh){makeRequest(e);return}const n=N.fromObject(r.cachePolicy);if(n.satisfiesWithoutRevalidation(e)&&!e.forceRefresh){const e=convertHeaders(n.responseHeaders());const s=new Response({statusCode:r.statusCode,headers:e,body:r.body,url:r.url});s.cachePolicy=n;s.fromCache=true;i.emit("response",s);if(typeof t==="function"){t(s)}}else if(n.satisfiesWithoutRevalidation(e)&&Date.now()>=n.timeToLive()&&e.forceRefresh){await this.cache.delete(s);e.headers=n.revalidationHeaders(e);makeRequest(e)}else{o=r;e.headers=n.revalidationHeaders(e);makeRequest(e)}};const errorHandler=e=>i.emit("error",new types_CacheError(e));if(this.cache instanceof O){const e=this.cache;e.once("error",errorHandler);i.on("error",(()=>e.removeListener("error",errorHandler)));i.on("response",(()=>e.removeListener("error",errorHandler)))}try{await get(e)}catch(t){if(e.automaticFailover&&!a){makeRequest(e)}i.emit("error",new types_CacheError(t))}})();return i};this.addHook=(e,t)=>{if(!this.hooks.has(e)){this.hooks.set(e,t)}};this.removeHook=e=>this.hooks.delete(e);this.getHook=e=>this.hooks.get(e);this.runHook=async(e,...t)=>this.hooks.get(e)?.(...t);if(t instanceof O){this.cache=t}else if(typeof t==="string"){this.cache=new O({uri:t,namespace:"cacheable-request"})}else{this.cache=new O({store:t,namespace:"cacheable-request"})}this.request=this.request.bind(this);this.cacheRequest=e}}const k=Object.entries;const cloneResponse=e=>{const t=new g.PassThrough({autoDestroy:false});mimicResponse(e,t);return e.pipe(t)};const urlObjectToRequestOptions=e=>{const t={...e};t.path=`${e.pathname||"/"}${e.search||""}`;delete t.pathname;delete t.search;return t};const normalizeUrlObject=e=>({protocol:e.protocol,auth:e.auth,hostname:e.hostname||e.host||"localhost",port:e.port,pathname:e.pathname,search:e.search});const convertHeaders=e=>{const t=[];for(const r of Object.keys(e)){t[r.toLowerCase()]=e[r]}return t};const P=CacheableRequest;const L="onResponse";var I=r(2391);const isFunction=e=>typeof e==="function";const isFormData=e=>Boolean(e&&isFunction(e.constructor)&&e[Symbol.toStringTag]==="FormData"&&isFunction(e.append)&&isFunction(e.getAll)&&isFunction(e.entries)&&isFunction(e[Symbol.iterator]));const isAsyncIterable=e=>isFunction(e[Symbol.asyncIterator]);async function*readStream(e){const t=e.getReader();while(true){const{done:e,value:r}=await t.read();if(e){break}yield r}}const getStreamIterator=e=>{if(isAsyncIterable(e)){return e}if(isFunction(e.getReader)){return readStream(e)}throw new TypeError("Unsupported data source: Expected either ReadableStream or async iterable.")};const M="abcdefghijklmnopqrstuvwxyz0123456789";function createBoundary(){let e=16;let t="";while(e--){t+=M[Math.random()*M.length<<0]}return t}const normalizeValue=e=>String(e).replace(/\r|\n/g,((e,t,r)=>{if(e==="\r"&&r[t+1]!=="\n"||e==="\n"&&r[t-1]!=="\r"){return"\r\n"}return e}));const getType=e=>Object.prototype.toString.call(e).slice(8,-1).toLowerCase();function isPlainObject(e){if(getType(e)!=="object"){return false}const t=Object.getPrototypeOf(e);if(t===null||t===undefined){return true}const r=t.constructor&&t.constructor.toString();return r===Object.toString()}function getProperty(e,t){if(typeof t==="string"){for(const[r,i]of Object.entries(e)){if(t.toLowerCase()===r.toLowerCase()){return i}}}return undefined}const proxyHeaders=e=>new Proxy(e,{get:(e,t)=>getProperty(e,t),has:(e,t)=>getProperty(e,t)!==undefined});const escapeName=e=>String(e).replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/"/g,"%22");const isFile=e=>Boolean(e&&typeof e==="object"&&isFunction(e.constructor)&&e[Symbol.toStringTag]==="File"&&isFunction(e.stream)&&e.name!=null);const D=null&&isFile;var F=undefined&&undefined.__classPrivateFieldSet||function(e,t,r,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof t==="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(e,r):n?n.value=r:t.set(e,r),r};var j=undefined&&undefined.__classPrivateFieldGet||function(e,t,r,i){if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof t==="function"?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?i:r==="a"?i.call(e):i?i.value:t.get(e)};var B,U,H,z,K,V,q,Z,G,$,W;const Y={enableAdditionalHeaders:false};const J={writable:false,configurable:false};class FormDataEncoder{constructor(e,t,r){B.add(this);U.set(this,"\r\n");H.set(this,void 0);z.set(this,void 0);K.set(this,"-".repeat(2));V.set(this,new TextEncoder);q.set(this,void 0);Z.set(this,void 0);G.set(this,void 0);if(!isFormData(e)){throw new TypeError("Expected first argument to be a FormData instance.")}let i;if(isPlainObject(t)){r=t}else{i=t}if(!i){i=createBoundary()}if(typeof i!=="string"){throw new TypeError("Expected boundary argument to be a string.")}if(r&&!isPlainObject(r)){throw new TypeError("Expected options argument to be an object.")}F(this,Z,Array.from(e.entries()),"f");F(this,G,{...Y,...r},"f");F(this,H,j(this,V,"f").encode(j(this,U,"f")),"f");F(this,z,j(this,H,"f").byteLength,"f");this.boundary=`form-data-boundary-${i}`;this.contentType=`multipart/form-data; boundary=${this.boundary}`;F(this,q,j(this,V,"f").encode(`${j(this,K,"f")}${this.boundary}${j(this,K,"f")}${j(this,U,"f").repeat(2)}`),"f");const n={"Content-Type":this.contentType};const s=j(this,B,"m",W).call(this);if(s){this.contentLength=s;n["Content-Length"]=s}this.headers=proxyHeaders(Object.freeze(n));Object.defineProperties(this,{boundary:J,contentType:J,contentLength:J,headers:J})}getContentLength(){return this.contentLength==null?undefined:Number(this.contentLength)}*values(){for(const[e,t]of j(this,Z,"f")){const r=isFile(t)?t:j(this,V,"f").encode(normalizeValue(t));yield j(this,B,"m",$).call(this,e,r);yield r;yield j(this,H,"f")}yield j(this,q,"f")}async*encode(){for(const e of this.values()){if(isFile(e)){yield*getStreamIterator(e.stream())}else{yield e}}}[(U=new WeakMap,H=new WeakMap,z=new WeakMap,K=new WeakMap,V=new WeakMap,q=new WeakMap,Z=new WeakMap,G=new WeakMap,B=new WeakSet,$=function _FormDataEncoder_getFieldHeader(e,t){let r="";r+=`${j(this,K,"f")}${this.boundary}${j(this,U,"f")}`;r+=`Content-Disposition: form-data; name="${escapeName(e)}"`;if(isFile(t)){r+=`; filename="${escapeName(t.name)}"${j(this,U,"f")}`;r+=`Content-Type: ${t.type||"application/octet-stream"}`}const i=isFile(t)?t.size:t.byteLength;if(j(this,G,"f").enableAdditionalHeaders===true&&i!=null&&!isNaN(i)){r+=`${j(this,U,"f")}Content-Length: ${isFile(t)?t.size:t.byteLength}`}return j(this,V,"f").encode(`${r}${j(this,U,"f").repeat(2)}`)},W=function _FormDataEncoder_getContentLength(){let e=0;for(const[t,r]of j(this,Z,"f")){const i=isFile(r)?r:j(this,V,"f").encode(normalizeValue(r));const n=isFile(i)?i.size:i.byteLength;if(n==null||isNaN(n)){return undefined}e+=j(this,B,"m",$).call(this,t,i).byteLength;e+=n;e+=j(this,z,"f")}return String(e+j(this,q,"f").byteLength)},Symbol.iterator)](){return this.values()}[Symbol.asyncIterator](){return this.encode()}}const Q=require("node:util");function is_form_data_isFormData(e){return h.nodeStream(e)&&h.function_(e.getBoundary)}async function getBodySize(e,t){if(t&&"content-length"in t){return Number(t["content-length"])}if(!e){return 0}if(h.string(e)){return m.Buffer.byteLength(e)}if(h.buffer(e)){return e.length}if(is_form_data_isFormData(e)){return(0,Q.promisify)(e.getLength.bind(e))()}return undefined}function proxyEvents(e,t,r){const i={};for(const n of r){const eventFunction=(...e)=>{t.emit(n,...e)};i[n]=eventFunction;e.on(n,eventFunction)}return()=>{for(const[t,r]of Object.entries(i)){e.off(t,r)}}}const X=require("node:net");function unhandle(){const e=[];return{once(t,r,i){t.once(r,i);e.push({origin:t,event:r,fn:i})},unhandleAll(){for(const t of e){const{origin:e,event:r,fn:i}=t;e.removeListener(r,i)}e.length=0}}}const ee=Symbol("reentry");const noop=()=>{};class timed_out_TimeoutError extends Error{constructor(e,t){super(`Timeout awaiting '${t}' for ${e}ms`);Object.defineProperty(this,"event",{enumerable:true,configurable:true,writable:true,value:t});Object.defineProperty(this,"code",{enumerable:true,configurable:true,writable:true,value:void 0});this.name="TimeoutError";this.code="ETIMEDOUT"}}function timedOut(e,t,r){if(ee in e){return noop}e[ee]=true;const i=[];const{once:n,unhandleAll:s}=unhandle();const addTimeout=(e,t,r)=>{const n=setTimeout(t,e,e,r);n.unref?.();const cancel=()=>{clearTimeout(n)};i.push(cancel);return cancel};const{host:o,hostname:a}=r;const timeoutHandler=(t,r)=>{e.destroy(new timed_out_TimeoutError(t,r))};const cancelTimeouts=()=>{for(const e of i){e()}s()};e.once("error",(t=>{cancelTimeouts();if(e.listenerCount("error")===0){throw t}}));if(typeof t.request!=="undefined"){const r=addTimeout(t.request,timeoutHandler,"request");n(e,"response",(e=>{n(e,"end",r)}))}if(typeof t.socket!=="undefined"){const{socket:r}=t;const socketTimeoutHandler=()=>{timeoutHandler(r,"socket")};e.setTimeout(r,socketTimeoutHandler);i.push((()=>{e.removeListener("timeout",socketTimeoutHandler)}))}const l=typeof t.lookup!=="undefined";const u=typeof t.connect!=="undefined";const c=typeof t.secureConnect!=="undefined";const h=typeof t.send!=="undefined";if(l||u||c||h){n(e,"socket",(i=>{const{socketPath:s}=e;if(i.connecting){const e=Boolean(s??X.isIP(a??o??"")!==0);if(l&&!e&&typeof i.address().address==="undefined"){const e=addTimeout(t.lookup,timeoutHandler,"lookup");n(i,"lookup",e)}if(u){const timeConnect=()=>addTimeout(t.connect,timeoutHandler,"connect");if(e){n(i,"connect",timeConnect())}else{n(i,"lookup",(e=>{if(e===null){n(i,"connect",timeConnect())}}))}}if(c&&r.protocol==="https:"){n(i,"connect",(()=>{const e=addTimeout(t.secureConnect,timeoutHandler,"secureConnect");n(i,"secureConnect",e)}))}}if(h){const timeRequest=()=>addTimeout(t.send,timeoutHandler,"send");if(i.connecting){n(i,"connect",(()=>{n(e,"upload-complete",timeRequest())}))}else{n(e,"upload-complete",timeRequest())}}}))}if(typeof t.response!=="undefined"){n(e,"upload-complete",(()=>{const r=addTimeout(t.response,timeoutHandler,"response");n(e,"response",r)}))}if(typeof t.read!=="undefined"){n(e,"response",(e=>{const r=addTimeout(t.read,timeoutHandler,"read");n(e,"end",r)}))}return cancelTimeouts}function urlToOptions(e){e=e;const t={protocol:e.protocol,hostname:h.string(e.hostname)&&e.hostname.startsWith("[")?e.hostname.slice(1,-1):e.hostname,host:e.host,hash:e.hash,search:e.search,pathname:e.pathname,href:e.href,path:`${e.pathname||""}${e.search||""}`};if(h.string(e.port)&&e.port.length>0){t.port=Number(e.port)}if(e.username||e.password){t.auth=`${e.username||""}:${e.password||""}`}return t}class WeakableMap{constructor(){Object.defineProperty(this,"weakMap",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"map",{enumerable:true,configurable:true,writable:true,value:void 0});this.weakMap=new WeakMap;this.map=new Map}set(e,t){if(typeof e==="object"){this.weakMap.set(e,t)}else{this.map.set(e,t)}}get(e){if(typeof e==="object"){return this.weakMap.get(e)}return this.map.get(e)}has(e){if(typeof e==="object"){return this.weakMap.has(e)}return this.map.has(e)}}const calculateRetryDelay=({attemptCount:e,retryOptions:t,error:r,retryAfter:i,computedValue:n})=>{if(r.name==="RetryError"){return 1}if(e>t.limit){return 0}const s=t.methods.includes(r.options.method);const o=t.errorCodes.includes(r.code);const a=r.response&&t.statusCodes.includes(r.response.statusCode);if(!s||!o&&!a){return 0}if(r.response){if(i){if(i>n){return 0}return i}if(r.response.statusCode===413){return 0}}const l=Math.random()*t.noise;return Math.min(2**(e-1)*1e3,t.backoffLimit)+l};const te=calculateRetryDelay;const re=require("node:tls");const ie=require("node:https");const ne=require("node:dns");const se=require("node:os");const{Resolver:oe}=ne.promises;const ae=Symbol("cacheableLookupCreateConnection");const le=Symbol("cacheableLookupInstance");const ue=Symbol("expires");const ce=typeof ne.ALL==="number";const verifyAgent=e=>{if(!(e&&typeof e.createConnection==="function")){throw new Error("Expected an Agent instance as the first argument")}};const map4to6=e=>{for(const t of e){if(t.family===6){continue}t.address=`::ffff:${t.address}`;t.family=6}};const getIfaceInfo=()=>{let e=false;let t=false;for(const r of Object.values(se.networkInterfaces())){for(const i of r){if(i.internal){continue}if(i.family==="IPv6"){t=true}else{e=true}if(e&&t){return{has4:e,has6:t}}}}return{has4:e,has6:t}};const isIterable=e=>Symbol.iterator in e;const ignoreNoResultErrors=e=>e.catch((e=>{if(e.code==="ENODATA"||e.code==="ENOTFOUND"||e.code==="ENOENT"){return[]}throw e}));const he={ttl:true};const de={all:true};const fe={all:true,family:4};const pe={all:true,family:6};class CacheableLookup{constructor({cache:e=new Map,maxTtl:t=Infinity,fallbackDuration:r=3600,errorTtl:i=.15,resolver:n=new oe,lookup:s=ne.lookup}={}){this.maxTtl=t;this.errorTtl=i;this._cache=e;this._resolver=n;this._dnsLookup=s&&(0,Q.promisify)(s);this.stats={cache:0,query:0};if(this._resolver instanceof oe){this._resolve4=this._resolver.resolve4.bind(this._resolver);this._resolve6=this._resolver.resolve6.bind(this._resolver)}else{this._resolve4=(0,Q.promisify)(this._resolver.resolve4.bind(this._resolver));this._resolve6=(0,Q.promisify)(this._resolver.resolve6.bind(this._resolver))}this._iface=getIfaceInfo();this._pending={};this._nextRemovalTime=false;this._hostnamesToFallback=new Set;this.fallbackDuration=r;if(r>0){const e=setInterval((()=>{this._hostnamesToFallback.clear()}),r*1e3);if(e.unref){e.unref()}this._fallbackInterval=e}this.lookup=this.lookup.bind(this);this.lookupAsync=this.lookupAsync.bind(this)}set servers(e){this.clear();this._resolver.setServers(e)}get servers(){return this._resolver.getServers()}lookup(e,t,r){if(typeof t==="function"){r=t;t={}}else if(typeof t==="number"){t={family:t}}if(!r){throw new Error("Callback must be a function.")}this.lookupAsync(e,t).then((e=>{if(t.all){r(null,e)}else{r(null,e.address,e.family,e.expires,e.ttl,e.source)}}),r)}async lookupAsync(e,t={}){if(typeof t==="number"){t={family:t}}let r=await this.query(e);if(t.family===6){const e=r.filter((e=>e.family===6));if(t.hints&ne.V4MAPPED){if(ce&&t.hints&ne.ALL||e.length===0){map4to6(r)}else{r=e}}else{r=e}}else if(t.family===4){r=r.filter((e=>e.family===4))}if(t.hints&ne.ADDRCONFIG){const{_iface:e}=this;r=r.filter((t=>t.family===6?e.has6:e.has4))}if(r.length===0){const t=new Error(`cacheableLookup ENOTFOUND ${e}`);t.code="ENOTFOUND";t.hostname=e;throw t}if(t.all){return r}return r[0]}async query(e){let t="cache";let r=await this._cache.get(e);if(r){this.stats.cache++}if(!r){const i=this._pending[e];if(i){this.stats.cache++;r=await i}else{t="query";const i=this.queryAndCache(e);this._pending[e]=i;this.stats.query++;try{r=await i}finally{delete this._pending[e]}}}r=r.map((e=>({...e,source:t})));return r}async _resolve(e){const[t,r]=await Promise.all([ignoreNoResultErrors(this._resolve4(e,he)),ignoreNoResultErrors(this._resolve6(e,he))]);let i=0;let n=0;let s=0;const o=Date.now();for(const e of t){e.family=4;e.expires=o+e.ttl*1e3;i=Math.max(i,e.ttl)}for(const e of r){e.family=6;e.expires=o+e.ttl*1e3;n=Math.max(n,e.ttl)}if(t.length>0){if(r.length>0){s=Math.min(i,n)}else{s=i}}else{s=n}return{entries:[...t,...r],cacheTtl:s}}async _lookup(e){try{const[t,r]=await Promise.all([ignoreNoResultErrors(this._dnsLookup(e,fe)),ignoreNoResultErrors(this._dnsLookup(e,pe))]);return{entries:[...t,...r],cacheTtl:0}}catch{return{entries:[],cacheTtl:0}}}async _set(e,t,r){if(this.maxTtl>0&&r>0){r=Math.min(r,this.maxTtl)*1e3;t[ue]=Date.now()+r;try{await this._cache.set(e,t,r)}catch(e){this.lookupAsync=async()=>{const t=new Error("Cache Error. Please recreate the CacheableLookup instance.");t.cause=e;throw t}}if(isIterable(this._cache)){this._tick(r)}}}async queryAndCache(e){if(this._hostnamesToFallback.has(e)){return this._dnsLookup(e,de)}let t=await this._resolve(e);if(t.entries.length===0&&this._dnsLookup){t=await this._lookup(e);if(t.entries.length!==0&&this.fallbackDuration>0){this._hostnamesToFallback.add(e)}}const r=t.entries.length===0?this.errorTtl:t.cacheTtl;await this._set(e,t.entries,r);return t.entries}_tick(e){const t=this._nextRemovalTime;if(!t||e<t){clearTimeout(this._removalTimeout);this._nextRemovalTime=e;this._removalTimeout=setTimeout((()=>{this._nextRemovalTime=false;let e=Infinity;const t=Date.now();for(const[r,i]of this._cache){const n=i[ue];if(t>=n){this._cache.delete(r)}else if(n<e){e=n}}if(e!==Infinity){this._tick(e-t)}}),e);if(this._removalTimeout.unref){this._removalTimeout.unref()}}}install(e){verifyAgent(e);if(ae in e){throw new Error("CacheableLookup has been already installed")}e[ae]=e.createConnection;e[le]=this;e.createConnection=(t,r)=>{if(!("lookup"in t)){t.lookup=this.lookup}return e[ae](t,r)}}uninstall(e){verifyAgent(e);if(e[ae]){if(e[le]!==this){throw new Error("The agent is not owned by this CacheableLookup instance")}e.createConnection=e[ae];delete e[ae];delete e[le]}}updateInterfaceInfo(){const{_iface:e}=this;this._iface=getIfaceInfo();if(e.has4&&!this._iface.has4||e.has6&&!this._iface.has6){this._cache.clear()}}clear(e){if(e){this._cache.delete(e);return}this._cache.clear()}}var me=r(4645);function parseLinkHeader(e){const t=[];const r=e.split(",");for(const i of r){const[r,...n]=i.split(";");const s=r.trim();if(s[0]!=="<"||s[s.length-1]!==">"){throw new Error(`Invalid format of the Link header reference: ${s}`)}const o=s.slice(1,-1);const a={};if(n.length===0){throw new Error(`Unexpected end of Link header parameters: ${n.join(";")}`)}for(const t of n){const r=t.trim();const i=r.indexOf("=");if(i===-1){throw new Error(`Failed to parse Link header: ${e}`)}const n=r.slice(0,i).trim();const s=r.slice(i+1).trim();a[n]=s}t.push({reference:o,parameters:a})}return t}const[ge,ye]=p.versions.node.split(".").map(Number);function validateSearchParameters(e){for(const t in e){const r=e[t];c.any([h.string,h.number,h.boolean,h.null_,h.undefined],r)}}const _e=new Map;let ve;const getGlobalDnsCache=()=>{if(ve){return ve}ve=new CacheableLookup;return ve};const be={request:undefined,agent:{http:undefined,https:undefined,http2:undefined},h2session:undefined,decompress:true,timeout:{connect:undefined,lookup:undefined,read:undefined,request:undefined,response:undefined,secureConnect:undefined,send:undefined,socket:undefined},prefixUrl:"",body:undefined,form:undefined,json:undefined,cookieJar:undefined,ignoreInvalidCookies:false,searchParams:undefined,dnsLookup:undefined,dnsCache:undefined,context:{},hooks:{init:[],beforeRequest:[],beforeError:[],beforeRedirect:[],beforeRetry:[],afterResponse:[]},followRedirect:true,maxRedirects:10,cache:undefined,throwHttpErrors:true,username:"",password:"",http2:false,allowGetBody:false,headers:{"user-agent":"got (https://github.com/sindresorhus/got)"},methodRewriting:false,dnsLookupIpVersion:undefined,parseJson:JSON.parse,stringifyJson:JSON.stringify,retry:{limit:2,methods:["GET","PUT","HEAD","DELETE","OPTIONS","TRACE"],statusCodes:[408,413,429,500,502,503,504,521,522,524],errorCodes:["ETIMEDOUT","ECONNRESET","EADDRINUSE","ECONNREFUSED","EPIPE","ENOTFOUND","ENETUNREACH","EAI_AGAIN"],maxRetryAfter:undefined,calculateDelay:({computedValue:e})=>e,backoffLimit:Number.POSITIVE_INFINITY,noise:100},localAddress:undefined,method:"GET",createConnection:undefined,cacheOptions:{shared:undefined,cacheHeuristic:undefined,immutableMinTimeToLive:undefined,ignoreCargoCult:undefined},https:{alpnProtocols:undefined,rejectUnauthorized:undefined,checkServerIdentity:undefined,certificateAuthority:undefined,key:undefined,certificate:undefined,passphrase:undefined,pfx:undefined,ciphers:undefined,honorCipherOrder:undefined,minVersion:undefined,maxVersion:undefined,signatureAlgorithms:undefined,tlsSessionLifetime:undefined,dhparam:undefined,ecdhCurve:undefined,certificateRevocationLists:undefined},encoding:undefined,resolveBodyOnly:false,isStream:false,responseType:"text",url:undefined,pagination:{transform(e){if(e.request.options.responseType==="json"){return e.body}return JSON.parse(e.body)},paginate({response:e}){const t=e.headers.link;if(typeof t!=="string"||t.trim()===""){return false}const r=parseLinkHeader(t);const i=r.find((e=>e.parameters.rel==="next"||e.parameters.rel==='"next"'));if(i){return{url:new y.URL(i.reference,e.url)}}return false},filter:()=>true,shouldContinue:()=>true,countLimit:Number.POSITIVE_INFINITY,backoff:0,requestLimit:1e4,stackAllItems:false},setHost:true,maxHeaderSize:undefined,signal:undefined,enableUnixSockets:true};const cloneInternals=e=>{const{hooks:t,retry:r}=e;const i={...e,context:{...e.context},cacheOptions:{...e.cacheOptions},https:{...e.https},agent:{...e.agent},headers:{...e.headers},retry:{...r,errorCodes:[...r.errorCodes],methods:[...r.methods],statusCodes:[...r.statusCodes]},timeout:{...e.timeout},hooks:{init:[...t.init],beforeRequest:[...t.beforeRequest],beforeError:[...t.beforeError],beforeRedirect:[...t.beforeRedirect],beforeRetry:[...t.beforeRetry],afterResponse:[...t.afterResponse]},searchParams:e.searchParams?new y.URLSearchParams(e.searchParams):undefined,pagination:{...e.pagination}};if(i.url!==undefined){i.prefixUrl=""}return i};const cloneRaw=e=>{const{hooks:t,retry:r}=e;const i={...e};if(h.object(e.context)){i.context={...e.context}}if(h.object(e.cacheOptions)){i.cacheOptions={...e.cacheOptions}}if(h.object(e.https)){i.https={...e.https}}if(h.object(e.cacheOptions)){i.cacheOptions={...i.cacheOptions}}if(h.object(e.agent)){i.agent={...e.agent}}if(h.object(e.headers)){i.headers={...e.headers}}if(h.object(r)){i.retry={...r};if(h.array(r.errorCodes)){i.retry.errorCodes=[...r.errorCodes]}if(h.array(r.methods)){i.retry.methods=[...r.methods]}if(h.array(r.statusCodes)){i.retry.statusCodes=[...r.statusCodes]}}if(h.object(e.timeout)){i.timeout={...e.timeout}}if(h.object(t)){i.hooks={...t};if(h.array(t.init)){i.hooks.init=[...t.init]}if(h.array(t.beforeRequest)){i.hooks.beforeRequest=[...t.beforeRequest]}if(h.array(t.beforeError)){i.hooks.beforeError=[...t.beforeError]}if(h.array(t.beforeRedirect)){i.hooks.beforeRedirect=[...t.beforeRedirect]}if(h.array(t.beforeRetry)){i.hooks.beforeRetry=[...t.beforeRetry]}if(h.array(t.afterResponse)){i.hooks.afterResponse=[...t.afterResponse]}}if(h.object(e.pagination)){i.pagination={...e.pagination}}return i};const getHttp2TimeoutOption=e=>{const t=[e.timeout.socket,e.timeout.connect,e.timeout.lookup,e.timeout.request,e.timeout.secureConnect].filter((e=>typeof e==="number"));if(t.length>0){return Math.min(...t)}return undefined};const init=(e,t,r)=>{const i=e.hooks?.init;if(i){for(const e of i){e(t,r)}}};class Options{constructor(e,t,r){Object.defineProperty(this,"_unixOptions",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_internals",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_merging",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_init",{enumerable:true,configurable:true,writable:true,value:void 0});c.any([h.string,h.urlInstance,h.object,h.undefined],e);c.any([h.object,h.undefined],t);c.any([h.object,h.undefined],r);if(e instanceof Options||t instanceof Options){throw new TypeError("The defaults must be passed as the third argument")}this._internals=cloneInternals(r?._internals??r??be);this._init=[...r?._init??[]];this._merging=false;this._unixOptions=undefined;try{if(h.plainObject(e)){try{this.merge(e);this.merge(t)}finally{this.url=e.url}}else{try{this.merge(t)}finally{if(t?.url!==undefined){if(e===undefined){this.url=t.url}else{throw new TypeError("The `url` option is mutually exclusive with the `input` argument")}}else if(e!==undefined){this.url=e}}}}catch(e){e.options=this;throw e}}merge(e){if(!e){return}if(e instanceof Options){for(const t of e._init){this.merge(t)}return}e=cloneRaw(e);init(this,e,this);init(e,e,this);this._merging=true;if("isStream"in e){this.isStream=e.isStream}try{let t=false;for(const r in e){if(r==="mutableDefaults"||r==="handlers"){continue}if(r==="url"){continue}if(!(r in this)){throw new Error(`Unexpected option: ${r}`)}this[r]=e[r];t=true}if(t){this._init.push(e)}}finally{this._merging=false}}get request(){return this._internals.request}set request(e){c.any([h.function_,h.undefined],e);this._internals.request=e}get agent(){return this._internals.agent}set agent(e){c.plainObject(e);for(const t in e){if(!(t in this._internals.agent)){throw new TypeError(`Unexpected agent option: ${t}`)}c.any([h.object,h.undefined],e[t])}if(this._merging){Object.assign(this._internals.agent,e)}else{this._internals.agent={...e}}}get h2session(){return this._internals.h2session}set h2session(e){this._internals.h2session=e}get decompress(){return this._internals.decompress}set decompress(e){c.boolean(e);this._internals.decompress=e}get timeout(){return this._internals.timeout}set timeout(e){c.plainObject(e);for(const t in e){if(!(t in this._internals.timeout)){throw new Error(`Unexpected timeout option: ${t}`)}c.any([h.number,h.undefined],e[t])}if(this._merging){Object.assign(this._internals.timeout,e)}else{this._internals.timeout={...e}}}get prefixUrl(){return this._internals.prefixUrl}set prefixUrl(e){c.any([h.string,h.urlInstance],e);if(e===""){this._internals.prefixUrl="";return}e=e.toString();if(!e.endsWith("/")){e+="/"}if(this._internals.prefixUrl&&this._internals.url){const{href:t}=this._internals.url;this._internals.url.href=e+t.slice(this._internals.prefixUrl.length)}this._internals.prefixUrl=e}get body(){return this._internals.body}set body(e){c.any([h.string,h.buffer,h.nodeStream,h.generator,h.asyncGenerator,isFormData,h.undefined],e);if(h.nodeStream(e)){c.truthy(e.readable)}if(e!==undefined){c.undefined(this._internals.form);c.undefined(this._internals.json)}this._internals.body=e}get form(){return this._internals.form}set form(e){c.any([h.plainObject,h.undefined],e);if(e!==undefined){c.undefined(this._internals.body);c.undefined(this._internals.json)}this._internals.form=e}get json(){return this._internals.json}set json(e){if(e!==undefined){c.undefined(this._internals.body);c.undefined(this._internals.form)}this._internals.json=e}get url(){return this._internals.url}set url(e){c.any([h.string,h.urlInstance,h.undefined],e);if(e===undefined){this._internals.url=undefined;return}if(h.string(e)&&e.startsWith("/")){throw new Error("`url` must not start with a slash")}const t=`${this.prefixUrl}${e.toString()}`;const r=new y.URL(t);this._internals.url=r;if(r.protocol==="unix:"){r.href=`http://unix${r.pathname}${r.search}`}if(r.protocol!=="http:"&&r.protocol!=="https:"){const e=new Error(`Unsupported protocol: ${r.protocol}`);e.code="ERR_UNSUPPORTED_PROTOCOL";throw e}if(this._internals.username){r.username=this._internals.username;this._internals.username=""}if(this._internals.password){r.password=this._internals.password;this._internals.password=""}if(this._internals.searchParams){r.search=this._internals.searchParams.toString();this._internals.searchParams=undefined}if(r.hostname==="unix"){if(!this._internals.enableUnixSockets){throw new Error("Using UNIX domain sockets but option `enableUnixSockets` is not enabled")}const e=/(?<socketPath>.+?):(?<path>.+)/.exec(`${r.pathname}${r.search}`);if(e?.groups){const{socketPath:t,path:r}=e.groups;this._unixOptions={socketPath:t,path:r,host:""}}else{this._unixOptions=undefined}return}this._unixOptions=undefined}get cookieJar(){return this._internals.cookieJar}set cookieJar(e){c.any([h.object,h.undefined],e);if(e===undefined){this._internals.cookieJar=undefined;return}let{setCookie:t,getCookieString:r}=e;c.function_(t);c.function_(r);if(t.length===4&&r.length===0){t=(0,Q.promisify)(t.bind(e));r=(0,Q.promisify)(r.bind(e));this._internals.cookieJar={setCookie:t,getCookieString:r}}else{this._internals.cookieJar=e}}get signal(){return this._internals.signal}set signal(e){c.object(e);this._internals.signal=e}get ignoreInvalidCookies(){return this._internals.ignoreInvalidCookies}set ignoreInvalidCookies(e){c.boolean(e);this._internals.ignoreInvalidCookies=e}get searchParams(){if(this._internals.url){return this._internals.url.searchParams}if(this._internals.searchParams===undefined){this._internals.searchParams=new y.URLSearchParams}return this._internals.searchParams}set searchParams(e){c.any([h.string,h.object,h.undefined],e);const t=this._internals.url;if(e===undefined){this._internals.searchParams=undefined;if(t){t.search=""}return}const r=this.searchParams;let i;if(h.string(e)){i=new y.URLSearchParams(e)}else if(e instanceof y.URLSearchParams){i=e}else{validateSearchParameters(e);i=new y.URLSearchParams;for(const t in e){const n=e[t];if(n===null){i.append(t,"")}else if(n===undefined){r.delete(t)}else{i.append(t,n)}}}if(this._merging){for(const e of i.keys()){r.delete(e)}for(const[e,t]of i){r.append(e,t)}}else if(t){t.search=r.toString()}else{this._internals.searchParams=r}}get searchParameters(){throw new Error("The `searchParameters` option does not exist. Use `searchParams` instead.")}set searchParameters(e){throw new Error("The `searchParameters` option does not exist. Use `searchParams` instead.")}get dnsLookup(){return this._internals.dnsLookup}set dnsLookup(e){c.any([h.function_,h.undefined],e);this._internals.dnsLookup=e}get dnsCache(){return this._internals.dnsCache}set dnsCache(e){c.any([h.object,h.boolean,h.undefined],e);if(e===true){this._internals.dnsCache=getGlobalDnsCache()}else if(e===false){this._internals.dnsCache=undefined}else{this._internals.dnsCache=e}}get context(){return this._internals.context}set context(e){c.object(e);if(this._merging){Object.assign(this._internals.context,e)}else{this._internals.context={...e}}}get hooks(){return this._internals.hooks}set hooks(e){c.object(e);for(const t in e){if(!(t in this._internals.hooks)){throw new Error(`Unexpected hook event: ${t}`)}const r=t;const i=e[r];c.any([h.array,h.undefined],i);if(i){for(const e of i){c.function_(e)}}if(this._merging){if(i){this._internals.hooks[r].push(...i)}}else{if(!i){throw new Error(`Missing hook event: ${t}`)}this._internals.hooks[t]=[...i]}}}get followRedirect(){return this._internals.followRedirect}set followRedirect(e){c.boolean(e);this._internals.followRedirect=e}get followRedirects(){throw new TypeError("The `followRedirects` option does not exist. Use `followRedirect` instead.")}set followRedirects(e){throw new TypeError("The `followRedirects` option does not exist. Use `followRedirect` instead.")}get maxRedirects(){return this._internals.maxRedirects}set maxRedirects(e){c.number(e);this._internals.maxRedirects=e}get cache(){return this._internals.cache}set cache(e){c.any([h.object,h.string,h.boolean,h.undefined],e);if(e===true){this._internals.cache=_e}else if(e===false){this._internals.cache=undefined}else{this._internals.cache=e}}get throwHttpErrors(){return this._internals.throwHttpErrors}set throwHttpErrors(e){c.boolean(e);this._internals.throwHttpErrors=e}get username(){const e=this._internals.url;const t=e?e.username:this._internals.username;return decodeURIComponent(t)}set username(e){c.string(e);const t=this._internals.url;const r=encodeURIComponent(e);if(t){t.username=r}else{this._internals.username=r}}get password(){const e=this._internals.url;const t=e?e.password:this._internals.password;return decodeURIComponent(t)}set password(e){c.string(e);const t=this._internals.url;const r=encodeURIComponent(e);if(t){t.password=r}else{this._internals.password=r}}get http2(){return this._internals.http2}set http2(e){c.boolean(e);this._internals.http2=e}get allowGetBody(){return this._internals.allowGetBody}set allowGetBody(e){c.boolean(e);this._internals.allowGetBody=e}get headers(){return this._internals.headers}set headers(e){c.plainObject(e);if(this._merging){Object.assign(this._internals.headers,lowercaseKeys(e))}else{this._internals.headers=lowercaseKeys(e)}}get methodRewriting(){return this._internals.methodRewriting}set methodRewriting(e){c.boolean(e);this._internals.methodRewriting=e}get dnsLookupIpVersion(){return this._internals.dnsLookupIpVersion}set dnsLookupIpVersion(e){if(e!==undefined&&e!==4&&e!==6){throw new TypeError(`Invalid DNS lookup IP version: ${e}`)}this._internals.dnsLookupIpVersion=e}get parseJson(){return this._internals.parseJson}set parseJson(e){c.function_(e);this._internals.parseJson=e}get stringifyJson(){return this._internals.stringifyJson}set stringifyJson(e){c.function_(e);this._internals.stringifyJson=e}get retry(){return this._internals.retry}set retry(e){c.plainObject(e);c.any([h.function_,h.undefined],e.calculateDelay);c.any([h.number,h.undefined],e.maxRetryAfter);c.any([h.number,h.undefined],e.limit);c.any([h.array,h.undefined],e.methods);c.any([h.array,h.undefined],e.statusCodes);c.any([h.array,h.undefined],e.errorCodes);c.any([h.number,h.undefined],e.noise);if(e.noise&&Math.abs(e.noise)>100){throw new Error(`The maximum acceptable retry noise is +/- 100ms, got ${e.noise}`)}for(const t in e){if(!(t in this._internals.retry)){throw new Error(`Unexpected retry option: ${t}`)}}if(this._merging){Object.assign(this._internals.retry,e)}else{this._internals.retry={...e}}const{retry:t}=this._internals;t.methods=[...new Set(t.methods.map((e=>e.toUpperCase())))];t.statusCodes=[...new Set(t.statusCodes)];t.errorCodes=[...new Set(t.errorCodes)]}get localAddress(){return this._internals.localAddress}set localAddress(e){c.any([h.string,h.undefined],e);this._internals.localAddress=e}get method(){return this._internals.method}set method(e){c.string(e);this._internals.method=e.toUpperCase()}get createConnection(){return this._internals.createConnection}set createConnection(e){c.any([h.function_,h.undefined],e);this._internals.createConnection=e}get cacheOptions(){return this._internals.cacheOptions}set cacheOptions(e){c.plainObject(e);c.any([h.boolean,h.undefined],e.shared);c.any([h.number,h.undefined],e.cacheHeuristic);c.any([h.number,h.undefined],e.immutableMinTimeToLive);c.any([h.boolean,h.undefined],e.ignoreCargoCult);for(const t in e){if(!(t in this._internals.cacheOptions)){throw new Error(`Cache option \`${t}\` does not exist`)}}if(this._merging){Object.assign(this._internals.cacheOptions,e)}else{this._internals.cacheOptions={...e}}}get https(){return this._internals.https}set https(e){c.plainObject(e);c.any([h.boolean,h.undefined],e.rejectUnauthorized);c.any([h.function_,h.undefined],e.checkServerIdentity);c.any([h.string,h.object,h.array,h.undefined],e.certificateAuthority);c.any([h.string,h.object,h.array,h.undefined],e.key);c.any([h.string,h.object,h.array,h.undefined],e.certificate);c.any([h.string,h.undefined],e.passphrase);c.any([h.string,h.buffer,h.array,h.undefined],e.pfx);c.any([h.array,h.undefined],e.alpnProtocols);c.any([h.string,h.undefined],e.ciphers);c.any([h.string,h.buffer,h.undefined],e.dhparam);c.any([h.string,h.undefined],e.signatureAlgorithms);c.any([h.string,h.undefined],e.minVersion);c.any([h.string,h.undefined],e.maxVersion);c.any([h.boolean,h.undefined],e.honorCipherOrder);c.any([h.number,h.undefined],e.tlsSessionLifetime);c.any([h.string,h.undefined],e.ecdhCurve);c.any([h.string,h.buffer,h.array,h.undefined],e.certificateRevocationLists);for(const t in e){if(!(t in this._internals.https)){throw new Error(`HTTPS option \`${t}\` does not exist`)}}if(this._merging){Object.assign(this._internals.https,e)}else{this._internals.https={...e}}}get encoding(){return this._internals.encoding}set encoding(e){if(e===null){throw new TypeError("To get a Buffer, set `options.responseType` to `buffer` instead")}c.any([h.string,h.undefined],e);this._internals.encoding=e}get resolveBodyOnly(){return this._internals.resolveBodyOnly}set resolveBodyOnly(e){c.boolean(e);this._internals.resolveBodyOnly=e}get isStream(){return this._internals.isStream}set isStream(e){c.boolean(e);this._internals.isStream=e}get responseType(){return this._internals.responseType}set responseType(e){if(e===undefined){this._internals.responseType="text";return}if(e!=="text"&&e!=="buffer"&&e!=="json"){throw new Error(`Invalid \`responseType\` option: ${e}`)}this._internals.responseType=e}get pagination(){return this._internals.pagination}set pagination(e){c.object(e);if(this._merging){Object.assign(this._internals.pagination,e)}else{this._internals.pagination=e}}get auth(){throw new Error("Parameter `auth` is deprecated. Use `username` / `password` instead.")}set auth(e){throw new Error("Parameter `auth` is deprecated. Use `username` / `password` instead.")}get setHost(){return this._internals.setHost}set setHost(e){c.boolean(e);this._internals.setHost=e}get maxHeaderSize(){return this._internals.maxHeaderSize}set maxHeaderSize(e){c.any([h.number,h.undefined],e);this._internals.maxHeaderSize=e}get enableUnixSockets(){return this._internals.enableUnixSockets}set enableUnixSockets(e){c.boolean(e);this._internals.enableUnixSockets=e}toJSON(){return{...this._internals}}[Symbol.for("nodejs.util.inspect.custom")](e,t){return(0,Q.inspect)(this._internals,t)}createNativeRequestOptions(){const e=this._internals;const t=e.url;let r;if(t.protocol==="https:"){r=e.http2?e.agent:e.agent.https}else{r=e.agent.http}const{https:i}=e;let{pfx:n}=i;if(h.array(n)&&h.plainObject(n[0])){n=n.map((e=>({buf:e.buffer,passphrase:e.passphrase})))}return{...e.cacheOptions,...this._unixOptions,ALPNProtocols:i.alpnProtocols,ca:i.certificateAuthority,cert:i.certificate,key:i.key,passphrase:i.passphrase,pfx:i.pfx,rejectUnauthorized:i.rejectUnauthorized,checkServerIdentity:i.checkServerIdentity??re.checkServerIdentity,ciphers:i.ciphers,honorCipherOrder:i.honorCipherOrder,minVersion:i.minVersion,maxVersion:i.maxVersion,sigalgs:i.signatureAlgorithms,sessionTimeout:i.tlsSessionLifetime,dhparam:i.dhparam,ecdhCurve:i.ecdhCurve,crl:i.certificateRevocationLists,lookup:e.dnsLookup??e.dnsCache?.lookup,family:e.dnsLookupIpVersion,agent:r,setHost:e.setHost,method:e.method,maxHeaderSize:e.maxHeaderSize,localAddress:e.localAddress,headers:e.headers,createConnection:e.createConnection,timeout:e.http2?getHttp2TimeoutOption(e):undefined,h2session:e.h2session}}getRequestFunction(){const e=this._internals.url;const{request:t}=this._internals;if(!t&&e){return this.getFallbackRequestFunction()}return t}getFallbackRequestFunction(){const e=this._internals.url;if(!e){return}if(e.protocol==="https:"){if(this._internals.http2){if(ge<15||ge===15&&ye<10){const e=new Error("To use the `http2` option, install Node.js 15.10.0 or above");e.code="EUNSUPPORTED";throw e}return me.auto}return ie.request}return _.request}freeze(){const e=this._internals;Object.freeze(e);Object.freeze(e.hooks);Object.freeze(e.hooks.afterResponse);Object.freeze(e.hooks.beforeError);Object.freeze(e.hooks.beforeRedirect);Object.freeze(e.hooks.beforeRequest);Object.freeze(e.hooks.beforeRetry);Object.freeze(e.hooks.init);Object.freeze(e.https);Object.freeze(e.cacheOptions);Object.freeze(e.agent);Object.freeze(e.headers);Object.freeze(e.timeout);Object.freeze(e.retry);Object.freeze(e.retry.errorCodes);Object.freeze(e.retry.methods);Object.freeze(e.retry.statusCodes)}}const isResponseOk=e=>{const{statusCode:t}=e;const r=e.request.options.followRedirect?299:399;return t>=200&&t<=r||t===304};class ParseError extends RequestError{constructor(e,t){const{options:r}=t.request;super(`${e.message} in "${r.url.toString()}"`,e,t.request);this.name="ParseError";this.code="ERR_BODY_PARSE_FAILURE"}}const parseBody=(e,t,r,i)=>{const{rawBody:n}=e;try{if(t==="text"){return n.toString(i)}if(t==="json"){return n.length===0?"":r(n.toString(i))}if(t==="buffer"){return n}}catch(t){throw new ParseError(t,e)}throw new ParseError({message:`Unknown body type '${t}'`,name:"Error"},e)};function isClientRequest(e){return e.writable&&!e.writableEnded}const xe=isClientRequest;function isUnixSocketURL(e){return e.protocol==="unix:"||e.hostname==="unix"}const{buffer:Te}=C;const we=h.string(p.versions.brotli);const Se=new Set(["GET","HEAD"]);const Ee=new WeakableMap;const Ae=new Set([300,301,302,303,304,307,308]);const Ce=["socket","connect","continue","information","upgrade"];const core_noop=()=>{};class Request extends g.Duplex{constructor(e,t,r){super({autoDestroy:false,highWaterMark:0});Object.defineProperty(this,"constructor",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_noPipe",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"options",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"response",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"requestUrl",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"redirectUrls",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"retryCount",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_stopRetry",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_downloadedSize",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_uploadedSize",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_stopReading",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_pipedServerResponses",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_request",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_responseSize",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_bodySize",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_unproxyEvents",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_isFromCache",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_cannotHaveBody",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_triggerRead",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_cancelTimeouts",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_removeListeners",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_nativeResponse",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_flushed",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_aborted",{enumerable:true,configurable:true,writable:true,value:void 0});Object.defineProperty(this,"_requestInitialized",{enumerable:true,configurable:true,writable:true,value:void 0});this._downloadedSize=0;this._uploadedSize=0;this._stopReading=false;this._pipedServerResponses=new Set;this._cannotHaveBody=false;this._unproxyEvents=core_noop;this._triggerRead=false;this._cancelTimeouts=core_noop;this._removeListeners=core_noop;this._jobs=[];this._flushed=false;this._requestInitialized=false;this._aborted=false;this.redirectUrls=[];this.retryCount=0;this._stopRetry=core_noop;this.on("pipe",(e=>{if(e?.headers){Object.assign(this.options.headers,e.headers)}}));this.on("newListener",(e=>{if(e==="retry"&&this.listenerCount("retry")>0){throw new Error("A retry listener has been attached already.")}}));try{this.options=new Options(e,t,r);if(!this.options.url){if(this.options.prefixUrl===""){throw new TypeError("Missing `url` property")}this.options.url=""}this.requestUrl=this.options.url}catch(e){const{options:t}=e;if(t){this.options=t}this.flush=async()=>{this.flush=async()=>{};this.destroy(e)};return}const{body:i}=this.options;if(h.nodeStream(i)){i.once("error",(e=>{if(this._flushed){this._beforeError(new UploadError(e,this))}else{this.flush=async()=>{this.flush=async()=>{};this._beforeError(new UploadError(e,this))}}}))}if(this.options.signal){const abort=()=>{this.destroy(new AbortError(this))};if(this.options.signal.aborted){abort()}else{this.options.signal.addEventListener("abort",abort);this._removeListeners=()=>{this.options.signal.removeEventListener("abort",abort)}}}}async flush(){if(this._flushed){return}this._flushed=true;try{await this._finalizeBody();if(this.destroyed){return}await this._makeRequest();if(this.destroyed){this._request?.destroy();return}for(const e of this._jobs){e()}this._jobs.length=0;this._requestInitialized=true}catch(e){this._beforeError(e)}}_beforeError(e){if(this._stopReading){return}const{response:t,options:r}=this;const i=this.retryCount+(e.name==="RetryError"?0:1);this._stopReading=true;if(!(e instanceof RequestError)){e=new RequestError(e.message,e,this)}const n=e;void(async()=>{if(t?.readable&&!t.rawBody&&!this._request?.socket?.destroyed){t.setEncoding(this.readableEncoding);const e=await this._setRawBody(t);if(e){t.body=t.rawBody.toString()}}if(this.listenerCount("retry")!==0){let s;try{let e;if(t&&"retry-after"in t.headers){e=Number(t.headers["retry-after"]);if(Number.isNaN(e)){e=Date.parse(t.headers["retry-after"])-Date.now();if(e<=0){e=1}}else{e*=1e3}}const o=r.retry;s=await o.calculateDelay({attemptCount:i,retryOptions:o,error:n,retryAfter:e,computedValue:te({attemptCount:i,retryOptions:o,error:n,retryAfter:e,computedValue:o.maxRetryAfter??r.timeout.request??Number.POSITIVE_INFINITY})})}catch(e){void this._error(new RequestError(e.message,e,this));return}if(s){await new Promise((e=>{const t=setTimeout(e,s);this._stopRetry=()=>{clearTimeout(t);e()}}));if(this.destroyed){return}try{for(const e of this.options.hooks.beforeRetry){await e(n,this.retryCount+1)}}catch(t){void this._error(new RequestError(t.message,e,this));return}if(this.destroyed){return}this.destroy();this.emit("retry",this.retryCount+1,e,(e=>{const t=new Request(r.url,e,r);t.retryCount=this.retryCount+1;p.nextTick((()=>{void t.flush()}));return t}));return}}void this._error(n)})()}_read(){this._triggerRead=true;const{response:e}=this;if(e&&!this._stopReading){if(e.readableLength){this._triggerRead=false}let t;while((t=e.read())!==null){this._downloadedSize+=t.length;const e=this.downloadProgress;if(e.percent<1){this.emit("downloadProgress",e)}this.push(t)}}}_write(e,t,r){const write=()=>{this._writeRequest(e,t,r)};if(this._requestInitialized){write()}else{this._jobs.push(write)}}_final(e){const endRequest=()=>{if(!this._request||this._request.destroyed){e();return}this._request.end((t=>{if(this._request._writableState?.errored){return}if(!t){this._bodySize=this._uploadedSize;this.emit("uploadProgress",this.uploadProgress);this._request.emit("upload-complete")}e(t)}))};if(this._requestInitialized){endRequest()}else{this._jobs.push(endRequest)}}_destroy(e,t){this._stopReading=true;this.flush=async()=>{};this._stopRetry();this._cancelTimeouts();this._removeListeners();if(this.options){const{body:e}=this.options;if(h.nodeStream(e)){e.destroy()}}if(this._request){this._request.destroy()}if(e!==null&&!h.undefined(e)&&!(e instanceof RequestError)){e=new RequestError(e.message,e,this)}t(e)}pipe(e,t){if(e instanceof _.ServerResponse){this._pipedServerResponses.add(e)}return super.pipe(e,t)}unpipe(e){if(e instanceof _.ServerResponse){this._pipedServerResponses.delete(e)}super.unpipe(e);return this}async _finalizeBody(){const{options:e}=this;const{headers:t}=e;const r=!h.undefined(e.form);const i=!h.undefined(e.json);const n=!h.undefined(e.body);const s=Se.has(e.method)&&!(e.method==="GET"&&e.allowGetBody);this._cannotHaveBody=s;if(r||i||n){if(s){throw new TypeError(`The \`${e.method}\` method cannot be used with a body`)}const i=!h.string(t["content-type"]);if(n){if(isFormData(e.body)){const r=new FormDataEncoder(e.body);if(i){t["content-type"]=r.headers["Content-Type"]}if("Content-Length"in r.headers){t["content-length"]=r.headers["Content-Length"]}e.body=r.encode()}if(is_form_data_isFormData(e.body)&&i){t["content-type"]=`multipart/form-data; boundary=${e.body.getBoundary()}`}}else if(r){if(i){t["content-type"]="application/x-www-form-urlencoded"}const{form:r}=e;e.form=undefined;e.body=new y.URLSearchParams(r).toString()}else{if(i){t["content-type"]="application/json"}const{json:r}=e;e.json=undefined;e.body=e.stringifyJson(r)}const o=await getBodySize(e.body,e.headers);if(h.undefined(t["content-length"])&&h.undefined(t["transfer-encoding"])&&!s&&!h.undefined(o)){t["content-length"]=String(o)}}if(e.responseType==="json"&&!("accept"in e.headers)){e.headers.accept="application/json"}this._bodySize=Number(t["content-length"])||undefined}async _onResponseBase(e){if(this.isAborted){return}const{options:t}=this;const{url:r}=t;this._nativeResponse=e;if(t.decompress){e=I(e)}const i=e.statusCode;const n=e;n.statusMessage=n.statusMessage??_.STATUS_CODES[i];n.url=t.url.toString();n.requestUrl=this.requestUrl;n.redirectUrls=this.redirectUrls;n.request=this;n.isFromCache=this._nativeResponse.fromCache??false;n.ip=this.ip;n.retryCount=this.retryCount;n.ok=isResponseOk(n);this._isFromCache=n.isFromCache;this._responseSize=Number(e.headers["content-length"])||undefined;this.response=n;e.once("end",(()=>{this._responseSize=this._downloadedSize;this.emit("downloadProgress",this.downloadProgress)}));e.once("error",(t=>{this._aborted=true;e.destroy();this._beforeError(new ReadError(t,this))}));e.once("aborted",(()=>{this._aborted=true;this._beforeError(new ReadError({name:"Error",message:"The server aborted pending request",code:"ECONNRESET"},this))}));this.emit("downloadProgress",this.downloadProgress);const s=e.headers["set-cookie"];if(h.object(t.cookieJar)&&s){let e=s.map((async e=>t.cookieJar.setCookie(e,r.toString())));if(t.ignoreInvalidCookies){e=e.map((async e=>{try{await e}catch{}}))}try{await Promise.all(e)}catch(e){this._beforeError(e);return}}if(this.isAborted){return}if(t.followRedirect&&e.headers.location&&Ae.has(i)){e.resume();this._cancelTimeouts();this._unproxyEvents();if(this.redirectUrls.length>=t.maxRedirects){this._beforeError(new MaxRedirectsError(this));return}this._request=undefined;const s=new Options(undefined,undefined,this.options);const o=i===303&&s.method!=="GET"&&s.method!=="HEAD";const a=i!==307&&i!==308;const l=s.methodRewriting&&a;if(o||l){s.method="GET";s.body=undefined;s.json=undefined;s.form=undefined;delete s.headers["content-length"]}try{const t=m.Buffer.from(e.headers.location,"binary").toString();const i=new y.URL(t,r);if(!isUnixSocketURL(r)&&isUnixSocketURL(i)){this._beforeError(new RequestError("Cannot redirect to UNIX socket",{},this));return}if(i.hostname!==r.hostname||i.port!==r.port){if("host"in s.headers){delete s.headers.host}if("cookie"in s.headers){delete s.headers.cookie}if("authorization"in s.headers){delete s.headers.authorization}if(s.username||s.password){s.username="";s.password=""}}else{i.username=s.username;i.password=s.password}this.redirectUrls.push(i);s.prefixUrl="";s.url=i;for(const e of s.hooks.beforeRedirect){await e(s,n)}this.emit("redirect",s,n);this.options=s;await this._makeRequest()}catch(e){this._beforeError(e);return}return}if(t.isStream&&t.throwHttpErrors&&!isResponseOk(n)){this._beforeError(new HTTPError(n));return}e.on("readable",(()=>{if(this._triggerRead){this._read()}}));this.on("resume",(()=>{e.resume()}));this.on("pause",(()=>{e.pause()}));e.once("end",(()=>{this.push(null)}));if(this._noPipe){const t=await this._setRawBody();if(t){this.emit("response",e)}return}this.emit("response",e);for(const r of this._pipedServerResponses){if(r.headersSent){continue}for(const i in e.headers){const n=t.decompress?i!=="content-encoding":true;const s=e.headers[i];if(n){r.setHeader(i,s)}}r.statusCode=i}}async _setRawBody(e=this){if(e.readableEnded){return false}try{const t=await Te(e);if(!this.isAborted){this.response.rawBody=t;return true}}catch{}return false}async _onResponse(e){try{await this._onResponseBase(e)}catch(e){this._beforeError(e)}}_onRequest(e){const{options:t}=this;const{timeout:r,url:i}=t;T(e);if(this.options.http2){e.setTimeout(0)}this._cancelTimeouts=timedOut(e,r,i);const n=t.cache?"cacheableResponse":"response";e.once(n,(e=>{void this._onResponse(e)}));e.once("error",(t=>{this._aborted=true;e.destroy();t=t instanceof timed_out_TimeoutError?new TimeoutError(t,this.timings,this):new RequestError(t.message,t,this);this._beforeError(t)}));this._unproxyEvents=proxyEvents(e,this,Ce);this._request=e;this.emit("uploadProgress",this.uploadProgress);this._sendBody();this.emit("request",e)}async _asyncWrite(e){return new Promise(((t,r)=>{super.write(e,(e=>{if(e){r(e);return}t()}))}))}_sendBody(){const{body:e}=this.options;const t=this.redirectUrls.length===0?this:this._request??this;if(h.nodeStream(e)){e.pipe(t)}else if(h.generator(e)||h.asyncGenerator(e)){(async()=>{try{for await(const t of e){await this._asyncWrite(t)}super.end()}catch(e){this._beforeError(e)}})()}else if(!h.undefined(e)){this._writeRequest(e,undefined,(()=>{}));t.end()}else if(this._cannotHaveBody||this._noPipe){t.end()}}_prepareCache(e){if(!Ee.has(e)){const t=new P(((e,t)=>{const r=e._request(e,t);if(h.promise(r)){r.once=(e,t)=>{if(e==="error"){(async()=>{try{await r}catch(e){t(e)}})()}else if(e==="abort"){(async()=>{try{const e=await r;e.once("abort",t)}catch{}})()}else{throw new Error(`Unknown HTTP2 promise event: ${e}`)}return r}}return r}),e);Ee.set(e,t.request())}}async _createCacheableRequest(e,t){return new Promise(((r,i)=>{Object.assign(t,urlToOptions(e));let n;const s=Ee.get(t.cache)(t,(async e=>{e._readableState.autoDestroy=false;if(n){const fix=()=>{if(e.req){e.complete=e.req.res.complete}};e.prependOnceListener("end",fix);fix();(await n).emit("cacheableResponse",e)}r(e)}));s.once("error",i);s.once("request",(async e=>{n=e;r(n)}))}))}async _makeRequest(){const{options:e}=this;const{headers:t,username:r,password:i}=e;const n=e.cookieJar;for(const e in t){if(h.undefined(t[e])){delete t[e]}else if(h.null_(t[e])){throw new TypeError(`Use \`undefined\` instead of \`null\` to delete the \`${e}\` header`)}}if(e.decompress&&h.undefined(t["accept-encoding"])){t["accept-encoding"]=we?"gzip, deflate, br":"gzip, deflate"}if(r||i){const e=m.Buffer.from(`${r}:${i}`).toString("base64");t.authorization=`Basic ${e}`}if(n){const r=await n.getCookieString(e.url.toString());if(h.nonEmptyString(r)){t.cookie=r}}e.prefixUrl="";let s;for(const t of e.hooks.beforeRequest){const r=await t(e);if(!h.undefined(r)){s=()=>r;break}}if(!s){s=e.getRequestFunction()}const o=e.url;this._requestOptions=e.createNativeRequestOptions();if(e.cache){this._requestOptions._request=s;this._requestOptions.cache=e.cache;this._requestOptions.body=e.body;this._prepareCache(e.cache)}const a=e.cache?this._createCacheableRequest:s;try{let t=a(o,this._requestOptions);if(h.promise(t)){t=await t}if(h.undefined(t)){t=e.getFallbackRequestFunction()(o,this._requestOptions);if(h.promise(t)){t=await t}}if(xe(t)){this._onRequest(t)}else if(this.writable){this.once("finish",(()=>{void this._onResponse(t)}));this._sendBody()}else{void this._onResponse(t)}}catch(e){if(e instanceof types_CacheError){throw new CacheError(e,this)}throw e}}async _error(e){try{if(e instanceof HTTPError&&!this.options.throwHttpErrors){}else{for(const t of this.options.hooks.beforeError){e=await t(e)}}}catch(t){e=new RequestError(t.message,t,this)}this.destroy(e)}_writeRequest(e,t,r){if(!this._request||this._request.destroyed){return}this._request.write(e,t,(i=>{if(!i&&!this._request.destroyed){this._uploadedSize+=m.Buffer.byteLength(e,t);const r=this.uploadProgress;if(r.percent<1){this.emit("uploadProgress",r)}}r(i)}))}get ip(){return this.socket?.remoteAddress}get isAborted(){return this._aborted}get socket(){return this._request?.socket??undefined}get downloadProgress(){let e;if(this._responseSize){e=this._downloadedSize/this._responseSize}else if(this._responseSize===this._downloadedSize){e=1}else{e=0}return{percent:e,transferred:this._downloadedSize,total:this._responseSize}}get uploadProgress(){let e;if(this._bodySize){e=this._uploadedSize/this._bodySize}else if(this._bodySize===this._uploadedSize){e=1}else{e=0}return{percent:e,transferred:this._uploadedSize,total:this._bodySize}}get timings(){return this._request?.timings}get isFromCache(){return this._isFromCache}get reusedSocket(){return this._request?.reusedSocket}}class types_CancelError extends RequestError{constructor(e){super("Promise was canceled",{},e);this.name="CancelError";this.code="ERR_CANCELED"}get isCanceled(){return true}}const Ne=["request","response","redirect","uploadProgress","downloadProgress"];function asPromise(e){let t;let r;let i;const n=new d.EventEmitter;const s=new PCancelable(((o,a,l)=>{l((()=>{t.destroy()}));l.shouldReject=false;l((()=>{a(new types_CancelError(t))}));const makeRequest=u=>{l((()=>{}));const c=e??new Request(undefined,undefined,i);c.retryCount=u;c._noPipe=true;t=c;c.once("response",(async e=>{const t=(e.headers["content-encoding"]??"").toLowerCase();const i=t==="gzip"||t==="deflate"||t==="br";const{options:n}=c;if(i&&!n.decompress){e.body=e.rawBody}else{try{e.body=parseBody(e,n.responseType,n.parseJson,n.encoding)}catch(t){e.body=e.rawBody.toString();if(isResponseOk(e)){c._beforeError(t);return}}}try{const t=n.hooks.afterResponse;for(const[r,i]of t.entries()){e=await i(e,(async e=>{n.merge(e);n.prefixUrl="";if(e.url){n.url=e.url}n.hooks.afterResponse=n.hooks.afterResponse.slice(0,r);throw new RetryError(c)}));if(!(h.object(e)&&h.number(e.statusCode)&&!h.nullOrUndefined(e.body))){throw new TypeError("The `afterResponse` hook returned an invalid value")}}}catch(e){c._beforeError(e);return}r=e;if(!isResponseOk(e)){c._beforeError(new HTTPError(e));return}c.destroy();o(c.options.resolveBodyOnly?e.body:e)}));const onError=e=>{if(s.isCanceled){return}const{options:t}=c;if(e instanceof HTTPError&&!t.throwHttpErrors){const{response:t}=e;c.destroy();o(c.options.resolveBodyOnly?t.body:t);return}a(e)};c.once("error",onError);const d=c.options?.body;c.once("retry",((t,r)=>{e=undefined;const n=c.options.body;if(d===n&&h.nodeStream(n)){r.message="Cannot retry with consumed body stream";onError(r);return}i=c.options;makeRequest(t)}));proxyEvents(c,n,Ne);if(h.undefined(e)){void c.flush()}};makeRequest(0)}));s.on=(e,t)=>{n.on(e,t);return s};s.off=(e,t)=>{n.off(e,t);return s};const shortcut=e=>{const t=(async()=>{await s;const{options:t}=r.request;return parseBody(r,e,t.parseJson,t.encoding)})();Object.defineProperties(t,Object.getOwnPropertyDescriptors(s));return t};s.json=()=>{if(t.options){const{headers:e}=t.options;if(!t.writableFinished&&!("accept"in e)){e.accept="application/json"}}return shortcut("json")};s.buffer=()=>shortcut("buffer");s.text=()=>shortcut("text");return s}const delay=async e=>new Promise((t=>{setTimeout(t,e)}));const isGotInstance=e=>h.function_(e);const Oe=["get","post","put","patch","head","delete"];const create=e=>{e={options:new Options(undefined,undefined,e.options),handlers:[...e.handlers],mutableDefaults:e.mutableDefaults};Object.defineProperty(e,"mutableDefaults",{enumerable:true,configurable:false,writable:false});const got=(t,r,i=e.options)=>{const n=new Request(t,r,i);let s;const lastHandler=e=>{n.options=e;n._noPipe=!e.isStream;void n.flush();if(e.isStream){return n}if(!s){s=asPromise(n)}return s};let o=0;const iterateHandlers=t=>{const r=e.handlers[o++]??lastHandler;const i=r(t,iterateHandlers);if(h.promise(i)&&!n.options.isStream){if(!s){s=asPromise(n)}if(i!==s){const e=Object.getOwnPropertyDescriptors(s);for(const t in e){if(t in i){delete e[t]}}Object.defineProperties(i,e);i.cancel=s.cancel}}return i};return iterateHandlers(n.options)};got.extend=(...t)=>{const r=new Options(undefined,undefined,e.options);const i=[...e.handlers];let n;for(const e of t){if(isGotInstance(e)){r.merge(e.defaults.options);i.push(...e.defaults.handlers);n=e.defaults.mutableDefaults}else{r.merge(e);if(e.handlers){i.push(...e.handlers)}n=e.mutableDefaults}}return create({options:r,handlers:i,mutableDefaults:Boolean(n)})};const paginateEach=async function*(t,r){let i=new Options(t,r,e.options);i.resolveBodyOnly=false;const{pagination:n}=i;c.function_(n.transform);c.function_(n.shouldContinue);c.function_(n.filter);c.function_(n.paginate);c.number(n.countLimit);c.number(n.requestLimit);c.number(n.backoff);const s=[];let{countLimit:o}=n;let a=0;while(a<n.requestLimit){if(a!==0){await delay(n.backoff)}const e=await got(undefined,undefined,i);const t=await n.transform(e);const r=[];c.array(t);for(const e of t){if(n.filter({item:e,currentItems:r,allItems:s})){if(!n.shouldContinue({item:e,currentItems:r,allItems:s})){return}yield e;if(n.stackAllItems){s.push(e)}r.push(e);if(--o<=0){return}}}const l=n.paginate({response:e,currentItems:r,allItems:s});if(l===false){return}if(l===e.request.options){i=e.request.options}else{i.merge(l);c.any([h.urlInstance,h.undefined],l.url);if(l.url!==undefined){i.prefixUrl="";i.url=l.url}}a++}};got.paginate=paginateEach;got.paginate.all=async(e,t)=>{const r=[];for await(const i of paginateEach(e,t)){r.push(i)}return r};got.paginate.each=paginateEach;got.stream=(e,t)=>got(e,{...t,isStream:true});for(const e of Oe){got[e]=(t,r)=>got(t,{...r,method:e});got.stream[e]=(t,r)=>got(t,{...r,method:e,isStream:true})}if(!e.mutableDefaults){Object.freeze(e.handlers);e.options.freeze()}Object.defineProperty(got,"defaults",{value:e,writable:false,configurable:false,enumerable:true});return got};const Re=create;const ke={options:new Options,handlers:[],mutableDefaults:false};const Pe=Re(ke);const Le=Pe},2561:e=>{"use strict";e.exports={version:"3.10.0"}}};var t={};function __nccwpck_require__(r){var i=t[r];if(i!==undefined){return i.exports}var n=t[r]={id:r,loaded:false,exports:{}};var s=true;try{e[r].call(n.exports,n,n.exports,__nccwpck_require__);s=false}finally{if(s)delete t[r]}n.loaded=true;return n.exports}(()=>{__nccwpck_require__.d=(e,t)=>{for(var r in t){if(__nccwpck_require__.o(t,r)&&!__nccwpck_require__.o(e,r)){Object.defineProperty(e,r,{enumerable:true,get:t[r]})}}}})();(()=>{__nccwpck_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})();(()=>{__nccwpck_require__.r=e=>{if(typeof Symbol!=="undefined"&&Symbol.toStringTag){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}Object.defineProperty(e,"__esModule",{value:true})}})();(()=>{__nccwpck_require__.nmd=e=>{e.paths=[];if(!e.children)e.children=[];return e}})();if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var r={};(()=>{"use strict";var e=r;Object.defineProperty(e,"__esModule",{value:true});const t=__nccwpck_require__(4379);const i=__nccwpck_require__(8584);const n=__nccwpck_require__(8989);const s=new t.Option("-l,--log-level <level>","Log level").choices(["error","warn","info","http","verbose","debug","silly"]).default("info");const o=new t.Option("-d,--deployments <path>","Path to the deployments folder");const a=new t.Option("--dry-run","Do not verify anything, just output the verifications that would be performed");const l=new t.Option("-n,--network <network name>","Network to verify").makeOptionMandatory();const u=new t.Option("-u,--api-url <url>","Scan API URL (fully qualified, with protocol and path)");const c=new t.Option("-k,--api-key <key>","Scan API Key");const h=new t.Command("non-target").description("Verifies a contract that does not have its own deployment file, i.e. has not been a target of a deployment").addOption(s).addOption(a).addOption(o).addOption(l).addOption(u).addOption(c).requiredOption("--address <address>","Contract address to verify").requiredOption("--name <contract name>","Fully qualified contract name to verify, e.g. contracts/MyToken.sol").requiredOption("--deployment <deployment file name>","Deployment file name, e.g. MyOtherToken.json").option("--arguments <constructor arguments>",'JSON encoded array of constructor arguments, e.g. [1234, "0x0"]',(e=>{try{const t=JSON.parse(e);if(!Array.isArray(t)){throw new Error(`Constructor arguments must be an array, got ${t}`)}return t}catch(e){throw new t.InvalidOptionArgumentError(`Malformed constructor arguments specified: ${e}`)}})).action((async e=>{const t=(0,n.createLogger)(e.logLevel);const r={dryRun:e.dryRun,paths:{deployments:e.deployments},networks:{[e.network]:{apiUrl:e.apiUrl,apiKey:e.apiKey}},contracts:[{network:e.network,address:e.address,contractName:e.name,deployment:e.deployment,constructorArguments:e.arguments}]};try{await(0,i.verifyNonTarget)(r,t)}catch(e){t.error(n.COLORS.error`The verification script exited with an error: ${e}`);process.exit(1)}}));const d=new t.Command("target").description("Verifies contracts that have been a part of a deployment, i.e. have their own deployment files").addOption(s).addOption(a).addOption(o).addOption(l).addOption(u).addOption(c).option("-c,--contracts <contract names>","Comma-separated list of case-sensitive contract names to verify",(e=>(e===null||e===void 0?void 0:e.trim())?e.split(",").map((e=>e.trim())):undefined)).action((async e=>{const t=(0,n.createLogger)(e.logLevel);const r={dryRun:e.dryRun,paths:{deployments:e.deployments},networks:{[e.network]:{apiUrl:e.apiUrl,apiKey:e.apiKey}},filter:e.contracts};try{await(0,i.verifyTarget)(r,t)}catch(e){t.error(n.COLORS.error`The verification script exited with an error: ${e}`);process.exit(1)}}));new t.Command("lz-verify-contract").description("Verify a set of contracts based on hardhat-deploy outputs").addCommand(h).addCommand(d,{isDefault:true}).parseAsync()})();module.exports=r})();