libp2p 0.46.20 → 0.46.21-0f5c305af
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/dist/index.min.js +1 -1
- package/dist/src/identify/consts.d.ts +1 -1
- package/dist/src/identify/consts.d.ts.map +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.d.ts.map +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/version.js.map +1 -1
- package/package.json +21 -21
- package/src/version.ts +1 -1
- package/dist/typedoc-urls.json +0 -71
package/dist/index.min.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
`,r};Vf.decode=function(e){for(var t=[],r=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,n=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,i=/\r?\n/,s;s=r.exec(e),!!s;){var o=s[1];o==="NEW CERTIFICATE REQUEST"&&(o="CERTIFICATE REQUEST");var a={type:o,procType:null,contentDomain:null,dekInfo:null,headers:[],body:Ms.util.decode64(s[3])};if(t.push(a),!!s[2]){for(var c=s[2].split(i),u=0;s&&u<c.length;){for(var l=c[u].replace(/\s+$/,""),f=u+1;f<c.length;++f){var h=c[f];if(!/\s/.test(h[0]))break;l+=h,u=f}if(s=l.match(n),s){for(var p={name:s[1],values:[]},d=s[2].split(","),m=0;m<d.length;++m)p.values.push(Jy(d[m]));if(a.procType)if(!a.contentDomain&&p.name==="Content-Domain")a.contentDomain=d[0]||"";else if(!a.dekInfo&&p.name==="DEK-Info"){if(p.values.length===0)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');a.dekInfo={algorithm:d[0],parameters:d[1]||null}}else a.headers.push(p);else{if(p.name!=="Proc-Type")throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(p.values.length!==2)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');a.procType={version:d[0],type:d[1]}}}++u}if(a.procType==="ENCRYPTED"&&!a.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(t.length===0)throw new Error("Invalid PEM formatted message.");return t};function Os(e){for(var t=e.name+": ",r=[],n=function(c,u){return" "+u},i=0;i<e.values.length;++i)r.push(e.values[i].replace(/^(\S+\r\n)/,n));t+=r.join(",")+`\r
|
|
13
13
|
`;for(var s=0,o=-1,i=0;i<t.length;++i,++s)if(s>65&&o!==-1){var a=t[o];a===","?(++o,t=t.substr(0,o)+`\r
|
|
14
14
|
`+t.substr(o)):t=t.substr(0,o)+`\r
|
|
15
|
-
`+a+t.substr(o+1),s=i-o-1,o=-1,++i}else(t[i]===" "||t[i]===" "||t[i]===",")&&(o=i);return t}function Jy(e){return e.replace(/^\s+/,"")}});var Qf=V((P_,Wf)=>{var qe=ht();jr();Pt();var Hf=Wf.exports=qe.sha256=qe.sha256||{};qe.md.sha256=qe.md.algorithms.sha256=Hf;Hf.create=function(){Gf||jy();var e=null,t=qe.util.createBuffer(),r=new Array(64),n={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8};return n.start=function(){n.messageLength=0,n.fullMessageLength=n.messageLength64=[];for(var i=n.messageLengthSize/4,s=0;s<i;++s)n.fullMessageLength.push(0);return t=qe.util.createBuffer(),e={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},n},n.start(),n.update=function(i,s){s==="utf8"&&(i=qe.util.encodeUtf8(i));var o=i.length;n.messageLength+=o,o=[o/4294967296>>>0,o>>>0];for(var a=n.fullMessageLength.length-1;a>=0;--a)n.fullMessageLength[a]+=o[1],o[1]=o[0]+(n.fullMessageLength[a]/4294967296>>>0),n.fullMessageLength[a]=n.fullMessageLength[a]>>>0,o[0]=o[1]/4294967296>>>0;return t.putBytes(i),zf(e,r,t),(t.read>2048||t.length()===0)&&t.compact(),n},n.digest=function(){var i=qe.util.createBuffer();i.putBytes(t.bytes());var s=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize,o=s&n.blockLength-1;i.putBytes(Ga.substr(0,n.blockLength-o));for(var a,c,u=n.fullMessageLength[0]*8,l=0;l<n.fullMessageLength.length-1;++l)a=n.fullMessageLength[l+1]*8,c=a/4294967296>>>0,u+=c,i.putInt32(u>>>0),u=a>>>0;i.putInt32(u);var f={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4,h5:e.h5,h6:e.h6,h7:e.h7};zf(f,r,i);var h=qe.util.createBuffer();return h.putInt32(f.h0),h.putInt32(f.h1),h.putInt32(f.h2),h.putInt32(f.h3),h.putInt32(f.h4),h.putInt32(f.h5),h.putInt32(f.h6),h.putInt32(f.h7),h},n};var Ga=null,Gf=!1,Yf=null;function jy(){Ga=String.fromCharCode(128),Ga+=qe.util.fillString(String.fromCharCode(0),64),Yf=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],Gf=!0}function zf(e,t,r){for(var n,i,s,o,a,c,u,l,f,h,p,d,m,y,g,x=r.length();x>=64;){for(u=0;u<16;++u)t[u]=r.getInt32();for(;u<64;++u)n=t[u-2],n=(n>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,i=t[u-15],i=(i>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,t[u]=n+t[u-7]+i+t[u-16]|0;for(l=e.h0,f=e.h1,h=e.h2,p=e.h3,d=e.h4,m=e.h5,y=e.h6,g=e.h7,u=0;u<64;++u)o=(d>>>6|d<<26)^(d>>>11|d<<21)^(d>>>25|d<<7),a=y^d&(m^y),s=(l>>>2|l<<30)^(l>>>13|l<<19)^(l>>>22|l<<10),c=l&f|h&(l^f),n=g+o+a+Yf[u]+t[u],i=s+c,g=y,y=m,m=d,d=p+n>>>0,p=h,h=f,f=l,l=n+i>>>0;e.h0=e.h0+l|0,e.h1=e.h1+f|0,e.h2=e.h2+h|0,e.h3=e.h3+p|0,e.h4=e.h4+d|0,e.h5=e.h5+m|0,e.h6=e.h6+y|0,e.h7=e.h7+g|0,x-=64}}});var Zf=V((D_,Xf)=>{var $e=ht();Pt();var Us=null;$e.util.isNodejs&&!$e.options.usePureJavaScript&&!process.versions["node-webkit"]&&(Us=Li());var tg=Xf.exports=$e.prng=$e.prng||{};tg.create=function(e){for(var t={plugin:e,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},r=e.md,n=new Array(32),i=0;i<32;++i)n[i]=r.create();t.pools=n,t.pool=0,t.generate=function(u,l){if(!l)return t.generateSync(u);var f=t.plugin.cipher,h=t.plugin.increment,p=t.plugin.formatKey,d=t.plugin.formatSeed,m=$e.util.createBuffer();t.key=null,y();function y(g){if(g)return l(g);if(m.length()>=u)return l(null,m.getBytes(u));if(t.generated>1048575&&(t.key=null),t.key===null)return $e.util.nextTick(function(){s(y)});var x=f(t.key,t.seed);t.generated+=x.length,m.putBytes(x),t.key=p(f(t.key,h(t.seed))),t.seed=d(f(t.key,t.seed)),$e.util.setImmediate(y)}},t.generateSync=function(u){var l=t.plugin.cipher,f=t.plugin.increment,h=t.plugin.formatKey,p=t.plugin.formatSeed;t.key=null;for(var d=$e.util.createBuffer();d.length()<u;){t.generated>1048575&&(t.key=null),t.key===null&&o();var m=l(t.key,t.seed);t.generated+=m.length,d.putBytes(m),t.key=h(l(t.key,f(t.seed))),t.seed=p(l(t.key,t.seed))}return d.getBytes(u)};function s(u){if(t.pools[0].messageLength>=32)return a(),u();var l=32-t.pools[0].messageLength<<5;t.seedFile(l,function(f,h){if(f)return u(f);t.collect(h),a(),u()})}function o(){if(t.pools[0].messageLength>=32)return a();var u=32-t.pools[0].messageLength<<5;t.collect(t.seedFileSync(u)),a()}function a(){t.reseeds=t.reseeds===4294967295?0:t.reseeds+1;var u=t.plugin.md.create();u.update(t.keyBytes);for(var l=1,f=0;f<32;++f)t.reseeds%l===0&&(u.update(t.pools[f].digest().getBytes()),t.pools[f].start()),l=l<<1;t.keyBytes=u.digest().getBytes(),u.start(),u.update(t.keyBytes);var h=u.digest().getBytes();t.key=t.plugin.formatKey(t.keyBytes),t.seed=t.plugin.formatSeed(h),t.generated=0}function c(u){var l=null,f=$e.util.globalScope,h=f.crypto||f.msCrypto;h&&h.getRandomValues&&(l=function(_){return h.getRandomValues(_)});var p=$e.util.createBuffer();if(l)for(;p.length()<u;){var d=Math.max(1,Math.min(u-p.length(),65536)/4),m=new Uint32Array(Math.floor(d));try{l(m);for(var y=0;y<m.length;++y)p.putInt32(m[y])}catch(_){if(!(typeof QuotaExceededError<"u"&&_ instanceof QuotaExceededError))throw _}}if(p.length()<u)for(var g,x,b,C=Math.floor(Math.random()*65536);p.length()<u;){x=16807*(C&65535),g=16807*(C>>16),x+=(g&32767)<<16,x+=g>>15,x=(x&2147483647)+(x>>31),C=x&4294967295;for(var y=0;y<3;++y)b=C>>>(y<<3),b^=Math.floor(Math.random()*256),p.putByte(b&255)}return p.getBytes(u)}return Us?(t.seedFile=function(u,l){Us.randomBytes(u,function(f,h){if(f)return l(f);l(null,h.toString())})},t.seedFileSync=function(u){return Us.randomBytes(u).toString()}):(t.seedFile=function(u,l){try{l(null,c(u))}catch(f){l(f)}},t.seedFileSync=c),t.collect=function(u){for(var l=u.length,f=0;f<l;++f)t.pools[t.pool].update(u.substr(f,1)),t.pool=t.pool===31?0:t.pool+1},t.collectInt=function(u,l){for(var f="",h=0;h<l;h+=8)f+=String.fromCharCode(u>>h&255);t.collect(f)},t.registerWorker=function(u){if(u===self)t.seedFile=function(f,h){function p(d){var m=d.data;m.forge&&m.forge.prng&&(self.removeEventListener("message",p),h(m.forge.prng.err,m.forge.prng.bytes))}self.addEventListener("message",p),self.postMessage({forge:{prng:{needed:f}}})};else{var l=function(f){var h=f.data;h.forge&&h.forge.prng&&t.seedFile(h.forge.prng.needed,function(p,d){u.postMessage({forge:{prng:{err:p,bytes:d}}})})};u.addEventListener("message",l)}},t}});var Pi=V((N_,Ya)=>{var Yt=ht();Ds();Qf();Zf();Pt();(function(){if(Yt.random&&Yt.random.getBytes){Ya.exports=Yt.random;return}(function(e){var t={},r=new Array(4),n=Yt.util.createBuffer();t.formatKey=function(f){var h=Yt.util.createBuffer(f);return f=new Array(4),f[0]=h.getInt32(),f[1]=h.getInt32(),f[2]=h.getInt32(),f[3]=h.getInt32(),Yt.aes._expandKey(f,!1)},t.formatSeed=function(f){var h=Yt.util.createBuffer(f);return f=new Array(4),f[0]=h.getInt32(),f[1]=h.getInt32(),f[2]=h.getInt32(),f[3]=h.getInt32(),f},t.cipher=function(f,h){return Yt.aes._updateBlock(f,h,r,!1),n.putInt32(r[0]),n.putInt32(r[1]),n.putInt32(r[2]),n.putInt32(r[3]),n.getBytes()},t.increment=function(f){return++f[3],f},t.md=Yt.md.sha256;function i(){var f=Yt.prng.create(t);return f.getBytes=function(h,p){return f.generate(h,p)},f.getBytesSync=function(h){return f.generate(h)},f}var s=i(),o=null,a=Yt.util.globalScope,c=a.crypto||a.msCrypto;if(c&&c.getRandomValues&&(o=function(f){return c.getRandomValues(f)}),Yt.options.usePureJavaScript||!Yt.util.isNodejs&&!o){if(typeof window>"u"||window.document,s.collectInt(+new Date,32),typeof navigator<"u"){var u="";for(var l in navigator)try{typeof navigator[l]=="string"&&(u+=navigator[l])}catch{}s.collect(u),u=null}e&&(e().mousemove(function(f){s.collectInt(f.clientX,16),s.collectInt(f.clientY,16)}),e().keypress(function(f){s.collectInt(f.charCode,8)}))}if(!Yt.random)Yt.random=s;else for(var l in s)Yt.random[l]=s[l];Yt.random.createInstance=i,Ya.exports=Yt.random})(typeof jQuery<"u"?jQuery:null)})()});var e0=V((k_,t0)=>{var fe=ht();Pt();var Wa=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],Jf=[1,2,3,5],eg=function(e,t){return e<<t&65535|(e&65535)>>16-t},rg=function(e,t){return(e&65535)>>t|e<<16-t&65535};t0.exports=fe.rc2=fe.rc2||{};fe.rc2.expandKey=function(e,t){typeof e=="string"&&(e=fe.util.createBuffer(e)),t=t||128;var r=e,n=e.length(),i=t,s=Math.ceil(i/8),o=255>>(i&7),a;for(a=n;a<128;a++)r.putByte(Wa[r.at(a-1)+r.at(a-n)&255]);for(r.setAt(128-s,Wa[r.at(128-s)&o]),a=127-s;a>=0;a--)r.setAt(a,Wa[r.at(a+1)^r.at(a+s)]);return r};var jf=function(e,t,r){var n=!1,i=null,s=null,o=null,a,c,u,l,f=[];for(e=fe.rc2.expandKey(e,t),u=0;u<64;u++)f.push(e.getInt16Le());r?(a=function(d){for(u=0;u<4;u++)d[u]+=f[l]+(d[(u+3)%4]&d[(u+2)%4])+(~d[(u+3)%4]&d[(u+1)%4]),d[u]=eg(d[u],Jf[u]),l++},c=function(d){for(u=0;u<4;u++)d[u]+=f[d[(u+3)%4]&63]}):(a=function(d){for(u=3;u>=0;u--)d[u]=rg(d[u],Jf[u]),d[u]-=f[l]+(d[(u+3)%4]&d[(u+2)%4])+(~d[(u+3)%4]&d[(u+1)%4]),l--},c=function(d){for(u=3;u>=0;u--)d[u]-=f[d[(u+3)%4]&63]});var h=function(d){var m=[];for(u=0;u<4;u++){var y=i.getInt16Le();o!==null&&(r?y^=o.getInt16Le():o.putInt16Le(y)),m.push(y&65535)}l=r?0:63;for(var g=0;g<d.length;g++)for(var x=0;x<d[g][0];x++)d[g][1](m);for(u=0;u<4;u++)o!==null&&(r?o.putInt16Le(m[u]):m[u]^=o.getInt16Le()),s.putInt16Le(m[u])},p=null;return p={start:function(d,m){d&&typeof d=="string"&&(d=fe.util.createBuffer(d)),n=!1,i=fe.util.createBuffer(),s=m||new fe.util.createBuffer,o=d,p.output=s},update:function(d){for(n||i.putBuffer(d);i.length()>=8;)h([[5,a],[1,c],[6,a],[1,c],[5,a]])},finish:function(d){var m=!0;if(r)if(d)m=d(8,i,!r);else{var y=i.length()===8?8:8-i.length();i.fillWithByte(y,y)}if(m&&(n=!0,p.update()),!r&&(m=i.length()===0,m))if(d)m=d(8,s,!r);else{var g=s.length(),x=s.at(g-1);x>g?m=!1:s.truncate(x)}return m}},p};fe.rc2.startEncrypting=function(e,t,r){var n=fe.rc2.createEncryptionCipher(e,128);return n.start(t,r),n};fe.rc2.createEncryptionCipher=function(e,t){return jf(e,t,!0)};fe.rc2.startDecrypting=function(e,t,r){var n=fe.rc2.createDecryptionCipher(e,128);return n.start(t,r),n};fe.rc2.createDecryptionCipher=function(e,t){return jf(e,t,!1)}});var Vs=V((O_,u0)=>{var Qa=ht();u0.exports=Qa.jsbn=Qa.jsbn||{};var sr,ng=0xdeadbeefcafe,r0=(ng&16777215)==15715070;function R(e,t,r){this.data=[],e!=null&&(typeof e=="number"?this.fromNumber(e,t,r):t==null&&typeof e!="string"?this.fromString(e,256):this.fromString(e,t))}Qa.jsbn.BigInteger=R;function ot(){return new R(null)}function ig(e,t,r,n,i,s){for(;--s>=0;){var o=t*this.data[e++]+r.data[n]+i;i=Math.floor(o/67108864),r.data[n++]=o&67108863}return i}function sg(e,t,r,n,i,s){for(var o=t&32767,a=t>>15;--s>=0;){var c=this.data[e]&32767,u=this.data[e++]>>15,l=a*c+u*o;c=o*c+((l&32767)<<15)+r.data[n]+(i&1073741823),i=(c>>>30)+(l>>>15)+a*u+(i>>>30),r.data[n++]=c&1073741823}return i}function n0(e,t,r,n,i,s){for(var o=t&16383,a=t>>14;--s>=0;){var c=this.data[e]&16383,u=this.data[e++]>>14,l=a*c+u*o;c=o*c+((l&16383)<<14)+r.data[n]+i,i=(c>>28)+(l>>14)+a*u,r.data[n++]=c&268435455}return i}typeof navigator>"u"?(R.prototype.am=n0,sr=28):r0&&navigator.appName=="Microsoft Internet Explorer"?(R.prototype.am=sg,sr=30):r0&&navigator.appName!="Netscape"?(R.prototype.am=ig,sr=26):(R.prototype.am=n0,sr=28);R.prototype.DB=sr;R.prototype.DM=(1<<sr)-1;R.prototype.DV=1<<sr;var Xa=52;R.prototype.FV=Math.pow(2,Xa);R.prototype.F1=Xa-sr;R.prototype.F2=2*sr-Xa;var og="0123456789abcdefghijklmnopqrstuvwxyz",Fs=new Array,Un,Ae;Un="0".charCodeAt(0);for(Ae=0;Ae<=9;++Ae)Fs[Un++]=Ae;Un="a".charCodeAt(0);for(Ae=10;Ae<36;++Ae)Fs[Un++]=Ae;Un="A".charCodeAt(0);for(Ae=10;Ae<36;++Ae)Fs[Un++]=Ae;function i0(e){return og.charAt(e)}function s0(e,t){var r=Fs[e.charCodeAt(t)];return r??-1}function ag(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s}function cg(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0}function Ar(e){var t=ot();return t.fromInt(e),t}function ug(e,t){var r;if(t==16)r=4;else if(t==8)r=3;else if(t==256)r=8;else if(t==2)r=1;else if(t==32)r=5;else if(t==4)r=2;else{this.fromRadix(e,t);return}this.t=0,this.s=0;for(var n=e.length,i=!1,s=0;--n>=0;){var o=r==8?e[n]&255:s0(e,n);if(o<0){e.charAt(n)=="-"&&(i=!0);continue}i=!1,s==0?this.data[this.t++]=o:s+r>this.DB?(this.data[this.t-1]|=(o&(1<<this.DB-s)-1)<<s,this.data[this.t++]=o>>this.DB-s):this.data[this.t-1]|=o<<s,s+=r,s>=this.DB&&(s-=this.DB)}r==8&&e[0]&128&&(this.s=-1,s>0&&(this.data[this.t-1]|=(1<<this.DB-s)-1<<s)),this.clamp(),i&&R.ZERO.subTo(this,this)}function lg(){for(var e=this.s&this.DM;this.t>0&&this.data[this.t-1]==e;)--this.t}function fg(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(e==16)t=4;else if(e==8)t=3;else if(e==2)t=1;else if(e==32)t=5;else if(e==4)t=2;else return this.toRadix(e);var r=(1<<t)-1,n,i=!1,s="",o=this.t,a=this.DB-o*this.DB%t;if(o-- >0)for(a<this.DB&&(n=this.data[o]>>a)>0&&(i=!0,s=i0(n));o>=0;)a<t?(n=(this.data[o]&(1<<a)-1)<<t-a,n|=this.data[--o]>>(a+=this.DB-t)):(n=this.data[o]>>(a-=t)&r,a<=0&&(a+=this.DB,--o)),n>0&&(i=!0),i&&(s+=i0(n));return i?s:"0"}function hg(){var e=ot();return R.ZERO.subTo(this,e),e}function dg(){return this.s<0?this.negate():this}function pg(e){var t=this.s-e.s;if(t!=0)return t;var r=this.t;if(t=r-e.t,t!=0)return this.s<0?-t:t;for(;--r>=0;)if((t=this.data[r]-e.data[r])!=0)return t;return 0}function Ks(e){var t=1,r;return(r=e>>>16)!=0&&(e=r,t+=16),(r=e>>8)!=0&&(e=r,t+=8),(r=e>>4)!=0&&(e=r,t+=4),(r=e>>2)!=0&&(e=r,t+=2),(r=e>>1)!=0&&(e=r,t+=1),t}function mg(){return this.t<=0?0:this.DB*(this.t-1)+Ks(this.data[this.t-1]^this.s&this.DM)}function yg(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s}function gg(e,t){for(var r=e;r<this.t;++r)t.data[r-e]=this.data[r];t.t=Math.max(this.t-e,0),t.s=this.s}function xg(e,t){var r=e%this.DB,n=this.DB-r,i=(1<<n)-1,s=Math.floor(e/this.DB),o=this.s<<r&this.DM,a;for(a=this.t-1;a>=0;--a)t.data[a+s+1]=this.data[a]>>n|o,o=(this.data[a]&i)<<r;for(a=s-1;a>=0;--a)t.data[a]=0;t.data[s]=o,t.t=this.t+s+1,t.s=this.s,t.clamp()}function Eg(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t){t.t=0;return}var n=e%this.DB,i=this.DB-n,s=(1<<n)-1;t.data[0]=this.data[r]>>n;for(var o=r+1;o<this.t;++o)t.data[o-r-1]|=(this.data[o]&s)<<i,t.data[o-r]=this.data[o]>>n;n>0&&(t.data[this.t-r-1]|=(this.s&s)<<i),t.t=this.t-r,t.clamp()}function bg(e,t){for(var r=0,n=0,i=Math.min(e.t,this.t);r<i;)n+=this.data[r]-e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n-=e.s;r<this.t;)n+=this.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n-=e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t.data[r++]=this.DV+n:n>0&&(t.data[r++]=n),t.t=r,t.clamp()}function wg(e,t){var r=this.abs(),n=e.abs(),i=r.t;for(t.t=i+n.t;--i>=0;)t.data[i]=0;for(i=0;i<n.t;++i)t.data[i+r.t]=r.am(0,n.data[i],t,i,0,r.t);t.s=0,t.clamp(),this.s!=e.s&&R.ZERO.subTo(t,t)}function vg(e){for(var t=this.abs(),r=e.t=2*t.t;--r>=0;)e.data[r]=0;for(r=0;r<t.t-1;++r){var n=t.am(r,t.data[r],e,2*r,0,1);(e.data[r+t.t]+=t.am(r+1,2*t.data[r],e,2*r+1,n,t.t-r-1))>=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()}function _g(e,t,r){var n=e.abs();if(!(n.t<=0)){var i=this.abs();if(i.t<n.t){t?.fromInt(0),r!=null&&this.copyTo(r);return}r==null&&(r=ot());var s=ot(),o=this.s,a=e.s,c=this.DB-Ks(n.data[n.t-1]);c>0?(n.lShiftTo(c,s),i.lShiftTo(c,r)):(n.copyTo(s),i.copyTo(r));var u=s.t,l=s.data[u-1];if(l!=0){var f=l*(1<<this.F1)+(u>1?s.data[u-2]>>this.F2:0),h=this.FV/f,p=(1<<this.F1)/f,d=1<<this.F2,m=r.t,y=m-u,g=t??ot();for(s.dlShiftTo(y,g),r.compareTo(g)>=0&&(r.data[r.t++]=1,r.subTo(g,r)),R.ONE.dlShiftTo(u,g),g.subTo(s,s);s.t<u;)s.data[s.t++]=0;for(;--y>=0;){var x=r.data[--m]==l?this.DM:Math.floor(r.data[m]*h+(r.data[m-1]+d)*p);if((r.data[m]+=s.am(0,x,r,y,0,u))<x)for(s.dlShiftTo(y,g),r.subTo(g,r);r.data[m]<--x;)r.subTo(g,r)}t!=null&&(r.drShiftTo(u,t),o!=a&&R.ZERO.subTo(t,t)),r.t=u,r.clamp(),c>0&&r.rShiftTo(c,r),o<0&&R.ZERO.subTo(r,r)}}}function Sg(e){var t=ot();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(R.ZERO)>0&&e.subTo(t,t),t}function tn(e){this.m=e}function Ag(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function Ig(e){return e}function Rg(e){e.divRemTo(this.m,null,e)}function Cg(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function Tg(e,t){e.squareTo(t),this.reduce(t)}tn.prototype.convert=Ag;tn.prototype.revert=Ig;tn.prototype.reduce=Rg;tn.prototype.mulTo=Cg;tn.prototype.sqrTo=Tg;function Bg(){if(this.t<1)return 0;var e=this.data[0];if(!(e&1))return 0;var t=e&3;return t=t*(2-(e&15)*t)&15,t=t*(2-(e&255)*t)&255,t=t*(2-((e&65535)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t}function en(e){this.m=e,this.mp=e.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function Lg(e){var t=ot();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(R.ZERO)>0&&this.m.subTo(t,t),t}function Pg(e){var t=ot();return e.copyTo(t),this.reduce(t),t}function Dg(e){for(;e.t<=this.mt2;)e.data[e.t++]=0;for(var t=0;t<this.m.t;++t){var r=e.data[t]&32767,n=r*this.mpl+((r*this.mph+(e.data[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e.data[r]+=this.m.am(0,n,e,t,0,this.m.t);e.data[r]>=e.DV;)e.data[r]-=e.DV,e.data[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}function Ng(e,t){e.squareTo(t),this.reduce(t)}function kg(e,t,r){e.multiplyTo(t,r),this.reduce(r)}en.prototype.convert=Lg;en.prototype.revert=Pg;en.prototype.reduce=Dg;en.prototype.mulTo=kg;en.prototype.sqrTo=Ng;function Og(){return(this.t>0?this.data[0]&1:this.s)==0}function Mg(e,t){if(e>4294967295||e<1)return R.ONE;var r=ot(),n=ot(),i=t.convert(this),s=Ks(e)-1;for(i.copyTo(r);--s>=0;)if(t.sqrTo(r,n),(e&1<<s)>0)t.mulTo(n,i,r);else{var o=r;r=n,n=o}return t.revert(r)}function Ug(e,t){var r;return e<256||t.isEven()?r=new tn(t):r=new en(t),this.exp(e,r)}R.prototype.copyTo=ag;R.prototype.fromInt=cg;R.prototype.fromString=ug;R.prototype.clamp=lg;R.prototype.dlShiftTo=yg;R.prototype.drShiftTo=gg;R.prototype.lShiftTo=xg;R.prototype.rShiftTo=Eg;R.prototype.subTo=bg;R.prototype.multiplyTo=wg;R.prototype.squareTo=vg;R.prototype.divRemTo=_g;R.prototype.invDigit=Bg;R.prototype.isEven=Og;R.prototype.exp=Mg;R.prototype.toString=fg;R.prototype.negate=hg;R.prototype.abs=dg;R.prototype.compareTo=pg;R.prototype.bitLength=mg;R.prototype.mod=Sg;R.prototype.modPowInt=Ug;R.ZERO=Ar(0);R.ONE=Ar(1);function Fg(){var e=ot();return this.copyTo(e),e}function Kg(){if(this.s<0){if(this.t==1)return this.data[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this.data[0];if(this.t==0)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]}function Vg(){return this.t==0?this.s:this.data[0]<<24>>24}function qg(){return this.t==0?this.s:this.data[0]<<16>>16}function $g(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function zg(){return this.s<0?-1:this.t<=0||this.t==1&&this.data[0]<=0?0:1}function Hg(e){if(e==null&&(e=10),this.signum()==0||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),n=Ar(r),i=ot(),s=ot(),o="";for(this.divRemTo(n,i,s);i.signum()>0;)o=(r+s.intValue()).toString(e).substr(1)+o,i.divRemTo(n,i,s);return s.intValue().toString(e)+o}function Gg(e,t){this.fromInt(0),t==null&&(t=10);for(var r=this.chunkSize(t),n=Math.pow(t,r),i=!1,s=0,o=0,a=0;a<e.length;++a){var c=s0(e,a);if(c<0){e.charAt(a)=="-"&&this.signum()==0&&(i=!0);continue}o=t*o+c,++s>=r&&(this.dMultiply(n),this.dAddOffset(o,0),s=0,o=0)}s>0&&(this.dMultiply(Math.pow(t,s)),this.dAddOffset(o,0)),i&&R.ZERO.subTo(this,this)}function Yg(e,t,r){if(typeof t=="number")if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(R.ONE.shiftLeft(e-1),Za,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(R.ONE.shiftLeft(e-1),this);else{var n=new Array,i=e&7;n.length=(e>>3)+1,t.nextBytes(n),i>0?n[0]&=(1<<i)-1:n[0]=0,this.fromString(n,256)}}function Wg(){var e=this.t,t=new Array;t[0]=this.s;var r=this.DB-e*this.DB%8,n,i=0;if(e-- >0)for(r<this.DB&&(n=this.data[e]>>r)!=(this.s&this.DM)>>r&&(t[i++]=n|this.s<<this.DB-r);e>=0;)r<8?(n=(this.data[e]&(1<<r)-1)<<8-r,n|=this.data[--e]>>(r+=this.DB-8)):(n=this.data[e]>>(r-=8)&255,r<=0&&(r+=this.DB,--e)),n&128&&(n|=-256),i==0&&(this.s&128)!=(n&128)&&++i,(i>0||n!=this.s)&&(t[i++]=n);return t}function Qg(e){return this.compareTo(e)==0}function Xg(e){return this.compareTo(e)<0?this:e}function Zg(e){return this.compareTo(e)>0?this:e}function Jg(e,t,r){var n,i,s=Math.min(e.t,this.t);for(n=0;n<s;++n)r.data[n]=t(this.data[n],e.data[n]);if(e.t<this.t){for(i=e.s&this.DM,n=s;n<this.t;++n)r.data[n]=t(this.data[n],i);r.t=this.t}else{for(i=this.s&this.DM,n=s;n<e.t;++n)r.data[n]=t(i,e.data[n]);r.t=e.t}r.s=t(this.s,e.s),r.clamp()}function jg(e,t){return e&t}function tx(e){var t=ot();return this.bitwiseTo(e,jg,t),t}function Za(e,t){return e|t}function ex(e){var t=ot();return this.bitwiseTo(e,Za,t),t}function o0(e,t){return e^t}function rx(e){var t=ot();return this.bitwiseTo(e,o0,t),t}function a0(e,t){return e&~t}function nx(e){var t=ot();return this.bitwiseTo(e,a0,t),t}function ix(){for(var e=ot(),t=0;t<this.t;++t)e.data[t]=this.DM&~this.data[t];return e.t=this.t,e.s=~this.s,e}function sx(e){var t=ot();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t}function ox(e){var t=ot();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t}function ax(e){if(e==0)return-1;var t=0;return e&65535||(e>>=16,t+=16),e&255||(e>>=8,t+=8),e&15||(e>>=4,t+=4),e&3||(e>>=2,t+=2),e&1||++t,t}function cx(){for(var e=0;e<this.t;++e)if(this.data[e]!=0)return e*this.DB+ax(this.data[e]);return this.s<0?this.t*this.DB:-1}function ux(e){for(var t=0;e!=0;)e&=e-1,++t;return t}function lx(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=ux(this.data[r]^t);return e}function fx(e){var t=Math.floor(e/this.DB);return t>=this.t?this.s!=0:(this.data[t]&1<<e%this.DB)!=0}function hx(e,t){var r=R.ONE.shiftLeft(e);return this.bitwiseTo(r,t,r),r}function dx(e){return this.changeBit(e,Za)}function px(e){return this.changeBit(e,a0)}function mx(e){return this.changeBit(e,o0)}function yx(e,t){for(var r=0,n=0,i=Math.min(e.t,this.t);r<i;)n+=this.data[r]+e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n+=e.s;r<this.t;)n+=this.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n+=e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=e.s}t.s=n<0?-1:0,n>0?t.data[r++]=n:n<-1&&(t.data[r++]=this.DV+n),t.t=r,t.clamp()}function gx(e){var t=ot();return this.addTo(e,t),t}function xx(e){var t=ot();return this.subTo(e,t),t}function Ex(e){var t=ot();return this.multiplyTo(e,t),t}function bx(e){var t=ot();return this.divRemTo(e,t,null),t}function wx(e){var t=ot();return this.divRemTo(e,null,t),t}function vx(e){var t=ot(),r=ot();return this.divRemTo(e,t,r),new Array(t,r)}function _x(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function Sx(e,t){if(e!=0){for(;this.t<=t;)this.data[this.t++]=0;for(this.data[t]+=e;this.data[t]>=this.DV;)this.data[t]-=this.DV,++t>=this.t&&(this.data[this.t++]=0),++this.data[t]}}function Di(){}function c0(e){return e}function Ax(e,t,r){e.multiplyTo(t,r)}function Ix(e,t){e.squareTo(t)}Di.prototype.convert=c0;Di.prototype.revert=c0;Di.prototype.mulTo=Ax;Di.prototype.sqrTo=Ix;function Rx(e){return this.exp(e,new Di)}function Cx(e,t,r){var n=Math.min(this.t+e.t,t);for(r.s=0,r.t=n;n>0;)r.data[--n]=0;var i;for(i=r.t-this.t;n<i;++n)r.data[n+this.t]=this.am(0,e.data[n],r,n,0,this.t);for(i=Math.min(e.t,t);n<i;++n)this.am(0,e.data[n],r,n,0,t-n);r.clamp()}function Tx(e,t,r){--t;var n=r.t=this.t+e.t-t;for(r.s=0;--n>=0;)r.data[n]=0;for(n=Math.max(t-this.t,0);n<e.t;++n)r.data[this.t+n-t]=this.am(t-n,e.data[n],r,0,0,this.t+n-t);r.clamp(),r.drShiftTo(1,r)}function Fn(e){this.r2=ot(),this.q3=ot(),R.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}function Bx(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=ot();return e.copyTo(t),this.reduce(t),t}function Lx(e){return e}function Px(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)}function Dx(e,t){e.squareTo(t),this.reduce(t)}function Nx(e,t,r){e.multiplyTo(t,r),this.reduce(r)}Fn.prototype.convert=Bx;Fn.prototype.revert=Lx;Fn.prototype.reduce=Px;Fn.prototype.mulTo=Nx;Fn.prototype.sqrTo=Dx;function kx(e,t){var r=e.bitLength(),n,i=Ar(1),s;if(r<=0)return i;r<18?n=1:r<48?n=3:r<144?n=4:r<768?n=5:n=6,r<8?s=new tn(t):t.isEven()?s=new Fn(t):s=new en(t);var o=new Array,a=3,c=n-1,u=(1<<n)-1;if(o[1]=s.convert(this),n>1){var l=ot();for(s.sqrTo(o[1],l);a<=u;)o[a]=ot(),s.mulTo(l,o[a-2],o[a]),a+=2}var f=e.t-1,h,p=!0,d=ot(),m;for(r=Ks(e.data[f])-1;f>=0;){for(r>=c?h=e.data[f]>>r-c&u:(h=(e.data[f]&(1<<r+1)-1)<<c-r,f>0&&(h|=e.data[f-1]>>this.DB+r-c)),a=n;!(h&1);)h>>=1,--a;if((r-=a)<0&&(r+=this.DB,--f),p)o[h].copyTo(i),p=!1;else{for(;a>1;)s.sqrTo(i,d),s.sqrTo(d,i),a-=2;a>0?s.sqrTo(i,d):(m=i,i=d,d=m),s.mulTo(d,o[h],i)}for(;f>=0&&!(e.data[f]&1<<r);)s.sqrTo(i,d),m=i,i=d,d=m,--r<0&&(r=this.DB-1,--f)}return s.revert(i)}function Ox(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var n=t;t=r,r=n}var i=t.getLowestSetBit(),s=r.getLowestSetBit();if(s<0)return t;for(i<s&&(s=i),s>0&&(t.rShiftTo(s,t),r.rShiftTo(s,r));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return s>0&&r.lShiftTo(s,r),r}function Mx(e){if(e<=0)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)if(t==0)r=this.data[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this.data[n])%e;return r}function Ux(e){var t=e.isEven();if(this.isEven()&&t||e.signum()==0)return R.ZERO;for(var r=e.clone(),n=this.clone(),i=Ar(1),s=Ar(0),o=Ar(0),a=Ar(1);r.signum()!=0;){for(;r.isEven();)r.rShiftTo(1,r),t?((!i.isEven()||!s.isEven())&&(i.addTo(this,i),s.subTo(e,s)),i.rShiftTo(1,i)):s.isEven()||s.subTo(e,s),s.rShiftTo(1,s);for(;n.isEven();)n.rShiftTo(1,n),t?((!o.isEven()||!a.isEven())&&(o.addTo(this,o),a.subTo(e,a)),o.rShiftTo(1,o)):a.isEven()||a.subTo(e,a),a.rShiftTo(1,a);r.compareTo(n)>=0?(r.subTo(n,r),t&&i.subTo(o,i),s.subTo(a,s)):(n.subTo(r,n),t&&o.subTo(i,o),a.subTo(s,a))}if(n.compareTo(R.ONE)!=0)return R.ZERO;if(a.compareTo(e)>=0)return a.subtract(e);if(a.signum()<0)a.addTo(e,a);else return a;return a.signum()<0?a.add(e):a}var Pe=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],Fx=(1<<26)/Pe[Pe.length-1];function Kx(e){var t,r=this.abs();if(r.t==1&&r.data[0]<=Pe[Pe.length-1]){for(t=0;t<Pe.length;++t)if(r.data[0]==Pe[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<Pe.length;){for(var n=Pe[t],i=t+1;i<Pe.length&&n<Fx;)n*=Pe[i++];for(n=r.modInt(n);t<i;)if(n%Pe[t++]==0)return!1}return r.millerRabin(e)}function Vx(e){var t=this.subtract(R.ONE),r=t.getLowestSetBit();if(r<=0)return!1;for(var n=t.shiftRight(r),i=qx(),s,o=0;o<e;++o){do s=new R(this.bitLength(),i);while(s.compareTo(R.ONE)<=0||s.compareTo(t)>=0);var a=s.modPow(n,this);if(a.compareTo(R.ONE)!=0&&a.compareTo(t)!=0){for(var c=1;c++<r&&a.compareTo(t)!=0;)if(a=a.modPowInt(2,this),a.compareTo(R.ONE)==0)return!1;if(a.compareTo(t)!=0)return!1}}return!0}function qx(){return{nextBytes:function(e){for(var t=0;t<e.length;++t)e[t]=Math.floor(Math.random()*256)}}}R.prototype.chunkSize=$g;R.prototype.toRadix=Hg;R.prototype.fromRadix=Gg;R.prototype.fromNumber=Yg;R.prototype.bitwiseTo=Jg;R.prototype.changeBit=hx;R.prototype.addTo=yx;R.prototype.dMultiply=_x;R.prototype.dAddOffset=Sx;R.prototype.multiplyLowerTo=Cx;R.prototype.multiplyUpperTo=Tx;R.prototype.modInt=Mx;R.prototype.millerRabin=Vx;R.prototype.clone=Fg;R.prototype.intValue=Kg;R.prototype.byteValue=Vg;R.prototype.shortValue=qg;R.prototype.signum=zg;R.prototype.toByteArray=Wg;R.prototype.equals=Qg;R.prototype.min=Xg;R.prototype.max=Zg;R.prototype.and=tx;R.prototype.or=ex;R.prototype.xor=rx;R.prototype.andNot=nx;R.prototype.not=ix;R.prototype.shiftLeft=sx;R.prototype.shiftRight=ox;R.prototype.getLowestSetBit=cx;R.prototype.bitCount=lx;R.prototype.testBit=fx;R.prototype.setBit=dx;R.prototype.clearBit=px;R.prototype.flipBit=mx;R.prototype.add=gx;R.prototype.subtract=xx;R.prototype.multiply=Ex;R.prototype.divide=bx;R.prototype.remainder=wx;R.prototype.divideAndRemainder=vx;R.prototype.modPow=kx;R.prototype.modInverse=Ux;R.prototype.pow=Rx;R.prototype.gcd=Ox;R.prototype.isProbablePrime=Kx});var p0=V((M_,d0)=>{var ze=ht();jr();Pt();var f0=d0.exports=ze.sha1=ze.sha1||{};ze.md.sha1=ze.md.algorithms.sha1=f0;f0.create=function(){h0||$x();var e=null,t=ze.util.createBuffer(),r=new Array(80),n={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8};return n.start=function(){n.messageLength=0,n.fullMessageLength=n.messageLength64=[];for(var i=n.messageLengthSize/4,s=0;s<i;++s)n.fullMessageLength.push(0);return t=ze.util.createBuffer(),e={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},n},n.start(),n.update=function(i,s){s==="utf8"&&(i=ze.util.encodeUtf8(i));var o=i.length;n.messageLength+=o,o=[o/4294967296>>>0,o>>>0];for(var a=n.fullMessageLength.length-1;a>=0;--a)n.fullMessageLength[a]+=o[1],o[1]=o[0]+(n.fullMessageLength[a]/4294967296>>>0),n.fullMessageLength[a]=n.fullMessageLength[a]>>>0,o[0]=o[1]/4294967296>>>0;return t.putBytes(i),l0(e,r,t),(t.read>2048||t.length()===0)&&t.compact(),n},n.digest=function(){var i=ze.util.createBuffer();i.putBytes(t.bytes());var s=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize,o=s&n.blockLength-1;i.putBytes(Ja.substr(0,n.blockLength-o));for(var a,c,u=n.fullMessageLength[0]*8,l=0;l<n.fullMessageLength.length-1;++l)a=n.fullMessageLength[l+1]*8,c=a/4294967296>>>0,u+=c,i.putInt32(u>>>0),u=a>>>0;i.putInt32(u);var f={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4};l0(f,r,i);var h=ze.util.createBuffer();return h.putInt32(f.h0),h.putInt32(f.h1),h.putInt32(f.h2),h.putInt32(f.h3),h.putInt32(f.h4),h},n};var Ja=null,h0=!1;function $x(){Ja=String.fromCharCode(128),Ja+=ze.util.fillString(String.fromCharCode(0),64),h0=!0}function l0(e,t,r){for(var n,i,s,o,a,c,u,l,f=r.length();f>=64;){for(i=e.h0,s=e.h1,o=e.h2,a=e.h3,c=e.h4,l=0;l<16;++l)n=r.getInt32(),t[l]=n,u=a^s&(o^a),n=(i<<5|i>>>27)+u+c+1518500249+n,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;for(;l<20;++l)n=t[l-3]^t[l-8]^t[l-14]^t[l-16],n=n<<1|n>>>31,t[l]=n,u=a^s&(o^a),n=(i<<5|i>>>27)+u+c+1518500249+n,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;for(;l<32;++l)n=t[l-3]^t[l-8]^t[l-14]^t[l-16],n=n<<1|n>>>31,t[l]=n,u=s^o^a,n=(i<<5|i>>>27)+u+c+1859775393+n,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;for(;l<40;++l)n=t[l-6]^t[l-16]^t[l-28]^t[l-32],n=n<<2|n>>>30,t[l]=n,u=s^o^a,n=(i<<5|i>>>27)+u+c+1859775393+n,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;for(;l<60;++l)n=t[l-6]^t[l-16]^t[l-28]^t[l-32],n=n<<2|n>>>30,t[l]=n,u=s&o|a&(s^o),n=(i<<5|i>>>27)+u+c+2400959708+n,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;for(;l<80;++l)n=t[l-6]^t[l-16]^t[l-28]^t[l-32],n=n<<2|n>>>30,t[l]=n,u=s^o^a,n=(i<<5|i>>>27)+u+c+3395469782+n,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;e.h0=e.h0+i|0,e.h1=e.h1+s|0,e.h2=e.h2+o|0,e.h3=e.h3+a|0,e.h4=e.h4+c|0,f-=64}}});var g0=V((U_,y0)=>{var He=ht();Pt();Pi();p0();var m0=y0.exports=He.pkcs1=He.pkcs1||{};m0.encode_rsa_oaep=function(e,t,r){var n,i,s,o;typeof r=="string"?(n=r,i=arguments[3]||void 0,s=arguments[4]||void 0):r&&(n=r.label||void 0,i=r.seed||void 0,s=r.md||void 0,r.mgf1&&r.mgf1.md&&(o=r.mgf1.md)),s?s.start():s=He.md.sha1.create(),o||(o=s);var a=Math.ceil(e.n.bitLength()/8),c=a-2*s.digestLength-2;if(t.length>c){var u=new Error("RSAES-OAEP input message length is too long.");throw u.length=t.length,u.maxLength=c,u}n||(n=""),s.update(n,"raw");for(var l=s.digest(),f="",h=c-t.length,p=0;p<h;p++)f+="\0";var d=l.getBytes()+f+""+t;if(!i)i=He.random.getBytes(s.digestLength);else if(i.length!==s.digestLength){var u=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.");throw u.seedLength=i.length,u.digestLength=s.digestLength,u}var m=qs(i,a-s.digestLength-1,o),y=He.util.xorBytes(d,m,d.length),g=qs(y,s.digestLength,o),x=He.util.xorBytes(i,g,i.length);return"\0"+x+y};m0.decode_rsa_oaep=function(e,t,r){var n,i,s;typeof r=="string"?(n=r,i=arguments[3]||void 0):r&&(n=r.label||void 0,i=r.md||void 0,r.mgf1&&r.mgf1.md&&(s=r.mgf1.md));var o=Math.ceil(e.n.bitLength()/8);if(t.length!==o){var y=new Error("RSAES-OAEP encoded message length is invalid.");throw y.length=t.length,y.expectedLength=o,y}if(i===void 0?i=He.md.sha1.create():i.start(),s||(s=i),o<2*i.digestLength+2)throw new Error("RSAES-OAEP key is too short for the hash function.");n||(n=""),i.update(n,"raw");for(var a=i.digest().getBytes(),c=t.charAt(0),u=t.substring(1,i.digestLength+1),l=t.substring(1+i.digestLength),f=qs(l,i.digestLength,s),h=He.util.xorBytes(u,f,u.length),p=qs(h,o-i.digestLength-1,s),d=He.util.xorBytes(l,p,l.length),m=d.substring(0,i.digestLength),y=c!=="\0",g=0;g<i.digestLength;++g)y|=a.charAt(g)!==m.charAt(g);for(var x=1,b=i.digestLength,C=i.digestLength;C<d.length;C++){var _=d.charCodeAt(C),S=_&1^1,P=x?65534:0;y|=_&P,x=x&S,b+=x}if(y||d.charCodeAt(b)!==1)throw new Error("Invalid RSAES-OAEP padding.");return d.substring(b+1)};function qs(e,t,r){r||(r=He.md.sha1.create());for(var n="",i=Math.ceil(t/r.digestLength),s=0;s<i;++s){var o=String.fromCharCode(s>>24&255,s>>16&255,s>>8&255,s&255);r.start(),r.update(e+o),n+=r.digest().getBytes()}return n.substring(0,t)}});var x0=V((F_,ja)=>{var Ir=ht();Pt();Vs();Pi();(function(){if(Ir.prime){ja.exports=Ir.prime;return}var e=ja.exports=Ir.prime=Ir.prime||{},t=Ir.jsbn.BigInteger,r=[6,4,2,4,2,4,6,2],n=new t(null);n.fromInt(30);var i=function(f,h){return f|h};e.generateProbablePrime=function(f,h,p){typeof h=="function"&&(p=h,h={}),h=h||{};var d=h.algorithm||"PRIMEINC";typeof d=="string"&&(d={name:d}),d.options=d.options||{};var m=h.prng||Ir.random,y={nextBytes:function(g){for(var x=m.getBytesSync(g.length),b=0;b<g.length;++b)g[b]=x.charCodeAt(b)}};if(d.name==="PRIMEINC")return s(f,y,d.options,p);throw new Error("Invalid prime generation algorithm: "+d.name)};function s(f,h,p,d){return"workers"in p?c(f,h,p,d):o(f,h,p,d)}function o(f,h,p,d){var m=u(f,h),y=0,g=l(m.bitLength());"millerRabinTests"in p&&(g=p.millerRabinTests);var x=10;"maxBlockTime"in p&&(x=p.maxBlockTime),a(m,f,h,y,g,x,d)}function a(f,h,p,d,m,y,g){var x=+new Date;do{if(f.bitLength()>h&&(f=u(h,p)),f.isProbablePrime(m))return g(null,f);f.dAddOffset(r[d++%8],0)}while(y<0||+new Date-x<y);Ir.util.setImmediate(function(){a(f,h,p,d,m,y,g)})}function c(f,h,p,d){if(typeof Worker>"u")return o(f,h,p,d);var m=u(f,h),y=p.workers,g=p.workLoad||100,x=g*30/8,b=p.workerScript||"forge/prime.worker.js";if(y===-1)return Ir.util.estimateCores(function(_,S){_&&(S=2),y=S-1,C()});C();function C(){y=Math.max(1,y);for(var _=[],S=0;S<y;++S)_[S]=new Worker(b);for(var P=y,S=0;S<y;++S)_[S].addEventListener("message",Y);var D=!1;function Y(W){if(!D){--P;var z=W.data;if(z.found){for(var et=0;et<_.length;++et)_[et].terminate();return D=!0,d(null,new t(z.prime,16))}m.bitLength()>f&&(m=u(f,h));var pt=m.toString(16);W.target.postMessage({hex:pt,workLoad:g}),m.dAddOffset(x,0)}}}}function u(f,h){var p=new t(f,h),d=f-1;return p.testBit(d)||p.bitwiseTo(t.ONE.shiftLeft(d),i,p),p.dAddOffset(31-p.mod(n).byteValue(),0),p}function l(f){return f<=100?27:f<=150?18:f<=200?15:f<=250?12:f<=300?9:f<=350?8:f<=400?7:f<=500?6:f<=600?5:f<=800?4:f<=1250?3:2}})()});var zs=V((K_,A0)=>{var $=ht();Bi();Vs();Cs();g0();x0();Pi();Pt();typeof it>"u"&&(it=$.jsbn.BigInteger);var it,tc=$.util.isNodejs?Li():null,v=$.asn1,Ie=$.util;$.pki=$.pki||{};A0.exports=$.pki.rsa=$.rsa=$.rsa||{};var Q=$.pki,zx=[6,4,2,4,2,4,6,2],Hx={name:"PrivateKeyInfo",tagClass:v.Class.UNIVERSAL,type:v.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:v.Class.UNIVERSAL,type:v.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:v.Class.UNIVERSAL,type:v.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:v.Class.UNIVERSAL,type:v.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:v.Class.UNIVERSAL,type:v.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},Gx={name:"RSAPrivateKey",tagClass:v.Class.UNIVERSAL,type:v.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:v.Class.UNIVERSAL,type:v.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:v.Class.UNIVERSAL,type:v.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:v.Class.UNIVERSAL,type:v.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:v.Class.UNIVERSAL,type:v.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:v.Class.UNIVERSAL,type:v.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:v.Class.UNIVERSAL,type:v.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:v.Class.UNIVERSAL,type:v.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:v.Class.UNIVERSAL,type:v.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:v.Class.UNIVERSAL,type:v.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},Yx={name:"RSAPublicKey",tagClass:v.Class.UNIVERSAL,type:v.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:v.Class.UNIVERSAL,type:v.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:v.Class.UNIVERSAL,type:v.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},Wx=$.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:v.Class.UNIVERSAL,type:v.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:v.Class.UNIVERSAL,type:v.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:v.Class.UNIVERSAL,type:v.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:v.Class.UNIVERSAL,type:v.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:v.Class.UNIVERSAL,type:v.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},Qx={name:"DigestInfo",tagClass:v.Class.UNIVERSAL,type:v.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm",tagClass:v.Class.UNIVERSAL,type:v.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm.algorithmIdentifier",tagClass:v.Class.UNIVERSAL,type:v.Type.OID,constructed:!1,capture:"algorithmIdentifier"},{name:"DigestInfo.DigestAlgorithm.parameters",tagClass:v.Class.UNIVERSAL,type:v.Type.NULL,capture:"parameters",optional:!0,constructed:!1}]},{name:"DigestInfo.digest",tagClass:v.Class.UNIVERSAL,type:v.Type.OCTETSTRING,constructed:!1,capture:"digest"}]},Xx=function(e){var t;if(e.algorithm in Q.oids)t=Q.oids[e.algorithm];else{var r=new Error("Unknown message digest algorithm.");throw r.algorithm=e.algorithm,r}var n=v.oidToDer(t).getBytes(),i=v.create(v.Class.UNIVERSAL,v.Type.SEQUENCE,!0,[]),s=v.create(v.Class.UNIVERSAL,v.Type.SEQUENCE,!0,[]);s.value.push(v.create(v.Class.UNIVERSAL,v.Type.OID,!1,n)),s.value.push(v.create(v.Class.UNIVERSAL,v.Type.NULL,!1,""));var o=v.create(v.Class.UNIVERSAL,v.Type.OCTETSTRING,!1,e.digest().getBytes());return i.value.push(s),i.value.push(o),v.toDer(i).getBytes()},_0=function(e,t,r){if(r)return e.modPow(t.e,t.n);if(!t.p||!t.q)return e.modPow(t.d,t.n);t.dP||(t.dP=t.d.mod(t.p.subtract(it.ONE))),t.dQ||(t.dQ=t.d.mod(t.q.subtract(it.ONE))),t.qInv||(t.qInv=t.q.modInverse(t.p));var n;do n=new it($.util.bytesToHex($.random.getBytes(t.n.bitLength()/8)),16);while(n.compareTo(t.n)>=0||!n.gcd(t.n).equals(it.ONE));e=e.multiply(n.modPow(t.e,t.n)).mod(t.n);for(var i=e.mod(t.p).modPow(t.dP,t.p),s=e.mod(t.q).modPow(t.dQ,t.q);i.compareTo(s)<0;)i=i.add(t.p);var o=i.subtract(s).multiply(t.qInv).mod(t.p).multiply(t.q).add(s);return o=o.multiply(n.modInverse(t.n)).mod(t.n),o};Q.rsa.encrypt=function(e,t,r){var n=r,i,s=Math.ceil(t.n.bitLength()/8);r!==!1&&r!==!0?(n=r===2,i=S0(e,t,r)):(i=$.util.createBuffer(),i.putBytes(e));for(var o=new it(i.toHex(),16),a=_0(o,t,n),c=a.toString(16),u=$.util.createBuffer(),l=s-Math.ceil(c.length/2);l>0;)u.putByte(0),--l;return u.putBytes($.util.hexToBytes(c)),u.getBytes()};Q.rsa.decrypt=function(e,t,r,n){var i=Math.ceil(t.n.bitLength()/8);if(e.length!==i){var s=new Error("Encrypted message length is invalid.");throw s.length=e.length,s.expected=i,s}var o=new it($.util.createBuffer(e).toHex(),16);if(o.compareTo(t.n)>=0)throw new Error("Encrypted message is invalid.");for(var a=_0(o,t,r),c=a.toString(16),u=$.util.createBuffer(),l=i-Math.ceil(c.length/2);l>0;)u.putByte(0),--l;return u.putBytes($.util.hexToBytes(c)),n!==!1?$s(u.getBytes(),t,r):u.getBytes()};Q.rsa.createKeyPairGenerationState=function(e,t,r){typeof e=="string"&&(e=parseInt(e,10)),e=e||2048,r=r||{};var n=r.prng||$.random,i={nextBytes:function(a){for(var c=n.getBytesSync(a.length),u=0;u<a.length;++u)a[u]=c.charCodeAt(u)}},s=r.algorithm||"PRIMEINC",o;if(s==="PRIMEINC")o={algorithm:s,state:0,bits:e,rng:i,eInt:t||65537,e:new it(null),p:null,q:null,qBits:e>>1,pBits:e-(e>>1),pqState:0,num:null,keys:null},o.e.fromInt(o.eInt);else throw new Error("Invalid key generation algorithm: "+s);return o};Q.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var r=new it(null);r.fromInt(30);for(var n=0,i=function(f,h){return f|h},s=+new Date,o,a=0;e.keys===null&&(t<=0||a<t);){if(e.state===0){var c=e.p===null?e.pBits:e.qBits,u=c-1;e.pqState===0?(e.num=new it(c,e.rng),e.num.testBit(u)||e.num.bitwiseTo(it.ONE.shiftLeft(u),i,e.num),e.num.dAddOffset(31-e.num.mod(r).byteValue(),0),n=0,++e.pqState):e.pqState===1?e.num.bitLength()>c?e.pqState=0:e.num.isProbablePrime(Jx(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(zx[n++%8],0):e.pqState===2?e.pqState=e.num.subtract(it.ONE).gcd(e.e).compareTo(it.ONE)===0?3:0:e.pqState===3&&(e.pqState=0,e.p===null?e.p=e.num:e.q=e.num,e.p!==null&&e.q!==null&&++e.state,e.num=null)}else if(e.state===1)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(e.state===2)e.p1=e.p.subtract(it.ONE),e.q1=e.q.subtract(it.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(e.state===3)e.phi.gcd(e.e).compareTo(it.ONE)===0?++e.state:(e.p=null,e.q=null,e.state=0);else if(e.state===4)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(e.state===5){var l=e.e.modInverse(e.phi);e.keys={privateKey:Q.rsa.setPrivateKey(e.n,e.e,l,e.p,e.q,l.mod(e.p1),l.mod(e.q1),e.q.modInverse(e.p)),publicKey:Q.rsa.setPublicKey(e.n,e.e)}}o=+new Date,a+=o-s,s=o}return e.keys!==null};Q.rsa.generateKeyPair=function(e,t,r,n){if(arguments.length===1?typeof e=="object"?(r=e,e=void 0):typeof e=="function"&&(n=e,e=void 0):arguments.length===2?typeof e=="number"?typeof t=="function"?(n=t,t=void 0):typeof t!="number"&&(r=t,t=void 0):(r=e,n=t,e=void 0,t=void 0):arguments.length===3&&(typeof t=="number"?typeof r=="function"&&(n=r,r=void 0):(n=r,r=t,t=void 0)),r=r||{},e===void 0&&(e=r.bits||2048),t===void 0&&(t=r.e||65537),!$.options.usePureJavaScript&&!r.prng&&e>=256&&e<=16384&&(t===65537||t===3)){if(n){if(E0("generateKeyPair"))return tc.generateKeyPair("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},function(a,c,u){if(a)return n(a);n(null,{privateKey:Q.privateKeyFromPem(u),publicKey:Q.publicKeyFromPem(c)})});if(b0("generateKey")&&b0("exportKey"))return Ie.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:v0(t),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(a){return Ie.globalScope.crypto.subtle.exportKey("pkcs8",a.privateKey)}).then(void 0,function(a){n(a)}).then(function(a){if(a){var c=Q.privateKeyFromAsn1(v.fromDer($.util.createBuffer(a)));n(null,{privateKey:c,publicKey:Q.setRsaPublicKey(c.n,c.e)})}});if(w0("generateKey")&&w0("exportKey")){var i=Ie.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:v0(t),hash:{name:"SHA-256"}},!0,["sign","verify"]);i.oncomplete=function(a){var c=a.target.result,u=Ie.globalScope.msCrypto.subtle.exportKey("pkcs8",c.privateKey);u.oncomplete=function(l){var f=l.target.result,h=Q.privateKeyFromAsn1(v.fromDer($.util.createBuffer(f)));n(null,{privateKey:h,publicKey:Q.setRsaPublicKey(h.n,h.e)})},u.onerror=function(l){n(l)}},i.onerror=function(a){n(a)};return}}else if(E0("generateKeyPairSync")){var s=tc.generateKeyPairSync("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:Q.privateKeyFromPem(s.privateKey),publicKey:Q.publicKeyFromPem(s.publicKey)}}}var o=Q.rsa.createKeyPairGenerationState(e,t,r);if(!n)return Q.rsa.stepKeyPairGenerationState(o,0),o.keys;Zx(o,r,n)};Q.setRsaPublicKey=Q.rsa.setPublicKey=function(e,t){var r={n:e,e:t};return r.encrypt=function(n,i,s){if(typeof i=="string"?i=i.toUpperCase():i===void 0&&(i="RSAES-PKCS1-V1_5"),i==="RSAES-PKCS1-V1_5")i={encode:function(a,c,u){return S0(a,c,2).getBytes()}};else if(i==="RSA-OAEP"||i==="RSAES-OAEP")i={encode:function(a,c){return $.pkcs1.encode_rsa_oaep(c,a,s)}};else if(["RAW","NONE","NULL",null].indexOf(i)!==-1)i={encode:function(a){return a}};else if(typeof i=="string")throw new Error('Unsupported encryption scheme: "'+i+'".');var o=i.encode(n,r,!0);return Q.rsa.encrypt(o,r,!0)},r.verify=function(n,i,s,o){typeof s=="string"?s=s.toUpperCase():s===void 0&&(s="RSASSA-PKCS1-V1_5"),o===void 0&&(o={_parseAllDigestBytes:!0}),"_parseAllDigestBytes"in o||(o._parseAllDigestBytes=!0),s==="RSASSA-PKCS1-V1_5"?s={verify:function(c,u){u=$s(u,r,!0);var l=v.fromDer(u,{parseAllBytes:o._parseAllDigestBytes}),f={},h=[];if(!v.validate(l,Qx,f,h)){var p=new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value.");throw p.errors=h,p}var d=v.derToOid(f.algorithmIdentifier);if(!(d===$.oids.md2||d===$.oids.md5||d===$.oids.sha1||d===$.oids.sha224||d===$.oids.sha256||d===$.oids.sha384||d===$.oids.sha512||d===$.oids["sha512-224"]||d===$.oids["sha512-256"])){var p=new Error("Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.");throw p.oid=d,p}if((d===$.oids.md2||d===$.oids.md5)&&!("parameters"in f))throw new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value. Missing algorithm identifer NULL parameters.");return c===f.digest}}:(s==="NONE"||s==="NULL"||s===null)&&(s={verify:function(c,u){return u=$s(u,r,!0),c===u}});var a=Q.rsa.decrypt(i,r,!0,!1);return s.verify(n,a,r.n.bitLength())},r};Q.setRsaPrivateKey=Q.rsa.setPrivateKey=function(e,t,r,n,i,s,o,a){var c={n:e,e:t,d:r,p:n,q:i,dP:s,dQ:o,qInv:a};return c.decrypt=function(u,l,f){typeof l=="string"?l=l.toUpperCase():l===void 0&&(l="RSAES-PKCS1-V1_5");var h=Q.rsa.decrypt(u,c,!1,!1);if(l==="RSAES-PKCS1-V1_5")l={decode:$s};else if(l==="RSA-OAEP"||l==="RSAES-OAEP")l={decode:function(p,d){return $.pkcs1.decode_rsa_oaep(d,p,f)}};else if(["RAW","NONE","NULL",null].indexOf(l)!==-1)l={decode:function(p){return p}};else throw new Error('Unsupported encryption scheme: "'+l+'".');return l.decode(h,c,!1)},c.sign=function(u,l){var f=!1;typeof l=="string"&&(l=l.toUpperCase()),l===void 0||l==="RSASSA-PKCS1-V1_5"?(l={encode:Xx},f=1):(l==="NONE"||l==="NULL"||l===null)&&(l={encode:function(){return u}},f=1);var h=l.encode(u,c.n.bitLength());return Q.rsa.encrypt(h,c,f)},c};Q.wrapRsaPrivateKey=function(e){return v.create(v.Class.UNIVERSAL,v.Type.SEQUENCE,!0,[v.create(v.Class.UNIVERSAL,v.Type.INTEGER,!1,v.integerToDer(0).getBytes()),v.create(v.Class.UNIVERSAL,v.Type.SEQUENCE,!0,[v.create(v.Class.UNIVERSAL,v.Type.OID,!1,v.oidToDer(Q.oids.rsaEncryption).getBytes()),v.create(v.Class.UNIVERSAL,v.Type.NULL,!1,"")]),v.create(v.Class.UNIVERSAL,v.Type.OCTETSTRING,!1,v.toDer(e).getBytes())])};Q.privateKeyFromAsn1=function(e){var t={},r=[];if(v.validate(e,Hx,t,r)&&(e=v.fromDer($.util.createBuffer(t.privateKey))),t={},r=[],!v.validate(e,Gx,t,r)){var n=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw n.errors=r,n}var i,s,o,a,c,u,l,f;return i=$.util.createBuffer(t.privateKeyModulus).toHex(),s=$.util.createBuffer(t.privateKeyPublicExponent).toHex(),o=$.util.createBuffer(t.privateKeyPrivateExponent).toHex(),a=$.util.createBuffer(t.privateKeyPrime1).toHex(),c=$.util.createBuffer(t.privateKeyPrime2).toHex(),u=$.util.createBuffer(t.privateKeyExponent1).toHex(),l=$.util.createBuffer(t.privateKeyExponent2).toHex(),f=$.util.createBuffer(t.privateKeyCoefficient).toHex(),Q.setRsaPrivateKey(new it(i,16),new it(s,16),new it(o,16),new it(a,16),new it(c,16),new it(u,16),new it(l,16),new it(f,16))};Q.privateKeyToAsn1=Q.privateKeyToRSAPrivateKey=function(e){return v.create(v.Class.UNIVERSAL,v.Type.SEQUENCE,!0,[v.create(v.Class.UNIVERSAL,v.Type.INTEGER,!1,v.integerToDer(0).getBytes()),v.create(v.Class.UNIVERSAL,v.Type.INTEGER,!1,Ge(e.n)),v.create(v.Class.UNIVERSAL,v.Type.INTEGER,!1,Ge(e.e)),v.create(v.Class.UNIVERSAL,v.Type.INTEGER,!1,Ge(e.d)),v.create(v.Class.UNIVERSAL,v.Type.INTEGER,!1,Ge(e.p)),v.create(v.Class.UNIVERSAL,v.Type.INTEGER,!1,Ge(e.q)),v.create(v.Class.UNIVERSAL,v.Type.INTEGER,!1,Ge(e.dP)),v.create(v.Class.UNIVERSAL,v.Type.INTEGER,!1,Ge(e.dQ)),v.create(v.Class.UNIVERSAL,v.Type.INTEGER,!1,Ge(e.qInv))])};Q.publicKeyFromAsn1=function(e){var t={},r=[];if(v.validate(e,Wx,t,r)){var n=v.derToOid(t.publicKeyOid);if(n!==Q.oids.rsaEncryption){var i=new Error("Cannot read public key. Unknown OID.");throw i.oid=n,i}e=t.rsaPublicKey}if(r=[],!v.validate(e,Yx,t,r)){var i=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw i.errors=r,i}var s=$.util.createBuffer(t.publicKeyModulus).toHex(),o=$.util.createBuffer(t.publicKeyExponent).toHex();return Q.setRsaPublicKey(new it(s,16),new it(o,16))};Q.publicKeyToAsn1=Q.publicKeyToSubjectPublicKeyInfo=function(e){return v.create(v.Class.UNIVERSAL,v.Type.SEQUENCE,!0,[v.create(v.Class.UNIVERSAL,v.Type.SEQUENCE,!0,[v.create(v.Class.UNIVERSAL,v.Type.OID,!1,v.oidToDer(Q.oids.rsaEncryption).getBytes()),v.create(v.Class.UNIVERSAL,v.Type.NULL,!1,"")]),v.create(v.Class.UNIVERSAL,v.Type.BITSTRING,!1,[Q.publicKeyToRSAPublicKey(e)])])};Q.publicKeyToRSAPublicKey=function(e){return v.create(v.Class.UNIVERSAL,v.Type.SEQUENCE,!0,[v.create(v.Class.UNIVERSAL,v.Type.INTEGER,!1,Ge(e.n)),v.create(v.Class.UNIVERSAL,v.Type.INTEGER,!1,Ge(e.e))])};function S0(e,t,r){var n=$.util.createBuffer(),i=Math.ceil(t.n.bitLength()/8);if(e.length>i-11){var s=new Error("Message is too long for PKCS#1 v1.5 padding.");throw s.length=e.length,s.max=i-11,s}n.putByte(0),n.putByte(r);var o=i-3-e.length,a;if(r===0||r===1){a=r===0?0:255;for(var c=0;c<o;++c)n.putByte(a)}else for(;o>0;){for(var u=0,l=$.random.getBytes(o),c=0;c<o;++c)a=l.charCodeAt(c),a===0?++u:n.putByte(a);o=u}return n.putByte(0),n.putBytes(e),n}function $s(e,t,r,n){var i=Math.ceil(t.n.bitLength()/8),s=$.util.createBuffer(e),o=s.getByte(),a=s.getByte();if(o!==0||r&&a!==0&&a!==1||!r&&a!=2||r&&a===0&&typeof n>"u")throw new Error("Encryption block is invalid.");var c=0;if(a===0){c=i-3-n;for(var u=0;u<c;++u)if(s.getByte()!==0)throw new Error("Encryption block is invalid.")}else if(a===1)for(c=0;s.length()>1;){if(s.getByte()!==255){--s.read;break}++c}else if(a===2)for(c=0;s.length()>1;){if(s.getByte()===0){--s.read;break}++c}var l=s.getByte();if(l!==0||c!==i-3-s.length())throw new Error("Encryption block is invalid.");return s.getBytes()}function Zx(e,t,r){typeof t=="function"&&(r=t,t={}),t=t||{};var n={algorithm:{name:t.algorithm||"PRIMEINC",options:{workers:t.workers||2,workLoad:t.workLoad||100,workerScript:t.workerScript}}};"prng"in t&&(n.prng=t.prng),i();function i(){s(e.pBits,function(a,c){if(a)return r(a);if(e.p=c,e.q!==null)return o(a,e.q);s(e.qBits,o)})}function s(a,c){$.prime.generateProbablePrime(a,n,c)}function o(a,c){if(a)return r(a);if(e.q=c,e.p.compareTo(e.q)<0){var u=e.p;e.p=e.q,e.q=u}if(e.p.subtract(it.ONE).gcd(e.e).compareTo(it.ONE)!==0){e.p=null,i();return}if(e.q.subtract(it.ONE).gcd(e.e).compareTo(it.ONE)!==0){e.q=null,s(e.qBits,o);return}if(e.p1=e.p.subtract(it.ONE),e.q1=e.q.subtract(it.ONE),e.phi=e.p1.multiply(e.q1),e.phi.gcd(e.e).compareTo(it.ONE)!==0){e.p=e.q=null,i();return}if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits){e.q=null,s(e.qBits,o);return}var l=e.e.modInverse(e.phi);e.keys={privateKey:Q.rsa.setPrivateKey(e.n,e.e,l,e.p,e.q,l.mod(e.p1),l.mod(e.q1),e.q.modInverse(e.p)),publicKey:Q.rsa.setPublicKey(e.n,e.e)},r(null,e.keys)}}function Ge(e){var t=e.toString(16);t[0]>="8"&&(t="00"+t);var r=$.util.hexToBytes(t);return r.length>1&&(r.charCodeAt(0)===0&&!(r.charCodeAt(1)&128)||r.charCodeAt(0)===255&&(r.charCodeAt(1)&128)===128)?r.substr(1):r}function Jx(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}function E0(e){return $.util.isNodejs&&typeof tc[e]=="function"}function b0(e){return typeof Ie.globalScope<"u"&&typeof Ie.globalScope.crypto=="object"&&typeof Ie.globalScope.crypto.subtle=="object"&&typeof Ie.globalScope.crypto.subtle[e]=="function"}function w0(e){return typeof Ie.globalScope<"u"&&typeof Ie.globalScope.msCrypto=="object"&&typeof Ie.globalScope.msCrypto.subtle=="object"&&typeof Ie.globalScope.msCrypto.subtle[e]=="function"}function v0(e){for(var t=$.util.hexToBytes(e.toString(16)),r=new Uint8Array(t.length),n=0;n<t.length;++n)r[n]=t.charCodeAt(n);return r}});var L0=V((V_,B0)=>{var M=ht();Ds();Bi();Of();jr();Cs();Ha();$f();Pi();e0();zs();Pt();typeof I0>"u"&&(I0=M.jsbn.BigInteger);var I0,A=M.asn1,Z=M.pki=M.pki||{};B0.exports=Z.pbe=M.pbe=M.pbe||{};var rn=Z.oids,jx={name:"EncryptedPrivateKeyInfo",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:A.Class.UNIVERSAL,type:A.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:A.Class.UNIVERSAL,type:A.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},t1={name:"PBES2Algorithms",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:A.Class.UNIVERSAL,type:A.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:A.Class.UNIVERSAL,type:A.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:A.Class.UNIVERSAL,type:A.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:A.Class.UNIVERSAL,type:A.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:A.Class.UNIVERSAL,type:A.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:A.Class.UNIVERSAL,type:A.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:A.Class.UNIVERSAL,type:A.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},e1={name:"pkcs-12PbeParams",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:A.Class.UNIVERSAL,type:A.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:A.Class.UNIVERSAL,type:A.Type.INTEGER,constructed:!1,capture:"iterations"}]};Z.encryptPrivateKeyInfo=function(e,t,r){r=r||{},r.saltSize=r.saltSize||8,r.count=r.count||2048,r.algorithm=r.algorithm||"aes128",r.prfAlgorithm=r.prfAlgorithm||"sha1";var n=M.random.getBytesSync(r.saltSize),i=r.count,s=A.integerToDer(i),o,a,c;if(r.algorithm.indexOf("aes")===0||r.algorithm==="des"){var u,l,f;switch(r.algorithm){case"aes128":o=16,u=16,l=rn["aes128-CBC"],f=M.aes.createEncryptionCipher;break;case"aes192":o=24,u=16,l=rn["aes192-CBC"],f=M.aes.createEncryptionCipher;break;case"aes256":o=32,u=16,l=rn["aes256-CBC"],f=M.aes.createEncryptionCipher;break;case"des":o=8,u=8,l=rn.desCBC,f=M.des.createEncryptionCipher;break;default:var h=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw h.algorithm=r.algorithm,h}var p="hmacWith"+r.prfAlgorithm.toUpperCase(),d=T0(p),m=M.pkcs5.pbkdf2(t,n,i,o,d),y=M.random.getBytesSync(u),g=f(m);g.start(y),g.update(A.toDer(e)),g.finish(),c=g.output.getBytes();var x=r1(n,s,o,p);a=A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[A.create(A.Class.UNIVERSAL,A.Type.OID,!1,A.oidToDer(rn.pkcs5PBES2).getBytes()),A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[A.create(A.Class.UNIVERSAL,A.Type.OID,!1,A.oidToDer(rn.pkcs5PBKDF2).getBytes()),x]),A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[A.create(A.Class.UNIVERSAL,A.Type.OID,!1,A.oidToDer(l).getBytes()),A.create(A.Class.UNIVERSAL,A.Type.OCTETSTRING,!1,y)])])])}else if(r.algorithm==="3des"){o=24;var b=new M.util.ByteBuffer(n),m=Z.pbe.generatePkcs12Key(t,b,1,i,o),y=Z.pbe.generatePkcs12Key(t,b,2,i,o),g=M.des.createEncryptionCipher(m);g.start(y),g.update(A.toDer(e)),g.finish(),c=g.output.getBytes(),a=A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[A.create(A.Class.UNIVERSAL,A.Type.OID,!1,A.oidToDer(rn["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[A.create(A.Class.UNIVERSAL,A.Type.OCTETSTRING,!1,n),A.create(A.Class.UNIVERSAL,A.Type.INTEGER,!1,s.getBytes())])])}else{var h=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw h.algorithm=r.algorithm,h}var C=A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[a,A.create(A.Class.UNIVERSAL,A.Type.OCTETSTRING,!1,c)]);return C};Z.decryptPrivateKeyInfo=function(e,t){var r=null,n={},i=[];if(!A.validate(e,jx,n,i)){var s=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw s.errors=i,s}var o=A.derToOid(n.encryptionOid),a=Z.pbe.getCipher(o,n.encryptionParams,t),c=M.util.createBuffer(n.encryptedData);return a.update(c),a.finish()&&(r=A.fromDer(a.output)),r};Z.encryptedPrivateKeyToPem=function(e,t){var r={type:"ENCRYPTED PRIVATE KEY",body:A.toDer(e).getBytes()};return M.pem.encode(r,{maxline:t})};Z.encryptedPrivateKeyFromPem=function(e){var t=M.pem.decode(e)[0];if(t.type!=="ENCRYPTED PRIVATE KEY"){var r=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw r.headerType=t.type,r}if(t.procType&&t.procType.type==="ENCRYPTED")throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return A.fromDer(t.body)};Z.encryptRsaPrivateKey=function(e,t,r){if(r=r||{},!r.legacy){var n=Z.wrapRsaPrivateKey(Z.privateKeyToAsn1(e));return n=Z.encryptPrivateKeyInfo(n,t,r),Z.encryptedPrivateKeyToPem(n)}var i,s,o,a;switch(r.algorithm){case"aes128":i="AES-128-CBC",o=16,s=M.random.getBytesSync(16),a=M.aes.createEncryptionCipher;break;case"aes192":i="AES-192-CBC",o=24,s=M.random.getBytesSync(16),a=M.aes.createEncryptionCipher;break;case"aes256":i="AES-256-CBC",o=32,s=M.random.getBytesSync(16),a=M.aes.createEncryptionCipher;break;case"3des":i="DES-EDE3-CBC",o=24,s=M.random.getBytesSync(8),a=M.des.createEncryptionCipher;break;case"des":i="DES-CBC",o=8,s=M.random.getBytesSync(8),a=M.des.createEncryptionCipher;break;default:var c=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+r.algorithm+'".');throw c.algorithm=r.algorithm,c}var u=M.pbe.opensslDeriveBytes(t,s.substr(0,8),o),l=a(u);l.start(s),l.update(A.toDer(Z.privateKeyToAsn1(e))),l.finish();var f={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:i,parameters:M.util.bytesToHex(s).toUpperCase()},body:l.output.getBytes()};return M.pem.encode(f)};Z.decryptRsaPrivateKey=function(e,t){var r=null,n=M.pem.decode(e)[0];if(n.type!=="ENCRYPTED PRIVATE KEY"&&n.type!=="PRIVATE KEY"&&n.type!=="RSA PRIVATE KEY"){var i=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".');throw i.headerType=i,i}if(n.procType&&n.procType.type==="ENCRYPTED"){var s,o;switch(n.dekInfo.algorithm){case"DES-CBC":s=8,o=M.des.createDecryptionCipher;break;case"DES-EDE3-CBC":s=24,o=M.des.createDecryptionCipher;break;case"AES-128-CBC":s=16,o=M.aes.createDecryptionCipher;break;case"AES-192-CBC":s=24,o=M.aes.createDecryptionCipher;break;case"AES-256-CBC":s=32,o=M.aes.createDecryptionCipher;break;case"RC2-40-CBC":s=5,o=function(f){return M.rc2.createDecryptionCipher(f,40)};break;case"RC2-64-CBC":s=8,o=function(f){return M.rc2.createDecryptionCipher(f,64)};break;case"RC2-128-CBC":s=16,o=function(f){return M.rc2.createDecryptionCipher(f,128)};break;default:var i=new Error('Could not decrypt private key; unsupported encryption algorithm "'+n.dekInfo.algorithm+'".');throw i.algorithm=n.dekInfo.algorithm,i}var a=M.util.hexToBytes(n.dekInfo.parameters),c=M.pbe.opensslDeriveBytes(t,a.substr(0,8),s),u=o(c);if(u.start(a),u.update(M.util.createBuffer(n.body)),u.finish())r=u.output.getBytes();else return r}else r=n.body;return n.type==="ENCRYPTED PRIVATE KEY"?r=Z.decryptPrivateKeyInfo(A.fromDer(r),t):r=A.fromDer(r),r!==null&&(r=Z.privateKeyFromAsn1(r)),r};Z.pbe.generatePkcs12Key=function(e,t,r,n,i,s){var o,a;if(typeof s>"u"||s===null){if(!("sha1"in M.md))throw new Error('"sha1" hash algorithm unavailable.');s=M.md.sha1.create()}var c=s.digestLength,u=s.blockLength,l=new M.util.ByteBuffer,f=new M.util.ByteBuffer;if(e!=null){for(a=0;a<e.length;a++)f.putInt16(e.charCodeAt(a));f.putInt16(0)}var h=f.length(),p=t.length(),d=new M.util.ByteBuffer;d.fillWithByte(r,u);var m=u*Math.ceil(p/u),y=new M.util.ByteBuffer;for(a=0;a<m;a++)y.putByte(t.at(a%p));var g=u*Math.ceil(h/u),x=new M.util.ByteBuffer;for(a=0;a<g;a++)x.putByte(f.at(a%h));var b=y;b.putBuffer(x);for(var C=Math.ceil(i/c),_=1;_<=C;_++){var S=new M.util.ByteBuffer;S.putBytes(d.bytes()),S.putBytes(b.bytes());for(var P=0;P<n;P++)s.start(),s.update(S.getBytes()),S=s.digest();var D=new M.util.ByteBuffer;for(a=0;a<u;a++)D.putByte(S.at(a%c));var Y=Math.ceil(p/u)+Math.ceil(h/u),W=new M.util.ByteBuffer;for(o=0;o<Y;o++){var z=new M.util.ByteBuffer(b.getBytes(u)),et=511;for(a=D.length()-1;a>=0;a--)et=et>>8,et+=D.at(a)+z.at(a),z.setAt(a,et&255);W.putBuffer(z)}b=W,l.putBuffer(S)}return l.truncate(l.length()-i),l};Z.pbe.getCipher=function(e,t,r){switch(e){case Z.oids.pkcs5PBES2:return Z.pbe.getCipherForPBES2(e,t,r);case Z.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case Z.oids["pbewithSHAAnd40BitRC2-CBC"]:return Z.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}};Z.pbe.getCipherForPBES2=function(e,t,r){var n={},i=[];if(!A.validate(t,t1,n,i)){var s=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw s.errors=i,s}if(e=A.derToOid(n.kdfOid),e!==Z.oids.pkcs5PBKDF2){var s=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw s.oid=e,s.supportedOids=["pkcs5PBKDF2"],s}if(e=A.derToOid(n.encOid),e!==Z.oids["aes128-CBC"]&&e!==Z.oids["aes192-CBC"]&&e!==Z.oids["aes256-CBC"]&&e!==Z.oids["des-EDE3-CBC"]&&e!==Z.oids.desCBC){var s=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw s.oid=e,s.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],s}var o=n.kdfSalt,a=M.util.createBuffer(n.kdfIterationCount);a=a.getInt(a.length()<<3);var c,u;switch(Z.oids[e]){case"aes128-CBC":c=16,u=M.aes.createDecryptionCipher;break;case"aes192-CBC":c=24,u=M.aes.createDecryptionCipher;break;case"aes256-CBC":c=32,u=M.aes.createDecryptionCipher;break;case"des-EDE3-CBC":c=24,u=M.des.createDecryptionCipher;break;case"desCBC":c=8,u=M.des.createDecryptionCipher;break}var l=C0(n.prfOid),f=M.pkcs5.pbkdf2(r,o,a,c,l),h=n.encIv,p=u(f);return p.start(h),p};Z.pbe.getCipherForPKCS12PBE=function(e,t,r){var n={},i=[];if(!A.validate(t,e1,n,i)){var s=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw s.errors=i,s}var o=M.util.createBuffer(n.salt),a=M.util.createBuffer(n.iterations);a=a.getInt(a.length()<<3);var c,u,l;switch(e){case Z.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:c=24,u=8,l=M.des.startDecrypting;break;case Z.oids["pbewithSHAAnd40BitRC2-CBC"]:c=5,u=8,l=function(m,y){var g=M.rc2.createDecryptionCipher(m,40);return g.start(y,null),g};break;default:var s=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw s.oid=e,s}var f=C0(n.prfOid),h=Z.pbe.generatePkcs12Key(r,o,1,a,c,f);f.start();var p=Z.pbe.generatePkcs12Key(r,o,2,a,u,f);return l(h,p)};Z.pbe.opensslDeriveBytes=function(e,t,r,n){if(typeof n>"u"||n===null){if(!("md5"in M.md))throw new Error('"md5" hash algorithm unavailable.');n=M.md.md5.create()}t===null&&(t="");for(var i=[R0(n,e+t)],s=16,o=1;s<r;++o,s+=16)i.push(R0(n,i[o-1]+e+t));return i.join("").substr(0,r)};function R0(e,t){return e.start().update(t).digest().getBytes()}function C0(e){var t;if(!e)t="hmacWithSHA1";else if(t=Z.oids[A.derToOid(e)],!t){var r=new Error("Unsupported PRF OID.");throw r.oid=e,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}return T0(t)}function T0(e){var t=M.md;switch(e){case"hmacWithSHA224":t=M.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":e=e.substr(8).toLowerCase();break;default:var r=new Error("Unsupported PRF algorithm.");throw r.algorithm=e,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}if(!t||!(e in t))throw new Error("Unknown hash algorithm: "+e);return t[e].create()}function r1(e,t,r,n){var i=A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[A.create(A.Class.UNIVERSAL,A.Type.OCTETSTRING,!1,e),A.create(A.Class.UNIVERSAL,A.Type.INTEGER,!1,t.getBytes())]);return n!=="hmacWithSHA1"&&i.value.push(A.create(A.Class.UNIVERSAL,A.Type.INTEGER,!1,M.util.hexToBytes(r.toString(16))),A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[A.create(A.Class.UNIVERSAL,A.Type.OID,!1,A.oidToDer(Z.oids[n]).getBytes()),A.create(A.Class.UNIVERSAL,A.Type.NULL,!1,"")])),i}});var Fh=V((VI,Uh)=>{var wt=ht();jr();Pt();var zi=Uh.exports=wt.sha512=wt.sha512||{};wt.md.sha512=wt.md.algorithms.sha512=zi;var Oh=wt.sha384=wt.sha512.sha384=wt.sha512.sha384||{};Oh.create=function(){return zi.create("SHA-384")};wt.md.sha384=wt.md.algorithms.sha384=Oh;wt.sha512.sha256=wt.sha512.sha256||{create:function(){return zi.create("SHA-512/256")}};wt.md["sha512/256"]=wt.md.algorithms["sha512/256"]=wt.sha512.sha256;wt.sha512.sha224=wt.sha512.sha224||{create:function(){return zi.create("SHA-512/224")}};wt.md["sha512/224"]=wt.md.algorithms["sha512/224"]=wt.sha512.sha224;zi.create=function(e){if(Mh||SE(),typeof e>"u"&&(e="SHA-512"),!(e in pn))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=pn[e],r=null,n=wt.util.createBuffer(),i=new Array(80),s=0;s<80;++s)i[s]=new Array(2);var o=64;switch(e){case"SHA-384":o=48;break;case"SHA-512/256":o=32;break;case"SHA-512/224":o=28;break}var a={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:o,messageLength:0,fullMessageLength:null,messageLengthSize:16};return a.start=function(){a.messageLength=0,a.fullMessageLength=a.messageLength128=[];for(var c=a.messageLengthSize/4,u=0;u<c;++u)a.fullMessageLength.push(0);n=wt.util.createBuffer(),r=new Array(t.length);for(var u=0;u<t.length;++u)r[u]=t[u].slice(0);return a},a.start(),a.update=function(c,u){u==="utf8"&&(c=wt.util.encodeUtf8(c));var l=c.length;a.messageLength+=l,l=[l/4294967296>>>0,l>>>0];for(var f=a.fullMessageLength.length-1;f>=0;--f)a.fullMessageLength[f]+=l[1],l[1]=l[0]+(a.fullMessageLength[f]/4294967296>>>0),a.fullMessageLength[f]=a.fullMessageLength[f]>>>0,l[0]=l[1]/4294967296>>>0;return n.putBytes(c),kh(r,i,n),(n.read>2048||n.length()===0)&&n.compact(),a},a.digest=function(){var c=wt.util.createBuffer();c.putBytes(n.bytes());var u=a.fullMessageLength[a.fullMessageLength.length-1]+a.messageLengthSize,l=u&a.blockLength-1;c.putBytes(tu.substr(0,a.blockLength-l));for(var f,h,p=a.fullMessageLength[0]*8,d=0;d<a.fullMessageLength.length-1;++d)f=a.fullMessageLength[d+1]*8,h=f/4294967296>>>0,p+=h,c.putInt32(p>>>0),p=f>>>0;c.putInt32(p);for(var m=new Array(r.length),d=0;d<r.length;++d)m[d]=r[d].slice(0);kh(m,i,c);var y=wt.util.createBuffer(),g;e==="SHA-512"?g=m.length:e==="SHA-384"?g=m.length-2:g=m.length-4;for(var d=0;d<g;++d)y.putInt32(m[d][0]),(d!==g-1||e!=="SHA-512/224")&&y.putInt32(m[d][1]);return y},a};var tu=null,Mh=!1,eu=null,pn=null;function SE(){tu=String.fromCharCode(128),tu+=wt.util.fillString(String.fromCharCode(0),128),eu=[[1116352408,3609767458],[1899447441,602891725],[3049323471,3964484399],[3921009573,2173295548],[961987163,4081628472],[1508970993,3053834265],[2453635748,2937671579],[2870763221,3664609560],[3624381080,2734883394],[310598401,1164996542],[607225278,1323610764],[1426881987,3590304994],[1925078388,4068182383],[2162078206,991336113],[2614888103,633803317],[3248222580,3479774868],[3835390401,2666613458],[4022224774,944711139],[264347078,2341262773],[604807628,2007800933],[770255983,1495990901],[1249150122,1856431235],[1555081692,3175218132],[1996064986,2198950837],[2554220882,3999719339],[2821834349,766784016],[2952996808,2566594879],[3210313671,3203337956],[3336571891,1034457026],[3584528711,2466948901],[113926993,3758326383],[338241895,168717936],[666307205,1188179964],[773529912,1546045734],[1294757372,1522805485],[1396182291,2643833823],[1695183700,2343527390],[1986661051,1014477480],[2177026350,1206759142],[2456956037,344077627],[2730485921,1290863460],[2820302411,3158454273],[3259730800,3505952657],[3345764771,106217008],[3516065817,3606008344],[3600352804,1432725776],[4094571909,1467031594],[275423344,851169720],[430227734,3100823752],[506948616,1363258195],[659060556,3750685593],[883997877,3785050280],[958139571,3318307427],[1322822218,3812723403],[1537002063,2003034995],[1747873779,3602036899],[1955562222,1575990012],[2024104815,1125592928],[2227730452,2716904306],[2361852424,442776044],[2428436474,593698344],[2756734187,3733110249],[3204031479,2999351573],[3329325298,3815920427],[3391569614,3928383900],[3515267271,566280711],[3940187606,3454069534],[4118630271,4000239992],[116418474,1914138554],[174292421,2731055270],[289380356,3203993006],[460393269,320620315],[685471733,587496836],[852142971,1086792851],[1017036298,365543100],[1126000580,2618297676],[1288033470,3409855158],[1501505948,4234509866],[1607167915,987167468],[1816402316,1246189591]],pn={},pn["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],pn["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],pn["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],pn["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],Mh=!0}function kh(e,t,r){for(var n,i,s,o,a,c,u,l,f,h,p,d,m,y,g,x,b,C,_,S,P,D,Y,W,z,et,pt,Qt,T,k,L,N,I,U,q,G=r.length();G>=128;){for(T=0;T<16;++T)t[T][0]=r.getInt32()>>>0,t[T][1]=r.getInt32()>>>0;for(;T<80;++T)N=t[T-2],k=N[0],L=N[1],n=((k>>>19|L<<13)^(L>>>29|k<<3)^k>>>6)>>>0,i=((k<<13|L>>>19)^(L<<3|k>>>29)^(k<<26|L>>>6))>>>0,U=t[T-15],k=U[0],L=U[1],s=((k>>>1|L<<31)^(k>>>8|L<<24)^k>>>7)>>>0,o=((k<<31|L>>>1)^(k<<24|L>>>8)^(k<<25|L>>>7))>>>0,I=t[T-7],q=t[T-16],L=i+I[1]+o+q[1],t[T][0]=n+I[0]+s+q[0]+(L/4294967296>>>0)>>>0,t[T][1]=L>>>0;for(m=e[0][0],y=e[0][1],g=e[1][0],x=e[1][1],b=e[2][0],C=e[2][1],_=e[3][0],S=e[3][1],P=e[4][0],D=e[4][1],Y=e[5][0],W=e[5][1],z=e[6][0],et=e[6][1],pt=e[7][0],Qt=e[7][1],T=0;T<80;++T)u=((P>>>14|D<<18)^(P>>>18|D<<14)^(D>>>9|P<<23))>>>0,l=((P<<18|D>>>14)^(P<<14|D>>>18)^(D<<23|P>>>9))>>>0,f=(z^P&(Y^z))>>>0,h=(et^D&(W^et))>>>0,a=((m>>>28|y<<4)^(y>>>2|m<<30)^(y>>>7|m<<25))>>>0,c=((m<<4|y>>>28)^(y<<30|m>>>2)^(y<<25|m>>>7))>>>0,p=(m&g|b&(m^g))>>>0,d=(y&x|C&(y^x))>>>0,L=Qt+l+h+eu[T][1]+t[T][1],n=pt+u+f+eu[T][0]+t[T][0]+(L/4294967296>>>0)>>>0,i=L>>>0,L=c+d,s=a+p+(L/4294967296>>>0)>>>0,o=L>>>0,pt=z,Qt=et,z=Y,et=W,Y=P,W=D,L=S+i,P=_+n+(L/4294967296>>>0)>>>0,D=L>>>0,_=b,S=C,b=g,C=x,g=m,x=y,L=i+o,m=n+s+(L/4294967296>>>0)>>>0,y=L>>>0;L=e[0][1]+y,e[0][0]=e[0][0]+m+(L/4294967296>>>0)>>>0,e[0][1]=L>>>0,L=e[1][1]+x,e[1][0]=e[1][0]+g+(L/4294967296>>>0)>>>0,e[1][1]=L>>>0,L=e[2][1]+C,e[2][0]=e[2][0]+b+(L/4294967296>>>0)>>>0,e[2][1]=L>>>0,L=e[3][1]+S,e[3][0]=e[3][0]+_+(L/4294967296>>>0)>>>0,e[3][1]=L>>>0,L=e[4][1]+D,e[4][0]=e[4][0]+P+(L/4294967296>>>0)>>>0,e[4][1]=L>>>0,L=e[5][1]+W,e[5][0]=e[5][0]+Y+(L/4294967296>>>0)>>>0,e[5][1]=L>>>0,L=e[6][1]+et,e[6][0]=e[6][0]+z+(L/4294967296>>>0)>>>0,e[6][1]=L>>>0,L=e[7][1]+Qt,e[7][0]=e[7][0]+pt+(L/4294967296>>>0)>>>0,e[7][1]=L>>>0,G-=128}}});var xu=V((x4,pd)=>{var ri=1e3,ni=ri*60,ii=ni*60,xn=ii*24,tb=xn*7,eb=xn*365.25;pd.exports=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0)return rb(e);if(r==="number"&&isFinite(e))return t.long?ib(e):nb(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function rb(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\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(t){var r=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*eb;case"weeks":case"week":case"w":return r*tb;case"days":case"day":case"d":return r*xn;case"hours":case"hour":case"hrs":case"hr":case"h":return r*ii;case"minutes":case"minute":case"mins":case"min":case"m":return r*ni;case"seconds":case"second":case"secs":case"sec":case"s":return r*ri;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function nb(e){var t=Math.abs(e);return t>=xn?Math.round(e/xn)+"d":t>=ii?Math.round(e/ii)+"h":t>=ni?Math.round(e/ni)+"m":t>=ri?Math.round(e/ri)+"s":e+"ms"}function ib(e){var t=Math.abs(e);return t>=xn?yo(e,t,xn,"day"):t>=ii?yo(e,t,ii,"hour"):t>=ni?yo(e,t,ni,"minute"):t>=ri?yo(e,t,ri,"second"):e+" ms"}function yo(e,t,r,n){var i=t>=r*1.5;return Math.round(e/r)+" "+n+(i?"s":"")}});var yd=V((E4,md)=>{function sb(e){r.debug=r,r.default=r,r.coerce=c,r.disable=s,r.enable=i,r.enabled=o,r.humanize=xu(),r.destroy=u,Object.keys(e).forEach(l=>{r[l]=e[l]}),r.names=[],r.skips=[],r.formatters={};function t(l){let f=0;for(let h=0;h<l.length;h++)f=(f<<5)-f+l.charCodeAt(h),f|=0;return r.colors[Math.abs(f)%r.colors.length]}r.selectColor=t;function r(l){let f,h=null,p,d;function m(...y){if(!m.enabled)return;let g=m,x=Number(new Date),b=x-(f||x);g.diff=b,g.prev=f,g.curr=x,f=x,y[0]=r.coerce(y[0]),typeof y[0]!="string"&&y.unshift("%O");let C=0;y[0]=y[0].replace(/%([a-zA-Z%])/g,(S,P)=>{if(S==="%%")return"%";C++;let D=r.formatters[P];if(typeof D=="function"){let Y=y[C];S=D.call(g,Y),y.splice(C,1),C--}return S}),r.formatArgs.call(g,y),(g.log||r.log).apply(g,y)}return m.namespace=l,m.useColors=r.useColors(),m.color=r.selectColor(l),m.extend=n,m.destroy=r.destroy,Object.defineProperty(m,"enabled",{enumerable:!0,configurable:!1,get:()=>h!==null?h:(p!==r.namespaces&&(p=r.namespaces,d=r.enabled(l)),d),set:y=>{h=y}}),typeof r.init=="function"&&r.init(m),m}function n(l,f){let h=r(this.namespace+(typeof f>"u"?":":f)+l);return h.log=this.log,h}function i(l){r.save(l),r.namespaces=l,r.names=[],r.skips=[];let f,h=(typeof l=="string"?l:"").split(/[\s,]+/),p=h.length;for(f=0;f<p;f++)h[f]&&(l=h[f].replace(/\*/g,".*?"),l[0]==="-"?r.skips.push(new RegExp("^"+l.slice(1)+"$")):r.names.push(new RegExp("^"+l+"$")))}function s(){let l=[...r.names.map(a),...r.skips.map(a).map(f=>"-"+f)].join(",");return r.enable(""),l}function o(l){if(l[l.length-1]==="*")return!0;let f,h;for(f=0,h=r.skips.length;f<h;f++)if(r.skips[f].test(l))return!1;for(f=0,h=r.names.length;f<h;f++)if(r.names[f].test(l))return!0;return!1}function a(l){return l.toString().substring(2,l.toString().length-2).replace(/\.\*\?$/,"*")}function c(l){return l instanceof Error?l.stack||l.message:l}function u(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}md.exports=sb});var Eu=V((Ee,go)=>{Ee.formatArgs=ab;Ee.save=cb;Ee.load=ub;Ee.useColors=ob;Ee.storage=lb();Ee.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();Ee.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function ob(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function ab(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+go.exports.humanize(this.diff),!this.useColors)return;let t="color: "+this.color;e.splice(1,0,t,"color: inherit");let r=0,n=0;e[0].replace(/%[a-zA-Z%]/g,i=>{i!=="%%"&&(r++,i==="%c"&&(n=r))}),e.splice(n,0,t)}Ee.log=console.debug||console.log||(()=>{});function cb(e){try{e?Ee.storage.setItem("debug",e):Ee.storage.removeItem("debug")}catch{}}function ub(){let e;try{e=Ee.storage.getItem("debug")}catch{}return!e&&typeof process<"u"&&"env"in process&&(e=process.env.DEBUG),e}function lb(){try{return localStorage}catch{}}go.exports=yd()(Ee);var{formatters:fb}=go.exports;fb.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var vd=V((q4,wd)=>{"use strict";wd.exports=e=>{if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}});var Cd=V((Id,Rd)=>{"use strict";var vo=vd(),{hasOwnProperty:Sd}=Object.prototype,{propertyIsEnumerable:xb}=Object,ai=(e,t,r)=>Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0}),Eb=Id,_d={concatArrays:!1,ignoreUndefined:!1},_o=e=>{let t=[];for(let r in e)Sd.call(e,r)&&t.push(r);if(Object.getOwnPropertySymbols){let r=Object.getOwnPropertySymbols(e);for(let n of r)xb.call(e,n)&&t.push(n)}return t};function ci(e){return Array.isArray(e)?bb(e):vo(e)?wb(e):e}function bb(e){let t=e.slice(0,0);return _o(e).forEach(r=>{ai(t,r,ci(e[r]))}),t}function wb(e){let t=Object.getPrototypeOf(e)===null?Object.create(null):{};return _o(e).forEach(r=>{ai(t,r,ci(e[r]))}),t}var Ad=(e,t,r,n)=>(r.forEach(i=>{typeof t[i]>"u"&&n.ignoreUndefined||(i in e&&e[i]!==Object.getPrototypeOf(e)?ai(e,i,_u(e[i],t[i],n)):ai(e,i,ci(t[i])))}),e),vb=(e,t,r)=>{let n=e.slice(0,0),i=0;return[e,t].forEach(s=>{let o=[];for(let a=0;a<s.length;a++)Sd.call(s,a)&&(o.push(String(a)),s===e?ai(n,i++,s[a]):ai(n,i++,ci(s[a])));n=Ad(n,s,_o(s).filter(a=>!o.includes(a)),r)}),n};function _u(e,t,r){return r.concatArrays&&Array.isArray(e)&&Array.isArray(t)?vb(e,t,r):!vo(t)||!vo(e)?ci(t):Ad(e,t,_o(t),r)}Rd.exports=function(...e){let t=_u(ci(_d),this!==Eb&&this||{},_d),r={_:{}};for(let n of e)if(n!==void 0){if(!vo(n))throw new TypeError("`"+n+"` is not an Option Object");r=_u(r,{_:n},t)}return r._}});var Ld=V((z4,Bd)=>{"use strict";function _b(e){return e>=55296&&e<=56319}function Sb(e){return e>=56320&&e<=57343}Bd.exports=function(t,r,n){if(typeof r!="string")throw new Error("Input must be string");for(var i=r.length,s=0,o,a,c=0;c<i;c+=1){if(o=r.charCodeAt(c),a=r[c],_b(o)&&Sb(r.charCodeAt(c+1))&&(c+=1,a+=r[c]),s+=t(a),s===n)return r.slice(0,c+1);if(s>n)return r.slice(0,c-a.length+1)}return r}});var Dd=V((H4,Pd)=>{"use strict";function Ab(e){return e>=55296&&e<=56319}function Ib(e){return e>=56320&&e<=57343}Pd.exports=function(t){if(typeof t!="string")throw new Error("Input must be string");for(var r=t.length,n=0,i=null,s=null,o=0;o<r;o++)i=t.charCodeAt(o),Ib(i)?s!=null&&Ab(s)?n+=1:n+=3:i<=127?n+=1:i>=128&&i<=2047?n+=2:i>=2048&&i<=65535&&(n+=3),s=i;return n}});var kd=V((G4,Nd)=>{"use strict";var Rb=Ld(),Cb=Dd();Nd.exports=Rb.bind(null,Cb)});var Ud=V((Y4,Md)=>{"use strict";var Tb=kd(),Bb=/[\/\?<>\\:\*\|"]/g,Lb=/[\x00-\x1f\x80-\x9f]/g,Pb=/^\.+$/,Db=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i,Nb=/[\. ]+$/;function Od(e,t){if(typeof e!="string")throw new Error("Input must be string");var r=e.replace(Bb,t).replace(Lb,t).replace(Pb,t).replace(Db,t).replace(Nb,t);return Tb(r,255)}Md.exports=function(e,t){var r=t&&t.replacement||"",n=Od(e,r);return r===""?n:Od(n,"")}});var up=V((ST,$u)=>{"use strict";var hw=Object.prototype.hasOwnProperty,le="~";function ss(){}Object.create&&(ss.prototype=Object.create(null),new ss().__proto__||(le=!1));function dw(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function cp(e,t,r,n,i){if(typeof r!="function")throw new TypeError("The listener must be a function");var s=new dw(r,n||e,i),o=le?le+t:t;return e._events[o]?e._events[o].fn?e._events[o]=[e._events[o],s]:e._events[o].push(s):(e._events[o]=s,e._eventsCount++),e}function Po(e,t){--e._eventsCount===0?e._events=new ss:delete e._events[t]}function ae(){this._events=new ss,this._eventsCount=0}ae.prototype.eventNames=function(){var t=[],r,n;if(this._eventsCount===0)return t;for(n in r=this._events)hw.call(r,n)&&t.push(le?n.slice(1):n);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(r)):t};ae.prototype.listeners=function(t){var r=le?le+t:t,n=this._events[r];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,s=n.length,o=new Array(s);i<s;i++)o[i]=n[i].fn;return o};ae.prototype.listenerCount=function(t){var r=le?le+t:t,n=this._events[r];return n?n.fn?1:n.length:0};ae.prototype.emit=function(t,r,n,i,s,o){var a=le?le+t:t;if(!this._events[a])return!1;var c=this._events[a],u=arguments.length,l,f;if(c.fn){switch(c.once&&this.removeListener(t,c.fn,void 0,!0),u){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,r),!0;case 3:return c.fn.call(c.context,r,n),!0;case 4:return c.fn.call(c.context,r,n,i),!0;case 5:return c.fn.call(c.context,r,n,i,s),!0;case 6:return c.fn.call(c.context,r,n,i,s,o),!0}for(f=1,l=new Array(u-1);f<u;f++)l[f-1]=arguments[f];c.fn.apply(c.context,l)}else{var h=c.length,p;for(f=0;f<h;f++)switch(c[f].once&&this.removeListener(t,c[f].fn,void 0,!0),u){case 1:c[f].fn.call(c[f].context);break;case 2:c[f].fn.call(c[f].context,r);break;case 3:c[f].fn.call(c[f].context,r,n);break;case 4:c[f].fn.call(c[f].context,r,n,i);break;default:if(!l)for(p=1,l=new Array(u-1);p<u;p++)l[p-1]=arguments[p];c[f].fn.apply(c[f].context,l)}}return!0};ae.prototype.on=function(t,r,n){return cp(this,t,r,n,!1)};ae.prototype.once=function(t,r,n){return cp(this,t,r,n,!0)};ae.prototype.removeListener=function(t,r,n,i){var s=le?le+t:t;if(!this._events[s])return this;if(!r)return Po(this,s),this;var o=this._events[s];if(o.fn)o.fn===r&&(!i||o.once)&&(!n||o.context===n)&&Po(this,s);else{for(var a=0,c=[],u=o.length;a<u;a++)(o[a].fn!==r||i&&!o[a].once||n&&o[a].context!==n)&&c.push(o[a]);c.length?this._events[s]=c.length===1?c[0]:c:Po(this,s)}return this};ae.prototype.removeAllListeners=function(t){var r;return t?(r=le?le+t:t,this._events[r]&&Po(this,r)):(this._events=new ss,this._eventsCount=0),this};ae.prototype.off=ae.prototype.removeListener;ae.prototype.addListener=ae.prototype.on;ae.prefixed=le;ae.EventEmitter=ae;typeof $u<"u"&&($u.exports=ae)});var pl=V((V3,Tp)=>{"use strict";function Cp(e,t){for(let r in t)Object.defineProperty(e,r,{value:t[r],enumerable:!0,configurable:!0});return e}function Rw(e,t,r){if(!e||typeof e=="string")throw new TypeError("Please pass an Error to err-code");r||(r={}),typeof t=="object"&&(r=t,t=""),t&&(r.code=t);try{return Cp(e,r)}catch{r.message=e.message,r.stack=e.stack;let i=function(){};return i.prototype=Object.create(Object.getPrototypeOf(e)),Cp(new i,r)}}Tp.exports=Rw});var kp=V(hs=>{(function(){var e,t,r,n,i,s,o,a;a=function(c){var u,l,f,h;return u=(c&255<<24)>>>24,l=(c&255<<16)>>>16,f=(c&65280)>>>8,h=c&255,[u,l,f,h].join(".")},o=function(c){var u,l,f,h,p,d;for(u=[],f=h=0;h<=3&&c.length!==0;f=++h){if(f>0){if(c[0]!==".")throw new Error("Invalid IP");c=c.substring(1)}d=t(c),p=d[0],l=d[1],c=c.substring(l),u.push(p)}if(c.length!==0)throw new Error("Invalid IP");switch(u.length){case 1:if(u[0]>4294967295)throw new Error("Invalid IP");return u[0]>>>0;case 2:if(u[0]>255||u[1]>16777215)throw new Error("Invalid IP");return(u[0]<<24|u[1])>>>0;case 3:if(u[0]>255||u[1]>255||u[2]>65535)throw new Error("Invalid IP");return(u[0]<<24|u[1]<<16|u[2])>>>0;case 4:if(u[0]>255||u[1]>255||u[2]>255||u[3]>255)throw new Error("Invalid IP");return(u[0]<<24|u[1]<<16|u[2]<<8|u[3])>>>0;default:throw new Error("Invalid IP")}},r=function(c){return c.charCodeAt(0)},n=r("0"),s=r("a"),i=r("A"),t=function(c){var u,l,f,h,p;for(h=0,u=10,l="9",f=0,c.length>1&&c[f]==="0"&&(c[f+1]==="x"||c[f+1]==="X"?(f+=2,u=16):"0"<=c[f+1]&&c[f+1]<="9"&&(f++,u=8,l="7")),p=f;f<c.length;){if("0"<=c[f]&&c[f]<=l)h=h*u+(r(c[f])-n)>>>0;else if(u===16)if("a"<=c[f]&&c[f]<="f")h=h*u+(10+r(c[f])-s)>>>0;else if("A"<=c[f]&&c[f]<="F")h=h*u+(10+r(c[f])-i)>>>0;else break;else break;if(h>4294967295)throw new Error("too large");f++}if(f===p)throw new Error("empty octet");return[h,f]},e=function(){function c(u,l){var f,h,p,d;if(typeof u!="string")throw new Error("Missing `net' parameter");if(l||(d=u.split("/",2),u=d[0],l=d[1]),l||(l=32),typeof l=="string"&&l.indexOf(".")>-1){try{this.maskLong=o(l)}catch(m){throw f=m,new Error("Invalid mask: "+l)}for(h=p=32;p>=0;h=--p)if(this.maskLong===4294967295<<32-h>>>0){this.bitmask=h;break}}else if(l||l===0)this.bitmask=parseInt(l,10),this.maskLong=0,this.bitmask>0&&(this.maskLong=4294967295<<32-this.bitmask>>>0);else throw new Error("Invalid mask: empty");try{this.netLong=(o(u)&this.maskLong)>>>0}catch(m){throw f=m,new Error("Invalid net address: "+u)}if(!(this.bitmask<=32))throw new Error("Invalid mask for ip4: "+l);this.size=Math.pow(2,32-this.bitmask),this.base=a(this.netLong),this.mask=a(this.maskLong),this.hostmask=a(~this.maskLong),this.first=this.bitmask<=30?a(this.netLong+1):this.base,this.last=this.bitmask<=30?a(this.netLong+this.size-2):a(this.netLong+this.size-1),this.broadcast=this.bitmask<=30?a(this.netLong+this.size-1):void 0}return c.prototype.contains=function(u){return typeof u=="string"&&(u.indexOf("/")>0||u.split(".").length!==4)&&(u=new c(u)),u instanceof c?this.contains(u.base)&&this.contains(u.broadcast||u.last):(o(u)&this.maskLong)>>>0===(this.netLong&this.maskLong)>>>0},c.prototype.next=function(u){return u==null&&(u=1),new c(a(this.netLong+this.size*u),this.mask)},c.prototype.forEach=function(u){var l,f,h;for(h=o(this.first),f=o(this.last),l=0;h<=f;)u(a(h),h,l),l++,h++},c.prototype.toString=function(){return this.base+"/"+this.bitmask},c}(),hs.ip2long=o,hs.long2ip=a,hs.Netmask=e}).call(hs)});var Fp=V((Up,jo)=>{(function(e){"use strict";let t="(0?\\d+|0x[a-f0-9]+)",r={fourOctet:new RegExp(`^${t}\\.${t}\\.${t}\\.${t}$`,"i"),threeOctet:new RegExp(`^${t}\\.${t}\\.${t}$`,"i"),twoOctet:new RegExp(`^${t}\\.${t}$`,"i"),longValue:new RegExp(`^${t}$`,"i")},n=new RegExp("^0[0-7]+$","i"),i=new RegExp("^0x[a-f0-9]+$","i"),s="%[0-9a-z]{1,}",o="(?:[0-9a-f]+::?)+",a={zoneIndex:new RegExp(s,"i"),native:new RegExp(`^(::)?(${o})?([0-9a-f]+)?(::)?(${s})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${t}\\.${t}\\.${t}\\.${t}(${s})?)$`,"i"),transitional:new RegExp(`^((?:${o})|(?:::)(?:${o})?)${t}\\.${t}\\.${t}\\.${t}(${s})?$`,"i")};function c(p,d){if(p.indexOf("::")!==p.lastIndexOf("::"))return null;let m=0,y=-1,g=(p.match(a.zoneIndex)||[])[0],x,b;for(g&&(g=g.substring(1),p=p.replace(/%.+$/,""));(y=p.indexOf(":",y+1))>=0;)m++;if(p.substr(0,2)==="::"&&m--,p.substr(-2,2)==="::"&&m--,m>d)return null;for(b=d-m,x=":";b--;)x+="0:";return p=p.replace("::",x),p[0]===":"&&(p=p.slice(1)),p[p.length-1]===":"&&(p=p.slice(0,-1)),d=function(){let C=p.split(":"),_=[];for(let S=0;S<C.length;S++)_.push(parseInt(C[S],16));return _}(),{parts:d,zoneId:g}}function u(p,d,m,y){if(p.length!==d.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let g=0,x;for(;y>0;){if(x=m-y,x<0&&(x=0),p[g]>>x!==d[g]>>x)return!1;y-=m,g+=1}return!0}function l(p){if(i.test(p))return parseInt(p,16);if(p[0]==="0"&&!isNaN(parseInt(p[1],10))){if(n.test(p))return parseInt(p,8);throw new Error(`ipaddr: cannot parse ${p} as octal`)}return parseInt(p,10)}function f(p,d){for(;p.length<d;)p=`0${p}`;return p}let h={};h.IPv4=function(){function p(d){if(d.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");let m,y;for(m=0;m<d.length;m++)if(y=d[m],!(0<=y&&y<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=d}return p.prototype.SpecialRanges={unspecified:[[new p([0,0,0,0]),8]],broadcast:[[new p([255,255,255,255]),32]],multicast:[[new p([224,0,0,0]),4]],linkLocal:[[new p([169,254,0,0]),16]],loopback:[[new p([127,0,0,0]),8]],carrierGradeNat:[[new p([100,64,0,0]),10]],private:[[new p([10,0,0,0]),8],[new p([172,16,0,0]),12],[new p([192,168,0,0]),16]],reserved:[[new p([192,0,0,0]),24],[new p([192,0,2,0]),24],[new p([192,88,99,0]),24],[new p([198,18,0,0]),15],[new p([198,51,100,0]),24],[new p([203,0,113,0]),24],[new p([240,0,0,0]),4]]},p.prototype.kind=function(){return"ipv4"},p.prototype.match=function(d,m){let y;if(m===void 0&&(y=d,d=y[0],m=y[1]),d.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return u(this.octets,d.octets,8,m)},p.prototype.prefixLengthFromSubnetMask=function(){let d=0,m=!1,y={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},g,x,b;for(g=3;g>=0;g-=1)if(x=this.octets[g],x in y){if(b=y[x],m&&b!==0)return null;b!==8&&(m=!0),d+=b}else return null;return 32-d},p.prototype.range=function(){return h.subnetMatch(this,this.SpecialRanges)},p.prototype.toByteArray=function(){return this.octets.slice(0)},p.prototype.toIPv4MappedAddress=function(){return h.IPv6.parse(`::ffff:${this.toString()}`)},p.prototype.toNormalizedString=function(){return this.toString()},p.prototype.toString=function(){return this.octets.join(".")},p}(),h.IPv4.broadcastAddressFromCIDR=function(p){try{let d=this.parseCIDR(p),m=d[0].toByteArray(),y=this.subnetMaskFromPrefixLength(d[1]).toByteArray(),g=[],x=0;for(;x<4;)g.push(parseInt(m[x],10)|parseInt(y[x],10)^255),x++;return new this(g)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},h.IPv4.isIPv4=function(p){return this.parser(p)!==null},h.IPv4.isValid=function(p){try{return new this(this.parser(p)),!0}catch{return!1}},h.IPv4.isValidFourPartDecimal=function(p){return!!(h.IPv4.isValid(p)&&p.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},h.IPv4.networkAddressFromCIDR=function(p){let d,m,y,g,x;try{for(d=this.parseCIDR(p),y=d[0].toByteArray(),x=this.subnetMaskFromPrefixLength(d[1]).toByteArray(),g=[],m=0;m<4;)g.push(parseInt(y[m],10)&parseInt(x[m],10)),m++;return new this(g)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},h.IPv4.parse=function(p){let d=this.parser(p);if(d===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(d)},h.IPv4.parseCIDR=function(p){let d;if(d=p.match(/^(.+)\/(\d+)$/)){let m=parseInt(d[2]);if(m>=0&&m<=32){let y=[this.parse(d[1]),m];return Object.defineProperty(y,"toString",{value:function(){return this.join("/")}}),y}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},h.IPv4.parser=function(p){let d,m,y;if(d=p.match(r.fourOctet))return function(){let g=d.slice(1,6),x=[];for(let b=0;b<g.length;b++)m=g[b],x.push(l(m));return x}();if(d=p.match(r.longValue)){if(y=l(d[1]),y>4294967295||y<0)throw new Error("ipaddr: address outside defined range");return function(){let g=[],x;for(x=0;x<=24;x+=8)g.push(y>>x&255);return g}().reverse()}else return(d=p.match(r.twoOctet))?function(){let g=d.slice(1,4),x=[];if(y=l(g[1]),y>16777215||y<0)throw new Error("ipaddr: address outside defined range");return x.push(l(g[0])),x.push(y>>16&255),x.push(y>>8&255),x.push(y&255),x}():(d=p.match(r.threeOctet))?function(){let g=d.slice(1,5),x=[];if(y=l(g[2]),y>65535||y<0)throw new Error("ipaddr: address outside defined range");return x.push(l(g[0])),x.push(l(g[1])),x.push(y>>8&255),x.push(y&255),x}():null},h.IPv4.subnetMaskFromPrefixLength=function(p){if(p=parseInt(p),p<0||p>32)throw new Error("ipaddr: invalid IPv4 prefix length");let d=[0,0,0,0],m=0,y=Math.floor(p/8);for(;m<y;)d[m]=255,m++;return y<4&&(d[y]=Math.pow(2,p%8)-1<<8-p%8),new this(d)},h.IPv6=function(){function p(d,m){let y,g;if(d.length===16)for(this.parts=[],y=0;y<=14;y+=2)this.parts.push(d[y]<<8|d[y+1]);else if(d.length===8)this.parts=d;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(y=0;y<this.parts.length;y++)if(g=this.parts[y],!(0<=g&&g<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");m&&(this.zoneId=m)}return p.prototype.SpecialRanges={unspecified:[new p([0,0,0,0,0,0,0,0]),128],linkLocal:[new p([65152,0,0,0,0,0,0,0]),10],multicast:[new p([65280,0,0,0,0,0,0,0]),8],loopback:[new p([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new p([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new p([0,0,0,0,0,65535,0,0]),96],rfc6145:[new p([0,0,0,0,65535,0,0,0]),96],rfc6052:[new p([100,65435,0,0,0,0,0,0]),96],"6to4":[new p([8194,0,0,0,0,0,0,0]),16],teredo:[new p([8193,0,0,0,0,0,0,0]),32],reserved:[[new p([8193,3512,0,0,0,0,0,0]),32]],benchmarking:[new p([8193,2,0,0,0,0,0,0]),48],amt:[new p([8193,3,0,0,0,0,0,0]),32],as112v6:[new p([8193,4,274,0,0,0,0,0]),48],deprecated:[new p([8193,16,0,0,0,0,0,0]),28],orchid2:[new p([8193,32,0,0,0,0,0,0]),28]},p.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},p.prototype.kind=function(){return"ipv6"},p.prototype.match=function(d,m){let y;if(m===void 0&&(y=d,d=y[0],m=y[1]),d.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return u(this.parts,d.parts,16,m)},p.prototype.prefixLengthFromSubnetMask=function(){let d=0,m=!1,y={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0},g,x;for(let b=7;b>=0;b-=1)if(g=this.parts[b],g in y){if(x=y[g],m&&x!==0)return null;x!==16&&(m=!0),d+=x}else return null;return 128-d},p.prototype.range=function(){return h.subnetMatch(this,this.SpecialRanges)},p.prototype.toByteArray=function(){let d,m=[],y=this.parts;for(let g=0;g<y.length;g++)d=y[g],m.push(d>>8),m.push(d&255);return m},p.prototype.toFixedLengthString=function(){let d=function(){let y=[];for(let g=0;g<this.parts.length;g++)y.push(f(this.parts[g].toString(16),4));return y}.call(this).join(":"),m="";return this.zoneId&&(m=`%${this.zoneId}`),d+m},p.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");let d=this.parts.slice(-2),m=d[0],y=d[1];return new h.IPv4([m>>8,m&255,y>>8,y&255])},p.prototype.toNormalizedString=function(){let d=function(){let y=[];for(let g=0;g<this.parts.length;g++)y.push(this.parts[g].toString(16));return y}.call(this).join(":"),m="";return this.zoneId&&(m=`%${this.zoneId}`),d+m},p.prototype.toRFC5952String=function(){let d=/((^|:)(0(:|$)){2,})/g,m=this.toNormalizedString(),y=0,g=-1,x;for(;x=d.exec(m);)x[0].length>g&&(y=x.index,g=x[0].length);return g<0?m:`${m.substring(0,y)}::${m.substring(y+g)}`},p.prototype.toString=function(){return this.toRFC5952String()},p}(),h.IPv6.broadcastAddressFromCIDR=function(p){try{let d=this.parseCIDR(p),m=d[0].toByteArray(),y=this.subnetMaskFromPrefixLength(d[1]).toByteArray(),g=[],x=0;for(;x<16;)g.push(parseInt(m[x],10)|parseInt(y[x],10)^255),x++;return new this(g)}catch(d){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${d})`)}},h.IPv6.isIPv6=function(p){return this.parser(p)!==null},h.IPv6.isValid=function(p){if(typeof p=="string"&&p.indexOf(":")===-1)return!1;try{let d=this.parser(p);return new this(d.parts,d.zoneId),!0}catch{return!1}},h.IPv6.networkAddressFromCIDR=function(p){let d,m,y,g,x;try{for(d=this.parseCIDR(p),y=d[0].toByteArray(),x=this.subnetMaskFromPrefixLength(d[1]).toByteArray(),g=[],m=0;m<16;)g.push(parseInt(y[m],10)&parseInt(x[m],10)),m++;return new this(g)}catch(b){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${b})`)}},h.IPv6.parse=function(p){let d=this.parser(p);if(d.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(d.parts,d.zoneId)},h.IPv6.parseCIDR=function(p){let d,m,y;if((m=p.match(/^(.+)\/(\d+)$/))&&(d=parseInt(m[2]),d>=0&&d<=128))return y=[this.parse(m[1]),d],Object.defineProperty(y,"toString",{value:function(){return this.join("/")}}),y;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},h.IPv6.parser=function(p){let d,m,y,g,x,b;if(y=p.match(a.deprecatedTransitional))return this.parser(`::ffff:${y[1]}`);if(a.native.test(p))return c(p,8);if((y=p.match(a.transitional))&&(b=y[6]||"",d=c(y[1].slice(0,-1)+b,6),d.parts)){for(x=[parseInt(y[2]),parseInt(y[3]),parseInt(y[4]),parseInt(y[5])],m=0;m<x.length;m++)if(g=x[m],!(0<=g&&g<=255))return null;return d.parts.push(x[0]<<8|x[1]),d.parts.push(x[2]<<8|x[3]),{parts:d.parts,zoneId:d.zoneId}}return null},h.IPv6.subnetMaskFromPrefixLength=function(p){if(p=parseInt(p),p<0||p>128)throw new Error("ipaddr: invalid IPv6 prefix length");let d=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],m=0,y=Math.floor(p/8);for(;m<y;)d[m]=255,m++;return y<16&&(d[y]=Math.pow(2,p%8)-1<<8-p%8),new this(d)},h.fromByteArray=function(p){let d=p.length;if(d===4)return new h.IPv4(p);if(d===16)return new h.IPv6(p);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},h.isValid=function(p){return h.IPv6.isValid(p)||h.IPv4.isValid(p)},h.parse=function(p){if(h.IPv6.isValid(p))return h.IPv6.parse(p);if(h.IPv4.isValid(p))return h.IPv4.parse(p);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},h.parseCIDR=function(p){try{return h.IPv6.parseCIDR(p)}catch{try{return h.IPv4.parseCIDR(p)}catch{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},h.process=function(p){let d=this.parse(p);return d.kind()==="ipv6"&&d.isIPv4MappedAddress()?d.toIPv4Address():d},h.subnetMatch=function(p,d,m){let y,g,x,b;m==null&&(m="unicast");for(g in d)if(Object.prototype.hasOwnProperty.call(d,g)){for(x=d[g],x[0]&&!(x[0]instanceof Array)&&(x=[x]),y=0;y<x.length;y++)if(b=x[y],p.kind()===b[0].kind()&&p.match.apply(p,b))return g}return m},typeof jo<"u"&&jo.exports?jo.exports=h:e.ipaddr=h})(Up)});var rm=V((VB,em)=>{"use strict";em.exports=tm;var Qw=xu(),Yr=tm.prototype,Xw=new Date%1e9;function Zw(){return(Math.random()*1e9>>>0)+Xw++}function tm(e){e=e||{},this.id=e.id||Zw(),this.max=e.max||1/0,this.items=e.items||[],this._lookup={},this.size=this.items.length,this.lastModified=new Date(e.lastModified||new Date);for(var t,r,n=this.items.length;n--;)t=this.items[n],r=new Date(t.expires)-new Date,this._lookup[t.key]=t,r>0?this.expire(t.key,r):r<=0&&this.delete(t.key)}Yr.has=function(e){return e in this._lookup};Yr.get=function(e){if(!this.has(e))return null;var t=this._lookup[e];return t.refresh&&this.expire(e,t.refresh),this.items.splice(this.items.indexOf(t),1),this.items.push(t),t.value};Yr.meta=function(e){if(!this.has(e))return null;var t=this._lookup[e];return"meta"in t?t.meta:null};Yr.set=function(e,t,r){var n=this._lookup[e],i=this._lookup[e]={key:e,value:t};return this.lastModified=new Date,n?(clearTimeout(n.timeout),this.items.splice(this.items.indexOf(n),1,i)):(this.size>=this.max&&this.delete(this.items[0].key),this.items.push(i),this.size++),r&&("ttl"in r&&this.expire(e,r.ttl),"meta"in r&&(i.meta=r.meta),r.refresh&&(i.refresh=r.ttl)),this};Yr.delete=function(e){var t=this._lookup[e];return t?(this.lastModified=new Date,this.items.splice(this.items.indexOf(t),1),clearTimeout(t.timeout),delete this._lookup[e],this.size--,this):!1};Yr.expire=function(e,t){var r=t||0,n=this._lookup[e];if(!n)return this;if(typeof r=="string"&&(r=Qw(t)),typeof r!="number")throw new TypeError("Expiration time must be a string or number.");return clearTimeout(n.timeout),n.timeout=setTimeout(this.delete.bind(this,n.key),r),n.expires=Number(new Date)+r,this};Yr.clear=function(){for(var e=this.items.length;e--;)this.delete(this.items[e].key);return this};Yr.toJSON=function(){for(var e=new Array(this.items.length),t,r=e.length;r--;)t=this.items[r],e[r]={key:t.key,meta:t.meta,value:t.value,expires:t.expires,refresh:t.refresh};return{id:this.id,max:isFinite(this.max)?this.max:void 0,lastModified:this.lastModified,items:e}}});var ys=V((iL,cm)=>{cm.exports=class{constructor(t={}){this.points=t.points,this.duration=t.duration,this.blockDuration=t.blockDuration,this.execEvenly=t.execEvenly,this.execEvenlyMinDelayMs=t.execEvenlyMinDelayMs,this.keyPrefix=t.keyPrefix}get points(){return this._points}set points(t){this._points=t>=0?t:4}get duration(){return this._duration}set duration(t){this._duration=typeof t>"u"?1:t}get msDuration(){return this.duration*1e3}get blockDuration(){return this._blockDuration}set blockDuration(t){this._blockDuration=typeof t>"u"?0:t}get msBlockDuration(){return this.blockDuration*1e3}get execEvenly(){return this._execEvenly}set execEvenly(t){this._execEvenly=typeof t>"u"?!1:!!t}get execEvenlyMinDelayMs(){return this._execEvenlyMinDelayMs}set execEvenlyMinDelayMs(t){this._execEvenlyMinDelayMs=typeof t>"u"?Math.ceil(this.msDuration/this.points):t}get keyPrefix(){return this._keyPrefix}set keyPrefix(t){if(typeof t>"u"&&(t="rlflx"),typeof t!="string")throw new Error("keyPrefix must be string");this._keyPrefix=t}_getKeySecDuration(t={}){return t&&t.customDuration>=0?t.customDuration:this.duration}getKey(t){return this.keyPrefix.length>0?`${this.keyPrefix}:${t}`:t}parseKey(t){return t.substring(this.keyPrefix.length)}consume(){throw new Error("You have to implement the method 'consume'!")}penalty(){throw new Error("You have to implement the method 'penalty'!")}reward(){throw new Error("You have to implement the method 'reward'!")}get(){throw new Error("You have to implement the method 'get'!")}set(){throw new Error("You have to implement the method 'set'!")}block(){throw new Error("You have to implement the method 'block'!")}delete(){throw new Error("You have to implement the method 'delete'!")}}});var lm=V((oL,um)=>{um.exports=class{constructor(){this._keys={},this._addedKeysAmount=0}collectExpired(){let t=Date.now();Object.keys(this._keys).forEach(r=>{this._keys[r]<=t&&delete this._keys[r]}),this._addedKeysAmount=Object.keys(this._keys).length}add(t,r){this.addMs(t,r*1e3)}addMs(t,r){this._keys[t]=Date.now()+r,this._addedKeysAmount++,this._addedKeysAmount>999&&this.collectExpired()}msBeforeExpire(t){let r=this._keys[t];if(r&&r>=Date.now()){this.collectExpired();let n=Date.now();return r>=n?r-n:0}return 0}delete(t){t?delete this._keys[t]:Object.keys(this._keys).forEach(r=>{delete this._keys[r]})}}});var hm=V((aL,fm)=>{var ev=lm();fm.exports=ev});var Se=V((uL,dm)=>{dm.exports=class{constructor(t,r,n,i){this.remainingPoints=typeof t>"u"?0:t,this.msBeforeNext=typeof r>"u"?0:r,this.consumedPoints=typeof n>"u"?0:n,this.isFirstInDuration=typeof i>"u"?!1:i}get msBeforeNext(){return this._msBeforeNext}set msBeforeNext(t){return this._msBeforeNext=t,this}get remainingPoints(){return this._remainingPoints}set remainingPoints(t){return this._remainingPoints=t,this}get consumedPoints(){return this._consumedPoints}set consumedPoints(t){return this._consumedPoints=t,this}get isFirstInDuration(){return this._isFirstInDuration}set isFirstInDuration(t){this._isFirstInDuration=!!t}_getDecoratedProperties(){return{remainingPoints:this.remainingPoints,msBeforeNext:this.msBeforeNext,consumedPoints:this.consumedPoints,isFirstInDuration:this.isFirstInDuration}}[Symbol.for("nodejs.util.inspect.custom")](){return this._getDecoratedProperties()}toString(){return JSON.stringify(this._getDecoratedProperties())}toJSON(){return this._getDecoratedProperties()}}});var Ei=V((fL,mm)=>{var Tl=ys(),rv=hm(),pm=Se();mm.exports=class extends Tl{constructor(t={}){super(t),this.inMemoryBlockOnConsumed=t.inMemoryBlockOnConsumed,this.inMemoryBlockDuration=t.inMemoryBlockDuration,this.insuranceLimiter=t.insuranceLimiter,this._inMemoryBlockedKeys=new rv}get client(){return this._client}set client(t){if(typeof t>"u")throw new Error("storeClient is not set");this._client=t}_afterConsume(t,r,n,i,s,o={}){let a=this._getRateLimiterRes(n,i,s);if(this.inMemoryBlockOnConsumed>0&&!(this.inMemoryBlockDuration>0)&&a.consumedPoints>=this.inMemoryBlockOnConsumed)return this._inMemoryBlockedKeys.addMs(n,a.msBeforeNext),a.consumedPoints>this.points?r(a):t(a);if(a.consumedPoints>this.points){let c=Promise.resolve();this.blockDuration>0&&a.consumedPoints<=this.points+i&&(a.msBeforeNext=this.msBlockDuration,c=this._block(n,a.consumedPoints,this.msBlockDuration,o)),this.inMemoryBlockOnConsumed>0&&a.consumedPoints>=this.inMemoryBlockOnConsumed&&(this._inMemoryBlockedKeys.add(n,this.inMemoryBlockDuration),a.msBeforeNext=this.msInMemoryBlockDuration),c.then(()=>{r(a)}).catch(u=>{r(u)})}else if(this.execEvenly&&a.msBeforeNext>0&&!a.isFirstInDuration){let c=Math.ceil(a.msBeforeNext/(a.remainingPoints+2));c<this.execEvenlyMinDelayMs&&(c=a.consumedPoints*this.execEvenlyMinDelayMs),setTimeout(t,c,a)}else t(a)}_handleError(t,r,n,i,s,o=!1,a={}){this.insuranceLimiter instanceof Tl?this.insuranceLimiter[r](s,o,a).then(c=>{n(c)}).catch(c=>{i(c)}):i(t)}getInMemoryBlockMsBeforeExpire(t){return this.inMemoryBlockOnConsumed>0?this._inMemoryBlockedKeys.msBeforeExpire(t):0}get inMemoryBlockOnConsumed(){return this._inMemoryBlockOnConsumed}set inMemoryBlockOnConsumed(t){if(this._inMemoryBlockOnConsumed=t?parseInt(t):0,this.inMemoryBlockOnConsumed>0&&this.points>this.inMemoryBlockOnConsumed)throw new Error('inMemoryBlockOnConsumed option must be greater or equal "points" option')}get inMemoryBlockDuration(){return this._inMemoryBlockDuration}set inMemoryBlockDuration(t){if(this._inMemoryBlockDuration=t?parseInt(t):0,this.inMemoryBlockDuration>0&&this.inMemoryBlockOnConsumed===0)throw new Error("inMemoryBlockOnConsumed option must be set up")}get msInMemoryBlockDuration(){return this._inMemoryBlockDuration*1e3}get insuranceLimiter(){return this._insuranceLimiter}set insuranceLimiter(t){if(typeof t<"u"&&!(t instanceof Tl))throw new Error("insuranceLimiter must be instance of RateLimiterAbstract");this._insuranceLimiter=t,this._insuranceLimiter&&(this._insuranceLimiter.blockDuration=this.blockDuration,this._insuranceLimiter.execEvenly=this.execEvenly)}block(t,r,n={}){let i=r*1e3;return this._block(this.getKey(t),this.points+1,i,n)}set(t,r,n,i={}){let s=(n>=0?n:this.duration)*1e3;return this._block(this.getKey(t),r,s,i)}consume(t,r=1,n={}){return new Promise((i,s)=>{let o=this.getKey(t),a=this.getInMemoryBlockMsBeforeExpire(o);if(a>0)return s(new pm(0,a));this._upsert(o,r,this._getKeySecDuration(n)*1e3,!1,n).then(c=>{this._afterConsume(i,s,o,r,c)}).catch(c=>{this._handleError(c,"consume",i,s,t,r,n)})})}penalty(t,r=1,n={}){let i=this.getKey(t);return new Promise((s,o)=>{this._upsert(i,r,this._getKeySecDuration(n)*1e3,!1,n).then(a=>{s(this._getRateLimiterRes(i,r,a))}).catch(a=>{this._handleError(a,"penalty",s,o,t,r,n)})})}reward(t,r=1,n={}){let i=this.getKey(t);return new Promise((s,o)=>{this._upsert(i,-r,this._getKeySecDuration(n)*1e3,!1,n).then(a=>{s(this._getRateLimiterRes(i,-r,a))}).catch(a=>{this._handleError(a,"reward",s,o,t,r,n)})})}get(t,r={}){let n=this.getKey(t);return new Promise((i,s)=>{this._get(n,r).then(o=>{i(o===null||typeof o>"u"?null:this._getRateLimiterRes(n,0,o))}).catch(o=>{this._handleError(o,"get",i,s,t,r)})})}delete(t,r={}){let n=this.getKey(t);return new Promise((i,s)=>{this._delete(n,r).then(o=>{this._inMemoryBlockedKeys.delete(n),i(o)}).catch(o=>{this._handleError(o,"delete",i,s,t,r)})})}deleteInMemoryBlockedAll(){this._inMemoryBlockedKeys.delete()}_getRateLimiterRes(t,r,n){throw new Error("You have to implement the method '_getRateLimiterRes'!")}_block(t,r,n,i={}){return new Promise((s,o)=>{this._upsert(t,r,n,!0,i).then(()=>{s(new pm(0,n>0?n:-1,r))}).catch(a=>{this._handleError(a,"block",s,o,this.parseKey(t),n/1e3,i)})})}_get(t,r={}){throw new Error("You have to implement the method '_get'!")}_delete(t,r={}){throw new Error("You have to implement the method '_delete'!")}_upsert(t,r,n,i=!1,s={}){throw new Error("You have to implement the method '_upsert'!")}}});var gm=V((hL,ym)=>{var nv=Ei(),iv=Se(),Bl="redis.call('set', KEYS[1], 0, 'EX', ARGV[2], 'NX') local consumed = redis.call('incrby', KEYS[1], ARGV[1]) local ttl = redis.call('pttl', KEYS[1]) if ttl == -1 then redis.call('expire', KEYS[1], ARGV[2]) ttl = 1000 * ARGV[2] end return {consumed, ttl} ",Ll=class extends nv{constructor(t){super(t),this.client=t.storeClient,this._rejectIfRedisNotReady=!!t.rejectIfRedisNotReady,this.useRedisPackage=t.useRedisPackage,this.useRedis3AndLowerPackage=t.useRedis3AndLowerPackage,typeof this.client.defineCommand=="function"&&this.client.defineCommand("rlflxIncr",{numberOfKeys:1,lua:Bl})}_isRedisReady(){return this._rejectIfRedisNotReady?!(this.client.status&&this.client.status!=="ready"||typeof this.client.isReady=="function"&&!this.client.isReady()):!0}_getRateLimiterRes(t,r,n){let[i,s]=n;Array.isArray(i)&&([,i]=i,[,s]=s);let o=new iv;return o.consumedPoints=parseInt(i),o.isFirstInDuration=o.consumedPoints===r,o.remainingPoints=Math.max(this.points-o.consumedPoints,0),o.msBeforeNext=s,o}async _upsert(t,r,n,i=!1){if(!this._isRedisReady())throw new Error("Redis connection is not ready");let s=Math.floor(n/1e3),o=this.client.multi();return i?(s>0?!this.useRedisPackage&&!this.useRedis3AndLowerPackage?o.set(t,r,"EX",s):o.set(t,r,{EX:s}):o.set(t,r),!this.useRedisPackage&&!this.useRedis3AndLowerPackage?o.pttl(t).exec(!0):o.pTTL(t).exec(!0)):s>0?!this.useRedisPackage&&!this.useRedis3AndLowerPackage?this.client.rlflxIncr([t].concat([String(r),String(s)])):this.useRedis3AndLowerPackage?new Promise((a,c)=>{let u=function(l,f){return l?c(l):a(f)};typeof this.client.rlflxIncr=="function"?this.client.rlflxIncr(t,r,s,u):this.client.eval(Bl,1,t,r,s,u)}):this.client.eval(Bl,{keys:[t],arguments:[String(r),String(s)]}):!this.useRedisPackage&&!this.useRedis3AndLowerPackage?o.incrby(t,r).pttl(t).exec(!0):o.incrBy(t,r).pTTL(t).exec(!0)}async _get(t){if(!this._isRedisReady())throw new Error("Redis connection is not ready");return!this.useRedisPackage&&!this.useRedis3AndLowerPackage?this.client.multi().get(t).pttl(t).exec().then(r=>{let[[,n]]=r;return n===null?null:r}):this.client.multi().get(t).pTTL(t).exec(!0).then(r=>{let[n]=r;return n===null?null:r})}_delete(t){return this.client.del(t).then(r=>r>0)}};ym.exports=Ll});var bm=V((dL,Em)=>{var sv=Ei(),ov=Se();function xm(e){try{let t=e.client?e.client:e,{version:r}=t.topology.s.options.metadata.driver,n=r.split(".").map(i=>parseInt(i));return{major:n[0],feature:n[1],patch:n[2]}}catch{return{major:0,feature:0,patch:0}}}var Pl=class e extends sv{constructor(t){super(t),this.dbName=t.dbName,this.tableName=t.tableName,this.indexKeyPrefix=t.indexKeyPrefix,t.mongo?this.client=t.mongo:this.client=t.storeClient,typeof this.client.then=="function"?this.client.then(r=>{this.client=r,this._initCollection(),this._driverVersion=xm(this.client)}):(this._initCollection(),this._driverVersion=xm(this.client))}get dbName(){return this._dbName}set dbName(t){this._dbName=typeof t>"u"?e.getDbName():t}static getDbName(){return"node-rate-limiter-flexible"}get tableName(){return this._tableName}set tableName(t){this._tableName=typeof t>"u"?this.keyPrefix:t}get client(){return this._client}set client(t){if(typeof t>"u")throw new Error("mongo is not set");this._client=t}get indexKeyPrefix(){return this._indexKeyPrefix}set indexKeyPrefix(t){this._indexKeyPrefix=t||{}}_initCollection(){let r=(typeof this.client.db=="function"?this.client.db(this.dbName):this.client).collection(this.tableName);r.createIndex({expire:-1},{expireAfterSeconds:0}),r.createIndex(Object.assign({},this.indexKeyPrefix,{key:1}),{unique:!0}),this._collection=r}_getRateLimiterRes(t,r,n){let i=new ov,s;return typeof n.value>"u"?s=n:s=n.value,i.isFirstInDuration=s.points===r,i.consumedPoints=s.points,i.remainingPoints=Math.max(this.points-i.consumedPoints,0),i.msBeforeNext=s.expire!==null?Math.max(new Date(s.expire).getTime()-Date.now(),0):-1,i}_upsert(t,r,n,i=!1,s={}){if(!this._collection)return Promise.reject(Error("Mongo connection is not established"));let o=s.attrs||{},a,c;i?(a={key:t},a=Object.assign(a,o),c={$set:{key:t,points:r,expire:n>0?new Date(Date.now()+n):null}},c.$set=Object.assign(c.$set,o)):(a={$or:[{expire:{$gt:new Date}},{expire:{$eq:null}}],key:t},a=Object.assign(a,o),c={$setOnInsert:{key:t,expire:n>0?new Date(Date.now()+n):null},$inc:{points:r}},c.$setOnInsert=Object.assign(c.$setOnInsert,o));let u={upsert:!0};return this._driverVersion.major>=4||this._driverVersion.major===3&&this._driverVersion.feature>=7||this._driverVersion.feature>=6&&this._driverVersion.patch>=7?u.returnDocument="after":u.returnOriginal=!1,new Promise((l,f)=>{this._collection.findOneAndUpdate(a,c,u).then(h=>{l(h)}).catch(h=>{if(h&&h.code===11e3){let p=Object.assign({$or:[{expire:{$lte:new Date}},{expire:{$eq:null}}],key:t},o),d={$set:Object.assign({key:t,points:r,expire:n>0?new Date(Date.now()+n):null},o)};this._collection.findOneAndUpdate(p,d,u).then(m=>{l(m)}).catch(m=>{m&&m.code===11e3?this._upsert(t,r,n,i).then(y=>l(y)).catch(y=>f(y)):f(m)})}else f(h)})})}_get(t,r={}){if(!this._collection)return Promise.reject(Error("Mongo connection is not established"));let n=r.attrs||{},i=Object.assign({key:t,$or:[{expire:{$gt:new Date}},{expire:{$eq:null}}]},n);return this._collection.findOne(i)}_delete(t,r={}){if(!this._collection)return Promise.reject(Error("Mongo connection is not established"));let n=r.attrs||{},i=Object.assign({key:t},n);return this._collection.deleteOne(i).then(s=>s.deletedCount>0)}};Em.exports=Pl});var vm=V((pL,wm)=>{var av=Ei(),cv=Se(),Dl=class extends av{constructor(t,r=null){super(t),this.client=t.storeClient,this.clientType=t.storeType,this.dbName=t.dbName,this.tableName=t.tableName,this.clearExpiredByTimeout=t.clearExpiredByTimeout,this.tableCreated=t.tableCreated,this.tableCreated?(this.clearExpiredByTimeout&&this._clearExpiredHourAgo(),typeof r=="function"&&r()):this._createDbAndTable().then(()=>{this.tableCreated=!0,this.clearExpiredByTimeout&&this._clearExpiredHourAgo(),typeof r=="function"&&r()}).catch(n=>{if(typeof r=="function")r(n);else throw n})}clearExpired(t){return new Promise(r=>{this._getConnection().then(n=>{n.query("DELETE FROM ??.?? WHERE expire < ?",[this.dbName,this.tableName,t],()=>{this._releaseConnection(n),r()})}).catch(()=>{r()})})}_clearExpiredHourAgo(){this._clearExpiredTimeoutId&&clearTimeout(this._clearExpiredTimeoutId),this._clearExpiredTimeoutId=setTimeout(()=>{this.clearExpired(Date.now()-36e5).then(()=>{this._clearExpiredHourAgo()})},3e5),this._clearExpiredTimeoutId.unref()}_getConnection(){switch(this.clientType){case"pool":return new Promise((t,r)=>{this.client.getConnection((n,i)=>{if(n)return r(n);t(i)})});case"sequelize":return this.client.connectionManager.getConnection();case"knex":return this.client.client.acquireConnection();default:return Promise.resolve(this.client)}}_releaseConnection(t){switch(this.clientType){case"pool":return t.release();case"sequelize":return this.client.connectionManager.releaseConnection(t);case"knex":return this.client.client.releaseConnection(t);default:return!0}}_createDbAndTable(){return new Promise((t,r)=>{this._getConnection().then(n=>{n.query(`CREATE DATABASE IF NOT EXISTS \`${this.dbName}\`;`,i=>{if(i)return this._releaseConnection(n),r(i);n.query(this._getCreateTableStmt(),s=>{if(s)return this._releaseConnection(n),r(s);this._releaseConnection(n),t()})})}).catch(n=>{r(n)})})}_getCreateTableStmt(){return`CREATE TABLE IF NOT EXISTS \`${this.dbName}\`.\`${this.tableName}\` (\`key\` VARCHAR(255) CHARACTER SET utf8 NOT NULL,\`points\` INT(9) NOT NULL default 0,\`expire\` BIGINT UNSIGNED,PRIMARY KEY (\`key\`)) ENGINE = INNODB;`}get clientType(){return this._clientType}set clientType(t){if(typeof t>"u")if(this.client.constructor.name==="Connection")t="connection";else if(this.client.constructor.name==="Pool")t="pool";else if(this.client.constructor.name==="Sequelize")t="sequelize";else throw new Error("storeType is not defined");this._clientType=t.toLowerCase()}get dbName(){return this._dbName}set dbName(t){this._dbName=typeof t>"u"?"rtlmtrflx":t}get tableName(){return this._tableName}set tableName(t){this._tableName=typeof t>"u"?this.keyPrefix:t}get tableCreated(){return this._tableCreated}set tableCreated(t){this._tableCreated=typeof t>"u"?!1:!!t}get clearExpiredByTimeout(){return this._clearExpiredByTimeout}set clearExpiredByTimeout(t){this._clearExpiredByTimeout=typeof t>"u"?!0:!!t}_getRateLimiterRes(t,r,n){let i=new cv,[s]=n;return i.isFirstInDuration=r===s.points,i.consumedPoints=i.isFirstInDuration?r:s.points,i.remainingPoints=Math.max(this.points-i.consumedPoints,0),i.msBeforeNext=s.expire?Math.max(s.expire-Date.now(),0):-1,i}_upsertTransaction(t,r,n,i,s){return new Promise((o,a)=>{t.query("BEGIN",c=>{if(c)return t.rollback(),a(c);let u=Date.now(),l=i>0?u+i:null,f,h;s?(f=`INSERT INTO ??.?? VALUES (?, ?, ?)
|
|
15
|
+
`+a+t.substr(o+1),s=i-o-1,o=-1,++i}else(t[i]===" "||t[i]===" "||t[i]===",")&&(o=i);return t}function Jy(e){return e.replace(/^\s+/,"")}});var Qf=V((P_,Wf)=>{var qe=ht();jr();Pt();var Hf=Wf.exports=qe.sha256=qe.sha256||{};qe.md.sha256=qe.md.algorithms.sha256=Hf;Hf.create=function(){Gf||jy();var e=null,t=qe.util.createBuffer(),r=new Array(64),n={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8};return n.start=function(){n.messageLength=0,n.fullMessageLength=n.messageLength64=[];for(var i=n.messageLengthSize/4,s=0;s<i;++s)n.fullMessageLength.push(0);return t=qe.util.createBuffer(),e={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},n},n.start(),n.update=function(i,s){s==="utf8"&&(i=qe.util.encodeUtf8(i));var o=i.length;n.messageLength+=o,o=[o/4294967296>>>0,o>>>0];for(var a=n.fullMessageLength.length-1;a>=0;--a)n.fullMessageLength[a]+=o[1],o[1]=o[0]+(n.fullMessageLength[a]/4294967296>>>0),n.fullMessageLength[a]=n.fullMessageLength[a]>>>0,o[0]=o[1]/4294967296>>>0;return t.putBytes(i),zf(e,r,t),(t.read>2048||t.length()===0)&&t.compact(),n},n.digest=function(){var i=qe.util.createBuffer();i.putBytes(t.bytes());var s=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize,o=s&n.blockLength-1;i.putBytes(Ga.substr(0,n.blockLength-o));for(var a,c,u=n.fullMessageLength[0]*8,l=0;l<n.fullMessageLength.length-1;++l)a=n.fullMessageLength[l+1]*8,c=a/4294967296>>>0,u+=c,i.putInt32(u>>>0),u=a>>>0;i.putInt32(u);var f={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4,h5:e.h5,h6:e.h6,h7:e.h7};zf(f,r,i);var h=qe.util.createBuffer();return h.putInt32(f.h0),h.putInt32(f.h1),h.putInt32(f.h2),h.putInt32(f.h3),h.putInt32(f.h4),h.putInt32(f.h5),h.putInt32(f.h6),h.putInt32(f.h7),h},n};var Ga=null,Gf=!1,Yf=null;function jy(){Ga=String.fromCharCode(128),Ga+=qe.util.fillString(String.fromCharCode(0),64),Yf=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],Gf=!0}function zf(e,t,r){for(var n,i,s,o,a,c,u,l,f,h,p,d,m,y,g,x=r.length();x>=64;){for(u=0;u<16;++u)t[u]=r.getInt32();for(;u<64;++u)n=t[u-2],n=(n>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,i=t[u-15],i=(i>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,t[u]=n+t[u-7]+i+t[u-16]|0;for(l=e.h0,f=e.h1,h=e.h2,p=e.h3,d=e.h4,m=e.h5,y=e.h6,g=e.h7,u=0;u<64;++u)o=(d>>>6|d<<26)^(d>>>11|d<<21)^(d>>>25|d<<7),a=y^d&(m^y),s=(l>>>2|l<<30)^(l>>>13|l<<19)^(l>>>22|l<<10),c=l&f|h&(l^f),n=g+o+a+Yf[u]+t[u],i=s+c,g=y,y=m,m=d,d=p+n>>>0,p=h,h=f,f=l,l=n+i>>>0;e.h0=e.h0+l|0,e.h1=e.h1+f|0,e.h2=e.h2+h|0,e.h3=e.h3+p|0,e.h4=e.h4+d|0,e.h5=e.h5+m|0,e.h6=e.h6+y|0,e.h7=e.h7+g|0,x-=64}}});var Zf=V((D_,Xf)=>{var $e=ht();Pt();var Us=null;$e.util.isNodejs&&!$e.options.usePureJavaScript&&!process.versions["node-webkit"]&&(Us=Li());var tg=Xf.exports=$e.prng=$e.prng||{};tg.create=function(e){for(var t={plugin:e,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},r=e.md,n=new Array(32),i=0;i<32;++i)n[i]=r.create();t.pools=n,t.pool=0,t.generate=function(u,l){if(!l)return t.generateSync(u);var f=t.plugin.cipher,h=t.plugin.increment,p=t.plugin.formatKey,d=t.plugin.formatSeed,m=$e.util.createBuffer();t.key=null,y();function y(g){if(g)return l(g);if(m.length()>=u)return l(null,m.getBytes(u));if(t.generated>1048575&&(t.key=null),t.key===null)return $e.util.nextTick(function(){s(y)});var x=f(t.key,t.seed);t.generated+=x.length,m.putBytes(x),t.key=p(f(t.key,h(t.seed))),t.seed=d(f(t.key,t.seed)),$e.util.setImmediate(y)}},t.generateSync=function(u){var l=t.plugin.cipher,f=t.plugin.increment,h=t.plugin.formatKey,p=t.plugin.formatSeed;t.key=null;for(var d=$e.util.createBuffer();d.length()<u;){t.generated>1048575&&(t.key=null),t.key===null&&o();var m=l(t.key,t.seed);t.generated+=m.length,d.putBytes(m),t.key=h(l(t.key,f(t.seed))),t.seed=p(l(t.key,t.seed))}return d.getBytes(u)};function s(u){if(t.pools[0].messageLength>=32)return a(),u();var l=32-t.pools[0].messageLength<<5;t.seedFile(l,function(f,h){if(f)return u(f);t.collect(h),a(),u()})}function o(){if(t.pools[0].messageLength>=32)return a();var u=32-t.pools[0].messageLength<<5;t.collect(t.seedFileSync(u)),a()}function a(){t.reseeds=t.reseeds===4294967295?0:t.reseeds+1;var u=t.plugin.md.create();u.update(t.keyBytes);for(var l=1,f=0;f<32;++f)t.reseeds%l===0&&(u.update(t.pools[f].digest().getBytes()),t.pools[f].start()),l=l<<1;t.keyBytes=u.digest().getBytes(),u.start(),u.update(t.keyBytes);var h=u.digest().getBytes();t.key=t.plugin.formatKey(t.keyBytes),t.seed=t.plugin.formatSeed(h),t.generated=0}function c(u){var l=null,f=$e.util.globalScope,h=f.crypto||f.msCrypto;h&&h.getRandomValues&&(l=function(_){return h.getRandomValues(_)});var p=$e.util.createBuffer();if(l)for(;p.length()<u;){var d=Math.max(1,Math.min(u-p.length(),65536)/4),m=new Uint32Array(Math.floor(d));try{l(m);for(var y=0;y<m.length;++y)p.putInt32(m[y])}catch(_){if(!(typeof QuotaExceededError<"u"&&_ instanceof QuotaExceededError))throw _}}if(p.length()<u)for(var g,x,b,C=Math.floor(Math.random()*65536);p.length()<u;){x=16807*(C&65535),g=16807*(C>>16),x+=(g&32767)<<16,x+=g>>15,x=(x&2147483647)+(x>>31),C=x&4294967295;for(var y=0;y<3;++y)b=C>>>(y<<3),b^=Math.floor(Math.random()*256),p.putByte(b&255)}return p.getBytes(u)}return Us?(t.seedFile=function(u,l){Us.randomBytes(u,function(f,h){if(f)return l(f);l(null,h.toString())})},t.seedFileSync=function(u){return Us.randomBytes(u).toString()}):(t.seedFile=function(u,l){try{l(null,c(u))}catch(f){l(f)}},t.seedFileSync=c),t.collect=function(u){for(var l=u.length,f=0;f<l;++f)t.pools[t.pool].update(u.substr(f,1)),t.pool=t.pool===31?0:t.pool+1},t.collectInt=function(u,l){for(var f="",h=0;h<l;h+=8)f+=String.fromCharCode(u>>h&255);t.collect(f)},t.registerWorker=function(u){if(u===self)t.seedFile=function(f,h){function p(d){var m=d.data;m.forge&&m.forge.prng&&(self.removeEventListener("message",p),h(m.forge.prng.err,m.forge.prng.bytes))}self.addEventListener("message",p),self.postMessage({forge:{prng:{needed:f}}})};else{var l=function(f){var h=f.data;h.forge&&h.forge.prng&&t.seedFile(h.forge.prng.needed,function(p,d){u.postMessage({forge:{prng:{err:p,bytes:d}}})})};u.addEventListener("message",l)}},t}});var Pi=V((N_,Ya)=>{var Yt=ht();Ds();Qf();Zf();Pt();(function(){if(Yt.random&&Yt.random.getBytes){Ya.exports=Yt.random;return}(function(e){var t={},r=new Array(4),n=Yt.util.createBuffer();t.formatKey=function(f){var h=Yt.util.createBuffer(f);return f=new Array(4),f[0]=h.getInt32(),f[1]=h.getInt32(),f[2]=h.getInt32(),f[3]=h.getInt32(),Yt.aes._expandKey(f,!1)},t.formatSeed=function(f){var h=Yt.util.createBuffer(f);return f=new Array(4),f[0]=h.getInt32(),f[1]=h.getInt32(),f[2]=h.getInt32(),f[3]=h.getInt32(),f},t.cipher=function(f,h){return Yt.aes._updateBlock(f,h,r,!1),n.putInt32(r[0]),n.putInt32(r[1]),n.putInt32(r[2]),n.putInt32(r[3]),n.getBytes()},t.increment=function(f){return++f[3],f},t.md=Yt.md.sha256;function i(){var f=Yt.prng.create(t);return f.getBytes=function(h,p){return f.generate(h,p)},f.getBytesSync=function(h){return f.generate(h)},f}var s=i(),o=null,a=Yt.util.globalScope,c=a.crypto||a.msCrypto;if(c&&c.getRandomValues&&(o=function(f){return c.getRandomValues(f)}),Yt.options.usePureJavaScript||!Yt.util.isNodejs&&!o){if(typeof window>"u"||window.document,s.collectInt(+new Date,32),typeof navigator<"u"){var u="";for(var l in navigator)try{typeof navigator[l]=="string"&&(u+=navigator[l])}catch{}s.collect(u),u=null}e&&(e().mousemove(function(f){s.collectInt(f.clientX,16),s.collectInt(f.clientY,16)}),e().keypress(function(f){s.collectInt(f.charCode,8)}))}if(!Yt.random)Yt.random=s;else for(var l in s)Yt.random[l]=s[l];Yt.random.createInstance=i,Ya.exports=Yt.random})(typeof jQuery<"u"?jQuery:null)})()});var e0=V((k_,t0)=>{var fe=ht();Pt();var Wa=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],Jf=[1,2,3,5],eg=function(e,t){return e<<t&65535|(e&65535)>>16-t},rg=function(e,t){return(e&65535)>>t|e<<16-t&65535};t0.exports=fe.rc2=fe.rc2||{};fe.rc2.expandKey=function(e,t){typeof e=="string"&&(e=fe.util.createBuffer(e)),t=t||128;var r=e,n=e.length(),i=t,s=Math.ceil(i/8),o=255>>(i&7),a;for(a=n;a<128;a++)r.putByte(Wa[r.at(a-1)+r.at(a-n)&255]);for(r.setAt(128-s,Wa[r.at(128-s)&o]),a=127-s;a>=0;a--)r.setAt(a,Wa[r.at(a+1)^r.at(a+s)]);return r};var jf=function(e,t,r){var n=!1,i=null,s=null,o=null,a,c,u,l,f=[];for(e=fe.rc2.expandKey(e,t),u=0;u<64;u++)f.push(e.getInt16Le());r?(a=function(d){for(u=0;u<4;u++)d[u]+=f[l]+(d[(u+3)%4]&d[(u+2)%4])+(~d[(u+3)%4]&d[(u+1)%4]),d[u]=eg(d[u],Jf[u]),l++},c=function(d){for(u=0;u<4;u++)d[u]+=f[d[(u+3)%4]&63]}):(a=function(d){for(u=3;u>=0;u--)d[u]=rg(d[u],Jf[u]),d[u]-=f[l]+(d[(u+3)%4]&d[(u+2)%4])+(~d[(u+3)%4]&d[(u+1)%4]),l--},c=function(d){for(u=3;u>=0;u--)d[u]-=f[d[(u+3)%4]&63]});var h=function(d){var m=[];for(u=0;u<4;u++){var y=i.getInt16Le();o!==null&&(r?y^=o.getInt16Le():o.putInt16Le(y)),m.push(y&65535)}l=r?0:63;for(var g=0;g<d.length;g++)for(var x=0;x<d[g][0];x++)d[g][1](m);for(u=0;u<4;u++)o!==null&&(r?o.putInt16Le(m[u]):m[u]^=o.getInt16Le()),s.putInt16Le(m[u])},p=null;return p={start:function(d,m){d&&typeof d=="string"&&(d=fe.util.createBuffer(d)),n=!1,i=fe.util.createBuffer(),s=m||new fe.util.createBuffer,o=d,p.output=s},update:function(d){for(n||i.putBuffer(d);i.length()>=8;)h([[5,a],[1,c],[6,a],[1,c],[5,a]])},finish:function(d){var m=!0;if(r)if(d)m=d(8,i,!r);else{var y=i.length()===8?8:8-i.length();i.fillWithByte(y,y)}if(m&&(n=!0,p.update()),!r&&(m=i.length()===0,m))if(d)m=d(8,s,!r);else{var g=s.length(),x=s.at(g-1);x>g?m=!1:s.truncate(x)}return m}},p};fe.rc2.startEncrypting=function(e,t,r){var n=fe.rc2.createEncryptionCipher(e,128);return n.start(t,r),n};fe.rc2.createEncryptionCipher=function(e,t){return jf(e,t,!0)};fe.rc2.startDecrypting=function(e,t,r){var n=fe.rc2.createDecryptionCipher(e,128);return n.start(t,r),n};fe.rc2.createDecryptionCipher=function(e,t){return jf(e,t,!1)}});var Vs=V((O_,u0)=>{var Qa=ht();u0.exports=Qa.jsbn=Qa.jsbn||{};var sr,ng=0xdeadbeefcafe,r0=(ng&16777215)==15715070;function R(e,t,r){this.data=[],e!=null&&(typeof e=="number"?this.fromNumber(e,t,r):t==null&&typeof e!="string"?this.fromString(e,256):this.fromString(e,t))}Qa.jsbn.BigInteger=R;function ot(){return new R(null)}function ig(e,t,r,n,i,s){for(;--s>=0;){var o=t*this.data[e++]+r.data[n]+i;i=Math.floor(o/67108864),r.data[n++]=o&67108863}return i}function sg(e,t,r,n,i,s){for(var o=t&32767,a=t>>15;--s>=0;){var c=this.data[e]&32767,u=this.data[e++]>>15,l=a*c+u*o;c=o*c+((l&32767)<<15)+r.data[n]+(i&1073741823),i=(c>>>30)+(l>>>15)+a*u+(i>>>30),r.data[n++]=c&1073741823}return i}function n0(e,t,r,n,i,s){for(var o=t&16383,a=t>>14;--s>=0;){var c=this.data[e]&16383,u=this.data[e++]>>14,l=a*c+u*o;c=o*c+((l&16383)<<14)+r.data[n]+i,i=(c>>28)+(l>>14)+a*u,r.data[n++]=c&268435455}return i}typeof navigator>"u"?(R.prototype.am=n0,sr=28):r0&&navigator.appName=="Microsoft Internet Explorer"?(R.prototype.am=sg,sr=30):r0&&navigator.appName!="Netscape"?(R.prototype.am=ig,sr=26):(R.prototype.am=n0,sr=28);R.prototype.DB=sr;R.prototype.DM=(1<<sr)-1;R.prototype.DV=1<<sr;var Xa=52;R.prototype.FV=Math.pow(2,Xa);R.prototype.F1=Xa-sr;R.prototype.F2=2*sr-Xa;var og="0123456789abcdefghijklmnopqrstuvwxyz",Fs=new Array,Un,Ae;Un="0".charCodeAt(0);for(Ae=0;Ae<=9;++Ae)Fs[Un++]=Ae;Un="a".charCodeAt(0);for(Ae=10;Ae<36;++Ae)Fs[Un++]=Ae;Un="A".charCodeAt(0);for(Ae=10;Ae<36;++Ae)Fs[Un++]=Ae;function i0(e){return og.charAt(e)}function s0(e,t){var r=Fs[e.charCodeAt(t)];return r??-1}function ag(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s}function cg(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0}function Ar(e){var t=ot();return t.fromInt(e),t}function ug(e,t){var r;if(t==16)r=4;else if(t==8)r=3;else if(t==256)r=8;else if(t==2)r=1;else if(t==32)r=5;else if(t==4)r=2;else{this.fromRadix(e,t);return}this.t=0,this.s=0;for(var n=e.length,i=!1,s=0;--n>=0;){var o=r==8?e[n]&255:s0(e,n);if(o<0){e.charAt(n)=="-"&&(i=!0);continue}i=!1,s==0?this.data[this.t++]=o:s+r>this.DB?(this.data[this.t-1]|=(o&(1<<this.DB-s)-1)<<s,this.data[this.t++]=o>>this.DB-s):this.data[this.t-1]|=o<<s,s+=r,s>=this.DB&&(s-=this.DB)}r==8&&e[0]&128&&(this.s=-1,s>0&&(this.data[this.t-1]|=(1<<this.DB-s)-1<<s)),this.clamp(),i&&R.ZERO.subTo(this,this)}function lg(){for(var e=this.s&this.DM;this.t>0&&this.data[this.t-1]==e;)--this.t}function fg(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(e==16)t=4;else if(e==8)t=3;else if(e==2)t=1;else if(e==32)t=5;else if(e==4)t=2;else return this.toRadix(e);var r=(1<<t)-1,n,i=!1,s="",o=this.t,a=this.DB-o*this.DB%t;if(o-- >0)for(a<this.DB&&(n=this.data[o]>>a)>0&&(i=!0,s=i0(n));o>=0;)a<t?(n=(this.data[o]&(1<<a)-1)<<t-a,n|=this.data[--o]>>(a+=this.DB-t)):(n=this.data[o]>>(a-=t)&r,a<=0&&(a+=this.DB,--o)),n>0&&(i=!0),i&&(s+=i0(n));return i?s:"0"}function hg(){var e=ot();return R.ZERO.subTo(this,e),e}function dg(){return this.s<0?this.negate():this}function pg(e){var t=this.s-e.s;if(t!=0)return t;var r=this.t;if(t=r-e.t,t!=0)return this.s<0?-t:t;for(;--r>=0;)if((t=this.data[r]-e.data[r])!=0)return t;return 0}function Ks(e){var t=1,r;return(r=e>>>16)!=0&&(e=r,t+=16),(r=e>>8)!=0&&(e=r,t+=8),(r=e>>4)!=0&&(e=r,t+=4),(r=e>>2)!=0&&(e=r,t+=2),(r=e>>1)!=0&&(e=r,t+=1),t}function mg(){return this.t<=0?0:this.DB*(this.t-1)+Ks(this.data[this.t-1]^this.s&this.DM)}function yg(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s}function gg(e,t){for(var r=e;r<this.t;++r)t.data[r-e]=this.data[r];t.t=Math.max(this.t-e,0),t.s=this.s}function xg(e,t){var r=e%this.DB,n=this.DB-r,i=(1<<n)-1,s=Math.floor(e/this.DB),o=this.s<<r&this.DM,a;for(a=this.t-1;a>=0;--a)t.data[a+s+1]=this.data[a]>>n|o,o=(this.data[a]&i)<<r;for(a=s-1;a>=0;--a)t.data[a]=0;t.data[s]=o,t.t=this.t+s+1,t.s=this.s,t.clamp()}function Eg(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t){t.t=0;return}var n=e%this.DB,i=this.DB-n,s=(1<<n)-1;t.data[0]=this.data[r]>>n;for(var o=r+1;o<this.t;++o)t.data[o-r-1]|=(this.data[o]&s)<<i,t.data[o-r]=this.data[o]>>n;n>0&&(t.data[this.t-r-1]|=(this.s&s)<<i),t.t=this.t-r,t.clamp()}function bg(e,t){for(var r=0,n=0,i=Math.min(e.t,this.t);r<i;)n+=this.data[r]-e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n-=e.s;r<this.t;)n+=this.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n-=e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t.data[r++]=this.DV+n:n>0&&(t.data[r++]=n),t.t=r,t.clamp()}function wg(e,t){var r=this.abs(),n=e.abs(),i=r.t;for(t.t=i+n.t;--i>=0;)t.data[i]=0;for(i=0;i<n.t;++i)t.data[i+r.t]=r.am(0,n.data[i],t,i,0,r.t);t.s=0,t.clamp(),this.s!=e.s&&R.ZERO.subTo(t,t)}function vg(e){for(var t=this.abs(),r=e.t=2*t.t;--r>=0;)e.data[r]=0;for(r=0;r<t.t-1;++r){var n=t.am(r,t.data[r],e,2*r,0,1);(e.data[r+t.t]+=t.am(r+1,2*t.data[r],e,2*r+1,n,t.t-r-1))>=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()}function _g(e,t,r){var n=e.abs();if(!(n.t<=0)){var i=this.abs();if(i.t<n.t){t?.fromInt(0),r!=null&&this.copyTo(r);return}r==null&&(r=ot());var s=ot(),o=this.s,a=e.s,c=this.DB-Ks(n.data[n.t-1]);c>0?(n.lShiftTo(c,s),i.lShiftTo(c,r)):(n.copyTo(s),i.copyTo(r));var u=s.t,l=s.data[u-1];if(l!=0){var f=l*(1<<this.F1)+(u>1?s.data[u-2]>>this.F2:0),h=this.FV/f,p=(1<<this.F1)/f,d=1<<this.F2,m=r.t,y=m-u,g=t??ot();for(s.dlShiftTo(y,g),r.compareTo(g)>=0&&(r.data[r.t++]=1,r.subTo(g,r)),R.ONE.dlShiftTo(u,g),g.subTo(s,s);s.t<u;)s.data[s.t++]=0;for(;--y>=0;){var x=r.data[--m]==l?this.DM:Math.floor(r.data[m]*h+(r.data[m-1]+d)*p);if((r.data[m]+=s.am(0,x,r,y,0,u))<x)for(s.dlShiftTo(y,g),r.subTo(g,r);r.data[m]<--x;)r.subTo(g,r)}t!=null&&(r.drShiftTo(u,t),o!=a&&R.ZERO.subTo(t,t)),r.t=u,r.clamp(),c>0&&r.rShiftTo(c,r),o<0&&R.ZERO.subTo(r,r)}}}function Sg(e){var t=ot();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(R.ZERO)>0&&e.subTo(t,t),t}function tn(e){this.m=e}function Ag(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function Ig(e){return e}function Rg(e){e.divRemTo(this.m,null,e)}function Cg(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function Tg(e,t){e.squareTo(t),this.reduce(t)}tn.prototype.convert=Ag;tn.prototype.revert=Ig;tn.prototype.reduce=Rg;tn.prototype.mulTo=Cg;tn.prototype.sqrTo=Tg;function Bg(){if(this.t<1)return 0;var e=this.data[0];if(!(e&1))return 0;var t=e&3;return t=t*(2-(e&15)*t)&15,t=t*(2-(e&255)*t)&255,t=t*(2-((e&65535)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t}function en(e){this.m=e,this.mp=e.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function Lg(e){var t=ot();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(R.ZERO)>0&&this.m.subTo(t,t),t}function Pg(e){var t=ot();return e.copyTo(t),this.reduce(t),t}function Dg(e){for(;e.t<=this.mt2;)e.data[e.t++]=0;for(var t=0;t<this.m.t;++t){var r=e.data[t]&32767,n=r*this.mpl+((r*this.mph+(e.data[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e.data[r]+=this.m.am(0,n,e,t,0,this.m.t);e.data[r]>=e.DV;)e.data[r]-=e.DV,e.data[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}function Ng(e,t){e.squareTo(t),this.reduce(t)}function kg(e,t,r){e.multiplyTo(t,r),this.reduce(r)}en.prototype.convert=Lg;en.prototype.revert=Pg;en.prototype.reduce=Dg;en.prototype.mulTo=kg;en.prototype.sqrTo=Ng;function Og(){return(this.t>0?this.data[0]&1:this.s)==0}function Mg(e,t){if(e>4294967295||e<1)return R.ONE;var r=ot(),n=ot(),i=t.convert(this),s=Ks(e)-1;for(i.copyTo(r);--s>=0;)if(t.sqrTo(r,n),(e&1<<s)>0)t.mulTo(n,i,r);else{var o=r;r=n,n=o}return t.revert(r)}function Ug(e,t){var r;return e<256||t.isEven()?r=new tn(t):r=new en(t),this.exp(e,r)}R.prototype.copyTo=ag;R.prototype.fromInt=cg;R.prototype.fromString=ug;R.prototype.clamp=lg;R.prototype.dlShiftTo=yg;R.prototype.drShiftTo=gg;R.prototype.lShiftTo=xg;R.prototype.rShiftTo=Eg;R.prototype.subTo=bg;R.prototype.multiplyTo=wg;R.prototype.squareTo=vg;R.prototype.divRemTo=_g;R.prototype.invDigit=Bg;R.prototype.isEven=Og;R.prototype.exp=Mg;R.prototype.toString=fg;R.prototype.negate=hg;R.prototype.abs=dg;R.prototype.compareTo=pg;R.prototype.bitLength=mg;R.prototype.mod=Sg;R.prototype.modPowInt=Ug;R.ZERO=Ar(0);R.ONE=Ar(1);function Fg(){var e=ot();return this.copyTo(e),e}function Kg(){if(this.s<0){if(this.t==1)return this.data[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this.data[0];if(this.t==0)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]}function Vg(){return this.t==0?this.s:this.data[0]<<24>>24}function qg(){return this.t==0?this.s:this.data[0]<<16>>16}function $g(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function zg(){return this.s<0?-1:this.t<=0||this.t==1&&this.data[0]<=0?0:1}function Hg(e){if(e==null&&(e=10),this.signum()==0||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),n=Ar(r),i=ot(),s=ot(),o="";for(this.divRemTo(n,i,s);i.signum()>0;)o=(r+s.intValue()).toString(e).substr(1)+o,i.divRemTo(n,i,s);return s.intValue().toString(e)+o}function Gg(e,t){this.fromInt(0),t==null&&(t=10);for(var r=this.chunkSize(t),n=Math.pow(t,r),i=!1,s=0,o=0,a=0;a<e.length;++a){var c=s0(e,a);if(c<0){e.charAt(a)=="-"&&this.signum()==0&&(i=!0);continue}o=t*o+c,++s>=r&&(this.dMultiply(n),this.dAddOffset(o,0),s=0,o=0)}s>0&&(this.dMultiply(Math.pow(t,s)),this.dAddOffset(o,0)),i&&R.ZERO.subTo(this,this)}function Yg(e,t,r){if(typeof t=="number")if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(R.ONE.shiftLeft(e-1),Za,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(R.ONE.shiftLeft(e-1),this);else{var n=new Array,i=e&7;n.length=(e>>3)+1,t.nextBytes(n),i>0?n[0]&=(1<<i)-1:n[0]=0,this.fromString(n,256)}}function Wg(){var e=this.t,t=new Array;t[0]=this.s;var r=this.DB-e*this.DB%8,n,i=0;if(e-- >0)for(r<this.DB&&(n=this.data[e]>>r)!=(this.s&this.DM)>>r&&(t[i++]=n|this.s<<this.DB-r);e>=0;)r<8?(n=(this.data[e]&(1<<r)-1)<<8-r,n|=this.data[--e]>>(r+=this.DB-8)):(n=this.data[e]>>(r-=8)&255,r<=0&&(r+=this.DB,--e)),n&128&&(n|=-256),i==0&&(this.s&128)!=(n&128)&&++i,(i>0||n!=this.s)&&(t[i++]=n);return t}function Qg(e){return this.compareTo(e)==0}function Xg(e){return this.compareTo(e)<0?this:e}function Zg(e){return this.compareTo(e)>0?this:e}function Jg(e,t,r){var n,i,s=Math.min(e.t,this.t);for(n=0;n<s;++n)r.data[n]=t(this.data[n],e.data[n]);if(e.t<this.t){for(i=e.s&this.DM,n=s;n<this.t;++n)r.data[n]=t(this.data[n],i);r.t=this.t}else{for(i=this.s&this.DM,n=s;n<e.t;++n)r.data[n]=t(i,e.data[n]);r.t=e.t}r.s=t(this.s,e.s),r.clamp()}function jg(e,t){return e&t}function tx(e){var t=ot();return this.bitwiseTo(e,jg,t),t}function Za(e,t){return e|t}function ex(e){var t=ot();return this.bitwiseTo(e,Za,t),t}function o0(e,t){return e^t}function rx(e){var t=ot();return this.bitwiseTo(e,o0,t),t}function a0(e,t){return e&~t}function nx(e){var t=ot();return this.bitwiseTo(e,a0,t),t}function ix(){for(var e=ot(),t=0;t<this.t;++t)e.data[t]=this.DM&~this.data[t];return e.t=this.t,e.s=~this.s,e}function sx(e){var t=ot();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t}function ox(e){var t=ot();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t}function ax(e){if(e==0)return-1;var t=0;return e&65535||(e>>=16,t+=16),e&255||(e>>=8,t+=8),e&15||(e>>=4,t+=4),e&3||(e>>=2,t+=2),e&1||++t,t}function cx(){for(var e=0;e<this.t;++e)if(this.data[e]!=0)return e*this.DB+ax(this.data[e]);return this.s<0?this.t*this.DB:-1}function ux(e){for(var t=0;e!=0;)e&=e-1,++t;return t}function lx(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=ux(this.data[r]^t);return e}function fx(e){var t=Math.floor(e/this.DB);return t>=this.t?this.s!=0:(this.data[t]&1<<e%this.DB)!=0}function hx(e,t){var r=R.ONE.shiftLeft(e);return this.bitwiseTo(r,t,r),r}function dx(e){return this.changeBit(e,Za)}function px(e){return this.changeBit(e,a0)}function mx(e){return this.changeBit(e,o0)}function yx(e,t){for(var r=0,n=0,i=Math.min(e.t,this.t);r<i;)n+=this.data[r]+e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n+=e.s;r<this.t;)n+=this.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n+=e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=e.s}t.s=n<0?-1:0,n>0?t.data[r++]=n:n<-1&&(t.data[r++]=this.DV+n),t.t=r,t.clamp()}function gx(e){var t=ot();return this.addTo(e,t),t}function xx(e){var t=ot();return this.subTo(e,t),t}function Ex(e){var t=ot();return this.multiplyTo(e,t),t}function bx(e){var t=ot();return this.divRemTo(e,t,null),t}function wx(e){var t=ot();return this.divRemTo(e,null,t),t}function vx(e){var t=ot(),r=ot();return this.divRemTo(e,t,r),new Array(t,r)}function _x(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function Sx(e,t){if(e!=0){for(;this.t<=t;)this.data[this.t++]=0;for(this.data[t]+=e;this.data[t]>=this.DV;)this.data[t]-=this.DV,++t>=this.t&&(this.data[this.t++]=0),++this.data[t]}}function Di(){}function c0(e){return e}function Ax(e,t,r){e.multiplyTo(t,r)}function Ix(e,t){e.squareTo(t)}Di.prototype.convert=c0;Di.prototype.revert=c0;Di.prototype.mulTo=Ax;Di.prototype.sqrTo=Ix;function Rx(e){return this.exp(e,new Di)}function Cx(e,t,r){var n=Math.min(this.t+e.t,t);for(r.s=0,r.t=n;n>0;)r.data[--n]=0;var i;for(i=r.t-this.t;n<i;++n)r.data[n+this.t]=this.am(0,e.data[n],r,n,0,this.t);for(i=Math.min(e.t,t);n<i;++n)this.am(0,e.data[n],r,n,0,t-n);r.clamp()}function Tx(e,t,r){--t;var n=r.t=this.t+e.t-t;for(r.s=0;--n>=0;)r.data[n]=0;for(n=Math.max(t-this.t,0);n<e.t;++n)r.data[this.t+n-t]=this.am(t-n,e.data[n],r,0,0,this.t+n-t);r.clamp(),r.drShiftTo(1,r)}function Fn(e){this.r2=ot(),this.q3=ot(),R.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}function Bx(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=ot();return e.copyTo(t),this.reduce(t),t}function Lx(e){return e}function Px(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)}function Dx(e,t){e.squareTo(t),this.reduce(t)}function Nx(e,t,r){e.multiplyTo(t,r),this.reduce(r)}Fn.prototype.convert=Bx;Fn.prototype.revert=Lx;Fn.prototype.reduce=Px;Fn.prototype.mulTo=Nx;Fn.prototype.sqrTo=Dx;function kx(e,t){var r=e.bitLength(),n,i=Ar(1),s;if(r<=0)return i;r<18?n=1:r<48?n=3:r<144?n=4:r<768?n=5:n=6,r<8?s=new tn(t):t.isEven()?s=new Fn(t):s=new en(t);var o=new Array,a=3,c=n-1,u=(1<<n)-1;if(o[1]=s.convert(this),n>1){var l=ot();for(s.sqrTo(o[1],l);a<=u;)o[a]=ot(),s.mulTo(l,o[a-2],o[a]),a+=2}var f=e.t-1,h,p=!0,d=ot(),m;for(r=Ks(e.data[f])-1;f>=0;){for(r>=c?h=e.data[f]>>r-c&u:(h=(e.data[f]&(1<<r+1)-1)<<c-r,f>0&&(h|=e.data[f-1]>>this.DB+r-c)),a=n;!(h&1);)h>>=1,--a;if((r-=a)<0&&(r+=this.DB,--f),p)o[h].copyTo(i),p=!1;else{for(;a>1;)s.sqrTo(i,d),s.sqrTo(d,i),a-=2;a>0?s.sqrTo(i,d):(m=i,i=d,d=m),s.mulTo(d,o[h],i)}for(;f>=0&&!(e.data[f]&1<<r);)s.sqrTo(i,d),m=i,i=d,d=m,--r<0&&(r=this.DB-1,--f)}return s.revert(i)}function Ox(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var n=t;t=r,r=n}var i=t.getLowestSetBit(),s=r.getLowestSetBit();if(s<0)return t;for(i<s&&(s=i),s>0&&(t.rShiftTo(s,t),r.rShiftTo(s,r));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return s>0&&r.lShiftTo(s,r),r}function Mx(e){if(e<=0)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)if(t==0)r=this.data[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this.data[n])%e;return r}function Ux(e){var t=e.isEven();if(this.isEven()&&t||e.signum()==0)return R.ZERO;for(var r=e.clone(),n=this.clone(),i=Ar(1),s=Ar(0),o=Ar(0),a=Ar(1);r.signum()!=0;){for(;r.isEven();)r.rShiftTo(1,r),t?((!i.isEven()||!s.isEven())&&(i.addTo(this,i),s.subTo(e,s)),i.rShiftTo(1,i)):s.isEven()||s.subTo(e,s),s.rShiftTo(1,s);for(;n.isEven();)n.rShiftTo(1,n),t?((!o.isEven()||!a.isEven())&&(o.addTo(this,o),a.subTo(e,a)),o.rShiftTo(1,o)):a.isEven()||a.subTo(e,a),a.rShiftTo(1,a);r.compareTo(n)>=0?(r.subTo(n,r),t&&i.subTo(o,i),s.subTo(a,s)):(n.subTo(r,n),t&&o.subTo(i,o),a.subTo(s,a))}if(n.compareTo(R.ONE)!=0)return R.ZERO;if(a.compareTo(e)>=0)return a.subtract(e);if(a.signum()<0)a.addTo(e,a);else return a;return a.signum()<0?a.add(e):a}var Pe=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],Fx=(1<<26)/Pe[Pe.length-1];function Kx(e){var t,r=this.abs();if(r.t==1&&r.data[0]<=Pe[Pe.length-1]){for(t=0;t<Pe.length;++t)if(r.data[0]==Pe[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<Pe.length;){for(var n=Pe[t],i=t+1;i<Pe.length&&n<Fx;)n*=Pe[i++];for(n=r.modInt(n);t<i;)if(n%Pe[t++]==0)return!1}return r.millerRabin(e)}function Vx(e){var t=this.subtract(R.ONE),r=t.getLowestSetBit();if(r<=0)return!1;for(var n=t.shiftRight(r),i=qx(),s,o=0;o<e;++o){do s=new R(this.bitLength(),i);while(s.compareTo(R.ONE)<=0||s.compareTo(t)>=0);var a=s.modPow(n,this);if(a.compareTo(R.ONE)!=0&&a.compareTo(t)!=0){for(var c=1;c++<r&&a.compareTo(t)!=0;)if(a=a.modPowInt(2,this),a.compareTo(R.ONE)==0)return!1;if(a.compareTo(t)!=0)return!1}}return!0}function qx(){return{nextBytes:function(e){for(var t=0;t<e.length;++t)e[t]=Math.floor(Math.random()*256)}}}R.prototype.chunkSize=$g;R.prototype.toRadix=Hg;R.prototype.fromRadix=Gg;R.prototype.fromNumber=Yg;R.prototype.bitwiseTo=Jg;R.prototype.changeBit=hx;R.prototype.addTo=yx;R.prototype.dMultiply=_x;R.prototype.dAddOffset=Sx;R.prototype.multiplyLowerTo=Cx;R.prototype.multiplyUpperTo=Tx;R.prototype.modInt=Mx;R.prototype.millerRabin=Vx;R.prototype.clone=Fg;R.prototype.intValue=Kg;R.prototype.byteValue=Vg;R.prototype.shortValue=qg;R.prototype.signum=zg;R.prototype.toByteArray=Wg;R.prototype.equals=Qg;R.prototype.min=Xg;R.prototype.max=Zg;R.prototype.and=tx;R.prototype.or=ex;R.prototype.xor=rx;R.prototype.andNot=nx;R.prototype.not=ix;R.prototype.shiftLeft=sx;R.prototype.shiftRight=ox;R.prototype.getLowestSetBit=cx;R.prototype.bitCount=lx;R.prototype.testBit=fx;R.prototype.setBit=dx;R.prototype.clearBit=px;R.prototype.flipBit=mx;R.prototype.add=gx;R.prototype.subtract=xx;R.prototype.multiply=Ex;R.prototype.divide=bx;R.prototype.remainder=wx;R.prototype.divideAndRemainder=vx;R.prototype.modPow=kx;R.prototype.modInverse=Ux;R.prototype.pow=Rx;R.prototype.gcd=Ox;R.prototype.isProbablePrime=Kx});var p0=V((M_,d0)=>{var ze=ht();jr();Pt();var f0=d0.exports=ze.sha1=ze.sha1||{};ze.md.sha1=ze.md.algorithms.sha1=f0;f0.create=function(){h0||$x();var e=null,t=ze.util.createBuffer(),r=new Array(80),n={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8};return n.start=function(){n.messageLength=0,n.fullMessageLength=n.messageLength64=[];for(var i=n.messageLengthSize/4,s=0;s<i;++s)n.fullMessageLength.push(0);return t=ze.util.createBuffer(),e={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},n},n.start(),n.update=function(i,s){s==="utf8"&&(i=ze.util.encodeUtf8(i));var o=i.length;n.messageLength+=o,o=[o/4294967296>>>0,o>>>0];for(var a=n.fullMessageLength.length-1;a>=0;--a)n.fullMessageLength[a]+=o[1],o[1]=o[0]+(n.fullMessageLength[a]/4294967296>>>0),n.fullMessageLength[a]=n.fullMessageLength[a]>>>0,o[0]=o[1]/4294967296>>>0;return t.putBytes(i),l0(e,r,t),(t.read>2048||t.length()===0)&&t.compact(),n},n.digest=function(){var i=ze.util.createBuffer();i.putBytes(t.bytes());var s=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize,o=s&n.blockLength-1;i.putBytes(Ja.substr(0,n.blockLength-o));for(var a,c,u=n.fullMessageLength[0]*8,l=0;l<n.fullMessageLength.length-1;++l)a=n.fullMessageLength[l+1]*8,c=a/4294967296>>>0,u+=c,i.putInt32(u>>>0),u=a>>>0;i.putInt32(u);var f={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4};l0(f,r,i);var h=ze.util.createBuffer();return h.putInt32(f.h0),h.putInt32(f.h1),h.putInt32(f.h2),h.putInt32(f.h3),h.putInt32(f.h4),h},n};var Ja=null,h0=!1;function $x(){Ja=String.fromCharCode(128),Ja+=ze.util.fillString(String.fromCharCode(0),64),h0=!0}function l0(e,t,r){for(var n,i,s,o,a,c,u,l,f=r.length();f>=64;){for(i=e.h0,s=e.h1,o=e.h2,a=e.h3,c=e.h4,l=0;l<16;++l)n=r.getInt32(),t[l]=n,u=a^s&(o^a),n=(i<<5|i>>>27)+u+c+1518500249+n,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;for(;l<20;++l)n=t[l-3]^t[l-8]^t[l-14]^t[l-16],n=n<<1|n>>>31,t[l]=n,u=a^s&(o^a),n=(i<<5|i>>>27)+u+c+1518500249+n,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;for(;l<32;++l)n=t[l-3]^t[l-8]^t[l-14]^t[l-16],n=n<<1|n>>>31,t[l]=n,u=s^o^a,n=(i<<5|i>>>27)+u+c+1859775393+n,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;for(;l<40;++l)n=t[l-6]^t[l-16]^t[l-28]^t[l-32],n=n<<2|n>>>30,t[l]=n,u=s^o^a,n=(i<<5|i>>>27)+u+c+1859775393+n,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;for(;l<60;++l)n=t[l-6]^t[l-16]^t[l-28]^t[l-32],n=n<<2|n>>>30,t[l]=n,u=s&o|a&(s^o),n=(i<<5|i>>>27)+u+c+2400959708+n,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;for(;l<80;++l)n=t[l-6]^t[l-16]^t[l-28]^t[l-32],n=n<<2|n>>>30,t[l]=n,u=s^o^a,n=(i<<5|i>>>27)+u+c+3395469782+n,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;e.h0=e.h0+i|0,e.h1=e.h1+s|0,e.h2=e.h2+o|0,e.h3=e.h3+a|0,e.h4=e.h4+c|0,f-=64}}});var g0=V((U_,y0)=>{var He=ht();Pt();Pi();p0();var m0=y0.exports=He.pkcs1=He.pkcs1||{};m0.encode_rsa_oaep=function(e,t,r){var n,i,s,o;typeof r=="string"?(n=r,i=arguments[3]||void 0,s=arguments[4]||void 0):r&&(n=r.label||void 0,i=r.seed||void 0,s=r.md||void 0,r.mgf1&&r.mgf1.md&&(o=r.mgf1.md)),s?s.start():s=He.md.sha1.create(),o||(o=s);var a=Math.ceil(e.n.bitLength()/8),c=a-2*s.digestLength-2;if(t.length>c){var u=new Error("RSAES-OAEP input message length is too long.");throw u.length=t.length,u.maxLength=c,u}n||(n=""),s.update(n,"raw");for(var l=s.digest(),f="",h=c-t.length,p=0;p<h;p++)f+="\0";var d=l.getBytes()+f+""+t;if(!i)i=He.random.getBytes(s.digestLength);else if(i.length!==s.digestLength){var u=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.");throw u.seedLength=i.length,u.digestLength=s.digestLength,u}var m=qs(i,a-s.digestLength-1,o),y=He.util.xorBytes(d,m,d.length),g=qs(y,s.digestLength,o),x=He.util.xorBytes(i,g,i.length);return"\0"+x+y};m0.decode_rsa_oaep=function(e,t,r){var n,i,s;typeof r=="string"?(n=r,i=arguments[3]||void 0):r&&(n=r.label||void 0,i=r.md||void 0,r.mgf1&&r.mgf1.md&&(s=r.mgf1.md));var o=Math.ceil(e.n.bitLength()/8);if(t.length!==o){var y=new Error("RSAES-OAEP encoded message length is invalid.");throw y.length=t.length,y.expectedLength=o,y}if(i===void 0?i=He.md.sha1.create():i.start(),s||(s=i),o<2*i.digestLength+2)throw new Error("RSAES-OAEP key is too short for the hash function.");n||(n=""),i.update(n,"raw");for(var a=i.digest().getBytes(),c=t.charAt(0),u=t.substring(1,i.digestLength+1),l=t.substring(1+i.digestLength),f=qs(l,i.digestLength,s),h=He.util.xorBytes(u,f,u.length),p=qs(h,o-i.digestLength-1,s),d=He.util.xorBytes(l,p,l.length),m=d.substring(0,i.digestLength),y=c!=="\0",g=0;g<i.digestLength;++g)y|=a.charAt(g)!==m.charAt(g);for(var x=1,b=i.digestLength,C=i.digestLength;C<d.length;C++){var _=d.charCodeAt(C),S=_&1^1,P=x?65534:0;y|=_&P,x=x&S,b+=x}if(y||d.charCodeAt(b)!==1)throw new Error("Invalid RSAES-OAEP padding.");return d.substring(b+1)};function qs(e,t,r){r||(r=He.md.sha1.create());for(var n="",i=Math.ceil(t/r.digestLength),s=0;s<i;++s){var o=String.fromCharCode(s>>24&255,s>>16&255,s>>8&255,s&255);r.start(),r.update(e+o),n+=r.digest().getBytes()}return n.substring(0,t)}});var x0=V((F_,ja)=>{var Ir=ht();Pt();Vs();Pi();(function(){if(Ir.prime){ja.exports=Ir.prime;return}var e=ja.exports=Ir.prime=Ir.prime||{},t=Ir.jsbn.BigInteger,r=[6,4,2,4,2,4,6,2],n=new t(null);n.fromInt(30);var i=function(f,h){return f|h};e.generateProbablePrime=function(f,h,p){typeof h=="function"&&(p=h,h={}),h=h||{};var d=h.algorithm||"PRIMEINC";typeof d=="string"&&(d={name:d}),d.options=d.options||{};var m=h.prng||Ir.random,y={nextBytes:function(g){for(var x=m.getBytesSync(g.length),b=0;b<g.length;++b)g[b]=x.charCodeAt(b)}};if(d.name==="PRIMEINC")return s(f,y,d.options,p);throw new Error("Invalid prime generation algorithm: "+d.name)};function s(f,h,p,d){return"workers"in p?c(f,h,p,d):o(f,h,p,d)}function o(f,h,p,d){var m=u(f,h),y=0,g=l(m.bitLength());"millerRabinTests"in p&&(g=p.millerRabinTests);var x=10;"maxBlockTime"in p&&(x=p.maxBlockTime),a(m,f,h,y,g,x,d)}function a(f,h,p,d,m,y,g){var x=+new Date;do{if(f.bitLength()>h&&(f=u(h,p)),f.isProbablePrime(m))return g(null,f);f.dAddOffset(r[d++%8],0)}while(y<0||+new Date-x<y);Ir.util.setImmediate(function(){a(f,h,p,d,m,y,g)})}function c(f,h,p,d){if(typeof Worker>"u")return o(f,h,p,d);var m=u(f,h),y=p.workers,g=p.workLoad||100,x=g*30/8,b=p.workerScript||"forge/prime.worker.js";if(y===-1)return Ir.util.estimateCores(function(_,S){_&&(S=2),y=S-1,C()});C();function C(){y=Math.max(1,y);for(var _=[],S=0;S<y;++S)_[S]=new Worker(b);for(var P=y,S=0;S<y;++S)_[S].addEventListener("message",Y);var D=!1;function Y(W){if(!D){--P;var z=W.data;if(z.found){for(var et=0;et<_.length;++et)_[et].terminate();return D=!0,d(null,new t(z.prime,16))}m.bitLength()>f&&(m=u(f,h));var pt=m.toString(16);W.target.postMessage({hex:pt,workLoad:g}),m.dAddOffset(x,0)}}}}function u(f,h){var p=new t(f,h),d=f-1;return p.testBit(d)||p.bitwiseTo(t.ONE.shiftLeft(d),i,p),p.dAddOffset(31-p.mod(n).byteValue(),0),p}function l(f){return f<=100?27:f<=150?18:f<=200?15:f<=250?12:f<=300?9:f<=350?8:f<=400?7:f<=500?6:f<=600?5:f<=800?4:f<=1250?3:2}})()});var zs=V((K_,A0)=>{var $=ht();Bi();Vs();Cs();g0();x0();Pi();Pt();typeof it>"u"&&(it=$.jsbn.BigInteger);var it,tc=$.util.isNodejs?Li():null,v=$.asn1,Ie=$.util;$.pki=$.pki||{};A0.exports=$.pki.rsa=$.rsa=$.rsa||{};var Q=$.pki,zx=[6,4,2,4,2,4,6,2],Hx={name:"PrivateKeyInfo",tagClass:v.Class.UNIVERSAL,type:v.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:v.Class.UNIVERSAL,type:v.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:v.Class.UNIVERSAL,type:v.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:v.Class.UNIVERSAL,type:v.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:v.Class.UNIVERSAL,type:v.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},Gx={name:"RSAPrivateKey",tagClass:v.Class.UNIVERSAL,type:v.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:v.Class.UNIVERSAL,type:v.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:v.Class.UNIVERSAL,type:v.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:v.Class.UNIVERSAL,type:v.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:v.Class.UNIVERSAL,type:v.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:v.Class.UNIVERSAL,type:v.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:v.Class.UNIVERSAL,type:v.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:v.Class.UNIVERSAL,type:v.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:v.Class.UNIVERSAL,type:v.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:v.Class.UNIVERSAL,type:v.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},Yx={name:"RSAPublicKey",tagClass:v.Class.UNIVERSAL,type:v.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:v.Class.UNIVERSAL,type:v.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:v.Class.UNIVERSAL,type:v.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},Wx=$.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:v.Class.UNIVERSAL,type:v.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:v.Class.UNIVERSAL,type:v.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:v.Class.UNIVERSAL,type:v.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:v.Class.UNIVERSAL,type:v.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:v.Class.UNIVERSAL,type:v.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},Qx={name:"DigestInfo",tagClass:v.Class.UNIVERSAL,type:v.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm",tagClass:v.Class.UNIVERSAL,type:v.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm.algorithmIdentifier",tagClass:v.Class.UNIVERSAL,type:v.Type.OID,constructed:!1,capture:"algorithmIdentifier"},{name:"DigestInfo.DigestAlgorithm.parameters",tagClass:v.Class.UNIVERSAL,type:v.Type.NULL,capture:"parameters",optional:!0,constructed:!1}]},{name:"DigestInfo.digest",tagClass:v.Class.UNIVERSAL,type:v.Type.OCTETSTRING,constructed:!1,capture:"digest"}]},Xx=function(e){var t;if(e.algorithm in Q.oids)t=Q.oids[e.algorithm];else{var r=new Error("Unknown message digest algorithm.");throw r.algorithm=e.algorithm,r}var n=v.oidToDer(t).getBytes(),i=v.create(v.Class.UNIVERSAL,v.Type.SEQUENCE,!0,[]),s=v.create(v.Class.UNIVERSAL,v.Type.SEQUENCE,!0,[]);s.value.push(v.create(v.Class.UNIVERSAL,v.Type.OID,!1,n)),s.value.push(v.create(v.Class.UNIVERSAL,v.Type.NULL,!1,""));var o=v.create(v.Class.UNIVERSAL,v.Type.OCTETSTRING,!1,e.digest().getBytes());return i.value.push(s),i.value.push(o),v.toDer(i).getBytes()},_0=function(e,t,r){if(r)return e.modPow(t.e,t.n);if(!t.p||!t.q)return e.modPow(t.d,t.n);t.dP||(t.dP=t.d.mod(t.p.subtract(it.ONE))),t.dQ||(t.dQ=t.d.mod(t.q.subtract(it.ONE))),t.qInv||(t.qInv=t.q.modInverse(t.p));var n;do n=new it($.util.bytesToHex($.random.getBytes(t.n.bitLength()/8)),16);while(n.compareTo(t.n)>=0||!n.gcd(t.n).equals(it.ONE));e=e.multiply(n.modPow(t.e,t.n)).mod(t.n);for(var i=e.mod(t.p).modPow(t.dP,t.p),s=e.mod(t.q).modPow(t.dQ,t.q);i.compareTo(s)<0;)i=i.add(t.p);var o=i.subtract(s).multiply(t.qInv).mod(t.p).multiply(t.q).add(s);return o=o.multiply(n.modInverse(t.n)).mod(t.n),o};Q.rsa.encrypt=function(e,t,r){var n=r,i,s=Math.ceil(t.n.bitLength()/8);r!==!1&&r!==!0?(n=r===2,i=S0(e,t,r)):(i=$.util.createBuffer(),i.putBytes(e));for(var o=new it(i.toHex(),16),a=_0(o,t,n),c=a.toString(16),u=$.util.createBuffer(),l=s-Math.ceil(c.length/2);l>0;)u.putByte(0),--l;return u.putBytes($.util.hexToBytes(c)),u.getBytes()};Q.rsa.decrypt=function(e,t,r,n){var i=Math.ceil(t.n.bitLength()/8);if(e.length!==i){var s=new Error("Encrypted message length is invalid.");throw s.length=e.length,s.expected=i,s}var o=new it($.util.createBuffer(e).toHex(),16);if(o.compareTo(t.n)>=0)throw new Error("Encrypted message is invalid.");for(var a=_0(o,t,r),c=a.toString(16),u=$.util.createBuffer(),l=i-Math.ceil(c.length/2);l>0;)u.putByte(0),--l;return u.putBytes($.util.hexToBytes(c)),n!==!1?$s(u.getBytes(),t,r):u.getBytes()};Q.rsa.createKeyPairGenerationState=function(e,t,r){typeof e=="string"&&(e=parseInt(e,10)),e=e||2048,r=r||{};var n=r.prng||$.random,i={nextBytes:function(a){for(var c=n.getBytesSync(a.length),u=0;u<a.length;++u)a[u]=c.charCodeAt(u)}},s=r.algorithm||"PRIMEINC",o;if(s==="PRIMEINC")o={algorithm:s,state:0,bits:e,rng:i,eInt:t||65537,e:new it(null),p:null,q:null,qBits:e>>1,pBits:e-(e>>1),pqState:0,num:null,keys:null},o.e.fromInt(o.eInt);else throw new Error("Invalid key generation algorithm: "+s);return o};Q.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var r=new it(null);r.fromInt(30);for(var n=0,i=function(f,h){return f|h},s=+new Date,o,a=0;e.keys===null&&(t<=0||a<t);){if(e.state===0){var c=e.p===null?e.pBits:e.qBits,u=c-1;e.pqState===0?(e.num=new it(c,e.rng),e.num.testBit(u)||e.num.bitwiseTo(it.ONE.shiftLeft(u),i,e.num),e.num.dAddOffset(31-e.num.mod(r).byteValue(),0),n=0,++e.pqState):e.pqState===1?e.num.bitLength()>c?e.pqState=0:e.num.isProbablePrime(Jx(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(zx[n++%8],0):e.pqState===2?e.pqState=e.num.subtract(it.ONE).gcd(e.e).compareTo(it.ONE)===0?3:0:e.pqState===3&&(e.pqState=0,e.p===null?e.p=e.num:e.q=e.num,e.p!==null&&e.q!==null&&++e.state,e.num=null)}else if(e.state===1)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(e.state===2)e.p1=e.p.subtract(it.ONE),e.q1=e.q.subtract(it.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(e.state===3)e.phi.gcd(e.e).compareTo(it.ONE)===0?++e.state:(e.p=null,e.q=null,e.state=0);else if(e.state===4)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(e.state===5){var l=e.e.modInverse(e.phi);e.keys={privateKey:Q.rsa.setPrivateKey(e.n,e.e,l,e.p,e.q,l.mod(e.p1),l.mod(e.q1),e.q.modInverse(e.p)),publicKey:Q.rsa.setPublicKey(e.n,e.e)}}o=+new Date,a+=o-s,s=o}return e.keys!==null};Q.rsa.generateKeyPair=function(e,t,r,n){if(arguments.length===1?typeof e=="object"?(r=e,e=void 0):typeof e=="function"&&(n=e,e=void 0):arguments.length===2?typeof e=="number"?typeof t=="function"?(n=t,t=void 0):typeof t!="number"&&(r=t,t=void 0):(r=e,n=t,e=void 0,t=void 0):arguments.length===3&&(typeof t=="number"?typeof r=="function"&&(n=r,r=void 0):(n=r,r=t,t=void 0)),r=r||{},e===void 0&&(e=r.bits||2048),t===void 0&&(t=r.e||65537),!$.options.usePureJavaScript&&!r.prng&&e>=256&&e<=16384&&(t===65537||t===3)){if(n){if(E0("generateKeyPair"))return tc.generateKeyPair("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},function(a,c,u){if(a)return n(a);n(null,{privateKey:Q.privateKeyFromPem(u),publicKey:Q.publicKeyFromPem(c)})});if(b0("generateKey")&&b0("exportKey"))return Ie.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:v0(t),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(a){return Ie.globalScope.crypto.subtle.exportKey("pkcs8",a.privateKey)}).then(void 0,function(a){n(a)}).then(function(a){if(a){var c=Q.privateKeyFromAsn1(v.fromDer($.util.createBuffer(a)));n(null,{privateKey:c,publicKey:Q.setRsaPublicKey(c.n,c.e)})}});if(w0("generateKey")&&w0("exportKey")){var i=Ie.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:v0(t),hash:{name:"SHA-256"}},!0,["sign","verify"]);i.oncomplete=function(a){var c=a.target.result,u=Ie.globalScope.msCrypto.subtle.exportKey("pkcs8",c.privateKey);u.oncomplete=function(l){var f=l.target.result,h=Q.privateKeyFromAsn1(v.fromDer($.util.createBuffer(f)));n(null,{privateKey:h,publicKey:Q.setRsaPublicKey(h.n,h.e)})},u.onerror=function(l){n(l)}},i.onerror=function(a){n(a)};return}}else if(E0("generateKeyPairSync")){var s=tc.generateKeyPairSync("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:Q.privateKeyFromPem(s.privateKey),publicKey:Q.publicKeyFromPem(s.publicKey)}}}var o=Q.rsa.createKeyPairGenerationState(e,t,r);if(!n)return Q.rsa.stepKeyPairGenerationState(o,0),o.keys;Zx(o,r,n)};Q.setRsaPublicKey=Q.rsa.setPublicKey=function(e,t){var r={n:e,e:t};return r.encrypt=function(n,i,s){if(typeof i=="string"?i=i.toUpperCase():i===void 0&&(i="RSAES-PKCS1-V1_5"),i==="RSAES-PKCS1-V1_5")i={encode:function(a,c,u){return S0(a,c,2).getBytes()}};else if(i==="RSA-OAEP"||i==="RSAES-OAEP")i={encode:function(a,c){return $.pkcs1.encode_rsa_oaep(c,a,s)}};else if(["RAW","NONE","NULL",null].indexOf(i)!==-1)i={encode:function(a){return a}};else if(typeof i=="string")throw new Error('Unsupported encryption scheme: "'+i+'".');var o=i.encode(n,r,!0);return Q.rsa.encrypt(o,r,!0)},r.verify=function(n,i,s,o){typeof s=="string"?s=s.toUpperCase():s===void 0&&(s="RSASSA-PKCS1-V1_5"),o===void 0&&(o={_parseAllDigestBytes:!0}),"_parseAllDigestBytes"in o||(o._parseAllDigestBytes=!0),s==="RSASSA-PKCS1-V1_5"?s={verify:function(c,u){u=$s(u,r,!0);var l=v.fromDer(u,{parseAllBytes:o._parseAllDigestBytes}),f={},h=[];if(!v.validate(l,Qx,f,h)){var p=new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value.");throw p.errors=h,p}var d=v.derToOid(f.algorithmIdentifier);if(!(d===$.oids.md2||d===$.oids.md5||d===$.oids.sha1||d===$.oids.sha224||d===$.oids.sha256||d===$.oids.sha384||d===$.oids.sha512||d===$.oids["sha512-224"]||d===$.oids["sha512-256"])){var p=new Error("Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.");throw p.oid=d,p}if((d===$.oids.md2||d===$.oids.md5)&&!("parameters"in f))throw new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value. Missing algorithm identifer NULL parameters.");return c===f.digest}}:(s==="NONE"||s==="NULL"||s===null)&&(s={verify:function(c,u){return u=$s(u,r,!0),c===u}});var a=Q.rsa.decrypt(i,r,!0,!1);return s.verify(n,a,r.n.bitLength())},r};Q.setRsaPrivateKey=Q.rsa.setPrivateKey=function(e,t,r,n,i,s,o,a){var c={n:e,e:t,d:r,p:n,q:i,dP:s,dQ:o,qInv:a};return c.decrypt=function(u,l,f){typeof l=="string"?l=l.toUpperCase():l===void 0&&(l="RSAES-PKCS1-V1_5");var h=Q.rsa.decrypt(u,c,!1,!1);if(l==="RSAES-PKCS1-V1_5")l={decode:$s};else if(l==="RSA-OAEP"||l==="RSAES-OAEP")l={decode:function(p,d){return $.pkcs1.decode_rsa_oaep(d,p,f)}};else if(["RAW","NONE","NULL",null].indexOf(l)!==-1)l={decode:function(p){return p}};else throw new Error('Unsupported encryption scheme: "'+l+'".');return l.decode(h,c,!1)},c.sign=function(u,l){var f=!1;typeof l=="string"&&(l=l.toUpperCase()),l===void 0||l==="RSASSA-PKCS1-V1_5"?(l={encode:Xx},f=1):(l==="NONE"||l==="NULL"||l===null)&&(l={encode:function(){return u}},f=1);var h=l.encode(u,c.n.bitLength());return Q.rsa.encrypt(h,c,f)},c};Q.wrapRsaPrivateKey=function(e){return v.create(v.Class.UNIVERSAL,v.Type.SEQUENCE,!0,[v.create(v.Class.UNIVERSAL,v.Type.INTEGER,!1,v.integerToDer(0).getBytes()),v.create(v.Class.UNIVERSAL,v.Type.SEQUENCE,!0,[v.create(v.Class.UNIVERSAL,v.Type.OID,!1,v.oidToDer(Q.oids.rsaEncryption).getBytes()),v.create(v.Class.UNIVERSAL,v.Type.NULL,!1,"")]),v.create(v.Class.UNIVERSAL,v.Type.OCTETSTRING,!1,v.toDer(e).getBytes())])};Q.privateKeyFromAsn1=function(e){var t={},r=[];if(v.validate(e,Hx,t,r)&&(e=v.fromDer($.util.createBuffer(t.privateKey))),t={},r=[],!v.validate(e,Gx,t,r)){var n=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw n.errors=r,n}var i,s,o,a,c,u,l,f;return i=$.util.createBuffer(t.privateKeyModulus).toHex(),s=$.util.createBuffer(t.privateKeyPublicExponent).toHex(),o=$.util.createBuffer(t.privateKeyPrivateExponent).toHex(),a=$.util.createBuffer(t.privateKeyPrime1).toHex(),c=$.util.createBuffer(t.privateKeyPrime2).toHex(),u=$.util.createBuffer(t.privateKeyExponent1).toHex(),l=$.util.createBuffer(t.privateKeyExponent2).toHex(),f=$.util.createBuffer(t.privateKeyCoefficient).toHex(),Q.setRsaPrivateKey(new it(i,16),new it(s,16),new it(o,16),new it(a,16),new it(c,16),new it(u,16),new it(l,16),new it(f,16))};Q.privateKeyToAsn1=Q.privateKeyToRSAPrivateKey=function(e){return v.create(v.Class.UNIVERSAL,v.Type.SEQUENCE,!0,[v.create(v.Class.UNIVERSAL,v.Type.INTEGER,!1,v.integerToDer(0).getBytes()),v.create(v.Class.UNIVERSAL,v.Type.INTEGER,!1,Ge(e.n)),v.create(v.Class.UNIVERSAL,v.Type.INTEGER,!1,Ge(e.e)),v.create(v.Class.UNIVERSAL,v.Type.INTEGER,!1,Ge(e.d)),v.create(v.Class.UNIVERSAL,v.Type.INTEGER,!1,Ge(e.p)),v.create(v.Class.UNIVERSAL,v.Type.INTEGER,!1,Ge(e.q)),v.create(v.Class.UNIVERSAL,v.Type.INTEGER,!1,Ge(e.dP)),v.create(v.Class.UNIVERSAL,v.Type.INTEGER,!1,Ge(e.dQ)),v.create(v.Class.UNIVERSAL,v.Type.INTEGER,!1,Ge(e.qInv))])};Q.publicKeyFromAsn1=function(e){var t={},r=[];if(v.validate(e,Wx,t,r)){var n=v.derToOid(t.publicKeyOid);if(n!==Q.oids.rsaEncryption){var i=new Error("Cannot read public key. Unknown OID.");throw i.oid=n,i}e=t.rsaPublicKey}if(r=[],!v.validate(e,Yx,t,r)){var i=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw i.errors=r,i}var s=$.util.createBuffer(t.publicKeyModulus).toHex(),o=$.util.createBuffer(t.publicKeyExponent).toHex();return Q.setRsaPublicKey(new it(s,16),new it(o,16))};Q.publicKeyToAsn1=Q.publicKeyToSubjectPublicKeyInfo=function(e){return v.create(v.Class.UNIVERSAL,v.Type.SEQUENCE,!0,[v.create(v.Class.UNIVERSAL,v.Type.SEQUENCE,!0,[v.create(v.Class.UNIVERSAL,v.Type.OID,!1,v.oidToDer(Q.oids.rsaEncryption).getBytes()),v.create(v.Class.UNIVERSAL,v.Type.NULL,!1,"")]),v.create(v.Class.UNIVERSAL,v.Type.BITSTRING,!1,[Q.publicKeyToRSAPublicKey(e)])])};Q.publicKeyToRSAPublicKey=function(e){return v.create(v.Class.UNIVERSAL,v.Type.SEQUENCE,!0,[v.create(v.Class.UNIVERSAL,v.Type.INTEGER,!1,Ge(e.n)),v.create(v.Class.UNIVERSAL,v.Type.INTEGER,!1,Ge(e.e))])};function S0(e,t,r){var n=$.util.createBuffer(),i=Math.ceil(t.n.bitLength()/8);if(e.length>i-11){var s=new Error("Message is too long for PKCS#1 v1.5 padding.");throw s.length=e.length,s.max=i-11,s}n.putByte(0),n.putByte(r);var o=i-3-e.length,a;if(r===0||r===1){a=r===0?0:255;for(var c=0;c<o;++c)n.putByte(a)}else for(;o>0;){for(var u=0,l=$.random.getBytes(o),c=0;c<o;++c)a=l.charCodeAt(c),a===0?++u:n.putByte(a);o=u}return n.putByte(0),n.putBytes(e),n}function $s(e,t,r,n){var i=Math.ceil(t.n.bitLength()/8),s=$.util.createBuffer(e),o=s.getByte(),a=s.getByte();if(o!==0||r&&a!==0&&a!==1||!r&&a!=2||r&&a===0&&typeof n>"u")throw new Error("Encryption block is invalid.");var c=0;if(a===0){c=i-3-n;for(var u=0;u<c;++u)if(s.getByte()!==0)throw new Error("Encryption block is invalid.")}else if(a===1)for(c=0;s.length()>1;){if(s.getByte()!==255){--s.read;break}++c}else if(a===2)for(c=0;s.length()>1;){if(s.getByte()===0){--s.read;break}++c}var l=s.getByte();if(l!==0||c!==i-3-s.length())throw new Error("Encryption block is invalid.");return s.getBytes()}function Zx(e,t,r){typeof t=="function"&&(r=t,t={}),t=t||{};var n={algorithm:{name:t.algorithm||"PRIMEINC",options:{workers:t.workers||2,workLoad:t.workLoad||100,workerScript:t.workerScript}}};"prng"in t&&(n.prng=t.prng),i();function i(){s(e.pBits,function(a,c){if(a)return r(a);if(e.p=c,e.q!==null)return o(a,e.q);s(e.qBits,o)})}function s(a,c){$.prime.generateProbablePrime(a,n,c)}function o(a,c){if(a)return r(a);if(e.q=c,e.p.compareTo(e.q)<0){var u=e.p;e.p=e.q,e.q=u}if(e.p.subtract(it.ONE).gcd(e.e).compareTo(it.ONE)!==0){e.p=null,i();return}if(e.q.subtract(it.ONE).gcd(e.e).compareTo(it.ONE)!==0){e.q=null,s(e.qBits,o);return}if(e.p1=e.p.subtract(it.ONE),e.q1=e.q.subtract(it.ONE),e.phi=e.p1.multiply(e.q1),e.phi.gcd(e.e).compareTo(it.ONE)!==0){e.p=e.q=null,i();return}if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits){e.q=null,s(e.qBits,o);return}var l=e.e.modInverse(e.phi);e.keys={privateKey:Q.rsa.setPrivateKey(e.n,e.e,l,e.p,e.q,l.mod(e.p1),l.mod(e.q1),e.q.modInverse(e.p)),publicKey:Q.rsa.setPublicKey(e.n,e.e)},r(null,e.keys)}}function Ge(e){var t=e.toString(16);t[0]>="8"&&(t="00"+t);var r=$.util.hexToBytes(t);return r.length>1&&(r.charCodeAt(0)===0&&!(r.charCodeAt(1)&128)||r.charCodeAt(0)===255&&(r.charCodeAt(1)&128)===128)?r.substr(1):r}function Jx(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}function E0(e){return $.util.isNodejs&&typeof tc[e]=="function"}function b0(e){return typeof Ie.globalScope<"u"&&typeof Ie.globalScope.crypto=="object"&&typeof Ie.globalScope.crypto.subtle=="object"&&typeof Ie.globalScope.crypto.subtle[e]=="function"}function w0(e){return typeof Ie.globalScope<"u"&&typeof Ie.globalScope.msCrypto=="object"&&typeof Ie.globalScope.msCrypto.subtle=="object"&&typeof Ie.globalScope.msCrypto.subtle[e]=="function"}function v0(e){for(var t=$.util.hexToBytes(e.toString(16)),r=new Uint8Array(t.length),n=0;n<t.length;++n)r[n]=t.charCodeAt(n);return r}});var L0=V((V_,B0)=>{var M=ht();Ds();Bi();Of();jr();Cs();Ha();$f();Pi();e0();zs();Pt();typeof I0>"u"&&(I0=M.jsbn.BigInteger);var I0,A=M.asn1,Z=M.pki=M.pki||{};B0.exports=Z.pbe=M.pbe=M.pbe||{};var rn=Z.oids,jx={name:"EncryptedPrivateKeyInfo",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:A.Class.UNIVERSAL,type:A.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:A.Class.UNIVERSAL,type:A.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},t1={name:"PBES2Algorithms",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:A.Class.UNIVERSAL,type:A.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:A.Class.UNIVERSAL,type:A.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:A.Class.UNIVERSAL,type:A.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:A.Class.UNIVERSAL,type:A.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:A.Class.UNIVERSAL,type:A.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:A.Class.UNIVERSAL,type:A.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:A.Class.UNIVERSAL,type:A.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},e1={name:"pkcs-12PbeParams",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:A.Class.UNIVERSAL,type:A.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:A.Class.UNIVERSAL,type:A.Type.INTEGER,constructed:!1,capture:"iterations"}]};Z.encryptPrivateKeyInfo=function(e,t,r){r=r||{},r.saltSize=r.saltSize||8,r.count=r.count||2048,r.algorithm=r.algorithm||"aes128",r.prfAlgorithm=r.prfAlgorithm||"sha1";var n=M.random.getBytesSync(r.saltSize),i=r.count,s=A.integerToDer(i),o,a,c;if(r.algorithm.indexOf("aes")===0||r.algorithm==="des"){var u,l,f;switch(r.algorithm){case"aes128":o=16,u=16,l=rn["aes128-CBC"],f=M.aes.createEncryptionCipher;break;case"aes192":o=24,u=16,l=rn["aes192-CBC"],f=M.aes.createEncryptionCipher;break;case"aes256":o=32,u=16,l=rn["aes256-CBC"],f=M.aes.createEncryptionCipher;break;case"des":o=8,u=8,l=rn.desCBC,f=M.des.createEncryptionCipher;break;default:var h=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw h.algorithm=r.algorithm,h}var p="hmacWith"+r.prfAlgorithm.toUpperCase(),d=T0(p),m=M.pkcs5.pbkdf2(t,n,i,o,d),y=M.random.getBytesSync(u),g=f(m);g.start(y),g.update(A.toDer(e)),g.finish(),c=g.output.getBytes();var x=r1(n,s,o,p);a=A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[A.create(A.Class.UNIVERSAL,A.Type.OID,!1,A.oidToDer(rn.pkcs5PBES2).getBytes()),A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[A.create(A.Class.UNIVERSAL,A.Type.OID,!1,A.oidToDer(rn.pkcs5PBKDF2).getBytes()),x]),A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[A.create(A.Class.UNIVERSAL,A.Type.OID,!1,A.oidToDer(l).getBytes()),A.create(A.Class.UNIVERSAL,A.Type.OCTETSTRING,!1,y)])])])}else if(r.algorithm==="3des"){o=24;var b=new M.util.ByteBuffer(n),m=Z.pbe.generatePkcs12Key(t,b,1,i,o),y=Z.pbe.generatePkcs12Key(t,b,2,i,o),g=M.des.createEncryptionCipher(m);g.start(y),g.update(A.toDer(e)),g.finish(),c=g.output.getBytes(),a=A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[A.create(A.Class.UNIVERSAL,A.Type.OID,!1,A.oidToDer(rn["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[A.create(A.Class.UNIVERSAL,A.Type.OCTETSTRING,!1,n),A.create(A.Class.UNIVERSAL,A.Type.INTEGER,!1,s.getBytes())])])}else{var h=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw h.algorithm=r.algorithm,h}var C=A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[a,A.create(A.Class.UNIVERSAL,A.Type.OCTETSTRING,!1,c)]);return C};Z.decryptPrivateKeyInfo=function(e,t){var r=null,n={},i=[];if(!A.validate(e,jx,n,i)){var s=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw s.errors=i,s}var o=A.derToOid(n.encryptionOid),a=Z.pbe.getCipher(o,n.encryptionParams,t),c=M.util.createBuffer(n.encryptedData);return a.update(c),a.finish()&&(r=A.fromDer(a.output)),r};Z.encryptedPrivateKeyToPem=function(e,t){var r={type:"ENCRYPTED PRIVATE KEY",body:A.toDer(e).getBytes()};return M.pem.encode(r,{maxline:t})};Z.encryptedPrivateKeyFromPem=function(e){var t=M.pem.decode(e)[0];if(t.type!=="ENCRYPTED PRIVATE KEY"){var r=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw r.headerType=t.type,r}if(t.procType&&t.procType.type==="ENCRYPTED")throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return A.fromDer(t.body)};Z.encryptRsaPrivateKey=function(e,t,r){if(r=r||{},!r.legacy){var n=Z.wrapRsaPrivateKey(Z.privateKeyToAsn1(e));return n=Z.encryptPrivateKeyInfo(n,t,r),Z.encryptedPrivateKeyToPem(n)}var i,s,o,a;switch(r.algorithm){case"aes128":i="AES-128-CBC",o=16,s=M.random.getBytesSync(16),a=M.aes.createEncryptionCipher;break;case"aes192":i="AES-192-CBC",o=24,s=M.random.getBytesSync(16),a=M.aes.createEncryptionCipher;break;case"aes256":i="AES-256-CBC",o=32,s=M.random.getBytesSync(16),a=M.aes.createEncryptionCipher;break;case"3des":i="DES-EDE3-CBC",o=24,s=M.random.getBytesSync(8),a=M.des.createEncryptionCipher;break;case"des":i="DES-CBC",o=8,s=M.random.getBytesSync(8),a=M.des.createEncryptionCipher;break;default:var c=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+r.algorithm+'".');throw c.algorithm=r.algorithm,c}var u=M.pbe.opensslDeriveBytes(t,s.substr(0,8),o),l=a(u);l.start(s),l.update(A.toDer(Z.privateKeyToAsn1(e))),l.finish();var f={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:i,parameters:M.util.bytesToHex(s).toUpperCase()},body:l.output.getBytes()};return M.pem.encode(f)};Z.decryptRsaPrivateKey=function(e,t){var r=null,n=M.pem.decode(e)[0];if(n.type!=="ENCRYPTED PRIVATE KEY"&&n.type!=="PRIVATE KEY"&&n.type!=="RSA PRIVATE KEY"){var i=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".');throw i.headerType=i,i}if(n.procType&&n.procType.type==="ENCRYPTED"){var s,o;switch(n.dekInfo.algorithm){case"DES-CBC":s=8,o=M.des.createDecryptionCipher;break;case"DES-EDE3-CBC":s=24,o=M.des.createDecryptionCipher;break;case"AES-128-CBC":s=16,o=M.aes.createDecryptionCipher;break;case"AES-192-CBC":s=24,o=M.aes.createDecryptionCipher;break;case"AES-256-CBC":s=32,o=M.aes.createDecryptionCipher;break;case"RC2-40-CBC":s=5,o=function(f){return M.rc2.createDecryptionCipher(f,40)};break;case"RC2-64-CBC":s=8,o=function(f){return M.rc2.createDecryptionCipher(f,64)};break;case"RC2-128-CBC":s=16,o=function(f){return M.rc2.createDecryptionCipher(f,128)};break;default:var i=new Error('Could not decrypt private key; unsupported encryption algorithm "'+n.dekInfo.algorithm+'".');throw i.algorithm=n.dekInfo.algorithm,i}var a=M.util.hexToBytes(n.dekInfo.parameters),c=M.pbe.opensslDeriveBytes(t,a.substr(0,8),s),u=o(c);if(u.start(a),u.update(M.util.createBuffer(n.body)),u.finish())r=u.output.getBytes();else return r}else r=n.body;return n.type==="ENCRYPTED PRIVATE KEY"?r=Z.decryptPrivateKeyInfo(A.fromDer(r),t):r=A.fromDer(r),r!==null&&(r=Z.privateKeyFromAsn1(r)),r};Z.pbe.generatePkcs12Key=function(e,t,r,n,i,s){var o,a;if(typeof s>"u"||s===null){if(!("sha1"in M.md))throw new Error('"sha1" hash algorithm unavailable.');s=M.md.sha1.create()}var c=s.digestLength,u=s.blockLength,l=new M.util.ByteBuffer,f=new M.util.ByteBuffer;if(e!=null){for(a=0;a<e.length;a++)f.putInt16(e.charCodeAt(a));f.putInt16(0)}var h=f.length(),p=t.length(),d=new M.util.ByteBuffer;d.fillWithByte(r,u);var m=u*Math.ceil(p/u),y=new M.util.ByteBuffer;for(a=0;a<m;a++)y.putByte(t.at(a%p));var g=u*Math.ceil(h/u),x=new M.util.ByteBuffer;for(a=0;a<g;a++)x.putByte(f.at(a%h));var b=y;b.putBuffer(x);for(var C=Math.ceil(i/c),_=1;_<=C;_++){var S=new M.util.ByteBuffer;S.putBytes(d.bytes()),S.putBytes(b.bytes());for(var P=0;P<n;P++)s.start(),s.update(S.getBytes()),S=s.digest();var D=new M.util.ByteBuffer;for(a=0;a<u;a++)D.putByte(S.at(a%c));var Y=Math.ceil(p/u)+Math.ceil(h/u),W=new M.util.ByteBuffer;for(o=0;o<Y;o++){var z=new M.util.ByteBuffer(b.getBytes(u)),et=511;for(a=D.length()-1;a>=0;a--)et=et>>8,et+=D.at(a)+z.at(a),z.setAt(a,et&255);W.putBuffer(z)}b=W,l.putBuffer(S)}return l.truncate(l.length()-i),l};Z.pbe.getCipher=function(e,t,r){switch(e){case Z.oids.pkcs5PBES2:return Z.pbe.getCipherForPBES2(e,t,r);case Z.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case Z.oids["pbewithSHAAnd40BitRC2-CBC"]:return Z.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}};Z.pbe.getCipherForPBES2=function(e,t,r){var n={},i=[];if(!A.validate(t,t1,n,i)){var s=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw s.errors=i,s}if(e=A.derToOid(n.kdfOid),e!==Z.oids.pkcs5PBKDF2){var s=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw s.oid=e,s.supportedOids=["pkcs5PBKDF2"],s}if(e=A.derToOid(n.encOid),e!==Z.oids["aes128-CBC"]&&e!==Z.oids["aes192-CBC"]&&e!==Z.oids["aes256-CBC"]&&e!==Z.oids["des-EDE3-CBC"]&&e!==Z.oids.desCBC){var s=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw s.oid=e,s.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],s}var o=n.kdfSalt,a=M.util.createBuffer(n.kdfIterationCount);a=a.getInt(a.length()<<3);var c,u;switch(Z.oids[e]){case"aes128-CBC":c=16,u=M.aes.createDecryptionCipher;break;case"aes192-CBC":c=24,u=M.aes.createDecryptionCipher;break;case"aes256-CBC":c=32,u=M.aes.createDecryptionCipher;break;case"des-EDE3-CBC":c=24,u=M.des.createDecryptionCipher;break;case"desCBC":c=8,u=M.des.createDecryptionCipher;break}var l=C0(n.prfOid),f=M.pkcs5.pbkdf2(r,o,a,c,l),h=n.encIv,p=u(f);return p.start(h),p};Z.pbe.getCipherForPKCS12PBE=function(e,t,r){var n={},i=[];if(!A.validate(t,e1,n,i)){var s=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw s.errors=i,s}var o=M.util.createBuffer(n.salt),a=M.util.createBuffer(n.iterations);a=a.getInt(a.length()<<3);var c,u,l;switch(e){case Z.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:c=24,u=8,l=M.des.startDecrypting;break;case Z.oids["pbewithSHAAnd40BitRC2-CBC"]:c=5,u=8,l=function(m,y){var g=M.rc2.createDecryptionCipher(m,40);return g.start(y,null),g};break;default:var s=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw s.oid=e,s}var f=C0(n.prfOid),h=Z.pbe.generatePkcs12Key(r,o,1,a,c,f);f.start();var p=Z.pbe.generatePkcs12Key(r,o,2,a,u,f);return l(h,p)};Z.pbe.opensslDeriveBytes=function(e,t,r,n){if(typeof n>"u"||n===null){if(!("md5"in M.md))throw new Error('"md5" hash algorithm unavailable.');n=M.md.md5.create()}t===null&&(t="");for(var i=[R0(n,e+t)],s=16,o=1;s<r;++o,s+=16)i.push(R0(n,i[o-1]+e+t));return i.join("").substr(0,r)};function R0(e,t){return e.start().update(t).digest().getBytes()}function C0(e){var t;if(!e)t="hmacWithSHA1";else if(t=Z.oids[A.derToOid(e)],!t){var r=new Error("Unsupported PRF OID.");throw r.oid=e,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}return T0(t)}function T0(e){var t=M.md;switch(e){case"hmacWithSHA224":t=M.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":e=e.substr(8).toLowerCase();break;default:var r=new Error("Unsupported PRF algorithm.");throw r.algorithm=e,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}if(!t||!(e in t))throw new Error("Unknown hash algorithm: "+e);return t[e].create()}function r1(e,t,r,n){var i=A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[A.create(A.Class.UNIVERSAL,A.Type.OCTETSTRING,!1,e),A.create(A.Class.UNIVERSAL,A.Type.INTEGER,!1,t.getBytes())]);return n!=="hmacWithSHA1"&&i.value.push(A.create(A.Class.UNIVERSAL,A.Type.INTEGER,!1,M.util.hexToBytes(r.toString(16))),A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[A.create(A.Class.UNIVERSAL,A.Type.OID,!1,A.oidToDer(Z.oids[n]).getBytes()),A.create(A.Class.UNIVERSAL,A.Type.NULL,!1,"")])),i}});var Fh=V((VI,Uh)=>{var wt=ht();jr();Pt();var zi=Uh.exports=wt.sha512=wt.sha512||{};wt.md.sha512=wt.md.algorithms.sha512=zi;var Oh=wt.sha384=wt.sha512.sha384=wt.sha512.sha384||{};Oh.create=function(){return zi.create("SHA-384")};wt.md.sha384=wt.md.algorithms.sha384=Oh;wt.sha512.sha256=wt.sha512.sha256||{create:function(){return zi.create("SHA-512/256")}};wt.md["sha512/256"]=wt.md.algorithms["sha512/256"]=wt.sha512.sha256;wt.sha512.sha224=wt.sha512.sha224||{create:function(){return zi.create("SHA-512/224")}};wt.md["sha512/224"]=wt.md.algorithms["sha512/224"]=wt.sha512.sha224;zi.create=function(e){if(Mh||SE(),typeof e>"u"&&(e="SHA-512"),!(e in pn))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=pn[e],r=null,n=wt.util.createBuffer(),i=new Array(80),s=0;s<80;++s)i[s]=new Array(2);var o=64;switch(e){case"SHA-384":o=48;break;case"SHA-512/256":o=32;break;case"SHA-512/224":o=28;break}var a={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:o,messageLength:0,fullMessageLength:null,messageLengthSize:16};return a.start=function(){a.messageLength=0,a.fullMessageLength=a.messageLength128=[];for(var c=a.messageLengthSize/4,u=0;u<c;++u)a.fullMessageLength.push(0);n=wt.util.createBuffer(),r=new Array(t.length);for(var u=0;u<t.length;++u)r[u]=t[u].slice(0);return a},a.start(),a.update=function(c,u){u==="utf8"&&(c=wt.util.encodeUtf8(c));var l=c.length;a.messageLength+=l,l=[l/4294967296>>>0,l>>>0];for(var f=a.fullMessageLength.length-1;f>=0;--f)a.fullMessageLength[f]+=l[1],l[1]=l[0]+(a.fullMessageLength[f]/4294967296>>>0),a.fullMessageLength[f]=a.fullMessageLength[f]>>>0,l[0]=l[1]/4294967296>>>0;return n.putBytes(c),kh(r,i,n),(n.read>2048||n.length()===0)&&n.compact(),a},a.digest=function(){var c=wt.util.createBuffer();c.putBytes(n.bytes());var u=a.fullMessageLength[a.fullMessageLength.length-1]+a.messageLengthSize,l=u&a.blockLength-1;c.putBytes(tu.substr(0,a.blockLength-l));for(var f,h,p=a.fullMessageLength[0]*8,d=0;d<a.fullMessageLength.length-1;++d)f=a.fullMessageLength[d+1]*8,h=f/4294967296>>>0,p+=h,c.putInt32(p>>>0),p=f>>>0;c.putInt32(p);for(var m=new Array(r.length),d=0;d<r.length;++d)m[d]=r[d].slice(0);kh(m,i,c);var y=wt.util.createBuffer(),g;e==="SHA-512"?g=m.length:e==="SHA-384"?g=m.length-2:g=m.length-4;for(var d=0;d<g;++d)y.putInt32(m[d][0]),(d!==g-1||e!=="SHA-512/224")&&y.putInt32(m[d][1]);return y},a};var tu=null,Mh=!1,eu=null,pn=null;function SE(){tu=String.fromCharCode(128),tu+=wt.util.fillString(String.fromCharCode(0),128),eu=[[1116352408,3609767458],[1899447441,602891725],[3049323471,3964484399],[3921009573,2173295548],[961987163,4081628472],[1508970993,3053834265],[2453635748,2937671579],[2870763221,3664609560],[3624381080,2734883394],[310598401,1164996542],[607225278,1323610764],[1426881987,3590304994],[1925078388,4068182383],[2162078206,991336113],[2614888103,633803317],[3248222580,3479774868],[3835390401,2666613458],[4022224774,944711139],[264347078,2341262773],[604807628,2007800933],[770255983,1495990901],[1249150122,1856431235],[1555081692,3175218132],[1996064986,2198950837],[2554220882,3999719339],[2821834349,766784016],[2952996808,2566594879],[3210313671,3203337956],[3336571891,1034457026],[3584528711,2466948901],[113926993,3758326383],[338241895,168717936],[666307205,1188179964],[773529912,1546045734],[1294757372,1522805485],[1396182291,2643833823],[1695183700,2343527390],[1986661051,1014477480],[2177026350,1206759142],[2456956037,344077627],[2730485921,1290863460],[2820302411,3158454273],[3259730800,3505952657],[3345764771,106217008],[3516065817,3606008344],[3600352804,1432725776],[4094571909,1467031594],[275423344,851169720],[430227734,3100823752],[506948616,1363258195],[659060556,3750685593],[883997877,3785050280],[958139571,3318307427],[1322822218,3812723403],[1537002063,2003034995],[1747873779,3602036899],[1955562222,1575990012],[2024104815,1125592928],[2227730452,2716904306],[2361852424,442776044],[2428436474,593698344],[2756734187,3733110249],[3204031479,2999351573],[3329325298,3815920427],[3391569614,3928383900],[3515267271,566280711],[3940187606,3454069534],[4118630271,4000239992],[116418474,1914138554],[174292421,2731055270],[289380356,3203993006],[460393269,320620315],[685471733,587496836],[852142971,1086792851],[1017036298,365543100],[1126000580,2618297676],[1288033470,3409855158],[1501505948,4234509866],[1607167915,987167468],[1816402316,1246189591]],pn={},pn["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],pn["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],pn["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],pn["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],Mh=!0}function kh(e,t,r){for(var n,i,s,o,a,c,u,l,f,h,p,d,m,y,g,x,b,C,_,S,P,D,Y,W,z,et,pt,Qt,T,k,L,N,I,U,q,G=r.length();G>=128;){for(T=0;T<16;++T)t[T][0]=r.getInt32()>>>0,t[T][1]=r.getInt32()>>>0;for(;T<80;++T)N=t[T-2],k=N[0],L=N[1],n=((k>>>19|L<<13)^(L>>>29|k<<3)^k>>>6)>>>0,i=((k<<13|L>>>19)^(L<<3|k>>>29)^(k<<26|L>>>6))>>>0,U=t[T-15],k=U[0],L=U[1],s=((k>>>1|L<<31)^(k>>>8|L<<24)^k>>>7)>>>0,o=((k<<31|L>>>1)^(k<<24|L>>>8)^(k<<25|L>>>7))>>>0,I=t[T-7],q=t[T-16],L=i+I[1]+o+q[1],t[T][0]=n+I[0]+s+q[0]+(L/4294967296>>>0)>>>0,t[T][1]=L>>>0;for(m=e[0][0],y=e[0][1],g=e[1][0],x=e[1][1],b=e[2][0],C=e[2][1],_=e[3][0],S=e[3][1],P=e[4][0],D=e[4][1],Y=e[5][0],W=e[5][1],z=e[6][0],et=e[6][1],pt=e[7][0],Qt=e[7][1],T=0;T<80;++T)u=((P>>>14|D<<18)^(P>>>18|D<<14)^(D>>>9|P<<23))>>>0,l=((P<<18|D>>>14)^(P<<14|D>>>18)^(D<<23|P>>>9))>>>0,f=(z^P&(Y^z))>>>0,h=(et^D&(W^et))>>>0,a=((m>>>28|y<<4)^(y>>>2|m<<30)^(y>>>7|m<<25))>>>0,c=((m<<4|y>>>28)^(y<<30|m>>>2)^(y<<25|m>>>7))>>>0,p=(m&g|b&(m^g))>>>0,d=(y&x|C&(y^x))>>>0,L=Qt+l+h+eu[T][1]+t[T][1],n=pt+u+f+eu[T][0]+t[T][0]+(L/4294967296>>>0)>>>0,i=L>>>0,L=c+d,s=a+p+(L/4294967296>>>0)>>>0,o=L>>>0,pt=z,Qt=et,z=Y,et=W,Y=P,W=D,L=S+i,P=_+n+(L/4294967296>>>0)>>>0,D=L>>>0,_=b,S=C,b=g,C=x,g=m,x=y,L=i+o,m=n+s+(L/4294967296>>>0)>>>0,y=L>>>0;L=e[0][1]+y,e[0][0]=e[0][0]+m+(L/4294967296>>>0)>>>0,e[0][1]=L>>>0,L=e[1][1]+x,e[1][0]=e[1][0]+g+(L/4294967296>>>0)>>>0,e[1][1]=L>>>0,L=e[2][1]+C,e[2][0]=e[2][0]+b+(L/4294967296>>>0)>>>0,e[2][1]=L>>>0,L=e[3][1]+S,e[3][0]=e[3][0]+_+(L/4294967296>>>0)>>>0,e[3][1]=L>>>0,L=e[4][1]+D,e[4][0]=e[4][0]+P+(L/4294967296>>>0)>>>0,e[4][1]=L>>>0,L=e[5][1]+W,e[5][0]=e[5][0]+Y+(L/4294967296>>>0)>>>0,e[5][1]=L>>>0,L=e[6][1]+et,e[6][0]=e[6][0]+z+(L/4294967296>>>0)>>>0,e[6][1]=L>>>0,L=e[7][1]+Qt,e[7][0]=e[7][0]+pt+(L/4294967296>>>0)>>>0,e[7][1]=L>>>0,G-=128}}});var xu=V((x4,pd)=>{var ri=1e3,ni=ri*60,ii=ni*60,xn=ii*24,tb=xn*7,eb=xn*365.25;pd.exports=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0)return rb(e);if(r==="number"&&isFinite(e))return t.long?ib(e):nb(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function rb(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\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(t){var r=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*eb;case"weeks":case"week":case"w":return r*tb;case"days":case"day":case"d":return r*xn;case"hours":case"hour":case"hrs":case"hr":case"h":return r*ii;case"minutes":case"minute":case"mins":case"min":case"m":return r*ni;case"seconds":case"second":case"secs":case"sec":case"s":return r*ri;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function nb(e){var t=Math.abs(e);return t>=xn?Math.round(e/xn)+"d":t>=ii?Math.round(e/ii)+"h":t>=ni?Math.round(e/ni)+"m":t>=ri?Math.round(e/ri)+"s":e+"ms"}function ib(e){var t=Math.abs(e);return t>=xn?yo(e,t,xn,"day"):t>=ii?yo(e,t,ii,"hour"):t>=ni?yo(e,t,ni,"minute"):t>=ri?yo(e,t,ri,"second"):e+" ms"}function yo(e,t,r,n){var i=t>=r*1.5;return Math.round(e/r)+" "+n+(i?"s":"")}});var yd=V((E4,md)=>{function sb(e){r.debug=r,r.default=r,r.coerce=c,r.disable=s,r.enable=i,r.enabled=o,r.humanize=xu(),r.destroy=u,Object.keys(e).forEach(l=>{r[l]=e[l]}),r.names=[],r.skips=[],r.formatters={};function t(l){let f=0;for(let h=0;h<l.length;h++)f=(f<<5)-f+l.charCodeAt(h),f|=0;return r.colors[Math.abs(f)%r.colors.length]}r.selectColor=t;function r(l){let f,h=null,p,d;function m(...y){if(!m.enabled)return;let g=m,x=Number(new Date),b=x-(f||x);g.diff=b,g.prev=f,g.curr=x,f=x,y[0]=r.coerce(y[0]),typeof y[0]!="string"&&y.unshift("%O");let C=0;y[0]=y[0].replace(/%([a-zA-Z%])/g,(S,P)=>{if(S==="%%")return"%";C++;let D=r.formatters[P];if(typeof D=="function"){let Y=y[C];S=D.call(g,Y),y.splice(C,1),C--}return S}),r.formatArgs.call(g,y),(g.log||r.log).apply(g,y)}return m.namespace=l,m.useColors=r.useColors(),m.color=r.selectColor(l),m.extend=n,m.destroy=r.destroy,Object.defineProperty(m,"enabled",{enumerable:!0,configurable:!1,get:()=>h!==null?h:(p!==r.namespaces&&(p=r.namespaces,d=r.enabled(l)),d),set:y=>{h=y}}),typeof r.init=="function"&&r.init(m),m}function n(l,f){let h=r(this.namespace+(typeof f>"u"?":":f)+l);return h.log=this.log,h}function i(l){r.save(l),r.namespaces=l,r.names=[],r.skips=[];let f,h=(typeof l=="string"?l:"").split(/[\s,]+/),p=h.length;for(f=0;f<p;f++)h[f]&&(l=h[f].replace(/\*/g,".*?"),l[0]==="-"?r.skips.push(new RegExp("^"+l.slice(1)+"$")):r.names.push(new RegExp("^"+l+"$")))}function s(){let l=[...r.names.map(a),...r.skips.map(a).map(f=>"-"+f)].join(",");return r.enable(""),l}function o(l){if(l[l.length-1]==="*")return!0;let f,h;for(f=0,h=r.skips.length;f<h;f++)if(r.skips[f].test(l))return!1;for(f=0,h=r.names.length;f<h;f++)if(r.names[f].test(l))return!0;return!1}function a(l){return l.toString().substring(2,l.toString().length-2).replace(/\.\*\?$/,"*")}function c(l){return l instanceof Error?l.stack||l.message:l}function u(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}md.exports=sb});var Eu=V((Ee,go)=>{Ee.formatArgs=ab;Ee.save=cb;Ee.load=ub;Ee.useColors=ob;Ee.storage=lb();Ee.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();Ee.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function ob(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function ab(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+go.exports.humanize(this.diff),!this.useColors)return;let t="color: "+this.color;e.splice(1,0,t,"color: inherit");let r=0,n=0;e[0].replace(/%[a-zA-Z%]/g,i=>{i!=="%%"&&(r++,i==="%c"&&(n=r))}),e.splice(n,0,t)}Ee.log=console.debug||console.log||(()=>{});function cb(e){try{e?Ee.storage.setItem("debug",e):Ee.storage.removeItem("debug")}catch{}}function ub(){let e;try{e=Ee.storage.getItem("debug")}catch{}return!e&&typeof process<"u"&&"env"in process&&(e=process.env.DEBUG),e}function lb(){try{return localStorage}catch{}}go.exports=yd()(Ee);var{formatters:fb}=go.exports;fb.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var vd=V((q4,wd)=>{"use strict";wd.exports=e=>{if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}});var Cd=V((Id,Rd)=>{"use strict";var vo=vd(),{hasOwnProperty:Sd}=Object.prototype,{propertyIsEnumerable:xb}=Object,ai=(e,t,r)=>Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0}),Eb=Id,_d={concatArrays:!1,ignoreUndefined:!1},_o=e=>{let t=[];for(let r in e)Sd.call(e,r)&&t.push(r);if(Object.getOwnPropertySymbols){let r=Object.getOwnPropertySymbols(e);for(let n of r)xb.call(e,n)&&t.push(n)}return t};function ci(e){return Array.isArray(e)?bb(e):vo(e)?wb(e):e}function bb(e){let t=e.slice(0,0);return _o(e).forEach(r=>{ai(t,r,ci(e[r]))}),t}function wb(e){let t=Object.getPrototypeOf(e)===null?Object.create(null):{};return _o(e).forEach(r=>{ai(t,r,ci(e[r]))}),t}var Ad=(e,t,r,n)=>(r.forEach(i=>{typeof t[i]>"u"&&n.ignoreUndefined||(i in e&&e[i]!==Object.getPrototypeOf(e)?ai(e,i,_u(e[i],t[i],n)):ai(e,i,ci(t[i])))}),e),vb=(e,t,r)=>{let n=e.slice(0,0),i=0;return[e,t].forEach(s=>{let o=[];for(let a=0;a<s.length;a++)Sd.call(s,a)&&(o.push(String(a)),s===e?ai(n,i++,s[a]):ai(n,i++,ci(s[a])));n=Ad(n,s,_o(s).filter(a=>!o.includes(a)),r)}),n};function _u(e,t,r){return r.concatArrays&&Array.isArray(e)&&Array.isArray(t)?vb(e,t,r):!vo(t)||!vo(e)?ci(t):Ad(e,t,_o(t),r)}Rd.exports=function(...e){let t=_u(ci(_d),this!==Eb&&this||{},_d),r={_:{}};for(let n of e)if(n!==void 0){if(!vo(n))throw new TypeError("`"+n+"` is not an Option Object");r=_u(r,{_:n},t)}return r._}});var Ld=V((z4,Bd)=>{"use strict";function _b(e){return e>=55296&&e<=56319}function Sb(e){return e>=56320&&e<=57343}Bd.exports=function(t,r,n){if(typeof r!="string")throw new Error("Input must be string");for(var i=r.length,s=0,o,a,c=0;c<i;c+=1){if(o=r.charCodeAt(c),a=r[c],_b(o)&&Sb(r.charCodeAt(c+1))&&(c+=1,a+=r[c]),s+=t(a),s===n)return r.slice(0,c+1);if(s>n)return r.slice(0,c-a.length+1)}return r}});var Dd=V((H4,Pd)=>{"use strict";function Ab(e){return e>=55296&&e<=56319}function Ib(e){return e>=56320&&e<=57343}Pd.exports=function(t){if(typeof t!="string")throw new Error("Input must be string");for(var r=t.length,n=0,i=null,s=null,o=0;o<r;o++)i=t.charCodeAt(o),Ib(i)?s!=null&&Ab(s)?n+=1:n+=3:i<=127?n+=1:i>=128&&i<=2047?n+=2:i>=2048&&i<=65535&&(n+=3),s=i;return n}});var kd=V((G4,Nd)=>{"use strict";var Rb=Ld(),Cb=Dd();Nd.exports=Rb.bind(null,Cb)});var Ud=V((Y4,Md)=>{"use strict";var Tb=kd(),Bb=/[\/\?<>\\:\*\|"]/g,Lb=/[\x00-\x1f\x80-\x9f]/g,Pb=/^\.+$/,Db=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i,Nb=/[\. ]+$/;function Od(e,t){if(typeof e!="string")throw new Error("Input must be string");var r=e.replace(Bb,t).replace(Lb,t).replace(Pb,t).replace(Db,t).replace(Nb,t);return Tb(r,255)}Md.exports=function(e,t){var r=t&&t.replacement||"",n=Od(e,r);return r===""?n:Od(n,"")}});var up=V((ST,$u)=>{"use strict";var hw=Object.prototype.hasOwnProperty,le="~";function ss(){}Object.create&&(ss.prototype=Object.create(null),new ss().__proto__||(le=!1));function dw(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function cp(e,t,r,n,i){if(typeof r!="function")throw new TypeError("The listener must be a function");var s=new dw(r,n||e,i),o=le?le+t:t;return e._events[o]?e._events[o].fn?e._events[o]=[e._events[o],s]:e._events[o].push(s):(e._events[o]=s,e._eventsCount++),e}function Po(e,t){--e._eventsCount===0?e._events=new ss:delete e._events[t]}function ae(){this._events=new ss,this._eventsCount=0}ae.prototype.eventNames=function(){var t=[],r,n;if(this._eventsCount===0)return t;for(n in r=this._events)hw.call(r,n)&&t.push(le?n.slice(1):n);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(r)):t};ae.prototype.listeners=function(t){var r=le?le+t:t,n=this._events[r];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,s=n.length,o=new Array(s);i<s;i++)o[i]=n[i].fn;return o};ae.prototype.listenerCount=function(t){var r=le?le+t:t,n=this._events[r];return n?n.fn?1:n.length:0};ae.prototype.emit=function(t,r,n,i,s,o){var a=le?le+t:t;if(!this._events[a])return!1;var c=this._events[a],u=arguments.length,l,f;if(c.fn){switch(c.once&&this.removeListener(t,c.fn,void 0,!0),u){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,r),!0;case 3:return c.fn.call(c.context,r,n),!0;case 4:return c.fn.call(c.context,r,n,i),!0;case 5:return c.fn.call(c.context,r,n,i,s),!0;case 6:return c.fn.call(c.context,r,n,i,s,o),!0}for(f=1,l=new Array(u-1);f<u;f++)l[f-1]=arguments[f];c.fn.apply(c.context,l)}else{var h=c.length,p;for(f=0;f<h;f++)switch(c[f].once&&this.removeListener(t,c[f].fn,void 0,!0),u){case 1:c[f].fn.call(c[f].context);break;case 2:c[f].fn.call(c[f].context,r);break;case 3:c[f].fn.call(c[f].context,r,n);break;case 4:c[f].fn.call(c[f].context,r,n,i);break;default:if(!l)for(p=1,l=new Array(u-1);p<u;p++)l[p-1]=arguments[p];c[f].fn.apply(c[f].context,l)}}return!0};ae.prototype.on=function(t,r,n){return cp(this,t,r,n,!1)};ae.prototype.once=function(t,r,n){return cp(this,t,r,n,!0)};ae.prototype.removeListener=function(t,r,n,i){var s=le?le+t:t;if(!this._events[s])return this;if(!r)return Po(this,s),this;var o=this._events[s];if(o.fn)o.fn===r&&(!i||o.once)&&(!n||o.context===n)&&Po(this,s);else{for(var a=0,c=[],u=o.length;a<u;a++)(o[a].fn!==r||i&&!o[a].once||n&&o[a].context!==n)&&c.push(o[a]);c.length?this._events[s]=c.length===1?c[0]:c:Po(this,s)}return this};ae.prototype.removeAllListeners=function(t){var r;return t?(r=le?le+t:t,this._events[r]&&Po(this,r)):(this._events=new ss,this._eventsCount=0),this};ae.prototype.off=ae.prototype.removeListener;ae.prototype.addListener=ae.prototype.on;ae.prefixed=le;ae.EventEmitter=ae;typeof $u<"u"&&($u.exports=ae)});var pl=V((V3,Tp)=>{"use strict";function Cp(e,t){for(let r in t)Object.defineProperty(e,r,{value:t[r],enumerable:!0,configurable:!0});return e}function Rw(e,t,r){if(!e||typeof e=="string")throw new TypeError("Please pass an Error to err-code");r||(r={}),typeof t=="object"&&(r=t,t=""),t&&(r.code=t);try{return Cp(e,r)}catch{r.message=e.message,r.stack=e.stack;let i=function(){};return i.prototype=Object.create(Object.getPrototypeOf(e)),Cp(new i,r)}}Tp.exports=Rw});var kp=V(hs=>{(function(){var e,t,r,n,i,s,o,a;a=function(c){var u,l,f,h;return u=(c&255<<24)>>>24,l=(c&255<<16)>>>16,f=(c&65280)>>>8,h=c&255,[u,l,f,h].join(".")},o=function(c){var u,l,f,h,p,d;for(u=[],f=h=0;h<=3&&c.length!==0;f=++h){if(f>0){if(c[0]!==".")throw new Error("Invalid IP");c=c.substring(1)}d=t(c),p=d[0],l=d[1],c=c.substring(l),u.push(p)}if(c.length!==0)throw new Error("Invalid IP");switch(u.length){case 1:if(u[0]>4294967295)throw new Error("Invalid IP");return u[0]>>>0;case 2:if(u[0]>255||u[1]>16777215)throw new Error("Invalid IP");return(u[0]<<24|u[1])>>>0;case 3:if(u[0]>255||u[1]>255||u[2]>65535)throw new Error("Invalid IP");return(u[0]<<24|u[1]<<16|u[2])>>>0;case 4:if(u[0]>255||u[1]>255||u[2]>255||u[3]>255)throw new Error("Invalid IP");return(u[0]<<24|u[1]<<16|u[2]<<8|u[3])>>>0;default:throw new Error("Invalid IP")}},r=function(c){return c.charCodeAt(0)},n=r("0"),s=r("a"),i=r("A"),t=function(c){var u,l,f,h,p;for(h=0,u=10,l="9",f=0,c.length>1&&c[f]==="0"&&(c[f+1]==="x"||c[f+1]==="X"?(f+=2,u=16):"0"<=c[f+1]&&c[f+1]<="9"&&(f++,u=8,l="7")),p=f;f<c.length;){if("0"<=c[f]&&c[f]<=l)h=h*u+(r(c[f])-n)>>>0;else if(u===16)if("a"<=c[f]&&c[f]<="f")h=h*u+(10+r(c[f])-s)>>>0;else if("A"<=c[f]&&c[f]<="F")h=h*u+(10+r(c[f])-i)>>>0;else break;else break;if(h>4294967295)throw new Error("too large");f++}if(f===p)throw new Error("empty octet");return[h,f]},e=function(){function c(u,l){var f,h,p,d;if(typeof u!="string")throw new Error("Missing `net' parameter");if(l||(d=u.split("/",2),u=d[0],l=d[1]),l||(l=32),typeof l=="string"&&l.indexOf(".")>-1){try{this.maskLong=o(l)}catch(m){throw f=m,new Error("Invalid mask: "+l)}for(h=p=32;p>=0;h=--p)if(this.maskLong===4294967295<<32-h>>>0){this.bitmask=h;break}}else if(l||l===0)this.bitmask=parseInt(l,10),this.maskLong=0,this.bitmask>0&&(this.maskLong=4294967295<<32-this.bitmask>>>0);else throw new Error("Invalid mask: empty");try{this.netLong=(o(u)&this.maskLong)>>>0}catch(m){throw f=m,new Error("Invalid net address: "+u)}if(!(this.bitmask<=32))throw new Error("Invalid mask for ip4: "+l);this.size=Math.pow(2,32-this.bitmask),this.base=a(this.netLong),this.mask=a(this.maskLong),this.hostmask=a(~this.maskLong),this.first=this.bitmask<=30?a(this.netLong+1):this.base,this.last=this.bitmask<=30?a(this.netLong+this.size-2):a(this.netLong+this.size-1),this.broadcast=this.bitmask<=30?a(this.netLong+this.size-1):void 0}return c.prototype.contains=function(u){return typeof u=="string"&&(u.indexOf("/")>0||u.split(".").length!==4)&&(u=new c(u)),u instanceof c?this.contains(u.base)&&this.contains(u.broadcast||u.last):(o(u)&this.maskLong)>>>0===(this.netLong&this.maskLong)>>>0},c.prototype.next=function(u){return u==null&&(u=1),new c(a(this.netLong+this.size*u),this.mask)},c.prototype.forEach=function(u){var l,f,h;for(h=o(this.first),f=o(this.last),l=0;h<=f;)u(a(h),h,l),l++,h++},c.prototype.toString=function(){return this.base+"/"+this.bitmask},c}(),hs.ip2long=o,hs.long2ip=a,hs.Netmask=e}).call(hs)});var Fp=V((Up,jo)=>{(function(e){"use strict";let t="(0?\\d+|0x[a-f0-9]+)",r={fourOctet:new RegExp(`^${t}\\.${t}\\.${t}\\.${t}$`,"i"),threeOctet:new RegExp(`^${t}\\.${t}\\.${t}$`,"i"),twoOctet:new RegExp(`^${t}\\.${t}$`,"i"),longValue:new RegExp(`^${t}$`,"i")},n=new RegExp("^0[0-7]+$","i"),i=new RegExp("^0x[a-f0-9]+$","i"),s="%[0-9a-z]{1,}",o="(?:[0-9a-f]+::?)+",a={zoneIndex:new RegExp(s,"i"),native:new RegExp(`^(::)?(${o})?([0-9a-f]+)?(::)?(${s})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${t}\\.${t}\\.${t}\\.${t}(${s})?)$`,"i"),transitional:new RegExp(`^((?:${o})|(?:::)(?:${o})?)${t}\\.${t}\\.${t}\\.${t}(${s})?$`,"i")};function c(p,d){if(p.indexOf("::")!==p.lastIndexOf("::"))return null;let m=0,y=-1,g=(p.match(a.zoneIndex)||[])[0],x,b;for(g&&(g=g.substring(1),p=p.replace(/%.+$/,""));(y=p.indexOf(":",y+1))>=0;)m++;if(p.substr(0,2)==="::"&&m--,p.substr(-2,2)==="::"&&m--,m>d)return null;for(b=d-m,x=":";b--;)x+="0:";return p=p.replace("::",x),p[0]===":"&&(p=p.slice(1)),p[p.length-1]===":"&&(p=p.slice(0,-1)),d=function(){let C=p.split(":"),_=[];for(let S=0;S<C.length;S++)_.push(parseInt(C[S],16));return _}(),{parts:d,zoneId:g}}function u(p,d,m,y){if(p.length!==d.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let g=0,x;for(;y>0;){if(x=m-y,x<0&&(x=0),p[g]>>x!==d[g]>>x)return!1;y-=m,g+=1}return!0}function l(p){if(i.test(p))return parseInt(p,16);if(p[0]==="0"&&!isNaN(parseInt(p[1],10))){if(n.test(p))return parseInt(p,8);throw new Error(`ipaddr: cannot parse ${p} as octal`)}return parseInt(p,10)}function f(p,d){for(;p.length<d;)p=`0${p}`;return p}let h={};h.IPv4=function(){function p(d){if(d.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");let m,y;for(m=0;m<d.length;m++)if(y=d[m],!(0<=y&&y<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=d}return p.prototype.SpecialRanges={unspecified:[[new p([0,0,0,0]),8]],broadcast:[[new p([255,255,255,255]),32]],multicast:[[new p([224,0,0,0]),4]],linkLocal:[[new p([169,254,0,0]),16]],loopback:[[new p([127,0,0,0]),8]],carrierGradeNat:[[new p([100,64,0,0]),10]],private:[[new p([10,0,0,0]),8],[new p([172,16,0,0]),12],[new p([192,168,0,0]),16]],reserved:[[new p([192,0,0,0]),24],[new p([192,0,2,0]),24],[new p([192,88,99,0]),24],[new p([198,18,0,0]),15],[new p([198,51,100,0]),24],[new p([203,0,113,0]),24],[new p([240,0,0,0]),4]]},p.prototype.kind=function(){return"ipv4"},p.prototype.match=function(d,m){let y;if(m===void 0&&(y=d,d=y[0],m=y[1]),d.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return u(this.octets,d.octets,8,m)},p.prototype.prefixLengthFromSubnetMask=function(){let d=0,m=!1,y={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},g,x,b;for(g=3;g>=0;g-=1)if(x=this.octets[g],x in y){if(b=y[x],m&&b!==0)return null;b!==8&&(m=!0),d+=b}else return null;return 32-d},p.prototype.range=function(){return h.subnetMatch(this,this.SpecialRanges)},p.prototype.toByteArray=function(){return this.octets.slice(0)},p.prototype.toIPv4MappedAddress=function(){return h.IPv6.parse(`::ffff:${this.toString()}`)},p.prototype.toNormalizedString=function(){return this.toString()},p.prototype.toString=function(){return this.octets.join(".")},p}(),h.IPv4.broadcastAddressFromCIDR=function(p){try{let d=this.parseCIDR(p),m=d[0].toByteArray(),y=this.subnetMaskFromPrefixLength(d[1]).toByteArray(),g=[],x=0;for(;x<4;)g.push(parseInt(m[x],10)|parseInt(y[x],10)^255),x++;return new this(g)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},h.IPv4.isIPv4=function(p){return this.parser(p)!==null},h.IPv4.isValid=function(p){try{return new this(this.parser(p)),!0}catch{return!1}},h.IPv4.isValidFourPartDecimal=function(p){return!!(h.IPv4.isValid(p)&&p.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},h.IPv4.networkAddressFromCIDR=function(p){let d,m,y,g,x;try{for(d=this.parseCIDR(p),y=d[0].toByteArray(),x=this.subnetMaskFromPrefixLength(d[1]).toByteArray(),g=[],m=0;m<4;)g.push(parseInt(y[m],10)&parseInt(x[m],10)),m++;return new this(g)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},h.IPv4.parse=function(p){let d=this.parser(p);if(d===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(d)},h.IPv4.parseCIDR=function(p){let d;if(d=p.match(/^(.+)\/(\d+)$/)){let m=parseInt(d[2]);if(m>=0&&m<=32){let y=[this.parse(d[1]),m];return Object.defineProperty(y,"toString",{value:function(){return this.join("/")}}),y}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},h.IPv4.parser=function(p){let d,m,y;if(d=p.match(r.fourOctet))return function(){let g=d.slice(1,6),x=[];for(let b=0;b<g.length;b++)m=g[b],x.push(l(m));return x}();if(d=p.match(r.longValue)){if(y=l(d[1]),y>4294967295||y<0)throw new Error("ipaddr: address outside defined range");return function(){let g=[],x;for(x=0;x<=24;x+=8)g.push(y>>x&255);return g}().reverse()}else return(d=p.match(r.twoOctet))?function(){let g=d.slice(1,4),x=[];if(y=l(g[1]),y>16777215||y<0)throw new Error("ipaddr: address outside defined range");return x.push(l(g[0])),x.push(y>>16&255),x.push(y>>8&255),x.push(y&255),x}():(d=p.match(r.threeOctet))?function(){let g=d.slice(1,5),x=[];if(y=l(g[2]),y>65535||y<0)throw new Error("ipaddr: address outside defined range");return x.push(l(g[0])),x.push(l(g[1])),x.push(y>>8&255),x.push(y&255),x}():null},h.IPv4.subnetMaskFromPrefixLength=function(p){if(p=parseInt(p),p<0||p>32)throw new Error("ipaddr: invalid IPv4 prefix length");let d=[0,0,0,0],m=0,y=Math.floor(p/8);for(;m<y;)d[m]=255,m++;return y<4&&(d[y]=Math.pow(2,p%8)-1<<8-p%8),new this(d)},h.IPv6=function(){function p(d,m){let y,g;if(d.length===16)for(this.parts=[],y=0;y<=14;y+=2)this.parts.push(d[y]<<8|d[y+1]);else if(d.length===8)this.parts=d;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(y=0;y<this.parts.length;y++)if(g=this.parts[y],!(0<=g&&g<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");m&&(this.zoneId=m)}return p.prototype.SpecialRanges={unspecified:[new p([0,0,0,0,0,0,0,0]),128],linkLocal:[new p([65152,0,0,0,0,0,0,0]),10],multicast:[new p([65280,0,0,0,0,0,0,0]),8],loopback:[new p([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new p([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new p([0,0,0,0,0,65535,0,0]),96],rfc6145:[new p([0,0,0,0,65535,0,0,0]),96],rfc6052:[new p([100,65435,0,0,0,0,0,0]),96],"6to4":[new p([8194,0,0,0,0,0,0,0]),16],teredo:[new p([8193,0,0,0,0,0,0,0]),32],reserved:[[new p([8193,3512,0,0,0,0,0,0]),32]],benchmarking:[new p([8193,2,0,0,0,0,0,0]),48],amt:[new p([8193,3,0,0,0,0,0,0]),32],as112v6:[new p([8193,4,274,0,0,0,0,0]),48],deprecated:[new p([8193,16,0,0,0,0,0,0]),28],orchid2:[new p([8193,32,0,0,0,0,0,0]),28]},p.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},p.prototype.kind=function(){return"ipv6"},p.prototype.match=function(d,m){let y;if(m===void 0&&(y=d,d=y[0],m=y[1]),d.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return u(this.parts,d.parts,16,m)},p.prototype.prefixLengthFromSubnetMask=function(){let d=0,m=!1,y={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0},g,x;for(let b=7;b>=0;b-=1)if(g=this.parts[b],g in y){if(x=y[g],m&&x!==0)return null;x!==16&&(m=!0),d+=x}else return null;return 128-d},p.prototype.range=function(){return h.subnetMatch(this,this.SpecialRanges)},p.prototype.toByteArray=function(){let d,m=[],y=this.parts;for(let g=0;g<y.length;g++)d=y[g],m.push(d>>8),m.push(d&255);return m},p.prototype.toFixedLengthString=function(){let d=function(){let y=[];for(let g=0;g<this.parts.length;g++)y.push(f(this.parts[g].toString(16),4));return y}.call(this).join(":"),m="";return this.zoneId&&(m=`%${this.zoneId}`),d+m},p.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");let d=this.parts.slice(-2),m=d[0],y=d[1];return new h.IPv4([m>>8,m&255,y>>8,y&255])},p.prototype.toNormalizedString=function(){let d=function(){let y=[];for(let g=0;g<this.parts.length;g++)y.push(this.parts[g].toString(16));return y}.call(this).join(":"),m="";return this.zoneId&&(m=`%${this.zoneId}`),d+m},p.prototype.toRFC5952String=function(){let d=/((^|:)(0(:|$)){2,})/g,m=this.toNormalizedString(),y=0,g=-1,x;for(;x=d.exec(m);)x[0].length>g&&(y=x.index,g=x[0].length);return g<0?m:`${m.substring(0,y)}::${m.substring(y+g)}`},p.prototype.toString=function(){return this.toRFC5952String()},p}(),h.IPv6.broadcastAddressFromCIDR=function(p){try{let d=this.parseCIDR(p),m=d[0].toByteArray(),y=this.subnetMaskFromPrefixLength(d[1]).toByteArray(),g=[],x=0;for(;x<16;)g.push(parseInt(m[x],10)|parseInt(y[x],10)^255),x++;return new this(g)}catch(d){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${d})`)}},h.IPv6.isIPv6=function(p){return this.parser(p)!==null},h.IPv6.isValid=function(p){if(typeof p=="string"&&p.indexOf(":")===-1)return!1;try{let d=this.parser(p);return new this(d.parts,d.zoneId),!0}catch{return!1}},h.IPv6.networkAddressFromCIDR=function(p){let d,m,y,g,x;try{for(d=this.parseCIDR(p),y=d[0].toByteArray(),x=this.subnetMaskFromPrefixLength(d[1]).toByteArray(),g=[],m=0;m<16;)g.push(parseInt(y[m],10)&parseInt(x[m],10)),m++;return new this(g)}catch(b){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${b})`)}},h.IPv6.parse=function(p){let d=this.parser(p);if(d.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(d.parts,d.zoneId)},h.IPv6.parseCIDR=function(p){let d,m,y;if((m=p.match(/^(.+)\/(\d+)$/))&&(d=parseInt(m[2]),d>=0&&d<=128))return y=[this.parse(m[1]),d],Object.defineProperty(y,"toString",{value:function(){return this.join("/")}}),y;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},h.IPv6.parser=function(p){let d,m,y,g,x,b;if(y=p.match(a.deprecatedTransitional))return this.parser(`::ffff:${y[1]}`);if(a.native.test(p))return c(p,8);if((y=p.match(a.transitional))&&(b=y[6]||"",d=c(y[1].slice(0,-1)+b,6),d.parts)){for(x=[parseInt(y[2]),parseInt(y[3]),parseInt(y[4]),parseInt(y[5])],m=0;m<x.length;m++)if(g=x[m],!(0<=g&&g<=255))return null;return d.parts.push(x[0]<<8|x[1]),d.parts.push(x[2]<<8|x[3]),{parts:d.parts,zoneId:d.zoneId}}return null},h.IPv6.subnetMaskFromPrefixLength=function(p){if(p=parseInt(p),p<0||p>128)throw new Error("ipaddr: invalid IPv6 prefix length");let d=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],m=0,y=Math.floor(p/8);for(;m<y;)d[m]=255,m++;return y<16&&(d[y]=Math.pow(2,p%8)-1<<8-p%8),new this(d)},h.fromByteArray=function(p){let d=p.length;if(d===4)return new h.IPv4(p);if(d===16)return new h.IPv6(p);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},h.isValid=function(p){return h.IPv6.isValid(p)||h.IPv4.isValid(p)},h.parse=function(p){if(h.IPv6.isValid(p))return h.IPv6.parse(p);if(h.IPv4.isValid(p))return h.IPv4.parse(p);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},h.parseCIDR=function(p){try{return h.IPv6.parseCIDR(p)}catch{try{return h.IPv4.parseCIDR(p)}catch{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},h.process=function(p){let d=this.parse(p);return d.kind()==="ipv6"&&d.isIPv4MappedAddress()?d.toIPv4Address():d},h.subnetMatch=function(p,d,m){let y,g,x,b;m==null&&(m="unicast");for(g in d)if(Object.prototype.hasOwnProperty.call(d,g)){for(x=d[g],x[0]&&!(x[0]instanceof Array)&&(x=[x]),y=0;y<x.length;y++)if(b=x[y],p.kind()===b[0].kind()&&p.match.apply(p,b))return g}return m},typeof jo<"u"&&jo.exports?jo.exports=h:e.ipaddr=h})(Up)});var rm=V((VB,em)=>{"use strict";em.exports=tm;var Qw=xu(),Yr=tm.prototype,Xw=new Date%1e9;function Zw(){return(Math.random()*1e9>>>0)+Xw++}function tm(e){e=e||{},this.id=e.id||Zw(),this.max=e.max||1/0,this.items=e.items||[],this._lookup={},this.size=this.items.length,this.lastModified=new Date(e.lastModified||new Date);for(var t,r,n=this.items.length;n--;)t=this.items[n],r=new Date(t.expires)-new Date,this._lookup[t.key]=t,r>0?this.expire(t.key,r):r<=0&&this.delete(t.key)}Yr.has=function(e){return e in this._lookup};Yr.get=function(e){if(!this.has(e))return null;var t=this._lookup[e];return t.refresh&&this.expire(e,t.refresh),this.items.splice(this.items.indexOf(t),1),this.items.push(t),t.value};Yr.meta=function(e){if(!this.has(e))return null;var t=this._lookup[e];return"meta"in t?t.meta:null};Yr.set=function(e,t,r){var n=this._lookup[e],i=this._lookup[e]={key:e,value:t};return this.lastModified=new Date,n?(clearTimeout(n.timeout),this.items.splice(this.items.indexOf(n),1,i)):(this.size>=this.max&&this.delete(this.items[0].key),this.items.push(i),this.size++),r&&("ttl"in r&&this.expire(e,r.ttl),"meta"in r&&(i.meta=r.meta),r.refresh&&(i.refresh=r.ttl)),this};Yr.delete=function(e){var t=this._lookup[e];return t?(this.lastModified=new Date,this.items.splice(this.items.indexOf(t),1),clearTimeout(t.timeout),delete this._lookup[e],this.size--,this):!1};Yr.expire=function(e,t){var r=t||0,n=this._lookup[e];if(!n)return this;if(typeof r=="string"&&(r=Qw(t)),typeof r!="number")throw new TypeError("Expiration time must be a string or number.");return clearTimeout(n.timeout),n.timeout=setTimeout(this.delete.bind(this,n.key),r),n.expires=Number(new Date)+r,this};Yr.clear=function(){for(var e=this.items.length;e--;)this.delete(this.items[e].key);return this};Yr.toJSON=function(){for(var e=new Array(this.items.length),t,r=e.length;r--;)t=this.items[r],e[r]={key:t.key,meta:t.meta,value:t.value,expires:t.expires,refresh:t.refresh};return{id:this.id,max:isFinite(this.max)?this.max:void 0,lastModified:this.lastModified,items:e}}});var ys=V((iL,cm)=>{cm.exports=class{constructor(t={}){this.points=t.points,this.duration=t.duration,this.blockDuration=t.blockDuration,this.execEvenly=t.execEvenly,this.execEvenlyMinDelayMs=t.execEvenlyMinDelayMs,this.keyPrefix=t.keyPrefix}get points(){return this._points}set points(t){this._points=t>=0?t:4}get duration(){return this._duration}set duration(t){this._duration=typeof t>"u"?1:t}get msDuration(){return this.duration*1e3}get blockDuration(){return this._blockDuration}set blockDuration(t){this._blockDuration=typeof t>"u"?0:t}get msBlockDuration(){return this.blockDuration*1e3}get execEvenly(){return this._execEvenly}set execEvenly(t){this._execEvenly=typeof t>"u"?!1:!!t}get execEvenlyMinDelayMs(){return this._execEvenlyMinDelayMs}set execEvenlyMinDelayMs(t){this._execEvenlyMinDelayMs=typeof t>"u"?Math.ceil(this.msDuration/this.points):t}get keyPrefix(){return this._keyPrefix}set keyPrefix(t){if(typeof t>"u"&&(t="rlflx"),typeof t!="string")throw new Error("keyPrefix must be string");this._keyPrefix=t}_getKeySecDuration(t={}){return t&&t.customDuration>=0?t.customDuration:this.duration}getKey(t){return this.keyPrefix.length>0?`${this.keyPrefix}:${t}`:t}parseKey(t){return t.substring(this.keyPrefix.length)}consume(){throw new Error("You have to implement the method 'consume'!")}penalty(){throw new Error("You have to implement the method 'penalty'!")}reward(){throw new Error("You have to implement the method 'reward'!")}get(){throw new Error("You have to implement the method 'get'!")}set(){throw new Error("You have to implement the method 'set'!")}block(){throw new Error("You have to implement the method 'block'!")}delete(){throw new Error("You have to implement the method 'delete'!")}}});var lm=V((oL,um)=>{um.exports=class{constructor(){this._keys={},this._addedKeysAmount=0}collectExpired(){let t=Date.now();Object.keys(this._keys).forEach(r=>{this._keys[r]<=t&&delete this._keys[r]}),this._addedKeysAmount=Object.keys(this._keys).length}add(t,r){this.addMs(t,r*1e3)}addMs(t,r){this._keys[t]=Date.now()+r,this._addedKeysAmount++,this._addedKeysAmount>999&&this.collectExpired()}msBeforeExpire(t){let r=this._keys[t];if(r&&r>=Date.now()){this.collectExpired();let n=Date.now();return r>=n?r-n:0}return 0}delete(t){t?delete this._keys[t]:Object.keys(this._keys).forEach(r=>{delete this._keys[r]})}}});var hm=V((aL,fm)=>{var ev=lm();fm.exports=ev});var Se=V((uL,dm)=>{dm.exports=class{constructor(t,r,n,i){this.remainingPoints=typeof t>"u"?0:t,this.msBeforeNext=typeof r>"u"?0:r,this.consumedPoints=typeof n>"u"?0:n,this.isFirstInDuration=typeof i>"u"?!1:i}get msBeforeNext(){return this._msBeforeNext}set msBeforeNext(t){return this._msBeforeNext=t,this}get remainingPoints(){return this._remainingPoints}set remainingPoints(t){return this._remainingPoints=t,this}get consumedPoints(){return this._consumedPoints}set consumedPoints(t){return this._consumedPoints=t,this}get isFirstInDuration(){return this._isFirstInDuration}set isFirstInDuration(t){this._isFirstInDuration=!!t}_getDecoratedProperties(){return{remainingPoints:this.remainingPoints,msBeforeNext:this.msBeforeNext,consumedPoints:this.consumedPoints,isFirstInDuration:this.isFirstInDuration}}[Symbol.for("nodejs.util.inspect.custom")](){return this._getDecoratedProperties()}toString(){return JSON.stringify(this._getDecoratedProperties())}toJSON(){return this._getDecoratedProperties()}}});var Ei=V((fL,mm)=>{var Tl=ys(),rv=hm(),pm=Se();mm.exports=class extends Tl{constructor(t={}){super(t),this.inMemoryBlockOnConsumed=t.inMemoryBlockOnConsumed,this.inMemoryBlockDuration=t.inMemoryBlockDuration,this.insuranceLimiter=t.insuranceLimiter,this._inMemoryBlockedKeys=new rv}get client(){return this._client}set client(t){if(typeof t>"u")throw new Error("storeClient is not set");this._client=t}_afterConsume(t,r,n,i,s,o={}){let a=this._getRateLimiterRes(n,i,s);if(this.inMemoryBlockOnConsumed>0&&!(this.inMemoryBlockDuration>0)&&a.consumedPoints>=this.inMemoryBlockOnConsumed)return this._inMemoryBlockedKeys.addMs(n,a.msBeforeNext),a.consumedPoints>this.points?r(a):t(a);if(a.consumedPoints>this.points){let c=Promise.resolve();this.blockDuration>0&&a.consumedPoints<=this.points+i&&(a.msBeforeNext=this.msBlockDuration,c=this._block(n,a.consumedPoints,this.msBlockDuration,o)),this.inMemoryBlockOnConsumed>0&&a.consumedPoints>=this.inMemoryBlockOnConsumed&&(this._inMemoryBlockedKeys.add(n,this.inMemoryBlockDuration),a.msBeforeNext=this.msInMemoryBlockDuration),c.then(()=>{r(a)}).catch(u=>{r(u)})}else if(this.execEvenly&&a.msBeforeNext>0&&!a.isFirstInDuration){let c=Math.ceil(a.msBeforeNext/(a.remainingPoints+2));c<this.execEvenlyMinDelayMs&&(c=a.consumedPoints*this.execEvenlyMinDelayMs),setTimeout(t,c,a)}else t(a)}_handleError(t,r,n,i,s,o=!1,a={}){this.insuranceLimiter instanceof Tl?this.insuranceLimiter[r](s,o,a).then(c=>{n(c)}).catch(c=>{i(c)}):i(t)}getInMemoryBlockMsBeforeExpire(t){return this.inMemoryBlockOnConsumed>0?this._inMemoryBlockedKeys.msBeforeExpire(t):0}get inMemoryBlockOnConsumed(){return this._inMemoryBlockOnConsumed}set inMemoryBlockOnConsumed(t){if(this._inMemoryBlockOnConsumed=t?parseInt(t):0,this.inMemoryBlockOnConsumed>0&&this.points>this.inMemoryBlockOnConsumed)throw new Error('inMemoryBlockOnConsumed option must be greater or equal "points" option')}get inMemoryBlockDuration(){return this._inMemoryBlockDuration}set inMemoryBlockDuration(t){if(this._inMemoryBlockDuration=t?parseInt(t):0,this.inMemoryBlockDuration>0&&this.inMemoryBlockOnConsumed===0)throw new Error("inMemoryBlockOnConsumed option must be set up")}get msInMemoryBlockDuration(){return this._inMemoryBlockDuration*1e3}get insuranceLimiter(){return this._insuranceLimiter}set insuranceLimiter(t){if(typeof t<"u"&&!(t instanceof Tl))throw new Error("insuranceLimiter must be instance of RateLimiterAbstract");this._insuranceLimiter=t,this._insuranceLimiter&&(this._insuranceLimiter.blockDuration=this.blockDuration,this._insuranceLimiter.execEvenly=this.execEvenly)}block(t,r,n={}){let i=r*1e3;return this._block(this.getKey(t),this.points+1,i,n)}set(t,r,n,i={}){let s=(n>=0?n:this.duration)*1e3;return this._block(this.getKey(t),r,s,i)}consume(t,r=1,n={}){return new Promise((i,s)=>{let o=this.getKey(t),a=this.getInMemoryBlockMsBeforeExpire(o);if(a>0)return s(new pm(0,a));this._upsert(o,r,this._getKeySecDuration(n)*1e3,!1,n).then(c=>{this._afterConsume(i,s,o,r,c)}).catch(c=>{this._handleError(c,"consume",i,s,t,r,n)})})}penalty(t,r=1,n={}){let i=this.getKey(t);return new Promise((s,o)=>{this._upsert(i,r,this._getKeySecDuration(n)*1e3,!1,n).then(a=>{s(this._getRateLimiterRes(i,r,a))}).catch(a=>{this._handleError(a,"penalty",s,o,t,r,n)})})}reward(t,r=1,n={}){let i=this.getKey(t);return new Promise((s,o)=>{this._upsert(i,-r,this._getKeySecDuration(n)*1e3,!1,n).then(a=>{s(this._getRateLimiterRes(i,-r,a))}).catch(a=>{this._handleError(a,"reward",s,o,t,r,n)})})}get(t,r={}){let n=this.getKey(t);return new Promise((i,s)=>{this._get(n,r).then(o=>{i(o===null||typeof o>"u"?null:this._getRateLimiterRes(n,0,o))}).catch(o=>{this._handleError(o,"get",i,s,t,r)})})}delete(t,r={}){let n=this.getKey(t);return new Promise((i,s)=>{this._delete(n,r).then(o=>{this._inMemoryBlockedKeys.delete(n),i(o)}).catch(o=>{this._handleError(o,"delete",i,s,t,r)})})}deleteInMemoryBlockedAll(){this._inMemoryBlockedKeys.delete()}_getRateLimiterRes(t,r,n){throw new Error("You have to implement the method '_getRateLimiterRes'!")}_block(t,r,n,i={}){return new Promise((s,o)=>{this._upsert(t,r,n,!0,i).then(()=>{s(new pm(0,n>0?n:-1,r))}).catch(a=>{this._handleError(a,"block",s,o,this.parseKey(t),n/1e3,i)})})}_get(t,r={}){throw new Error("You have to implement the method '_get'!")}_delete(t,r={}){throw new Error("You have to implement the method '_delete'!")}_upsert(t,r,n,i=!1,s={}){throw new Error("You have to implement the method '_upsert'!")}}});var gm=V((hL,ym)=>{var nv=Ei(),iv=Se(),Bl="redis.call('set', KEYS[1], 0, 'EX', ARGV[2], 'NX') local consumed = redis.call('incrby', KEYS[1], ARGV[1]) local ttl = redis.call('pttl', KEYS[1]) if ttl == -1 then redis.call('expire', KEYS[1], ARGV[2]) ttl = 1000 * ARGV[2] end return {consumed, ttl} ",Ll=class extends nv{constructor(t){super(t),this.client=t.storeClient,this._rejectIfRedisNotReady=!!t.rejectIfRedisNotReady,this.useRedisPackage=t.useRedisPackage||this.client.constructor.name==="Commander"||!1,this.useRedis3AndLowerPackage=t.useRedis3AndLowerPackage,typeof this.client.defineCommand=="function"&&this.client.defineCommand("rlflxIncr",{numberOfKeys:1,lua:Bl})}_isRedisReady(){return this._rejectIfRedisNotReady?!(this.client.status&&this.client.status!=="ready"||typeof this.client.isReady=="function"&&!this.client.isReady()):!0}_getRateLimiterRes(t,r,n){let[i,s]=n;Array.isArray(i)&&([,i]=i,[,s]=s);let o=new iv;return o.consumedPoints=parseInt(i),o.isFirstInDuration=o.consumedPoints===r,o.remainingPoints=Math.max(this.points-o.consumedPoints,0),o.msBeforeNext=s,o}async _upsert(t,r,n,i=!1){if(!this._isRedisReady())throw new Error("Redis connection is not ready");let s=Math.floor(n/1e3),o=this.client.multi();return i?(s>0?!this.useRedisPackage&&!this.useRedis3AndLowerPackage?o.set(t,r,"EX",s):o.set(t,r,{EX:s}):o.set(t,r),!this.useRedisPackage&&!this.useRedis3AndLowerPackage?o.pttl(t).exec(!0):o.pTTL(t).exec(!0)):s>0?!this.useRedisPackage&&!this.useRedis3AndLowerPackage?this.client.rlflxIncr([t].concat([String(r),String(s)])):this.useRedis3AndLowerPackage?new Promise((a,c)=>{let u=function(l,f){return l?c(l):a(f)};typeof this.client.rlflxIncr=="function"?this.client.rlflxIncr(t,r,s,u):this.client.eval(Bl,1,t,r,s,u)}):this.client.eval(Bl,{keys:[t],arguments:[String(r),String(s)]}):!this.useRedisPackage&&!this.useRedis3AndLowerPackage?o.incrby(t,r).pttl(t).exec(!0):o.incrBy(t,r).pTTL(t).exec(!0)}async _get(t){if(!this._isRedisReady())throw new Error("Redis connection is not ready");return!this.useRedisPackage&&!this.useRedis3AndLowerPackage?this.client.multi().get(t).pttl(t).exec().then(r=>{let[[,n]]=r;return n===null?null:r}):this.client.multi().get(t).pTTL(t).exec(!0).then(r=>{let[n]=r;return n===null?null:r})}_delete(t){return this.client.del(t).then(r=>r>0)}};ym.exports=Ll});var bm=V((dL,Em)=>{var sv=Ei(),ov=Se();function xm(e){try{let t=e.client?e.client:e,{version:r}=t.topology.s.options.metadata.driver,n=r.split(".").map(i=>parseInt(i));return{major:n[0],feature:n[1],patch:n[2]}}catch{return{major:0,feature:0,patch:0}}}var Pl=class e extends sv{constructor(t){super(t),this.dbName=t.dbName,this.tableName=t.tableName,this.indexKeyPrefix=t.indexKeyPrefix,t.mongo?this.client=t.mongo:this.client=t.storeClient,typeof this.client.then=="function"?this.client.then(r=>{this.client=r,this._initCollection(),this._driverVersion=xm(this.client)}):(this._initCollection(),this._driverVersion=xm(this.client))}get dbName(){return this._dbName}set dbName(t){this._dbName=typeof t>"u"?e.getDbName():t}static getDbName(){return"node-rate-limiter-flexible"}get tableName(){return this._tableName}set tableName(t){this._tableName=typeof t>"u"?this.keyPrefix:t}get client(){return this._client}set client(t){if(typeof t>"u")throw new Error("mongo is not set");this._client=t}get indexKeyPrefix(){return this._indexKeyPrefix}set indexKeyPrefix(t){this._indexKeyPrefix=t||{}}_initCollection(){let r=(typeof this.client.db=="function"?this.client.db(this.dbName):this.client).collection(this.tableName);r.createIndex({expire:-1},{expireAfterSeconds:0}),r.createIndex(Object.assign({},this.indexKeyPrefix,{key:1}),{unique:!0}),this._collection=r}_getRateLimiterRes(t,r,n){let i=new ov,s;return typeof n.value>"u"?s=n:s=n.value,i.isFirstInDuration=s.points===r,i.consumedPoints=s.points,i.remainingPoints=Math.max(this.points-i.consumedPoints,0),i.msBeforeNext=s.expire!==null?Math.max(new Date(s.expire).getTime()-Date.now(),0):-1,i}_upsert(t,r,n,i=!1,s={}){if(!this._collection)return Promise.reject(Error("Mongo connection is not established"));let o=s.attrs||{},a,c;i?(a={key:t},a=Object.assign(a,o),c={$set:{key:t,points:r,expire:n>0?new Date(Date.now()+n):null}},c.$set=Object.assign(c.$set,o)):(a={$or:[{expire:{$gt:new Date}},{expire:{$eq:null}}],key:t},a=Object.assign(a,o),c={$setOnInsert:{key:t,expire:n>0?new Date(Date.now()+n):null},$inc:{points:r}},c.$setOnInsert=Object.assign(c.$setOnInsert,o));let u={upsert:!0};return this._driverVersion.major>=4||this._driverVersion.major===3&&this._driverVersion.feature>=7||this._driverVersion.feature>=6&&this._driverVersion.patch>=7?u.returnDocument="after":u.returnOriginal=!1,new Promise((l,f)=>{this._collection.findOneAndUpdate(a,c,u).then(h=>{l(h)}).catch(h=>{if(h&&h.code===11e3){let p=Object.assign({$or:[{expire:{$lte:new Date}},{expire:{$eq:null}}],key:t},o),d={$set:Object.assign({key:t,points:r,expire:n>0?new Date(Date.now()+n):null},o)};this._collection.findOneAndUpdate(p,d,u).then(m=>{l(m)}).catch(m=>{m&&m.code===11e3?this._upsert(t,r,n,i).then(y=>l(y)).catch(y=>f(y)):f(m)})}else f(h)})})}_get(t,r={}){if(!this._collection)return Promise.reject(Error("Mongo connection is not established"));let n=r.attrs||{},i=Object.assign({key:t,$or:[{expire:{$gt:new Date}},{expire:{$eq:null}}]},n);return this._collection.findOne(i)}_delete(t,r={}){if(!this._collection)return Promise.reject(Error("Mongo connection is not established"));let n=r.attrs||{},i=Object.assign({key:t},n);return this._collection.deleteOne(i).then(s=>s.deletedCount>0)}};Em.exports=Pl});var vm=V((pL,wm)=>{var av=Ei(),cv=Se(),Dl=class extends av{constructor(t,r=null){super(t),this.client=t.storeClient,this.clientType=t.storeType,this.dbName=t.dbName,this.tableName=t.tableName,this.clearExpiredByTimeout=t.clearExpiredByTimeout,this.tableCreated=t.tableCreated,this.tableCreated?(this.clearExpiredByTimeout&&this._clearExpiredHourAgo(),typeof r=="function"&&r()):this._createDbAndTable().then(()=>{this.tableCreated=!0,this.clearExpiredByTimeout&&this._clearExpiredHourAgo(),typeof r=="function"&&r()}).catch(n=>{if(typeof r=="function")r(n);else throw n})}clearExpired(t){return new Promise(r=>{this._getConnection().then(n=>{n.query("DELETE FROM ??.?? WHERE expire < ?",[this.dbName,this.tableName,t],()=>{this._releaseConnection(n),r()})}).catch(()=>{r()})})}_clearExpiredHourAgo(){this._clearExpiredTimeoutId&&clearTimeout(this._clearExpiredTimeoutId),this._clearExpiredTimeoutId=setTimeout(()=>{this.clearExpired(Date.now()-36e5).then(()=>{this._clearExpiredHourAgo()})},3e5),this._clearExpiredTimeoutId.unref()}_getConnection(){switch(this.clientType){case"pool":return new Promise((t,r)=>{this.client.getConnection((n,i)=>{if(n)return r(n);t(i)})});case"sequelize":return this.client.connectionManager.getConnection();case"knex":return this.client.client.acquireConnection();default:return Promise.resolve(this.client)}}_releaseConnection(t){switch(this.clientType){case"pool":return t.release();case"sequelize":return this.client.connectionManager.releaseConnection(t);case"knex":return this.client.client.releaseConnection(t);default:return!0}}_createDbAndTable(){return new Promise((t,r)=>{this._getConnection().then(n=>{n.query(`CREATE DATABASE IF NOT EXISTS \`${this.dbName}\`;`,i=>{if(i)return this._releaseConnection(n),r(i);n.query(this._getCreateTableStmt(),s=>{if(s)return this._releaseConnection(n),r(s);this._releaseConnection(n),t()})})}).catch(n=>{r(n)})})}_getCreateTableStmt(){return`CREATE TABLE IF NOT EXISTS \`${this.dbName}\`.\`${this.tableName}\` (\`key\` VARCHAR(255) CHARACTER SET utf8 NOT NULL,\`points\` INT(9) NOT NULL default 0,\`expire\` BIGINT UNSIGNED,PRIMARY KEY (\`key\`)) ENGINE = INNODB;`}get clientType(){return this._clientType}set clientType(t){if(typeof t>"u")if(this.client.constructor.name==="Connection")t="connection";else if(this.client.constructor.name==="Pool")t="pool";else if(this.client.constructor.name==="Sequelize")t="sequelize";else throw new Error("storeType is not defined");this._clientType=t.toLowerCase()}get dbName(){return this._dbName}set dbName(t){this._dbName=typeof t>"u"?"rtlmtrflx":t}get tableName(){return this._tableName}set tableName(t){this._tableName=typeof t>"u"?this.keyPrefix:t}get tableCreated(){return this._tableCreated}set tableCreated(t){this._tableCreated=typeof t>"u"?!1:!!t}get clearExpiredByTimeout(){return this._clearExpiredByTimeout}set clearExpiredByTimeout(t){this._clearExpiredByTimeout=typeof t>"u"?!0:!!t}_getRateLimiterRes(t,r,n){let i=new cv,[s]=n;return i.isFirstInDuration=r===s.points,i.consumedPoints=i.isFirstInDuration?r:s.points,i.remainingPoints=Math.max(this.points-i.consumedPoints,0),i.msBeforeNext=s.expire?Math.max(s.expire-Date.now(),0):-1,i}_upsertTransaction(t,r,n,i,s){return new Promise((o,a)=>{t.query("BEGIN",c=>{if(c)return t.rollback(),a(c);let u=Date.now(),l=i>0?u+i:null,f,h;s?(f=`INSERT INTO ??.?? VALUES (?, ?, ?)
|
|
16
16
|
ON DUPLICATE KEY UPDATE
|
|
17
17
|
points = ?,
|
|
18
18
|
expire = ?;`,h=[this.dbName,this.tableName,r,n,l,n,l]):(f=`INSERT INTO ??.?? VALUES (?, ?, ?)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const PROTOCOL_VERSION = "ipfs/0.1.0";
|
|
2
|
-
export declare const AGENT_VERSION = "js-libp2p/0.46.
|
|
2
|
+
export declare const AGENT_VERSION = "js-libp2p/0.46.21-0f5c305af";
|
|
3
3
|
export declare const MULTICODEC_IDENTIFY = "/ipfs/id/1.0.0";
|
|
4
4
|
export declare const MULTICODEC_IDENTIFY_PUSH = "/ipfs/id/push/1.0.0";
|
|
5
5
|
export declare const IDENTIFY_PROTOCOL_VERSION = "0.1.0";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../../../src/identify/consts.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB,eAAe,CAAA;AAC5C,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../../../src/identify/consts.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB,eAAe,CAAA;AAC5C,eAAO,MAAM,aAAa,gCAAyB,CAAA;AACnD,eAAO,MAAM,mBAAmB,mBAAmB,CAAA;AACnD,eAAO,MAAM,wBAAwB,wBAAwB,CAAA;AAE7D,eAAO,MAAM,yBAAyB,UAAU,CAAA;AAChD,eAAO,MAAM,iCAAiC,OAAO,CAAA;AACrD,eAAO,MAAM,sCAAsC,YAAY,CAAA;AAC/D,eAAO,MAAM,oCAAoC,UAAU,CAAA;AAC3D,eAAO,MAAM,yCAAyC,UAAU,CAAA"}
|
package/dist/src/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,sBAAsB,CAAA;AAC1C,eAAO,MAAM,IAAI,WAAW,CAAA"}
|
package/dist/src/version.js
CHANGED
package/dist/src/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,mBAAmB,CAAA;AAC1C,MAAM,CAAC,MAAM,IAAI,GAAG,QAAQ,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "libp2p",
|
|
3
|
-
"version": "0.46.
|
|
3
|
+
"version": "0.46.21-0f5c305af",
|
|
4
4
|
"description": "JavaScript implementation of libp2p, a modular peer to peer network stack",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
6
|
"homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/libp2p#readme",
|
|
@@ -121,18 +121,18 @@
|
|
|
121
121
|
},
|
|
122
122
|
"dependencies": {
|
|
123
123
|
"@achingbrain/nat-port-mapper": "^1.0.9",
|
|
124
|
-
"@libp2p/crypto": "
|
|
125
|
-
"@libp2p/interface": "
|
|
126
|
-
"@libp2p/interface-internal": "
|
|
127
|
-
"@libp2p/keychain": "
|
|
128
|
-
"@libp2p/logger": "
|
|
129
|
-
"@libp2p/multistream-select": "
|
|
130
|
-
"@libp2p/peer-collections": "
|
|
131
|
-
"@libp2p/peer-id": "
|
|
132
|
-
"@libp2p/peer-id-factory": "
|
|
133
|
-
"@libp2p/peer-record": "
|
|
134
|
-
"@libp2p/peer-store": "
|
|
135
|
-
"@libp2p/utils": "
|
|
124
|
+
"@libp2p/crypto": "2.0.8-0f5c305af",
|
|
125
|
+
"@libp2p/interface": "0.1.6-0f5c305af",
|
|
126
|
+
"@libp2p/interface-internal": "0.1.9-0f5c305af",
|
|
127
|
+
"@libp2p/keychain": "3.0.8-0f5c305af",
|
|
128
|
+
"@libp2p/logger": "3.1.0-0f5c305af",
|
|
129
|
+
"@libp2p/multistream-select": "4.0.6-0f5c305af",
|
|
130
|
+
"@libp2p/peer-collections": "4.0.8-0f5c305af",
|
|
131
|
+
"@libp2p/peer-id": "3.0.6-0f5c305af",
|
|
132
|
+
"@libp2p/peer-id-factory": "3.0.8-0f5c305af",
|
|
133
|
+
"@libp2p/peer-record": "6.0.9-0f5c305af",
|
|
134
|
+
"@libp2p/peer-store": "9.0.9-0f5c305af",
|
|
135
|
+
"@libp2p/utils": "4.0.7-0f5c305af",
|
|
136
136
|
"@multiformats/mafmt": "^12.1.2",
|
|
137
137
|
"@multiformats/multiaddr": "^12.1.5",
|
|
138
138
|
"@multiformats/multiaddr-matcher": "^1.0.0",
|
|
@@ -170,17 +170,17 @@
|
|
|
170
170
|
"@chainsafe/libp2p-gossipsub": "^10.0.0",
|
|
171
171
|
"@chainsafe/libp2p-noise": "^13.0.0",
|
|
172
172
|
"@chainsafe/libp2p-yamux": "^5.0.0",
|
|
173
|
-
"@libp2p/bootstrap": "
|
|
173
|
+
"@libp2p/bootstrap": "9.0.12-0f5c305af",
|
|
174
174
|
"@libp2p/daemon-client": "^7.0.0",
|
|
175
175
|
"@libp2p/daemon-server": "^6.0.0",
|
|
176
|
-
"@libp2p/floodsub": "
|
|
177
|
-
"@libp2p/interface-compliance-tests": "
|
|
176
|
+
"@libp2p/floodsub": "8.0.13-0f5c305af",
|
|
177
|
+
"@libp2p/interface-compliance-tests": "4.1.5-0f5c305af",
|
|
178
178
|
"@libp2p/interop": "^9.0.0",
|
|
179
|
-
"@libp2p/kad-dht": "
|
|
180
|
-
"@libp2p/mdns": "
|
|
181
|
-
"@libp2p/mplex": "
|
|
182
|
-
"@libp2p/tcp": "
|
|
183
|
-
"@libp2p/websockets": "
|
|
179
|
+
"@libp2p/kad-dht": "10.0.15-0f5c305af",
|
|
180
|
+
"@libp2p/mdns": "9.0.14-0f5c305af",
|
|
181
|
+
"@libp2p/mplex": "9.0.12-0f5c305af",
|
|
182
|
+
"@libp2p/tcp": "8.0.13-0f5c305af",
|
|
183
|
+
"@libp2p/websockets": "7.0.13-0f5c305af",
|
|
184
184
|
"@types/xsalsa20": "^1.1.0",
|
|
185
185
|
"aegir": "^41.0.2",
|
|
186
186
|
"execa": "^8.0.1",
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const version = '0.46.
|
|
1
|
+
export const version = '0.46.21-0f5c305af'
|
|
2
2
|
export const name = 'libp2p'
|
package/dist/typedoc-urls.json
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"AutoNATComponents": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.autonat.AutoNATComponents.html",
|
|
3
|
-
"./autonat:AutoNATComponents": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.autonat.AutoNATComponents.html",
|
|
4
|
-
"AutoNATServiceInit": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.autonat.AutoNATServiceInit.html",
|
|
5
|
-
"./autonat:AutoNATServiceInit": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.autonat.AutoNATServiceInit.html",
|
|
6
|
-
"autoNATService": "https://libp2p.github.io/js-libp2p/functions/libp2p.autonat.autoNATService.html",
|
|
7
|
-
"./autonat:autoNATService": "https://libp2p.github.io/js-libp2p/functions/libp2p.autonat.autoNATService.html",
|
|
8
|
-
"CircuitRelayService": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.circuit_relay.CircuitRelayService.html",
|
|
9
|
-
"./circuit-relay:CircuitRelayService": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.circuit_relay.CircuitRelayService.html",
|
|
10
|
-
"CircuitRelayServiceEvents": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.circuit_relay.CircuitRelayServiceEvents.html",
|
|
11
|
-
"./circuit-relay:CircuitRelayServiceEvents": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.circuit_relay.CircuitRelayServiceEvents.html",
|
|
12
|
-
"RelayReservation": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.circuit_relay.RelayReservation.html",
|
|
13
|
-
"./circuit-relay:RelayReservation": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.circuit_relay.RelayReservation.html",
|
|
14
|
-
"circuitRelayServer": "https://libp2p.github.io/js-libp2p/functions/libp2p.circuit_relay.circuitRelayServer.html",
|
|
15
|
-
"circuitRelayTransport": "https://libp2p.github.io/js-libp2p/functions/libp2p.circuit_relay.circuitRelayTransport.html",
|
|
16
|
-
"FetchService": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.fetch.FetchService.html",
|
|
17
|
-
"./fetch:FetchService": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.fetch.FetchService.html",
|
|
18
|
-
"FetchServiceComponents": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.fetch.FetchServiceComponents.html",
|
|
19
|
-
"./fetch:FetchServiceComponents": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.fetch.FetchServiceComponents.html",
|
|
20
|
-
"FetchServiceInit": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.fetch.FetchServiceInit.html",
|
|
21
|
-
"./fetch:FetchServiceInit": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.fetch.FetchServiceInit.html",
|
|
22
|
-
"HandleMessageOptions": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.fetch.HandleMessageOptions.html",
|
|
23
|
-
"./fetch:HandleMessageOptions": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.fetch.HandleMessageOptions.html",
|
|
24
|
-
"LookupFunction": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.fetch.LookupFunction.html",
|
|
25
|
-
"./fetch:LookupFunction": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.fetch.LookupFunction.html",
|
|
26
|
-
"fetchService": "https://libp2p.github.io/js-libp2p/functions/libp2p.fetch.fetchService-1.html",
|
|
27
|
-
"./fetch:fetchService": "https://libp2p.github.io/js-libp2p/functions/libp2p.fetch.fetchService-1.html",
|
|
28
|
-
"IdentifyService": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.identify.IdentifyService.html",
|
|
29
|
-
"./identify:IdentifyService": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.identify.IdentifyService.html",
|
|
30
|
-
"IdentifyServiceComponents": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.identify.IdentifyServiceComponents.html",
|
|
31
|
-
"./identify:IdentifyServiceComponents": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.identify.IdentifyServiceComponents.html",
|
|
32
|
-
"IdentifyServiceInit": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.identify.IdentifyServiceInit.html",
|
|
33
|
-
"./identify:IdentifyServiceInit": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.identify.IdentifyServiceInit.html",
|
|
34
|
-
"Message": "https://libp2p.github.io/js-libp2p/variables/libp2p.identify.Message.html",
|
|
35
|
-
"./identify:Message": "https://libp2p.github.io/js-libp2p/variables/libp2p.identify.Message.html",
|
|
36
|
-
"multicodecs": "https://libp2p.github.io/js-libp2p/variables/libp2p.identify.multicodecs.html",
|
|
37
|
-
"./identify:multicodecs": "https://libp2p.github.io/js-libp2p/variables/libp2p.identify.multicodecs.html",
|
|
38
|
-
"identifyService": "https://libp2p.github.io/js-libp2p/functions/libp2p.identify.identifyService-1.html",
|
|
39
|
-
"./identify:identifyService": "https://libp2p.github.io/js-libp2p/functions/libp2p.identify.identifyService-1.html",
|
|
40
|
-
"Libp2pInit": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.index.Libp2pInit.html",
|
|
41
|
-
".:Libp2pInit": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.index.Libp2pInit.html",
|
|
42
|
-
"Libp2pOptions": "https://libp2p.github.io/js-libp2p/types/libp2p.index.Libp2pOptions.html",
|
|
43
|
-
".:Libp2pOptions": "https://libp2p.github.io/js-libp2p/types/libp2p.index.Libp2pOptions.html",
|
|
44
|
-
"ServiceFactoryMap": "https://libp2p.github.io/js-libp2p/types/libp2p.index.ServiceFactoryMap.html",
|
|
45
|
-
".:ServiceFactoryMap": "https://libp2p.github.io/js-libp2p/types/libp2p.index.ServiceFactoryMap.html",
|
|
46
|
-
"createLibp2p": "https://libp2p.github.io/js-libp2p/functions/libp2p.index.createLibp2p.html",
|
|
47
|
-
".:createLibp2p": "https://libp2p.github.io/js-libp2p/functions/libp2p.index.createLibp2p.html",
|
|
48
|
-
"plaintext": "https://libp2p.github.io/js-libp2p/functions/libp2p.insecure.plaintext.html",
|
|
49
|
-
"./insecure:plaintext": "https://libp2p.github.io/js-libp2p/functions/libp2p.insecure.plaintext.html",
|
|
50
|
-
"PingService": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.ping.PingService.html",
|
|
51
|
-
"./ping:PingService": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.ping.PingService.html",
|
|
52
|
-
"PingServiceComponents": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.ping.PingServiceComponents.html",
|
|
53
|
-
"./ping:PingServiceComponents": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.ping.PingServiceComponents.html",
|
|
54
|
-
"PingServiceInit": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.ping.PingServiceInit.html",
|
|
55
|
-
"./ping:PingServiceInit": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.ping.PingServiceInit.html",
|
|
56
|
-
"pingService": "https://libp2p.github.io/js-libp2p/functions/libp2p.ping.pingService-1.html",
|
|
57
|
-
"./ping:pingService": "https://libp2p.github.io/js-libp2p/functions/libp2p.ping.pingService-1.html",
|
|
58
|
-
"ProtectorInit": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.pnet.ProtectorInit.html",
|
|
59
|
-
"./pnet:ProtectorInit": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.pnet.ProtectorInit.html",
|
|
60
|
-
"generateKey": "https://libp2p.github.io/js-libp2p/functions/libp2p.pnet.generateKey.html",
|
|
61
|
-
"preSharedKey": "https://libp2p.github.io/js-libp2p/functions/libp2p.pnet.preSharedKey.html",
|
|
62
|
-
"./pnet:preSharedKey": "https://libp2p.github.io/js-libp2p/functions/libp2p.pnet.preSharedKey.html",
|
|
63
|
-
"PMPOptions": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.upnp_nat.PMPOptions.html",
|
|
64
|
-
"./upnp-nat:PMPOptions": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.upnp_nat.PMPOptions.html",
|
|
65
|
-
"UPnPNATComponents": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.upnp_nat.UPnPNATComponents.html",
|
|
66
|
-
"./upnp-nat:UPnPNATComponents": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.upnp_nat.UPnPNATComponents.html",
|
|
67
|
-
"UPnPNATInit": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.upnp_nat.UPnPNATInit.html",
|
|
68
|
-
"./upnp-nat:UPnPNATInit": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.upnp_nat.UPnPNATInit.html",
|
|
69
|
-
"uPnPNATService": "https://libp2p.github.io/js-libp2p/functions/libp2p.upnp_nat.uPnPNATService.html",
|
|
70
|
-
"./upnp-nat:uPnPNATService": "https://libp2p.github.io/js-libp2p/functions/libp2p.upnp_nat.uPnPNATService.html"
|
|
71
|
-
}
|